| 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 "apps/shell_window_geometry_cache.h" | 5 #include "apps/shell_window_geometry_cache.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/prefs/mock_pref_change_callback.h" | 7 #include "base/prefs/mock_pref_change_callback.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/test_extension_prefs.h" | 10 #include "chrome/browser/extensions/test_extension_prefs.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Spins the UI threads' message loops to make sure any task | 45 // Spins the UI threads' message loops to make sure any task |
| 46 // posted to sync the geometry to the value store gets a chance to run. | 46 // posted to sync the geometry to the value store gets a chance to run. |
| 47 void WaitForSync(); | 47 void WaitForSync(); |
| 48 | 48 |
| 49 void LoadExtension(const std::string& extension_id); | 49 void LoadExtension(const std::string& extension_id); |
| 50 void UnloadExtension(const std::string& extension_id); | 50 void UnloadExtension(const std::string& extension_id); |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 TestingProfile profile_; | 53 TestingProfile profile_; |
| 54 MessageLoopForUI ui_message_loop_; | 54 base::MessageLoopForUI ui_message_loop_; |
| 55 content::TestBrowserThread ui_thread_; | 55 content::TestBrowserThread ui_thread_; |
| 56 scoped_ptr<extensions::TestExtensionPrefs> prefs_; | 56 scoped_ptr<extensions::TestExtensionPrefs> prefs_; |
| 57 scoped_ptr<ShellWindowGeometryCache> cache_; | 57 scoped_ptr<ShellWindowGeometryCache> cache_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension( | 60 void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension( |
| 61 const std::string& extension_id, | 61 const std::string& extension_id, |
| 62 const std::string& window_id, | 62 const std::string& window_id, |
| 63 const gfx::Rect& bounds, | 63 const gfx::Rect& bounds, |
| 64 ui::WindowShowState state) { | 64 ui::WindowShowState state) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // The first added window should no longer have cached geometry. | 247 // The first added window should no longer have cached geometry. |
| 248 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL)); | 248 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL)); |
| 249 // All other windows should still exist. | 249 // All other windows should still exist. |
| 250 for (size_t i = 1; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) { | 250 for (size_t i = 1; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) { |
| 251 std::string window_id = "window_" + base::IntToString(i); | 251 std::string window_id = "window_" + base::IntToString(i); |
| 252 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL)); | 252 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL)); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace extensions | 256 } // namespace extensions |
| OLD | NEW |