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" | |
59 #endif | 60 #endif |
60 | 61 |
61 namespace extensions { | 62 namespace extensions { |
62 | 63 |
63 namespace { | 64 namespace { |
64 | 65 |
65 const char kTestExtensionName[] = "FooBar"; | 66 const char kTestExtensionName[] = "FooBar"; |
66 const char kTestingUsername[] = "user1@example.com"; | 67 const char kTestingUsername[] = "user1@example.com"; |
67 | 68 |
68 } // namespace | 69 } // namespace |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 thread_bundle_.reset(new content::TestBrowserThreadBundle( | 214 thread_bundle_.reset(new content::TestBrowserThreadBundle( |
214 content::TestBrowserThreadBundle::REAL_IO_THREAD)); | 215 content::TestBrowserThreadBundle::REAL_IO_THREAD)); |
215 | 216 |
216 // Allow extension update to unpack crx in process. | 217 // Allow extension update to unpack crx in process. |
217 in_process_utility_thread_helper_.reset( | 218 in_process_utility_thread_helper_.reset( |
218 new content::InProcessUtilityThreadHelper); | 219 new content::InProcessUtilityThreadHelper); |
219 | 220 |
220 // This is needed to create extension service under CrOS. | 221 // This is needed to create extension service under CrOS. |
221 #if defined(OS_CHROMEOS) | 222 #if defined(OS_CHROMEOS) |
222 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 223 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
224 // Create a DBus thread manager setter for its side effect. | |
225 (void) chromeos::DBusThreadManager::GetSetterForTesting(); | |
Yoyo Zhou
2014/09/13 00:50:47
What is this (void) doing here?
Luigi Semenzato
2014/09/13 01:02:48
The function returns a value which I ignore, as I
Yoyo Zhou
2014/09/13 01:09:43
The usage looks pretty uncommon in src/chrome, so
| |
223 #endif | 226 #endif |
224 | 227 |
225 // Create a new profile. | 228 // Create a new profile. |
226 TestingProfile::Builder builder; | 229 TestingProfile::Builder builder; |
227 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 230 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
228 gcm::FakeSigninManager::Build); | 231 gcm::FakeSigninManager::Build); |
229 profile_ = builder.Build(); | 232 profile_ = builder.Build(); |
230 signin_manager_ = static_cast<gcm::FakeSigninManager*>( | 233 signin_manager_ = static_cast<gcm::FakeSigninManager*>( |
231 SigninManagerFactory::GetInstance()->GetForProfile(profile_.get())); | 234 SigninManagerFactory::GetInstance()->GetForProfile(profile_.get())); |
232 | 235 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |