| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "extensions/common/extension_set.h" | 29 #include "extensions/common/extension_set.h" |
| 30 #include "extensions/common/permissions/permission_set.h" | 30 #include "extensions/common/permissions/permission_set.h" |
| 31 #include "extensions/common/test_util.h" | 31 #include "extensions/common/test_util.h" |
| 32 | 32 |
| 33 namespace extensions { | 33 namespace extensions { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 std::unique_ptr<KeyedService> BuildManagementApi( | 37 std::unique_ptr<KeyedService> BuildManagementApi( |
| 38 content::BrowserContext* context) { | 38 content::BrowserContext* context) { |
| 39 return base::WrapUnique(new ManagementAPI(context)); | 39 return base::MakeUnique<ManagementAPI>(context); |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::unique_ptr<KeyedService> BuildEventRouter( | 42 std::unique_ptr<KeyedService> BuildEventRouter( |
| 43 content::BrowserContext* profile) { | 43 content::BrowserContext* profile) { |
| 44 return base::WrapUnique( | 44 return base::MakeUnique<extensions::EventRouter>( |
| 45 new extensions::EventRouter(profile, ExtensionPrefs::Get(profile))); | 45 profile, ExtensionPrefs::Get(profile)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 namespace constants = extension_management_api_constants; | 50 namespace constants = extension_management_api_constants; |
| 51 | 51 |
| 52 // TODO(devlin): Unittests are awesome. Test more with unittests and less with | 52 // TODO(devlin): Unittests are awesome. Test more with unittests and less with |
| 53 // heavy api/browser tests. | 53 // heavy api/browser tests. |
| 54 class ManagementApiUnitTest : public ExtensionServiceTestWithInstall { | 54 class ManagementApiUnitTest : public ExtensionServiceTestWithInstall { |
| 55 protected: | 55 protected: |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 EXPECT_FALSE(prefs->DidExtensionEscalatePermissions(extension_id)); | 380 EXPECT_FALSE(prefs->DidExtensionEscalatePermissions(extension_id)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 // Some permissions for v2 extension should be granted by now. | 383 // Some permissions for v2 extension should be granted by now. |
| 384 known_perms = prefs->GetGrantedPermissions(extension_id); | 384 known_perms = prefs->GetGrantedPermissions(extension_id); |
| 385 ASSERT_TRUE(known_perms); | 385 ASSERT_TRUE(known_perms); |
| 386 EXPECT_FALSE(known_perms->IsEmpty()); | 386 EXPECT_FALSE(known_perms->IsEmpty()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace extensions | 389 } // namespace extensions |
| OLD | NEW |