OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import time | 7 import time |
8 | 8 |
9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
10 import pyauto | 10 import pyauto |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 'SUCCESS', | 320 'SUCCESS', |
321 self.GetDOMValue('document.getElementById("result").innerHTML')) | 321 self.GetDOMValue('document.getElementById("result").innerHTML')) |
322 self._CheckHistory('Target Page', url2, 2) | 322 self._CheckHistory('Target Page', url2, 2) |
323 | 323 |
324 def testOneHistoryTabPerWindow(self): | 324 def testOneHistoryTabPerWindow(self): |
325 """Verify history shortcut opens only one history tab per window. | 325 """Verify history shortcut opens only one history tab per window. |
326 | 326 |
327 Also, make sure that existing history tab is activated. | 327 Also, make sure that existing history tab is activated. |
328 """ | 328 """ |
329 command_line = self.GetBrowserInfo()['properties']['command_line_string'] | 329 command_line = self.GetBrowserInfo()['properties']['command_line_string'] |
330 if '--disable-uber-page' in command_line.split(): | 330 history_url = 'chrome://history-frame/' |
331 history_url = 'chrome://history-frame/' | |
332 else: | |
333 history_url = 'chrome://chrome/history/' | |
334 | 331 |
335 # Invoke History. | 332 # Invoke History. |
336 self.RunCommand(pyauto.IDC_SHOW_HISTORY) | 333 self.RunCommand(pyauto.IDC_SHOW_HISTORY) |
337 self.assertEqual('History', self.GetActiveTabTitle(), | 334 self.assertEqual('History', self.GetActiveTabTitle(), |
338 msg='History page was not opened.') | 335 msg='History page was not opened.') |
339 | 336 |
340 # Open new tab, invoke History again. | 337 # Open new tab, invoke History again. |
341 self.RunCommand(pyauto.IDC_NEW_TAB) | 338 self.RunCommand(pyauto.IDC_NEW_TAB) |
342 self.RunCommand(pyauto.IDC_SHOW_HISTORY) | 339 self.RunCommand(pyauto.IDC_SHOW_HISTORY) |
343 | 340 |
344 # Verify there is only one history tab, and that it is activated. | 341 # Verify there is only one history tab, and that it is activated. |
345 tab0url = self.GetBrowserInfo()['windows'][0]['tabs'][0]['url'] | 342 tab0url = self.GetBrowserInfo()['windows'][0]['tabs'][0]['url'] |
346 self.assertEqual( | 343 self.assertEqual( |
347 history_url, tab0url, msg='Tab 0: expected = %s, actual = %s.' | 344 history_url, tab0url, msg='Tab 0: expected = %s, actual = %s.' |
348 % (history_url, tab0url)) | 345 % (history_url, tab0url)) |
349 | 346 |
350 tab1url = self.GetBrowserInfo()['windows'][0]['tabs'][1]['url'] | 347 tab1url = self.GetBrowserInfo()['windows'][0]['tabs'][1]['url'] |
351 self.assertNotEqual( | 348 self.assertNotEqual( |
352 history_url, tab1url, | 349 history_url, tab1url, |
353 msg='Tab 1: History page not expected.') | 350 msg='Tab 1: History page not expected.') |
354 | 351 |
355 self.assertEqual('History', self.GetActiveTabTitle(), | 352 self.assertEqual('History', self.GetActiveTabTitle(), |
356 msg='History page is not activated.') | 353 msg='History page is not activated.') |
357 | 354 |
358 | 355 |
359 if __name__ == '__main__': | 356 if __name__ == '__main__': |
360 pyauto_functional.Main() | 357 pyauto_functional.Main() |
OLD | NEW |