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

Side by Side Diff: extensions/renderer/activity_log_converter_strategy_unittest.cc

Issue 1115563002: extensions/renderer: Use v8::Local instead of v8::Handle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "extensions/renderer/activity_log_converter_strategy.h" 7 #include "extensions/renderer/activity_log_converter_strategy.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "v8/include/v8.h" 9 #include "v8/include/v8.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 std::string out; 77 std::string out;
78 scoped_ptr<base::Value> value( 78 scoped_ptr<base::Value> value(
79 converter_->FromV8Value(v8_value, context())); 79 converter_->FromV8Value(v8_value, context()));
80 if (value->IsType(base::Value::TYPE_STRING) 80 if (value->IsType(base::Value::TYPE_STRING)
81 && value->GetAsString(&out) 81 && value->GetAsString(&out)
82 && out == expected) 82 && out == expected)
83 return testing::AssertionSuccess(); 83 return testing::AssertionSuccess();
84 return testing::AssertionFailure(); 84 return testing::AssertionFailure();
85 } 85 }
86 86
87 v8::Handle<v8::Context> context() const { 87 v8::Local<v8::Context> context() const {
88 return v8::Local<v8::Context>::New(isolate_, context_); 88 return v8::Local<v8::Context>::New(isolate_, context_);
89 } 89 }
90 90
91 v8::Isolate* isolate_; 91 v8::Isolate* isolate_;
92 v8::HandleScope handle_scope_; 92 v8::HandleScope handle_scope_;
93 v8::Global<v8::Context> context_; 93 v8::Global<v8::Context> context_;
94 v8::Context::Scope context_scope_; 94 v8::Context::Scope context_scope_;
95 scoped_ptr<V8ValueConverter> converter_; 95 scoped_ptr<V8ValueConverter> converter_;
96 scoped_ptr<ActivityLogConverterStrategy> strategy_; 96 scoped_ptr<ActivityLogConverterStrategy> strategy_;
97 }; 97 };
(...skipping 17 matching lines...) Expand all
115 "hot: \"dog\"," 115 "hot: \"dog\","
116 "}," 116 "},"
117 "empty_dictionary: {}," 117 "empty_dictionary: {},"
118 "list: [ \"monkey\", \"balls\" ]," 118 "list: [ \"monkey\", \"balls\" ],"
119 "empty_list: []," 119 "empty_list: [],"
120 "function: function() {}," 120 "function: function() {},"
121 "named_function: foo" 121 "named_function: foo"
122 "};" 122 "};"
123 "})();"; 123 "})();";
124 124
125 v8::Handle<v8::Script> script( 125 v8::Local<v8::Script> script(
126 v8::Script::Compile(v8::String::NewFromUtf8(isolate_, source))); 126 v8::Script::Compile(v8::String::NewFromUtf8(isolate_, source)));
127 v8::Handle<v8::Object> v8_object = script->Run().As<v8::Object>(); 127 v8::Local<v8::Object> v8_object = script->Run().As<v8::Object>();
128 128
129 EXPECT_TRUE(VerifyString(v8_object, "[Object]")); 129 EXPECT_TRUE(VerifyString(v8_object, "[Object]"));
130 EXPECT_TRUE( 130 EXPECT_TRUE(
131 VerifyNull(v8_object->Get(v8::String::NewFromUtf8(isolate_, "null")))); 131 VerifyNull(v8_object->Get(v8::String::NewFromUtf8(isolate_, "null"))));
132 EXPECT_TRUE(VerifyBoolean( 132 EXPECT_TRUE(VerifyBoolean(
133 v8_object->Get(v8::String::NewFromUtf8(isolate_, "true")), true)); 133 v8_object->Get(v8::String::NewFromUtf8(isolate_, "true")), true));
134 EXPECT_TRUE(VerifyBoolean( 134 EXPECT_TRUE(VerifyBoolean(
135 v8_object->Get(v8::String::NewFromUtf8(isolate_, "false")), false)); 135 v8_object->Get(v8::String::NewFromUtf8(isolate_, "false")), false));
136 EXPECT_TRUE(VerifyInteger( 136 EXPECT_TRUE(VerifyInteger(
137 v8_object->Get(v8::String::NewFromUtf8(isolate_, "positive_int")), 42)); 137 v8_object->Get(v8::String::NewFromUtf8(isolate_, "positive_int")), 42));
(...skipping 23 matching lines...) Expand all
161 "[Array]")); 161 "[Array]"));
162 EXPECT_TRUE(VerifyString( 162 EXPECT_TRUE(VerifyString(
163 v8_object->Get(v8::String::NewFromUtf8(isolate_, "function")), 163 v8_object->Get(v8::String::NewFromUtf8(isolate_, "function")),
164 "[Function]")); 164 "[Function]"));
165 EXPECT_TRUE(VerifyString( 165 EXPECT_TRUE(VerifyString(
166 v8_object->Get(v8::String::NewFromUtf8(isolate_, "named_function")), 166 v8_object->Get(v8::String::NewFromUtf8(isolate_, "named_function")),
167 "[Function foo()]")); 167 "[Function foo()]"));
168 } 168 }
169 169
170 } // namespace extensions 170 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/activity_log_converter_strategy.cc ('k') | extensions/renderer/api_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698