| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 rv = cache->OpenEntry(key, &entry, &cb); | 99 rv = cache->OpenEntry(key, &entry, &cb); |
| 100 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 100 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 WriteHeaders(entry, headers); | 103 WriteHeaders(entry, headers); |
| 104 WriteData(entry, data); | 104 WriteData(entry, data); |
| 105 entry->Close(); | 105 entry->Close(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void FillCache(net::URLRequestContextGetter* context_getter) { | 108 void FillCache(net::URLRequestContextGetter* context_getter) { |
| 109 TestOldCompletionCallback cb; | 109 net::TestCompletionCallback cb; |
| 110 disk_cache::Backend* cache; | 110 disk_cache::Backend* cache; |
| 111 int rv = | 111 int rv = |
| 112 context_getter->GetURLRequestContext()->http_transaction_factory()-> | 112 context_getter->GetURLRequestContext()->http_transaction_factory()-> |
| 113 GetCache()->GetBackend(&cache, &cb); | 113 GetCache()->GetBackend(&cache, cb.callback()); |
| 114 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 114 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 115 | 115 |
| 116 std::string empty; | 116 std::string empty; |
| 117 WriteToEntry(cache, kMalwareURL, kMalwareHeaders, kMalwareData); | 117 WriteToEntry(cache, kMalwareURL, kMalwareHeaders, kMalwareData); |
| 118 WriteToEntry(cache, kLandingURL, kLandingHeaders, kLandingData); | 118 WriteToEntry(cache, kLandingURL, kLandingHeaders, kLandingData); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void QuitUIMessageLoop() { | 121 void QuitUIMessageLoop() { |
| 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 123 BrowserThread::PostTask(BrowserThread::UI, | 123 BrowserThread::PostTask(BrowserThread::UI, |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 pb_resource = expected.add_resources(); | 679 pb_resource = expected.add_resources(); |
| 680 pb_resource->set_id(2); | 680 pb_resource->set_id(2); |
| 681 pb_resource->set_parent_id(3); | 681 pb_resource->set_parent_id(3); |
| 682 pb_resource->set_url(kSecondRedirectURL); | 682 pb_resource->set_url(kSecondRedirectURL); |
| 683 pb_resource = expected.add_resources(); | 683 pb_resource = expected.add_resources(); |
| 684 pb_resource->set_id(3); | 684 pb_resource->set_id(3); |
| 685 pb_resource->set_url(kFirstRedirectURL); | 685 pb_resource->set_url(kFirstRedirectURL); |
| 686 | 686 |
| 687 VerifyResults(actual, expected); | 687 VerifyResults(actual, expected); |
| 688 } | 688 } |
| OLD | NEW |