| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, | 45 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, |
| 46 expected_change); | 46 expected_change); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Same as |InstallExtension| but with the normal extension UI showing up | 49 // Same as |InstallExtension| but with the normal extension UI showing up |
| 50 // (for e.g. info bar on success). | 50 // (for e.g. info bar on success). |
| 51 bool InstallExtensionWithUI(const FilePath& path, int expected_change) { | 51 bool InstallExtensionWithUI(const FilePath& path, int expected_change) { |
| 52 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, | 52 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, |
| 53 expected_change); | 53 expected_change); |
| 54 } | 54 } |
| 55 bool InstallExtensionWithUIAutoConfirm(const FilePath& path, |
| 56 int expected_change, |
| 57 Profile* profile) { |
| 58 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, |
| 59 expected_change, profile); |
| 60 } |
| 55 | 61 |
| 56 // Begins install process but simulates a user cancel. | 62 // Begins install process but simulates a user cancel. |
| 57 bool StartInstallButCancel(const FilePath& path) { | 63 bool StartInstallButCancel(const FilePath& path) { |
| 58 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); | 64 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); |
| 59 } | 65 } |
| 60 | 66 |
| 61 void ReloadExtension(const std::string& extension_id); | 67 void ReloadExtension(const std::string& extension_id); |
| 62 | 68 |
| 63 void UnloadExtension(const std::string& extension_id); | 69 void UnloadExtension(const std::string& extension_id); |
| 64 | 70 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 std::string last_loaded_extension_id_; | 108 std::string last_loaded_extension_id_; |
| 103 int extension_installs_observed_; | 109 int extension_installs_observed_; |
| 104 | 110 |
| 105 private: | 111 private: |
| 106 // Specifies the type of UI (if any) to show during installation and what | 112 // Specifies the type of UI (if any) to show during installation and what |
| 107 // user action to simulate. | 113 // user action to simulate. |
| 108 enum InstallUIType { | 114 enum InstallUIType { |
| 109 INSTALL_UI_TYPE_NONE, | 115 INSTALL_UI_TYPE_NONE, |
| 110 INSTALL_UI_TYPE_CANCEL, | 116 INSTALL_UI_TYPE_CANCEL, |
| 111 INSTALL_UI_TYPE_NORMAL, | 117 INSTALL_UI_TYPE_NORMAL, |
| 118 INSTALL_UI_TYPE_AUTO_CONFIRM, |
| 112 }; | 119 }; |
| 113 | 120 |
| 114 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, | 121 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, |
| 115 InstallUIType ui_type, | 122 InstallUIType ui_type, |
| 116 int expected_change); | 123 int expected_change); |
| 124 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, |
| 125 InstallUIType ui_type, |
| 126 int expected_change, |
| 127 Profile* profile); |
| 117 bool LoadExtensionImpl(const FilePath& path, bool incognito_enabled); | 128 bool LoadExtensionImpl(const FilePath& path, bool incognito_enabled); |
| 118 | 129 |
| 119 bool WaitForExtensionHostsToLoad(); | 130 bool WaitForExtensionHostsToLoad(); |
| 120 | 131 |
| 121 // When waiting for page action count to change, we wait until it reaches this | 132 // When waiting for page action count to change, we wait until it reaches this |
| 122 // value. | 133 // value. |
| 123 int target_page_action_count_; | 134 int target_page_action_count_; |
| 124 | 135 |
| 125 // When waiting for visible page action count to change, we wait until it | 136 // When waiting for visible page action count to change, we wait until it |
| 126 // reaches this value. | 137 // reaches this value. |
| 127 int target_visible_page_action_count_; | 138 int target_visible_page_action_count_; |
| 128 }; | 139 }; |
| 129 | 140 |
| 130 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 141 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |