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

Side by Side Diff: Source/bindings/v8/ScriptPromiseResolverTest.cpp

Issue 180773003: Simplify the way to initialize context (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ScriptPromiseResolverTest() 48 ScriptPromiseResolverTest()
49 : m_isolate(v8::Isolate::GetCurrent()) 49 : m_isolate(v8::Isolate::GetCurrent())
50 , m_handleScope(m_isolate) 50 , m_handleScope(m_isolate)
51 , m_context(m_isolate, v8::Context::New(m_isolate)) 51 , m_context(m_isolate, v8::Context::New(m_isolate))
52 , m_contextScope(m_context.newLocal(m_isolate)) 52 , m_contextScope(m_context.newLocal(m_isolate))
53 { 53 {
54 } 54 }
55 55
56 void SetUp() 56 void SetUp()
57 { 57 {
58 v8::Handle<v8::Context> context(m_context.newLocal(m_isolate)); 58 // FIXME: Create a new world and pass it to V8PerContextData.
haraken 2014/02/28 11:14:05 I'll address this in a follow-up CL. Passing 0 doe
59 V8PerContextDataHolder::install(context, DOMWrapperWorld::current(m_isol ate)); 59 m_perContextData = V8PerContextData::create(m_context.newLocal(m_isolate ), 0);
60 m_perContextData = V8PerContextData::create(context);
61 m_perContextData->init();
62 m_promise = ScriptPromise::createPending(); 60 m_promise = ScriptPromise::createPending();
63 m_resolver = ScriptPromiseResolver::create(m_promise); 61 m_resolver = ScriptPromiseResolver::create(m_promise);
64 } 62 }
65 63
66 void TearDown() 64 void TearDown()
67 { 65 {
68 m_resolver = nullptr; 66 m_resolver = nullptr;
69 m_promise.clear(); 67 m_promise.clear();
70 m_perContextData.clear(); 68 m_perContextData.clear();
71 } 69 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_resolver->reject(ScriptValue(v8::Integer::New(m_isolate, 4), m_isolate)); 165 m_resolver->reject(ScriptValue(v8::Integer::New(m_isolate, 4), m_isolate));
168 EXPECT_FALSE(m_resolver->isPending()); 166 EXPECT_FALSE(m_resolver->isPending());
169 EXPECT_EQ(V8PromiseCustom::Fulfilled, state()); 167 EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
170 ASSERT_TRUE(result()->IsNumber()); 168 ASSERT_TRUE(result()->IsNumber());
171 EXPECT_EQ(3, result().As<v8::Integer>()->Value()); 169 EXPECT_EQ(3, result().As<v8::Integer>()->Value());
172 } 170 }
173 171
174 } // namespace 172 } // namespace
175 173
176 } // namespace WebCore 174 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698