OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 WebUIScreenLocker* webui_screen_locker() const; | 113 WebUIScreenLocker* webui_screen_locker() const; |
114 | 114 |
115 // Returns the WebUI object from the screen locker. | 115 // Returns the WebUI object from the screen locker. |
116 content::WebUI* webui() const; | 116 content::WebUI* webui() const; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester); | 118 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester); |
119 }; | 119 }; |
120 | 120 |
121 void WebUIScreenLockerTester::SetPassword(const std::string& password) { | 121 void WebUIScreenLockerTester::SetPassword(const std::string& password) { |
122 RenderViewHost()->ExecuteJavascriptInWebFrame( | 122 RenderViewHost()->ExecuteJavascriptInWebFrame( |
123 string16(), | 123 base::string16(), |
124 ASCIIToUTF16(base::StringPrintf( | 124 ASCIIToUTF16(base::StringPrintf( |
125 "$('pod-row').pods[0].passwordElement.value = '%s';", | 125 "$('pod-row').pods[0].passwordElement.value = '%s';", |
126 password.c_str()))); | 126 password.c_str()))); |
127 } | 127 } |
128 | 128 |
129 std::string WebUIScreenLockerTester::GetPassword() { | 129 std::string WebUIScreenLockerTester::GetPassword() { |
130 std::string result; | 130 std::string result; |
131 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( | 131 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( |
132 RenderViewHost(), | 132 RenderViewHost(), |
133 "$('pod-row').pods[0].passwordElement.value;"); | 133 "$('pod-row').pods[0].passwordElement.value;"); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 new MockAuthenticator(ScreenLocker::screen_locker_, user, password)); | 207 new MockAuthenticator(ScreenLocker::screen_locker_, user, password)); |
208 } | 208 } |
209 | 209 |
210 } // namespace test | 210 } // namespace test |
211 | 211 |
212 test::ScreenLockerTester* ScreenLocker::GetTester() { | 212 test::ScreenLockerTester* ScreenLocker::GetTester() { |
213 return new test::WebUIScreenLockerTester(); | 213 return new test::WebUIScreenLockerTester(); |
214 } | 214 } |
215 | 215 |
216 } // namespace chromeos | 216 } // namespace chromeos |
OLD | NEW |