#include "components/page_load_metrics/google/browser/gws_abandoned_page_load_metrics_observer.h"
#include <vector>
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h"
#include "chrome/browser/page_load_metrics/observers/chrome_gws_abandoned_page_load_metrics_observer.h"
#include "chrome/browser/page_load_metrics/observers/gws_page_load_metrics_observer.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/page_load_metrics/browser/page_load_metrics_test_waiter.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_navigation_throttle.h"
#include "content/public/test/test_navigation_throttle_inserter.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "services/network/public/cpp/network_quality_tracker.h"
namespace {
const char kSRPDomain[] = …;
const char kSRPPath[] = …;
const char kSRPRedirectPath[] = …;
std::unique_ptr<net::test_server::HttpResponse> SRPHandler(
const net::test_server::HttpRequest& request) { … }
std::unique_ptr<net::test_server::HttpResponse> SRPRedirectHandler(
const net::test_server::HttpRequest& request) { … }
}
AbandonReason;
NavigationMilestone;
PageLoadMetricsTestWaiter;
class GWSAbandonedPageLoadMetricsObserverBrowserTest
: public MetricIntegrationTest { … };
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest, Search) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
NonSearch) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
NonSRPRedirectToSRP) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SRPRedirectToNonSRP) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
HistoryNavigationToSrp) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
PrerenderToSrp) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchCancelledByNewNavigation) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchCancelledByWebContentsStop) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchTabHidden) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
NonSRPRedirectToSRP_Hidden) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchTabHiddenThenStopped) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchTabHiddenThenStopped_NonSRPRedirectToSRP) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchTabHiddenMultipleTimes) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchCancelledByTabClose) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchCancelledByNavigationThrottle) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchTurnedToErrorPageByNavigationThrottle) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
SearchCancelledByRenderProcessGone) { … }
IN_PROC_BROWSER_TEST_F(GWSAbandonedPageLoadMetricsObserverBrowserTest,
DISABLED_TabHidden) { … }