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 "chrome/browser/chromeos/login/lock/screen_locker_tester.h" | 5 #include "chrome/browser/chromeos/login/lock/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Returns the ScreenLockerWebUI object. | 111 // Returns the ScreenLockerWebUI object. |
112 WebUIScreenLocker* webui_screen_locker() const; | 112 WebUIScreenLocker* webui_screen_locker() const; |
113 | 113 |
114 // Returns the WebUI object from the screen locker. | 114 // Returns the WebUI object from the screen locker. |
115 content::WebUI* webui() const; | 115 content::WebUI* webui() const; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester); | 117 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester); |
118 }; | 118 }; |
119 | 119 |
120 void WebUIScreenLockerTester::SetPassword(const std::string& password) { | 120 void WebUIScreenLockerTester::SetPassword(const std::string& password) { |
121 webui()->GetWebContents()->GetMainFrame()->ExecuteJavaScript( | 121 webui()->GetWebContents()->GetMainFrame()->ExecuteJavaScriptForTests( |
122 base::ASCIIToUTF16(base::StringPrintf( | 122 base::ASCIIToUTF16(base::StringPrintf( |
123 "$('pod-row').pods[0].passwordElement.value = '%s';", | 123 "$('pod-row').pods[0].passwordElement.value = '%s';", |
124 password.c_str()))); | 124 password.c_str()))); |
125 } | 125 } |
126 | 126 |
127 std::string WebUIScreenLockerTester::GetPassword() { | 127 std::string WebUIScreenLockerTester::GetPassword() { |
128 std::string result; | 128 std::string result; |
129 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( | 129 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( |
130 RenderViewHost()->GetMainFrame(), | 130 RenderViewHost()->GetMainFrame(), |
131 "$('pod-row').pods[0].passwordElement.value;"); | 131 "$('pod-row').pods[0].passwordElement.value;"); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 new FakeExtendedAuthenticator(ScreenLocker::screen_locker_, user_context); | 209 new FakeExtendedAuthenticator(ScreenLocker::screen_locker_, user_context); |
210 } | 210 } |
211 | 211 |
212 } // namespace test | 212 } // namespace test |
213 | 213 |
214 test::ScreenLockerTester* ScreenLocker::GetTester() { | 214 test::ScreenLockerTester* ScreenLocker::GetTester() { |
215 return new test::WebUIScreenLockerTester(); | 215 return new test::WebUIScreenLockerTester(); |
216 } | 216 } |
217 | 217 |
218 } // namespace chromeos | 218 } // namespace chromeos |
OLD | NEW |