OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }; | 65 }; |
66 | 66 |
67 NullExecutionContext::NullExecutionContext() | 67 NullExecutionContext::NullExecutionContext() |
68 : m_queue(adoptPtr(new NullEventQueue())) | 68 : m_queue(adoptPtr(new NullEventQueue())) |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 class IDBRequestTest : public testing::Test { | 72 class IDBRequestTest : public testing::Test { |
73 public: | 73 public: |
74 IDBRequestTest() | 74 IDBRequestTest() |
75 : m_handleScope(v8::Isolate::GetCurrent()) | 75 : m_scope(V8BindingTestScope::create(v8::Isolate::GetCurrent())) |
76 , m_scope(v8::Context::New(v8::Isolate::GetCurrent())) | |
77 , m_context(adoptRef(new NullExecutionContext())) | 76 , m_context(adoptRef(new NullExecutionContext())) |
78 { | 77 { |
79 } | 78 } |
80 | 79 |
81 ExecutionContext* executionContext() | 80 ExecutionContext* executionContext() |
82 { | 81 { |
83 return m_context.get(); | 82 return m_context.get(); |
84 } | 83 } |
85 | 84 |
86 private: | 85 private: |
87 v8::HandleScope m_handleScope; | 86 OwnPtr<V8BindingTestScope> m_scope; |
88 v8::Context::Scope m_scope; | |
89 RefPtr<ExecutionContext> m_context; | 87 RefPtr<ExecutionContext> m_context; |
90 }; | 88 }; |
91 | 89 |
92 TEST_F(IDBRequestTest, EventsAfterStopping) | 90 TEST_F(IDBRequestTest, EventsAfterStopping) |
93 { | 91 { |
94 IDBTransaction* transaction = 0; | 92 IDBTransaction* transaction = 0; |
95 RefPtr<IDBRequest> request = IDBRequest::create(executionContext(), IDBAny::
createUndefined(), transaction); | 93 RefPtr<IDBRequest> request = IDBRequest::create(executionContext(), IDBAny::
createUndefined(), transaction); |
96 EXPECT_EQ(request->readyState(), "pending"); | 94 EXPECT_EQ(request->readyState(), "pending"); |
97 executionContext()->stopActiveDOMObjects(); | 95 executionContext()->stopActiveDOMObjects(); |
98 | 96 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); | 167 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); |
170 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); | 168 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); |
171 EXPECT_EQ(request->readyState(), "pending"); | 169 EXPECT_EQ(request->readyState(), "pending"); |
172 | 170 |
173 executionContext()->stopActiveDOMObjects(); | 171 executionContext()->stopActiveDOMObjects(); |
174 request->onSuccess(backend.release(), metadata); | 172 request->onSuccess(backend.release(), metadata); |
175 } | 173 } |
176 } | 174 } |
177 | 175 |
178 } // namespace | 176 } // namespace |
OLD | NEW |