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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void PasswordManagerBrowserTestBase::SetUpOnMainThread() { | 186 void PasswordManagerBrowserTestBase::SetUpOnMainThread() { |
187 // Use TestPasswordStore to remove a possible race. Normally the | 187 // Use TestPasswordStore to remove a possible race. Normally the |
188 // PasswordStore does its database manipulation on the DB thread, which | 188 // PasswordStore does its database manipulation on the DB thread, which |
189 // creates a possible race during navigation. Specifically the | 189 // creates a possible race during navigation. Specifically the |
190 // PasswordManager will ignore any forms in a page if the load from the | 190 // PasswordManager will ignore any forms in a page if the load from the |
191 // PasswordStore has not completed. | 191 // PasswordStore has not completed. |
192 PasswordStoreFactory::GetInstance()->SetTestingFactory( | 192 PasswordStoreFactory::GetInstance()->SetTestingFactory( |
193 browser()->profile(), | 193 browser()->profile(), |
194 password_manager::BuildPasswordStore< | 194 password_manager::BuildPasswordStore< |
195 content::BrowserContext, password_manager::TestPasswordStore>); | 195 content::BrowserContext, password_manager::TestPasswordStore>); |
196 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 196 ASSERT_TRUE(embedded_test_server()->Start()); |
197 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( | 197 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( |
198 password_manager::switches::kEnableAutomaticPasswordSaving)); | 198 password_manager::switches::kEnableAutomaticPasswordSaving)); |
199 } | 199 } |
200 | 200 |
201 void PasswordManagerBrowserTestBase::TearDownOnMainThread() { | 201 void PasswordManagerBrowserTestBase::TearDownOnMainThread() { |
202 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 202 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
203 } | 203 } |
204 | 204 |
205 content::WebContents* PasswordManagerBrowserTestBase::WebContents() { | 205 content::WebContents* PasswordManagerBrowserTestBase::WebContents() { |
206 return browser()->tab_strip_model()->GetActiveWebContents(); | 206 return browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 " var element = document.getElementById('%s');" | 334 " var element = document.getElementById('%s');" |
335 "window.domAutomationController.send(element && element.value == '%s');", | 335 "window.domAutomationController.send(element && element.value == '%s');", |
336 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), | 336 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), |
337 element_id.c_str(), expected_value.c_str()); | 337 element_id.c_str(), expected_value.c_str()); |
338 bool return_value = false; | 338 bool return_value = false; |
339 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 339 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
340 RenderViewHost(), value_check_script, &return_value)); | 340 RenderViewHost(), value_check_script, &return_value)); |
341 EXPECT_TRUE(return_value) << "element_id = " << element_id | 341 EXPECT_TRUE(return_value) << "element_id = " << element_id |
342 << ", expected_value = " << expected_value; | 342 << ", expected_value = " << expected_value; |
343 } | 343 } |
OLD | NEW |