| 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 "net/cookies/canonical_cookie.h" | 8 #include "net/cookies/canonical_cookie.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 53 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 54 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 54 } | 55 } |
| 55 | 56 |
| 56 TEST_F(CookiesDetailsTest, CreateForTreeDatabase) { | 57 TEST_F(CookiesDetailsTest, CreateForTreeDatabase) { |
| 57 base::scoped_nsobject<CocoaCookieDetails> details; | 58 base::scoped_nsobject<CocoaCookieDetails> details; |
| 58 GURL origin("http://chromium.org"); | 59 GURL origin("http://chromium.org"); |
| 59 std::string database_name("sassolungo"); | 60 std::string database_name("sassolungo"); |
| 60 std::string description("a great place to climb"); | 61 std::string description("a great place to climb"); |
| 61 int64 size = 1234; | 62 int64 size = 1234; |
| 62 base::Time last_modified = base::Time::Now(); | 63 base::Time last_modified = base::Time::Now(); |
| 63 BrowsingDataDatabaseHelper::DatabaseInfo info( | 64 BrowsingDataDatabaseHelper::DatabaseInfo info( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 75 | 76 |
| 76 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 77 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 77 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 78 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 78 EXPECT_TRUE([details.get() shouldShowDatabaseTreeDetailsView]); | 79 EXPECT_TRUE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 79 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 80 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 80 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 81 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 81 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 82 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 82 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 83 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 83 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 84 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 84 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 85 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 86 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 85 } | 87 } |
| 86 | 88 |
| 87 TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) { | 89 TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) { |
| 88 base::scoped_nsobject<CocoaCookieDetails> details; | 90 base::scoped_nsobject<CocoaCookieDetails> details; |
| 89 const GURL kOrigin("http://chromium.org/"); | 91 const GURL kOrigin("http://chromium.org/"); |
| 90 int64 size = 1234; | 92 int64 size = 1234; |
| 91 base::Time last_modified = base::Time::Now(); | 93 base::Time last_modified = base::Time::Now(); |
| 92 BrowsingDataLocalStorageHelper::LocalStorageInfo info( | 94 BrowsingDataLocalStorageHelper::LocalStorageInfo info( |
| 93 kOrigin, size, last_modified); | 95 kOrigin, size, last_modified); |
| 94 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:&info]); | 96 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:&info]); |
| 95 | 97 |
| 96 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeLocalStorage); | 98 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeLocalStorage); |
| 97 EXPECT_NSEQ(@"http://chromium.org/", [details.get() domain]); | 99 EXPECT_NSEQ(@"http://chromium.org/", [details.get() domain]); |
| 98 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); | 100 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); |
| 99 EXPECT_NSNE(@"", [details.get() lastModified]); | 101 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 100 | 102 |
| 101 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 103 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 102 EXPECT_TRUE([details.get() shouldShowLocalStorageTreeDetailsView]); | 104 EXPECT_TRUE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 103 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 105 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 104 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 106 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 105 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 107 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 106 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 108 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 107 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 109 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 108 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 110 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 109 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 111 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 112 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 110 } | 113 } |
| 111 | 114 |
| 112 TEST_F(CookiesDetailsTest, CreateForTreeAppCache) { | 115 TEST_F(CookiesDetailsTest, CreateForTreeAppCache) { |
| 113 base::scoped_nsobject<CocoaCookieDetails> details; | 116 base::scoped_nsobject<CocoaCookieDetails> details; |
| 114 | 117 |
| 115 GURL url("http://chromium.org/stuff.manifest"); | 118 GURL url("http://chromium.org/stuff.manifest"); |
| 116 content::AppCacheInfo info; | 119 content::AppCacheInfo info; |
| 117 info.creation_time = base::Time::Now(); | 120 info.creation_time = base::Time::Now(); |
| 118 info.last_update_time = base::Time::Now(); | 121 info.last_update_time = base::Time::Now(); |
| 119 info.last_access_time = base::Time::Now(); | 122 info.last_access_time = base::Time::Now(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 130 | 133 |
| 131 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 134 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 132 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 135 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 133 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 136 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 134 EXPECT_TRUE([details.get() shouldShowAppCacheTreeDetailsView]); | 137 EXPECT_TRUE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 135 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 138 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 136 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 139 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 137 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 140 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 138 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 141 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 139 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 142 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 143 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 140 } | 144 } |
| 141 | 145 |
| 142 TEST_F(CookiesDetailsTest, CreateForTreeIndexedDB) { | 146 TEST_F(CookiesDetailsTest, CreateForTreeIndexedDB) { |
| 143 base::scoped_nsobject<CocoaCookieDetails> details; | 147 base::scoped_nsobject<CocoaCookieDetails> details; |
| 144 | 148 |
| 145 GURL origin("http://moose.org/"); | 149 GURL origin("http://moose.org/"); |
| 146 int64 size = 1234; | 150 int64 size = 1234; |
| 147 base::Time last_modified = base::Time::Now(); | 151 base::Time last_modified = base::Time::Now(); |
| 148 content::IndexedDBInfo info(origin, | 152 content::IndexedDBInfo info(origin, |
| 149 size, | 153 size, |
| 150 last_modified, | 154 last_modified, |
| 151 0); | 155 0); |
| 152 | 156 |
| 153 details.reset([[CocoaCookieDetails alloc] initWithIndexedDBInfo:&info]); | 157 details.reset([[CocoaCookieDetails alloc] initWithIndexedDBInfo:&info]); |
| 154 | 158 |
| 155 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeIndexedDB); | 159 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeIndexedDB); |
| 156 EXPECT_NSEQ(@"http://moose.org/", [details.get() domain]); | 160 EXPECT_NSEQ(@"http://moose.org/", [details.get() domain]); |
| 157 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); | 161 EXPECT_NSEQ(@"1,234 B", [details.get() fileSize]); |
| 158 EXPECT_NSNE(@"", [details.get() lastModified]); | 162 EXPECT_NSNE(@"", [details.get() lastModified]); |
| 159 | 163 |
| 160 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 164 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 161 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 165 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 162 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 166 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 163 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 167 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 164 EXPECT_TRUE([details.get() shouldShowIndexedDBTreeDetailsView]); | 168 EXPECT_TRUE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 165 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 169 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 166 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 170 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 167 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 171 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 168 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 172 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 173 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 169 } | 174 } |
| 170 | 175 |
| 171 TEST_F(CookiesDetailsTest, CreateForPromptDatabase) { | 176 TEST_F(CookiesDetailsTest, CreateForPromptDatabase) { |
| 172 base::scoped_nsobject<CocoaCookieDetails> details; | 177 base::scoped_nsobject<CocoaCookieDetails> details; |
| 173 std::string domain("chromium.org"); | 178 std::string domain("chromium.org"); |
| 174 base::string16 name(base::SysNSStringToUTF16(@"wicked_name")); | 179 base::string16 name(base::SysNSStringToUTF16(@"wicked_name")); |
| 175 base::string16 desc(base::SysNSStringToUTF16(@"desc")); | 180 base::string16 desc(base::SysNSStringToUTF16(@"desc")); |
| 176 details.reset([[CocoaCookieDetails alloc] initWithDatabase:domain | 181 details.reset([[CocoaCookieDetails alloc] initWithDatabase:domain |
| 177 databaseName:name | 182 databaseName:name |
| 178 databaseDescription:desc | 183 databaseDescription:desc |
| 179 fileSize:94]); | 184 fileSize:94]); |
| 180 | 185 |
| 181 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptDatabase); | 186 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptDatabase); |
| 182 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); | 187 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
| 183 EXPECT_NSEQ(@"wicked_name", [details.get() name]); | 188 EXPECT_NSEQ(@"wicked_name", [details.get() name]); |
| 184 EXPECT_NSEQ(@"desc", [details.get() databaseDescription]); | 189 EXPECT_NSEQ(@"desc", [details.get() databaseDescription]); |
| 185 EXPECT_NSEQ(@"94 B", [details.get() fileSize]); | 190 EXPECT_NSEQ(@"94 B", [details.get() fileSize]); |
| 186 | 191 |
| 187 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 192 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 188 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 193 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 189 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 194 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 190 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 195 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 191 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 196 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 192 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 197 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 193 EXPECT_TRUE([details.get() shouldShowDatabasePromptDetailsView]); | 198 EXPECT_TRUE([details.get() shouldShowDatabasePromptDetailsView]); |
| 194 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 199 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 195 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 200 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 201 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 196 } | 202 } |
| 197 | 203 |
| 198 TEST_F(CookiesDetailsTest, CreateForPromptLocalStorage) { | 204 TEST_F(CookiesDetailsTest, CreateForPromptLocalStorage) { |
| 199 base::scoped_nsobject<CocoaCookieDetails> details; | 205 base::scoped_nsobject<CocoaCookieDetails> details; |
| 200 std::string domain("chromium.org"); | 206 std::string domain("chromium.org"); |
| 201 base::string16 key(base::SysNSStringToUTF16(@"testKey")); | 207 base::string16 key(base::SysNSStringToUTF16(@"testKey")); |
| 202 base::string16 value(base::SysNSStringToUTF16(@"testValue")); | 208 base::string16 value(base::SysNSStringToUTF16(@"testValue")); |
| 203 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:domain | 209 details.reset([[CocoaCookieDetails alloc] initWithLocalStorage:domain |
| 204 key:key | 210 key:key |
| 205 value:value]); | 211 value:value]); |
| 206 | 212 |
| 207 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptLocalStorage); | 213 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptLocalStorage); |
| 208 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); | 214 EXPECT_NSEQ(@"chromium.org", [details.get() domain]); |
| 209 EXPECT_NSEQ(@"testKey", [details.get() localStorageKey]); | 215 EXPECT_NSEQ(@"testKey", [details.get() localStorageKey]); |
| 210 EXPECT_NSEQ(@"testValue", [details.get() localStorageValue]); | 216 EXPECT_NSEQ(@"testValue", [details.get() localStorageValue]); |
| 211 | 217 |
| 212 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 218 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 213 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 219 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 214 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 220 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 215 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 221 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 216 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 222 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 217 EXPECT_TRUE([details.get() shouldShowLocalStoragePromptDetailsView]); | 223 EXPECT_TRUE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 218 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 224 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 219 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 225 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 220 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 226 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 227 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 221 } | 228 } |
| 222 | 229 |
| 223 TEST_F(CookiesDetailsTest, CreateForPromptAppCache) { | 230 TEST_F(CookiesDetailsTest, CreateForPromptAppCache) { |
| 224 base::scoped_nsobject<CocoaCookieDetails> details; | 231 base::scoped_nsobject<CocoaCookieDetails> details; |
| 225 std::string manifestURL("http://html5demos.com/html5demo.manifest"); | 232 std::string manifestURL("http://html5demos.com/html5demo.manifest"); |
| 226 details.reset([[CocoaCookieDetails alloc] | 233 details.reset([[CocoaCookieDetails alloc] |
| 227 initWithAppCacheManifestURL:manifestURL.c_str()]); | 234 initWithAppCacheManifestURL:manifestURL.c_str()]); |
| 228 | 235 |
| 229 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptAppCache); | 236 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypePromptAppCache); |
| 230 EXPECT_NSEQ(@"http://html5demos.com/html5demo.manifest", | 237 EXPECT_NSEQ(@"http://html5demos.com/html5demo.manifest", |
| 231 [details.get() manifestURL]); | 238 [details.get() manifestURL]); |
| 232 | 239 |
| 233 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 240 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 234 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 241 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 235 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 242 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 236 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 243 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 237 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 244 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 238 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 245 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 239 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 246 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 240 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); | 247 EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]); |
| 241 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 248 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 249 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 242 } | 250 } |
| 243 | 251 |
| 244 TEST_F(CookiesDetailsTest, CreateForTreeServiceWorker) { | 252 TEST_F(CookiesDetailsTest, CreateForTreeServiceWorker) { |
| 245 base::scoped_nsobject<CocoaCookieDetails> details; | 253 base::scoped_nsobject<CocoaCookieDetails> details; |
| 246 | 254 |
| 247 GURL origin("https://example.com/"); | 255 GURL origin("https://example.com/"); |
| 248 std::vector<GURL> scopes; | 256 std::vector<GURL> scopes; |
| 249 scopes.push_back(GURL("https://example.com/app1/*")); | 257 scopes.push_back(GURL("https://example.com/app1/*")); |
| 250 scopes.push_back(GURL("https://example.com/app2/*")); | 258 scopes.push_back(GURL("https://example.com/app2/*")); |
| 251 content::ServiceWorkerUsageInfo info(origin, | 259 content::ServiceWorkerUsageInfo info(origin, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 263 | 271 |
| 264 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); | 272 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 265 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); | 273 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 266 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); | 274 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 267 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); | 275 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 268 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); | 276 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 269 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); | 277 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 270 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); | 278 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 271 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); | 279 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 272 EXPECT_TRUE([details.get() shouldShowServiceWorkerTreeDetailsView]); | 280 EXPECT_TRUE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 281 EXPECT_FALSE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 282 } |
| 283 |
| 284 TEST_F(CookiesDetailsTest, CreateForTreeCacheStorage) { |
| 285 base::scoped_nsobject<CocoaCookieDetails> details; |
| 286 |
| 287 GURL origin("https://example.com/"); |
| 288 content::CacheStorageUsageInfo info(origin); |
| 289 |
| 290 details.reset( |
| 291 [[CocoaCookieDetails alloc] initWithServiceWorkerUsageInfo:&info]); |
| 292 |
| 293 EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeServiceWorker); |
| 294 EXPECT_NSEQ(@"https://example.com/", [details.get() domain]); |
| 295 EXPECT_NSEQ(@"0 B", [details.get() fileSize]); |
| 296 EXPECT_NSEQ(@"", [details.get() lastModified]); |
| 297 |
| 298 EXPECT_TRUE([details.get() shouldHideCookieDetailsView]); |
| 299 EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]); |
| 300 EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]); |
| 301 EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]); |
| 302 EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]); |
| 303 EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]); |
| 304 EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]); |
| 305 EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]); |
| 306 EXPECT_FALSE([details.get() shouldShowServiceWorkerTreeDetailsView]); |
| 307 EXPECT_TRUE([details.get() shouldShowCacheStorageTreeDetailsView]); |
| 273 } | 308 } |
| 274 } | 309 } |
| OLD | NEW |