| 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" |
| 11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/extension_manifest_constants.h" | 12 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 13 #include "chrome/common/extensions/manifest.h" | 13 #include "chrome/common/extensions/manifest.h" |
| 14 #include "chrome/common/extensions/manifest_handler.h" | 14 #include "chrome/common/extensions/manifest_handler.h" |
| 15 #include "chrome/common/extensions/web_intents_handler.h" | 15 #include "chrome/common/extensions/web_intents_handler.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 using extensions::Extension; | 21 using extensions::Extension; |
| 22 using extensions::Manifest; | 22 using extensions::Manifest; |
| 23 | 23 |
| 24 namespace keys = extension_manifest_keys; | 24 namespace keys = extension_manifest_keys; |
| 25 | 25 |
| 26 class ExtensionSpecialStoragePolicyTest : public testing::Test { | 26 class ExtensionSpecialStoragePolicyTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 virtual void SetUp() { | 28 virtual void SetUp() { |
| 29 policy_ = new ExtensionSpecialStoragePolicy(NULL); | 29 policy_ = new ExtensionSpecialStoragePolicy(NULL); |
| 30 extensions::ManifestHandler::Register(keys::kIntents, | 30 extensions::ManifestHandler::Register( |
| 31 new extensions::WebIntentsHandler); | 31 keys::kIntents, |
| 32 make_linked_ptr(new extensions::WebIntentsHandler)); |
| 32 } | 33 } |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 scoped_refptr<Extension> CreateProtectedApp() { | 36 scoped_refptr<Extension> CreateProtectedApp() { |
| 36 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 37 FilePath path(FILE_PATH_LITERAL("c:\\foo")); | 38 FilePath path(FILE_PATH_LITERAL("c:\\foo")); |
| 38 #elif defined(OS_POSIX) | 39 #elif defined(OS_POSIX) |
| 39 FilePath path(FILE_PATH_LITERAL("/foo")); | 40 FilePath path(FILE_PATH_LITERAL("/foo")); |
| 40 #endif | 41 #endif |
| 41 DictionaryValue manifest; | 42 DictionaryValue manifest; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 CONTENT_SETTING_SESSION_ONLY); | 324 CONTENT_SETTING_SESSION_ONLY); |
| 324 | 325 |
| 325 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); | 326 EXPECT_TRUE(policy_->HasSessionOnlyOrigins()); |
| 326 | 327 |
| 327 // Clearing an origin-specific rule. | 328 // Clearing an origin-specific rule. |
| 328 cookie_settings->ResetCookieSetting(pattern, | 329 cookie_settings->ResetCookieSetting(pattern, |
| 329 ContentSettingsPattern::Wildcard()); | 330 ContentSettingsPattern::Wildcard()); |
| 330 | 331 |
| 331 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); | 332 EXPECT_FALSE(policy_->HasSessionOnlyOrigins()); |
| 332 } | 333 } |
| OLD | NEW |