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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 void NavigationObserver::NavigationEntryCommitted( | 49 void NavigationObserver::NavigationEntryCommitted( |
50 const content::LoadCommittedDetails& load_details) { | 50 const content::LoadCommittedDetails& load_details) { |
51 if (quit_on_entry_committed_) | 51 if (quit_on_entry_committed_) |
52 message_loop_runner_->Quit(); | 52 message_loop_runner_->Quit(); |
53 } | 53 } |
54 | 54 |
55 void NavigationObserver::Wait() { | 55 void NavigationObserver::Wait() { |
56 message_loop_runner_->Run(); | 56 message_loop_runner_->Run(); |
57 } | 57 } |
58 | 58 |
59 PasswordStoreObserver::PasswordStoreObserver( | |
60 password_manager::TestPasswordStore* password_store) | |
61 : message_loop_runner_(new content::MessageLoopRunner), | |
62 test_password_store_(password_store) { | |
63 } | |
64 | |
65 PasswordStoreObserver::~PasswordStoreObserver() { | |
66 } | |
67 | |
68 void PasswordStoreObserver::Wait() { | |
69 autofill::PasswordForm form; | |
70 test_password_store_->GetLogins( | |
71 form, password_manager::PasswordStore::ALLOW_PROMPT, this); | |
vabr (Chromium)
2015/08/05 08:37:35
Please use DISALLOW_PROMPT instead, to mitigate th
xunlu
2015/08/05 18:37:13
Done.
| |
72 message_loop_runner_->Run(); | |
73 } | |
74 | |
75 void PasswordStoreObserver::OnGetPasswordStoreResults( | |
76 ScopedVector<autofill::PasswordForm> results) { | |
77 message_loop_runner_->Quit(); | |
78 } | |
79 | |
59 PromptObserver::PromptObserver() { | 80 PromptObserver::PromptObserver() { |
60 } | 81 } |
82 | |
61 PromptObserver::~PromptObserver() { | 83 PromptObserver::~PromptObserver() { |
62 } | 84 } |
63 | 85 |
64 void PromptObserver::Accept() const { | 86 void PromptObserver::Accept() const { |
65 EXPECT_TRUE(IsShowingPrompt()); | 87 EXPECT_TRUE(IsShowingPrompt()); |
66 AcceptImpl(); | 88 AcceptImpl(); |
67 } | 89 } |
68 | 90 |
69 class InfoBarObserver : public PromptObserver, | 91 class InfoBarObserver : public PromptObserver, |
70 public infobars::InfoBarManager::Observer { | 92 public infobars::InfoBarManager::Observer { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 " var element = document.getElementById('%s');" | 291 " var element = document.getElementById('%s');" |
270 "window.domAutomationController.send(element && element.value == '%s');", | 292 "window.domAutomationController.send(element && element.value == '%s');", |
271 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), | 293 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), |
272 element_id.c_str(), expected_value.c_str()); | 294 element_id.c_str(), expected_value.c_str()); |
273 bool return_value = false; | 295 bool return_value = false; |
274 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 296 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
275 RenderViewHost(), value_check_script, &return_value)); | 297 RenderViewHost(), value_check_script, &return_value)); |
276 EXPECT_TRUE(return_value) << "element_id = " << element_id | 298 EXPECT_TRUE(return_value) << "element_id = " << element_id |
277 << ", expected_value = " << expected_value; | 299 << ", expected_value = " << expected_value; |
278 } | 300 } |
OLD | NEW |