Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
|
dennis_jeffrey
2011/08/25 23:09:20
Since it looks like this test is chromeos-specific
tturchetto
2011/08/26 00:49:38
Renamed the file to chromeos_browser.py
On 2011/0
| |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import pyauto_functional | |
|
dennis_jeffrey
2011/08/25 23:09:20
I recommend adding a comment saying that this impo
tturchetto
2011/08/26 00:49:38
Done.
| |
| 7 import pyauto | |
| 8 | |
| 9 | |
| 10 class CloseTab(pyauto.PyUITest): | |
| 11 """Close last tab test for ChromeOS. | |
|
dennis_jeffrey
2011/08/25 23:09:20
Although there's only 1 test in this class right n
tturchetto
2011/08/26 00:49:38
Done.
| |
| 12 | |
| 13 Requires ChromeOS to be logged in. | |
| 14 """ | |
| 15 | |
| 16 def testCloseAllTabs(self): | |
| 17 """Close all tabs. There should be 1 tab open on Chrome OS""" | |
|
dennis_jeffrey
2011/08/25 23:09:20
"Closes all tabs and verifies 1 tab is still open
tturchetto
2011/08/26 00:49:38
Done.
| |
| 18 tab_count = self.GetTabCount() | |
| 19 | |
| 20 for tab_index in xrange(tab_count - 1, -1, -1): | |
|
dennis_jeffrey
2011/08/25 23:09:20
how about using xrange(tab_count, 0, -1)? It seem
tturchetto
2011/08/26 00:49:38
this will give error message, therefore, I keep th
| |
| 21 self.GetBrowserWindow(0).GetTab(tab_index).Close(True) | |
| 22 | |
| 23 info = self.GetBrowserInfo() | |
| 24 self.assertEqual(1, len(info['windows'])) # one window | |
|
dennis_jeffrey
2011/08/25 23:09:20
I think the comment is not necessary; it's easy to
tturchetto
2011/08/26 00:49:38
Done.
| |
| 25 self.assertEqual(1, len(info['windows'][0]['tabs'])) # one tab | |
|
dennis_jeffrey
2011/08/25 23:09:20
I think the comment is not necessary; it's easy to
tturchetto
2011/08/26 00:49:38
Done.
| |
| 26 self.assertEqual('chrome://newtab/', | |
| 27 info['windows'][0]['tabs'][0]['url']) # empty URL | |
|
dennis_jeffrey
2011/08/25 23:09:20
I think the comment is not necessary, but it also
dennis_jeffrey
2011/08/25 23:09:20
For each of the 3 assertions above, you may want t
tturchetto
2011/08/26 00:49:38
Done.
tturchetto
2011/08/26 00:49:38
Done.
| |
| 28 | |
|
dennis_jeffrey
2011/08/25 23:09:20
Add 1 more blank line here.
tturchetto
2011/08/26 00:49:38
Done.
| |
| 29 if __name__ == '__main__': | |
| 30 pyauto_functional.Main() | |
| OLD | NEW |