| 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/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "components/version_info/version_info.h" | 13 #include "components/version_info/version_info.h" |
| 14 #include "content/public/browser/resource_dispatcher_host.h" |
| 14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 15 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 17 #include "extensions/common/constants.h" |
| 16 #include "extensions/shell/browser/desktop_controller.h" | 18 #include "extensions/shell/browser/desktop_controller.h" |
| 17 #include "extensions/shell/browser/shell_content_browser_client.h" | 19 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 18 #include "extensions/shell/browser/shell_extension_system.h" | 20 #include "extensions/shell/browser/shell_extension_system.h" |
| 19 | 21 |
| 20 namespace extensions { | 22 namespace extensions { |
| 21 | 23 |
| 22 AppShellTest::AppShellTest() | 24 AppShellTest::AppShellTest() |
| 23 : browser_context_(nullptr), | 25 : browser_context_(nullptr), |
| 24 extension_system_(nullptr), | 26 extension_system_(nullptr), |
| 25 // Default channel is STABLE but override with UNKNOWN so that unlaunched | 27 // Default channel is STABLE but override with UNKNOWN so that unlaunched |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); | 49 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); |
| 48 SetUpCommandLine(command_line); | 50 SetUpCommandLine(command_line); |
| 49 content::BrowserTestBase::SetUp(); | 51 content::BrowserTestBase::SetUp(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void AppShellTest::SetUpOnMainThread() { | 54 void AppShellTest::SetUpOnMainThread() { |
| 53 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext(); | 55 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext(); |
| 54 | 56 |
| 55 extension_system_ = static_cast<ShellExtensionSystem*>( | 57 extension_system_ = static_cast<ShellExtensionSystem*>( |
| 56 ExtensionSystem::Get(browser_context_)); | 58 ExtensionSystem::Get(browser_context_)); |
| 59 |
| 60 content::ResourceDispatcherHost::Get()->AddSchemeForAccessCheck( |
| 61 extensions::kExtensionScheme); |
| 57 } | 62 } |
| 58 | 63 |
| 59 void AppShellTest::RunTestOnMainThreadLoop() { | 64 void AppShellTest::RunTestOnMainThreadLoop() { |
| 60 base::MessageLoopForUI::current()->RunUntilIdle(); | 65 base::MessageLoopForUI::current()->RunUntilIdle(); |
| 61 | 66 |
| 62 SetUpOnMainThread(); | 67 SetUpOnMainThread(); |
| 63 | 68 |
| 64 RunTestOnMainThread(); | 69 RunTestOnMainThread(); |
| 65 | 70 |
| 66 TearDownOnMainThread(); | 71 TearDownOnMainThread(); |
| 67 | 72 |
| 68 // Clean up the app window. | 73 // Clean up the app window. |
| 69 DesktopController::instance()->CloseAppWindows(); | 74 DesktopController::instance()->CloseAppWindows(); |
| 70 } | 75 } |
| 71 | 76 |
| 72 } // namespace extensions | 77 } // namespace extensions |
| OLD | NEW |