// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_FAKE_PAGE_LOAD_METRICS_OBSERVER_DELEGATE_H_ #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_FAKE_PAGE_LOAD_METRICS_OBSERVER_DELEGATE_H_ #include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "components/page_load_metrics/browser/page_load_metrics_observer.h" #include "components/page_load_metrics/browser/page_load_metrics_observer_delegate.h" #include "components/page_load_metrics/common/page_end_reason.h" #include "content/public/browser/web_contents.h" #include "url/gurl.h" namespace page_load_metrics { // A fake page load metrics observer delegate for use in unit tests. // Almost all of the methods in this implementation simply return a backing // instance variable (defaulting to null/zero values). Tests should configure // the delegate's backing variables as appropriate for their scenarios. One // exception is the BackForwardCacheRestore related methods - the // BackForwardCacheRestore state structs are stored in an internal vector. Use // |AddBackForwardCacheRestore| and |ClearBackForwardCacheRestores| to manage // the fake delegate's vector of BackForwardCacheRestore states. // If a backing instance variable doesn't exist for a method you need to fake, // please add it with an appropriate default/zero value. class FakePageLoadMetricsObserverDelegate : public PageLoadMetricsObserverDelegate { … }; } // namespace page_load_metrics #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_FAKE_PAGE_LOAD_METRICS_OBSERVER_DELEGATE_H_