| 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; | |
| 26 | 25 |
| 27 // Base class for extension browser tests. Provides utilities for loading, | 26 // Base class for extension browser tests. Provides utilities for loading, |
| 28 // unloading, and installing extensions. | 27 // unloading, and installing extensions. |
| 29 class ExtensionBrowserTest : virtual public InProcessBrowserTest, | 28 class ExtensionBrowserTest : virtual public InProcessBrowserTest, |
| 30 public content::NotificationObserver { | 29 public content::NotificationObserver { |
| 31 protected: | 30 protected: |
| 32 // Flags used to configure how the tests are run. | 31 // Flags used to configure how the tests are run. |
| 33 enum Flags { | 32 enum Flags { |
| 34 kFlagNone = 0, | 33 kFlagNone = 0, |
| 35 | 34 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // happened. | 162 // happened. |
| 164 bool WaitForExtensionLoadError(); | 163 bool WaitForExtensionLoadError(); |
| 165 | 164 |
| 166 // Wait for the specified extension to crash. Returns true if it really | 165 // Wait for the specified extension to crash. Returns true if it really |
| 167 // crashed. | 166 // crashed. |
| 168 bool WaitForExtensionCrash(const std::string& extension_id); | 167 bool WaitForExtensionCrash(const std::string& extension_id); |
| 169 | 168 |
| 170 // Wait for the crx installer to be done. Returns true if it really is done. | 169 // Wait for the crx installer to be done. Returns true if it really is done. |
| 171 bool WaitForCrxInstallerDone(); | 170 bool WaitForCrxInstallerDone(); |
| 172 | 171 |
| 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 | |
| 180 // Simulates a page calling window.open on an URL and waits for the | 172 // Simulates a page calling window.open on an URL and waits for the |
| 181 // navigation. | 173 // navigation. |
| 182 void OpenWindow(content::WebContents* contents, | 174 void OpenWindow(content::WebContents* contents, |
| 183 const GURL& url, | 175 const GURL& url, |
| 184 bool newtab_process_should_equal_opener, | 176 bool newtab_process_should_equal_opener, |
| 185 content::WebContents** newtab_result); | 177 content::WebContents** newtab_result); |
| 186 | 178 |
| 187 // Simulates a page navigating itself to an URL and waits for the | 179 // Simulates a page navigating itself to an URL and waits for the |
| 188 // navigation. | 180 // navigation. |
| 189 void NavigateInRenderer(content::WebContents* contents, const GURL& url); | 181 void NavigateInRenderer(content::WebContents* contents, const GURL& url); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Disable external install UI. | 256 // Disable external install UI. |
| 265 extensions::FeatureSwitch::ScopedOverride | 257 extensions::FeatureSwitch::ScopedOverride |
| 266 override_prompt_for_external_extensions_; | 258 override_prompt_for_external_extensions_; |
| 267 | 259 |
| 268 // Disable the sideload wipeout UI. | 260 // Disable the sideload wipeout UI. |
| 269 extensions::FeatureSwitch::ScopedOverride | 261 extensions::FeatureSwitch::ScopedOverride |
| 270 override_sideload_wipeout_; | 262 override_sideload_wipeout_; |
| 271 }; | 263 }; |
| 272 | 264 |
| 273 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 265 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |