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

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

Issue 273753002: Implement 3 PIN browser tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR feedbacks 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/cancel_pin_browser_test.js
diff --git a/remoting/webapp/browser_test/cancel_pin_browser_test.js b/remoting/webapp/browser_test/cancel_pin_browser_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ca31253a76225f2fb175638a62d3d67fed5cb59a
--- /dev/null
+++ b/remoting/webapp/browser_test/cancel_pin_browser_test.js
@@ -0,0 +1,55 @@
+// 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. Hit cancel at the PIN prompt.
+ * 3. Reconnect with the PIN.
+ * 4. Verify that the session is connected.
+ */
+
+'use strict';
+
+/** @constructor */
+browserTest.Cancel_PIN = function() {};
+
+browserTest.Cancel_PIN.prototype.run = function(data) {
+ browserTest.expect(typeof data.pin == 'string');
+
+ var AppMode = remoting.AppMode;
+
+ browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT).then(function() {
+ // Sometimes the click handler of the |cancel-pin-entry-button| will fire
+ // before |clickOnControl| returns. We need to listen for the UI Mode
+ // changes before clicking the button.
Jamie 2014/05/13 18:59:54 My understanding is that one of the advantages of
kelvinp 2014/05/13 23:11:01 Good Idea. Done.
Jamie 2014/05/13 23:27:05 I think you can get rid of the comment now. Also,
+ var promise = browserTest.onUIMode(AppMode.HOME);
+ browserTest.clickOnControl('cancel-pin-entry-button');
+ return promise;
+ }).then(function() {
+ var promise = browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT);
+ browserTest.clickOnControl('this-host-connect');
+ return promise;
+ }).then(
+ this.enterPin_.bind(this, data.pin)
+ ).then(function() {
+ // On fulfilled.
+ browserTest.pass();
+ }, function(reason) {
+ // On rejected.
+ browserTest.fail(reason);
+ });
+
+ browserTest.clickOnControl('this-host-connect');
+};
+
+browserTest.Cancel_PIN.prototype.enterPin_ = function (pin) {
+ var promise = browserTest.expectMe2MeConnected();
+ document.getElementById('pin-entry').value = pin;
+ browserTest.clickOnControl('pin-connect-button');
+
+ return promise;
+};

Powered by Google App Engine
This is Rietveld 408576698