OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/shell/test/shell_test.h" | 5 #include "extensions/shell/test/shell_test.h" |
6 | 6 |
| 7 #include "base/base_paths.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" |
9 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
10 #include "extensions/browser/extension_system.h" | 13 #include "extensions/browser/extension_system.h" |
11 #include "extensions/shell/browser/desktop_controller.h" | 14 #include "extensions/shell/browser/desktop_controller.h" |
12 #include "extensions/shell/browser/shell_content_browser_client.h" | 15 #include "extensions/shell/browser/shell_content_browser_client.h" |
13 #include "extensions/shell/browser/shell_extension_system.h" | 16 #include "extensions/shell/browser/shell_extension_system.h" |
14 | 17 |
15 namespace extensions { | 18 namespace extensions { |
16 | 19 |
17 AppShellTest::AppShellTest() : browser_context_(NULL), extension_system_(NULL) { | 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 app_shell_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 |
18 } | 33 } |
19 | 34 |
20 AppShellTest::~AppShellTest() { | 35 AppShellTest::~AppShellTest() { |
21 } | 36 } |
22 | 37 |
23 void AppShellTest::SetUp() { | 38 void AppShellTest::SetUp() { |
24 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
25 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); | 40 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); |
26 SetUpCommandLine(command_line); | 41 SetUpCommandLine(command_line); |
27 content::BrowserTestBase::SetUp(); | 42 content::BrowserTestBase::SetUp(); |
(...skipping 13 matching lines...) Expand all Loading... |
41 | 56 |
42 RunTestOnMainThread(); | 57 RunTestOnMainThread(); |
43 | 58 |
44 TearDownOnMainThread(); | 59 TearDownOnMainThread(); |
45 | 60 |
46 // Clean up the app window. | 61 // Clean up the app window. |
47 DesktopController::instance()->CloseAppWindows(); | 62 DesktopController::instance()->CloseAppWindows(); |
48 } | 63 } |
49 | 64 |
50 } // namespace extensions | 65 } // namespace extensions |
OLD | NEW |