Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 8437002: Move BrowserThread to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few updates. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // This test creates a fake safebrowsing service, where we can inject 5 // This test creates a fake safebrowsing service, where we can inject
6 // malware and phishing urls. It then uses a real browser to go to 6 // malware and phishing urls. It then uses a real browser to go to
7 // these urls, and sends "goback" or "proceed" commands and verifies 7 // these urls, and sends "goback" or "proceed" commands and verifies
8 // they work. 8 // they work.
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/safe_browsing/malware_details.h" 14 #include "chrome/browser/safe_browsing/malware_details.h"
15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/browser/renderer_host/render_process_host.h" 23 #include "content/browser/renderer_host/render_process_host.h"
24 #include "content/browser/renderer_host/resource_dispatcher_host.h" 24 #include "content/browser/renderer_host/resource_dispatcher_host.h"
25 #include "content/browser/tab_contents/tab_contents.h" 25 #include "content/browser/tab_contents/tab_contents.h"
26 #include "content/browser/tab_contents/tab_contents_view.h" 26 #include "content/browser/tab_contents/tab_contents_view.h"
27 #include "content/test/test_browser_thread.h" 27 #include "content/test/test_browser_thread.h"
28 28
29 using content::BrowserThread;
30
29 // A SafeBrowingService class that allows us to inject the malicious URLs. 31 // A SafeBrowingService class that allows us to inject the malicious URLs.
30 class FakeSafeBrowsingService : public SafeBrowsingService { 32 class FakeSafeBrowsingService : public SafeBrowsingService {
31 public: 33 public:
32 FakeSafeBrowsingService() {} 34 FakeSafeBrowsingService() {}
33 35
34 virtual ~FakeSafeBrowsingService() {} 36 virtual ~FakeSafeBrowsingService() {}
35 37
36 // Called on the IO thread to check if the given url is safe or not. If we 38 // Called on the IO thread to check if the given url is safe or not. If we
37 // can synchronously determine that the url is safe, CheckUrl returns true. 39 // can synchronously determine that the url is safe, CheckUrl returns true.
38 // Otherwise it returns false, and "client" is called asynchronously with the 40 // Otherwise it returns false, and "client" is called asynchronously with the
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 prefs::kSafeBrowsingReportingEnabled)); 550 prefs::kSafeBrowsingReportingEnabled));
549 551
550 SendCommand("\"proceed\""); // Simulate the user clicking "back" 552 SendCommand("\"proceed\""); // Simulate the user clicking "back"
551 AssertNoInterstitial(true); // Assert the interstitial is gone 553 AssertNoInterstitial(true); // Assert the interstitial is gone
552 554
553 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); 555 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL());
554 AssertReportSent(); 556 AssertReportSent();
555 } 557 }
556 558
557 } // namespace 559 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698