Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4008)

Unified Diff: chromecast/browser/test/chromecast_browser_test_helper_default.cc

Issue 1870443003: [Chromecast] Enable browser media tests to work on internal builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/browser/test/chromecast_browser_test_helper_default.cc
diff --git a/chromecast/browser/test/chromecast_browser_test_helper_default.cc b/chromecast/browser/test/chromecast_browser_test_helper_default.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c5bf496e7c7d75ef1e61170b088a842b826eb4a
--- /dev/null
+++ b/chromecast/browser/test/chromecast_browser_test_helper_default.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromecast/browser/test/chromecast_browser_test_helper.h"
+
+#include "base/memory/ptr_util.h"
+#include "chromecast/browser/cast_browser_context.h"
+#include "chromecast/browser/cast_browser_process.h"
+#include "chromecast/browser/cast_content_window.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/test_navigation_observer.h"
+
+namespace chromecast {
+namespace shell {
+namespace {
+
+class DefaultHelper : public ChromecastBrowserTestHelper {
+ public:
+ ~DefaultHelper() override {}
+
+ content::WebContents* NavigateToURL(const GURL& url) override {
+ window_.reset(new CastContentWindow);
+ gfx::Size initial_size(1280, 720);
+
+ web_contents_ = window_->CreateWebContents(
+ initial_size, CastBrowserProcess::GetInstance()->browser_context());
+ window_->CreateWindowTree(initial_size, web_contents_.get());
+
+ content::WaitForLoadStop(web_contents_.get());
+ content::TestNavigationObserver same_tab_observer(web_contents_.get(), 1);
+ content::NavigationController::LoadURLParams params(url);
+ params.transition_type = ui::PageTransitionFromInt(
+ ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
+ web_contents_->GetController().LoadURLWithParams(params);
+ same_tab_observer.Wait();
+
+ return web_contents_.get();
+ }
+
+ private:
+ std::unique_ptr<CastContentWindow> window_;
+ std::unique_ptr<content::WebContents> web_contents_;
+};
+
+} // namespace
+
+std::unique_ptr<ChromecastBrowserTestHelper>
+ChromecastBrowserTestHelper::Create() {
+ return base::WrapUnique(new DefaultHelper());
+}
+
+} // namespace shell
+} // namespace chromecast
« no previous file with comments | « chromecast/browser/test/chromecast_browser_test_helper.h ('k') | chromecast/browser/test/chromecast_shell_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698