Index: chrome/test/functional/chromeos_crosh.py |
diff --git a/chrome/test/functional/chromeos_crosh.py b/chrome/test/functional/chromeos_crosh.py |
index 31dcc21e50368792e6ba935157934e725bc8c08c..a765215c0ae0d86df6e32229d8693b4dfc57226d 100755 |
--- a/chrome/test/functional/chromeos_crosh.py |
+++ b/chrome/test/functional/chromeos_crosh.py |
@@ -44,6 +44,74 @@ class CroshTest(pyauto.PyUITest): |
self.WaitForHtermText(text='command crosh completed with exit code 0', |
msg='Could not exit crosh.') |
+ def testAddBookmark(self): |
+ """Test bookmark crosh.""" |
+ for _ in range(self.GetBrowserWindowCount()): |
Nirnimesh
2012/07/18 00:53:05
This is not necessary since setUp() already does s
tturchetto
2012/07/25 00:30:48
Done.
|
+ self.CloseBrowserWindow(0) |
+ self.assertEqual(0, self.GetBrowserWindowCount()) |
+ self.OpenCrosh() |
+ self.assertEqual(1, self.GetBrowserWindowCount()) |
+ self.assertEqual(1, self.GetTabCount(), |
+ msg='Could not open crosh') |
+ self.assertEqual('crosh', self.GetActiveTabTitle()) |
+ |
+ # Add bookmark. |
Nirnimesh
2012/07/18 00:53:05
The rest of the test does not seem to depend on op
tturchetto
2012/07/25 00:30:48
Used #2 suggestion.
Done
|
+ bookmarks = self.GetBookmarkModel() |
+ bar_id = bookmarks.BookmarkBar()['id'] |
+ name = 'crosh' |
+ url = 'chrome-extension://nkoccljplnhpfnfiajclkommnmllphnl/html/crosh.html' |
+ count = bookmarks.NodeCount() |
+ self.AddBookmarkURL(bar_id, 0, name, url) |
+ bookmarks = self.GetBookmarkModel() |
+ node = bookmarks.BookmarkBar()['children'][0] |
+ self.assertEqual(count+1, bookmarks.NodeCount()) |
Nirnimesh
2012/07/18 00:53:05
need space around +
tturchetto
2012/07/25 00:30:48
Done.
|
+ self.assertEqual(node['type'], 'url') |
+ self.assertEqual(node['name'], name) |
+ self.assertTrue(url in node['url']) |
+ |
+ |
+class CroshLoginTest(pyauto.PyUITest): |
Nirnimesh
2012/07/18 00:53:05
Please add this test to chromeos_login.py
This is
tturchetto
2012/07/25 00:30:48
Done.
|
+ """Tests for crosh in guest mode.""" |
+ |
+ def setUp(self): |
Nirnimesh
2012/07/18 00:53:05
If you follow my previous comment, this will not b
tturchetto
2012/07/25 00:30:48
I moved this test to chromeos_login.py, therefore
|
+ pyauto.PyUITest.setUp(self) |
+ if self.GetLoginInfo()['is_logged_in']: |
+ self.Logout() |
+ |
+ def testGuestCrosh(self): |
+ """Test we can use crosh in guest mode.""" |
+ |
Nirnimesh
2012/07/18 00:53:05
remove blank line
tturchetto
2012/07/25 00:30:48
Done.
|
+ self.LoginAsGuest() |
+ login_info = self.GetLoginInfo() |
+ self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.') |
+ self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.') |
+ for _ in range(self.GetBrowserWindowCount()): |
+ self.CloseBrowserWindow(0) |
+ |
+ self.assertEqual(0, self.GetBrowserWindowCount()) |
+ self.OpenCrosh() |
+ self.assertEqual(1, self.GetBrowserWindowCount()) |
+ self.assertEqual(1, self.GetTabCount(),msg='Could not open crosh') |
+ self.assertEqual('crosh', self.GetActiveTabTitle()) |
+ |
+ # Verify crosh prompt. |
+ self.WaitForHtermText(text='crosh> ', |
+ msg='Could not find "crosh> " prompt') |
+ self.assertTrue( |
+ self.GetHtermRowsText(start=0, end=2).endswith('crosh> '), |
+ msg='Could not find "crosh> " prompt') |
+ |
+ # Run a crosh command. |
+ self.SendKeysToHterm('help\\n') |
+ self.WaitForHtermText(text='help_advanced', |
+ msg='Could not find "help_advanced" in help output.') |
+ |
+ # Exit crosh and close tab. |
+ self.SendKeysToHterm('exit\\n') |
+ self.WaitForHtermText(text='command crosh completed with exit code 0', |
+ msg='Could not exit crosh.') |
+ self.Logout() |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |