summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc7
-rw-r--r--chrome/browser/chromeos/login/managed/managed_user_test_base.cc3
-rw-r--r--chrome/browser/chromeos/login/screens/update_screen_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/login/test/oobe_base_test.cc3
-rw-r--r--chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/login/wizard_controller_browsertest.cc16
-rw-r--r--chrome/browser/chromeos/net/network_portal_detector_test_impl.cc13
-rw-r--r--chrome/browser/chromeos/net/network_portal_detector_test_impl.h3
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_apitest.cc6
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc9
-rw-r--r--chrome/test/data/extensions/api_test/networking/test.js78
-rw-r--r--components/wifi/fake_wifi_service.cc4
12 files changed, 80 insertions, 68 deletions
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index c08dcfd..36b1bcb 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -229,15 +229,18 @@ class ServicesCustomizationDocumentTest : public testing::Test {
DBusThreadManager::InitializeWithStub();
NetworkHandler::Initialize();
RunUntilIdle();
+ const NetworkState* default_network =
+ NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
std::string default_network_path =
- NetworkHandler::Get()->network_state_handler()->default_network_path();
+ default_network ? default_network->path() : "";
NetworkPortalDetector::InitializeForTesting(&network_portal_detector_);
NetworkPortalDetector::CaptivePortalState online_state;
online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
online_state.response_code = 204;
network_portal_detector_.SetDefaultNetworkPathForTesting(
- default_network_path);
+ default_network_path,
+ default_network ? default_network->guid() : "");
network_portal_detector_.SetDetectionResultsForTesting(
default_network_path, online_state);
diff --git a/chrome/browser/chromeos/login/managed/managed_user_test_base.cc b/chrome/browser/chromeos/login/managed/managed_user_test_base.cc
index 2ff6e11..5a23e1f 100644
--- a/chrome/browser/chromeos/login/managed/managed_user_test_base.cc
+++ b/chrome/browser/chromeos/login/managed/managed_user_test_base.cc
@@ -195,7 +195,8 @@ void ManagedUserTestBase::SetUpInProcessBrowserTestFixture() {
online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
online_state.response_code = 204;
network_portal_detector_->SetDefaultNetworkPathForTesting(
- kStubEthernetServicePath);
+ kStubEthernetServicePath,
+ kStubEthernetServicePath /* guid */);
network_portal_detector_->SetDetectionResultsForTesting(
kStubEthernetServicePath, online_state);
}
diff --git a/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc
index e87148d..170bfe8 100644
--- a/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc
@@ -105,7 +105,8 @@ class UpdateScreenTest : public WizardInProcessBrowserTest {
void SetDefaultNetworkPath(const std::string& service_path) {
DCHECK(network_portal_detector_);
network_portal_detector_->SetDefaultNetworkPathForTesting(
- service_path);
+ service_path,
+ service_path /* guid */);
}
void SetDetectionResults(
diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.cc b/chrome/browser/chromeos/login/test/oobe_base_test.cc
index 5ae1255..583a3eb9 100644
--- a/chrome/browser/chromeos/login/test/oobe_base_test.cc
+++ b/chrome/browser/chromeos/login/test/oobe_base_test.cc
@@ -58,7 +58,8 @@ void OobeBaseTest::SetUpInProcessBrowserTestFixture() {
network_portal_detector_ = new NetworkPortalDetectorTestImpl();
NetworkPortalDetector::InitializeForTesting(network_portal_detector_);
network_portal_detector_->SetDefaultNetworkPathForTesting(
- FakeShillManagerClient::kFakeEthernetNetworkPath);
+ FakeShillManagerClient::kFakeEthernetNetworkPath,
+ FakeShillManagerClient::kFakeEthernetNetworkPath /* guid */);
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
}
diff --git a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc
index 2ee8b55..68c995c 100644
--- a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc
+++ b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc
@@ -188,7 +188,8 @@ class CaptivePortalWindowCtorDtorTest : public LoginManagerTest {
portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
portal_state.response_code = 200;
network_portal_detector_->SetDefaultNetworkPathForTesting(
- FakeShillManagerClient::kFakeEthernetNetworkPath);
+ FakeShillManagerClient::kFakeEthernetNetworkPath,
+ FakeShillManagerClient::kFakeEthernetNetworkPath /* guid */);
network_portal_detector_->SetDetectionResultsForTesting(
FakeShillManagerClient::kFakeEthernetNetworkPath, portal_state);
}
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index eae2402..fbf07b5 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -427,16 +427,16 @@ class WizardControllerFlowTest : public WizardControllerTest {
NetworkPortalDetector::CaptivePortalState online_state;
online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
online_state.response_code = 204;
+
+ // Default detworks happens to be usually "eth1" in tests.
+ const NetworkState* default_network =
+ NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
+
network_portal_detector_->SetDefaultNetworkPathForTesting(
- NetworkHandler::Get()
- ->network_state_handler()
- ->DefaultNetwork()
- ->path());
+ default_network->path(),
+ default_network->guid());
network_portal_detector_->SetDetectionResultsForTesting(
- NetworkHandler::Get()
- ->network_state_handler()
- ->DefaultNetwork()
- ->path(),
+ default_network->path(),
online_state);
}
diff --git a/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc
index 2649eb5..7913514 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc
+++ b/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc
@@ -16,12 +16,17 @@ NetworkPortalDetectorTestImpl::~NetworkPortalDetectorTestImpl() {
}
void NetworkPortalDetectorTestImpl::SetDefaultNetworkPathForTesting(
- const std::string& service_path) {
- DVLOG(1) << "SetDefaultNetworkPathForTesting: " << service_path;
- if (service_path.empty())
+ const std::string& service_path,
+ const std::string& guid) {
+ DVLOG(1) << "SetDefaultNetworkPathForTesting:"
+ << " service path: " << service_path
+ << " guid: " << guid;
+ if (service_path.empty()) {
default_network_.reset();
- else
+ } else {
default_network_.reset(new NetworkState(service_path));
+ default_network_->SetGuid(guid);
+ }
}
void NetworkPortalDetectorTestImpl::SetDetectionResultsForTesting(
diff --git a/chrome/browser/chromeos/net/network_portal_detector_test_impl.h b/chrome/browser/chromeos/net/network_portal_detector_test_impl.h
index a176ba2..9cbb45a 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_test_impl.h
+++ b/chrome/browser/chromeos/net/network_portal_detector_test_impl.h
@@ -21,7 +21,8 @@ class NetworkPortalDetectorTestImpl : public NetworkPortalDetector {
NetworkPortalDetectorTestImpl();
virtual ~NetworkPortalDetectorTestImpl();
- void SetDefaultNetworkPathForTesting(const std::string& service_path);
+ void SetDefaultNetworkPathForTesting(const std::string& service_path,
+ const std::string& guid);
void SetDetectionResultsForTesting(const std::string& service_path,
const CaptivePortalState& state);
void NotifyObserversForTesting();
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
index d3b644d..2a0530f4 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -237,7 +237,7 @@ class ExtensionNetworkingPrivateApiTest
const bool add_to_visible = true;
// Tests need a known GUID, so use 'service_path'.
service_test_->AddServiceWithIPConfig(
- service_path, service_path /* guid */, name,
+ service_path, service_path + "_GUID" /* guid */, name,
type, state, "" /* ipconfig_path */,
add_to_visible);
}
@@ -327,7 +327,7 @@ class ExtensionNetworkingPrivateApiTest
AddService("stub_wifi2", "wifi2_PSK", shill::kTypeWifi, shill::kStateIdle);
service_test_->SetServiceProperty("stub_wifi2",
shill::kGuidProperty,
- base::StringValue("stub_wifi2"));
+ base::StringValue("stub_wifi2_GUID"));
service_test_->SetServiceProperty("stub_wifi2",
shill::kSecurityProperty,
base::StringValue(shill::kSecurityPsk));
@@ -610,7 +610,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest,
IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest,
CaptivePortalNotification) {
- detector()->SetDefaultNetworkPathForTesting("wifi");
+ detector()->SetDefaultNetworkPathForTesting("wifi", "wifi_GUID");
NetworkPortalDetector::CaptivePortalState state;
state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
detector()->SetDetectionResultsForTesting("wifi", state);
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
index 73f3a63..786690a 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_event_router_chromeos.cc
@@ -159,10 +159,7 @@ void NetworkingPrivateEventRouterImpl::NetworkListChanged() {
networks.begin();
iter != networks.end();
++iter) {
- // TODO(gspencer): Currently the "GUID" is actually the service path. Fix
- // this to be the real GUID once we're using
- // ManagedNetworkConfigurationManager.
- changes.push_back((*iter)->path());
+ changes.push_back((*iter)->guid());
}
scoped_ptr<base::ListValue> args(
@@ -185,7 +182,7 @@ void NetworkingPrivateEventRouterImpl::NetworkPropertiesUpdated(
network->path());
scoped_ptr<base::ListValue> args(
api::networking_private::OnNetworksChanged::Create(
- std::vector<std::string>(1, network->path())));
+ std::vector<std::string>(1, network->guid())));
scoped_ptr<Event> extension_event(new Event(
api::networking_private::OnNetworksChanged::kEventName, args.Pass()));
event_router->BroadcastEvent(extension_event.Pass());
@@ -194,7 +191,7 @@ void NetworkingPrivateEventRouterImpl::NetworkPropertiesUpdated(
void NetworkingPrivateEventRouterImpl::OnPortalDetectionCompleted(
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalState& state) {
- const std::string path = network ? network->path() : std::string();
+ const std::string path = network ? network->guid() : std::string();
EventRouter* event_router = EventRouter::Get(profile_);
if (!event_router->HasEventListener(
diff --git a/chrome/test/data/extensions/api_test/networking/test.js b/chrome/test/data/extensions/api_test/networking/test.js
index 0b25357..28a7de1 100644
--- a/chrome/test/data/extensions/api_test/networking/test.js
+++ b/chrome/test/data/extensions/api_test/networking/test.js
@@ -74,13 +74,14 @@ var privateHelpers = {
var availableTests = [
function startConnect() {
- chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass());
+ chrome.networkingPrivate.startConnect("stub_wifi2_GUID", callbackPass());
},
function startDisconnect() {
// Must connect to a network before we can disconnect from it.
- chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass(
+ chrome.networkingPrivate.startConnect("stub_wifi2_GUID", callbackPass(
function() {
- chrome.networkingPrivate.startDisconnect("stub_wifi2", callbackPass());
+ chrome.networkingPrivate.startDisconnect("stub_wifi2_GUID",
+ callbackPass());
}));
},
function startConnectNonexistent() {
@@ -129,7 +130,7 @@ var availableTests = [
assertEq([{
"Connectable": true,
"ConnectionState": "Connected",
- "GUID": "stub_wifi1",
+ "GUID": "stub_wifi1_GUID",
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
@@ -137,7 +138,7 @@ var availableTests = [
"SignalStrength": 40
}
}, {
- "GUID": "stub_wifi2",
+ "GUID": "stub_wifi2_GUID",
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
@@ -152,7 +153,7 @@ var availableTests = [
assertEq([{
"Connectable": true,
"ConnectionState": "Connected",
- "GUID": "stub_wifi1",
+ "GUID": "stub_wifi1_GUID",
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
@@ -170,7 +171,7 @@ var availableTests = [
"Ethernet": {
"Authentication": "None"
},
- "GUID": "stub_ethernet",
+ "GUID": "stub_ethernet_GUID",
"Name": "eth0",
"Type": "Ethernet"
}], result);
@@ -187,14 +188,14 @@ var availableTests = [
"Ethernet": {
"Authentication": "None"
},
- "GUID": "stub_ethernet",
+ "GUID": "stub_ethernet_GUID",
"Name": "eth0",
"Type": "Ethernet"
},
{
"Connectable": true,
"ConnectionState": "Connected",
- "GUID": "stub_wifi1",
+ "GUID": "stub_wifi1_GUID",
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
@@ -204,14 +205,14 @@ var availableTests = [
},
{
"ConnectionState": "Connected",
- "GUID": "stub_vpn1",
+ "GUID": "stub_vpn1_GUID",
"Name": "vpn1",
"Type": "VPN"
},
{
"Connectable": true,
"ConnectionState": "NotConnected",
- "GUID": "stub_wifi2",
+ "GUID": "stub_wifi2_GUID",
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
@@ -228,7 +229,7 @@ var availableTests = [
assertEq([{
"Connectable": true,
"ConnectionState": "Connected",
- "GUID": "stub_wifi1",
+ "GUID": "stub_wifi1_GUID",
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
@@ -239,7 +240,7 @@ var availableTests = [
{
"Connectable": true,
"ConnectionState": "NotConnected",
- "GUID": "stub_wifi2",
+ "GUID": "stub_wifi2_GUID",
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
@@ -252,10 +253,10 @@ var availableTests = [
},
function requestNetworkScan() {
// Connected or Connecting networks should be listed first, sorted by type.
- var expected = ["stub_ethernet",
- "stub_wifi1",
- "stub_vpn1",
- "stub_wifi2"];
+ var expected = ["stub_ethernet_GUID",
+ "stub_wifi1_GUID",
+ "stub_vpn1_GUID",
+ "stub_wifi2_GUID"];
var done = chrome.test.callbackAdded();
var listener = new privateHelpers.listListener(expected, done);
chrome.networkingPrivate.onNetworkListChanged.addListener(
@@ -264,11 +265,11 @@ var availableTests = [
},
function getProperties() {
chrome.networkingPrivate.getProperties(
- "stub_wifi1",
+ "stub_wifi1_GUID",
callbackPass(function(result) {
assertEq({ "Connectable": true,
"ConnectionState": "Connected",
- "GUID": "stub_wifi1",
+ "GUID": "stub_wifi1_GUID",
"MacAddress": "00:11:22:AA:BB:CC",
"IPConfigs": [{
"Gateway": "0.0.0.1",
@@ -290,7 +291,7 @@ var availableTests = [
},
function getPropertiesCellular() {
chrome.networkingPrivate.getProperties(
- "stub_cellular1",
+ "stub_cellular1_GUID",
callbackPass(function(result) {
assertEq({ "Cellular": {
"ActivationState": "not-activated",
@@ -304,7 +305,7 @@ var availableTests = [
"RoamingState": "home"
},
"ConnectionState": "NotConnected",
- "GUID": "stub_cellular1",
+ "GUID": "stub_cellular1_GUID",
"Name": "cellular1",
"Type": "Cellular"
}, result);
@@ -372,7 +373,7 @@ var availableTests = [
},
function setProperties() {
var done = chrome.test.callbackAdded();
- var network_guid = "stub_wifi2";
+ var network_guid = "stub_wifi2_GUID";
chrome.networkingPrivate.getProperties(
network_guid,
callbackPass(function(result) {
@@ -396,12 +397,12 @@ var availableTests = [
},
function getState() {
chrome.networkingPrivate.getState(
- "stub_wifi2",
+ "stub_wifi2_GUID",
callbackPass(function(result) {
assertEq({
"Connectable": true,
"ConnectionState": "NotConnected",
- "GUID": "stub_wifi2",
+ "GUID": "stub_wifi2_GUID",
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
@@ -417,7 +418,7 @@ var availableTests = [
callbackFail('Error.InvalidNetworkGuid'));
},
function onNetworksChangedEventConnect() {
- var network = "stub_wifi2";
+ var network = "stub_wifi2_GUID";
var done = chrome.test.callbackAdded();
var expectedStates = ["Connected"];
var listener =
@@ -425,7 +426,7 @@ var availableTests = [
chrome.networkingPrivate.startConnect(network, callbackPass());
},
function onNetworksChangedEventDisconnect() {
- var network = "stub_wifi1";
+ var network = "stub_wifi1_GUID";
var done = chrome.test.callbackAdded();
var expectedStates = ["NotConnected"];
var listener =
@@ -435,15 +436,15 @@ var availableTests = [
function onNetworkListChangedEvent() {
// Connecting to wifi2 should set wifi1 to offline. Connected or Connecting
// networks should be listed first, sorted by type.
- var expected = ["stub_ethernet",
- "stub_wifi2",
- "stub_vpn1",
- "stub_wifi1"];
+ var expected = ["stub_ethernet_GUID",
+ "stub_wifi2_GUID",
+ "stub_vpn1_GUID",
+ "stub_wifi1_GUID"];
var done = chrome.test.callbackAdded();
var listener = new privateHelpers.listListener(expected, done);
chrome.networkingPrivate.onNetworkListChanged.addListener(
listener.listenForChanges);
- var network = "stub_wifi2";
+ var network = "stub_wifi2_GUID";
chrome.networkingPrivate.startConnect(network, callbackPass());
},
function verifyDestination() {
@@ -454,7 +455,7 @@ var availableTests = [
}));
},
function verifyAndEncryptCredentials() {
- var network_guid = "stub_wifi2";
+ var network_guid = "stub_wifi2_GUID";
chrome.networkingPrivate.verifyAndEncryptCredentials(
verificationProperties,
network_guid,
@@ -486,11 +487,11 @@ var availableTests = [
}));
},
function getCaptivePortalStatus() {
- var networks = [['stub_ethernet', 'Online'],
- ['stub_wifi1', 'Offline'],
- ['stub_wifi2', 'Portal'],
- ['stub_cellular1', 'ProxyAuthRequired'],
- ['stub_vpn1', 'Unknown']];
+ var networks = [['stub_ethernet_GUID', 'Online'],
+ ['stub_wifi1_GUID', 'Offline'],
+ ['stub_wifi2_GUID', 'Portal'],
+ ['stub_cellular1_GUID', 'ProxyAuthRequired'],
+ ['stub_vpn1_GUID', 'Unknown']];
networks.forEach(function(network) {
var servicePath = network[0];
var expectedStatus = network[1];
@@ -504,7 +505,8 @@ var availableTests = [
function captivePortalNotification() {
var done = chrome.test.callbackAdded();
var listener =
- new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done);
+ new privateHelpers.watchForCaptivePortalState(
+ 'wifi_GUID', 'Online', done);
chrome.test.sendMessage('notifyPortalDetectorObservers');
},
];
diff --git a/components/wifi/fake_wifi_service.cc b/components/wifi/fake_wifi_service.cc
index 91b2d3e..3be2af5 100644
--- a/components/wifi/fake_wifi_service.cc
+++ b/components/wifi/fake_wifi_service.cc
@@ -16,7 +16,7 @@ FakeWiFiService::FakeWiFiService() {
{
NetworkProperties network_properties;
network_properties.connection_state = onc::connection_state::kConnected;
- network_properties.guid = "stub_wifi1";
+ network_properties.guid = "stub_wifi1_GUID";
network_properties.name = "wifi1";
network_properties.type = onc::network_type::kWiFi;
network_properties.frequency = 0;
@@ -42,7 +42,7 @@ FakeWiFiService::FakeWiFiService() {
{
NetworkProperties network_properties;
network_properties.connection_state = onc::connection_state::kNotConnected;
- network_properties.guid = "stub_wifi2";
+ network_properties.guid = "stub_wifi2_GUID";
network_properties.name = "wifi2_PSK";
network_properties.type = onc::network_type::kWiFi;
network_properties.frequency = 5000;