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