| 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/cookies_tree_model.h" | 5 #include "chrome/browser/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/content_settings/cookie_settings.h" | 10 #include "chrome/browser/content_settings/cookie_settings.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
| 29 | 29 |
| 30 using ::testing::_; | 30 using ::testing::_; |
| 31 using content::BrowserThread; | 31 using content::BrowserThread; |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 class CookiesTreeModelTest : public testing::Test { | 35 class CookiesTreeModelTest : public testing::Test { |
| 36 public: | 36 public: |
| 37 CookiesTreeModelTest() : ui_thread_(BrowserThread::UI, &message_loop_), | 37 CookiesTreeModelTest() |
| 38 io_thread_(BrowserThread::IO, &message_loop_) { | 38 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 39 file_user_blocking_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
| 40 io_thread_(BrowserThread::IO, &message_loop_) { |
| 39 } | 41 } |
| 40 | 42 |
| 41 virtual ~CookiesTreeModelTest() { | 43 virtual ~CookiesTreeModelTest() { |
| 42 } | 44 } |
| 43 | 45 |
| 44 virtual void SetUp() OVERRIDE { | 46 virtual void SetUp() OVERRIDE { |
| 45 profile_.reset(new TestingProfile()); | 47 profile_.reset(new TestingProfile()); |
| 46 profile_->CreateRequestContext(); | 48 profile_->CreateRequestContext(); |
| 47 mock_browsing_data_cookie_helper_ = | 49 mock_browsing_data_cookie_helper_ = |
| 48 new MockBrowsingDataCookieHelper(profile_.get()); | 50 new MockBrowsingDataCookieHelper(profile_.get()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 void DeleteStoredObjects(CookieTreeNode* node) { | 271 void DeleteStoredObjects(CookieTreeNode* node) { |
| 270 node->DeleteStoredObjects(); | 272 node->DeleteStoredObjects(); |
| 271 CookieTreeNode* parent_node = node->parent(); | 273 CookieTreeNode* parent_node = node->parent(); |
| 272 DCHECK(parent_node); | 274 DCHECK(parent_node); |
| 273 delete parent_node->GetModel()->Remove(parent_node, node); | 275 delete parent_node->GetModel()->Remove(parent_node, node); |
| 274 } | 276 } |
| 275 | 277 |
| 276 protected: | 278 protected: |
| 277 MessageLoop message_loop_; | 279 MessageLoop message_loop_; |
| 278 content::TestBrowserThread ui_thread_; | 280 content::TestBrowserThread ui_thread_; |
| 281 content::TestBrowserThread file_user_blocking_; |
| 279 content::TestBrowserThread io_thread_; | 282 content::TestBrowserThread io_thread_; |
| 280 | 283 |
| 281 scoped_ptr<TestingProfile> profile_; | 284 scoped_ptr<TestingProfile> profile_; |
| 282 scoped_refptr<MockBrowsingDataCookieHelper> | 285 scoped_refptr<MockBrowsingDataCookieHelper> |
| 283 mock_browsing_data_cookie_helper_; | 286 mock_browsing_data_cookie_helper_; |
| 284 scoped_refptr<MockBrowsingDataDatabaseHelper> | 287 scoped_refptr<MockBrowsingDataDatabaseHelper> |
| 285 mock_browsing_data_database_helper_; | 288 mock_browsing_data_database_helper_; |
| 286 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 289 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| 287 mock_browsing_data_local_storage_helper_; | 290 mock_browsing_data_local_storage_helper_; |
| 288 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 291 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); | 1001 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); |
| 999 EXPECT_EQ("http://fshost3:3/", | 1002 EXPECT_EQ("http://fshost3:3/", |
| 1000 GetDisplayedFileSystems(cookies_model.get())); | 1003 GetDisplayedFileSystems(cookies_model.get())); |
| 1001 | 1004 |
| 1002 cookies_model->UpdateSearchResults(std::wstring()); | 1005 cookies_model->UpdateSearchResults(std::wstring()); |
| 1003 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1006 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1004 GetDisplayedFileSystems(cookies_model.get())); | 1007 GetDisplayedFileSystems(cookies_model.get())); |
| 1005 } | 1008 } |
| 1006 | 1009 |
| 1007 } // namespace | 1010 } // namespace |
| OLD | NEW |