OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/chromeos/login/screen_locker_tester.h" | 5 #include "chrome/browser/chromeos/login/screen_locker_tester.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/scoped_ptr.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/chromeos/login/mock_authenticator.h" | 12 #include "chrome/browser/chromeos/login/mock_authenticator.h" |
12 #include "chrome/browser/chromeos/login/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/screen_locker.h" |
13 #include "chrome/browser/chromeos/login/screen_lock_view.h" | 14 #include "chrome/browser/chromeos/login/screen_lock_view.h" |
14 #include "views/controls/button/button.h" | 15 #include "views/controls/button/button.h" |
15 #include "views/controls/label.h" | 16 #include "views/controls/label.h" |
16 #include "views/controls/textfield/textfield.h" | 17 #include "views/controls/textfield/textfield.h" |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
30 void ScreenLockerTester::InjectMockAuthenticator(const char* password) { | 31 void ScreenLockerTester::InjectMockAuthenticator(const char* password) { |
31 DCHECK(ScreenLocker::screen_locker_); | 32 DCHECK(ScreenLocker::screen_locker_); |
32 ScreenLocker::screen_locker_->SetAuthenticator( | 33 ScreenLocker::screen_locker_->SetAuthenticator( |
33 new MockAuthenticator(ScreenLocker::screen_locker_, "", password)); | 34 new MockAuthenticator(ScreenLocker::screen_locker_, "", password)); |
34 } | 35 } |
35 | 36 |
36 void ScreenLockerTester::EnterPassword(const char* password) { | 37 void ScreenLockerTester::EnterPassword(const char* password) { |
37 DCHECK(ScreenLocker::screen_locker_); | 38 DCHECK(ScreenLocker::screen_locker_); |
38 views::Textfield* pass = GetPasswordField(); | 39 views::Textfield* pass = GetPasswordField(); |
39 pass->SetText(ASCIIToUTF16(password)); | 40 pass->SetText(ASCIIToUTF16(password)); |
40 GdkEventKey eventKey; | 41 GdkEvent* event = gdk_event_new(GDK_KEY_PRESS); |
41 eventKey.keyval = GDK_Return; | 42 |
42 views::Textfield::Keystroke ret(&eventKey); | 43 event->key.keyval = GDK_Return; |
| 44 views::Textfield::Keystroke ret(&event->key); |
43 ScreenLocker::screen_locker_->screen_lock_view_->HandleKeystroke(pass, ret); | 45 ScreenLocker::screen_locker_->screen_lock_view_->HandleKeystroke(pass, ret); |
| 46 |
| 47 gdk_event_free(event); |
44 } | 48 } |
45 | 49 |
46 views::Textfield* ScreenLockerTester::GetPasswordField() { | 50 views::Textfield* ScreenLockerTester::GetPasswordField() { |
47 DCHECK(ScreenLocker::screen_locker_); | 51 DCHECK(ScreenLocker::screen_locker_); |
48 return ScreenLocker::screen_locker_->screen_lock_view_->password_field_; | 52 return ScreenLocker::screen_locker_->screen_lock_view_->password_field_; |
49 } | 53 } |
50 | 54 |
51 } // namespace test | 55 } // namespace test |
52 | 56 |
53 } // namespace chromeos | 57 } // namespace chromeos |
OLD | NEW |