| Index: webkit/support/test_webidbfactory.h
|
| diff --git a/webkit/support/test_webidbfactory.h b/webkit/support/test_webidbfactory.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e7b02b0767bbeb5e6ec5339b70b8986db2082b63
|
| --- /dev/null
|
| +++ b/webkit/support/test_webidbfactory.h
|
| @@ -0,0 +1,55 @@
|
| +// Copyright (c) 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 WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_
|
| +#define WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_
|
| +
|
| +#include "base/files/scoped_temp_dir.h"
|
| +#include "base/threading/thread_local.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
|
| +
|
| +// Wrap a WebKit::WebIDBFactory to rewrite the data directory to
|
| +// a scoped temp directory. In multiprocess Chromium this is rewritten
|
| +// to a real profile directory during IPC.
|
| +class TestWebIDBFactory : public WebKit::WebIDBFactory {
|
| + public:
|
| + TestWebIDBFactory();
|
| + virtual ~TestWebIDBFactory();
|
| +
|
| + // WebIDBFactory methods:
|
| + virtual void getDatabaseNames(WebKit::WebIDBCallbacks* callbacks,
|
| + const WebKit::WebSecurityOrigin& origin,
|
| + WebKit::WebFrame* frame,
|
| + const WebKit::WebString& data_dir);
|
| + virtual void open(const WebKit::WebString& name,
|
| + long long version,
|
| + long long transaction_id,
|
| + WebKit::WebIDBCallbacks* callbacks,
|
| + WebKit::WebIDBDatabaseCallbacks* database_callbacks,
|
| + const WebKit::WebSecurityOrigin& origin,
|
| + WebKit::WebFrame* frame,
|
| + const WebKit::WebString& data_dir);
|
| + virtual void deleteDatabase(const WebKit::WebString& name,
|
| + WebKit::WebIDBCallbacks* callbacks,
|
| + const WebKit::WebSecurityOrigin& origin,
|
| + WebKit::WebFrame* frame,
|
| + const WebKit::WebString& data_dir);
|
| +
|
| + private:
|
| + // Returns the WebIDBFactory implementation to use for the current thread.
|
| + WebKit::WebIDBFactory* GetFactory();
|
| +
|
| + // Returns the data directory to use.
|
| + WebKit::WebString GetDataDir() const;
|
| +
|
| + // We allocate a separate WebIDBFactory instance per thread since the
|
| + // implementation is not thread-safe. We also intentionally leak the
|
| + // factory instances to avoid shutdown races. TODO(darin): Can we
|
| + // avoid leaking these?
|
| + base::ThreadLocalPointer<WebKit::WebIDBFactory> factories_;
|
| +
|
| + base::ScopedTempDir indexed_db_dir_;
|
| +};
|
| +
|
| +#endif // WEBKIT_SUPPORT_TEST_WEBIDBFACTORY_H_
|
|
|