Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include "apps/test/app_shell_test.h" | |
| 6 | |
| 7 #include "apps/apps_client.h" | |
| 8 #include "apps/shell/browser/shell_browser_context.h" | |
| 9 #include "apps/shell/browser/shell_extension_system.h" | |
| 10 #include "apps/shell/browser/shell_extension_system_factory.h" | |
| 11 #include "base/files/file_path.h" | |
| 12 #include "base/logging.h" | |
| 13 #include "base/path_service.h" | |
|
jam
2014/03/20 16:58:13
nit: not needed
Yoyo Zhou
2014/03/20 21:17:30
Done.
| |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 15 #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.
| |
| 16 #include "extensions/browser/extension_system.h" | |
| 17 #include "extensions/browser/renderer_startup_helper.h" | |
| 18 #include "extensions/common/extension_paths.h" | |
| 19 | |
| 20 namespace apps { | |
| 21 | |
| 22 AppShellTest::AppShellTest() {} | |
| 23 | |
| 24 AppShellTest::~AppShellTest() {} | |
| 25 | |
| 26 void AppShellTest::SetUpOnMainThread() { | |
| 27 std::vector<content::BrowserContext*> contexts = | |
| 28 AppsClient::Get()->GetLoadedBrowserContexts(); | |
| 29 CHECK_EQ(1U, contexts.size()); | |
| 30 browser_context_ = contexts[0]; | |
| 31 | |
| 32 extension_system_ = static_cast<extensions::ShellExtensionSystem*>( | |
| 33 extensions::ExtensionSystem::Get(browser_context_)); | |
| 34 } | |
| 35 | |
| 36 void AppShellTest::RunTestOnMainThreadLoop() { | |
| 37 // Pump startup related events. | |
| 38 base::MessageLoopForUI::current()->RunUntilIdle(); | |
| 39 | |
| 40 SetUpOnMainThread(); | |
| 41 | |
| 42 RunTestOnMainThread(); | |
| 43 | |
| 44 TearDownOnMainThread(); | |
| 45 | |
| 46 // TODO(yoz): Make windows close. This doesn't seem to close the root window. | |
| 47 extension_system_->CloseApp(); | |
| 48 } | |
| 49 | |
| 50 bool AppShellTest::LoadAndLaunchApp(const base::FilePath& app_dir) { | |
| 51 return extension_system_->LoadAndLaunchApp(app_dir); | |
| 52 } | |
| 53 | |
| 54 // 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.
| |
| 55 | |
| 56 } // namespace apps | |
| OLD | NEW |