OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // |
11 // This test launches safebrowsing test server and issues several update | 11 // This test launches safebrowsing test server and issues several update |
12 // requests against that server. Each update would get different data and after | 12 // requests against that server. Each update would get different data and after |
13 // each update, the test will get a list of URLs from the test server to verify | 13 // each update, the test will get a list of URLs from the test server to verify |
14 // its repository. The test will succeed only if all updates are performed and | 14 // its repository. The test will succeed only if all updates are performed and |
15 // URLs match what the server expected. | 15 // URLs match what the server expected. |
16 | 16 |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
21 #include "base/environment.h" | 21 #include "base/environment.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/process_util.h" | 23 #include "base/process_util.h" |
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/time.h" | 31 #include "base/time.h" |
31 #include "base/utf_string_conversions.h" | 32 #include "base/utf_string_conversions.h" |
32 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/profiles/profile.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" |
36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
38 #include "chrome/test/base/in_process_browser_test.h" | 39 #include "chrome/test/base/in_process_browser_test.h" |
39 #include "chrome/test/base/ui_test_utils.h" | 40 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 652 } |
652 | 653 |
653 // Verifies with server if test is done and waits till server responses. | 654 // Verifies with server if test is done and waits till server responses. |
654 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 655 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
655 safe_browsing_helper->VerifyTestComplete(server_host, | 656 safe_browsing_helper->VerifyTestComplete(server_host, |
656 server_port, | 657 server_port, |
657 last_step)); | 658 last_step)); |
658 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 659 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
659 test_server.Stop(); | 660 test_server.Stop(); |
660 } | 661 } |
OLD | NEW |