OLD | NEW |
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) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 """Test that instant loads PNG file.""" | 265 """Test that instant loads PNG file.""" |
267 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) | 266 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) |
268 | 267 |
269 def testInstantLoadsSVG(self): | 268 def testInstantLoadsSVG(self): |
270 """Test that instant loads SVG file.""" | 269 """Test that instant loads SVG file.""" |
271 self._AssertInstantLoadsFile(os.path.join('circle.svg')) | 270 self._AssertInstantLoadsFile(os.path.join('circle.svg')) |
272 | 271 |
273 | 272 |
274 if __name__ == '__main__': | 273 if __name__ == '__main__': |
275 pyauto_functional.Main() | 274 pyauto_functional.Main() |
OLD | NEW |