OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 new TestURLRequestHttpJob(req_.get())); | 384 new TestURLRequestHttpJob(req_.get())); |
385 job->SetPriority(LOW); | 385 job->SetPriority(LOW); |
386 job->Start(); | 386 job->Start(); |
387 ASSERT_TRUE(network_layer_.last_transaction()); | 387 ASSERT_TRUE(network_layer_.last_transaction()); |
388 EXPECT_EQ(LOW, network_layer_.last_transaction()->priority()); | 388 EXPECT_EQ(LOW, network_layer_.last_transaction()->priority()); |
389 | 389 |
390 job->SetPriority(HIGHEST); | 390 job->SetPriority(HIGHEST); |
391 EXPECT_EQ(HIGHEST, network_layer_.last_transaction()->priority()); | 391 EXPECT_EQ(HIGHEST, network_layer_.last_transaction()->priority()); |
392 } | 392 } |
393 | 393 |
| 394 // Make sure that URLRequestHttpJob passes on its priority updates to |
| 395 // newly-created transactions after the first one. |
| 396 TEST_F(URLRequestHttpJobTest, SetSubsequentTransactionPriority) { |
| 397 scoped_refptr<TestURLRequestHttpJob> job( |
| 398 new TestURLRequestHttpJob(req_.get())); |
| 399 job->Start(); |
| 400 |
| 401 job->SetPriority(LOW); |
| 402 ASSERT_TRUE(network_layer_.last_transaction()); |
| 403 EXPECT_EQ(LOW, network_layer_.last_transaction()->priority()); |
| 404 |
| 405 job->Kill(); |
| 406 network_layer_.ClearLastTransaction(); |
| 407 |
| 408 // Creates a second transaction. |
| 409 job->Start(); |
| 410 ASSERT_TRUE(network_layer_.last_transaction()); |
| 411 EXPECT_EQ(LOW, network_layer_.last_transaction()->priority()); |
| 412 } |
| 413 |
394 // Confirm we do advertise SDCH encoding in the case of a GET. | 414 // Confirm we do advertise SDCH encoding in the case of a GET. |
395 TEST_F(URLRequestHttpJobTest, SdchAdvertisementGet) { | 415 TEST_F(URLRequestHttpJobTest, SdchAdvertisementGet) { |
396 EnableSdch(); | 416 EnableSdch(); |
397 req_->set_method("GET"); // Redundant with default. | 417 req_->set_method("GET"); // Redundant with default. |
398 scoped_refptr<TestURLRequestHttpJob> job( | 418 scoped_refptr<TestURLRequestHttpJob> job( |
399 new TestURLRequestHttpJob(req_.get())); | 419 new TestURLRequestHttpJob(req_.get())); |
400 job->Start(); | 420 job->Start(); |
401 EXPECT_TRUE(TransactionAcceptsSdchEncoding()); | 421 EXPECT_TRUE(TransactionAcceptsSdchEncoding()); |
402 } | 422 } |
403 | 423 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 req_->SetLoadFlags(LOAD_DISABLE_CACHE); | 592 req_->SetLoadFlags(LOAD_DISABLE_CACHE); |
573 job->Start(); | 593 job->Start(); |
574 base::RunLoop().RunUntilIdle(); | 594 base::RunLoop().RunUntilIdle(); |
575 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); | 595 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); |
576 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); | 596 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); |
577 } | 597 } |
578 | 598 |
579 } // namespace | 599 } // namespace |
580 | 600 |
581 } // namespace net | 601 } // namespace net |
OLD | NEW |