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

Side by Side Diff: webkit/database/database_quota_client_unittest.cc

Issue 7234014: Move code to clear web databases on shutdown to the database tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/testing_profile.cc ('k') | webkit/database/database_tracker.h » ('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 (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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/memory/scoped_callback_factory.h" 8 #include "base/memory/scoped_callback_factory.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webkit/database/database_quota_client.h" 14 #include "webkit/database/database_quota_client.h"
15 #include "webkit/database/database_tracker.h" 15 #include "webkit/database/database_tracker.h"
16 #include "webkit/database/database_util.h" 16 #include "webkit/database/database_util.h"
17 17
18 namespace webkit_database { 18 namespace webkit_database {
19 19
20 // Declared to shorten the line lengths. 20 // Declared to shorten the line lengths.
21 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; 21 static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
22 static const quota::StorageType kPerm = quota::kStorageTypePersistent; 22 static const quota::StorageType kPerm = quota::kStorageTypePersistent;
23 23
24 // Mock tracker class the mocks up those methods of the tracker 24 // Mock tracker class the mocks up those methods of the tracker
25 // that are used by the QuotaClient. 25 // that are used by the QuotaClient.
26 class MockDatabaseTracker : public DatabaseTracker { 26 class MockDatabaseTracker : public DatabaseTracker {
27 public: 27 public:
28 MockDatabaseTracker() 28 MockDatabaseTracker()
29 : DatabaseTracker(FilePath(), false, NULL, NULL, NULL), 29 : DatabaseTracker(FilePath(), false, false, NULL, NULL, NULL),
30 delete_called_count_(0), 30 delete_called_count_(0),
31 async_delete_(false) {} 31 async_delete_(false) {}
32 32
33 virtual ~MockDatabaseTracker() {} 33 virtual ~MockDatabaseTracker() {}
34 34
35 virtual bool GetOriginInfo( 35 virtual bool GetOriginInfo(
36 const string16& origin_identifier, 36 const string16& origin_identifier,
37 OriginInfo* info) OVERRIDE { 37 OriginInfo* info) OVERRIDE {
38 std::map<GURL, MockOriginInfo>::const_iterator found = 38 std::map<GURL, MockOriginInfo>::const_iterator found =
39 mock_origin_infos_.find( 39 mock_origin_infos_.find(
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 mock_tracker()->set_async_delete(false); 271 mock_tracker()->set_async_delete(false);
272 EXPECT_TRUE(DeleteOriginData(&client, kTemp, kOriginA)); 272 EXPECT_TRUE(DeleteOriginData(&client, kTemp, kOriginA));
273 EXPECT_EQ(1, mock_tracker()->delete_called_count()); 273 EXPECT_EQ(1, mock_tracker()->delete_called_count());
274 274
275 mock_tracker()->set_async_delete(true); 275 mock_tracker()->set_async_delete(true);
276 EXPECT_TRUE(DeleteOriginData(&client, kTemp, kOriginA)); 276 EXPECT_TRUE(DeleteOriginData(&client, kTemp, kOriginA));
277 EXPECT_EQ(2, mock_tracker()->delete_called_count()); 277 EXPECT_EQ(2, mock_tracker()->delete_called_count());
278 } 278 }
279 279
280 } // namespace webkit_database 280 } // namespace webkit_database
OLDNEW
« no previous file with comments | « chrome/test/testing_profile.cc ('k') | webkit/database/database_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698