Chromium Code Reviews| Index: content/browser/webrtc_getusermedia_browsertest.cc |
| diff --git a/content/browser/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc_getusermedia_browsertest.cc |
| index 04688eb48d788b2c6fe03eeeade065723979396a..a7153f28cd9a0e76511d205c4d6fbc0130361301 100644 |
| --- a/content/browser/webrtc_getusermedia_browsertest.cc |
| +++ b/content/browser/webrtc_getusermedia_browsertest.cc |
| @@ -18,20 +18,22 @@ namespace content { |
| class WebrtcGetUserMediaTest: public ContentBrowserTest { |
| public: |
| WebrtcGetUserMediaTest() {} |
| - protected: |
| - void TestGetUserMediaWithConstraints(const std::string& constraints) { |
| + |
| + virtual void SetUp() OVERRIDE { |
| ASSERT_TRUE(test_server()->Start()); |
| - GURL empty_url(test_server()->GetURL( |
| - "files/media/getusermedia_and_stop.html")); |
| - NavigateToURL(shell(), empty_url); |
| + ContentBrowserTest::SetUp(); |
| + } |
| + virtual void TearDown() OVERRIDE { |
| + ContentBrowserTest::TearDown(); |
| + ASSERT_TRUE(test_server()->Stop()); |
|
jam
2012/12/03 15:55:54
test_server's destructor already calls Stop(), so
phoglund_chromium
2012/12/03 17:34:51
Done.
|
| + } |
| + protected: |
| + bool ExecuteJavascript(const std::string& javascript) { |
| RenderViewHost* render_view_host = |
| shell()->web_contents()->GetRenderViewHost(); |
| - EXPECT_TRUE(ExecuteJavaScript(render_view_host, L"", |
| - ASCIIToWide(constraints))); |
| - |
| - ExpectTitle("OK"); |
| + return ExecuteJavaScript(render_view_host, L"", ASCIIToWide(javascript)); |
| } |
| void ExpectTitle(const std::string& expected_title) const { |
| @@ -45,16 +47,21 @@ class WebrtcGetUserMediaTest: public ContentBrowserTest { |
| // see that the success callback is called. If the error callback is called or |
| // none of the callbacks are called the tests will simply time out and fail. |
| IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, GetVideoStreamAndStop) { |
|
phoglund_chromium
2012/12/03 14:25:08
I think this way of organizing the test made a bit
jam
2012/12/03 15:55:54
to me they're both as easy to understand, but if y
phoglund_chromium
2012/12/03 17:34:51
Yeah, I think we will go in a direction where we m
|
| - TestGetUserMediaWithConstraints("getUserMedia({video: true});"); |
| + GURL url(test_server()->GetURL("files/media/getusermedia_and_stop.html")); |
| + NavigateToURL(shell(), url); |
| + |
| + EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true});")); |
| + |
| + ExpectTitle("OK"); |
| } |
| IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, GetAudioAndVideoStreamAndStop) { |
| - TestGetUserMediaWithConstraints("getUserMedia({video: true, audio: true});"); |
| -} |
| + GURL url(test_server()->GetURL("files/media/getusermedia_and_stop.html")); |
| + NavigateToURL(shell(), url); |
| + |
| + EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true, audio: true});")); |
| -// TODO(phoglund): enable once we have fake audio device support. |
| -IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, DISABLED_GetAudioStreamAndStop) { |
| - TestGetUserMediaWithConstraints("getUserMedia({audio: true});"); |
| + ExpectTitle("OK"); |
| } |
| } // namespace content |