OLD | NEW |
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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" | 9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 MOCK_METHOD1(IsInCache, bool(const GURL&)); | 94 MOCK_METHOD1(IsInCache, bool(const GURL&)); |
95 MOCK_METHOD0(OverReportLimit, bool()); | 95 MOCK_METHOD0(OverReportLimit, bool()); |
96 | 96 |
97 private: | 97 private: |
98 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); | 98 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); |
99 }; | 99 }; |
100 | 100 |
101 class MockSafeBrowsingService : public SafeBrowsingService { | 101 class MockSafeBrowsingService : public SafeBrowsingService { |
102 public: | 102 public: |
103 MockSafeBrowsingService() {} | 103 MockSafeBrowsingService() {} |
104 virtual ~MockSafeBrowsingService() {} | |
105 | 104 |
106 MOCK_METHOD1(DoDisplayBlockingPage, void(const UnsafeResource& resource)); | 105 MOCK_METHOD1(DoDisplayBlockingPage, void(const UnsafeResource& resource)); |
107 MOCK_METHOD1(MatchCsdWhitelistUrl, bool(const GURL&)); | 106 MOCK_METHOD1(MatchCsdWhitelistUrl, bool(const GURL&)); |
108 | 107 |
109 // Helper function which calls OnBlockingPageComplete for this client | 108 // Helper function which calls OnBlockingPageComplete for this client |
110 // object. | 109 // object. |
111 void InvokeOnBlockingPageComplete( | 110 void InvokeOnBlockingPageComplete( |
112 const SafeBrowsingService::UrlCheckCallback& callback) { | 111 const SafeBrowsingService::UrlCheckCallback& callback) { |
113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
114 DCHECK(!callback.is_null()); | 113 DCHECK(!callback.is_null()); |
115 // Note: this will delete the client object in the case of the CsdClient | 114 // Note: this will delete the client object in the case of the CsdClient |
116 // implementation. | 115 // implementation. |
117 callback.Run(false); | 116 callback.Run(false); |
118 } | 117 } |
119 | 118 |
| 119 protected: |
| 120 virtual ~MockSafeBrowsingService() {} |
| 121 |
120 private: | 122 private: |
121 DISALLOW_COPY_AND_ASSIGN(MockSafeBrowsingService); | 123 DISALLOW_COPY_AND_ASSIGN(MockSafeBrowsingService); |
122 }; | 124 }; |
123 | 125 |
124 class MockTestingProfile : public TestingProfile { | 126 class MockTestingProfile : public TestingProfile { |
125 public: | 127 public: |
126 MockTestingProfile() {} | 128 MockTestingProfile() {} |
127 virtual ~MockTestingProfile() {} | 129 virtual ~MockTestingProfile() {} |
128 | 130 |
129 MOCK_CONST_METHOD0(IsOffTheRecord, bool()); | 131 MOCK_CONST_METHOD0(IsOffTheRecord, bool()); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); | 782 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); |
781 EXPECT_EQ(url, resource.url); | 783 EXPECT_EQ(url, resource.url); |
782 EXPECT_EQ(url, resource.original_url); | 784 EXPECT_EQ(url, resource.original_url); |
783 resource.callback.Reset(); | 785 resource.callback.Reset(); |
784 msg = process()->sink().GetFirstMessageMatching( | 786 msg = process()->sink().GetFirstMessageMatching( |
785 SafeBrowsingMsg_StartPhishingDetection::ID); | 787 SafeBrowsingMsg_StartPhishingDetection::ID); |
786 ASSERT_FALSE(msg); | 788 ASSERT_FALSE(msg); |
787 } | 789 } |
788 | 790 |
789 } // namespace safe_browsing | 791 } // namespace safe_browsing |
OLD | NEW |