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

Side by Side Diff: extensions/browser/app_window/app_window_geometry_cache_unittest.cc

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix extensions_unittests Created 5 years, 4 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 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/app_window/app_window_geometry_cache.h" 5 #include "extensions/browser/app_window/app_window_geometry_cache.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/mock_pref_change_callback.h" 9 #include "base/prefs/mock_pref_change_callback.h"
10 #include "base/prefs/pref_service_factory.h" 10 #include "base/prefs/pref_service_factory.h"
11 #include "base/prefs/testing_pref_store.h" 11 #include "base/prefs/testing_pref_store.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 13 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "content/public/test/test_browser_context.h" 14 #include "content/public/test/test_browser_context.h"
15 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
16 #include "content/public/test/test_utils.h" 16 #include "content/public/test/test_utils.h"
17 #include "extensions/browser/extension_pref_value_map.h" 17 #include "extensions/browser/extension_pref_value_map.h"
18 #include "extensions/browser/extension_prefs.h" 18 #include "extensions/browser/extension_prefs.h"
19 #include "extensions/browser/extensions_test.h" 19 #include "extensions/browser/extensions_test.h"
20 #include "extensions/browser/null_app_sorting.h"
21 #include "extensions/common/extension_builder.h" 20 #include "extensions/common/extension_builder.h"
22 #include "extensions/common/value_builder.h" 21 #include "extensions/common/value_builder.h"
23 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
24 23
25 using content::BrowserThread; 24 using content::BrowserThread;
26 25
27 namespace extensions { 26 namespace extensions {
28 27
29 namespace { 28 namespace {
30 const char kWindowId[] = "windowid"; 29 const char kWindowId[] = "windowid";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 base::PrefServiceFactory factory; 84 base::PrefServiceFactory factory;
86 factory.set_user_prefs(new TestingPrefStore); 85 factory.set_user_prefs(new TestingPrefStore);
87 factory.set_extension_prefs(new TestingPrefStore); 86 factory.set_extension_prefs(new TestingPrefStore);
88 user_prefs::PrefRegistrySyncable* pref_registry = 87 user_prefs::PrefRegistrySyncable* pref_registry =
89 new user_prefs::PrefRegistrySyncable; 88 new user_prefs::PrefRegistrySyncable;
90 // Prefs should be registered before the PrefService is created. 89 // Prefs should be registered before the PrefService is created.
91 ExtensionPrefs::RegisterProfilePrefs(pref_registry); 90 ExtensionPrefs::RegisterProfilePrefs(pref_registry);
92 pref_service_ = factory.Create(pref_registry).Pass(); 91 pref_service_ = factory.Create(pref_registry).Pass();
93 92
94 extension_prefs_.reset(ExtensionPrefs::Create( 93 extension_prefs_.reset(ExtensionPrefs::Create(
94 nullptr,
not at google - send to devlin 2015/08/03 21:12:08 This seems to be the only case where ExtensionPref
Marc Treib 2015/08/04 08:36:28 D'oh, somehow I didn't see the |browser_context()|
95 pref_service_.get(), 95 pref_service_.get(),
96 browser_context()->GetPath().AppendASCII("Extensions"), 96 browser_context()->GetPath().AppendASCII("Extensions"),
97 extension_pref_value_map_.get(), 97 extension_pref_value_map_.get(),
98 scoped_ptr<AppSorting>(new NullAppSorting),
99 false /* extensions_disabled */, 98 false /* extensions_disabled */,
100 std::vector<ExtensionPrefsObserver*>())); 99 std::vector<ExtensionPrefsObserver*>()));
101 100
102 cache_.reset( 101 cache_.reset(
103 new AppWindowGeometryCache(browser_context(), extension_prefs_.get())); 102 new AppWindowGeometryCache(browser_context(), extension_prefs_.get()));
104 cache_->SetSyncDelayForTests(0); 103 cache_->SetSyncDelayForTests(0);
105 } 104 }
106 105
107 void AppWindowGeometryCacheTest::TearDown() { 106 void AppWindowGeometryCacheTest::TearDown() {
108 cache_.reset(); 107 cache_.reset();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // The first added window should no longer have cached geometry. 420 // The first added window should no longer have cached geometry.
422 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); 421 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL));
423 // All other windows should still exist. 422 // All other windows should still exist.
424 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { 423 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
425 std::string window_id = "window_" + base::IntToString(i); 424 std::string window_id = "window_" + base::IntToString(i);
426 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); 425 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL));
427 } 426 }
428 } 427 }
429 428
430 } // namespace extensions 429 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698