| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/files/file_enumerator.h" | 21 #include "base/files/file_enumerator.h" |
| 22 #include "base/files/file_util.h" | 22 #include "base/files/file_util.h" |
| 23 #include "base/files/scoped_temp_dir.h" | 23 #include "base/files/scoped_temp_dir.h" |
| 24 #include "base/json/json_file_value_serializer.h" | 24 #include "base/json/json_file_value_serializer.h" |
| 25 #include "base/json/json_reader.h" | 25 #include "base/json/json_reader.h" |
| 26 #include "base/json/json_string_value_serializer.h" | 26 #include "base/json/json_string_value_serializer.h" |
| 27 #include "base/location.h" | 27 #include "base/location.h" |
| 28 #include "base/macros.h" | 28 #include "base/macros.h" |
| 29 #include "base/memory/ptr_util.h" | 29 #include "base/memory/ptr_util.h" |
| 30 #include "base/memory/weak_ptr.h" | 30 #include "base/memory/weak_ptr.h" |
| 31 #include "base/run_loop.h" |
| 31 #include "base/single_thread_task_runner.h" | 32 #include "base/single_thread_task_runner.h" |
| 32 #include "base/stl_util.h" | 33 #include "base/stl_util.h" |
| 33 #include "base/strings/pattern.h" | 34 #include "base/strings/pattern.h" |
| 34 #include "base/strings/string16.h" | 35 #include "base/strings/string16.h" |
| 35 #include "base/strings/string_number_conversions.h" | 36 #include "base/strings/string_number_conversions.h" |
| 36 #include "base/strings/string_util.h" | 37 #include "base/strings/string_util.h" |
| 37 #include "base/strings/utf_string_conversions.h" | 38 #include "base/strings/utf_string_conversions.h" |
| 38 #include "base/threading/thread_task_runner_handle.h" | 39 #include "base/threading/thread_task_runner_handle.h" |
| 39 #include "base/version.h" | 40 #include "base/version.h" |
| 40 #include "build/build_config.h" | 41 #include "build/build_config.h" |
| (...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 new extensions::PackExtensionJob(&pack_client, output_dir, | 1964 new extensions::PackExtensionJob(&pack_client, output_dir, |
| 1964 base::FilePath(), | 1965 base::FilePath(), |
| 1965 ExtensionCreator::kOverwriteCRX)); | 1966 ExtensionCreator::kOverwriteCRX)); |
| 1966 packer->Start(); | 1967 packer->Start(); |
| 1967 | 1968 |
| 1968 // The packer will post a notification task to the current thread's message | 1969 // The packer will post a notification task to the current thread's message |
| 1969 // loop when it is finished. We manually run the loop here so that we | 1970 // loop when it is finished. We manually run the loop here so that we |
| 1970 // block and catch the notification; otherwise, the process would exit. | 1971 // block and catch the notification; otherwise, the process would exit. |
| 1971 // This call to |Run()| is matched by a call to |Quit()| in the | 1972 // This call to |Run()| is matched by a call to |Quit()| in the |
| 1972 // |PackExtensionTestClient|'s notification handling code. | 1973 // |PackExtensionTestClient|'s notification handling code. |
| 1973 base::MessageLoop::current()->Run(); | 1974 base::RunLoop().Run(); |
| 1974 | 1975 |
| 1975 if (HasFatalFailure()) | 1976 if (HasFatalFailure()) |
| 1976 return; | 1977 return; |
| 1977 | 1978 |
| 1978 InstallCRX(expected_crx_path, INSTALL_NEW); | 1979 InstallCRX(expected_crx_path, INSTALL_NEW); |
| 1979 } | 1980 } |
| 1980 } | 1981 } |
| 1981 | 1982 |
| 1982 TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { | 1983 TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { |
| 1983 InitializeEmptyExtensionService(); | 1984 InitializeEmptyExtensionService(); |
| (...skipping 4831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6815 | 6816 |
| 6816 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6817 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 6817 content::Source<Profile>(profile()), | 6818 content::Source<Profile>(profile()), |
| 6818 content::NotificationService::NoDetails()); | 6819 content::NotificationService::NoDetails()); |
| 6819 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6820 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 6820 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6821 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 6821 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6822 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 6822 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6823 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 6823 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6824 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 6824 } | 6825 } |
| OLD | NEW |