OLD | NEW |
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> |
8 #include <utility> | |
9 #include <vector> | 8 #include <vector> |
10 | 9 |
11 #include "base/bind.h" | 10 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
15 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
16 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
17 #include "base/location.h" | 16 #include "base/location.h" |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 280 |
282 waiter_.PumpUILoop(); | 281 waiter_.PumpUILoop(); |
283 gcm_app_handler_->Shutdown(); | 282 gcm_app_handler_->Shutdown(); |
284 } | 283 } |
285 | 284 |
286 // Returns a barebones test extension. | 285 // Returns a barebones test extension. |
287 scoped_refptr<Extension> CreateExtension() { | 286 scoped_refptr<Extension> CreateExtension() { |
288 base::DictionaryValue manifest; | 287 base::DictionaryValue manifest; |
289 manifest.SetString(manifest_keys::kVersion, "1.0.0.0"); | 288 manifest.SetString(manifest_keys::kVersion, "1.0.0.0"); |
290 manifest.SetString(manifest_keys::kName, kTestExtensionName); | 289 manifest.SetString(manifest_keys::kName, kTestExtensionName); |
291 auto permission_list = base::MakeUnique<base::ListValue>(); | 290 base::ListValue* permission_list = new base::ListValue; |
292 permission_list->AppendString("gcm"); | 291 permission_list->AppendString("gcm"); |
293 manifest.Set(manifest_keys::kPermissions, std::move(permission_list)); | 292 manifest.Set(manifest_keys::kPermissions, permission_list); |
294 | 293 |
295 std::string error; | 294 std::string error; |
296 scoped_refptr<Extension> extension = Extension::Create( | 295 scoped_refptr<Extension> extension = Extension::Create( |
297 temp_dir_.GetPath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS, | 296 temp_dir_.GetPath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS, |
298 "ldnnhddmnhbkjipkidpdiheffobcpfmf", &error); | 297 "ldnnhddmnhbkjipkidpdiheffobcpfmf", &error); |
299 EXPECT_TRUE(extension.get()) << error; | 298 EXPECT_TRUE(extension.get()) << error; |
300 EXPECT_TRUE( | 299 EXPECT_TRUE( |
301 extension->permissions_data()->HasAPIPermission(APIPermission::kGcm)); | 300 extension->permissions_data()->HasAPIPermission(APIPermission::kGcm)); |
302 | 301 |
303 return extension; | 302 return extension; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 483 |
485 // 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 |
486 // has GCM permission removed. | 485 // has GCM permission removed. |
487 UpdateExtension(extension.get(), "good2.crx"); | 486 UpdateExtension(extension.get(), "good2.crx"); |
488 waiter()->PumpUILoop(); | 487 waiter()->PumpUILoop(); |
489 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 488 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
490 EXPECT_FALSE(HasAppHandlers(extension->id())); | 489 EXPECT_FALSE(HasAppHandlers(extension->id())); |
491 } | 490 } |
492 | 491 |
493 } // namespace extensions | 492 } // namespace extensions |
OLD | NEW |