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

Side by Side Diff: content/child/v8_value_converter_impl_unittest.cc

Issue 2036893002: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 "content/child/v8_value_converter_impl.h" 5 #include "content/child/v8_value_converter_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 EXPECT_EQ(100, GetInt(converted, 0)); 561 EXPECT_EQ(100, GetInt(converted, 0));
562 EXPECT_EQ(200, GetInt(converted, 1)); 562 EXPECT_EQ(200, GetInt(converted, 1));
563 EXPECT_EQ(300, GetInt(converted, 2)); 563 EXPECT_EQ(300, GetInt(converted, 2));
564 564
565 // Getters/setters shouldn't be triggered while accessing existing values. 565 // Getters/setters shouldn't be triggered while accessing existing values.
566 EXPECT_EQ(1, GetInt(result, "getters")); 566 EXPECT_EQ(1, GetInt(result, "getters"));
567 EXPECT_EQ(1, GetInt(result, "setters")); 567 EXPECT_EQ(1, GetInt(result, "setters"));
568 568
569 // Try again, using an array without the index. 569 // Try again, using an array without the index.
570 base::ListValue one_item_list; 570 base::ListValue one_item_list;
571 one_item_list.Append(new base::FundamentalValue(123456)); 571 one_item_list.AppendInteger(123456);
572 v8::Local<v8::Array> converted2 = 572 v8::Local<v8::Array> converted2 =
573 converter.ToV8Value(&one_item_list, context).As<v8::Array>(); 573 converter.ToV8Value(&one_item_list, context).As<v8::Array>();
574 EXPECT_FALSE(converted2.IsEmpty()); 574 EXPECT_FALSE(converted2.IsEmpty());
575 575
576 // Getters/setters shouldn't be triggered during the conversion. 576 // Getters/setters shouldn't be triggered during the conversion.
577 EXPECT_EQ(1, GetInt(result, "getters")); 577 EXPECT_EQ(1, GetInt(result, "getters"));
578 EXPECT_EQ(1, GetInt(result, "setters")); 578 EXPECT_EQ(1, GetInt(result, "setters"));
579 579
580 EXPECT_EQ(1u, converted2->Length()); 580 EXPECT_EQ(1u, converted2->Length());
581 EXPECT_EQ(123456, GetInt(converted2, 0)); 581 EXPECT_EQ(123456, GetInt(converted2, 0));
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 EXPECT_TRUE( 1120 EXPECT_TRUE(
1121 base::Value::Equals(reference_number_value.get(), number_value.get())); 1121 base::Value::Equals(reference_number_value.get(), number_value.get()));
1122 1122
1123 v8::Local<v8::Primitive> undefined(v8::Undefined(isolate_)); 1123 v8::Local<v8::Primitive> undefined(v8::Undefined(isolate_));
1124 std::unique_ptr<base::Value> undefined_value( 1124 std::unique_ptr<base::Value> undefined_value(
1125 converter.FromV8Value(undefined, context)); 1125 converter.FromV8Value(undefined, context));
1126 EXPECT_FALSE(undefined_value); 1126 EXPECT_FALSE(undefined_value);
1127 } 1127 }
1128 1128
1129 } // namespace content 1129 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_message_handler_unittest.cc ('k') | content/common/font_list_pango.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698