Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome_frame/test/mock_ie_event_sink_actions.h

Issue 12779010: Attempt to fix flake in FullTabDownloadTest.CF_DownloadFileFromPost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: motion to fix other test binaries Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/navigation_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/test/test_process_killer_win.h" 16 #include "base/test/test_process_killer_win.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" 20 #include "chrome_frame/test/chrome_frame_test_utils.h"
21 #include "chrome_frame/test/ie_event_sink.h" 21 #include "chrome_frame/test/ie_event_sink.h"
22 #include "chrome_frame/test/mock_ie_event_sink_test.h" 22 #include "chrome_frame/test/mock_ie_event_sink_test.h"
23 #include "chrome_frame/test/simulate_input.h" 23 #include "chrome_frame/test/simulate_input.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "ui/gfx/point.h" 25 #include "ui/gfx/point.h"
26 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
27 27
28 namespace chrome_frame_test { 28 namespace chrome_frame_test {
29 29
30 MATCHER_P(UrlPathEq, url, "equals the path and query portion of the url") { 30 MATCHER_P(UrlPathEq, url, "equals the path and query portion of the url") {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 } 383 }
384 384
385 // Polling actions 385 // Polling actions
386 386
387 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { 387 ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) {
388 base::Time start = base::Time::Now(); 388 base::Time start = base::Time::Now();
389 while (!file_util::PathExists(file)) { 389 while (!file_util::PathExists(file)) {
390 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { 390 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) {
391 ADD_FAILURE() << "File was not saved within timeout"; 391 ADD_FAILURE() << "File was not saved within timeout";
392 TakeSnapshotAndLog();
392 break; 393 break;
393 } 394 }
394 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); 395 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200));
395 } 396 }
396 mock->event_sink()->CloseWebBrowser(); 397 mock->event_sink()->CloseWebBrowser();
397 } 398 }
398 399
399 ACTION_P2(WaitForFileSave, file, timeout_ms) { 400 ACTION_P2(WaitForFileSave, file, timeout_ms) {
400 base::Time start = base::Time::Now(); 401 base::Time start = base::Time::Now();
401 while (!file_util::PathExists(file)) { 402 while (!file_util::PathExists(file)) {
402 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); 403 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200));
403 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { 404 if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) {
404 ADD_FAILURE() << "File was not saved within timeout"; 405 ADD_FAILURE() << "File was not saved within timeout";
406 TakeSnapshotAndLog();
405 break; 407 break;
406 } 408 }
407 } 409 }
408 } 410 }
409 411
410 // Flaky actions 412 // Flaky actions
411 413
412 ACTION_P(SetFocusToRenderer, mock) { 414 ACTION_P(SetFocusToRenderer, mock) {
413 simulate_input::SetKeyboardFocusToWindow( 415 simulate_input::SetKeyboardFocusToWindow(
414 mock->event_sink()->GetRendererWindow()); 416 mock->event_sink()->GetRendererWindow());
(...skipping 25 matching lines...) Expand all
440 442
441 loop->PostDelayedTask( 443 loop->PostDelayedTask(
442 FROM_HERE, 444 FROM_HERE,
443 base::Bind(simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), 445 base::Bind(simulate_input::SendCharA, VK_RETURN, simulate_input::NONE),
444 next_delay); 446 next_delay);
445 } 447 }
446 448
447 } // namespace chrome_frame_test 449 } // namespace chrome_frame_test
448 450
449 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_ 451 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_ACTIONS_H_
OLDNEW
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/navigation_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698