| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" | 9 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/local_discovery/gcd_api_flow.h" | 12 #include "chrome/browser/local_discovery/gcd_api_flow.h" |
| 13 #include "chrome/browser/local_discovery/wifi/mock_wifi_manager.h" | 13 #include "chrome/browser/local_discovery/wifi/mock_wifi_manager.h" |
| 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/extensions/api/mdns.h" | 15 #include "chrome/common/extensions/api/mdns.h" |
| 15 #include "extensions/common/switches.h" | 16 #include "extensions/common/switches.h" |
| 16 #include "net/url_request/test_url_fetcher_factory.h" | 17 #include "net/url_request/test_url_fetcher_factory.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 | 19 |
| 19 #if defined(ENABLE_MDNS) | 20 #if defined(ENABLE_MDNS) |
| 20 #include "chrome/browser/local_discovery/test_service_discovery_client.h" | 21 #include "chrome/browser/local_discovery/test_service_discovery_client.h" |
| 21 #endif // ENABLE_MDNS | 22 #endif // ENABLE_MDNS |
| 22 | 23 |
| 23 namespace api = extensions::api; | 24 namespace api = extensions::api; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 class GcdPrivateAPITest : public ExtensionApiTest { | 221 class GcdPrivateAPITest : public ExtensionApiTest { |
| 221 public: | 222 public: |
| 222 GcdPrivateAPITest() : url_fetcher_factory_(&url_fetcher_impl_factory_) { | 223 GcdPrivateAPITest() : url_fetcher_factory_(&url_fetcher_impl_factory_) { |
| 223 } | 224 } |
| 224 | 225 |
| 225 void SetUpCommandLine(base::CommandLine* command_line) override { | 226 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 226 ExtensionApiTest::SetUpCommandLine(command_line); | 227 ExtensionApiTest::SetUpCommandLine(command_line); |
| 227 command_line->AppendSwitchASCII( | 228 command_line->AppendSwitchASCII( |
| 228 extensions::switches::kWhitelistedExtensionID, | 229 extensions::switches::kWhitelistedExtensionID, |
| 229 "ddchlicdkolnonkihahngkmmmjnjlkkf"); | 230 "ddchlicdkolnonkihahngkmmmjnjlkkf"); |
| 231 command_line->AppendSwitch(switches::kEnablePrivetV3); |
| 230 } | 232 } |
| 231 | 233 |
| 232 protected: | 234 protected: |
| 233 FakeGCDApiFlowFactory api_flow_factory_; | 235 FakeGCDApiFlowFactory api_flow_factory_; |
| 234 net::URLFetcherImplFactory url_fetcher_impl_factory_; | 236 net::URLFetcherImplFactory url_fetcher_impl_factory_; |
| 235 net::FakeURLFetcherFactory url_fetcher_factory_; | 237 net::FakeURLFetcherFactory url_fetcher_factory_; |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, GetCloudList) { | 240 IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, GetCloudList) { |
| 239 api_flow_factory_.SetResponse( | 241 api_flow_factory_.SetResponse( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (ExtensionSubtestsAreSkipped()) | 365 if (ExtensionSubtestsAreSkipped()) |
| 364 return; | 366 return; |
| 365 EXPECT_CALL(wifi_manager_factory_, WifiManagerCreated()) | 367 EXPECT_CALL(wifi_manager_factory_, WifiManagerCreated()) |
| 366 .WillOnce(Invoke(this, &GcdPrivateWithWifiAPITest::OnCreateWifiManager)); | 368 .WillOnce(Invoke(this, &GcdPrivateWithWifiAPITest::OnCreateWifiManager)); |
| 367 | 369 |
| 368 EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "wifi_password.html")); | 370 EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "wifi_password.html")); |
| 369 } | 371 } |
| 370 #endif // ENABLE_WIFI_BOOTSTRAPPING | 372 #endif // ENABLE_WIFI_BOOTSTRAPPING |
| 371 | 373 |
| 372 } // namespace | 374 } // namespace |
| OLD | NEW |