| Index: content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| index 050ca41002bad0640a80bf078e8885d2200d5b2a..3ce27bccf97bca010dbb615dc8cc2dccf32e9104 100644
|
| --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| @@ -22,6 +22,7 @@
|
| #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h"
|
| #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
|
| #include "url/gurl.h"
|
| +#include "url/origin.h"
|
|
|
| using base::ASCIIToUTF16;
|
|
|
| @@ -34,7 +35,7 @@ class MockIDBFactory : public IndexedDBFactoryImpl {
|
| explicit MockIDBFactory(IndexedDBContextImpl* context)
|
| : IndexedDBFactoryImpl(context) {}
|
| scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore(
|
| - const GURL& origin,
|
| + const url::Origin& origin,
|
| const base::FilePath& data_directory) {
|
| blink::WebIDBDataLoss data_loss =
|
| blink::WebIDBDataLossNone;
|
| @@ -54,12 +55,12 @@ class MockIDBFactory : public IndexedDBFactoryImpl {
|
| }
|
|
|
| void TestCloseBackingStore(IndexedDBBackingStore* backing_store) {
|
| - CloseBackingStore(backing_store->origin_url());
|
| + CloseBackingStore(backing_store->origin());
|
| }
|
|
|
| void TestReleaseBackingStore(IndexedDBBackingStore* backing_store,
|
| bool immediate) {
|
| - ReleaseBackingStore(backing_store->origin_url(), immediate);
|
| + ReleaseBackingStore(backing_store->origin(), immediate);
|
| }
|
|
|
| private:
|
| @@ -101,8 +102,8 @@ class IndexedDBFactoryTest : public testing::Test {
|
| };
|
|
|
| TEST_F(IndexedDBFactoryTest, BackingStoreLifetime) {
|
| - GURL origin1("http://localhost:81");
|
| - GURL origin2("http://localhost:82");
|
| + const url::Origin origin1(GURL("http://localhost:81"));
|
| + const url::Origin origin2(GURL("http://localhost:82"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -128,7 +129,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreLifetime) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, BackingStoreLazyClose) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -156,8 +157,8 @@ TEST_F(IndexedDBFactoryTest, BackingStoreLazyClose) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
|
| - GURL origin1("http://localhost:81");
|
| - GURL origin2("http://localhost:82");
|
| + const url::Origin origin1(GURL("http://localhost:81"));
|
| + const url::Origin origin2(GURL("http://localhost:82"));
|
|
|
| scoped_refptr<IndexedDBBackingStore> mem_store1 =
|
| factory()->TestOpenBackingStore(origin1, base::FilePath());
|
| @@ -194,12 +195,12 @@ TEST_F(IndexedDBFactoryTest, RejectLongOrigins) {
|
| EXPECT_GT(limit, 0);
|
|
|
| std::string origin(limit + 1, 'x');
|
| - GURL too_long_origin("http://" + origin + ":81/");
|
| + url::Origin too_long_origin(GURL("http://" + origin + ":81/"));
|
| scoped_refptr<IndexedDBBackingStore> diskStore1 =
|
| factory()->TestOpenBackingStore(too_long_origin, base_path);
|
| EXPECT_FALSE(diskStore1.get());
|
|
|
| - GURL ok_origin("http://someorigin.com:82/");
|
| + url::Origin ok_origin(GURL("http://someorigin.com:82/"));
|
| scoped_refptr<IndexedDBBackingStore> diskStore2 =
|
| factory()->TestOpenBackingStore(ok_origin, base_path);
|
| EXPECT_TRUE(diskStore2.get());
|
| @@ -215,7 +216,7 @@ class DiskFullFactory : public IndexedDBFactoryImpl {
|
| private:
|
| ~DiskFullFactory() override {}
|
| scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
|
| - const GURL& origin_url,
|
| + const url::Origin& origin,
|
| const base::FilePath& data_directory,
|
| net::URLRequestContext* request_context,
|
| blink::WebIDBDataLoss* data_loss,
|
| @@ -248,7 +249,7 @@ class LookingForQuotaErrorMockCallbacks : public IndexedDBCallbacks {
|
| };
|
|
|
| TEST_F(IndexedDBFactoryTest, QuotaErrorOnDiskFull) {
|
| - const GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
|
|
| @@ -263,13 +264,13 @@ TEST_F(IndexedDBFactoryTest, QuotaErrorOnDiskFull) {
|
| 0, /* child_process_id */
|
| 2, /* transaction_id */
|
| 1 /* version */);
|
| - factory->Open(name, connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + factory->Open(name, connection, NULL /* request_context */, origin,
|
| + temp_directory.path());
|
| EXPECT_TRUE(callbacks->error_called());
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, BackingStoreReleasedOnForcedClose) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -282,7 +283,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleasedOnForcedClose) {
|
| callbacks, db_callbacks, 0, /* child_process_id */
|
| transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
|
| factory()->Open(ASCIIToUTF16("db"), connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
|
|
| @@ -296,7 +297,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleasedOnForcedClose) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -309,7 +310,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) {
|
| callbacks, db_callbacks, 0, /* child_process_id */
|
| transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
|
| factory()->Open(ASCIIToUTF16("db"), connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
| IndexedDBBackingStore* store =
|
| @@ -334,7 +335,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -345,8 +346,7 @@ TEST_F(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore) {
|
| scoped_refptr<MockIndexedDBCallbacks> callbacks(
|
| new MockIndexedDBCallbacks(expect_connection));
|
| factory()->DeleteDatabase(ASCIIToUTF16("db"), NULL /* request_context */,
|
| - callbacks, url::Origin(origin),
|
| - temp_directory.path());
|
| + callbacks, origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin));
|
| @@ -359,7 +359,7 @@ TEST_F(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -369,8 +369,7 @@ TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) {
|
| const bool expect_connection = false;
|
| scoped_refptr<MockIndexedDBCallbacks> callbacks(
|
| new MockIndexedDBCallbacks(expect_connection));
|
| - factory()->GetDatabaseNames(callbacks, url::Origin(origin),
|
| - temp_directory.path(),
|
| + factory()->GetDatabaseNames(callbacks, origin, temp_directory.path(),
|
| NULL /* request_context */);
|
|
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| @@ -384,7 +383,7 @@ TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) {
|
| }
|
|
|
| TEST_F(IndexedDBFactoryTest, ForceCloseReleasesBackingStore) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -397,7 +396,7 @@ TEST_F(IndexedDBFactoryTest, ForceCloseReleasesBackingStore) {
|
| callbacks, db_callbacks, 0, /* child_process_id */
|
| transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
|
| factory()->Open(ASCIIToUTF16("db"), connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| @@ -458,7 +457,7 @@ class ErrorCallbacks : public MockIndexedDBCallbacks {
|
| };
|
|
|
| TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
|
| - GURL origin("http://localhost:81");
|
| + const url::Origin origin(GURL("http://localhost:81"));
|
|
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| @@ -478,8 +477,8 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
|
| 0, /* child_process_id */
|
| transaction_id,
|
| db_version);
|
| - factory()->Open(db_name, connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + factory()->Open(db_name, connection, NULL /* request_context */, origin,
|
| + temp_directory.path());
|
| EXPECT_TRUE(factory()->IsDatabaseOpen(origin, db_name));
|
|
|
| // Pump the message loop so the upgrade transaction can run.
|
| @@ -500,8 +499,8 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
|
| 0, /* child_process_id */
|
| transaction_id,
|
| db_version - 1);
|
| - factory()->Open(db_name, connection, NULL /* request_context */,
|
| - url::Origin(origin), temp_directory.path());
|
| + factory()->Open(db_name, connection, NULL /* request_context */, origin,
|
| + temp_directory.path());
|
| EXPECT_TRUE(callbacks->saw_error());
|
| EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
|
| }
|
|
|