diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 19:44:14 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 19:44:14 +0000 |
commit | cb37d4830e2ab67e9151bba115bf05c11cf1da42 (patch) | |
tree | ce6ce00523ff7b7e7f8d73890321f3a66c3c62d5 /chrome/test/functional/popups.py | |
parent | a6a1ee832e13ea90790da610ef1a884854e96e01 (diff) | |
download | chromium_src-cb37d4830e2ab67e9151bba115bf05c11cf1da42.zip chromium_src-cb37d4830e2ab67e9151bba115bf05c11cf1da42.tar.gz chromium_src-cb37d4830e2ab67e9151bba115bf05c11cf1da42.tar.bz2 |
PyAuto automation support for blocked popups
Add PyAuto automation hooks for fetching info about blocked popups in a tab,
and launching a blocked popup.
BUG=55889
TEST=popups.py
Review URL: http://codereview.chromium.org/3688004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional/popups.py')
-rw-r--r-- | chrome/test/functional/popups.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/test/functional/popups.py b/chrome/test/functional/popups.py new file mode 100644 index 0000000..48b9831 --- /dev/null +++ b/chrome/test/functional/popups.py @@ -0,0 +1,54 @@ +#!/usr/bin/python + +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os + +import pyauto_functional # Must be imported before pyauto +import pyauto + + +class PopupsTest(pyauto.PyUITest): + """TestCase for Popup blocking.""" + + def Debug(self): + """Test method for experimentation. + + This method will not run automatically. + """ + import pprint + pp = pprint.PrettyPrinter(indent=2) + while True: + raw_input('Interact with the browser and hit <enter>') + pp.pprint(self.GetBlockedPopupsInfo()) + + def testPopupBlockerEnabled(self): + """Verify popup blocking is enabled.""" + self.assertFalse(self.GetBlockedPopupsInfo(), + msg='Should have no blocked popups on startup') + file_url = self.GetFileURLForPath(os.path.join( + self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) + self.NavigateToURL(file_url) + blocked_popups = self.GetBlockedPopupsInfo() + self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') + self.assertEqual('Popup Success!', blocked_popups[0]['title']) + + def testLaunchBlockedPopup(self): + """Verify that a blocked popup can be unblocked.""" + file_url = self.GetFileURLForPath(os.path.join( + self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) + self.NavigateToURL(file_url) + self.assertEqual(1, len(self.GetBlockedPopupsInfo())) + self.UnblockAndLaunchBlockedPopup(0) + # Verify that no more popups are blocked + self.assertFalse(self.GetBlockedPopupsInfo()) + # Verify that popup window was created + self.assertEqual(2, self.GetBrowserWindowCount(), + msg='Popup could not be launched'); + self.assertEqual('Popup Success!', self.GetActiveTabTitle(1)) + + +if __name__ == '__main__': + pyauto_functional.Main() |