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

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

Issue 1100223002: Update {virtual,override} to follow C++11 style in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
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 creates a safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 static void GenUrlFullhashResult(const GURL& url, 392 static void GenUrlFullhashResult(const GURL& url,
393 int list_id, 393 int list_id,
394 SBFullHashResult* full_hash) { 394 SBFullHashResult* full_hash) {
395 std::string host; 395 std::string host;
396 std::string path; 396 std::string path;
397 safe_browsing_util::CanonicalizeUrl(url, &host, &path, NULL); 397 safe_browsing_util::CanonicalizeUrl(url, &host, &path, NULL);
398 full_hash->hash = SBFullHashForString(host + path); 398 full_hash->hash = SBFullHashForString(host + path);
399 full_hash->list_id = list_id; 399 full_hash->list_id = list_id;
400 } 400 }
401 401
402 virtual void SetUp() { 402 void SetUp() override {
403 // InProcessBrowserTest::SetUp() instantiates SafebrowsingService and 403 // InProcessBrowserTest::SetUp() instantiates SafebrowsingService and
404 // RegisterFactory has to be called before SafeBrowsingService is created. 404 // RegisterFactory has to be called before SafeBrowsingService is created.
405 sb_factory_.reset(new TestSafeBrowsingServiceFactory( 405 sb_factory_.reset(new TestSafeBrowsingServiceFactory(
406 "https://definatelynotarealdomain/safebrowsing")); 406 "https://definatelynotarealdomain/safebrowsing"));
407 SafeBrowsingService::RegisterFactory(sb_factory_.get()); 407 SafeBrowsingService::RegisterFactory(sb_factory_.get());
408 SafeBrowsingDatabase::RegisterFactory(&db_factory_); 408 SafeBrowsingDatabase::RegisterFactory(&db_factory_);
409 SafeBrowsingProtocolManager::RegisterFactory(&pm_factory_); 409 SafeBrowsingProtocolManager::RegisterFactory(&pm_factory_);
410 InProcessBrowserTest::SetUp(); 410 InProcessBrowserTest::SetUp();
411 } 411 }
412 412
413 virtual void TearDown() { 413 void TearDown() override {
414 InProcessBrowserTest::TearDown(); 414 InProcessBrowserTest::TearDown();
415 415
416 // Unregister test factories after InProcessBrowserTest::TearDown 416 // Unregister test factories after InProcessBrowserTest::TearDown
417 // (which destructs SafeBrowsingService). 417 // (which destructs SafeBrowsingService).
418 SafeBrowsingDatabase::RegisterFactory(NULL); 418 SafeBrowsingDatabase::RegisterFactory(NULL);
419 SafeBrowsingProtocolManager::RegisterFactory(NULL); 419 SafeBrowsingProtocolManager::RegisterFactory(NULL);
420 SafeBrowsingService::RegisterFactory(NULL); 420 SafeBrowsingService::RegisterFactory(NULL);
421 } 421 }
422 422
423 virtual void SetUpCommandLine(base::CommandLine* command_line) override { 423 void SetUpCommandLine(base::CommandLine* command_line) override {
424 // Makes sure the auto update is not triggered during the test. 424 // Makes sure the auto update is not triggered during the test.
425 // This test will fill up the database using testing prefixes 425 // This test will fill up the database using testing prefixes
426 // and urls. 426 // and urls.
427 command_line->AppendSwitch(switches::kSbDisableAutoUpdate); 427 command_line->AppendSwitch(switches::kSbDisableAutoUpdate);
428 #if defined(OS_CHROMEOS) 428 #if defined(OS_CHROMEOS)
429 command_line->AppendSwitch( 429 command_line->AppendSwitch(
430 chromeos::switches::kIgnoreUserProfileMappingForTests); 430 chromeos::switches::kIgnoreUserProfileMappingForTests);
431 #endif 431 #endif
432 } 432 }
433 433
434 void SetUpOnMainThread() override { 434 void SetUpOnMainThread() override {
435 InProcessBrowserTest::SetUpOnMainThread(); 435 InProcessBrowserTest::SetUpOnMainThread();
436 g_browser_process->safe_browsing_service()->ui_manager()->AddObserver( 436 g_browser_process->safe_browsing_service()->ui_manager()->AddObserver(
437 &observer_); 437 &observer_);
438 } 438 }
439 439
440 void TearDownOnMainThread() override { 440 void TearDownOnMainThread() override {
441 g_browser_process->safe_browsing_service()->ui_manager()->RemoveObserver( 441 g_browser_process->safe_browsing_service()->ui_manager()->RemoveObserver(
442 &observer_); 442 &observer_);
443 InProcessBrowserTest::TearDownOnMainThread(); 443 InProcessBrowserTest::TearDownOnMainThread();
444 } 444 }
445 445
446 virtual void SetUpInProcessBrowserTestFixture() { 446 void SetUpInProcessBrowserTestFixture() override {
447 ASSERT_TRUE(test_server()->Start()); 447 ASSERT_TRUE(test_server()->Start());
448 } 448 }
449 449
450 // This will setup the "url" prefix in database and prepare protocol manager 450 // This will setup the "url" prefix in database and prepare protocol manager
451 // to respond with |full_hash|, as well as other |full_hash|es previously set 451 // to respond with |full_hash|, as well as other |full_hash|es previously set
452 // via this call, on GetFullHash requests. 452 // via this call, on GetFullHash requests.
453 void SetupResponseForUrl(const GURL& url, const SBFullHashResult& full_hash) { 453 void SetupResponseForUrl(const GURL& url, const SBFullHashResult& full_hash) {
454 std::vector<SBPrefix> prefix_hits; 454 std::vector<SBPrefix> prefix_hits;
455 prefix_hits.push_back(full_hash.hash.prefix); 455 prefix_hits.push_back(full_hash.hash.prefix);
456 456
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 content::WindowedNotificationObserver observer( 1263 content::WindowedNotificationObserver observer(
1264 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, 1264 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE,
1265 content::Source<SafeBrowsingDatabaseManager>( 1265 content::Source<SafeBrowsingDatabaseManager>(
1266 sb_service_->database_manager().get())); 1266 sb_service_->database_manager().get()));
1267 BrowserThread::PostTask( 1267 BrowserThread::PostTask(
1268 BrowserThread::IO, 1268 BrowserThread::IO,
1269 FROM_HERE, 1269 FROM_HERE,
1270 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); 1270 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this));
1271 observer.Wait(); 1271 observer.Wait();
1272 } 1272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698