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

Side by Side Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix an Android compile error Created 4 years 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 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 shell()->LoadURL(url); 626 shell()->LoadURL(url);
627 tab_observer.Wait(); 627 tab_observer.Wait();
628 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL()); 628 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL());
629 629
630 // We should have gotten to DidStopLoading. 630 // We should have gotten to DidStopLoading.
631 EXPECT_TRUE(delegate->did_stop_loading); 631 EXPECT_TRUE(delegate->did_stop_loading);
632 632
633 ResourceDispatcherHost::Get()->SetDelegate(nullptr); 633 ResourceDispatcherHost::Get()->SetDelegate(nullptr);
634 } 634 }
635 635
636 // Test for eTLD+1 of the top page.
637 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, RapporUrlOfTopPage) {
638 host_resolver()->AddRule("*", "127.0.0.1");
639 ASSERT_TRUE(embedded_test_server()->Start());
640
641 TestNavigationObserver tab_observer(shell()->web_contents(), 1);
642 GURL url(embedded_test_server()->GetURL("foo.com", "/title2.html"));
643 shell()->LoadURL(url);
644 tab_observer.Wait();
645 EXPECT_EQ(std::string("foo.com"),
646 static_cast<WebContentsImpl*>(shell()->web_contents())
647 ->GetRapporCommittedUrl());
648 }
649
636 struct FirstVisuallyNonEmptyPaintObserver : public WebContentsObserver { 650 struct FirstVisuallyNonEmptyPaintObserver : public WebContentsObserver {
637 FirstVisuallyNonEmptyPaintObserver(Shell* shell) 651 FirstVisuallyNonEmptyPaintObserver(Shell* shell)
638 : WebContentsObserver(shell->web_contents()), 652 : WebContentsObserver(shell->web_contents()),
639 did_fist_visually_non_empty_paint_(false) {} 653 did_fist_visually_non_empty_paint_(false) {}
640 654
641 void DidFirstVisuallyNonEmptyPaint() override { 655 void DidFirstVisuallyNonEmptyPaint() override {
642 did_fist_visually_non_empty_paint_ = true; 656 did_fist_visually_non_empty_paint_ = true;
643 on_did_first_visually_non_empty_paint_.Run(); 657 on_did_first_visually_non_empty_paint_.Run();
644 } 658 }
645 659
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 // Make sure the WebContents cleaned up the previous pending request. A new 1312 // Make sure the WebContents cleaned up the previous pending request. A new
1299 // request should be forwarded to the WebContentsDelegate. 1313 // request should be forwarded to the WebContentsDelegate.
1300 delegate.get()->request_to_lock_mouse_called_ = false; 1314 delegate.get()->request_to_lock_mouse_called_ = false;
1301 ASSERT_TRUE(ExecuteScript(shell(), 1315 ASSERT_TRUE(ExecuteScript(shell(),
1302 "window.domAutomationController.send(document.body." 1316 "window.domAutomationController.send(document.body."
1303 "requestPointerLock());")); 1317 "requestPointerLock());"));
1304 EXPECT_TRUE(delegate.get()->request_to_lock_mouse_called_); 1318 EXPECT_TRUE(delegate.get()->request_to_lock_mouse_called_);
1305 } 1319 }
1306 1320
1307 } // namespace content 1321 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698