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

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

Issue 397903002: Do not assign launch ordinals to ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ephemapp_unload_review
Patch Set: Changed implementation Created 6 years, 5 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 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"
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 default_app_launch_ordinal_); 952 default_app_launch_ordinal_);
953 } 953 }
954 954
955 private: 955 private:
956 scoped_refptr<Extension> other_app_; 956 scoped_refptr<Extension> other_app_;
957 scoped_refptr<Extension> yet_another_app_; 957 scoped_refptr<Extension> yet_another_app_;
958 }; 958 };
959 TEST_F(ChromeAppSortingDefaultOrdinalNoCollision, 959 TEST_F(ChromeAppSortingDefaultOrdinalNoCollision,
960 ChromeAppSortingDefaultOrdinalNoCollision) {} 960 ChromeAppSortingDefaultOrdinalNoCollision) {}
961 961
962 // Tests that SetExtensionVisible() correctly hides and unhides extensions.
963 class ChromeAppSortingSetExtensionVisible : public ChromeAppSortingTest {
964 public:
965 ChromeAppSortingSetExtensionVisible() {}
966 virtual ~ChromeAppSortingSetExtensionVisible() {}
967
968 virtual void Initialize() OVERRIDE {
969 first_app_ = prefs_.AddApp("first_app");
970 second_app_ = prefs_.AddApp("second_app");
971 }
972
973 virtual void Verify() OVERRIDE {
974 ChromeAppSorting* sorting = app_sorting();
975 syncer::StringOrdinal page1 = sorting->GetPageOrdinal(first_app_->id());
976 syncer::StringOrdinal page2 = sorting->GetPageOrdinal(second_app_->id());
977 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(first_app_->id()).IsValid());
978 EXPECT_TRUE(sorting->GetAppLaunchOrdinal(second_app_->id()).IsValid());
979 EXPECT_TRUE(page1.IsValid());
980 EXPECT_TRUE(page2.IsValid());
981 EXPECT_TRUE(page1.Equals(page2));
982
983 sorting->SetExtensionVisible(first_app_->id(), false);
984 EXPECT_EQ(
985 1U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1]));
986
987 sorting->SetExtensionVisible(first_app_->id(), true);
988 EXPECT_EQ(
989 2U, sorting->CountItemsVisibleOnNtp(sorting->ntp_ordinal_map_[page1]));
990 }
991
992 private:
993 scoped_refptr<Extension> first_app_;
994 scoped_refptr<Extension> second_app_;
995 };
996 TEST_F(ChromeAppSortingSetExtensionVisible,
997 ChromeAppSortingSetExtensionVisible) {
998 }
999
962 } // namespace extensions 1000 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698