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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 715203004: PlzNavigate: Add a browser test for basic navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a browser test for renderer initiated navigations Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 145a24989e38d3e9a892162161c3f22a647c6f6c..d8f12f5b8053e7bb99527470cf74a6c6132de737 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -16,7 +16,6 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_utils.h"
@@ -29,50 +28,6 @@
namespace content {
-class SitePerProcessWebContentsObserver: public WebContentsObserver {
- public:
- explicit SitePerProcessWebContentsObserver(WebContents* web_contents)
- : WebContentsObserver(web_contents),
- navigation_succeeded_(false) {}
- ~SitePerProcessWebContentsObserver() override {}
-
- void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- bool is_error_page,
- bool is_iframe_srcdoc) override {
- navigation_succeeded_ = false;
- }
-
- void DidFailProvisionalLoad(
- RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- int error_code,
- const base::string16& error_description) override {
- navigation_url_ = validated_url;
- navigation_succeeded_ = false;
- }
-
- void DidCommitProvisionalLoadForFrame(
- RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) override {
- navigation_url_ = url;
- navigation_succeeded_ = true;
- }
-
- const GURL& navigation_url() const {
- return navigation_url_;
- }
-
- int navigation_succeeded() const { return navigation_succeeded_; }
-
- private:
- GURL navigation_url_;
- bool navigation_succeeded_;
-
- DISALLOW_COPY_AND_ASSIGN(SitePerProcessWebContentsObserver);
-};
-
class RedirectNotificationObserver : public NotificationObserver {
public:
// Register to listen for notifications of the given type from either a
@@ -208,7 +163,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) {
static_cast<WebContentsImpl*>(shell()->web_contents())->
GetFrameTree()->root();
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
// Load same-site page into iframe.
FrameTreeNode* child = root->child_at(0);
@@ -301,7 +256,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) {
static_cast<WebContentsImpl*>(shell()->web_contents())->
GetFrameTree()->root();
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
// Load same-site page into iframe.
FrameTreeNode* child = root->child_at(0);
@@ -432,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
NavigateToURL(shell(), main_url);
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
{
// Load cross-site client-redirect page into Iframe.
// Should be blocked.
@@ -558,7 +513,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
NavigateToURL(shell(), main_url);
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
{
// Load client-redirect page pointing to a cross-site client-redirect page,
// which eventually redirects back to same-site page.
@@ -647,7 +602,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
{
// Load same-site page into iframe.
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
GURL http_url(embedded_test_server()->GetURL("/title1.html"));
NavigateFrameToURL(root->child_at(0), http_url);
EXPECT_EQ(http_url, observer.navigation_url());
@@ -670,7 +625,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
FrameTreeNode* child = root->child_at(1);
SiteInstance* site = NULL;
{
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
TestFrameNavigationObserver navigation_observer(child);
NavigationController::LoadURLParams params(cross_site_url);
params.transition_type = PageTransitionFromInt(ui::PAGE_TRANSITION_LINK);
@@ -706,7 +661,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// TODO(nasko): Once we have proper cleanup of resources, add code to
// verify that the intermediate SiteInstance/RenderFrameHost have been
// properly cleaned up.
- SitePerProcessWebContentsObserver observer(shell()->web_contents());
+ TestNavigationWebContentsObserver observer(shell()->web_contents());
TestFrameNavigationObserver navigation_observer(child);
NavigationController::LoadURLParams params(cross_site_url);
params.transition_type = PageTransitionFromInt(ui::PAGE_TRANSITION_LINK);

Powered by Google App Engine
This is Rietveld 408576698