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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "extensions/common/manifest.h" | 49 #include "extensions/common/manifest.h" |
50 #include "extensions/common/manifest_constants.h" | 50 #include "extensions/common/manifest_constants.h" |
51 #include "extensions/common/permissions/api_permission.h" | 51 #include "extensions/common/permissions/api_permission.h" |
52 #include "extensions/common/permissions/permissions_data.h" | 52 #include "extensions/common/permissions/permissions_data.h" |
53 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
54 | 54 |
55 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
56 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 56 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
57 #include "chrome/browser/chromeos/settings/cros_settings.h" | 57 #include "chrome/browser/chromeos/settings/cros_settings.h" |
58 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 58 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
59 #include "chromeos/dbus/dbus_thread_manager.h" | |
60 #endif | 59 #endif |
61 | 60 |
62 namespace extensions { | 61 namespace extensions { |
63 | 62 |
64 namespace { | 63 namespace { |
65 | 64 |
66 const char kTestExtensionName[] = "FooBar"; | 65 const char kTestExtensionName[] = "FooBar"; |
67 const char kTestingUsername[] = "user1@example.com"; | 66 const char kTestingUsername[] = "user1@example.com"; |
68 | 67 |
69 } // namespace | 68 } // namespace |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 thread_bundle_.reset(new content::TestBrowserThreadBundle( | 213 thread_bundle_.reset(new content::TestBrowserThreadBundle( |
215 content::TestBrowserThreadBundle::REAL_IO_THREAD)); | 214 content::TestBrowserThreadBundle::REAL_IO_THREAD)); |
216 | 215 |
217 // Allow extension update to unpack crx in process. | 216 // Allow extension update to unpack crx in process. |
218 in_process_utility_thread_helper_.reset( | 217 in_process_utility_thread_helper_.reset( |
219 new content::InProcessUtilityThreadHelper); | 218 new content::InProcessUtilityThreadHelper); |
220 | 219 |
221 // This is needed to create extension service under CrOS. | 220 // This is needed to create extension service under CrOS. |
222 #if defined(OS_CHROMEOS) | 221 #if defined(OS_CHROMEOS) |
223 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 222 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
224 // Create a DBus thread manager setter for its side effect. | |
225 // Ignore the return value. | |
226 chromeos::DBusThreadManager::GetSetterForTesting(); | |
227 #endif | 223 #endif |
228 | 224 |
229 // Create a new profile. | 225 // Create a new profile. |
230 TestingProfile::Builder builder; | 226 TestingProfile::Builder builder; |
231 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 227 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
232 gcm::FakeSigninManager::Build); | 228 gcm::FakeSigninManager::Build); |
233 profile_ = builder.Build(); | 229 profile_ = builder.Build(); |
234 signin_manager_ = static_cast<gcm::FakeSigninManager*>( | 230 signin_manager_ = static_cast<gcm::FakeSigninManager*>( |
235 SigninManagerFactory::GetInstance()->GetForProfile(profile_.get())); | 231 SigninManagerFactory::GetInstance()->GetForProfile(profile_.get())); |
236 | 232 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 485 |
490 // 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 |
491 // has GCM permission removed. | 487 // has GCM permission removed. |
492 UpdateExtension(extension.get(), "good2.crx"); | 488 UpdateExtension(extension.get(), "good2.crx"); |
493 waiter()->PumpUILoop(); | 489 waiter()->PumpUILoop(); |
494 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 490 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
495 EXPECT_FALSE(HasAppHandlers(extension->id())); | 491 EXPECT_FALSE(HasAppHandlers(extension->id())); |
496 } | 492 } |
497 | 493 |
498 } // namespace extensions | 494 } // namespace extensions |
OLD | NEW |