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

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

Issue 2378353002: [Merge-M54] Fix crash on item drag in shelf. (Closed)
Patch Set: 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 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3909 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); 3909 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
3910 3910
3911 std::string window_app_id("org.chromium.arc.1"); 3911 std::string window_app_id("org.chromium.arc.1");
3912 CreateArcWindow(window_app_id); 3912 CreateArcWindow(window_app_id);
3913 arc_test_.app_instance()->SendTaskCreated(1, 3913 arc_test_.app_instance()->SendTaskCreated(1,
3914 arc_test_.fake_default_apps()[0]); 3914 arc_test_.fake_default_apps()[0]);
3915 3915
3916 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); 3916 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id));
3917 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); 3917 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
3918 } 3918 }
3919
3920 // Checks the case when several app items have the same ordinal position (which
3921 // is valid case).
3922 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) {
3923 InitLauncherController();
3924
3925 extension_service_->AddExtension(extension1_.get());
3926 extension_service_->AddExtension(extension2_.get());
3927 extension_service_->AddExtension(extension3_.get());
3928
3929 syncer::SyncChangeList sync_list;
3930 InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId);
3931 InsertAddPinChange(&sync_list, 1, extension1_->id());
3932 InsertAddPinChange(&sync_list, 1, extension2_->id());
3933 InsertAddPinChange(&sync_list, 1, extension3_->id());
3934 SendPinChanges(sync_list, true);
3935
3936 EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus());
3937
3938 const syncer::StringOrdinal position_chrome =
3939 app_service_->GetPinPosition(extension_misc::kChromeAppId);
3940 const syncer::StringOrdinal position_1 =
3941 app_service_->GetPinPosition(extension1_->id());
3942 const syncer::StringOrdinal position_2 =
3943 app_service_->GetPinPosition(extension2_->id());
3944 const syncer::StringOrdinal position_3 =
3945 app_service_->GetPinPosition(extension3_->id());
3946 EXPECT_TRUE(position_chrome.LessThan(position_1));
3947 EXPECT_TRUE(position_1.Equals(position_2));
3948 EXPECT_TRUE(position_2.Equals(position_3));
3949
3950 // Move Chrome between App1 and App2.
3951 // Note, move target_index is in context when moved element is removed from
3952 // array first.
3953 model_->Move(1, 2);
3954 EXPECT_EQ("AppList, App1, Chrome, App2, App3", GetPinnedAppStatus());
3955
3956 // Expect sync positions for only Chrome is updated and its resolution is
3957 // after all duplicated ordinals.
3958 EXPECT_TRUE(position_3.LessThan(
3959 app_service_->GetPinPosition(extension_misc::kChromeAppId)));
3960 EXPECT_TRUE(
3961 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
3962 EXPECT_TRUE(
3963 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
3964 EXPECT_TRUE(
3965 position_2.Equals(app_service_->GetPinPosition(extension2_->id())));
3966 EXPECT_TRUE(
3967 position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
3968 }
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