OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 if (got_selection) { | 340 if (got_selection) { |
341 EXPECT_EQ(expected_text, actual_text); | 341 EXPECT_EQ(expected_text, actual_text); |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 // Polling actions | 345 // Polling actions |
346 | 346 |
347 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { | 347 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { |
348 base::Time start = base::Time::Now(); | 348 base::Time start = base::Time::Now(); |
349 while (!file_util::PathExists(file)) { | 349 while (!file_util::PathExists(file)) { |
350 base::PlatformThread::Sleep(200); | |
351 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 350 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
352 ADD_FAILURE() << "File was not saved within timeout"; | 351 ADD_FAILURE() << "File was not saved within timeout"; |
353 break; | 352 break; |
354 } | 353 } |
| 354 base::PlatformThread::Sleep(200); |
355 } | 355 } |
356 mock->event_sink()->CloseWebBrowser(); | 356 mock->event_sink()->CloseWebBrowser(); |
357 } | 357 } |
358 | 358 |
359 ACTION_P2(WaitForFileSave, file, timeout_ms) { | 359 ACTION_P2(WaitForFileSave, file, timeout_ms) { |
360 base::Time start = base::Time::Now(); | 360 base::Time start = base::Time::Now(); |
361 while (!file_util::PathExists(file)) { | 361 while (!file_util::PathExists(file)) { |
362 base::PlatformThread::Sleep(200); | 362 base::PlatformThread::Sleep(200); |
363 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 363 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
364 ADD_FAILURE() << "File was not saved within timeout"; | 364 ADD_FAILURE() << "File was not saved within timeout"; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 next_delay = next_delay + kInterval; | 399 next_delay = next_delay + kInterval; |
400 | 400 |
401 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( | 401 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( |
402 simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), | 402 simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), |
403 next_delay); | 403 next_delay); |
404 } | 404 } |
405 | 405 |
406 } // namespace chrome_frame_test | 406 } // namespace chrome_frame_test |
407 | 407 |
408 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ | 408 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ |
OLD | NEW |