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