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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/media/webrtc_browsertest_base.h" | 12 #include "chrome/browser/media/webrtc_browsertest_base.h" |
13 #include "chrome/browser/media/webrtc_browsertest_common.h" | 13 #include "chrome/browser/media/webrtc_browsertest_common.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
20 #include "media/base/media_switches.h" | 20 #include "media/base/media_switches.h" |
21 #include "net/test/python_utils.h" | 21 #include "net/test/python_utils.h" |
22 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
23 | 23 |
24 // You need this solution to run this test. The solution will download appengine | 24 // You need this solution to run this test. The solution will download appengine |
25 // and the apprtc code for you. | 25 // and the apprtc code for you. |
26 const char kAdviseOnGclientSolution[] = | 26 const char kAdviseOnGclientSolution[] = |
27 "You need to add this solution to your .gclient to run this test:\n" | 27 "You need to add this solution to your .gclient to run this test:\n" |
28 "{\n" | 28 "{\n" |
29 " \"name\" : \"webrtc.DEPS\",\n" | 29 " \"name\" : \"webrtc.DEPS\",\n" |
30 " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" | 30 " \"url\" : \"https://chromium.googlesource.com/chromium/deps/" |
31 "third_party/webrtc/webrtc.DEPS\",\n" | 31 "webrtc/webrtc.DEPS\",\n" |
32 "}"; | 32 "}"; |
33 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; | 33 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; |
34 | 34 |
35 const char kIsApprtcCallUpJavascript[] = | 35 const char kIsApprtcCallUpJavascript[] = |
36 "var remoteVideo = document.querySelector('#remote-video');" | 36 "var remoteVideo = document.querySelector('#remote-video');" |
37 "var remoteVideoActive =" | 37 "var remoteVideoActive =" |
38 " remoteVideo != null &&" | 38 " remoteVideo != null &&" |
39 " remoteVideo.classList.contains('active');" | 39 " remoteVideo.classList.contains('active');" |
40 "window.domAutomationController.send(remoteVideoActive.toString());"; | 40 "window.domAutomationController.send(remoteVideoActive.toString());"; |
41 | 41 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 base::FilePath appengine_dev_appserver = | 79 base::FilePath appengine_dev_appserver = |
80 GetSourceDir().Append( | 80 GetSourceDir().Append( |
81 FILE_PATH_LITERAL("../google_appengine/dev_appserver.py")); | 81 FILE_PATH_LITERAL("../google_appengine/dev_appserver.py")); |
82 if (!base::PathExists(appengine_dev_appserver)) { | 82 if (!base::PathExists(appengine_dev_appserver)) { |
83 LOG(ERROR) << "Missing appengine sdk at " << | 83 LOG(ERROR) << "Missing appengine sdk at " << |
84 appengine_dev_appserver.value() << ". " << kAdviseOnGclientSolution; | 84 appengine_dev_appserver.value() << ". " << kAdviseOnGclientSolution; |
85 return false; | 85 return false; |
86 } | 86 } |
87 | 87 |
88 base::FilePath apprtc_dir = | 88 base::FilePath apprtc_dir = |
89 GetSourceDir().Append(FILE_PATH_LITERAL( | 89 GetSourceDir().Append(FILE_PATH_LITERAL("out/apprtc/out/app_engine")); |
90 "out/webrtc-samples/samples/web/content/apprtc")); | |
91 if (!base::PathExists(apprtc_dir)) { | 90 if (!base::PathExists(apprtc_dir)) { |
92 LOG(ERROR) << "Missing AppRTC code at " << | 91 LOG(ERROR) << "Missing AppRTC AppEngine app at " << |
93 apprtc_dir.value() << ". " << kAdviseOnGclientSolution; | 92 apprtc_dir.value() << ". " << kAdviseOnGclientSolution; |
94 return false; | 93 return false; |
95 } | 94 } |
| 95 if (!base::PathExists(apprtc_dir.Append(FILE_PATH_LITERAL("app.yaml")))) { |
| 96 LOG(ERROR) << "The AppRTC AppEngine app at " << |
| 97 apprtc_dir.value() << " appears to have not been built." << |
| 98 "This should have been done by webrtc.DEPS scripts which invoke " << |
| 99 "'grunt build' on AppRTC."; |
| 100 return false; |
| 101 } |
96 | 102 |
97 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 103 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
98 EXPECT_TRUE(GetPythonCommand(&command_line)); | 104 EXPECT_TRUE(GetPythonCommand(&command_line)); |
99 | 105 |
100 command_line.AppendArgPath(appengine_dev_appserver); | 106 command_line.AppendArgPath(appengine_dev_appserver); |
101 command_line.AppendArgPath(apprtc_dir); | 107 command_line.AppendArgPath(apprtc_dir); |
102 command_line.AppendArg("--port=" + port); | 108 command_line.AppendArg("--port=" + port); |
103 command_line.AppendArg("--admin_port=9998"); | 109 command_line.AppendArg("--admin_port=9998"); |
104 command_line.AppendArg("--skip_sdk_update_check"); | 110 command_line.AppendArg("--skip_sdk_update_check"); |
105 command_line.AppendArg("--clear_datastore=yes"); | 111 command_line.AppendArg("--clear_datastore=yes"); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 "&firefox_fake_device=1"); | 286 "&firefox_fake_device=1"); |
281 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); | 287 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); |
282 | 288 |
283 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); | 289 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); |
284 | 290 |
285 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); | 291 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); |
286 | 292 |
287 // Ensure Firefox manages to send video our way. | 293 // Ensure Firefox manages to send video our way. |
288 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); | 294 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); |
289 } | 295 } |
OLD | NEW |