| Index: net/http/http_cache_transaction_unittest.cc
|
| diff --git a/net/http/http_cache_transaction_unittest.cc b/net/http/http_cache_transaction_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..40fde35d75f4cf7230580b4251ef780ff3f9c77b
|
| --- /dev/null
|
| +++ b/net/http/http_cache_transaction_unittest.cc
|
| @@ -0,0 +1,43 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "net/http/http_cache_transaction.h"
|
| +
|
| +#include "net/base/test_completion_callback.h"
|
| +#include "net/http/http_cache.h"
|
| +#include "net/http/http_request_info.h"
|
| +#include "net/http/http_transaction_unittest.h"
|
| +#include "net/http/mock_http_cache.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace net {
|
| +
|
| +class HttpCacheTransactionTest : public ::testing::Test {
|
| + protected:
|
| + MockHttpCache cache_;
|
| +};
|
| +
|
| +// Make sure that calling HttpCache::Transaction passes on its
|
| +// priority updates to its underlying network transaction.
|
| +TEST_F(HttpCacheTransactionTest, SetPriority) {
|
| + scoped_ptr<HttpTransaction> trans;
|
| + ASSERT_EQ(OK, cache_.http_cache()->CreateTransaction(&trans, NULL));
|
| +
|
| + // Shouldn't crash.
|
| + trans->SetPriority(LOW);
|
| +
|
| + HttpRequestInfo info;
|
| + info.priority = MEDIUM;
|
| + TestCompletionCallback callback;
|
| + trans->Start(&info, callback.callback(), BoundNetLog());
|
| +
|
| + ASSERT_TRUE(cache_.network_layer()->last_transaction());
|
| + EXPECT_EQ(MEDIUM, cache_.network_layer()->last_transaction()->priority());
|
| +
|
| + trans->SetPriority(HIGHEST);
|
| + EXPECT_EQ(HIGHEST, cache_.network_layer()->last_transaction()->priority());
|
| +}
|
| +
|
| +} // namespace net
|
| +
|
|
|