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
3 // found in the LICENSE file.
5 #include "chrome_frame/test/chrome_frame_automation_mock.h"
6 #include "chrome_frame/test/chrome_frame_test_utils.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 const base::TimeDelta kLongWaitTimeout
= base::TimeDelta::FromSeconds(25);
11 TEST(ChromeFrame
, Launch
) {
12 base::MessageLoopForUI loop
;
13 AutomationMockLaunch
mock_launch(&loop
,
14 kLongWaitTimeout
.InMilliseconds());
17 FROM_HERE
, base::MessageLoop::QuitClosure(), kLongWaitTimeout
);
19 mock_launch
.Navigate("about:blank");
20 base::RunLoop
run_loop(NULL
);
22 EXPECT_TRUE(mock_launch
.launch_result());
25 TEST(ChromeFrame
, Navigate
) {
26 base::MessageLoopForUI loop
;
27 AutomationMockNavigate
mock_navigate(&loop
,
28 kLongWaitTimeout
.InMilliseconds());
31 FROM_HERE
, base::MessageLoop::QuitClosure(), kLongWaitTimeout
);
33 mock_navigate
.NavigateRelativeFile(L
"postmessage_basic_frame.html");
34 base::RunLoop
run_loop(NULL
);
36 EXPECT_FALSE(mock_navigate
.navigation_result());
39 TEST(ChromeFrame
, PostMessage
) {
40 base::MessageLoopForUI loop
;
41 AutomationMockPostMessage
mock_postmessage(&loop
,
42 kLongWaitTimeout
.InMilliseconds());
45 FROM_HERE
, base::MessageLoop::QuitClosure(), kLongWaitTimeout
);
47 mock_postmessage
.NavigateRelativeFile(L
"postmessage_basic_frame.html");
48 base::RunLoop
run_loop(NULL
);
50 EXPECT_FALSE(mock_postmessage
.postmessage_result());
53 TEST(ChromeFrame
, RequestStart
) {
54 base::MessageLoopForUI loop
;
55 AutomationMockHostNetworkRequestStart
mock_request_start(
56 &loop
, kLongWaitTimeout
.InMilliseconds());
59 FROM_HERE
, base::MessageLoop::QuitClosure(), kLongWaitTimeout
);
61 mock_request_start
.NavigateRelative(L
"postmessage_basic_frame.html");
62 base::RunLoop
run_loop(NULL
);
64 EXPECT_TRUE(mock_request_start
.request_start_result());