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

Side by Side Diff: content/renderer/java/gin_java_bridge_value_converter_unittest.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/java/gin_java_bridge_value_converter.h" 5 #include "content/renderer/java/gin_java_bridge_value_converter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <memory> 10 #include <memory>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 for (size_t i = 0; i < arraysize(array_types); i += 2) { 121 for (size_t i = 0; i < arraysize(array_types); i += 2) {
122 const char* typed_array_type = array_types[i + 1]; 122 const char* typed_array_type = array_types[i + 1];
123 v8::Local<v8::Script> script(v8::Script::Compile(v8::String::NewFromUtf8( 123 v8::Local<v8::Script> script(v8::Script::Compile(v8::String::NewFromUtf8(
124 isolate_, 124 isolate_,
125 base::StringPrintf( 125 base::StringPrintf(
126 source_template, array_types[i], typed_array_type).c_str()))); 126 source_template, array_types[i], typed_array_type).c_str())));
127 v8::Local<v8::Value> v8_typed_array = script->Run(); 127 v8::Local<v8::Value> v8_typed_array = script->Run();
128 std::unique_ptr<base::Value> list_value( 128 std::unique_ptr<base::Value> list_value(
129 converter->FromV8Value(v8_typed_array, context)); 129 converter->FromV8Value(v8_typed_array, context));
130 ASSERT_TRUE(list_value.get()) << typed_array_type; 130 ASSERT_TRUE(list_value.get()) << typed_array_type;
131 EXPECT_TRUE(list_value->IsType(base::Value::TYPE_LIST)) << typed_array_type; 131 EXPECT_TRUE(list_value->IsType(base::Value::Type::LIST))
132 << typed_array_type;
132 base::ListValue* list; 133 base::ListValue* list;
133 ASSERT_TRUE(list_value->GetAsList(&list)) << typed_array_type; 134 ASSERT_TRUE(list_value->GetAsList(&list)) << typed_array_type;
134 EXPECT_EQ(1u, list->GetSize()) << typed_array_type; 135 EXPECT_EQ(1u, list->GetSize()) << typed_array_type;
135 double first_element; 136 double first_element;
136 ASSERT_TRUE(list->GetDouble(0, &first_element)) << typed_array_type; 137 ASSERT_TRUE(list->GetDouble(0, &first_element)) << typed_array_type;
137 EXPECT_EQ(42.0, first_element) << typed_array_type; 138 EXPECT_EQ(42.0, first_element) << typed_array_type;
138 } 139 }
139 } 140 }
140 141
141 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/public/child/v8_value_converter.h ('k') | content/renderer/java/gin_java_function_invocation_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698