| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTILS_H
_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTILS_H
_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTILS_H
_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTILS_H
_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 10 | 10 |
| 11 namespace chrome { | 11 namespace chrome { |
| 12 | 12 |
| 13 // A simple delegate implementation that counts the number of times | |
| 14 // |InstallUIProceed| and |InstallUIAbort| are called. | |
| 15 class MockExtensionInstallPromptDelegate | |
| 16 : public ExtensionInstallPrompt::Delegate { | |
| 17 public: | |
| 18 MockExtensionInstallPromptDelegate() | |
| 19 : proceed_count_(0), | |
| 20 abort_count_(0) {} | |
| 21 | |
| 22 // ExtensionInstallPrompt::Delegate overrides. | |
| 23 void InstallUIProceed() override; | |
| 24 void InstallUIAbort(bool user_initiated) override; | |
| 25 | |
| 26 int proceed_count() { return proceed_count_; } | |
| 27 int abort_count() { return abort_count_; } | |
| 28 | |
| 29 protected: | |
| 30 int proceed_count_; | |
| 31 int abort_count_; | |
| 32 }; | |
| 33 | |
| 34 // Loads the test extension from the given test directory and manifest file. | 13 // Loads the test extension from the given test directory and manifest file. |
| 35 scoped_refptr<extensions::Extension> LoadInstallPromptExtension( | 14 scoped_refptr<extensions::Extension> LoadInstallPromptExtension( |
| 36 const char* extension_dir_name, | 15 const char* extension_dir_name, |
| 37 const char* manifest_file); | 16 const char* manifest_file); |
| 38 | 17 |
| 39 // Loads the default install_prompt test extension. | 18 // Loads the default install_prompt test extension. |
| 40 scoped_refptr<extensions::Extension> LoadInstallPromptExtension(); | 19 scoped_refptr<extensions::Extension> LoadInstallPromptExtension(); |
| 41 | 20 |
| 42 // Loads the icon for the install prompt extension. | 21 // Loads the icon for the install prompt extension. |
| 43 gfx::Image LoadInstallPromptIcon(); | 22 gfx::Image LoadInstallPromptIcon(); |
| 44 | 23 |
| 45 // Builds a prompt using the given extension. | 24 // Builds a prompt using the given extension. |
| 46 scoped_ptr<ExtensionInstallPrompt::Prompt> BuildExtensionInstallPrompt( | 25 scoped_ptr<ExtensionInstallPrompt::Prompt> BuildExtensionInstallPrompt( |
| 47 extensions::Extension* extension); | 26 extensions::Extension* extension); |
| 48 | 27 |
| 49 scoped_ptr<ExtensionInstallPrompt::Prompt> | 28 scoped_ptr<ExtensionInstallPrompt::Prompt> |
| 50 BuildExtensionPostInstallPermissionsPrompt(extensions::Extension* extension); | 29 BuildExtensionPostInstallPermissionsPrompt(extensions::Extension* extension); |
| 51 | 30 |
| 52 } // namespace chrome | 31 } // namespace chrome |
| 53 | 32 |
| 54 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTIL
S_H_ | 33 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_UTIL
S_H_ |
| OLD | NEW |