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 19 matching lines...) Expand all Loading... |
30 #include "net/test/embedded_test_server/embedded_test_server.h" | 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
31 | 31 |
32 NavigationObserver::NavigationObserver(content::WebContents* web_contents) | 32 NavigationObserver::NavigationObserver(content::WebContents* web_contents) |
33 : content::WebContentsObserver(web_contents), | 33 : content::WebContentsObserver(web_contents), |
34 quit_on_entry_committed_(false), | 34 quit_on_entry_committed_(false), |
35 message_loop_runner_(new content::MessageLoopRunner) { | 35 message_loop_runner_(new content::MessageLoopRunner) { |
36 } | 36 } |
37 NavigationObserver::~NavigationObserver() { | 37 NavigationObserver::~NavigationObserver() { |
38 } | 38 } |
39 | 39 |
| 40 void NavigationObserver::DidFinishNavigation( |
| 41 content::NavigationHandle* navigation_handle) { |
| 42 if (quit_on_entry_committed_) |
| 43 message_loop_runner_->Quit(); |
| 44 } |
| 45 |
40 void NavigationObserver::DidFinishLoad( | 46 void NavigationObserver::DidFinishLoad( |
41 content::RenderFrameHost* render_frame_host, | 47 content::RenderFrameHost* render_frame_host, |
42 const GURL& validated_url) { | 48 const GURL& validated_url) { |
43 render_frame_host_ = render_frame_host; | 49 render_frame_host_ = render_frame_host; |
44 if (!wait_for_path_.empty()) { | 50 if (!wait_for_path_.empty()) { |
45 if (validated_url.path() == wait_for_path_) | 51 if (validated_url.path() == wait_for_path_) |
46 message_loop_runner_->Quit(); | 52 message_loop_runner_->Quit(); |
47 } else if (!render_frame_host->GetParent()) { | 53 } else if (!render_frame_host->GetParent()) { |
48 message_loop_runner_->Quit(); | 54 message_loop_runner_->Quit(); |
49 } | 55 } |
50 } | 56 } |
51 | 57 |
52 void NavigationObserver::NavigationEntryCommitted( | |
53 const content::LoadCommittedDetails& load_details) { | |
54 if (quit_on_entry_committed_) | |
55 message_loop_runner_->Quit(); | |
56 } | |
57 | |
58 void NavigationObserver::Wait() { | 58 void NavigationObserver::Wait() { |
59 message_loop_runner_->Run(); | 59 message_loop_runner_->Run(); |
60 } | 60 } |
61 | 61 |
62 PromptObserver::PromptObserver() { | 62 PromptObserver::PromptObserver() { |
63 } | 63 } |
64 PromptObserver::~PromptObserver() { | 64 PromptObserver::~PromptObserver() { |
65 } | 65 } |
66 | 66 |
67 bool PromptObserver::IsShowingUpdatePrompt() const { | 67 bool PromptObserver::IsShowingUpdatePrompt() const { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 " var element = document.getElementById('%s');" | 335 " var element = document.getElementById('%s');" |
336 "window.domAutomationController.send(element && element.value == '%s');", | 336 "window.domAutomationController.send(element && element.value == '%s');", |
337 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), | 337 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), |
338 element_id.c_str(), expected_value.c_str()); | 338 element_id.c_str(), expected_value.c_str()); |
339 bool return_value = false; | 339 bool return_value = false; |
340 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 340 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
341 RenderViewHost(), value_check_script, &return_value)); | 341 RenderViewHost(), value_check_script, &return_value)); |
342 EXPECT_TRUE(return_value) << "element_id = " << element_id | 342 EXPECT_TRUE(return_value) << "element_id = " << element_id |
343 << ", expected_value = " << expected_value; | 343 << ", expected_value = " << expected_value; |
344 } | 344 } |
OLD | NEW |