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) |
24 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), | 25 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), |
25 msg='Instant is not enabled.') | 26 msg='Instant is not enabled.') |
26 self.SetOmniboxText('google.com') | 27 self.SetOmniboxText('google.com') |
27 self.assertTrue(self.WaitUntil( | 28 self.assertTrue(self.WaitUntil( |
28 lambda: self.GetInstantInfo().get('current') and not | 29 lambda: self.GetInstantInfo().get('current') and not |
29 self.GetInstantInfo().get('loading'))) | 30 self.GetInstantInfo().get('loading'))) |
30 title = self.GetInstantInfo()['title'] | 31 title = self.GetInstantInfo()['title'] |
31 self.assertEqual('Google', title, msg='Instant did not load.') | 32 self.assertEqual('Google', title, msg='Instant did not load.') |
32 # Disable Instant. | 33 # Disable Instant. |
33 self.SetPrefs(pyauto.kInstantEnabled, False) | 34 self.SetPrefs(pyauto.kInstantEnabled, False) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 """Test that instant loads PNG file.""" | 266 """Test that instant loads PNG file.""" |
266 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) | 267 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) |
267 | 268 |
268 def testInstantLoadsSVG(self): | 269 def testInstantLoadsSVG(self): |
269 """Test that instant loads SVG file.""" | 270 """Test that instant loads SVG file.""" |
270 self._AssertInstantLoadsFile(os.path.join('circle.svg')) | 271 self._AssertInstantLoadsFile(os.path.join('circle.svg')) |
271 | 272 |
272 | 273 |
273 if __name__ == '__main__': | 274 if __name__ == '__main__': |
274 pyauto_functional.Main() | 275 pyauto_functional.Main() |
OLD | NEW |