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

Side by Side Diff: chrome/test/functional/execute_javascript.py

Issue 8649004: Allow chromedriver to install an extension and get all installed extension IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 import os 6 import os
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 import pyauto_functional 10 import pyauto_functional
(...skipping 19 matching lines...) Expand all
30 self.NavigateToURL(self.GetFileURLForDataPath( 30 self.NavigateToURL(self.GetFileURLForDataPath(
31 'frame_dom_access', 'frame_dom_access.html')) 31 'frame_dom_access', 'frame_dom_access.html'))
32 32
33 v = self.GetDOMValue('document.getElementById("myinput").nodeName') 33 v = self.GetDOMValue('document.getElementById("myinput").nodeName')
34 self.assertEqual(v, 'INPUT') 34 self.assertEqual(v, 'INPUT')
35 35
36 def testExecuteJavascriptInExtension(self): 36 def testExecuteJavascriptInExtension(self):
37 """Test we can inject JavaScript into an extension.""" 37 """Test we can inject JavaScript into an extension."""
38 dir_path = os.path.abspath( 38 dir_path = os.path.abspath(
39 os.path.join(self.DataDir(), 'extensions', 'js_injection_background')) 39 os.path.join(self.DataDir(), 'extensions', 'js_injection_background'))
40 ext_id = self.InstallExtension(dir_path, False); 40 ext_id = self.InstallExtension(dir_path)
41 self.assertTrue(ext_id, msg='Failed to install extension: %s.' % dir_path) 41 self.assertTrue(ext_id, msg='Failed to install extension: %s.' % dir_path)
42 42
43 # Verify extension is enabled. 43 # Verify extension is enabled.
44 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) 44 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
45 self.assertTrue(extension['is_enabled'], 45 self.assertTrue(extension['is_enabled'],
46 msg='Extension was disabled by default') 46 msg='Extension was disabled by default')
47 47
48 # Get the background page's view. 48 # Get the background page's view.
49 background_view = self.WaitUntilExtensionViewLoaded( 49 background_view = self.WaitUntilExtensionViewLoaded(
50 view_type='EXTENSION_BACKGROUND_PAGE') 50 view_type='EXTENSION_BACKGROUND_PAGE')
(...skipping 13 matching lines...) Expand all
64 v = self.ExecuteJavascriptInRenderView( 64 v = self.ExecuteJavascriptInRenderView(
65 'window.domAutomationController.send(int_var)', background_view) 65 'window.domAutomationController.send(int_var)', background_view)
66 self.assertEqual(v, 42, msg='Incorrect value returned (v = %s).' % v) 66 self.assertEqual(v, 42, msg='Incorrect value returned (v = %s).' % v)
67 v = self.ExecuteJavascriptInRenderView( 67 v = self.ExecuteJavascriptInRenderView(
68 'window.domAutomationController.send(str_var)', background_view) 68 'window.domAutomationController.send(str_var)', background_view)
69 self.assertEqual(v, 'foo', msg='Incorrect value returned (v = %s).' % v) 69 self.assertEqual(v, 'foo', msg='Incorrect value returned (v = %s).' % v)
70 70
71 71
72 if __name__ == '__main__': 72 if __name__ == '__main__':
73 pyauto_functional.Main() 73 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698