summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 20:28:26 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 20:28:26 +0000
commit8557da6bd5eaef6a20be0a23834dd05bd66fc24d (patch)
tree80efb129b18fe8616bde4ce283304bb4dcf88a28 /sync
parent5229175a5c9342c93806f0ac97cf45ce1cbe4bc2 (diff)
downloadchromium_src-8557da6bd5eaef6a20be0a23834dd05bd66fc24d.zip
chromium_src-8557da6bd5eaef6a20be0a23834dd05bd66fc24d.tar.gz
chromium_src-8557da6bd5eaef6a20be0a23834dd05bd66fc24d.tar.bz2
Replace kChromeOSReleaseBoard with SysInfo::GetLsbReleaseBoard()
BUG=126732 Review URL: https://codereview.chromium.org/32043003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231396 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/util/DEPS4
-rw-r--r--sync/util/get_session_name.cc27
-rw-r--r--sync/util/get_session_name_unittest.cc23
3 files changed, 8 insertions, 46 deletions
diff --git a/sync/util/DEPS b/sync/util/DEPS
index 13d7bf1..d311654f 100644
--- a/sync/util/DEPS
+++ b/sync/util/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+chromeos",
"+crypto",
"+sync/base",
"+sync/internal_api/public/base",
@@ -6,9 +7,6 @@ include_rules = [
"+sync/protocol",
"+sync/test/fake_encryptor.h",
- # TODO(rsimha): Remove this after http://crbug.com/126732 is fixed.
- "+chromeos/chromeos_switches.h",
-
# TODO(zea): remove this once we don't need the cryptographer to get the set
# of encrypted types.
"+sync/syncable/nigori_handler.h"
diff --git a/sync/util/get_session_name.cc b/sync/util/get_session_name.cc
index d51c93e..3a09c51 100644
--- a/sync/util/get_session_name.cc
+++ b/sync/util/get_session_name.cc
@@ -11,10 +11,7 @@
#include "base/sys_info.h"
#include "base/task_runner.h"
-#if defined(OS_CHROMEOS)
-#include "base/command_line.h"
-#include "chromeos/chromeos_switches.h"
-#elif defined(OS_LINUX)
+#if defined(OS_LINUX)
#include "sync/util/get_session_name_linux.h"
#elif defined(OS_IOS)
#include "sync/util/get_session_name_ios.h"
@@ -33,27 +30,7 @@ namespace {
std::string GetSessionNameSynchronously() {
std::string session_name;
#if defined(OS_CHROMEOS)
- // The approach below is similar to that used by the CrOs implementation of
- // StatisticsProvider::GetMachineStatistic(CHROMEOS_RELEASE_BOARD).
- // See chromeos/system/statistics_provider.{h|cc}.
- //
- // We cannot use StatisticsProvider here because of the mutual dependency
- // it creates between sync.gyp:sync and chrome.gyp:browser.
- //
- // Even though this code is ad hoc and fragile, it remains the only means of
- // determining the Chrome OS hardware platform so we can display the right
- // device name in the "Other devices" section of the new tab page.
- // TODO(rsimha): Change this once a better alternative is available.
- // See http://crbug.com/126732.
- std::string board;
- const CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(chromeos::switches::kChromeOSReleaseBoard)) {
- board = command_line->
- GetSwitchValueASCII(chromeos::switches::kChromeOSReleaseBoard);
- } else {
- LOG(ERROR) << "Failed to get board information";
- }
-
+ std::string board = base::SysInfo::GetLsbReleaseBoard();
// Currently, only "stumpy" type of board is considered Chromebox, and
// anything else is Chromebook. On these devices, session_name should look
// like "stumpy-signed-mp-v2keys" etc. The information can be checked on
diff --git a/sync/util/get_session_name_unittest.cc b/sync/util/get_session_name_unittest.cc
index e973945..724cd8b 100644
--- a/sync/util/get_session_name_unittest.cc
+++ b/sync/util/get_session_name_unittest.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
+#include "base/sys_info.h"
#include "sync/util/get_session_name.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,15 +43,8 @@ TEST_F(GetSessionNameTest, GetSessionNameSynchronously) {
// Call GetSessionNameSynchronouslyForTesting on ChromeOS where the board type
// is "lumpy-signed-mp-v2keys" and make sure the return value is "Chromebook".
TEST_F(GetSessionNameTest, GetSessionNameSynchronouslyChromebook) {
- // This test cannot be run on a real CrOs device, since it will already have a
- // board type, and we cannot override it.
- // TODO(rsimha): Rewrite this test once http://crbug.com/126732 is fixed.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(chromeos::switches::kChromeOSReleaseBoard))
- return;
-
- command_line->AppendSwitchASCII(chromeos::switches::kChromeOSReleaseBoard,
- "lumpy-signed-mp-v2keys");
+ const char* kLsbRelease = "CHROMEOS_RELEASE_BOARD=lumpy-signed-mp-v2keys\n";
+ base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
const std::string& session_name = GetSessionNameSynchronouslyForTesting();
EXPECT_EQ("Chromebook", session_name);
}
@@ -58,15 +52,8 @@ TEST_F(GetSessionNameTest, GetSessionNameSynchronouslyChromebook) {
// Call GetSessionNameSynchronouslyForTesting on ChromeOS where the board type
// is "stumpy-signed-mp-v2keys" and make sure the return value is "Chromebox".
TEST_F(GetSessionNameTest, GetSessionNameSynchronouslyChromebox) {
- // This test cannot be run on a real CrOs device, since it will already have a
- // board type, and we cannot override it.
- // TODO(rsimha): Rewrite this test once http://crbug.com/126732 is fixed.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(chromeos::switches::kChromeOSReleaseBoard))
- return;
-
- command_line->AppendSwitchASCII(chromeos::switches::kChromeOSReleaseBoard,
- "stumpy-signed-mp-v2keys");
+ const char* kLsbRelease = "CHROMEOS_RELEASE_BOARD=stumpy-signed-mp-v2keys\n";
+ base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
const std::string& session_name = GetSessionNameSynchronouslyForTesting();
EXPECT_EQ("Chromebox", session_name);
}