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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2366073002: Fix crash on item drag in shelf. (Closed)
Patch Set: Drop NOTREACHED Created 4 years, 2 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); 3907 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
3908 3908
3909 std::string window_app_id("org.chromium.arc.1"); 3909 std::string window_app_id("org.chromium.arc.1");
3910 CreateArcWindow(window_app_id); 3910 CreateArcWindow(window_app_id);
3911 arc_test_.app_instance()->SendTaskCreated(1, 3911 arc_test_.app_instance()->SendTaskCreated(1,
3912 arc_test_.fake_default_apps()[0]); 3912 arc_test_.fake_default_apps()[0]);
3913 3913
3914 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); 3914 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id));
3915 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); 3915 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
3916 } 3916 }
3917
3918 // Checks the case when several app items have the same ordinal position (which
3919 // is valid case).
3920 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) {
3921 InitLauncherController();
3922
3923 extension_service_->AddExtension(extension1_.get());
3924 extension_service_->AddExtension(extension2_.get());
3925 extension_service_->AddExtension(extension3_.get());
3926
3927 syncer::SyncChangeList sync_list;
3928 InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId);
3929 InsertAddPinChange(&sync_list, 1, extension1_->id());
3930 InsertAddPinChange(&sync_list, 1, extension2_->id());
3931 InsertAddPinChange(&sync_list, 1, extension3_->id());
3932 SendPinChanges(sync_list, true);
3933
3934 EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus());
3935
3936 const syncer::StringOrdinal position_chrome =
3937 app_service_->GetPinPosition(extension_misc::kChromeAppId);
3938 const syncer::StringOrdinal position_1 =
3939 app_service_->GetPinPosition(extension1_->id());
3940 const syncer::StringOrdinal position_2 =
3941 app_service_->GetPinPosition(extension2_->id());
3942 const syncer::StringOrdinal position_3 =
3943 app_service_->GetPinPosition(extension3_->id());
3944 EXPECT_TRUE(position_chrome.LessThan(position_1));
3945 EXPECT_TRUE(position_1.Equals(position_2));
3946 EXPECT_TRUE(position_2.Equals(position_3));
3947
3948 // Move Chrome between App1 and App2.
3949 // Note, move target_index is in context when moved element is removed from
3950 // array first.
3951 model_->Move(1, 2);
3952 EXPECT_EQ("AppList, App1, Chrome, App2, App3", GetPinnedAppStatus());
3953
3954 // Expect sync positions for only Chrome is updated and its resolution is
3955 // after all duplicated ordinals.
3956 EXPECT_TRUE(position_3.LessThan(
3957 app_service_->GetPinPosition(extension_misc::kChromeAppId)));
3958 EXPECT_TRUE(
3959 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
3960 EXPECT_TRUE(
3961 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
3962 EXPECT_TRUE(
3963 position_2.Equals(app_service_->GetPinPosition(extension2_->id())));
3964 EXPECT_TRUE(
3965 position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
3966 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698