Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc

Issue 2557513004: Remove explicit singletonness of ArcBridgeService part 3. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 20 #include "components/arc/arc_bridge_service.h"
msw 2016/12/06 17:49:32 nit: remove if not needed
hidehiko 2016/12/06 19:11:28 Done.
21 #include "components/arc/common/app.mojom.h" 21 #include "components/arc/common/app.mojom.h"
22 #include "components/arc/test/fake_app_instance.h" 22 #include "components/arc/test/fake_app_instance.h"
23 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
24 24
25 namespace arc { 25 namespace arc {
26 26
27 class ArcAppUninstallDialogViewBrowserTest : public InProcessBrowserTest { 27 class ArcAppUninstallDialogViewBrowserTest : public InProcessBrowserTest {
28 public: 28 public:
29 ArcAppUninstallDialogViewBrowserTest() {} 29 ArcAppUninstallDialogViewBrowserTest() {}
30 30
31 // InProcessBrowserTest: 31 // InProcessBrowserTest:
32 ~ArcAppUninstallDialogViewBrowserTest() override {} 32 ~ArcAppUninstallDialogViewBrowserTest() override {}
33 33
34 void SetUpAppInstance() { 34 void SetUpAppInstance() {
35 profile_ = browser()->profile(); 35 profile_ = browser()->profile();
36 36
37 base::CommandLine::ForCurrentProcess()->AppendSwitch( 37 base::CommandLine::ForCurrentProcess()->AppendSwitch(
38 chromeos::switches::kEnableArc); 38 chromeos::switches::kEnableArc);
39 39
40 // A valid |arc_app_list_prefs_| is needed for the Arc bridge service and 40 // A valid |arc_app_list_prefs_| is needed for the Arc bridge service and
msw 2016/12/06 17:49:32 nit: update mention of Arc bridge service, if it's
hidehiko 2016/12/06 19:11:28 Hmm... Good catch. Actually neither ArcBridgeServi
41 // the Arc session manager. 41 // the Arc session manager.
42 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 42 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
43 if (!arc_app_list_pref_) { 43 if (!arc_app_list_pref_) {
44 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( 44 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting(
45 profile_); 45 profile_);
46 } 46 }
47 47
48 DCHECK(ArcBridgeService::Get());
49 ArcSessionManager* session_manager = ArcSessionManager::Get(); 48 ArcSessionManager* session_manager = ArcSessionManager::Get();
50 DCHECK(session_manager); 49 DCHECK(session_manager);
51 ArcSessionManager::DisableUIForTesting(); 50 ArcSessionManager::DisableUIForTesting();
52 session_manager->OnPrimaryUserProfilePrepared(profile_); 51 session_manager->OnPrimaryUserProfilePrepared(profile_);
53 session_manager->EnableArc(); 52 session_manager->EnableArc();
54 53
55 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_); 54 arc_app_list_pref_ = ArcAppListPrefs::Get(profile_);
56 DCHECK(arc_app_list_pref_); 55 DCHECK(arc_app_list_pref_);
57 56
58 base::RunLoop run_loop; 57 base::RunLoop run_loop;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 content::RunAllPendingInMessageLoop(); 173 content::RunAllPendingInMessageLoop();
175 174
176 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); 175 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true));
177 content::RunAllPendingInMessageLoop(); 176 content::RunAllPendingInMessageLoop();
178 app_ids = arc_app_list_pref()->GetAppIds(); 177 app_ids = arc_app_list_pref()->GetAppIds();
179 EXPECT_EQ(app_ids.size(), 1u); 178 EXPECT_EQ(app_ids.size(), 1u);
180 controller->DismissView(); 179 controller->DismissView();
181 } 180 }
182 181
183 } // namespace arc 182 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698