| Index: content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc b/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| deleted file mode 100644
|
| index af86147a99f8cf3400f406abb459f5321e3495d1..0000000000000000000000000000000000000000
|
| --- a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| +++ /dev/null
|
| @@ -1,74 +0,0 @@
|
| -// 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.
|
| -
|
| -#include "base/files/file_path.h"
|
| -#include "base/files/scoped_temp_dir.h"
|
| -#include "base/string16.h"
|
| -#include "base/strings/utf_string_conversions.h"
|
| -#include "content/browser/indexed_db/indexed_db_backing_store.h"
|
| -#include "content/browser/indexed_db/leveldb/leveldb_database.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| -#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
| -
|
| -using WebKit::WebSecurityOrigin;
|
| -using content::IndexedDBBackingStore;
|
| -using content::LevelDBComparator;
|
| -using content::LevelDBDatabase;
|
| -using content::LevelDBFactory;
|
| -using content::LevelDBSlice;
|
| -using content::LevelDBSnapshot;
|
| -
|
| -namespace {
|
| -
|
| -class BustedLevelDBDatabase : public LevelDBDatabase {
|
| - public:
|
| - static scoped_ptr<LevelDBDatabase> Open(
|
| - const base::FilePath& file_name,
|
| - const LevelDBComparator* /*comparator*/) {
|
| - return scoped_ptr<LevelDBDatabase>(new BustedLevelDBDatabase);
|
| - }
|
| - virtual bool Get(const LevelDBSlice& key,
|
| - std::vector<char>& value,
|
| - bool& found,
|
| - const LevelDBSnapshot* = 0) OVERRIDE {
|
| - // false means IO error.
|
| - return false;
|
| - }
|
| -};
|
| -
|
| -class MockLevelDBFactory : public LevelDBFactory {
|
| - public:
|
| - MockLevelDBFactory() : destroy_called_(false) {}
|
| - virtual scoped_ptr<LevelDBDatabase> OpenLevelDB(
|
| - const base::FilePath& file_name,
|
| - const LevelDBComparator* comparator) OVERRIDE {
|
| - return BustedLevelDBDatabase::Open(file_name, comparator);
|
| - }
|
| - virtual bool DestroyLevelDB(const base::FilePath& file_name) OVERRIDE {
|
| - EXPECT_FALSE(destroy_called_);
|
| - destroy_called_ = true;
|
| - return false;
|
| - }
|
| - virtual ~MockLevelDBFactory() { EXPECT_TRUE(destroy_called_); }
|
| -
|
| - private:
|
| - bool destroy_called_;
|
| -};
|
| -
|
| -TEST(IndexedDBIOErrorTest, CleanUpTest) {
|
| - WebSecurityOrigin origin(
|
| - WebSecurityOrigin::createFromString("http://localhost:81"));
|
| - base::ScopedTempDir temp_directory;
|
| - ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| - const base::FilePath path = temp_directory.path();
|
| - string16 dummy_file_identifier;
|
| - MockLevelDBFactory mock_leveldb_factory;
|
| - scoped_refptr<IndexedDBBackingStore> backing_store =
|
| - IndexedDBBackingStore::Open(origin.databaseIdentifier(),
|
| - UTF8ToUTF16(path.AsUTF8Unsafe()),
|
| - dummy_file_identifier,
|
| - &mock_leveldb_factory);
|
| -}
|
| -
|
| -} // namespace
|
|
|