OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/prefs/mock_pref_change_callback.h" | 6 #include "base/prefs/mock_pref_change_callback.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
9 #include "chrome/browser/extensions/shell_window_geometry_cache.h" | 9 #include "chrome/browser/extensions/shell_window_geometry_cache.h" |
10 #include "chrome/browser/extensions/test_extension_prefs.h" | 10 #include "chrome/browser/extensions/test_extension_prefs.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Spins the UI threads' message loops to make sure any task | 43 // Spins the UI threads' message loops to make sure any task |
44 // posted to sync the geometry to the value store gets a chance to run. | 44 // posted to sync the geometry to the value store gets a chance to run. |
45 void WaitForSync(); | 45 void WaitForSync(); |
46 | 46 |
47 void LoadExtension(const std::string& extension_id); | 47 void LoadExtension(const std::string& extension_id); |
48 void UnloadExtension(const std::string& extension_id); | 48 void UnloadExtension(const std::string& extension_id); |
49 | 49 |
50 protected: | 50 protected: |
51 TestingProfile profile_; | 51 TestingProfile profile_; |
52 MessageLoopForUI ui_message_loop_; | 52 base::MessageLoopForUI ui_message_loop_; |
53 content::TestBrowserThread ui_thread_; | 53 content::TestBrowserThread ui_thread_; |
54 scoped_ptr<TestExtensionPrefs> prefs_; | 54 scoped_ptr<TestExtensionPrefs> prefs_; |
55 scoped_ptr<ShellWindowGeometryCache> cache_; | 55 scoped_ptr<ShellWindowGeometryCache> cache_; |
56 }; | 56 }; |
57 | 57 |
58 void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension( | 58 void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension( |
59 const std::string& extension_id, const std::string& window_id, | 59 const std::string& extension_id, const std::string& window_id, |
60 const gfx::Rect& bounds) { | 60 const gfx::Rect& bounds) { |
61 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 61 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
62 base::DictionaryValue* value = new base::DictionaryValue; | 62 base::DictionaryValue* value = new base::DictionaryValue; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // The first added window should no longer have cached geometry. | 218 // The first added window should no longer have cached geometry. |
219 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", &bounds)); | 219 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", &bounds)); |
220 // All other windows should still exist. | 220 // All other windows should still exist. |
221 for (size_t i = 1; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) { | 221 for (size_t i = 1; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) { |
222 std::string window_id = "window_" + base::IntToString(i); | 222 std::string window_id = "window_" + base::IntToString(i); |
223 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, &bounds)); | 223 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, &bounds)); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 } // namespace extensions | 227 } // namespace extensions |
OLD | NEW |