Change next_proto member type.
[chromium-blink-merge.git] / chromecast / browser / test / chromecast_browser_test.cc
blobbd5dee6e486c01ad78067f3b9af9fc9b3d82833a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/browser/test/chromecast_browser_test.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "chromecast/browser/cast_browser_context.h"
11 #include "chromecast/browser/cast_browser_process.h"
12 #include "chromecast/browser/cast_content_window.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/web_contents.h"
16 #include "content/public/test/browser_test_utils.h"
17 #include "content/public/test/test_navigation_observer.h"
19 namespace chromecast {
20 namespace shell {
22 ChromecastBrowserTest::ChromecastBrowserTest()
23 : setup_called_(false) {
26 ChromecastBrowserTest::~ChromecastBrowserTest() {
27 CHECK(setup_called_) << "Overridden SetUp() did not call parent "
28 << "implementation, so test not run.";
31 void ChromecastBrowserTest::SetUp() {
32 SetUpCommandLine(base::CommandLine::ForCurrentProcess());
33 setup_called_ = true;
34 BrowserTestBase::SetUp();
37 void ChromecastBrowserTest::RunTestOnMainThreadLoop() {
38 // Pump startup related events.
39 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
40 base::RunLoop().RunUntilIdle();
42 SetUpOnMainThread();
44 RunTestOnMainThread();
46 TearDownOnMainThread();
48 for (content::RenderProcessHost::iterator i(
49 content::RenderProcessHost::AllHostsIterator());
50 !i.IsAtEnd(); i.Advance()) {
51 i.GetCurrentValue()->FastShutdownIfPossible();
54 web_contents_.reset();
55 window_.reset();
58 void ChromecastBrowserTest::NavigateToURL(content::WebContents* window,
59 const GURL& url) {
60 content::WaitForLoadStop(window);
61 content::TestNavigationObserver same_tab_observer(window, 1);
62 content::NavigationController::LoadURLParams params(url);
63 params.transition_type = ui::PageTransitionFromInt(
64 ui::PAGE_TRANSITION_TYPED |
65 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
66 window->GetController().LoadURLWithParams(params);
67 same_tab_observer.Wait();
70 content::WebContents* ChromecastBrowserTest::CreateBrowser() {
71 window_.reset(new CastContentWindow);
72 gfx::Size initial_size(1280, 720);
73 web_contents_ = window_->Create(
74 initial_size, CastBrowserProcess::GetInstance()->browser_context());
75 return web_contents_.get();
78 } // namespace shell
79 } // namespace chromecast