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_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 5 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome_frame/test/simulate_input.h" | 30 #include "chrome_frame/test/simulate_input.h" |
31 #include "chrome_frame/test_utils.h" | 31 #include "chrome_frame/test_utils.h" |
32 #include "chrome_frame/utils.h" | 32 #include "chrome_frame/utils.h" |
33 | 33 |
34 #include "gtest/gtest.h" | 34 #include "gtest/gtest.h" |
35 | 35 |
36 // Needed for CreateFunctor. | 36 // Needed for CreateFunctor. |
37 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING | 37 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
38 #include "testing/gmock_mutant.h" | 38 #include "testing/gmock_mutant.h" |
39 | 39 |
| 40 interface IWebBrowser2; |
| 41 |
| 42 namespace base { |
40 class FilePath; | 43 class FilePath; |
41 interface IWebBrowser2; | 44 } |
42 | 45 |
43 namespace chrome_frame_test { | 46 namespace chrome_frame_test { |
44 | 47 |
45 int CloseVisibleWindowsOnAllThreads(HANDLE process); | 48 int CloseVisibleWindowsOnAllThreads(HANDLE process); |
46 | 49 |
47 base::ProcessHandle LaunchIE(const std::wstring& url); | 50 base::ProcessHandle LaunchIE(const std::wstring& url); |
48 base::ProcessHandle LaunchChrome(const std::wstring& url, | 51 base::ProcessHandle LaunchChrome(const std::wstring& url, |
49 const FilePath& user_data_dir); | 52 const base::FilePath& user_data_dir); |
50 | 53 |
51 // Attempts to close all open IE windows. | 54 // Attempts to close all open IE windows. |
52 // The return value is the number of windows closed. | 55 // The return value is the number of windows closed. |
53 // @note: this function requires COM to be initialized on the calling thread. | 56 // @note: this function requires COM to be initialized on the calling thread. |
54 // Since the caller might be running in either MTA or STA, the function does | 57 // Since the caller might be running in either MTA or STA, the function does |
55 // not perform this initialization itself. | 58 // not perform this initialization itself. |
56 int CloseAllIEWindows(); | 59 int CloseAllIEWindows(); |
57 | 60 |
58 extern const wchar_t kIEImageName[]; | 61 extern const wchar_t kIEImageName[]; |
59 extern const wchar_t kIEBrokerImageName[]; | 62 extern const wchar_t kIEBrokerImageName[]; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 bool WasTimedOut() const { | 239 bool WasTimedOut() const { |
237 return !quit_loop_invoked_; | 240 return !quit_loop_invoked_; |
238 } | 241 } |
239 | 242 |
240 void RunUntilIdle() { | 243 void RunUntilIdle() { |
241 loop_.RunUntilIdle(); | 244 loop_.RunUntilIdle(); |
242 } | 245 } |
243 | 246 |
244 private: | 247 private: |
245 static void SnapshotAndQuit() { | 248 static void SnapshotAndQuit() { |
246 FilePath snapshot; | 249 base::FilePath snapshot; |
247 if (ui_test_utils::SaveScreenSnapshotToDesktop(&snapshot)) { | 250 if (ui_test_utils::SaveScreenSnapshotToDesktop(&snapshot)) { |
248 testing::UnitTest* unit_test = testing::UnitTest::GetInstance(); | 251 testing::UnitTest* unit_test = testing::UnitTest::GetInstance(); |
249 const testing::TestInfo* test_info = unit_test->current_test_info(); | 252 const testing::TestInfo* test_info = unit_test->current_test_info(); |
250 std::string name; | 253 std::string name; |
251 if (test_info != NULL) { | 254 if (test_info != NULL) { |
252 name.append(test_info->test_case_name()) | 255 name.append(test_info->test_case_name()) |
253 .append(1, '.') | 256 .append(1, '.') |
254 .append(test_info->name()); | 257 .append(test_info->name()); |
255 } else { | 258 } else { |
256 name = "unknown test"; | 259 name = "unknown test"; |
(...skipping 22 matching lines...) Expand all Loading... |
279 | 282 |
280 // Launches IE as a COM server and returns the corresponding IWebBrowser2 | 283 // Launches IE as a COM server and returns the corresponding IWebBrowser2 |
281 // interface pointer. | 284 // interface pointer. |
282 // Returns S_OK on success. | 285 // Returns S_OK on success. |
283 HRESULT LaunchIEAsComServer(IWebBrowser2** web_browser); | 286 HRESULT LaunchIEAsComServer(IWebBrowser2** web_browser); |
284 | 287 |
285 // Returns the path of the exe passed in. | 288 // Returns the path of the exe passed in. |
286 std::wstring GetExecutableAppPath(const std::wstring& file); | 289 std::wstring GetExecutableAppPath(const std::wstring& file); |
287 | 290 |
288 // Returns the profile path to be used for IE. This varies as per version. | 291 // Returns the profile path to be used for IE. This varies as per version. |
289 FilePath GetProfilePathForIE(); | 292 base::FilePath GetProfilePathForIE(); |
290 | 293 |
291 // Returns the version of the exe passed in. | 294 // Returns the version of the exe passed in. |
292 std::wstring GetExeVersion(const std::wstring& exe_path); | 295 std::wstring GetExeVersion(const std::wstring& exe_path); |
293 | 296 |
294 // Returns the version of Internet Explorer on the machine. | 297 // Returns the version of Internet Explorer on the machine. |
295 IEVersion GetInstalledIEVersion(); | 298 IEVersion GetInstalledIEVersion(); |
296 | 299 |
297 // Returns the folder for CF test data. | 300 // Returns the folder for CF test data. |
298 FilePath GetTestDataFolder(); | 301 base::FilePath GetTestDataFolder(); |
299 | 302 |
300 // Returns the folder for Selenium core. | 303 // Returns the folder for Selenium core. |
301 FilePath GetSeleniumTestFolder(); | 304 base::FilePath GetSeleniumTestFolder(); |
302 | 305 |
303 // Returns the path portion of the url. | 306 // Returns the path portion of the url. |
304 std::wstring GetPathFromUrl(const std::wstring& url); | 307 std::wstring GetPathFromUrl(const std::wstring& url); |
305 | 308 |
306 // Returns the path and query portion of the url. | 309 // Returns the path and query portion of the url. |
307 std::wstring GetPathAndQueryFromUrl(const std::wstring& url); | 310 std::wstring GetPathAndQueryFromUrl(const std::wstring& url); |
308 | 311 |
309 // Adds the CF meta tag to the html page. Returns true if successful. | 312 // Adds the CF meta tag to the html page. Returns true if successful. |
310 bool AddCFMetaTag(std::string* html_data); | 313 bool AddCFMetaTag(std::string* html_data); |
311 | 314 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } // namespace chrome_frame_test | 377 } // namespace chrome_frame_test |
375 | 378 |
376 // TODO(tommi): This is a temporary workaround while we're getting our | 379 // TODO(tommi): This is a temporary workaround while we're getting our |
377 // Singleton story straight. Ideally each test should clear up any singletons | 380 // Singleton story straight. Ideally each test should clear up any singletons |
378 // it might have created, but test cases do not implicitly have their own | 381 // it might have created, but test cases do not implicitly have their own |
379 // AtExitManager, so we have this workaround method for tests that depend on | 382 // AtExitManager, so we have this workaround method for tests that depend on |
380 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. | 383 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. |
381 void DeleteAllSingletons(); | 384 void DeleteAllSingletons(); |
382 | 385 |
383 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 386 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
OLD | NEW |