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 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/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/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
16 #include "chrome/browser/extensions/extension_test_notification_observer.h" | 16 #include "chrome/browser/extensions/extension_test_notification_observer.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/feature_switch.h" | 19 #include "chrome/common/extensions/feature_switch.h" |
20 #include "chrome/common/extensions/features/feature_channel.h" | 20 #include "chrome/common/extensions/features/feature_channel.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "extensions/common/manifest.h" | 23 #include "extensions/common/manifest.h" |
24 | 24 |
25 class ExtensionProcessManager; | |
26 class ExtensionService; | 25 class ExtensionService; |
27 class ExtensionSet; | 26 class ExtensionSet; |
28 class Profile; | 27 class Profile; |
29 | 28 |
| 29 namespace extensions { |
| 30 class ProcessManager; |
| 31 } |
| 32 |
30 // Base class for extension browser tests. Provides utilities for loading, | 33 // Base class for extension browser tests. Provides utilities for loading, |
31 // unloading, and installing extensions. | 34 // unloading, and installing extensions. |
32 class ExtensionBrowserTest : virtual public InProcessBrowserTest { | 35 class ExtensionBrowserTest : virtual public InProcessBrowserTest { |
33 protected: | 36 protected: |
34 // Flags used to configure how the tests are run. | 37 // Flags used to configure how the tests are run. |
35 enum Flags { | 38 enum Flags { |
36 kFlagNone = 0, | 39 kFlagNone = 0, |
37 | 40 |
38 // Allow the extension to run in incognito mode. | 41 // Allow the extension to run in incognito mode. |
39 kFlagEnableIncognito = 1 << 0, | 42 kFlagEnableIncognito = 1 << 0, |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 bool newtab_process_should_equal_opener, | 258 bool newtab_process_should_equal_opener, |
256 content::WebContents** newtab_result); | 259 content::WebContents** newtab_result); |
257 | 260 |
258 // Simulates a page navigating itself to an URL and waits for the | 261 // Simulates a page navigating itself to an URL and waits for the |
259 // navigation. | 262 // navigation. |
260 void NavigateInRenderer(content::WebContents* contents, const GURL& url); | 263 void NavigateInRenderer(content::WebContents* contents, const GURL& url); |
261 | 264 |
262 // Looks for an ExtensionHost whose URL has the given path component | 265 // Looks for an ExtensionHost whose URL has the given path component |
263 // (including leading slash). Also verifies that the expected number of hosts | 266 // (including leading slash). Also verifies that the expected number of hosts |
264 // are loaded. | 267 // are loaded. |
265 extensions::ExtensionHost* FindHostWithPath(ExtensionProcessManager* manager, | 268 extensions::ExtensionHost* FindHostWithPath( |
266 const std::string& path, | 269 extensions::ProcessManager* manager, |
267 int expected_hosts); | 270 const std::string& path, |
| 271 int expected_hosts); |
| 272 |
268 // Returns | 273 // Returns |
269 // extensions::browsertest_util::ExecuteScriptInBackgroundPage(profile(), | 274 // extensions::browsertest_util::ExecuteScriptInBackgroundPage(profile(), |
270 // extension_id, script). | 275 // extension_id, script). |
271 std::string ExecuteScriptInBackgroundPage(const std::string& extension_id, | 276 std::string ExecuteScriptInBackgroundPage(const std::string& extension_id, |
272 const std::string& script); | 277 const std::string& script); |
273 | 278 |
274 bool loaded_; | 279 bool loaded_; |
275 bool installed_; | 280 bool installed_; |
276 | 281 |
277 // test_data/extensions. | 282 // test_data/extensions. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 330 |
326 // Disable external install UI. | 331 // Disable external install UI. |
327 extensions::FeatureSwitch::ScopedOverride | 332 extensions::FeatureSwitch::ScopedOverride |
328 override_prompt_for_external_extensions_; | 333 override_prompt_for_external_extensions_; |
329 | 334 |
330 // The default profile to be used. | 335 // The default profile to be used. |
331 Profile* profile_; | 336 Profile* profile_; |
332 }; | 337 }; |
333 | 338 |
334 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 339 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
OLD | NEW |