OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/extensions/api/enterprise_platform_keys_private/enterpr
ise_platform_keys_private_api.h" | 5 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterpr
ise_platform_keys_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 base::FundamentalValue(true)); | 175 base::FundamentalValue(true)); |
176 } | 176 } |
177 | 177 |
178 virtual ~EPKPChallengeKeyTestBase() { | 178 virtual ~EPKPChallengeKeyTestBase() { |
179 EXPECT_TRUE(chromeos::CrosSettings::Get()-> | 179 EXPECT_TRUE(chromeos::CrosSettings::Get()-> |
180 RemoveSettingsProvider(&stub_settings_provider_)); | 180 RemoveSettingsProvider(&stub_settings_provider_)); |
181 chromeos::CrosSettings::Get()-> | 181 chromeos::CrosSettings::Get()-> |
182 AddSettingsProvider(device_settings_provider_); | 182 AddSettingsProvider(device_settings_provider_); |
183 } | 183 } |
184 | 184 |
185 virtual void SetUp() OVERRIDE { | 185 virtual void SetUp() override { |
186 BrowserWithTestWindowTest::SetUp(); | 186 BrowserWithTestWindowTest::SetUp(); |
187 | 187 |
188 // Set the user preferences. | 188 // Set the user preferences. |
189 prefs_ = browser()->profile()->GetPrefs(); | 189 prefs_ = browser()->profile()->GetPrefs(); |
190 prefs_->SetString(prefs::kGoogleServicesUsername, "test@google.com"); | 190 prefs_->SetString(prefs::kGoogleServicesUsername, "test@google.com"); |
191 base::ListValue whitelist; | 191 base::ListValue whitelist; |
192 whitelist.AppendString(extension_->id()); | 192 whitelist.AppendString(extension_->id()); |
193 prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist); | 193 prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist); |
194 } | 194 } |
195 | 195 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 static const char kArgs[]; | 346 static const char kArgs[]; |
347 | 347 |
348 EPKPChallengeUserKeyTest() : | 348 EPKPChallengeUserKeyTest() : |
349 func_(new EPKPChallengeUserKey(&mock_cryptohome_client_, | 349 func_(new EPKPChallengeUserKey(&mock_cryptohome_client_, |
350 &mock_async_method_caller_, | 350 &mock_async_method_caller_, |
351 &mock_attestation_flow_, | 351 &mock_attestation_flow_, |
352 &stub_install_attributes_)) { | 352 &stub_install_attributes_)) { |
353 func_->set_extension(extension_.get()); | 353 func_->set_extension(extension_.get()); |
354 } | 354 } |
355 | 355 |
356 virtual void SetUp() OVERRIDE { | 356 virtual void SetUp() override { |
357 EPKPChallengeKeyTestBase::SetUp(); | 357 EPKPChallengeKeyTestBase::SetUp(); |
358 | 358 |
359 // Set the user preferences. | 359 // Set the user preferences. |
360 prefs_->SetBoolean(prefs::kAttestationEnabled, true); | 360 prefs_->SetBoolean(prefs::kAttestationEnabled, true); |
361 } | 361 } |
362 | 362 |
363 // Returns an error string for the given code. | 363 // Returns an error string for the given code. |
364 std::string GetCertificateError(int error_code) { | 364 std::string GetCertificateError(int error_code) { |
365 return base::StringPrintf(EPKPChallengeUserKey::kGetCertificateFailedError, | 365 return base::StringPrintf(EPKPChallengeUserKey::kGetCertificateFailedError, |
366 error_code); | 366 error_code); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_)) | 511 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_)) |
512 .WillRepeatedly(Invoke(FakeBoolDBusMethod( | 512 .WillRepeatedly(Invoke(FakeBoolDBusMethod( |
513 chromeos::DBUS_METHOD_CALL_FAILURE, true))); | 513 chromeos::DBUS_METHOD_CALL_FAILURE, true))); |
514 | 514 |
515 EXPECT_EQ(GetCertificateError(kDBusError), | 515 EXPECT_EQ(GetCertificateError(kDBusError), |
516 utils::RunFunctionAndReturnError(func_.get(), kArgs, browser())); | 516 utils::RunFunctionAndReturnError(func_.get(), kArgs, browser())); |
517 } | 517 } |
518 | 518 |
519 } // namespace | 519 } // namespace |
520 } // namespace extensions | 520 } // namespace extensions |
OLD | NEW |