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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
10 #include "extensions/browser/extension_registry.h" | 11 #include "extensions/browser/extension_registry.h" |
11 #include "extensions/browser/notification_types.h" | 12 #include "extensions/browser/notification_types.h" |
12 #include "extensions/common/extension_paths.h" | 13 #include "extensions/common/extension_paths.h" |
13 #include "extensions/shell/browser/shell_extension_system.h" | 14 #include "extensions/shell/browser/shell_extension_system.h" |
14 #include "extensions/test/result_catcher.h" | 15 #include "extensions/test/result_catcher.h" |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 ShellApiTest::ShellApiTest() { | 19 ShellApiTest::ShellApiTest() { |
19 } | 20 } |
20 | 21 |
21 ShellApiTest::~ShellApiTest() { | 22 ShellApiTest::~ShellApiTest() { |
22 } | 23 } |
23 | 24 |
24 const Extension* ShellApiTest::LoadApp(const std::string& app_dir) { | 25 const Extension* ShellApiTest::LoadApp(const std::string& app_dir) { |
| 26 base::ThreadRestrictions::ScopedAllowIO allow_io; |
25 base::FilePath test_data_dir; | 27 base::FilePath test_data_dir; |
26 PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); | 28 PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); |
27 test_data_dir = test_data_dir.AppendASCII(app_dir); | 29 test_data_dir = test_data_dir.AppendASCII(app_dir); |
28 | 30 |
29 const Extension* extension = extension_system_->LoadApp(test_data_dir); | 31 const Extension* extension = extension_system_->LoadApp(test_data_dir); |
30 if (!extension) | 32 if (!extension) |
31 return NULL; | 33 return NULL; |
32 | 34 |
33 extension_system_->LaunchApp(extension->id()); | 35 extension_system_->LaunchApp(extension->id()); |
34 | 36 |
(...skipping 22 matching lines...) Expand all Loading... |
57 UnloadedExtensionInfo::Reason reason(UnloadedExtensionInfo::REASON_DISABLE); | 59 UnloadedExtensionInfo::Reason reason(UnloadedExtensionInfo::REASON_DISABLE); |
58 registry->TriggerOnUnloaded(app, reason); | 60 registry->TriggerOnUnloaded(app, reason); |
59 | 61 |
60 content::NotificationService::current()->Notify( | 62 content::NotificationService::current()->Notify( |
61 extensions::NOTIFICATION_EXTENSION_REMOVED, | 63 extensions::NOTIFICATION_EXTENSION_REMOVED, |
62 content::Source<content::BrowserContext>(browser_context()), | 64 content::Source<content::BrowserContext>(browser_context()), |
63 content::Details<const Extension>(app)); | 65 content::Details<const Extension>(app)); |
64 } | 66 } |
65 | 67 |
66 } // namespace extensions | 68 } // namespace extensions |
OLD | NEW |