| 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_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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 274 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
| 275 items.push_back( | 275 items.push_back( |
| 276 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 276 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
| 277 return items; | 277 return items; |
| 278 } | 278 } |
| 279 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { | 279 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { |
| 280 return NULL; | 280 return NULL; |
| 281 } | 281 } |
| 282 bool IsDraggable() override { return false; } | 282 bool IsDraggable() override { return false; } |
| 283 bool CanPin() const override { | 283 bool CanPin() const override { |
| 284 return launcher_controller()->GetPinnable(app_id()) == | 284 return chrome::util::GetPinnable(launcher_controller()->GetProfile(), |
| 285 app_id()) == |
| 285 AppListControllerDelegate::PIN_EDITABLE; | 286 AppListControllerDelegate::PIN_EDITABLE; |
| 286 } | 287 } |
| 287 bool ShouldShowTooltip() override { return false; } | 288 bool ShouldShowTooltip() override { return false; } |
| 288 | 289 |
| 289 private: | 290 private: |
| 290 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); | 291 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); |
| 291 }; | 292 }; |
| 292 | 293 |
| 293 } // namespace | 294 } // namespace |
| 294 | 295 |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 // 2 is not pinned as it's not installed | 1304 // 2 is not pinned as it's not installed |
| 1304 EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); | 1305 EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
| 1305 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); | 1306 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); |
| 1306 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension4_->id())); | 1307 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension4_->id())); |
| 1307 // install extension 2 and check | 1308 // install extension 2 and check |
| 1308 extension_service_->AddExtension(extension2_.get()); | 1309 extension_service_->AddExtension(extension2_.get()); |
| 1309 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); | 1310 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); |
| 1310 | 1311 |
| 1311 // Check user can manually pin or unpin these apps | 1312 // Check user can manually pin or unpin these apps |
| 1312 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, | 1313 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, |
| 1313 launcher_controller_->GetPinnable(extension1_->id())); | 1314 chrome::util::GetPinnable(launcher_controller->Getprofile(), |
| 1315 extension1_->id())); |
| 1314 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 1316 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 1315 launcher_controller_->GetPinnable(extension2_->id())); | 1317 chrome::util::GetPinnable(launcher_controller->Getprofile(), |
| 1318 extension1_->id())); |
| 1316 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, | 1319 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, |
| 1317 launcher_controller_->GetPinnable(extension3_->id())); | 1320 chrome::util::GetPinnable(launcher_controller->Getprofile(), |
| 1321 extension1_->id())); |
| 1318 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 1322 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 1319 launcher_controller_->GetPinnable(extension4_->id())); | 1323 chrome::util::GetPinnable(launcher_controller->Getprofile(), |
| 1324 extension1_->id())); |
| 1320 | 1325 |
| 1321 // Check the order of shelf pinned apps | 1326 // Check the order of shelf pinned apps |
| 1322 EXPECT_EQ("AppList, App2, App4, App1, Chrome, App3", GetPinnedAppStatus()); | 1327 EXPECT_EQ("AppList, App2, App4, App1, Chrome, App3", GetPinnedAppStatus()); |
| 1323 } | 1328 } |
| 1324 | 1329 |
| 1325 // Check that the restauration of launcher items is happening in the same order | 1330 // Check that the restauration of launcher items is happening in the same order |
| 1326 // as the user has pinned them (on another system) when they are synced reverse | 1331 // as the user has pinned them (on another system) when they are synced reverse |
| 1327 // order. | 1332 // order. |
| 1328 TEST_F(ChromeLauncherControllerImplTest, RestoreDefaultAppsReverseOrder) { | 1333 TEST_F(ChromeLauncherControllerImplTest, RestoreDefaultAppsReverseOrder) { |
| 1329 InitLauncherController(); | 1334 InitLauncherController(); |
| (...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3347 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app | 3352 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app |
| 3348 // package_name (not hash) specified as id. In this test we check that | 3353 // package_name (not hash) specified as id. In this test we check that |
| 3349 // by hash we can determine that appropriate package was set by policy. | 3354 // by hash we can determine that appropriate package was set by policy. |
| 3350 base::ListValue policy_value; | 3355 base::ListValue policy_value; |
| 3351 InsertPrefValue(&policy_value, 0, appinfo.package_name); | 3356 InsertPrefValue(&policy_value, 0, appinfo.package_name); |
| 3352 profile()->GetTestingPrefService()->SetManagedPref( | 3357 profile()->GetTestingPrefService()->SetManagedPref( |
| 3353 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); | 3358 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); |
| 3354 | 3359 |
| 3355 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); | 3360 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); |
| 3356 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 3361 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 3357 launcher_controller_->GetPinnable(app_id)); | 3362 chrome::util::GetPinnable(launcher_controller->Getprofile(), |
| 3363 extension1_->id())); |
| 3358 } | 3364 } |
| OLD | NEW |