OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test_extension_registry_observer.h" | 5 #include "extensions/browser/test_extension_registry_observer.h" |
6 | 6 |
7 #include "content/public/test/test_utils.h" | 7 #include "content/public/test/test_utils.h" |
8 #include "extensions/browser/extension_registry.h" | 8 #include "extensions/browser/extension_registry.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 class TestExtensionRegistryObserver::Waiter { | 12 class TestExtensionRegistryObserver::Waiter { |
13 public: | 13 public: |
14 Waiter(const std::string& extension_id) : observed_(false), runner_(NULL) {} | 14 explicit Waiter(const std::string& extension_id) |
| 15 : observed_(false), runner_(NULL) {} |
15 | 16 |
16 void Wait() { | 17 void Wait() { |
17 if (observed_) | 18 if (observed_) |
18 return; | 19 return; |
19 | 20 |
20 runner_ = new content::MessageLoopRunner(); | 21 runner_ = new content::MessageLoopRunner(); |
21 runner_->Run(); | 22 runner_->Run(); |
22 } | 23 } |
23 | 24 |
24 void OnObserved() { | 25 void OnObserved() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 96 |
96 void TestExtensionRegistryObserver::OnExtensionUnloaded( | 97 void TestExtensionRegistryObserver::OnExtensionUnloaded( |
97 content::BrowserContext* browser_context, | 98 content::BrowserContext* browser_context, |
98 const Extension* extension, | 99 const Extension* extension, |
99 UnloadedExtensionInfo::Reason reason) { | 100 UnloadedExtensionInfo::Reason reason) { |
100 if (extension->id() == extension_id_) | 101 if (extension->id() == extension_id_) |
101 unloaded_waiter_->OnObserved(); | 102 unloaded_waiter_->OnObserved(); |
102 } | 103 } |
103 | 104 |
104 } // namespace extensions | 105 } // namespace extensions |
OLD | NEW |