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

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

Issue 8400060: Switch content tests to use BrowserThreadImpl directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr Created 9 years, 1 month 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 | Annotate | Revision Log
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_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_callback_factory.h" 10 #include "base/memory/scoped_callback_factory.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
14 #include "content/browser/browser_thread_impl.h"
14 #include "content/browser/in_process_webkit/indexed_db_context.h" 15 #include "content/browser/in_process_webkit/indexed_db_context.h"
15 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" 16 #include "content/browser/in_process_webkit/indexed_db_quota_client.h"
16 #include "content/browser/in_process_webkit/webkit_context.h" 17 #include "content/browser/in_process_webkit/webkit_context.h"
17 #include "content/test/test_browser_context.h" 18 #include "content/test/test_browser_context.h"
18 #include "content/test/test_browser_thread.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "webkit/database/database_util.h" 20 #include "webkit/database/database_util.h"
21 21
22
22 // Declared to shorten the line lengths. 23 // Declared to shorten the line lengths.
23 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; 24 static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
24 static const quota::StorageType kPerm = quota::kStorageTypePersistent; 25 static const quota::StorageType kPerm = quota::kStorageTypePersistent;
25 26
26 using namespace webkit_database; 27 using namespace webkit_database;
28 using content::BrowserThreadImpl;
27 29
28 // Base class for our test fixtures. 30 // Base class for our test fixtures.
29 class IndexedDBQuotaClientTest : public testing::Test { 31 class IndexedDBQuotaClientTest : public testing::Test {
30 public: 32 public:
31 const GURL kOriginA; 33 const GURL kOriginA;
32 const GURL kOriginB; 34 const GURL kOriginB;
33 const GURL kOriginOther; 35 const GURL kOriginOther;
34 36
35 IndexedDBQuotaClientTest() 37 IndexedDBQuotaClientTest()
36 : kOriginA("http://host"), 38 : kOriginA("http://host"),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 delete_status_ = code; 149 delete_status_ = code;
148 } 150 }
149 151
150 ScopedTempDir temp_dir_; 152 ScopedTempDir temp_dir_;
151 int64 usage_; 153 int64 usage_;
152 std::set<GURL> origins_; 154 std::set<GURL> origins_;
153 quota::StorageType type_; 155 quota::StorageType type_;
154 scoped_refptr<IndexedDBContext> idb_context_; 156 scoped_refptr<IndexedDBContext> idb_context_;
155 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; 157 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_;
156 MessageLoop message_loop_; 158 MessageLoop message_loop_;
157 content::TestBrowserThread webkit_thread_; 159 BrowserThreadImpl webkit_thread_;
158 content::TestBrowserThread io_thread_; 160 BrowserThreadImpl io_thread_;
159 quota::QuotaStatusCode delete_status_; 161 quota::QuotaStatusCode delete_status_;
160 }; 162 };
161 163
162 164
163 TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) { 165 TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
164 IndexedDBQuotaClient client( 166 IndexedDBQuotaClient client(
165 base::MessageLoopProxy::current(), 167 base::MessageLoopProxy::current(),
166 idb_context()); 168 idb_context());
167 169
168 AddFakeIndexedDB(kOriginA, 6); 170 AddFakeIndexedDB(kOriginA, 6);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 AddFakeIndexedDB(kOriginA, 1000); 231 AddFakeIndexedDB(kOriginA, 1000);
230 AddFakeIndexedDB(kOriginB, 50); 232 AddFakeIndexedDB(kOriginB, 50);
231 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); 233 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
232 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 234 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
233 235
234 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); 236 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA);
235 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); 237 EXPECT_EQ(quota::kQuotaStatusOk, delete_status);
236 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); 238 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 239 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
238 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698