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

Unified Diff: ash/test/ash_test_environment_content.cc

Issue 2296973002: Moves ash content specific tests into ash_content_unittests (Closed)
Patch Set: add dep to base test suport Created 4 years, 3 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
« no previous file with comments | « ash/test/ash_test_environment_content.h ('k') | ash/test/ash_test_environment_default.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/ash_test_environment_content.cc
diff --git a/ash/test/ash_test_environment_content.cc b/ash/test/ash_test_environment_content.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0e5123730ab39b6f5872b57c62ce53e0675b75ed
--- /dev/null
+++ b/ash/test/ash_test_environment_content.cc
@@ -0,0 +1,70 @@
+// 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 "ash/test/ash_test_environment_content.h"
+
+#include "ash/test/ash_test_views_delegate.h"
+#include "ash/test/content/test_shell_content_state.h"
+#include "base/memory/ptr_util.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/web_contents_tester.h"
+
+namespace ash {
+namespace test {
+namespace {
+
+class AshTestViewsDelegateContent : public AshTestViewsDelegate {
+ public:
+ AshTestViewsDelegateContent() {}
+ ~AshTestViewsDelegateContent() override {}
+
+ // AshTestViewsDelegate:
+ content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) override {
+ return content::WebContentsTester::CreateTestWebContents(browser_context,
+ site_instance);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegateContent);
+};
+
+} // namespace
+
+// static
+std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
+ return base::MakeUnique<AshTestEnvironmentContent>();
+}
+
+AshTestEnvironmentContent::AshTestEnvironmentContent()
+ : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {}
+
+AshTestEnvironmentContent::~AshTestEnvironmentContent() {}
+
+void AshTestEnvironmentContent::SetUp() {
+ ShellContentState* content_state = content_state_;
+ if (!content_state) {
+ test_shell_content_state_ = new TestShellContentState;
+ content_state = test_shell_content_state_;
+ }
+ ShellContentState::SetInstance(content_state);
+}
+
+void AshTestEnvironmentContent::TearDown() {
+ ShellContentState::DestroyInstance();
+}
+
+base::SequencedWorkerPool* AshTestEnvironmentContent::GetBlockingPool() {
+ return content::BrowserThread::GetBlockingPool();
+}
+
+std::unique_ptr<views::ViewsDelegate>
+AshTestEnvironmentContent::CreateViewsDelegate() {
+ return base::MakeUnique<AshTestViewsDelegateContent>();
+}
+
+} // namespace test
+} // namespace ash
« no previous file with comments | « ash/test/ash_test_environment_content.h ('k') | ash/test/ash_test_environment_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698