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

Side by Side Diff: Source/bindings/v8/ScriptPromiseTest.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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 ScriptPromiseTest() 48 ScriptPromiseTest()
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.
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 } 60 }
63 61
64 void TearDown() 62 void TearDown()
65 { 63 {
66 m_perContextData.clear(); 64 m_perContextData.clear();
67 } 65 }
68 66
69 V8PromiseCustom::PromiseState state(ScriptPromise promise) 67 V8PromiseCustom::PromiseState state(ScriptPromise promise)
70 { 68 {
71 return V8PromiseCustom::getState(V8PromiseCustom::getInternal(promise.v8 Value().As<v8::Object>())); 69 return V8PromiseCustom::getState(V8PromiseCustom::getInternal(promise.v8 Value().As<v8::Object>()));
(...skipping 30 matching lines...) Expand all
102 ASSERT_TRUE(V8PromiseCustom::isPromise(promise2.v8Value(), m_isolate)); 100 ASSERT_TRUE(V8PromiseCustom::isPromise(promise2.v8Value(), m_isolate));
103 101
104 EXPECT_EQ(V8PromiseCustom::Fulfilled, state(promise1)); 102 EXPECT_EQ(V8PromiseCustom::Fulfilled, state(promise1));
105 EXPECT_EQ(V8PromiseCustom::Fulfilled, state(promise2)); 103 EXPECT_EQ(V8PromiseCustom::Fulfilled, state(promise2));
106 EXPECT_NE(promise1.v8Value(), promise2.v8Value()); 104 EXPECT_NE(promise1.v8Value(), promise2.v8Value());
107 } 105 }
108 106
109 } // namespace 107 } // namespace
110 108
111 } // namespace WebCore 109 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698