OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/test/webrtc_content_browsertest_base.h" | 5 #include "content/test/webrtc_content_browsertest_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 // doesn't have other interfaces available. | 26 // doesn't have other interfaces available. |
27 CommandLine::ForCurrentProcess()->AppendSwitch( | 27 CommandLine::ForCurrentProcess()->AppendSwitch( |
28 switches::kAllowLoopbackInPeerConnection); | 28 switches::kAllowLoopbackInPeerConnection); |
29 } | 29 } |
30 | 30 |
31 void WebRtcContentBrowserTest::SetUp() { | 31 void WebRtcContentBrowserTest::SetUp() { |
32 EnablePixelOutput(); | 32 EnablePixelOutput(); |
33 ContentBrowserTest::SetUp(); | 33 ContentBrowserTest::SetUp(); |
34 } | 34 } |
35 | 35 |
36 bool WebRtcContentBrowserTest::ExecuteJavascript( | |
37 const std::string& javascript) { | |
38 return ExecuteScript(shell()->web_contents(), javascript); | |
39 } | |
40 | |
41 // Executes |javascript|. The script is required to use | 36 // Executes |javascript|. The script is required to use |
42 // window.domAutomationController.send to send a string value back to here. | 37 // window.domAutomationController.send to send a string value back to here. |
43 std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult( | 38 std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult( |
44 const std::string& javascript) { | 39 const std::string& javascript) { |
45 std::string result; | 40 std::string result; |
46 EXPECT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(), | 41 EXPECT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(), |
47 javascript, | 42 javascript, |
48 &result)); | 43 &result)); |
49 return result; | 44 return result; |
50 } | 45 } |
51 | 46 |
52 void WebRtcContentBrowserTest::ExpectTitle( | 47 void WebRtcContentBrowserTest::ExecuteJavascriptAndWaitForOk( |
53 const std::string& expected_title) const { | 48 const std::string& javascript) { |
54 base::string16 expected_title16(base::ASCIIToUTF16(expected_title)); | 49 #if defined (OS_ANDROID) |
55 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | 50 // Always force iSAC 16K on Android for now (Opus is broken). |
56 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 51 ASSERT_TRUE(ExecuteJavascript("forceIsac16KInSdp();")); |
perkj_chrome
2014/03/07 14:00:21
Does this work for all tests regardless of the tes
phoglund_chromium
2014/03/07 14:23:36
You're right, this will break android for the getu
| |
57 } | 52 #endif |
53 | |
54 std::string result = ExecuteJavascriptAndReturnResult(javascript); | |
55 if (result != "OK") { | |
56 printf("From javascript: %s", result.c_str()); | |
57 FAIL(); | |
58 } | |
59 } | |
58 | 60 |
59 std::string WebRtcContentBrowserTest::GenerateGetUserMediaCall( | 61 std::string WebRtcContentBrowserTest::GenerateGetUserMediaCall( |
60 const char* function_name, | 62 const char* function_name, |
61 int min_width, | 63 int min_width, |
62 int max_width, | 64 int max_width, |
63 int min_height, | 65 int min_height, |
64 int max_height, | 66 int max_height, |
65 int min_frame_rate, | 67 int min_frame_rate, |
66 int max_frame_rate) const { | 68 int max_frame_rate) const { |
67 return base::StringPrintf( | 69 return base::StringPrintf( |
68 "%s({video: {mandatory: {minWidth: %d, maxWidth: %d, " | 70 "%s({video: {mandatory: {minWidth: %d, maxWidth: %d, " |
69 "minHeight: %d, maxHeight: %d, minFrameRate: %d, maxFrameRate: %d}, " | 71 "minHeight: %d, maxHeight: %d, minFrameRate: %d, maxFrameRate: %d}, " |
70 "optional: []}});", | 72 "optional: []}});", |
71 function_name, | 73 function_name, |
72 min_width, | 74 min_width, |
73 max_width, | 75 max_width, |
74 min_height, | 76 min_height, |
75 max_height, | 77 max_height, |
76 min_frame_rate, | 78 min_frame_rate, |
77 max_frame_rate); | 79 max_frame_rate); |
78 } | 80 } |
79 | 81 |
80 } // namespace content | 82 } // namespace content |
OLD | NEW |