| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 #include "base/string_number_conversions.h" | 24 #include "base/string_number_conversions.h" |
| 25 #include "base/string_split.h" | 25 #include "base/string_split.h" |
| 26 #include "base/stringprintf.h" | 26 #include "base/stringprintf.h" |
| 27 #include "base/synchronization/lock.h" | 27 #include "base/synchronization/lock.h" |
| 28 #include "base/test/test_timeouts.h" | 28 #include "base/test/test_timeouts.h" |
| 29 #include "base/threading/platform_thread.h" | 29 #include "base/threading/platform_thread.h" |
| 30 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
| 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/safe_browsing/protocol_manager.h" | 35 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 37 #include "chrome/browser/ui/browser.h" |
| 36 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
| 37 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 39 #include "chrome/test/base/in_process_browser_test.h" | 41 #include "chrome/test/base/in_process_browser_test.h" |
| 40 #include "chrome/test/base/ui_test_utils.h" | 42 #include "chrome/test/base/ui_test_utils.h" |
| 41 #include "content/public/browser/browser_context.h" | 43 #include "content/public/browser/browser_context.h" |
| 42 #include "content/public/test/test_browser_thread.h" | 44 #include "content/public/test/test_browser_thread.h" |
| 43 #include "net/base/host_resolver.h" | 45 #include "net/base/host_resolver.h" |
| 44 #include "net/base/load_flags.h" | 46 #include "net/base/load_flags.h" |
| 45 #include "net/base/net_log.h" | 47 #include "net/base/net_log.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 540 |
| 539 // See http://crbug.com/96459 | 541 // See http://crbug.com/96459 |
| 540 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, | 542 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, |
| 541 DISABLED_SafeBrowsingSystemTest) { | 543 DISABLED_SafeBrowsingSystemTest) { |
| 542 LOG(INFO) << "Start test"; | 544 LOG(INFO) << "Start test"; |
| 543 const char* server_host = SafeBrowsingTestServer::Host(); | 545 const char* server_host = SafeBrowsingTestServer::Host(); |
| 544 int server_port = SafeBrowsingTestServer::Port(); | 546 int server_port = SafeBrowsingTestServer::Port(); |
| 545 ASSERT_TRUE(InitSafeBrowsingService()); | 547 ASSERT_TRUE(InitSafeBrowsingService()); |
| 546 | 548 |
| 547 net::URLRequestContextGetter* request_context = | 549 net::URLRequestContextGetter* request_context = |
| 548 GetBrowserContext()->GetRequestContext(); | 550 browser()->profile()->GetRequestContext(); |
| 549 scoped_refptr<SafeBrowsingServiceTestHelper> safe_browsing_helper( | 551 scoped_refptr<SafeBrowsingServiceTestHelper> safe_browsing_helper( |
| 550 new SafeBrowsingServiceTestHelper(this, request_context)); | 552 new SafeBrowsingServiceTestHelper(this, request_context)); |
| 551 int last_step = 0; | 553 int last_step = 0; |
| 552 FilePath datafile_path = FilePath(kDataFile); | 554 FilePath datafile_path = FilePath(kDataFile); |
| 553 SafeBrowsingTestServer test_server(datafile_path); | 555 SafeBrowsingTestServer test_server(datafile_path); |
| 554 ASSERT_TRUE(test_server.Start()); | 556 ASSERT_TRUE(test_server.Start()); |
| 555 | 557 |
| 556 // Make sure the server is running. | 558 // Make sure the server is running. |
| 557 safe_browsing_helper->WaitTillServerReady(server_host, server_port); | 559 safe_browsing_helper->WaitTillServerReady(server_host, server_port); |
| 558 | 560 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 632 } |
| 631 | 633 |
| 632 // Verifies with server if test is done and waits till server responses. | 634 // Verifies with server if test is done and waits till server responses. |
| 633 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 635 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 634 safe_browsing_helper->VerifyTestComplete(server_host, | 636 safe_browsing_helper->VerifyTestComplete(server_host, |
| 635 server_port, | 637 server_port, |
| 636 last_step)); | 638 last_step)); |
| 637 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 639 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 638 test_server.Stop(); | 640 test_server.Stop(); |
| 639 } | 641 } |
| OLD | NEW |