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

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

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ParseJson in test Created 4 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
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test, 348 SafeBrowsingServerTestHelper(SafeBrowsingServerTest* safe_browsing_test,
349 net::URLRequestContextGetter* request_context) 349 net::URLRequestContextGetter* request_context)
350 : safe_browsing_test_(safe_browsing_test), 350 : safe_browsing_test_(safe_browsing_test),
351 response_status_(net::URLRequestStatus::FAILED), 351 response_status_(net::URLRequestStatus::FAILED),
352 request_context_(request_context) { 352 request_context_(request_context) {
353 } 353 }
354 354
355 // Callbacks for SafeBrowsingDatabaseManager::Client. 355 // Callbacks for SafeBrowsingDatabaseManager::Client.
356 void OnCheckBrowseUrlResult(const GURL& url, 356 void OnCheckBrowseUrlResult(const GURL& url,
357 SBThreatType threat_type, 357 SBThreatType threat_type,
358 const std::string& metadata) override { 358 const ThreatMetadata& metadata) override {
359 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); 359 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
360 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); 360 EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db());
361 safe_browsing_test_->set_is_checked_url_safe( 361 safe_browsing_test_->set_is_checked_url_safe(
362 threat_type == SB_THREAT_TYPE_SAFE); 362 threat_type == SB_THREAT_TYPE_SAFE);
363 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 363 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
364 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this)); 364 base::Bind(&SafeBrowsingServerTestHelper::OnCheckUrlDone, this));
365 } 365 }
366 366
367 virtual void OnBlockingPageComplete(bool proceed) { 367 virtual void OnBlockingPageComplete(bool proceed) {
368 NOTREACHED() << "Not implemented."; 368 NOTREACHED() << "Not implemented.";
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 582 }
583 583
584 // Verifies with server if test is done and waits till server responses. 584 // Verifies with server if test is done and waits till server responses.
585 EXPECT_EQ(net::URLRequestStatus::SUCCESS, 585 EXPECT_EQ(net::URLRequestStatus::SUCCESS,
586 safe_browsing_helper->VerifyTestComplete(spawned_test_server(), 586 safe_browsing_helper->VerifyTestComplete(spawned_test_server(),
587 last_step)); 587 last_step));
588 EXPECT_EQ("yes", safe_browsing_helper->response_data()); 588 EXPECT_EQ("yes", safe_browsing_helper->response_data());
589 } 589 }
590 590
591 } // namespace safe_browsing 591 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc ('k') | chrome/browser/safe_browsing/ui_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698