| 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_MOCK_IE_EVENT_SINK_ACTIONS_H_ | 5 #ifndef CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ |
| 6 #define CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ | 6 #define CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome_frame/test/chrome_frame_test_utils.h" | 15 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 16 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" | 16 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" |
| 17 #include "chrome_frame/test/ie_event_sink.h" | 17 #include "chrome_frame/test/ie_event_sink.h" |
| 18 #include "chrome_frame/test/mock_ie_event_sink_test.h" | 18 #include "chrome_frame/test/mock_ie_event_sink_test.h" |
| 19 #include "chrome_frame/test/simulate_input.h" | 19 #include "chrome_frame/test/simulate_input.h" |
| 20 #include "gfx/point.h" | 20 #include "gfx/point.h" |
| 21 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 if (got_selection) { | 334 if (got_selection) { |
| 335 EXPECT_EQ(expected_text, actual_text); | 335 EXPECT_EQ(expected_text, actual_text); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Polling actions | 339 // Polling actions |
| 340 | 340 |
| 341 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { | 341 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { |
| 342 base::Time start = base::Time::Now(); | 342 base::Time start = base::Time::Now(); |
| 343 while (!file_util::PathExists(file)) { | 343 while (!file_util::PathExists(file)) { |
| 344 PlatformThread::Sleep(200); | 344 base::PlatformThread::Sleep(200); |
| 345 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 345 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
| 346 ADD_FAILURE() << "File was not saved within timeout"; | 346 ADD_FAILURE() << "File was not saved within timeout"; |
| 347 break; | 347 break; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 mock->event_sink()->CloseWebBrowser(); | 350 mock->event_sink()->CloseWebBrowser(); |
| 351 } | 351 } |
| 352 | 352 |
| 353 ACTION_P2(WaitForFileSave, file, timeout_ms) { | 353 ACTION_P2(WaitForFileSave, file, timeout_ms) { |
| 354 base::Time start = base::Time::Now(); | 354 base::Time start = base::Time::Now(); |
| 355 while (!file_util::PathExists(file)) { | 355 while (!file_util::PathExists(file)) { |
| 356 PlatformThread::Sleep(200); | 356 base::PlatformThread::Sleep(200); |
| 357 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 357 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
| 358 ADD_FAILURE() << "File was not saved within timeout"; | 358 ADD_FAILURE() << "File was not saved within timeout"; |
| 359 break; | 359 break; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 // Flaky actions | 364 // Flaky actions |
| 365 | 365 |
| 366 ACTION_P(SetFocusToRenderer, mock) { | 366 ACTION_P(SetFocusToRenderer, mock) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 393 next_delay = next_delay + kInterval; | 393 next_delay = next_delay + kInterval; |
| 394 | 394 |
| 395 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( | 395 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( |
| 396 simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), | 396 simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), |
| 397 next_delay); | 397 next_delay); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace chrome_frame_test | 400 } // namespace chrome_frame_test |
| 401 | 401 |
| 402 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ | 402 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ |
| OLD | NEW |