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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
11 #include "base/message_loop.h" | |
12 #include "base/scoped_temp_dir.h" | |
13 #include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h" | 13 #include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h" |
14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
15 #include "webkit/quota/mock_storage_client.h" | 15 #include "webkit/quota/mock_storage_client.h" |
16 #include "webkit/quota/quota_manager.h" | 16 #include "webkit/quota/quota_manager.h" |
17 | 17 |
18 using content::BrowserThread; | 18 using content::BrowserThread; |
19 | 19 |
20 class BrowsingDataQuotaHelperTest : public testing::Test { | 20 class BrowsingDataQuotaHelperTest : public testing::Test { |
21 public: | 21 public: |
22 typedef BrowsingDataQuotaHelper::QuotaInfo QuotaInfo; | 22 typedef BrowsingDataQuotaHelper::QuotaInfo QuotaInfo; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 quota_info_ = quota_info; | 112 quota_info_ = quota_info; |
113 fetching_completed_ = true; | 113 fetching_completed_ = true; |
114 } | 114 } |
115 | 115 |
116 MessageLoop message_loop_; | 116 MessageLoop message_loop_; |
117 content::TestBrowserThread ui_thread_; | 117 content::TestBrowserThread ui_thread_; |
118 content::TestBrowserThread db_thread_; | 118 content::TestBrowserThread db_thread_; |
119 content::TestBrowserThread io_thread_; | 119 content::TestBrowserThread io_thread_; |
120 scoped_refptr<quota::QuotaManager> quota_manager_; | 120 scoped_refptr<quota::QuotaManager> quota_manager_; |
121 | 121 |
122 ScopedTempDir dir_; | 122 base::ScopedTempDir dir_; |
123 scoped_refptr<BrowsingDataQuotaHelper> helper_; | 123 scoped_refptr<BrowsingDataQuotaHelper> helper_; |
124 | 124 |
125 bool fetching_completed_; | 125 bool fetching_completed_; |
126 QuotaInfoArray quota_info_; | 126 QuotaInfoArray quota_info_; |
127 int64 quota_; | 127 int64 quota_; |
128 base::WeakPtrFactory<BrowsingDataQuotaHelperTest> weak_factory_; | 128 base::WeakPtrFactory<BrowsingDataQuotaHelperTest> weak_factory_; |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperTest); | 130 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperTest); |
131 }; | 131 }; |
132 | 132 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 MessageLoop::current()->RunAllPending(); | 197 MessageLoop::current()->RunAllPending(); |
198 | 198 |
199 GetPersistentHostQuota(kHost1); | 199 GetPersistentHostQuota(kHost1); |
200 MessageLoop::current()->RunAllPending(); | 200 MessageLoop::current()->RunAllPending(); |
201 EXPECT_EQ(0, quota()); | 201 EXPECT_EQ(0, quota()); |
202 | 202 |
203 GetPersistentHostQuota(kHost2); | 203 GetPersistentHostQuota(kHost2); |
204 MessageLoop::current()->RunAllPending(); | 204 MessageLoop::current()->RunAllPending(); |
205 EXPECT_EQ(10, quota()); | 205 EXPECT_EQ(10, quota()); |
206 } | 206 } |
OLD | NEW |