| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromecast/browser/test/chromecast_browser_test_helper.h" | 5 #include "chromecast/browser/test/chromecast_browser_test_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chromecast/browser/cast_browser_context.h" | 8 #include "chromecast/browser/cast_browser_context.h" |
| 9 #include "chromecast/browser/cast_browser_process.h" | 9 #include "chromecast/browser/cast_browser_process.h" |
| 10 #include "chromecast/browser/cast_content_window.h" | 10 #include "chromecast/browser/cast_content_window.h" |
| 11 #include "chromecast/browser/cast_media_blocker.h" | 11 #include "chromecast/browser/cast_media_blocker.h" |
| 12 #include "content/public/browser/media_session.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/test_navigation_observer.h" | 15 #include "content/public/test/test_navigation_observer.h" |
| 15 | 16 |
| 16 namespace chromecast { | 17 namespace chromecast { |
| 17 namespace shell { | 18 namespace shell { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class DefaultHelper : public ChromecastBrowserTestHelper { | 21 class DefaultHelper : public ChromecastBrowserTestHelper { |
| 21 public: | 22 public: |
| 22 ~DefaultHelper() override {} | 23 ~DefaultHelper() override {} |
| 23 | 24 |
| 24 content::WebContents* NavigateToURL(const GURL& url) override { | 25 content::WebContents* NavigateToURL(const GURL& url) override { |
| 25 window_.reset(new CastContentWindow); | 26 window_.reset(new CastContentWindow); |
| 26 | 27 |
| 27 web_contents_ = window_->CreateWebContents( | 28 web_contents_ = window_->CreateWebContents( |
| 28 CastBrowserProcess::GetInstance()->browser_context()); | 29 CastBrowserProcess::GetInstance()->browser_context()); |
| 29 window_->CreateWindowTree(web_contents_.get()); | 30 window_->CreateWindowTree(web_contents_.get()); |
| 30 blocker_.reset(new CastMediaBlocker(web_contents_.get())); | 31 blocker_.reset(new CastMediaBlocker( |
| 32 content::MediaSession::Get(web_contents_.get()), web_contents_.get())); |
| 31 | 33 |
| 32 content::WaitForLoadStop(web_contents_.get()); | 34 content::WaitForLoadStop(web_contents_.get()); |
| 33 content::TestNavigationObserver same_tab_observer(web_contents_.get(), 1); | 35 content::TestNavigationObserver same_tab_observer(web_contents_.get(), 1); |
| 34 content::NavigationController::LoadURLParams params(url); | 36 content::NavigationController::LoadURLParams params(url); |
| 35 params.transition_type = ui::PageTransitionFromInt( | 37 params.transition_type = ui::PageTransitionFromInt( |
| 36 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 38 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 37 web_contents_->GetController().LoadURLWithParams(params); | 39 web_contents_->GetController().LoadURLWithParams(params); |
| 38 same_tab_observer.Wait(); | 40 same_tab_observer.Wait(); |
| 39 | 41 |
| 40 return web_contents_.get(); | 42 return web_contents_.get(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 | 54 |
| 53 } // namespace | 55 } // namespace |
| 54 | 56 |
| 55 std::unique_ptr<ChromecastBrowserTestHelper> | 57 std::unique_ptr<ChromecastBrowserTestHelper> |
| 56 ChromecastBrowserTestHelper::Create() { | 58 ChromecastBrowserTestHelper::Create() { |
| 57 return base::MakeUnique<DefaultHelper>(); | 59 return base::MakeUnique<DefaultHelper>(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 } // namespace shell | 62 } // namespace shell |
| 61 } // namespace chromecast | 63 } // namespace chromecast |
| OLD | NEW |