OLD | NEW |
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/sys_string_conversions.h" | 5 #include "base/sys_string_conversions.h" |
6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 6 #import "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 "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "net/cookies/parsed_cookie.h" | 9 #include "net/cookies/parsed_cookie.h" |
10 #import "testing/gtest_mac.h" | 10 #import "testing/gtest_mac.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeFolder); | 21 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeFolder); |
22 } | 22 } |
23 | 23 |
24 TEST_F(CookiesDetailsTest, CreateForCookie) { | 24 TEST_F(CookiesDetailsTest, CreateForCookie) { |
25 scoped_nsobject<CocoaCookieDetails> details; | 25 scoped_nsobject<CocoaCookieDetails> details; |
26 GURL url("http://chromium.org"); | 26 GURL url("http://chromium.org"); |
27 std::string cookieLine( | 27 std::string cookieLine( |
28 "PHPSESSID=0123456789abcdef0123456789abcdef; path=/"); | 28 "PHPSESSID=0123456789abcdef0123456789abcdef; path=/"); |
29 net::ParsedCookie pc(cookieLine); | 29 net::ParsedCookie pc(cookieLine); |
30 net::CookieMonster::CanonicalCookie cookie(url, pc); | 30 net::CookieMonster::CanonicalCookie cookie(url, pc); |
31 NSString* origin = base::SysUTF8ToNSString("http://chromium.org"); | |
32 details.reset([[CocoaCookieDetails alloc] initWithCookie:&cookie | 31 details.reset([[CocoaCookieDetails alloc] initWithCookie:&cookie |
33 origin:origin | |
34 canEditExpiration:NO]); | 32 canEditExpiration:NO]); |
35 | 33 |
36 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeCookie); | 34 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeCookie); |
37 EXPECT_NSEQ(@"PHPSESSID", [details.get() name]); | 35 EXPECT_NSEQ(@"PHPSESSID", [details.get() name]); |
38 EXPECT_NSEQ(@"0123456789abcdef0123456789abcdef", | 36 EXPECT_NSEQ(@"0123456789abcdef0123456789abcdef", |
39 [details.get() content]); | 37 [details.get() content]); |
40 EXPECT_NSEQ(@"http://chromium.org", [details.get() domain]); | 38 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
41 EXPECT_NSEQ(@"/", [details.get() path]); | 39 EXPECT_NSEQ(@"/", [details.get() path]); |
42 EXPECT_NSNE(@"", [details.get() lastModified]); | 40 EXPECT_NSNE(@"", [details.get() lastModified]); |
43 EXPECT_NSNE(@"", [details.get() created]); | 41 EXPECT_NSNE(@"", [details.get() created]); |
44 EXPECT_NSNE(@"", [details.get() sendFor]); | 42 EXPECT_NSNE(@"", [details.get() sendFor]); |
45 | 43 |
46 EXPECT_FALSE([details.get() shouldHideCookieDetailsView]); | 44 EXPECT_FALSE([details.get() shouldHideCookieDetailsView]); |
47 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 45 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
48 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 46 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
49 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 47 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
50 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 48 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 222 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
225 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 223 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
226 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 224 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
227 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 225 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
228 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 226 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
229 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 227 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
230 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); | 228 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); |
231 } | 229 } |
232 | 230 |
233 } | 231 } |
OLD | NEW |