diff --git a/qubes/tests/integ/basic.py b/qubes/tests/integ/basic.py index ed8e37cc6..da63edadd 100644 --- a/qubes/tests/integ/basic.py +++ b/qubes/tests/integ/basic.py @@ -472,7 +472,10 @@ def setUp(self): super(TC_30_Gui_daemon, self).setUp() self.init_default_template() - async def _test_clipboard(self, test_string): + async def _test_clipboard(self, test_string, + set_features=None, + expect_content=None, + expect_source_name=None): testvm1 = self.app.add_new_vm( qubes.vm.appvm.AppVM, name=self.make_vm_name('vm1'), label='red') @@ -483,6 +486,9 @@ async def _test_clipboard(self, test_string): await testvm2.create_on_disk() self.app.save() + for feature, value in (set_features or {}).items(): + testvm1.features[feature] = value + await asyncio.gather( testvm1.start(), testvm2.start()) @@ -514,18 +520,23 @@ async def _test_clipboard(self, test_string): clipboard_content = \ open('/var/run/qubes/qubes-clipboard.bin', 'r').read().strip() + + if expect_content is not None: + test_string = expect_content self.assertEqual(clipboard_content, test_string, "Clipboard copy operation failed - content") + if expect_source_name is None: + expect_source_name = testvm1.name clipboard_source = \ open('/var/run/qubes/qubes-clipboard.bin.source', 'r').read().strip() - self.assertEqual(clipboard_source, testvm1.name, + self.assertEqual(clipboard_source, expect_source_name, "Clipboard copy operation failed - owner") # Then paste it to the other window window_title = 'user@{}'.format(testvm2.name) p = await testvm2.run( - 'zenity --entry --title={} > /tmp/test.txt'.format(window_title)) + 'zenity --text-info --editable --title={} > /tmp/test.txt'.format(window_title)) await self.wait_for_window_coro(window_title) subprocess.check_call(['xdotool', 'key', '--delay', '100', @@ -553,6 +564,38 @@ def test_000_clipboard(self): test_string = "test123" self.loop.run_until_complete(self._test_clipboard(test_string)) + @unittest.skipUnless( + spawn.find_executable('xdotool'), + "xdotool not installed") + def test_001_clipboard_64k(self): + test_string = "test123abc" * 6400 + self.loop.run_until_complete(self._test_clipboard(test_string)) + + @unittest.skipUnless( + spawn.find_executable('xdotool'), + "xdotool not installed") + def test_002_clipboard_200k_truncated(self): + test_string = "test123abc" * 20000 + self.loop.run_until_complete(self._test_clipboard(test_string, + expect_content="", expect_source_name="")) + + @unittest.skipUnless( + spawn.find_executable('xdotool'), + "xdotool not installed") + def test_002_clipboard_200k(self): + test_string = "test123abc" * 20000 + self.loop.run_until_complete(self._test_clipboard(test_string, + set_features={"gui-max-clipboard-size": 200_000})) + + @unittest.skipUnless( + spawn.find_executable('xdotool'), + "xdotool not installed") + def test_002_clipboard_300k(self): + test_string = "test123abc" * 30000 + self.loop.run_until_complete(self._test_clipboard(test_string, + expect_content="Qube clipboard size over 256KiB and X11 INCR " + "protocol support is not implemented!")) + class TC_05_StandaloneVMMixin(object): def setUp(self):