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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/scoped_temp_dir.h" | 14 #include "base/scoped_temp_dir.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 19 #include "content/public/browser/web_contents.h" |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 class Extension; | 22 class Extension; |
22 } | 23 } |
23 | 24 |
24 // Base class for extension browser tests. Provides utilities for loading, | 25 // Base class for extension browser tests. Provides utilities for loading, |
25 // unloading, and installing extensions. | 26 // unloading, and installing extensions. |
26 class ExtensionBrowserTest | 27 class ExtensionBrowserTest |
27 : public InProcessBrowserTest, public content::NotificationObserver { | 28 : public InProcessBrowserTest, public content::NotificationObserver { |
28 protected: | 29 protected: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void WaitForExtensionLoad(); | 130 void WaitForExtensionLoad(); |
130 | 131 |
131 // Waits for an extension load error. Returns true if the error really | 132 // Waits for an extension load error. Returns true if the error really |
132 // happened. | 133 // happened. |
133 bool WaitForExtensionLoadError(); | 134 bool WaitForExtensionLoadError(); |
134 | 135 |
135 // Wait for the specified extension to crash. Returns true if it really | 136 // Wait for the specified extension to crash. Returns true if it really |
136 // crashed. | 137 // crashed. |
137 bool WaitForExtensionCrash(const std::string& extension_id); | 138 bool WaitForExtensionCrash(const std::string& extension_id); |
138 | 139 |
| 140 // Simulates a page calling window.open on an URL and waits for the |
| 141 // navigation. |
| 142 void OpenWindow(content::WebContents* contents, |
| 143 const GURL& url, |
| 144 bool newtab_process_should_equal_opener, |
| 145 content::WebContents** newtab_result); |
| 146 |
| 147 // Simulates a page navigating itself to an URL and waits for the |
| 148 // navigation. |
| 149 void NavigateInRenderer(content::WebContents* contents, const GURL& url); |
| 150 |
139 // content::NotificationObserver | 151 // content::NotificationObserver |
140 virtual void Observe(int type, | 152 virtual void Observe(int type, |
141 const content::NotificationSource& source, | 153 const content::NotificationSource& source, |
142 const content::NotificationDetails& details) OVERRIDE; | 154 const content::NotificationDetails& details) OVERRIDE; |
143 | 155 |
144 bool loaded_; | 156 bool loaded_; |
145 bool installed_; | 157 bool installed_; |
146 | 158 |
147 // test_data/extensions. | 159 // test_data/extensions. |
148 FilePath test_data_dir_; | 160 FilePath test_data_dir_; |
(...skipping 30 matching lines...) Expand all Loading... |
179 // When waiting for page action count to change, we wait until it reaches this | 191 // When waiting for page action count to change, we wait until it reaches this |
180 // value. | 192 // value. |
181 int target_page_action_count_; | 193 int target_page_action_count_; |
182 | 194 |
183 // When waiting for visible page action count to change, we wait until it | 195 // When waiting for visible page action count to change, we wait until it |
184 // reaches this value. | 196 // reaches this value. |
185 int target_visible_page_action_count_; | 197 int target_visible_page_action_count_; |
186 }; | 198 }; |
187 | 199 |
188 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 200 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
OLD | NEW |