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 copy | 6 import copy |
7 import os | 7 import os |
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 u'tabs': [ | 304 u'tabs': [ |
305 { u'type': u'tab', | 305 { u'type': u'tab', |
306 u'url': self.PAGES[1]['url'], | 306 u'url': self.PAGES[1]['url'], |
307 u'direction': u'ltr' }, | 307 u'direction': u'ltr' }, |
308 { u'type': u'tab', | 308 { u'type': u'tab', |
309 u'url': self.PAGES[0]['url']}] | 309 u'url': self.PAGES[0]['url']}] |
310 }] | 310 }] |
311 self.assertEquals(expected, test_utils.StripUnmatchedKeys( | 311 self.assertEquals(expected, test_utils.StripUnmatchedKeys( |
312 self.GetNTPRecentlyClosed(), expected)) | 312 self.GetNTPRecentlyClosed(), expected)) |
313 | 313 |
314 def testRecentlyClosedShowsUniqueItems(self): | |
315 """Tests that the Recently Closed section does not show duplicate items""" | |
316 self.RemoveNTPDefaultThumbnails() | |
317 self.AppendTab(pyauto.GURL(self.PAGES[0]['url'])) | |
318 self.AppendTab(pyauto.GURL(self.PAGES[0]['url'])) | |
319 self.GetBrowserWindow(0).GetTab(1).Close(True) | |
320 self.GetBrowserWindow(0).GetTab(1).Close(True) | |
321 self.assertEquals(1, len(self.GetNTPRecentlyClosed())) | |
322 | |
323 def testRecentlyClosedIncognito(self): | 314 def testRecentlyClosedIncognito(self): |
324 """Tests that we don't record closure of Incognito tabs or windows""" | 315 """Tests that we don't record closure of Incognito tabs or windows""" |
325 #self.RemoveNTPDefaultThumbnails() | 316 #self.RemoveNTPDefaultThumbnails() |
326 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 317 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
327 self.NavigateToURL(self.PAGES[0]['url'], 1, 0) | 318 self.NavigateToURL(self.PAGES[0]['url'], 1, 0) |
328 self.AppendTab(pyauto.GURL(self.PAGES[0]['url']), 1) | 319 self.AppendTab(pyauto.GURL(self.PAGES[0]['url']), 1) |
329 self.AppendTab(pyauto.GURL(self.PAGES[1]['url']), 1) | 320 self.AppendTab(pyauto.GURL(self.PAGES[1]['url']), 1) |
330 self.GetBrowserWindow(1).GetTab(0).Close(True) | 321 self.GetBrowserWindow(1).GetTab(0).Close(True) |
331 self.assertFalse(self.GetNTPRecentlyClosed()) | 322 self.assertFalse(self.GetNTPRecentlyClosed()) |
332 self.CloseBrowserWindow(1) | 323 self.CloseBrowserWindow(1) |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 info = self.GetBrowserInfo() | 512 info = self.GetBrowserInfo() |
522 self.assertTrue(len(info['windows']) == 2, | 513 self.assertTrue(len(info['windows']) == 2, |
523 msg='A second window does not exist.') | 514 msg='A second window does not exist.') |
524 actual_tab_url = info['windows'][1]['tabs'][0]['url'] | 515 actual_tab_url = info['windows'][1]['tabs'][0]['url'] |
525 expected_app_url_start = 'chrome-extension://' + installed_app_id | 516 expected_app_url_start = 'chrome-extension://' + installed_app_id |
526 self.assertTrue(actual_tab_url.startswith(expected_app_url_start), | 517 self.assertTrue(actual_tab_url.startswith(expected_app_url_start), |
527 msg='The app was not launched in the new window.') | 518 msg='The app was not launched in the new window.') |
528 | 519 |
529 if __name__ == '__main__': | 520 if __name__ == '__main__': |
530 pyauto_functional.Main() | 521 pyauto_functional.Main() |
OLD | NEW |