| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 class ChromeRenderProcessHostBackgroundingTest | 544 class ChromeRenderProcessHostBackgroundingTest |
| 545 : public ChromeRenderProcessHostTest { | 545 : public ChromeRenderProcessHostTest { |
| 546 public: | 546 public: |
| 547 ChromeRenderProcessHostBackgroundingTest() {} | 547 ChromeRenderProcessHostBackgroundingTest() {} |
| 548 | 548 |
| 549 void SetUpCommandLine(base::CommandLine* command_line) override { | 549 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 550 command_line->AppendSwitch(switches::kProcessPerTab); | 550 command_line->AppendSwitch(switches::kProcessPerTab); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void SetUpOnMainThread() override { | 553 void SetUpOnMainThread() override { |
| 554 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 554 ASSERT_TRUE(embedded_test_server()->Start()); |
| 555 | 555 |
| 556 // Set up the server and get the test pages. | 556 // Set up the server and get the test pages. |
| 557 base::FilePath test_data_dir; | 557 base::FilePath test_data_dir; |
| 558 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); | 558 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); |
| 559 embedded_test_server()->ServeFilesFromDirectory( | 559 embedded_test_server()->ServeFilesFromDirectory( |
| 560 test_data_dir.AppendASCII("chrome/test/data/")); | 560 test_data_dir.AppendASCII("chrome/test/data/")); |
| 561 audio_url_ = embedded_test_server()->GetURL("/extensions/loop_audio.html"); | 561 audio_url_ = embedded_test_server()->GetURL("/extensions/loop_audio.html"); |
| 562 no_audio_url_ = embedded_test_server()->GetURL("/title1.html"); | 562 no_audio_url_ = embedded_test_server()->GetURL("/title1.html"); |
| 563 | 563 |
| 564 // Open a browser, navigate to the audio page and get its WebContents. | 564 // Open a browser, navigate to the audio page and get its WebContents. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 content::ExecuteScript(audio_tab_web_contents_, | 677 content::ExecuteScript(audio_tab_web_contents_, |
| 678 "document.getElementById('audioPlayer').play();")); | 678 "document.getElementById('audioPlayer').play();")); |
| 679 | 679 |
| 680 // Wait until the two pages are not backgrounded. | 680 // Wait until the two pages are not backgrounded. |
| 681 while (no_audio_process_.IsProcessBackgrounded() || | 681 while (no_audio_process_.IsProcessBackgrounded() || |
| 682 audio_process_.IsProcessBackgrounded()) { | 682 audio_process_.IsProcessBackgrounded()) { |
| 683 base::RunLoop().RunUntilIdle(); | 683 base::RunLoop().RunUntilIdle(); |
| 684 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); | 684 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); |
| 685 } | 685 } |
| 686 } | 686 } |
| OLD | NEW |