OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/shell/shell.h" | 10 #include "content/shell/shell.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // We need fake devices in this test since we want to run on naked VMs. We | 23 // We need fake devices in this test since we want to run on naked VMs. We |
24 // assume this switch is set by default in content_browsertests. | 24 // assume this switch is set by default in content_browsertests. |
25 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 25 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
26 switches::kUseFakeDeviceForMediaStream)); | 26 switches::kUseFakeDeviceForMediaStream)); |
27 | 27 |
28 ASSERT_TRUE(test_server()->Start()); | 28 ASSERT_TRUE(test_server()->Start()); |
29 ContentBrowserTest::SetUp(); | 29 ContentBrowserTest::SetUp(); |
30 } | 30 } |
31 protected: | 31 protected: |
32 bool ExecuteJavascript(const std::string& javascript) { | 32 bool ExecuteJavascript(const std::string& javascript) { |
33 RenderViewHost* render_view_host = | 33 return ExecuteScript(shell()->web_contents(), javascript); |
34 shell()->web_contents()->GetRenderViewHost(); | |
35 | |
36 return ExecuteJavaScript(render_view_host, "", javascript); | |
37 } | 34 } |
38 | 35 |
39 void ExpectTitle(const std::string& expected_title) const { | 36 void ExpectTitle(const std::string& expected_title) const { |
40 string16 expected_title16(ASCIIToUTF16(expected_title)); | 37 string16 expected_title16(ASCIIToUTF16(expected_title)); |
41 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | 38 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); |
42 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 39 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
43 } | 40 } |
44 }; | 41 }; |
45 | 42 |
46 // These tests will all make a getUserMedia call with different constraints and | 43 // These tests will all make a getUserMedia call with different constraints and |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 CanSetupAudioAndVideoCallWithoutMsidAndBundle) { | 87 CanSetupAudioAndVideoCallWithoutMsidAndBundle) { |
91 GURL url(test_server()->GetURL("files/media/peerconnection-call.html")); | 88 GURL url(test_server()->GetURL("files/media/peerconnection-call.html")); |
92 NavigateToURL(shell(), url); | 89 NavigateToURL(shell(), url); |
93 | 90 |
94 EXPECT_TRUE(ExecuteJavascript("callWithoutMsidAndBundle();")); | 91 EXPECT_TRUE(ExecuteJavascript("callWithoutMsidAndBundle();")); |
95 ExpectTitle("OK"); | 92 ExpectTitle("OK"); |
96 } | 93 } |
97 | 94 |
98 } // namespace content | 95 } // namespace content |
99 | 96 |
OLD | NEW |