Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: chrome/test/chromedriver/test/run_py_tests.py

Issue 2890103002: [Chromedriver] Allow access to chrome extension within iframe. (Closed)
Patch Set: using packed extension for unique id. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """End to end tests for ChromeDriver.""" 6 """End to end tests for ChromeDriver."""
7 7
8 import base64 8 import base64
9 import json 9 import json
10 import math 10 import math
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 driver, old_handles, check_closed_windows=False) 1831 driver, old_handles, check_closed_windows=False)
1832 handles = driver.GetWindowHandles() 1832 handles = driver.GetWindowHandles()
1833 for handle in handles: 1833 for handle in handles:
1834 driver.SwitchToWindow(handle) 1834 driver.SwitchToWindow(handle)
1835 if driver.GetCurrentUrl() == 'chrome-extension://' \ 1835 if driver.GetCurrentUrl() == 'chrome-extension://' \
1836 'gegjcdcfeiojglhifpmibkadodekakpc/_generated_background_page.html': 1836 'gegjcdcfeiojglhifpmibkadodekakpc/_generated_background_page.html':
1837 self.assertEqual(42, driver.ExecuteScript('return magic;')) 1837 self.assertEqual(42, driver.ExecuteScript('return magic;'))
1838 return 1838 return
1839 self.fail("couldn't find generated background page for test app") 1839 self.fail("couldn't find generated background page for test app")
1840 1840
1841 def testIFrameWithExtensionsSource(self):
1842 crx_path = os.path.join(_TEST_DATA_DIR, 'frames_extension.crx')
1843 driver = self.CreateDriver(
1844 chrome_extensions=[self._PackExtension(crx_path)])
1845 driver.Load(
1846 ChromeDriverTest._http_server.GetUrl() +
1847 '/chromedriver/iframe_extension.html')
1848 driver.SwitchToFrame('testframe')
1849 element = driver.FindElement('id', 'p1')
1850 self.assertEqual('Its a frame with extension source', element.GetText())
1851
1841 def testDontExecuteScriptsInContentScriptContext(self): 1852 def testDontExecuteScriptsInContentScriptContext(self):
1842 # This test extension has a content script which runs in all frames (see 1853 # This test extension has a content script which runs in all frames (see
1843 # https://developer.chrome.com/extensions/content_scripts) which causes each 1854 # https://developer.chrome.com/extensions/content_scripts) which causes each
1844 # frame on the page to be associated with multiple JS execution contexts. 1855 # frame on the page to be associated with multiple JS execution contexts.
1845 # Make sure that ExecuteScript operates on the page's context, rather than 1856 # Make sure that ExecuteScript operates on the page's context, rather than
1846 # the extension's content script's one. 1857 # the extension's content script's one.
1847 extension_path = os.path.join(_TEST_DATA_DIR, 'all_frames') 1858 extension_path = os.path.join(_TEST_DATA_DIR, 'all_frames')
1848 driver = self.CreateDriver( 1859 driver = self.CreateDriver(
1849 chrome_switches=['load-extension=%s' % extension_path]) 1860 chrome_switches=['load-extension=%s' % extension_path])
1850 driver.Load( 1861 driver.Load(
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 2485
2475 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 2486 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
2476 sys.modules[__name__]) 2487 sys.modules[__name__])
2477 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) 2488 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
2478 ChromeDriverTest.GlobalSetUp() 2489 ChromeDriverTest.GlobalSetUp()
2479 MobileEmulationCapabilityTest.GlobalSetUp() 2490 MobileEmulationCapabilityTest.GlobalSetUp()
2480 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) 2491 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests)
2481 ChromeDriverTest.GlobalTearDown() 2492 ChromeDriverTest.GlobalTearDown()
2482 MobileEmulationCapabilityTest.GlobalTearDown() 2493 MobileEmulationCapabilityTest.GlobalTearDown()
2483 sys.exit(len(result.failures) + len(result.errors)) 2494 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chrome/test/data/chromedriver/frames_extension.crx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698