| 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 25 matching lines...) Expand all Loading... |
| 36 #include "components/gcm_driver/fake_gcm_client.h" | 36 #include "components/gcm_driver/fake_gcm_client.h" |
| 37 #include "components/gcm_driver/fake_gcm_client_factory.h" | 37 #include "components/gcm_driver/fake_gcm_client_factory.h" |
| 38 #include "components/gcm_driver/gcm_client_factory.h" | 38 #include "components/gcm_driver/gcm_client_factory.h" |
| 39 #include "components/gcm_driver/gcm_driver.h" | 39 #include "components/gcm_driver/gcm_driver.h" |
| 40 #include "components/keyed_service/core/keyed_service.h" | 40 #include "components/keyed_service/core/keyed_service.h" |
| 41 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
| 42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
| 43 #include "content/public/test/test_browser_thread_bundle.h" | 43 #include "content/public/test/test_browser_thread_bundle.h" |
| 44 #include "content/public/test/test_utils.h" | 44 #include "content/public/test/test_utils.h" |
| 45 #include "extensions/browser/extension_system.h" | 45 #include "extensions/browser/extension_system.h" |
| 46 #include "extensions/browser/uninstall_reason.h" |
| 46 #include "extensions/common/extension.h" | 47 #include "extensions/common/extension.h" |
| 47 #include "extensions/common/manifest.h" | 48 #include "extensions/common/manifest.h" |
| 48 #include "extensions/common/manifest_constants.h" | 49 #include "extensions/common/manifest_constants.h" |
| 49 #include "extensions/common/permissions/api_permission.h" | 50 #include "extensions/common/permissions/api_permission.h" |
| 50 #include "extensions/common/permissions/permissions_data.h" | 51 #include "extensions/common/permissions/permissions_data.h" |
| 51 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
| 52 | 53 |
| 53 #if !defined(OS_ANDROID) | 54 #if !defined(OS_ANDROID) |
| 54 #include "chrome/browser/extensions/api/gcm/gcm_api.h" | 55 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
| 55 #endif | 56 #endif |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 extension_service_->DisableExtension( | 328 extension_service_->DisableExtension( |
| 328 extension->id(), Extension::DISABLE_USER_ACTION); | 329 extension->id(), Extension::DISABLE_USER_ACTION); |
| 329 } | 330 } |
| 330 | 331 |
| 331 void EnableExtension(const Extension* extension) { | 332 void EnableExtension(const Extension* extension) { |
| 332 extension_service_->EnableExtension(extension->id()); | 333 extension_service_->EnableExtension(extension->id()); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void UninstallExtension(const Extension* extension) { | 336 void UninstallExtension(const Extension* extension) { |
| 336 extension_service_->UninstallExtension( | 337 extension_service_->UninstallExtension( |
| 337 extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); | 338 extension->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL); |
| 338 } | 339 } |
| 339 | 340 |
| 340 void SignIn(const std::string& username) { | 341 void SignIn(const std::string& username) { |
| 341 signin_manager_->SignIn(username); | 342 signin_manager_->SignIn(username); |
| 342 waiter_.PumpIOLoop(); | 343 waiter_.PumpIOLoop(); |
| 343 } | 344 } |
| 344 | 345 |
| 345 void SignOut() { | 346 void SignOut() { |
| 346 signin_manager_->SignOut(signin_metrics::SIGNOUT_TEST); | 347 signin_manager_->SignOut(signin_metrics::SIGNOUT_TEST); |
| 347 waiter_.PumpIOLoop(); | 348 waiter_.PumpIOLoop(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 485 |
| 485 // App handler is removed when the extension is updated to the version that | 486 // App handler is removed when the extension is updated to the version that |
| 486 // has GCM permission removed. | 487 // has GCM permission removed. |
| 487 UpdateExtension(extension, "good2.crx"); | 488 UpdateExtension(extension, "good2.crx"); |
| 488 waiter()->PumpUILoop(); | 489 waiter()->PumpUILoop(); |
| 489 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 490 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
| 490 EXPECT_FALSE(HasAppHandlers(extension->id())); | 491 EXPECT_FALSE(HasAppHandlers(extension->id())); |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace extensions | 494 } // namespace extensions |
| OLD | NEW |