| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "components/gcm_driver/gcm_driver.h" | 34 #include "components/gcm_driver/gcm_driver.h" |
| 35 #include "components/keyed_service/core/keyed_service.h" | 35 #include "components/keyed_service/core/keyed_service.h" |
| 36 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
| 37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/test/test_browser_thread_bundle.h" | 38 #include "content/public/test/test_browser_thread_bundle.h" |
| 39 #include "extensions/browser/extension_system.h" | 39 #include "extensions/browser/extension_system.h" |
| 40 #include "extensions/common/extension.h" | 40 #include "extensions/common/extension.h" |
| 41 #include "extensions/common/manifest.h" | 41 #include "extensions/common/manifest.h" |
| 42 #include "extensions/common/manifest_constants.h" | 42 #include "extensions/common/manifest_constants.h" |
| 43 #include "extensions/common/permissions/api_permission.h" | 43 #include "extensions/common/permissions/api_permission.h" |
| 44 #include "extensions/common/permissions/permissions_data.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
| 45 | 46 |
| 46 #if !defined(OS_ANDROID) | 47 #if !defined(OS_ANDROID) |
| 47 #include "chrome/browser/extensions/api/gcm/gcm_api.h" | 48 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
| 48 #endif | 49 #endif |
| 49 | 50 |
| 50 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 51 #include "chrome/browser/chromeos/login/users/user_manager.h" | 52 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 52 #include "chrome/browser/chromeos/settings/cros_settings.h" | 53 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 53 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 54 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 manifest.Set(manifest_keys::kPermissions, permission_list); | 251 manifest.Set(manifest_keys::kPermissions, permission_list); |
| 251 | 252 |
| 252 std::string error; | 253 std::string error; |
| 253 scoped_refptr<Extension> extension = Extension::Create( | 254 scoped_refptr<Extension> extension = Extension::Create( |
| 254 path.AppendASCII(kTestExtensionName), | 255 path.AppendASCII(kTestExtensionName), |
| 255 Manifest::INVALID_LOCATION, | 256 Manifest::INVALID_LOCATION, |
| 256 manifest, | 257 manifest, |
| 257 Extension::NO_FLAGS, | 258 Extension::NO_FLAGS, |
| 258 &error); | 259 &error); |
| 259 EXPECT_TRUE(extension.get()) << error; | 260 EXPECT_TRUE(extension.get()) << error; |
| 260 EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kGcm)); | 261 EXPECT_TRUE( |
| 262 extension->permissions_data()->HasAPIPermission(APIPermission::kGcm)); |
| 261 | 263 |
| 262 return extension; | 264 return extension; |
| 263 } | 265 } |
| 264 | 266 |
| 265 void LoadExtension(const Extension* extension) { | 267 void LoadExtension(const Extension* extension) { |
| 266 extension_service_->AddExtension(extension); | 268 extension_service_->AddExtension(extension); |
| 267 } | 269 } |
| 268 | 270 |
| 269 void DisableExtension(const Extension* extension) { | 271 void DisableExtension(const Extension* extension) { |
| 270 extension_service_->DisableExtension( | 272 extension_service_->DisableExtension( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 UninstallExtension(extension); | 394 UninstallExtension(extension); |
| 393 waiter()->WaitUntilCompleted(); | 395 waiter()->WaitUntilCompleted(); |
| 394 EXPECT_EQ(gcm::GCMClient::SUCCESS, | 396 EXPECT_EQ(gcm::GCMClient::SUCCESS, |
| 395 gcm_app_handler()->unregistration_result()); | 397 gcm_app_handler()->unregistration_result()); |
| 396 | 398 |
| 397 // Clean up. | 399 // Clean up. |
| 398 GetGCMDriver()->RemoveAppHandler("Foo"); | 400 GetGCMDriver()->RemoveAppHandler("Foo"); |
| 399 } | 401 } |
| 400 | 402 |
| 401 } // namespace extensions | 403 } // namespace extensions |
| OLD | NEW |