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

Side by Side Diff: chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller_unittest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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 "base/strings/sys_string_conversions.h" 5 #include "base/strings/sys_string_conversions.h"
6 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 6 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
7 #include "chrome/browser/ui/cocoa/content_settings/cookie_details.h" 7 #include "chrome/browser/ui/cocoa/content_settings/cookie_details.h"
8 #include "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controlle r.h" 8 #include "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controlle r.h"
9 #include "net/cookies/canonical_cookie.h" 9 #include "net/cookies/canonical_cookie.h"
10 #include "net/cookies/parsed_cookie.h" 10 #include "net/cookies/parsed_cookie.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return [details autorelease]; 45 return [details autorelease];
46 } 46 }
47 47
48 static CookiePromptContentDetailsAdapter* CreateDatabaseTestContent() { 48 static CookiePromptContentDetailsAdapter* CreateDatabaseTestContent() {
49 CocoaCookieDetails* details = CreateTestDatabaseDetails(); 49 CocoaCookieDetails* details = CreateTestDatabaseDetails();
50 return [[[CookiePromptContentDetailsAdapter alloc] initWithDetails:details] 50 return [[[CookiePromptContentDetailsAdapter alloc] initWithDetails:details]
51 autorelease]; 51 autorelease];
52 } 52 }
53 53
54 TEST_F(CookieDetailsViewControllerTest, Create) { 54 TEST_F(CookieDetailsViewControllerTest, Create) {
55 scoped_nsobject<CookieDetailsViewController> detailsViewController( 55 base::scoped_nsobject<CookieDetailsViewController> detailsViewController(
56 [[CookieDetailsViewController alloc] init]); 56 [[CookieDetailsViewController alloc] init]);
57 } 57 }
58 58
59 TEST_F(CookieDetailsViewControllerTest, ShrinkToFit) { 59 TEST_F(CookieDetailsViewControllerTest, ShrinkToFit) {
60 scoped_nsobject<CookieDetailsViewController> detailsViewController( 60 base::scoped_nsobject<CookieDetailsViewController> detailsViewController(
61 [[CookieDetailsViewController alloc] init]); 61 [[CookieDetailsViewController alloc] init]);
62 scoped_nsobject<CookiePromptContentDetailsAdapter> adapter( 62 base::scoped_nsobject<CookiePromptContentDetailsAdapter> adapter(
63 [CreateDatabaseTestContent() retain]); 63 [CreateDatabaseTestContent() retain]);
64 [detailsViewController.get() setContentObject:adapter.get()]; 64 [detailsViewController.get() setContentObject:adapter.get()];
65 NSRect beforeFrame = [[detailsViewController.get() view] frame]; 65 NSRect beforeFrame = [[detailsViewController.get() view] frame];
66 [detailsViewController.get() shrinkViewToFit]; 66 [detailsViewController.get() shrinkViewToFit];
67 NSRect afterFrame = [[detailsViewController.get() view] frame]; 67 NSRect afterFrame = [[detailsViewController.get() view] frame];
68 68
69 EXPECT_TRUE(afterFrame.size.height < beforeFrame.size.width); 69 EXPECT_TRUE(afterFrame.size.height < beforeFrame.size.width);
70 } 70 }
71 71
72 TEST_F(CookieDetailsViewControllerTest, ExpirationEditability) { 72 TEST_F(CookieDetailsViewControllerTest, ExpirationEditability) {
73 scoped_nsobject<CookieDetailsViewController> detailsViewController( 73 base::scoped_nsobject<CookieDetailsViewController> detailsViewController(
74 [[CookieDetailsViewController alloc] init]); 74 [[CookieDetailsViewController alloc] init]);
75 [detailsViewController view]; 75 [detailsViewController view];
76 scoped_nsobject<CookiePromptContentDetailsAdapter> adapter( 76 base::scoped_nsobject<CookiePromptContentDetailsAdapter> adapter(
77 [CreateCookieTestContent(YES) retain]); 77 [CreateCookieTestContent(YES) retain]);
78 [detailsViewController.get() setContentObject:adapter.get()]; 78 [detailsViewController.get() setContentObject:adapter.get()];
79 79
80 EXPECT_FALSE([detailsViewController.get() hasExpiration]); 80 EXPECT_FALSE([detailsViewController.get() hasExpiration]);
81 [detailsViewController.get() setCookieHasExplicitExpiration:adapter.get()]; 81 [detailsViewController.get() setCookieHasExplicitExpiration:adapter.get()];
82 EXPECT_TRUE([detailsViewController.get() hasExpiration]); 82 EXPECT_TRUE([detailsViewController.get() hasExpiration]);
83 [detailsViewController.get() 83 [detailsViewController.get()
84 setCookieDoesntHaveExplicitExpiration:adapter.get()]; 84 setCookieDoesntHaveExplicitExpiration:adapter.get()];
85 EXPECT_FALSE([detailsViewController.get() hasExpiration]); 85 EXPECT_FALSE([detailsViewController.get() hasExpiration]);
86 } 86 }
87 87
88 } // namespace 88 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698