diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-28 20:28:26 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-28 20:28:26 +0000 |
commit | 8557da6bd5eaef6a20be0a23834dd05bd66fc24d (patch) | |
tree | 80efb129b18fe8616bde4ce283304bb4dcf88a28 | |
parent | 5229175a5c9342c93806f0ac97cf45ce1cbe4bc2 (diff) | |
download | chromium_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
-rw-r--r-- | chromeos/chromeos_switches.cc | 3 | ||||
-rw-r--r-- | chromeos/chromeos_switches.h | 1 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.cc | 14 | ||||
-rw-r--r-- | sync/util/DEPS | 4 | ||||
-rw-r--r-- | sync/util/get_session_name.cc | 27 | ||||
-rw-r--r-- | sync/util/get_session_name_unittest.cc | 23 |
6 files changed, 10 insertions, 62 deletions
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index fbfda49..42ffe24 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc @@ -18,9 +18,6 @@ const char kAshWebUIInit[] = "ash-webui-init"; // Enables overriding the path for the default authentication extension. const char kAuthExtensionPath[] = "auth-ext-path"; -// Enables overriding the Chrome OS board type when running on Linux. -const char kChromeOSReleaseBoard[] = "chromeos-release-board"; - // Forces the stub implementation of dbus clients. const char kDbusStub[] = "dbus-stub"; diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 6f03824..7218df3 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h @@ -23,7 +23,6 @@ namespace switches { CHROMEOS_EXPORT extern const char kAppOemManifestFile[]; CHROMEOS_EXPORT extern const char kAshWebUIInit[]; CHROMEOS_EXPORT extern const char kAuthExtensionPath[]; -CHROMEOS_EXPORT extern const char kChromeOSReleaseBoard[]; CHROMEOS_EXPORT extern const char kDbusStub[]; CHROMEOS_EXPORT extern const char kDefaultStubNetworkStateIdle[]; CHROMEOS_EXPORT extern const char kDisableBootAnimation[]; diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc index b5f6ba0..319a6e9 100644 --- a/device/bluetooth/bluetooth_adapter_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc @@ -7,10 +7,9 @@ #include <string> #include "base/bind.h" -#include "base/command_line.h" #include "base/logging.h" #include "base/metrics/histogram.h" -#include "chromeos/chromeos_switches.h" +#include "base/sys_info.h" #include "chromeos/dbus/bluetooth_adapter_client.h" #include "chromeos/dbus/bluetooth_device_client.h" #include "chromeos/dbus/bluetooth_input_client.h" @@ -328,16 +327,7 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { } void BluetoothAdapterChromeOS::SetAdapterName() { - // Set a better name for the adapter than "BlueZ 5.x"; this isn't an ideal - // way to do this but it'll do for now. See http://crbug.com/126732 and - // http://crbug.com/126802. - std::string board; - const CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(chromeos::switches::kChromeOSReleaseBoard)) { - board = command_line-> - GetSwitchValueASCII(chromeos::switches::kChromeOSReleaseBoard); - } - + std::string board = base::SysInfo::GetLsbReleaseBoard(); std::string alias; if (board.substr(0, 6) == "stumpy") { alias = "Chromebox"; 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); } |