| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
| 6 #include "chrome/browser/cocoa/browser_test_helper.h" | 6 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 7 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 7 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
| 8 #include "chrome/browser/cocoa/extensions/extension_popup_controller.h" | 8 #include "chrome/browser/cocoa/extensions/extension_popup_controller.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 9 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| 10 #include "chrome/browser/extensions/extensions_service.h" | 11 #include "chrome/browser/extensions/extensions_service.h" |
| 11 #include "chrome/test/testing_profile.h" | 12 #include "chrome/test/testing_profile.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 class ExtensionTestingProfile : public TestingProfile { | 16 class ExtensionTestingProfile : public TestingProfile { |
| 16 public: | 17 public: |
| 17 ExtensionTestingProfile() {} | 18 ExtensionTestingProfile() {} |
| 18 | 19 |
| 19 FilePath GetExtensionsInstallDir() { | 20 FilePath GetExtensionsInstallDir() { |
| 20 return GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName); | 21 return GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName); |
| 21 } | 22 } |
| 22 | 23 |
| 23 void InitExtensionProfile() { | 24 void InitExtensionProfile() { |
| 24 DCHECK(!GetExtensionProcessManager()); | 25 DCHECK(!GetExtensionProcessManager()); |
| 25 DCHECK(!GetExtensionsService()); | 26 DCHECK(!GetExtensionsService()); |
| 26 | 27 |
| 27 manager_.reset(ExtensionProcessManager::Create(this)); | 28 manager_.reset(ExtensionProcessManager::Create(this)); |
| 29 ExtensionPrefs* extension_prefs = new ExtensionPrefs( |
| 30 GetPrefs(), |
| 31 GetExtensionsInstallDir()); |
| 28 service_ = new ExtensionsService(this, | 32 service_ = new ExtensionsService(this, |
| 29 CommandLine::ForCurrentProcess(), | 33 CommandLine::ForCurrentProcess(), |
| 30 GetExtensionsInstallDir(), | 34 GetExtensionsInstallDir(), |
| 35 extension_prefs, |
| 31 false); | 36 false); |
| 32 service_->set_extensions_enabled(true); | 37 service_->set_extensions_enabled(true); |
| 33 service_->set_show_extensions_prompts(false); | 38 service_->set_show_extensions_prompts(false); |
| 34 service_->ClearProvidersForTesting(); | 39 service_->ClearProvidersForTesting(); |
| 35 service_->Init(); | 40 service_->Init(); |
| 36 } | 41 } |
| 37 | 42 |
| 38 void ShutdownExtensionProfile() { | 43 void ShutdownExtensionProfile() { |
| 39 manager_.reset(); | 44 manager_.reset(); |
| 40 service_ = NULL; | 45 service_ = NULL; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 }; | 85 }; |
| 81 | 86 |
| 82 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) { | 87 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) { |
| 83 // TODO(andybons): Better mechanisms for mocking out the extensions service | 88 // TODO(andybons): Better mechanisms for mocking out the extensions service |
| 84 // and extensions for easy testing need to be implemented. | 89 // and extensions for easy testing need to be implemented. |
| 85 // http://crbug.com/28316 | 90 // http://crbug.com/28316 |
| 86 EXPECT_TRUE([ExtensionPopupController popup]); | 91 EXPECT_TRUE([ExtensionPopupController popup]); |
| 87 } | 92 } |
| 88 | 93 |
| 89 } // namespace | 94 } // namespace |
| OLD | NEW |