Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: extensions/browser/info_map_unittest.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "content/public/test/test_browser_thread.h" 7 #include "content/public/test/test_browser_thread.h"
8 #include "extensions/browser/info_map.h" 8 #include "extensions/browser/info_map.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 EXPECT_TRUE(extension2->HasOneRef()); 62 EXPECT_TRUE(extension2->HasOneRef());
63 EXPECT_TRUE(extension3->HasOneRef()); 63 EXPECT_TRUE(extension3->HasOneRef());
64 64
65 // Add a ref to each extension and give it to the info map. 65 // Add a ref to each extension and give it to the info map.
66 info_map->AddExtension(extension1.get(), base::Time(), false, false); 66 info_map->AddExtension(extension1.get(), base::Time(), false, false);
67 info_map->AddExtension(extension2.get(), base::Time(), false, false); 67 info_map->AddExtension(extension2.get(), base::Time(), false, false);
68 info_map->AddExtension(extension3.get(), base::Time(), false, false); 68 info_map->AddExtension(extension3.get(), base::Time(), false, false);
69 69
70 // Release extension1, and the info map should have the only ref. 70 // Release extension1, and the info map should have the only ref.
71 const Extension* weak_extension1 = extension1.get(); 71 const Extension* weak_extension1 = extension1.get();
72 extension1 = NULL; 72 extension1 = nullptr;
73 EXPECT_TRUE(weak_extension1->HasOneRef()); 73 EXPECT_TRUE(weak_extension1->HasOneRef());
74 74
75 // Remove extension2, and the extension2 object should have the only ref. 75 // Remove extension2, and the extension2 object should have the only ref.
76 info_map->RemoveExtension( 76 info_map->RemoveExtension(
77 extension2->id(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); 77 extension2->id(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL);
78 EXPECT_TRUE(extension2->HasOneRef()); 78 EXPECT_TRUE(extension2->HasOneRef());
79 79
80 // Delete the info map, and the extension3 object should have the only ref. 80 // Delete the info map, and the extension3 object should have the only ref.
81 info_map = NULL; 81 info_map = nullptr;
82 EXPECT_TRUE(extension3->HasOneRef()); 82 EXPECT_TRUE(extension3->HasOneRef());
83 } 83 }
84 84
85 // Tests that we can query a few extension properties from the InfoMap. 85 // Tests that we can query a few extension properties from the InfoMap.
86 TEST_F(InfoMapTest, Properties) { 86 TEST_F(InfoMapTest, Properties) {
87 scoped_refptr<InfoMap> info_map(new InfoMap()); 87 scoped_refptr<InfoMap> info_map(new InfoMap());
88 88
89 scoped_refptr<Extension> extension1(CreateExtension("extension1")); 89 scoped_refptr<Extension> extension1(CreateExtension("extension1"));
90 scoped_refptr<Extension> extension2(CreateExtension("extension2")); 90 scoped_refptr<Extension> extension2(CreateExtension("extension2"));
91 91
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 EXPECT_TRUE(does_not_exist_path.empty()); 125 EXPECT_TRUE(does_not_exist_path.empty());
126 126
127 // A file does not need to exist to be mapped to a path with the non-blocking 127 // A file does not need to exist to be mapped to a path with the non-blocking
128 // API. This avoids hitting the disk to see if it exists. 128 // API. This avoids hitting the disk to see if it exists.
129 EXPECT_TRUE(info_map->MapUrlToLocalFilePath( 129 EXPECT_TRUE(info_map->MapUrlToLocalFilePath(
130 does_not_exist_url, false /* use_blocking_api */, &does_not_exist_path)); 130 does_not_exist_url, false /* use_blocking_api */, &does_not_exist_path));
131 EXPECT_FALSE(does_not_exist_path.empty()); 131 EXPECT_FALSE(does_not_exist_path.empty());
132 } 132 }
133 133
134 } // namespace extensions 134 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698