Chromium Code Reviews| 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 #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; |
|
grt (UTC plus 2)
2012/04/17 14:13:32
why not:
const base::TimeDelta kLongWaitTimeout =
grt (UTC plus 2)
2012/04/18 02:04:24
I had assumed that the ban on static initializers
| |
| 10 | 10 |
| 11 TEST(ChromeFrame, Launch) { | 11 TEST(ChromeFrame, Launch) { |
| 12 MessageLoopForUI loop; | 12 MessageLoopForUI loop; |
| 13 AutomationMockLaunch mock_launch(&loop, kLongWaitTimeout); | 13 AutomationMockLaunch mock_launch(&loop, kLongWaitTimeout); |
|
grt (UTC plus 2)
2012/04/17 14:13:32
and this would become kLongWaitTimeout.ToMilliseco
| |
| 14 | 14 |
| 15 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout); | 15 loop.PostDelayedTask(FROM_HERE, |
| 16 MessageLoop::QuitClosure(), | |
| 17 base::TimeDelta::FromMilliseconds(kLongWaitTimeout)); | |
| 16 | 18 |
| 17 mock_launch.Navigate("about:blank"); | 19 mock_launch.Navigate("about:blank"); |
| 18 loop.RunWithDispatcher(NULL); | 20 loop.RunWithDispatcher(NULL); |
| 19 EXPECT_TRUE(mock_launch.launch_result()); | 21 EXPECT_TRUE(mock_launch.launch_result()); |
| 20 } | 22 } |
| 21 | 23 |
| 22 TEST(ChromeFrame, Navigate) { | 24 TEST(ChromeFrame, Navigate) { |
| 23 MessageLoopForUI loop; | 25 MessageLoopForUI loop; |
| 24 AutomationMockNavigate mock_navigate(&loop, kLongWaitTimeout); | 26 AutomationMockNavigate mock_navigate(&loop, kLongWaitTimeout); |
| 25 | 27 |
| 26 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout); | 28 loop.PostDelayedTask(FROM_HERE, |
| 29 MessageLoop::QuitClosure(), | |
| 30 base::TimeDelta::FromMilliseconds(kLongWaitTimeout)); | |
| 27 | 31 |
| 28 mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html"); | 32 mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html"); |
| 29 loop.RunWithDispatcher(NULL); | 33 loop.RunWithDispatcher(NULL); |
| 30 EXPECT_FALSE(mock_navigate.navigation_result()); | 34 EXPECT_FALSE(mock_navigate.navigation_result()); |
| 31 } | 35 } |
| 32 | 36 |
| 33 TEST(ChromeFrame, PostMessage) { | 37 TEST(ChromeFrame, PostMessage) { |
| 34 MessageLoopForUI loop; | 38 MessageLoopForUI loop; |
| 35 AutomationMockPostMessage mock_postmessage(&loop, kLongWaitTimeout); | 39 AutomationMockPostMessage mock_postmessage(&loop, kLongWaitTimeout); |
| 36 | 40 |
| 37 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout); | 41 loop.PostDelayedTask(FROM_HERE, |
| 42 MessageLoop::QuitClosure(), | |
| 43 base::TimeDelta::FromMilliseconds(kLongWaitTimeout)); | |
| 38 | 44 |
| 39 mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html"); | 45 mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html"); |
| 40 loop.RunWithDispatcher(NULL); | 46 loop.RunWithDispatcher(NULL); |
| 41 EXPECT_FALSE(mock_postmessage.postmessage_result()); | 47 EXPECT_FALSE(mock_postmessage.postmessage_result()); |
| 42 } | 48 } |
| 43 | 49 |
| 44 TEST(ChromeFrame, RequestStart) { | 50 TEST(ChromeFrame, RequestStart) { |
| 45 MessageLoopForUI loop; | 51 MessageLoopForUI loop; |
| 46 AutomationMockHostNetworkRequestStart mock_request_start(&loop, | 52 AutomationMockHostNetworkRequestStart mock_request_start(&loop, |
| 47 kLongWaitTimeout); | 53 kLongWaitTimeout); |
| 48 | 54 |
| 49 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout); | 55 loop.PostDelayedTask(FROM_HERE, |
| 56 MessageLoop::QuitClosure(), | |
| 57 base::TimeDelta::FromMilliseconds(kLongWaitTimeout)); | |
| 50 | 58 |
| 51 mock_request_start.NavigateRelative(L"postmessage_basic_frame.html"); | 59 mock_request_start.NavigateRelative(L"postmessage_basic_frame.html"); |
| 52 loop.RunWithDispatcher(NULL); | 60 loop.RunWithDispatcher(NULL); |
| 53 EXPECT_TRUE(mock_request_start.request_start_result()); | 61 EXPECT_TRUE(mock_request_start.request_start_result()); |
| 54 } | 62 } |
| 55 | 63 |
| OLD | NEW |