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

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

Issue 2541173002: arc: Make request to remove Android's data folder persistent. (Closed)
Patch Set: browser tests extended/updated 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e8f90f171ad1fc1adbed7f77392209d89ec88bbf..4b8d6c51db677fe831591e2c25375293d00ab5e2 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
@@ -176,6 +176,12 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
user_manager::UserManager::Get());
}
+ void EnableArc() {
+ PrefService* const prefs = profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kArcEnabled, true);
+ base::RunLoop().RunUntilIdle();
+ }
+
void set_profile_name(const std::string& username) {
profile_->set_profile_name(username);
}
@@ -195,8 +201,7 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
};
IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ConsumerAccount) {
- PrefService* const prefs = profile()->GetPrefs();
- prefs->SetBoolean(prefs::kArcEnabled, true);
+ EnableArc();
token_service()->IssueTokenForAllPendingRequests(kUnmanagedAuthToken,
base::Time::Max());
ASSERT_EQ(ArcSessionManager::State::ACTIVE,
@@ -205,9 +210,7 @@ IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ConsumerAccount) {
IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, WellKnownConsumerAccount) {
set_profile_name(kWellKnownConsumerName);
- PrefService* const prefs = profile()->GetPrefs();
-
- prefs->SetBoolean(prefs::kArcEnabled, true);
+ EnableArc();
ASSERT_EQ(ArcSessionManager::State::ACTIVE,
ArcSessionManager::Get()->state());
}
@@ -217,17 +220,13 @@ IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ManagedChromeAccount) {
policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile());
connector->OverrideIsManagedForTesting(true);
- PrefService* const pref = profile()->GetPrefs();
-
- pref->SetBoolean(prefs::kArcEnabled, true);
+ EnableArc();
ASSERT_EQ(ArcSessionManager::State::ACTIVE,
ArcSessionManager::Get()->state());
}
IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ManagedAndroidAccount) {
- PrefService* const prefs = profile()->GetPrefs();
-
- prefs->SetBoolean(prefs::kArcEnabled, true);
+ EnableArc();
token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken,
base::Time::Max());
ArcSessionManagerShutdownObserver observer;
@@ -236,4 +235,38 @@ IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ManagedAndroidAccount) {
ArcSessionManager::Get()->state());
}
+IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, RemoveDataFolder) {
hidehiko 2016/12/01 16:15:03 Could you move this into unittest, instead of brow
khmel 2016/12/01 17:18:59 Done.
+ EnableArc();
+ ASSERT_EQ(ArcSessionManager::State::ACTIVE,
+ ArcSessionManager::Get()->state());
+ EXPECT_FALSE(
+ profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
+
+ // Request to remove data folder and close session immediately.
+ ArcSessionManager::Get()->RemoveArcData();
+ ASSERT_TRUE(
+ profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
+ ASSERT_EQ(ArcSessionManager::State::ACTIVE,
+ ArcSessionManager::Get()->state());
+ ArcSessionManager::Get()->Shutdown();
+ base::RunLoop().RunUntilIdle();
+ // Request to remove data is still active.
+ ASSERT_TRUE(
+ profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
+
+ ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile());
+ // Data removal request is in progress.
+ ASSERT_EQ(ArcSessionManager::State::STOPPED,
+ ArcSessionManager::Get()->state());
+ ASSERT_TRUE(
+ profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
+ base::RunLoop().RunUntilIdle();
+ // After remove Arc is started.
hidehiko 2016/12/01 16:15:03 nit: s/Arc/ARC/ for consistency.
khmel 2016/12/01 17:18:59 Done.
+ ASSERT_EQ(ArcSessionManager::State::ACTIVE,
+ ArcSessionManager::Get()->state());
+ ASSERT_FALSE(
+ profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
+ ArcSessionManager::Get()->Shutdown();
+}
+
} // namespace arc
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698