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
This commit is contained in:
chromeos
device/bluetooth
sync/util
@ -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";
|
||||
|
||||
|
@ -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[];
|
||||
|
@ -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";
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user