OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/password_manager_test_base.h" | 5 #include "chrome/browser/password_manager/password_manager_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // the password. | 157 // the password. |
158 base::RunLoop run_loop; | 158 base::RunLoop run_loop; |
159 run_loop.RunUntilIdle(); | 159 run_loop.RunUntilIdle(); |
160 ASSERT_FALSE(password_store->IsEmpty()); | 160 ASSERT_FALSE(password_store->IsEmpty()); |
161 | 161 |
162 NavigateToFile(filename); | 162 NavigateToFile(filename); |
163 | 163 |
164 // Let the user interact with the page, so that DOM gets modification events, | 164 // Let the user interact with the page, so that DOM gets modification events, |
165 // needed for autofilling fields. | 165 // needed for autofilling fields. |
166 content::SimulateMouseClickAt( | 166 content::SimulateMouseClickAt( |
167 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); | 167 WebContents(), 0, blink::WebMouseEvent::Button::Left, gfx::Point(1, 1)); |
168 | 168 |
169 // Wait until that interaction causes the password value to be revealed. | 169 // Wait until that interaction causes the password value to be revealed. |
170 WaitForElementValue(expected_element, expected_value); | 170 WaitForElementValue(expected_element, expected_value); |
171 } | 171 } |
172 | 172 |
173 void PasswordManagerBrowserTestBase::WaitForElementValue( | 173 void PasswordManagerBrowserTestBase::WaitForElementValue( |
174 const std::string& element_id, | 174 const std::string& element_id, |
175 const std::string& expected_value) { | 175 const std::string& expected_value) { |
176 WaitForElementValue("null", element_id, expected_value); | 176 WaitForElementValue("null", element_id, expected_value); |
177 } | 177 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 " var element = document.getElementById('%s');" | 249 " var element = document.getElementById('%s');" |
250 "window.domAutomationController.send(element && element.value == '%s');", | 250 "window.domAutomationController.send(element && element.value == '%s');", |
251 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), | 251 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), |
252 element_id.c_str(), expected_value.c_str()); | 252 element_id.c_str(), expected_value.c_str()); |
253 bool return_value = false; | 253 bool return_value = false; |
254 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 254 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
255 RenderViewHost(), value_check_script, &return_value)); | 255 RenderViewHost(), value_check_script, &return_value)); |
256 EXPECT_TRUE(return_value) << "element_id = " << element_id | 256 EXPECT_TRUE(return_value) << "element_id = " << element_id |
257 << ", expected_value = " << expected_value; | 257 << ", expected_value = " << expected_value; |
258 } | 258 } |
OLD | NEW |