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 "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
Fady Samuel
2014/08/29 19:39:46
Is this still necessary?
Xi Han
2014/08/29 19:52:53
Removed.
| |
11 #include "components/crx_file/id_util.h" | 11 #include "components/crx_file/id_util.h" |
12 #include "extensions/common/constants.h" | |
12 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
13 #include "sync/api/string_ordinal.h" | 14 #include "sync/api/string_ordinal.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 namespace keys = manifest_keys; | 19 namespace keys = manifest_keys; |
19 | 20 |
20 class ChromeAppSortingTest : public ExtensionPrefsTest { | 21 class ChromeAppSortingTest : public ExtensionPrefsTest { |
21 protected: | 22 protected: |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 public: | 221 public: |
221 ChromeAppSortingInitializeWithNoApps() {} | 222 ChromeAppSortingInitializeWithNoApps() {} |
222 virtual ~ChromeAppSortingInitializeWithNoApps() {} | 223 virtual ~ChromeAppSortingInitializeWithNoApps() {} |
223 | 224 |
224 virtual void Initialize() OVERRIDE { | 225 virtual void Initialize() OVERRIDE { |
225 AppSorting* app_sorting = prefs()->app_sorting(); | 226 AppSorting* app_sorting = prefs()->app_sorting(); |
226 | 227 |
227 // Make sure that the web store has valid ordinals. | 228 // Make sure that the web store has valid ordinals. |
228 syncer::StringOrdinal initial_ordinal = | 229 syncer::StringOrdinal initial_ordinal = |
229 syncer::StringOrdinal::CreateInitialOrdinal(); | 230 syncer::StringOrdinal::CreateInitialOrdinal(); |
230 app_sorting->SetPageOrdinal(extension_misc::kWebStoreAppId, | 231 app_sorting->SetPageOrdinal(extensions::kWebStoreAppId, |
231 initial_ordinal); | 232 initial_ordinal); |
232 app_sorting->SetAppLaunchOrdinal(extension_misc::kWebStoreAppId, | 233 app_sorting->SetAppLaunchOrdinal(extensions::kWebStoreAppId, |
233 initial_ordinal); | 234 initial_ordinal); |
234 | 235 |
235 ExtensionIdList ids; | 236 ExtensionIdList ids; |
236 app_sorting->Initialize(ids); | 237 app_sorting->Initialize(ids); |
237 } | 238 } |
238 virtual void Verify() OVERRIDE { | 239 virtual void Verify() OVERRIDE { |
239 ChromeAppSorting* app_sorting = | 240 ChromeAppSorting* app_sorting = |
240 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); | 241 static_cast<ChromeAppSorting*>(prefs()->app_sorting()); |
241 | 242 |
242 syncer::StringOrdinal page = | 243 syncer::StringOrdinal page = |
243 app_sorting->GetPageOrdinal(extension_misc::kWebStoreAppId); | 244 app_sorting->GetPageOrdinal(extensions::kWebStoreAppId); |
244 EXPECT_TRUE(page.IsValid()); | 245 EXPECT_TRUE(page.IsValid()); |
245 | 246 |
246 ChromeAppSorting::PageOrdinalMap::iterator page_it = | 247 ChromeAppSorting::PageOrdinalMap::iterator page_it = |
247 app_sorting->ntp_ordinal_map_.find(page); | 248 app_sorting->ntp_ordinal_map_.find(page); |
248 EXPECT_TRUE(page_it != app_sorting->ntp_ordinal_map_.end()); | 249 EXPECT_TRUE(page_it != app_sorting->ntp_ordinal_map_.end()); |
249 | 250 |
250 syncer::StringOrdinal app_launch = | 251 syncer::StringOrdinal app_launch = |
251 app_sorting->GetPageOrdinal(extension_misc::kWebStoreAppId); | 252 app_sorting->GetPageOrdinal(extensions::kWebStoreAppId); |
252 EXPECT_TRUE(app_launch.IsValid()); | 253 EXPECT_TRUE(app_launch.IsValid()); |
253 | 254 |
254 ChromeAppSorting::AppLaunchOrdinalMap::iterator app_launch_it = | 255 ChromeAppSorting::AppLaunchOrdinalMap::iterator app_launch_it = |
255 page_it->second.find(app_launch); | 256 page_it->second.find(app_launch); |
256 EXPECT_TRUE(app_launch_it != page_it->second.end()); | 257 EXPECT_TRUE(app_launch_it != page_it->second.end()); |
257 } | 258 } |
258 }; | 259 }; |
259 TEST_F(ChromeAppSortingInitializeWithNoApps, | 260 TEST_F(ChromeAppSortingInitializeWithNoApps, |
260 ChromeAppSortingInitializeWithNoApps) {} | 261 ChromeAppSortingInitializeWithNoApps) {} |
261 | 262 |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
992 | 993 |
993 private: | 994 private: |
994 scoped_refptr<Extension> first_app_; | 995 scoped_refptr<Extension> first_app_; |
995 scoped_refptr<Extension> second_app_; | 996 scoped_refptr<Extension> second_app_; |
996 }; | 997 }; |
997 TEST_F(ChromeAppSortingSetExtensionVisible, | 998 TEST_F(ChromeAppSortingSetExtensionVisible, |
998 ChromeAppSortingSetExtensionVisible) { | 999 ChromeAppSortingSetExtensionVisible) { |
999 } | 1000 } |
1000 | 1001 |
1001 } // namespace extensions | 1002 } // namespace extensions |
OLD | NEW |