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

Unified Diff: chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc

Issue 2723073002: Extract kArcEnabled preference from ArcSessionManager part 2. (Closed)
Patch Set: address comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
index 29dbb859781d039d3837c43042188f2f634b6f6c..a9f9eac3028a5e176d3606242eb1c126ef85a2a6 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
@@ -14,6 +14,7 @@
#include "base/run_loop.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/arc/arc_auth_notification.h"
#include "chrome/browser/chromeos/arc/arc_service_launcher.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/test/arc_data_removed_waiter.h"
@@ -124,6 +125,7 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
new chromeos::FakeChromeUserManager));
// Init ArcSessionManager for testing.
ArcSessionManager::DisableUIForTesting();
+ ArcAuthNotification::DisableForTesting();
ArcSessionManager::EnableCheckAndroidManagementForTesting();
ArcSessionManager::Get()->SetArcSessionRunnerForTesting(
base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create)));
@@ -151,6 +153,12 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
GetFakeUserManager()->LoginUser(account_id);
// Set up ARC for test profile.
+ // Currently, ArcSessionManager is singleton and set up with the original
+ // Profile instance. This re-initializes the ArcServiceLauncher by
+ // overwriting Profile with profile().
+ // TODO(hidehiko): This way several ArcService instances created with
+ // the original Profile instance on Browser creatuion are kept in the
+ // ArcServiceManager. For proper overwriting, those should be removed.
ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile());
}
@@ -162,8 +170,13 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
const AccountId account_id(
AccountId::FromUserEmailGaiaId(kFakeUserName, kFakeGaiaId));
GetFakeUserManager()->RemoveUserFromList(account_id);
- ArcSessionManager::Get()->Shutdown();
- ArcServiceManager::Get()->Shutdown();
+ // Since ArcServiceLauncher is (re-)set up with profile() in
+ // SetUpOnMainThread() it is necessary to Shutdown() before the profile()
+ // is destroyed. ArcServiceLauncher::Shutdown() will be called again on
+ // fixture destruction (because it is initialized with the original Profile
+ // instance in fixture, once), but it should be no op.
+ // TODO(hidehiko): Think about a way to test the code cleanly.
+ ArcServiceLauncher::Get()->Shutdown();
profile_.reset();
user_manager_enabler_.reset();
test_server_.reset();
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.cc ('k') | chrome/browser/chromeos/arc/arc_session_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698