chromium/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc

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

#include "third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.h"

#include "components/ukm/test_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"

namespace blink {

static constexpr char kBaseUrl[] =;
static constexpr int kDeviceWidth =;
static constexpr int kDeviceHeight =;
static constexpr float kMinimumZoom =;
static constexpr float kMaximumZoom =;

class MobileFriendlinessCheckerTest : public testing::Test {};

TEST_F(MobileFriendlinessCheckerTest, NoViewportSetting) {}

TEST_F(MobileFriendlinessCheckerTest, DeviceWidth) {}

TEST_F(MobileFriendlinessCheckerTest, HardcodedViewport) {}

TEST_F(MobileFriendlinessCheckerTest, HardcodedViewportWithDeviceScale3) {}

TEST_F(MobileFriendlinessCheckerTest, DeviceWidthWithInitialScale05) {}

TEST_F(MobileFriendlinessCheckerTest, AllowUserScalableWithSmallMaxZoom) {}

TEST_F(MobileFriendlinessCheckerTest, AllowUserScalableWithLargeMaxZoom) {}

TEST_F(MobileFriendlinessCheckerTest,
       AllowUserScalableWithLargeMaxZoomAndLargeInitialScale) {}

TEST_F(MobileFriendlinessCheckerTest, UserZoom) {}

TEST_F(MobileFriendlinessCheckerTest, NoText) {}

TEST_F(MobileFriendlinessCheckerTest, NoSmallFonts) {}

TEST_F(MobileFriendlinessCheckerTest, NoSmallFontsWithDeviceScaleFactor) {}

TEST_F(MobileFriendlinessCheckerTest, OnlySmallFonts) {}

TEST_F(MobileFriendlinessCheckerTest, OnlySmallFontsWithDeviceScaleFactor) {}

TEST_F(MobileFriendlinessCheckerTest, MostlySmallFont) {}

TEST_F(MobileFriendlinessCheckerTest, MostlySmallInSpan) {}

TEST_F(MobileFriendlinessCheckerTest, MultipleDivs) {}

TEST_F(MobileFriendlinessCheckerTest, DontCountInvisibleSmallFontArea) {}

TEST_F(MobileFriendlinessCheckerTest, ScaleZoomedLegibleFont) {}

TEST_F(MobileFriendlinessCheckerTest, ViewportZoomedOutIllegibleFont) {}

TEST_F(MobileFriendlinessCheckerTest, TooWideViewportWidthIllegibleFont) {}

TEST_F(MobileFriendlinessCheckerTest, CSSZoomedIllegibleFont) {}

TEST_F(MobileFriendlinessCheckerTest, OnlySmallFontsClipped) {}

TEST_F(MobileFriendlinessCheckerTest, NormalTextAndWideImage) {}

TEST_F(MobileFriendlinessCheckerTest, SmallTextByWideTable) {}

TEST_F(MobileFriendlinessCheckerTest,
       NormalTextAndWideImageWithDeviceWidthViewport) {}

TEST_F(MobileFriendlinessCheckerTest, ZIndex) {}

TEST_F(MobileFriendlinessCheckerTest, NormalTextAndWideImageWithInitialScale) {}

TEST_F(MobileFriendlinessCheckerTest,
       NormalTextAndWideImageWithInitialScaleAndDeviceScale) {}

// This test shows that text will grow with text-size-adjust: auto in a
// fixed-width table.
TEST_F(MobileFriendlinessCheckerTest, FixedWidthTableTextSizeAdjustAuto) {}

// This test shows that text remains small with text-size-adjust: none in a
// fixed-width table.
TEST_F(MobileFriendlinessCheckerTest, FixedWidthTableTextSizeAdjustNone) {}

TEST_F(MobileFriendlinessCheckerTest, TextNarrow) {}

TEST_F(MobileFriendlinessCheckerTest, TextTooWide) {}

TEST_F(MobileFriendlinessCheckerTest, TextAbsolutePositioning) {}

TEST_F(MobileFriendlinessCheckerTest, ImageAbsolutePositioning) {}

TEST_F(MobileFriendlinessCheckerTest, SmallTextOutsideViewportCeiling) {}

TEST_F(MobileFriendlinessCheckerTest, TextTooWideOverflowXHidden) {}

TEST_F(MobileFriendlinessCheckerTest, TextTooWideHidden) {}

TEST_F(MobileFriendlinessCheckerTest, TextTooWideHiddenInDiv) {}

TEST_F(MobileFriendlinessCheckerTest, TextTooWideHiddenInDivDiv) {}

TEST_F(MobileFriendlinessCheckerTest, ImageNarrow) {}

TEST_F(MobileFriendlinessCheckerTest, ImageTooWide) {}

TEST_F(MobileFriendlinessCheckerTest, ImageTooWide100) {}

TEST_F(MobileFriendlinessCheckerTest, WideImageClipped) {}

TEST_F(MobileFriendlinessCheckerTest, ImageTooWideTwoImages) {}

TEST_F(MobileFriendlinessCheckerTest, ImageTooWideAbsolutePosition) {}

TEST_F(MobileFriendlinessCheckerTest, ImageTooWideDisplayNone) {}

TEST_F(MobileFriendlinessCheckerTest, ScaleTextOutsideViewport) {}

TEST_F(MobileFriendlinessCheckerTest, ScrollerOutsideViewport) {}

TEST_F(MobileFriendlinessCheckerTest, SubScroller) {}

TEST_F(MobileFriendlinessCheckerTest, SubScrollerHalfOutByMargin) {}

TEST_F(MobileFriendlinessCheckerTest, SubScrollerOutByTranslate) {}

/*
 * TODO(kumagi): Get precise paint offset of rtl environment is hard.
TEST_F(MobileFriendlinessCheckerTest, SubScrollerGoesLeft) {
  ukm::mojom::UkmEntry ukm = CalculateMetricsForHTMLString(R"HTML(
<html>
  <head>
    <style>
      body {
        margin: 0px;
        direction: rtl;
      }
      div.scroller {
        margin-right: 360px;
        width: 480px;
        height: 800px;
        overflow: scroll;
      }
    </style>
    <meta name="viewport" content="width=480px, initial-scale=1.0
minimum-scale=1.0">
  </head>
  <body style="font: 40px/1 Ahem; line-height: 1">
    <div class="scroller">
      <img style="width: 9000px; height: 1px">
    </div>
  </body>
</html>
)HTML");
  // Right to left language scrollbar goes to left.
  ExpectUkm(actual_mf.text_content_outside_viewport_percentage, 75);
}
*/

TEST_F(MobileFriendlinessCheckerTest, SubScrollerFitsWithinViewport) {}

TEST_F(MobileFriendlinessCheckerTest, SubScrollerTwice) {}

TEST_F(MobileFriendlinessCheckerTest, SubScrollerInSubScroller) {}

TEST_F(MobileFriendlinessCheckerTest, ScrollableLayoutView) {}

TEST_F(MobileFriendlinessCheckerTest, IFrame) {}

TEST_F(MobileFriendlinessCheckerTest, IFrameVieportDeviceWidth) {}

TEST_F(MobileFriendlinessCheckerTest, IFrameSmallTextRatio) {}

}  // namespace blink