OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <string> | 10 #include <string> |
11 #include <exdisp.h> | 11 #include <exdisp.h> |
12 #include <exdispid.h> | 12 #include <exdispid.h> |
13 #include <mshtml.h> | 13 #include <mshtml.h> |
14 #include <shlguid.h> | 14 #include <shlguid.h> |
15 #include <shobjidl.h> | 15 #include <shobjidl.h> |
16 #include <windows.h> | 16 #include <windows.h> |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
21 #include "base/scoped_comptr_win.h" | 21 #include "base/scoped_comptr_win.h" |
22 #include "base/scoped_variant_win.h" | 22 #include "base/scoped_variant_win.h" |
23 | |
24 #include "chrome_frame/test_utils.h" | 23 #include "chrome_frame/test_utils.h" |
25 #include "chrome_frame/test/simulate_input.h" | 24 #include "chrome_frame/test/simulate_input.h" |
26 #include "chrome_frame/test/window_watchdog.h" | 25 #include "chrome_frame/test/window_watchdog.h" |
27 #include "chrome_frame/utils.h" | 26 #include "chrome_frame/utils.h" |
| 27 #include "gmock/gmock.h" |
28 | 28 |
29 // Include without path to make GYP build see it. | 29 // Include without path to make GYP build see it. |
30 #include "chrome_tab.h" // NOLINT | 30 #include "chrome_tab.h" // NOLINT |
31 | 31 |
32 namespace chrome_frame_test { | 32 namespace chrome_frame_test { |
33 | 33 |
34 int CloseVisibleWindowsOnAllThreads(HANDLE process); | 34 int CloseVisibleWindowsOnAllThreads(HANDLE process); |
35 | 35 |
36 base::ProcessHandle LaunchFirefox(const std::wstring& url); | 36 base::ProcessHandle LaunchFirefox(const std::wstring& url); |
37 base::ProcessHandle LaunchOpera(const std::wstring& url); | 37 base::ProcessHandle LaunchOpera(const std::wstring& url); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 // Returns the profile path to be used for IE. This varies as per version. | 339 // Returns the profile path to be used for IE. This varies as per version. |
340 FilePath GetProfilePathForIE(); | 340 FilePath GetProfilePathForIE(); |
341 | 341 |
342 // Returns the version of the exe passed in. | 342 // Returns the version of the exe passed in. |
343 std::wstring GetExeVersion(const std::wstring& exe_path); | 343 std::wstring GetExeVersion(const std::wstring& exe_path); |
344 | 344 |
345 // Returns the version of Internet Explorer on the machine. | 345 // Returns the version of Internet Explorer on the machine. |
346 IEVersion GetInstalledIEVersion(); | 346 IEVersion GetInstalledIEVersion(); |
347 | 347 |
| 348 // Posts a delayed task to send an extended keystroke |repeat| times with an |
| 349 // optional modifier via SendInput. Following this, the enter key is sent. |
| 350 void DelaySendExtendedKeysEnter(TimedMsgLoop* loop, int delay, char c, |
| 351 int repeat, simulate_input::Modifier mod); |
| 352 |
| 353 // Returns an action which posts a delayed task that sends the given |
| 354 // scan code via SendInput. |
| 355 ACTION_P4(DelaySendScanCode, loop, delay, c, mod) { |
| 356 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( |
| 357 simulate_input::SendScanCode, c, mod), delay); |
| 358 } |
| 359 |
348 // A convenience class to close all open IE windows at the end | 360 // A convenience class to close all open IE windows at the end |
349 // of a scope. It's more convenient to do it this way than to | 361 // of a scope. It's more convenient to do it this way than to |
350 // explicitly call chrome_frame_test::CloseAllIEWindows at the | 362 // explicitly call chrome_frame_test::CloseAllIEWindows at the |
351 // end of a test since part of the test's cleanup code may be | 363 // end of a test since part of the test's cleanup code may be |
352 // in object destructors that would run after CloseAllIEWindows | 364 // in object destructors that would run after CloseAllIEWindows |
353 // would get called. | 365 // would get called. |
354 // Ideally all IE windows should be closed when this happens so | 366 // Ideally all IE windows should be closed when this happens so |
355 // if the test ran normally, we should not have any windows to | 367 // if the test ran normally, we should not have any windows to |
356 // close at this point. | 368 // close at this point. |
357 class CloseIeAtEndOfScope { | 369 class CloseIeAtEndOfScope { |
(...skipping 16 matching lines...) Expand all Loading... |
374 class ComStackObjectWithUninitialize : public CComObjectStackEx<Base> { | 386 class ComStackObjectWithUninitialize : public CComObjectStackEx<Base> { |
375 public: | 387 public: |
376 virtual ~ComStackObjectWithUninitialize() { | 388 virtual ~ComStackObjectWithUninitialize() { |
377 Base::Uninitialize(); | 389 Base::Uninitialize(); |
378 } | 390 } |
379 }; | 391 }; |
380 | 392 |
381 } // namespace chrome_frame_test | 393 } // namespace chrome_frame_test |
382 | 394 |
383 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 395 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
OLD | NEW |