| Index: chrome/browser/chromeos/extensions/networking_private_apitest.cc
|
| diff --git a/chrome/browser/chromeos/extensions/networking_private_apitest.cc b/chrome/browser/chromeos/extensions/networking_private_apitest.cc
|
| index f823111c451b82284e07d9e6d925b592d28fbf76..fe897bb551658769b47f53942ffb7dcc1be9a213 100644
|
| --- a/chrome/browser/chromeos/extensions/networking_private_apitest.cc
|
| +++ b/chrome/browser/chromeos/extensions/networking_private_apitest.cc
|
| @@ -10,11 +10,18 @@
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
| #include "chromeos/dbus/shill_device_client.h"
|
| +#include "chromeos/dbus/shill_profile_client.h"
|
| #include "chromeos/dbus/shill_service_client.h"
|
| +#include "chromeos/network/managed_network_configuration_handler.h"
|
| +#include "chromeos/network/onc/onc_constants.h"
|
| +#include "chromeos/network/onc/onc_utils.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| namespace chromeos {
|
|
|
| +const char kSharedProfilePath[] = "/profile/default";
|
| +const char kUserProfilePath[] = "/profile/chronos/shill";
|
| +
|
| class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest {
|
| public:
|
| // Whitelist the extension ID of the test extension.
|
| @@ -61,6 +68,9 @@ class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest {
|
| flimflam::kTypeWifi, flimflam::kStateIdle,
|
| add_to_watchlist);
|
| service_test->SetServiceProperty("stub_wifi2",
|
| + flimflam::kGuidProperty,
|
| + base::StringValue("stub_wifi2"));
|
| + service_test->SetServiceProperty("stub_wifi2",
|
| flimflam::kSecurityProperty,
|
| base::StringValue(flimflam::kSecurityPsk));
|
| service_test->SetServiceProperty("stub_wifi2",
|
| @@ -146,6 +156,70 @@ IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, SetProperties) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest,
|
| + GetManagedProperties) {
|
| + ShillServiceClient::TestInterface* service_test =
|
| + DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
|
| + const std::string uidata_blob =
|
| + "{ \"user_settings\": {"
|
| + " \"WiFi\": {"
|
| + " \"Passphrase\": \"top secret\","
|
| + " }"
|
| + " }"
|
| + "}";
|
| + service_test->SetServiceProperty("stub_wifi2",
|
| + flimflam::kGuidProperty,
|
| + base::StringValue("stub_wifi2"));
|
| + service_test->SetServiceProperty("stub_wifi2",
|
| + flimflam::kUIDataProperty,
|
| + base::StringValue(uidata_blob));
|
| + service_test->SetServiceProperty("stub_wifi2",
|
| + flimflam::kProfileProperty,
|
| + base::StringValue(kUserProfilePath));
|
| + service_test->SetServiceProperty("stub_wifi2",
|
| + flimflam::kAutoConnectProperty,
|
| + base::FundamentalValue(false));
|
| +
|
| + ShillProfileClient::TestInterface* profile_test =
|
| + DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
|
| +
|
| + profile_test->AddService("stub_wifi2");
|
| +
|
| + content::RunAllPendingInMessageLoop();
|
| +
|
| + const std::string user_policy_blob =
|
| + "{ \"NetworkConfigurations\": ["
|
| + " { \"GUID\": \"stub_wifi2\","
|
| + " \"Type\": \"WiFi\","
|
| + " \"Name\": \"My WiFi Network\","
|
| + " \"WiFi\": {"
|
| + " \"Passphrase\": \"passphrase\","
|
| + " \"Recommended\": [ \"AutoConnect\", \"Passphrase\" ],"
|
| + " \"SSID\": \"stub_wifi2\","
|
| + " \"Security\": \"WPA-PSK\""
|
| + " }"
|
| + " }"
|
| + " ],"
|
| + " \"Certificates\": [],"
|
| + " \"Type\": \"UnencryptedConfiguration\""
|
| + "}";
|
| + scoped_ptr<base::DictionaryValue> user_policy =
|
| + onc::ReadDictionaryFromJson(user_policy_blob);
|
| + ManagedNetworkConfigurationHandler::Get()->SetPolicy(
|
| + onc::ONC_SOURCE_USER_POLICY,
|
| + *user_policy);
|
| +
|
| + scoped_ptr<base::DictionaryValue> device_policy =
|
| + onc::ReadDictionaryFromJson(onc::kEmptyUnencryptedConfiguration);
|
| + ManagedNetworkConfigurationHandler::Get()->SetPolicy(
|
| + onc::ONC_SOURCE_DEVICE_POLICY,
|
| + *device_policy);
|
| +
|
| + content::RunAllPendingInMessageLoop();
|
| +
|
| + EXPECT_TRUE(RunNetworkingSubtest("getManagedProperties")) << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest,
|
| OnNetworksChangedEventConnect) {
|
| EXPECT_TRUE(RunNetworkingSubtest("onNetworksChangedEventConnect"))
|
| << message_;
|
|
|