OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 5907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5918 MockHttpCache cache; | 5918 MockHttpCache cache; |
5919 | 5919 |
5920 scoped_ptr<net::HttpTransaction> trans; | 5920 scoped_ptr<net::HttpTransaction> trans; |
5921 EXPECT_EQ(net::OK, cache.http_cache()->CreateTransaction( | 5921 EXPECT_EQ(net::OK, cache.http_cache()->CreateTransaction( |
5922 net::IDLE, &trans, NULL)); | 5922 net::IDLE, &trans, NULL)); |
5923 ASSERT_TRUE(trans.get()); | 5923 ASSERT_TRUE(trans.get()); |
5924 | 5924 |
5925 // Shouldn't crash, but doesn't do anything either. | 5925 // Shouldn't crash, but doesn't do anything either. |
5926 trans->SetPriority(net::LOW); | 5926 trans->SetPriority(net::LOW); |
5927 | 5927 |
5928 EXPECT_FALSE(cache.network_layer()->last_transaction()); | 5928 EXPECT_FALSE(cache.network_layer()->last_transaction().get()); |
5929 EXPECT_EQ(net::DEFAULT_PRIORITY, | 5929 EXPECT_EQ(net::DEFAULT_PRIORITY, |
5930 cache.network_layer()->last_create_transaction_priority()); | 5930 cache.network_layer()->last_create_transaction_priority()); |
5931 | 5931 |
5932 net::HttpRequestInfo info; | 5932 net::HttpRequestInfo info; |
5933 info.url = GURL(kSimpleGET_Transaction.url); | 5933 info.url = GURL(kSimpleGET_Transaction.url); |
5934 net::TestCompletionCallback callback; | 5934 net::TestCompletionCallback callback; |
5935 EXPECT_EQ(net::ERR_IO_PENDING, | 5935 EXPECT_EQ(net::ERR_IO_PENDING, |
5936 trans->Start(&info, callback.callback(), net::BoundNetLog())); | 5936 trans->Start(&info, callback.callback(), net::BoundNetLog())); |
5937 | 5937 |
5938 ASSERT_TRUE(cache.network_layer()->last_transaction()); | 5938 ASSERT_TRUE(cache.network_layer()->last_transaction().get()); |
5939 EXPECT_EQ(net::LOW, | 5939 EXPECT_EQ(net::LOW, |
5940 cache.network_layer()->last_create_transaction_priority()); | 5940 cache.network_layer()->last_create_transaction_priority()); |
5941 EXPECT_EQ(net::LOW, | 5941 EXPECT_EQ(net::LOW, |
5942 cache.network_layer()->last_transaction()->priority()); | 5942 cache.network_layer()->last_transaction()->priority()); |
5943 | 5943 |
5944 trans->SetPriority(net::HIGHEST); | 5944 trans->SetPriority(net::HIGHEST); |
5945 EXPECT_EQ(net::LOW, | 5945 EXPECT_EQ(net::LOW, |
5946 cache.network_layer()->last_create_transaction_priority()); | 5946 cache.network_layer()->last_create_transaction_priority()); |
5947 EXPECT_EQ(net::HIGHEST, | 5947 EXPECT_EQ(net::HIGHEST, |
5948 cache.network_layer()->last_transaction()->priority()); | 5948 cache.network_layer()->last_transaction()->priority()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5989 trans->SetPriority(net::HIGHEST); | 5989 trans->SetPriority(net::HIGHEST); |
5990 // Should trigger a new network transaction and pick up the new | 5990 // Should trigger a new network transaction and pick up the new |
5991 // priority. | 5991 // priority. |
5992 ReadAndVerifyTransaction(trans.get(), transaction); | 5992 ReadAndVerifyTransaction(trans.get(), transaction); |
5993 | 5993 |
5994 EXPECT_EQ(net::HIGHEST, | 5994 EXPECT_EQ(net::HIGHEST, |
5995 cache.network_layer()->last_create_transaction_priority()); | 5995 cache.network_layer()->last_create_transaction_priority()); |
5996 | 5996 |
5997 RemoveMockTransaction(&kRangeGET_TransactionOK); | 5997 RemoveMockTransaction(&kRangeGET_TransactionOK); |
5998 } | 5998 } |
OLD | NEW |