#include "chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h"
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
#include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
#include "components/page_load_metrics/browser/page_load_tracker.h"
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "content/public/browser/web_contents.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "url/gurl.h"
namespace {
constexpr char kExampleUrl[] = …;
constexpr char kExampleUrl2[] = …;
constexpr char kGoogleSearchResultsUrl[] = …;
constexpr char kGoogleSearchResultsVideoUrl[] = …;
}
class FromGWSPageLoadMetricsObserverTest
: public page_load_metrics::PageLoadMetricsObserverTestHarness { … };
class FromGWSPageLoadMetricsLoggerTest : public testing::Test { … };
TEST_F(FromGWSPageLoadMetricsObserverTest, NoMetrics) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NoPreviousCommittedUrl) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NonSearchPreviousCommittedUrl) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
GoogleNonSearchPreviousCommittedUrl1) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
GoogleNonSearchPreviousCommittedUrl2) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrl1) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrl2) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrl3) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrl4) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrlToMaps1) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrlToMaps2) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchPreviousCommittedUrlToMaps3) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, GoogleSearchModeLogged) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchToNonSearchToOtherPage) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, SearchToNonSearchToSearch) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
SearchToNonSearchToSearchToNonSearch) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
SearchToNonSearchToSearchToNonSearchBackgrounded) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
SearchRedirectorPreviousCommittedUrl) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
NonSearchRedirectorPreviousCommittedUrl) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
SearchPreviousCommittedUrlBackgroundLater) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_NewNavigationBeforeCommit …
#else
#define MAYBE_NewNavigationBeforeCommit …
#endif
TEST_F(FromGWSPageLoadMetricsObserverTest, MAYBE_NewNavigationBeforeCommit) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NewNavigationBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforeCommit) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforeCommitNonSearch) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforeCommitSearchToSearch) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforeCommitAndBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CloseBeforeCommit) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CloseBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
AbortCloseBeforeCommitAndBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest,
AbortStopBeforeCommitAndCloseBeforePaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NoAbortNewNavigationFromAboutURL) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NoAbortNewNavigationAfterPaint) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, NewNavigationBeforeInteraction) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, StopBeforeInteraction) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CloseBeforeInteraction) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CloseBeforePaintAndInteraction) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CloseAfterInteraction) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, CommittedIntent) { … }
TEST_F(FromGWSPageLoadMetricsObserverTest, ProvisionalIntent) { … }
class FromGWSPageLoadMetricsObserverWithSidePanelTest
: public FromGWSPageLoadMetricsObserverTest { … };
TEST_F(FromGWSPageLoadMetricsObserverWithSidePanelTest,
NonSearchPreviousCommittedUrl) { … }
TEST_F(FromGWSPageLoadMetricsObserverWithSidePanelTest,
RecordsRegularAndSidePanelSpecificMetrics) { … }
TEST_F(FromGWSPageLoadMetricsObserverWithSidePanelTest,
GoogleSearchModeLogged) { … }
TEST_F(FromGWSPageLoadMetricsObserverWithSidePanelTest,
SidePanelNavigationBackgrounded) { … }
TEST_F(FromGWSPageLoadMetricsObserverWithSidePanelTest,
DoesNotRecordNonGWSAndNonLinkInitiatedNavigations) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, Basic) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, NoPreviousPage) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, NavigationNotInitiatedViaLink) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, ProvisionalFromGWS) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, ProvisionalNotFromGWS) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, ProvisionalIgnoredAfterCommit1) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, ProvisionalIgnoredAfterCommit2) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, NavigationFromSearch) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, NavigationToSearchHostname) { … }
TEST_F(FromGWSPageLoadMetricsLoggerTest, NavigationFromSearchRedirector) { … }
FromGWSPageLoadMetricsLoggerWithSidePanelTest;
TEST_F(FromGWSPageLoadMetricsLoggerWithSidePanelTest,
InitiatedFromSidePanelWithGoogleSRP) { … }
TEST_F(FromGWSPageLoadMetricsLoggerWithSidePanelTest,
InitiatedFromSidePanelWithNonGooglePage) { … }
TEST_F(FromGWSPageLoadMetricsLoggerWithSidePanelTest,
InitiatedFromSidePanelWithGoogleSRPNotLinkInitiated) { … }