| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Win32 mocks. | 5 // Win32 mocks. |
| 6 | 6 |
| 7 #ifndef CEEE_TESTING_UTILS_MOCK_WIN32_H_ | 7 #ifndef CEEE_TESTING_UTILS_MOCK_WIN32_H_ |
| 8 #define CEEE_TESTING_UTILS_MOCK_WIN32_H_ | 8 #define CEEE_TESTING_UTILS_MOCK_WIN32_H_ |
| 9 | 9 |
| 10 // atlwin.h re#defines SetWindowLongPtr and it caused a build error here. | 10 // atlwin.h re#defines SetWindowLongPtr and it caused a build error here. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 MOCK_STATIC_INIT(EnumWindows); | 61 MOCK_STATIC_INIT(EnumWindows); |
| 62 MOCK_STATIC_INIT(IsWindow); | 62 MOCK_STATIC_INIT(IsWindow); |
| 63 MOCK_STATIC_INIT(IsWindowVisible); | 63 MOCK_STATIC_INIT(IsWindowVisible); |
| 64 MOCK_STATIC_INIT(GetClassName); | 64 MOCK_STATIC_INIT(GetClassName); |
| 65 MOCK_STATIC_INIT(GetForegroundWindow); | 65 MOCK_STATIC_INIT(GetForegroundWindow); |
| 66 MOCK_STATIC_INIT(GetParent); | 66 MOCK_STATIC_INIT(GetParent); |
| 67 MOCK_STATIC_INIT(GetTopWindow); | 67 MOCK_STATIC_INIT(GetTopWindow); |
| 68 MOCK_STATIC_INIT(GetWindow); | 68 MOCK_STATIC_INIT(GetWindow); |
| 69 MOCK_STATIC_INIT(GetWindowRect); | 69 MOCK_STATIC_INIT(GetWindowRect); |
| 70 MOCK_STATIC_INIT(GetWindowThreadProcessId); | 70 MOCK_STATIC_INIT(GetWindowThreadProcessId); |
| 71 MOCK_STATIC_INIT(KillTimer); |
| 71 MOCK_STATIC_INIT(MoveWindow); | 72 MOCK_STATIC_INIT(MoveWindow); |
| 72 MOCK_STATIC_INIT(PostMessage); | 73 MOCK_STATIC_INIT(PostMessage); |
| 73 MOCK_STATIC_INIT(SendMessage); | 74 MOCK_STATIC_INIT(SendMessage); |
| 74 MOCK_STATIC_INIT(SetProp); | 75 MOCK_STATIC_INIT(SetProp); |
| 76 MOCK_STATIC_INIT(SetTimer); |
| 75 MOCK_STATIC_INIT(SetWindowLongPtr); | 77 MOCK_STATIC_INIT(SetWindowLongPtr); |
| 76 MOCK_STATIC_INIT(SetWindowPos); | 78 MOCK_STATIC_INIT(SetWindowPos); |
| 77 MOCK_STATIC_INIT_END() | 79 MOCK_STATIC_INIT_END() |
| 78 | 80 |
| 79 MOCK_STATIC4(LRESULT, CALLBACK, DefWindowProc, HWND, UINT, WPARAM, LPARAM); | 81 MOCK_STATIC4(LRESULT, CALLBACK, DefWindowProc, HWND, UINT, WPARAM, LPARAM); |
| 80 MOCK_STATIC3(BOOL, CALLBACK, EnumChildWindows, HWND, WNDENUMPROC, LPARAM); | 82 MOCK_STATIC3(BOOL, CALLBACK, EnumChildWindows, HWND, WNDENUMPROC, LPARAM); |
| 81 MOCK_STATIC2(BOOL, CALLBACK, EnumWindows, WNDENUMPROC, LPARAM); | 83 MOCK_STATIC2(BOOL, CALLBACK, EnumWindows, WNDENUMPROC, LPARAM); |
| 82 MOCK_STATIC1(BOOL, CALLBACK, IsWindow, HWND); | 84 MOCK_STATIC1(BOOL, CALLBACK, IsWindow, HWND); |
| 83 MOCK_STATIC1(BOOL, CALLBACK, IsWindowVisible, HWND); | 85 MOCK_STATIC1(BOOL, CALLBACK, IsWindowVisible, HWND); |
| 84 MOCK_STATIC3(int, CALLBACK, GetClassName, HWND, LPTSTR, int); | 86 MOCK_STATIC3(int, CALLBACK, GetClassName, HWND, LPTSTR, int); |
| 85 MOCK_STATIC0(HWND, CALLBACK, GetForegroundWindow); | 87 MOCK_STATIC0(HWND, CALLBACK, GetForegroundWindow); |
| 86 MOCK_STATIC1(HWND, CALLBACK, GetParent, HWND); | 88 MOCK_STATIC1(HWND, CALLBACK, GetParent, HWND); |
| 87 MOCK_STATIC1(HWND, CALLBACK, GetTopWindow, HWND); | 89 MOCK_STATIC1(HWND, CALLBACK, GetTopWindow, HWND); |
| 88 MOCK_STATIC2(HWND, CALLBACK, GetWindow, HWND, UINT); | 90 MOCK_STATIC2(HWND, CALLBACK, GetWindow, HWND, UINT); |
| 89 MOCK_STATIC2(BOOL, CALLBACK, GetWindowRect, HWND, LPRECT); | 91 MOCK_STATIC2(BOOL, CALLBACK, GetWindowRect, HWND, LPRECT); |
| 90 MOCK_STATIC2(DWORD, CALLBACK, GetWindowThreadProcessId, HWND, LPDWORD); | 92 MOCK_STATIC2(DWORD, CALLBACK, GetWindowThreadProcessId, HWND, LPDWORD); |
| 93 MOCK_STATIC2(BOOL, CALLBACK, KillTimer, HWND, UINT_PTR); |
| 91 MOCK_STATIC6(BOOL, CALLBACK, MoveWindow, | 94 MOCK_STATIC6(BOOL, CALLBACK, MoveWindow, |
| 92 HWND, int, int, int, int, BOOL); | 95 HWND, int, int, int, int, BOOL); |
| 93 MOCK_STATIC4(BOOL, CALLBACK, PostMessage, HWND, UINT, WPARAM, LPARAM); | 96 MOCK_STATIC4(BOOL, CALLBACK, PostMessage, HWND, UINT, WPARAM, LPARAM); |
| 94 MOCK_STATIC4(LRESULT, CALLBACK, SendMessage, HWND, UINT, WPARAM, LPARAM); | 97 MOCK_STATIC4(LRESULT, CALLBACK, SendMessage, HWND, UINT, WPARAM, LPARAM); |
| 95 MOCK_STATIC3(BOOL, CALLBACK, SetProp, HWND, LPCWSTR, HANDLE); | 98 MOCK_STATIC3(BOOL, CALLBACK, SetProp, HWND, LPCWSTR, HANDLE); |
| 99 MOCK_STATIC4(UINT_PTR, CALLBACK, SetTimer, HWND, UINT_PTR, UINT, TIMERPROC); |
| 96 MOCK_STATIC3(LONG_PTR, CALLBACK, SetWindowLongPtr, HWND, int, LONG_PTR); | 100 MOCK_STATIC3(LONG_PTR, CALLBACK, SetWindowLongPtr, HWND, int, LONG_PTR); |
| 97 MOCK_STATIC7(BOOL, CALLBACK, SetWindowPos, | 101 MOCK_STATIC7(BOOL, CALLBACK, SetWindowPos, |
| 98 HWND, HWND, int, int, int, int, UINT); | 102 HWND, HWND, int, int, int, int, UINT); |
| 99 MOCK_STATIC_CLASS_END(MockUser32) | 103 MOCK_STATIC_CLASS_END(MockUser32) |
| 100 | 104 |
| 101 // Static functions for (effectively) mocking GetNativeSystemInfo | 105 // Static functions for (effectively) mocking GetNativeSystemInfo |
| 102 class NativeSystemInfoMockTool { | 106 class NativeSystemInfoMockTool { |
| 103 public: | 107 public: |
| 104 static void SetEnvironment_x86(LPSYSTEM_INFO psys_info) { | 108 static void SetEnvironment_x86(LPSYSTEM_INFO psys_info) { |
| 105 memset(psys_info, 0, sizeof(*psys_info)); | 109 memset(psys_info, 0, sizeof(*psys_info)); |
| 106 psys_info->wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; | 110 psys_info->wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; |
| 107 psys_info->dwNumberOfProcessors = 1; | 111 psys_info->dwNumberOfProcessors = 1; |
| 108 } | 112 } |
| 109 | 113 |
| 110 static void SetEnvironment_x64(LPSYSTEM_INFO psys_info) { | 114 static void SetEnvironment_x64(LPSYSTEM_INFO psys_info) { |
| 111 memset(psys_info, 0, sizeof(*psys_info)); | 115 memset(psys_info, 0, sizeof(*psys_info)); |
| 112 psys_info->wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; | 116 psys_info->wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; |
| 113 psys_info->dwNumberOfProcessors = 4; | 117 psys_info->dwNumberOfProcessors = 4; |
| 114 } | 118 } |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace testing | 121 } // namespace testing |
| 118 | 122 |
| 119 #endif // CEEE_TESTING_UTILS_MOCK_WIN32_H_ | 123 #endif // CEEE_TESTING_UTILS_MOCK_WIN32_H_ |
| OLD | NEW |