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

Side by Side Diff: chrome/browser/extensions/chrome_app_sorting_unittest.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/chrome_app_sorting.h" 5 #include "chrome/browser/extensions/chrome_app_sorting.h"
6 6
7 #include "chrome/browser/extensions/extension_prefs_unittest.h" 7 #include "chrome/browser/extensions/extension_prefs_unittest.h"
8 #include "components/crx_file/id_util.h" 8 #include "components/crx_file/id_util.h"
9 #include "components/sync/model/string_ordinal.h" 9 #include "components/sync/model/string_ordinal.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // A preference determining the order of which the apps appear on the NTP. 147 // A preference determining the order of which the apps appear on the NTP.
148 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; 148 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index";
149 // A preference determining the page on which an app appears in the NTP. 149 // A preference determining the page on which an app appears in the NTP.
150 const char kPrefPageIndexDeprecated[] = "page_index"; 150 const char kPrefPageIndexDeprecated[] = "page_index";
151 151
152 // Setup the deprecated preferences. 152 // Setup the deprecated preferences.
153 ExtensionScopedPrefs* scoped_prefs = 153 ExtensionScopedPrefs* scoped_prefs =
154 static_cast<ExtensionScopedPrefs*>(prefs()); 154 static_cast<ExtensionScopedPrefs*>(prefs());
155 scoped_prefs->UpdateExtensionPref(extension1()->id(), 155 scoped_prefs->UpdateExtensionPref(extension1()->id(),
156 kPrefAppLaunchIndexDeprecated, 156 kPrefAppLaunchIndexDeprecated,
157 new base::FundamentalValue(0)); 157 new base::Value(0));
158 scoped_prefs->UpdateExtensionPref(extension1()->id(), 158 scoped_prefs->UpdateExtensionPref(extension1()->id(),
159 kPrefPageIndexDeprecated, 159 kPrefPageIndexDeprecated,
160 new base::FundamentalValue(0)); 160 new base::Value(0));
161 161
162 scoped_prefs->UpdateExtensionPref(extension2()->id(), 162 scoped_prefs->UpdateExtensionPref(extension2()->id(),
163 kPrefAppLaunchIndexDeprecated, 163 kPrefAppLaunchIndexDeprecated,
164 new base::FundamentalValue(1)); 164 new base::Value(1));
165 scoped_prefs->UpdateExtensionPref(extension2()->id(), 165 scoped_prefs->UpdateExtensionPref(extension2()->id(),
166 kPrefPageIndexDeprecated, 166 kPrefPageIndexDeprecated,
167 new base::FundamentalValue(0)); 167 new base::Value(0));
168 168
169 scoped_prefs->UpdateExtensionPref(extension3()->id(), 169 scoped_prefs->UpdateExtensionPref(extension3()->id(),
170 kPrefAppLaunchIndexDeprecated, 170 kPrefAppLaunchIndexDeprecated,
171 new base::FundamentalValue(0)); 171 new base::Value(0));
172 scoped_prefs->UpdateExtensionPref(extension3()->id(), 172 scoped_prefs->UpdateExtensionPref(extension3()->id(),
173 kPrefPageIndexDeprecated, 173 kPrefPageIndexDeprecated,
174 new base::FundamentalValue(1)); 174 new base::Value(1));
175 175
176 // We insert the ids in reverse order so that we have to deal with the 176 // We insert the ids in reverse order so that we have to deal with the
177 // element on the 2nd page before the 1st page is seen. 177 // element on the 2nd page before the 1st page is seen.
178 ExtensionIdList ids; 178 ExtensionIdList ids;
179 ids.push_back(extension3()->id()); 179 ids.push_back(extension3()->id());
180 ids.push_back(extension2()->id()); 180 ids.push_back(extension2()->id());
181 ids.push_back(extension1()->id()); 181 ids.push_back(extension1()->id());
182 182
183 app_sorting()->MigrateAppIndex(ids); 183 app_sorting()->MigrateAppIndex(ids);
184 } 184 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // A preference determining the order of which the apps appear on the NTP. 254 // A preference determining the order of which the apps appear on the NTP.
255 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; 255 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index";
256 // A preference determining the page on which an app appears in the NTP. 256 // A preference determining the page on which an app appears in the NTP.
257 const char kPrefPageIndexDeprecated[] = "page_index"; 257 const char kPrefPageIndexDeprecated[] = "page_index";
258 258
259 // Setup the deprecated preference. 259 // Setup the deprecated preference.
260 ExtensionScopedPrefs* scoped_prefs = 260 ExtensionScopedPrefs* scoped_prefs =
261 static_cast<ExtensionScopedPrefs*>(prefs()); 261 static_cast<ExtensionScopedPrefs*>(prefs());
262 scoped_prefs->UpdateExtensionPref(extension1()->id(), 262 scoped_prefs->UpdateExtensionPref(extension1()->id(),
263 kPrefAppLaunchIndexDeprecated, 263 kPrefAppLaunchIndexDeprecated,
264 new base::FundamentalValue(0)); 264 new base::Value(0));
265 scoped_prefs->UpdateExtensionPref(extension1()->id(), 265 scoped_prefs->UpdateExtensionPref(extension1()->id(),
266 kPrefPageIndexDeprecated, 266 kPrefPageIndexDeprecated,
267 new base::FundamentalValue(-1)); 267 new base::Value(-1));
268 } 268 }
269 void Verify() override { 269 void Verify() override {
270 // Make sure that the invalid page_index wasn't converted over. 270 // Make sure that the invalid page_index wasn't converted over.
271 EXPECT_FALSE(app_sorting()->GetAppLaunchOrdinal( 271 EXPECT_FALSE(app_sorting()->GetAppLaunchOrdinal(
272 extension1()->id()).IsValid()); 272 extension1()->id()).IsValid());
273 } 273 }
274 }; 274 };
275 TEST_F(ChromeAppSortingMigrateAppIndexInvalid, 275 TEST_F(ChromeAppSortingMigrateAppIndexInvalid,
276 ChromeAppSortingMigrateAppIndexInvalid) {} 276 ChromeAppSortingMigrateAppIndexInvalid) {}
277 277
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 936
937 private: 937 private:
938 scoped_refptr<Extension> first_app_; 938 scoped_refptr<Extension> first_app_;
939 scoped_refptr<Extension> second_app_; 939 scoped_refptr<Extension> second_app_;
940 }; 940 };
941 TEST_F(ChromeAppSortingSetExtensionVisible, 941 TEST_F(ChromeAppSortingSetExtensionVisible,
942 ChromeAppSortingSetExtensionVisible) { 942 ChromeAppSortingSetExtensionVisible) {
943 } 943 }
944 944
945 } // namespace extensions 945 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698