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

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

Issue 2531543003: Resolve initialize/destory order between ArcService and ArcSessionManager. (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 <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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chromeos/arc/arc_service_launcher.h"
16 #include "chrome/browser/chromeos/arc/arc_session_manager.h" 17 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 18 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 19 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
20 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 21 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
21 #include "chrome/browser/policy/profile_policy_connector.h" 22 #include "chrome/browser/policy/profile_policy_connector.h"
22 #include "chrome/browser/policy/profile_policy_connector_factory.h" 23 #include "chrome/browser/policy/profile_policy_connector_factory.h"
23 #include "chrome/browser/policy/test/local_policy_test_server.h" 24 #include "chrome/browser/policy/test/local_policy_test_server.h"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 26 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 token_service_->UpdateCredentials("", kRefreshToken); 153 token_service_->UpdateCredentials("", kRefreshToken);
153 154
154 profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); 155 profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true);
155 156
156 const AccountId account_id( 157 const AccountId account_id(
157 AccountId::FromUserEmailGaiaId(kFakeUserName, "1234567890")); 158 AccountId::FromUserEmailGaiaId(kFakeUserName, "1234567890"));
158 GetFakeUserManager()->AddUser(account_id); 159 GetFakeUserManager()->AddUser(account_id);
159 GetFakeUserManager()->LoginUser(account_id); 160 GetFakeUserManager()->LoginUser(account_id);
160 161
161 // Set up ARC for test profile. 162 // Set up ARC for test profile.
162 std::unique_ptr<BooleanPrefMember> arc_enabled_pref = 163 ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile());
163 base::MakeUnique<BooleanPrefMember>();
164 arc_enabled_pref->Init(prefs::kArcEnabled, profile()->GetPrefs());
165 ArcServiceManager::Get()->OnPrimaryUserProfilePrepared(
166 multi_user_util::GetAccountIdFromProfile(profile()),
167 std::move(arc_enabled_pref));
168 ArcSessionManager::Get()->OnPrimaryUserProfilePrepared(profile());
169 } 164 }
170 165
171 void TearDownOnMainThread() override { 166 void TearDownOnMainThread() override {
172 ArcSessionManager::Get()->Shutdown(); 167 ArcSessionManager::Get()->Shutdown();
173 ArcServiceManager::Get()->Shutdown(); 168 ArcServiceManager::Get()->Shutdown();
174 profile_.reset(); 169 profile_.reset();
175 user_manager_enabler_.reset(); 170 user_manager_enabler_.reset();
176 test_server_.reset(); 171 test_server_.reset();
177 } 172 }
178 173
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 prefs->SetBoolean(prefs::kArcEnabled, true); 230 prefs->SetBoolean(prefs::kArcEnabled, true);
236 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, 231 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken,
237 base::Time::Max()); 232 base::Time::Max());
238 ArcSessionManagerShutdownObserver observer; 233 ArcSessionManagerShutdownObserver observer;
239 observer.Wait(); 234 observer.Wait();
240 ASSERT_EQ(ArcSessionManager::State::STOPPED, 235 ASSERT_EQ(ArcSessionManager::State::STOPPED,
241 ArcSessionManager::Get()->state()); 236 ArcSessionManager::Get()->state());
242 } 237 }
243 238
244 } // namespace arc 239 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698