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

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

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 TestWeirdType(converter, regex, base::Value::Type::DICTIONARY, 411 TestWeirdType(converter, regex, base::Value::Type::DICTIONARY,
412 std::unique_ptr<base::Value>(new base::DictionaryValue())); 412 std::unique_ptr<base::Value>(new base::DictionaryValue()));
413 413
414 converter.SetDateAllowed(true); 414 converter.SetDateAllowed(true);
415 TestWeirdType(converter, v8::Date::New(isolate_, 1000), 415 TestWeirdType(converter, v8::Date::New(isolate_, 1000),
416 base::Value::Type::DOUBLE, 416 base::Value::Type::DOUBLE,
417 std::unique_ptr<base::Value>(new base::Value(1.0))); 417 std::unique_ptr<base::Value>(new base::Value(1.0)));
418 418
419 converter.SetRegExpAllowed(true); 419 converter.SetRegExpAllowed(true);
420 TestWeirdType(converter, regex, base::Value::Type::STRING, 420 TestWeirdType(converter, regex, base::Value::Type::STRING,
421 std::unique_ptr<base::Value>(new base::StringValue("/./"))); 421 std::unique_ptr<base::Value>(new base::Value("/./")));
422 } 422 }
423 423
424 TEST_F(V8ValueConverterImplTest, Prototype) { 424 TEST_F(V8ValueConverterImplTest, Prototype) {
425 v8::HandleScope handle_scope(isolate_); 425 v8::HandleScope handle_scope(isolate_);
426 v8::Local<v8::Context> context = 426 v8::Local<v8::Context> context =
427 v8::Local<v8::Context>::New(isolate_, context_); 427 v8::Local<v8::Context>::New(isolate_, context_);
428 v8::Context::Scope context_scope(context); 428 v8::Context::Scope context_scope(context);
429 v8::MicrotasksScope microtasks( 429 v8::MicrotasksScope microtasks(
430 isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); 430 isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks);
431 431
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 return true; 1014 return true;
1015 } 1015 }
1016 bool FromV8Undefined(std::unique_ptr<base::Value>* out) const override { 1016 bool FromV8Undefined(std::unique_ptr<base::Value>* out) const override {
1017 *out = NewReferenceValue(); 1017 *out = NewReferenceValue();
1018 return true; 1018 return true;
1019 } 1019 }
1020 base::Value* reference_value() const { return reference_value_.get(); } 1020 base::Value* reference_value() const { return reference_value_.get(); }
1021 1021
1022 private: 1022 private:
1023 static std::unique_ptr<base::Value> NewReferenceValue() { 1023 static std::unique_ptr<base::Value> NewReferenceValue() {
1024 return base::MakeUnique<base::StringValue>("strategy"); 1024 return base::MakeUnique<base::Value>("strategy");
1025 } 1025 }
1026 std::unique_ptr<base::Value> reference_value_; 1026 std::unique_ptr<base::Value> reference_value_;
1027 }; 1027 };
1028 1028
1029 TEST_F(V8ValueConverterImplTest, StrategyOverrides) { 1029 TEST_F(V8ValueConverterImplTest, StrategyOverrides) {
1030 v8::HandleScope handle_scope(isolate_); 1030 v8::HandleScope handle_scope(isolate_);
1031 v8::Local<v8::Context> context = 1031 v8::Local<v8::Context> context =
1032 v8::Local<v8::Context>::New(isolate_, context_); 1032 v8::Local<v8::Context>::New(isolate_, context_);
1033 v8::Context::Scope context_scope(context); 1033 v8::Context::Scope context_scope(context);
1034 1034
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 EXPECT_TRUE( 1172 EXPECT_TRUE(
1173 base::Value::Equals(reference_number_value.get(), number_value.get())); 1173 base::Value::Equals(reference_number_value.get(), number_value.get()));
1174 1174
1175 v8::Local<v8::Primitive> undefined(v8::Undefined(isolate_)); 1175 v8::Local<v8::Primitive> undefined(v8::Undefined(isolate_));
1176 std::unique_ptr<base::Value> undefined_value( 1176 std::unique_ptr<base::Value> undefined_value(
1177 converter.FromV8Value(undefined, context)); 1177 converter.FromV8Value(undefined, context));
1178 EXPECT_FALSE(undefined_value); 1178 EXPECT_FALSE(undefined_value);
1179 } 1179 }
1180 1180
1181 } // namespace content 1181 } // namespace content
OLDNEW
« no previous file with comments | « content/child/v8_value_converter_impl.cc ('k') | content/common/common_param_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698