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

Side by Side Diff: net/http/http_cache_transaction_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: Add more tests 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) 2013 The Chromium Authors. All rights reserved.
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/http/http_cache_transaction.h"
6
7 #include "net/base/test_completion_callback.h"
8 #include "net/http/http_cache.h"
9 #include "net/http/http_request_info.h"
10 #include "net/http/http_transaction_unittest.h"
11 #include "net/http/mock_http_cache.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace net {
15
16 class HttpCacheTransactionTest : public ::testing::Test {
17 protected:
18 MockHttpCache cache_;
19 };
20
21 // Make sure that calling HttpCache::Transaction passes on its
22 // priority updates to its underlying network transaction.
23 TEST_F(HttpCacheTransactionTest, SetPriority) {
24 scoped_ptr<HttpTransaction> trans;
25 ASSERT_EQ(OK, cache_.http_cache()->CreateTransaction(&trans, NULL));
26
27 // Shouldn't crash.
28 trans->SetPriority(LOW);
29
30 HttpRequestInfo info;
31 info.priority = MEDIUM;
32 TestCompletionCallback callback;
33 trans->Start(&info, callback.callback(), BoundNetLog());
34
35 ASSERT_TRUE(cache_.network_layer()->last_transaction());
36 EXPECT_EQ(MEDIUM, cache_.network_layer()->last_transaction()->priority());
37
38 trans->SetPriority(HIGHEST);
39 EXPECT_EQ(HIGHEST, cache_.network_layer()->last_transaction()->priority());
40 }
41
42 } // namespace net
43
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698