1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_TESTER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_TESTER_H_ 7 #pragma once 8 9 #include <string> 10 11 #include "base/basictypes.h" 12 13 namespace views { 14 class Button; 15 class Textfield; 16 class Widget; 17 } // namespace views 18 19 namespace chromeos { 20 21 class ScreenLocker; 22 23 namespace test { 24 25 // ScreenLockerTester provides access to the private state/function 26 // of ScreenLocker class. Used to implement unit tests. 27 class ScreenLockerTester { 28 public: 29 // Returns true if the screen is locked. 30 bool IsLocked(); 31 32 // Injects MockAuthenticate that uses given |user| and |password|. 33 void InjectMockAuthenticator(const std::string& user, 34 const std::string& password); 35 36 // Sets the password text. 37 void SetPassword(const std::string& password); 38 39 // Gets the password text. 40 std::string GetPassword() const; 41 42 // Emulates entring a password. 43 void EnterPassword(const std::string& password); 44 45 // Emulates the ready message from window manager. 46 void EmulateWindowManagerReady(); 47 48 // Returns the widget for screen locker window. 49 views::Widget* GetWidget() const; 50 51 views::Widget* GetChildWidget() const; 52 53 private: 54 friend class chromeos::ScreenLocker; 55 56 ScreenLockerTester() {} 57 58 views::Textfield* GetPasswordField() const; 59 60 DISALLOW_COPY_AND_ASSIGN(ScreenLockerTester); 61 }; 62 63 } // namespace test 64 65 } // namespace chromeos 66 67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_TESTER_H_ 68