| 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/process/process.h" | 7 #include "base/process/process.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 WaitForLauncherThread(); | 113 WaitForLauncherThread(); |
| 114 WaitForMessageProcessing(wc); | 114 WaitForMessageProcessing(wc); |
| 115 return ProcessFromHandle(wc->GetRenderProcessHost()->GetHandle()); | 115 return ProcessFromHandle(wc->GetRenderProcessHost()->GetHandle()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Ensures that the backgrounding / foregrounding gets a chance to run. | 118 // Ensures that the backgrounding / foregrounding gets a chance to run. |
| 119 void WaitForLauncherThread() { | 119 void WaitForLauncherThread() { |
| 120 content::BrowserThread::PostTaskAndReply( | 120 content::BrowserThread::PostTaskAndReply( |
| 121 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 121 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
| 122 base::Bind(&base::DoNothing), base::MessageLoop::QuitClosure()); | 122 base::Bind(&base::DoNothing), base::MessageLoop::QuitWhenIdleClosure()); |
| 123 base::MessageLoop::current()->Run(); | 123 base::MessageLoop::current()->Run(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Implicitly waits for the renderer process associated with the specified | 126 // Implicitly waits for the renderer process associated with the specified |
| 127 // WebContents to process outstanding IPC messages by running some JavaScript | 127 // WebContents to process outstanding IPC messages by running some JavaScript |
| 128 // and waiting for the result. | 128 // and waiting for the result. |
| 129 void WaitForMessageProcessing(WebContents* wc) { | 129 void WaitForMessageProcessing(WebContents* wc) { |
| 130 bool result = false; | 130 bool result = false; |
| 131 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 131 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 132 wc, "window.domAutomationController.send(true);", &result)); | 132 wc, "window.domAutomationController.send(true);", &result)); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 content::ExecuteScript(audio_tab_web_contents_, | 675 content::ExecuteScript(audio_tab_web_contents_, |
| 676 "document.getElementById('audioPlayer').play();")); | 676 "document.getElementById('audioPlayer').play();")); |
| 677 | 677 |
| 678 // Wait until the two pages are not backgrounded. | 678 // Wait until the two pages are not backgrounded. |
| 679 while (no_audio_process_.IsProcessBackgrounded() || | 679 while (no_audio_process_.IsProcessBackgrounded() || |
| 680 audio_process_.IsProcessBackgrounded()) { | 680 audio_process_.IsProcessBackgrounded()) { |
| 681 base::RunLoop().RunUntilIdle(); | 681 base::RunLoop().RunUntilIdle(); |
| 682 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); | 682 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); |
| 683 } | 683 } |
| 684 } | 684 } |
| OLD | NEW |