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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chrome/browser/content_settings/cookie_settings.h" | 7 #include "chrome/browser/content_settings/cookie_settings.h" |
8 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
10 #include "chrome/common/content_settings_types.h" | 10 #include "chrome/common/content_settings_types.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 ExpectProtectedBy(empty_set, GURL("http://foo.wildcards/")); | 309 ExpectProtectedBy(empty_set, GURL("http://foo.wildcards/")); |
310 ExpectProtectedBy(empty_set, GURL("https://bar.wildcards/")); | 310 ExpectProtectedBy(empty_set, GURL("https://bar.wildcards/")); |
311 } | 311 } |
312 | 312 |
313 TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) { | 313 TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) { |
314 base::MessageLoop message_loop; | 314 base::MessageLoop message_loop; |
315 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 315 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
316 | 316 |
317 TestingProfile profile; | 317 TestingProfile profile; |
318 CookieSettings* cookie_settings = | 318 CookieSettings* cookie_settings = |
319 CookieSettings::Factory::GetForProfile(&profile); | 319 CookieSettings::Factory::GetForProfile(&profile).get(); |
320 policy_ = new ExtensionSpecialStoragePolicy(cookie_settings); | 320 policy_ = new ExtensionSpecialStoragePolicy(cookie_settings); |
321 | 321 |
322 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 322 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
323 | 323 |
324 // The default setting can be session-only. | 324 // The default setting can be session-only. |
325 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 325 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
326 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); | 326 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); |
327 | 327 |
328 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_ALLOW); | 328 cookie_settings->SetDefaultCookieSetting(CONTENT_SETTING_ALLOW); |
329 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 329 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 EXPECT_TRUE(observer.IsCompleted()); | 396 EXPECT_TRUE(observer.IsCompleted()); |
397 } | 397 } |
398 | 398 |
399 observer.ExpectClear(); | 399 observer.ExpectClear(); |
400 policy_->RevokeRightsForAllExtensions(); | 400 policy_->RevokeRightsForAllExtensions(); |
401 message_loop.RunUntilIdle(); | 401 message_loop.RunUntilIdle(); |
402 EXPECT_TRUE(observer.IsCompleted()); | 402 EXPECT_TRUE(observer.IsCompleted()); |
403 | 403 |
404 policy_->RemoveObserver(&observer); | 404 policy_->RemoveObserver(&observer); |
405 } | 405 } |
OLD | NEW |