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

Side by Side Diff: chrome/browser/cocoa/cookies_window_controller_unittest.mm

Issue 650110: Teach the cookie tree view / model about appcaches. Not hooked up to real dat... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/browser/cocoa/cookies_window_controller.mm ('k') | chrome/browser/cookies_tree_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tree_model.h" 7 #include "app/tree_model.h"
8 #import "base/scoped_nsobject.h" 8 #import "base/scoped_nsobject.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/cocoa/browser_test_helper.h" 10 #include "chrome/browser/cocoa/browser_test_helper.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 [[cocoaParent mutableChildren] addObject:cocoaChild1.get()]; 128 [[cocoaParent mutableChildren] addObject:cocoaChild1.get()];
129 [[cocoaChild1 mutableChildren] addObject:cocoaChild2.get()]; 129 [[cocoaChild1 mutableChildren] addObject:cocoaChild2.get()];
130 130
131 EXPECT_EQ(cocoaChild2.get(), FindCocoaNode(child2.get(), cocoaParent.get())); 131 EXPECT_EQ(cocoaChild2.get(), FindCocoaNode(child2.get(), cocoaParent.get()));
132 } 132 }
133 133
134 TEST_F(CookiesWindowControllerTest, CocoaNodeFromTreeNodeCookie) { 134 TEST_F(CookiesWindowControllerTest, CocoaNodeFromTreeNodeCookie) {
135 net::CookieMonster* cm = browser_helper_.profile()->GetCookieMonster(); 135 net::CookieMonster* cm = browser_helper_.profile()->GetCookieMonster();
136 cm->SetCookie(GURL("http://foo.com"), "A=B"); 136 cm->SetCookie(GURL("http://foo.com"), "A=B");
137 CookiesTreeModel model(browser_helper_.profile(), database_helper_, 137 CookiesTreeModel model(browser_helper_.profile(), database_helper_,
138 local_storage_helper_); 138 local_storage_helper_, nil);
139 139
140 // Root --> foo.com --> Cookies --> A. Create node for 'A'. 140 // Root --> foo.com --> Cookies --> A. Create node for 'A'.
141 TreeModelNode* node = model.GetRoot()->GetChild(0)->GetChild(0)->GetChild(0); 141 TreeModelNode* node = model.GetRoot()->GetChild(0)->GetChild(0)->GetChild(0);
142 CocoaCookieTreeNode* cookie = CocoaNodeFromTreeNode(node); 142 CocoaCookieTreeNode* cookie = CocoaNodeFromTreeNode(node);
143 143
144 EXPECT_TRUE([@"B" isEqualToString:[cookie content]]); 144 EXPECT_TRUE([@"B" isEqualToString:[cookie content]]);
145 EXPECT_TRUE([@"When I close my browser" isEqualToString:[cookie expires]]); 145 EXPECT_TRUE([@"When I close my browser" isEqualToString:[cookie expires]]);
146 EXPECT_TRUE([@"Any kind of connection" isEqualToString:[cookie sendFor]]); 146 EXPECT_TRUE([@"Any kind of connection" isEqualToString:[cookie sendFor]]);
147 EXPECT_TRUE([@"A" isEqualToString:[cookie title]]); 147 EXPECT_TRUE([@"A" isEqualToString:[cookie title]]);
148 EXPECT_TRUE([@"A" isEqualToString:[cookie name]]); 148 EXPECT_TRUE([@"A" isEqualToString:[cookie name]]);
149 EXPECT_TRUE([@"/" isEqualToString:[cookie path]]); 149 EXPECT_TRUE([@"/" isEqualToString:[cookie path]]);
150 EXPECT_EQ(0U, [[cookie children] count]); 150 EXPECT_EQ(0U, [[cookie children] count]);
151 EXPECT_TRUE([cookie created]); 151 EXPECT_TRUE([cookie created]);
152 EXPECT_TRUE([cookie isLeaf]); 152 EXPECT_TRUE([cookie isLeaf]);
153 EXPECT_EQ(node, [cookie treeNode]); 153 EXPECT_EQ(node, [cookie treeNode]);
154 } 154 }
155 155
156 TEST_F(CookiesWindowControllerTest, CocoaNodeFromTreeNodeRecursive) { 156 TEST_F(CookiesWindowControllerTest, CocoaNodeFromTreeNodeRecursive) {
157 net::CookieMonster* cm = browser_helper_.profile()->GetCookieMonster(); 157 net::CookieMonster* cm = browser_helper_.profile()->GetCookieMonster();
158 cm->SetCookie(GURL("http://foo.com"), "A=B"); 158 cm->SetCookie(GURL("http://foo.com"), "A=B");
159 CookiesTreeModel model(browser_helper_.profile(), database_helper_, 159 CookiesTreeModel model(browser_helper_.profile(), database_helper_,
160 local_storage_helper_); 160 local_storage_helper_, nil);
161 161
162 // Root --> foo.com --> Cookies --> A. Create node for 'foo.com'. 162 // Root --> foo.com --> Cookies --> A. Create node for 'foo.com'.
163 CookieTreeNode* node = model.GetRoot()->GetChild(0); 163 CookieTreeNode* node = model.GetRoot()->GetChild(0);
164 CocoaCookieTreeNode* domain = CocoaNodeFromTreeNode(node); 164 CocoaCookieTreeNode* domain = CocoaNodeFromTreeNode(node);
165 CocoaCookieTreeNode* cookies = [[domain children] objectAtIndex:0]; 165 CocoaCookieTreeNode* cookies = [[domain children] objectAtIndex:0];
166 CocoaCookieTreeNode* cookie = [[cookies children] objectAtIndex:0]; 166 CocoaCookieTreeNode* cookie = [[cookies children] objectAtIndex:0];
167 167
168 // Test domain-level node. 168 // Test domain-level node.
169 EXPECT_TRUE([@"foo.com" isEqualToString:[domain title]]); 169 EXPECT_TRUE([@"foo.com" isEqualToString:[domain title]]);
170 170
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // Local Storage --> origin2. 689 // Local Storage --> origin2.
690 node = [[node children] lastObject]; 690 node = [[node children] lastObject];
691 EXPECT_TRUE([@"origin2" isEqualToString:[node title]]); 691 EXPECT_TRUE([@"origin2" isEqualToString:[node title]]);
692 EXPECT_EQ(kCocoaCookieTreeNodeTypeLocalStorage, [node nodeType]); 692 EXPECT_EQ(kCocoaCookieTreeNodeTypeLocalStorage, [node nodeType]);
693 EXPECT_TRUE([@"origin2" isEqualToString:[node domain]]); 693 EXPECT_TRUE([@"origin2" isEqualToString:[node domain]]);
694 EXPECT_TRUE([node lastModified]); 694 EXPECT_TRUE([node lastModified]);
695 EXPECT_TRUE([node fileSize]); 695 EXPECT_TRUE([node fileSize]);
696 } 696 }
697 697
698 } // namespace 698 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/cookies_window_controller.mm ('k') | chrome/browser/cookies_tree_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698