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

Unified Diff: chrome/test/functional/extensions.py

Issue 8587004: Add PyAuto tests for triggering browser/page action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style change Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/functional/extensions.py
diff --git a/chrome/test/functional/extensions.py b/chrome/test/functional/extensions.py
index c949a71d5e3a266a8834852c2dede4cbd659b98d..a23553a4020b188af6190cda069d0778fcce409f 100644
--- a/chrome/test/functional/extensions.py
+++ b/chrome/test/functional/extensions.py
@@ -182,6 +182,43 @@ class ExtensionsTest(pyauto.PyUITest):
extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
self.assertFalse(extension['allowed_in_incognito'])
+ def testTriggerBrowserAction(self):
+ """Test triggering browser action."""
+ dir_path = os.path.abspath(
+ os.path.join(self.DataDir(), 'extensions', 'trigger_actions',
+ 'browser_action'))
+ ext_id = self.InstallExtension(dir_path, False);
+ self.assertTrue(ext_id, msg='Failed to install extension: %s.' % dir_path)
+
+ self.NavigateToURL(self.GetFileURLForDataPath(
+ 'frame_dom_access', 'frame_dom_access.html'))
+
+ self.TriggerExtensionActionById(ext_id)
+
+ # Verify that the browser action turned the background red.
+ self.assertTrue(self.WaitUntil(
+ lambda: self.GetDOMValue('document.body.style.backgroundColor'),
+ expect_retval='red'))
dennis_jeffrey 2011/11/17 00:11:32 add a second parameter to the assert: msg='Browse
frankf 2011/11/17 00:25:03 Done.
+
+ def testTriggerPageAction(self):
+ """Test triggering page action."""
+ dir_path = os.path.abspath(
+ os.path.join(self.DataDir(), 'extensions', 'trigger_actions',
+ 'page_action'))
+ ext_id = self.InstallExtension(dir_path, False);
+ self.assertTrue(ext_id, msg='Failed to install extension: %s.' % dir_path)
+
+ # Page action icon is displayed when a tab is created.
dennis_jeffrey 2011/11/17 00:11:32 Is it required that the page action icon be displa
frankf 2011/11/17 00:25:03 Yes, done.
+ self.AppendTab(pyauto.GURL(self.GetFileURLForDataPath(
+ 'frame_dom_access', 'frame_dom_access.html')))
+
+ self.TriggerExtensionActionById(ext_id)
+
+ # Verify that page action turned the background red.
+ self.assertTrue(self.WaitUntil(
+ lambda: self.GetDOMValue('document.body.style.backgroundColor', 1),
dennis_jeffrey 2011/11/17 00:11:32 tab_index=1
frankf 2011/11/17 00:25:03 Done.
+ expect_retval='red'))
dennis_jeffrey 2011/11/17 00:11:32 add a second parameter to the assert: msg='Page a
frankf 2011/11/17 00:25:03 Done.
+
def testAdblockExtensionCrash(self):
"""Test AdBlock extension successfully installed and enabled, and do not
cause browser crash.

Powered by Google App Engine
This is Rietveld 408576698