| 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/values.h" | 5 #include "base/values.h" |
| 6 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 6 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 7 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 9 #include "components/content_settings/core/browser/cookie_settings.h" | 10 #include "components/content_settings/core/browser/cookie_settings.h" |
| 10 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
| 11 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
| 12 #include "content/public/test/test_browser_thread.h" | 13 #include "content/public/test/test_browser_thread.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 15 #include "extensions/common/extension_set.h" | 16 #include "extensions/common/extension_set.h" |
| 16 #include "extensions/common/manifest.h" | 17 #include "extensions/common/manifest.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 TEST_F(ExtensionSpecialStoragePolicyTest, IsStorageDurableTest) { | 346 TEST_F(ExtensionSpecialStoragePolicyTest, IsStorageDurableTest) { |
| 346 TestingProfile profile; | 347 TestingProfile profile; |
| 347 content_settings::CookieSettings* cookie_settings = | 348 content_settings::CookieSettings* cookie_settings = |
| 348 CookieSettingsFactory::GetForProfile(&profile).get(); | 349 CookieSettingsFactory::GetForProfile(&profile).get(); |
| 349 policy_ = new ExtensionSpecialStoragePolicy(cookie_settings); | 350 policy_ = new ExtensionSpecialStoragePolicy(cookie_settings); |
| 350 const GURL kHttpUrl("http://foo.com"); | 351 const GURL kHttpUrl("http://foo.com"); |
| 351 | 352 |
| 352 EXPECT_FALSE(policy_->IsStorageDurable(kHttpUrl)); | 353 EXPECT_FALSE(policy_->IsStorageDurable(kHttpUrl)); |
| 353 | 354 |
| 354 HostContentSettingsMap* content_settings_map = | 355 HostContentSettingsMap* content_settings_map = |
| 355 profile.GetHostContentSettingsMap(); | 356 HostContentSettingsMapFactory::GetForProfile(&profile); |
| 356 content_settings_map->SetContentSetting( | 357 content_settings_map->SetContentSetting( |
| 357 ContentSettingsPattern::FromString("foo.com"), | 358 ContentSettingsPattern::FromString("foo.com"), |
| 358 ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 359 ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, |
| 359 std::string(), CONTENT_SETTING_ALLOW); | 360 std::string(), CONTENT_SETTING_ALLOW); |
| 360 | 361 |
| 361 EXPECT_TRUE(policy_->IsStorageDurable(kHttpUrl)); | 362 EXPECT_TRUE(policy_->IsStorageDurable(kHttpUrl)); |
| 362 } | 363 } |
| 363 | 364 |
| 364 TEST_F(ExtensionSpecialStoragePolicyTest, NotificationTest) { | 365 TEST_F(ExtensionSpecialStoragePolicyTest, NotificationTest) { |
| 365 PolicyChangeObserver observer; | 366 PolicyChangeObserver observer; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 EXPECT_TRUE(observer.IsCompleted()); | 409 EXPECT_TRUE(observer.IsCompleted()); |
| 409 } | 410 } |
| 410 | 411 |
| 411 observer.ExpectClear(); | 412 observer.ExpectClear(); |
| 412 policy_->RevokeRightsForAllExtensions(); | 413 policy_->RevokeRightsForAllExtensions(); |
| 413 base::MessageLoop::current()->RunUntilIdle(); | 414 base::MessageLoop::current()->RunUntilIdle(); |
| 414 EXPECT_TRUE(observer.IsCompleted()); | 415 EXPECT_TRUE(observer.IsCompleted()); |
| 415 | 416 |
| 416 policy_->RemoveObserver(&observer); | 417 policy_->RemoveObserver(&observer); |
| 417 } | 418 } |
| OLD | NEW |