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

Unified Diff: apps/test/app_shell_test.cc

Issue 205653002: Add apps_browsertests target (currently running 0 tests). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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: apps/test/app_shell_test.cc
diff --git a/apps/test/app_shell_test.cc b/apps/test/app_shell_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..971faef7ca695708e7f089f62fc9d103515a58c4
--- /dev/null
+++ b/apps/test/app_shell_test.cc
@@ -0,0 +1,56 @@
+// 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 "apps/test/app_shell_test.h"
+
+#include "apps/apps_client.h"
+#include "apps/shell/browser/shell_browser_context.h"
+#include "apps/shell/browser/shell_extension_system.h"
+#include "apps/shell/browser/shell_extension_system_factory.h"
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/path_service.h"
jam 2014/03/20 16:58:13 nit: not needed
Yoyo Zhou 2014/03/20 21:17:30 Done.
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/notification_service.h"
jam 2014/03/20 16:58:13 nit: not needed
Yoyo Zhou 2014/03/20 21:17:30 Done.
+#include "extensions/browser/extension_system.h"
+#include "extensions/browser/renderer_startup_helper.h"
+#include "extensions/common/extension_paths.h"
+
+namespace apps {
+
+AppShellTest::AppShellTest() {}
+
+AppShellTest::~AppShellTest() {}
+
+void AppShellTest::SetUpOnMainThread() {
+ std::vector<content::BrowserContext*> contexts =
+ AppsClient::Get()->GetLoadedBrowserContexts();
+ CHECK_EQ(1U, contexts.size());
+ browser_context_ = contexts[0];
+
+ extension_system_ = static_cast<extensions::ShellExtensionSystem*>(
+ extensions::ExtensionSystem::Get(browser_context_));
+}
+
+void AppShellTest::RunTestOnMainThreadLoop() {
+ // Pump startup related events.
+ base::MessageLoopForUI::current()->RunUntilIdle();
+
+ SetUpOnMainThread();
+
+ RunTestOnMainThread();
+
+ TearDownOnMainThread();
+
+ // TODO(yoz): Make windows close. This doesn't seem to close the root window.
+ extension_system_->CloseApp();
+}
+
+bool AppShellTest::LoadAndLaunchApp(const base::FilePath& app_dir) {
+ return extension_system_->LoadAndLaunchApp(app_dir);
+}
+
+// TODO(yoz): Add some tests.
jam 2014/03/20 16:58:13 I'm not understanding this comment. the tests woul
Yoyo Zhou 2014/03/20 21:17:30 Removed.
+
+} // namespace apps

Powered by Google App Engine
This is Rietveld 408576698