OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chromeos/login/user.h" | 8 #include "chrome/browser/chromeos/login/user.h" |
9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
| 10 #include "chrome/browser/extensions/api/networking_private/networking_private_pr
ocess_client.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/policy/browser_policy_connector.h" | 12 #include "chrome/browser/policy/browser_policy_connector.h" |
12 #include "chrome/browser/policy/external_data_fetcher.h" | 13 #include "chrome/browser/policy/external_data_fetcher.h" |
13 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 14 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
14 #include "chrome/browser/policy/policy_map.h" | 15 #include "chrome/browser/policy/policy_map.h" |
15 #include "chrome/browser/policy/policy_types.h" | 16 #include "chrome/browser/policy/policy_types.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
18 | 19 |
19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 214 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
214 ExtensionApiTest::SetUpCommandLine(command_line); | 215 ExtensionApiTest::SetUpCommandLine(command_line); |
215 // Whitelist the extension ID of the test extension. | 216 // Whitelist the extension ID of the test extension. |
216 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, | 217 command_line->AppendSwitchASCII(::switches::kWhitelistedExtensionID, |
217 "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 218 "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
218 } | 219 } |
219 | 220 |
220 virtual void SetUpOnMainThread() OVERRIDE { | 221 virtual void SetUpOnMainThread() OVERRIDE { |
221 ExtensionApiTest::SetUpOnMainThread(); | 222 ExtensionApiTest::SetUpOnMainThread(); |
222 content::RunAllPendingInMessageLoop(); | 223 content::RunAllPendingInMessageLoop(); |
| 224 base::DictionaryValue mock_parameters; |
| 225 scoped_refptr<extensions::NetworkingPrivateProcessClient> process_client( |
| 226 extensions::NetworkingPrivateProcessClient::GetProcessClientForProfile( |
| 227 profile())); |
| 228 // Prevent shutdown between calls. |
| 229 process_client->HaveEventsListeners(true); |
| 230 process_client->UseWiFiServiceMock(mock_parameters); |
223 } | 231 } |
224 #endif // OS_CHROMEOS | 232 #endif // OS_CHROMEOS |
225 | 233 |
226 protected: | 234 protected: |
227 policy::MockConfigurationPolicyProvider provider_; | 235 policy::MockConfigurationPolicyProvider provider_; |
228 std::string userhash_; | 236 std::string userhash_; |
229 }; | 237 }; |
230 | 238 |
231 // Place each subtest into a separate browser test so that the stub networking | 239 // Place each subtest into a separate browser test so that the stub networking |
232 // library state is reset for each subtest run. This way they won't affect each | 240 // library state is reset for each subtest run. This way they won't affect each |
(...skipping 16 matching lines...) Expand all Loading... |
249 StartDisconnectNonexistent) { | 257 StartDisconnectNonexistent) { |
250 EXPECT_TRUE(RunNetworkingSubtest("startDisconnectNonexistent")) << message_; | 258 EXPECT_TRUE(RunNetworkingSubtest("startDisconnectNonexistent")) << message_; |
251 } | 259 } |
252 | 260 |
253 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 261 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
254 StartGetPropertiesNonexistent) { | 262 StartGetPropertiesNonexistent) { |
255 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) | 263 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) |
256 << message_; | 264 << message_; |
257 } | 265 } |
258 | 266 |
259 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, CreateNetwork) { | |
260 EXPECT_TRUE(RunNetworkingSubtest("createNetwork")) << message_; | |
261 } | |
262 | |
263 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { | 267 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { |
264 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; | 268 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; |
265 } | 269 } |
266 | 270 |
267 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 271 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
268 GetVisibleNetworksWifi) { | 272 GetVisibleNetworksWifi) { |
269 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworksWifi")) << message_; | 273 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworksWifi")) << message_; |
270 } | 274 } |
271 | 275 |
272 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, RequestNetworkScan) { | 276 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, RequestNetworkScan) { |
273 EXPECT_TRUE(RunNetworkingSubtest("requestNetworkScan")) << message_; | 277 EXPECT_TRUE(RunNetworkingSubtest("requestNetworkScan")) << message_; |
274 } | 278 } |
275 | 279 |
276 // Properties are filtered and translated through | 280 // Properties are filtered and translated through |
277 // ShillToONCTranslator::TranslateWiFiWithState | 281 // ShillToONCTranslator::TranslateWiFiWithState |
278 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetProperties) { | 282 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetProperties) { |
279 EXPECT_TRUE(RunNetworkingSubtest("getProperties")) << message_; | 283 EXPECT_TRUE(RunNetworkingSubtest("getProperties")) << message_; |
280 } | 284 } |
281 | 285 |
282 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetState) { | 286 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetState) { |
283 EXPECT_TRUE(RunNetworkingSubtest("getState")) << message_; | 287 EXPECT_TRUE(RunNetworkingSubtest("getState")) << message_; |
284 } | 288 } |
285 | 289 |
286 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, SetProperties) { | 290 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, SetProperties) { |
287 EXPECT_TRUE(RunNetworkingSubtest("setProperties")) << message_; | 291 EXPECT_TRUE(RunNetworkingSubtest("setProperties")) << message_; |
288 } | 292 } |
289 | 293 |
290 #if defined(OS_CHROMEOS) | 294 #if defined(OS_CHROMEOS) |
| 295 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, CreateNetwork) { |
| 296 EXPECT_TRUE(RunNetworkingSubtest("createNetwork")) << message_; |
| 297 } |
| 298 |
291 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetStateNonExistent) { | 299 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetStateNonExistent) { |
292 EXPECT_TRUE(RunNetworkingSubtest("getStateNonExistent")) << message_; | 300 EXPECT_TRUE(RunNetworkingSubtest("getStateNonExistent")) << message_; |
293 } | 301 } |
294 | 302 |
295 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 303 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
296 GetManagedProperties) { | 304 GetManagedProperties) { |
297 ShillServiceClient::TestInterface* service_test = | 305 ShillServiceClient::TestInterface* service_test = |
298 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 306 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
299 const std::string uidata_blob = | 307 const std::string uidata_blob = |
300 "{ \"user_settings\": {" | 308 "{ \"user_settings\": {" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 384 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
377 VerifyAndEncryptData) { | 385 VerifyAndEncryptData) { |
378 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; | 386 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; |
379 } | 387 } |
380 | 388 |
381 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, | 389 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, |
382 ExtensionNetworkingPrivateApiTest, | 390 ExtensionNetworkingPrivateApiTest, |
383 testing::Bool()); | 391 testing::Bool()); |
384 | 392 |
385 } // namespace chromeos | 393 } // namespace chromeos |
OLD | NEW |