Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: net/url_request/url_request_http_job_unittest.cc

Issue 12701011: [Net] Propagate priority changes from URLRequest to HttpTransaction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698