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

Unified Diff: chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc

Issue 2702893002: Revert of Skip ARC initial screen when everything is set up by policy (Closed)
Patch Set: 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/intent_helper/arc_settings_service_browsertest.cc
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc
index b6af890010a6f5cdea604cf952f2e0af2fd5d6ea..bdc25895bd1f29c3d01c74d5dea5e11702fbcec9 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_profile_client.h"
@@ -175,8 +174,6 @@
constexpr char kONCPacUrl[] = "http://domain.com/x";
-constexpr char kBackupBroadcastAction[] =
- "org.chromium.arc.intent_helper.SET_BACKUP_ENABLED";
constexpr char kLocationServiceBroadcastAction[] =
"org.chromium.arc.intent_helper.SET_LOCATION_SERVICE_ENABLED";
constexpr char kSetProxyBroadcastAction[] =
@@ -320,76 +317,7 @@
DISALLOW_COPY_AND_ASSIGN(ArcSettingsServiceTest);
};
-IN_PROC_BROWSER_TEST_F(ArcSettingsServiceTest, BackupRestorePolicyTest) {
- PrefService* const prefs = browser()->profile()->GetPrefs();
-
- // Set the user pref as initially enabled.
- prefs->SetBoolean(prefs::kArcBackupRestoreEnabled, true);
- EXPECT_TRUE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled));
-
- fake_intent_helper_instance_->clear_broadcasts();
-
- // The policy is set to false.
- policy::PolicyMap policy;
- policy.Set(policy::key::kArcBackupRestoreEnabled,
- policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
- policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
- nullptr);
- UpdatePolicy(policy);
-
- // The pref is disabled and managed, and the corresponding broadcast is sent
- // at least once.
- EXPECT_FALSE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled));
- EXPECT_TRUE(prefs->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
- base::DictionaryValue expected_broadcast_extras;
- expected_broadcast_extras.SetBoolean("enabled", false);
- expected_broadcast_extras.SetBoolean("managed", true);
- EXPECT_GE(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
- kBackupBroadcastAction, &expected_broadcast_extras),
- 1);
-
- fake_intent_helper_instance_->clear_broadcasts();
-
- // The policy is set to true.
- policy.Set(policy::key::kArcBackupRestoreEnabled,
- policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
- policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true),
- nullptr);
- UpdatePolicy(policy);
-
- // The pref is enabled and managed, and the corresponding broadcast is sent at
- // least once.
- EXPECT_TRUE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled));
- EXPECT_TRUE(prefs->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
- expected_broadcast_extras.SetBoolean("enabled", true);
- EXPECT_GE(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
- kBackupBroadcastAction, &expected_broadcast_extras),
- 1);
-
- fake_intent_helper_instance_->clear_broadcasts();
-
- // The policy is unset.
- policy.Erase(policy::key::kArcBackupRestoreEnabled);
- UpdatePolicy(policy);
-
- // The pref is disabled and unmanaged, and the corresponding broadcast is
- // sent.
- EXPECT_FALSE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled));
- EXPECT_FALSE(prefs->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
- expected_broadcast_extras.SetBoolean("enabled", false);
- expected_broadcast_extras.SetBoolean("managed", false);
- EXPECT_EQ(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
- kBackupBroadcastAction, &expected_broadcast_extras),
- 1);
-}
-
IN_PROC_BROWSER_TEST_F(ArcSettingsServiceTest, LocationServicePolicyTest) {
- PrefService* const prefs = browser()->profile()->GetPrefs();
-
- // Set the user pref as initially enabled.
- prefs->SetBoolean(prefs::kArcLocationServiceEnabled, true);
- EXPECT_TRUE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled));
-
fake_intent_helper_instance_->clear_broadcasts();
// The policy is set to false.
@@ -400,14 +328,11 @@
nullptr);
UpdatePolicy(policy);
- // The pref is disabled and managed, and the corresponding broadcast is sent
- // at least once.
- EXPECT_FALSE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled));
- EXPECT_TRUE(prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled));
+ // The broadcast is sent which says that the pref is disabled and managed.
base::DictionaryValue expected_broadcast_extras;
expected_broadcast_extras.SetBoolean("enabled", false);
expected_broadcast_extras.SetBoolean("managed", true);
- EXPECT_GE(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
+ EXPECT_EQ(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
kLocationServiceBroadcastAction,
&expected_broadcast_extras),
1);
@@ -421,28 +346,8 @@
nullptr);
UpdatePolicy(policy);
- // The pref is enabled and managed, and the corresponding broadcast is sent at
- // least once.
- EXPECT_TRUE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled));
- EXPECT_TRUE(prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled));
+ // The broadcast is sent which says that the pref is enabled and managed.
expected_broadcast_extras.SetBoolean("enabled", true);
- EXPECT_GE(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
- kLocationServiceBroadcastAction,
- &expected_broadcast_extras),
- 1);
-
- fake_intent_helper_instance_->clear_broadcasts();
-
- // The policy is unset.
- policy.Erase(policy::key::kArcLocationServiceEnabled);
- UpdatePolicy(policy);
-
- // The pref is disabled and unmanaged, and the corresponding broadcast is
- // sent.
- EXPECT_FALSE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled));
- EXPECT_FALSE(prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled));
- expected_broadcast_extras.SetBoolean("enabled", false);
- expected_broadcast_extras.SetBoolean("managed", false);
EXPECT_EQ(CountBroadcasts(fake_intent_helper_instance_->broadcasts(),
kLocationServiceBroadcastAction,
&expected_broadcast_extras),

Powered by Google App Engine
This is Rietveld 408576698