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

Side by Side Diff: content/renderer/v8_value_converter_browsertest.cc

Issue 7634018: base: Rename ValueType to something less redundant as _just_ Type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/json_schema_validator_unittest_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/values.h" 8 #include "base/values.h"
9 #include "content/renderer/v8_value_converter.h" 9 #include "content/renderer/v8_value_converter.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 v8::Handle<v8::Value> child = value->Get(index); 92 v8::Handle<v8::Value> child = value->Get(index);
93 if (child.IsEmpty()) { 93 if (child.IsEmpty()) {
94 ADD_FAILURE(); 94 ADD_FAILURE();
95 return false; 95 return false;
96 } 96 }
97 return child->IsNull(); 97 return child->IsNull();
98 } 98 }
99 99
100 void TestWeirdType(const V8ValueConverter& converter, 100 void TestWeirdType(const V8ValueConverter& converter,
101 v8::Handle<v8::Value> val, 101 v8::Handle<v8::Value> val,
102 Value::ValueType expected_type, 102 base::Value::Type expected_type,
103 Value* expected_value) { 103 Value* expected_value) {
104 scoped_ptr<Value> raw(converter.FromV8Value(val, context_)); 104 scoped_ptr<Value> raw(converter.FromV8Value(val, context_));
105 ASSERT_TRUE(raw.get()); 105 ASSERT_TRUE(raw.get());
106 EXPECT_EQ(expected_type, raw->GetType()); 106 EXPECT_EQ(expected_type, raw->GetType());
107 if (expected_value) 107 if (expected_value)
108 EXPECT_TRUE(expected_value->Equals(raw.get())); 108 EXPECT_TRUE(expected_value->Equals(raw.get()));
109 109
110 v8::Handle<v8::Object> object(v8::Object::New()); 110 v8::Handle<v8::Object> object(v8::Object::New());
111 object->Set(v8::String::New("test"), val); 111 object->Set(v8::String::New("test"), val);
112 scoped_ptr<DictionaryValue> dictionary( 112 scoped_ptr<DictionaryValue> dictionary(
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 v8::Handle<v8::Script> script(v8::Script::New(v8::String::New(source))); 317 v8::Handle<v8::Script> script(v8::Script::New(v8::String::New(source)));
318 v8::Handle<v8::Object> object = script->Run().As<v8::Object>(); 318 v8::Handle<v8::Object> object = script->Run().As<v8::Object>();
319 ASSERT_FALSE(object.IsEmpty()); 319 ASSERT_FALSE(object.IsEmpty());
320 320
321 V8ValueConverter converter; 321 V8ValueConverter converter;
322 scoped_ptr<DictionaryValue> result( 322 scoped_ptr<DictionaryValue> result(
323 static_cast<DictionaryValue*>(converter.FromV8Value(object, context_))); 323 static_cast<DictionaryValue*>(converter.FromV8Value(object, context_)));
324 ASSERT_TRUE(result.get()); 324 ASSERT_TRUE(result.get());
325 EXPECT_EQ(0u, result->size()); 325 EXPECT_EQ(0u, result->size());
326 } 326 }
OLDNEW
« no previous file with comments | « chrome/common/json_schema_validator_unittest_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698