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_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 <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 EXPECT_TRUE(got_selection); | 378 EXPECT_TRUE(got_selection); |
379 if (got_selection) { | 379 if (got_selection) { |
380 EXPECT_EQ(expected_text, actual_text); | 380 EXPECT_EQ(expected_text, actual_text); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 // Polling actions | 384 // Polling actions |
385 | 385 |
386 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { | 386 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { |
387 base::Time start = base::Time::Now(); | 387 base::Time start = base::Time::Now(); |
388 while (!file_util::PathExists(file)) { | 388 while (!base::PathExists(file)) { |
389 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 389 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
390 ADD_FAILURE() << "File was not saved within timeout"; | 390 ADD_FAILURE() << "File was not saved within timeout"; |
391 TakeSnapshotAndLog(); | 391 TakeSnapshotAndLog(); |
392 break; | 392 break; |
393 } | 393 } |
394 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); | 394 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); |
395 } | 395 } |
396 mock->event_sink()->CloseWebBrowser(); | 396 mock->event_sink()->CloseWebBrowser(); |
397 } | 397 } |
398 | 398 |
399 ACTION_P2(WaitForFileSave, file, timeout_ms) { | 399 ACTION_P2(WaitForFileSave, file, timeout_ms) { |
400 base::Time start = base::Time::Now(); | 400 base::Time start = base::Time::Now(); |
401 while (!file_util::PathExists(file)) { | 401 while (!base::PathExists(file)) { |
402 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); | 402 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); |
403 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { | 403 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { |
404 ADD_FAILURE() << "File was not saved within timeout"; | 404 ADD_FAILURE() << "File was not saved within timeout"; |
405 TakeSnapshotAndLog(); | 405 TakeSnapshotAndLog(); |
406 break; | 406 break; |
407 } | 407 } |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 // Flaky actions | 411 // Flaky actions |
(...skipping 29 matching lines...) Expand all Loading... |
441 | 441 |
442 loop->PostDelayedTask( | 442 loop->PostDelayedTask( |
443 FROM_HERE, | 443 FROM_HERE, |
444 base::Bind(simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), | 444 base::Bind(simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), |
445 next_delay); | 445 next_delay); |
446 } | 446 } |
447 | 447 |
448 } // namespace chrome_frame_test | 448 } // namespace chrome_frame_test |
449 | 449 |
450 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ | 450 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ |
OLD | NEW |