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

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

Issue 714133002: Add more management policy checking after extension installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix CrOS compile Created 6 years, 1 month 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"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 scoped_refptr<Extension> extension = 163 scoped_refptr<Extension> extension =
164 ExtensionBuilder() 164 ExtensionBuilder()
165 .SetManifest( 165 .SetManifest(
166 DictionaryBuilder().Set("name", "test").Set("version", "0.1")) 166 DictionaryBuilder().Set("name", "test").Set("version", "0.1"))
167 .SetPath(path) 167 .SetPath(path)
168 .Build(); 168 .Build();
169 169
170 extension_prefs_->OnExtensionInstalled( 170 extension_prefs_->OnExtensionInstalled(
171 extension.get(), 171 extension.get(),
172 Extension::ENABLED, 172 Extension::ENABLED,
173 Extension::DISABLE_NONE,
173 syncer::StringOrdinal::CreateInitialOrdinal(), 174 syncer::StringOrdinal::CreateInitialOrdinal(),
174 std::string()); 175 std::string());
175 return extension->id(); 176 return extension->id();
176 } 177 }
177 178
178 // Test getting geometry from an empty store. 179 // Test getting geometry from an empty store.
179 TEST_F(AppWindowGeometryCacheTest, GetGeometryEmptyStore) { 180 TEST_F(AppWindowGeometryCacheTest, GetGeometryEmptyStore) {
180 const std::string extension_id = AddExtensionWithPrefs("ext1"); 181 const std::string extension_id = AddExtensionWithPrefs("ext1");
181 ASSERT_FALSE(cache_->GetGeometry(extension_id, kWindowId, NULL, NULL, NULL)); 182 ASSERT_FALSE(cache_->GetGeometry(extension_id, kWindowId, NULL, NULL, NULL));
182 } 183 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // The first added window should no longer have cached geometry. 422 // The first added window should no longer have cached geometry.
422 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); 423 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL));
423 // All other windows should still exist. 424 // All other windows should still exist.
424 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { 425 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
425 std::string window_id = "window_" + base::IntToString(i); 426 std::string window_id = "window_" + base::IntToString(i);
426 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); 427 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL));
427 } 428 }
428 } 429 }
429 430
430 } // namespace extensions 431 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698