OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1397 // content is empty. | 1397 // content is empty. |
1398 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { | 1398 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { |
1399 TestDelegate d; | 1399 TestDelegate d; |
1400 URLRequest req(GURL("data:,"), &d, &default_context_); | 1400 URLRequest req(GURL("data:,"), &d, &default_context_); |
1401 req.Start(); | 1401 req.Start(); |
1402 MessageLoop::current()->Run(); | 1402 MessageLoop::current()->Run(); |
1403 EXPECT_EQ("", d.data_received()); | 1403 EXPECT_EQ("", d.data_received()); |
1404 EXPECT_EQ(1, default_network_delegate_.completed_requests()); | 1404 EXPECT_EQ(1, default_network_delegate_.completed_requests()); |
1405 } | 1405 } |
1406 | 1406 |
1407 // Make sure that URLRequest passes on its priority updates to its | |
1408 // job. | |
1409 TEST_F(URLRequestTest, Priority) { | |
1410 TestInterceptor interceptor; | |
1411 | |
1412 interceptor.intercept_main_request_ = true; | |
mmenke
2013/03/12 18:40:22
Rather than having URLRequest friend the individua
akalin
2013/03/12 22:08:28
Done.
| |
1413 | |
1414 TestDelegate d; | |
1415 URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); | |
1416 EXPECT_EQ(LOWEST, req.priority()); | |
1417 EXPECT_TRUE(!req.job_); | |
1418 | |
1419 req.SetPriority(IDLE); | |
1420 EXPECT_EQ(IDLE, req.priority()); | |
1421 EXPECT_TRUE(!req.job_); | |
1422 | |
1423 req.Start(); | |
1424 EXPECT_TRUE(req.job_ != NULL); | |
1425 scoped_refptr<URLRequestTestJob> job( | |
1426 static_cast<URLRequestTestJob*>(req.job_.get())); | |
1427 EXPECT_EQ(IDLE, job->priority()); | |
1428 | |
1429 req.SetPriority(HIGHEST); | |
1430 EXPECT_EQ(HIGHEST, req.priority()); | |
1431 EXPECT_EQ(HIGHEST, job->priority()); | |
1432 } | |
1433 | |
1407 // TODO(droger): Support TestServer on iOS (see http://crbug.com/148666). | 1434 // TODO(droger): Support TestServer on iOS (see http://crbug.com/148666). |
1408 #if !defined(OS_IOS) | 1435 #if !defined(OS_IOS) |
1409 // A subclass of TestServer that uses a statically-configured hostname. This is | 1436 // A subclass of TestServer that uses a statically-configured hostname. This is |
1410 // to work around mysterious failures in chrome_frame_net_tests. See: | 1437 // to work around mysterious failures in chrome_frame_net_tests. See: |
1411 // http://crbug.com/114369 | 1438 // http://crbug.com/114369 |
1412 class LocalHttpTestServer : public TestServer { | 1439 class LocalHttpTestServer : public TestServer { |
1413 public: | 1440 public: |
1414 explicit LocalHttpTestServer(const base::FilePath& document_root) | 1441 explicit LocalHttpTestServer(const base::FilePath& document_root) |
1415 : TestServer(TestServer::TYPE_HTTP, | 1442 : TestServer(TestServer::TYPE_HTTP, |
1416 ScopedCustomUrlRequestTestHttpHost::value(), | 1443 ScopedCustomUrlRequestTestHttpHost::value(), |
(...skipping 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5367 | 5394 |
5368 EXPECT_FALSE(r.is_pending()); | 5395 EXPECT_FALSE(r.is_pending()); |
5369 EXPECT_EQ(1, d->response_started_count()); | 5396 EXPECT_EQ(1, d->response_started_count()); |
5370 EXPECT_FALSE(d->received_data_before_response()); | 5397 EXPECT_FALSE(d->received_data_before_response()); |
5371 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 5398 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
5372 } | 5399 } |
5373 } | 5400 } |
5374 #endif // !defined(DISABLE_FTP_SUPPORT) | 5401 #endif // !defined(DISABLE_FTP_SUPPORT) |
5375 | 5402 |
5376 } // namespace net | 5403 } // namespace net |
OLD | NEW |