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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 BrowsingDataLocalStorageHelper* local_storage_helper_; | 109 BrowsingDataLocalStorageHelper* local_storage_helper_; |
110 }; | 110 }; |
111 | 111 |
112 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, CallbackCompletes) { | 112 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, CallbackCompletes) { |
113 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( | 113 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( |
114 new BrowsingDataLocalStorageHelper(browser()->profile())); | 114 new BrowsingDataLocalStorageHelper(browser()->profile())); |
115 CreateLocalStorageFilesForTest(); | 115 CreateLocalStorageFilesForTest(); |
116 StopTestOnCallback stop_test_on_callback(local_storage_helper); | 116 StopTestOnCallback stop_test_on_callback(local_storage_helper.get()); |
117 local_storage_helper->StartFetching( | 117 local_storage_helper->StartFetching(base::Bind( |
118 base::Bind(&StopTestOnCallback::Callback, | 118 &StopTestOnCallback::Callback, base::Unretained(&stop_test_on_callback))); |
119 base::Unretained(&stop_test_on_callback))); | |
120 // Blocks until StopTestOnCallback::Callback is notified. | 119 // Blocks until StopTestOnCallback::Callback is notified. |
121 content::RunMessageLoop(); | 120 content::RunMessageLoop(); |
122 } | 121 } |
123 | 122 |
124 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { | 123 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { |
125 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( | 124 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( |
126 new BrowsingDataLocalStorageHelper(browser()->profile())); | 125 new BrowsingDataLocalStorageHelper(browser()->profile())); |
127 CreateLocalStorageFilesForTest(); | 126 CreateLocalStorageFilesForTest(); |
128 local_storage_helper->DeleteOrigin(GURL(kOriginOfTestFile0)); | 127 local_storage_helper->DeleteOrigin(GURL(kOriginOfTestFile0)); |
129 BrowserThread::GetBlockingPool()->FlushForTesting(); | 128 BrowserThread::GetBlockingPool()->FlushForTesting(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 base::Bind(&TestCompletionCallback::callback, | 181 base::Bind(&TestCompletionCallback::callback, |
183 base::Unretained(&callback))); | 182 base::Unretained(&callback))); |
184 | 183 |
185 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result = | 184 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result = |
186 callback.result(); | 185 callback.result(); |
187 | 186 |
188 ASSERT_EQ(1u, result.size()); | 187 ASSERT_EQ(1u, result.size()); |
189 EXPECT_EQ(origin, result.begin()->origin_url); | 188 EXPECT_EQ(origin, result.begin()->origin_url); |
190 } | 189 } |
191 } // namespace | 190 } // namespace |
OLD | NEW |