| 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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 RenderViewHost()->ExecuteJavascriptInWebFrame( | 121 RenderViewHost()->ExecuteJavascriptInWebFrame( |
| 122 string16(), | 122 string16(), |
| 123 ASCIIToUTF16(StringPrintf( | 123 ASCIIToUTF16(base::StringPrintf( |
| 124 "$('pod-row').pods[0].passwordElement.value = '%s';", | 124 "$('pod-row').pods[0].passwordElement.value = '%s';", |
| 125 password.c_str()))); | 125 password.c_str()))); |
| 126 } | 126 } |
| 127 | 127 |
| 128 std::string WebUIScreenLockerTester::GetPassword() { | 128 std::string WebUIScreenLockerTester::GetPassword() { |
| 129 std::string result; | 129 std::string result; |
| 130 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( | 130 scoped_ptr<base::Value> v = content::ExecuteScriptAndGetValue( |
| 131 RenderViewHost(), | 131 RenderViewHost(), |
| 132 "$('pod-row').pods[0].passwordElement.value;"); | 132 "$('pod-row').pods[0].passwordElement.value;"); |
| 133 CHECK(v->GetAsString(&result)); | 133 CHECK(v->GetAsString(&result)); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 new MockAuthenticator(ScreenLocker::screen_locker_, user, password)); | 206 new MockAuthenticator(ScreenLocker::screen_locker_, user, password)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace test | 209 } // namespace test |
| 210 | 210 |
| 211 test::ScreenLockerTester* ScreenLocker::GetTester() { | 211 test::ScreenLockerTester* ScreenLocker::GetTester() { |
| 212 return new test::WebUIScreenLockerTester(); | 212 return new test::WebUIScreenLockerTester(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace chromeos | 215 } // namespace chromeos |
| OLD | NEW |