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

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

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

Powered by Google App Engine
This is Rietveld 408576698