Skip to content

Commit

Permalink
Skip OwnerSettingsServiceChromeOS with --stub-cros-settings.
Browse files Browse the repository at this point in the history
When running with --stub-cros-settings, skip the owner settings service and
go straight to the CrosSettings for managing settings. This allows changes to
settings to persist to the in-memory stub copy.

This is useful for testing with a CrOS simulated environment on a linux desktop.

BUG=495403

Review URL: https://codereview.chromium.org/1164523006

Cr-Commit-Position: refs/heads/master@{#332530}
  • Loading branch information
orenb authored and Commit bot committed Jun 3, 2015
1 parent dedffcf commit 7ff3b97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "chrome/browser/chromeos/settings/device_settings_provider.h"
#include "chrome/browser/chromeos/settings/session_manager_operation.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/tpm/tpm_token_loader.h"
#include "components/ownership/owner_key_util.h"
Expand Down Expand Up @@ -262,6 +263,10 @@ bool OwnerSettingsServiceChromeOS::HasPendingChanges() const {
}

bool OwnerSettingsServiceChromeOS::HandlesSetting(const std::string& setting) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kStubCrosSettings)) {
return false;
}
return DeviceSettingsProvider::IsDeviceSetting(setting);
}

Expand Down
2 changes: 2 additions & 0 deletions chromeos/chromeos_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ const char kSmsTestMessages[] = "sms-test-messages";

// Indicates that a stub implementation of CrosSettings that stores settings in
// memory without signing should be used, treating current user as the owner.
// This also modifies OwnerSettingsServiceChromeOS::HandlesSetting such that no
// settings are handled by OwnerSettingsServiceChromeOS.
// This option is for testing the chromeos build of chrome on the desktop only.
const char kStubCrosSettings[] = "stub-cros-settings";

Expand Down

0 comments on commit 7ff3b97

Please sign in to comment.