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

Unified Diff: tools/chrome_remote_control/chrome_remote_control/google_credentials_backend_unittest.py

Issue 11361165: [chrome_remote_control] Rename chrome_remote_control to telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: tools/chrome_remote_control/chrome_remote_control/google_credentials_backend_unittest.py
diff --git a/tools/chrome_remote_control/chrome_remote_control/google_credentials_backend_unittest.py b/tools/chrome_remote_control/chrome_remote_control/google_credentials_backend_unittest.py
deleted file mode 100644
index 8b380f0620a9ac71426079e08409d41cc860750b..0000000000000000000000000000000000000000
--- a/tools/chrome_remote_control/chrome_remote_control/google_credentials_backend_unittest.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-import unittest
-
-from chrome_remote_control import browser_finder
-from chrome_remote_control import google_credentials_backend
-from chrome_remote_control import simple_mock
-from chrome_remote_control import options_for_unittests
-
-_ = simple_mock.DONT_CARE
-
-class MockTab(simple_mock.MockObject):
- def __init__(self):
- super(MockTab, self).__init__()
- self.runtime = simple_mock.MockObject(self)
- self.page = simple_mock.MockObject(self)
-
-class TestGoogleCredentialsBackend(unittest.TestCase):
- def testRealLoginIfPossible(self):
- credentials_path = os.path.join(
- os.path.dirname(__file__),
- '..', '..', 'perf', 'data', 'credentials.json')
- if not os.path.exists(credentials_path):
- return
-
- options = options_for_unittests.Get()
- with browser_finder.FindBrowser(options).Create() as b:
- b.credentials.credentials_path = credentials_path
- if not b.credentials.CanLogin('google'):
- return
- with b.ConnectToNthTab(0) as tab:
- ret = b.credentials.LoginNeeded(tab, 'google')
- self.assertTrue(ret)
-
- def testLoginUsingMock(self): # pylint: disable=R0201
- tab = MockTab()
-
- backend = google_credentials_backend.GoogleCredentialsBackend()
- config = {'username': 'blah',
- 'password': 'blargh'}
-
- tab.page.ExpectCall('Navigate', 'https://accounts.google.com/')
- tab.runtime.ExpectCall('Evaluate', _).WillReturn(False)
- tab.runtime.ExpectCall('Evaluate', _).WillReturn(True)
- tab.ExpectCall('WaitForDocumentReadyStateToBeInteractiveOrBetter')
-
- def VerifyEmail(js):
- assert 'Email' in js
- assert 'blah' in js
- tab.runtime.ExpectCall('Execute', _).WhenCalled(VerifyEmail)
-
- def VerifyPw(js):
- assert 'Passwd' in js
- assert 'largh' in js
- tab.runtime.ExpectCall('Execute', _).WhenCalled(VerifyPw)
-
- def VerifySubmit(js):
- assert '.submit' in js
- tab.runtime.ExpectCall('Execute', _).WhenCalled(VerifySubmit)
-
- # Checking for form still up.
- tab.runtime.ExpectCall('Evaluate', _).WillReturn(False)
-
- backend.LoginNeeded(tab, config)
-

Powered by Google App Engine
This is Rietveld 408576698