OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Auth type and value set using |SetAuthType|. | 188 // Auth type and value set using |SetAuthType|. |
189 AuthType auth_type_; | 189 AuthType auth_type_; |
190 base::string16 auth_value_; | 190 base::string16 auth_value_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(TestLockHandler); | 192 DISALLOW_COPY_AND_ASSIGN(TestLockHandler); |
193 }; | 193 }; |
194 | 194 |
195 class EasyUnlockScreenlockStateHandlerTest : public testing::Test { | 195 class EasyUnlockScreenlockStateHandlerTest : public testing::Test { |
196 public: | 196 public: |
197 EasyUnlockScreenlockStateHandlerTest() : user_email_("test_user@gmail.com") {} | 197 EasyUnlockScreenlockStateHandlerTest() : user_email_("test_user@gmail.com") {} |
198 virtual ~EasyUnlockScreenlockStateHandlerTest() {} | 198 ~EasyUnlockScreenlockStateHandlerTest() override {} |
199 | 199 |
200 virtual void SetUp() override { | 200 void SetUp() override { |
201 TestingBrowserProcess::GetGlobal()->SetApplicationLocale("en-US"); | 201 TestingBrowserProcess::GetGlobal()->SetApplicationLocale("en-US"); |
202 | 202 |
203 // Create and inject fake lock handler to the screenlock bridge. | 203 // Create and inject fake lock handler to the screenlock bridge. |
204 lock_handler_.reset(new TestLockHandler(user_email_)); | 204 lock_handler_.reset(new TestLockHandler(user_email_)); |
205 ScreenlockBridge* screenlock_bridge = ScreenlockBridge::Get(); | 205 ScreenlockBridge* screenlock_bridge = ScreenlockBridge::Get(); |
206 screenlock_bridge->SetLockHandler(lock_handler_.get()); | 206 screenlock_bridge->SetLockHandler(lock_handler_.get()); |
207 | 207 |
208 // Create the screenlock state handler object that will be tested. | 208 // Create the screenlock state handler object that will be tested. |
209 state_handler_.reset(new EasyUnlockScreenlockStateHandler( | 209 state_handler_.reset(new EasyUnlockScreenlockStateHandler( |
210 user_email_, | 210 user_email_, |
211 EasyUnlockScreenlockStateHandler::NO_HARDLOCK, | 211 EasyUnlockScreenlockStateHandler::NO_HARDLOCK, |
212 screenlock_bridge)); | 212 screenlock_bridge)); |
213 } | 213 } |
214 | 214 |
215 virtual void TearDown() override { | 215 void TearDown() override { |
216 ScreenlockBridge::Get()->SetLockHandler(NULL); | 216 ScreenlockBridge::Get()->SetLockHandler(NULL); |
217 lock_handler_.reset(); | 217 lock_handler_.reset(); |
218 state_handler_.reset(); | 218 state_handler_.reset(); |
219 } | 219 } |
220 | 220 |
221 protected: | 221 protected: |
222 // The state handler that is being tested. | 222 // The state handler that is being tested. |
223 scoped_ptr<EasyUnlockScreenlockStateHandler> state_handler_; | 223 scoped_ptr<EasyUnlockScreenlockStateHandler> state_handler_; |
224 | 224 |
225 // The user associated with |state_handler_|. | 225 // The user associated with |state_handler_|. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 state_handler_->ChangeState( | 742 state_handler_->ChangeState( |
743 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); | 743 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); |
744 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); | 744 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); |
745 EXPECT_TRUE(lock_handler_->HasCustomIcon()); | 745 EXPECT_TRUE(lock_handler_->HasCustomIcon()); |
746 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 746 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
747 lock_handler_->GetAuthType(user_email_)); | 747 lock_handler_->GetAuthType(user_email_)); |
748 } | 748 } |
749 | 749 |
750 } // namespace | 750 } // namespace |
OLD | NEW |