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

Unified Diff: chrome/test/remoting/it2me_browsertest.cc

Issue 838543002: Implement browser test for It2Me (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge conflicts Created 5 years, 11 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
« no previous file with comments | « chrome/test/remoting/fullscreen_browsertest.cc ('k') | chrome/test/remoting/me2me_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/remoting/it2me_browsertest.cc
diff --git a/chrome/test/remoting/it2me_browsertest.cc b/chrome/test/remoting/it2me_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c4a3240b083d285dfd40ac022e565a4d8dfa1241
--- /dev/null
+++ b/chrome/test/remoting/it2me_browsertest.cc
@@ -0,0 +1,67 @@
+// 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.
+
+#include "base/strings/string_number_conversions.h"
+#include "chrome/test/remoting/remote_desktop_browsertest.h"
+
+namespace remoting {
+
+class It2MeBrowserTest : public RemoteDesktopBrowserTest {
+ protected:
+ std::string GetAccessCode(content::WebContents* contents);
+
+ // Launches a Chromoting app instance for the helper.
+ content::WebContents* SetUpHelperInstance();
+};
+
+std::string It2MeBrowserTest::GetAccessCode(content::WebContents* contents) {
+ RunJavaScriptTest(contents, "GetAccessCode", "{}");
+ std::string access_code = RemoteTestHelper::ExecuteScriptAndExtractString(
+ contents, "document.getElementById('access-code-display').innerText");
+ return access_code;
+}
+
+content::WebContents* It2MeBrowserTest::SetUpHelperInstance() {
+ content::WebContents* helper_content =
+ LaunchChromotingApp(false, NEW_FOREGROUND_TAB);
+ LoadBrowserTestJavaScript(helper_content);
+ LoadScript(helper_content, FILE_PATH_LITERAL("it2me_browser_test.js"));
+ return helper_content;
+}
+
+IN_PROC_BROWSER_TEST_F(It2MeBrowserTest, MANUAL_Connect) {
+ content::WebContents* helpee_content = SetUpTest();
+ LoadScript(helpee_content, FILE_PATH_LITERAL("it2me_browser_test.js"));
+
+ content::WebContents* helper_content = SetUpHelperInstance();
+ RunJavaScriptTest(helper_content, "ConnectIt2Me", "{"
+ "accessCode: '" + GetAccessCode(helpee_content) + "'"
+ "}");
+
+ Cleanup();
+}
+
+IN_PROC_BROWSER_TEST_F(It2MeBrowserTest, MANUAL_InvalidAccessCode) {
+ content::WebContents* helpee_content = SetUpTest();
+ LoadScript(helpee_content, FILE_PATH_LITERAL("it2me_browser_test.js"));
+
+ // Generate an invalid access code by generating a valid access code and
+ // changing its PIN portion.
+ std::string access_code = GetAccessCode(helpee_content);
+
+ uint64 invalid_access_code = 0;
+ ASSERT_TRUE(base::StringToUint64(access_code, &invalid_access_code));
+ std::ostringstream invalid_access_code_string;
+
+ invalid_access_code_string << ++invalid_access_code;
+
+ content::WebContents* helper_content = SetUpHelperInstance();
+ RunJavaScriptTest(helper_content, "InvalidAccessCode", "{"
+ "accessCode: '" + invalid_access_code_string.str() + "'"
+ "}");
+
+ Cleanup();
+}
+
+} // namespace remoting
« no previous file with comments | « chrome/test/remoting/fullscreen_browsertest.cc ('k') | chrome/test/remoting/me2me_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698