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..1face558535438df0df1b950188541f9eebca6aa |
| --- /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. |
|
Devlin
2016/05/31 22:58:38
no (c)
jdufault
2016/06/01 00:07:35
Done.
|
| +// 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) { |
|
Devlin
2016/05/31 22:58:38
Could these be unittests?
jdufault
2016/06/01 00:07:35
I may be able to do something like the wallpaper p
Devlin
2016/06/01 17:44:12
Please do look into using unittests. The wallpape
|
| + // Setup a fake authenticator for testing. This enables testing of |
| + // quickUnlockPrivate.checkPassword. |
| + QuickUnlockPrivateSetModesFunction::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 |