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

Unified Diff: remoting/webapp/browser_test/invalid_pin_browser_test.js

Issue 273753002: Implement 3 PIN browser tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PIN Browser Tests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/browser_test/invalid_pin_browser_test.js
diff --git a/remoting/webapp/browser_test/invalid_pin_browser_test.js b/remoting/webapp/browser_test/invalid_pin_browser_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..83170162565755bf17158c5f370e2ad49f347974
--- /dev/null
+++ b/remoting/webapp/browser_test/invalid_pin_browser_test.js
@@ -0,0 +1,62 @@
+// Copyright 2014 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.
+
+/**
+ * @fileoverview
+ * @suppress {checkTypes}
+ * Browser test for the scenario below:
+ * 1. Attempt to connect.
+ * 2. Enter |data.pin| at the PIN prompt.
+ * 3. Verify that there is connection error due to invalid access code.
+ */
+
+'use strict';
+
+/** @constructor */
+browserTest.Invalid_PIN = function(data) {
+ browserTest.assert(typeof data.pin == 'string');
+
+ this.data_ = data;
+ this.bound_ = {
+ onPINPrompt: this.onPINPrompt_.bind(this),
+ onSessionConnected: this.onSessionConnected_.bind(this),
+ onSessionError: this.onSessionError_.bind(this)
+ };
+};
+
+browserTest.Invalid_PIN.prototype.run = function() {
+ browserTest.waitForUIMode(
+ remoting.AppMode.CLIENT_PIN_PROMPT,
+ this.bound_.onPINPrompt);
+ this.clickOnMe2MeHost_();
+};
+
+browserTest.Invalid_PIN.prototype.clickOnMe2MeHost_ = function() {
+ browserTest.clickOnControl('this-host-connect');
+};
+
+browserTest.Invalid_PIN.prototype.onPINPrompt_ = function() {
+ browserTest.waitForUIMode(
+ remoting.AppMode.IN_SESSION, this.bound_.onSessionConnected,
+ browserTest.Timeout.NONE);
+
+ browserTest.waitForUIMode(
+ remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME,
+ this.bound_.onSessionError);
+
+ document.getElementById('pin-entry').value = this.data_.pin;
+ browserTest.clickOnControl('pin-connect-button');
+};
+
+browserTest.Invalid_PIN.prototype.onSessionConnected_ = function() {
+ browserTest.fail('Expect the session to disconnect due to invalid PIN.');
+};
+
+browserTest.Invalid_PIN.prototype.onSessionError_= function() {
+ var errorDiv = document.getElementById('connect-error-message');
+ var actual = errorDiv.innerText;
+ var expected = l10n.getTranslationOrError(remoting.Error.INVALID_ACCESS_CODE);
+ browserTest.assert(actual == expected);
Jamie 2014/05/09 01:02:18 This should not be an assertion. If the error is n
kelvinp 2014/05/12 21:08:34 Rename to expect equal
+ browserTest.pass();
+};

Powered by Google App Engine
This is Rietveld 408576698