Commit a9eabd2d authored by James West's avatar James West Committed by Commit Bot

[Chromecast] Add CreateWebView() method to CastBrowserTest

Allow CastWebView to be created and WebContents retrieved so that a
WebContentsObserver can be added before navigating to the URL.

Bug: internal b/73180315
Test: cast_shell_internal_browsertests
Change-Id: I0c47b5f3c1dca4fe9384c6675b3edf6acd51c793
Reviewed-on: https://chromium-review.googlesource.com/923714Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: James West <jameswest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537493}
parent b5986687
......@@ -52,7 +52,7 @@ void CastBrowserTest::PostRunTestOnMainThread() {
cast_web_view_.reset();
}
content::WebContents* CastBrowserTest::NavigateToURL(const GURL& url) {
content::WebContents* CastBrowserTest::CreateWebView() {
CastWebView::CreateParams params;
params.delegate = this;
params.enabled_for_dev = true;
......@@ -61,7 +61,13 @@ content::WebContents* CastBrowserTest::NavigateToURL(const GURL& url) {
nullptr, /* extension */
GURL() /* initial_url */);
content::WebContents* web_contents = cast_web_view_->web_contents();
return cast_web_view_->web_contents();
}
content::WebContents* CastBrowserTest::NavigateToURL(const GURL& url) {
content::WebContents* web_contents =
cast_web_view_ ? cast_web_view_->web_contents() : CreateWebView();
content::WaitForLoadStop(web_contents);
content::TestNavigationObserver same_tab_observer(web_contents, 1);
......
......@@ -38,6 +38,7 @@ class CastBrowserTest : public content::BrowserTestBase, CastWebView::Delegate {
void PreRunTestOnMainThread() override;
void PostRunTestOnMainThread() override;
content::WebContents* CreateWebView();
content::WebContents* NavigateToURL(const GURL& url);
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment