| 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 namespace blink { | 51 namespace blink { |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 class IDBRequestTest : public testing::Test { | 54 class IDBRequestTest : public testing::Test { |
| 55 public: | 55 public: |
| 56 IDBRequestTest() | 56 IDBRequestTest() |
| 57 : m_scope(v8::Isolate::GetCurrent()) | 57 : m_scope(v8::Isolate::GetCurrent()) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void SetUp() override | 61 void SetUp() override |
| 62 { | 62 { |
| 63 m_executionContext = adoptRefWillBeNoop(new NullExecutionContext()); | 63 m_executionContext = adoptRefWillBeNoop(new NullExecutionContext()); |
| 64 m_scope.scriptState()->setExecutionContext(m_executionContext.get()); | 64 m_scope.scriptState()->setExecutionContext(m_executionContext.get()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() override | 67 void TearDown() override |
| 68 { | 68 { |
| 69 m_executionContext->notifyContextDestroyed(); | 69 m_executionContext->notifyContextDestroyed(); |
| 70 m_scope.scriptState()->setExecutionContext(nullptr); | 70 m_scope.scriptState()->setExecutionContext(nullptr); |
| 71 } | 71 } |
| 72 | 72 |
| 73 v8::Isolate* isolate() const { return m_scope.isolate(); } | 73 v8::Isolate* isolate() const { return m_scope.isolate(); } |
| 74 ScriptState* scriptState() const { return m_scope.scriptState(); } | 74 ScriptState* scriptState() const { return m_scope.scriptState(); } |
| 75 ExecutionContext* executionContext() const { return m_scope.scriptState()->e
xecutionContext(); } | 75 ExecutionContext* executionContext() const { return m_scope.scriptState()->e
xecutionContext(); } |
| 76 | 76 |
| 77 private: | 77 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // finds the object in a pending state (and asserts.) | 114 // finds the object in a pending state (and asserts.) |
| 115 executionContext()->stopActiveDOMObjects(); | 115 executionContext()->stopActiveDOMObjects(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 class MockWebIDBDatabase : public WebIDBDatabase { | 118 class MockWebIDBDatabase : public WebIDBDatabase { |
| 119 public: | 119 public: |
| 120 static PassOwnPtr<MockWebIDBDatabase> create() | 120 static PassOwnPtr<MockWebIDBDatabase> create() |
| 121 { | 121 { |
| 122 return adoptPtr(new MockWebIDBDatabase()); | 122 return adoptPtr(new MockWebIDBDatabase()); |
| 123 } | 123 } |
| 124 virtual ~MockWebIDBDatabase() | 124 ~MockWebIDBDatabase() override |
| 125 { | 125 { |
| 126 EXPECT_TRUE(m_closeCalled); | 126 EXPECT_TRUE(m_closeCalled); |
| 127 } | 127 } |
| 128 | 128 |
| 129 virtual void close() override | 129 void close() override |
| 130 { | 130 { |
| 131 m_closeCalled = true; | 131 m_closeCalled = true; |
| 132 } | 132 } |
| 133 virtual void abort(long long transactionId) override { } | 133 void abort(long long transactionId) override { } |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 MockWebIDBDatabase() | 136 MockWebIDBDatabase() |
| 137 : m_closeCalled(false) | 137 : m_closeCalled(false) |
| 138 { | 138 { |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool m_closeCalled; | 141 bool m_closeCalled; |
| 142 }; | 142 }; |
| 143 | 143 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 163 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); | 163 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); |
| 164 EXPECT_EQ(request->readyState(), "pending"); | 164 EXPECT_EQ(request->readyState(), "pending"); |
| 165 | 165 |
| 166 executionContext()->stopActiveDOMObjects(); | 166 executionContext()->stopActiveDOMObjects(); |
| 167 request->onSuccess(backend.release(), metadata); | 167 request->onSuccess(backend.release(), metadata); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| 172 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |