Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(994)

Side by Side Diff: content/browser/indexed_db/indexed_db_factory_unittest.cc

Issue 313883003: Split IndexedDBFactory into virtual base + impl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extraneous method proto's: ReleaseBackingStore & CloseBackingStore Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory_impl.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/indexed_db_factory.h"
6
7 #include "base/file_util.h" 5 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 7 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
11 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
12 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
13 #include "content/browser/indexed_db/indexed_db_connection.h" 11 #include "content/browser/indexed_db/indexed_db_connection.h"
14 #include "content/browser/indexed_db/indexed_db_context_impl.h" 12 #include "content/browser/indexed_db/indexed_db_context_impl.h"
13 #include "content/browser/indexed_db/indexed_db_factory_impl.h"
jsbell 2014/07/17 18:45:46 Huh... I thought we put "self" includes by unittes
cmumford 2014/07/17 20:11:52 I did that because it produced a presubmit warning
15 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" 14 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h"
16 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" 15 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h"
17 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" 17 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h"
19 #include "third_party/WebKit/public/platform/WebIDBTypes.h" 18 #include "third_party/WebKit/public/platform/WebIDBTypes.h"
20 #include "url/gurl.h" 19 #include "url/gurl.h"
21 #include "webkit/common/database/database_identifier.h" 20 #include "webkit/common/database/database_identifier.h"
22 21
23 using base::ASCIIToUTF16; 22 using base::ASCIIToUTF16;
24 23
25 namespace content { 24 namespace content {
26 25
27 namespace { 26 namespace {
28 27
29 class MockIDBFactory : public IndexedDBFactory { 28 class MockIDBFactory : public IndexedDBFactoryImpl {
30 public: 29 public:
31 explicit MockIDBFactory(IndexedDBContextImpl* context) 30 explicit MockIDBFactory(IndexedDBContextImpl* context)
32 : IndexedDBFactory(context) {} 31 : IndexedDBFactoryImpl(context) {}
33 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore( 32 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore(
34 const GURL& origin, 33 const GURL& origin,
35 const base::FilePath& data_directory) { 34 const base::FilePath& data_directory) {
36 blink::WebIDBDataLoss data_loss = 35 blink::WebIDBDataLoss data_loss =
37 blink::WebIDBDataLossNone; 36 blink::WebIDBDataLossNone;
38 std::string data_loss_message; 37 std::string data_loss_message;
39 bool disk_full; 38 bool disk_full;
40 leveldb::Status s; 39 leveldb::Status s;
41 scoped_refptr<IndexedDBBackingStore> backing_store = 40 scoped_refptr<IndexedDBBackingStore> backing_store =
42 OpenBackingStore(origin, 41 OpenBackingStore(origin,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 scoped_refptr<IndexedDBBackingStore> diskStore1 = 191 scoped_refptr<IndexedDBBackingStore> diskStore1 =
193 factory()->TestOpenBackingStore(too_long_origin, base_path); 192 factory()->TestOpenBackingStore(too_long_origin, base_path);
194 EXPECT_FALSE(diskStore1); 193 EXPECT_FALSE(diskStore1);
195 194
196 GURL ok_origin("http://someorigin.com:82/"); 195 GURL ok_origin("http://someorigin.com:82/");
197 scoped_refptr<IndexedDBBackingStore> diskStore2 = 196 scoped_refptr<IndexedDBBackingStore> diskStore2 =
198 factory()->TestOpenBackingStore(ok_origin, base_path); 197 factory()->TestOpenBackingStore(ok_origin, base_path);
199 EXPECT_TRUE(diskStore2); 198 EXPECT_TRUE(diskStore2);
200 } 199 }
201 200
202 class DiskFullFactory : public IndexedDBFactory { 201 class DiskFullFactory : public IndexedDBFactoryImpl {
203 public: 202 public:
204 explicit DiskFullFactory(IndexedDBContextImpl* context) 203 explicit DiskFullFactory(IndexedDBContextImpl* context)
205 : IndexedDBFactory(context) {} 204 : IndexedDBFactoryImpl(context) {}
206 205
207 private: 206 private:
208 virtual ~DiskFullFactory() {} 207 virtual ~DiskFullFactory() {}
209 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( 208 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
210 const GURL& origin_url, 209 const GURL& origin_url,
211 const base::FilePath& data_directory, 210 const base::FilePath& data_directory,
212 net::URLRequestContext* request_context, 211 net::URLRequestContext* request_context,
213 blink::WebIDBDataLoss* data_loss, 212 blink::WebIDBDataLoss* data_loss,
214 std::string* data_loss_message, 213 std::string* data_loss_message,
215 bool* disk_full, 214 bool* disk_full,
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 temp_directory.path()); 523 temp_directory.path());
525 EXPECT_TRUE(callbacks->saw_error()); 524 EXPECT_TRUE(callbacks->saw_error());
526 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); 525 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
527 } 526 }
528 527
529 // Terminate all pending-close timers. 528 // Terminate all pending-close timers.
530 factory()->ForceClose(origin); 529 factory()->ForceClose(origin);
531 } 530 }
532 531
533 } // namespace content 532 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory_impl.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698