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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 ContentSettingsPattern pattern = | 334 ContentSettingsPattern pattern = |
335 ContentSettingsPattern::FromString("pattern.com"); | 335 ContentSettingsPattern::FromString("[*.]pattern.com"); |
raymes
2016/03/16 03:24:11
nit: perhaps add a TODO to remove the pattern afte
lshang
2016/03/17 01:53:59
Done.
| |
336 | 336 GURL url("http://pattern.com"); |
337 cookie_settings->SetCookieSetting(pattern, | 337 cookie_settings->SetCookieSetting(url, CONTENT_SETTING_SESSION_ONLY); |
338 ContentSettingsPattern::Wildcard(), | |
339 CONTENT_SETTING_SESSION_ONLY); | |
340 | 338 |
341 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); | 339 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); |
342 | 340 |
343 // Clearing an origin-specific rule. | 341 // Clearing an origin-specific rule. |
344 cookie_settings->ResetCookieSetting(pattern, | 342 cookie_settings->ResetCookieSetting(pattern, |
345 ContentSettingsPattern::Wildcard()); | 343 ContentSettingsPattern::Wildcard()); |
346 | 344 |
347 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 345 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
348 } | 346 } |
349 | 347 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 EXPECT_TRUE(observer.IsCompleted()); | 410 EXPECT_TRUE(observer.IsCompleted()); |
413 } | 411 } |
414 | 412 |
415 observer.ExpectClear(); | 413 observer.ExpectClear(); |
416 policy_->RevokeRightsForAllExtensions(); | 414 policy_->RevokeRightsForAllExtensions(); |
417 base::MessageLoop::current()->RunUntilIdle(); | 415 base::MessageLoop::current()->RunUntilIdle(); |
418 EXPECT_TRUE(observer.IsCompleted()); | 416 EXPECT_TRUE(observer.IsCompleted()); |
419 | 417 |
420 policy_->RemoveObserver(&observer); | 418 policy_->RemoveObserver(&observer); |
421 } | 419 } |
OLD | NEW |