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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 10 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 324 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
325 | 325 |
326 // The default setting can be session-only. | 326 // The default setting can be session-only. |
327 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 327 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
328 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); | 328 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); |
329 | 329 |
330 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_ALLOW); | 330 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_ALLOW); |
331 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 331 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
332 | 332 |
333 // Or the session-onlyness can affect individual origins. | 333 // Or the session-onlyness can affect individual origins. |
| 334 // TODO(lshang): Remove the pattern after ResetCookieSetting() is also changed |
| 335 // to use GURL. |
334 ContentSettingsPattern pattern = | 336 ContentSettingsPattern pattern = |
335 ContentSettingsPattern::FromString("pattern.com"); | 337 ContentSettingsPattern::FromString("[*.]pattern.com"); |
336 | 338 GURL url("http://pattern.com"); |
337 cookie_settings->SetCookieSetting(pattern, | 339 cookie_settings->SetCookieSetting(url, CONTENT_SETTING_SESSION_ONLY); |
338 ContentSettingsPattern::Wildcard(), | |
339 CONTENT_SETTING_SESSION_ONLY); | |
340 | 340 |
341 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); | 341 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); |
342 | 342 |
343 // Clearing an origin-specific rule. | 343 // Clearing an origin-specific rule. |
344 cookie_settings->ResetCookieSetting(pattern, | 344 cookie_settings->ResetCookieSetting(pattern, |
345 ContentSettingsPattern::Wildcard()); | 345 ContentSettingsPattern::Wildcard()); |
346 | 346 |
347 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 347 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
348 } | 348 } |
349 | 349 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 EXPECT_TRUE(observer.IsCompleted()); | 412 EXPECT_TRUE(observer.IsCompleted()); |
413 } | 413 } |
414 | 414 |
415 observer.ExpectClear(); | 415 observer.ExpectClear(); |
416 policy_->RevokeRightsForAllExtensions(); | 416 policy_->RevokeRightsForAllExtensions(); |
417 base::MessageLoop::current()->RunUntilIdle(); | 417 base::MessageLoop::current()->RunUntilIdle(); |
418 EXPECT_TRUE(observer.IsCompleted()); | 418 EXPECT_TRUE(observer.IsCompleted()); |
419 | 419 |
420 policy_->RemoveObserver(&observer); | 420 policy_->RemoveObserver(&observer); |
421 } | 421 } |
OLD | NEW |