| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/thread.h" | 8 #include "base/thread.h" |
| 9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // we mock them up. | 37 // we mock them up. |
| 38 class MockHttpServer { | 38 class MockHttpServer { |
| 39 public: | 39 public: |
| 40 static GURL GetMockUrl(const std::string& path) { | 40 static GURL GetMockUrl(const std::string& path) { |
| 41 return GURL("http://mockhost/" + path); | 41 return GURL("http://mockhost/" + path); |
| 42 } | 42 } |
| 43 | 43 |
| 44 static net::URLRequestJob* JobFactory(net::URLRequest* request, | 44 static net::URLRequestJob* JobFactory(net::URLRequest* request, |
| 45 const std::string& scheme) { | 45 const std::string& scheme) { |
| 46 if (request->url().host() != "mockhost") | 46 if (request->url().host() != "mockhost") |
| 47 return new URLRequestErrorJob(request, -1); | 47 return new net::URLRequestErrorJob(request, -1); |
| 48 | 48 |
| 49 std::string headers, body; | 49 std::string headers, body; |
| 50 GetMockResponse(request->url().path(), &headers, &body); | 50 GetMockResponse(request->url().path(), &headers, &body); |
| 51 return new URLRequestTestJob(request, headers, body, true); | 51 return new URLRequestTestJob(request, headers, body, true); |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 static void GetMockResponse(const std::string& path, | 55 static void GetMockResponse(const std::string& path, |
| 56 std::string* headers, | 56 std::string* headers, |
| 57 std::string* body) { | 57 std::string* body) { |
| (...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 RunTestOnIOThread(&AppCacheUpdateJobTest::MultipleHeadersRefetchTest); | 3457 RunTestOnIOThread(&AppCacheUpdateJobTest::MultipleHeadersRefetchTest); |
| 3458 } | 3458 } |
| 3459 | 3459 |
| 3460 } // namespace appcache | 3460 } // namespace appcache |
| 3461 | 3461 |
| 3462 // AppCacheUpdateJobTest is expected to always live longer than the | 3462 // AppCacheUpdateJobTest is expected to always live longer than the |
| 3463 // runnable methods. This lets us call NewRunnableMethod on its instances. | 3463 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 3464 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheUpdateJobTest); | 3464 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheUpdateJobTest); |
| 3465 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 3465 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
| 3466 appcache::AppCacheUpdateJobTest::MockAppCachePolicy); | 3466 appcache::AppCacheUpdateJobTest::MockAppCachePolicy); |
| OLD | NEW |