| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/feature_switch.h" | 16 #include "chrome/common/extensions/feature_switch.h" |
| 17 #include "chrome/common/extensions/features/feature.h" | 17 #include "chrome/common/extensions/features/feature.h" |
| 18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 | 23 |
| 24 class ExtensionProcessManager; | 24 class ExtensionProcessManager; |
| 25 class ShellWindow; |
| 25 | 26 |
| 26 // Base class for extension browser tests. Provides utilities for loading, | 27 // Base class for extension browser tests. Provides utilities for loading, |
| 27 // unloading, and installing extensions. | 28 // unloading, and installing extensions. |
| 28 class ExtensionBrowserTest : virtual public InProcessBrowserTest, | 29 class ExtensionBrowserTest : virtual public InProcessBrowserTest, |
| 29 public content::NotificationObserver { | 30 public content::NotificationObserver { |
| 30 protected: | 31 protected: |
| 31 // Flags used to configure how the tests are run. | 32 // Flags used to configure how the tests are run. |
| 32 enum Flags { | 33 enum Flags { |
| 33 kFlagNone = 0, | 34 kFlagNone = 0, |
| 34 | 35 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // happened. | 163 // happened. |
| 163 bool WaitForExtensionLoadError(); | 164 bool WaitForExtensionLoadError(); |
| 164 | 165 |
| 165 // Wait for the specified extension to crash. Returns true if it really | 166 // Wait for the specified extension to crash. Returns true if it really |
| 166 // crashed. | 167 // crashed. |
| 167 bool WaitForExtensionCrash(const std::string& extension_id); | 168 bool WaitForExtensionCrash(const std::string& extension_id); |
| 168 | 169 |
| 169 // Wait for the crx installer to be done. Returns true if it really is done. | 170 // Wait for the crx installer to be done. Returns true if it really is done. |
| 170 bool WaitForCrxInstallerDone(); | 171 bool WaitForCrxInstallerDone(); |
| 171 | 172 |
| 173 // Closes |window| and waits until it's gone. |
| 174 void CloseShellWindow(ShellWindow* window); |
| 175 |
| 176 // Close any Shell Windows and wait for the app's background page to be |
| 177 // unloaded. |
| 178 void CloseShellWindowsAndWaitForAppToExit(); |
| 179 |
| 172 // Simulates a page calling window.open on an URL and waits for the | 180 // Simulates a page calling window.open on an URL and waits for the |
| 173 // navigation. | 181 // navigation. |
| 174 void OpenWindow(content::WebContents* contents, | 182 void OpenWindow(content::WebContents* contents, |
| 175 const GURL& url, | 183 const GURL& url, |
| 176 bool newtab_process_should_equal_opener, | 184 bool newtab_process_should_equal_opener, |
| 177 content::WebContents** newtab_result); | 185 content::WebContents** newtab_result); |
| 178 | 186 |
| 179 // Simulates a page navigating itself to an URL and waits for the | 187 // Simulates a page navigating itself to an URL and waits for the |
| 180 // navigation. | 188 // navigation. |
| 181 void NavigateInRenderer(content::WebContents* contents, const GURL& url); | 189 void NavigateInRenderer(content::WebContents* contents, const GURL& url); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // Disable external install UI. | 264 // Disable external install UI. |
| 257 extensions::FeatureSwitch::ScopedOverride | 265 extensions::FeatureSwitch::ScopedOverride |
| 258 override_prompt_for_external_extensions_; | 266 override_prompt_for_external_extensions_; |
| 259 | 267 |
| 260 // Disable the sideload wipeout UI. | 268 // Disable the sideload wipeout UI. |
| 261 extensions::FeatureSwitch::ScopedOverride | 269 extensions::FeatureSwitch::ScopedOverride |
| 262 override_sideload_wipeout_; | 270 override_sideload_wipeout_; |
| 263 }; | 271 }; |
| 264 | 272 |
| 265 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 273 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |