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

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

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 years, 3 months 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 5
6 #include "chrome/browser/prefs/pref_service.h" 6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/safe_browsing/malware_details.h" 8 #include "chrome/browser/safe_browsing/malware_details.h"
9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
11 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
12 #include "content/browser/renderer_host/test_render_view_host.h"
13 #include "content/browser/tab_contents/navigation_entry.h" 13 #include "content/browser/tab_contents/navigation_entry.h"
14 #include "content/browser/tab_contents/test_tab_contents.h" 14 #include "content/browser/tab_contents/test_tab_contents.h"
15 #include "content/common/view_messages.h" 15 #include "content/common/view_messages.h"
16 16
17 static const char* kGoogleURL = "http://www.google.com/"; 17 static const char* kGoogleURL = "http://www.google.com/";
18 static const char* kGoodURL = "http://www.goodguys.com/"; 18 static const char* kGoodURL = "http://www.goodguys.com/";
19 static const char* kBadURL = "http://www.badguys.com/"; 19 static const char* kBadURL = "http://www.badguys.com/";
20 static const char* kBadURL2 = "http://www.badguys2.com/"; 20 static const char* kBadURL2 = "http://www.badguys2.com/";
21 static const char* kBadURL3 = "http://www.badguys3.com/"; 21 static const char* kBadURL3 = "http://www.badguys3.com/";
22 22
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 61 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
62 SafeBrowsingService* service, 62 SafeBrowsingService* service,
63 TabContents* tab_contents, 63 TabContents* tab_contents,
64 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { 64 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) {
65 return new TestSafeBrowsingBlockingPage(service, tab_contents, 65 return new TestSafeBrowsingBlockingPage(service, tab_contents,
66 unsafe_resources); 66 unsafe_resources);
67 } 67 }
68 }; 68 };
69 69
70 class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness, 70 class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness,
71 public SafeBrowsingService::Client { 71 public SafeBrowsingService::Client {
72 public: 72 public:
73 // The decision the user made. 73 // The decision the user made.
74 enum UserResponse { 74 enum UserResponse {
75 PENDING, 75 PENDING,
76 OK, 76 OK,
77 CANCEL 77 CANCEL
78 }; 78 };
79 79
80 SafeBrowsingBlockingPageTest() 80 SafeBrowsingBlockingPageTest()
81 : ui_thread_(BrowserThread::UI, MessageLoop::current()), 81 : ui_thread_(BrowserThread::UI, MessageLoop::current()),
82 io_thread_(BrowserThread::IO, MessageLoop::current()) { 82 io_thread_(BrowserThread::IO, MessageLoop::current()) {
83 ResetUserResponse(); 83 ResetUserResponse();
84 service_ = new TestSafeBrowsingService(); 84 service_ = new TestSafeBrowsingService();
85 } 85 }
86 86
87 virtual void SetUp() { 87 virtual void SetUp() {
88 RenderViewHostTestHarness::SetUp(); 88 ChromeRenderViewHostTestHarness::SetUp();
89 SafeBrowsingBlockingPage::RegisterFactory(&factory_); 89 SafeBrowsingBlockingPage::RegisterFactory(&factory_);
90 ResetUserResponse(); 90 ResetUserResponse();
91 } 91 }
92 92
93 // SafeBrowsingService::Client implementation. 93 // SafeBrowsingService::Client implementation.
94 virtual void OnUrlCheckResult(const GURL& url, 94 virtual void OnUrlCheckResult(const GURL& url,
95 SafeBrowsingService::UrlCheckResult result) { 95 SafeBrowsingService::UrlCheckResult result) {
96 } 96 }
97 virtual void OnBlockingPageComplete(bool proceed) { 97 virtual void OnBlockingPageComplete(bool proceed) {
98 if (proceed) 98 if (proceed)
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 585
586 EXPECT_TRUE(profile->GetPrefs()->GetBoolean( 586 EXPECT_TRUE(profile->GetPrefs()->GetBoolean(
587 prefs::kSafeBrowsingReportingEnabled)); 587 prefs::kSafeBrowsingReportingEnabled));
588 588
589 // Simulate the user uncheck the report agreement checkbox. 589 // Simulate the user uncheck the report agreement checkbox.
590 sb_interstitial->SetReportingPreference(false); 590 sb_interstitial->SetReportingPreference(false);
591 591
592 EXPECT_FALSE(profile->GetPrefs()->GetBoolean( 592 EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
593 prefs::kSafeBrowsingReportingEnabled)); 593 prefs::kSafeBrowsingReportingEnabled));
594 } 594 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/malware_details_unittest.cc ('k') | chrome/browser/sessions/tab_restore_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698