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..399c9df386383d8cc67d1d7a1bb8da5990ff58c5 |
--- /dev/null |
+++ b/remoting/webapp/browser_test/invalid_pin_browser_test.js |
@@ -0,0 +1,48 @@ |
+// 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() {}; |
+ |
+browserTest.Invalid_PIN.prototype.run = function(data) { |
+ // Input validation. |
+ browserTest.expect(typeof data.pin == 'string'); |
+ |
+ browserTest.onUIMode(remoting.AppMode.CLIENT_PIN_PROMPT).then( |
+ this.enterPIN_.bind(this, data.pin) |
+ ).then( |
+ // Sleep for two seconds to allow the host backoff timer to reset. |
+ base.Promise.sleep.bind(window, 2000) |
+ ).then(function() { |
+ // On fulfilled. |
+ browserTest.pass(); |
+ }, function(reason) { |
+ // On rejected. |
+ browserTest.fail(reason); |
+ }); |
+ |
+ // Connect to me2me Host. |
+ browserTest.clickOnControl('this-host-connect'); |
+}; |
+ |
+browserTest.Invalid_PIN.prototype.enterPIN_ = function(pin) { |
+ var InvalidPINError = remoting.Error.INVALID_ACCESS_CODE; |
+ var promise = browserTest.expectMe2MeError(InvalidPINError); |
+ |
+ document.getElementById('pin-entry').value = pin; |
+ browserTest.clickOnControl('pin-connect-button'); |
+ |
+ return promise; |
+}; |