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" |
| 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/cocoa/browser_test_helper.h" | 12 #include "chrome/browser/cocoa/browser_test_helper.h" |
12 #include "chrome/browser/browsing_data_remover.h" | 13 #include "chrome/browser/browsing_data_remover.h" |
13 #include "chrome/browser/cocoa/clear_browsing_data_controller.h" | 14 #include "chrome/browser/cocoa/clear_browsing_data_controller.h" |
14 #import "chrome/browser/cocoa/cookies_window_controller.h" | 15 #import "chrome/browser/cocoa/cookies_window_controller.h" |
15 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 16 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
16 #include "chrome/browser/mock_browsing_data_database_helper.h" | 17 #include "chrome/browser/mock_browsing_data_database_helper.h" |
17 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" | 18 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" |
18 #include "chrome/browser/mock_browsing_data_appcache_helper.h" | 19 #include "chrome/browser/mock_browsing_data_appcache_helper.h" |
19 #include "chrome/browser/cookies_tree_model.h" | 20 #include "chrome/browser/cookies_tree_model.h" |
20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 CocoaCookieTreeNode* cocoa_node = | 296 CocoaCookieTreeNode* cocoa_node = |
296 [[[[[controller_ cocoaTreeModel] children] objectAtIndex:0] | 297 [[[[[controller_ cocoaTreeModel] children] objectAtIndex:0] |
297 children] objectAtIndex:0]; | 298 children] objectAtIndex:0]; |
298 | 299 |
299 EXPECT_NSEQ(l10n_util::GetNSString(IDS_COOKIES_COOKIES), | 300 EXPECT_NSEQ(l10n_util::GetNSString(IDS_COOKIES_COOKIES), |
300 [cocoa_node title]); | 301 [cocoa_node title]); |
301 | 302 |
302 // Fake update the cookie folder's title. This would never happen in reality, | 303 // Fake update the cookie folder's title. This would never happen in reality, |
303 // but it tests the code path that ultimately calls CocoaNodeFromTreeNode, | 304 // but it tests the code path that ultimately calls CocoaNodeFromTreeNode, |
304 // which is tested elsewhere. | 305 // which is tested elsewhere. |
305 node->SetTitle(L"Silly Change"); | 306 node->SetTitle(ASCIIToUTF16("Silly Change")); |
306 [controller_ modelObserver]->TreeNodeChanged(model, node); | 307 [controller_ modelObserver]->TreeNodeChanged(model, node); |
307 | 308 |
308 EXPECT_NSEQ(@"Silly Change", [cocoa_node title]); | 309 EXPECT_NSEQ(@"Silly Change", [cocoa_node title]); |
309 } | 310 } |
310 | 311 |
311 TEST_F(CookiesWindowControllerTest, DeleteCookie) { | 312 TEST_F(CookiesWindowControllerTest, DeleteCookie) { |
312 const GURL url = GURL("http://foo.com"); | 313 const GURL url = GURL("http://foo.com"); |
313 TestingProfile* profile = browser_helper_.profile(); | 314 TestingProfile* profile = browser_helper_.profile(); |
314 net::CookieMonster* cm = profile->GetCookieMonster(); | 315 net::CookieMonster* cm = profile->GetCookieMonster(); |
315 cm->SetCookie(url, "A=B"); | 316 cm->SetCookie(url, "A=B"); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // Local Storage --> http://host2:2/. | 678 // Local Storage --> http://host2:2/. |
678 node = [[node children] lastObject]; | 679 node = [[node children] lastObject]; |
679 EXPECT_NSEQ(@"http://host2:2/", [node title]); | 680 EXPECT_NSEQ(@"http://host2:2/", [node title]); |
680 EXPECT_EQ(kCocoaCookieDetailsTypeTreeLocalStorage, [node nodeType]); | 681 EXPECT_EQ(kCocoaCookieDetailsTypeTreeLocalStorage, [node nodeType]); |
681 EXPECT_NSEQ(@"http://host2:2/", [[node details] domain]); | 682 EXPECT_NSEQ(@"http://host2:2/", [[node details] domain]); |
682 EXPECT_TRUE([[node details] lastModified]); | 683 EXPECT_TRUE([[node details] lastModified]); |
683 EXPECT_TRUE([[node details] fileSize]); | 684 EXPECT_TRUE([[node details] fileSize]); |
684 } | 685 } |
685 | 686 |
686 } // namespace | 687 } // namespace |
OLD | NEW |