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/files/file_path.h" | 5 #include "base/files/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/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 // Test that the callback is NULL when the verdict is not phishing. | 86 // Test that the callback is NULL when the verdict is not phishing. |
87 MATCHER(CallbackIsNull, "") { | 87 MATCHER(CallbackIsNull, "") { |
88 return arg.is_null(); | 88 return arg.is_null(); |
89 } | 89 } |
90 | 90 |
91 ACTION(QuitUIMessageLoop) { | 91 ACTION(QuitUIMessageLoop) { |
92 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
93 base::MessageLoopForUI::current()->Quit(); | 93 base::MessageLoopForUI::current()->QuitWhenIdle(); |
94 } | 94 } |
95 | 95 |
96 ACTION_P(InvokeDoneCallback, verdict) { | 96 ACTION_P(InvokeDoneCallback, verdict) { |
97 scoped_ptr<ClientPhishingRequest> request(::std::tr1::get<1>(args)); | 97 scoped_ptr<ClientPhishingRequest> request(::std::tr1::get<1>(args)); |
98 request->CopyFrom(*verdict); | 98 request->CopyFrom(*verdict); |
99 ::std::tr1::get<2>(args).Run(true, request.Pass()); | 99 ::std::tr1::get<2>(args).Run(true, request.Pass()); |
100 } | 100 } |
101 | 101 |
102 ACTION_P(InvokeMalwareCallback, verdict) { | 102 ACTION_P(InvokeMalwareCallback, verdict) { |
103 scoped_ptr<ClientMalwareRequest> request(::std::tr1::get<1>(args)); | 103 scoped_ptr<ClientMalwareRequest> request(::std::tr1::get<1>(args)); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 EXPECT_EQ(url, resource.url); | 1139 EXPECT_EQ(url, resource.url); |
1140 EXPECT_EQ(url, resource.original_url); | 1140 EXPECT_EQ(url, resource.original_url); |
1141 | 1141 |
1142 ExpectStartPhishingDetection(NULL); | 1142 ExpectStartPhishingDetection(NULL); |
1143 | 1143 |
1144 // Showing a phishing warning will invalidate all the weak pointers which | 1144 // Showing a phishing warning will invalidate all the weak pointers which |
1145 // means we will not extract malware features. | 1145 // means we will not extract malware features. |
1146 ExpectShouldClassifyForMalwareResult(false); | 1146 ExpectShouldClassifyForMalwareResult(false); |
1147 } | 1147 } |
1148 } // namespace safe_browsing | 1148 } // namespace safe_browsing |
OLD | NEW |