Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: base/win/win_api_interface.h

Issue 9167004: Match whole path components in DevicePathToDriveLetterPath(). Add tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rev Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 // Class WinApiInterface provides a way to mock windows API calls in
6 // unit tests. Functions can call members of class WinApiInterface
7 // instead of Windows API functions, and subclasses of WinApiInterface
8 // can be used by tests. Members of this class should do nothing except
9 // calling the real API call they are named after.
10 //
11 // Tests should be written with the assumption that new calls will be
12 // added over time. For example, if you use gmock to create a strict mock
13 // of WinApiInterface, do not make any other windows API calls in the code
14 // under test.
15
16 #ifndef BASE_WIN_WIN_API_INTERFACE_H_
17 #define BASE_WIN_WIN_API_INTERFACE_H_
18
19 #include <windows.h>
20
21 namespace base {
22 namespace win {
23
24 class WinApiInterface {
25 public:
26 virtual DWORD QueryDosDevice(LPCTSTR lpDeviceName,
27 LPTSTR lpTargetPath,
28 DWORD ucchMax) {
29 return ::QueryDosDevice(lpDeviceName, lpTargetPath, ucchMax);
30 }
31
32 virtual DWORD GetLogicalDriveStrings(DWORD nBufferLength,
33 LPTSTR lpBuffer) {
34 return ::GetLogicalDriveStrings(nBufferLength, lpBuffer);
35 }
36
37 static WinApiInterface* GetInstance();
rvargas (doing something else) 2012/01/11 22:26:26 This has to be exported.
38 };
39
40 } // namespace win
41 } // namespace base
42
43 #endif // BASE_WIN_WIN_API_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698