| 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" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // interstitial page we know that it would have been posted before | 152 // interstitial page we know that it would have been posted before |
| 153 // we put the quit message there. | 153 // we put the quit message there. |
| 154 BrowserThread::PostTask(BrowserThread::IO, | 154 BrowserThread::PostTask(BrowserThread::IO, |
| 155 FROM_HERE, | 155 FROM_HERE, |
| 156 NewRunnableFunction(&QuitUIMessageLoop)); | 156 NewRunnableFunction(&QuitUIMessageLoop)); |
| 157 MessageLoop::current()->Run(); | 157 MessageLoop::current()->Run(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ExpectPreClassificationChecks(const GURL& url, | 160 void ExpectPreClassificationChecks(const GURL& url, |
| 161 const bool* is_private, | 161 const bool* is_private, |
| 162 const bool* is_off_the_record, | 162 const bool* is_incognito, |
| 163 const bool* match_csd_whitelist, | 163 const bool* match_csd_whitelist, |
| 164 const bool* get_valid_cached_result, | 164 const bool* get_valid_cached_result, |
| 165 const bool* is_in_cache, | 165 const bool* is_in_cache, |
| 166 const bool* over_report_limit) { | 166 const bool* over_report_limit) { |
| 167 if (is_private) { | 167 if (is_private) { |
| 168 EXPECT_CALL(*csd_service_, IsPrivateIPAddress(_)) | 168 EXPECT_CALL(*csd_service_, IsPrivateIPAddress(_)) |
| 169 .WillOnce(Return(*is_private)); | 169 .WillOnce(Return(*is_private)); |
| 170 } | 170 } |
| 171 if (is_off_the_record) { | 171 if (is_incognito) { |
| 172 EXPECT_CALL(*mock_profile_, IsOffTheRecord()) | 172 EXPECT_CALL(*mock_profile_, IsOffTheRecord()) |
| 173 .WillRepeatedly(Return(*is_off_the_record)); | 173 .WillRepeatedly(Return(*is_incognito)); |
| 174 } | 174 } |
| 175 if (match_csd_whitelist) { | 175 if (match_csd_whitelist) { |
| 176 EXPECT_CALL(*sb_service_, MatchCsdWhitelistUrl(url)) | 176 EXPECT_CALL(*sb_service_, MatchCsdWhitelistUrl(url)) |
| 177 .WillOnce(Return(*match_csd_whitelist)); | 177 .WillOnce(Return(*match_csd_whitelist)); |
| 178 } | 178 } |
| 179 if (get_valid_cached_result) { | 179 if (get_valid_cached_result) { |
| 180 EXPECT_CALL(*csd_service_, GetValidCachedResult(url, NotNull())) | 180 EXPECT_CALL(*csd_service_, GetValidCachedResult(url, NotNull())) |
| 181 .WillOnce(DoAll(SetArgumentPointee<1>(true), | 181 .WillOnce(DoAll(SetArgumentPointee<1>(true), |
| 182 Return(*get_valid_cached_result))); | 182 Return(*get_valid_cached_result))); |
| 183 } | 183 } |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Now we check that all expected functions were indeed called on the two | 535 // Now we check that all expected functions were indeed called on the two |
| 536 // service objects. | 536 // service objects. |
| 537 EXPECT_TRUE(Mock::VerifyAndClear(csd_service_.get())); | 537 EXPECT_TRUE(Mock::VerifyAndClear(csd_service_.get())); |
| 538 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); | 538 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); |
| 539 msg = process()->sink().GetFirstMessageMatching( | 539 msg = process()->sink().GetFirstMessageMatching( |
| 540 SafeBrowsingMsg_StartPhishingDetection::ID); | 540 SafeBrowsingMsg_StartPhishingDetection::ID); |
| 541 ASSERT_FALSE(msg); | 541 ASSERT_FALSE(msg); |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace safe_browsing | 544 } // namespace safe_browsing |
| OLD | NEW |