| 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 4153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4164 std::string window_app_id("org.chromium.arc.1"); | 4164 std::string window_app_id("org.chromium.arc.1"); |
| 4165 CreateArcWindow(window_app_id); | 4165 CreateArcWindow(window_app_id); |
| 4166 arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_default_apps()[0], | 4166 arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_default_apps()[0], |
| 4167 std::string()); | 4167 std::string()); |
| 4168 | 4168 |
| 4169 EXPECT_NE(ash::kInvalidShelfID, | 4169 EXPECT_NE(ash::kInvalidShelfID, |
| 4170 launcher_controller_->GetShelfIDForAppID(app_id)); | 4170 launcher_controller_->GetShelfIDForAppID(app_id)); |
| 4171 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); | 4171 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
| 4172 } | 4172 } |
| 4173 | 4173 |
| 4174 TEST_P(ChromeLauncherControllerArcDefaultAppsTest, PlayStoreDeferredLaunch) { |
| 4175 // Add ARC host app to enable Play Store default app. |
| 4176 extension_service_->AddExtension(arc_support_host_.get()); |
| 4177 arc_test_.SetUp(profile()); |
| 4178 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); |
| 4179 EXPECT_TRUE(prefs->IsRegistered(arc::kPlayStoreAppId)); |
| 4180 |
| 4181 InitLauncherController(); |
| 4182 |
| 4183 EnablePlayStore(true); |
| 4184 |
| 4185 // Pin Play Store. It should be pinned but not scheduled for deferred launch. |
| 4186 launcher_controller_->PinAppWithID(arc::kPlayStoreAppId); |
| 4187 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); |
| 4188 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp( |
| 4189 arc::kPlayStoreAppId)); |
| 4190 |
| 4191 // Simulate click. This should schedule Play Store for deferred launch. |
| 4192 LauncherItemController* item_controller = |
| 4193 launcher_controller_->GetLauncherItemController( |
| 4194 launcher_controller_->GetShelfIDForAppID(arc::kPlayStoreAppId)); |
| 4195 EXPECT_TRUE(item_controller); |
| 4196 SelectItem(item_controller); |
| 4197 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); |
| 4198 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp( |
| 4199 arc::kPlayStoreAppId)); |
| 4200 } |
| 4201 |
| 4174 // Checks the case when several app items have the same ordinal position (which | 4202 // Checks the case when several app items have the same ordinal position (which |
| 4175 // is valid case). | 4203 // is valid case). |
| 4176 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) { | 4204 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) { |
| 4177 InitLauncherController(); | 4205 InitLauncherController(); |
| 4178 | 4206 |
| 4179 extension_service_->AddExtension(extension1_.get()); | 4207 extension_service_->AddExtension(extension1_.get()); |
| 4180 extension_service_->AddExtension(extension2_.get()); | 4208 extension_service_->AddExtension(extension2_.get()); |
| 4181 extension_service_->AddExtension(extension3_.get()); | 4209 extension_service_->AddExtension(extension3_.get()); |
| 4182 | 4210 |
| 4183 syncer::SyncChangeList sync_list; | 4211 syncer::SyncChangeList sync_list; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4395 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 4423 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4396 shelf_controller->auto_hide()); | 4424 shelf_controller->auto_hide()); |
| 4397 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4425 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4398 | 4426 |
| 4399 PrefService* prefs = profile()->GetTestingPrefService(); | 4427 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4400 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4428 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4401 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4429 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4402 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4430 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4403 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4431 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4404 } | 4432 } |
| OLD | NEW |