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

Side by Side Diff: gin/wrappable_unittest.cc

Issue 184253004: gin: Bug fix: Fix CreateHandle to return an emtpy handle in some extreme cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bug fix: remove an extra include Created 6 years, 9 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 | « gin/wrappable.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/logging.h" 5 #include "base/logging.h"
6 #include "gin/arguments.h" 6 #include "gin/arguments.h"
7 #include "gin/handle.h" 7 #include "gin/handle.h"
8 #include "gin/object_template_builder.h" 8 #include "gin/object_template_builder.h"
9 #include "gin/per_isolate_data.h" 9 #include "gin/per_isolate_data.h"
10 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 v8::Handle<v8::Function> func; 184 v8::Handle<v8::Function> func;
185 EXPECT_TRUE(ConvertFromV8(isolate, val, &func)); 185 EXPECT_TRUE(ConvertFromV8(isolate, val, &func));
186 v8::Handle<v8::Value> argv[] = { 186 v8::Handle<v8::Value> argv[] = {
187 ConvertToV8(isolate, object.get()) 187 ConvertToV8(isolate, object.get())
188 }; 188 };
189 func->Call(v8::Undefined(isolate), 1, argv); 189 func->Call(v8::Undefined(isolate), 1, argv);
190 EXPECT_FALSE(try_catch.HasCaught()); 190 EXPECT_FALSE(try_catch.HasCaught());
191 EXPECT_EQ("Hello, Lily", object->result); 191 EXPECT_EQ("Hello, Lily", object->result);
192 } 192 }
193 193
194 TEST_F(WrappableTest, ErrorInObjectConstructorProperty) {
195 v8::Isolate* isolate = instance_->isolate();
196 v8::HandleScope handle_scope(isolate);
197
198 v8::Handle<v8::String> source = StringToV8(
199 isolate,
200 "(function() {"
201 " Object.defineProperty(Object.prototype, 'constructor', {"
202 " get: function() { throw 'Error'; },"
203 " set: function() { throw 'Error'; }"
204 " });"
205 "})();");
206 EXPECT_FALSE(source.IsEmpty());
207 v8::Handle<v8::Script> script = v8::Script::New(source);
208 script->Run();
209
210 gin::TryCatch try_catch;
211 gin::Handle<MyObject> obj = MyObject::Create(isolate);
212 EXPECT_TRUE(obj.IsEmpty());
213 EXPECT_TRUE(try_catch.HasCaught());
214 }
215
194 } // namespace gin 216 } // namespace gin
OLDNEW
« no previous file with comments | « gin/wrappable.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698