OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/remoting/remote_desktop_browsertest.h" | 5 #include "chrome/test/remoting/remote_desktop_browsertest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 VerifyChromotingLoaded(false); | 444 VerifyChromotingLoaded(false); |
445 if (is_unpacked()) | 445 if (is_unpacked()) |
446 InstallChromotingAppUnpacked(); | 446 InstallChromotingAppUnpacked(); |
447 else | 447 else |
448 InstallChromotingAppCrx(); | 448 InstallChromotingAppCrx(); |
449 } | 449 } |
450 | 450 |
451 VerifyChromotingLoaded(true); | 451 VerifyChromotingLoaded(true); |
452 } | 452 } |
453 | 453 |
| 454 void RemoteDesktopBrowserTest::LoadBrowserTestJavaScript( |
| 455 content::WebContents* content) { |
| 456 LoadScript(content, FILE_PATH_LITERAL("browser_test.js")); |
| 457 LoadScript(content, FILE_PATH_LITERAL("mock_client_plugin.js")); |
| 458 LoadScript(content, FILE_PATH_LITERAL("mock_host_list_api.js")); |
| 459 LoadScript(content, FILE_PATH_LITERAL("mock_identity.js")); |
| 460 LoadScript(content, FILE_PATH_LITERAL("mock_oauth2_api.js")); |
| 461 LoadScript(content, FILE_PATH_LITERAL("mock_session_connector.js")); |
| 462 LoadScript(content, FILE_PATH_LITERAL("mock_signal_strategy.js")); |
| 463 LoadScript(content, FILE_PATH_LITERAL("timeout_waiter.js")); |
| 464 } |
| 465 |
454 void RemoteDesktopBrowserTest::Cleanup() { | 466 void RemoteDesktopBrowserTest::Cleanup() { |
455 // TODO(weitaosu): Remove this hack by blocking on the appropriate | 467 // TODO(weitaosu): Remove this hack by blocking on the appropriate |
456 // notification. | 468 // notification. |
457 // The browser may still be loading images embedded in the webapp. If we | 469 // The browser may still be loading images embedded in the webapp. If we |
458 // uinstall it now those load will fail. | 470 // uinstall it now those load will fail. |
459 ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait()); | 471 ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait()); |
460 | 472 |
461 if (!NoCleanup()) { | 473 if (!NoCleanup()) { |
462 UninstallChromotingApp(); | 474 UninstallChromotingApp(); |
463 VerifyChromotingLoaded(false); | 475 VerifyChromotingLoaded(false); |
464 } | 476 } |
465 | 477 |
466 // TODO(chaitali): Remove this additional timeout after we figure out | 478 // TODO(chaitali): Remove this additional timeout after we figure out |
467 // why this is needed for the v1 app to work. | 479 // why this is needed for the v1 app to work. |
468 // Without this timeout the test fail with a "CloseWebContents called for | 480 // Without this timeout the test fail with a "CloseWebContents called for |
469 // tab not in our strip" error for the v1 app. | 481 // tab not in our strip" error for the v1 app. |
470 ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait()); | 482 ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(2)).Wait()); |
471 } | 483 } |
472 | 484 |
473 void RemoteDesktopBrowserTest::SetUpTestForMe2Me() { | 485 void RemoteDesktopBrowserTest::SetUpTestForMe2Me() { |
474 VerifyInternetAccess(); | 486 VerifyInternetAccess(); |
475 Install(); | 487 Install(); |
476 LaunchChromotingApp(false); | 488 LaunchChromotingApp(false); |
| 489 LoadBrowserTestJavaScript(app_web_content()); |
477 Auth(); | 490 Auth(); |
478 LoadScript(app_web_content(), FILE_PATH_LITERAL("browser_test.js")); | |
479 ExpandMe2Me(); | 491 ExpandMe2Me(); |
480 // The call to EnsureRemoteConnectionEnabled() does a PIN reset. | 492 // The call to EnsureRemoteConnectionEnabled() does a PIN reset. |
481 // This causes the test to fail because of a recent bug: | 493 // This causes the test to fail because of a recent bug: |
482 // crbug.com/430676 | 494 // crbug.com/430676 |
483 // TODO(anandc): Reactivate this call after above bug is fixed. | 495 // TODO(anandc): Reactivate this call after above bug is fixed. |
484 //EnsureRemoteConnectionEnabled(); | 496 //EnsureRemoteConnectionEnabled(); |
485 } | 497 } |
486 | 498 |
487 void RemoteDesktopBrowserTest::Auth() { | 499 void RemoteDesktopBrowserTest::Auth() { |
488 // For this test, we must be given the user-name and password. | 500 // For this test, we must be given the user-name and password. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 // static | 907 // static |
896 bool RemoteDesktopBrowserTest::IsEnabled( | 908 bool RemoteDesktopBrowserTest::IsEnabled( |
897 content::WebContents* client_web_content, | 909 content::WebContents* client_web_content, |
898 const std::string& element_name) { | 910 const std::string& element_name) { |
899 return !ExecuteScriptAndExtractBool( | 911 return !ExecuteScriptAndExtractBool( |
900 client_web_content, | 912 client_web_content, |
901 "document.getElementById(\"" + element_name + "\").disabled"); | 913 "document.getElementById(\"" + element_name + "\").disabled"); |
902 } | 914 } |
903 | 915 |
904 } // namespace remoting | 916 } // namespace remoting |
OLD | NEW |