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 "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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 // Base class for tests. | 44 // Base class for tests. |
45 class AppWindowGeometryCacheTest : public ExtensionsTest { | 45 class AppWindowGeometryCacheTest : public ExtensionsTest { |
46 public: | 46 public: |
47 AppWindowGeometryCacheTest() | 47 AppWindowGeometryCacheTest() |
48 : ui_thread_(BrowserThread::UI, &ui_message_loop_) {} | 48 : ui_thread_(BrowserThread::UI, &ui_message_loop_) {} |
49 | 49 |
50 // testing::Test overrides: | 50 // testing::Test overrides: |
51 virtual void SetUp() OVERRIDE; | 51 virtual void SetUp() override; |
52 virtual void TearDown() OVERRIDE; | 52 virtual void TearDown() override; |
53 | 53 |
54 void AddGeometryAndLoadExtension(const std::string& extension_id, | 54 void AddGeometryAndLoadExtension(const std::string& extension_id, |
55 const std::string& window_id, | 55 const std::string& window_id, |
56 const gfx::Rect& bounds, | 56 const gfx::Rect& bounds, |
57 const gfx::Rect& screen_bounds, | 57 const gfx::Rect& screen_bounds, |
58 ui::WindowShowState state); | 58 ui::WindowShowState state); |
59 | 59 |
60 // Spins the UI threads' message loops to make sure any task | 60 // Spins the UI threads' message loops to make sure any task |
61 // posted to sync the geometry to the value store gets a chance to run. | 61 // posted to sync the geometry to the value store gets a chance to run. |
62 void WaitForSync(); | 62 void WaitForSync(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // The first added window should no longer have cached geometry. | 421 // The first added window should no longer have cached geometry. |
422 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); | 422 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); |
423 // All other windows should still exist. | 423 // All other windows should still exist. |
424 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { | 424 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { |
425 std::string window_id = "window_" + base::IntToString(i); | 425 std::string window_id = "window_" + base::IntToString(i); |
426 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); | 426 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 } // namespace extensions | 430 } // namespace extensions |
OLD | NEW |