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

Side by Side Diff: extensions/common/message_bundle_unittest.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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/common/message_bundle.cc ('k') | extensions/common/permissions/api_permission.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/common/message_bundle.h" 5 #include "extensions/common/message_bundle.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "extensions/common/error_utils.h" 19 #include "extensions/common/error_utils.h"
20 #include "extensions/common/extension_l10n_util.h" 20 #include "extensions/common/extension_l10n_util.h"
21 #include "extensions/common/manifest_constants.h" 21 #include "extensions/common/manifest_constants.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace extensions { 24 namespace extensions {
25 25
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 std::string error; 153 std::string error;
154 handler_.reset(MessageBundle::Create(catalogs_, &error)); 154 handler_.reset(MessageBundle::Create(catalogs_, &error));
155 155
156 return error; 156 return error;
157 } 157 }
158 158
159 void ClearDictionary() { 159 void ClearDictionary() {
160 handler_->dictionary_.clear(); 160 handler_->dictionary_.clear();
161 } 161 }
162 162
163 scoped_ptr<MessageBundle> handler_; 163 std::unique_ptr<MessageBundle> handler_;
164 std::vector<linked_ptr<base::DictionaryValue> > catalogs_; 164 std::vector<linked_ptr<base::DictionaryValue> > catalogs_;
165 }; 165 };
166 166
167 TEST_F(MessageBundleTest, ReservedMessagesCount) { 167 TEST_F(MessageBundleTest, ReservedMessagesCount) {
168 ASSERT_EQ(5U, ReservedMessagesCount()); 168 ASSERT_EQ(5U, ReservedMessagesCount());
169 } 169 }
170 170
171 TEST_F(MessageBundleTest, InitEmptyDictionaries) { 171 TEST_F(MessageBundleTest, InitEmptyDictionaries) {
172 CreateMessageBundle(); 172 CreateMessageBundle();
173 EXPECT_TRUE(handler_.get() != NULL); 173 EXPECT_TRUE(handler_.get() != NULL);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 messages.insert(std::make_pair("message_name", "message_value")); 428 messages.insert(std::make_pair("message_name", "message_value"));
429 (*GetExtensionToL10nMessagesMap())[extension_id] = messages; 429 (*GetExtensionToL10nMessagesMap())[extension_id] = messages;
430 430
431 L10nMessagesMap* map = GetL10nMessagesMap(extension_id); 431 L10nMessagesMap* map = GetL10nMessagesMap(extension_id);
432 ASSERT_TRUE(NULL != map); 432 ASSERT_TRUE(NULL != map);
433 EXPECT_EQ(1U, map->size()); 433 EXPECT_EQ(1U, map->size());
434 EXPECT_EQ("message_value", (*map)["message_name"]); 434 EXPECT_EQ("message_value", (*map)["message_name"]);
435 } 435 }
436 436
437 } // namespace extensions 437 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/message_bundle.cc ('k') | extensions/common/permissions/api_permission.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698