| 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/message_loop.h" | 5 #include "base/message_loop/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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
| 99 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); | 99 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); |
| 100 #elif defined(OS_POSIX) | 100 #elif defined(OS_POSIX) |
| 101 base::FilePath path(FILE_PATH_LITERAL("/foo")); | 101 base::FilePath path(FILE_PATH_LITERAL("/foo")); |
| 102 #endif | 102 #endif |
| 103 DictionaryValue manifest; | 103 DictionaryValue manifest; |
| 104 manifest.SetString(keys::kName, "Protected"); | 104 manifest.SetString(keys::kName, "Protected"); |
| 105 manifest.SetString(keys::kVersion, "1"); | 105 manifest.SetString(keys::kVersion, "1"); |
| 106 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); | 106 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); |
| 107 base::ListValue* list = new base::ListValue(); | 107 base::ListValue* list = new base::ListValue(); |
| 108 list->Append(Value::CreateStringValue("http://explicit/protected")); | 108 list->Append(new base::StringValue("http://explicit/protected")); |
| 109 list->Append(Value::CreateStringValue("*://*.wildcards/protected")); | 109 list->Append(new base::StringValue("*://*.wildcards/protected")); |
| 110 manifest.Set(keys::kWebURLs, list); | 110 manifest.Set(keys::kWebURLs, list); |
| 111 std::string error; | 111 std::string error; |
| 112 scoped_refptr<Extension> protected_app = Extension::Create( | 112 scoped_refptr<Extension> protected_app = Extension::Create( |
| 113 path, Manifest::INVALID_LOCATION, manifest, | 113 path, Manifest::INVALID_LOCATION, manifest, |
| 114 Extension::NO_FLAGS, &error); | 114 Extension::NO_FLAGS, &error); |
| 115 EXPECT_TRUE(protected_app.get()) << error; | 115 EXPECT_TRUE(protected_app.get()) << error; |
| 116 return protected_app; | 116 return protected_app; |
| 117 } | 117 } |
| 118 | 118 |
| 119 scoped_refptr<Extension> CreateUnlimitedApp() { | 119 scoped_refptr<Extension> CreateUnlimitedApp() { |
| 120 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
| 121 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); | 121 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); |
| 122 #elif defined(OS_POSIX) | 122 #elif defined(OS_POSIX) |
| 123 base::FilePath path(FILE_PATH_LITERAL("/bar")); | 123 base::FilePath path(FILE_PATH_LITERAL("/bar")); |
| 124 #endif | 124 #endif |
| 125 DictionaryValue manifest; | 125 DictionaryValue manifest; |
| 126 manifest.SetString(keys::kName, "Unlimited"); | 126 manifest.SetString(keys::kName, "Unlimited"); |
| 127 manifest.SetString(keys::kVersion, "1"); | 127 manifest.SetString(keys::kVersion, "1"); |
| 128 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); | 128 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); |
| 129 base::ListValue* list = new base::ListValue(); | 129 base::ListValue* list = new base::ListValue(); |
| 130 list->Append(Value::CreateStringValue("unlimitedStorage")); | 130 list->Append(new base::StringValue("unlimitedStorage")); |
| 131 manifest.Set(keys::kPermissions, list); | 131 manifest.Set(keys::kPermissions, list); |
| 132 list = new base::ListValue(); | 132 list = new base::ListValue(); |
| 133 list->Append(Value::CreateStringValue("http://explicit/unlimited")); | 133 list->Append(new base::StringValue("http://explicit/unlimited")); |
| 134 list->Append(Value::CreateStringValue("*://*.wildcards/unlimited")); | 134 list->Append(new base::StringValue("*://*.wildcards/unlimited")); |
| 135 manifest.Set(keys::kWebURLs, list); | 135 manifest.Set(keys::kWebURLs, list); |
| 136 std::string error; | 136 std::string error; |
| 137 scoped_refptr<Extension> unlimited_app = Extension::Create( | 137 scoped_refptr<Extension> unlimited_app = Extension::Create( |
| 138 path, Manifest::INVALID_LOCATION, manifest, | 138 path, Manifest::INVALID_LOCATION, manifest, |
| 139 Extension::NO_FLAGS, &error); | 139 Extension::NO_FLAGS, &error); |
| 140 EXPECT_TRUE(unlimited_app.get()) << error; | 140 EXPECT_TRUE(unlimited_app.get()) << error; |
| 141 return unlimited_app; | 141 return unlimited_app; |
| 142 } | 142 } |
| 143 | 143 |
| 144 scoped_refptr<Extension> CreateRegularApp() { | 144 scoped_refptr<Extension> CreateRegularApp() { |
| (...skipping 251 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 |