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