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

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

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
« no previous file with comments | « extensions/browser/error_map.cc ('k') | extensions/browser/event_listener_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/error_map.h" 5 #include "extensions/browser/error_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "components/crx_file/id_util.h" 14 #include "components/crx_file/id_util.h"
15 #include "extensions/browser/extension_error.h" 15 #include "extensions/browser/extension_error.h"
16 #include "extensions/browser/extension_error_test_util.h" 16 #include "extensions/browser/extension_error_test_util.h"
17 #include "extensions/common/constants.h" 17 #include "extensions/common/constants.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 using error_test_util::CreateNewRuntimeError; 22 using error_test_util::CreateNewRuntimeError;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const size_t kNumErrors = 3u; 144 const size_t kNumErrors = 3u;
145 145
146 // Report three errors. 146 // Report three errors.
147 for (size_t i = 0; i < kNumErrors; ++i) { 147 for (size_t i = 0; i < kNumErrors; ++i) {
148 ASSERT_TRUE( 148 ASSERT_TRUE(
149 errors_.AddError(CreateNewRuntimeError(kId, base::SizeTToString(i)))); 149 errors_.AddError(CreateNewRuntimeError(kId, base::SizeTToString(i))));
150 } 150 }
151 151
152 // Create an error identical to the second error reported, save its 152 // Create an error identical to the second error reported, save its
153 // location, and add it to the error map. 153 // location, and add it to the error map.
154 scoped_ptr<ExtensionError> runtime_error2 = 154 std::unique_ptr<ExtensionError> runtime_error2 =
155 CreateNewRuntimeError(kId, base::UintToString(1u)); 155 CreateNewRuntimeError(kId, base::UintToString(1u));
156 const ExtensionError* weak_error = runtime_error2.get(); 156 const ExtensionError* weak_error = runtime_error2.get();
157 ASSERT_TRUE(errors_.AddError(std::move(runtime_error2))); 157 ASSERT_TRUE(errors_.AddError(std::move(runtime_error2)));
158 158
159 // We should only have three errors stored, since two of the four reported 159 // We should only have three errors stored, since two of the four reported
160 // were identical, and the older should have been replaced. 160 // were identical, and the older should have been replaced.
161 ASSERT_EQ(1u, errors_.size()); 161 ASSERT_EQ(1u, errors_.size());
162 const ErrorList& list = errors_.GetErrorsForExtension(kId); 162 const ErrorList& list = errors_.GetErrorsForExtension(kId);
163 ASSERT_EQ(kNumErrors, list.size()); 163 ASSERT_EQ(kNumErrors, list.size());
164 164
165 // The duplicate error should be the last reported (pointer comparison)... 165 // The duplicate error should be the last reported (pointer comparison)...
166 ASSERT_EQ(weak_error, list.back()); 166 ASSERT_EQ(weak_error, list.back());
167 // ... and should have two reported occurrences. 167 // ... and should have two reported occurrences.
168 ASSERT_EQ(2u, list.back()->occurrences()); 168 ASSERT_EQ(2u, list.back()->occurrences());
169 } 169 }
170 170
171 } // namespace extensions 171 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/error_map.cc ('k') | extensions/browser/event_listener_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698