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 | 7 |
8 import pyauto_functional # must be imported before pyauto | 8 import pyauto_functional # must be imported before pyauto |
9 import pyauto | 9 import pyauto |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... | |
37 # Run a crosh command. | 37 # Run a crosh command. |
38 self.SendKeysToHterm('help\\n') | 38 self.SendKeysToHterm('help\\n') |
39 self.WaitForHtermText(text='help_advanced', | 39 self.WaitForHtermText(text='help_advanced', |
40 msg='Could not find "help_advanced" in help output.') | 40 msg='Could not find "help_advanced" in help output.') |
41 | 41 |
42 # Exit crosh and close tab. | 42 # Exit crosh and close tab. |
43 self.SendKeysToHterm('exit\\n') | 43 self.SendKeysToHterm('exit\\n') |
44 self.WaitForHtermText(text='command crosh completed with exit code 0', | 44 self.WaitForHtermText(text='command crosh completed with exit code 0', |
45 msg='Could not exit crosh.') | 45 msg='Could not exit crosh.') |
46 | 46 |
47 def testAddBookmark(self): | |
48 """Test bookmark crosh.""" | |
Nirnimesh
2012/07/25 07:03:45
Make this better. It's not clear what the test is.
tturchetto
2012/07/26 22:44:28
Done.
| |
49 self.assertEqual(0, self.GetBrowserWindowCount()) | |
50 self.OpenCrosh() | |
51 self.assertEqual(1, self.GetBrowserWindowCount()) | |
52 self.assertEqual(1, self.GetTabCount(), | |
53 msg='Could not open crosh') | |
54 self.assertEqual('crosh', self.GetActiveTabTitle()) | |
Nirnimesh
2012/07/25 07:03:45
49-54 is the same as 23-28. Refactor to a separate
tturchetto
2012/07/26 22:44:28
Done.
| |
55 | |
56 # Add bookmark. | |
57 bookmarks = self.GetBookmarkModel() | |
58 bar_id = bookmarks.BookmarkBar()['id'] | |
59 name = 'crosh' | |
60 url = self.GetActiveTabURL() | |
61 count = bookmarks.NodeCount() | |
62 self.AddBookmarkURL(bar_id, 0, name, url.spec()) | |
63 bookmarks = self.GetBookmarkModel() | |
64 node = bookmarks.BookmarkBar()['children'][0] | |
65 self.assertEqual(count + 1, bookmarks.NodeCount()) | |
66 self.assertEqual(node['type'], 'url') | |
67 self.assertEqual(node['name'], name) | |
68 self.assertTrue(url.spec() in node['url']) | |
Nirnimesh
2012/07/25 07:03:45
use assertEqual
tturchetto
2012/07/26 22:44:28
I am verifying condition, therefore assertTrue?
| |
69 | |
47 | 70 |
48 if __name__ == '__main__': | 71 if __name__ == '__main__': |
49 pyauto_functional.Main() | 72 pyauto_functional.Main() |
OLD | NEW |