Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
mmenke
2013/03/12 18:40:22
nit: 2013
akalin
2013/03/12 22:08:28
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/url_request/url_request_http_job.h" | |
| 6 | |
| 7 #include "base/memory/ref_counted.h" | |
| 8 #include "net/http/http_transaction_unittest.h" | |
| 9 #include "net/url_request/url_request_test_util.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace net { | |
| 13 | |
| 14 // Make sure that URLRequestHttpJob passes on its priority updates to | |
| 15 // its transaction. | |
| 16 TEST(URLRequestHttpJob, Priority) { | |
| 17 MockNetworkLayer network_layer; | |
| 18 net::TestURLRequestContext context; | |
| 19 context.set_http_transaction_factory(&network_layer); | |
| 20 | |
| 21 net::TestDelegate d; | |
| 22 net::TestURLRequest req(GURL("http://www.example.com"), &d, &context, NULL); | |
| 23 scoped_refptr<URLRequestHttpJob> job( | |
| 24 static_cast<URLRequestHttpJob*>( | |
| 25 URLRequestHttpJob::Factory(&req, NULL, "http"))); | |
| 26 EXPECT_TRUE(!job->transaction_); | |
|
mmenke
2013/03/12 18:40:22
EXPECT_FALSE(job->transaction_);?
akalin
2013/03/12 22:08:28
Done.
| |
| 27 | |
| 28 req.SetPriority(MEDIUM); | |
| 29 // |req| doesn't know about |job|, so propagate the SetPriority call | |
| 30 // manually. | |
| 31 job->SetPriority(MEDIUM); | |
| 32 | |
| 33 job->Start(); | |
| 34 EXPECT_TRUE(job->transaction_ != NULL); | |
|
mmenke
2013/03/12 18:40:22
EXPECT_TRUE(job->transaction_);?
Think it's a lit
akalin
2013/03/12 22:08:28
I think I'm just paranoid of how various compilers
| |
| 35 MockNetworkTransaction* transaction = | |
| 36 static_cast<MockNetworkTransaction*>(job->transaction_.get()); | |
| 37 EXPECT_EQ(MEDIUM, transaction->priority()); | |
| 38 | |
| 39 job->SetPriority(HIGHEST); | |
| 40 EXPECT_EQ(HIGHEST, transaction->priority()); | |
| 41 } | |
| 42 | |
| 43 } // namespace net | |
| OLD | NEW |