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

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

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 7 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 // This test uses the safebrowsing test server published at 5 // This test uses the safebrowsing test server published at
6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing 6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing
7 // protocol implemetation. Details of the safebrowsing testing flow is 7 // protocol implemetation. Details of the safebrowsing testing flow is
8 // documented at 8 // documented at
9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting 9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting
10 // 10 //
(...skipping 21 matching lines...) Expand all
32 #include "base/utf_string_conversions.h" 32 #include "base/utf_string_conversions.h"
33 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
34 #include "chrome/browser/safe_browsing/protocol_manager.h" 34 #include "chrome/browser/safe_browsing/protocol_manager.h"
35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 35 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
36 #include "chrome/common/chrome_switches.h" 36 #include "chrome/common/chrome_switches.h"
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "chrome/test/base/in_process_browser_test.h" 38 #include "chrome/test/base/in_process_browser_test.h"
39 #include "chrome/test/base/ui_test_utils.h" 39 #include "chrome/test/base/ui_test_utils.h"
40 #include "content/public/browser/browser_context.h" 40 #include "content/public/browser/browser_context.h"
41 #include "content/public/common/url_fetcher.h" 41 #include "content/public/common/url_fetcher.h"
42 #include "content/public/common/url_fetcher_delegate.h"
43 #include "content/test/test_browser_thread.h" 42 #include "content/test/test_browser_thread.h"
44 #include "net/base/host_resolver.h" 43 #include "net/base/host_resolver.h"
45 #include "net/base/load_flags.h" 44 #include "net/base/load_flags.h"
46 #include "net/base/net_log.h" 45 #include "net/base/net_log.h"
47 #include "net/test/python_utils.h" 46 #include "net/test/python_utils.h"
47 #include "net/url_request/url_fetcher_delegate.h"
48 #include "net/url_request/url_request_status.h" 48 #include "net/url_request/url_request_status.h"
49 #include "testing/gtest/include/gtest/gtest.h" 49 #include "testing/gtest/include/gtest/gtest.h"
50 50
51 using content::BrowserThread; 51 using content::BrowserThread;
52 52
53 namespace { 53 namespace {
54 54
55 const FilePath::CharType kDataFile[] = 55 const FilePath::CharType kDataFile[] =
56 FILE_PATH_LITERAL("testing_input_nomac.dat"); 56 FILE_PATH_LITERAL("testing_input_nomac.dat");
57 const char kUrlVerifyPath[] = "/safebrowsing/verify_urls"; 57 const char kUrlVerifyPath[] = "/safebrowsing/verify_urls";
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 bool is_checked_url_safe_; 341 bool is_checked_url_safe_;
342 342
343 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTest); 343 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTest);
344 }; 344 };
345 345
346 // A ref counted helper class that handles callbacks between IO thread and UI 346 // A ref counted helper class that handles callbacks between IO thread and UI
347 // thread. 347 // thread.
348 class SafeBrowsingServiceTestHelper 348 class SafeBrowsingServiceTestHelper
349 : public base::RefCountedThreadSafe<SafeBrowsingServiceTestHelper>, 349 : public base::RefCountedThreadSafe<SafeBrowsingServiceTestHelper>,
350 public SafeBrowsingService::Client, 350 public SafeBrowsingService::Client,
351 public content::URLFetcherDelegate { 351 public net::URLFetcherDelegate {
352 public: 352 public:
353 SafeBrowsingServiceTestHelper(SafeBrowsingServiceTest* safe_browsing_test, 353 SafeBrowsingServiceTestHelper(SafeBrowsingServiceTest* safe_browsing_test,
354 net::URLRequestContextGetter* request_context) 354 net::URLRequestContextGetter* request_context)
355 : safe_browsing_test_(safe_browsing_test), 355 : safe_browsing_test_(safe_browsing_test),
356 response_status_(net::URLRequestStatus::FAILED), 356 response_status_(net::URLRequestStatus::FAILED),
357 request_context_(request_context) { 357 request_context_(request_context) {
358 } 358 }
359 359
360 // Callbacks for SafeBrowsingService::Client. 360 // Callbacks for SafeBrowsingService::Client.
361 virtual void OnBrowseUrlCheckResult( 361 virtual void OnBrowseUrlCheckResult(
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 644 }
645 645
646 // Verifies with server if test is done and waits till server responses. 646 // Verifies with server if test is done and waits till server responses.
647 EXPECT_EQ(net::URLRequestStatus::SUCCESS, 647 EXPECT_EQ(net::URLRequestStatus::SUCCESS,
648 safe_browsing_helper->VerifyTestComplete(server_host, 648 safe_browsing_helper->VerifyTestComplete(server_host,
649 server_port, 649 server_port,
650 last_step)); 650 last_step));
651 EXPECT_EQ("yes", safe_browsing_helper->response_data()); 651 EXPECT_EQ("yes", safe_browsing_helper->response_data());
652 test_server.Stop(); 652 test_server.Stop();
653 } 653 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.cc ('k') | chrome/browser/search_engines/template_url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698