Chromium Code Reviews| Index: chromeos/dbus/shill_stub_helper.cc |
| diff --git a/chromeos/dbus/shill_stub_helper.cc b/chromeos/dbus/shill_stub_helper.cc |
| index fe1e0d079857cb729351410b5b9fcfbaf88c66e8..1c5700848cbead9ab3bfe08549d0bba7d9380ccc 100644 |
| --- a/chromeos/dbus/shill_stub_helper.cc |
| +++ b/chromeos/dbus/shill_stub_helper.cc |
| @@ -20,19 +20,11 @@ namespace shill_stub_helper { |
| namespace { |
| -const char kDevicePathEthernet[] = "/device/eth1"; |
| -const char kDevicePathWifi[] = "/device/wifi1"; |
| -const char kDevicePathCellular[] = "/device/cellular1"; |
| -const char kDevicePathWimax[] = "/device/wimax1"; |
| - |
| -const char kStubPortalledWifiName[] = "Portalled Wifi"; |
| -const char kStubPortalledWifiPath[] = "portalled_wifi"; |
| - |
| -void UpdatePortalledWifiState() { |
| +void UpdatePortalledWifiState(const std::string& service_path) { |
| ShillServiceClient::TestInterface* services = |
| DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| - services->SetServiceProperty(kStubPortalledWifiPath, |
| + services->SetServiceProperty(service_path, |
| shill::kStateProperty, |
| base::StringValue(shill::kStatePortal)); |
| } |
| @@ -57,16 +49,6 @@ bool IsStubNetworkTypeEnabled(const std::string& network_type) { |
| } // namespace |
| -const char kSharedProfilePath[] = "/profile/default"; |
| - |
| -bool IsStubPortalledWifiEnabled(const std::string& path) { |
| - if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| - chromeos::switches::kEnableStubPortalledWifi)) { |
| - return false; |
| - } |
| - return path == kStubPortalledWifiPath; |
| -} |
| - |
| void SetupDefaultEnvironment() { |
| ShillServiceClient::TestInterface* services = |
| DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| @@ -85,19 +67,19 @@ void SetupDefaultEnvironment() { |
| manager->AddTechnology(shill::kTypeCellular, true); |
| manager->AddTechnology(shill::kTypeWimax, true); |
| - profiles->AddProfile(kSharedProfilePath, std::string()); |
| + std::string shared_profile = ShillProfileClient::GetSharedProfilePath(); |
| + profiles->AddProfile(shared_profile, std::string()); |
| - devices->AddDevice( |
| - kDevicePathEthernet, shill::kTypeEthernet, "stub_eth_device1"); |
| - devices->AddDevice(kDevicePathWifi, shill::kTypeWifi, "stub_wifi_device1"); |
| + devices->AddDevice("/device/eth1", shill::kTypeEthernet, "stub_eth_device1"); |
| + devices->AddDevice("/device/wifi1", shill::kTypeWifi, "stub_wifi_device1"); |
| devices->AddDevice( |
| - kDevicePathCellular, shill::kTypeCellular, "stub_cellular_device1"); |
| - devices->SetDeviceProperty(kDevicePathCellular, |
| + "/device/cellular1", shill::kTypeCellular, "stub_cellular_device1"); |
| + devices->SetDeviceProperty("/device/cellular1", |
| shill::kCarrierProperty, |
| base::StringValue(shill::kCarrierSprint)); |
| - devices->AddDevice(kDevicePathWimax, shill::kTypeWimax, "stub_wimax_device1"); |
| + devices->AddDevice("/device/wimax1", shill::kTypeWimax, "stub_wimax_device1"); |
| const bool add_to_visible = true; |
| const bool add_to_watchlist = true; |
| @@ -108,7 +90,7 @@ void SetupDefaultEnvironment() { |
| shill::kTypeEthernet, |
| shill::kStateOnline, |
| add_to_visible, add_to_watchlist); |
| - profiles->AddService(kSharedProfilePath, "eth1"); |
| + profiles->AddService(shared_profile, "eth1"); |
| } |
| // Wifi |
| @@ -122,7 +104,7 @@ void SetupDefaultEnvironment() { |
| services->SetServiceProperty("wifi1", |
| shill::kSecurityProperty, |
| base::StringValue(shill::kSecurityWep)); |
| - profiles->AddService(kSharedProfilePath, "wifi1"); |
| + profiles->AddService(shared_profile, "wifi1"); |
| services->AddService("wifi2", |
| "wifi2_PSK", |
| @@ -135,23 +117,26 @@ void SetupDefaultEnvironment() { |
| base::FundamentalValue strength_value(80); |
| services->SetServiceProperty( |
| "wifi2", shill::kSignalStrengthProperty, strength_value); |
| - profiles->AddService(kSharedProfilePath, "wifi2"); |
| + profiles->AddService(shared_profile, "wifi2"); |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| chromeos::switches::kEnableStubPortalledWifi)) { |
| - services->AddService(kStubPortalledWifiPath, |
| - kStubPortalledWifiName, |
| + const std::string kPortaledWifiPath = "portalled_wifi"; |
|
pneubeck (no reviews)
2014/02/28 20:25:57
typo: Portaled -> Portalled
stevenjb
2014/02/28 20:29:00
Done.
|
| + services->AddService(kPortaledWifiPath, |
| + "Portalled Wifi", |
| shill::kTypeWifi, |
| shill::kStatePortal, |
| add_to_visible, add_to_watchlist); |
| - services->SetServiceProperty(kStubPortalledWifiPath, |
| + services->SetServiceProperty(kPortaledWifiPath, |
| shill::kSecurityProperty, |
| base::StringValue(shill::kSecurityNone)); |
| - services->SetConnectBehavior(kStubPortalledWifiPath, |
| - base::Bind(&UpdatePortalledWifiState)); |
| - services->SetServiceProperty(kStubPortalledWifiPath, |
| + services->SetConnectBehavior(kPortaledWifiPath, |
| + base::Bind(&UpdatePortalledWifiState, |
| + kPortaledWifiPath)); |
| + services->SetServiceProperty(kPortaledWifiPath, |
| shill::kConnectableProperty, |
| base::FundamentalValue(true)); |
| + profiles->AddService(shared_profile, kPortaledWifiPath); |
|
pneubeck (no reviews)
2014/02/28 20:25:57
was that missing before?
stevenjb
2014/02/28 20:29:00
Yes. It was causing warning spam in NetworkStateHa
|
| } |
| // Wimax |
| @@ -200,7 +185,7 @@ void SetupDefaultEnvironment() { |
| add_to_visible, add_to_watchlist); |
| services->SetServiceProperty( |
| "vpn1", shill::kProviderProperty, provider_properties); |
| - profiles->AddService(kSharedProfilePath, "vpn1"); |
| + profiles->AddService(shared_profile, "vpn1"); |
| services->AddService("vpn2", |
| "vpn2", |
| @@ -213,17 +198,5 @@ void SetupDefaultEnvironment() { |
| manager->SortManagerServices(); |
| } |
| -std::string DevicePathForType(const std::string& type) { |
| - if (type == shill::kTypeEthernet) |
| - return kDevicePathEthernet; |
| - if (type == shill::kTypeWifi) |
| - return kDevicePathWifi; |
| - if (type == shill::kTypeCellular) |
| - return kDevicePathCellular; |
| - if (type == shill::kTypeWimax) |
| - return kDevicePathWimax; |
| - return ""; |
| -} |
| - |
| } // namespace shill_stub_helper |
| } // namespace chromeos |