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

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

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/extension_gcm_app_handler.h" 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h"
6 6
7 #include <memory> 7 #include <memory>
jdoerrie 2017/04/06 14:25:51 #include <utility>
vabr (Chromium) 2017/04/07 20:40:40 Done.
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 waiter_.PumpUILoop(); 281 waiter_.PumpUILoop();
282 gcm_app_handler_->Shutdown(); 282 gcm_app_handler_->Shutdown();
283 } 283 }
284 284
285 // Returns a barebones test extension. 285 // Returns a barebones test extension.
286 scoped_refptr<Extension> CreateExtension() { 286 scoped_refptr<Extension> CreateExtension() {
287 base::DictionaryValue manifest; 287 base::DictionaryValue manifest;
288 manifest.SetString(manifest_keys::kVersion, "1.0.0.0"); 288 manifest.SetString(manifest_keys::kVersion, "1.0.0.0");
289 manifest.SetString(manifest_keys::kName, kTestExtensionName); 289 manifest.SetString(manifest_keys::kName, kTestExtensionName);
290 base::ListValue* permission_list = new base::ListValue; 290 auto permission_list = base::MakeUnique<base::ListValue>();
291 permission_list->AppendString("gcm"); 291 permission_list->AppendString("gcm");
292 manifest.Set(manifest_keys::kPermissions, permission_list); 292 manifest.Set(manifest_keys::kPermissions, std::move(permission_list));
293 293
294 std::string error; 294 std::string error;
295 scoped_refptr<Extension> extension = Extension::Create( 295 scoped_refptr<Extension> extension = Extension::Create(
296 temp_dir_.GetPath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS, 296 temp_dir_.GetPath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS,
297 "ldnnhddmnhbkjipkidpdiheffobcpfmf", &error); 297 "ldnnhddmnhbkjipkidpdiheffobcpfmf", &error);
298 EXPECT_TRUE(extension.get()) << error; 298 EXPECT_TRUE(extension.get()) << error;
299 EXPECT_TRUE( 299 EXPECT_TRUE(
300 extension->permissions_data()->HasAPIPermission(APIPermission::kGcm)); 300 extension->permissions_data()->HasAPIPermission(APIPermission::kGcm));
301 301
302 return extension; 302 return extension;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 // App handler is removed when the extension is updated to the version that 484 // App handler is removed when the extension is updated to the version that
485 // has GCM permission removed. 485 // has GCM permission removed.
486 UpdateExtension(extension.get(), "good2.crx"); 486 UpdateExtension(extension.get(), "good2.crx");
487 waiter()->PumpUILoop(); 487 waiter()->PumpUILoop();
488 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); 488 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero());
489 EXPECT_FALSE(HasAppHandlers(extension->id())); 489 EXPECT_FALSE(HasAppHandlers(extension->id()));
490 } 490 }
491 491
492 } // namespace extensions 492 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698