Chromium Code Reviews| 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 ChromeLauncherController::set_instance_for_test(launcher_controller_.get()); | |
|
msw
2017/04/04 01:42:05
This is not necessary
khmel
2017/04/04 16:52:26
Done.
| |
| 4183 | |
| 4184 EnablePlayStore(true); | |
| 4185 | |
| 4186 // Pin Play Store. It should be pinned but not registered for deferred launch. | |
| 4187 launcher_controller_->PinAppWithID(arc::kPlayStoreAppId); | |
| 4188 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); | |
| 4189 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp( | |
| 4190 arc::kPlayStoreAppId)); | |
| 4191 | |
| 4192 // Simulate click. This should register deferred controller. | |
|
msw
2017/04/04 01:42:05
nit: explain what deferred controller you mean mor
khmel
2017/04/04 16:52:26
Done.
| |
| 4193 LauncherItemController* item_controller = | |
| 4194 launcher_controller_->GetLauncherItemController( | |
| 4195 launcher_controller_->GetShelfIDForAppID(arc::kPlayStoreAppId)); | |
| 4196 EXPECT_TRUE(item_controller); | |
| 4197 SelectItem(item_controller); | |
| 4198 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc::kPlayStoreAppId)); | |
| 4199 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp( | |
| 4200 arc::kPlayStoreAppId)); | |
| 4201 } | |
| 4202 | |
| 4174 // Checks the case when several app items have the same ordinal position (which | 4203 // Checks the case when several app items have the same ordinal position (which |
| 4175 // is valid case). | 4204 // is valid case). |
| 4176 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) { | 4205 TEST_F(ChromeLauncherControllerImplTest, CheckPositionConflict) { |
| 4177 InitLauncherController(); | 4206 InitLauncherController(); |
| 4178 | 4207 |
| 4179 extension_service_->AddExtension(extension1_.get()); | 4208 extension_service_->AddExtension(extension1_.get()); |
| 4180 extension_service_->AddExtension(extension2_.get()); | 4209 extension_service_->AddExtension(extension2_.get()); |
| 4181 extension_service_->AddExtension(extension3_.get()); | 4210 extension_service_->AddExtension(extension3_.get()); |
| 4182 | 4211 |
| 4183 syncer::SyncChangeList sync_list; | 4212 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, | 4424 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4396 shelf_controller->auto_hide()); | 4425 shelf_controller->auto_hide()); |
| 4397 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4426 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4398 | 4427 |
| 4399 PrefService* prefs = profile()->GetTestingPrefService(); | 4428 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4400 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4429 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4401 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4430 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4402 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4431 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4403 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4432 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4404 } | 4433 } |
| OLD | NEW |