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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 // Adds a page to history. | 299 // Adds a page to history. |
300 // The redirects is the redirect url chain leading to the url. | 300 // The redirects is the redirect url chain leading to the url. |
301 void AddPageToHistory(const GURL& url, | 301 void AddPageToHistory(const GURL& url, |
302 history::RedirectList* redirects) { | 302 history::RedirectList* redirects) { |
303 // The last item of the redirect chain has to be the final url when adding | 303 // The last item of the redirect chain has to be the final url when adding |
304 // to history backend. | 304 // to history backend. |
305 redirects->push_back(url); | 305 redirects->push_back(url); |
306 history_service()->AddPage( | 306 history_service()->AddPage( |
307 url, static_cast<void*>(this), 0, GURL(), | 307 url, base::Time::Now(), static_cast<void*>(this), 0, GURL(), |
308 content::PAGE_TRANSITION_TYPED, | 308 *redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
309 *redirects, history::SOURCE_BROWSED, false); | 309 false); |
310 } | 310 } |
311 | 311 |
312 content::TestBrowserThread ui_thread_; | 312 content::TestBrowserThread ui_thread_; |
313 content::TestBrowserThread io_thread_; | 313 content::TestBrowserThread io_thread_; |
314 scoped_refptr<MockSafeBrowsingService> sb_service_; | 314 scoped_refptr<MockSafeBrowsingService> sb_service_; |
315 }; | 315 }; |
316 | 316 |
317 // Tests creating a simple malware report. | 317 // Tests creating a simple malware report. |
318 TEST_F(MalwareDetailsTest, MalwareSubResource) { | 318 TEST_F(MalwareDetailsTest, MalwareSubResource) { |
319 // Start a load. | 319 // Start a load. |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 pb_resource = expected.add_resources(); | 683 pb_resource = expected.add_resources(); |
684 pb_resource->set_id(2); | 684 pb_resource->set_id(2); |
685 pb_resource->set_parent_id(3); | 685 pb_resource->set_parent_id(3); |
686 pb_resource->set_url(kSecondRedirectURL); | 686 pb_resource->set_url(kSecondRedirectURL); |
687 pb_resource = expected.add_resources(); | 687 pb_resource = expected.add_resources(); |
688 pb_resource->set_id(3); | 688 pb_resource->set_id(3); |
689 pb_resource->set_url(kFirstRedirectURL); | 689 pb_resource->set_url(kFirstRedirectURL); |
690 | 690 |
691 VerifyResults(actual, expected); | 691 VerifyResults(actual, expected); |
692 } | 692 } |
OLD | NEW |