| 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_scope(V8BindingTestScope::create(v8::Isolate::GetCurrent())) | 75 : m_handleScope(v8::Isolate::GetCurrent()) |
| 76 , m_scope(v8::Context::New(v8::Isolate::GetCurrent())) |
| 76 , m_context(adoptRef(new NullExecutionContext())) | 77 , m_context(adoptRef(new NullExecutionContext())) |
| 77 { | 78 { |
| 78 } | 79 } |
| 79 | 80 |
| 80 ExecutionContext* executionContext() | 81 ExecutionContext* executionContext() |
| 81 { | 82 { |
| 82 return m_context.get(); | 83 return m_context.get(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 private: | 86 private: |
| 86 OwnPtr<V8BindingTestScope> m_scope; | 87 v8::HandleScope m_handleScope; |
| 88 v8::Context::Scope m_scope; |
| 87 RefPtr<ExecutionContext> m_context; | 89 RefPtr<ExecutionContext> m_context; |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 TEST_F(IDBRequestTest, EventsAfterStopping) | 92 TEST_F(IDBRequestTest, EventsAfterStopping) |
| 91 { | 93 { |
| 92 IDBTransaction* transaction = 0; | 94 IDBTransaction* transaction = 0; |
| 93 RefPtr<IDBRequest> request = IDBRequest::create(executionContext(), IDBAny::
createUndefined(), transaction); | 95 RefPtr<IDBRequest> request = IDBRequest::create(executionContext(), IDBAny::
createUndefined(), transaction); |
| 94 EXPECT_EQ(request->readyState(), "pending"); | 96 EXPECT_EQ(request->readyState(), "pending"); |
| 95 executionContext()->stopActiveDOMObjects(); | 97 executionContext()->stopActiveDOMObjects(); |
| 96 | 98 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); | 169 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); |
| 168 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); | 170 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); |
| 169 EXPECT_EQ(request->readyState(), "pending"); | 171 EXPECT_EQ(request->readyState(), "pending"); |
| 170 | 172 |
| 171 executionContext()->stopActiveDOMObjects(); | 173 executionContext()->stopActiveDOMObjects(); |
| 172 request->onSuccess(backend.release(), metadata); | 174 request->onSuccess(backend.release(), metadata); |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace | 178 } // namespace |
| OLD | NEW |