Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1370 MockStorageClient* client = | 1370 MockStorageClient* client = |
| 1371 CreateClient(kData, arraysize(kData), QuotaClient::kFileSystem); | 1371 CreateClient(kData, arraysize(kData), QuotaClient::kFileSystem); |
| 1372 RegisterClient(client); | 1372 RegisterClient(client); |
| 1373 | 1373 |
| 1374 GetGlobalUsage(kTemp); | 1374 GetGlobalUsage(kTemp); |
| 1375 base::RunLoop().RunUntilIdle(); | 1375 base::RunLoop().RunUntilIdle(); |
| 1376 | 1376 |
| 1377 EvictOriginData(GURL("http://foo.com/"), kTemp); | 1377 EvictOriginData(GURL("http://foo.com/"), kTemp); |
| 1378 base::RunLoop().RunUntilIdle(); | 1378 base::RunLoop().RunUntilIdle(); |
| 1379 | 1379 |
| 1380 // Ensure used count and time since access are recorded. | |
| 1381 histograms.ExpectTotalCount( | |
| 1382 QuotaManager::kEvictedOriginAccessedCountHistogram, 1); | |
| 1383 histograms.ExpectBucketCount( | |
| 1384 QuotaManager::kEvictedOriginAccessedCountHistogram, 0, 1); | |
| 1385 histograms.ExpectTotalCount( | |
| 1386 QuotaManager::kEvictedOriginTimeSinceAccessHistogram, 1); | |
|
michaeln
2015/11/05 00:01:23
ooops, wait... this test is red?
calamity
2015/11/05 07:10:47
Only ran quota database tests locally after the ch
| |
| 1387 | |
| 1380 // First eviction has no 'last' time to compare to. | 1388 // First eviction has no 'last' time to compare to. |
| 1381 histograms.ExpectTotalCount( | 1389 histograms.ExpectTotalCount( |
| 1382 QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 0); | 1390 QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 0); |
| 1383 | 1391 |
| 1384 client->AddOriginAndNotify(GURL("http://foo.com"), kTemp, 100); | 1392 client->AddOriginAndNotify(GURL("http://foo.com"), kTemp, 100); |
| 1385 | 1393 |
| 1394 // Change the used count of the origin. | |
| 1395 quota_manager()->NotifyStorageAccessed(QuotaClient::kUnknown, GURL(kOrigin), | |
| 1396 kTemp); | |
| 1397 base::RunLoop().RunUntilIdle(); | |
| 1398 | |
| 1386 GetGlobalUsage(kTemp); | 1399 GetGlobalUsage(kTemp); |
| 1387 base::RunLoop().RunUntilIdle(); | 1400 base::RunLoop().RunUntilIdle(); |
| 1388 | 1401 |
| 1389 EvictOriginData(GURL("http://foo.com/"), kTemp); | 1402 EvictOriginData(GURL("http://foo.com/"), kTemp); |
| 1390 base::RunLoop().RunUntilIdle(); | 1403 base::RunLoop().RunUntilIdle(); |
| 1391 | 1404 |
| 1392 // Second eviction should log a histogram sample. | 1405 // The new used count should be logged. |
| 1406 histograms.ExpectTotalCount( | |
| 1407 QuotaManager::kEvictedOriginAccessedCountHistogram, 2); | |
| 1408 histograms.ExpectBucketCount( | |
| 1409 QuotaManager::kEvictedOriginAccessedCountHistogram, 1, 1); | |
| 1410 histograms.ExpectTotalCount( | |
| 1411 QuotaManager::kEvictedOriginTimeSinceAccessHistogram, 2); | |
| 1412 | |
| 1413 // Second eviction should log a 'time between repeated eviction' sample. | |
| 1393 histograms.ExpectTotalCount( | 1414 histograms.ExpectTotalCount( |
| 1394 QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 1); | 1415 QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 1); |
| 1395 | 1416 |
| 1396 client->AddOriginAndNotify(GURL("http://foo.com"), kTemp, 100); | 1417 client->AddOriginAndNotify(GURL("http://foo.com"), kTemp, 100); |
| 1397 | 1418 |
| 1398 GetGlobalUsage(kTemp); | 1419 GetGlobalUsage(kTemp); |
| 1399 base::RunLoop().RunUntilIdle(); | 1420 base::RunLoop().RunUntilIdle(); |
| 1400 | 1421 |
| 1401 DeleteOriginFromDatabase(GURL("http://foo.com"), kTemp); | 1422 DeleteOriginFromDatabase(GURL("http://foo.com"), kTemp); |
| 1402 | 1423 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2251 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); | 2272 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); |
| 2252 | 2273 |
| 2253 GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); | 2274 GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
| 2254 base::RunLoop().RunUntilIdle(); | 2275 base::RunLoop().RunUntilIdle(); |
| 2255 EXPECT_EQ(kQuotaStatusOk, status()); | 2276 EXPECT_EQ(kQuotaStatusOk, status()); |
| 2256 EXPECT_EQ(10, usage()); | 2277 EXPECT_EQ(10, usage()); |
| 2257 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); | 2278 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); |
| 2258 } | 2279 } |
| 2259 | 2280 |
| 2260 } // namespace content | 2281 } // namespace content |
| OLD | NEW |