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

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

Issue 2502143002: Revert of [chromecast] Make testnames consistent. (Closed)
Patch Set: Created 4 years, 1 month 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.cc
diff --git a/chromecast/browser/test/chromecast_browser_test.cc b/chromecast/browser/test/chromecast_browser_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5bc37200ae111b2a1b087047a2d72422bc632cf2
--- /dev/null
+++ b/chromecast/browser/test/chromecast_browser_test.cc
@@ -0,0 +1,71 @@
+// Copyright 2014 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.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/run_loop.h"
+#include "chromecast/base/metrics/cast_metrics_helper.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/browser_thread.h"
+#include "content/public/browser/render_process_host.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 {
+
+ChromecastBrowserTest::ChromecastBrowserTest() {}
+
+ChromecastBrowserTest::~ChromecastBrowserTest() {}
+
+void ChromecastBrowserTest::SetUp() {
+ SetUpCommandLine(base::CommandLine::ForCurrentProcess());
+
+ BrowserTestBase::SetUp();
+}
+
+void ChromecastBrowserTest::TearDownOnMainThread() {
+ web_contents_.reset();
+ window_.reset();
+
+ BrowserTestBase::TearDownOnMainThread();
+}
+
+void ChromecastBrowserTest::RunTestOnMainThreadLoop() {
+ // Pump startup related events.
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ base::RunLoop().RunUntilIdle();
+
+ metrics::CastMetricsHelper::GetInstance()->SetDummySessionIdForTesting();
+
+ SetUpOnMainThread();
+ RunTestOnMainThread();
+ TearDownOnMainThread();
+}
+
+content::WebContents* ChromecastBrowserTest::NavigateToURL(const GURL& url) {
+ window_ = base::MakeUnique<CastContentWindow>();
+
+ web_contents_ = window_->CreateWebContents(
+ CastBrowserProcess::GetInstance()->browser_context());
+ window_->CreateWindowTree(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();
+}
+
+} // namespace shell
+} // namespace chromecast
« no previous file with comments | « chromecast/browser/test/chromecast_browser_test.h ('k') | chromecast/browser/test/chromecast_browser_test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698