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

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

Issue 8198027: Allow controlling the Instant field trial through a command line flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/test_launcher_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import cgi 7 import cgi
8 import os 8 import os
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
11 import pyauto 11 import pyauto
12 12
13 13
14 class InstantSettingsTest(pyauto.PyUITest): 14 class InstantSettingsTest(pyauto.PyUITest):
15 """Test Chrome Instant settings.""" 15 """Test Chrome Instant settings."""
16 16
17 def testEnableDisableInstant(self): 17 def testEnableDisableInstant(self):
18 """Test to verify default Chrome Instant setting. 18 """Test to verify default Chrome Instant setting.
19 Check if the setting can be enabled and disabled.""" 19 Check if the setting can be enabled and disabled."""
20 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), 20 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled),
21 msg='Instant is enabled by default.') 21 msg='Instant is enabled by default.')
22 # Enable instant. 22 # Enable instant.
23 self.SetPrefs(pyauto.kInstantEnabled, True) 23 self.SetPrefs(pyauto.kInstantEnabled, True)
24 self.SetPrefs(pyauto.kInstantEnabledOnce, True)
25 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), 24 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled),
26 msg='Instant is not enabled.') 25 msg='Instant is not enabled.')
27 self.SetOmniboxText('google.com') 26 self.SetOmniboxText('google.com')
28 self.assertTrue(self.WaitUntil( 27 self.assertTrue(self.WaitUntil(
29 lambda: self.GetInstantInfo().get('current') and not 28 lambda: self.GetInstantInfo().get('current') and not
30 self.GetInstantInfo().get('loading'))) 29 self.GetInstantInfo().get('loading')))
31 title = self.GetInstantInfo()['title'] 30 title = self.GetInstantInfo()['title']
32 self.assertEqual('Google', title, msg='Instant did not load.') 31 self.assertEqual('Google', title, msg='Instant did not load.')
33 # Disable Instant. 32 # Disable Instant.
34 self.SetPrefs(pyauto.kInstantEnabled, False) 33 self.SetPrefs(pyauto.kInstantEnabled, False)
35 self.assertFalse(self.GetInstantInfo()['enabled'], 34 self.assertFalse(self.GetInstantInfo()['enabled'],
36 msg='Instant is not disabled.') 35 msg='Instant is not disabled.')
37 36
38 37
39 class InstantTest(pyauto.PyUITest): 38 class InstantTest(pyauto.PyUITest):
40 """TestCase for Omnibox Instant feature.""" 39 """TestCase for Omnibox Instant feature."""
41 40
42 def setUp(self): 41 def setUp(self):
43 pyauto.PyUITest.setUp(self) 42 pyauto.PyUITest.setUp(self)
44 self.SetPrefs(pyauto.kInstantEnabled, True) 43 self.SetPrefs(pyauto.kInstantEnabled, True)
45 self.SetPrefs(pyauto.kInstantEnabledOnce, True)
46 44
47 def _DoneLoading(self): 45 def _DoneLoading(self):
48 info = self.GetInstantInfo() 46 info = self.GetInstantInfo()
49 return info.get('current') and not info.get('loading') 47 return info.get('current') and not info.get('loading')
50 48
51 def _DoneLoadingGoogleQuery(self, query): 49 def _DoneLoadingGoogleQuery(self, query):
52 """Wait for Omnibox Instant to load Google search result 50 """Wait for Omnibox Instant to load Google search result
53 and verify location URL contains the specifed query. 51 and verify location URL contains the specifed query.
54 52
55 Args: 53 Args:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 """Test that instant loads PNG file.""" 265 """Test that instant loads PNG file."""
268 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) 266 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png'))
269 267
270 def testInstantLoadsSVG(self): 268 def testInstantLoadsSVG(self):
271 """Test that instant loads SVG file.""" 269 """Test that instant loads SVG file."""
272 self._AssertInstantLoadsFile(os.path.join('circle.svg')) 270 self._AssertInstantLoadsFile(os.path.join('circle.svg'))
273 271
274 272
275 if __name__ == '__main__': 273 if __name__ == '__main__':
276 pyauto_functional.Main() 274 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/base/test_launcher_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698