#include <memory>
#include <string>
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/policy/policy_test_utils.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_metrics.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_utils.h"
#include "chrome/browser/sync/test/integration/sessions_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/controls/hover_button.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/browser/ui/views/sharing/sharing_browsertest.h"
#include "chrome/browser/ui/views/sharing/sharing_dialog_view.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/sharing_message/features.h"
#include "components/sharing_message/pref_names.h"
#include "components/sharing_message/sharing_constants.h"
#include "components/sharing_message/sharing_sync_preference.h"
#include "components/sync/service/sync_service_impl.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/test/browser_test.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/events/base_event_utils.h"
#include "ui/views/test/button_test_api.h"
#include "url/gurl.h"
namespace {
const char kTelUrl[] = …;
const char kNonTelUrl[] = …;
const char kLinkText[] = …;
const char kTextWithPhoneNumber[] = …;
const char kTextWithoutPhoneNumber[] = …;
const char kTestPageURL[] = …;
enum class ClickToCallPolicy { … };
}
class ClickToCallBrowserTest : public SharingBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest,
ContextMenu_TelLink_SingleDeviceAvailable) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, ContextMenu_NoDevicesAvailable) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, ContextMenu_UnsafeTelLink) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, ContextMenu_EscapedCharacters) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest,
ContextMenu_TelLink_MultipleDevicesAvailable) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest,
ContextMenu_HighlightedText_MultipleDevicesAvailable) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, ContextMenu_TelLink_Histograms) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest,
ContextMenu_HighlightedText_Histograms) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, ContextMenu_UKM) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, CloseTabWithBubble) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, LeftClick_ChooseDevice) { … }
#endif
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, OpenNewTabAndShowBubble) { … }
IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest, NavigateDifferentOrigin) { … }
class ClickToCallPolicyTest
: public policy::PolicyTest,
public testing::WithParamInterface<ClickToCallPolicy> { … };
IN_PROC_BROWSER_TEST_P(ClickToCallPolicyTest, RunTest) { … }
INSTANTIATE_TEST_SUITE_P(…);