1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome_frame/test/chrome_frame_automation_mock.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
const base::TimeDelta kLongWaitTimeout = base::TimeDelta::FromSeconds(25);
TEST(ChromeFrame, Launch) {
MessageLoopForUI loop;
AutomationMockLaunch mock_launch(&loop,
kLongWaitTimeout.InMilliseconds());
loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout);
mock_launch.Navigate("about:blank");
base::RunLoop run_loop(NULL);
run_loop.Run();
EXPECT_TRUE(mock_launch.launch_result());
}
TEST(ChromeFrame, Navigate) {
MessageLoopForUI loop;
AutomationMockNavigate mock_navigate(&loop,
kLongWaitTimeout.InMilliseconds());
loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout);
mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html");
base::RunLoop run_loop(NULL);
run_loop.Run();
EXPECT_FALSE(mock_navigate.navigation_result());
}
TEST(ChromeFrame, PostMessage) {
MessageLoopForUI loop;
AutomationMockPostMessage mock_postmessage(&loop,
kLongWaitTimeout.InMilliseconds());
loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout);
mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html");
base::RunLoop run_loop(NULL);
run_loop.Run();
EXPECT_FALSE(mock_postmessage.postmessage_result());
}
TEST(ChromeFrame, RequestStart) {
MessageLoopForUI loop;
AutomationMockHostNetworkRequestStart mock_request_start(
&loop, kLongWaitTimeout.InMilliseconds());
loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), kLongWaitTimeout);
mock_request_start.NavigateRelative(L"postmessage_basic_frame.html");
base::RunLoop run_loop(NULL);
run_loop.Run();
EXPECT_TRUE(mock_request_start.request_start_result());
}
|