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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 2640473003: Convert tests to use the non-deprecated WebContentsObserver navigation methods. (Closed)
Patch Set: review comments Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 5 #include <list>
6 #include <set> 6 #include <set>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 class StartProvisionalLoadObserver : public content::WebContentsObserver { 259 class StartProvisionalLoadObserver : public content::WebContentsObserver {
260 public: 260 public:
261 StartProvisionalLoadObserver(WebContents* web_contents, 261 StartProvisionalLoadObserver(WebContents* web_contents,
262 const GURL& expected_url) 262 const GURL& expected_url)
263 : content::WebContentsObserver(web_contents), 263 : content::WebContentsObserver(web_contents),
264 url_(expected_url), 264 url_(expected_url),
265 url_seen_(false), 265 url_seen_(false),
266 message_loop_runner_(new content::MessageLoopRunner) {} 266 message_loop_runner_(new content::MessageLoopRunner) {}
267 ~StartProvisionalLoadObserver() override {} 267 ~StartProvisionalLoadObserver() override {}
268 268
269 void DidStartProvisionalLoadForFrame( 269 void DidStartNavigation(
270 content::RenderFrameHost* render_frame_host, 270 content::NavigationHandle* navigation_handle) override {
271 const GURL& validated_url, 271 if (navigation_handle->GetURL() == url_) {
272 bool is_error_page) override {
273 if (validated_url == url_) {
274 url_seen_ = true; 272 url_seen_ = true;
275 message_loop_runner_->Quit(); 273 message_loop_runner_->Quit();
276 } 274 }
277 } 275 }
278 276
279 // Run a nested message loop until navigation to the expected URL has started. 277 // Run a nested message loop until navigation to the expected URL has started.
280 void Wait() { 278 void Wait() {
281 if (url_seen_) 279 if (url_seen_)
282 return; 280 return;
283 281
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 "extensions/api_test/webnavigation/crash/b.html", 811 "extensions/api_test/webnavigation/crash/b.html",
814 embedded_test_server()->port())); 812 embedded_test_server()->port()));
815 ui_test_utils::NavigateToURL(browser(), url); 813 ui_test_utils::NavigateToURL(browser(), url);
816 814
817 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 815 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
818 } 816 }
819 817
820 #endif 818 #endif
821 819
822 } // namespace extensions 820 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698