| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 class IDBRequestTest : public testing::Test { | 52 class IDBRequestTest : public testing::Test { |
| 53 public: | 53 public: |
| 54 IDBRequestTest() | 54 IDBRequestTest() |
| 55 : m_scope(v8::Isolate::GetCurrent()) | 55 : m_scope(v8::Isolate::GetCurrent()) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SetUp() override | 59 void SetUp() override |
| 60 { | 60 { |
| 61 m_executionContext = adoptRefWillBeNoop(new NullExecutionContext()); | 61 m_executionContext = new NullExecutionContext(); |
| 62 m_scope.getScriptState()->setExecutionContext(m_executionContext.get()); | 62 m_scope.getScriptState()->setExecutionContext(m_executionContext.get()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TearDown() override | 65 void TearDown() override |
| 66 { | 66 { |
| 67 m_executionContext->notifyContextDestroyed(); | 67 m_executionContext->notifyContextDestroyed(); |
| 68 m_scope.getScriptState()->setExecutionContext(nullptr); | 68 m_scope.getScriptState()->setExecutionContext(nullptr); |
| 69 } | 69 } |
| 70 | 70 |
| 71 v8::Isolate* isolate() const { return m_scope.isolate(); } | 71 v8::Isolate* isolate() const { return m_scope.isolate(); } |
| 72 ScriptState* getScriptState() const { return m_scope.getScriptState(); } | 72 ScriptState* getScriptState() const { return m_scope.getScriptState(); } |
| 73 ExecutionContext* getExecutionContext() const { return m_scope.getScriptStat
e()->getExecutionContext(); } | 73 ExecutionContext* getExecutionContext() const { return m_scope.getScriptStat
e()->getExecutionContext(); } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 V8TestingScope m_scope; | 76 V8TestingScope m_scope; |
| 77 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 77 Persistent<ExecutionContext> m_executionContext; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 TEST_F(IDBRequestTest, EventsAfterStopping) | 80 TEST_F(IDBRequestTest, EventsAfterStopping) |
| 81 { | 81 { |
| 82 IDBTransaction* transaction = nullptr; | 82 IDBTransaction* transaction = nullptr; |
| 83 IDBRequest* request = IDBRequest::create(getScriptState(), IDBAny::createUnd
efined(), transaction); | 83 IDBRequest* request = IDBRequest::create(getScriptState(), IDBAny::createUnd
efined(), transaction); |
| 84 EXPECT_EQ(request->readyState(), "pending"); | 84 EXPECT_EQ(request->readyState(), "pending"); |
| 85 getExecutionContext()->stopActiveDOMObjects(); | 85 getExecutionContext()->stopActiveDOMObjects(); |
| 86 | 86 |
| 87 // Ensure none of the following raise assertions in stopped state: | 87 // Ensure none of the following raise assertions in stopped state: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c
allbacks, transactionId, version); | 141 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c
allbacks, transactionId, version); |
| 142 EXPECT_EQ(request->readyState(), "pending"); | 142 EXPECT_EQ(request->readyState(), "pending"); |
| 143 | 143 |
| 144 getExecutionContext()->stopActiveDOMObjects(); | 144 getExecutionContext()->stopActiveDOMObjects(); |
| 145 request->onSuccess(backend.release(), metadata); | 145 request->onSuccess(backend.release(), metadata); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace | 149 } // namespace |
| 150 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |