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

/*
 * Copyright (C) 2012 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 "third_party/blink/renderer/core/page/chrome_client_impl.h"

#include <string>
#include <vector>

#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "cc/trees/layer_tree_host.h"
#include "components/autofill/core/common/autofill_features.h"
#include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/mojom/choosers/color_chooser.mojom-blink.h"
#include "third_party/blink/public/web/web_autofill_state.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_local_frame_client.h"
#include "third_party/blink/public/web/web_testing_support.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/forms/color_chooser.h"
#include "third_party/blink/renderer/core/html/forms/color_chooser_client.h"
#include "third_party/blink/renderer/core/html/forms/date_time_chooser.h"
#include "third_party/blink/renderer/core/html/forms/date_time_chooser_client.h"
#include "third_party/blink/renderer/core/html/forms/file_chooser.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_list_element.h"
#include "third_party/blink/renderer/core/html/forms/html_text_area_element.h"
#include "third_party/blink/renderer/core/html/forms/mock_file_chooser.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/loader/frame_load_request.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scoped_page_pauser.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/language.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"

// To avoid conflicts with the CreateWindow macro from the Windows SDK...
#undef CreateWindow

ElementsAre;
Eq;
Not;

namespace blink {

namespace {
class FakeChromeClientForAutofill : public EmptyChromeClient {};
}  // namespace

class ViewCreatingClient : public frame_test_helpers::TestWebFrameClient {};

class CreateWindowTest : public testing::Test {};

TEST_F(CreateWindowTest, CreateWindowFromPausedPage) {}

class NewWindowUrlCapturingChromeClient : public EmptyChromeClient {};

class FormSubmissionTest : public PageTestBase {};

TEST_F(FormSubmissionTest, FormGetSubmissionNewFrameUrlTest) {}

class FakeColorChooserClient : public GarbageCollected<FakeColorChooserClient>,
                               public ColorChooserClient {};

class FakeDateTimeChooserClient
    : public GarbageCollected<FakeDateTimeChooserClient>,
      public DateTimeChooserClient {};

// TODO(crbug.com/779126): A number of popups are not supported in immersive
// mode. The PagePopupSuppressionTests ensure that these unsupported popups
// do not appear in immersive mode.
class PagePopupSuppressionTest : public testing::Test {};

// A FileChooserClient which makes FileChooser::OpenFileChooser() success.
class MockFileChooserClient : public GarbageCollected<MockFileChooserClient>,
                              public FileChooserClient {};

class FileChooserQueueTest : public testing::Test {};

TEST_F(FileChooserQueueTest, DerefQueuedChooser) {}

class AutofillChromeClientTest : public PageTestBase {};

// Validates the JavaScriptChangedValue notification if JavaScript
// overrides the autofilled content of form controls *after* the fill has been
// concluded.
TEST_F(AutofillChromeClientTest, NotificationsOfJavaScriptChangesAfterFill) {}

// Validates the JavaScriptChangedValue notification if JavaScript
// overrides the autofilled content of form controls during the fill operation.
// This is the case because a JavaScript event handler on change signals is
// is triggered during the autofill operation.
TEST_F(AutofillChromeClientTest, NotificationsOfJavaScriptChangesDuringFill) {}

}  // namespace blink