chromium/components/web_resource/resource_request_allowed_notifier_unittest.cc

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

#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "components/prefs/testing_pref_service.h"
#include "components/web_resource/eula_accepted_notifier.h"
#include "components/web_resource/resource_request_allowed_notifier_test_util.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace web_resource {

// EulaAcceptedNotifier test class that allows mocking the EULA accepted state
// and issuing simulated notifications.
class TestEulaAcceptedNotifier : public EulaAcceptedNotifier {};

enum class ConnectionTrackerResponseMode {};

// A test fixture class for ResourceRequestAllowedNotifier tests that require
// network state simulations. This also acts as the service implementing the
// ResourceRequestAllowedNotifier::Observer interface.
class ResourceRequestAllowedNotifierBaseTest
    : public testing::Test,
      public ResourceRequestAllowedNotifier::Observer,
      public testing::WithParamInterface<ConnectionTrackerResponseMode> {};

class ResourceRequestAllowedNotifierTest
    : public ResourceRequestAllowedNotifierBaseTest {};

class ResourceRequestAllowedNotifierNoEulaTest
    : public ResourceRequestAllowedNotifierBaseTest {};

TEST_P(ResourceRequestAllowedNotifierTest, NotifyOnInitialNetworkState) {}

TEST_P(ResourceRequestAllowedNotifierTest, DoNotNotifyIfOffline) {}

TEST_P(ResourceRequestAllowedNotifierTest, DoNotNotifyIfOnlineToOnline) {}

TEST_P(ResourceRequestAllowedNotifierTest, NotifyOnReconnect) {}

TEST_P(ResourceRequestAllowedNotifierTest, NoNotifyOnWardriving) {}

TEST_P(ResourceRequestAllowedNotifierTest, NoNotifyOnFlakyConnection) {}

TEST_P(ResourceRequestAllowedNotifierTest, NotifyOnFlakyConnection) {}

TEST_P(ResourceRequestAllowedNotifierTest, NoNotifyOnEulaAfterGoOffline) {}

TEST_P(ResourceRequestAllowedNotifierTest, NoRequestNoNotify) {}

TEST_P(ResourceRequestAllowedNotifierTest, EulaOnlyNetworkOffline) {}

TEST_P(ResourceRequestAllowedNotifierTest, EulaFirst) {}

TEST_P(ResourceRequestAllowedNotifierTest, NetworkFirst) {}

TEST_P(ResourceRequestAllowedNotifierTest, NoRequestNoNotifyEula) {}

INSTANTIATE_TEST_SUITE_P();

TEST_P(ResourceRequestAllowedNotifierNoEulaTest, NetworkNotification) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace web_resource