OLD | NEW |
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 <map> | 7 #include <map> |
8 | 8 |
9 #include "chrome/browser/extensions/./extension_prefs_unittest.h" | 9 #include "chrome/browser/extensions/./extension_prefs_unittest.h" |
10 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
11 #include "extensions/common/constants.h" | 11 #include "extensions/common/constants.h" |
12 #include "extensions/common/manifest_constants.h" | 12 #include "extensions/common/manifest_constants.h" |
13 #include "sync/api/string_ordinal.h" | 13 #include "sync/api/string_ordinal.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 namespace keys = manifest_keys; | 18 namespace keys = manifest_keys; |
19 | 19 |
20 class ChromeAppSortingTest : public ExtensionPrefsTest { | 20 class ChromeAppSortingTest : public ExtensionPrefsTest { |
21 protected: | 21 protected: |
22 ChromeAppSorting* app_sorting() { | 22 ChromeAppSorting* app_sorting() { |
23 return static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 23 return static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
24 } | 24 } |
25 }; | 25 }; |
26 | 26 |
27 class ChromeAppSortingAppLocation : public ChromeAppSortingTest { | 27 class ChromeAppSortingAppLocation : public ChromeAppSortingTest { |
28 public: | 28 public: |
29 virtual void Initialize() OVERRIDE { | 29 virtual void Initialize() override { |
30 extension_ = prefs_.AddExtension("not_an_app"); | 30 extension_ = prefs_.AddExtension("not_an_app"); |
31 // Non-apps should not have any app launch ordinal or page ordinal. | 31 // Non-apps should not have any app launch ordinal or page ordinal. |
32 prefs()->OnExtensionInstalled(extension_.get(), | 32 prefs()->OnExtensionInstalled(extension_.get(), |
33 Extension::ENABLED, | 33 Extension::ENABLED, |
34 syncer::StringOrdinal(), | 34 syncer::StringOrdinal(), |
35 std::string()); | 35 std::string()); |
36 } | 36 } |
37 | 37 |
38 virtual void Verify() OVERRIDE { | 38 virtual void Verify() override { |
39 EXPECT_FALSE( | 39 EXPECT_FALSE( |
40 app_sorting()->GetAppLaunchOrdinal(extension_->id()).IsValid()); | 40 app_sorting()->GetAppLaunchOrdinal(extension_->id()).IsValid()); |
41 EXPECT_FALSE( | 41 EXPECT_FALSE( |
42 app_sorting()->GetPageOrdinal(extension_->id()).IsValid()); | 42 app_sorting()->GetPageOrdinal(extension_->id()).IsValid()); |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 scoped_refptr<Extension> extension_; | 46 scoped_refptr<Extension> extension_; |
47 }; | 47 }; |
48 TEST_F(ChromeAppSortingAppLocation, ChromeAppSortingAppLocation) {} | 48 TEST_F(ChromeAppSortingAppLocation, ChromeAppSortingAppLocation) {} |
49 | 49 |
50 class ChromeAppSortingAppLaunchOrdinal : public ChromeAppSortingTest { | 50 class ChromeAppSortingAppLaunchOrdinal : public ChromeAppSortingTest { |
51 public: | 51 public: |
52 virtual void Initialize() OVERRIDE { | 52 virtual void Initialize() override { |
53 // No extensions yet. | 53 // No extensions yet. |
54 syncer::StringOrdinal page = syncer::StringOrdinal::CreateInitialOrdinal(); | 54 syncer::StringOrdinal page = syncer::StringOrdinal::CreateInitialOrdinal(); |
55 EXPECT_TRUE(syncer::StringOrdinal::CreateInitialOrdinal().Equals( | 55 EXPECT_TRUE(syncer::StringOrdinal::CreateInitialOrdinal().Equals( |
56 app_sorting()->CreateNextAppLaunchOrdinal(page))); | 56 app_sorting()->CreateNextAppLaunchOrdinal(page))); |
57 | 57 |
58 extension_ = prefs_.AddApp("on_extension_installed"); | 58 extension_ = prefs_.AddApp("on_extension_installed"); |
59 EXPECT_FALSE(prefs()->IsExtensionDisabled(extension_->id())); | 59 EXPECT_FALSE(prefs()->IsExtensionDisabled(extension_->id())); |
60 prefs()->OnExtensionInstalled(extension_.get(), | 60 prefs()->OnExtensionInstalled(extension_.get(), |
61 Extension::ENABLED, | 61 Extension::ENABLED, |
62 syncer::StringOrdinal(), | 62 syncer::StringOrdinal(), |
63 std::string()); | 63 std::string()); |
64 } | 64 } |
65 | 65 |
66 virtual void Verify() OVERRIDE { | 66 virtual void Verify() override { |
67 syncer::StringOrdinal launch_ordinal = | 67 syncer::StringOrdinal launch_ordinal = |
68 app_sorting()->GetAppLaunchOrdinal(extension_->id()); | 68 app_sorting()->GetAppLaunchOrdinal(extension_->id()); |
69 syncer::StringOrdinal page_ordinal = | 69 syncer::StringOrdinal page_ordinal = |
70 syncer::StringOrdinal::CreateInitialOrdinal(); | 70 syncer::StringOrdinal::CreateInitialOrdinal(); |
71 | 71 |
72 // Extension should have been assigned a valid StringOrdinal. | 72 // Extension should have been assigned a valid StringOrdinal. |
73 EXPECT_TRUE(launch_ordinal.IsValid()); | 73 EXPECT_TRUE(launch_ordinal.IsValid()); |
74 EXPECT_TRUE(launch_ordinal.LessThan( | 74 EXPECT_TRUE(launch_ordinal.LessThan( |
75 app_sorting()->CreateNextAppLaunchOrdinal(page_ordinal))); | 75 app_sorting()->CreateNextAppLaunchOrdinal(page_ordinal))); |
76 // Set a new launch ordinal of and verify it comes after. | 76 // Set a new launch ordinal of and verify it comes after. |
(...skipping 21 matching lines...) Expand all Loading... |
98 app_sorting()->CreateFirstAppLaunchOrdinal(next_page))); | 98 app_sorting()->CreateFirstAppLaunchOrdinal(next_page))); |
99 } | 99 } |
100 | 100 |
101 private: | 101 private: |
102 scoped_refptr<Extension> extension_; | 102 scoped_refptr<Extension> extension_; |
103 }; | 103 }; |
104 TEST_F(ChromeAppSortingAppLaunchOrdinal, ChromeAppSortingAppLaunchOrdinal) {} | 104 TEST_F(ChromeAppSortingAppLaunchOrdinal, ChromeAppSortingAppLaunchOrdinal) {} |
105 | 105 |
106 class ChromeAppSortingPageOrdinal : public ChromeAppSortingTest { | 106 class ChromeAppSortingPageOrdinal : public ChromeAppSortingTest { |
107 public: | 107 public: |
108 virtual void Initialize() OVERRIDE { | 108 virtual void Initialize() override { |
109 extension_ = prefs_.AddApp("page_ordinal"); | 109 extension_ = prefs_.AddApp("page_ordinal"); |
110 // Install with a page preference. | 110 // Install with a page preference. |
111 first_page_ = syncer::StringOrdinal::CreateInitialOrdinal(); | 111 first_page_ = syncer::StringOrdinal::CreateInitialOrdinal(); |
112 prefs()->OnExtensionInstalled(extension_.get(), | 112 prefs()->OnExtensionInstalled(extension_.get(), |
113 Extension::ENABLED, | 113 Extension::ENABLED, |
114 first_page_, | 114 first_page_, |
115 std::string()); | 115 std::string()); |
116 EXPECT_TRUE(first_page_.Equals( | 116 EXPECT_TRUE(first_page_.Equals( |
117 app_sorting()->GetPageOrdinal(extension_->id()))); | 117 app_sorting()->GetPageOrdinal(extension_->id()))); |
118 EXPECT_EQ(0, app_sorting()->PageStringOrdinalAsInteger(first_page_)); | 118 EXPECT_EQ(0, app_sorting()->PageStringOrdinalAsInteger(first_page_)); |
119 | 119 |
120 scoped_refptr<Extension> extension2 = prefs_.AddApp("page_ordinal_2"); | 120 scoped_refptr<Extension> extension2 = prefs_.AddApp("page_ordinal_2"); |
121 // Install without any page preference. | 121 // Install without any page preference. |
122 prefs()->OnExtensionInstalled(extension2.get(), | 122 prefs()->OnExtensionInstalled(extension2.get(), |
123 Extension::ENABLED, | 123 Extension::ENABLED, |
124 syncer::StringOrdinal(), | 124 syncer::StringOrdinal(), |
125 std::string()); | 125 std::string()); |
126 EXPECT_TRUE(first_page_.Equals( | 126 EXPECT_TRUE(first_page_.Equals( |
127 app_sorting()->GetPageOrdinal(extension2->id()))); | 127 app_sorting()->GetPageOrdinal(extension2->id()))); |
128 } | 128 } |
129 virtual void Verify() OVERRIDE { | 129 virtual void Verify() override { |
130 // Set the page ordinal. | 130 // Set the page ordinal. |
131 syncer::StringOrdinal new_page = first_page_.CreateAfter(); | 131 syncer::StringOrdinal new_page = first_page_.CreateAfter(); |
132 app_sorting()->SetPageOrdinal(extension_->id(), new_page); | 132 app_sorting()->SetPageOrdinal(extension_->id(), new_page); |
133 // Verify the page ordinal. | 133 // Verify the page ordinal. |
134 EXPECT_TRUE( | 134 EXPECT_TRUE( |
135 new_page.Equals(app_sorting()->GetPageOrdinal(extension_->id()))); | 135 new_page.Equals(app_sorting()->GetPageOrdinal(extension_->id()))); |
136 EXPECT_EQ(1, app_sorting()->PageStringOrdinalAsInteger(new_page)); | 136 EXPECT_EQ(1, app_sorting()->PageStringOrdinalAsInteger(new_page)); |
137 | 137 |
138 // This extension doesn't exist, so it should return an invalid | 138 // This extension doesn't exist, so it should return an invalid |
139 // StringOrdinal. | 139 // StringOrdinal. |
140 EXPECT_FALSE(app_sorting()->GetPageOrdinal("foo").IsValid()); | 140 EXPECT_FALSE(app_sorting()->GetPageOrdinal("foo").IsValid()); |
141 } | 141 } |
142 | 142 |
143 private: | 143 private: |
144 syncer::StringOrdinal first_page_; | 144 syncer::StringOrdinal first_page_; |
145 scoped_refptr<Extension> extension_; | 145 scoped_refptr<Extension> extension_; |
146 }; | 146 }; |
147 TEST_F(ChromeAppSortingPageOrdinal, ChromeAppSortingPageOrdinal) {} | 147 TEST_F(ChromeAppSortingPageOrdinal, ChromeAppSortingPageOrdinal) {} |
148 | 148 |
149 // Ensure that ChromeAppSorting is able to properly initialize off a set | 149 // Ensure that ChromeAppSorting is able to properly initialize off a set |
150 // of old page and app launch indices and properly convert them. | 150 // of old page and app launch indices and properly convert them. |
151 class ChromeAppSortingInitialize : public PrefsPrepopulatedTestBase { | 151 class ChromeAppSortingInitialize : public PrefsPrepopulatedTestBase { |
152 public: | 152 public: |
153 ChromeAppSortingInitialize() {} | 153 ChromeAppSortingInitialize() {} |
154 virtual ~ChromeAppSortingInitialize() {} | 154 virtual ~ChromeAppSortingInitialize() {} |
155 | 155 |
156 virtual void Initialize() OVERRIDE { | 156 virtual void Initialize() override { |
157 // A preference determining the order of which the apps appear on the NTP. | 157 // A preference determining the order of which the apps appear on the NTP. |
158 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; | 158 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; |
159 // A preference determining the page on which an app appears in the NTP. | 159 // A preference determining the page on which an app appears in the NTP. |
160 const char kPrefPageIndexDeprecated[] = "page_index"; | 160 const char kPrefPageIndexDeprecated[] = "page_index"; |
161 | 161 |
162 // Setup the deprecated preferences. | 162 // Setup the deprecated preferences. |
163 ExtensionScopedPrefs* scoped_prefs = | 163 ExtensionScopedPrefs* scoped_prefs = |
164 static_cast<ExtensionScopedPrefs*>(prefs()); | 164 static_cast<ExtensionScopedPrefs*>(prefs()); |
165 scoped_prefs->UpdateExtensionPref(extension1()->id(), | 165 scoped_prefs->UpdateExtensionPref(extension1()->id(), |
166 kPrefAppLaunchIndexDeprecated, | 166 kPrefAppLaunchIndexDeprecated, |
(...skipping 18 matching lines...) Expand all Loading... |
185 | 185 |
186 // We insert the ids in reserve order so that we have to deal with the | 186 // We insert the ids in reserve order so that we have to deal with the |
187 // element on the 2nd page before the 1st page is seen. | 187 // element on the 2nd page before the 1st page is seen. |
188 ExtensionIdList ids; | 188 ExtensionIdList ids; |
189 ids.push_back(extension3()->id()); | 189 ids.push_back(extension3()->id()); |
190 ids.push_back(extension2()->id()); | 190 ids.push_back(extension2()->id()); |
191 ids.push_back(extension1()->id()); | 191 ids.push_back(extension1()->id()); |
192 | 192 |
193 prefs()->app_sorting()->Initialize(ids); | 193 prefs()->app_sorting()->Initialize(ids); |
194 } | 194 } |
195 virtual void Verify() OVERRIDE { | 195 virtual void Verify() override { |
196 syncer::StringOrdinal first_ordinal = | 196 syncer::StringOrdinal first_ordinal = |
197 syncer::StringOrdinal::CreateInitialOrdinal(); | 197 syncer::StringOrdinal::CreateInitialOrdinal(); |
198 AppSorting* app_sorting = prefs()->app_sorting(); | 198 AppSorting* app_sorting = prefs()->app_sorting(); |
199 | 199 |
200 EXPECT_TRUE(first_ordinal.Equals( | 200 EXPECT_TRUE(first_ordinal.Equals( |
201 app_sorting->GetAppLaunchOrdinal(extension1()->id()))); | 201 app_sorting->GetAppLaunchOrdinal(extension1()->id()))); |
202 EXPECT_TRUE(first_ordinal.LessThan( | 202 EXPECT_TRUE(first_ordinal.LessThan( |
203 app_sorting->GetAppLaunchOrdinal(extension2()->id()))); | 203 app_sorting->GetAppLaunchOrdinal(extension2()->id()))); |
204 EXPECT_TRUE(first_ordinal.Equals( | 204 EXPECT_TRUE(first_ordinal.Equals( |
205 app_sorting->GetAppLaunchOrdinal(extension3()->id()))); | 205 app_sorting->GetAppLaunchOrdinal(extension3()->id()))); |
206 | 206 |
207 EXPECT_TRUE(first_ordinal.Equals( | 207 EXPECT_TRUE(first_ordinal.Equals( |
208 app_sorting->GetPageOrdinal(extension1()->id()))); | 208 app_sorting->GetPageOrdinal(extension1()->id()))); |
209 EXPECT_TRUE(first_ordinal.Equals( | 209 EXPECT_TRUE(first_ordinal.Equals( |
210 app_sorting->GetPageOrdinal(extension2()->id()))); | 210 app_sorting->GetPageOrdinal(extension2()->id()))); |
211 EXPECT_TRUE(first_ordinal.LessThan( | 211 EXPECT_TRUE(first_ordinal.LessThan( |
212 app_sorting->GetPageOrdinal(extension3()->id()))); | 212 app_sorting->GetPageOrdinal(extension3()->id()))); |
213 } | 213 } |
214 }; | 214 }; |
215 TEST_F(ChromeAppSortingInitialize, ChromeAppSortingInitialize) {} | 215 TEST_F(ChromeAppSortingInitialize, ChromeAppSortingInitialize) {} |
216 | 216 |
217 // Make sure that initialization still works when no extensions are present | 217 // Make sure that initialization still works when no extensions are present |
218 // (i.e. make sure that the web store icon is still loaded into the map). | 218 // (i.e. make sure that the web store icon is still loaded into the map). |
219 class ChromeAppSortingInitializeWithNoApps : public PrefsPrepopulatedTestBase { | 219 class ChromeAppSortingInitializeWithNoApps : public PrefsPrepopulatedTestBase { |
220 public: | 220 public: |
221 ChromeAppSortingInitializeWithNoApps() {} | 221 ChromeAppSortingInitializeWithNoApps() {} |
222 virtual ~ChromeAppSortingInitializeWithNoApps() {} | 222 virtual ~ChromeAppSortingInitializeWithNoApps() {} |
223 | 223 |
224 virtual void Initialize() OVERRIDE { | 224 virtual void Initialize() override { |
225 AppSorting* app_sorting = prefs()->app_sorting(); | 225 AppSorting* app_sorting = prefs()->app_sorting(); |
226 | 226 |
227 // Make sure that the web store has valid ordinals. | 227 // Make sure that the web store has valid ordinals. |
228 syncer::StringOrdinal initial_ordinal = | 228 syncer::StringOrdinal initial_ordinal = |
229 syncer::StringOrdinal::CreateInitialOrdinal(); | 229 syncer::StringOrdinal::CreateInitialOrdinal(); |
230 app_sorting->SetPageOrdinal(extensions::kWebStoreAppId, | 230 app_sorting->SetPageOrdinal(extensions::kWebStoreAppId, |
231 initial_ordinal); | 231 initial_ordinal); |
232 app_sorting->SetAppLaunchOrdinal(extensions::kWebStoreAppId, | 232 app_sorting->SetAppLaunchOrdinal(extensions::kWebStoreAppId, |
233 initial_ordinal); | 233 initial_ordinal); |
234 | 234 |
235 ExtensionIdList ids; | 235 ExtensionIdList ids; |
236 app_sorting->Initialize(ids); | 236 app_sorting->Initialize(ids); |
237 } | 237 } |
238 virtual void Verify() OVERRIDE { | 238 virtual void Verify() override { |
239 ChromeAppSorting* app_sorting = | 239 ChromeAppSorting* app_sorting = |
240 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 240 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
241 | 241 |
242 syncer::StringOrdinal page = | 242 syncer::StringOrdinal page = |
243 app_sorting->GetPageOrdinal(extensions::kWebStoreAppId); | 243 app_sorting->GetPageOrdinal(extensions::kWebStoreAppId); |
244 EXPECT_TRUE(page.IsValid()); | 244 EXPECT_TRUE(page.IsValid()); |
245 | 245 |
246 ChromeAppSorting::PageOrdinalMap::iterator page_it = | 246 ChromeAppSorting::PageOrdinalMap::iterator page_it = |
247 app_sorting->ntp_ordinal_map_.find(page); | 247 app_sorting->ntp_ordinal_map_.find(page); |
248 EXPECT_TRUE(page_it != app_sorting->ntp_ordinal_map_.end()); | 248 EXPECT_TRUE(page_it != app_sorting->ntp_ordinal_map_.end()); |
(...skipping 13 matching lines...) Expand all Loading... |
262 // Tests the application index to ordinal migration code for values that | 262 // Tests the application index to ordinal migration code for values that |
263 // shouldn't be converted. This should be removed when the migrate code | 263 // shouldn't be converted. This should be removed when the migrate code |
264 // is taken out. | 264 // is taken out. |
265 // http://crbug.com/107376 | 265 // http://crbug.com/107376 |
266 class ChromeAppSortingMigrateAppIndexInvalid | 266 class ChromeAppSortingMigrateAppIndexInvalid |
267 : public PrefsPrepopulatedTestBase { | 267 : public PrefsPrepopulatedTestBase { |
268 public: | 268 public: |
269 ChromeAppSortingMigrateAppIndexInvalid() {} | 269 ChromeAppSortingMigrateAppIndexInvalid() {} |
270 virtual ~ChromeAppSortingMigrateAppIndexInvalid() {} | 270 virtual ~ChromeAppSortingMigrateAppIndexInvalid() {} |
271 | 271 |
272 virtual void Initialize() OVERRIDE { | 272 virtual void Initialize() override { |
273 // A preference determining the order of which the apps appear on the NTP. | 273 // A preference determining the order of which the apps appear on the NTP. |
274 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; | 274 const char kPrefAppLaunchIndexDeprecated[] = "app_launcher_index"; |
275 // A preference determining the page on which an app appears in the NTP. | 275 // A preference determining the page on which an app appears in the NTP. |
276 const char kPrefPageIndexDeprecated[] = "page_index"; | 276 const char kPrefPageIndexDeprecated[] = "page_index"; |
277 | 277 |
278 // Setup the deprecated preference. | 278 // Setup the deprecated preference. |
279 ExtensionScopedPrefs* scoped_prefs = | 279 ExtensionScopedPrefs* scoped_prefs = |
280 static_cast<ExtensionScopedPrefs*>(prefs()); | 280 static_cast<ExtensionScopedPrefs*>(prefs()); |
281 scoped_prefs->UpdateExtensionPref(extension1()->id(), | 281 scoped_prefs->UpdateExtensionPref(extension1()->id(), |
282 kPrefAppLaunchIndexDeprecated, | 282 kPrefAppLaunchIndexDeprecated, |
283 new base::FundamentalValue(0)); | 283 new base::FundamentalValue(0)); |
284 scoped_prefs->UpdateExtensionPref(extension1()->id(), | 284 scoped_prefs->UpdateExtensionPref(extension1()->id(), |
285 kPrefPageIndexDeprecated, | 285 kPrefPageIndexDeprecated, |
286 new base::FundamentalValue(-1)); | 286 new base::FundamentalValue(-1)); |
287 | 287 |
288 ExtensionIdList ids; | 288 ExtensionIdList ids; |
289 ids.push_back(extension1()->id()); | 289 ids.push_back(extension1()->id()); |
290 | 290 |
291 prefs()->app_sorting()->Initialize(ids); | 291 prefs()->app_sorting()->Initialize(ids); |
292 } | 292 } |
293 virtual void Verify() OVERRIDE { | 293 virtual void Verify() override { |
294 // Make sure that the invalid page_index wasn't converted over. | 294 // Make sure that the invalid page_index wasn't converted over. |
295 EXPECT_FALSE(prefs()->app_sorting()->GetAppLaunchOrdinal( | 295 EXPECT_FALSE(prefs()->app_sorting()->GetAppLaunchOrdinal( |
296 extension1()->id()).IsValid()); | 296 extension1()->id()).IsValid()); |
297 } | 297 } |
298 }; | 298 }; |
299 TEST_F(ChromeAppSortingMigrateAppIndexInvalid, | 299 TEST_F(ChromeAppSortingMigrateAppIndexInvalid, |
300 ChromeAppSortingMigrateAppIndexInvalid) {} | 300 ChromeAppSortingMigrateAppIndexInvalid) {} |
301 | 301 |
302 class ChromeAppSortingFixNTPCollisionsAllCollide | 302 class ChromeAppSortingFixNTPCollisionsAllCollide |
303 : public PrefsPrepopulatedTestBase { | 303 : public PrefsPrepopulatedTestBase { |
304 public: | 304 public: |
305 ChromeAppSortingFixNTPCollisionsAllCollide() {} | 305 ChromeAppSortingFixNTPCollisionsAllCollide() {} |
306 virtual ~ChromeAppSortingFixNTPCollisionsAllCollide() {} | 306 virtual ~ChromeAppSortingFixNTPCollisionsAllCollide() {} |
307 | 307 |
308 virtual void Initialize() OVERRIDE { | 308 virtual void Initialize() override { |
309 repeated_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); | 309 repeated_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); |
310 | 310 |
311 AppSorting* app_sorting = prefs()->app_sorting(); | 311 AppSorting* app_sorting = prefs()->app_sorting(); |
312 | 312 |
313 app_sorting->SetAppLaunchOrdinal(extension1()->id(), | 313 app_sorting->SetAppLaunchOrdinal(extension1()->id(), |
314 repeated_ordinal_); | 314 repeated_ordinal_); |
315 app_sorting->SetPageOrdinal(extension1()->id(), repeated_ordinal_); | 315 app_sorting->SetPageOrdinal(extension1()->id(), repeated_ordinal_); |
316 | 316 |
317 app_sorting->SetAppLaunchOrdinal(extension2()->id(), repeated_ordinal_); | 317 app_sorting->SetAppLaunchOrdinal(extension2()->id(), repeated_ordinal_); |
318 app_sorting->SetPageOrdinal(extension2()->id(), repeated_ordinal_); | 318 app_sorting->SetPageOrdinal(extension2()->id(), repeated_ordinal_); |
319 | 319 |
320 app_sorting->SetAppLaunchOrdinal(extension3()->id(), repeated_ordinal_); | 320 app_sorting->SetAppLaunchOrdinal(extension3()->id(), repeated_ordinal_); |
321 app_sorting->SetPageOrdinal(extension3()->id(), repeated_ordinal_); | 321 app_sorting->SetPageOrdinal(extension3()->id(), repeated_ordinal_); |
322 | 322 |
323 app_sorting->FixNTPOrdinalCollisions(); | 323 app_sorting->FixNTPOrdinalCollisions(); |
324 } | 324 } |
325 virtual void Verify() OVERRIDE { | 325 virtual void Verify() override { |
326 AppSorting* app_sorting = prefs()->app_sorting(); | 326 AppSorting* app_sorting = prefs()->app_sorting(); |
327 syncer::StringOrdinal extension1_app_launch = | 327 syncer::StringOrdinal extension1_app_launch = |
328 app_sorting->GetAppLaunchOrdinal(extension1()->id()); | 328 app_sorting->GetAppLaunchOrdinal(extension1()->id()); |
329 syncer::StringOrdinal extension2_app_launch = | 329 syncer::StringOrdinal extension2_app_launch = |
330 app_sorting->GetAppLaunchOrdinal(extension2()->id()); | 330 app_sorting->GetAppLaunchOrdinal(extension2()->id()); |
331 syncer::StringOrdinal extension3_app_launch = | 331 syncer::StringOrdinal extension3_app_launch = |
332 app_sorting->GetAppLaunchOrdinal(extension3()->id()); | 332 app_sorting->GetAppLaunchOrdinal(extension3()->id()); |
333 | 333 |
334 // The overlapping extensions should have be adjusted so that they are | 334 // The overlapping extensions should have be adjusted so that they are |
335 // sorted by their id. | 335 // sorted by their id. |
(...skipping 18 matching lines...) Expand all Loading... |
354 }; | 354 }; |
355 TEST_F(ChromeAppSortingFixNTPCollisionsAllCollide, | 355 TEST_F(ChromeAppSortingFixNTPCollisionsAllCollide, |
356 ChromeAppSortingFixNTPCollisionsAllCollide) {} | 356 ChromeAppSortingFixNTPCollisionsAllCollide) {} |
357 | 357 |
358 class ChromeAppSortingFixNTPCollisionsSomeCollideAtStart | 358 class ChromeAppSortingFixNTPCollisionsSomeCollideAtStart |
359 : public PrefsPrepopulatedTestBase { | 359 : public PrefsPrepopulatedTestBase { |
360 public: | 360 public: |
361 ChromeAppSortingFixNTPCollisionsSomeCollideAtStart() {} | 361 ChromeAppSortingFixNTPCollisionsSomeCollideAtStart() {} |
362 virtual ~ChromeAppSortingFixNTPCollisionsSomeCollideAtStart() {} | 362 virtual ~ChromeAppSortingFixNTPCollisionsSomeCollideAtStart() {} |
363 | 363 |
364 virtual void Initialize() OVERRIDE { | 364 virtual void Initialize() override { |
365 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); | 365 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); |
366 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); | 366 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); |
367 | 367 |
368 AppSorting* app_sorting = prefs()->app_sorting(); | 368 AppSorting* app_sorting = prefs()->app_sorting(); |
369 | 369 |
370 // Have the first two extension in the same position, with a third | 370 // Have the first two extension in the same position, with a third |
371 // (non-colliding) extension after. | 371 // (non-colliding) extension after. |
372 | 372 |
373 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); | 373 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); |
374 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); | 374 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); |
375 | 375 |
376 app_sorting->SetAppLaunchOrdinal(extension2()->id(), first_ordinal_); | 376 app_sorting->SetAppLaunchOrdinal(extension2()->id(), first_ordinal_); |
377 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); | 377 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); |
378 | 378 |
379 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); | 379 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); |
380 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); | 380 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); |
381 | 381 |
382 app_sorting->FixNTPOrdinalCollisions(); | 382 app_sorting->FixNTPOrdinalCollisions(); |
383 } | 383 } |
384 virtual void Verify() OVERRIDE { | 384 virtual void Verify() override { |
385 AppSorting* app_sorting = prefs()->app_sorting(); | 385 AppSorting* app_sorting = prefs()->app_sorting(); |
386 syncer::StringOrdinal extension1_app_launch = | 386 syncer::StringOrdinal extension1_app_launch = |
387 app_sorting->GetAppLaunchOrdinal(extension1()->id()); | 387 app_sorting->GetAppLaunchOrdinal(extension1()->id()); |
388 syncer::StringOrdinal extension2_app_launch = | 388 syncer::StringOrdinal extension2_app_launch = |
389 app_sorting->GetAppLaunchOrdinal(extension2()->id()); | 389 app_sorting->GetAppLaunchOrdinal(extension2()->id()); |
390 syncer::StringOrdinal extension3_app_launch = | 390 syncer::StringOrdinal extension3_app_launch = |
391 app_sorting->GetAppLaunchOrdinal(extension3()->id()); | 391 app_sorting->GetAppLaunchOrdinal(extension3()->id()); |
392 | 392 |
393 // The overlapping extensions should have be adjusted so that they are | 393 // The overlapping extensions should have be adjusted so that they are |
394 // sorted by their id, but they both should be before ext3, which wasn't | 394 // sorted by their id, but they both should be before ext3, which wasn't |
(...skipping 17 matching lines...) Expand all Loading... |
412 }; | 412 }; |
413 TEST_F(ChromeAppSortingFixNTPCollisionsSomeCollideAtStart, | 413 TEST_F(ChromeAppSortingFixNTPCollisionsSomeCollideAtStart, |
414 ChromeAppSortingFixNTPCollisionsSomeCollideAtStart) {} | 414 ChromeAppSortingFixNTPCollisionsSomeCollideAtStart) {} |
415 | 415 |
416 class ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd | 416 class ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd |
417 : public PrefsPrepopulatedTestBase { | 417 : public PrefsPrepopulatedTestBase { |
418 public: | 418 public: |
419 ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd() {} | 419 ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd() {} |
420 virtual ~ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd() {} | 420 virtual ~ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd() {} |
421 | 421 |
422 virtual void Initialize() OVERRIDE { | 422 virtual void Initialize() override { |
423 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); | 423 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); |
424 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); | 424 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); |
425 | 425 |
426 AppSorting* app_sorting = prefs()->app_sorting(); | 426 AppSorting* app_sorting = prefs()->app_sorting(); |
427 | 427 |
428 // Have the first extension in a non-colliding position, followed by two | 428 // Have the first extension in a non-colliding position, followed by two |
429 // two extension in the same position. | 429 // two extension in the same position. |
430 | 430 |
431 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); | 431 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); |
432 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); | 432 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); |
433 | 433 |
434 app_sorting->SetAppLaunchOrdinal(extension2()->id(), second_ordinal); | 434 app_sorting->SetAppLaunchOrdinal(extension2()->id(), second_ordinal); |
435 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); | 435 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); |
436 | 436 |
437 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); | 437 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); |
438 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); | 438 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); |
439 | 439 |
440 app_sorting->FixNTPOrdinalCollisions(); | 440 app_sorting->FixNTPOrdinalCollisions(); |
441 } | 441 } |
442 virtual void Verify() OVERRIDE { | 442 virtual void Verify() override { |
443 AppSorting* app_sorting = prefs()->app_sorting(); | 443 AppSorting* app_sorting = prefs()->app_sorting(); |
444 syncer::StringOrdinal extension1_app_launch = | 444 syncer::StringOrdinal extension1_app_launch = |
445 app_sorting->GetAppLaunchOrdinal(extension1()->id()); | 445 app_sorting->GetAppLaunchOrdinal(extension1()->id()); |
446 syncer::StringOrdinal extension2_app_launch = | 446 syncer::StringOrdinal extension2_app_launch = |
447 app_sorting->GetAppLaunchOrdinal(extension2()->id()); | 447 app_sorting->GetAppLaunchOrdinal(extension2()->id()); |
448 syncer::StringOrdinal extension3_app_launch = | 448 syncer::StringOrdinal extension3_app_launch = |
449 app_sorting->GetAppLaunchOrdinal(extension3()->id()); | 449 app_sorting->GetAppLaunchOrdinal(extension3()->id()); |
450 | 450 |
451 // The overlapping extensions should have be adjusted so that they are | 451 // The overlapping extensions should have be adjusted so that they are |
452 // sorted by their id, but they both should be after ext1, which wasn't | 452 // sorted by their id, but they both should be after ext1, which wasn't |
(...skipping 17 matching lines...) Expand all Loading... |
470 }; | 470 }; |
471 TEST_F(ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd, | 471 TEST_F(ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd, |
472 ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd) {} | 472 ChromeAppSortingFixNTPCollisionsSomeCollideAtEnd) {} |
473 | 473 |
474 class ChromeAppSortingFixNTPCollisionsTwoCollisions | 474 class ChromeAppSortingFixNTPCollisionsTwoCollisions |
475 : public PrefsPrepopulatedTestBase { | 475 : public PrefsPrepopulatedTestBase { |
476 public: | 476 public: |
477 ChromeAppSortingFixNTPCollisionsTwoCollisions() {} | 477 ChromeAppSortingFixNTPCollisionsTwoCollisions() {} |
478 virtual ~ChromeAppSortingFixNTPCollisionsTwoCollisions() {} | 478 virtual ~ChromeAppSortingFixNTPCollisionsTwoCollisions() {} |
479 | 479 |
480 virtual void Initialize() OVERRIDE { | 480 virtual void Initialize() override { |
481 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); | 481 first_ordinal_ = syncer::StringOrdinal::CreateInitialOrdinal(); |
482 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); | 482 syncer::StringOrdinal second_ordinal = first_ordinal_.CreateAfter(); |
483 | 483 |
484 AppSorting* app_sorting = prefs()->app_sorting(); | 484 AppSorting* app_sorting = prefs()->app_sorting(); |
485 | 485 |
486 // Have two extensions colliding, followed by two more colliding extensions. | 486 // Have two extensions colliding, followed by two more colliding extensions. |
487 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); | 487 app_sorting->SetAppLaunchOrdinal(extension1()->id(), first_ordinal_); |
488 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); | 488 app_sorting->SetPageOrdinal(extension1()->id(), first_ordinal_); |
489 | 489 |
490 app_sorting->SetAppLaunchOrdinal(extension2()->id(), first_ordinal_); | 490 app_sorting->SetAppLaunchOrdinal(extension2()->id(), first_ordinal_); |
491 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); | 491 app_sorting->SetPageOrdinal(extension2()->id(), first_ordinal_); |
492 | 492 |
493 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); | 493 app_sorting->SetAppLaunchOrdinal(extension3()->id(), second_ordinal); |
494 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); | 494 app_sorting->SetPageOrdinal(extension3()->id(), first_ordinal_); |
495 | 495 |
496 app_sorting->SetAppLaunchOrdinal(extension4()->id(), second_ordinal); | 496 app_sorting->SetAppLaunchOrdinal(extension4()->id(), second_ordinal); |
497 app_sorting->SetPageOrdinal(extension4()->id(), first_ordinal_); | 497 app_sorting->SetPageOrdinal(extension4()->id(), first_ordinal_); |
498 | 498 |
499 app_sorting->FixNTPOrdinalCollisions(); | 499 app_sorting->FixNTPOrdinalCollisions(); |
500 } | 500 } |
501 virtual void Verify() OVERRIDE { | 501 virtual void Verify() override { |
502 AppSorting* app_sorting = prefs()->app_sorting(); | 502 AppSorting* app_sorting = prefs()->app_sorting(); |
503 syncer::StringOrdinal extension1_app_launch = | 503 syncer::StringOrdinal extension1_app_launch = |
504 app_sorting->GetAppLaunchOrdinal(extension1()->id()); | 504 app_sorting->GetAppLaunchOrdinal(extension1()->id()); |
505 syncer::StringOrdinal extension2_app_launch = | 505 syncer::StringOrdinal extension2_app_launch = |
506 app_sorting->GetAppLaunchOrdinal(extension2()->id()); | 506 app_sorting->GetAppLaunchOrdinal(extension2()->id()); |
507 syncer::StringOrdinal extension3_app_launch = | 507 syncer::StringOrdinal extension3_app_launch = |
508 app_sorting->GetAppLaunchOrdinal(extension3()->id()); | 508 app_sorting->GetAppLaunchOrdinal(extension3()->id()); |
509 syncer::StringOrdinal extension4_app_launch = | 509 syncer::StringOrdinal extension4_app_launch = |
510 app_sorting->GetAppLaunchOrdinal(extension4()->id()); | 510 app_sorting->GetAppLaunchOrdinal(extension4()->id()); |
511 | 511 |
(...skipping 26 matching lines...) Expand all Loading... |
538 }; | 538 }; |
539 TEST_F(ChromeAppSortingFixNTPCollisionsTwoCollisions, | 539 TEST_F(ChromeAppSortingFixNTPCollisionsTwoCollisions, |
540 ChromeAppSortingFixNTPCollisionsTwoCollisions) {} | 540 ChromeAppSortingFixNTPCollisionsTwoCollisions) {} |
541 | 541 |
542 class ChromeAppSortingEnsureValidOrdinals | 542 class ChromeAppSortingEnsureValidOrdinals |
543 : public PrefsPrepopulatedTestBase { | 543 : public PrefsPrepopulatedTestBase { |
544 public : | 544 public : |
545 ChromeAppSortingEnsureValidOrdinals() {} | 545 ChromeAppSortingEnsureValidOrdinals() {} |
546 virtual ~ChromeAppSortingEnsureValidOrdinals() {} | 546 virtual ~ChromeAppSortingEnsureValidOrdinals() {} |
547 | 547 |
548 virtual void Initialize() OVERRIDE {} | 548 virtual void Initialize() override {} |
549 virtual void Verify() OVERRIDE { | 549 virtual void Verify() override { |
550 AppSorting* app_sorting = prefs()->app_sorting(); | 550 AppSorting* app_sorting = prefs()->app_sorting(); |
551 | 551 |
552 // Give ext1 invalid ordinals and then check that EnsureValidOrdinals fixes | 552 // Give ext1 invalid ordinals and then check that EnsureValidOrdinals fixes |
553 // them. | 553 // them. |
554 app_sorting->SetAppLaunchOrdinal(extension1()->id(), | 554 app_sorting->SetAppLaunchOrdinal(extension1()->id(), |
555 syncer::StringOrdinal()); | 555 syncer::StringOrdinal()); |
556 app_sorting->SetPageOrdinal(extension1()->id(), syncer::StringOrdinal()); | 556 app_sorting->SetPageOrdinal(extension1()->id(), syncer::StringOrdinal()); |
557 | 557 |
558 app_sorting->EnsureValidOrdinals(extension1()->id(), | 558 app_sorting->EnsureValidOrdinals(extension1()->id(), |
559 syncer::StringOrdinal()); | 559 syncer::StringOrdinal()); |
560 | 560 |
561 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(extension1()->id()).IsValid()); | 561 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(extension1()->id()).IsValid()); |
562 EXPECT_TRUE(app_sorting->GetPageOrdinal(extension1()->id()).IsValid()); | 562 EXPECT_TRUE(app_sorting->GetPageOrdinal(extension1()->id()).IsValid()); |
563 } | 563 } |
564 }; | 564 }; |
565 TEST_F(ChromeAppSortingEnsureValidOrdinals, | 565 TEST_F(ChromeAppSortingEnsureValidOrdinals, |
566 ChromeAppSortingEnsureValidOrdinals) {} | 566 ChromeAppSortingEnsureValidOrdinals) {} |
567 | 567 |
568 class ChromeAppSortingPageOrdinalMapping : public PrefsPrepopulatedTestBase { | 568 class ChromeAppSortingPageOrdinalMapping : public PrefsPrepopulatedTestBase { |
569 public: | 569 public: |
570 ChromeAppSortingPageOrdinalMapping() {} | 570 ChromeAppSortingPageOrdinalMapping() {} |
571 virtual ~ChromeAppSortingPageOrdinalMapping() {} | 571 virtual ~ChromeAppSortingPageOrdinalMapping() {} |
572 | 572 |
573 virtual void Initialize() OVERRIDE {} | 573 virtual void Initialize() override {} |
574 virtual void Verify() OVERRIDE { | 574 virtual void Verify() override { |
575 std::string ext_1 = "ext_1"; | 575 std::string ext_1 = "ext_1"; |
576 std::string ext_2 = "ext_2"; | 576 std::string ext_2 = "ext_2"; |
577 | 577 |
578 ChromeAppSorting* app_sorting = | 578 ChromeAppSorting* app_sorting = |
579 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 579 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
580 syncer::StringOrdinal first_ordinal = | 580 syncer::StringOrdinal first_ordinal = |
581 syncer::StringOrdinal::CreateInitialOrdinal(); | 581 syncer::StringOrdinal::CreateInitialOrdinal(); |
582 | 582 |
583 // Ensure attempting to removing a mapping with an invalid page doesn't | 583 // Ensure attempting to removing a mapping with an invalid page doesn't |
584 // modify the map. | 584 // modify the map. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 scoped_refptr<Extension> app1_scoped_; | 661 scoped_refptr<Extension> app1_scoped_; |
662 scoped_refptr<Extension> app2_scoped_; | 662 scoped_refptr<Extension> app2_scoped_; |
663 }; | 663 }; |
664 | 664 |
665 class ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage | 665 class ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage |
666 : public ChromeAppSortingPreinstalledAppsBase { | 666 : public ChromeAppSortingPreinstalledAppsBase { |
667 public: | 667 public: |
668 ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage() {} | 668 ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage() {} |
669 virtual ~ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage() {} | 669 virtual ~ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage() {} |
670 | 670 |
671 virtual void Initialize() OVERRIDE {} | 671 virtual void Initialize() override {} |
672 virtual void Verify() OVERRIDE { | 672 virtual void Verify() override { |
673 syncer::StringOrdinal page = syncer::StringOrdinal::CreateInitialOrdinal(); | 673 syncer::StringOrdinal page = syncer::StringOrdinal::CreateInitialOrdinal(); |
674 ChromeAppSorting* app_sorting = | 674 ChromeAppSorting* app_sorting = |
675 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 675 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
676 | 676 |
677 syncer::StringOrdinal min = | 677 syncer::StringOrdinal min = |
678 app_sorting->GetMinOrMaxAppLaunchOrdinalsOnPage( | 678 app_sorting->GetMinOrMaxAppLaunchOrdinalsOnPage( |
679 page, | 679 page, |
680 ChromeAppSorting::MIN_ORDINAL); | 680 ChromeAppSorting::MIN_ORDINAL); |
681 syncer::StringOrdinal max = | 681 syncer::StringOrdinal max = |
682 app_sorting->GetMinOrMaxAppLaunchOrdinalsOnPage( | 682 app_sorting->GetMinOrMaxAppLaunchOrdinalsOnPage( |
(...skipping 23 matching lines...) Expand all Loading... |
706 ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage) {} | 706 ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage) {} |
707 | 707 |
708 // Make sure that empty pages aren't removed from the integer to ordinal | 708 // Make sure that empty pages aren't removed from the integer to ordinal |
709 // mapping. See http://crbug.com/109802 for details. | 709 // mapping. See http://crbug.com/109802 for details. |
710 class ChromeAppSortingKeepEmptyStringOrdinalPages | 710 class ChromeAppSortingKeepEmptyStringOrdinalPages |
711 : public ChromeAppSortingPreinstalledAppsBase { | 711 : public ChromeAppSortingPreinstalledAppsBase { |
712 public: | 712 public: |
713 ChromeAppSortingKeepEmptyStringOrdinalPages() {} | 713 ChromeAppSortingKeepEmptyStringOrdinalPages() {} |
714 virtual ~ChromeAppSortingKeepEmptyStringOrdinalPages() {} | 714 virtual ~ChromeAppSortingKeepEmptyStringOrdinalPages() {} |
715 | 715 |
716 virtual void Initialize() OVERRIDE { | 716 virtual void Initialize() override { |
717 AppSorting* app_sorting = prefs()->app_sorting(); | 717 AppSorting* app_sorting = prefs()->app_sorting(); |
718 | 718 |
719 syncer::StringOrdinal first_page = | 719 syncer::StringOrdinal first_page = |
720 syncer::StringOrdinal::CreateInitialOrdinal(); | 720 syncer::StringOrdinal::CreateInitialOrdinal(); |
721 app_sorting->SetPageOrdinal(app1_->id(), first_page); | 721 app_sorting->SetPageOrdinal(app1_->id(), first_page); |
722 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); | 722 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); |
723 | 723 |
724 last_page_ = first_page.CreateAfter(); | 724 last_page_ = first_page.CreateAfter(); |
725 app_sorting->SetPageOrdinal(app2_->id(), last_page_); | 725 app_sorting->SetPageOrdinal(app2_->id(), last_page_); |
726 EXPECT_EQ(1, app_sorting->PageStringOrdinalAsInteger(last_page_)); | 726 EXPECT_EQ(1, app_sorting->PageStringOrdinalAsInteger(last_page_)); |
727 | 727 |
728 // Move the second app to create an empty page. | 728 // Move the second app to create an empty page. |
729 app_sorting->SetPageOrdinal(app2_->id(), first_page); | 729 app_sorting->SetPageOrdinal(app2_->id(), first_page); |
730 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); | 730 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); |
731 } | 731 } |
732 virtual void Verify() OVERRIDE { | 732 virtual void Verify() override { |
733 AppSorting* app_sorting = prefs()->app_sorting(); | 733 AppSorting* app_sorting = prefs()->app_sorting(); |
734 | 734 |
735 // Move the second app to a new empty page at the end, skipping over | 735 // Move the second app to a new empty page at the end, skipping over |
736 // the current empty page. | 736 // the current empty page. |
737 last_page_ = last_page_.CreateAfter(); | 737 last_page_ = last_page_.CreateAfter(); |
738 app_sorting->SetPageOrdinal(app2_->id(), last_page_); | 738 app_sorting->SetPageOrdinal(app2_->id(), last_page_); |
739 EXPECT_EQ(2, app_sorting->PageStringOrdinalAsInteger(last_page_)); | 739 EXPECT_EQ(2, app_sorting->PageStringOrdinalAsInteger(last_page_)); |
740 EXPECT_TRUE(last_page_.Equals(app_sorting->PageIntegerAsStringOrdinal(2))); | 740 EXPECT_TRUE(last_page_.Equals(app_sorting->PageIntegerAsStringOrdinal(2))); |
741 } | 741 } |
742 | 742 |
743 private: | 743 private: |
744 syncer::StringOrdinal last_page_; | 744 syncer::StringOrdinal last_page_; |
745 }; | 745 }; |
746 TEST_F(ChromeAppSortingKeepEmptyStringOrdinalPages, | 746 TEST_F(ChromeAppSortingKeepEmptyStringOrdinalPages, |
747 ChromeAppSortingKeepEmptyStringOrdinalPages) {} | 747 ChromeAppSortingKeepEmptyStringOrdinalPages) {} |
748 | 748 |
749 class ChromeAppSortingMakesFillerOrdinals | 749 class ChromeAppSortingMakesFillerOrdinals |
750 : public ChromeAppSortingPreinstalledAppsBase { | 750 : public ChromeAppSortingPreinstalledAppsBase { |
751 public: | 751 public: |
752 ChromeAppSortingMakesFillerOrdinals() {} | 752 ChromeAppSortingMakesFillerOrdinals() {} |
753 virtual ~ChromeAppSortingMakesFillerOrdinals() {} | 753 virtual ~ChromeAppSortingMakesFillerOrdinals() {} |
754 | 754 |
755 virtual void Initialize() OVERRIDE { | 755 virtual void Initialize() override { |
756 AppSorting* app_sorting = prefs()->app_sorting(); | 756 AppSorting* app_sorting = prefs()->app_sorting(); |
757 | 757 |
758 syncer::StringOrdinal first_page = | 758 syncer::StringOrdinal first_page = |
759 syncer::StringOrdinal::CreateInitialOrdinal(); | 759 syncer::StringOrdinal::CreateInitialOrdinal(); |
760 app_sorting->SetPageOrdinal(app1_->id(), first_page); | 760 app_sorting->SetPageOrdinal(app1_->id(), first_page); |
761 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); | 761 EXPECT_EQ(0, app_sorting->PageStringOrdinalAsInteger(first_page)); |
762 } | 762 } |
763 virtual void Verify() OVERRIDE { | 763 virtual void Verify() override { |
764 AppSorting* app_sorting = prefs()->app_sorting(); | 764 AppSorting* app_sorting = prefs()->app_sorting(); |
765 | 765 |
766 // Because the UI can add an unlimited number of empty pages without an app | 766 // Because the UI can add an unlimited number of empty pages without an app |
767 // on them, this test simulates dropping of an app on the 1st and 4th empty | 767 // on them, this test simulates dropping of an app on the 1st and 4th empty |
768 // pages (3rd and 6th pages by index) to ensure we don't crash and that | 768 // pages (3rd and 6th pages by index) to ensure we don't crash and that |
769 // filler ordinals are created as needed. See: http://crbug.com/122214 | 769 // filler ordinals are created as needed. See: http://crbug.com/122214 |
770 syncer::StringOrdinal page_three = | 770 syncer::StringOrdinal page_three = |
771 app_sorting->PageIntegerAsStringOrdinal(2); | 771 app_sorting->PageIntegerAsStringOrdinal(2); |
772 app_sorting->SetPageOrdinal(app1_->id(), page_three); | 772 app_sorting->SetPageOrdinal(app1_->id(), page_three); |
773 EXPECT_EQ(2, app_sorting->PageStringOrdinalAsInteger(page_three)); | 773 EXPECT_EQ(2, app_sorting->PageStringOrdinalAsInteger(page_three)); |
774 | 774 |
775 syncer::StringOrdinal page_six = app_sorting->PageIntegerAsStringOrdinal(5); | 775 syncer::StringOrdinal page_six = app_sorting->PageIntegerAsStringOrdinal(5); |
776 app_sorting->SetPageOrdinal(app1_->id(), page_six); | 776 app_sorting->SetPageOrdinal(app1_->id(), page_six); |
777 EXPECT_EQ(5, app_sorting->PageStringOrdinalAsInteger(page_six)); | 777 EXPECT_EQ(5, app_sorting->PageStringOrdinalAsInteger(page_six)); |
778 } | 778 } |
779 }; | 779 }; |
780 TEST_F(ChromeAppSortingMakesFillerOrdinals, | 780 TEST_F(ChromeAppSortingMakesFillerOrdinals, |
781 ChromeAppSortingMakesFillerOrdinals) {} | 781 ChromeAppSortingMakesFillerOrdinals) {} |
782 | 782 |
783 class ChromeAppSortingDefaultOrdinalsBase : public ChromeAppSortingTest { | 783 class ChromeAppSortingDefaultOrdinalsBase : public ChromeAppSortingTest { |
784 public: | 784 public: |
785 ChromeAppSortingDefaultOrdinalsBase() {} | 785 ChromeAppSortingDefaultOrdinalsBase() {} |
786 virtual ~ChromeAppSortingDefaultOrdinalsBase() {} | 786 virtual ~ChromeAppSortingDefaultOrdinalsBase() {} |
787 | 787 |
788 virtual void Initialize() OVERRIDE { | 788 virtual void Initialize() override { |
789 app_ = CreateApp("app"); | 789 app_ = CreateApp("app"); |
790 | 790 |
791 InitDefaultOrdinals(); | 791 InitDefaultOrdinals(); |
792 ChromeAppSorting* app_sorting = | 792 ChromeAppSorting* app_sorting = |
793 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 793 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
794 ChromeAppSorting::AppOrdinalsMap& sorting_defaults = | 794 ChromeAppSorting::AppOrdinalsMap& sorting_defaults = |
795 app_sorting->default_ordinals_; | 795 app_sorting->default_ordinals_; |
796 sorting_defaults[app_->id()].page_ordinal = default_page_ordinal_; | 796 sorting_defaults[app_->id()].page_ordinal = default_page_ordinal_; |
797 sorting_defaults[app_->id()].app_launch_ordinal = | 797 sorting_defaults[app_->id()].app_launch_ordinal = |
798 default_app_launch_ordinal_; | 798 default_app_launch_ordinal_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 syncer::StringOrdinal default_app_launch_ordinal_; | 839 syncer::StringOrdinal default_app_launch_ordinal_; |
840 }; | 840 }; |
841 | 841 |
842 // Tests that the app gets its default ordinals. | 842 // Tests that the app gets its default ordinals. |
843 class ChromeAppSortingDefaultOrdinals | 843 class ChromeAppSortingDefaultOrdinals |
844 : public ChromeAppSortingDefaultOrdinalsBase { | 844 : public ChromeAppSortingDefaultOrdinalsBase { |
845 public: | 845 public: |
846 ChromeAppSortingDefaultOrdinals() {} | 846 ChromeAppSortingDefaultOrdinals() {} |
847 virtual ~ChromeAppSortingDefaultOrdinals() {} | 847 virtual ~ChromeAppSortingDefaultOrdinals() {} |
848 | 848 |
849 virtual void Verify() OVERRIDE { | 849 virtual void Verify() override { |
850 AppSorting* app_sorting = prefs()->app_sorting(); | 850 AppSorting* app_sorting = prefs()->app_sorting(); |
851 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( | 851 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( |
852 default_page_ordinal_)); | 852 default_page_ordinal_)); |
853 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( | 853 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( |
854 default_app_launch_ordinal_)); | 854 default_app_launch_ordinal_)); |
855 } | 855 } |
856 }; | 856 }; |
857 TEST_F(ChromeAppSortingDefaultOrdinals, | 857 TEST_F(ChromeAppSortingDefaultOrdinals, |
858 ChromeAppSortingDefaultOrdinals) {} | 858 ChromeAppSortingDefaultOrdinals) {} |
859 | 859 |
860 // Tests that the default page ordinal is overridden by install page ordinal. | 860 // Tests that the default page ordinal is overridden by install page ordinal. |
861 class ChromeAppSortingDefaultOrdinalOverriddenByInstallPage | 861 class ChromeAppSortingDefaultOrdinalOverriddenByInstallPage |
862 : public ChromeAppSortingDefaultOrdinalsBase { | 862 : public ChromeAppSortingDefaultOrdinalsBase { |
863 public: | 863 public: |
864 ChromeAppSortingDefaultOrdinalOverriddenByInstallPage() {} | 864 ChromeAppSortingDefaultOrdinalOverriddenByInstallPage() {} |
865 virtual ~ChromeAppSortingDefaultOrdinalOverriddenByInstallPage() {} | 865 virtual ~ChromeAppSortingDefaultOrdinalOverriddenByInstallPage() {} |
866 | 866 |
867 virtual void Verify() OVERRIDE { | 867 virtual void Verify() override { |
868 AppSorting* app_sorting = prefs()->app_sorting(); | 868 AppSorting* app_sorting = prefs()->app_sorting(); |
869 | 869 |
870 EXPECT_FALSE(app_sorting->GetPageOrdinal(app_->id()).Equals( | 870 EXPECT_FALSE(app_sorting->GetPageOrdinal(app_->id()).Equals( |
871 default_page_ordinal_)); | 871 default_page_ordinal_)); |
872 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals(install_page_)); | 872 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals(install_page_)); |
873 } | 873 } |
874 | 874 |
875 protected: | 875 protected: |
876 virtual void InstallApps() OVERRIDE { | 876 virtual void InstallApps() override { |
877 install_page_ = default_page_ordinal_.CreateAfter(); | 877 install_page_ = default_page_ordinal_.CreateAfter(); |
878 prefs()->OnExtensionInstalled(app_.get(), | 878 prefs()->OnExtensionInstalled(app_.get(), |
879 Extension::ENABLED, | 879 Extension::ENABLED, |
880 install_page_, | 880 install_page_, |
881 std::string()); | 881 std::string()); |
882 } | 882 } |
883 | 883 |
884 private: | 884 private: |
885 syncer::StringOrdinal install_page_; | 885 syncer::StringOrdinal install_page_; |
886 }; | 886 }; |
887 TEST_F(ChromeAppSortingDefaultOrdinalOverriddenByInstallPage, | 887 TEST_F(ChromeAppSortingDefaultOrdinalOverriddenByInstallPage, |
888 ChromeAppSortingDefaultOrdinalOverriddenByInstallPage) {} | 888 ChromeAppSortingDefaultOrdinalOverriddenByInstallPage) {} |
889 | 889 |
890 // Tests that the default ordinals are overridden by user values. | 890 // Tests that the default ordinals are overridden by user values. |
891 class ChromeAppSortingDefaultOrdinalOverriddenByUserValue | 891 class ChromeAppSortingDefaultOrdinalOverriddenByUserValue |
892 : public ChromeAppSortingDefaultOrdinalsBase { | 892 : public ChromeAppSortingDefaultOrdinalsBase { |
893 public: | 893 public: |
894 ChromeAppSortingDefaultOrdinalOverriddenByUserValue() {} | 894 ChromeAppSortingDefaultOrdinalOverriddenByUserValue() {} |
895 virtual ~ChromeAppSortingDefaultOrdinalOverriddenByUserValue() {} | 895 virtual ~ChromeAppSortingDefaultOrdinalOverriddenByUserValue() {} |
896 | 896 |
897 virtual void Verify() OVERRIDE { | 897 virtual void Verify() override { |
898 AppSorting* app_sorting = prefs()->app_sorting(); | 898 AppSorting* app_sorting = prefs()->app_sorting(); |
899 | 899 |
900 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( | 900 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( |
901 user_page_ordinal_)); | 901 user_page_ordinal_)); |
902 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( | 902 EXPECT_TRUE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( |
903 user_app_launch_ordinal_)); | 903 user_app_launch_ordinal_)); |
904 } | 904 } |
905 | 905 |
906 protected: | 906 protected: |
907 virtual void SetupUserOrdinals() OVERRIDE { | 907 virtual void SetupUserOrdinals() override { |
908 user_page_ordinal_ = default_page_ordinal_.CreateAfter(); | 908 user_page_ordinal_ = default_page_ordinal_.CreateAfter(); |
909 user_app_launch_ordinal_ = default_app_launch_ordinal_.CreateBefore(); | 909 user_app_launch_ordinal_ = default_app_launch_ordinal_.CreateBefore(); |
910 | 910 |
911 AppSorting* app_sorting = prefs()->app_sorting(); | 911 AppSorting* app_sorting = prefs()->app_sorting(); |
912 app_sorting->SetPageOrdinal(app_->id(), user_page_ordinal_); | 912 app_sorting->SetPageOrdinal(app_->id(), user_page_ordinal_); |
913 app_sorting->SetAppLaunchOrdinal(app_->id(), user_app_launch_ordinal_); | 913 app_sorting->SetAppLaunchOrdinal(app_->id(), user_app_launch_ordinal_); |
914 } | 914 } |
915 | 915 |
916 private: | 916 private: |
917 syncer::StringOrdinal user_page_ordinal_; | 917 syncer::StringOrdinal user_page_ordinal_; |
918 syncer::StringOrdinal user_app_launch_ordinal_; | 918 syncer::StringOrdinal user_app_launch_ordinal_; |
919 }; | 919 }; |
920 TEST_F(ChromeAppSortingDefaultOrdinalOverriddenByUserValue, | 920 TEST_F(ChromeAppSortingDefaultOrdinalOverriddenByUserValue, |
921 ChromeAppSortingDefaultOrdinalOverriddenByUserValue) {} | 921 ChromeAppSortingDefaultOrdinalOverriddenByUserValue) {} |
922 | 922 |
923 // Tests that the default app launch ordinal is changed to avoid collision. | 923 // Tests that the default app launch ordinal is changed to avoid collision. |
924 class ChromeAppSortingDefaultOrdinalNoCollision | 924 class ChromeAppSortingDefaultOrdinalNoCollision |
925 : public ChromeAppSortingDefaultOrdinalsBase { | 925 : public ChromeAppSortingDefaultOrdinalsBase { |
926 public: | 926 public: |
927 ChromeAppSortingDefaultOrdinalNoCollision() {} | 927 ChromeAppSortingDefaultOrdinalNoCollision() {} |
928 virtual ~ChromeAppSortingDefaultOrdinalNoCollision() {} | 928 virtual ~ChromeAppSortingDefaultOrdinalNoCollision() {} |
929 | 929 |
930 virtual void Verify() OVERRIDE { | 930 virtual void Verify() override { |
931 AppSorting* app_sorting = prefs()->app_sorting(); | 931 AppSorting* app_sorting = prefs()->app_sorting(); |
932 | 932 |
933 // Use the default page. | 933 // Use the default page. |
934 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( | 934 EXPECT_TRUE(app_sorting->GetPageOrdinal(app_->id()).Equals( |
935 default_page_ordinal_)); | 935 default_page_ordinal_)); |
936 // Not using the default app launch ordinal because of the collision. | 936 // Not using the default app launch ordinal because of the collision. |
937 EXPECT_FALSE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( | 937 EXPECT_FALSE(app_sorting->GetAppLaunchOrdinal(app_->id()).Equals( |
938 default_app_launch_ordinal_)); | 938 default_app_launch_ordinal_)); |
939 } | 939 } |
940 | 940 |
941 protected: | 941 protected: |
942 virtual void SetupUserOrdinals() OVERRIDE { | 942 virtual void SetupUserOrdinals() override { |
943 other_app_ = prefs_.AddApp("other_app"); | 943 other_app_ = prefs_.AddApp("other_app"); |
944 // Creates a collision. | 944 // Creates a collision. |
945 AppSorting* app_sorting = prefs()->app_sorting(); | 945 AppSorting* app_sorting = prefs()->app_sorting(); |
946 app_sorting->SetPageOrdinal(other_app_->id(), default_page_ordinal_); | 946 app_sorting->SetPageOrdinal(other_app_->id(), default_page_ordinal_); |
947 app_sorting->SetAppLaunchOrdinal(other_app_->id(), | 947 app_sorting->SetAppLaunchOrdinal(other_app_->id(), |
948 default_app_launch_ordinal_); | 948 default_app_launch_ordinal_); |
949 | 949 |
950 yet_another_app_ = prefs_.AddApp("yet_aother_app"); | 950 yet_another_app_ = prefs_.AddApp("yet_aother_app"); |
951 app_sorting->SetPageOrdinal(yet_another_app_->id(), default_page_ordinal_); | 951 app_sorting->SetPageOrdinal(yet_another_app_->id(), default_page_ordinal_); |
952 app_sorting->SetAppLaunchOrdinal(yet_another_app_->id(), | 952 app_sorting->SetAppLaunchOrdinal(yet_another_app_->id(), |
953 default_app_launch_ordinal_); | 953 default_app_launch_ordinal_); |
954 } | 954 } |
955 | 955 |
956 private: | 956 private: |
957 scoped_refptr<Extension> other_app_; | 957 scoped_refptr<Extension> other_app_; |
958 scoped_refptr<Extension> yet_another_app_; | 958 scoped_refptr<Extension> yet_another_app_; |
959 }; | 959 }; |
960 TEST_F(ChromeAppSortingDefaultOrdinalNoCollision, | 960 TEST_F(ChromeAppSortingDefaultOrdinalNoCollision, |
961 ChromeAppSortingDefaultOrdinalNoCollision) {} | 961 ChromeAppSortingDefaultOrdinalNoCollision) {} |
962 | 962 |
963 // Tests that SetExtensionVisible() correctly hides and unhides extensions. | 963 // Tests that SetExtensionVisible() correctly hides and unhides extensions. |
964 class ChromeAppSortingSetExtensionVisible : public ChromeAppSortingTest { | 964 class ChromeAppSortingSetExtensionVisible : public ChromeAppSortingTest { |
965 public: | 965 public: |
966 ChromeAppSortingSetExtensionVisible() {} | 966 ChromeAppSortingSetExtensionVisible() {} |
967 virtual ~ChromeAppSortingSetExtensionVisible() {} | 967 virtual ~ChromeAppSortingSetExtensionVisible() {} |
968 | 968 |
969 virtual void Initialize() OVERRIDE { | 969 virtual void Initialize() override { |
970 first_app_ = prefs_.AddApp("first_app"); | 970 first_app_ = prefs_.AddApp("first_app"); |
971 second_app_ = prefs_.AddApp("second_app"); | 971 second_app_ = prefs_.AddApp("second_app"); |
972 } | 972 } |
973 | 973 |
974 virtual void Verify() OVERRIDE { | 974 virtual void Verify() override { |
975 ChromeAppSorting* sorting = app_sorting(); | 975 ChromeAppSorting* sorting = app_sorting(); |
976 syncer::StringOrdinal page1 = sorting->GetPageOrdinal(first_app_->id()); | 976 syncer::StringOrdinal page1 = sorting->GetPageOrdinal(first_app_->id()); |
977 syncer::StringOrdinal page2 = sorting->GetPageOrdinal(second_app_->id()); | 977 syncer::StringOrdinal page2 = sorting->GetPageOrdinal(second_app_->id()); |
978 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(first_app_->id()).IsValid()); | 978 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(first_app_->id()).IsValid()); |
979 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(second_app_->id()).IsValid()); | 979 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(second_app_->id()).IsValid()); |
980 EXPECT_TRUE(page1.IsValid()); | 980 EXPECT_TRUE(page1.IsValid()); |
981 EXPECT_TRUE(page2.IsValid()); | 981 EXPECT_TRUE(page2.IsValid()); |
982 EXPECT_TRUE(page1.Equals(page2)); | 982 EXPECT_TRUE(page1.Equals(page2)); |
983 | 983 |
984 sorting->SetExtensionVisible(first_app_->id(), false); | 984 sorting->SetExtensionVisible(first_app_->id(), false); |
985 EXPECT_EQ( | 985 EXPECT_EQ( |
986 1U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1])); | 986 1U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1])); |
987 | 987 |
988 sorting->SetExtensionVisible(first_app_->id(), true); | 988 sorting->SetExtensionVisible(first_app_->id(), true); |
989 EXPECT_EQ( | 989 EXPECT_EQ( |
990 2U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1])); | 990 2U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1])); |
991 } | 991 } |
992 | 992 |
993 private: | 993 private: |
994 scoped_refptr<Extension> first_app_; | 994 scoped_refptr<Extension> first_app_; |
995 scoped_refptr<Extension> second_app_; | 995 scoped_refptr<Extension> second_app_; |
996 }; | 996 }; |
997 TEST_F(ChromeAppSortingSetExtensionVisible, | 997 TEST_F(ChromeAppSortingSetExtensionVisible, |
998 ChromeAppSortingSetExtensionVisible) { | 998 ChromeAppSortingSetExtensionVisible) { |
999 } | 999 } |
1000 | 1000 |
1001 } // namespace extensions | 1001 } // namespace extensions |
OLD | NEW |