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

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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 234 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
234 235
235 // Make BrowserThread work in unittest. 236 // Make BrowserThread work in unittest.
236 thread_bundle_.reset(new content::TestBrowserThreadBundle( 237 thread_bundle_.reset(new content::TestBrowserThreadBundle(
237 content::TestBrowserThreadBundle::REAL_IO_THREAD)); 238 content::TestBrowserThreadBundle::REAL_IO_THREAD));
238 239
239 // Allow extension update to unpack crx in process. 240 // Allow extension update to unpack crx in process.
240 in_process_utility_thread_helper_.reset( 241 in_process_utility_thread_helper_.reset(
241 new content::InProcessUtilityThreadHelper); 242 new content::InProcessUtilityThreadHelper);
242 243
244 shell_context_ = content::ShellContext::Create();
245
243 // This is needed to create extension service under CrOS. 246 // This is needed to create extension service under CrOS.
244 #if defined(OS_CHROMEOS) 247 #if defined(OS_CHROMEOS)
245 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); 248 test_user_manager_.reset(new chromeos::ScopedTestUserManager());
246 // Creating a DBus thread manager setter has the side effect of 249 // Creating a DBus thread manager setter has the side effect of
247 // creating a DBusThreadManager, which is needed for testing. 250 // creating a DBusThreadManager, which is needed for testing.
248 // We don't actually need the setter so we ignore the return value. 251 // We don't actually need the setter so we ignore the return value.
249 chromeos::DBusThreadManager::GetSetterForTesting(); 252 chromeos::DBusThreadManager::GetSetterForTesting();
250 #endif 253 #endif
251 254
252 // Create a new profile. 255 // Create a new profile.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 393 }
391 gcm::GCMClient::Result unregistration_result() const { 394 gcm::GCMClient::Result unregistration_result() const {
392 return unregistration_result_; 395 return unregistration_result_;
393 } 396 }
394 397
395 private: 398 private:
396 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; 399 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
397 std::unique_ptr<content::InProcessUtilityThreadHelper> 400 std::unique_ptr<content::InProcessUtilityThreadHelper>
398 in_process_utility_thread_helper_; 401 in_process_utility_thread_helper_;
399 std::unique_ptr<TestingProfile> profile_; 402 std::unique_ptr<TestingProfile> profile_;
403 std::unique_ptr<content::ShellContext> shell_context_;
400 ExtensionService* extension_service_; // Not owned. 404 ExtensionService* extension_service_; // Not owned.
401 base::ScopedTempDir temp_dir_; 405 base::ScopedTempDir temp_dir_;
402 406
403 // This is needed to create extension service under CrOS. 407 // This is needed to create extension service under CrOS.
404 #if defined(OS_CHROMEOS) 408 #if defined(OS_CHROMEOS)
405 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 409 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
406 chromeos::ScopedTestCrosSettings test_cros_settings_; 410 chromeos::ScopedTestCrosSettings test_cros_settings_;
407 std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_; 411 std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
408 #endif 412 #endif
409 413
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 489
486 // App handler is removed when the extension is updated to the version that 490 // App handler is removed when the extension is updated to the version that
487 // has GCM permission removed. 491 // has GCM permission removed.
488 UpdateExtension(extension.get(), "good2.crx"); 492 UpdateExtension(extension.get(), "good2.crx");
489 waiter()->PumpUILoop(); 493 waiter()->PumpUILoop();
490 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); 494 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero());
491 EXPECT_FALSE(HasAppHandlers(extension->id())); 495 EXPECT_FALSE(HasAppHandlers(extension->id()));
492 } 496 }
493 497
494 } // namespace extensions 498 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698