screen_locker_tester.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2010 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 "base/basictypes.h" 10 11namespace views { 12class Button; 13class Textfield; 14class Widget; 15} // namespace views 16 17namespace chromeos { 18 19class ScreenLocker; 20 21namespace test { 22 23// ScreenLockerTester provides access to the private state/function 24// of ScreenLocker class. Used to implement unit tests. 25class ScreenLockerTester { 26 public: 27 // Returns true if the screen is locked. 28 bool IsLocked(); 29 30 // Injects MockAuthenticate that uses given |user| and |password|. 31 void InjectMockAuthenticator(const char* user, const char* password); 32 33 // Emulates entring a password. 34 void EnterPassword(const char* password); 35 36 // Emulates the ready message from window manager. 37 void EmulateWindowManagerReady(); 38 39 // Returns the widget for screen locker window. 40 views::Widget* GetWidget(); 41 42 views::Widget* GetChildWidget(); 43 44 private: 45 friend class chromeos::ScreenLocker; 46 47 ScreenLockerTester() {} 48 49 views::Textfield* GetPasswordField(); 50 51 DISALLOW_COPY_AND_ASSIGN(ScreenLockerTester); 52}; 53 54} // namespace test 55 56} // namespace chromeos 57 58#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_TESTER_H_ 59