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

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

Issue 2755073003: [Merge M58] arc: Reactivate OptIn flow on clicking Play Store. (Closed)
Patch Set: update unit_tests expectation for M58 Created 3 years, 9 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.h ('k') | chrome/browser/chromeos/arc/arc_util.cc » ('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_unittest.cc
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc
index efdfe629e5ffb024eff224ebad20fb3453129379..c369c77266756510ccac8e01a413976d2f044eff 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc
@@ -509,6 +509,31 @@ TEST_P(ArcSessionManagerPolicyTest, SkippingTerms) {
arc_session_manager()->Shutdown();
}
+TEST_P(ArcSessionManagerPolicyTest, ReenableManagedArc) {
+ sync_preferences::TestingPrefServiceSyncable* const prefs =
+ profile()->GetTestingPrefService();
+
+ // Set ARC to be managed.
+ prefs->SetManagedPref(prefs::kArcEnabled, new base::Value(true));
+ EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile()));
+
+ arc_session_manager()->SetProfile(profile());
+ arc_session_manager()->RequestEnable();
+ EXPECT_TRUE(arc_session_manager()->enable_requested());
+
+ // Simulate close OptIn. Session manager should stop.
+ SetArcPlayStoreEnabledForProfile(profile(), false);
+ EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile()));
+ EXPECT_FALSE(arc_session_manager()->enable_requested());
+
+ // Restart ARC again
+ SetArcPlayStoreEnabledForProfile(profile(), true);
+ EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile()));
+ EXPECT_TRUE(arc_session_manager()->enable_requested());
+
+ arc_session_manager()->Shutdown();
+}
+
INSTANTIATE_TEST_CASE_P(
ArcSessionManagerPolicyTest,
ArcSessionManagerPolicyTest,
@@ -700,7 +725,21 @@ TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsRejected) {
EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE,
arc_session_manager()->state());
ReportResult(false);
- EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state());
+ if (!IsManagedUser()) {
+ // ArcPlayStoreEnabledPreferenceHandler is not running, so the state should
+ // be kept as is
+ EXPECT_EQ(/*ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE,*/
+ ArcSessionManager::State::STOPPED, // M58 Only, different logic
+ arc_session_manager()->state());
+ EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile()));
+ } else {
+ // For managed case we handle closing outside of
+ // ArcPlayStoreEnabledPreferenceHandler. So it session turns to STOPPED.
+ EXPECT_EQ(ArcSessionManager::State::STOPPED,
+ arc_session_manager()->state());
+ // Managed user's preference should not be overwritten.
+ EXPECT_TRUE(IsArcPlayStoreEnabledForProfile(profile()));
+ }
}
TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsViewDestroyed) {
@@ -709,7 +748,21 @@ TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsViewDestroyed) {
arc_session_manager()->state());
CloseLoginDisplayHost();
ReportViewDestroyed();
- EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state());
+ if (!IsManagedUser()) {
+ // ArcPlayStoreEnabledPreferenceHandler is not running, so the state should
+ // be kept as is.
+ EXPECT_EQ(/*ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE,*/
+ ArcSessionManager::State::STOPPED, // M58 Only, different logic
+ arc_session_manager()->state());
+ EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile()));
+ } else {
+ // For managed case we handle closing outside of
+ // ArcPlayStoreEnabledPreferenceHandler. So it session turns to STOPPED.
+ EXPECT_EQ(ArcSessionManager::State::STOPPED,
+ arc_session_manager()->state());
+ // Managed user's preference should not be overwritten.
+ EXPECT_TRUE(IsArcPlayStoreEnabledForProfile(profile()));
+ }
}
} // namespace arc
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.h ('k') | chrome/browser/chromeos/arc/arc_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698