Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: content/browser/media/webrtc_aecdump_browsertest.cc

Issue 516883002: Disabling WebRTC call tests on Android ASAN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing indent Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/media/webrtc_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/process/process_handle.h"
6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/stringprintf.h"
8 #include "content/browser/media/webrtc_internals.h"
9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/test/browser_test_utils.h"
11 #include "content/public/test/content_browser_test_utils.h"
12 #include "content/shell/browser/shell.h"
13 #include "content/test/webrtc_content_browsertest_base.h"
14 #include "net/test/embedded_test_server/embedded_test_server.h"
15
16 namespace {
17
18 const int kExpectedConsumerId = 0;
19
20 // Get the ID for the render process host when there should only be one.
21 bool GetRenderProcessHostId(base::ProcessId* id) {
22 content::RenderProcessHost::iterator it(
23 content::RenderProcessHost::AllHostsIterator());
24 *id = base::GetProcId(it.GetCurrentValue()->GetHandle());
25 EXPECT_NE(base::kNullProcessId, *id);
26 if (*id == base::kNullProcessId)
27 return false;
28 it.Advance();
29 EXPECT_TRUE(it.IsAtEnd());
30 return it.IsAtEnd();
31 }
32
33 } // namespace
34
35 namespace content {
36
37 class WebRtcAecDumpBrowserTest : public WebRtcContentBrowserTest {
38 public:
39 WebRtcAecDumpBrowserTest() {}
40 virtual ~WebRtcAecDumpBrowserTest() {}
41 };
42
43 #if defined(OS_WIN)
44 #define IntToStringType base::IntToString16
45 #else
46 #define IntToStringType base::IntToString
47 #endif
48
49 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
50 // Timing out on ARM linux bot: http://crbug.com/238490
51 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
52 #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
53 // Renderer crashes under Android ASAN: https://crbug.com/408496.
54 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
55 #else
56 #define MAYBE_CallWithAecDump CallWithAecDump
57 #endif
58
59 // This tests will make a complete PeerConnection-based call, verify that
60 // video is playing for the call, and verify that a non-empty AEC dump file
61 // exists. The AEC dump is enabled through webrtc-internals. The HTML and
62 // Javascript is bypassed since it would trigger a file picker dialog. Instead,
63 // the dialog callback FileSelected() is invoked directly. In fact, there's
64 // never a webrtc-internals page opened at all since that's not needed.
65 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) {
66 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
67
68 // We must navigate somewhere first so that the render process is created.
69 NavigateToURL(shell(), GURL(""));
70
71 base::FilePath dump_file;
72 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
73 base::DeleteFile(dump_file, false);
74
75 // This fakes the behavior of another open tab with webrtc-internals, and
76 // enabling AEC dump in that tab.
77 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
78
79 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
80 NavigateToURL(shell(), url);
81 DisableOpusIfOnAndroid();
82 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
83
84 EXPECT_FALSE(base::PathExists(dump_file));
85
86 // Add file extensions that we expect to be added. The dump name will be
87 // <temporary path>.<render process id>.<consumer id>, for example
88 // "/tmp/.com.google.Chrome.Z6UC3P.12345.0".
89 base::ProcessId render_process_id = base::kNullProcessId;
90 EXPECT_TRUE(GetRenderProcessHostId(&render_process_id));
91 dump_file = dump_file.AddExtension(IntToStringType(render_process_id))
92 .AddExtension(IntToStringType(kExpectedConsumerId));
93
94 EXPECT_TRUE(base::PathExists(dump_file));
95 int64 file_size = 0;
96 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
97 EXPECT_GT(file_size, 0);
98
99 base::DeleteFile(dump_file, false);
100 }
101
102 // TODO(grunell): Add test for multiple dumps when re-use of
103 // MediaStreamAudioProcessor in AudioCapturer has been removed.
104
105 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
106 // Timing out on ARM linux bot: http://crbug.com/238490
107 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled
108 #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
109 // Renderer crashes under Android ASAN: https://crbug.com/408496.
110 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled
111 #else
112 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab led
113 #endif
114
115 // As above, but enable and disable dump before starting a call. The file should
116 // be created, but should be empty.
117 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest,
118 MAYBE_CallWithAecDumpEnabledThenDisabled) {
119 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
120
121 // We must navigate somewhere first so that the render process is created.
122 NavigateToURL(shell(), GURL(""));
123
124 base::FilePath dump_file;
125 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
126 base::DeleteFile(dump_file, false);
127
128 // This fakes the behavior of another open tab with webrtc-internals, and
129 // enabling AEC dump in that tab, then disabling it.
130 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
131 WebRTCInternals::GetInstance()->DisableAecDump();
132
133 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
134 NavigateToURL(shell(), url);
135 DisableOpusIfOnAndroid();
136 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
137
138 // Add file extensions that we expect to be added.
139 base::ProcessId render_process_id = base::kNullProcessId;
140 EXPECT_TRUE(GetRenderProcessHostId(&render_process_id));
141 dump_file = dump_file.AddExtension(IntToStringType(render_process_id))
142 .AddExtension(IntToStringType(kExpectedConsumerId));
143
144 EXPECT_FALSE(base::PathExists(dump_file));
145
146 base::DeleteFile(dump_file, false);
147 }
148
149 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
150 // Timing out on ARM linux bot: http://crbug.com/238490
151 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump
152 #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
153 // Renderer crashes under Android ASAN: https://crbug.com/408496.
154 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump
155 #else
156 #define MAYBE_TwoCallsWithAecDump TwoCallsWithAecDump
157 #endif
158
159 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_TwoCallsWithAecDump) {
160 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
161
162 // We must navigate somewhere first so that the render process is created.
163 NavigateToURL(shell(), GURL(""));
164
165 // Create a second window.
166 Shell* shell2 = CreateBrowser();
167 NavigateToURL(shell2, GURL(""));
168
169 base::FilePath dump_file;
170 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
171 base::DeleteFile(dump_file, false);
172
173 // This fakes the behavior of another open tab with webrtc-internals, and
174 // enabling AEC dump in that tab.
175 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
176
177 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
178
179 NavigateToURL(shell(), url);
180 NavigateToURL(shell2, url);
181 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
182 std::string result;
183 EXPECT_TRUE(ExecuteScriptAndExtractString(
184 shell2->web_contents(),
185 "call({video: true, audio: true});",
186 &result));
187 ASSERT_STREQ("OK", result.c_str());
188
189 EXPECT_FALSE(base::PathExists(dump_file));
190
191 RenderProcessHost::iterator it =
192 content::RenderProcessHost::AllHostsIterator();
193 for (; !it.IsAtEnd(); it.Advance()) {
194 base::ProcessId render_process_id =
195 base::GetProcId(it.GetCurrentValue()->GetHandle());
196 EXPECT_NE(base::kNullProcessId, render_process_id);
197
198 // Add file extensions that we expect to be added.
199 base::FilePath unique_dump_file =
200 dump_file.AddExtension(IntToStringType(render_process_id))
201 .AddExtension(IntToStringType(kExpectedConsumerId));
202
203 EXPECT_TRUE(base::PathExists(unique_dump_file));
204 int64 file_size = 0;
205 EXPECT_TRUE(base::GetFileSize(unique_dump_file, &file_size));
206 EXPECT_GT(file_size, 0);
207
208 base::DeleteFile(unique_dump_file, false);
209 }
210 }
211
212 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/webrtc_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698