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 process_client->UseWiFiServiceMock(mock_parameters); | |
223 } | 229 } |
224 #endif // OS_CHROMEOS | 230 #endif // OS_CHROMEOS |
225 | 231 |
226 protected: | 232 protected: |
227 policy::MockConfigurationPolicyProvider provider_; | 233 policy::MockConfigurationPolicyProvider provider_; |
228 std::string userhash_; | 234 std::string userhash_; |
229 }; | 235 }; |
230 | 236 |
231 // Place each subtest into a separate browser test so that the stub networking | 237 // 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 | 238 // library state is reset for each subtest run. This way they won't affect each |
(...skipping 16 matching lines...) Expand all Loading... | |
249 StartDisconnectNonexistent) { | 255 StartDisconnectNonexistent) { |
250 EXPECT_TRUE(RunNetworkingSubtest("startDisconnectNonexistent")) << message_; | 256 EXPECT_TRUE(RunNetworkingSubtest("startDisconnectNonexistent")) << message_; |
251 } | 257 } |
252 | 258 |
253 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 259 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
254 StartGetPropertiesNonexistent) { | 260 StartGetPropertiesNonexistent) { |
255 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) | 261 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) |
256 << message_; | 262 << message_; |
257 } | 263 } |
258 | 264 |
259 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, CreateNetwork) { | |
260 EXPECT_TRUE(RunNetworkingSubtest("createNetwork")) << message_; | |
261 } | |
262 | |
263 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { | 265 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { |
264 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; | 266 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; |
265 } | 267 } |
266 | 268 |
267 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 269 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
268 GetVisibleNetworksWifi) { | 270 GetVisibleNetworksWifi) { |
269 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworksWifi")) << message_; | 271 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworksWifi")) << message_; |
270 } | 272 } |
271 | 273 |
272 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, RequestNetworkScan) { | 274 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, RequestNetworkScan) { |
273 EXPECT_TRUE(RunNetworkingSubtest("requestNetworkScan")) << message_; | 275 EXPECT_TRUE(RunNetworkingSubtest("requestNetworkScan")) << message_; |
274 } | 276 } |
275 | 277 |
276 // Properties are filtered and translated through | 278 // Properties are filtered and translated through |
277 // ShillToONCTranslator::TranslateWiFiWithState | 279 // ShillToONCTranslator::TranslateWiFiWithState |
278 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetProperties) { | 280 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetProperties) { |
279 EXPECT_TRUE(RunNetworkingSubtest("getProperties")) << message_; | 281 EXPECT_TRUE(RunNetworkingSubtest("getProperties")) << message_; |
280 } | 282 } |
281 | 283 |
282 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetState) { | 284 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetState) { |
283 EXPECT_TRUE(RunNetworkingSubtest("getState")) << message_; | 285 EXPECT_TRUE(RunNetworkingSubtest("getState")) << message_; |
284 } | 286 } |
285 | 287 |
286 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, SetProperties) { | 288 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, SetProperties) { |
287 EXPECT_TRUE(RunNetworkingSubtest("setProperties")) << message_; | 289 EXPECT_TRUE(RunNetworkingSubtest("setProperties")) << message_; |
288 } | 290 } |
289 | 291 |
290 #if defined(OS_CHROMEOS) | 292 #if defined(OS_CHROMEOS) |
cbentzel
2013/10/16 13:09:26
Does this test need to be ChromeOS only?
mef
2013/10/17 02:33:25
I believe so. There is no 'CreateNetwork' implemen
| |
293 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, CreateNetwork) { | |
294 EXPECT_TRUE(RunNetworkingSubtest("createNetwork")) << message_; | |
295 } | |
296 | |
291 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetStateNonExistent) { | 297 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, GetStateNonExistent) { |
292 EXPECT_TRUE(RunNetworkingSubtest("getStateNonExistent")) << message_; | 298 EXPECT_TRUE(RunNetworkingSubtest("getStateNonExistent")) << message_; |
293 } | 299 } |
294 | 300 |
295 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 301 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
296 GetManagedProperties) { | 302 GetManagedProperties) { |
297 ShillServiceClient::TestInterface* service_test = | 303 ShillServiceClient::TestInterface* service_test = |
298 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 304 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
299 const std::string uidata_blob = | 305 const std::string uidata_blob = |
300 "{ \"user_settings\": {" | 306 "{ \"user_settings\": {" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, | 382 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, |
377 VerifyAndEncryptData) { | 383 VerifyAndEncryptData) { |
378 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; | 384 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; |
379 } | 385 } |
380 | 386 |
381 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, | 387 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, |
382 ExtensionNetworkingPrivateApiTest, | 388 ExtensionNetworkingPrivateApiTest, |
383 testing::Bool()); | 389 testing::Bool()); |
384 | 390 |
385 } // namespace chromeos | 391 } // namespace chromeos |
OLD | NEW |