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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
jdoerrie
2017/04/06 14:25:51
#include <utility>
vabr (Chromium)
2017/04/07 20:40:41
Done.
| |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | |
8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 12 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
13 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 14 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
15 #include "components/content_settings/core/browser/cookie_settings.h" | 16 #include "components/content_settings/core/browser/cookie_settings.h" |
16 #include "components/content_settings/core/common/content_settings.h" | 17 #include "components/content_settings/core/common/content_settings.h" |
17 #include "components/content_settings/core/common/content_settings_types.h" | 18 #include "components/content_settings/core/common/content_settings_types.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 scoped_refptr<Extension> CreateProtectedApp() { | 103 scoped_refptr<Extension> CreateProtectedApp() { |
103 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
104 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); | 105 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); |
105 #elif defined(OS_POSIX) | 106 #elif defined(OS_POSIX) |
106 base::FilePath path(FILE_PATH_LITERAL("/foo")); | 107 base::FilePath path(FILE_PATH_LITERAL("/foo")); |
107 #endif | 108 #endif |
108 base::DictionaryValue manifest; | 109 base::DictionaryValue manifest; |
109 manifest.SetString(keys::kName, "Protected"); | 110 manifest.SetString(keys::kName, "Protected"); |
110 manifest.SetString(keys::kVersion, "1"); | 111 manifest.SetString(keys::kVersion, "1"); |
111 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); | 112 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); |
112 base::ListValue* list = new base::ListValue(); | 113 auto list = base::MakeUnique<base::ListValue>(); |
113 list->AppendString("http://explicit/protected"); | 114 list->AppendString("http://explicit/protected"); |
114 list->AppendString("*://*.wildcards/protected"); | 115 list->AppendString("*://*.wildcards/protected"); |
115 manifest.Set(keys::kWebURLs, list); | 116 manifest.Set(keys::kWebURLs, std::move(list)); |
116 std::string error; | 117 std::string error; |
117 scoped_refptr<Extension> protected_app = Extension::Create( | 118 scoped_refptr<Extension> protected_app = Extension::Create( |
118 path, Manifest::INVALID_LOCATION, manifest, | 119 path, Manifest::INVALID_LOCATION, manifest, |
119 Extension::NO_FLAGS, &error); | 120 Extension::NO_FLAGS, &error); |
120 EXPECT_TRUE(protected_app.get()) << error; | 121 EXPECT_TRUE(protected_app.get()) << error; |
121 return protected_app; | 122 return protected_app; |
122 } | 123 } |
123 | 124 |
124 scoped_refptr<Extension> CreateUnlimitedApp() { | 125 scoped_refptr<Extension> CreateUnlimitedApp() { |
125 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
126 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); | 127 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); |
127 #elif defined(OS_POSIX) | 128 #elif defined(OS_POSIX) |
128 base::FilePath path(FILE_PATH_LITERAL("/bar")); | 129 base::FilePath path(FILE_PATH_LITERAL("/bar")); |
129 #endif | 130 #endif |
130 base::DictionaryValue manifest; | 131 base::DictionaryValue manifest; |
131 manifest.SetString(keys::kName, "Unlimited"); | 132 manifest.SetString(keys::kName, "Unlimited"); |
132 manifest.SetString(keys::kVersion, "1"); | 133 manifest.SetString(keys::kVersion, "1"); |
133 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); | 134 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); |
134 base::ListValue* list = new base::ListValue(); | 135 auto list = base::MakeUnique<base::ListValue>(); |
135 list->AppendString("unlimitedStorage"); | 136 list->AppendString("unlimitedStorage"); |
136 manifest.Set(keys::kPermissions, list); | 137 manifest.Set(keys::kPermissions, std::move(list)); |
137 list = new base::ListValue(); | 138 list = base::MakeUnique<base::ListValue>(); |
138 list->AppendString("http://explicit/unlimited"); | 139 list->AppendString("http://explicit/unlimited"); |
139 list->AppendString("*://*.wildcards/unlimited"); | 140 list->AppendString("*://*.wildcards/unlimited"); |
140 manifest.Set(keys::kWebURLs, list); | 141 manifest.Set(keys::kWebURLs, std::move(list)); |
141 std::string error; | 142 std::string error; |
142 scoped_refptr<Extension> unlimited_app = Extension::Create( | 143 scoped_refptr<Extension> unlimited_app = Extension::Create( |
143 path, Manifest::INVALID_LOCATION, manifest, | 144 path, Manifest::INVALID_LOCATION, manifest, |
144 Extension::NO_FLAGS, &error); | 145 Extension::NO_FLAGS, &error); |
145 EXPECT_TRUE(unlimited_app.get()) << error; | 146 EXPECT_TRUE(unlimited_app.get()) << error; |
146 return unlimited_app; | 147 return unlimited_app; |
147 } | 148 } |
148 | 149 |
149 scoped_refptr<Extension> CreateRegularApp() { | 150 scoped_refptr<Extension> CreateRegularApp() { |
150 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 EXPECT_TRUE(observer.IsCompleted()); | 392 EXPECT_TRUE(observer.IsCompleted()); |
392 } | 393 } |
393 | 394 |
394 observer.ExpectClear(); | 395 observer.ExpectClear(); |
395 policy_->RevokeRightsForAllExtensions(); | 396 policy_->RevokeRightsForAllExtensions(); |
396 base::RunLoop().RunUntilIdle(); | 397 base::RunLoop().RunUntilIdle(); |
397 EXPECT_TRUE(observer.IsCompleted()); | 398 EXPECT_TRUE(observer.IsCompleted()); |
398 | 399 |
399 policy_->RemoveObserver(&observer); | 400 policy_->RemoveObserver(&observer); |
400 } | 401 } |
OLD | NEW |