| 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 | |
| 414 // Confirm we do advertise SDCH encoding in the case of a GET. | 394 // Confirm we do advertise SDCH encoding in the case of a GET. |
| 415 TEST_F(URLRequestHttpJobTest, SdchAdvertisementGet) { | 395 TEST_F(URLRequestHttpJobTest, SdchAdvertisementGet) { |
| 416 EnableSdch(); | 396 EnableSdch(); |
| 417 req_->set_method("GET"); // Redundant with default. | 397 req_->set_method("GET"); // Redundant with default. |
| 418 scoped_refptr<TestURLRequestHttpJob> job( | 398 scoped_refptr<TestURLRequestHttpJob> job( |
| 419 new TestURLRequestHttpJob(req_.get())); | 399 new TestURLRequestHttpJob(req_.get())); |
| 420 job->Start(); | 400 job->Start(); |
| 421 EXPECT_TRUE(TransactionAcceptsSdchEncoding()); | 401 EXPECT_TRUE(TransactionAcceptsSdchEncoding()); |
| 422 } | 402 } |
| 423 | 403 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 req_->SetLoadFlags(LOAD_DISABLE_CACHE); | 572 req_->SetLoadFlags(LOAD_DISABLE_CACHE); |
| 593 job->Start(); | 573 job->Start(); |
| 594 base::RunLoop().RunUntilIdle(); | 574 base::RunLoop().RunUntilIdle(); |
| 595 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); | 575 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); |
| 596 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); | 576 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); |
| 597 } | 577 } |
| 598 | 578 |
| 599 } // namespace | 579 } // namespace |
| 600 | 580 |
| 601 } // namespace net | 581 } // namespace net |
| OLD | NEW |