| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 self.assertEqual( | 319 self.assertEqual( |
| 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'] |
| 330 if '--disable-uber-page' in command_line.split(): |
| 331 history_url = 'chrome://history-frame/' |
| 332 else: |
| 333 history_url = 'chrome://chrome/history/' |
| 334 |
| 329 # Invoke History. | 335 # Invoke History. |
| 330 self.RunCommand(pyauto.IDC_SHOW_HISTORY) | 336 self.RunCommand(pyauto.IDC_SHOW_HISTORY) |
| 331 self.assertEqual('History', self.GetActiveTabTitle(), | 337 self.assertEqual('History', self.GetActiveTabTitle(), |
| 332 msg='History page was not opened.') | 338 msg='History page was not opened.') |
| 333 | 339 |
| 334 # Open new tab, invoke History again. | 340 # Open new tab, invoke History again. |
| 335 self.RunCommand(pyauto.IDC_NEW_TAB) | 341 self.RunCommand(pyauto.IDC_NEW_TAB) |
| 336 self.RunCommand(pyauto.IDC_SHOW_HISTORY) | 342 self.RunCommand(pyauto.IDC_SHOW_HISTORY) |
| 337 | 343 |
| 338 # Verify there is only one history tab, and that it is activated. | 344 # Verify there is only one history tab, and that it is activated. |
| 339 tab0url = self.GetBrowserInfo()['windows'][0]['tabs'][0]['url'] | 345 tab0url = self.GetBrowserInfo()['windows'][0]['tabs'][0]['url'] |
| 340 self.assertEqual( | 346 self.assertEqual( |
| 341 'chrome://history/', tab0url, msg='Tab 0: expected = %s, actual = %s.' | 347 history_url, tab0url, msg='Tab 0: expected = %s, actual = %s.' |
| 342 % ('chrome://history/', tab0url)) | 348 % (history_url, tab0url)) |
| 343 | 349 |
| 344 tab1url = self.GetBrowserInfo()['windows'][0]['tabs'][1]['url'] | 350 tab1url = self.GetBrowserInfo()['windows'][0]['tabs'][1]['url'] |
| 345 self.assertNotEqual( | 351 self.assertNotEqual( |
| 346 'chrome://history/', tab1url, | 352 history_url, tab1url, |
| 347 msg='Tab 1: History page not expected.') | 353 msg='Tab 1: History page not expected.') |
| 348 | 354 |
| 349 self.assertEqual('History', self.GetActiveTabTitle(), | 355 self.assertEqual('History', self.GetActiveTabTitle(), |
| 350 msg='History page is not activated.') | 356 msg='History page is not activated.') |
| 351 | 357 |
| 352 | 358 |
| 353 if __name__ == '__main__': | 359 if __name__ == '__main__': |
| 354 pyauto_functional.Main() | 360 pyauto_functional.Main() |
| OLD | NEW |