chromium/chrome/browser/ui/views/hats/hats_browsertest.cc

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

#include <memory>
#include <string>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/callback_helpers.h"
#include "base/json/values_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/hats/hats_service_desktop.h"
#include "chrome/browser/ui/hats/hats_service_factory.h"
#include "chrome/browser/ui/hats/mock_hats_service.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/hats/hats_next_web_dialog.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/scoped_browser_locale.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/version_info/version_info.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/views/test/views_test_utils.h"
#include "url/gurl.h"

namespace {

// The product specific data expected by the test survey. The boolean values are
// checked in hats_next_mock.html.
const SurveyBitsData kHatsNextTestSurveyProductSpecificBitsData{};

const SurveyStringData kHatsNextTestSurveyProductSpecificStringData{};

// The locale expected by the test survey. This value is checked in
// hats_next_mock.html for tests that expect a loaded response.
const char kTestLocale[] =;

const char kTestHistogramName[] =;

}  // namespace

class MockHatsNextWebDialog : public HatsNextWebDialog {};

class HatsNextWebDialogBrowserTest : public InProcessBrowserTest {};

// Test that the web dialog correctly receives change to history state that
// indicates a survey is ready to be shown.
IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, SurveyLoaded) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyLoadedWithHistogramName) {}

// Test that the web dialog correctly receives change to history state that
// indicates the survey window should be closed.
IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, SurveyClosed) {}

// Test that a survey which first reports as loaded, then reports closure, only
// logs that the survey was shown.
IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, SurveyLoadedThenClosed) {}

// Test that if the survey does not indicate it is ready for display before the
// timeout the widget is closed.
IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, SurveyTimeout) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, UnknownURLFragment) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, NewWebContents) {}

// The devtools browser for undocked devtools has no tab strip and can't open
// new tabs. Instead it should open new WebContents in the main browser.
IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       NewWebContentsForDevtoolsBrowser) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, DialogResize) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, MaximumSize) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, ZoomLevel) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, SurveyCompleted) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyQuestionAnsweredInvalidQuestion) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyQuestionAnsweredFirstQuestion) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyQuestionAnsweredSingleSelectQuestion) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyQuestionAnsweredMultipleSelectQuestion) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest,
                       SurveyQuestionAnsweredMultipleQuestions) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, NoHistogramName) {}

IN_PROC_BROWSER_TEST_F(HatsNextWebDialogBrowserTest, ExcludedHistogram) {}