| 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/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 typedef BrowsingDataQuotaHelper::QuotaInfo QuotaInfo; | 25 typedef BrowsingDataQuotaHelper::QuotaInfo QuotaInfo; |
| 26 typedef BrowsingDataQuotaHelper::QuotaInfoArray QuotaInfoArray; | 26 typedef BrowsingDataQuotaHelper::QuotaInfoArray QuotaInfoArray; |
| 27 | 27 |
| 28 BrowsingDataQuotaHelperTest() | 28 BrowsingDataQuotaHelperTest() |
| 29 : fetching_completed_(true), | 29 : fetching_completed_(true), |
| 30 quota_(-1), | 30 quota_(-1), |
| 31 weak_factory_(this) {} | 31 weak_factory_(this) {} |
| 32 | 32 |
| 33 virtual ~BrowsingDataQuotaHelperTest() {} | 33 virtual ~BrowsingDataQuotaHelperTest() {} |
| 34 | 34 |
| 35 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() override { |
| 36 EXPECT_TRUE(dir_.CreateUniqueTempDir()); | 36 EXPECT_TRUE(dir_.CreateUniqueTempDir()); |
| 37 quota_manager_ = new storage::QuotaManager( | 37 quota_manager_ = new storage::QuotaManager( |
| 38 false, | 38 false, |
| 39 dir_.path(), | 39 dir_.path(), |
| 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
| 41 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), | 41 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), |
| 42 NULL); | 42 NULL); |
| 43 helper_ = new BrowsingDataQuotaHelperImpl( | 43 helper_ = new BrowsingDataQuotaHelperImpl( |
| 44 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), | 44 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), |
| 45 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 45 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
| 46 quota_manager_.get()); | 46 quota_manager_.get()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void TearDown() OVERRIDE { | 49 virtual void TearDown() override { |
| 50 helper_ = NULL; | 50 helper_ = NULL; |
| 51 quota_manager_ = NULL; | 51 quota_manager_ = NULL; |
| 52 quota_info_.clear(); | 52 quota_info_.clear(); |
| 53 base::MessageLoop::current()->RunUntilIdle(); | 53 base::MessageLoop::current()->RunUntilIdle(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 const QuotaInfoArray& quota_info() const { | 57 const QuotaInfoArray& quota_info() const { |
| 58 return quota_info_; | 58 return quota_info_; |
| 59 } | 59 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 base::MessageLoop::current()->RunUntilIdle(); | 197 base::MessageLoop::current()->RunUntilIdle(); |
| 198 | 198 |
| 199 GetPersistentHostQuota(kHost1); | 199 GetPersistentHostQuota(kHost1); |
| 200 base::MessageLoop::current()->RunUntilIdle(); | 200 base::MessageLoop::current()->RunUntilIdle(); |
| 201 EXPECT_EQ(0, quota()); | 201 EXPECT_EQ(0, quota()); |
| 202 | 202 |
| 203 GetPersistentHostQuota(kHost2); | 203 GetPersistentHostQuota(kHost2); |
| 204 base::MessageLoop::current()->RunUntilIdle(); | 204 base::MessageLoop::current()->RunUntilIdle(); |
| 205 EXPECT_EQ(10, quota()); | 205 EXPECT_EQ(10, quota()); |
| 206 } | 206 } |
| OLD | NEW |