| 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 virtual ~MockIDBCallbacks() | 51 virtual ~MockIDBCallbacks() |
| 52 { | 52 { |
| 53 EXPECT_TRUE(m_wasErrorCalled); | 53 EXPECT_TRUE(m_wasErrorCalled); |
| 54 } | 54 } |
| 55 virtual void onError(PassRefPtr<IDBDatabaseError>) | 55 virtual void onError(PassRefPtr<IDBDatabaseError>) |
| 56 { | 56 { |
| 57 m_wasErrorCalled = true; | 57 m_wasErrorCalled = true; |
| 58 } | 58 } |
| 59 virtual void onSuccess(const Vector<String>&) { } | 59 virtual void onSuccess(const Vector<String>&) { } |
| 60 virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDB
Key>, PassRefPtr<IDBKey>, PassRefPtr<SharedBuffer>) { } | 60 virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDB
Key>, PassRefPtr<IDBKey>, PassRefPtr<SharedBuffer>) { } |
| 61 virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>, const IDBDat
abaseMetadata&) | 61 virtual void onSuccess(IDBDatabaseBackendInterface*, const IDBDatabaseMetada
ta&) |
| 62 { | 62 { |
| 63 EXPECT_TRUE(false); | 63 EXPECT_TRUE(false); |
| 64 } | 64 } |
| 65 virtual void onSuccess(PassRefPtr<IDBKey>) { } | 65 virtual void onSuccess(PassRefPtr<IDBKey>) { } |
| 66 virtual void onSuccess(PassRefPtr<SharedBuffer>) OVERRIDE { } | 66 virtual void onSuccess(PassRefPtr<SharedBuffer>) OVERRIDE { } |
| 67 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I
DBKeyPath&) OVERRIDE { } | 67 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I
DBKeyPath&) OVERRIDE { } |
| 68 virtual void onSuccess(int64_t) OVERRIDE { } | 68 virtual void onSuccess(int64_t) OVERRIDE { } |
| 69 virtual void onSuccess() OVERRIDE { } | 69 virtual void onSuccess() OVERRIDE { } |
| 70 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<Sh
aredBuffer>) OVERRIDE { }; | 70 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<Sh
aredBuffer>) OVERRIDE { }; |
| 71 virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vec
tor<RefPtr<IDBKey> >&, const Vector<RefPtr<SharedBuffer> >&) OVERRIDE { } | 71 virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vec
tor<RefPtr<IDBKey> >&, const Vector<RefPtr<SharedBuffer> >&) OVERRIDE { } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 virtual PassRefPtr<IDBBackingStore> openBackingStore(const String&, const St
ring& dataDir) | 103 virtual PassRefPtr<IDBBackingStore> openBackingStore(const String&, const St
ring& dataDir) |
| 104 { | 104 { |
| 105 return FailingBackingStore::open(); | 105 return FailingBackingStore::open(); |
| 106 } | 106 } |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class FakeIDBDatabaseCallbacks : public IDBDatabaseCallbacks { | 109 class FakeIDBDatabaseCallbacks : public IDBDatabaseCallbacks { |
| 110 public: | 110 public: |
| 111 static PassRefPtr<FakeIDBDatabaseCallbacks> create() { return adoptRef(new F
akeIDBDatabaseCallbacks()); } | 111 static FakeIDBDatabaseCallbacks* create() { return new FakeIDBDatabaseCallba
cks(); } |
| 112 virtual ~FakeIDBDatabaseCallbacks() { } | 112 virtual ~FakeIDBDatabaseCallbacks() { } |
| 113 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRID
E { } | 113 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRID
E { } |
| 114 virtual void onForcedClose() OVERRIDE { } | 114 virtual void onForcedClose() OVERRIDE { } |
| 115 virtual void onAbort(int64_t transactionId, PassRefPtr<IDBDatabaseError> err
or) OVERRIDE { } | 115 virtual void onAbort(int64_t transactionId, PassRefPtr<IDBDatabaseError> err
or) OVERRIDE { } |
| 116 virtual void onComplete(int64_t transactionId) OVERRIDE { } | 116 virtual void onComplete(int64_t transactionId) OVERRIDE { } |
| 117 virtual void trace(Visitor*) OVERRIDE { } |
| 117 private: | 118 private: |
| 118 FakeIDBDatabaseCallbacks() { } | 119 FakeIDBDatabaseCallbacks() { } |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 TEST(IDBAbortTest, TheTest) | 122 TEST(IDBAbortTest, TheTest) |
| 122 { | 123 { |
| 123 IDBFactoryBackendImpl* factory = FailingIDBFactoryBackendImpl::create(); | 124 IDBFactoryBackendImpl* factory = FailingIDBFactoryBackendImpl::create(); |
| 124 const String& name = "db name"; | 125 const String& name = "db name"; |
| 125 RefPtr<MockIDBCallbacks> callbacks = MockIDBCallbacks::create(); | 126 RefPtr<MockIDBCallbacks> callbacks = MockIDBCallbacks::create(); |
| 126 RefPtr<FakeIDBDatabaseCallbacks> databaseCallbacks = FakeIDBDatabaseCallback
s::create(); | 127 FakeIDBDatabaseCallbacks* databaseCallbacks = FakeIDBDatabaseCallbacks::crea
te(); |
| 127 RefPtr<SecurityOrigin> origin = SecurityOrigin::create("http", "localhost",
81); | 128 RefPtr<SecurityOrigin> origin = SecurityOrigin::create("http", "localhost",
81); |
| 128 const int64_t DummyVersion = 2; | 129 const int64_t DummyVersion = 2; |
| 129 factory->open(name, DummyVersion, 1, callbacks.get(), databaseCallbacks, ori
gin->databaseIdentifier(), nullptr, String() /*path*/); | 130 factory->open(name, DummyVersion, 1, callbacks.get(), databaseCallbacks, ori
gin->databaseIdentifier(), nullptr, String() /*path*/); |
| 130 } | 131 } |
| 131 | 132 |
| 132 } // namespace | 133 } // namespace |
| OLD | NEW |