| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 .Build()) | 107 .Build()) |
| 108 .Build()) | 108 .Build()) |
| 109 .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") | 109 .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") |
| 110 .Build(); | 110 .Build(); |
| 111 ExtensionRegistry::Get(browser_context())->AddEnabled(extension); | 111 ExtensionRegistry::Get(browser_context())->AddEnabled(extension); |
| 112 return extension; | 112 return extension; |
| 113 } | 113 } |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 void SetUp() override { | 116 void SetUp() override { |
| 117 ExtensionsTest::SetUp(); |
| 117 user_prefs::UserPrefs::Set(browser_context(), &testing_pref_service_); | 118 user_prefs::UserPrefs::Set(browser_context(), &testing_pref_service_); |
| 118 } | 119 } |
| 119 | 120 |
| 120 private: | 121 private: |
| 121 sync_preferences::TestingPrefServiceSyncable testing_pref_service_; | 122 sync_preferences::TestingPrefServiceSyncable testing_pref_service_; |
| 122 | 123 |
| 123 // The total number of pending tasks that have been executed. | 124 // The total number of pending tasks that have been executed. |
| 124 int task_run_count_; | 125 int task_run_count_; |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(LazyBackgroundTaskQueueTest); | 127 DISALLOW_COPY_AND_ASSIGN(LazyBackgroundTaskQueueTest); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); | 210 EXPECT_EQ(1u, queue.extensions_with_pending_tasks()); |
| 210 | 211 |
| 211 // Processing tasks when there is one pending runs the task and removes the | 212 // Processing tasks when there is one pending runs the task and removes the |
| 212 // extension from the list of extensions with pending tasks. | 213 // extension from the list of extensions with pending tasks. |
| 213 queue.ProcessPendingTasks(NULL, browser_context(), extension.get()); | 214 queue.ProcessPendingTasks(NULL, browser_context(), extension.get()); |
| 214 EXPECT_EQ(1, task_run_count()); | 215 EXPECT_EQ(1, task_run_count()); |
| 215 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); | 216 EXPECT_EQ(0u, queue.extensions_with_pending_tasks()); |
| 216 } | 217 } |
| 217 | 218 |
| 218 } // namespace extensions | 219 } // namespace extensions |
| OLD | NEW |