| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_list/arc/arc_app_dialog.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_dialog.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 9 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 11 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 13 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 13 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" | 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" |
| 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
| 20 #include "components/arc/arc_bridge_service.h" | |
| 21 #include "components/arc/common/app.mojom.h" | 20 #include "components/arc/common/app.mojom.h" |
| 22 #include "components/arc/test/fake_app_instance.h" | 21 #include "components/arc/test/fake_app_instance.h" |
| 23 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
| 24 | 23 |
| 25 namespace arc { | 24 namespace arc { |
| 26 | 25 |
| 27 class ArcAppUninstallDialogViewBrowserTest : public InProcessBrowserTest { | 26 class ArcAppUninstallDialogViewBrowserTest : public InProcessBrowserTest { |
| 28 public: | 27 public: |
| 29 ArcAppUninstallDialogViewBrowserTest() {} | 28 ArcAppUninstallDialogViewBrowserTest() {} |
| 30 | 29 |
| 31 // InProcessBrowserTest: | 30 // InProcessBrowserTest: |
| 32 ~ArcAppUninstallDialogViewBrowserTest() override {} | 31 ~ArcAppUninstallDialogViewBrowserTest() override {} |
| 33 | 32 |
| 34 void SetUpAppInstance() { | 33 void SetUpAppInstance() { |
| 35 profile_ = browser()->profile(); | 34 profile_ = browser()->profile(); |
| 36 | 35 |
| 37 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 36 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 38 chromeos::switches::kEnableArc); | 37 chromeos::switches::kEnableArc); |
| 39 | 38 |
| 40 // A valid |arc_app_list_prefs_| is needed for the Arc bridge service and | |
| 41 // the Arc session manager. | |
| 42 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); | 39 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); |
| 43 if (!arc_app_list_pref_) { | 40 if (!arc_app_list_pref_) { |
| 44 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( | 41 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( |
| 45 profile_); | 42 profile_); |
| 46 } | 43 } |
| 47 | 44 |
| 48 DCHECK(ArcBridgeService::Get()); | |
| 49 ArcSessionManager* session_manager = ArcSessionManager::Get(); | 45 ArcSessionManager* session_manager = ArcSessionManager::Get(); |
| 50 DCHECK(session_manager); | 46 DCHECK(session_manager); |
| 51 ArcSessionManager::DisableUIForTesting(); | 47 ArcSessionManager::DisableUIForTesting(); |
| 52 session_manager->OnPrimaryUserProfilePrepared(profile_); | 48 session_manager->OnPrimaryUserProfilePrepared(profile_); |
| 53 session_manager->EnableArc(); | 49 session_manager->EnableArc(); |
| 54 | 50 |
| 55 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); | 51 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); |
| 56 DCHECK(arc_app_list_pref_); | 52 DCHECK(arc_app_list_pref_); |
| 57 | 53 |
| 58 base::RunLoop run_loop; | 54 base::RunLoop run_loop; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 content::RunAllPendingInMessageLoop(); | 170 content::RunAllPendingInMessageLoop(); |
| 175 | 171 |
| 176 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); | 172 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); |
| 177 content::RunAllPendingInMessageLoop(); | 173 content::RunAllPendingInMessageLoop(); |
| 178 app_ids = arc_app_list_pref()->GetAppIds(); | 174 app_ids = arc_app_list_pref()->GetAppIds(); |
| 179 EXPECT_EQ(app_ids.size(), 1u); | 175 EXPECT_EQ(app_ids.size(), 1u); |
| 180 controller->DismissView(); | 176 controller->DismissView(); |
| 181 } | 177 } |
| 182 | 178 |
| 183 } // namespace arc | 179 } // namespace arc |
| OLD | NEW |