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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 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) 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 <deque> 5 #include <deque>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 }; 379 };
380 380
381 #if defined(ENABLE_SAFE_BROWSING) 381 #if defined(ENABLE_SAFE_BROWSING)
382 // A SafeBrowingService implementation that returns a fixed result for a given 382 // A SafeBrowingService implementation that returns a fixed result for a given
383 // URL. 383 // URL.
384 class FakeSafeBrowsingService : public SafeBrowsingService { 384 class FakeSafeBrowsingService : public SafeBrowsingService {
385 public: 385 public:
386 FakeSafeBrowsingService() : 386 FakeSafeBrowsingService() :
387 result_(SAFE) {} 387 result_(SAFE) {}
388 388
389 virtual ~FakeSafeBrowsingService() {}
390
391 // Called on the IO thread to check if the given url is safe or not. If we 389 // Called on the IO thread to check if the given url is safe or not. If we
392 // can synchronously determine that the url is safe, CheckUrl returns true. 390 // can synchronously determine that the url is safe, CheckUrl returns true.
393 // Otherwise it returns false, and "client" is called asynchronously with the 391 // Otherwise it returns false, and "client" is called asynchronously with the
394 // result when it is ready. 392 // result when it is ready.
395 // Returns true, indicating a SAFE result, unless the URL is the fixed URL 393 // Returns true, indicating a SAFE result, unless the URL is the fixed URL
396 // specified by the user, and the user-specified result is not SAFE 394 // specified by the user, and the user-specified result is not SAFE
397 // (in which that result will be communicated back via a call into the 395 // (in which that result will be communicated back via a call into the
398 // client, and false will be returned). 396 // client, and false will be returned).
399 // Overrides SafeBrowsingService::CheckBrowseUrl. 397 // Overrides SafeBrowsingService::CheckBrowseUrl.
400 virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) OVERRIDE { 398 virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) OVERRIDE {
401 if (gurl != url_ || result_ == SAFE) 399 if (gurl != url_ || result_ == SAFE)
402 return true; 400 return true;
403 401
404 BrowserThread::PostTask( 402 BrowserThread::PostTask(
405 BrowserThread::IO, FROM_HERE, 403 BrowserThread::IO, FROM_HERE,
406 base::Bind(&FakeSafeBrowsingService::OnCheckBrowseURLDone, this, gurl, 404 base::Bind(&FakeSafeBrowsingService::OnCheckBrowseURLDone, this, gurl,
407 client)); 405 client));
408 return false; 406 return false;
409 } 407 }
410 408
411 void SetResultForUrl(const GURL& url, UrlCheckResult result) { 409 void SetResultForUrl(const GURL& url, UrlCheckResult result) {
412 url_ = url; 410 url_ = url;
413 result_ = result; 411 result_ = result;
414 } 412 }
415 413
416 private: 414 private:
415 virtual ~FakeSafeBrowsingService() {}
416
417 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { 417 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) {
418 SafeBrowsingService::SafeBrowsingCheck check; 418 SafeBrowsingService::SafeBrowsingCheck check;
419 check.urls.push_back(gurl); 419 check.urls.push_back(gurl);
420 check.client = client; 420 check.client = client;
421 check.result = result_; 421 check.result = result_;
422 client->OnSafeBrowsingResult(check); 422 client->OnSafeBrowsingResult(check);
423 } 423 }
424 424
425 GURL url_; 425 GURL url_;
426 UrlCheckResult result_; 426 UrlCheckResult result_;
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 WebContents* web_contents = browser()->GetSelectedWebContents(); 2147 WebContents* web_contents = browser()->GetSelectedWebContents();
2148 bool display_test_result = false; 2148 bool display_test_result = false;
2149 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 2149 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
2150 web_contents->GetRenderViewHost(), L"", 2150 web_contents->GetRenderViewHost(), L"",
2151 L"DidDisplayReallyPass()", 2151 L"DidDisplayReallyPass()",
2152 &display_test_result)); 2152 &display_test_result));
2153 ASSERT_TRUE(display_test_result); 2153 ASSERT_TRUE(display_test_result);
2154 } 2154 }
2155 2155
2156 } // namespace prerender 2156 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/pepper_gtalk_message_filter.cc ('k') | chrome/browser/renderer_host/plugin_info_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698