| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 <memory> | 6 #include <memory> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 base::Bind(&ConditionalCacheCountingHelperBrowserTest::CountCallback, | 28 base::Bind(&ConditionalCacheCountingHelperBrowserTest::CountCallback, |
| 29 base::Unretained(this)); | 29 base::Unretained(this)); |
| 30 | 30 |
| 31 cache_util_ = base::MakeUnique<content::CacheTestUtil>( | 31 cache_util_ = base::MakeUnique<content::CacheTestUtil>( |
| 32 content::BrowserContext::GetDefaultStoragePartition( | 32 content::BrowserContext::GetDefaultStoragePartition( |
| 33 browser()->profile())); | 33 browser()->profile())); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void TearDownOnMainThread() override { cache_util_.reset(); } | 36 void TearDownOnMainThread() override { cache_util_.reset(); } |
| 37 | 37 |
| 38 void CountCallback(int64_t size, bool is_upper_limit) { | 38 void CountCallback(bool is_upper_limit, int64_t size) { |
| 39 // Negative values represent an unexpected error. | 39 // Negative values represent an unexpected error. |
| 40 DCHECK(size >= 0 || size == net::ERR_ABORTED); | 40 DCHECK(size >= 0 || size == net::ERR_ABORTED); |
| 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 42 last_size_ = size; | 42 last_size_ = size; |
| 43 last_is_upper_limit_ = is_upper_limit; | 43 last_is_upper_limit_ = is_upper_limit; |
| 44 | 44 |
| 45 if (run_loop_) | 45 if (run_loop_) |
| 46 run_loop_->Quit(); | 46 run_loop_->Quit(); |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 EXPECT_EQ(size_1_2, size_1_3); | 123 EXPECT_EQ(size_1_2, size_1_3); |
| 124 EXPECT_EQ(size_2_3, size_1_3); | 124 EXPECT_EQ(size_2_3, size_1_3); |
| 125 } else { | 125 } else { |
| 126 EXPECT_GT(size_1_2, 0); | 126 EXPECT_GT(size_1_2, 0); |
| 127 EXPECT_GT(size_2_3, 0); | 127 EXPECT_GT(size_2_3, 0); |
| 128 EXPECT_LT(size_1_2, size_1_3); | 128 EXPECT_LT(size_1_2, size_1_3); |
| 129 EXPECT_LT(size_2_3, size_1_3); | 129 EXPECT_LT(size_2_3, size_1_3); |
| 130 EXPECT_EQ(size_1_2 + size_2_3, size_1_3); | 130 EXPECT_EQ(size_1_2 + size_2_3, size_1_3); |
| 131 } | 131 } |
| 132 } | 132 } |
| OLD | NEW |