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

Side by Side Diff: net/http/http_cache_unittest.cc

Issue 20737002: Change the API of disk_cache::CreateCacheBackend to use scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new test Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 1917
1918 // Just to make sure that everything is still pending. 1918 // Just to make sure that everything is still pending.
1919 base::MessageLoop::current()->RunUntilIdle(); 1919 base::MessageLoop::current()->RunUntilIdle();
1920 1920
1921 // The request should be creating the disk cache. 1921 // The request should be creating the disk cache.
1922 EXPECT_FALSE(c->callback.have_result()); 1922 EXPECT_FALSE(c->callback.have_result());
1923 1923
1924 // We cannot call FinishCreation because the factory itself will go away with 1924 // We cannot call FinishCreation because the factory itself will go away with
1925 // the cache, so grab the callback and attempt to use it. 1925 // the cache, so grab the callback and attempt to use it.
1926 net::CompletionCallback callback = factory->callback(); 1926 net::CompletionCallback callback = factory->callback();
1927 disk_cache::Backend** backend = factory->backend(); 1927 scoped_ptr<disk_cache::Backend>* backend = factory->backend();
1928 1928
1929 cache.reset(); 1929 cache.reset();
1930 base::MessageLoop::current()->RunUntilIdle(); 1930 base::MessageLoop::current()->RunUntilIdle();
1931 1931
1932 *backend = NULL; 1932 backend->reset();
1933 callback.Run(net::ERR_ABORTED); 1933 callback.Run(net::ERR_ABORTED);
1934 } 1934 }
1935 1935
1936 // Tests that we can delete the cache while creating the backend, from within 1936 // Tests that we can delete the cache while creating the backend, from within
1937 // one of the callbacks. 1937 // one of the callbacks.
1938 TEST(HttpCache, DeleteCacheWaitingForBackend2) { 1938 TEST(HttpCache, DeleteCacheWaitingForBackend2) {
1939 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory(); 1939 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
1940 MockHttpCache* cache = new MockHttpCache(factory); 1940 MockHttpCache* cache = new MockHttpCache(factory);
1941 1941
1942 DeleteCacheCompletionCallback cb(cache); 1942 DeleteCacheCompletionCallback cb(cache);
(...skipping 4051 matching lines...) Expand 10 before | Expand all | Expand 10 after
5994 trans->SetPriority(net::HIGHEST); 5994 trans->SetPriority(net::HIGHEST);
5995 // Should trigger a new network transaction and pick up the new 5995 // Should trigger a new network transaction and pick up the new
5996 // priority. 5996 // priority.
5997 ReadAndVerifyTransaction(trans.get(), transaction); 5997 ReadAndVerifyTransaction(trans.get(), transaction);
5998 5998
5999 EXPECT_EQ(net::HIGHEST, 5999 EXPECT_EQ(net::HIGHEST,
6000 cache.network_layer()->last_create_transaction_priority()); 6000 cache.network_layer()->last_create_transaction_priority());
6001 6001
6002 RemoveMockTransaction(&kRangeGET_TransactionOK); 6002 RemoveMockTransaction(&kRangeGET_TransactionOK);
6003 } 6003 }
OLDNEW
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698