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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 22885002: c/b/extensions, json_schema_compiler: Do not use Value::Create*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed C-style casts. Created 7 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 ASSERT_TRUE(form_data.get() != NULL); 577 ASSERT_TRUE(form_data.get() != NULL);
578 ASSERT_TRUE(form_data->GetType() == Value::TYPE_DICTIONARY); 578 ASSERT_TRUE(form_data->GetType() == Value::TYPE_DICTIONARY);
579 // Contents of raw. 579 // Contents of raw.
580 ListValue raw; 580 ListValue raw;
581 extensions::subtle::AppendKeyValuePair( 581 extensions::subtle::AppendKeyValuePair(
582 keys::kRequestBodyRawBytesKey, 582 keys::kRequestBodyRawBytesKey,
583 BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), 583 BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length),
584 &raw); 584 &raw);
585 extensions::subtle::AppendKeyValuePair( 585 extensions::subtle::AppendKeyValuePair(
586 keys::kRequestBodyRawFileKey, 586 keys::kRequestBodyRawFileKey,
587 Value::CreateStringValue(std::string()), 587 new base::StringValue(std::string()),
588 &raw); 588 &raw);
589 extensions::subtle::AppendKeyValuePair( 589 extensions::subtle::AppendKeyValuePair(
590 keys::kRequestBodyRawBytesKey, 590 keys::kRequestBodyRawBytesKey,
591 BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), 591 BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length),
592 &raw); 592 &raw);
593 // Summary. 593 // Summary.
594 const Value* const kExpected[] = { 594 const Value* const kExpected[] = {
595 form_data.get(), 595 form_data.get(),
596 NULL, 596 NULL,
597 &raw, 597 &raw,
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 new EventResponseDelta("ext_1", base::Time::FromInternalValue(0))); 1158 new EventResponseDelta("ext_1", base::Time::FromInternalValue(0)));
1159 linked_ptr<EventResponseDelta> b( 1159 linked_ptr<EventResponseDelta> b(
1160 new EventResponseDelta("ext_2", base::Time::FromInternalValue(1000))); 1160 new EventResponseDelta("ext_2", base::Time::FromInternalValue(1000)));
1161 EXPECT_FALSE(InDecreasingExtensionInstallationTimeOrder(a, a)); 1161 EXPECT_FALSE(InDecreasingExtensionInstallationTimeOrder(a, a));
1162 EXPECT_FALSE(InDecreasingExtensionInstallationTimeOrder(a, b)); 1162 EXPECT_FALSE(InDecreasingExtensionInstallationTimeOrder(a, b));
1163 EXPECT_TRUE(InDecreasingExtensionInstallationTimeOrder(b, a)); 1163 EXPECT_TRUE(InDecreasingExtensionInstallationTimeOrder(b, a));
1164 } 1164 }
1165 1165
1166 TEST(ExtensionWebRequestHelpersTest, TestStringToCharList) { 1166 TEST(ExtensionWebRequestHelpersTest, TestStringToCharList) {
1167 ListValue list_value; 1167 ListValue list_value;
1168 list_value.Append(Value::CreateIntegerValue('1')); 1168 list_value.Append(new base::FundamentalValue('1'));
1169 list_value.Append(Value::CreateIntegerValue('2')); 1169 list_value.Append(new base::FundamentalValue('2'));
1170 list_value.Append(Value::CreateIntegerValue('3')); 1170 list_value.Append(new base::FundamentalValue('3'));
1171 list_value.Append(Value::CreateIntegerValue(0xFE)); 1171 list_value.Append(new base::FundamentalValue(0xFE));
1172 list_value.Append(Value::CreateIntegerValue(0xD1)); 1172 list_value.Append(new base::FundamentalValue(0xD1));
1173 1173
1174 unsigned char char_value[] = {'1', '2', '3', 0xFE, 0xD1}; 1174 unsigned char char_value[] = {'1', '2', '3', 0xFE, 0xD1};
1175 std::string string_value(reinterpret_cast<char *>(char_value), 5); 1175 std::string string_value(reinterpret_cast<char *>(char_value), 5);
1176 1176
1177 scoped_ptr<ListValue> converted_list(StringToCharList(string_value)); 1177 scoped_ptr<ListValue> converted_list(StringToCharList(string_value));
1178 EXPECT_TRUE(list_value.Equals(converted_list.get())); 1178 EXPECT_TRUE(list_value.Equals(converted_list.get()));
1179 1179
1180 std::string converted_string; 1180 std::string converted_string;
1181 EXPECT_TRUE(CharListToString(&list_value, &converted_string)); 1181 EXPECT_TRUE(CharListToString(&list_value, &converted_string));
1182 EXPECT_EQ(string_value, converted_string); 1182 EXPECT_EQ(string_value, converted_string);
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 EXPECT_TRUE(credentials_set); 2132 EXPECT_TRUE(credentials_set);
2133 EXPECT_FALSE(auth3.Empty()); 2133 EXPECT_FALSE(auth3.Empty());
2134 EXPECT_EQ(username, auth1.username()); 2134 EXPECT_EQ(username, auth1.username());
2135 EXPECT_EQ(password, auth1.password()); 2135 EXPECT_EQ(password, auth1.password());
2136 EXPECT_EQ(1u, warning_set.size()); 2136 EXPECT_EQ(1u, warning_set.size());
2137 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2137 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2138 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2138 EXPECT_EQ(3u, capturing_net_log.GetSize());
2139 } 2139 }
2140 2140
2141 } // namespace extensions 2141 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698