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

Side by Side Diff: device/nfc/nfc_ndef_record_unittest.cc

Issue 2285933003: Remove more usage of the base::ListValue::Append(Value*) overload. (Closed)
Patch Set: Small fixes Created 4 years, 3 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 "device/nfc/nfc_ndef_record.h" 5 #include "device/nfc/nfc_ndef_record.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/memory/ptr_util.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 using base::DictionaryValue; 16 using base::DictionaryValue;
16 using base::ListValue; 17 using base::ListValue;
17 using base::StringValue; 18 using base::StringValue;
18 19
19 namespace device { 20 namespace device {
20 21
21 namespace { 22 namespace {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 192
192 // Empty titles value should fail. 193 // Empty titles value should fail.
193 ListValue* list_value = new ListValue(); 194 ListValue* list_value = new ListValue();
194 data.Set(NfcNdefRecord::kFieldTitles, list_value); 195 data.Set(NfcNdefRecord::kFieldTitles, list_value);
195 196
196 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data)); 197 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data));
197 EXPECT_FALSE(record->IsPopulated()); 198 EXPECT_FALSE(record->IsPopulated());
198 199
199 // Title value with missing required field. 200 // Title value with missing required field.
200 DictionaryValue* title_value = new DictionaryValue(); 201 DictionaryValue* title_value = new DictionaryValue();
201 list_value->Append(title_value); 202 list_value->Append(base::WrapUnique(title_value));
202 203
203 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data)); 204 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data));
204 EXPECT_FALSE(record->IsPopulated()); 205 EXPECT_FALSE(record->IsPopulated());
205 206
206 // Title value with invalid "text" field. 207 // Title value with invalid "text" field.
207 title_value->SetInteger(NfcNdefRecord::kFieldText, 0); 208 title_value->SetInteger(NfcNdefRecord::kFieldText, 0);
208 209
209 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data)); 210 EXPECT_FALSE(record->Populate(NfcNdefRecord::kTypeSmartPoster, &data));
210 EXPECT_FALSE(record->IsPopulated()); 211 EXPECT_FALSE(record->IsPopulated());
211 212
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_EQ(kTestText, string_value); 244 EXPECT_EQ(kTestText, string_value);
244 EXPECT_TRUE(const_dictionary_value->GetString( 245 EXPECT_TRUE(const_dictionary_value->GetString(
245 NfcNdefRecord::kFieldLanguageCode, &string_value)); 246 NfcNdefRecord::kFieldLanguageCode, &string_value));
246 EXPECT_EQ(kTestLanguageCode, string_value); 247 EXPECT_EQ(kTestLanguageCode, string_value);
247 EXPECT_TRUE(const_dictionary_value->GetString( 248 EXPECT_TRUE(const_dictionary_value->GetString(
248 NfcNdefRecord::kFieldEncoding, &string_value)); 249 NfcNdefRecord::kFieldEncoding, &string_value));
249 EXPECT_EQ(kTestEncoding, string_value); 250 EXPECT_EQ(kTestEncoding, string_value);
250 } 251 }
251 252
252 } // namespace device 253 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698