| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" | 8 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
| 8 #include "chrome/browser/extensions/error_console/error_console.h" | 9 #include "chrome/browser/extensions/error_console/error_console.h" |
| 9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_service_test_base.h" | 12 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 12 #include "chrome/browser/extensions/extension_util.h" | 13 #include "chrome/browser/extensions/extension_util.h" |
| 13 #include "chrome/browser/extensions/test_extension_dir.h" | 14 #include "chrome/browser/extensions/test_extension_dir.h" |
| 14 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
| 15 #include "chrome/browser/extensions/unpacked_installer.h" | 16 #include "chrome/browser/extensions/unpacked_installer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 31 #include "extensions/common/extension_set.h" | 32 #include "extensions/common/extension_set.h" |
| 32 #include "extensions/common/feature_switch.h" | 33 #include "extensions/common/feature_switch.h" |
| 33 #include "extensions/common/manifest_constants.h" | 34 #include "extensions/common/manifest_constants.h" |
| 34 #include "extensions/common/test_util.h" | 35 #include "extensions/common/test_util.h" |
| 35 #include "extensions/common/value_builder.h" | 36 #include "extensions/common/value_builder.h" |
| 36 | 37 |
| 37 namespace extensions { | 38 namespace extensions { |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 KeyedService* BuildAPI(content::BrowserContext* context) { | 42 scoped_ptr<KeyedService> BuildAPI(content::BrowserContext* context) { |
| 42 return new DeveloperPrivateAPI(context); | 43 return make_scoped_ptr(new DeveloperPrivateAPI(context)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 KeyedService* BuildEventRouter(content::BrowserContext* profile) { | 46 scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) { |
| 46 return new EventRouter(profile, ExtensionPrefs::Get(profile)); | 47 return make_scoped_ptr( |
| 48 new EventRouter(profile, ExtensionPrefs::Get(profile))); |
| 47 } | 49 } |
| 48 | 50 |
| 49 } // namespace | 51 } // namespace |
| 50 | 52 |
| 51 class DeveloperPrivateApiUnitTest : public ExtensionServiceTestBase { | 53 class DeveloperPrivateApiUnitTest : public ExtensionServiceTestBase { |
| 52 protected: | 54 protected: |
| 53 DeveloperPrivateApiUnitTest() {} | 55 DeveloperPrivateApiUnitTest() {} |
| 54 ~DeveloperPrivateApiUnitTest() override {} | 56 ~DeveloperPrivateApiUnitTest() override {} |
| 55 | 57 |
| 56 // A wrapper around extension_function_test_utils::RunFunction that runs with | 58 // A wrapper around extension_function_test_utils::RunFunction that runs with |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 args = ListBuilder() | 533 args = ListBuilder() |
| 532 .Append(DictionaryBuilder().Set("extensionId", extension->id())) | 534 .Append(DictionaryBuilder().Set("extensionId", extension->id())) |
| 533 .Build(); | 535 .Build(); |
| 534 function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); | 536 function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); |
| 535 EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); | 537 EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); |
| 536 // No more errors! | 538 // No more errors! |
| 537 EXPECT_TRUE(error_console->GetErrorsForExtension(extension->id()).empty()); | 539 EXPECT_TRUE(error_console->GetErrorsForExtension(extension->id()).empty()); |
| 538 } | 540 } |
| 539 | 541 |
| 540 } // namespace extensions | 542 } // namespace extensions |
| OLD | NEW |