| Index: content/public/test/web_contents_tester.h
|
| ===================================================================
|
| --- content/public/test/web_contents_tester.h (revision 140261)
|
| +++ content/public/test/web_contents_tester.h (working copy)
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_TEST_WEB_CONTENTS_TESTER_H_
|
| -#define CONTENT_TEST_WEB_CONTENTS_TESTER_H_
|
| +#ifndef CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_
|
| +#define CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_
|
| #pragma once
|
|
|
| #include "content/public/common/page_transition_types.h"
|
| @@ -22,41 +22,36 @@
|
| class SiteInstance;
|
| class WebContents;
|
|
|
| -// This interface allows embedders of content/ to write tests that
|
| -// depend on a test version of WebContents. This interface can be
|
| -// retrieved from any content::WebContents that was retrieved via a
|
| -// call to RenderViewHostTestHarness::GetWebContents() (directly or
|
| -// indirectly) or constructed explicitly via one of the
|
| -// WebContentsTester::Create... methods.
|
| +// This interface allows embedders of content/ to write tests that depend on a
|
| +// test version of WebContents. This interface can be retrieved from any
|
| +// WebContents that was retrieved via a call to
|
| +// RenderViewHostTestHarness::GetWebContents() (directly or indirectly) or
|
| +// constructed explicitly via one of the WebContentsTester::Create... methods.
|
| //
|
| -// Tests within content/ can directly static_cast WebContents objects
|
| -// retrieved or created as described above to
|
| -// content::TestWebContents.
|
| +// Tests within content/ can directly static_cast WebContents objects retrieved
|
| +// or created as described above to TestWebContents.
|
| //
|
| -// Design note: We considered two alternatives to this separate test
|
| -// interface approach:
|
| +// Design note: We considered two alternatives to this separate test interface
|
| +// approach:
|
| //
|
| -// a) Define a TestWebContents interface that inherits fromn
|
| -// WebContents, and have the concrete TestWebContents inherit from it
|
| -// as well as from content::WebContentsImpl. This approach was
|
| -// discarded as it introduces a diamond inheritance pattern, which
|
| -// means we wouldn't be e.g. able to downcast from WebContents to
|
| -// WebContentsImpl using static_cast.
|
| +// a) Define a TestWebContents interface that inherits from WebContents, and
|
| +// have the concrete TestWebContents inherit from it as well as from
|
| +// WebContentsImpl. This approach was discarded as it introduces a diamond
|
| +// inheritance pattern, which means we wouldn't be e.g. able to downcast from
|
| +// WebContents to WebContentsImpl using static_cast.
|
| //
|
| -// b) Define a TestWebContents interface that inherits from
|
| -// WebContents, and have the concrete TestWebContents implement it,
|
| -// using composition of a content::WebContentsImpl to implement most
|
| -// methods. This approach was discarded as there is a fundamental
|
| -// assumption in content/ that a WebContents* can be downcast to a
|
| -// WebContentsImpl*, and this wouldn't be true for TestWebContents
|
| +// b) Define a TestWebContents interface that inherits from WebContents, and
|
| +// have the concrete TestWebContents implement it, using composition of a
|
| +// WebContentsImpl to implement most methods. This approach was discarded as
|
| +// there is a fundamental assumption in content/ that a WebContents* can be
|
| +// downcast to a WebContentsImpl*, and this wouldn't be true for TestWebContents
|
| // objects.
|
| class WebContentsTester {
|
| public:
|
| - // Retrieves a WebContentsTester to drive tests of the specified
|
| - // WebContents. As noted above you need to be sure the 'contents'
|
| - // object supports testing, i.e. is either created using one of the
|
| - // Create... functions below, or is retrieved via
|
| - // RenderViewHostTestHarness::GetWebContents().
|
| + // Retrieves a WebContentsTester to drive tests of the specified WebContents.
|
| + // As noted above you need to be sure the 'contents' object supports testing,
|
| + // i.e. is either created using one of the Create... functions below, or is
|
| + // retrieved via RenderViewHostTestHarness::GetWebContents().
|
| static WebContentsTester* For(WebContents* contents);
|
|
|
| // Creates a WebContents enabled for testing.
|
| @@ -87,7 +82,7 @@
|
| // in question have been made.
|
| virtual int GetNumberOfFocusCalls() = 0;
|
|
|
| - virtual content::RenderViewHost* GetPendingRenderViewHost() const = 0;
|
| + virtual RenderViewHost* GetPendingRenderViewHost() const = 0;
|
|
|
| // Creates a pending navigation to the given URL with the default parameters
|
| // and then commits the load with a page ID one larger than any seen. This
|
| @@ -102,17 +97,17 @@
|
| // Does nothing if no cross-navigation is pending.
|
| virtual void ProceedWithCrossSiteNavigation() = 0;
|
|
|
| - virtual void TestDidNavigate(content::RenderViewHost* render_view_host,
|
| + virtual void TestDidNavigate(RenderViewHost* render_view_host,
|
| int page_id,
|
| const GURL& url,
|
| - content::PageTransition transition) = 0;
|
| + PageTransition transition) = 0;
|
|
|
| virtual void TestDidNavigateWithReferrer(
|
| - content::RenderViewHost* render_view_host,
|
| + RenderViewHost* render_view_host,
|
| int page_id,
|
| const GURL& url,
|
| - const content::Referrer& referrer,
|
| - content::PageTransition transition) = 0;
|
| + const Referrer& referrer,
|
| + PageTransition transition) = 0;
|
|
|
| // Promote GetWebkitPrefs to public.
|
| virtual webkit_glue::WebPreferences TestGetWebkitPrefs() = 0;
|
| @@ -120,4 +115,4 @@
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_TEST_WEB_CONTENTS_TESTER_H_
|
| +#endif // CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_
|
|
|