| 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 "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 MockBrowsingDataFlashLSOHelper::MockBrowsingDataFlashLSOHelper( | 11 MockBrowsingDataFlashLSOHelper::MockBrowsingDataFlashLSOHelper( |
| 12 content::BrowserContext* browser_context) { | 12 content::BrowserContext* browser_context) { |
| 13 } | 13 } |
| 14 void MockBrowsingDataFlashLSOHelper::StartFetching( | 14 void MockBrowsingDataFlashLSOHelper::StartFetching( |
| 15 const GetSitesWithFlashDataCallback& callback) { | 15 const GetSitesWithFlashDataCallback& callback) { |
| 16 ASSERT_FALSE(callback.is_null()); |
| 17 ASSERT_TRUE(callback_.is_null()); |
| 16 callback_ = callback; | 18 callback_ = callback; |
| 17 } | 19 } |
| 18 | 20 |
| 19 void MockBrowsingDataFlashLSOHelper::DeleteFlashLSOsForSite( | 21 void MockBrowsingDataFlashLSOHelper::DeleteFlashLSOsForSite( |
| 20 const std::string& site) { | 22 const std::string& site) { |
| 21 std::vector<std::string>::iterator entry = | 23 std::vector<std::string>::iterator entry = |
| 22 std::find(domains_.begin(), domains_.end(), site); | 24 std::find(domains_.begin(), domains_.end(), site); |
| 23 ASSERT_TRUE(entry != domains_.end()); | 25 ASSERT_TRUE(entry != domains_.end()); |
| 24 domains_.erase(entry); | 26 domains_.erase(entry); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void MockBrowsingDataFlashLSOHelper::AddFlashLSODomain( | 29 void MockBrowsingDataFlashLSOHelper::AddFlashLSODomain( |
| 28 const std::string& domain) { | 30 const std::string& domain) { |
| 29 domains_.push_back(domain); | 31 domains_.push_back(domain); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void MockBrowsingDataFlashLSOHelper::Notify() { | 34 void MockBrowsingDataFlashLSOHelper::Notify() { |
| 33 callback_.Run(domains_); | 35 callback_.Run(domains_); |
| 34 callback_ = GetSitesWithFlashDataCallback(); | 36 callback_ = GetSitesWithFlashDataCallback(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 bool MockBrowsingDataFlashLSOHelper::AllDeleted() { | 39 bool MockBrowsingDataFlashLSOHelper::AllDeleted() { |
| 38 return domains_.empty(); | 40 return domains_.empty(); |
| 39 } | 41 } |
| 40 | 42 |
| 41 MockBrowsingDataFlashLSOHelper::~MockBrowsingDataFlashLSOHelper() { | 43 MockBrowsingDataFlashLSOHelper::~MockBrowsingDataFlashLSOHelper() { |
| 42 } | 44 } |
| OLD | NEW |