| OLD | NEW |
| 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 <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 571 } |
| 572 | 572 |
| 573 V8ValueConverterImpl converter; | 573 V8ValueConverterImpl converter; |
| 574 | 574 |
| 575 scoped_ptr<base::Value> actual_object( | 575 scoped_ptr<base::Value> actual_object( |
| 576 converter.FromV8Value(object, context)); | 576 converter.FromV8Value(object, context)); |
| 577 EXPECT_TRUE(base::Value::Equals( | 577 EXPECT_TRUE(base::Value::Equals( |
| 578 base::test::ParseJson("{ \"bar\": null }").get(), actual_object.get())); | 578 base::test::ParseJson("{ \"bar\": null }").get(), actual_object.get())); |
| 579 | 579 |
| 580 // Everything is null because JSON stringification preserves array length. | 580 // Everything is null because JSON stringification preserves array length. |
| 581 scoped_ptr<Value> actual_array(converter.FromV8Value(array, context)); | 581 scoped_ptr<base::Value> actual_array(converter.FromV8Value(array, context)); |
| 582 EXPECT_TRUE(base::Value::Equals( | 582 EXPECT_TRUE(base::Value::Equals( |
| 583 base::test::ParseJson("[ null, null, null ]").get(), actual_array.get())); | 583 base::test::ParseJson("[ null, null, null ]").get(), actual_array.get())); |
| 584 } | 584 } |
| 585 | 585 |
| 586 TEST_F(V8ValueConverterImplTest, ObjectsWithClashingIdentityHash) { | 586 TEST_F(V8ValueConverterImplTest, ObjectsWithClashingIdentityHash) { |
| 587 v8::HandleScope handle_scope(isolate_); | 587 v8::HandleScope handle_scope(isolate_); |
| 588 v8::Local<v8::Context> context = | 588 v8::Local<v8::Context> context = |
| 589 v8::Local<v8::Context>::New(isolate_, context_); | 589 v8::Local<v8::Context>::New(isolate_, context_); |
| 590 v8::Context::Scope context_scope(context); | 590 v8::Context::Scope context_scope(context); |
| 591 V8ValueConverterImpl converter; | 591 V8ValueConverterImpl converter; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 684 |
| 685 base::Value* current = value.get(); | 685 base::Value* current = value.get(); |
| 686 for (int i = 1; i < kExpectedDepth; ++i) { | 686 for (int i = 1; i < kExpectedDepth; ++i) { |
| 687 base::DictionaryValue* current_as_object = NULL; | 687 base::DictionaryValue* current_as_object = NULL; |
| 688 ASSERT_TRUE(current->GetAsDictionary(¤t_as_object)) << i; | 688 ASSERT_TRUE(current->GetAsDictionary(¤t_as_object)) << i; |
| 689 ASSERT_TRUE(current_as_object->Get(kKey, ¤t)) << i; | 689 ASSERT_TRUE(current_as_object->Get(kKey, ¤t)) << i; |
| 690 } | 690 } |
| 691 | 691 |
| 692 // The leaf node shouldn't have any properties. | 692 // The leaf node shouldn't have any properties. |
| 693 base::DictionaryValue empty; | 693 base::DictionaryValue empty; |
| 694 EXPECT_TRUE(Value::Equals(&empty, current)) << *current; | 694 EXPECT_TRUE(base::Value::Equals(&empty, current)) << *current; |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace content | 697 } // namespace content |
| OLD | NEW |