Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_test.cc |
| diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_test.cc b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_test.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..60113f02a9773ef5bd78f6da89111a139105d4d0 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_test.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This file tests the chromeos.quickUnlockPrivate extension API. |
| + |
| +#include "chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h" |
| + |
| +#include "chrome/browser/extensions/extension_apitest.h" |
| +#include "chromeos/login/auth/fake_extended_authenticator.h" |
| +#include "chromeos/login/auth/user_context.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| + |
| +using namespace extensions; |
| + |
| +namespace chromeos { |
| +namespace { |
| +const char* kTestUserEmail = "testuser@gmail.com"; |
| +const char* kTestUserPassword = "valid"; |
| +} // namespace |
|
achuithb
2016/05/20 23:50:21
drop comment
jdufault
2016/05/23 18:06:09
Done.
|
| + |
| +class QuickUnlockPrivateApiTest : public ExtensionApiTest {}; |
| + |
| +IN_PROC_BROWSER_TEST_F(QuickUnlockPrivateApiTest, ApiTests) { |
| + // Setup a fake authenticator for testing. This enables testing of |
| + // quickUnlockPrivate.checkPassword. |
| + QuickUnlockPrivateCheckPasswordFunction::SetCreateAuthenticatorForTesting( |
| + [](chromeos::AuthStatusConsumer* auth_status_consumer) { |
| + AccountId account_id = AccountId::FromUserEmail(kTestUserEmail); |
| + chromeos::UserContext expected_context(account_id); |
| + expected_context.SetKey(Key(kTestUserPassword)); |
| + |
| + chromeos::ExtendedAuthenticator* authenticator = |
| + new chromeos::FakeExtendedAuthenticator(auth_status_consumer, |
| + expected_context); |
| + return authenticator; |
| + }); |
| + |
| + ASSERT_TRUE(RunExtensionTest("quick_unlock_private/apiTests")) << message_; |
| +} |
| + |
| +} // namespace chromeos |