| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 converter_->avoid_identity_hash_for_testing_ = false; | 44 converter_->avoid_identity_hash_for_testing_ = false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 class V8ValueConverterImplTest : public testing::Test { | 47 class V8ValueConverterImplTest : public testing::Test { |
| 48 public: | 48 public: |
| 49 V8ValueConverterImplTest() | 49 V8ValueConverterImplTest() |
| 50 : isolate_(v8::Isolate::GetCurrent()) { | 50 : isolate_(v8::Isolate::GetCurrent()) { |
| 51 } | 51 } |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 virtual void SetUp() { | 54 void SetUp() override { |
| 55 v8::HandleScope handle_scope(isolate_); | 55 v8::HandleScope handle_scope(isolate_); |
| 56 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); | 56 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); |
| 57 context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); | 57 context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void TearDown() { | 60 void TearDown() override { context_.Reset(); } |
| 61 context_.Reset(); | |
| 62 } | |
| 63 | 61 |
| 64 std::string GetString(base::DictionaryValue* value, const std::string& key) { | 62 std::string GetString(base::DictionaryValue* value, const std::string& key) { |
| 65 std::string temp; | 63 std::string temp; |
| 66 if (!value->GetString(key, &temp)) { | 64 if (!value->GetString(key, &temp)) { |
| 67 ADD_FAILURE(); | 65 ADD_FAILURE(); |
| 68 return std::string(); | 66 return std::string(); |
| 69 } | 67 } |
| 70 return temp; | 68 return temp; |
| 71 } | 69 } |
| 72 | 70 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 EXPECT_TRUE( | 866 EXPECT_TRUE( |
| 869 base::Value::Equals(reference_number_value.get(), number_value.get())); | 867 base::Value::Equals(reference_number_value.get(), number_value.get())); |
| 870 | 868 |
| 871 v8::Handle<v8::Primitive> undefined(v8::Undefined(isolate_)); | 869 v8::Handle<v8::Primitive> undefined(v8::Undefined(isolate_)); |
| 872 scoped_ptr<base::Value> undefined_value( | 870 scoped_ptr<base::Value> undefined_value( |
| 873 converter.FromV8Value(undefined, context)); | 871 converter.FromV8Value(undefined, context)); |
| 874 EXPECT_FALSE(undefined_value); | 872 EXPECT_FALSE(undefined_value); |
| 875 } | 873 } |
| 876 | 874 |
| 877 } // namespace content | 875 } // namespace content |
| OLD | NEW |