OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "app/tree_model.h" | 8 #include "app/tree_model.h" |
9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 - (TreeModelNode*)treeNode { | 45 - (TreeModelNode*)treeNode { |
46 return testNode_; | 46 return testNode_; |
47 } | 47 } |
48 @end | 48 @end |
49 | 49 |
50 namespace { | 50 namespace { |
51 | 51 |
52 class CookiesWindowControllerTest : public CocoaTest { | 52 class CookiesWindowControllerTest : public CocoaTest { |
53 public: | 53 public: |
54 CookiesWindowControllerTest() | |
55 : io_thread_(ChromeThread::IO, MessageLoop::current()) {} | |
56 | 54 |
57 virtual void SetUp() { | 55 virtual void SetUp() { |
58 CocoaTest::SetUp(); | 56 CocoaTest::SetUp(); |
59 TestingProfile* profile = browser_helper_.profile(); | 57 TestingProfile* profile = browser_helper_.profile(); |
60 profile->CreateRequestContext(); | 58 profile->CreateRequestContext(); |
61 database_helper_ = new MockBrowsingDataDatabaseHelper(profile); | 59 database_helper_ = new MockBrowsingDataDatabaseHelper(profile); |
62 local_storage_helper_ = new MockBrowsingDataLocalStorageHelper(profile); | 60 local_storage_helper_ = new MockBrowsingDataLocalStorageHelper(profile); |
63 appcache_helper_ = new MockBrowsingDataAppCacheHelper(profile); | 61 appcache_helper_ = new MockBrowsingDataAppCacheHelper(profile); |
64 controller_.reset( | 62 controller_.reset( |
65 [[CookiesWindowController alloc] initWithProfile:profile | 63 [[CookiesWindowController alloc] initWithProfile:profile |
(...skipping 11 matching lines...) Expand all Loading... |
77 return [controller_ modelObserver]->CocoaNodeFromTreeNode(node); | 75 return [controller_ modelObserver]->CocoaNodeFromTreeNode(node); |
78 } | 76 } |
79 | 77 |
80 CocoaCookieTreeNode* FindCocoaNode(TreeModelNode* node, | 78 CocoaCookieTreeNode* FindCocoaNode(TreeModelNode* node, |
81 CocoaCookieTreeNode* start) { | 79 CocoaCookieTreeNode* start) { |
82 return [controller_ modelObserver]->FindCocoaNode(node, start); | 80 return [controller_ modelObserver]->FindCocoaNode(node, start); |
83 } | 81 } |
84 | 82 |
85 protected: | 83 protected: |
86 BrowserTestHelper browser_helper_; | 84 BrowserTestHelper browser_helper_; |
87 // Need an IO thread to not leak from TestingProfile::CreateRequestContext(). | |
88 ChromeThread io_thread_; | |
89 scoped_nsobject<CookiesWindowController> controller_; | 85 scoped_nsobject<CookiesWindowController> controller_; |
90 MockBrowsingDataDatabaseHelper* database_helper_; | 86 MockBrowsingDataDatabaseHelper* database_helper_; |
91 MockBrowsingDataLocalStorageHelper* local_storage_helper_; | 87 MockBrowsingDataLocalStorageHelper* local_storage_helper_; |
92 MockBrowsingDataAppCacheHelper* appcache_helper_; | 88 MockBrowsingDataAppCacheHelper* appcache_helper_; |
93 }; | 89 }; |
94 | 90 |
95 TEST_F(CookiesWindowControllerTest, Construction) { | 91 TEST_F(CookiesWindowControllerTest, Construction) { |
96 std::vector<SkBitmap> skia_icons; | 92 std::vector<SkBitmap> skia_icons; |
97 [controller_ treeModel]->GetIcons(&skia_icons); | 93 [controller_ treeModel]->GetIcons(&skia_icons); |
98 | 94 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Local Storage --> origin2. | 731 // Local Storage --> origin2. |
736 node = [[node children] lastObject]; | 732 node = [[node children] lastObject]; |
737 EXPECT_TRUE([@"origin2" isEqualToString:[node title]]); | 733 EXPECT_TRUE([@"origin2" isEqualToString:[node title]]); |
738 EXPECT_EQ(kCocoaCookieDetailsTypeTreeLocalStorage, [node nodeType]); | 734 EXPECT_EQ(kCocoaCookieDetailsTypeTreeLocalStorage, [node nodeType]); |
739 EXPECT_TRUE([@"origin2" isEqualToString:[[node details] domain]]); | 735 EXPECT_TRUE([@"origin2" isEqualToString:[[node details] domain]]); |
740 EXPECT_TRUE([[node details] lastModified]); | 736 EXPECT_TRUE([[node details] lastModified]); |
741 EXPECT_TRUE([[node details] fileSize]); | 737 EXPECT_TRUE([[node details] fileSize]); |
742 } | 738 } |
743 | 739 |
744 } // namespace | 740 } // namespace |
OLD | NEW |