OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <windows.h> | 4 #include <windows.h> |
5 #include <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 // IShellWindows includes. Unfortunately we can't keep these in | 7 // IShellWindows includes. Unfortunately we can't keep these in |
8 // alphabetic order since exdisp will bark if some interfaces aren't fully | 8 // alphabetic order since exdisp will bark if some interfaces aren't fully |
9 // defined. | 9 // defined. |
10 #include <mshtml.h> | 10 #include <mshtml.h> |
11 #include <exdisp.h> | 11 #include <exdisp.h> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/scoped_bstr_win.h" | 16 #include "base/scoped_bstr_win.h" |
17 #include "base/scoped_variant_win.h" | 17 #include "base/scoped_variant_win.h" |
18 #include "base/win_util.h" | 18 #include "base/win_util.h" |
19 #include "gmock/gmock.h" | 19 #include "gmock/gmock.h" |
20 #include "net/url_request/url_request_unittest.h" | 20 #include "net/url_request/url_request_unittest.h" |
21 #include "chrome_frame/test/chrome_frame_unittests.h" | 21 #include "chrome_frame/test/chrome_frame_unittests.h" |
22 #include "chrome_frame/chrome_frame_automation.h" | 22 #include "chrome_frame/chrome_frame_automation.h" |
23 #include "chrome_frame/chrome_frame_delegate.h" | 23 #include "chrome_frame/chrome_frame_delegate.h" |
24 #include "chrome_frame/crash_reporting/vectored_handler-impl.h" | |
25 #include "chrome_frame/test/chrome_frame_test_utils.h" | 24 #include "chrome_frame/test/chrome_frame_test_utils.h" |
26 #include "chrome_frame/test_utils.h" | 25 #include "chrome_frame/test_utils.h" |
27 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/installer/util/install_util.h" | 27 #include "chrome/installer/util/install_util.h" |
29 #include "chrome/installer/util/helper.h" | 28 #include "chrome/installer/util/helper.h" |
30 | 29 |
31 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING | 30 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
32 #include "testing/gmock_mutant.h" | 31 #include "testing/gmock_mutant.h" |
33 | 32 |
34 using testing::CreateFunctor; | 33 using testing::CreateFunctor; |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 template <> struct RunnableMethodTraits<ChromeFrameAutomationClient> { | 880 template <> struct RunnableMethodTraits<ChromeFrameAutomationClient> { |
882 void RetainCallee(ChromeFrameAutomationClient* obj) {} | 881 void RetainCallee(ChromeFrameAutomationClient* obj) {} |
883 void ReleaseCallee(ChromeFrameAutomationClient* obj) {} | 882 void ReleaseCallee(ChromeFrameAutomationClient* obj) {} |
884 }; | 883 }; |
885 | 884 |
886 template <> struct RunnableMethodTraits<chrome_frame_test::TimedMsgLoop> { | 885 template <> struct RunnableMethodTraits<chrome_frame_test::TimedMsgLoop> { |
887 void RetainCallee(chrome_frame_test::TimedMsgLoop* obj) {} | 886 void RetainCallee(chrome_frame_test::TimedMsgLoop* obj) {} |
888 void ReleaseCallee(chrome_frame_test::TimedMsgLoop* obj) {} | 887 void ReleaseCallee(chrome_frame_test::TimedMsgLoop* obj) {} |
889 }; | 888 }; |
890 | 889 |
891 // Saves typing. It's somewhat hard to create a wrapper around | |
892 // testing::InvokeWithoutArgs since it returns a | |
893 // non-public (testing::internal) type. | |
894 #define QUIT_LOOP(loop) testing::InvokeWithoutArgs(\ | |
895 CreateFunctor(&loop, &chrome_frame_test::TimedMsgLoop::Quit)) | |
896 | |
897 #define QUIT_LOOP_SOON(loop, seconds) testing::InvokeWithoutArgs(\ | |
898 CreateFunctor(&loop, &chrome_frame_test::TimedMsgLoop::QuitAfter, \ | |
899 seconds)) | |
900 | |
901 // We mock ChromeFrameDelegate only. The rest is with real AutomationProxy | 890 // We mock ChromeFrameDelegate only. The rest is with real AutomationProxy |
902 TEST(CFACWithChrome, CreateTooFast) { | 891 TEST(CFACWithChrome, CreateTooFast) { |
903 MockCFDelegate cfd; | 892 MockCFDelegate cfd; |
904 chrome_frame_test::TimedMsgLoop loop; | 893 chrome_frame_test::TimedMsgLoop loop; |
905 int timeout = 0; // Chrome cannot send Hello message so fast. | 894 int timeout = 0; // Chrome cannot send Hello message so fast. |
906 const std::wstring profile = L"Adam.N.Epilinter"; | 895 const std::wstring profile = L"Adam.N.Epilinter"; |
907 | 896 |
908 scoped_refptr<ChromeFrameAutomationClient> client; | 897 scoped_refptr<ChromeFrameAutomationClient> client; |
909 client = new ChromeFrameAutomationClient(); | 898 client = new ChromeFrameAutomationClient(); |
910 | 899 |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 mock.LaunchIEAndNavigate(kChromeFrameFullTabModeBeforeUnloadEventTest); | 1929 mock.LaunchIEAndNavigate(kChromeFrameFullTabModeBeforeUnloadEventTest); |
1941 ASSERT_HRESULT_SUCCEEDED(hr); | 1930 ASSERT_HRESULT_SUCCEEDED(hr); |
1942 if (hr == S_FALSE) | 1931 if (hr == S_FALSE) |
1943 return; | 1932 return; |
1944 | 1933 |
1945 ASSERT_TRUE(mock.web_browser2() != NULL); | 1934 ASSERT_TRUE(mock.web_browser2() != NULL); |
1946 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); | 1935 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); |
1947 mock.Uninitialize(); | 1936 mock.Uninitialize(); |
1948 chrome_frame_test::CloseAllIEWindows(); | 1937 chrome_frame_test::CloseAllIEWindows(); |
1949 } | 1938 } |
OLD | NEW |