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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 AppShellTest::~AppShellTest() { | 40 AppShellTest::~AppShellTest() { |
41 } | 41 } |
42 | 42 |
43 void AppShellTest::SetUp() { | 43 void AppShellTest::SetUp() { |
44 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 44 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
45 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); | 45 command_line->AppendSwitchASCII(switches::kTestType, "appshell"); |
46 SetUpCommandLine(command_line); | 46 SetUpCommandLine(command_line); |
47 content::BrowserTestBase::SetUp(); | 47 content::BrowserTestBase::SetUp(); |
48 } | 48 } |
49 | 49 |
50 void AppShellTest::SetUpOnMainThread() { | 50 void AppShellTest::PreRunTestOnMainThread() { |
51 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext(); | 51 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext(); |
52 | 52 |
53 extension_system_ = static_cast<ShellExtensionSystem*>( | 53 extension_system_ = static_cast<ShellExtensionSystem*>( |
54 ExtensionSystem::Get(browser_context_)); | 54 ExtensionSystem::Get(browser_context_)); |
55 extension_system_->Init(); | 55 extension_system_->Init(); |
| 56 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 57 base::RunLoop().RunUntilIdle(); |
56 } | 58 } |
57 | 59 |
58 void AppShellTest::RunTestOnMainThreadLoop() { | 60 void AppShellTest::PostRunTestOnMainThread() { |
59 DCHECK(base::MessageLoopForUI::IsCurrent()); | |
60 base::RunLoop().RunUntilIdle(); | |
61 | |
62 SetUpOnMainThread(); | |
63 | |
64 RunTestOnMainThread(); | |
65 | |
66 TearDownOnMainThread(); | |
67 | |
68 // Clean up the app window. | 61 // Clean up the app window. |
69 DesktopController::instance()->CloseAppWindows(); | 62 DesktopController::instance()->CloseAppWindows(); |
70 } | 63 } |
71 | 64 |
72 } // namespace extensions | 65 } // namespace extensions |
OLD | NEW |