| 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/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 35 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 using ::testing::_; | 38 using ::testing::_; |
| 39 using content::BrowserThread; | 39 using content::BrowserThread; |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 class CookiesTreeModelTest : public testing::Test { | 43 class CookiesTreeModelTest : public testing::Test { |
| 44 public: | 44 public: |
| 45 virtual ~CookiesTreeModelTest() { | 45 ~CookiesTreeModelTest() override { |
| 46 // Avoid memory leaks. | 46 // Avoid memory leaks. |
| 47 #if defined(ENABLE_EXTENSIONS) | 47 #if defined(ENABLE_EXTENSIONS) |
| 48 special_storage_policy_ = NULL; | 48 special_storage_policy_ = NULL; |
| 49 #endif | 49 #endif |
| 50 profile_.reset(); | 50 profile_.reset(); |
| 51 base::MessageLoop::current()->RunUntilIdle(); | 51 base::MessageLoop::current()->RunUntilIdle(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void SetUp() override { | 54 void SetUp() override { |
| 55 profile_.reset(new TestingProfile()); | 55 profile_.reset(new TestingProfile()); |
| 56 mock_browsing_data_cookie_helper_ = | 56 mock_browsing_data_cookie_helper_ = |
| 57 new MockBrowsingDataCookieHelper(profile_->GetRequestContext()); | 57 new MockBrowsingDataCookieHelper(profile_->GetRequestContext()); |
| 58 mock_browsing_data_database_helper_ = | 58 mock_browsing_data_database_helper_ = |
| 59 new MockBrowsingDataDatabaseHelper(profile_.get()); | 59 new MockBrowsingDataDatabaseHelper(profile_.get()); |
| 60 mock_browsing_data_local_storage_helper_ = | 60 mock_browsing_data_local_storage_helper_ = |
| 61 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 61 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 62 mock_browsing_data_session_storage_helper_ = | 62 mock_browsing_data_session_storage_helper_ = |
| 63 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 63 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 64 mock_browsing_data_appcache_helper_ = | 64 mock_browsing_data_appcache_helper_ = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 scoped_refptr<CookieSettings> cookie_settings = | 79 scoped_refptr<CookieSettings> cookie_settings = |
| 80 new CookieSettings(profile_->GetHostContentSettingsMap(), | 80 new CookieSettings(profile_->GetHostContentSettingsMap(), |
| 81 profile_->GetPrefs()); | 81 profile_->GetPrefs()); |
| 82 #if defined(ENABLE_EXTENSIONS) | 82 #if defined(ENABLE_EXTENSIONS) |
| 83 special_storage_policy_ = | 83 special_storage_policy_ = |
| 84 new ExtensionSpecialStoragePolicy(cookie_settings.get()); | 84 new ExtensionSpecialStoragePolicy(cookie_settings.get()); |
| 85 #endif | 85 #endif |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual void TearDown() override { | 88 void TearDown() override { |
| 89 mock_browsing_data_service_worker_helper_ = NULL; | 89 mock_browsing_data_service_worker_helper_ = NULL; |
| 90 mock_browsing_data_channel_id_helper_ = NULL; | 90 mock_browsing_data_channel_id_helper_ = NULL; |
| 91 mock_browsing_data_quota_helper_ = NULL; | 91 mock_browsing_data_quota_helper_ = NULL; |
| 92 mock_browsing_data_file_system_helper_ = NULL; | 92 mock_browsing_data_file_system_helper_ = NULL; |
| 93 mock_browsing_data_indexed_db_helper_ = NULL; | 93 mock_browsing_data_indexed_db_helper_ = NULL; |
| 94 mock_browsing_data_appcache_helper_ = NULL; | 94 mock_browsing_data_appcache_helper_ = NULL; |
| 95 mock_browsing_data_session_storage_helper_ = NULL; | 95 mock_browsing_data_session_storage_helper_ = NULL; |
| 96 mock_browsing_data_local_storage_helper_ = NULL; | 96 mock_browsing_data_local_storage_helper_ = NULL; |
| 97 mock_browsing_data_database_helper_ = NULL; | 97 mock_browsing_data_database_helper_ = NULL; |
| 98 mock_browsing_data_flash_lso_helper_ = NULL; | 98 mock_browsing_data_flash_lso_helper_ = NULL; |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1340 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
| 1341 | 1341 |
| 1342 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); | 1342 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); |
| 1343 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1343 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
| 1344 | 1344 |
| 1345 cookies_model.UpdateSearchResults(base::string16()); | 1345 cookies_model.UpdateSearchResults(base::string16()); |
| 1346 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1346 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 } // namespace | 1349 } // namespace |
| OLD | NEW |