OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/renderer_host/render_process_host_impl.h" | 9 #include "content/browser/renderer_host/render_process_host_impl.h" |
10 #include "content/common/child_process_messages.h" | 10 #include "content/common/child_process_messages.h" |
11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 #include "content/public/browser/render_process_host_observer.h" | 13 #include "content/public/browser/render_process_host_observer.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
16 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
17 #include "content/public/test/content_browser_test_utils.h" | 17 #include "content/public/test/content_browser_test_utils.h" |
18 #include "content/public/test/test_service.mojom.h" | 18 #include "content/public/test/test_service.mojom.h" |
19 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
20 #include "media/base/bind_to_current_loop.h" | 20 #include "media/base/bind_to_current_loop.h" |
21 #include "media/base/media_switches.h" | 21 #include "media/base/media_switches.h" |
22 #include "media/base/test_data_util.h" | 22 #include "media/base/test_data_util.h" |
| 23 #include "media/mojo/features.h" |
23 #include "net/test/embedded_test_server/embedded_test_server.h" | 24 #include "net/test/embedded_test_server/embedded_test_server.h" |
24 | 25 |
25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
27 #endif | 28 #endif |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 namespace { | 31 namespace { |
31 | 32 |
32 int RenderProcessHostCount() { | 33 int RenderProcessHostCount() { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 private: | 260 private: |
260 base::Closure quit_closure_; | 261 base::Closure quit_closure_; |
261 }; | 262 }; |
262 | 263 |
263 // Tests that audio stream counts (used for process priority calculations) are | 264 // Tests that audio stream counts (used for process priority calculations) are |
264 // properly set and cleared during media playback and renderer terminations. | 265 // properly set and cleared during media playback and renderer terminations. |
265 // | 266 // |
266 // Note: This test can't run when the Mojo Renderer is used since it does not | 267 // Note: This test can't run when the Mojo Renderer is used since it does not |
267 // create audio streams through the normal audio pathways; at present this is | 268 // create audio streams through the normal audio pathways; at present this is |
268 // only used by Chromecast. | 269 // only used by Chromecast. |
269 #if defined(ENABLE_MOJO_RENDERER) | 270 #if BUILDFLAG(ENABLE_MOJO_RENDERER) |
270 #define KillProcessZerosAudioStreams DISABLED_KillProcessZerosAudioStreams | 271 #define KillProcessZerosAudioStreams DISABLED_KillProcessZerosAudioStreams |
271 #endif | 272 #endif |
272 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, KillProcessZerosAudioStreams) { | 273 IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, KillProcessZerosAudioStreams) { |
273 embedded_test_server()->ServeFilesFromSourceDirectory( | 274 embedded_test_server()->ServeFilesFromSourceDirectory( |
274 media::GetTestDataPath()); | 275 media::GetTestDataPath()); |
275 ASSERT_TRUE(embedded_test_server()->Start()); | 276 ASSERT_TRUE(embedded_test_server()->Start()); |
276 NavigateToURL(shell(), embedded_test_server()->GetURL("/sfx_s16le.wav")); | 277 NavigateToURL(shell(), embedded_test_server()->GetURL("/sfx_s16le.wav")); |
277 RenderProcessHostImpl* rph = static_cast<RenderProcessHostImpl*>( | 278 RenderProcessHostImpl* rph = static_cast<RenderProcessHostImpl*>( |
278 shell()->web_contents()->GetMainFrame()->GetProcess()); | 279 shell()->web_contents()->GetMainFrame()->GetProcess()); |
279 | 280 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // Verify shutdown went as expected. | 322 // Verify shutdown went as expected. |
322 EXPECT_EQ(0, rph->get_audio_stream_count_for_testing()); | 323 EXPECT_EQ(0, rph->get_audio_stream_count_for_testing()); |
323 EXPECT_EQ(1, process_exits_); | 324 EXPECT_EQ(1, process_exits_); |
324 EXPECT_EQ(0, host_destructions_); | 325 EXPECT_EQ(0, host_destructions_); |
325 if (!host_destructions_) | 326 if (!host_destructions_) |
326 rph->RemoveObserver(this); | 327 rph->RemoveObserver(this); |
327 } | 328 } |
328 | 329 |
329 } // namespace | 330 } // namespace |
330 } // namespace content | 331 } // namespace content |
OLD | NEW |