| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.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" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void StartFetching() { | 64 void StartFetching() { |
| 65 fetching_completed_ = false; | 65 fetching_completed_ = false; |
| 66 helper_->StartFetching( | 66 helper_->StartFetching( |
| 67 base::Bind(&BrowsingDataQuotaHelperTest::FetchCompleted, | 67 base::Bind(&BrowsingDataQuotaHelperTest::FetchCompleted, |
| 68 weak_factory_.GetWeakPtr())); | 68 weak_factory_.GetWeakPtr())); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RegisterClient(const quota::MockOriginData* data, std::size_t data_len) { | 71 void RegisterClient(const quota::MockOriginData* data, std::size_t data_len) { |
| 72 quota::MockStorageClient* client = | 72 quota::MockStorageClient* client = |
| 73 new quota::MockStorageClient( | 73 new quota::MockStorageClient( |
| 74 quota_manager_->proxy(), data, data_len); | 74 quota_manager_->proxy(), data, quota::QuotaClient::kFileSystem, |
| 75 data_len); |
| 75 quota_manager_->proxy()->RegisterClient(client); | 76 quota_manager_->proxy()->RegisterClient(client); |
| 76 client->TouchAllOriginsAndNotify(); | 77 client->TouchAllOriginsAndNotify(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void SetPersistentHostQuota(const std::string& host, int64 quota) { | 80 void SetPersistentHostQuota(const std::string& host, int64 quota) { |
| 80 quota_ = -1; | 81 quota_ = -1; |
| 81 quota_manager_->SetPersistentHostQuota( | 82 quota_manager_->SetPersistentHostQuota( |
| 82 host, quota, | 83 host, quota, |
| 83 base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota, | 84 base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota, |
| 84 weak_factory_.GetWeakPtr())); | 85 weak_factory_.GetWeakPtr())); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 MessageLoop::current()->RunAllPending(); | 172 MessageLoop::current()->RunAllPending(); |
| 172 | 173 |
| 173 GetPersistentHostQuota(kHost1); | 174 GetPersistentHostQuota(kHost1); |
| 174 MessageLoop::current()->RunAllPending(); | 175 MessageLoop::current()->RunAllPending(); |
| 175 EXPECT_EQ(0, quota()); | 176 EXPECT_EQ(0, quota()); |
| 176 | 177 |
| 177 GetPersistentHostQuota(kHost2); | 178 GetPersistentHostQuota(kHost2); |
| 178 MessageLoop::current()->RunAllPending(); | 179 MessageLoop::current()->RunAllPending(); |
| 179 EXPECT_EQ(10, quota()); | 180 EXPECT_EQ(10, quota()); |
| 180 } | 181 } |
| OLD | NEW |