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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "chrome/browser/browser_thread.h" | |
12 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | |
13 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 11 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
14 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 12 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
15 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 13 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
16 #include "chrome/browser/tab_contents/test_tab_contents.h" | |
17 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/ui_test_utils.h" | 15 #include "chrome/test/ui_test_utils.h" |
| 16 #include "content/browser/browser_thread.h" |
| 17 #include "content/browser/renderer_host/test_render_view_host.h" |
| 18 #include "content/browser/tab_contents/test_tab_contents.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gmock/include/gmock/gmock-spec-builders.h" | 21 #include "testing/gmock/include/gmock/gmock-spec-builders.h" |
22 | 22 |
23 using ::testing::_; | 23 using ::testing::_; |
24 using ::testing::DoAll; | 24 using ::testing::DoAll; |
25 using ::testing::Mock; | 25 using ::testing::Mock; |
26 using ::testing::SaveArg; | 26 using ::testing::SaveArg; |
27 | 27 |
28 namespace safe_browsing { | 28 namespace safe_browsing { |
29 | 29 |
30 class MockClientSideDetectionService : public ClientSideDetectionService { | 30 class MockClientSideDetectionService : public ClientSideDetectionService { |
31 public: | 31 public: |
32 MockClientSideDetectionService(const FilePath& model_path) | 32 explicit MockClientSideDetectionService(const FilePath& model_path) |
33 : ClientSideDetectionService(model_path, NULL) {} | 33 : ClientSideDetectionService(model_path, NULL) {} |
34 virtual ~MockClientSideDetectionService() {}; | 34 virtual ~MockClientSideDetectionService() {}; |
35 | 35 |
36 MOCK_METHOD3(SendClientReportPhishingRequest, | 36 MOCK_METHOD3(SendClientReportPhishingRequest, |
37 void(const GURL&, double, ClientReportPhishingRequestCallback*)); | 37 void(const GURL&, double, ClientReportPhishingRequestCallback*)); |
38 | 38 |
39 private: | 39 private: |
40 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); | 40 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); |
41 }; | 41 }; |
42 | 42 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 sb_service_.get(), | 287 sb_service_.get(), |
288 &MockSafeBrowsingService::InvokeOnBlockingPageComplete, | 288 &MockSafeBrowsingService::InvokeOnBlockingPageComplete, |
289 client)); | 289 client)); |
290 // Since the CsdClient object will be deleted on the UI thread I need | 290 // Since the CsdClient object will be deleted on the UI thread I need |
291 // to run the UI message loop. Post a task to stop the UI message loop | 291 // to run the UI message loop. Post a task to stop the UI message loop |
292 // after the client object destructor is called. | 292 // after the client object destructor is called. |
293 FlushIOMessageLoop(); | 293 FlushIOMessageLoop(); |
294 } | 294 } |
295 | 295 |
296 } // namespace safe_browsing | 296 } // namespace safe_browsing |
OLD | NEW |