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

Unified Diff: net/http/url_security_manager_unittest.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/url_security_manager_posix.cc ('k') | net/http/url_security_manager_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/url_security_manager_unittest.cc
diff --git a/net/http/url_security_manager_unittest.cc b/net/http/url_security_manager_unittest.cc
deleted file mode 100644
index 8e6d8c5cb9c7b5b684a04ec407d9fafd1b92543b..0000000000000000000000000000000000000000
--- a/net/http/url_security_manager_unittest.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/http/url_security_manager.h"
-
-#include "base/basictypes.h"
-#include "net/base/net_errors.h"
-#include "net/http/http_auth_filter.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-namespace net {
-
-namespace {
-
-struct TestData {
- const char* const url;
- bool succeds_in_windows_default;
- bool succeeds_in_whitelist;
-};
-
-const char kTestAuthWhitelist[] = "*example.com,*foobar.com,baz";
-
-// Under Windows the following will be allowed by default:
-// localhost
-// host names without a period.
-// In Posix systems (or on Windows if a whitelist is specified explicitly),
-// everything depends on the whitelist.
-const TestData kTestDataList[] = {
- { "http://localhost", true, false },
- { "http://bat", true, false },
- { "http://www.example.com", false, true },
- { "http://example.com", false, true },
- { "http://foobar.com", false, true },
- { "http://boo.foobar.com", false, true },
- { "http://baz", true, true },
- { "http://www.exampl.com", false, false },
- { "http://example.org", false, false },
- { "http://foobar.net", false, false },
- { "http://boo.fubar.com", false, false },
-};
-
-} // namespace
-
-TEST(URLSecurityManager, UseDefaultCredentials) {
- HttpAuthFilterWhitelist* auth_filter = new HttpAuthFilterWhitelist(
- kTestAuthWhitelist);
- ASSERT_TRUE(auth_filter);
- // The URL security manager takes ownership of |auth_filter|.
- scoped_ptr<URLSecurityManager> url_security_manager(
- URLSecurityManager::Create(auth_filter, NULL));
- ASSERT_TRUE(url_security_manager.get());
-
- for (size_t i = 0; i < arraysize(kTestDataList); ++i) {
- GURL gurl(kTestDataList[i].url);
- bool can_use_default =
- url_security_manager->CanUseDefaultCredentials(gurl);
-
- EXPECT_EQ(kTestDataList[i].succeeds_in_whitelist, can_use_default)
- << " Run: " << i << " URL: '" << gurl << "'";
- }
-}
-
-TEST(URLSecurityManager, CanDelegate) {
- HttpAuthFilterWhitelist* auth_filter = new HttpAuthFilterWhitelist(
- kTestAuthWhitelist);
- ASSERT_TRUE(auth_filter);
- // The URL security manager takes ownership of |auth_filter|.
- scoped_ptr<URLSecurityManager> url_security_manager(
- URLSecurityManager::Create(NULL, auth_filter));
- ASSERT_TRUE(url_security_manager.get());
-
- for (size_t i = 0; i < arraysize(kTestDataList); ++i) {
- GURL gurl(kTestDataList[i].url);
- bool can_delegate = url_security_manager->CanDelegate(gurl);
- EXPECT_EQ(kTestDataList[i].succeeds_in_whitelist, can_delegate)
- << " Run: " << i << " URL: '" << gurl << "'";
- }
-}
-
-TEST(URLSecurityManager, CanDelegate_NoWhitelist) {
- // Nothing can delegate in this case.
- scoped_ptr<URLSecurityManager> url_security_manager(
- URLSecurityManager::Create(NULL, NULL));
- ASSERT_TRUE(url_security_manager.get());
-
- for (size_t i = 0; i < arraysize(kTestDataList); ++i) {
- GURL gurl(kTestDataList[i].url);
- bool can_delegate = url_security_manager->CanDelegate(gurl);
- EXPECT_FALSE(can_delegate);
- }
-}
-
-
-} // namespace net
« no previous file with comments | « net/http/url_security_manager_posix.cc ('k') | net/http/url_security_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698