OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class ScriptPromiseResolverTest : public testing::Test { | 47 class ScriptPromiseResolverTest : public testing::Test { |
48 public: | 48 public: |
49 ScriptPromiseResolverTest() | 49 ScriptPromiseResolverTest() |
50 : m_isolate(v8::Isolate::GetCurrent()) | 50 : m_isolate(v8::Isolate::GetCurrent()) |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 void SetUp() | 54 void SetUp() |
55 { | 55 { |
56 m_scope = V8ExecutionScope::create(m_isolate); | 56 m_scope = V8ExecutionScope::create(m_isolate); |
57 m_resolver = ScriptPromiseResolver::create(m_isolate); | 57 m_resolver = ScriptPromiseResolver::create(m_scope->scriptState()); |
58 m_promise = m_resolver->promise(); | 58 m_promise = m_resolver->promise(); |
59 } | 59 } |
60 | 60 |
61 void TearDown() | 61 void TearDown() |
62 { | 62 { |
63 m_resolver = nullptr; | 63 m_resolver = nullptr; |
64 m_promise.clear(); | 64 m_promise.clear(); |
65 m_scope.clear(); | 65 m_scope.clear(); |
66 } | 66 } |
67 | 67 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 m_resolver->reject(ScriptValue(ScriptState::current(m_isolate), v8::Integer:
:New(m_isolate, 4))); | 160 m_resolver->reject(ScriptValue(ScriptState::current(m_isolate), v8::Integer:
:New(m_isolate, 4))); |
161 EXPECT_EQ(V8PromiseCustom::Fulfilled, state()); | 161 EXPECT_EQ(V8PromiseCustom::Fulfilled, state()); |
162 ASSERT_TRUE(result()->IsNumber()); | 162 ASSERT_TRUE(result()->IsNumber()); |
163 EXPECT_EQ(3, result().As<v8::Integer>()->Value()); | 163 EXPECT_EQ(3, result().As<v8::Integer>()->Value()); |
164 } | 164 } |
165 | 165 |
166 } // namespace | 166 } // namespace |
167 | 167 |
168 } // namespace WebCore | 168 } // namespace WebCore |
OLD | NEW |