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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }; | 67 }; |
68 | 68 |
69 NullExecutionContext::NullExecutionContext() | 69 NullExecutionContext::NullExecutionContext() |
70 : m_queue(adoptPtr(new NullEventQueue())) | 70 : m_queue(adoptPtr(new NullEventQueue())) |
71 { | 71 { |
72 } | 72 } |
73 | 73 |
74 class IDBRequestTest : public testing::Test { | 74 class IDBRequestTest : public testing::Test { |
75 public: | 75 public: |
76 IDBRequestTest() | 76 IDBRequestTest() |
77 : m_scope(V8TestingScope::create(v8::Isolate::GetCurrent())) | 77 : m_scope(v8::Isolate::GetCurrent()) |
78 { | 78 { |
79 m_scope->scriptState()->setExecutionContext(adoptRef(new NullExecutionCo
ntext())); | 79 m_scope.scriptState()->setExecutionContext(adoptRef(new NullExecutionCon
text())); |
80 } | 80 } |
81 | 81 |
82 v8::Isolate* isolate() const { return m_scope->isolate(); } | 82 v8::Isolate* isolate() const { return m_scope.isolate(); } |
83 ScriptState* scriptState() const { return m_scope->scriptState(); } | 83 ScriptState* scriptState() const { return m_scope.scriptState(); } |
84 ExecutionContext* executionContext() const { return m_scope->scriptState()->
executionContext(); } | 84 ExecutionContext* executionContext() const { return m_scope.scriptState()->e
xecutionContext(); } |
85 | 85 |
86 private: | 86 private: |
87 OwnPtr<V8TestingScope> m_scope; | 87 V8TestingScope m_scope; |
88 }; | 88 }; |
89 | 89 |
90 TEST_F(IDBRequestTest, EventsAfterStopping) | 90 TEST_F(IDBRequestTest, EventsAfterStopping) |
91 { | 91 { |
92 IDBTransaction* transaction = 0; | 92 IDBTransaction* transaction = 0; |
93 IDBRequest* request = IDBRequest::create(scriptState(), IDBAny::createUndefi
ned(), transaction); | 93 IDBRequest* request = IDBRequest::create(scriptState(), IDBAny::createUndefi
ned(), transaction); |
94 EXPECT_EQ(request->readyState(), "pending"); | 94 EXPECT_EQ(request->readyState(), "pending"); |
95 executionContext()->stopActiveDOMObjects(); | 95 executionContext()->stopActiveDOMObjects(); |
96 | 96 |
97 // Ensure none of the following raise assertions in stopped state: | 97 // Ensure none of the following raise assertions in stopped state: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); | 167 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); |
168 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); | 168 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); |
169 EXPECT_EQ(request->readyState(), "pending"); | 169 EXPECT_EQ(request->readyState(), "pending"); |
170 | 170 |
171 executionContext()->stopActiveDOMObjects(); | 171 executionContext()->stopActiveDOMObjects(); |
172 request->onSuccess(backend.release(), metadata); | 172 request->onSuccess(backend.release(), metadata); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 } // namespace | 176 } // namespace |
OLD | NEW |