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_service_unittest.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_service_test_base.h" |
10 #include "chrome/browser/extensions/test_extension_system.h" | 11 #include "chrome/browser/extensions/test_extension_system.h" |
11 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "extensions/browser/process_manager.h" | 14 #include "extensions/browser/process_manager.h" |
14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
15 #include "extensions/common/extension_builder.h" | 16 #include "extensions/common/extension_builder.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 | 20 |
(...skipping 16 matching lines...) Expand all Loading... |
36 } | 37 } |
37 | 38 |
38 private: | 39 private: |
39 int create_count_; | 40 int create_count_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); | 42 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); |
42 }; | 43 }; |
43 | 44 |
44 // Derives from ExtensionServiceTestBase because ExtensionService is difficult | 45 // Derives from ExtensionServiceTestBase because ExtensionService is difficult |
45 // to initialize alone. | 46 // to initialize alone. |
46 class LazyBackgroundTaskQueueTest : public ExtensionServiceTestBase { | 47 class LazyBackgroundTaskQueueTest |
| 48 : public extensions::ExtensionServiceTestBase { |
47 public: | 49 public: |
48 LazyBackgroundTaskQueueTest() : task_run_count_(0) {} | 50 LazyBackgroundTaskQueueTest() : task_run_count_(0) {} |
49 virtual ~LazyBackgroundTaskQueueTest() {} | 51 virtual ~LazyBackgroundTaskQueueTest() {} |
50 | 52 |
51 int task_run_count() { return task_run_count_; } | 53 int task_run_count() { return task_run_count_; } |
52 | 54 |
53 // A simple callback for AddPendingTask. | 55 // A simple callback for AddPendingTask. |
54 void RunPendingTask(ExtensionHost* host) { | 56 void RunPendingTask(ExtensionHost* host) { |
55 task_run_count_++; | 57 task_run_count_++; |
56 } | 58 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); | 186 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); |
185 | 187 |
186 // 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 |
187 // extension from the list of extensions with pending tasks. | 189 // extension from the list of extensions with pending tasks. |
188 queue.ProcessPendingTasks(NULL, profile_.get(), extension); | 190 queue.ProcessPendingTasks(NULL, profile_.get(), extension); |
189 EXPECT_EQ(1, task_run_count()); | 191 EXPECT_EQ(1, task_run_count()); |
190 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); | 192 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); |
191 } | 193 } |
192 | 194 |
193 } // namespace extensions | 195 } // namespace extensions |
OLD | NEW |