#include <memory>
#include <string>
#include <vector>
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/icu_test_util.h"
#include "base/test/with_feature_override.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/pdf/pdf_extension_test_base.h"
#include "chrome/browser/pdf/pdf_extension_test_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/devtools_agent_coverage_observer.h"
#include "chrome/test/base/test_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/web_ui_test_data_source.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/scoped_time_zone.h"
#include "extensions/test/result_catcher.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "pdf/buildflags.h"
#include "pdf/pdf_features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/gurl.h"
class PDFExtensionJSTestBase : public PDFExtensionTestBase { … };
class PDFExtensionJSTest : public base::test::WithFeatureOverride,
public PDFExtensionJSTestBase { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Basic) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, BasicPlugin) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, PluginController) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Viewport) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Layout3) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Layout4) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Bookmark) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Navigator) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ParamsParser) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ZoomManager) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, GestureDetector) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, SwipeDetector) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, TouchHandling) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Elements) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, DownloadControls) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Title) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, WhitespaceTitle) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, PageChange) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, PageSelector) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ScrollWithFormFieldFocusedTest) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Metrics) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerPasswordDialog) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ArrayBufferAllocator) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerToolbar) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerPdfSidenav) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerThumbnailBar) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerThumbnail) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerAttachmentBar) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerAttachment) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Fullscreen) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, PostMessageProxy) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Printing) {
RunTestsInJsModule("printing_icon_test.js", "test.pdf");
}
#endif
#if BUILDFLAG(ENABLE_INK)
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, DISABLED_AnnotationsFeatureEnabled) {
if (UseOopif()) {
GTEST_SKIP();
}
RunTestsInJsModule("annotations_feature_enabled_test.js", "test.pdf");
}
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, AnnotationsToolbar) {
RunTestsInJsModule("annotations_toolbar_test.js", "test.pdf");
}
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, ViewerToolbarDropdown) {
RunTestsInJsModule("viewer_toolbar_dropdown_test.js", "test.pdf");
}
#endif
class PDFExtensionPacificTimeZoneJSTest : public PDFExtensionJSTest { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionPacificTimeZoneJSTest,
ViewerPropertiesDialog) { … }
class PDFExtensionContentSettingJSTest : public PDFExtensionJSTest { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, Beep) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, NoBeep) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, BeepThenNoBeep) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, NoBeepThenBeep) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, BeepCsp) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, DISABLED_NoBeepCsp) { … }
class PDFExtensionWebUICodeCacheJSTest : public PDFExtensionJSTest { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionWebUICodeCacheJSTest, Basic) { … }
class PDFExtensionServiceWorkerJSTest : public PDFExtensionJSTest { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionServiceWorkerJSTest, NoFetchHandler) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionServiceWorkerJSTest, NetworkFallback) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionServiceWorkerJSTest, Interception) { … }
#if BUILDFLAG(ENABLE_PDF_INK2)
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(PDFExtensionJSTest, Ink2Disabled) { … }
#endif
class PDFExtensionJSInk2Test : public PDFExtensionJSTest { … };
IN_PROC_BROWSER_TEST_P(PDFExtensionJSInk2Test, Ink2) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSInk2Test, Ink2Save) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSInk2Test, Ink2SidePanel) { … }
IN_PROC_BROWSER_TEST_P(PDFExtensionJSInk2Test, Ink2ViewerToolbar) { … }
class PDFExtensionJSInk2BeforeUnloadTest : public PDFExtensionJSTestBase { … };
IN_PROC_BROWSER_TEST_F(PDFExtensionJSInk2BeforeUnloadTest, Stroke) { … }
IN_PROC_BROWSER_TEST_F(PDFExtensionJSInk2BeforeUnloadTest, Undo) { … }
#endif
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);