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/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 base::ListValue policy_value1; | 1749 base::ListValue policy_value1; |
1750 InsertPrefValue(&policy_value1, 0, extension3_->id()); | 1750 InsertPrefValue(&policy_value1, 0, extension3_->id()); |
1751 InsertPrefValue(&policy_value1, 1, extension2_->id()); | 1751 InsertPrefValue(&policy_value1, 1, extension2_->id()); |
1752 InsertPrefValue(&policy_value1, 2, extension1_->id()); | 1752 InsertPrefValue(&policy_value1, 2, extension1_->id()); |
1753 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, | 1753 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
1754 policy_value1.DeepCopy()); | 1754 policy_value1.DeepCopy()); |
1755 EXPECT_EQ("AppList, Chrome, App3, App2, App1, ", GetPinnedAppStatus()); | 1755 EXPECT_EQ("AppList, Chrome, App3, App2, App1, ", GetPinnedAppStatus()); |
1756 | 1756 |
1757 // Going back to a status where there is no requirement for app 2 to be pinned | 1757 // Going back to a status where there is no requirement for app 2 to be pinned |
1758 // should convert it back to locked but not pinned and state. The position | 1758 // should convert it back to locked but not pinned and state. The position |
1759 // is determined by the |ShelfModel|'s weight system. Since at the moment | 1759 // is determined by the |ShelfModel|'s weight system and since running |
1760 // the weight of a running app has the same as a shortcut, it will remain | 1760 // applications are not allowed to be mixed with shortcuts, it should show up |
1761 // where it is. Surely note ideal, but since the sync process can shift around | 1761 // at the end of the list. |
1762 // locations - as well as many other edge cases - this gets nearly impossible | |
1763 // to get right. | |
1764 // TODO(skuhne): Filed crbug.com/293761 to track of this. | |
1765 base::ListValue policy_value2; | 1762 base::ListValue policy_value2; |
1766 InsertPrefValue(&policy_value2, 0, extension3_->id()); | 1763 InsertPrefValue(&policy_value2, 0, extension3_->id()); |
1767 InsertPrefValue(&policy_value2, 1, extension1_->id()); | 1764 InsertPrefValue(&policy_value2, 1, extension1_->id()); |
1768 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, | 1765 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
1769 policy_value2.DeepCopy()); | 1766 policy_value2.DeepCopy()); |
1770 EXPECT_EQ("AppList, Chrome, App3, app2, App1, ", GetPinnedAppStatus()); | 1767 EXPECT_EQ("AppList, Chrome, App3, App1, app2, ", GetPinnedAppStatus()); |
1771 | 1768 |
1772 // Removing an item should simply close it and everything should shift. | 1769 // Removing an item should simply close it and everything should shift. |
1773 base::ListValue policy_value3; | 1770 base::ListValue policy_value3; |
1774 InsertPrefValue(&policy_value3, 0, extension3_->id()); | 1771 InsertPrefValue(&policy_value3, 0, extension3_->id()); |
1775 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, | 1772 profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps, |
1776 policy_value3.DeepCopy()); | 1773 policy_value3.DeepCopy()); |
1777 EXPECT_EQ("AppList, Chrome, App3, app2, ", GetPinnedAppStatus()); | 1774 EXPECT_EQ("AppList, Chrome, App3, app2, ", GetPinnedAppStatus()); |
1778 } | 1775 } |
1779 | 1776 |
1780 // Check that a running and not pinned V2 application will be properly converted | 1777 // Check that a running and not pinned V2 application will be properly converted |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2739 | 2736 |
2740 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2737 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2741 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2738 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2742 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2739 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2743 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2740 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2744 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2741 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2745 | 2742 |
2746 launcher_controller_->UnpinAppWithID("1"); | 2743 launcher_controller_->UnpinAppWithID("1"); |
2747 ASSERT_EQ(initial_size, model_->items().size()); | 2744 ASSERT_EQ(initial_size, model_->items().size()); |
2748 } | 2745 } |
OLD | NEW |