Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: chrome/test/functional/chromeos_crosh.py

Issue 10778006: Adding HTML Terminal test case: 1. TestAddBookmark, 2. Login as guest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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."""
49 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.
50 self.CloseBrowserWindow(0)
51 self.assertEqual(0, self.GetBrowserWindowCount())
52 self.OpenCrosh()
53 self.assertEqual(1, self.GetBrowserWindowCount())
54 self.assertEqual(1, self.GetTabCount(),
55 msg='Could not open crosh')
56 self.assertEqual('crosh', self.GetActiveTabTitle())
57
58 # 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
59 bookmarks = self.GetBookmarkModel()
60 bar_id = bookmarks.BookmarkBar()['id']
61 name = 'crosh'
62 url = 'chrome-extension://nkoccljplnhpfnfiajclkommnmllphnl/html/crosh.html'
63 count = bookmarks.NodeCount()
64 self.AddBookmarkURL(bar_id, 0, name, url)
65 bookmarks = self.GetBookmarkModel()
66 node = bookmarks.BookmarkBar()['children'][0]
67 self.assertEqual(count+1, bookmarks.NodeCount())
Nirnimesh 2012/07/18 00:53:05 need space around +
tturchetto 2012/07/25 00:30:48 Done.
68 self.assertEqual(node['type'], 'url')
69 self.assertEqual(node['name'], name)
70 self.assertTrue(url in node['url'])
71
72
73 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.
74 """Tests for crosh in guest mode."""
75
76 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
77 pyauto.PyUITest.setUp(self)
78 if self.GetLoginInfo()['is_logged_in']:
79 self.Logout()
80
81 def testGuestCrosh(self):
82 """Test we can use crosh in guest mode."""
83
Nirnimesh 2012/07/18 00:53:05 remove blank line
tturchetto 2012/07/25 00:30:48 Done.
84 self.LoginAsGuest()
85 login_info = self.GetLoginInfo()
86 self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.')
87 self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.')
88 for _ in range(self.GetBrowserWindowCount()):
89 self.CloseBrowserWindow(0)
90
91 self.assertEqual(0, self.GetBrowserWindowCount())
92 self.OpenCrosh()
93 self.assertEqual(1, self.GetBrowserWindowCount())
94 self.assertEqual(1, self.GetTabCount(),msg='Could not open crosh')
95 self.assertEqual('crosh', self.GetActiveTabTitle())
96
97 # Verify crosh prompt.
98 self.WaitForHtermText(text='crosh> ',
99 msg='Could not find "crosh> " prompt')
100 self.assertTrue(
101 self.GetHtermRowsText(start=0, end=2).endswith('crosh> '),
102 msg='Could not find "crosh> " prompt')
103
104 # Run a crosh command.
105 self.SendKeysToHterm('help\\n')
106 self.WaitForHtermText(text='help_advanced',
107 msg='Could not find "help_advanced" in help output.')
108
109 # Exit crosh and close tab.
110 self.SendKeysToHterm('exit\\n')
111 self.WaitForHtermText(text='command crosh completed with exit code 0',
112 msg='Could not exit crosh.')
113 self.Logout()
114
47 115
48 if __name__ == '__main__': 116 if __name__ == '__main__':
49 pyauto_functional.Main() 117 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698