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

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

Issue 2112543002: Convert UtilityProcessHost to bootstrap Mojo Channel using the Shell connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@p9x
Patch Set: . Created 4 years, 5 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>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 27 matching lines...) Expand all
38 #include "components/gcm_driver/fake_gcm_app_handler.h" 38 #include "components/gcm_driver/fake_gcm_app_handler.h"
39 #include "components/gcm_driver/fake_gcm_client.h" 39 #include "components/gcm_driver/fake_gcm_client.h"
40 #include "components/gcm_driver/fake_gcm_client_factory.h" 40 #include "components/gcm_driver/fake_gcm_client_factory.h"
41 #include "components/gcm_driver/gcm_client_factory.h" 41 #include "components/gcm_driver/gcm_client_factory.h"
42 #include "components/gcm_driver/gcm_driver.h" 42 #include "components/gcm_driver/gcm_driver.h"
43 #include "components/gcm_driver/gcm_profile_service.h" 43 #include "components/gcm_driver/gcm_profile_service.h"
44 #include "components/keyed_service/core/keyed_service.h" 44 #include "components/keyed_service/core/keyed_service.h"
45 #include "components/signin/core/browser/signin_manager.h" 45 #include "components/signin/core/browser/signin_manager.h"
46 #include "content/public/browser/browser_context.h" 46 #include "content/public/browser/browser_context.h"
47 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/shell_context.h"
48 #include "content/public/test/test_browser_thread_bundle.h" 49 #include "content/public/test/test_browser_thread_bundle.h"
49 #include "content/public/test/test_utils.h" 50 #include "content/public/test/test_utils.h"
50 #include "extensions/browser/extension_system.h" 51 #include "extensions/browser/extension_system.h"
51 #include "extensions/browser/uninstall_reason.h" 52 #include "extensions/browser/uninstall_reason.h"
52 #include "extensions/common/extension.h" 53 #include "extensions/common/extension.h"
53 #include "extensions/common/manifest.h" 54 #include "extensions/common/manifest.h"
54 #include "extensions/common/manifest_constants.h" 55 #include "extensions/common/manifest_constants.h"
55 #include "extensions/common/permissions/api_permission.h" 56 #include "extensions/common/permissions/api_permission.h"
56 #include "extensions/common/permissions/permissions_data.h" 57 #include "extensions/common/permissions/permissions_data.h"
57 #include "testing/gtest/include/gtest/gtest.h" 58 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ExtensionGCMAppHandlerTest() 224 ExtensionGCMAppHandlerTest()
224 : extension_service_(NULL), 225 : extension_service_(NULL),
225 registration_result_(gcm::GCMClient::UNKNOWN_ERROR), 226 registration_result_(gcm::GCMClient::UNKNOWN_ERROR),
226 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) { 227 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) {
227 } 228 }
228 229
229 ~ExtensionGCMAppHandlerTest() override {} 230 ~ExtensionGCMAppHandlerTest() override {}
230 231
231 // Overridden from test::Test: 232 // Overridden from test::Test:
232 void SetUp() override { 233 void SetUp() override {
234 shell_context_ = content::ShellContext::Create();
233 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 235 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
234 236
235 // Make BrowserThread work in unittest. 237 // Make BrowserThread work in unittest.
236 thread_bundle_.reset(new content::TestBrowserThreadBundle( 238 thread_bundle_.reset(new content::TestBrowserThreadBundle(
237 content::TestBrowserThreadBundle::REAL_IO_THREAD)); 239 content::TestBrowserThreadBundle::REAL_IO_THREAD));
238 240
239 // Allow extension update to unpack crx in process. 241 // Allow extension update to unpack crx in process.
240 in_process_utility_thread_helper_.reset( 242 in_process_utility_thread_helper_.reset(
241 new content::InProcessUtilityThreadHelper); 243 new content::InProcessUtilityThreadHelper);
242 244
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 392 }
391 gcm::GCMClient::Result unregistration_result() const { 393 gcm::GCMClient::Result unregistration_result() const {
392 return unregistration_result_; 394 return unregistration_result_;
393 } 395 }
394 396
395 private: 397 private:
396 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; 398 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
397 std::unique_ptr<content::InProcessUtilityThreadHelper> 399 std::unique_ptr<content::InProcessUtilityThreadHelper>
398 in_process_utility_thread_helper_; 400 in_process_utility_thread_helper_;
399 std::unique_ptr<TestingProfile> profile_; 401 std::unique_ptr<TestingProfile> profile_;
402 std::unique_ptr<content::ShellContext> shell_context_;
400 ExtensionService* extension_service_; // Not owned. 403 ExtensionService* extension_service_; // Not owned.
401 base::ScopedTempDir temp_dir_; 404 base::ScopedTempDir temp_dir_;
402 405
403 // This is needed to create extension service under CrOS. 406 // This is needed to create extension service under CrOS.
404 #if defined(OS_CHROMEOS) 407 #if defined(OS_CHROMEOS)
405 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 408 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
406 chromeos::ScopedTestCrosSettings test_cros_settings_; 409 chromeos::ScopedTestCrosSettings test_cros_settings_;
407 std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_; 410 std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
408 #endif 411 #endif
409 412
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 488
486 // App handler is removed when the extension is updated to the version that 489 // App handler is removed when the extension is updated to the version that
487 // has GCM permission removed. 490 // has GCM permission removed.
488 UpdateExtension(extension.get(), "good2.crx"); 491 UpdateExtension(extension.get(), "good2.crx");
489 waiter()->PumpUILoop(); 492 waiter()->PumpUILoop();
490 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); 493 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero());
491 EXPECT_FALSE(HasAppHandlers(extension->id())); 494 EXPECT_FALSE(HasAppHandlers(extension->id()));
492 } 495 }
493 496
494 } // namespace extensions 497 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698