Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/extensions/api/networking_private/networking_private_apitest.cc

Issue 102993002: Implement Networking Private API VerifyAndEncryptCredentials method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address codereview comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 13 matching lines...) Expand all
24 #include "chromeos/network/onc/onc_utils.h" 24 #include "chromeos/network/onc/onc_utils.h"
25 #include "components/onc/onc_constants.h" 25 #include "components/onc/onc_constants.h"
26 #include "components/policy/core/browser/browser_policy_connector.h" 26 #include "components/policy/core/browser/browser_policy_connector.h"
27 #include "components/policy/core/common/external_data_fetcher.h" 27 #include "components/policy/core/common/external_data_fetcher.h"
28 #include "components/policy/core/common/mock_configuration_policy_provider.h" 28 #include "components/policy/core/common/mock_configuration_policy_provider.h"
29 #include "components/policy/core/common/policy_map.h" 29 #include "components/policy/core/common/policy_map.h"
30 #include "components/policy/core/common/policy_types.h" 30 #include "components/policy/core/common/policy_types.h"
31 #include "policy/policy_constants.h" 31 #include "policy/policy_constants.h"
32 #include "third_party/cros_system_api/dbus/service_constants.h" 32 #include "third_party/cros_system_api/dbus/service_constants.h"
33 #else // !defined(OS_CHROMEOS) 33 #else // !defined(OS_CHROMEOS)
34 #include "chrome/browser/extensions/api/networking_private/networking_private_cr edentials_getter.h"
34 #include "chrome/browser/extensions/api/networking_private/networking_private_se rvice_client.h" 35 #include "chrome/browser/extensions/api/networking_private/networking_private_se rvice_client.h"
35 #include "chrome/browser/extensions/api/networking_private/networking_private_se rvice_client_factory.h" 36 #include "chrome/browser/extensions/api/networking_private/networking_private_se rvice_client_factory.h"
36 #include "components/wifi/wifi_service.h" 37 #include "components/wifi/wifi_service.h"
37 #endif // defined(OS_CHROMEOS) 38 #endif // defined(OS_CHROMEOS)
38 39
39 using testing::Return; 40 using testing::Return;
40 using testing::_; 41 using testing::_;
41 42
42 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
43 using chromeos::CryptohomeClient; 44 using chromeos::CryptohomeClient;
44 using chromeos::DBUS_METHOD_CALL_SUCCESS; 45 using chromeos::DBUS_METHOD_CALL_SUCCESS;
45 using chromeos::DBusMethodCallStatus; 46 using chromeos::DBusMethodCallStatus;
46 using chromeos::DBusThreadManager; 47 using chromeos::DBusThreadManager;
47 using chromeos::ShillDeviceClient; 48 using chromeos::ShillDeviceClient;
48 using chromeos::ShillManagerClient; 49 using chromeos::ShillManagerClient;
49 using chromeos::ShillProfileClient; 50 using chromeos::ShillProfileClient;
50 using chromeos::ShillServiceClient; 51 using chromeos::ShillServiceClient;
51 #else // !defined(OS_CHROMEOS) 52 #else // !defined(OS_CHROMEOS)
53 using extensions::NetworkingPrivateCredentialsGetter;
52 using extensions::NetworkingPrivateServiceClientFactory; 54 using extensions::NetworkingPrivateServiceClientFactory;
53 #endif // defined(OS_CHROMEOS) 55 #endif // defined(OS_CHROMEOS)
54 56
55 namespace { 57 namespace {
56 58
57 #if defined(OS_CHROMEOS) 59 #if defined(OS_CHROMEOS)
58 const char kUser1ProfilePath[] = "/profile/user1/shill"; 60 const char kUser1ProfilePath[] = "/profile/user1/shill";
59 #else // !defined(OS_CHROMEOS) 61 #else // !defined(OS_CHROMEOS)
60 62
61 // Stub Verify* methods implementation to satisfy expectations of 63 // Stub Verify* methods implementation to satisfy expectations of
62 // networking_private_apitest. 64 // networking_private_apitest.
63 // TODO(mef): Fix ChromeOS implementation to use NetworkingPrivateCrypto, 65 // TODO(mef): Fix ChromeOS implementation to use NetworkingPrivateCrypto,
64 // and update networking_private_apitest to use and expect valid data. 66 // and update networking_private_apitest to use and expect valid data.
65 // That will eliminate the need for mock implementation. 67 // That will eliminate the need for mock implementation.
66 class CryptoVerifyStub 68 class CryptoVerifyStub
67 : public extensions::NetworkingPrivateServiceClient::CryptoVerify { 69 : public extensions::NetworkingPrivateServiceClient::CryptoVerify {
68 virtual void VerifyDestination(scoped_ptr<base::ListValue> args, 70 virtual void VerifyDestination(scoped_ptr<base::ListValue> args,
69 bool* verified, 71 bool* verified,
70 std::string* error) OVERRIDE { 72 std::string* error) OVERRIDE {
71 *verified = true; 73 *verified = true;
72 } 74 }
73 75
76 virtual void VerifyAndEncryptCredentials(
77 scoped_ptr<base::ListValue> args,
78 scoped_ptr<NetworkingPrivateCredentialsGetter> credentials_getter,
79 const extensions::NetworkingPrivateServiceClient::CryptoVerify::
80 VerifyAndEncryptCredentialsCallback& callback) OVERRIDE {
81 callback.Run("encrypted_credentials", "");
82 }
83
74 virtual void VerifyAndEncryptData(scoped_ptr<base::ListValue> args, 84 virtual void VerifyAndEncryptData(scoped_ptr<base::ListValue> args,
75 std::string* encoded_data, 85 std::string* encoded_data,
76 std::string* error) OVERRIDE { 86 std::string* error) OVERRIDE {
77 *encoded_data = "encrypted_data"; 87 *encoded_data = "encrypted_data";
78 } 88 }
79 }; 89 };
80 #endif // defined(OS_CHROMEOS) 90 #endif // defined(OS_CHROMEOS)
81 91
82 class ExtensionNetworkingPrivateApiTest : 92 class ExtensionNetworkingPrivateApiTest :
83 public ExtensionApiTest, 93 public ExtensionApiTest,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 GetWifiTDLSStatus) { 453 GetWifiTDLSStatus) {
444 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_; 454 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_;
445 } 455 }
446 #endif 456 #endif
447 457
448 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, 458 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation,
449 ExtensionNetworkingPrivateApiTest, 459 ExtensionNetworkingPrivateApiTest,
450 testing::Bool()); 460 testing::Bool());
451 461
452 } // namespace 462 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698