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

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

Issue 501183003: Remove implicit conversions from scoped_refptr to T* in content/browser/indexed_db/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 new MockQuotaManager(false /*in_memory*/, 47 new MockQuotaManager(false /*in_memory*/,
48 browser_context_->GetPath(), 48 browser_context_->GetPath(),
49 base::MessageLoop::current()->message_loop_proxy(), 49 base::MessageLoop::current()->message_loop_proxy(),
50 base::MessageLoop::current()->message_loop_proxy(), 50 base::MessageLoop::current()->message_loop_proxy(),
51 browser_context_->GetSpecialStoragePolicy()); 51 browser_context_->GetSpecialStoragePolicy());
52 52
53 idb_context_ = 53 idb_context_ =
54 new IndexedDBContextImpl(browser_context_->GetPath(), 54 new IndexedDBContextImpl(browser_context_->GetPath(),
55 browser_context_->GetSpecialStoragePolicy(), 55 browser_context_->GetSpecialStoragePolicy(),
56 quota_manager->proxy(), 56 quota_manager->proxy(),
57 task_runner_); 57 task_runner_.get());
58 base::MessageLoop::current()->RunUntilIdle(); 58 base::MessageLoop::current()->RunUntilIdle();
59 setup_temp_dir(); 59 setup_temp_dir();
60 } 60 }
61 61
62 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); } 62 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); }
63 63
64 void setup_temp_dir() { 64 void setup_temp_dir() {
65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
66 base::FilePath indexeddb_dir = 66 base::FilePath indexeddb_dir =
67 temp_dir_.path().Append(IndexedDBContextImpl::kIndexedDBDirectory); 67 temp_dir_.path().Append(IndexedDBContextImpl::kIndexedDBDirectory);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 client->DeleteOriginData( 123 client->DeleteOriginData(
124 origin_url, 124 origin_url,
125 kTemp, 125 kTemp,
126 base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete, 126 base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete,
127 weak_factory_.GetWeakPtr())); 127 weak_factory_.GetWeakPtr()));
128 FlushIndexedDBTaskRunner(); 128 FlushIndexedDBTaskRunner();
129 base::MessageLoop::current()->RunUntilIdle(); 129 base::MessageLoop::current()->RunUntilIdle();
130 return delete_status_; 130 return delete_status_;
131 } 131 }
132 132
133 IndexedDBContextImpl* idb_context() { return idb_context_; } 133 IndexedDBContextImpl* idb_context() { return idb_context_.get(); }
134 134
135 void SetFileSizeTo(const base::FilePath& path, int size) { 135 void SetFileSizeTo(const base::FilePath& path, int size) {
136 std::string junk(size, 'a'); 136 std::string junk(size, 'a');
137 ASSERT_EQ(size, base::WriteFile(path, junk.c_str(), size)); 137 ASSERT_EQ(size, base::WriteFile(path, junk.c_str(), size));
138 } 138 }
139 139
140 void AddFakeIndexedDB(const GURL& origin, int size) { 140 void AddFakeIndexedDB(const GURL& origin, int size) {
141 base::FilePath file_path_origin = idb_context()->GetFilePathForTesting( 141 base::FilePath file_path_origin = idb_context()->GetFilePathForTesting(
142 storage::GetIdentifierFromOrigin(origin)); 142 storage::GetIdentifierFromOrigin(origin));
143 if (!base::CreateDirectory(file_path_origin)) { 143 if (!base::CreateDirectory(file_path_origin)) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); 236 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
238 238
239 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); 239 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA);
240 EXPECT_EQ(storage::kQuotaStatusOk, delete_status); 240 EXPECT_EQ(storage::kQuotaStatusOk, delete_status);
241 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); 241 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
242 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 242 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
243 } 243 }
244 244
245 } // namespace content 245 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_quota_client.cc ('k') | content/browser/indexed_db/indexed_db_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698