Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 373623002: Convert remaining WebContentsObservers loading callbacks to use RFH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix one more compile error Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/test/base/test_switches.h" 26 #include "chrome/test/base/test_switches.h"
27 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
28 #include "components/autofill/core/browser/autofill_test_utils.h" 28 #include "components/autofill/core/browser/autofill_test_utils.h"
29 #include "components/infobars/core/confirm_infobar_delegate.h" 29 #include "components/infobars/core/confirm_infobar_delegate.h"
30 #include "components/infobars/core/infobar.h" 30 #include "components/infobars/core/infobar.h"
31 #include "components/infobars/core/infobar_manager.h" 31 #include "components/infobars/core/infobar_manager.h"
32 #include "components/password_manager/core/browser/test_password_store.h" 32 #include "components/password_manager/core/browser/test_password_store.h"
33 #include "components/password_manager/core/common/password_manager_switches.h" 33 #include "components/password_manager/core/common/password_manager_switches.h"
34 #include "content/public/browser/navigation_controller.h" 34 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "content/public/browser/render_frame_host.h"
36 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
37 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
38 #include "content/public/browser/web_contents_observer.h" 39 #include "content/public/browser/web_contents_observer.h"
39 #include "content/public/test/browser_test_utils.h" 40 #include "content/public/test/browser_test_utils.h"
40 #include "content/public/test/test_utils.h" 41 #include "content/public/test/test_utils.h"
41 #include "net/test/embedded_test_server/embedded_test_server.h" 42 #include "net/test/embedded_test_server/embedded_test_server.h"
42 #include "net/test/embedded_test_server/http_request.h" 43 #include "net/test/embedded_test_server/http_request.h"
43 #include "net/test/embedded_test_server/http_response.h" 44 #include "net/test/embedded_test_server/http_response.h"
44 #include "net/url_request/test_url_fetcher_factory.h" 45 #include "net/url_request/test_url_fetcher_factory.h"
45 #include "testing/gmock/include/gmock/gmock.h" 46 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 27 matching lines...) Expand all
73 } 74 }
74 75
75 // Normally Wait() will not return until a main frame navigation occurs. 76 // Normally Wait() will not return until a main frame navigation occurs.
76 // If a path is set, Wait() will return after this path has been seen, 77 // If a path is set, Wait() will return after this path has been seen,
77 // regardless of the frame that navigated. Useful for multi-frame pages. 78 // regardless of the frame that navigated. Useful for multi-frame pages.
78 void SetPathToWaitFor(const std::string& path) { 79 void SetPathToWaitFor(const std::string& path) {
79 wait_for_path_ = path; 80 wait_for_path_ = path;
80 } 81 }
81 82
82 // content::WebContentsObserver: 83 // content::WebContentsObserver:
83 virtual void DidFinishLoad( 84 virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host,
84 int64 frame_id, 85 const GURL& validated_url) OVERRIDE {
85 const GURL& validated_url,
86 bool is_main_frame,
87 content::RenderViewHost* render_view_host) OVERRIDE {
88 if (!wait_for_path_.empty()) { 86 if (!wait_for_path_.empty()) {
89 if (validated_url.path() == wait_for_path_) 87 if (validated_url.path() == wait_for_path_)
90 message_loop_runner_->Quit(); 88 message_loop_runner_->Quit();
91 } else if (is_main_frame) { 89 } else if (!render_frame_host->GetParent()) {
92 message_loop_runner_->Quit(); 90 message_loop_runner_->Quit();
93 } 91 }
94 } 92 }
95 93
96 bool infobar_shown() const { return infobar_shown_; } 94 bool infobar_shown() const { return infobar_shown_; }
97 bool infobar_removed() const { return infobar_removed_; } 95 bool infobar_removed() const { return infobar_removed_; }
98 96
99 void disable_should_automatically_accept_infobar() { 97 void disable_should_automatically_accept_infobar() {
100 should_automatically_accept_infobar_ = false; 98 should_automatically_accept_infobar_ = false;
101 } 99 }
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 ui_controller()->SavePassword(); 1076 ui_controller()->SavePassword();
1079 } else { 1077 } else {
1080 EXPECT_TRUE(nav_observer.infobar_shown()); 1078 EXPECT_TRUE(nav_observer.infobar_shown());
1081 } 1079 }
1082 // Spin the message loop to make sure the password store had a chance to save 1080 // Spin the message loop to make sure the password store had a chance to save
1083 // the password. 1081 // the password.
1084 base::RunLoop run_loop; 1082 base::RunLoop run_loop;
1085 run_loop.RunUntilIdle(); 1083 run_loop.RunUntilIdle();
1086 EXPECT_FALSE(password_store->IsEmpty()); 1084 EXPECT_FALSE(password_store->IsEmpty());
1087 } 1085 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.cc ('k') | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698