blob: 5c3ee4bfb8b91140e69a36d8600fae2f12869e65 [file] [log] [blame]
// Copyright 2017 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.
module network.mojom;
import "mojo/public/mojom/base/memory_pressure_level.mojom";
import "services/network/public/mojom/network_change_manager.mojom";
import "services/network/public/mojom/network_param.mojom";
import "services/network/public/mojom/network_types.mojom";
// Maps to net::RuleBasedHostResolverProc::Rule::ResolverType.
enum ResolverType {
struct Rule {
ResolverType resolver_type;
string host_pattern;
string replacement;
int32 host_resolver_flags;
string canonical_name;
// Testing interface to the network service.
// Methods are sometimes synchronous to avoid race conditions since this test
// interface is on a different pipe than interfaces which are impacted.
interface NetworkServiceTest {
// Adds the given host resolver rules in the process where the network service
// is running.
AddRules(array<Rule> rules) => ();
// Simulates a network connection type change. The new connection type will be
// updated to |type| and broadcasts will be sent to
// NetworkConnectionManagerClient implementations.
SimulateNetworkChange(ConnectionType type) => ();
// Simulates a network quality change. The new effective connection type will
// be updated to |type| and broadcasts will be sent to
// NetworkQualityEstimatorManagerClient implementations.
SimulateNetworkQualityChange(EffectiveConnectionType type) => ();
// Crash the process where network service is running.
// These methods mirror the net::MockCertVerifier interface.
MockCertVerifierSetDefaultResult(int32 default_result) => ();
X509Certificate cert,
string host_pattern,
CertVerifyResult verify_result,
int32 rv) => ();
// Toggles requiring CT for testing
enum RequireCT {
SetRequireCT(RequireCT required) => ();
// Set the global transport security state preloaded static data source to
// the unittest_default source, with the reporting URIs rewritten to use
// |reporting_port|. If |reporting_port| is 0, the source will be reset to
// the default.
SetTransportSecurityStateSource(uint16 reporting_port) => ();
// Allow host resolutions to reach the network. Since going to the network
// can be a source of flakiness, this should only be called in tests that
// can tolerate this, such as those run manually or on an FYI bot.
SetAllowNetworkAccessToHostResolutions() => ();
// Causes the next host resolve to the given hostname to crash the process.
CrashOnResolveHost(string host);
// Causes the next CookieManager::GetCookieList call to crash.
// Gets the latest memory pressure level reported by the
// MemoryPressureListener.
=> (mojo_base.mojom.MemoryPressureLevel memory_pressure_level);
// Gets the current count of peer to peer connections that may require low
// latency.
=> (uint32 connection_count);
// Returns the value of an environment variable in the network service's
// process, or an empty string if it's not set.
GetEnvironmentVariableValue(string name) => (string value);
// Logs the given string in the network service. This is used to test log
// redirection.
Log(string message) => ();
// Activates the specified field trial. Intended for use verifying that the
// network service informs the main process when a field trial is activated.
ActivateFieldTrial(string field_trial_name);
// Instantiates a net::ScopedTestEVPolicy with the specified fingerprint and
// policy oid.
SetEVPolicy(array<uint8, 32> fingerprint_sha256, string policy_oid) => ();
// Gets the current count of entries in the First-Party sets mapping. Note
// that each entry is a registered domain mapped to its owner.
GetFirstPartySetEntriesCount() => (int64 entries);