summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional
diff options
context:
space:
mode:
authordyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-17 01:19:55 +0000
committerdyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-17 01:19:55 +0000
commitf4d62d69d1024bb613273a87507e2ed1a6c8fa46 (patch)
tree8b98672e9bbefb07844acd4f698b1ce017f75b22 /chrome/test/functional
parent447c2a9ab2d12fdff6a58d8bb8500c2c505dfbe0 (diff)
downloadchromium_src-f4d62d69d1024bb613273a87507e2ed1a6c8fa46.zip
chromium_src-f4d62d69d1024bb613273a87507e2ed1a6c8fa46.tar.gz
chromium_src-f4d62d69d1024bb613273a87507e2ed1a6c8fa46.tar.bz2
Added additional content verification for App Cache and DNS special tabs pages.
BUG=none TEST=none Review URL: http://codereview.chromium.org/5692005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional')
-rw-r--r--chrome/test/functional/content.py51
-rw-r--r--chrome/test/functional/special_tabs.py52
-rw-r--r--chrome/test/functional/test_utils.py16
3 files changed, 82 insertions, 37 deletions
diff --git a/chrome/test/functional/content.py b/chrome/test/functional/content.py
index f231050..e8e5cd1 100644
--- a/chrome/test/functional/content.py
+++ b/chrome/test/functional/content.py
@@ -7,6 +7,7 @@ import os
import pyauto_functional # Must be imported before pyauto
import pyauto
+import test_utils
class ContentTest(pyauto.PyUITest):
@@ -16,17 +17,6 @@ class ContentTest(pyauto.PyUITest):
"""Return a URL in the data dir for the given filename."""
return self.GetFileURLForPath(os.path.join(self.DataDir(), filename))
- def _StringContentCheck(self, content_string, have_list, nothave_list):
- """Look for the presence or absence of strings in content.
-
- Confirm all strings in have_list are found in content_string.
- Confirm all strings in nothave_list are NOT found in content_string.
- """
- for s in have_list:
- self.assertTrue(s in content_string)
- for s in nothave_list:
- self.assertTrue(s not in content_string)
-
def _FileContentCheck(self, filename, have_list, nothave_list):
"""String check in local file.
@@ -37,7 +27,8 @@ class ContentTest(pyauto.PyUITest):
window/tab is open.
"""
self.NavigateToURL(self._DataDirURL(filename))
- self._StringContentCheck(self.GetTabContents(), have_list, nothave_list)
+ test_utils.StringContentCheck(self, self.GetTabContents(),
+ have_list, nothave_list)
def testLocalFileBasics(self):
"""For a few local files, do some basic has / not has."""
@@ -55,12 +46,12 @@ class ContentTest(pyauto.PyUITest):
"""Test content when we have 2 tabs."""
self.NavigateToURL(self._DataDirURL('title1.html'))
self.AppendTab(pyauto.GURL(self._DataDirURL('title2.html')), 0)
- self._StringContentCheck(self.GetTabContents(0, 0),
- ['page has no title'],
- ['Awesomeness'])
- self._StringContentCheck(self.GetTabContents(1, 0),
- ['Awesomeness'],
- ['page has no title'])
+ test_utils.StringContentCheck(self, self.GetTabContents(0, 0),
+ ['page has no title'],
+ ['Awesomeness'])
+ test_utils.StringContentCheck(self, self.GetTabContents(1, 0),
+ ['Awesomeness'],
+ ['page has no title'])
def testThreeWindows(self):
"""Test content when we have 3 windows."""
@@ -70,22 +61,22 @@ class ContentTest(pyauto.PyUITest):
self.GetBrowserWindow(window_index).BringToFront()
self.NavigateToURL(self._DataDirURL(url), window_index, 0)
- self._StringContentCheck(self.GetTabContents(0, 0),
- ['page has no title'],
- ['Awesomeness'])
- self._StringContentCheck(self.GetTabContents(0, 1),
- ['Awesomeness'],
- ['page has no title'])
- self._StringContentCheck(self.GetTabContents(0, 2),
- ['Title Of More Awesomeness'],
- ['page has no title'])
+ test_utils.StringContentCheck(self, self.GetTabContents(0, 0),
+ ['page has no title'],
+ ['Awesomeness'])
+ test_utils.StringContentCheck(self, self.GetTabContents(0, 1),
+ ['Awesomeness'],
+ ['page has no title'])
+ test_utils.StringContentCheck(self, self.GetTabContents(0, 2),
+ ['Title Of More Awesomeness'],
+ ['page has no title'])
def testAboutVersion(self):
"""Confirm about:version contains some expected content."""
self.NavigateToURL('about:version')
- self._StringContentCheck(self.GetTabContents(),
- ['User Agent', 'Command Line'],
- ['odmomfodfm disfnodugdzuoufgbn ifdnf fif'])
+ test_utils.StringContentCheck(self, self.GetTabContents(),
+ ['User Agent', 'Command Line'],
+ ['odmomfodfm disfnodugdzuoufgbn ifdnf fif'])
def testHttpsPage(self):
"""Test content in https://www.google.com"""
diff --git a/chrome/test/functional/special_tabs.py b/chrome/test/functional/special_tabs.py
index 954f937..cdf5fd4 100644
--- a/chrome/test/functional/special_tabs.py
+++ b/chrome/test/functional/special_tabs.py
@@ -3,8 +3,11 @@
# 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
+import test_utils
class SpecialTabsTest(pyauto.PyUITest):
@@ -32,12 +35,29 @@ class SpecialTabsTest(pyauto.PyUITest):
'chrome://newtab': 'New Tab',
}
- def testSpecialAccleratorTabs(self):
- """Test special tabs created by acclerators like IDC_SHOW_HISTORY,
- IDC_SHOW_DOWNLOADS."""
- for accel, title in self.special_accelerator_tabs.iteritems():
- self.RunCommand(accel)
- self.assertEqual(title, self.GetActiveTabTitle())
+ def _VerifyAppCacheInternals(self):
+ """Confirm about:appcache-internals contains expected content for Caches.
+ Also confirms that the about page populates Application Caches."""
+ # Navigate to html page to activate DNS prefetching.
+ self.NavigateToURL('http://static.webvm.net/appcache-test/simple.html')
+ # Wait for page to load and display sucess or fail message.
+ self.WaitUntil(
+ lambda: self.GetDOMValue('document.getElementById("result").innerHTML'),
+ expect_retval='SUCCESS')
+ self.GetBrowserWindow(0).GetTab(0).GoBack()
+ test_utils.StringContentCheck(self, self.GetTabContents(),
+ ['Manifest', 'Remove this AppCache'],
+ [])
+
+ def _VerifyAboutDNS(self):
+ """Confirm about:dns contains expected content related to DNS info.
+ Also confirms that prefetching DNS records propogate."""
+ # Navigate to a page to activate DNS prefetching.
+ self.NavigateToURL('http://www.google.com')
+ self.GetBrowserWindow(0).GetTab(0).GoBack()
+ test_utils.StringContentCheck(self, self.GetTabContents(),
+ ['Host name', 'How long ago', 'Motivation'],
+ [])
def testSpecialURLTabs(self):
"""Test special tabs created by URLs like chrome://downloads,
@@ -46,7 +66,25 @@ class SpecialTabsTest(pyauto.PyUITest):
self.NavigateToURL(url)
self.assertEqual(title, self.GetActiveTabTitle())
+ def testAboutAppCacheTab(self):
+ """Test App Cache tab to confirm about page populates caches."""
+ self.NavigateToURL('about:appcache-internals')
+ self._VerifyAppCacheInternals()
+ self.assertEqual('AppCache Internals', self.GetActiveTabTitle())
+
+ def testAboutDNSTab(self):
+ """Test DNS tab to confirm DNS about page propogates records."""
+ self.NavigateToURL('about:dns')
+ self._VerifyAboutDNS()
+ self.assertEqual('About DNS', self.GetActiveTabTitle())
+
+ def testSpecialAcceratorTabs(self):
+ """Test special tabs created by acclerators like IDC_SHOW_HISTORY,
+ IDC_SHOW_DOWNLOADS."""
+ for accel, title in self.special_accelerator_tabs.iteritems():
+ self.RunCommand(accel)
+ self.assertEqual(title, self.GetActiveTabTitle())
+
if __name__ == '__main__':
pyauto_functional.Main()
-
diff --git a/chrome/test/functional/test_utils.py b/chrome/test/functional/test_utils.py
index 978e488..6894ad6 100644
--- a/chrome/test/functional/test_utils.py
+++ b/chrome/test/functional/test_utils.py
@@ -199,3 +199,19 @@ def StripUnmatchedKeys(item_to_strip, reference_item):
elif item_to_strip_type is types.DictType:
return StripDict(item_to_strip, reference_item)
return copy.deepcopy(item_to_strip)
+
+
+def StringContentCheck(test, content_string, have_list, nothave_list):
+ """Check for the presence or absence of strings within content.
+ Confirm all strings in have_list are found in content_strings.
+ Confirm all strings in nothave_list are not found in content_strings.
+
+ Args:
+ content_string: string to search for within content
+ have_list: list of strings found within content
+ nothave_list: list of strings not found within content
+ """
+ for s in have_list:
+ test.assertTrue(s in content_string, s)
+ for s in nothave_list:
+ test.assertTrue(s not in content_string)