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

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

Issue 838543002: Implement browser test for It2Me (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL feedback 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
Index: chrome/test/remoting/remote_desktop_browsertest.cc
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc
index a18778a990d5598c1717992faba72e710ac70232..fd7c9fb089b2833c22ac40f4b42ad4ed66757759 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -166,8 +166,12 @@ void RemoteDesktopBrowserTest::VerifyChromotingLoaded(bool expected) {
ASSERT_EQ(installed, expected);
}
-void RemoteDesktopBrowserTest::LaunchChromotingApp(bool defer_start) {
+void RemoteDesktopBrowserTest::LaunchChromotingApp(
+ bool defer_start,
+ WindowOpenDisposition window_open_disposition,
+ content::WebContents** app_web_contents) {
ASSERT_TRUE(extension_);
+ ASSERT_EQ(*app_web_contents, nullptr);
GURL chromoting_main = Chromoting_Main_URL();
// We cannot simply wait for any page load because the first page
@@ -183,11 +187,15 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp(bool defer_start) {
extensions::FeatureSwitch::trace_app_source(),
defer_start);
+ if (is_platform_app()) {
+ window_open_disposition = NEW_WINDOW;
Jamie 2015/01/10 00:14:24 Could we get rid of the disposition parameter if w
kelvinp 2015/01/12 21:15:24 V2 test currently doesn't run reliably. I prefer
+ }
+
OpenApplication(AppLaunchParams(browser()->profile(), extension_,
is_platform_app()
? extensions::LAUNCH_CONTAINER_NONE
: extensions::LAUNCH_CONTAINER_TAB,
- is_platform_app() ? NEW_WINDOW : CURRENT_TAB,
+ window_open_disposition,
extensions::SOURCE_TEST));
observer.Wait();
@@ -199,10 +207,12 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp(bool defer_start) {
content::Source<content::NavigationController>(observer.source()).ptr();
content::WebContents* web_contents = controller->GetWebContents();
+ ASSERT_TRUE(web_contents);
+
if (web_contents != active_web_contents())
web_contents_stack_.push_back(web_contents);
- app_web_content_ = web_contents;
+ *app_web_contents = web_contents;
if (is_platform_app()) {
EXPECT_EQ(GetFirstAppWindowWebContents(), active_web_contents());
@@ -218,6 +228,17 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp(bool defer_start) {
EXPECT_EQ(Chromoting_Main_URL(), GetCurrentURL());
}
+void RemoteDesktopBrowserTest::LaunchChromotingApp(
+ bool defer_start,
+ content::WebContents** app_web_contents) {
+ LaunchChromotingApp(defer_start, CURRENT_TAB, app_web_contents);
+}
+
+void RemoteDesktopBrowserTest::LaunchChromotingApp(bool defer_start) {
+ content::WebContents* app_web_contents = nullptr;
+ LaunchChromotingApp(defer_start, CURRENT_TAB, &app_web_contents);
+}
+
void RemoteDesktopBrowserTest::StartChromotingApp() {
ClickOnControl("browser-test-continue-init");
};
@@ -470,18 +491,20 @@ void RemoteDesktopBrowserTest::Cleanup() {
ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait());
}
-void RemoteDesktopBrowserTest::SetUpTestForMe2Me() {
+content::WebContents* RemoteDesktopBrowserTest::SetUpTest() {
+ content::WebContents* app_web_content = nullptr;
VerifyInternetAccess();
Install();
- LaunchChromotingApp(false);
+ LaunchChromotingApp(false, &app_web_content);
Auth();
- LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js"));
+ LoadScript(app_web_content, FILE_PATH_LITERAL("browser_test.js"));
ExpandMe2Me();
// The call to EnsureRemoteConnectionEnabled() does a PIN reset.
// This causes the test to fail because of a recent bug:
// crbug.com/430676
// TODO(anandc): Reactivate this call after above bug is fixed.
- //EnsureRemoteConnectionEnabled();
+ //EnsureRemoteConnectionEnabled(app_web_content);
+ return app_web_content;
}
void RemoteDesktopBrowserTest::Auth() {
@@ -493,7 +516,8 @@ void RemoteDesktopBrowserTest::Auth() {
Approve();
}
-void RemoteDesktopBrowserTest::EnsureRemoteConnectionEnabled() {
+void RemoteDesktopBrowserTest::EnsureRemoteConnectionEnabled(
+ content::WebContents* app_web_content) {
// browser_test.ensureRemoteConnectionEnabled is defined in
// browser_test.js, which must be loaded before calling this function.
// TODO(kelvinp): This function currently only works on linux when the user is
@@ -501,7 +525,7 @@ void RemoteDesktopBrowserTest::EnsureRemoteConnectionEnabled() {
// to Mac (https://crbug.com/397576) and Windows (https://crbug.com/397575).
bool result;
EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
- app_web_content(),
+ app_web_content,
"browserTest.ensureRemoteConnectionEnabled(" + me2me_pin() + ")",
&result));
EXPECT_TRUE(result) << "Cannot start the host with Pin:" << me2me_pin();
@@ -717,7 +741,6 @@ bool RemoteDesktopBrowserTest::LoadScript(
return content::ExecuteScript(web_contents, script);
}
-// static
void RemoteDesktopBrowserTest::RunJavaScriptTest(
content::WebContents* web_contents,
const std::string& testName,

Powered by Google App Engine
This is Rietveld 408576698