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

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

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "components/pref_registry/pref_registry_syncable.h" 14 #include "components/pref_registry/pref_registry_syncable.h"
15 #include "components/prefs/mock_pref_change_callback.h" 15 #include "components/prefs/mock_pref_change_callback.h"
16 #include "components/prefs/pref_service_factory.h" 16 #include "components/prefs/pref_service_factory.h"
17 #include "components/prefs/testing_pref_store.h" 17 #include "components/prefs/testing_pref_store.h"
18 #include "content/public/test/test_browser_context.h" 18 #include "content/public/test/test_browser_context.h"
19 #include "content/public/test/test_browser_thread.h" 19 #include "content/public/test/test_browser_thread.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "extensions/browser/extension_pref_value_map.h" 21 #include "extensions/browser/extension_pref_value_map.h"
22 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void LoadExtension(const std::string& extension_id); 67 void LoadExtension(const std::string& extension_id);
68 void UnloadExtension(const std::string& extension_id); 68 void UnloadExtension(const std::string& extension_id);
69 69
70 // Creates and adds an extension with associated prefs. Returns the extension 70 // Creates and adds an extension with associated prefs. Returns the extension
71 // ID. 71 // ID.
72 std::string AddExtensionWithPrefs(const std::string& name); 72 std::string AddExtensionWithPrefs(const std::string& name);
73 73
74 protected: 74 protected:
75 base::MessageLoopForUI ui_message_loop_; 75 base::MessageLoopForUI ui_message_loop_;
76 content::TestBrowserThread ui_thread_; 76 content::TestBrowserThread ui_thread_;
77 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; 77 std::unique_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
78 scoped_ptr<PrefService> pref_service_; 78 std::unique_ptr<PrefService> pref_service_;
79 scoped_ptr<ExtensionPrefs> extension_prefs_; 79 std::unique_ptr<ExtensionPrefs> extension_prefs_;
80 scoped_ptr<AppWindowGeometryCache> cache_; 80 std::unique_ptr<AppWindowGeometryCache> cache_;
81 }; 81 };
82 82
83 void AppWindowGeometryCacheTest::SetUp() { 83 void AppWindowGeometryCacheTest::SetUp() {
84 ExtensionsTest::SetUp(); 84 ExtensionsTest::SetUp();
85 85
86 // Set up all the dependencies of ExtensionPrefs. 86 // Set up all the dependencies of ExtensionPrefs.
87 extension_pref_value_map_.reset(new ExtensionPrefValueMap); 87 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
88 PrefServiceFactory factory; 88 PrefServiceFactory factory;
89 factory.set_user_prefs(new TestingPrefStore); 89 factory.set_user_prefs(new TestingPrefStore);
90 factory.set_extension_prefs(new TestingPrefStore); 90 factory.set_extension_prefs(new TestingPrefStore);
(...skipping 22 matching lines...) Expand all
113 113
114 ExtensionsTest::TearDown(); 114 ExtensionsTest::TearDown();
115 } 115 }
116 116
117 void AppWindowGeometryCacheTest::AddGeometryAndLoadExtension( 117 void AppWindowGeometryCacheTest::AddGeometryAndLoadExtension(
118 const std::string& extension_id, 118 const std::string& extension_id,
119 const std::string& window_id, 119 const std::string& window_id,
120 const gfx::Rect& bounds, 120 const gfx::Rect& bounds,
121 const gfx::Rect& screen_bounds, 121 const gfx::Rect& screen_bounds,
122 ui::WindowShowState state) { 122 ui::WindowShowState state) {
123 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 123 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
124 base::DictionaryValue* value = new base::DictionaryValue; 124 base::DictionaryValue* value = new base::DictionaryValue;
125 value->SetInteger("x", bounds.x()); 125 value->SetInteger("x", bounds.x());
126 value->SetInteger("y", bounds.y()); 126 value->SetInteger("y", bounds.y());
127 value->SetInteger("w", bounds.width()); 127 value->SetInteger("w", bounds.width());
128 value->SetInteger("h", bounds.height()); 128 value->SetInteger("h", bounds.height());
129 value->SetInteger("screen_bounds_x", screen_bounds.x()); 129 value->SetInteger("screen_bounds_x", screen_bounds.x());
130 value->SetInteger("screen_bounds_y", screen_bounds.y()); 130 value->SetInteger("screen_bounds_y", screen_bounds.y());
131 value->SetInteger("screen_bounds_w", screen_bounds.width()); 131 value->SetInteger("screen_bounds_w", screen_bounds.width());
132 value->SetInteger("screen_bounds_h", screen_bounds.height()); 132 value->SetInteger("screen_bounds_h", screen_bounds.height());
133 value->SetInteger("state", state); 133 value->SetInteger("state", state);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // The first added window should no longer have cached geometry. 424 // The first added window should no longer have cached geometry.
425 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL)); 425 EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL));
426 // All other windows should still exist. 426 // All other windows should still exist.
427 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) { 427 for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
428 std::string window_id = "window_" + base::SizeTToString(i); 428 std::string window_id = "window_" + base::SizeTToString(i);
429 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL)); 429 EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL));
430 } 430 }
431 } 431 }
432 432
433 } // namespace extensions 433 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_window/app_window_geometry_cache.cc ('k') | extensions/browser/app_window/native_app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698