Index: chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc |
diff --git a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc |
index 9669957841cdf627fe27093bdc96bddf365a2ccf..06ce15ee1a6679c0a01211686015ea076fb23ac1 100644 |
--- a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc |
+++ b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc |
@@ -42,10 +42,7 @@ const char kTitlePageOfAppEngineAdminPage[] = "Instances"; |
class WebrtcApprtcBrowserTest : public WebRtcTestBase { |
public: |
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
- EXPECT_FALSE(command_line->HasSwitch( |
- switches::kUseFakeDeviceForMediaStream)); |
- EXPECT_FALSE(command_line->HasSwitch( |
- switches::kUseFakeUIForMediaStream)); |
+ EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); |
// The video playback will not work without a GPU, so force its use here. |
command_line->AppendSwitch(switches::kUseGpuInTests); |
@@ -116,8 +113,42 @@ class WebrtcApprtcBrowserTest : public WebRtcTestBase { |
return source_dir; |
} |
+ bool LaunchFirefoxWithUrl(const GURL& url) { |
+ base::FilePath firefox_binary = |
+ GetSourceDir().Append( |
+ FILE_PATH_LITERAL("../firefox-nightly/firefox/firefox")); |
tommi (sloooow) - chröme
2013/12/12 18:41:33
Add each path component separately for cross platf
phoglund_chromium
2013/12/13 14:35:10
I can do that, but it will _work_ like this. For i
tommi (sloooow) - chröme
2013/12/13 14:51:26
OK, if Append takes care of this then it's fine as
|
+ if (!base::PathExists(firefox_binary)) { |
+ LOG(ERROR) << "Missing firefox binary at " << |
+ firefox_binary.value() << ". " << kAdviseOnGclientSolution; |
+ return false; |
+ } |
+ base::FilePath firefox_launcher = |
+ GetSourceDir().Append( |
+ FILE_PATH_LITERAL("../webrtc.DEPS/run_firefox_webrtc.py")); |
+ if (!base::PathExists(firefox_launcher)) { |
+ LOG(ERROR) << "Missing firefox launcher at " << |
+ firefox_launcher.value() << ". " << kAdviseOnGclientSolution; |
+ return false; |
+ } |
+ |
+ CommandLine command_line(firefox_launcher); |
+ command_line.AppendSwitchPath("--binary", firefox_binary); |
+ command_line.AppendSwitchASCII("--webpage", url.spec()); |
+ |
+ VLOG(0) << "Running " << command_line.GetCommandLineString(); |
tommi (sloooow) - chröme
2013/12/12 19:52:05
forgot one thing - VLOG(0) is apparently frowned u
phoglund_chromium
2013/12/13 14:35:10
Done.
|
+ return base::LaunchProcess(command_line, base::LaunchOptions(), |
kjellander_chromium
2013/12/13 10:19:11
What happens if there's no webcam available for Fi
phoglund_chromium
2013/12/13 14:35:10
Don't know, I guess gUM will fail there and the ca
|
+ &firefox_); |
+ |
+ return true; |
+ } |
+ |
+ bool StopFirefox() { |
+ return base::KillProcess(firefox_, 0, false); |
kjellander_chromium
2013/12/13 10:19:11
Is there some way we can check if firefox crashed
tommi (sloooow) - chröme
2013/12/13 12:21:31
Can we find a better way to close Firefox?
Killing
phoglund_chromium
2013/12/13 14:35:10
I can't see any easy portable way of doing that un
phoglund_chromium
2013/12/13 14:35:10
It will shut down cleanly on Linux, because I hook
tommi (sloooow) - chröme
2013/12/13 14:51:26
Signals like that don't exist on Windows unfortuna
phoglund_chromium
2013/12/13 15:13:35
Nope, you are right, I actually tried it and regis
tommi (sloooow) - chröme
2013/12/13 15:22:30
Sounds good. Can you add a note explaining that a
|
+ } |
+ |
private: |
base::ProcessHandle dev_appserver_; |
+ base::ProcessHandle firefox_; |
}; |
IN_PROC_BROWSER_TEST_F(WebrtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { |
@@ -148,3 +179,28 @@ IN_PROC_BROWSER_TEST_F(WebrtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { |
ASSERT_TRUE(StopApprtcInstance()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(WebrtcApprtcBrowserTest, |
+ MANUAL_FirefoxApprtcInteropTest) { |
+ ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost()); |
kjellander_chromium
2013/12/13 10:19:11
I think we want to skip this on Vista as well, as
kjellander_chromium
2013/12/13 10:19:11
Add DetectErrorsInJavaScript(); since communicatin
phoglund_chromium
2013/12/13 14:35:10
You mean skip it on XP? Yeah, probably. Actually I
phoglund_chromium
2013/12/13 14:35:10
Done.
|
+ while (!LocalApprtcInstanceIsUp()) |
+ VLOG(0) << "Waiting for AppRTC to come up..."; |
tommi (sloooow) - chröme
2013/12/12 19:52:05
would be nice to change all the VLOG(0)'s to VLOG(
phoglund_chromium
2013/12/13 14:35:10
Done.
|
+ |
+ // Run Chrome with a fake device to avoid having the browsers fight over the |
+ // camera (we'll just give that to firefox here). |
+ CommandLine::ForCurrentProcess()->AppendSwitch( |
+ switches::kUseFakeDeviceForMediaStream); |
+ |
+ GURL room_url = GURL(base::StringPrintf("http://localhost:9999?r=room_%d", |
+ base::RandInt(0, 65536))); |
kjellander_chromium
2013/12/13 10:19:11
Do we really need to randomize this? I would be su
phoglund_chromium
2013/12/13 14:35:10
Yeah, this test can't execute in parallel, but it
tommi (sloooow) - chröme
2013/12/13 14:51:26
The room number could also be the thread id. As i
kjellander_chromium
2013/12/13 14:53:21
Fair enough, as we don't run these tests in parall
|
+ content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); |
+ |
+ // TODO(phoglund): Remove when this bug gets fixed: |
+ // http://code.google.com/p/webrtc/issues/detail?id=1742 |
+ SleepInJavascript(chrome_tab, 5000); |
+ |
+ ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); |
+ |
+ ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); |
tommi (sloooow) - chröme
2013/12/12 18:41:33
EXPECT_TRUE so that the next line will be run.
Fi
phoglund_chromium
2013/12/13 14:35:10
I think it's good to return early if we have alrea
|
+ ASSERT_TRUE(StopFirefox()); |
kjellander_chromium
2013/12/13 10:19:11
Add
ASSERT_TRUE(StopApprtcInstance());
after stop
phoglund_chromium
2013/12/13 14:35:10
Done.
|
+} |