blob: c02332b59b3a3e3f37503739a3428b69ef79c1aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/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 logging
import pyauto_functional # Must be imported before pyauto
import pyauto
class PrefsTest(pyauto.PyUITest):
"""TestCase for Preferences."""
def testSessionRestore(self):
url1 = 'http://www.google.com/'
url2 = 'http://news.google.com/'
self.NavigateToURL(url1)
self.AppendTab(pyauto.GURL(url2))
num_tabs = self.GetTabCount()
# Set pref to restore session on startup
browser = self.GetBrowserWindow(0)
browser.SetIntPreference(pyauto.kRestoreOnStartup, 1)
logging.debug('Setting %s to 1' % pyauto.kRestoreOnStartup)
self.CloseBrowserAndServer() # Close browser
self.set_clear_profile(False) # Do not clear profile on next startup
self.LaunchBrowserAndServer() # Reopen browser
self.assertEqual(num_tabs, self.GetTabCount())
self.ActivateTab(0)
self.assertEqual(url1, self.GetActiveTabURL().spec())
self.ActivateTab(1)
self.assertEqual(url2, self.GetActiveTabURL().spec())
self.set_clear_profile(True) # Restore the flag to clear profile next
if __name__ == '__main__':
pyauto_functional.Main()
|