Commit d8fa9c91 authored by tturchetto@google.com's avatar tturchetto@google.com

Adding HTML Terminal test case: 1. TestAddBookmark, 2. Login as guest

BUG=128108
TEST=This is a test.

Review URL: https://chromiumcodereview.appspot.com/10778006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148675 0039d316-1c4b-4281-b951-d872f2087c98
parent a7c4c03a
...@@ -7,6 +7,7 @@ import os ...@@ -7,6 +7,7 @@ import os
import pyauto_functional # must be imported before pyauto import pyauto_functional # must be imported before pyauto
import pyauto import pyauto
import test_utils
class CroshTest(pyauto.PyUITest): class CroshTest(pyauto.PyUITest):
...@@ -20,12 +21,7 @@ class CroshTest(pyauto.PyUITest): ...@@ -20,12 +21,7 @@ class CroshTest(pyauto.PyUITest):
def testBasic(self): def testBasic(self):
"""Verify crosh basic flow.""" """Verify crosh basic flow."""
self.assertEqual(0, self.GetBrowserWindowCount()) test_utils.OpenCroshVerification(self)
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. # Verify crosh prompt.
self.WaitForHtermText(text='crosh> ', self.WaitForHtermText(text='crosh> ',
...@@ -44,6 +40,24 @@ class CroshTest(pyauto.PyUITest): ...@@ -44,6 +40,24 @@ class CroshTest(pyauto.PyUITest):
self.WaitForHtermText(text='command crosh completed with exit code 0', self.WaitForHtermText(text='command crosh completed with exit code 0',
msg='Could not exit crosh.') msg='Could not exit crosh.')
def testAddBookmark(self):
"""Test crosh URL can be bookmarked"""
test_utils.OpenCroshVerification(self)
# Add bookmark.
bookmarks = self.GetBookmarkModel()
bar_id = bookmarks.BookmarkBar()['id']
name = 'crosh'
url = self.GetActiveTabURL()
count = bookmarks.NodeCount()
self.AddBookmarkURL(bar_id, 0, name, url.spec())
bookmarks = self.GetBookmarkModel()
node = bookmarks.BookmarkBar()['children'][0]
self.assertEqual(count + 1, bookmarks.NodeCount())
self.assertEqual(node['type'], 'url')
self.assertEqual(node['name'], name)
self.assertEqual(url.spec(), node['url'])
if __name__ == '__main__': if __name__ == '__main__':
pyauto_functional.Main() pyauto_functional.Main()
...@@ -10,6 +10,7 @@ import sys ...@@ -10,6 +10,7 @@ import sys
import pyauto_functional # Must be imported before pyauto import pyauto_functional # Must be imported before pyauto
import pyauto import pyauto
import pyauto_errors import pyauto_errors
import test_utils
sys.path.append('/usr/local') # To make autotest libs importable. sys.path.append('/usr/local') # To make autotest libs importable.
...@@ -221,6 +222,33 @@ class ChromeosLogin(pyauto.PyUITest): ...@@ -221,6 +222,33 @@ class ChromeosLogin(pyauto.PyUITest):
self.testGoodLogin() # Re-login with same account. self.testGoodLogin() # Re-login with same account.
_VerifyProfile() _VerifyProfile()
def testGuestCrosh(self):
"""Verify we can use crosh in guest mode."""
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)
test_utils.OpenCroshVerification(self)
# 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.')
if __name__ == '__main__': if __name__ == '__main__':
pyauto_functional.Main() pyauto_functional.Main()
...@@ -364,7 +364,7 @@ def LoginToDevice(test, test_account='test_google_account'): ...@@ -364,7 +364,7 @@ def LoginToDevice(test, test_account='test_google_account'):
If no test account is specified, we use test_google_account as the default. If no test account is specified, we use test_google_account as the default.
You can choose test accounts from - You can choose test accounts from -
chrome/test/data/pyauto_private/private_tests_info.txt chrome/test/data/pyauto_private/private_tests_info.txt
Args: Args:
test_account: The account used to login to the Chromeos device. test_account: The account used to login to the Chromeos device.
...@@ -434,3 +434,15 @@ def AssertInfobarTypeDoesNotAppear(test, infobar_type, windex=0, tab_index=0): ...@@ -434,3 +434,15 @@ def AssertInfobarTypeDoesNotAppear(test, infobar_type, windex=0, tab_index=0):
test, infobar_type, windex, tab_index) is not None, timeout=20), test, infobar_type, windex, tab_index) is not None, timeout=20),
msg=('Infobar type for %s appeared when it should be hidden.' msg=('Infobar type for %s appeared when it should be hidden.'
% infobar_type)) % infobar_type))
def OpenCroshVerification(self):
"""This test opens crosh.
This function assumes that no browser windows are open.
"""
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())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment