| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/browser/info_map.h" | 5 #include "extensions/browser/info_map.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "content/public/test/test_browser_thread_bundle.h" | 8 #include "content/public/test/test_browser_thread_bundle.h" |
| 9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
| 10 #include "extensions/common/extension_paths.h" | 10 #include "extensions/common/extension_paths.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 info_map->AddExtension(extension2.get(), base::Time(), false, false); | 61 info_map->AddExtension(extension2.get(), base::Time(), false, false); |
| 62 info_map->AddExtension(extension3.get(), base::Time(), false, false); | 62 info_map->AddExtension(extension3.get(), base::Time(), false, false); |
| 63 | 63 |
| 64 // Release extension1, and the info map should have the only ref. | 64 // Release extension1, and the info map should have the only ref. |
| 65 const Extension* weak_extension1 = extension1.get(); | 65 const Extension* weak_extension1 = extension1.get(); |
| 66 extension1 = NULL; | 66 extension1 = NULL; |
| 67 EXPECT_TRUE(weak_extension1->HasOneRef()); | 67 EXPECT_TRUE(weak_extension1->HasOneRef()); |
| 68 | 68 |
| 69 // Remove extension2, and the extension2 object should have the only ref. | 69 // Remove extension2, and the extension2 object should have the only ref. |
| 70 info_map->RemoveExtension( | 70 info_map->RemoveExtension( |
| 71 extension2->id(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); | 71 extension2->id(), extensions::UnloadedExtensionReason::REASON_UNINSTALL); |
| 72 EXPECT_TRUE(extension2->HasOneRef()); | 72 EXPECT_TRUE(extension2->HasOneRef()); |
| 73 | 73 |
| 74 // Delete the info map, and the extension3 object should have the only ref. | 74 // Delete the info map, and the extension3 object should have the only ref. |
| 75 info_map = NULL; | 75 info_map = NULL; |
| 76 EXPECT_TRUE(extension3->HasOneRef()); | 76 EXPECT_TRUE(extension3->HasOneRef()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Tests that we can query a few extension properties from the InfoMap. | 79 // Tests that we can query a few extension properties from the InfoMap. |
| 80 TEST_F(InfoMapTest, Properties) { | 80 TEST_F(InfoMapTest, Properties) { |
| 81 scoped_refptr<InfoMap> info_map(new InfoMap()); | 81 scoped_refptr<InfoMap> info_map(new InfoMap()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 EXPECT_TRUE(does_not_exist_path.empty()); | 119 EXPECT_TRUE(does_not_exist_path.empty()); |
| 120 | 120 |
| 121 // A file does not need to exist to be mapped to a path with the non-blocking | 121 // A file does not need to exist to be mapped to a path with the non-blocking |
| 122 // API. This avoids hitting the disk to see if it exists. | 122 // API. This avoids hitting the disk to see if it exists. |
| 123 EXPECT_TRUE(info_map->MapUrlToLocalFilePath( | 123 EXPECT_TRUE(info_map->MapUrlToLocalFilePath( |
| 124 does_not_exist_url, false /* use_blocking_api */, &does_not_exist_path)); | 124 does_not_exist_url, false /* use_blocking_api */, &does_not_exist_path)); |
| 125 EXPECT_FALSE(does_not_exist_path.empty()); | 125 EXPECT_FALSE(does_not_exist_path.empty()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace extensions | 128 } // namespace extensions |
| OLD | NEW |