OLD | NEW |
1 // Copyright (c) 2009 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/thread.h" | 6 #include "base/thread.h" |
7 #include "base/waitable_event.h" | 7 #include "base/waitable_event.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/url_request/url_request.h" | 9 #include "net/url_request/url_request.h" |
10 #include "net/url_request/url_request_error_job.h" | 10 #include "net/url_request/url_request_error_job.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "webkit/appcache/appcache.h" | 12 #include "webkit/appcache/appcache.h" |
13 #include "webkit/appcache/appcache_request_handler.h" | 13 #include "webkit/appcache/appcache_request_handler.h" |
14 #include "webkit/appcache/appcache_url_request_job.h" | 14 #include "webkit/appcache/appcache_url_request_job.h" |
15 #include "webkit/appcache/mock_appcache_service.h" | 15 #include "webkit/appcache/mock_appcache_service.h" |
16 | 16 |
17 namespace appcache { | 17 namespace appcache { |
18 | 18 |
19 class AppCacheRequestHandlerTest : public testing::Test { | 19 class AppCacheRequestHandlerTest : public testing::Test { |
20 public: | 20 public: |
21 class MockFrontend : public AppCacheFrontend { | 21 class MockFrontend : public AppCacheFrontend { |
22 public: | 22 public: |
23 virtual void OnCacheSelected(int host_id, int64 cache_id , | 23 virtual void OnCacheSelected(int host_id, int64 cache_id , |
24 appcache::Status status) {} | 24 appcache::Status status) {} |
25 | 25 |
26 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 26 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
27 appcache::Status status) {} | 27 appcache::Status status) {} |
28 | 28 |
29 virtual void OnEventRaised(const std::vector<int>& host_ids, | 29 virtual void OnEventRaised(const std::vector<int>& host_ids, |
30 appcache::EventID event_id) {} | 30 appcache::EventID event_id) {} |
| 31 |
| 32 virtual void OnContentBlocked(int host_id) {} |
31 }; | 33 }; |
32 | 34 |
33 // Helper class run a test on our io_thread. The io_thread | 35 // Helper class run a test on our io_thread. The io_thread |
34 // is spun up once and reused for all tests. | 36 // is spun up once and reused for all tests. |
35 template <class Method> | 37 template <class Method> |
36 class WrapperTask : public Task { | 38 class WrapperTask : public Task { |
37 public: | 39 public: |
38 WrapperTask(AppCacheRequestHandlerTest* test, Method method) | 40 WrapperTask(AppCacheRequestHandlerTest* test, Method method) |
39 : test_(test), method_(method) { | 41 : test_(test), method_(method) { |
40 } | 42 } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 TEST_F(AppCacheRequestHandlerTest, UnsupportedScheme) { | 648 TEST_F(AppCacheRequestHandlerTest, UnsupportedScheme) { |
647 RunTestOnIOThread(&AppCacheRequestHandlerTest::UnsupportedScheme); | 649 RunTestOnIOThread(&AppCacheRequestHandlerTest::UnsupportedScheme); |
648 } | 650 } |
649 | 651 |
650 TEST_F(AppCacheRequestHandlerTest, CanceledRequest) { | 652 TEST_F(AppCacheRequestHandlerTest, CanceledRequest) { |
651 RunTestOnIOThread(&AppCacheRequestHandlerTest::CanceledRequest); | 653 RunTestOnIOThread(&AppCacheRequestHandlerTest::CanceledRequest); |
652 } | 654 } |
653 | 655 |
654 } // namespace appcache | 656 } // namespace appcache |
655 | 657 |
OLD | NEW |