| 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/strings/sys_string_conversions.h" | 5 #include "base/strings/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/canonical_cookie.h" |
| 10 #include "net/cookies/parsed_cookie.h" | 10 #include "net/cookies/parsed_cookie.h" |
| 11 #import "testing/gtest_mac.h" | 11 #import "testing/gtest_mac.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class CookiesDetailsTest : public CocoaTest { | 15 class CookiesDetailsTest : public CocoaTest { |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 TEST_F(CookiesDetailsTest, CreateForFolder) { | 18 TEST_F(CookiesDetailsTest, CreateForFolder) { |
| 19 scoped_nsobject<CocoaCookieDetails> details; | 19 base::scoped_nsobject<CocoaCookieDetails> details; |
| 20 details.reset([[CocoaCookieDetails alloc] initAsFolder]); | 20 details.reset([[CocoaCookieDetails alloc] initAsFolder]); |
| 21 | 21 |
| 22 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeFolder); | 22 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeFolder); |
| 23 } | 23 } |
| 24 | 24 |
| 25 TEST_F(CookiesDetailsTest, CreateForCookie) { | 25 TEST_F(CookiesDetailsTest, CreateForCookie) { |
| 26 scoped_nsobject<CocoaCookieDetails> details; | 26 base::scoped_nsobject<CocoaCookieDetails> details; |
| 27 GURL url("http://chromium.org"); | 27 GURL url("http://chromium.org"); |
| 28 std::string cookieLine( | 28 std::string cookieLine( |
| 29 "PHPSESSID=0123456789abcdef0123456789abcdef; path=/"); | 29 "PHPSESSID=0123456789abcdef0123456789abcdef; path=/"); |
| 30 net::ParsedCookie pc(cookieLine); | 30 net::ParsedCookie pc(cookieLine); |
| 31 net::CanonicalCookie cookie(url, pc); | 31 net::CanonicalCookie cookie(url, pc); |
| 32 details.reset([[CocoaCookieDetails alloc] initWithCookie:&cookie | 32 details.reset([[CocoaCookieDetails alloc] initWithCookie:&cookie |
| 33 canEditExpiration:NO]); | 33 canEditExpiration:NO]); |
| 34 | 34 |
| 35 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeCookie); | 35 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeCookie); |
| 36 EXPECT_NSEQ(@"PHPSESSID", [details.get() name]); | 36 EXPECT_NSEQ(@"PHPSESSID", [details.get() name]); |
| 37 EXPECT_NSEQ(@"0123456789abcdef0123456789abcdef", | 37 EXPECT_NSEQ(@"0123456789abcdef0123456789abcdef", |
| 38 [details.get() content]); | 38 [details.get() content]); |
| 39 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); | 39 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
| 40 EXPECT_NSEQ(@"/", [details.get() path]); | 40 EXPECT_NSEQ(@"/", [details.get() path]); |
| 41 EXPECT_NSNE(@"", [details.get() lastModified]); | 41 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 42 EXPECT_NSNE(@"", [details.get() created]); | 42 EXPECT_NSNE(@"", [details.get() created]); |
| 43 EXPECT_NSNE(@"", [details.get() sendFor]); | 43 EXPECT_NSNE(@"", [details.get() sendFor]); |
| 44 | 44 |
| 45 EXPECT_FALSE([details.get() shouldHideCookieDetailsView]); | 45 EXPECT_FALSE([details.get() shouldHideCookieDetailsView]); |
| 46 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 46 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 47 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 47 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 48 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 48 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 49 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 49 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 50 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 50 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 51 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 51 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 52 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 52 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TEST_F(CookiesDetailsTest, CreateForTreeDatabase) { | 55 TEST_F(CookiesDetailsTest, CreateForTreeDatabase) { |
| 56 scoped_nsobject<CocoaCookieDetails> details; | 56 base::scoped_nsobject<CocoaCookieDetails> details; |
| 57 GURL origin("http://chromium.org"); | 57 GURL origin("http://chromium.org"); |
| 58 std::string database_name("sassolungo"); | 58 std::string database_name("sassolungo"); |
| 59 std::string description("a great place to climb"); | 59 std::string description("a great place to climb"); |
| 60 int64 size = 1234; | 60 int64 size = 1234; |
| 61 base::Time last_modified = base::Time::Now(); | 61 base::Time last_modified = base::Time::Now(); |
| 62 BrowsingDataDatabaseHelper::DatabaseInfo info( | 62 BrowsingDataDatabaseHelper::DatabaseInfo info( |
| 63 webkit_database::DatabaseIdentifier::CreateFromOrigin(origin), | 63 webkit_database::DatabaseIdentifier::CreateFromOrigin(origin), |
| 64 database_name, description, size, last_modified); | 64 database_name, description, size, last_modified); |
| 65 details.reset([[CocoaCookieDetails alloc] initWithDatabase:&info]); | 65 details.reset([[CocoaCookieDetails alloc] initWithDatabase:&info]); |
| 66 | 66 |
| 67 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeDatabase); | 67 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeDatabase); |
| 68 EXPECT_NSEQ(@"a great place to climb", [details.get() databaseDescription]); | 68 EXPECT_NSEQ(@"a great place to climb", [details.get() databaseDescription]); |
| 69 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); | 69 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); |
| 70 EXPECT_NSNE(@"", [details.get() lastModified]); | 70 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 71 | 71 |
| 72 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 72 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 73 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 73 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 74 EXPECT_TRUE([details.get() shouldShowDatabaseTreeDetailsView]); | 74 EXPECT_TRUE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 75 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 75 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 76 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 76 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 77 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 77 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 78 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 78 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 79 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 79 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) { | 82 TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) { |
| 83 scoped_nsobject<CocoaCookieDetails> details; | 83 base::scoped_nsobject<CocoaCookieDetails> details; |
| 84 const GURL kOrigin("http://chromium.org/"); | 84 const GURL kOrigin("http://chromium.org/"); |
| 85 int64 size = 1234; | 85 int64 size = 1234; |
| 86 base::Time last_modified = base::Time::Now(); | 86 base::Time last_modified = base::Time::Now(); |
| 87 BrowsingDataLocalStorageHelper::LocalStorageInfo info( | 87 BrowsingDataLocalStorageHelper::LocalStorageInfo info( |
| 88 kOrigin, size, last_modified); | 88 kOrigin, size, last_modified); |
| 89 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:&info]); | 89 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:&info]); |
| 90 | 90 |
| 91 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeLocalStorage); | 91 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeLocalStorage); |
| 92 EXPECT_NSEQ(@"http://chromium.org/", [details.get() domain]); | 92 EXPECT_NSEQ(@"http://chromium.org/", [details.get() domain]); |
| 93 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); | 93 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); |
| 94 EXPECT_NSNE(@"", [details.get() lastModified]); | 94 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 95 | 95 |
| 96 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 96 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 97 EXPECT_TRUE([details.get() shouldShowLocalStorageTreeDetailsView]); | 97 EXPECT_TRUE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 98 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 98 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 99 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 99 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 100 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 100 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 101 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 101 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 102 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 102 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 103 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 103 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TEST_F(CookiesDetailsTest, CreateForTreeAppCache) { | 106 TEST_F(CookiesDetailsTest, CreateForTreeAppCache) { |
| 107 scoped_nsobject<CocoaCookieDetails> details; | 107 base::scoped_nsobject<CocoaCookieDetails> details; |
| 108 | 108 |
| 109 GURL url("http://chromium.org/stuff.manifest"); | 109 GURL url("http://chromium.org/stuff.manifest"); |
| 110 appcache::AppCacheInfo info; | 110 appcache::AppCacheInfo info; |
| 111 info.creation_time = base::Time::Now(); | 111 info.creation_time = base::Time::Now(); |
| 112 info.last_update_time = base::Time::Now(); | 112 info.last_update_time = base::Time::Now(); |
| 113 info.last_access_time = base::Time::Now(); | 113 info.last_access_time = base::Time::Now(); |
| 114 info.size=2678; | 114 info.size=2678; |
| 115 info.manifest_url = url; | 115 info.manifest_url = url; |
| 116 details.reset([[CocoaCookieDetails alloc] initWithAppCacheInfo:&info]); | 116 details.reset([[CocoaCookieDetails alloc] initWithAppCacheInfo:&info]); |
| 117 | 117 |
| 118 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeAppCache); | 118 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeAppCache); |
| 119 EXPECT_NSEQ(@"http://chromium.org/stuff.manifest", | 119 EXPECT_NSEQ(@"http://chromium.org/stuff.manifest", |
| 120 [details.get() manifestURL]); | 120 [details.get() manifestURL]); |
| 121 EXPECT_NSEQ(@"2,678 B", [details.get() fileSize]); | 121 EXPECT_NSEQ(@"2,678 B", [details.get() fileSize]); |
| 122 EXPECT_NSNE(@"", [details.get() lastAccessed]); | 122 EXPECT_NSNE(@"", [details.get() lastAccessed]); |
| 123 EXPECT_NSNE(@"", [details.get() created]); | 123 EXPECT_NSNE(@"", [details.get() created]); |
| 124 | 124 |
| 125 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 125 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 126 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 126 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 127 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 127 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 128 EXPECT_TRUE([details.get() shouldShowAppCacheTreeDetailsView]); | 128 EXPECT_TRUE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 129 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 129 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 130 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 130 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 131 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 131 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 132 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 132 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 133 } | 133 } |
| 134 | 134 |
| 135 TEST_F(CookiesDetailsTest, CreateForTreeIndexedDB) { | 135 TEST_F(CookiesDetailsTest, CreateForTreeIndexedDB) { |
| 136 scoped_nsobject<CocoaCookieDetails> details; | 136 base::scoped_nsobject<CocoaCookieDetails> details; |
| 137 | 137 |
| 138 GURL origin("http://moose.org/"); | 138 GURL origin("http://moose.org/"); |
| 139 int64 size = 1234; | 139 int64 size = 1234; |
| 140 base::Time last_modified = base::Time::Now(); | 140 base::Time last_modified = base::Time::Now(); |
| 141 base::FilePath file_path; | 141 base::FilePath file_path; |
| 142 content::IndexedDBInfo info(origin, | 142 content::IndexedDBInfo info(origin, |
| 143 size, | 143 size, |
| 144 last_modified, | 144 last_modified, |
| 145 file_path); | 145 file_path); |
| 146 | 146 |
| 147 details.reset([[CocoaCookieDetails alloc] initWithIndexedDBInfo:&info]); | 147 details.reset([[CocoaCookieDetails alloc] initWithIndexedDBInfo:&info]); |
| 148 | 148 |
| 149 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeIndexedDB); | 149 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeIndexedDB); |
| 150 EXPECT_NSEQ(@"http://moose.org/", [details.get() domain]); | 150 EXPECT_NSEQ(@"http://moose.org/", [details.get() domain]); |
| 151 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); | 151 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); |
| 152 EXPECT_NSNE(@"", [details.get() lastModified]); | 152 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 153 | 153 |
| 154 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 154 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 155 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 155 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 156 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 156 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 157 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 157 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 158 EXPECT_TRUE([details.get() shouldShowIndexedDBTreeDetailsView]); | 158 EXPECT_TRUE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 159 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 159 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 160 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 160 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 161 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 161 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 162 } | 162 } |
| 163 | 163 |
| 164 TEST_F(CookiesDetailsTest, CreateForPromptDatabase) { | 164 TEST_F(CookiesDetailsTest, CreateForPromptDatabase) { |
| 165 scoped_nsobject<CocoaCookieDetails> details; | 165 base::scoped_nsobject<CocoaCookieDetails> details; |
| 166 std::string domain("chromium.org"); | 166 std::string domain("chromium.org"); |
| 167 string16 name(base::SysNSStringToUTF16(@"wicked_name")); | 167 string16 name(base::SysNSStringToUTF16(@"wicked_name")); |
| 168 string16 desc(base::SysNSStringToUTF16(@"desc")); | 168 string16 desc(base::SysNSStringToUTF16(@"desc")); |
| 169 details.reset([[CocoaCookieDetails alloc] initWithDatabase:domain | 169 details.reset([[CocoaCookieDetails alloc] initWithDatabase:domain |
| 170 databaseName:name | 170 databaseName:name |
| 171 databaseDescription:desc | 171 databaseDescription:desc |
| 172 fileSize:94]); | 172 fileSize:94]); |
| 173 | 173 |
| 174 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptDatabase); | 174 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptDatabase); |
| 175 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); | 175 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
| 176 EXPECT_NSEQ(@"wicked_name", [details.get() name]); | 176 EXPECT_NSEQ(@"wicked_name", [details.get() name]); |
| 177 EXPECT_NSEQ(@"desc", [details.get() databaseDescription]); | 177 EXPECT_NSEQ(@"desc", [details.get() databaseDescription]); |
| 178 EXPECT_NSEQ(@"94 B", [details.get() fileSize]); | 178 EXPECT_NSEQ(@"94 B", [details.get() fileSize]); |
| 179 | 179 |
| 180 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 180 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 181 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 181 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 182 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 182 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 183 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 183 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 184 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 184 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 185 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 185 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 186 EXPECT_TRUE([details.get() shouldShowDatabasePromptDetailsView]); | 186 EXPECT_TRUE([details.get() shouldShowDatabasePromptDetailsView]); |
| 187 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 187 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST_F(CookiesDetailsTest, CreateForPromptLocalStorage) { | 190 TEST_F(CookiesDetailsTest, CreateForPromptLocalStorage) { |
| 191 scoped_nsobject<CocoaCookieDetails> details; | 191 base::scoped_nsobject<CocoaCookieDetails> details; |
| 192 std::string domain("chromium.org"); | 192 std::string domain("chromium.org"); |
| 193 string16 key(base::SysNSStringToUTF16(@"testKey")); | 193 string16 key(base::SysNSStringToUTF16(@"testKey")); |
| 194 string16 value(base::SysNSStringToUTF16(@"testValue")); | 194 string16 value(base::SysNSStringToUTF16(@"testValue")); |
| 195 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:domain | 195 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:domain |
| 196 key:key | 196 key:key |
| 197 value:value]); | 197 value:value]); |
| 198 | 198 |
| 199 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptLocalStorage); | 199 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptLocalStorage); |
| 200 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); | 200 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
| 201 EXPECT_NSEQ(@"testKey", [details.get() localStorageKey]); | 201 EXPECT_NSEQ(@"testKey", [details.get() localStorageKey]); |
| 202 EXPECT_NSEQ(@"testValue", [details.get() localStorageValue]); | 202 EXPECT_NSEQ(@"testValue", [details.get() localStorageValue]); |
| 203 | 203 |
| 204 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 204 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 205 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 205 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 206 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 206 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 207 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 207 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 208 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 208 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 209 EXPECT_TRUE([details.get() shouldShowLocalStoragePromptDetailsView]); | 209 EXPECT_TRUE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 210 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 210 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 211 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 211 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 212 } | 212 } |
| 213 | 213 |
| 214 TEST_F(CookiesDetailsTest, CreateForPromptAppCache) { | 214 TEST_F(CookiesDetailsTest, CreateForPromptAppCache) { |
| 215 scoped_nsobject<CocoaCookieDetails> details; | 215 base::scoped_nsobject<CocoaCookieDetails> details; |
| 216 std::string manifestURL("http://html5demos.com/html5demo.manifest"); | 216 std::string manifestURL("http://html5demos.com/html5demo.manifest"); |
| 217 details.reset([[CocoaCookieDetails alloc] | 217 details.reset([[CocoaCookieDetails alloc] |
| 218 initWithAppCacheManifestURL:manifestURL.c_str()]); | 218 initWithAppCacheManifestURL:manifestURL.c_str()]); |
| 219 | 219 |
| 220 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptAppCache); | 220 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptAppCache); |
| 221 EXPECT_NSEQ(@"http://html5demos.com/html5demo.manifest", | 221 EXPECT_NSEQ(@"http://html5demos.com/html5demo.manifest", |
| 222 [details.get() manifestURL]); | 222 [details.get() manifestURL]); |
| 223 | 223 |
| 224 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 224 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 225 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 225 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 226 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 226 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 227 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 227 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 228 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 228 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 229 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 229 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 230 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 230 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 231 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); | 231 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } | 234 } |
| OLD | NEW |