OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void GetPersistentHostQuota(const std::string& host) { | 88 void GetPersistentHostQuota(const std::string& host) { |
89 quota_ = -1; | 89 quota_ = -1; |
90 quota_manager_->GetPersistentHostQuota( | 90 quota_manager_->GetPersistentHostQuota( |
91 host, | 91 host, |
92 base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota, | 92 base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota, |
93 weak_factory_.GetWeakPtr())); | 93 weak_factory_.GetWeakPtr())); |
94 } | 94 } |
95 | 95 |
96 void GotPersistentHostQuota(quota::QuotaStatusCode status, | 96 void GotPersistentHostQuota(quota::QuotaStatusCode status, |
97 const std::string& host, | |
98 quota::StorageType type, | |
99 int64 quota) { | 97 int64 quota) { |
100 EXPECT_EQ(quota::kQuotaStatusOk, status); | 98 EXPECT_EQ(quota::kQuotaStatusOk, status); |
101 EXPECT_EQ(quota::kStorageTypePersistent, type); | |
102 quota_ = quota; | 99 quota_ = quota; |
103 } | 100 } |
104 | 101 |
105 void RevokeHostQuota(const std::string& host) { | 102 void RevokeHostQuota(const std::string& host) { |
106 helper_->RevokeHostQuota(host); | 103 helper_->RevokeHostQuota(host); |
107 } | 104 } |
108 | 105 |
109 int64 quota() { | 106 int64 quota() { |
110 return quota_; | 107 return quota_; |
111 } | 108 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 MessageLoop::current()->RunAllPending(); | 197 MessageLoop::current()->RunAllPending(); |
201 | 198 |
202 GetPersistentHostQuota(kHost1); | 199 GetPersistentHostQuota(kHost1); |
203 MessageLoop::current()->RunAllPending(); | 200 MessageLoop::current()->RunAllPending(); |
204 EXPECT_EQ(0, quota()); | 201 EXPECT_EQ(0, quota()); |
205 | 202 |
206 GetPersistentHostQuota(kHost2); | 203 GetPersistentHostQuota(kHost2); |
207 MessageLoop::current()->RunAllPending(); | 204 MessageLoop::current()->RunAllPending(); |
208 EXPECT_EQ(10, quota()); | 205 EXPECT_EQ(10, quota()); |
209 } | 206 } |
OLD | NEW |