| 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/background/background_contents_service.h" | 8 #include "chrome/browser/background/background_contents_service.h" |
| 9 #include "chrome/browser/background/background_contents_service_factory.h" | 9 #include "chrome/browser/background/background_contents_service_factory.h" |
| 10 #include "chrome/browser/background/background_mode_manager.h" | 10 #include "chrome/browser/background/background_mode_manager.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 active_impulse_counter.SetGoalAndGetCallback(20)); | 605 active_impulse_counter.SetGoalAndGetCallback(20)); |
| 606 active_impulse_counter.Wait(); | 606 active_impulse_counter.Wait(); |
| 607 | 607 |
| 608 // Clear callback to free reference to message loop in ImpulseCallbackCounter. | 608 // Clear callback to free reference to message loop in ImpulseCallbackCounter. |
| 609 manager->SetKeepaliveImpulseCallbackForTesting( | 609 manager->SetKeepaliveImpulseCallbackForTesting( |
| 610 extensions::ProcessManager::ImpulseCallbackForTesting()); | 610 extensions::ProcessManager::ImpulseCallbackForTesting()); |
| 611 } | 611 } |
| 612 | 612 |
| 613 // Verify that nacl modules that go idle will not send keepalive impulses. | 613 // Verify that nacl modules that go idle will not send keepalive impulses. |
| 614 // Disabled on windows due to Win XP failures: | 614 // Disabled on windows due to Win XP failures: |
| 615 // DesktopRootWindowHostWin::HandleCreate not implemented. crbug.com/331954 | 615 // DesktopWindowTreeHostWin::HandleCreate not implemented. crbug.com/331954 |
| 616 #if defined(OS_WIN) | 616 #if defined(OS_WIN) |
| 617 #define MAYBE_BackgroundKeepaliveIdle DISABLED_BackgroundKeepaliveIdle | 617 #define MAYBE_BackgroundKeepaliveIdle DISABLED_BackgroundKeepaliveIdle |
| 618 #else | 618 #else |
| 619 #define MAYBE_BackgroundKeepaliveIdle BackgroundKeepaliveIdle | 619 #define MAYBE_BackgroundKeepaliveIdle BackgroundKeepaliveIdle |
| 620 #endif | 620 #endif |
| 621 IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest, | 621 IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest, |
| 622 MAYBE_BackgroundKeepaliveIdle) { | 622 MAYBE_BackgroundKeepaliveIdle) { |
| 623 ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true); | 623 ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true); |
| 624 LaunchTestingApp(); | 624 LaunchTestingApp(); |
| 625 extensions::ProcessManager* manager = | 625 extensions::ProcessManager* manager = |
| 626 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 626 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 627 ImpulseCallbackCounter idle_impulse_counter(extension()->id()); | 627 ImpulseCallbackCounter idle_impulse_counter(extension()->id()); |
| 628 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 628 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
| 629 | 629 |
| 630 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 630 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
| 631 idle_impulse_counter.SetGoalAndGetCallback(1)); | 631 idle_impulse_counter.SetGoalAndGetCallback(1)); |
| 632 nacl_modules_loaded.Reply("be idle"); | 632 nacl_modules_loaded.Reply("be idle"); |
| 633 idle_impulse_counter.Wait(); | 633 idle_impulse_counter.Wait(); |
| 634 | 634 |
| 635 // Clear callback to free reference to message loop in ImpulseCallbackCounter. | 635 // Clear callback to free reference to message loop in ImpulseCallbackCounter. |
| 636 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 636 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
| 637 extensions::ProcessManager::ImpulseCallbackForTesting()); | 637 extensions::ProcessManager::ImpulseCallbackForTesting()); |
| 638 } | 638 } |
| 639 | 639 |
| OLD | NEW |