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

Unified Diff: chrome/browser/ui/webui/sync_setup_browsertest.js

Issue 8503003: Seed test for SyncUI: sign in successfully with mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use makeAndRegisterMockHandler in new ChromeSendWebUITest. Created 9 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
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/sync_setup_browsertest.js
diff --git a/chrome/browser/ui/webui/sync_setup_browsertest.js b/chrome/browser/ui/webui/sync_setup_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..1132ec3f348db70e4ee80c8fd97894d77ad5b16e
--- /dev/null
+++ b/chrome/browser/ui/webui/sync_setup_browsertest.js
@@ -0,0 +1,90 @@
+// Copyright (c) 2011 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.
+
+/**
+ * Test fixture for sync setup WebUI testing.
+ * @constructor
+ * @extends {testing.Test}
+ */
+function SyncSetupWebUITest() {}
+
+SyncSetupWebUITest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /**
+ * Browse to personal options.
+ **/
+ browsePreload: 'chrome://settings/personal',
+
+ /** @inheritDoc */
+ preLoad: function() {
+ this.makeAndRegisterMockHandler(['stopSyncing',
+ 'SyncSetupDidClosePage',
+ 'SyncSetupSubmitAuth',
+ 'SyncSetupConfigure',
+ 'SyncSetupPassphrase',
+ 'SyncSetupPassphraseCancel',
+ 'SyncSetupAttachHandler',
+ 'SyncSetupShowErrorUI',
+ 'SyncSetupShowSetupUI',
+ ]);
+ },
+
+ /**
+ * Verifies starting point is not synced.
+ */
+ verifyUnsynced: function() {
+ },
+
+ /**
+ * Clicks the "Sign in to Chrome" button.
+ */
+ startSyncing: function() {
+ var startStopSyncButton = PersonalOptions.getStartStopSyncButton();
+ assertNotEquals(null, startStopSyncButton);
+ this.mockHandler.expects(once()).SyncSetupShowSetupUI().
+ will(callFunction(function() {
+ OptionsPage.navigateToPage('syncSetup');
+ }));
+
+ this.mockHandler.expects(once()).SyncSetupAttachHandler().
+ will(callFunction(function() {
+ SyncSetupOverlay.showSyncSetupPage(
+ 'login', {
+ user: '',
+ error: 0,
+ editable_user: true,
+ });
+ }));
+ startStopSyncButton.click();
+ },
+};
+
+// Verify that initial state is unsynced, start syncing, then login.
+TEST_F('SyncSetupWebUITest', 'VerifySignIn', function() {
+ // Start syncing to pull up the sign in page.
+ assertFalse(PersonalOptions.getInstance().syncSetupCompleted);
+ this.startSyncing();
+
+ // Verify the DOM objects on the page.
+ var gaiaEmail = SyncSetupOverlay.getLoginEmail();
+ assertNotEquals(null, gaiaEmail);
+ var gaiaPasswd = SyncSetupOverlay.getLoginPasswd();
+ assertNotEquals(null, gaiaPasswd);
+ var signInButton = SyncSetupOverlay.getSignInButton();
+ assertNotEquals(null, signInButton);
+
+ // Expect set up submission and close messages sent through chrome.send().
+ this.mockHandler.expects(once()).SyncSetupSubmitAuth(NOT_NULL).
+ will(callFunction(function() {
+ SyncSetupOverlay.showSuccessAndClose();
+ }));
+ this.mockHandler.expects(once()).SyncSetupDidClosePage();
+
+ // Set the email & password, then sign in.
+ gaiaEmail.value = 'foo@bar.baz';
+ gaiaPasswd.value = 'foo@bar.baz';
+ signInButton.click();
+});
+
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698