Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: extensions/browser/extension_registry_unittest.cc

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Enum class Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extension_registry.h" 5 #include "extensions/browser/extension_registry.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const ExtensionList& uninstalled() { return uninstalled_; } 52 const ExtensionList& uninstalled() { return uninstalled_; }
53 53
54 private: 54 private:
55 void OnExtensionLoaded(content::BrowserContext* browser_context, 55 void OnExtensionLoaded(content::BrowserContext* browser_context,
56 const Extension* extension) override { 56 const Extension* extension) override {
57 loaded_.push_back(extension); 57 loaded_.push_back(extension);
58 } 58 }
59 59
60 void OnExtensionUnloaded(content::BrowserContext* browser_context, 60 void OnExtensionUnloaded(content::BrowserContext* browser_context,
61 const Extension* extension, 61 const Extension* extension,
62 UnloadedExtensionInfo::Reason reason) override { 62 UnloadedExtensionReason reason) override {
63 unloaded_.push_back(extension); 63 unloaded_.push_back(extension);
64 } 64 }
65 65
66 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, 66 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
67 const Extension* extension, 67 const Extension* extension,
68 bool is_update, 68 bool is_update,
69 const std::string& old_name) override { 69 const std::string& old_name) override {
70 installed_.push_back(extension); 70 installed_.push_back(extension);
71 } 71 }
72 72
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 registry.TriggerOnLoaded(extension.get()); 253 registry.TriggerOnLoaded(extension.get());
254 254
255 registry.TriggerOnWillBeInstalled(extension.get(), true, "foo"); 255 registry.TriggerOnWillBeInstalled(extension.get(), true, "foo");
256 256
257 EXPECT_TRUE(HasSingleExtension(observer.loaded(), extension.get())); 257 EXPECT_TRUE(HasSingleExtension(observer.loaded(), extension.get()));
258 EXPECT_TRUE(observer.unloaded().empty()); 258 EXPECT_TRUE(observer.unloaded().empty());
259 registry.Shutdown(); 259 registry.Shutdown();
260 260
261 registry.RemoveEnabled(extension->id()); 261 registry.RemoveEnabled(extension->id());
262 registry.TriggerOnUnloaded(extension.get(), 262 registry.TriggerOnUnloaded(extension.get(),
263 UnloadedExtensionInfo::REASON_DISABLE); 263 UnloadedExtensionReason::REASON_DISABLE);
264 264
265 EXPECT_TRUE(observer.loaded().empty()); 265 EXPECT_TRUE(observer.loaded().empty());
266 EXPECT_TRUE(HasSingleExtension(observer.unloaded(), extension.get())); 266 EXPECT_TRUE(HasSingleExtension(observer.unloaded(), extension.get()));
267 registry.Shutdown(); 267 registry.Shutdown();
268 268
269 registry.TriggerOnUninstalled(extension.get(), UNINSTALL_REASON_FOR_TESTING); 269 registry.TriggerOnUninstalled(extension.get(), UNINSTALL_REASON_FOR_TESTING);
270 EXPECT_TRUE(observer.installed().empty()); 270 EXPECT_TRUE(observer.installed().empty());
271 EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get())); 271 EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get()));
272 272
273 registry.RemoveObserver(&observer); 273 registry.RemoveObserver(&observer);
274 } 274 }
275 275
276 } // namespace 276 } // namespace
277 } // namespace extensions 277 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698