Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/cookies_tree_model_unittest.cc

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix memory leaks in tests Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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() {
44 // Avoid memory leaks.
45 profile_.reset();
46 message_loop_.RunAllPending();
42 } 47 }
43 48
44 virtual void SetUp() OVERRIDE { 49 virtual void SetUp() OVERRIDE {
45 profile_.reset(new TestingProfile()); 50 profile_.reset(new TestingProfile());
46 profile_->CreateRequestContext(); 51 profile_->CreateRequestContext();
47 mock_browsing_data_cookie_helper_ = 52 mock_browsing_data_cookie_helper_ =
48 new MockBrowsingDataCookieHelper(profile_.get()); 53 new MockBrowsingDataCookieHelper(profile_.get());
49 mock_browsing_data_database_helper_ = 54 mock_browsing_data_database_helper_ =
50 new MockBrowsingDataDatabaseHelper(profile_.get()); 55 new MockBrowsingDataDatabaseHelper(profile_.get());
51 mock_browsing_data_local_storage_helper_ = 56 mock_browsing_data_local_storage_helper_ =
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void DeleteStoredObjects(CookieTreeNode* node) { 274 void DeleteStoredObjects(CookieTreeNode* node) {
270 node->DeleteStoredObjects(); 275 node->DeleteStoredObjects();
271 CookieTreeNode* parent_node = node->parent(); 276 CookieTreeNode* parent_node = node->parent();
272 DCHECK(parent_node); 277 DCHECK(parent_node);
273 delete parent_node->GetModel()->Remove(parent_node, node); 278 delete parent_node->GetModel()->Remove(parent_node, node);
274 } 279 }
275 280
276 protected: 281 protected:
277 MessageLoop message_loop_; 282 MessageLoop message_loop_;
278 content::TestBrowserThread ui_thread_; 283 content::TestBrowserThread ui_thread_;
284 content::TestBrowserThread file_user_blocking_;
279 content::TestBrowserThread io_thread_; 285 content::TestBrowserThread io_thread_;
280 286
281 scoped_ptr<TestingProfile> profile_; 287 scoped_ptr<TestingProfile> profile_;
282 scoped_refptr<MockBrowsingDataCookieHelper> 288 scoped_refptr<MockBrowsingDataCookieHelper>
283 mock_browsing_data_cookie_helper_; 289 mock_browsing_data_cookie_helper_;
284 scoped_refptr<MockBrowsingDataDatabaseHelper> 290 scoped_refptr<MockBrowsingDataDatabaseHelper>
285 mock_browsing_data_database_helper_; 291 mock_browsing_data_database_helper_;
286 scoped_refptr<MockBrowsingDataLocalStorageHelper> 292 scoped_refptr<MockBrowsingDataLocalStorageHelper>
287 mock_browsing_data_local_storage_helper_; 293 mock_browsing_data_local_storage_helper_;
288 scoped_refptr<MockBrowsingDataLocalStorageHelper> 294 scoped_refptr<MockBrowsingDataLocalStorageHelper>
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); 1004 cookies_model->UpdateSearchResults(std::wstring(L"fshost3"));
999 EXPECT_EQ("http://fshost3:3/", 1005 EXPECT_EQ("http://fshost3:3/",
1000 GetDisplayedFileSystems(cookies_model.get())); 1006 GetDisplayedFileSystems(cookies_model.get()));
1001 1007
1002 cookies_model->UpdateSearchResults(std::wstring()); 1008 cookies_model->UpdateSearchResults(std::wstring());
1003 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1009 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
1004 GetDisplayedFileSystems(cookies_model.get())); 1010 GetDisplayedFileSystems(cookies_model.get()));
1005 } 1011 }
1006 1012
1007 } // namespace 1013 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/offline/offline_load_page_unittest.cc ('k') | chrome/browser/diagnostics/sqlite_diagnostics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698