| OLD | NEW |
| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 observer->GetNotificationDatabaseSize()); | 87 observer->GetNotificationDatabaseSize()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 class TestQuotaManagerProxy : public quota::QuotaManagerProxy { | 90 class TestQuotaManagerProxy : public quota::QuotaManagerProxy { |
| 91 public: | 91 public: |
| 92 TestQuotaManagerProxy() | 92 TestQuotaManagerProxy() |
| 93 : QuotaManagerProxy(NULL, NULL), | 93 : QuotaManagerProxy(NULL, NULL), |
| 94 registered_client_(NULL) { | 94 registered_client_(NULL) { |
| 95 } | 95 } |
| 96 | 96 |
| 97 virtual ~TestQuotaManagerProxy() { | |
| 98 EXPECT_FALSE(registered_client_); | |
| 99 } | |
| 100 | |
| 101 virtual void RegisterClient(quota::QuotaClient* client) { | 97 virtual void RegisterClient(quota::QuotaClient* client) { |
| 102 EXPECT_FALSE(registered_client_); | 98 EXPECT_FALSE(registered_client_); |
| 103 registered_client_ = client; | 99 registered_client_ = client; |
| 104 } | 100 } |
| 105 | 101 |
| 106 virtual void NotifyStorageAccessed(quota::QuotaClient::ID client_id, | 102 virtual void NotifyStorageAccessed(quota::QuotaClient::ID client_id, |
| 107 const GURL& origin, | 103 const GURL& origin, |
| 108 quota::StorageType type) { | 104 quota::StorageType type) { |
| 109 EXPECT_EQ(quota::QuotaClient::kDatabase, client_id); | 105 EXPECT_EQ(quota::QuotaClient::kDatabase, client_id); |
| 110 EXPECT_EQ(quota::kStorageTypeTemporary, type); | 106 EXPECT_EQ(quota::kStorageTypeTemporary, type); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 modifications_.clear(); | 142 modifications_.clear(); |
| 147 } | 143 } |
| 148 | 144 |
| 149 quota::QuotaClient* registered_client_; | 145 quota::QuotaClient* registered_client_; |
| 150 | 146 |
| 151 // Map from origin to count of access notifications. | 147 // Map from origin to count of access notifications. |
| 152 std::map<GURL, int> accesses_; | 148 std::map<GURL, int> accesses_; |
| 153 | 149 |
| 154 // Map from origin to <count, sum of deltas> | 150 // Map from origin to <count, sum of deltas> |
| 155 std::map<GURL, std::pair<int, int64> > modifications_; | 151 std::map<GURL, std::pair<int, int64> > modifications_; |
| 152 |
| 153 protected: |
| 154 virtual ~TestQuotaManagerProxy() { |
| 155 EXPECT_FALSE(registered_client_); |
| 156 } |
| 156 }; | 157 }; |
| 157 | 158 |
| 158 | 159 |
| 159 bool EnsureFileOfSize(const FilePath& file_path, int64 length) { | 160 bool EnsureFileOfSize(const FilePath& file_path, int64 length) { |
| 160 base::PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED); | 161 base::PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED); |
| 161 base::PlatformFile file = | 162 base::PlatformFile file = |
| 162 base::CreatePlatformFile( | 163 base::CreatePlatformFile( |
| 163 file_path, | 164 file_path, |
| 164 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE, | 165 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE, |
| 165 NULL, | 166 NULL, |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 943 |
| 943 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { | 944 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { |
| 944 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); | 945 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); |
| 945 } | 946 } |
| 946 | 947 |
| 947 TEST(DatabaseTrackerTest, HandleSqliteError) { | 948 TEST(DatabaseTrackerTest, HandleSqliteError) { |
| 948 DatabaseTracker_TestHelper_Test::HandleSqliteError(); | 949 DatabaseTracker_TestHelper_Test::HandleSqliteError(); |
| 949 } | 950 } |
| 950 | 951 |
| 951 } // namespace webkit_database | 952 } // namespace webkit_database |
| OLD | NEW |