Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ | 5 #ifndef ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ |
| 6 #define ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ | 6 #define ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ |
| 7 | 7 |
| 8 #include "ash/public/interfaces/lock_screen.mojom.h" | 8 #include "ash/public/interfaces/lock_screen.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 class MockLockScreenClient : public mojom::LockScreenClient { | 14 class MockLockScreenClient : public mojom::LockScreenClient { |
| 15 public: | 15 public: |
| 16 MockLockScreenClient(); | 16 MockLockScreenClient(); |
| 17 ~MockLockScreenClient() override; | 17 ~MockLockScreenClient() override; |
| 18 | 18 |
| 19 mojom::LockScreenClientPtr CreateInterfacePtrAndBind(); | 19 mojom::LockScreenClientPtr CreateInterfacePtrAndBind(); |
| 20 | 20 |
| 21 // Result that should be passed to |callback| in |AuthenticateUser|. | |
| 22 void set_authenticate_user_callback_result(bool value) { | |
| 23 authenticate_user_callback_result_ = value; | |
| 24 } | |
|
xiyuan
2017/06/07 19:02:28
nit: move this the last of all methods. Prevailing
jdufault
2017/06/07 22:53:21
I've done some reordering. Does the accessor go af
xiyuan
2017/06/07 23:03:21
I personally prefer to put accessors to the very l
jdufault
2017/06/08 17:36:06
I'd prefer to leave as is - I can reorder if you f
xiyuan
2017/06/08 17:49:06
Acknowledged.
| |
| 25 | |
| 21 // mojom::LockScreenClient: | 26 // mojom::LockScreenClient: |
| 22 MOCK_METHOD3(AuthenticateUser, | 27 void AuthenticateUser(const AccountId& account_id, |
| 28 const std::string& password, | |
| 29 bool authenticated_by_pin, | |
| 30 AuthenticateUserCallback callback) override; | |
| 31 MOCK_METHOD4(AuthenticateUser_, | |
| 23 void(const AccountId& account_id, | 32 void(const AccountId& account_id, |
| 24 const std::string& password, | 33 const std::string& password, |
| 25 bool authenticated_by_pin)); | 34 bool authenticated_by_pin, |
| 35 AuthenticateUserCallback& callback)); | |
| 26 | 36 |
| 27 private: | 37 private: |
| 38 bool authenticate_user_callback_result_ = true; | |
| 39 | |
| 28 mojo::Binding<ash::mojom::LockScreenClient> binding_; | 40 mojo::Binding<ash::mojom::LockScreenClient> binding_; |
| 29 | 41 |
| 30 DISALLOW_COPY_AND_ASSIGN(MockLockScreenClient); | 42 DISALLOW_COPY_AND_ASSIGN(MockLockScreenClient); |
| 31 }; | 43 }; |
| 32 | 44 |
| 33 // Helper method to bind a lock screen client so it receives all mojo calls. | 45 // Helper method to bind a lock screen client so it receives all mojo calls. |
| 34 std::unique_ptr<MockLockScreenClient> BindMockLockScreenClient(); | 46 std::unique_ptr<MockLockScreenClient> BindMockLockScreenClient(); |
| 35 | 47 |
| 36 } // namespace ash | 48 } // namespace ash |
| 37 | 49 |
| 38 #endif // ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ | 50 #endif // ASH_LOGIN_MOCK_LOCK_SCREEN_CLIENT_H_ |
| OLD | NEW |