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 "omaha/base/app_util.h" | |
19 #include "omaha/net/bits_request.h" | |
20 #include "omaha/testing/unit_test.h" | |
21 | |
22 namespace omaha { | |
23 | |
24 // Moves the job to error state if no progress at all is made for 10 seconds. | |
25 TEST(BitsRequestTest, Send) { | |
26 if (IsTestRunByLocalSystem()) { | |
27 return; | |
28 } | |
29 | |
30 BitsRequest bits_request; | |
31 bits_request.set_no_progress_timeout(10); // 10 seconds. | |
32 CString temp_dir = app_util::GetTempDir(); | |
33 CString temp_file; | |
34 EXPECT_TRUE(::GetTempFileName(temp_dir, _T("tmp"), 0, | |
35 CStrBuf(temp_file, MAX_PATH))); | |
36 bits_request.set_filename(temp_file); | |
37 bits_request.set_url(_T("http://dl.google.com/update2/UpdateData.bin")); | |
38 EXPECT_HRESULT_SUCCEEDED(bits_request.Send()); | |
39 EXPECT_EQ(HTTP_STATUS_OK, bits_request.GetHttpStatusCode()); | |
40 | |
41 bits_request.set_low_priority(true); | |
42 EXPECT_HRESULT_SUCCEEDED(bits_request.Send()); | |
43 EXPECT_EQ(HTTP_STATUS_OK, bits_request.GetHttpStatusCode()); | |
44 } | |
45 | |
46 } // namespace omaha | |
47 | |
OLD | NEW |