chromium/chrome/browser/net/explicitly_allowed_ports_switch_browsertest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "url/gurl.h"

namespace content {

class ExplicitlyAllowedPortsSwitchBrowserTest : public InProcessBrowserTest {};

// Tests that when no special command line flags are passed, requests to port 79
// (finger) fail with ERR_UNSAFE_PORT.
IN_PROC_BROWSER_TEST_F(ExplicitlyAllowedPortsSwitchBrowserTest,
                       Port79DefaultBlocked) {}

class ExplicitlyAllowPort79BrowserTest
    : public ExplicitlyAllowedPortsSwitchBrowserTest {};

// Tests that when run with the flag --explicitly-allowed-ports=79, requests to
// port 79 (finger) are permitted.
//
// The request may succeed or fail depending on the platform and what services
// are running, so the test just verifies the reason for failure is not
// ERR_UNSAFE_PORT.
IN_PROC_BROWSER_TEST_F(ExplicitlyAllowPort79BrowserTest, Load) {}

}  // namespace content