| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 MessageLoop::current()->RunAllPending(); | 153 MessageLoop::current()->RunAllPending(); |
| 154 EXPECT_TRUE(fetching_completed()); | 154 EXPECT_TRUE(fetching_completed()); |
| 155 | 155 |
| 156 std::set<QuotaInfo> expected, actual; | 156 std::set<QuotaInfo> expected, actual; |
| 157 actual.insert(quota_info().begin(), quota_info().end()); | 157 actual.insert(quota_info().begin(), quota_info().end()); |
| 158 expected.insert(QuotaInfo("example.com", 11, 100)); | 158 expected.insert(QuotaInfo("example.com", 11, 100)); |
| 159 expected.insert(QuotaInfo("example2.com", 1000, 0)); | 159 expected.insert(QuotaInfo("example2.com", 1000, 0)); |
| 160 EXPECT_TRUE(expected == actual); | 160 EXPECT_TRUE(expected == actual); |
| 161 } | 161 } |
| 162 | 162 |
| 163 TEST_F(BrowsingDataQuotaHelperTest, IgnoreExtensions) { | 163 TEST_F(BrowsingDataQuotaHelperTest, IgnoreExtensionsAndDevTools) { |
| 164 const quota::MockOriginData kOrigins[] = { | 164 const quota::MockOriginData kOrigins[] = { |
| 165 {"http://example.com/", quota::kStorageTypeTemporary, 1}, | 165 {"http://example.com/", quota::kStorageTypeTemporary, 1}, |
| 166 {"https://example.com/", quota::kStorageTypeTemporary, 10}, | 166 {"https://example.com/", quota::kStorageTypeTemporary, 10}, |
| 167 {"http://example.com/", quota::kStorageTypePersistent, 100}, | 167 {"http://example.com/", quota::kStorageTypePersistent, 100}, |
| 168 {"http://example2.com/", quota::kStorageTypeTemporary, 1000}, | 168 {"http://example2.com/", quota::kStorageTypeTemporary, 1000}, |
| 169 {"chrome-extension://abcdefghijklmnopqrstuvwxyz/", | 169 {"chrome-extension://abcdefghijklmnopqrstuvwxyz/", |
| 170 quota::kStorageTypeTemporary, 10000}, | 170 quota::kStorageTypeTemporary, 10000}, |
| 171 {"chrome-extension://abcdefghijklmnopqrstuvwxyz/", | 171 {"chrome-extension://abcdefghijklmnopqrstuvwxyz/", |
| 172 quota::kStorageTypePersistent, 100000}, | 172 quota::kStorageTypePersistent, 100000}, |
| 173 {"chrome-devtools://abcdefghijklmnopqrstuvwxyz/", |
| 174 quota::kStorageTypeTemporary, 10000}, |
| 175 {"chrome-devtools://abcdefghijklmnopqrstuvwxyz/", |
| 176 quota::kStorageTypePersistent, 100000}, |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 RegisterClient(kOrigins, arraysize(kOrigins)); | 179 RegisterClient(kOrigins, arraysize(kOrigins)); |
| 176 StartFetching(); | 180 StartFetching(); |
| 177 MessageLoop::current()->RunAllPending(); | 181 MessageLoop::current()->RunAllPending(); |
| 178 EXPECT_TRUE(fetching_completed()); | 182 EXPECT_TRUE(fetching_completed()); |
| 179 | 183 |
| 180 std::set<QuotaInfo> expected, actual; | 184 std::set<QuotaInfo> expected, actual; |
| 181 actual.insert(quota_info().begin(), quota_info().end()); | 185 actual.insert(quota_info().begin(), quota_info().end()); |
| 182 expected.insert(QuotaInfo("example.com", 11, 100)); | 186 expected.insert(QuotaInfo("example.com", 11, 100)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 196 MessageLoop::current()->RunAllPending(); | 200 MessageLoop::current()->RunAllPending(); |
| 197 | 201 |
| 198 GetPersistentHostQuota(kHost1); | 202 GetPersistentHostQuota(kHost1); |
| 199 MessageLoop::current()->RunAllPending(); | 203 MessageLoop::current()->RunAllPending(); |
| 200 EXPECT_EQ(0, quota()); | 204 EXPECT_EQ(0, quota()); |
| 201 | 205 |
| 202 GetPersistentHostQuota(kHost2); | 206 GetPersistentHostQuota(kHost2); |
| 203 MessageLoop::current()->RunAllPending(); | 207 MessageLoop::current()->RunAllPending(); |
| 204 EXPECT_EQ(10, quota()); | 208 EXPECT_EQ(10, quota()); |
| 205 } | 209 } |
| OLD | NEW |