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_apitest.h" | 5 #include "extensions/shell/test/shell_apitest.h" |
6 | 6 |
| 7 #include "apps/launcher.h" |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
9 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
10 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
11 #include "extensions/browser/extension_registry.h" | 12 #include "extensions/browser/extension_registry.h" |
12 #include "extensions/browser/notification_types.h" | 13 #include "extensions/browser/notification_types.h" |
| 14 #include "extensions/common/constants.h" |
13 #include "extensions/common/extension_paths.h" | 15 #include "extensions/common/extension_paths.h" |
14 #include "extensions/shell/browser/shell_extension_system.h" | 16 #include "extensions/shell/browser/shell_extension_system.h" |
15 #include "extensions/test/result_catcher.h" | 17 #include "extensions/test/result_catcher.h" |
16 | 18 |
17 namespace extensions { | 19 namespace extensions { |
18 | 20 |
19 ShellApiTest::ShellApiTest() { | 21 ShellApiTest::ShellApiTest() { |
20 } | 22 } |
21 | 23 |
22 ShellApiTest::~ShellApiTest() { | 24 ShellApiTest::~ShellApiTest() { |
23 } | 25 } |
24 | 26 |
25 const Extension* ShellApiTest::LoadApp(const std::string& app_dir) { | 27 const Extension* ShellApiTest::LoadApp(const std::string& app_dir) { |
26 base::ThreadRestrictions::ScopedAllowIO allow_io; | 28 base::ThreadRestrictions::ScopedAllowIO allow_io; |
27 base::FilePath test_data_dir; | 29 base::FilePath test_data_dir; |
28 PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); | 30 PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); |
29 test_data_dir = test_data_dir.AppendASCII(app_dir); | 31 test_data_dir = test_data_dir.AppendASCII(app_dir); |
30 | 32 |
31 const Extension* extension = extension_system_->LoadApp(test_data_dir); | 33 const Extension* extension = extension_system_->LoadApp(test_data_dir); |
32 if (!extension) | 34 if (!extension) |
33 return NULL; | 35 return NULL; |
34 | 36 |
35 extension_system_->LaunchApp(extension->id()); | 37 apps::LaunchPlatformApp(browser_context(), extension, |
| 38 extensions::SOURCE_UNTRACKED); |
36 | 39 |
37 return extension; | 40 return extension; |
38 } | 41 } |
39 | 42 |
40 bool ShellApiTest::RunAppTest(const std::string& app_dir) { | 43 bool ShellApiTest::RunAppTest(const std::string& app_dir) { |
41 ResultCatcher catcher; | 44 ResultCatcher catcher; |
42 | 45 |
43 const Extension* extension = LoadApp(app_dir); | 46 const Extension* extension = LoadApp(app_dir); |
44 if (!extension) | 47 if (!extension) |
45 return false; | 48 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
59 UnloadedExtensionReason reason(UnloadedExtensionReason::DISABLE); | 62 UnloadedExtensionReason reason(UnloadedExtensionReason::DISABLE); |
60 registry->TriggerOnUnloaded(app, reason); | 63 registry->TriggerOnUnloaded(app, reason); |
61 | 64 |
62 content::NotificationService::current()->Notify( | 65 content::NotificationService::current()->Notify( |
63 extensions::NOTIFICATION_EXTENSION_REMOVED, | 66 extensions::NOTIFICATION_EXTENSION_REMOVED, |
64 content::Source<content::BrowserContext>(browser_context()), | 67 content::Source<content::BrowserContext>(browser_context()), |
65 content::Details<const Extension>(app)); | 68 content::Details<const Extension>(app)); |
66 } | 69 } |
67 | 70 |
68 } // namespace extensions | 71 } // namespace extensions |
OLD | NEW |