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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 #include "net/url_request/url_fetcher_delegate.h" | 52 #include "net/url_request/url_fetcher_delegate.h" |
53 #include "net/url_request/url_request_status.h" | 53 #include "net/url_request/url_request_status.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
55 | 55 |
56 using content::BrowserThread; | 56 using content::BrowserThread; |
57 | 57 |
58 #ifndef SAFE_BROWSING_DB_LOCAL | 58 #ifndef SAFE_BROWSING_DB_LOCAL |
59 #error This test requires the SAFE_BROWSING_DB_LOCAL implementation. | 59 #error This test requires the SAFE_BROWSING_DB_LOCAL implementation. |
60 #endif | 60 #endif |
61 | 61 |
62 namespace { | 62 namespace { |
Nathan Parker
2015/11/05 22:00:53
namespace safe_browsing
vakh (old account. dont use)
2015/11/07 01:22:56
As best as I can tell, these definitions are only
| |
63 | 63 |
64 const base::FilePath::CharType kDataFile[] = | 64 const base::FilePath::CharType kDataFile[] = |
65 FILE_PATH_LITERAL("testing_input_nomac.dat"); | 65 FILE_PATH_LITERAL("testing_input_nomac.dat"); |
66 const char kUrlVerifyPath[] = "safebrowsing/verify_urls"; | 66 const char kUrlVerifyPath[] = "safebrowsing/verify_urls"; |
67 const char kDBVerifyPath[] = "safebrowsing/verify_database"; | 67 const char kDBVerifyPath[] = "safebrowsing/verify_database"; |
68 const char kTestCompletePath[] = "test_complete"; | 68 const char kTestCompletePath[] = "test_complete"; |
69 | 69 |
70 struct PhishingUrl { | 70 struct PhishingUrl { |
71 std::string url; | 71 std::string url; |
72 std::string list_name; | 72 std::string list_name; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 SafeBrowsingService* CreateSafeBrowsingService() override { | 141 SafeBrowsingService* CreateSafeBrowsingService() override { |
142 return new FakeSafeBrowsingService(url_prefix_); | 142 return new FakeSafeBrowsingService(url_prefix_); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 std::string url_prefix_; | 146 std::string url_prefix_; |
147 }; | 147 }; |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 namespace safe_browsing { | |
152 | |
151 // This starts the browser and keeps status of states related to SafeBrowsing. | 153 // This starts the browser and keeps status of states related to SafeBrowsing. |
152 class SafeBrowsingServerTest : public InProcessBrowserTest { | 154 class SafeBrowsingServerTest : public InProcessBrowserTest { |
153 public: | 155 public: |
154 SafeBrowsingServerTest() | 156 SafeBrowsingServerTest() |
155 : safe_browsing_service_(NULL), | 157 : safe_browsing_service_(NULL), |
156 is_database_ready_(true), | 158 is_database_ready_(true), |
157 is_update_scheduled_(false), | 159 is_update_scheduled_(false), |
158 is_checked_url_in_db_(false), | 160 is_checked_url_in_db_(false), |
159 is_checked_url_safe_(false) { | 161 is_checked_url_safe_(false) { |
160 } | 162 } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 573 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
572 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 574 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
573 last_step = step; | 575 last_step = step; |
574 } | 576 } |
575 | 577 |
576 // Verifies with server if test is done and waits till server responses. | 578 // Verifies with server if test is done and waits till server responses. |
577 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 579 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
578 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 580 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
579 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 581 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
580 } | 582 } |
583 | |
584 } // namespace safe_browsing | |
OLD | NEW |