summaryrefslogtreecommitdiffstats
path: root/chromium/content/browser/indexed_db/mock_indexed_db_callbacks.h
blob: fecfd1abb29dd05cf03835c2eb3a6e9cc63550ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_CALLBACKS_H_
#define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_CALLBACKS_H_

#include <vector>

#include "content/browser/indexed_db/indexed_db_callbacks.h"
#include "content/browser/indexed_db/indexed_db_connection.h"

namespace content {

class MockIndexedDBCallbacks : public IndexedDBCallbacks {
 public:
  MockIndexedDBCallbacks();
  explicit MockIndexedDBCallbacks(bool expect_connection);

  virtual void OnSuccess() OVERRIDE;
  virtual void OnSuccess(int64 result) OVERRIDE;
  virtual void OnSuccess(const std::vector<base::string16>& result) OVERRIDE;
  virtual void OnSuccess(const IndexedDBKey& key) OVERRIDE;
  virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection,
                         const IndexedDBDatabaseMetadata& metadata) OVERRIDE;
  IndexedDBConnection* connection() { return connection_.get(); }

 protected:
  virtual ~MockIndexedDBCallbacks();

  scoped_ptr<IndexedDBConnection> connection_;

 private:
  bool expect_connection_;

  DISALLOW_COPY_AND_ASSIGN(MockIndexedDBCallbacks);
};

}  // namespace content

#endif  // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_CALLBACKS_H_