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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service_browsertest.cc

Issue 2436763004: More graceful shutdown for ArcSession. (Closed)
Patch Set: Add StopArcInstance Created 4 years, 2 months 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Enable ARC. 132 // Enable ARC.
133 command_line->AppendSwitch(chromeos::switches::kEnableArc); 133 command_line->AppendSwitch(chromeos::switches::kEnableArc);
134 chromeos::FakeSessionManagerClient* const fake_session_manager_client = 134 chromeos::FakeSessionManagerClient* const fake_session_manager_client =
135 new chromeos::FakeSessionManagerClient; 135 new chromeos::FakeSessionManagerClient;
136 fake_session_manager_client->set_arc_available(true); 136 fake_session_manager_client->set_arc_available(true);
137 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( 137 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
138 std::unique_ptr<chromeos::SessionManagerClient>( 138 std::unique_ptr<chromeos::SessionManagerClient>(
139 fake_session_manager_client)); 139 fake_session_manager_client));
140 140
141 // Mock out ARC bridge. 141 // Mock out ARC bridge.
142 auto service = base::MakeUnique<ArcBridgeServiceImpl>(); 142 // Here inject FakeArcSession so blocking task runner is not needed.
143 auto service = base::MakeUnique<ArcBridgeServiceImpl>(nullptr);
143 service->SetArcSessionFactoryForTesting(base::Bind(FakeArcSession::Create)); 144 service->SetArcSessionFactoryForTesting(base::Bind(FakeArcSession::Create));
144 ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service)); 145 ArcServiceManager::SetArcBridgeServiceForTesting(std::move(service));
145 } 146 }
146 147
147 void SetUpOnMainThread() override { 148 void SetUpOnMainThread() override {
148 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( 149 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler(
149 new chromeos::FakeChromeUserManager)); 150 new chromeos::FakeChromeUserManager));
150 // Init ArcAuthService for testing. 151 // Init ArcAuthService for testing.
151 ArcAuthService::DisableUIForTesting(); 152 ArcAuthService::DisableUIForTesting();
152 ArcAuthService::EnableCheckAndroidManagementForTesting(); 153 ArcAuthService::EnableCheckAndroidManagementForTesting();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 245
245 prefs->SetBoolean(prefs::kArcEnabled, true); 246 prefs->SetBoolean(prefs::kArcEnabled, true);
246 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, 247 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken,
247 base::Time::Max()); 248 base::Time::Max());
248 ArcAuthServiceShutdownObserver observer; 249 ArcAuthServiceShutdownObserver observer;
249 observer.Wait(); 250 observer.Wait();
250 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state()); 251 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state());
251 } 252 }
252 253
253 } // namespace arc 254 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/chromeos/arc/arc_service_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698