OLD | NEW |
| (Empty) |
1 // Copyright 2007-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include <windows.h> | |
17 #include <winhttp.h> | |
18 #include <atlbase.h> | |
19 #include "omaha/net/bits_utils.h" | |
20 #include "omaha/testing/unit_test.h" | |
21 | |
22 namespace omaha { | |
23 | |
24 TEST(BitsUtilsTest, GetBitsManager) { | |
25 CComPtr<IBackgroundCopyManager> bits_manager; | |
26 ASSERT_HRESULT_SUCCEEDED(GetBitsManager(&bits_manager)); | |
27 } | |
28 | |
29 TEST(BitsUtilsTest, GetHttpStatusFromBitsError) { | |
30 EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_400), | |
31 HTTP_STATUS_BAD_REQUEST); | |
32 EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_407), | |
33 HTTP_STATUS_PROXY_AUTH_REQ); | |
34 EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_100), | |
35 HTTP_STATUS_CONTINUE); | |
36 EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_505), | |
37 HTTP_STATUS_VERSION_NOT_SUP); | |
38 | |
39 EXPECT_EQ(GetHttpStatusFromBitsError(-1), 0); | |
40 EXPECT_EQ(GetHttpStatusFromBitsError(0), 0); | |
41 EXPECT_EQ(GetHttpStatusFromBitsError(99), 0); | |
42 EXPECT_EQ(GetHttpStatusFromBitsError(506), 0); | |
43 } | |
44 | |
45 } // namespace omaha | |
46 | |
OLD | NEW |