| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/extensions/extension_apitest.h" | 13 #include "chrome/browser/extensions/extension_apitest.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_test_message_listener.h" | 15 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_dialogs.h" | 18 #include "chrome/browser/ui/browser_dialogs.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/extensions/application_launch.h" | 20 #include "chrome/browser/ui/extensions/application_launch.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "components/nacl/browser/nacl_process_host.h" | |
| 24 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/test/test_notification_tracker.h" | 24 #include "content/public/test/test_notification_tracker.h" |
| 26 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 27 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
| 28 #include "extensions/common/switches.h" | 27 #include "extensions/common/switches.h" |
| 29 #include "net/dns/mock_host_resolver.h" | 28 #include "net/dns/mock_host_resolver.h" |
| 30 #include "net/test/embedded_test_server/embedded_test_server.h" | 29 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 30 #include "ppapi/shared_impl/ppapi_switches.h" |
| 31 | 31 |
| 32 #if defined(OS_MACOSX) | 32 #if defined(OS_MACOSX) |
| 33 #include "base/mac/scoped_nsautorelease_pool.h" | 33 #include "base/mac/scoped_nsautorelease_pool.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 using base::ASCIIToUTF16; | 36 using base::ASCIIToUTF16; |
| 37 using extensions::Extension; | 37 using extensions::Extension; |
| 38 | 38 |
| 39 class AppBackgroundPageApiTest : public ExtensionApiTest { | 39 class AppBackgroundPageApiTest : public ExtensionApiTest { |
| 40 public: | 40 public: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 : extension_(NULL) { | 124 : extension_(NULL) { |
| 125 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir_); | 125 PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir_); |
| 126 app_dir_ = app_dir_.AppendASCII( | 126 app_dir_ = app_dir_.AppendASCII( |
| 127 "ppapi/tests/extensions/background_keepalive/newlib"); | 127 "ppapi/tests/extensions/background_keepalive/newlib"); |
| 128 } | 128 } |
| 129 virtual ~AppBackgroundPageNaClTest() { | 129 virtual ~AppBackgroundPageNaClTest() { |
| 130 } | 130 } |
| 131 | 131 |
| 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 133 AppBackgroundPageApiTest::SetUpCommandLine(command_line); | 133 AppBackgroundPageApiTest::SetUpCommandLine(command_line); |
| 134 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); | 134 command_line->AppendSwitchASCII( |
| 135 switches::kPpapiKeepAliveThrottle, "50"); |
| 135 command_line->AppendSwitchASCII( | 136 command_line->AppendSwitchASCII( |
| 136 extensions::switches::kEventPageIdleTime, "1000"); | 137 extensions::switches::kEventPageIdleTime, "1000"); |
| 137 command_line->AppendSwitchASCII( | 138 command_line->AppendSwitchASCII( |
| 138 extensions::switches::kEventPageSuspendingTime, "1000"); | 139 extensions::switches::kEventPageSuspendingTime, "1000"); |
| 139 } | 140 } |
| 140 | 141 |
| 141 const Extension* extension() { return extension_; } | 142 const Extension* extension() { return extension_; } |
| 142 | 143 |
| 143 protected: | 144 protected: |
| 144 void LaunchTestingApp() { | 145 void LaunchTestingApp() { |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 638 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 638 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); | 639 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); |
| 639 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 640 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
| 640 | 641 |
| 641 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 642 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
| 642 idle_impulse_counter.SetGoalAndGetCallback(1)); | 643 idle_impulse_counter.SetGoalAndGetCallback(1)); |
| 643 nacl_modules_loaded.Reply("be idle"); | 644 nacl_modules_loaded.Reply("be idle"); |
| 644 idle_impulse_counter.Wait(); | 645 idle_impulse_counter.Wait(); |
| 645 } | 646 } |
| 646 | 647 |
| OLD | NEW |