Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: chrome/browser/extensions/extension_special_storage_policy_unittest.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
7 #include <utility>
8
9 #include "base/macros.h" 7 #include "base/macros.h"
10 #include "base/memory/ptr_util.h"
11 #include "base/run_loop.h" 8 #include "base/run_loop.h"
12 #include "base/values.h" 9 #include "base/values.h"
13 #include "build/build_config.h" 10 #include "build/build_config.h"
14 #include "chrome/browser/content_settings/cookie_settings_factory.h" 11 #include "chrome/browser/content_settings/cookie_settings_factory.h"
15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
16 #include "chrome/browser/extensions/extension_special_storage_policy.h" 13 #include "chrome/browser/extensions/extension_special_storage_policy.h"
17 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
18 #include "components/content_settings/core/browser/cookie_settings.h" 15 #include "components/content_settings/core/browser/cookie_settings.h"
19 #include "components/content_settings/core/common/content_settings.h" 16 #include "components/content_settings/core/common/content_settings.h"
20 #include "components/content_settings/core/common/content_settings_types.h" 17 #include "components/content_settings/core/common/content_settings_types.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 scoped_refptr<Extension> CreateProtectedApp() { 102 scoped_refptr<Extension> CreateProtectedApp() {
106 #if defined(OS_WIN) 103 #if defined(OS_WIN)
107 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); 104 base::FilePath path(FILE_PATH_LITERAL("c:\\foo"));
108 #elif defined(OS_POSIX) 105 #elif defined(OS_POSIX)
109 base::FilePath path(FILE_PATH_LITERAL("/foo")); 106 base::FilePath path(FILE_PATH_LITERAL("/foo"));
110 #endif 107 #endif
111 base::DictionaryValue manifest; 108 base::DictionaryValue manifest;
112 manifest.SetString(keys::kName, "Protected"); 109 manifest.SetString(keys::kName, "Protected");
113 manifest.SetString(keys::kVersion, "1"); 110 manifest.SetString(keys::kVersion, "1");
114 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); 111 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start");
115 auto list = base::MakeUnique<base::ListValue>(); 112 base::ListValue* list = new base::ListValue();
116 list->AppendString("http://explicit/protected"); 113 list->AppendString("http://explicit/protected");
117 list->AppendString("*://*.wildcards/protected"); 114 list->AppendString("*://*.wildcards/protected");
118 manifest.Set(keys::kWebURLs, std::move(list)); 115 manifest.Set(keys::kWebURLs, list);
119 std::string error; 116 std::string error;
120 scoped_refptr<Extension> protected_app = Extension::Create( 117 scoped_refptr<Extension> protected_app = Extension::Create(
121 path, Manifest::INVALID_LOCATION, manifest, 118 path, Manifest::INVALID_LOCATION, manifest,
122 Extension::NO_FLAGS, &error); 119 Extension::NO_FLAGS, &error);
123 EXPECT_TRUE(protected_app.get()) << error; 120 EXPECT_TRUE(protected_app.get()) << error;
124 return protected_app; 121 return protected_app;
125 } 122 }
126 123
127 scoped_refptr<Extension> CreateUnlimitedApp() { 124 scoped_refptr<Extension> CreateUnlimitedApp() {
128 #if defined(OS_WIN) 125 #if defined(OS_WIN)
129 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); 126 base::FilePath path(FILE_PATH_LITERAL("c:\\bar"));
130 #elif defined(OS_POSIX) 127 #elif defined(OS_POSIX)
131 base::FilePath path(FILE_PATH_LITERAL("/bar")); 128 base::FilePath path(FILE_PATH_LITERAL("/bar"));
132 #endif 129 #endif
133 base::DictionaryValue manifest; 130 base::DictionaryValue manifest;
134 manifest.SetString(keys::kName, "Unlimited"); 131 manifest.SetString(keys::kName, "Unlimited");
135 manifest.SetString(keys::kVersion, "1"); 132 manifest.SetString(keys::kVersion, "1");
136 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); 133 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start");
137 auto list = base::MakeUnique<base::ListValue>(); 134 base::ListValue* list = new base::ListValue();
138 list->AppendString("unlimitedStorage"); 135 list->AppendString("unlimitedStorage");
139 manifest.Set(keys::kPermissions, std::move(list)); 136 manifest.Set(keys::kPermissions, list);
140 list = base::MakeUnique<base::ListValue>(); 137 list = new base::ListValue();
141 list->AppendString("http://explicit/unlimited"); 138 list->AppendString("http://explicit/unlimited");
142 list->AppendString("*://*.wildcards/unlimited"); 139 list->AppendString("*://*.wildcards/unlimited");
143 manifest.Set(keys::kWebURLs, std::move(list)); 140 manifest.Set(keys::kWebURLs, list);
144 std::string error; 141 std::string error;
145 scoped_refptr<Extension> unlimited_app = Extension::Create( 142 scoped_refptr<Extension> unlimited_app = Extension::Create(
146 path, Manifest::INVALID_LOCATION, manifest, 143 path, Manifest::INVALID_LOCATION, manifest,
147 Extension::NO_FLAGS, &error); 144 Extension::NO_FLAGS, &error);
148 EXPECT_TRUE(unlimited_app.get()) << error; 145 EXPECT_TRUE(unlimited_app.get()) << error;
149 return unlimited_app; 146 return unlimited_app;
150 } 147 }
151 148
152 scoped_refptr<Extension> CreateRegularApp() { 149 scoped_refptr<Extension> CreateRegularApp() {
153 #if defined(OS_WIN) 150 #if defined(OS_WIN)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 EXPECT_TRUE(observer.IsCompleted()); 391 EXPECT_TRUE(observer.IsCompleted());
395 } 392 }
396 393
397 observer.ExpectClear(); 394 observer.ExpectClear();
398 policy_->RevokeRightsForAllExtensions(); 395 policy_->RevokeRightsForAllExtensions();
399 base::RunLoop().RunUntilIdle(); 396 base::RunLoop().RunUntilIdle();
400 EXPECT_TRUE(observer.IsCompleted()); 397 EXPECT_TRUE(observer.IsCompleted());
401 398
402 policy_->RemoveObserver(&observer); 399 policy_->RemoveObserver(&observer);
403 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698