Commit f147ae30 authored by estade@chromium.org's avatar estade@chromium.org

Get rid of more uses of CreateStringValue

split off from https://codereview.chromium.org/388963002/

BUG=160586

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283537 0039d316-1c4b-4281-b951-d872f2087c98
parent c3eb0328
...@@ -242,18 +242,15 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path, ...@@ -242,18 +242,15 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path,
AddDevice(device_path); AddDevice(device_path);
base::DictionaryValue* properties = GetDeviceProperties(device_path); base::DictionaryValue* properties = GetDeviceProperties(device_path);
properties->SetWithoutPathExpansion(shill::kTypeProperty, properties->SetStringWithoutPathExpansion(shill::kTypeProperty, type);
base::Value::CreateStringValue(type)); properties->SetStringWithoutPathExpansion(shill::kNameProperty, name);
properties->SetWithoutPathExpansion(shill::kNameProperty, properties->SetStringWithoutPathExpansion(shill::kDBusObjectProperty,
base::Value::CreateStringValue(name)); device_path);
properties->SetWithoutPathExpansion( properties->SetStringWithoutPathExpansion(
shill::kDBusObjectProperty, base::Value::CreateStringValue(device_path)); shill::kDBusServiceProperty, modemmanager::kModemManager1ServiceName);
properties->SetWithoutPathExpansion(
shill::kDBusServiceProperty,
base::Value::CreateStringValue(modemmanager::kModemManager1ServiceName));
if (type == shill::kTypeCellular) { if (type == shill::kTypeCellular) {
properties->SetWithoutPathExpansion(shill::kCellularAllowRoamingProperty, properties->SetBooleanWithoutPathExpansion(
new base::FundamentalValue(false)); shill::kCellularAllowRoamingProperty, false);
} }
} }
......
...@@ -361,8 +361,8 @@ ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() { ...@@ -361,8 +361,8 @@ ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() {
// ShillManagerClient::TestInterface overrides. // ShillManagerClient::TestInterface overrides.
void FakeShillManagerClient::AddDevice(const std::string& device_path) { void FakeShillManagerClient::AddDevice(const std::string& device_path) {
if (GetListProperty(shill::kDevicesProperty)->AppendIfNotPresent( if (GetListProperty(shill::kDevicesProperty)
base::Value::CreateStringValue(device_path))) { ->AppendIfNotPresent(new base::StringValue(device_path))) {
CallNotifyObserversPropertyChanged(shill::kDevicesProperty); CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
} }
} }
...@@ -382,14 +382,14 @@ void FakeShillManagerClient::ClearDevices() { ...@@ -382,14 +382,14 @@ void FakeShillManagerClient::ClearDevices() {
void FakeShillManagerClient::AddTechnology(const std::string& type, void FakeShillManagerClient::AddTechnology(const std::string& type,
bool enabled) { bool enabled) {
if (GetListProperty(shill::kAvailableTechnologiesProperty)-> if (GetListProperty(shill::kAvailableTechnologiesProperty)
AppendIfNotPresent(base::Value::CreateStringValue(type))) { ->AppendIfNotPresent(new base::StringValue(type))) {
CallNotifyObserversPropertyChanged( CallNotifyObserversPropertyChanged(
shill::kAvailableTechnologiesProperty); shill::kAvailableTechnologiesProperty);
} }
if (enabled && if (enabled &&
GetListProperty(shill::kEnabledTechnologiesProperty)-> GetListProperty(shill::kEnabledTechnologiesProperty)
AppendIfNotPresent(base::Value::CreateStringValue(type))) { ->AppendIfNotPresent(new base::StringValue(type))) {
CallNotifyObserversPropertyChanged( CallNotifyObserversPropertyChanged(
shill::kEnabledTechnologiesProperty); shill::kEnabledTechnologiesProperty);
} }
...@@ -412,8 +412,8 @@ void FakeShillManagerClient::RemoveTechnology(const std::string& type) { ...@@ -412,8 +412,8 @@ void FakeShillManagerClient::RemoveTechnology(const std::string& type) {
void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type, void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type,
bool initializing) { bool initializing) {
if (initializing) { if (initializing) {
if (GetListProperty(shill::kUninitializedTechnologiesProperty)-> if (GetListProperty(shill::kUninitializedTechnologiesProperty)
AppendIfNotPresent(base::Value::CreateStringValue(type))) { ->AppendIfNotPresent(new base::StringValue(type))) {
CallNotifyObserversPropertyChanged( CallNotifyObserversPropertyChanged(
shill::kUninitializedTechnologiesProperty); shill::kUninitializedTechnologiesProperty);
} }
...@@ -460,8 +460,8 @@ void FakeShillManagerClient::AddManagerService( ...@@ -460,8 +460,8 @@ void FakeShillManagerClient::AddManagerService(
const std::string& service_path, const std::string& service_path,
bool notify_observers) { bool notify_observers) {
DVLOG(2) << "AddManagerService: " << service_path; DVLOG(2) << "AddManagerService: " << service_path;
GetListProperty(shill::kServiceCompleteListProperty)->AppendIfNotPresent( GetListProperty(shill::kServiceCompleteListProperty)
base::Value::CreateStringValue(service_path)); ->AppendIfNotPresent(new base::StringValue(service_path));
SortManagerServices(false); SortManagerServices(false);
if (notify_observers) if (notify_observers)
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
......
...@@ -267,9 +267,9 @@ TEST_F(GsmSMSClientTest, Get) { ...@@ -267,9 +267,9 @@ TEST_F(GsmSMSClientTest, Get) {
// Create expected result. // Create expected result.
base::DictionaryValue expected_result; base::DictionaryValue expected_result;
expected_result.SetWithoutPathExpansion( expected_result.SetWithoutPathExpansion(
kNumberKey, base::Value::CreateStringValue(kExampleNumber)); kNumberKey, new base::StringValue(kExampleNumber));
expected_result.SetWithoutPathExpansion( expected_result.SetWithoutPathExpansion(kTextKey,
kTextKey, base::Value::CreateStringValue(kExampleText)); new base::StringValue(kExampleText));
expected_result_ = &expected_result; expected_result_ = &expected_result;
// Call Delete. // Call Delete.
client_->Get(kServiceName, dbus::ObjectPath(kObjectPath), kIndex, client_->Get(kServiceName, dbus::ObjectPath(kObjectPath), kIndex,
...@@ -308,10 +308,9 @@ TEST_F(GsmSMSClientTest, List) { ...@@ -308,10 +308,9 @@ TEST_F(GsmSMSClientTest, List) {
// Create expected result. // Create expected result.
base::ListValue expected_result; base::ListValue expected_result;
base::DictionaryValue* sms = new base::DictionaryValue; base::DictionaryValue* sms = new base::DictionaryValue;
sms->SetWithoutPathExpansion( sms->SetWithoutPathExpansion(kNumberKey,
kNumberKey, base::Value::CreateStringValue(kExampleNumber)); new base::StringValue(kExampleNumber));
sms->SetWithoutPathExpansion( sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText));
kTextKey, base::Value::CreateStringValue(kExampleText));
expected_result.Append(sms); expected_result.Append(sms);
expected_result_ = &expected_result; expected_result_ = &expected_result;
// Call List. // Call List.
......
...@@ -38,7 +38,7 @@ base::DictionaryValue* PopStringToStringDictionary( ...@@ -38,7 +38,7 @@ base::DictionaryValue* PopStringToStringDictionary(
!entry_reader.PopString(&key) || !entry_reader.PopString(&key) ||
!entry_reader.PopString(&value)) !entry_reader.PopString(&value))
return NULL; return NULL;
result->SetWithoutPathExpansion(key, base::Value::CreateStringValue(value)); result->SetWithoutPathExpansion(key, new base::StringValue(value));
} }
return result.release(); return result.release();
} }
...@@ -282,17 +282,14 @@ ShillClientUnittestBase::CreateExampleServiceProperties() { ...@@ -282,17 +282,14 @@ ShillClientUnittestBase::CreateExampleServiceProperties() {
base::DictionaryValue* properties = new base::DictionaryValue; base::DictionaryValue* properties = new base::DictionaryValue;
properties->SetWithoutPathExpansion( properties->SetWithoutPathExpansion(
shill::kGuidProperty, shill::kGuidProperty,
base::Value::CreateStringValue("00000000-0000-0000-0000-000000000000")); new base::StringValue("00000000-0000-0000-0000-000000000000"));
properties->SetWithoutPathExpansion( properties->SetWithoutPathExpansion(
shill::kModeProperty, shill::kModeProperty, new base::StringValue(shill::kModeManaged));
base::Value::CreateStringValue(shill::kModeManaged)); properties->SetWithoutPathExpansion(shill::kTypeProperty,
properties->SetWithoutPathExpansion( new base::StringValue(shill::kTypeWifi));
shill::kTypeProperty,
base::Value::CreateStringValue(shill::kTypeWifi));
shill_property_util::SetSSID("testssid", properties); shill_property_util::SetSSID("testssid", properties);
properties->SetWithoutPathExpansion( properties->SetWithoutPathExpansion(
shill::kSecurityProperty, shill::kSecurityProperty, new base::StringValue(shill::kSecurityPsk));
base::Value::CreateStringValue(shill::kSecurityPsk));
return properties; return properties;
} }
......
...@@ -105,7 +105,7 @@ TEST_F(ShillIPConfigClientTest, GetProperties) { ...@@ -105,7 +105,7 @@ TEST_F(ShillIPConfigClientTest, GetProperties) {
// Create the expected value. // Create the expected value.
base::DictionaryValue value; base::DictionaryValue value;
value.SetWithoutPathExpansion(shill::kAddressProperty, value.SetWithoutPathExpansion(shill::kAddressProperty,
base::Value::CreateStringValue(kAddress)); new base::StringValue(kAddress));
value.SetWithoutPathExpansion(shill::kMtuProperty, value.SetWithoutPathExpansion(shill::kMtuProperty,
base::Value::CreateIntegerValue(kMtu)); base::Value::CreateIntegerValue(kMtu));
......
...@@ -165,7 +165,7 @@ TEST_F(ShillManagerClientTest, GetNetworksForGeolocation) { ...@@ -165,7 +165,7 @@ TEST_F(ShillManagerClientTest, GetNetworksForGeolocation) {
base::DictionaryValue* property_dict_value = new base::DictionaryValue; base::DictionaryValue* property_dict_value = new base::DictionaryValue;
property_dict_value->SetWithoutPathExpansion( property_dict_value->SetWithoutPathExpansion(
shill::kGeoMacAddressProperty, shill::kGeoMacAddressProperty,
base::Value::CreateStringValue("01:23:45:67:89:AB")); new base::StringValue("01:23:45:67:89:AB"));
type_entry_value->Append(property_dict_value); type_entry_value->Append(property_dict_value);
type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value);
......
...@@ -66,7 +66,7 @@ TEST_F(ShillProfileClientTest, PropertyChanged) { ...@@ -66,7 +66,7 @@ TEST_F(ShillProfileClientTest, PropertyChanged) {
// Set expectations. // Set expectations.
base::ListValue value; base::ListValue value;
value.Append(base::Value::CreateStringValue(kExampleEntryPath)); value.Append(new base::StringValue(kExampleEntryPath));
MockPropertyChangeObserver observer; MockPropertyChangeObserver observer;
EXPECT_CALL(observer, EXPECT_CALL(observer,
OnPropertyChanged( OnPropertyChanged(
...@@ -108,7 +108,7 @@ TEST_F(ShillProfileClientTest, GetProperties) { ...@@ -108,7 +108,7 @@ TEST_F(ShillProfileClientTest, GetProperties) {
// Create the expected value. // Create the expected value.
base::ListValue* entries = new base::ListValue; base::ListValue* entries = new base::ListValue;
entries->Append(base::Value::CreateStringValue(kExampleEntryPath)); entries->Append(new base::StringValue(kExampleEntryPath));
base::DictionaryValue value; base::DictionaryValue value;
value.SetWithoutPathExpansion(shill::kEntriesProperty, entries); value.SetWithoutPathExpansion(shill::kEntriesProperty, entries);
// Set expectations. // Set expectations.
...@@ -142,9 +142,8 @@ TEST_F(ShillProfileClientTest, GetEntry) { ...@@ -142,9 +142,8 @@ TEST_F(ShillProfileClientTest, GetEntry) {
// Create the expected value. // Create the expected value.
base::DictionaryValue value; base::DictionaryValue value;
value.SetWithoutPathExpansion( value.SetWithoutPathExpansion(shill::kTypeProperty,
shill::kTypeProperty, new base::StringValue(shill::kTypeWifi));
base::Value::CreateStringValue(shill::kTypeWifi));
// Set expectations. // Set expectations.
PrepareForMethodCall(shill::kGetEntryFunction, PrepareForMethodCall(shill::kGetEntryFunction,
base::Bind(&ExpectStringArgument, kExampleEntryPath), base::Bind(&ExpectStringArgument, kExampleEntryPath),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment