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

Unified Diff: apps/app_window_geometry_cache_unittest.cc

Issue 270703003: Use ExtensionRegistryObserver instead of DEPRECATED extension notify from app_window_geometry_cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit_tests Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_window_geometry_cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_window_geometry_cache_unittest.cc
diff --git a/apps/app_window_geometry_cache_unittest.cc b/apps/app_window_geometry_cache_unittest.cc
index ccff88226550d45b87c03605650984bf6fd09521..50240c733c399f60da6b35c991a56a95ccd4d740 100644
--- a/apps/app_window_geometry_cache_unittest.cc
+++ b/apps/app_window_geometry_cache_unittest.cc
@@ -11,23 +11,38 @@
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_prefs.h"
+#include "extensions/common/extension_builder.h"
+#include "extensions/common/value_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
+using content::BrowserThread;
+
+namespace apps {
+
+namespace {
const char kWindowId[] = "windowid";
const char kWindowId2[] = "windowid2";
-using content::BrowserThread;
+// Create a very simple extension with id.
+scoped_refptr<extensions::Extension> CreateExtension(const std::string& id) {
+ return extensions::ExtensionBuilder()
+ .SetManifest(extensions::DictionaryBuilder().Set("name", "test").Set(
+ "version", "0.1"))
+ .SetID(id)
+ .Build();
+}
-namespace apps {
+} // namespace
// Base class for tests.
class AppWindowGeometryCacheTest : public testing::Test {
public:
AppWindowGeometryCacheTest()
- : ui_thread_(BrowserThread::UI, &ui_message_loop_) {
+ : profile_(new TestingProfile),
+ ui_thread_(BrowserThread::UI, &ui_message_loop_) {
prefs_.reset(new extensions::TestExtensionPrefs(
ui_message_loop_.message_loop_proxy().get()));
- cache_.reset(new AppWindowGeometryCache(&profile_, prefs_->prefs()));
+ cache_.reset(new AppWindowGeometryCache(profile_.get(), prefs_->prefs()));
cache_->SetSyncDelayForTests(0);
}
@@ -45,7 +60,7 @@ class AppWindowGeometryCacheTest : public testing::Test {
void UnloadExtension(const std::string& extension_id);
protected:
- TestingProfile profile_;
+ scoped_ptr<TestingProfile> profile_;
base::MessageLoopForUI ui_message_loop_;
content::TestBrowserThread ui_thread_;
scoped_ptr<extensions::TestExtensionPrefs> prefs_;
@@ -86,7 +101,12 @@ void AppWindowGeometryCacheTest::LoadExtension(
void AppWindowGeometryCacheTest::UnloadExtension(
const std::string& extension_id) {
- cache_->OnExtensionUnloaded(extension_id);
+ scoped_refptr<extensions::Extension> extension =
+ CreateExtension(extension_id);
+ cache_->OnExtensionUnloaded(
+ profile_.get(),
+ extension.get(),
+ extensions::UnloadedExtensionInfo::REASON_DISABLE);
WaitForSync();
}
« no previous file with comments | « apps/app_window_geometry_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698