| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/lazy_background_task_queue.h" | 5 #include "extensions/browser/lazy_background_task_queue.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
| 10 #include "chrome/browser/extensions/extension_service_unittest.h" | 10 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 11 #include "chrome/browser/extensions/test_extension_system.h" | 11 #include "chrome/browser/extensions/test_extension_system.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/extension_builder.h" | 13 #include "chrome/common/extensions/extension_builder.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 // An ExtensionProcessManager that doesn't create background host pages. | 20 // An ExtensionProcessManager that doesn't create background host pages. |
| 21 class TestExtensionProcessManager : public ExtensionProcessManager { | 21 class TestExtensionProcessManager : public ExtensionProcessManager { |
| 22 public: | 22 public: |
| 23 explicit TestExtensionProcessManager(Profile* profile) | 23 explicit TestExtensionProcessManager(Profile* profile) |
| 24 : ExtensionProcessManager(profile), | 24 : ExtensionProcessManager(profile, profile->GetOriginalProfile()), |
| 25 create_count_(0) {} | 25 create_count_(0) {} |
| 26 virtual ~TestExtensionProcessManager() {} | 26 virtual ~TestExtensionProcessManager() {} |
| 27 | 27 |
| 28 int create_count() { return create_count_; } | 28 int create_count() { return create_count_; } |
| 29 | 29 |
| 30 // ExtensionProcessManager overrides: | 30 // ExtensionProcessManager overrides: |
| 31 virtual extensions::ExtensionHost* CreateBackgroundHost( | 31 virtual extensions::ExtensionHost* CreateBackgroundHost( |
| 32 const extensions::Extension* extension, | 32 const extensions::Extension* extension, |
| 33 const GURL& url) OVERRIDE { | 33 const GURL& url) OVERRIDE { |
| 34 // Don't actually try to create a web contents. | 34 // Don't actually try to create a web contents. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); | 186 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); |
| 187 | 187 |
| 188 // Processing tasks when there is one pending runs the task and removes the | 188 // Processing tasks when there is one pending runs the task and removes the |
| 189 // extension from the list of extensions with pending tasks. | 189 // extension from the list of extensions with pending tasks. |
| 190 queue.ProcessPendingTasks(NULL, profile_.get(), extension); | 190 queue.ProcessPendingTasks(NULL, profile_.get(), extension); |
| 191 EXPECT_EQ(1, task_run_count()); | 191 EXPECT_EQ(1, task_run_count()); |
| 192 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); | 192 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace extensions | 195 } // namespace extensions |
| OLD | NEW |