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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
37 #include "base/mac/scoped_nsautorelease_pool.h" | 37 #include "base/mac/scoped_nsautorelease_pool.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using base::ASCIIToUTF16; | 40 using base::ASCIIToUTF16; |
41 using extensions::Extension; | 41 using extensions::Extension; |
42 | 42 |
43 class AppBackgroundPageApiTest : public ExtensionApiTest { | 43 class AppBackgroundPageApiTest : public ExtensionApiTest { |
44 public: | 44 public: |
45 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 45 virtual void SetUpCommandLine(CommandLine* command_line) override { |
46 ExtensionApiTest::SetUpCommandLine(command_line); | 46 ExtensionApiTest::SetUpCommandLine(command_line); |
47 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 47 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
48 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage); | 48 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage); |
49 } | 49 } |
50 | 50 |
51 bool CreateApp(const std::string& app_manifest, | 51 bool CreateApp(const std::string& app_manifest, |
52 base::FilePath* app_dir) { | 52 base::FilePath* app_dir) { |
53 if (!app_dir_.CreateUniqueTempDir()) { | 53 if (!app_dir_.CreateUniqueTempDir()) { |
54 LOG(ERROR) << "Unable to create a temporary directory."; | 54 LOG(ERROR) << "Unable to create a temporary directory."; |
55 return false; | 55 return false; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // Fixture to assist in testing v2 app background pages containing | 123 // Fixture to assist in testing v2 app background pages containing |
124 // Native Client embeds. | 124 // Native Client embeds. |
125 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { | 125 class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { |
126 public: | 126 public: |
127 AppBackgroundPageNaClTest() | 127 AppBackgroundPageNaClTest() |
128 : extension_(NULL) {} | 128 : extension_(NULL) {} |
129 virtual ~AppBackgroundPageNaClTest() { | 129 virtual ~AppBackgroundPageNaClTest() { |
130 } | 130 } |
131 | 131 |
132 virtual void SetUpOnMainThread() OVERRIDE { | 132 virtual void SetUpOnMainThread() override { |
133 AppBackgroundPageApiTest::SetUpOnMainThread(); | 133 AppBackgroundPageApiTest::SetUpOnMainThread(); |
134 #if !defined(DISABLE_NACL) | 134 #if !defined(DISABLE_NACL) |
135 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); | 135 nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(50); |
136 #endif | 136 #endif |
137 extensions::ProcessManager::SetEventPageIdleTimeForTesting(1000); | 137 extensions::ProcessManager::SetEventPageIdleTimeForTesting(1000); |
138 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1000); | 138 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1000); |
139 } | 139 } |
140 | 140 |
141 const Extension* extension() { return extension_; } | 141 const Extension* extension() { return extension_; } |
142 | 142 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 643 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
644 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); | 644 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); |
645 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 645 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
646 | 646 |
647 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 647 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
648 idle_impulse_counter.SetGoalAndGetCallback(1)); | 648 idle_impulse_counter.SetGoalAndGetCallback(1)); |
649 nacl_modules_loaded.Reply("be idle"); | 649 nacl_modules_loaded.Reply("be idle"); |
650 idle_impulse_counter.Wait(); | 650 idle_impulse_counter.Wait(); |
651 #endif | 651 #endif |
652 } | 652 } |
OLD | NEW |