OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/http/url_security_manager.h" | 5 #include "net/http/url_security_manager.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/http/http_auth_filter.h" | 9 #include "net/http/http_auth_filter.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 struct TestData { | 17 struct TestData { |
18 const char* url; | 18 const char* const url; |
19 bool succeds_in_windows_default; | 19 bool succeds_in_windows_default; |
20 bool succeeds_in_whitelist; | 20 bool succeeds_in_whitelist; |
21 }; | 21 }; |
22 | 22 |
23 const char* kTestAuthWhitelist = "*example.com,*foobar.com,baz"; | 23 const char kTestAuthWhitelist[] = "*example.com,*foobar.com,baz"; |
24 | 24 |
25 // Under Windows the following will be allowed by default: | 25 // Under Windows the following will be allowed by default: |
26 // localhost | 26 // localhost |
27 // host names without a period. | 27 // host names without a period. |
28 // In Posix systems (or on Windows if a whitelist is specified explicitly), | 28 // In Posix systems (or on Windows if a whitelist is specified explicitly), |
29 // everything depends on the whitelist. | 29 // everything depends on the whitelist. |
30 const TestData kTestDataList[] = { | 30 const TestData kTestDataList[] = { |
31 { "http://localhost", true, false }, | 31 { "http://localhost", true, false }, |
32 { "http://bat", true, false }, | 32 { "http://bat", true, false }, |
33 { "http://www.example.com", false, true }, | 33 { "http://www.example.com", false, true }, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 for (size_t i = 0; i < arraysize(kTestDataList); ++i) { | 88 for (size_t i = 0; i < arraysize(kTestDataList); ++i) { |
89 GURL gurl(kTestDataList[i].url); | 89 GURL gurl(kTestDataList[i].url); |
90 bool can_delegate = url_security_manager->CanDelegate(gurl); | 90 bool can_delegate = url_security_manager->CanDelegate(gurl); |
91 EXPECT_FALSE(can_delegate); | 91 EXPECT_FALSE(can_delegate); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 } // namespace net | 96 } // namespace net |
OLD | NEW |