chromium/third_party/blink/renderer/core/page/viewport_test.cc

/*
 * Copyright (C) 2013 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/web/web_console_message.h"
#include "third_party/blink/public/web/web_frame.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/page_scale_constraints.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/viewport_description.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/geometry/length.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_loader_mock_factory.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "ui/base/ime/mojom/virtual_keyboard_types.mojom-blink.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"

namespace blink {

class ViewportTest : public testing::Test {};

static void SetViewportSettings(WebSettings* settings) {}

static PageScaleConstraints RunViewportTest(Page* page,
                                            int initial_width,
                                            int initial_height) {}

TEST_F(ViewportTest, viewport6) {}

TEST_F(ViewportTest, viewport7) {}

TEST_F(ViewportTest, viewport8) {}

TEST_F(ViewportTest, viewport9) {}

TEST_F(ViewportTest, viewport10) {}

TEST_F(ViewportTest, viewport11) {}

TEST_F(ViewportTest, viewport12) {}

TEST_F(ViewportTest, viewport13) {}

TEST_F(ViewportTest, viewport14) {}

TEST_F(ViewportTest, viewport15) {}

TEST_F(ViewportTest, viewport16) {}

TEST_F(ViewportTest, viewport17) {}

TEST_F(ViewportTest, viewport18) {}

TEST_F(ViewportTest, viewport19) {}

TEST_F(ViewportTest, viewport20) {}

TEST_F(ViewportTest, viewport21) {}

TEST_F(ViewportTest, viewport22) {}

TEST_F(ViewportTest, viewport23) {}

TEST_F(ViewportTest, viewport24) {}

TEST_F(ViewportTest, viewport25) {}

TEST_F(ViewportTest, viewport26) {}

TEST_F(ViewportTest, viewport27) {}

TEST_F(ViewportTest, viewport28) {}

TEST_F(ViewportTest, viewport29) {}

TEST_F(ViewportTest, viewport30) {}

TEST_F(ViewportTest, viewport31) {}

TEST_F(ViewportTest, viewport32) {}

TEST_F(ViewportTest, viewport33) {}

TEST_F(ViewportTest, viewport34) {}

TEST_F(ViewportTest, viewport35) {}

TEST_F(ViewportTest, viewport36) {}

TEST_F(ViewportTest, viewport37) {}

TEST_F(ViewportTest, viewport38) {}

TEST_F(ViewportTest, viewport39) {}

TEST_F(ViewportTest, viewport40) {}

TEST_F(ViewportTest, viewport41) {}

TEST_F(ViewportTest, viewport42) {}

TEST_F(ViewportTest, viewport43) {}

TEST_F(ViewportTest, viewport44) {}

TEST_F(ViewportTest, viewport45) {}

TEST_F(ViewportTest, viewport46) {}

TEST_F(ViewportTest, viewport47) {}

TEST_F(ViewportTest, viewport48) {}

TEST_F(ViewportTest, viewport49) {}

TEST_F(ViewportTest, viewport50) {}

TEST_F(ViewportTest, viewport51) {}

TEST_F(ViewportTest, viewport52) {}

TEST_F(ViewportTest, viewport53) {}

TEST_F(ViewportTest, viewport54) {}

TEST_F(ViewportTest, viewport55) {}

TEST_F(ViewportTest, viewport56) {}

TEST_F(ViewportTest, viewport57) {}

TEST_F(ViewportTest, viewport58) {}

TEST_F(ViewportTest, viewport59) {}

TEST_F(ViewportTest, viewport60) {}

TEST_F(ViewportTest, viewport61) {}

TEST_F(ViewportTest, viewport62) {}

TEST_F(ViewportTest, viewport63) {}

TEST_F(ViewportTest, viewport64) {}

TEST_F(ViewportTest, viewport65) {}

TEST_F(ViewportTest, viewport66) {}

TEST_F(ViewportTest, viewport67) {}

TEST_F(ViewportTest, viewport68) {}

TEST_F(ViewportTest, viewport69) {}

TEST_F(ViewportTest, viewport70) {}

TEST_F(ViewportTest, viewport71) {}

TEST_F(ViewportTest, viewport72) {}

TEST_F(ViewportTest, viewport73) {}

TEST_F(ViewportTest, viewport74) {}

TEST_F(ViewportTest, viewport75) {}

TEST_F(ViewportTest, viewport76) {}

TEST_F(ViewportTest, viewport77) {}

TEST_F(ViewportTest, viewport78) {}

TEST_F(ViewportTest, viewport79) {}

TEST_F(ViewportTest, viewport80) {}

TEST_F(ViewportTest, viewport81) {}

TEST_F(ViewportTest, viewport82) {}

TEST_F(ViewportTest, viewport83) {}

TEST_F(ViewportTest, viewport84) {}

TEST_F(ViewportTest, viewport85) {}

TEST_F(ViewportTest, viewport86) {}

TEST_F(ViewportTest, viewport87) {}

TEST_F(ViewportTest, viewport88) {}

TEST_F(ViewportTest, viewport90) {}

TEST_F(ViewportTest, viewport100) {}

TEST_F(ViewportTest, viewport101) {}

TEST_F(ViewportTest, viewport102) {}

TEST_F(ViewportTest, viewport103) {}

TEST_F(ViewportTest, viewport104) {}

TEST_F(ViewportTest, viewport105) {}

TEST_F(ViewportTest, viewport106) {}

TEST_F(ViewportTest, viewport107) {}

TEST_F(ViewportTest, viewport108) {}

TEST_F(ViewportTest, viewport109) {}

TEST_F(ViewportTest, viewport110) {}

TEST_F(ViewportTest, viewport111) {}

TEST_F(ViewportTest, viewport112) {}

TEST_F(ViewportTest, viewport113) {}

TEST_F(ViewportTest, viewport114) {}

TEST_F(ViewportTest, viewport115) {}

TEST_F(ViewportTest, viewport116) {}

TEST_F(ViewportTest, viewport117) {}

TEST_F(ViewportTest, viewport118) {}

TEST_F(ViewportTest, viewport119) {}

TEST_F(ViewportTest, viewport120) {}

TEST_F(ViewportTest, viewport121) {}

TEST_F(ViewportTest, viewport122) {}

TEST_F(ViewportTest, viewport123) {}

TEST_F(ViewportTest, viewport124) {}

TEST_F(ViewportTest, viewport125) {}

TEST_F(ViewportTest, viewport126) {}

TEST_F(ViewportTest, viewport127) {}

TEST_F(ViewportTest, viewport129) {}

TEST_F(ViewportTest, viewport130) {}

TEST_F(ViewportTest, viewport131) {}

TEST_F(ViewportTest, viewport132) {}

TEST_F(ViewportTest, viewport133) {}

TEST_F(ViewportTest, viewport134) {}

TEST_F(ViewportTest, viewport135) {}

TEST_F(ViewportTest, viewport136) {}

TEST_F(ViewportTest, viewport137) {}

TEST_F(ViewportTest, viewport138) {}

TEST_F(ViewportTest, viewportLegacyHandheldFriendly) {}

static void SetQuirkViewportSettings(WebSettings* settings) {}

TEST_F(ViewportTest, viewportLegacyMergeQuirk1) {}

TEST_F(ViewportTest, viewportLegacyMergeQuirk2) {}

TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWithoutContent) {}

TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWith0) {}

TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWith400) {}

TEST_F(ViewportTest, viewportLegacyOrdering2) {}

TEST_F(ViewportTest, viewportLegacyOrdering3) {}

TEST_F(ViewportTest, viewportLegacyOrdering4) {}

TEST_F(ViewportTest, viewportLegacyOrdering5) {}

TEST_F(ViewportTest, viewportLegacyOrdering6) {}

TEST_F(ViewportTest, viewportLegacyOrdering7) {}

TEST_F(ViewportTest, viewportLegacyOrdering8) {}

TEST_F(ViewportTest, viewportLegacyDefaultValueChangedByXHTMLMP) {}

TEST_F(ViewportTest,
       viewportLegacyDefaultValueChangedByXHTMLMPAndOverriddenByMeta) {}

TEST_F(ViewportTest, viewportLegacyXHTMLMPOrdering) {}

TEST_F(ViewportTest, viewportLegacyXHTMLMPRemoveAndAdd) {}

TEST_F(ViewportTest, viewportLimitsAdjustedForNoUserScale) {}

TEST_F(ViewportTest, viewportLimitsAdjustedForUserScale) {}

class ConsoleMessageWebFrameClient
    : public frame_test_helpers::TestWebFrameClient {};

TEST_F(ViewportTest, viewportWarnings1) {}

TEST_F(ViewportTest, viewportWarnings2) {}

TEST_F(ViewportTest, viewportWarnings3) {}

TEST_F(ViewportTest, viewportWarnings4) {}

TEST_F(ViewportTest, viewportWarnings5) {}

TEST_F(ViewportTest, viewportWarnings6) {}

TEST_F(ViewportTest, viewportWarnings7) {}

TEST_F(ViewportTest, viewportWarnings8) {}

TEST_F(ViewportTest, viewport1) {}

TEST_F(ViewportTest, viewport2) {}

TEST_F(ViewportTest, viewport3) {}

TEST_F(ViewportTest, viewport4) {}

// Verifies that the value clamping from
// https://www.w3.org/TR/css-device-adapt-1/#width-and-height-properties
// applies to CSS pixel not physical pixel.
TEST_F(ViewportTest, viewport5) {}

class ViewportHistogramsTest : public SimTest {};

TEST_F(ViewportHistogramsTest, NoOpOnWhenViewportDisabled) {}

TEST_F(ViewportHistogramsTest, TypeNone) {}

TEST_F(ViewportHistogramsTest, TypeDeviceWidth) {}

TEST_F(ViewportHistogramsTest, TypeConstant) {}

TEST_F(ViewportHistogramsTest, TypeHandheldFriendlyMeta) {}

TEST_F(ViewportHistogramsTest, TypeMobileOptimizedMeta) {}

TEST_F(ViewportHistogramsTest, TypeXhtml) {}

class ViewportMetaSimTest : public SimTest {};

// Test that the virtual keyboard mode isn't set when a interactive-widget key
// isn't provided.
TEST_F(ViewportMetaSimTest, VirtualKeyboardUnsetWithFlag) {}

// Test that an invalid value to the interactive-widget property fails to be
// parsed.
TEST_F(ViewportMetaSimTest, VirtualKeyboardParsingEnabledByFlag) {}

// Test that the resizes-content value is correctly parsed and set on the
// interactive-widget key.
TEST_F(ViewportMetaSimTest, VirtualKeyboardResizesContent) {}

// Test that the resizes-visual value is correctly parsed and set on the
// interactive-widget key.
TEST_F(ViewportMetaSimTest, VirtualKeyboardResizeVisual) {}

// Test that the overlays-content value is correctly parsed and set on the
// interactive-widget key.
TEST_F(ViewportMetaSimTest, VirtualKeyboardOverlaysContent) {}

// Test that the virtualKeyboard.overlaysContent API overrides any values set
// from the meta tag and that unsetting it goes back to using the meta tag
// keyboard mode.
TEST_F(ViewportMetaSimTest, VirtualKeyboardAPIOverlaysContent) {}

// Ensure that updating the content to a bad value causes the mode to become
// unset.
TEST_F(ViewportMetaSimTest, VirtualKeyboardUpdateContent) {}

// Test use counters for values of the 'interactive-widget' property.
TEST_F(ViewportMetaSimTest, InteractiveWidgetUseCounters) {}

// Test that the zoom factor for the device scale is used in the calculation of
// the viewport layout width when browser zoom is applied.
TEST_F(ViewportMetaSimTest, PageZoomDoesntAffectMobileLayoutSize_WidthDefault) {}

TEST_F(ViewportMetaSimTest, PageZoomDoesntAffectMobileLayoutSize_Width1000) {}

TEST_F(ViewportMetaSimTest, PageZoomDoesntAffectMobileLayoutSize_WidthDevice) {}

}  // namespace blink