| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 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/process/process_handle.h" | 5 #include "base/process/process_handle.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/browser/media/webrtc_internals.h" | 8 #include "content/browser/media/webrtc_internals.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| 11 #include "content/public/test/content_browser_test_utils.h" | 11 #include "content/public/test/content_browser_test_utils.h" |
| 12 #include "content/shell/browser/shell.h" | 12 #include "content/shell/browser/shell.h" |
| 13 #include "content/test/webrtc_content_browsertest_base.h" | 13 #include "content/test/webrtc_content_browsertest_base.h" |
| 14 #include "media/audio/audio_manager.h" |
| 14 #include "net/test/embedded_test_server/embedded_test_server.h" | 15 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 const int kExpectedConsumerId = 0; | 19 const int kExpectedConsumerId = 0; |
| 19 | 20 |
| 20 // Get the ID for the render process host when there should only be one. | 21 // Get the ID for the render process host when there should only be one. |
| 21 bool GetRenderProcessHostId(base::ProcessId* id) { | 22 bool GetRenderProcessHostId(base::ProcessId* id) { |
| 22 content::RenderProcessHost::iterator it( | 23 content::RenderProcessHost::iterator it( |
| 23 content::RenderProcessHost::AllHostsIterator()); | 24 content::RenderProcessHost::AllHostsIterator()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #define MAYBE_CallWithAecDump CallWithAecDump | 57 #define MAYBE_CallWithAecDump CallWithAecDump |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 // This tests will make a complete PeerConnection-based call, verify that | 60 // 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 // 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 // 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 // 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 // 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 // never a webrtc-internals page opened at all since that's not needed. |
| 65 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) { | 66 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) { |
| 67 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { |
| 68 LOG(INFO) << "Missing output devices: skipping test..."; |
| 69 return; |
| 70 } |
| 71 |
| 66 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 72 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 67 | 73 |
| 68 // We must navigate somewhere first so that the render process is created. | 74 // We must navigate somewhere first so that the render process is created. |
| 69 NavigateToURL(shell(), GURL("")); | 75 NavigateToURL(shell(), GURL("")); |
| 70 | 76 |
| 71 base::FilePath dump_file; | 77 base::FilePath dump_file; |
| 72 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); | 78 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); |
| 73 base::DeleteFile(dump_file, false); | 79 base::DeleteFile(dump_file, false); |
| 74 | 80 |
| 75 // This fakes the behavior of another open tab with webrtc-internals, and | 81 // This fakes the behavior of another open tab with webrtc-internals, and |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Renderer crashes under Android ASAN: https://crbug.com/408496. | 115 // Renderer crashes under Android ASAN: https://crbug.com/408496. |
| 110 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled
ThenDisabled | 116 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled
ThenDisabled |
| 111 #else | 117 #else |
| 112 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab
led | 118 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab
led |
| 113 #endif | 119 #endif |
| 114 | 120 |
| 115 // As above, but enable and disable dump before starting a call. The file should | 121 // As above, but enable and disable dump before starting a call. The file should |
| 116 // be created, but should be empty. | 122 // be created, but should be empty. |
| 117 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, | 123 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, |
| 118 MAYBE_CallWithAecDumpEnabledThenDisabled) { | 124 MAYBE_CallWithAecDumpEnabledThenDisabled) { |
| 125 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { |
| 126 LOG(INFO) << "Missing output devices: skipping test..."; |
| 127 return; |
| 128 } |
| 129 |
| 119 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 130 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 120 | 131 |
| 121 // We must navigate somewhere first so that the render process is created. | 132 // We must navigate somewhere first so that the render process is created. |
| 122 NavigateToURL(shell(), GURL("")); | 133 NavigateToURL(shell(), GURL("")); |
| 123 | 134 |
| 124 base::FilePath dump_file; | 135 base::FilePath dump_file; |
| 125 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); | 136 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); |
| 126 base::DeleteFile(dump_file, false); | 137 base::DeleteFile(dump_file, false); |
| 127 | 138 |
| 128 // This fakes the behavior of another open tab with webrtc-internals, and | 139 // This fakes the behavior of another open tab with webrtc-internals, and |
| (...skipping 21 matching lines...) Expand all Loading... |
| 150 // Timing out on ARM linux bot: http://crbug.com/238490 | 161 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 151 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump | 162 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump |
| 152 #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) | 163 #elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) |
| 153 // Renderer crashes under Android ASAN: https://crbug.com/408496. | 164 // Renderer crashes under Android ASAN: https://crbug.com/408496. |
| 154 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump | 165 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump |
| 155 #else | 166 #else |
| 156 #define MAYBE_TwoCallsWithAecDump TwoCallsWithAecDump | 167 #define MAYBE_TwoCallsWithAecDump TwoCallsWithAecDump |
| 157 #endif | 168 #endif |
| 158 | 169 |
| 159 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_TwoCallsWithAecDump) { | 170 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_TwoCallsWithAecDump) { |
| 171 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { |
| 172 LOG(INFO) << "Missing output devices: skipping test..."; |
| 173 return; |
| 174 } |
| 175 |
| 160 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 176 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 161 | 177 |
| 162 // We must navigate somewhere first so that the render process is created. | 178 // We must navigate somewhere first so that the render process is created. |
| 163 NavigateToURL(shell(), GURL("")); | 179 NavigateToURL(shell(), GURL("")); |
| 164 | 180 |
| 165 // Create a second window. | 181 // Create a second window. |
| 166 Shell* shell2 = CreateBrowser(); | 182 Shell* shell2 = CreateBrowser(); |
| 167 NavigateToURL(shell2, GURL("")); | 183 NavigateToURL(shell2, GURL("")); |
| 168 | 184 |
| 169 base::FilePath dump_file; | 185 base::FilePath dump_file; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 EXPECT_TRUE(base::PathExists(unique_dump_file)); | 219 EXPECT_TRUE(base::PathExists(unique_dump_file)); |
| 204 int64 file_size = 0; | 220 int64 file_size = 0; |
| 205 EXPECT_TRUE(base::GetFileSize(unique_dump_file, &file_size)); | 221 EXPECT_TRUE(base::GetFileSize(unique_dump_file, &file_size)); |
| 206 EXPECT_GT(file_size, 0); | 222 EXPECT_GT(file_size, 0); |
| 207 | 223 |
| 208 base::DeleteFile(unique_dump_file, false); | 224 base::DeleteFile(unique_dump_file, false); |
| 209 } | 225 } |
| 210 } | 226 } |
| 211 | 227 |
| 212 } // namespace content | 228 } // namespace content |
| OLD | NEW |