Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / extensions / shell / test / shell_test.cc
blob183303a645daca2989f602c661a5b233cd7fea61
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
3 // found in the LICENSE file.
5 #include "extensions/shell/test/shell_test.h"
7 #include "base/base_paths.h"
8 #include "base/command_line.h"
9 #include "base/files/file_path.h"
10 #include "base/logging.h"
11 #include "base/path_service.h"
12 #include "content/public/common/content_switches.h"
13 #include "extensions/browser/extension_system.h"
14 #include "extensions/shell/browser/desktop_controller.h"
15 #include "extensions/shell/browser/shell_content_browser_client.h"
16 #include "extensions/shell/browser/shell_extension_system.h"
18 namespace extensions {
20 AppShellTest::AppShellTest() : browser_context_(NULL), extension_system_(NULL) {
21 #if defined(OS_MACOSX)
22 // TODO(phajdan.jr): Make browser tests self-contained on Mac; remove this.
23 // Set up the application path as though we we are inside the App Shell.app
24 // bundle, rather than the top-level extensions_browsertests, because we
25 // make many assumptions about where the executable is located.
26 base::FilePath app_shell_path;
27 CHECK(PathService::Get(base::FILE_EXE, &app_shell_path));
28 app_shell_path = app_shell_path.DirName();
29 app_shell_path = app_shell_path.Append(
30 FILE_PATH_LITERAL("App Shell.app/Contents/MacOS/App Shell"));
31 CHECK(PathService::Override(base::FILE_EXE, app_shell_path));
32 #endif
35 AppShellTest::~AppShellTest() {
38 void AppShellTest::SetUp() {
39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
40 command_line->AppendSwitchASCII(switches::kTestType, "appshell");
41 SetUpCommandLine(command_line);
42 content::BrowserTestBase::SetUp();
45 void AppShellTest::SetUpOnMainThread() {
46 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext();
48 extension_system_ = static_cast<ShellExtensionSystem*>(
49 ExtensionSystem::Get(browser_context_));
52 void AppShellTest::RunTestOnMainThreadLoop() {
53 base::MessageLoopForUI::current()->RunUntilIdle();
55 SetUpOnMainThread();
57 RunTestOnMainThread();
59 TearDownOnMainThread();
61 // Clean up the app window.
62 DesktopController::instance()->CloseAppWindows();
65 } // namespace extensions