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/app_window/app_window_geometry_cache.h" | 5 #include "extensions/browser/app_window/app_window_geometry_cache.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 void AppWindowGeometryCacheTest::LoadExtension( | 113 void AppWindowGeometryCacheTest::LoadExtension( |
114 const std::string& extension_id) { | 114 const std::string& extension_id) { |
115 cache_->LoadGeometryFromStorage(extension_id); | 115 cache_->LoadGeometryFromStorage(extension_id); |
116 WaitForSync(); | 116 WaitForSync(); |
117 } | 117 } |
118 | 118 |
119 void AppWindowGeometryCacheTest::UnloadExtension( | 119 void AppWindowGeometryCacheTest::UnloadExtension( |
120 const std::string& extension_id) { | 120 const std::string& extension_id) { |
121 scoped_refptr<Extension> extension = CreateExtension(extension_id); | 121 scoped_refptr<Extension> extension = CreateExtension(extension_id); |
122 cache_->OnExtensionUnloaded(browser_context(), | 122 cache_->OnExtensionUnloaded(browser_context(), extension.get(), |
123 extension.get(), | 123 UnloadedExtensionReason::DISABLE); |
124 UnloadedExtensionInfo::REASON_DISABLE); | |
125 WaitForSync(); | 124 WaitForSync(); |
126 } | 125 } |
127 | 126 |
128 std::string AppWindowGeometryCacheTest::AddExtensionWithPrefs( | 127 std::string AppWindowGeometryCacheTest::AddExtensionWithPrefs( |
129 const std::string& name) { | 128 const std::string& name) { |
130 // Generate the extension with a path based on the name so that extensions | 129 // Generate the extension with a path based on the name so that extensions |
131 // with different names will have different IDs. | 130 // with different names will have different IDs. |
132 base::FilePath path = | 131 base::FilePath path = |
133 browser_context()->GetPath().AppendASCII("Extensions").AppendASCII(name); | 132 browser_context()->GetPath().AppendASCII("Extensions").AppendASCII(name); |
134 scoped_refptr<Extension> extension = | 133 scoped_refptr<Extension> extension = |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // The first added window should no longer have cached geometry. | 393 // The first added window should no longer have cached geometry. |
395 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); | 394 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); |
396 // All other windows should still exist. | 395 // All other windows should still exist. |
397 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { | 396 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { |
398 std::string window_id = "window_" + base::SizeTToString(i); | 397 std::string window_id = "window_" + base::SizeTToString(i); |
399 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); | 398 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); |
400 } | 399 } |
401 } | 400 } |
402 | 401 |
403 } // namespace extensions | 402 } // namespace extensions |
OLD | NEW |