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

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

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 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 20 matching lines...) Expand all
31 #include "base/time.h" 31 #include "base/time.h"
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/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/safe_browsing/protocol_manager.h" 35 #include "chrome/browser/safe_browsing/protocol_manager.h"
36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
37 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
39 #include "chrome/test/base/in_process_browser_test.h" 39 #include "chrome/test/base/in_process_browser_test.h"
40 #include "chrome/test/base/ui_test_utils.h" 40 #include "chrome/test/base/ui_test_utils.h"
41 #include "content/public/common/content_url_request_user_data.h"
41 #include "content/public/common/url_fetcher.h" 42 #include "content/public/common/url_fetcher.h"
42 #include "content/public/common/url_fetcher_delegate.h" 43 #include "content/public/common/url_fetcher_delegate.h"
43 #include "content/test/test_browser_thread.h" 44 #include "content/test/test_browser_thread.h"
44 #include "net/base/host_resolver.h" 45 #include "net/base/host_resolver.h"
45 #include "net/base/load_flags.h" 46 #include "net/base/load_flags.h"
46 #include "net/base/net_log.h" 47 #include "net/base/net_log.h"
47 #include "net/test/python_utils.h" 48 #include "net/test/python_utils.h"
48 #include "net/url_request/url_request_status.h" 49 #include "net/url_request/url_request_status.h"
49 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
50 51
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 531 }
531 532
532 // Fetch a URL. If message_loop_started is true, starts the message loop 533 // Fetch a URL. If message_loop_started is true, starts the message loop
533 // so the caller could wait till OnURLFetchComplete is called. 534 // so the caller could wait till OnURLFetchComplete is called.
534 net::URLRequestStatus::Status FetchUrl(const GURL& url) { 535 net::URLRequestStatus::Status FetchUrl(const GURL& url) {
535 url_fetcher_.reset(content::URLFetcher::Create( 536 url_fetcher_.reset(content::URLFetcher::Create(
536 url, content::URLFetcher::GET, this)); 537 url, content::URLFetcher::GET, this));
537 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); 538 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
538 url_fetcher_->SetRequestContext( 539 url_fetcher_->SetRequestContext(
539 Profile::Deprecated::GetDefaultRequestContext()); 540 Profile::Deprecated::GetDefaultRequestContext());
541 url_fetcher_->SetContentURLRequestUserData(
542 new content::ContentURLRequestUserData());
540 url_fetcher_->Start(); 543 url_fetcher_->Start();
541 ui_test_utils::RunMessageLoop(); 544 ui_test_utils::RunMessageLoop();
542 return response_status_; 545 return response_status_;
543 } 546 }
544 547
545 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_; 548 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_;
546 SafeBrowsingServiceTest* safe_browsing_test_; 549 SafeBrowsingServiceTest* safe_browsing_test_;
547 scoped_ptr<content::URLFetcher> url_fetcher_; 550 scoped_ptr<content::URLFetcher> url_fetcher_;
548 std::string response_data_; 551 std::string response_data_;
549 net::URLRequestStatus::Status response_status_; 552 net::URLRequestStatus::Status response_status_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 651 }
649 652
650 // Verifies with server if test is done and waits till server responses. 653 // Verifies with server if test is done and waits till server responses.
651 EXPECT_EQ(net::URLRequestStatus::SUCCESS, 654 EXPECT_EQ(net::URLRequestStatus::SUCCESS,
652 safe_browsing_helper->VerifyTestComplete(server_host, 655 safe_browsing_helper->VerifyTestComplete(server_host,
653 server_port, 656 server_port,
654 last_step)); 657 last_step));
655 EXPECT_EQ("yes", safe_browsing_helper->response_data()); 658 EXPECT_EQ("yes", safe_browsing_helper->response_data());
656 test_server.Stop(); 659 test_server.Stop();
657 } 660 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698