New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 593196 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

chrome.networkingPrivate.createNetwork doesn't return GUID

Project Member Reported by cernekee@chromium.org, Mar 9 2016

Issue description

Per https://developer.chrome.com/extensions/networkingPrivate#method-createNetwork the callback function should be invoked with the GUID of the new connection.  Instead, it is invoked with the shill service name (e.g. "/service/161").  This isn't very helpful, because other functions like forgetNetwork() want to refer to networks using the GUID.
 
Good catch. You will need to do a lookup of service_path -> guid in a wrapper callback from NetworkingPrivateChromeOS::CreateNetwork().

Be careful - other code relies on NetworkConfigurationHandler::CreateShillConfiguration, and ManagedNetworkConfigurationHandlerImpl::CreateConfiguration, plus those classes mostly deal with service_path, so I would avoid making any changes there.

The mechanism for doing the translation is basically the inverse of GetServicePathFromGuid() in networking_private_chromeos.cc - look up NetworkState by service_path and use the guid() from there.

It is conceivable that there is an edge case where NetworkState does not exist yet since the callback is Run immediately and not posted:

https://code.google.com/p/chromium/codesearch#chromium/src/chromeos/network/network_configuration_handler.cc&q=NetworkConfigurationHandler::RunCreateNetworkCallback&sq=package:chromium&type=cs&l=399

So the DBus call to update the list of networks might still be waiting to be processed.

The simplest fix for that would be to post the callback instead of running it directly. Alternatively in networking_private_chromeos.cc the guid lookup could be deffered instead.

Feel free to ping me if you have any questions.

I noticed that the createNetwork() test in chrome/test/data/extensions/api_test/networking_private/chromeos/test.js is checking the GUID and should have caught this bug, but I couldn't figure out how to run the test.  This is what I tried:

export GYP_DEFINES="use_goma=1 chromeos=1 component=shared_library"
ninja -j1000 -C out/Debug browser_tests && ./out/Debug/browser_tests --disable-setuid-sandbox --gtest_filter="NetworkingPrivateApiTest.CreateNetwork"

This seems to run networking_private_apitest.cc, not networking_private_chromeos_apitest.cc.  If I change the former file to force the test to fail, the test does fail.  If I break the latter file, it doesn't fail.  Also, if I delete all of the code from test.js, the test still passes.

Is this operator error, or a symptom of a larger problem?
Once upon a time, "guid" and "service_path" were synonymous. Some tests may still play a bit fast and loose with them,

Both NetworkingPrivateApiTest and NetworkingPrivateChromeOSApiTest run on chromeos (the former tests just the API, the latter sets up a fake implementation and does more involved testing).

The filter for the chromeos tests would be "NetworkingPrivateApiTest.*"

It would be great to update that test to set "service_path" and "guid" to different values and ensure that the guid is indeed returned.

Status: Fixed (was: Started)
Project Member

Comment 5 by bugdroid1@chromium.org, Mar 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f1da84b10359d62c67a73e46da90b0d0510a0768

commit f1da84b10359d62c67a73e46da90b0d0510a0768
Author: cernekee <cernekee@chromium.org>
Date: Tue Mar 15 23:33:03 2016

Invoke createNetwork() callback with GUID, not service name

The current implementation doesn't match the API spec.  Fix this.

BUG= 593196 
TEST=go to chrome://settings/network , ctrl-shift-i, run in console:
     chrome.networkingPrivate.createNetwork(false,
         {"Type":"WiFi","WiFi":{"SSID":"GoogleGuest","AutoConnect":true}},
         function(x) { console.log(x); })

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

Cr-Commit-Position: refs/heads/master@{#381347}

[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chrome/browser/chromeos/login/helper.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chrome/browser/chromeos/login/helper.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chrome/browser/chromeos/net/onc_utils.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/managed_network_configuration_handler.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/managed_network_configuration_handler_impl.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/managed_network_configuration_handler_impl.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/mock_managed_network_configuration_handler.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/network_configuration_handler.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/network_configuration_handler.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/network_configuration_handler_unittest.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/chromeos/network/network_handler_callbacks.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/components/wifi_sync/wifi_config_delegate_chromeos.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/components/wifi_sync/wifi_config_delegate_chromeos_unittest.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/extensions/browser/api/networking_private/networking_private_chromeos.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/extensions/browser/api/vpn_provider/vpn_service.cc
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/extensions/browser/api/vpn_provider/vpn_service.h
[modify] https://crrev.com/f1da84b10359d62c67a73e46da90b0d0510a0768/ui/chromeos/network/network_connect.cc

Labels: VerifyIn-51
Status: Verified (was: Fixed)
Samus 8172.1.0. Tested as per comment#5. 

Sign in to add a comment