| 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 21 matching lines...) Expand all Loading... |
| 32 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 32 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
| 33 #include "modules/indexeddb/IDBKeyRange.h" | 33 #include "modules/indexeddb/IDBKeyRange.h" |
| 34 #include "modules/indexeddb/IDBOpenDBRequest.h" | 34 #include "modules/indexeddb/IDBOpenDBRequest.h" |
| 35 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
| 36 #include "public/platform/WebIDBDatabase.h" | 36 #include "public/platform/WebIDBDatabase.h" |
| 37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 38 #include <gtest/gtest.h> | 38 #include <gtest/gtest.h> |
| 39 | 39 |
| 40 using namespace WebCore; | 40 using namespace WebCore; |
| 41 | 41 |
| 42 using blink::WebData; | |
| 43 using blink::WebIDBCallbacks; | |
| 44 using blink::WebIDBDatabase; | |
| 45 using blink::WebIDBDatabaseCallbacks; | |
| 46 using blink::WebIDBKey; | |
| 47 using blink::WebIDBKeyPath; | |
| 48 using blink::WebIDBKeyRange; | |
| 49 using blink::WebString; | |
| 50 using blink::WebVector; | |
| 51 | |
| 52 namespace { | 42 namespace { |
| 53 | 43 |
| 54 class NullEventQueue : public EventQueue { | 44 class NullEventQueue : public EventQueue { |
| 55 public: | 45 public: |
| 56 NullEventQueue() { } | 46 NullEventQueue() { } |
| 57 virtual ~NullEventQueue() { } | 47 virtual ~NullEventQueue() { } |
| 58 virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE { return true; } | 48 virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE { return true; } |
| 59 virtual bool cancelEvent(Event*) OVERRIDE { return true; } | 49 virtual bool cancelEvent(Event*) OVERRIDE { return true; } |
| 60 virtual void close() OVERRIDE { } | 50 virtual void close() OVERRIDE { } |
| 61 }; | 51 }; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 EXPECT_EQ(request->readyState(), "pending"); | 115 EXPECT_EQ(request->readyState(), "pending"); |
| 126 | 116 |
| 127 // Simulate the IDBTransaction having received onAbort from back end and abo
rting the request: | 117 // Simulate the IDBTransaction having received onAbort from back end and abo
rting the request: |
| 128 request->abort(); | 118 request->abort(); |
| 129 | 119 |
| 130 // Now simulate the back end having fired an abort error at the request to c
lear up any intermediaries. | 120 // Now simulate the back end having fired an abort error at the request to c
lear up any intermediaries. |
| 131 // Ensure an assertion is not raised. | 121 // Ensure an assertion is not raised. |
| 132 request->onError(DOMError::create(AbortError, "Description goes here.")); | 122 request->onError(DOMError::create(AbortError, "Description goes here.")); |
| 133 } | 123 } |
| 134 | 124 |
| 135 class MockWebIDBDatabase : public WebIDBDatabase { | 125 class MockWebIDBDatabase : public blink::WebIDBDatabase { |
| 136 public: | 126 public: |
| 137 static PassOwnPtr<MockWebIDBDatabase> create() | 127 static PassOwnPtr<MockWebIDBDatabase> create() |
| 138 { | 128 { |
| 139 return adoptPtr(new MockWebIDBDatabase()); | 129 return adoptPtr(new MockWebIDBDatabase()); |
| 140 } | 130 } |
| 141 virtual ~MockWebIDBDatabase() | 131 virtual ~MockWebIDBDatabase() |
| 142 { | 132 { |
| 143 EXPECT_TRUE(m_closeCalled); | 133 EXPECT_TRUE(m_closeCalled); |
| 144 } | 134 } |
| 145 | 135 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); | 169 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); |
| 180 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); | 170 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(executionCon
text(), callbacks, transactionId, version); |
| 181 EXPECT_EQ(request->readyState(), "pending"); | 171 EXPECT_EQ(request->readyState(), "pending"); |
| 182 | 172 |
| 183 executionContext()->stopActiveDOMObjects(); | 173 executionContext()->stopActiveDOMObjects(); |
| 184 request->onSuccess(backend.release(), metadata); | 174 request->onSuccess(backend.release(), metadata); |
| 185 } | 175 } |
| 186 } | 176 } |
| 187 | 177 |
| 188 } // namespace | 178 } // namespace |
| OLD | NEW |