OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "chrome_frame/test/chrome_frame_automation_mock.h" | 5 #include "chrome_frame/test/chrome_frame_automation_mock.h" |
6 #include "chrome_frame/test/chrome_frame_test_utils.h" | 6 #include "chrome_frame/test/chrome_frame_test_utils.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 const int kLongWaitTimeout = 25 * 1000; | 9 const int kLongWaitTimeout = 25 * 1000; |
10 const int kShortWaitTimeout = 5 * 1000; | 10 const int kShortWaitTimeout = 5 * 1000; |
11 | 11 |
12 // This test has been marked as flaky as it randomly times out on the CF | 12 // This test has been marked as flaky as it randomly times out on the CF |
13 // builders | 13 // builders |
14 // http://code.google.com/p/chromium/issues/detail?id=81479 | 14 // http://code.google.com/p/chromium/issues/detail?id=81479 |
15 TEST(ChromeFrame, FLAKY_Launch) { | 15 TEST(ChromeFrame, FLAKY_Launch) { |
16 MessageLoopForUI loop; | 16 MessageLoopForUI loop; |
17 AutomationMockLaunch mock_launch(&loop, kLongWaitTimeout); | 17 AutomationMockLaunch mock_launch(&loop, kLongWaitTimeout); |
18 | 18 |
19 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); | 19 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); |
20 | 20 |
21 mock_launch.Navigate("about:blank"); | 21 mock_launch.Navigate("about:blank"); |
22 loop.Run(NULL); | 22 loop.RunWithDispatcher(NULL); |
23 EXPECT_TRUE(mock_launch.launch_result()); | 23 EXPECT_TRUE(mock_launch.launch_result()); |
24 } | 24 } |
25 | 25 |
26 TEST(ChromeFrame, Navigate) { | 26 TEST(ChromeFrame, Navigate) { |
27 MessageLoopForUI loop; | 27 MessageLoopForUI loop; |
28 AutomationMockNavigate mock_navigate(&loop, kLongWaitTimeout); | 28 AutomationMockNavigate mock_navigate(&loop, kLongWaitTimeout); |
29 | 29 |
30 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); | 30 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); |
31 | 31 |
32 mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html"); | 32 mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html"); |
33 loop.Run(NULL); | 33 loop.RunWithDispatcher(NULL); |
34 EXPECT_FALSE(mock_navigate.navigation_result()); | 34 EXPECT_FALSE(mock_navigate.navigation_result()); |
35 } | 35 } |
36 | 36 |
37 TEST(ChromeFrame, PostMessage) { | 37 TEST(ChromeFrame, PostMessage) { |
38 MessageLoopForUI loop; | 38 MessageLoopForUI loop; |
39 AutomationMockPostMessage mock_postmessage(&loop, kLongWaitTimeout); | 39 AutomationMockPostMessage mock_postmessage(&loop, kLongWaitTimeout); |
40 | 40 |
41 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); | 41 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); |
42 | 42 |
43 mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html"); | 43 mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html"); |
44 loop.Run(NULL); | 44 loop.RunWithDispatcher(NULL); |
45 EXPECT_FALSE(mock_postmessage.postmessage_result()); | 45 EXPECT_FALSE(mock_postmessage.postmessage_result()); |
46 } | 46 } |
47 | 47 |
48 // Marking this test as flaky as it fails randomly on the CF builders. | 48 // Marking this test as flaky as it fails randomly on the CF builders. |
49 // http://code.google.com/p/chromium/issues/detail?id=81479 | 49 // http://code.google.com/p/chromium/issues/detail?id=81479 |
50 TEST(ChromeFrame, FLAKY_RequestStart) { | 50 TEST(ChromeFrame, FLAKY_RequestStart) { |
51 MessageLoopForUI loop; | 51 MessageLoopForUI loop; |
52 AutomationMockHostNetworkRequestStart mock_request_start(&loop, | 52 AutomationMockHostNetworkRequestStart mock_request_start(&loop, |
53 kLongWaitTimeout); | 53 kLongWaitTimeout); |
54 | 54 |
55 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); | 55 loop.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, kLongWaitTimeout); |
56 | 56 |
57 mock_request_start.NavigateRelative(L"postmessage_basic_frame.html"); | 57 mock_request_start.NavigateRelative(L"postmessage_basic_frame.html"); |
58 loop.Run(NULL); | 58 loop.RunWithDispatcher(NULL); |
59 EXPECT_TRUE(mock_request_start.request_start_result()); | 59 EXPECT_TRUE(mock_request_start.request_start_result()); |
60 } | 60 } |
61 | 61 |
OLD | NEW |