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