Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / indexed_db / indexed_db_factory_unittest.cc
index f61d975..70f8ae6 100644 (file)
@@ -2,9 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "content/browser/indexed_db/indexed_db_factory_impl.h"
-
-#include "base/file_util.h"
+#include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/test/test_simple_task_runner.h"
 #include "content/browser/indexed_db/indexed_db_connection.h"
 #include "content/browser/indexed_db/indexed_db_context_impl.h"
+#include "content/browser/indexed_db/indexed_db_factory_impl.h"
 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h"
 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h"
+#include "storage/common/database/database_identifier.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h"
 #include "third_party/WebKit/public/platform/WebIDBTypes.h"
 #include "url/gurl.h"
-#include "webkit/common/database/database_identifier.h"
 
 using base::ASCIIToUTF16;
 
@@ -60,7 +59,7 @@ class MockIDBFactory : public IndexedDBFactoryImpl {
   }
 
  private:
-  virtual ~MockIDBFactory() {}
+  ~MockIDBFactory() override {}
 
   DISALLOW_COPY_AND_ASSIGN(MockIDBFactory);
 };
@@ -110,8 +109,8 @@ TEST_F(IndexedDBFactoryTest, BackingStoreLifetime) {
   scoped_refptr<IndexedDBBackingStore> disk_store3 =
       factory()->TestOpenBackingStore(origin2, temp_directory.path());
 
-  factory()->TestCloseBackingStore(disk_store1);
-  factory()->TestCloseBackingStore(disk_store3);
+  factory()->TestCloseBackingStore(disk_store1.get());
+  factory()->TestCloseBackingStore(disk_store3.get());
 
   EXPECT_FALSE(disk_store1->HasOneRef());
   EXPECT_FALSE(disk_store2->HasOneRef());
@@ -163,8 +162,8 @@ TEST_F(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
   scoped_refptr<IndexedDBBackingStore> mem_store3 =
       factory()->TestOpenBackingStore(origin2, base::FilePath());
 
-  factory()->TestCloseBackingStore(mem_store1);
-  factory()->TestCloseBackingStore(mem_store3);
+  factory()->TestCloseBackingStore(mem_store1.get());
+  factory()->TestCloseBackingStore(mem_store3.get());
 
   EXPECT_FALSE(mem_store1->HasOneRef());
   EXPECT_FALSE(mem_store2->HasOneRef());
@@ -191,12 +190,12 @@ TEST_F(IndexedDBFactoryTest, RejectLongOrigins) {
   GURL too_long_origin("http://" + origin + ":81/");
   scoped_refptr<IndexedDBBackingStore> diskStore1 =
       factory()->TestOpenBackingStore(too_long_origin, base_path);
-  EXPECT_FALSE(diskStore1);
+  EXPECT_FALSE(diskStore1.get());
 
   GURL ok_origin("http://someorigin.com:82/");
   scoped_refptr<IndexedDBBackingStore> diskStore2 =
       factory()->TestOpenBackingStore(ok_origin, base_path);
-  EXPECT_TRUE(diskStore2);
+  EXPECT_TRUE(diskStore2.get());
 }
 
 class DiskFullFactory : public IndexedDBFactoryImpl {
@@ -205,15 +204,15 @@ class DiskFullFactory : public IndexedDBFactoryImpl {
       : IndexedDBFactoryImpl(context) {}
 
  private:
-  virtual ~DiskFullFactory() {}
-  virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
+  ~DiskFullFactory() override {}
+  scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
       const GURL& origin_url,
       const base::FilePath& data_directory,
       net::URLRequestContext* request_context,
       blink::WebIDBDataLoss* data_loss,
       std::string* data_loss_message,
       bool* disk_full,
-      leveldb::Status* s) OVERRIDE {
+      leveldb::Status* s) override {
     *disk_full = true;
     *s = leveldb::Status::IOError("Disk is full");
     return scoped_refptr<IndexedDBBackingStore>();
@@ -226,14 +225,14 @@ class LookingForQuotaErrorMockCallbacks : public IndexedDBCallbacks {
  public:
   LookingForQuotaErrorMockCallbacks()
       : IndexedDBCallbacks(NULL, 0, 0), error_called_(false) {}
-  virtual void OnError(const IndexedDBDatabaseError& error) OVERRIDE {
+  void OnError(const IndexedDBDatabaseError& error) override {
     error_called_ = true;
     EXPECT_EQ(blink::WebIDBDatabaseExceptionQuotaError, error.code());
   }
   bool error_called() const { return error_called_; }
 
  private:
-  virtual ~LookingForQuotaErrorMockCallbacks() {}
+  ~LookingForQuotaErrorMockCallbacks() override {}
   bool error_called_;
 
   DISALLOW_COPY_AND_ASSIGN(LookingForQuotaErrorMockCallbacks);
@@ -435,21 +434,21 @@ class UpgradeNeededCallbacks : public MockIndexedDBCallbacks {
  public:
   UpgradeNeededCallbacks() {}
 
-  virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection,
-                         const IndexedDBDatabaseMetadata& metadata) OVERRIDE {
+  void OnSuccess(scoped_ptr<IndexedDBConnection> connection,
+                 const IndexedDBDatabaseMetadata& metadata) override {
     EXPECT_TRUE(connection_.get());
     EXPECT_FALSE(connection.get());
   }
 
-  virtual void OnUpgradeNeeded(
+  void OnUpgradeNeeded(
       int64 old_version,
       scoped_ptr<IndexedDBConnection> connection,
-      const content::IndexedDBDatabaseMetadata& metadata) OVERRIDE {
+      const content::IndexedDBDatabaseMetadata& metadata) override {
     connection_ = connection.Pass();
   }
 
  protected:
-  virtual ~UpgradeNeededCallbacks() {}
+  ~UpgradeNeededCallbacks() override {}
 
  private:
   DISALLOW_COPY_AND_ASSIGN(UpgradeNeededCallbacks);
@@ -459,13 +458,13 @@ class ErrorCallbacks : public MockIndexedDBCallbacks {
  public:
   ErrorCallbacks() : MockIndexedDBCallbacks(false), saw_error_(false) {}
 
-  virtual void OnError(const IndexedDBDatabaseError& error) OVERRIDE {
+  void OnError(const IndexedDBDatabaseError& error) override {
     saw_error_= true;
   }
   bool saw_error() const { return saw_error_; }
 
  private:
-  virtual ~ErrorCallbacks() {}
+  ~ErrorCallbacks() override {}
   bool saw_error_;
 
   DISALLOW_COPY_AND_ASSIGN(ErrorCallbacks);