| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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.h" | 5 #include "chromecast/browser/test/chromecast_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chromecast/browser/cast_browser_context.h" | 10 #include "chromecast/browser/cast_browser_context.h" |
| 11 #include "chromecast/browser/cast_browser_process.h" | 11 #include "chromecast/browser/cast_browser_process.h" |
| 12 #include "chromecast/browser/cast_content_window.h" |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 16 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 17 | 18 |
| 18 namespace chromecast { | 19 namespace chromecast { |
| 19 namespace shell { | 20 namespace shell { |
| 20 | 21 |
| 21 ChromecastBrowserTest::ChromecastBrowserTest() | 22 ChromecastBrowserTest::ChromecastBrowserTest() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 TearDownOnMainThread(); | 46 TearDownOnMainThread(); |
| 46 | 47 |
| 47 for (content::RenderProcessHost::iterator i( | 48 for (content::RenderProcessHost::iterator i( |
| 48 content::RenderProcessHost::AllHostsIterator()); | 49 content::RenderProcessHost::AllHostsIterator()); |
| 49 !i.IsAtEnd(); i.Advance()) { | 50 !i.IsAtEnd(); i.Advance()) { |
| 50 i.GetCurrentValue()->FastShutdownIfPossible(); | 51 i.GetCurrentValue()->FastShutdownIfPossible(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 web_contents_.reset(); | 54 web_contents_.reset(); |
| 55 window_.reset(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void ChromecastBrowserTest::NavigateToURL(content::WebContents* window, | 58 void ChromecastBrowserTest::NavigateToURL(content::WebContents* window, |
| 57 const GURL& url) { | 59 const GURL& url) { |
| 58 content::WaitForLoadStop(window); | 60 content::WaitForLoadStop(window); |
| 59 content::TestNavigationObserver same_tab_observer(window, 1); | 61 content::TestNavigationObserver same_tab_observer(window, 1); |
| 60 content::NavigationController::LoadURLParams params(url); | 62 content::NavigationController::LoadURLParams params(url); |
| 61 params.transition_type = ui::PageTransitionFromInt( | 63 params.transition_type = ui::PageTransitionFromInt( |
| 62 ui::PAGE_TRANSITION_TYPED | | 64 ui::PAGE_TRANSITION_TYPED | |
| 63 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 65 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 64 window->GetController().LoadURLWithParams(params); | 66 window->GetController().LoadURLWithParams(params); |
| 65 same_tab_observer.Wait(); | 67 same_tab_observer.Wait(); |
| 66 } | 68 } |
| 67 | 69 |
| 68 content::WebContents* ChromecastBrowserTest::CreateBrowser() { | 70 content::WebContents* ChromecastBrowserTest::CreateBrowser() { |
| 69 content::WebContents::CreateParams create_params( | 71 window_.reset(new CastContentWindow); |
| 70 CastBrowserProcess::GetInstance()->browser_context(), | 72 gfx::Size initial_size(1280, 720); |
| 71 NULL); | 73 web_contents_ = window_->Create( |
| 72 create_params.routing_id = MSG_ROUTING_NONE; | 74 initial_size, CastBrowserProcess::GetInstance()->browser_context()); |
| 73 create_params.initial_size = gfx::Size(1280, 720); | |
| 74 web_contents_.reset(content::WebContents::Create(create_params)); | |
| 75 return web_contents_.get(); | 75 return web_contents_.get(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace shell | 78 } // namespace shell |
| 79 } // namespace chromecast | 79 } // namespace chromecast |
| OLD | NEW |