| 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..3f510bb740495825740871cdcb686c943af65acb
|
| --- /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";
|
| +}
|
| +
|
| +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
|
|
|