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 <memory> |
5 #include <utility> | 6 #include <utility> |
6 | 7 |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/callback.h" | 9 #include "base/callback.h" |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" | 13 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" |
14 #include "chrome/browser/extensions/extension_apitest.h" | 14 #include "chrome/browser/extensions/extension_apitest.h" |
15 #include "components/user_manager/user.h" | 15 #include "components/user_manager/user.h" |
16 #include "components/user_manager/user_manager.h" | 16 #include "components/user_manager/user_manager.h" |
17 #include "components/wifi/fake_wifi_service.h" | 17 #include "components/wifi/fake_wifi_service.h" |
18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
19 #include "extensions/browser/api/networking_private/networking_private_delegate_
factory.h" | 19 #include "extensions/browser/api/networking_private/networking_private_delegate_
factory.h" |
20 #include "extensions/browser/api/networking_private/networking_private_event_rou
ter.h" | 20 #include "extensions/browser/api/networking_private/networking_private_event_rou
ter.h" |
21 #include "extensions/browser/api/networking_private/networking_private_event_rou
ter_factory.h" | 21 #include "extensions/browser/api/networking_private/networking_private_event_rou
ter_factory.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 void SetUpCommandLine(base::CommandLine* command_line) override { | 81 void SetUpCommandLine(base::CommandLine* command_line) override { |
82 ExtensionApiTest::SetUpCommandLine(command_line); | 82 ExtensionApiTest::SetUpCommandLine(command_line); |
83 // Whitelist the extension ID of the test extension. | 83 // Whitelist the extension ID of the test extension. |
84 command_line->AppendSwitchASCII( | 84 command_line->AppendSwitchASCII( |
85 extensions::switches::kWhitelistedExtensionID, | 85 extensions::switches::kWhitelistedExtensionID, |
86 "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 86 "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
87 } | 87 } |
88 | 88 |
89 static scoped_ptr<KeyedService> CreateNetworkingPrivateServiceClient( | 89 static std::unique_ptr<KeyedService> CreateNetworkingPrivateServiceClient( |
90 content::BrowserContext* context) { | 90 content::BrowserContext* context) { |
91 scoped_ptr<wifi::FakeWiFiService> wifi_service(new wifi::FakeWiFiService()); | 91 std::unique_ptr<wifi::FakeWiFiService> wifi_service( |
92 scoped_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub); | 92 new wifi::FakeWiFiService()); |
93 return scoped_ptr<KeyedService>(new NetworkingPrivateServiceClient( | 93 std::unique_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub); |
| 94 return std::unique_ptr<KeyedService>(new NetworkingPrivateServiceClient( |
94 std::move(wifi_service), std::move(crypto_verify))); | 95 std::move(wifi_service), std::move(crypto_verify))); |
95 } | 96 } |
96 | 97 |
97 void SetUpOnMainThread() override { | 98 void SetUpOnMainThread() override { |
98 ExtensionApiTest::SetUpOnMainThread(); | 99 ExtensionApiTest::SetUpOnMainThread(); |
99 content::RunAllPendingInMessageLoop(); | 100 content::RunAllPendingInMessageLoop(); |
100 NetworkingPrivateDelegateFactory::GetInstance()->SetTestingFactory( | 101 NetworkingPrivateDelegateFactory::GetInstance()->SetTestingFactory( |
101 profile(), &CreateNetworkingPrivateServiceClient); | 102 profile(), &CreateNetworkingPrivateServiceClient); |
102 } | 103 } |
103 | 104 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 VerifyAndEncryptCredentials) { | 213 VerifyAndEncryptCredentials) { |
213 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptCredentials")) << message_; | 214 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptCredentials")) << message_; |
214 } | 215 } |
215 | 216 |
216 IN_PROC_BROWSER_TEST_F(NetworkingPrivateServiceClientApiTest, | 217 IN_PROC_BROWSER_TEST_F(NetworkingPrivateServiceClientApiTest, |
217 VerifyAndEncryptData) { | 218 VerifyAndEncryptData) { |
218 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; | 219 EXPECT_TRUE(RunNetworkingSubtest("verifyAndEncryptData")) << message_; |
219 } | 220 } |
220 | 221 |
221 } // namespace | 222 } // namespace |
OLD | NEW |