diff --git a/BUILD.gn b/BUILD.gn index 1200abe..df54a977 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -573,6 +573,7 @@ "//base:pe_image_test", "//chrome/install_static:install_static_unittests", "//chrome/installer/setup:setup_unittests", + "//chrome_elf:chrome_elf_import_unittests", "//chrome_elf:chrome_elf_unittests", "//chrome_elf:dll_hash_main", "//cloud_print:cloud_print_unittests",
diff --git a/DEPS b/DEPS index e5e1178..9681690 100644 --- a/DEPS +++ b/DEPS
@@ -49,7 +49,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'b4df6351f719186aee39e19ab3420cd5159f87c4', + 'v8_revision': '16e8fb38edadb87f2b3ba9f9fbc177cef1152734', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -69,7 +69,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '58418a24debb15019ec71eca193eff02c2a4846c', + 'pdfium_revision': '522e100534c78b026d170d5625c1e72046a6953c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -101,7 +101,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '8ec7b14edf48a27389a11c5af3bc14991eb28152', + 'catapult_revision': '5ec8f61fde1a3b172f7322769baabd8b7ec6c34e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -133,6 +133,11 @@ 'src/buildtools': Var('chromium_git') + '/chromium/buildtools.git' + '@' + Var('buildtools_revision'), + 'src/chrome/installer/mac/third_party/xz/xz': { + 'url': Var('chromium_git') + '/chromium/deps/xz.git' + '@' + 'eecaf55632ca72e90eb2641376bce7cdbc7284f7', + 'condition': 'checkout_mac', + }, + 'src/chrome/test/data/perf/canvas_bench': Var('chromium_git') + '/chromium/canvas_bench.git' + '@' + 'a7b40ea5ae0239517d78845a5fc9b12976bfc732', @@ -142,6 +147,51 @@ 'src/chrome/test/data/vr/webvr_info': Var('chromium_git') + '/external/github.com/toji/webvr.info.git' + '@' + '932fd58075e564727b5525681d6b9293b41a90f7', + 'src/ios/third_party/earl_grey/src': { + 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'b8f1ed850b3b8c059d2912ac4c25a2480ddba826', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/fishhook/src': { + 'url': Var('chromium_git') + '/external/github.com/facebook/fishhook.git' + '@' + 'd172d5247aa590c25d0b1885448bae76036ea22c', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/gcdwebserver/src': { + 'url': Var('chromium_git') + '/external/github.com/swisspol/GCDWebServer.git' + '@' + '43555c66627f6ed44817855a0f6d465f559d30e0', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/material_components_ios/src': { + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '74e87aa83f93ef27347b91c33a6d54af34b90977', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/material_font_disk_loader_ios/src': { + 'url': Var('chromium_git') + '/external/github.com/material-foundation/material-font-disk-loader-ios.git' + '@' + '8e30188777b016182658fbaa0a4a020a48183224', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/material_roboto_font_loader_ios/src': { + 'url': Var('chromium_git') + '/external/github.com/material-foundation/material-roboto-font-loader-ios.git' + '@' + '4aa51e906e5671c71d24e991f1f10d782a58409f', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/material_sprited_animation_view_ios/src': { + 'url': Var('chromium_git') + '/external/github.com/material-foundation/material-sprited-animation-view-ios.git' + '@' + 'c6e16d06bdafd95540c62b3402d9414692fbca81', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/material_text_accessibility_ios/src': { + 'url': Var('chromium_git') + '/external/github.com/material-foundation/material-text-accessibility-ios.git' + '@' + '7340b22cc589101ba0b11516afe4f3a733041951', + 'condition': 'checkout_ios', + }, + + 'src/ios/third_party/ochamcrest/src': { + 'url': Var('chromium_git') + '/external/github.com/hamcrest/OCHamcrest.git' + '@' + 'd7ee4ecfb6bd13c3c8d364682b6228ccd86e1e1a', + 'condition': 'checkout_ios', + }, + 'src/media/cdm/api': Var('chromium_git') + '/chromium/cdm.git' + '@' + '1f49c55d3151a4e1eec088befee5f578fea81f4b', @@ -172,6 +222,11 @@ 'src/third_party/bidichecker': Var('chromium_git') + '/external/bidichecker/lib.git' + '@' + '97f2aa645b74c28c57eca56992235c79850fa9e0', + 'src/third_party/bison': { + 'url': Var('chromium_git') + '/chromium/deps/bison.git' + '@' + '083c9a45e4affdd5464ee2b224c2df649c6e26c3', + 'condition': 'checkout_win', + }, + 'src/third_party/boringssl/src': Var('boringssl_git') + '/boringssl.git' + '@' + Var('boringssl_revision'), @@ -184,6 +239,12 @@ 'src/third_party/ced/src': Var('chromium_git') + '/external/github.com/google/compact_enc_det.git' + '@' + '94c367a1fe3a13207f4b22604fcfd1d9f9ddf6d9', + # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. + 'src/third_party/chromite': { + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '5704204e2f302317e202fd7ccb24593f64425ea9', + 'condition': 'checkout_linux', + }, + 'src/third_party/cld_2/src': Var('chromium_git') + '/external/github.com/CLD2Owners/cld2.git' + '@' + '84b58a5d7690ebf05a91406f371ce00c3daf31c0', @@ -196,6 +257,12 @@ 'src/third_party/crc32c/src': Var('chromium_git') + '/external/github.com/google/crc32c.git' + '@' + '9bc7a0cada31f3224779b7ba7f56cc7382758e54', + # For Linux and Chromium OS. + 'src/third_party/cros_system_api': { + 'url': Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + '72120182b44dcaf936241c8a9b3695c13bc6b589', + 'condition': 'checkout_linux', + }, + 'src/third_party/custom_tabs_client/src': { 'url': Var('chromium_git') + '/external/github.com/GoogleChrome/custom-tabs-client.git' + '@' + 'cff061038b852d647f7044d828a9df78aa135f38', 'condition': 'checkout_android', @@ -204,6 +271,12 @@ 'src/third_party/depot_tools': Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'b2e961b1171d9f27278461a0a3286ab89161368c', + # DevTools node modules. Used on Linux buildbots only. + 'src/third_party/devtools-node-modules': { + 'url': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), + 'condition': 'checkout_linux', + }, + 'src/third_party/dom_distiller_js/dist': Var('chromium_git') + '/chromium/dom-distiller/dist.git' + '@' + '232c293a4d3ebcbc4320f642af017ee054b3be93', @@ -231,15 +304,43 @@ 'src/third_party/flatbuffers/src': Var('chromium_git') + '/external/github.com/google/flatbuffers.git' + '@' + '01c50d57a67a52ee3cddd81b54d4647e9123a290', + # Used for embedded builds. CrOS & Linux use the system version. + 'src/third_party/fontconfig/src': { + 'url': Var('chromium_git') + '/external/fontconfig.git' + '@' + 'f16c3118e25546c1b749f9823c51827a60aeb5c1', + 'condition': 'checkout_linux', + }, + 'src/third_party/freetype/src': Var('chromium_git') + '/chromium/src/third_party/freetype2.git' + '@' + Var('freetype_revision'), + # Chrome OS touchpad gestures library. + 'src/third_party/gestures/gestures': { + 'url': Var('chromium_git') + '/chromiumos/platform/gestures.git' + '@' + '5a656849c7d2b0d0ddbe0ac6d300c1e2fada0bb4', + 'condition': 'checkout_linux', + }, + 'src/third_party/glslang/src': Var('chromium_git') + '/external/github.com/google/glslang.git' + '@' + '210c6bf4d8119dc5f8ac21da2d4c87184f7015e0', + 'src/third_party/google_toolbox_for_mac/src': { + 'url': Var('chromium_git') + '/external/github.com/google/google-toolbox-for-mac.git' + '@' + Var('google_toolbox_for_mac_revision'), + 'condition': 'checkout_ios or checkout_mac', + }, + 'src/third_party/googletest/src': Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '7f8fefabedf2965980585be8c2bff97458f28e0b', + # GNU binutils assembler for x86-32. + 'src/third_party/gnu_binutils': { + 'url': Var('chromium_git') + '/native_client/deps/third_party/gnu_binutils.git' + '@' + 'f4003433b61b25666565690caf3d7a7a1a4ec436', + 'condition': 'checkout_win', + }, + + 'src/third_party/gperf': { + 'url': Var('chromium_git') + '/chromium/deps/gperf.git' + '@' + 'd892d79f64f9449770443fb06da49b5a1e5d33c1', + 'condition': 'checkout_win', + }, + 'src/third_party/gvr-android-sdk/src': { 'url': Var('chromium_git') + '/external/github.com/googlevr/gvr-android-sdk.git' + '@' + 'ee5cb1c6138d0be57e82ddafc1b54d7d3e3e5560', 'condition': 'checkout_android', @@ -278,9 +379,26 @@ 'src/third_party/libaddressinput/src': Var('chromium_git') + '/external/libaddressinput.git' + '@' + '87f69db0b1ca732ba148489d2f75b3af2f236632', + # Userspace interface to kernel DRM services. + 'src/third_party/libdrm/src': { + 'url': Var('chromium_git') + '/chromiumos/third_party/libdrm.git' + '@' + '0ce18bedd3e62d4784fa755403801934ba171084', + 'condition': 'checkout_linux', + }, + + # The libevdev library (Chrome OS version). + 'src/third_party/libevdev/src': { + 'url': Var('chromium_git') + '/chromiumos/platform/libevdev.git' + '@' + '9f7a1961eb4726211e18abd147d5a11a4ea86744', + 'condition': 'checkout_linux', + }, + 'src/third_party/libjpeg_turbo': Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + 'a1750dbc79a8792dde3d3f7d7d8ac28ba01ac9dd', + 'src/third_party/liblouis/src': { + 'url': Var('chromium_git') + '/external/liblouis-github.git' + '@' + '5f9c03f2a3478561deb6ae4798175094be8a26c2', + 'condition': 'checkout_linux', + }, + 'src/third_party/libphonenumber/dist': Var('chromium_git') + '/external/libphonenumber.git' + '@' + 'a4da30df63a097d67e3c429ead6790ad91d36cf4', @@ -290,6 +408,12 @@ 'src/third_party/libsrtp': Var('chromium_git') + '/chromium/deps/libsrtp.git' + '@' + '1d45b8e599dc2db6ea3ae22dbc94a8c504652423', + # Android Explicit Synchronization. + 'src/third_party/libsync/src': { + 'url': Var('chromium_git') + '/aosp/platform/system/core/libsync.git' + '@' + 'aa6cda6f638bd57d3a024f0d201f723a5c3bb875', + 'condition': 'checkout_linux', + }, + 'src/third_party/libvpx/source/libvpx': Var('chromium_git') + '/webm/libvpx.git' + '@' + '10bab1ec2966e0c22e80965b00b2a953a338880b', @@ -299,14 +423,54 @@ 'src/third_party/libyuv': Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '5b1af9a33545895ea12c52bf007f17914de19173', # from r1670 + 'src/third_party/lighttpd': { + 'url': Var('chromium_git') + '/chromium/deps/lighttpd.git' + '@' + Var('lighttpd_revision'), + 'condition': 'checkout_mac or checkout_win', + }, + + 'src/third_party/lss': { + 'url': Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'), + 'condition': 'checkout_android or checkout_linux', + }, + + 'src/third_party/material_design_icons/src': { + 'url': Var('chromium_git') + '/external/github.com/google/material-design-icons.git' + '@' + + '5ab428852e35dc177a8c37a2df9dc9ccf768c65a', + 'condition': 'checkout_ios', + }, + 'src/third_party/mesa/src': Var('chromium_git') + '/chromium/deps/mesa.git' + '@' + 'ef811c6bd4de74e13e7035ca882cc77f85793fef', + # GNU binutils assembler for x86-64. + 'src/third_party/mingw-w64/mingw/bin': { + 'url': Var('chromium_git') + '/native_client/deps/third_party/mingw-w64/mingw/bin.git' + '@' + '3cc8b140b883a9fe4986d12cfd46c16a093d3527', + 'condition': 'checkout_win', + }, + + # Graphics buffer allocator for Chrome OS. + 'src/third_party/minigbm/src': { + 'url': Var('chromium_git') + '/chromiumos/platform/minigbm.git' + '@' + '27a7e6a24709564e18c3382d0aeda0b40c7ae03b', + 'condition': 'checkout_linux', + }, + + # Minizip library. Used on Chrome OS. + 'src/third_party/minizip/src': { + 'url': Var('chromium_git') + '/external/github.com/nmoinvaz/minizip' + '@' + 'e07e141475220196b55294c8172b274cc32d642d', + 'condition': 'checkout_linux', + }, + 'src/third_party/mockito/src': { 'url': Var('chromium_git') + '/external/mockito/mockito.git' + '@' + 'de83ad4598ad4cf5ea53c69a8a8053780b04b850', 'condition': 'checkout_android', }, + # Binaries for nacl sdk. + 'src/third_party/nacl_sdk_binaries': { + 'url': Var('chromium_git') + '/chromium/deps/nacl_sdk_binaries.git' + '@' + '759dfca03bdc774da7ecbf974f6e2b84f43699a5', + 'condition': 'checkout_win', + }, + 'src/third_party/netty-tcnative/src': { 'url': Var('chromium_git') + '/external/netty-tcnative.git' + '@' + '5b46a8ef4a39c39c576fcdaaf718b585d75df463', 'condition': 'checkout_android', @@ -326,6 +490,23 @@ 'src/third_party/pdfium': Var('pdfium_git') + '/pdfium.git' + '@' + Var('pdfium_revision'), + # Parses Windows PE/COFF executable format. + 'src/third_party/pefile': { + 'url': Var('chromium_git') + '/external/pefile.git' + '@' + '72c6ae42396cb913bcab63c15585dc3b5c3f92f1', + 'condition': 'checkout_win', + }, + + 'src/third_party/perl': { + 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', + 'condition': 'checkout_win', + }, + + # Dependency of chromite.git and skia. + 'src/third_party/pyelftools': { + 'url': Var('chromium_git') + '/chromiumos/third_party/pyelftools.git' + '@' + '19b3e610c86fcadb837d252c794cb5e8008826ae', + 'condition': 'checkout_linux', + }, + 'src/third_party/pyftpdlib/src': Var('chromium_git') + '/external/pyftpdlib.git' + '@' + '2be6d65e31c7ee6320d059f581f05ae8d89d7e45', @@ -374,6 +555,24 @@ 'src/third_party/visualmetrics/src': Var('chromium_git') + '/external/github.com/WPO-Foundation/visualmetrics.git' + '@' + '1edde9d2fe203229c895b648fdec355917200ad6', + # Display server protocol for Linux. + 'src/third_party/wayland/src': { + 'url': Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland.git' + '@' + '1361da9cd5a719b32d978485a29920429a31ed25', + 'condition': 'checkout_linux', + }, + + # Wayland protocols that add functionality not available in the core protocol. + 'src/third_party/wayland-protocols/src': { + 'url': Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland-protocols.git' + '@' + '26c99346ab5f2273fe5581bc4f6397bbb834f747', + 'condition': 'checkout_linux', + }, + + # Wireless Display Software. Used on Chrome OS. + 'src/third_party/wds/src': { + 'url': Var('chromium_git') + '/external/github.com/01org/wds' + '@' + 'ac3d8210d95f3000bf5c8e16a79dbbbf22d554a5', + 'condition': 'checkout_linux', + }, + 'src/third_party/webdriver/pylib': Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd', @@ -383,6 +582,11 @@ 'src/third_party/webrtc': Var('webrtc_git') + '/src.git' + '@' + 'bbceb76f540159e2dba0701ac03c514f01624130', # commit position 20032 + 'src/third_party/xdg-utils': { + 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', + 'condition': 'checkout_linux', + }, + 'src/third_party/yasm/source/patched-yasm': Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + 'b98114e18d8b9b84586b10d24353ab8616d4c5fc', @@ -405,154 +609,6 @@ } -deps_os = { - 'win': { - 'src/third_party/bison': - Var('chromium_git') + '/chromium/deps/bison.git' + '@' + '083c9a45e4affdd5464ee2b224c2df649c6e26c3', - - 'src/third_party/gperf': - Var('chromium_git') + '/chromium/deps/gperf.git' + '@' + 'd892d79f64f9449770443fb06da49b5a1e5d33c1', - - 'src/third_party/perl': - Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', - - 'src/third_party/lighttpd': - Var('chromium_git') + '/chromium/deps/lighttpd.git' + '@' + Var('lighttpd_revision'), - - # Parses Windows PE/COFF executable format. - 'src/third_party/pefile': - Var('chromium_git') + '/external/pefile.git' + '@' + '72c6ae42396cb913bcab63c15585dc3b5c3f92f1', - - # GNU binutils assembler for x86-32. - 'src/third_party/gnu_binutils': - Var('chromium_git') + '/native_client/deps/third_party/gnu_binutils.git' + '@' + 'f4003433b61b25666565690caf3d7a7a1a4ec436', - # GNU binutils assembler for x86-64. - 'src/third_party/mingw-w64/mingw/bin': - Var('chromium_git') + '/native_client/deps/third_party/mingw-w64/mingw/bin.git' + '@' + '3cc8b140b883a9fe4986d12cfd46c16a093d3527', - - # Binaries for nacl sdk. - 'src/third_party/nacl_sdk_binaries': - Var('chromium_git') + '/chromium/deps/nacl_sdk_binaries.git' + '@' + '759dfca03bdc774da7ecbf974f6e2b84f43699a5', - }, - 'ios': { - 'src/ios/third_party/earl_grey/src': - Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'b8f1ed850b3b8c059d2912ac4c25a2480ddba826', - - 'src/ios/third_party/fishhook/src': - Var('chromium_git') + '/external/github.com/facebook/fishhook.git' + '@' + 'd172d5247aa590c25d0b1885448bae76036ea22c', - - 'src/ios/third_party/gcdwebserver/src': - Var('chromium_git') + '/external/github.com/swisspol/GCDWebServer.git' + '@' + '43555c66627f6ed44817855a0f6d465f559d30e0', - - 'src/ios/third_party/material_components_ios/src': - Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '74e87aa83f93ef27347b91c33a6d54af34b90977', - - 'src/ios/third_party/material_font_disk_loader_ios/src': - Var('chromium_git') + '/external/github.com/material-foundation/material-font-disk-loader-ios.git' + '@' + '8e30188777b016182658fbaa0a4a020a48183224', - - 'src/ios/third_party/material_roboto_font_loader_ios/src': - Var('chromium_git') + '/external/github.com/material-foundation/material-roboto-font-loader-ios.git' + '@' + '4aa51e906e5671c71d24e991f1f10d782a58409f', - - 'src/ios/third_party/material_sprited_animation_view_ios/src': - Var('chromium_git') + '/external/github.com/material-foundation/material-sprited-animation-view-ios.git' + '@' + 'c6e16d06bdafd95540c62b3402d9414692fbca81', - - 'src/ios/third_party/material_text_accessibility_ios/src': - Var('chromium_git') + '/external/github.com/material-foundation/material-text-accessibility-ios.git' + '@' + '7340b22cc589101ba0b11516afe4f3a733041951', - - 'src/ios/third_party/ochamcrest/src': - Var('chromium_git') + '/external/github.com/hamcrest/OCHamcrest.git' + '@' + 'd7ee4ecfb6bd13c3c8d364682b6228ccd86e1e1a', - - 'src/third_party/google_toolbox_for_mac/src': - Var('chromium_git') + '/external/github.com/google/google-toolbox-for-mac.git' + '@' + Var('google_toolbox_for_mac_revision'), - - 'src/third_party/material_design_icons/src': - Var('chromium_git') + '/external/github.com/google/material-design-icons.git' + '@' + - '5ab428852e35dc177a8c37a2df9dc9ccf768c65a', - }, - 'mac': { - 'src/chrome/installer/mac/third_party/xz/xz': - Var('chromium_git') + '/chromium/deps/xz.git' + '@' + 'eecaf55632ca72e90eb2641376bce7cdbc7284f7', - - 'src/third_party/google_toolbox_for_mac/src': - Var('chromium_git') + '/external/github.com/google/google-toolbox-for-mac.git' + '@' + Var('google_toolbox_for_mac_revision'), - - 'src/third_party/lighttpd': - Var('chromium_git') + '/chromium/deps/lighttpd.git' + '@' + Var('lighttpd_revision'), - }, - 'unix': { - # Linux, really. - 'src/third_party/xdg-utils': - Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', - - 'src/third_party/lss': - Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'), - - # For Linux and Chromium OS. - 'src/third_party/cros_system_api': - Var('chromium_git') + '/chromiumos/platform/system_api.git' + '@' + '8dbf538802c8f50b0ce1f06f579d3a4809592ecc', - - # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. - 'src/third_party/chromite': - Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '5704204e2f302317e202fd7ccb24593f64425ea9', - - # Dependency of chromite.git and skia. - 'src/third_party/pyelftools': - Var('chromium_git') + '/chromiumos/third_party/pyelftools.git' + '@' + '19b3e610c86fcadb837d252c794cb5e8008826ae', - - 'src/third_party/liblouis/src': - Var('chromium_git') + '/external/liblouis-github.git' + '@' + '5f9c03f2a3478561deb6ae4798175094be8a26c2', - - # Used for embedded builds. CrOS & Linux use the system version. - 'src/third_party/fontconfig/src': - Var('chromium_git') + '/external/fontconfig.git' + '@' + 'f16c3118e25546c1b749f9823c51827a60aeb5c1', - - # Graphics buffer allocator for Chrome OS. - 'src/third_party/minigbm/src': - Var('chromium_git') + '/chromiumos/platform/minigbm.git' + '@' + '27a7e6a24709564e18c3382d0aeda0b40c7ae03b', - - # Userspace interface to kernel DRM services. - 'src/third_party/libdrm/src': - Var('chromium_git') + '/chromiumos/third_party/libdrm.git' + '@' + '0ce18bedd3e62d4784fa755403801934ba171084', - - # Display server protocol for Linux. - 'src/third_party/wayland/src': - Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland.git' + '@' + '1361da9cd5a719b32d978485a29920429a31ed25', - - # Wayland protocols that add functionality not available in the core protocol. - 'src/third_party/wayland-protocols/src': - Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland-protocols.git' + '@' + '26c99346ab5f2273fe5581bc4f6397bbb834f747', - - # The libevdev library (Chrome OS version). - 'src/third_party/libevdev/src': - Var('chromium_git') + '/chromiumos/platform/libevdev.git' + '@' + '9f7a1961eb4726211e18abd147d5a11a4ea86744', - - # Chrome OS touchpad gestures library. - 'src/third_party/gestures/gestures': - Var('chromium_git') + '/chromiumos/platform/gestures.git' + '@' + '5a656849c7d2b0d0ddbe0ac6d300c1e2fada0bb4', - - # Wireless Display Software. Used on Chrome OS. - 'src/third_party/wds/src': - Var('chromium_git') + '/external/github.com/01org/wds' + '@' + 'ac3d8210d95f3000bf5c8e16a79dbbbf22d554a5', - - # DevTools node modules. Used on Linux buildbots only. - 'src/third_party/devtools-node-modules': - Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), - - # Minizip library. Used on Chrome OS. - 'src/third_party/minizip/src': - Var('chromium_git') + '/external/github.com/nmoinvaz/minizip' + '@' + 'e07e141475220196b55294c8172b274cc32d642d', - - # Android Explicit Synchronization. - 'src/third_party/libsync/src': - Var('chromium_git') + '/aosp/platform/system/core/libsync.git' + '@' + 'aa6cda6f638bd57d3a024f0d201f723a5c3bb875', - }, - 'android': { - # TODO(phajdan.jr): move all lss entries together to deps behind proper condition. - 'src/third_party/lss': - Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'), - }, -} - include_rules = [ # Everybody can use some things. # NOTE: THIS HAS TO STAY IN SYNC WITH third_party/DEPS which disallows these. @@ -780,7 +836,7 @@ { 'name': 'orderfiles_win', 'pattern': '.', - 'condition': 'host_os == "win"', + 'condition': 'checkout_win', 'action': [ 'python', 'src/third_party/depot_tools/download_from_google_storage.py', '--no_resume', @@ -982,227 +1038,244 @@ '-s', 'src/third_party/checkstyle/checkstyle-8.0-all.jar.sha1' ], }, -] -# Note: These are keyed off target os, not host os. So don't move things here -# that depend on the target os. -hooks_os = { - 'android': [ - { - # This downloads SDK extras and puts them in the - # third_party/android_tools/sdk/extras directory. - 'name': 'sdkextras', - 'pattern': '.', - # When adding a new sdk extras package to download, add the package - # directory and zip file to .gitignore in third_party/android_tools. - 'action': ['python', - 'src/build/android/play_services/update.py', - 'download' - ], - }, - { - 'name': 'android_system_sdk', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'android_system_stubs', - '-l', 'third_party/android_system_sdk' - ], - }, - { - 'name': 'intellij', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-intellij', - '-l', 'third_party/intellij' - ], - }, - { - 'name': 'javax_inject', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-javax-inject', - '-l', 'third_party/javax_inject' - ], - }, - { - 'name': 'hamcrest', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-hamcrest', - '-l', 'third_party/hamcrest' - ], - }, - { - 'name': 'guava', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-guava', - '-l', 'third_party/guava' - ], - }, - { - 'name': 'android_support_test_runner', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-android-support-test-runner', - '-l', 'third_party/android_support_test_runner' - ], - }, - { - 'name': 'byte_buddy', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-byte-buddy', - '-l', 'third_party/byte_buddy' - ], - }, - { - 'name': 'espresso', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-espresso', - '-l', 'third_party/espresso' - ], - }, - { - 'name': 'robolectric_libs', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-robolectric', - '-l', 'third_party/robolectric' - ], - }, - { - 'name': 'apache_velocity', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-apache-velocity', - '-l', 'third_party/apache_velocity' - ], - }, - { - 'name': 'ow2_asm', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-ow2-asm', - '-l', 'third_party/ow2_asm' - ], - }, - { - 'name': 'desugar', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-android-tools/bazel/desugar', - '-l', 'third_party/bazel/desugar' - ], - }, - { - 'name': 'apk-patch-size-estimator', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-android-tools/apk-patch-size-estimator', - '-l', 'third_party/apk-patch-size-estimator/lib' - ], - }, - { - 'name': 'icu4j', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-icu4j', - '-l', 'third_party/icu4j' - ], - }, - { - 'name': 'accessibility_test_framework', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-accessibility-test-framework', - '-l', 'third_party/accessibility_test_framework' - ], - }, - { - 'name': 'bouncycastle', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-bouncycastle', - '-l', 'third_party/bouncycastle' - ], - }, - { - 'name': 'sqlite4java', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-sqlite4java', - '-l', 'third_party/sqlite4java' - ], - }, - { - 'name': 'gson', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-gson', - '-l', 'third_party/gson', - ], - }, - { - 'name': 'objenesis', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-objenesis', - '-l', 'third_party/objenesis' - ], - }, - { - 'name': 'xstream', - 'pattern': '.', - 'action': ['python', - 'src/build/android/update_deps/update_third_party_deps.py', - 'download', - '-b', 'chromium-robolectric', - '-l', 'third_party/xstream' - ], - }, - { - 'name': 'gvr_static_shim_android_arm', - 'pattern': '\\.sha1', + { + # This downloads SDK extras and puts them in the + # third_party/android_tools/sdk/extras directory. + 'name': 'sdkextras', + 'pattern': '.', + 'condition': 'checkout_android', + # When adding a new sdk extras package to download, add the package + # directory and zip file to .gitignore in third_party/android_tools. + 'action': ['python', + 'src/build/android/play_services/update.py', + 'download' + ], + }, + { + 'name': 'android_system_sdk', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'android_system_stubs', + '-l', 'third_party/android_system_sdk' + ], + }, + { + 'name': 'intellij', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-intellij', + '-l', 'third_party/intellij' + ], + }, + { + 'name': 'javax_inject', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-javax-inject', + '-l', 'third_party/javax_inject' + ], + }, + { + 'name': 'hamcrest', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-hamcrest', + '-l', 'third_party/hamcrest' + ], + }, + { + 'name': 'guava', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-guava', + '-l', 'third_party/guava' + ], + }, + { + 'name': 'android_support_test_runner', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-android-support-test-runner', + '-l', 'third_party/android_support_test_runner' + ], + }, + { + 'name': 'byte_buddy', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-byte-buddy', + '-l', 'third_party/byte_buddy' + ], + }, + { + 'name': 'espresso', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-espresso', + '-l', 'third_party/espresso' + ], + }, + { + 'name': 'robolectric_libs', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-robolectric', + '-l', 'third_party/robolectric' + ], + }, + { + 'name': 'apache_velocity', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-apache-velocity', + '-l', 'third_party/apache_velocity' + ], + }, + { + 'name': 'ow2_asm', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-ow2-asm', + '-l', 'third_party/ow2_asm' + ], + }, + { + 'name': 'desugar', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-android-tools/bazel/desugar', + '-l', 'third_party/bazel/desugar' + ], + }, + { + 'name': 'apk-patch-size-estimator', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-android-tools/apk-patch-size-estimator', + '-l', 'third_party/apk-patch-size-estimator/lib' + ], + }, + { + 'name': 'icu4j', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-icu4j', + '-l', 'third_party/icu4j' + ], + }, + { + 'name': 'accessibility_test_framework', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-accessibility-test-framework', + '-l', 'third_party/accessibility_test_framework' + ], + }, + { + 'name': 'bouncycastle', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-bouncycastle', + '-l', 'third_party/bouncycastle' + ], + }, + { + 'name': 'sqlite4java', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-sqlite4java', + '-l', 'third_party/sqlite4java' + ], + }, + { + 'name': 'gson', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-gson', + '-l', 'third_party/gson', + ], + }, + { + 'name': 'objenesis', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-objenesis', + '-l', 'third_party/objenesis' + ], + }, + { + 'name': 'xstream', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/update_deps/update_third_party_deps.py', + 'download', + '-b', 'chromium-robolectric', + '-l', 'third_party/xstream' + ], + }, + { + 'name': 'gvr_static_shim_android_arm', + 'pattern': '\\.sha1', + 'condition': 'checkout_android', 'action': [ 'python', 'src/third_party/depot_tools/download_from_google_storage.py', '--no_resume', @@ -1210,11 +1283,12 @@ '--no_auth', '--bucket', 'chromium-gvr-static-shim', '-s', 'src/third_party/gvr-android-sdk/libgvr_shim_static_arm.a.sha1', - ], - }, - { - 'name': 'gvr_static_shim_android_arm64', - 'pattern': '\\.sha1', + ], + }, + { + 'name': 'gvr_static_shim_android_arm64', + 'pattern': '\\.sha1', + 'condition': 'checkout_android', 'action': [ 'python', 'src/third_party/depot_tools/download_from_google_storage.py', '--no_resume', @@ -1223,10 +1297,11 @@ '--bucket', 'chromium-gvr-static-shim', '-s', 'src/third_party/gvr-android-sdk/libgvr_shim_static_arm64.a.sha1', ], - }, - { - 'name': 'vr_controller_test_api', - 'pattern': '\\.sha1', + }, + { + 'name': 'vr_controller_test_api', + 'pattern': '\\.sha1', + 'condition': 'checkout_android', 'action': [ 'python', 'src/third_party/depot_tools/download_from_google_storage.py', '--no_resume', @@ -1234,37 +1309,38 @@ '--no_auth', '--bucket', 'chromium-gvr-static-shim/controller_test_api', '-s', 'src/third_party/gvr-android-sdk/test-libraries/controller_test_api.aar.sha1', - ], - }, - # Download VR test APKs only if the environment variable is set - { - 'name': 'vr_test_apks', - 'pattern': '.', - 'action': [ 'python', - 'src/third_party/gvr-android-sdk/test-apks/update.py', - ], - }, - { - # Pull doclava binaries if building for Android. - 'name': 'doclava', - 'pattern': '.', - 'action': ['python', - 'src/build/android/download_doclava.py', - ], - }, - ], - 'fuchsia': [ - { - 'name': 'fuchsia_sdk', - 'pattern': '.', - 'action': [ - 'python', - 'src/build/fuchsia/update_sdk.py', - '36d9ffb6bda53112e826941757efe04654050d46', - ], - }, - ], -} + ], + }, + # Download VR test APKs only if the environment variable is set + { + 'name': 'vr_test_apks', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': [ 'python', + 'src/third_party/gvr-android-sdk/test-apks/update.py', + ], + }, + { + # Pull doclava binaries if building for Android. + 'name': 'doclava', + 'pattern': '.', + 'condition': 'checkout_android', + 'action': ['python', + 'src/build/android/download_doclava.py', + ], + }, + + { + 'name': 'fuchsia_sdk', + 'pattern': '.', + 'condition': 'checkout_fuchsia', + 'action': [ + 'python', + 'src/build/fuchsia/update_sdk.py', + '36d9ffb6bda53112e826941757efe04654050d46', + ], + }, +] recursedeps = [ # buildtools provides clang_format, libc++, and libc++abi
diff --git a/WATCHLISTS b/WATCHLISTS index 0f3c76c..de759ce 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -901,6 +901,9 @@ 'gpu': { 'filepath': 'gpu/', }, + 'gpu_passthrough_cmd_decoder': { + 'filepath': 'gpu/command_buffer/service/.*passthrough', + }, 'history_ui': { 'filepath': 'chrome/browser/resources/(md_)?history|'\ 'chrome/browser/ui/webui/.*history', @@ -2010,6 +2013,8 @@ 'dpranke@chromium.org', 'tfarina@chromium.org'], 'gpu': ['piman+watch@chromium.org'], + 'gpu_passthrough_cmd_decoder': ['cwallez+watch@chromium.org', + 'geofflang+watch@chromium.org'], 'history_ui': ['pam+watch@chromium.org'], 'hotword': ['rlp+watch@chromium.org'], 'i18n': ['jshin+watch@chromium.org'],
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index c171eaa..7623536 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -925,7 +925,6 @@ "//components/prefs", "//components/quirks", "//components/session_manager:base", - "//components/session_manager/core", "//components/signin/core/account_id", "//components/strings", "//components/user_manager", @@ -1434,7 +1433,6 @@ "//chromeos:test_support_without_gmock", "//components/prefs:test_support", "//components/quirks", - "//components/session_manager/core", "//components/signin/core/account_id", "//components/user_manager", "//components/user_manager:test_support",
diff --git a/ash/DEPS b/ash/DEPS index e6d96c63..0b8c3da 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -72,6 +72,10 @@ # TODO: This is temporary, ash should not use these. http://crbug.com/747415. "+ui/events/devices/device_data_manager.h", "+ui/events/devices/input_device_manager.h", + + # SessionManager/UserManager is not part of ash. Use SessionController. + "-components/session_manager/core", + "-components/user_manager/user_manager.h", ] specific_include_rules = {
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index d7866ae..9bdc7cf5 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -588,9 +588,6 @@ <message name="IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS" desc="The label used in the settings entry in the network dialog."> Network settings </message> - <message name="IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS" desc="The label used in the proxy settings entry in the network dialog in the login screen."> - Proxy settings - </message> <message name="IDS_ASH_STATUS_TRAY_OTHER_WIFI" desc="The label used for the item to display other Wi-Fi networks."> Join other... </message>
diff --git a/ash/public/interfaces/system_tray.mojom b/ash/public/interfaces/system_tray.mojom index c120468..f79bbe1 100644 --- a/ash/public/interfaces/system_tray.mojom +++ b/ash/public/interfaces/system_tray.mojom
@@ -128,9 +128,6 @@ // be any string. ShowNetworkSettings(string network_id); - // Shows UI for changing proxy settings. - ShowProxySettings(); - // Attempts to sign out the user. // TODO(jamescook): Migrate to a user or login service. crbug.com/665582 SignOut();
diff --git a/ash/session/session_controller.cc b/ash/session/session_controller.cc index a95f42bd3..a15f086a 100644 --- a/ash/session/session_controller.cc +++ b/ash/session/session_controller.cc
@@ -203,15 +203,6 @@ return GetUserSession(0)->user_info->is_new_profile; } -bool SessionController::IsKioskSession() const { - if (!IsActiveUserSessionStarted()) - return false; - - user_manager::UserType active_user_type = GetUserSession(0)->user_info->type; - return active_user_type == user_manager::USER_TYPE_KIOSK_APP || - active_user_type == user_manager::USER_TYPE_ARC_KIOSK_APP; -} - void SessionController::LockScreen() { if (client_) client_->RequestLockScreen();
diff --git a/ash/session/session_controller.h b/ash/session/session_controller.h index 71d4d59..7d077076 100644 --- a/ash/session/session_controller.h +++ b/ash/session/session_controller.h
@@ -121,10 +121,6 @@ // device (i.e. first time login on the device). bool IsUserFirstLogin() const; - // Returns true if the current user session is a kiosk session (either - // chrome app kiosk or ARC kiosk). - bool IsKioskSession() const; - // Locks the screen. The locking happens asynchronously. void LockScreen();
diff --git a/ash/system/bluetooth/bluetooth_power_controller.h b/ash/system/bluetooth/bluetooth_power_controller.h index f683d2f..94d0933 100644 --- a/ash/system/bluetooth/bluetooth_power_controller.h +++ b/ash/system/bluetooth/bluetooth_power_controller.h
@@ -12,7 +12,7 @@ #include "base/logging.h" #include "base/macros.h" #include "components/prefs/pref_change_registrar.h" -#include "components/user_manager/user_manager.h" +#include "components/user_manager/user_type.h" #include "device/bluetooth/bluetooth_adapter.h" class PrefRegistrySimple;
diff --git a/ash/system/network/network_state_list_detailed_view.cc b/ash/system/network/network_state_list_detailed_view.cc index 95125c0..17a63a9 100644 --- a/ash/system/network/network_state_list_detailed_view.cc +++ b/ash/system/network/network_state_list_detailed_view.cc
@@ -168,7 +168,6 @@ login_(login), info_button_(nullptr), settings_button_(nullptr), - proxy_settings_button_(nullptr), info_bubble_(nullptr) {} NetworkStateListDetailedView::~NetworkStateListDetailedView() { @@ -202,8 +201,6 @@ if (sender == settings_button_) ShowSettings(); - else if (sender == proxy_settings_button_) - Shell::Get()->system_tray_controller()->ShowProxySettings(); if (owner()->system_tray()) owner()->system_tray()->CloseBubble(); @@ -252,26 +249,11 @@ IDS_ASH_STATUS_TRAY_NETWORK_INFO); tri_view()->AddView(TriView::Container::END, info_button_); - if (login_ != LoginStatus::NOT_LOGGED_IN) { - DCHECK(!settings_button_); - settings_button_ = new SystemMenuButton( - this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, - IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS); - - // Allow the user to access settings only if user is logged in - // and showing settings is allowed. There are situations (supervised user - // creation flow) when session is started but UI flow continues within - // login UI, i.e., no browser window is yet available. - if (!Shell::Get()->session_controller()->ShouldEnableSettings()) - settings_button_->SetEnabled(false); - - tri_view()->AddView(TriView::Container::END, settings_button_); - } else { - proxy_settings_button_ = new SystemMenuButton( - this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, - IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS); - tri_view()->AddView(TriView::Container::END, proxy_settings_button_); - } + DCHECK(!settings_button_); + settings_button_ = new SystemMenuButton( + this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, + IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS); + tri_view()->AddView(TriView::Container::END, settings_button_); } void NetworkStateListDetailedView::ShowSettings() { @@ -282,10 +264,19 @@ } void NetworkStateListDetailedView::UpdateHeaderButtons() { - if (proxy_settings_button_) { - proxy_settings_button_->SetEnabled( - NetworkHandler::Get()->network_state_handler()->DefaultNetwork() != - nullptr); + if (settings_button_) { + if (login_ == LoginStatus::NOT_LOGGED_IN) { + // When not logged in, only enable the settings button if there is a + // default (i.e. connected or connecting) network to show settings for. + settings_button_->SetEnabled( + !!NetworkHandler::Get()->network_state_handler()->DefaultNetwork()); + } else { + // Otherwise, enable if showing settings is allowed. There are situations + // (supervised user creation flow) when the session is started but UI flow + // continues within login UI, i.e., no browser window is yet available. + settings_button_->SetEnabled( + Shell::Get()->session_controller()->ShouldEnableSettings()); + } } if (list_type_ == LIST_TYPE_NETWORK) { NetworkStateHandler* network_state_handler =
diff --git a/ash/system/network/network_state_list_detailed_view.h b/ash/system/network/network_state_list_detailed_view.h index 3f22e16..235ced1 100644 --- a/ash/system/network/network_state_list_detailed_view.h +++ b/ash/system/network/network_state_list_detailed_view.h
@@ -82,7 +82,6 @@ views::Button* info_button_; views::Button* settings_button_; - views::Button* proxy_settings_button_; // A small bubble for displaying network info. views::BubbleDialogDelegateView* info_bubble_;
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc index 1b6a9c53..a3506ce 100644 --- a/ash/system/overview/overview_button_tray.cc +++ b/ash/system/overview/overview_button_tray.cc
@@ -141,11 +141,9 @@ Shell* shell = Shell::Get(); SetVisible( shell->tablet_mode_controller()->IsTabletModeWindowManagerEnabled() && - session_controller->IsActiveUserSessionStarted() && - !session_controller->IsScreenLocked() && session_controller->GetSessionState() == session_manager::SessionState::ACTIVE && - !session_controller->IsKioskSession()); + !session_controller->IsRunningInAppMode()); } } // namespace ash
diff --git a/ash/system/palette/palette_utils.cc b/ash/system/palette/palette_utils.cc index e46b127b..48c7f4c 100644 --- a/ash/system/palette/palette_utils.cc +++ b/ash/system/palette/palette_utils.cc
@@ -90,7 +90,7 @@ return !session_controller->IsUserSessionBlocked() && session_controller->GetSessionState() == session_manager::SessionState::ACTIVE && - !session_controller->IsKioskSession(); + !session_controller->IsRunningInAppMode(); } } // namespace palette_utils
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 42d14e8..3299133 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc
@@ -483,8 +483,8 @@ bool can_activate, BubbleCreationType creation_type, bool persistent) { - // No system tray bubbles in kiosk mode. - if (Shell::Get()->session_controller()->IsKioskSession()) + // No system tray bubbles in kiosk app mode. + if (Shell::Get()->session_controller()->IsRunningInAppMode()) return; // Destroy any existing bubble and create a new one.
diff --git a/ash/system/tray/system_tray_controller.cc b/ash/system/tray/system_tray_controller.cc index 6401774..5f9082c 100644 --- a/ash/system/tray/system_tray_controller.cc +++ b/ash/system/tray/system_tray_controller.cc
@@ -129,11 +129,6 @@ system_tray_client_->ShowNetworkSettings(network_id); } -void SystemTrayController::ShowProxySettings() { - if (system_tray_client_) - system_tray_client_->ShowProxySettings(); -} - void SystemTrayController::SignOut() { if (system_tray_client_) system_tray_client_->SignOut();
diff --git a/ash/system/tray/system_tray_controller.h b/ash/system/tray/system_tray_controller.h index 0ffe0c2..8ef4586 100644 --- a/ash/system/tray/system_tray_controller.h +++ b/ash/system/tray/system_tray_controller.h
@@ -57,7 +57,6 @@ void ShowNetworkCreate(const std::string& type); void ShowThirdPartyVpnCreate(const std::string& extension_id); void ShowNetworkSettings(const std::string& network_id); - void ShowProxySettings(); void SignOut(); void RequestRestartForUpdate();
diff --git a/ash/system/web_notification/login_state_notification_blocker.cc b/ash/system/web_notification/login_state_notification_blocker.cc index a3e607c..85cb0d7 100644 --- a/ash/system/web_notification/login_state_notification_blocker.cc +++ b/ash/system/web_notification/login_state_notification_blocker.cc
@@ -4,11 +4,11 @@ #include "ash/system/web_notification/login_state_notification_blocker.h" +#include "ash/session/session_controller.h" +#include "ash/shell.h" #include "ash/system/system_notifier.h" -#include "components/session_manager/core/session_manager.h" #include "ui/message_center/message_center.h" -using session_manager::SessionManager; using session_manager::SessionState; namespace ash { @@ -16,14 +16,11 @@ LoginStateNotificationBlocker::LoginStateNotificationBlocker( message_center::MessageCenter* message_center) : NotificationBlocker(message_center) { - // SessionManager may not exist in some tests. - if (SessionManager::Get()) - SessionManager::Get()->AddObserver(this); + Shell::Get()->session_controller()->AddObserver(this); } LoginStateNotificationBlocker::~LoginStateNotificationBlocker() { - if (SessionManager::Get()) - SessionManager::Get()->RemoveObserver(this); + Shell::Get()->session_controller()->RemoveObserver(this); } bool LoginStateNotificationBlocker::ShouldShowNotificationAsPopup( @@ -31,13 +28,11 @@ if (ash::system_notifier::ShouldAlwaysShowPopups(notification.notifier_id())) return true; - if (SessionManager::Get()) - return SessionManager::Get()->session_state() == SessionState::ACTIVE; - - return true; + return Shell::Get()->session_controller()->GetSessionState() == + SessionState::ACTIVE; } -void LoginStateNotificationBlocker::OnSessionStateChanged() { +void LoginStateNotificationBlocker::OnSessionStateChanged(SessionState state) { NotifyBlockingStateChanged(); }
diff --git a/ash/system/web_notification/login_state_notification_blocker.h b/ash/system/web_notification/login_state_notification_blocker.h index b837e68f..fd64fbc1 100644 --- a/ash/system/web_notification/login_state_notification_blocker.h +++ b/ash/system/web_notification/login_state_notification_blocker.h
@@ -6,18 +6,18 @@ #define ASH_SYSTEM_WEB_NOTIFICATION_LOGIN_STATE_NOTIFICATION_BLOCKER_H_ #include "ash/ash_export.h" +#include "ash/session/session_observer.h" #include "base/macros.h" -#include "components/session_manager/core/session_manager_observer.h" #include "ui/message_center/notification_blocker.h" namespace ash { // A notification blocker which suppresses notifications popups based on the -// login state reported by the SessionManager. Only active (logged in, unlocked) -// sessions will show popups. +// session state reported by the SessionController. Only active (logged in, +// unlocked) sessions will show popups. class ASH_EXPORT LoginStateNotificationBlocker : public message_center::NotificationBlocker, - public session_manager::SessionManagerObserver { + public SessionObserver { public: explicit LoginStateNotificationBlocker( message_center::MessageCenter* message_center); @@ -28,8 +28,8 @@ bool ShouldShowNotificationAsPopup( const message_center::Notification& notification) const override; - // session_manager::SessionManagerObserver overrides: - void OnSessionStateChanged() override; + // SessionObserver overrides: + void OnSessionStateChanged(session_manager::SessionState state) override; DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlocker); };
diff --git a/ash/system/web_notification/login_state_notification_blocker_unittest.cc b/ash/system/web_notification/login_state_notification_blocker_unittest.cc index 4f6cc5d1..06af74f9 100644 --- a/ash/system/web_notification/login_state_notification_blocker_unittest.cc +++ b/ash/system/web_notification/login_state_notification_blocker_unittest.cc
@@ -6,18 +6,17 @@ #include <memory> +#include "ash/session/test_session_controller_client.h" #include "ash/system/system_notifier.h" #include "ash/test/ash_test_base.h" #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" -#include "components/session_manager/core/session_manager.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h" using base::UTF8ToUTF16; -using session_manager::SessionManager; using session_manager::SessionState; namespace ash { @@ -25,7 +24,7 @@ namespace { class LoginStateNotificationBlockerTest - : public AshTestBase, + : public NoSessionAshTestBase, public message_center::NotificationBlocker::Observer { public: LoginStateNotificationBlockerTest() {} @@ -33,10 +32,7 @@ // tests::AshTestBase overrides: void SetUp() override { - session_manager_ = base::MakeUnique<SessionManager>(); - session_manager_->SetSessionState(SessionState::LOGIN_PRIMARY); - - AshTestBase::SetUp(); + NoSessionAshTestBase::SetUp(); blocker_.reset(new LoginStateNotificationBlocker( message_center::MessageCenter::Get())); blocker_->AddObserver(this); @@ -45,7 +41,7 @@ void TearDown() override { blocker_->RemoveObserver(this); blocker_.reset(); - AshTestBase::TearDown(); + NoSessionAshTestBase::TearDown(); } // message_center::NotificationBlocker::Observer overrides: @@ -71,14 +67,13 @@ } void SetLockedState(bool locked) { - SessionManager::Get()->SetSessionState(locked ? SessionState::LOCKED - : SessionState::ACTIVE); + GetSessionControllerClient()->SetSessionState( + locked ? SessionState::LOCKED : SessionState::ACTIVE); } private: int state_changed_count_ = 0; std::unique_ptr<message_center::NotificationBlocker> blocker_; - std::unique_ptr<session_manager::SessionManager> session_manager_; DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerTest); }; @@ -90,12 +85,12 @@ EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); // Login screen. - SessionManager::Get()->SetSessionState(SessionState::LOGIN_PRIMARY); + GetSessionControllerClient()->SetSessionState(SessionState::LOGIN_PRIMARY); EXPECT_EQ(0, GetStateChangedCountAndReset()); EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); // Logged in as a normal user. - SessionManager::Get()->SetSessionState(SessionState::ACTIVE); + SimulateUserLogin("user@test.com"); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); @@ -120,12 +115,12 @@ EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); // Login screen. - SessionManager::Get()->SetSessionState(SessionState::LOGIN_PRIMARY); + GetSessionControllerClient()->SetSessionState(SessionState::LOGIN_PRIMARY); EXPECT_EQ(0, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); // Logged in as a normal user. - SessionManager::Get()->SetSessionState(SessionState::ACTIVE); + SimulateUserLogin("user@test.com"); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc index 97038091..210e522 100644 --- a/ash/wm/overview/window_selector_controller.cc +++ b/ash/wm/overview/window_selector_controller.cc
@@ -41,14 +41,15 @@ // static bool WindowSelectorController::CanSelect() { - // Don't allow a window overview if the screen is locked or a modal dialog is - // open or running in kiosk app session. + // Don't allow a window overview if the user session is not active (e.g. + // locked or in user-adding screen) or a modal dialog is open or running in + // kiosk app session. SessionController* session_controller = Shell::Get()->session_controller(); - return session_controller->IsActiveUserSessionStarted() && - !session_controller->IsScreenLocked() && + return session_controller->GetSessionState() == + session_manager::SessionState::ACTIVE && !ShellPort::Get()->IsSystemModalWindowOpen() && !Shell::Get()->screen_pinning_controller()->IsPinned() && - !session_controller->IsKioskSession(); + !session_controller->IsRunningInAppMode(); } bool WindowSelectorController::ToggleOverview() {
diff --git a/ash/wm/tablet_mode/tablet_mode_event_handler.cc b/ash/wm/tablet_mode/tablet_mode_event_handler.cc index 9bd7759..4f45989 100644 --- a/ash/wm/tablet_mode/tablet_mode_event_handler.cc +++ b/ash/wm/tablet_mode/tablet_mode_event_handler.cc
@@ -53,8 +53,8 @@ return false; } - // Do not exit fullscreen in kiosk mode. - if (Shell::Get()->session_controller()->IsKioskSession()) + // Do not exit fullscreen in kiosk app mode. + if (Shell::Get()->session_controller()->IsRunningInAppMode()) return false; WMEvent toggle_fullscreen(WM_EVENT_TOGGLE_FULLSCREEN);
diff --git a/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java b/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java index 7e9d3afc..2ef4f59 100644 --- a/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java +++ b/base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java
@@ -28,7 +28,7 @@ // * link a native executable to prove the generated header + cc file are self-contained. // All comments are informational only, and are ignored by the jni generator. // -// Binding C/C++ with Java is not trivial, specially when ownership and object lifetime +// Binding C/C++ with Java is not trivial, especially when ownership and object lifetime // semantics needs to be managed across boundaries. // Following a few guidelines will make the code simpler and less buggy: // @@ -94,7 +94,7 @@ // object binds to. @JNINamespace("base::android") class SampleForTests { - // Classes can store their C++ pointer counter part as an int that is normally initialized by + // Classes can store their C++ pointer counterpart as an int that is normally initialized by // calling out a nativeInit() function. Replace "CPPClass" with your particular class name! long mNativeCPPObject;
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index a9611bf..c7fef4a2 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py
@@ -38,6 +38,22 @@ from pylib.symbols import deobfuscator +# Matches messages only on pre-L (Dalvik) that are spammy and unimportant. +_DALVIK_IGNORE_PATTERN = re.compile('|'.join([ + r'^Added shared lib', + r'^Could not find ', + r'^DexOpt:', + r'^GC_', + r'^Late-enabling CheckJNI', + r'^Link of class', + r'^No JNI_OnLoad found in', + r'^Trying to load lib', + r'^Unable to resolve superclass', + r'^VFY:', + r'^WAIT_', + ])) + + def _Colorize(text, style=''): return (style + text @@ -159,10 +175,11 @@ def _RunMemUsage(devices, package_name): def mem_usage_helper(d): ret = [] - proc_map = d.GetPids(package_name) - for name, pids in proc_map.iteritems(): - for pid in pids: - ret.append((name, pid, d.GetMemoryUsageForPid(pid))) + proc_map = _GetPackagePids(d, package_name) + for name in sorted(proc_map.iterkeys()): + for pid in proc_map[name]: + ret.append( + (name, '\n'.join(d.RunShellCommand(['dumpsys', 'meminfo', pid])))) return ret parallel_devices = device_utils.DeviceUtils.parallel(devices) @@ -171,11 +188,11 @@ if not result: print 'No processes found.' else: - for name, pid, usage in sorted(result): - print '%s(%s):' % (name, pid) - for k, v in sorted(usage.iteritems()): - print ' %s=%d' % (k, v) - print + for name, usage in sorted(result): + print _Colorize( + '==== Output of "dumpsys meminfo %s" ====' % name, + colorama.Fore.GREEN) + print usage def _DuHelper(device, path_spec, run_as=None): @@ -381,11 +398,12 @@ self._deobfuscator = deobfuscate self._primary_pid = None self._my_pids = set() - self._not_my_pids = set() + self._seen_pids = set() self._UpdateMyPids() def _UpdateMyPids(self): - for name, pids in self._device.GetPids(self._package_name).items(): + package_pids = _GetPackagePids(self._device, self._package_name) + for name, pids in package_pids.iteritems(): if ':' not in name: self._primary_pid = int(pids[0]) self._my_pids.update(int(p) for p in pids) @@ -413,7 +431,7 @@ style = colorama.Back.GREEN elif priority == 'D': style = colorama.Back.BLUE - return style + colorama.Style.BRIGHT + colorama.Fore.BLACK + return style + colorama.Fore.BLACK def _ParseLine(self, line): tokens = line.split(None, 6) @@ -440,8 +458,14 @@ date, invokation_time, pid, tid, priority, tag, original_message) def _PrintParsedLine(self, parsed_line, dim=False): + tid_style = '' + # Make the main thread bright. + if not dim and parsed_line.pid == parsed_line.tid: + tid_style = colorama.Style.BRIGHT pid_style = self._GetPidStyle(parsed_line.pid, dim) # We have to pad before adding color as that changes the width of the tag. + pid_str = _Colorize('{:5}'.format(parsed_line.pid), pid_style) + tid_str = _Colorize('{:5}'.format(parsed_line.tid), tid_style) tag = _Colorize('{:8}'.format(parsed_line.tag), pid_style + ('' if dim else colorama.Style.BRIGHT)) priority = _Colorize(parsed_line.priority, @@ -451,34 +475,31 @@ messages = self._deobfuscator.TransformLines(messages) for message in messages: message = _Colorize(message, pid_style) - sys.stdout.write('{} {} {:5} {:5} {} {}: {}\n'.format( - parsed_line.date, parsed_line.invokation_time, parsed_line.pid, - parsed_line.tid, priority, tag, message)) + sys.stdout.write('{} {} {} {} {} {}: {}\n'.format( + parsed_line.date, parsed_line.invokation_time, pid_str, tid_str, + priority, tag, message)) def ProcessLine(self, line, fast=False): - dim = False if not line or line.startswith('------'): return log = self._ParseLine(line) - if log.pid in self._my_pids or (not fast and - (log.priority == 'F' or # Java crash dump - log.tag == 'ActivityManager' or # Android system - log.tag == 'DEBUG')): # Native crash dump - pass # write - elif log.pid in self._not_my_pids: - dim = True - elif fast: - # Skip checking whether our package spawned new processes. - self._not_my_pids.add(log.pid) - dim = True - else: - # Check and add the pid if it is a new one from our package. - self._UpdateMyPids() - if log.pid not in self._my_pids: - self._not_my_pids.add(log.pid) - dim = True - if (self._verbose and not fast) or not dim: - self._PrintParsedLine(log, dim) + if log.pid not in self._seen_pids: + self._seen_pids.add(log.pid) + if not fast: + self._UpdateMyPids() + + owned_pid = log.pid in self._my_pids + if fast and not owned_pid: + return + if owned_pid and not self._verbose and log.tag == 'dalvikvm': + if _DALVIK_IGNORE_PATTERN.match(log.message): + return + + if owned_pid or self._verbose or ( + log.priority == 'F' or # Java crash dump + log.tag == 'ActivityManager' or # Android system + log.tag == 'DEBUG'): # Native crash dump + self._PrintParsedLine(log, not owned_pid) def _RunLogcat(device, package_name, mapping_path, verbose): @@ -512,9 +533,15 @@ deobfuscate.Close() +def _GetPackagePids(device, package_name): + return dict((k, v) for k, v in device.GetPids(package_name).iteritems() + if k == package_name or k.startswith(package_name + ':')) + + def _RunPs(devices, package_name): parallel_devices = device_utils.DeviceUtils.parallel(devices) - all_pids = parallel_devices.GetPids(package_name).pGet(None) + all_pids = parallel_devices.pMap( + lambda d: _GetPackagePids(d, package_name)).pGet(None) for proc_map in _PrintPerDeviceOutput(devices, all_pids): if not proc_map: print 'No processes found.'
diff --git a/build/config/ios/asset_catalog.gni b/build/config/ios/asset_catalog.gni index c267772..ac2b052a 100644 --- a/build/config/ios/asset_catalog.gni +++ b/build/config/ios/asset_catalog.gni
@@ -2,24 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -declare_args() { - # Controls whether the "imageset" template sets up the build to compile - # the asset catalogs (to generate an Assets.car file). If set to false, - # instead the assets will be copied verbatim to the generated bundle. - # As loading resources from the compiled asset catalog or unpacked is - # transparent to application code, this results in faster build but in - # a larger application. - # - # This requires that resources uses scale (like "@2x", "@3x") and idiom - # (like "~ipad", "~iphone") suffixes and use the same basename as the - # imageset directory in order for the correct resource to be loaded if - # ios_compile_asset_catalogs is set to false. - # - # Note: flipping this variable requires a clobber build (as there is no - # way to specify that unknown files are deleted as part of the build). - ios_compile_asset_catalogs = true -} - # This template declares a bundle_data target that references an asset # catalog so that it is compiled to the asset catalog of the generated # bundle. @@ -46,11 +28,6 @@ # This template also ensures that the file are only copied once when the # build targets multiple architectures at the same time (aka "fat build"). # -# If ios_compile_asset_catalogs is set to false, the resources will instead -# just be copied into the final bundles (they are still copied to a temporary -# location in gen/ to avoid accidentally compiling them if they are located -# in a .xcassets directory). -# # Arguments # # sources: @@ -77,46 +54,28 @@ } } else { _copy_target_name = target_name + "__copy" - _fake_target_name = target_name + "__fake" _data_target_name = target_name _sources = invoker.sources - _extension = invoker.asset_type - - foreach(_source, invoker.sources) { - _dir = get_path_info(_source, "dir") - - assert(get_path_info(_dir, "extension") == _extension, - "$_source dirname must have .$_extension extension") - - # If the compilation of asset catalogs is disabled, the Contents.json - # file must not be copied. - if (!ios_compile_asset_catalogs) { - if (get_path_info(_source, "file") == "Contents.json") { - _sources -= [ _source ] - } - } - } + _outputs = [] # The compilation of resources into Assets.car is enabled automatically # by the "create_bundle" target if any of the "bundle_data" sources's # path is in a .xcassets directory and matches one of the know asset # catalog type. - # - # Copy the file to a directory that either matches that pattern if the - # compilation of asset catalogs is enabled or not. The detection will - # be performed by gn and the correct ninja rules generated. This is the - # main difference between the two variants for this template. - if (ios_compile_asset_catalogs) { - _xcassets_dir = "$target_gen_dir/${target_name}.xcassets" - } else { - _xcassets_dir = "$target_gen_dir/${target_name}_xcassets" - } - + _xcassets_dir = "$target_gen_dir/${target_name}.xcassets" _output_dir = "$_xcassets_dir/" + get_path_info(get_path_info(_sources[0], "dir"), "file") - copy(_copy_target_name) { + foreach(_source, invoker.sources) { + _dir = get_path_info(_source, "dir") + _outputs += [ "$_output_dir/" + get_path_info(_source, "file") ] + + assert(get_path_info(_dir, "extension") == invoker.asset_type, + "$_source dirname must have .${invoker.asset_type} extension") + } + + action(_copy_target_name) { # Forward "deps", "public_deps" and "testonly" in case some of the # source files are generated. forward_variables_from(invoker, @@ -126,27 +85,16 @@ "testonly", ]) - visibility = [ ":$_fake_target_name" ] - sources = _sources - outputs = [ - "$_output_dir/{{source_file_part}}", - ] - } - - action(_fake_target_name) { - forward_variables_from(invoker, [ "testonly" ]) + script = "//build/config/ios/hardlink.py" visibility = [ ":$_data_target_name" ] - script = "//build/config/ios/dummy.py" sources = _sources - outputs = [ - "$_xcassets_dir", + outputs = _outputs + [ _xcassets_dir ] + + args = [ + rebase_path(get_path_info(_sources[0], "dir"), root_out_dir), + rebase_path(_output_dir, root_out_dir), ] - public_deps = [ - ":$_copy_target_name", - ] - args = rebase_path(sources, root_build_dir) + - rebase_path(outputs, root_build_dir) } bundle_data(_data_target_name) { @@ -164,7 +112,7 @@ "{{bundle_resources_dir}}/{{source_file_part}}", ] public_deps = [ - ":$_fake_target_name", + ":$_copy_target_name", ] } }
diff --git a/build/sanitizers/tsan_suppressions.cc b/build/sanitizers/tsan_suppressions.cc index b10fcc3..1324889f 100644 --- a/build/sanitizers/tsan_suppressions.cc +++ b/build/sanitizers/tsan_suppressions.cc
@@ -84,8 +84,7 @@ "race:*trace_event_unique_catstatic*\n" // http://crbug.com/244856 - "race:AutoPulseLock\n" - "race:pulse::InitPulse\n" + "race:libpulsecommon*.so\n" // http://crbug.com/246968 "race:webrtc::VideoCodingModuleImpl::RegisterPacketRequestCallback\n"
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index 5c1b29be..447d732 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -606,8 +606,6 @@ "paint/display_item_list_unittest.cc", "paint/paint_image_unittest.cc", "paint/paint_op_buffer_unittest.cc", - "paint/paint_shader_unittest.cc", - "paint/scoped_image_flags_unittest.cc", "paint/solid_color_analyzer_unittest.cc", "raster/playback_image_provider_unittest.cc", "raster/raster_buffer_provider_unittest.cc",
diff --git a/cc/paint/BUILD.gn b/cc/paint/BUILD.gn index 037891d4..387800c5 100644 --- a/cc/paint/BUILD.gn +++ b/cc/paint/BUILD.gn
@@ -45,8 +45,6 @@ "paint_shader.h", "record_paint_canvas.cc", "record_paint_canvas.h", - "scoped_image_flags.cc", - "scoped_image_flags.h", "skia_paint_canvas.cc", "skia_paint_canvas.h", "skia_paint_image_generator.cc",
diff --git a/cc/paint/discardable_image_map.cc b/cc/paint/discardable_image_map.cc index 05dbe8b..0d23dd3 100644 --- a/cc/paint/discardable_image_map.cc +++ b/cc/paint/discardable_image_map.cc
@@ -27,8 +27,6 @@ return dst; } -// This canvas is used only for tracking transform/clip/filter state from the -// non-drawing ops. class PaintTrackingCanvas final : public SkNoDrawCanvas { public: PaintTrackingCanvas(int width, int height) : SkNoDrawCanvas(width, height) {} @@ -77,14 +75,52 @@ class DiscardableImageGenerator { public: - DiscardableImageGenerator(int width, - int height, - const PaintOpBuffer* buffer) { - PaintTrackingCanvas canvas(width, height); - GatherDiscardableImages(buffer, nullptr, &canvas); - } + DiscardableImageGenerator(int width, int height) : canvas_(width, height) {} ~DiscardableImageGenerator() = default; + void GatherDiscardableImages(const PaintOpBuffer* buffer) { + if (!buffer->HasDiscardableImages()) + return; + + PlaybackParams params(nullptr, canvas_.getTotalMatrix()); + canvas_.save(); + // TODO(khushalsagar): Optimize out save/restore blocks if there are no + // images in the draw ops between them. + for (auto* op : PaintOpBuffer::Iterator(buffer)) { + if (op->IsDrawOp()) { + SkRect op_rect; + if (op->IsPaintOpWithFlags() && PaintOp::GetBounds(op, &op_rect)) { + AddImageFromFlags(op_rect, + static_cast<const PaintOpWithFlags*>(op)->flags); + } + + PaintOpType op_type = static_cast<PaintOpType>(op->type); + if (op_type == PaintOpType::DrawImage) { + auto* image_op = static_cast<DrawImageOp*>(op); + auto* sk_image = image_op->image.GetSkImage().get(); + AddImage(image_op->image, + SkRect::MakeIWH(sk_image->width(), sk_image->height()), + SkRect::MakeXYWH(image_op->left, image_op->top, + sk_image->width(), sk_image->height()), + nullptr, image_op->flags); + } else if (op_type == PaintOpType::DrawImageRect) { + auto* image_rect_op = static_cast<DrawImageRectOp*>(op); + SkMatrix matrix; + matrix.setRectToRect(image_rect_op->src, image_rect_op->dst, + SkMatrix::kFill_ScaleToFit); + AddImage(image_rect_op->image, image_rect_op->src, image_rect_op->dst, + &matrix, image_rect_op->flags); + } else if (op_type == PaintOpType::DrawRecord) { + GatherDiscardableImages( + static_cast<const DrawRecordOp*>(op)->record.get()); + } + } else { + op->Raster(&canvas_, params); + } + } + canvas_.restore(); + } + std::vector<std::pair<DrawImage, gfx::Rect>> TakeImages() { return std::move(image_set_); } @@ -117,112 +153,48 @@ } private: - // Adds discardable images from |buffer| to the set of images tracked by - // this generator. If |buffer| is being used in a DrawOp that requires - // rasterization of the buffer as a pre-processing step for execution of the - // op (for instance, with PaintRecord backed PaintShaders), - // |top_level_op_rect| is set to the rect for that op. If provided, the - // |top_level_op_rect| will be used as the rect for tracking the position of - // this image in the top-level buffer. - void GatherDiscardableImages(const PaintOpBuffer* buffer, - const gfx::Rect* top_level_op_rect, - PaintTrackingCanvas* canvas) { - if (!buffer->HasDiscardableImages()) + void AddImageFromFlags(const SkRect& rect, const PaintFlags& flags) { + if (!flags.HasShader() || + flags.getShader()->shader_type() != PaintShader::Type::kImage) return; - // Prevent PaintOpBuffers from having side effects back into the canvas. - SkAutoCanvasRestore save_restore(canvas, true); - - PlaybackParams params(nullptr, canvas->getTotalMatrix()); - // TODO(khushalsagar): Optimize out save/restore blocks if there are no - // images in the draw ops between them. - for (auto* op : PaintOpBuffer::Iterator(buffer)) { - if (!op->IsDrawOp()) { - op->Raster(canvas, params); - continue; - } else if (!PaintOp::OpHasDiscardableImages(op)) { - continue; - } - - gfx::Rect op_rect; - base::Optional<gfx::Rect> local_op_rect; - - if (top_level_op_rect) { - op_rect = *top_level_op_rect; - } else { - local_op_rect = ComputePaintRect(op, canvas); - if (local_op_rect.value().IsEmpty()) - continue; - - op_rect = local_op_rect.value(); - } - - const SkMatrix& ctm = canvas->getTotalMatrix(); - if (op->IsPaintOpWithFlags()) { - AddImageFromFlags(op_rect, - static_cast<const PaintOpWithFlags*>(op)->flags, ctm); - } - - PaintOpType op_type = static_cast<PaintOpType>(op->type); - if (op_type == PaintOpType::DrawImage) { - auto* image_op = static_cast<DrawImageOp*>(op); - auto* sk_image = image_op->image.GetSkImage().get(); - AddImage(image_op->image, - SkRect::MakeIWH(sk_image->width(), sk_image->height()), - op_rect, ctm, image_op->flags.getFilterQuality()); - } else if (op_type == PaintOpType::DrawImageRect) { - auto* image_rect_op = static_cast<DrawImageRectOp*>(op); - SkMatrix matrix = ctm; - matrix.postConcat(SkMatrix::MakeRectToRect(image_rect_op->src, - image_rect_op->dst, - SkMatrix::kFill_ScaleToFit)); - AddImage(image_rect_op->image, image_rect_op->src, op_rect, matrix, - image_rect_op->flags.getFilterQuality()); - } else if (op_type == PaintOpType::DrawRecord) { - GatherDiscardableImages( - static_cast<const DrawRecordOp*>(op)->record.get(), - top_level_op_rect, canvas); - } - } + const PaintImage& paint_image = flags.getShader()->paint_image(); + SkMatrix local_matrix = flags.getShader()->GetLocalMatrix(); + AddImage(paint_image, + SkRect::MakeWH(paint_image.width(), paint_image.height()), rect, + &local_matrix, flags); } - // Given the |op_rect|, which is the rect for the draw op, returns the - // transformed rect accounting for the current transform, clip and paint - // state on |canvas_|. - gfx::Rect ComputePaintRect(const PaintOp* op, PaintTrackingCanvas* canvas) { - const SkRect& clip_rect = SkRect::Make(canvas->getDeviceClipBounds()); - const SkMatrix& ctm = canvas->getTotalMatrix(); + void AddImage(PaintImage paint_image, + const SkRect& src_rect, + const SkRect& rect, + const SkMatrix* local_matrix, + const PaintFlags& flags) { + if (!paint_image.IsLazyGenerated()) + return; - gfx::Rect transformed_rect; - SkRect op_rect; - if (!PaintOp::GetBounds(op, &op_rect)) { - // If we can't provide a conservative bounding rect for the op, assume it - // covers the complete current clip. - transformed_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(clip_rect)); - } else { - const PaintFlags* flags = - op->IsPaintOpWithFlags() - ? &static_cast<const PaintOpWithFlags*>(op)->flags - : nullptr; - SkPaint paint; - if (flags) - paint = flags->ToSkPaint(); + const SkRect& clip_rect = SkRect::Make(canvas_.getDeviceClipBounds()); + const SkMatrix& ctm = canvas_.getTotalMatrix(); - SkRect paint_rect = MapRect(ctm, op_rect); - bool computed_paint_bounds = - canvas->ComputePaintBounds(paint_rect, &paint, &paint_rect); - if (!computed_paint_bounds) { - // TODO(vmpstr): UMA this case. - paint_rect = clip_rect; - } - - // Clamp the image rect by the current clip rect. - if (!paint_rect.intersect(clip_rect)) - return gfx::Rect(); - - transformed_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(paint_rect)); + SkRect paint_rect = MapRect(ctm, rect); + SkPaint paint = flags.ToSkPaint(); + bool computed_paint_bounds = + canvas_.ComputePaintBounds(paint_rect, &paint, &paint_rect); + if (!computed_paint_bounds) { + // TODO(vmpstr): UMA this case. + paint_rect = clip_rect; } + // Clamp the image rect by the current clip rect. + if (!paint_rect.intersect(clip_rect)) + return; + + SkFilterQuality filter_quality = flags.getFilterQuality(); + + SkIRect src_irect; + src_rect.roundOut(&src_irect); + gfx::Rect image_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(paint_rect)); + // During raster, we use the device clip bounds on the canvas, which outsets // the actual clip by 1 due to the possibility of antialiasing. Account for // this here by outsetting the image rect by 1. Note that this only affects @@ -233,52 +205,7 @@ // raster time, since we might be sending a larger-than-one-item display // item to skia, which means that skia will internally determine whether to // raster the picture (using device clip bounds that are outset). - transformed_rect.Inset(-1, -1); - return transformed_rect; - } - - void AddImageFromFlags(const gfx::Rect& op_rect, - const PaintFlags& flags, - const SkMatrix& ctm) { - if (!flags.getShader()) - return; - - if (flags.getShader()->shader_type() == PaintShader::Type::kImage) { - const PaintImage& paint_image = flags.getShader()->paint_image(); - SkMatrix matrix = ctm; - matrix.postConcat(flags.getShader()->GetLocalMatrix()); - AddImage(paint_image, - SkRect::MakeWH(paint_image.width(), paint_image.height()), - op_rect, matrix, flags.getFilterQuality()); - } else if (flags.getShader()->shader_type() == - PaintShader::Type::kPaintRecord && - flags.getShader()->paint_record()->HasDiscardableImages()) { - SkRect scaled_tile_rect; - if (!flags.getShader()->GetRasterizationTileRect(ctm, - &scaled_tile_rect)) { - return; - } - - PaintTrackingCanvas canvas(scaled_tile_rect.width(), - scaled_tile_rect.height()); - canvas.setMatrix(SkMatrix::MakeRectToRect(flags.getShader()->tile(), - scaled_tile_rect, - SkMatrix::kFill_ScaleToFit)); - GatherDiscardableImages(flags.getShader()->paint_record().get(), &op_rect, - &canvas); - } - } - - void AddImage(PaintImage paint_image, - const SkRect& src_rect, - const gfx::Rect& image_rect, - const SkMatrix& matrix, - SkFilterQuality filter_quality) { - if (!paint_image.IsLazyGenerated()) - return; - - SkIRect src_irect; - src_rect.roundOut(&src_irect); + image_rect.Inset(-1, -1); // Make a note if any image was originally specified in a non-sRGB color // space. @@ -290,6 +217,10 @@ color_stats_srgb_image_count_++; } + SkMatrix matrix = ctm; + if (local_matrix) + matrix.postConcat(*local_matrix); + image_id_to_rect_[paint_image.stable_id()].Union(image_rect); if (paint_image.ShouldAnimate()) { @@ -304,6 +235,9 @@ image_rect); } + // This canvas is used only for tracking transform/clip/filter state from the + // non-drawing ops. + PaintTrackingCanvas canvas_; std::vector<std::pair<DrawImage, gfx::Rect>> image_set_; base::flat_map<PaintImage::Id, gfx::Rect> image_id_to_rect_; std::vector<DiscardableImageMap::AnimatedImageMetadata> @@ -329,8 +263,8 @@ if (!paint_op_buffer->HasDiscardableImages()) return; - DiscardableImageGenerator generator(bounds.right(), bounds.bottom(), - paint_op_buffer); + DiscardableImageGenerator generator(bounds.right(), bounds.bottom()); + generator.GatherDiscardableImages(paint_op_buffer); generator.RecordColorHistograms(); image_id_to_rect_ = generator.TakeImageIdToRectMap(); animated_images_metadata_ = generator.TakeAnimatedImagesMetadata();
diff --git a/cc/paint/discardable_image_map_unittest.cc b/cc/paint/discardable_image_map_unittest.cc index 4530746..0e8a6d20e 100644 --- a/cc/paint/discardable_image_map_unittest.cc +++ b/cc/paint/discardable_image_map_unittest.cc
@@ -747,43 +747,6 @@ EXPECT_DCHECK_DEATH(images[2]->frame_index()); } -TEST_F(DiscardableImageMapTest, CapturesImagesInPaintRecordShaders) { - // Create the record to use in the shader. - auto shader_record = sk_make_sp<PaintOpBuffer>(); - shader_record->push<ScaleOp>(2.0f, 2.0f); - PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(100, 100)); - shader_record->push<DrawImageOp>(paint_image, 0.f, 0.f, nullptr); - - gfx::Rect visible_rect(500, 500); - scoped_refptr<DisplayItemList> display_list = new DisplayItemList(); - display_list->StartPaint(); - display_list->push<ScaleOp>(2.0f, 2.0f); - PaintFlags flags; - SkRect tile = SkRect::MakeWH(100, 100); - flags.setShader(PaintShader::MakePaintRecord( - shader_record, tile, SkShader::TileMode::kClamp_TileMode, - SkShader::TileMode::kClamp_TileMode, nullptr)); - display_list->push<DrawRectOp>(SkRect::MakeWH(200, 200), flags); - display_list->EndPaintOfUnpaired(visible_rect); - display_list->Finalize(); - - display_list->GenerateDiscardableImagesMetadata(); - const auto& image_map = display_list->discardable_image_map(); - - // The image rect is set to the rect for the DrawRectOp. - std::vector<PositionScaleDrawImage> draw_images = - GetDiscardableImagesInRect(image_map, visible_rect); - std::vector<gfx::Rect> inset_rects = InsetImageRects(draw_images); - ASSERT_EQ(draw_images.size(), 1u); - EXPECT_EQ(draw_images[0].image, paint_image); - // The position of the image is the position of the DrawRectOp that uses the - // shader. - EXPECT_EQ(gfx::Rect(400, 400), inset_rects[0]); - // The scale of the image includes the scale at which the shader record is - // rasterized. - EXPECT_EQ(SkSize::Make(4.f, 4.f), draw_images[0].scale); -} - class DiscardableImageMapColorSpaceTest : public DiscardableImageMapTest, public testing::WithParamInterface<gfx::ColorSpace> {};
diff --git a/cc/paint/paint_op_buffer.cc b/cc/paint/paint_op_buffer.cc index ab441cd..4631780 100644 --- a/cc/paint/paint_op_buffer.cc +++ b/cc/paint/paint_op_buffer.cc
@@ -13,7 +13,6 @@ #include "cc/paint/paint_op_reader.h" #include "cc/paint/paint_op_writer.h" #include "cc/paint/paint_record.h" -#include "cc/paint/scoped_image_flags.h" #include "third_party/skia/include/core/SkAnnotation.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkRegion.h" @@ -26,6 +25,22 @@ return result; } +bool IsImageShader(const PaintFlags& flags) { + return flags.HasShader() && + flags.getShader()->shader_type() == PaintShader::Type::kImage; +} + +bool IsImageOp(const PaintOp* op) { + if (op->GetType() == PaintOpType::DrawImage) + return true; + else if (op->GetType() == PaintOpType::DrawImageRect) + return true; + else if (op->IsDrawOp() && op->IsPaintOpWithFlags()) + return IsImageShader(static_cast<const PaintOpWithFlags*>(op)->flags); + + return false; +} + bool QuickRejectDraw(const PaintOp* op, const SkCanvas* canvas) { DCHECK(op->IsDrawOp()); @@ -43,6 +58,65 @@ return canvas->quickReject(rect); } +// Encapsulates a ImageProvider::DecodedImageHolder and a SkPaint. Use of +// this class ensures that the DecodedImageHolder outlives the dependent +// SkPaint. +class ScopedImageFlags { + public: + ScopedImageFlags(ImageProvider* image_provider, + const PaintFlags& flags, + const SkMatrix& ctm) { + DCHECK(IsImageShader(flags)); + + const PaintImage& paint_image = flags.getShader()->paint_image(); + SkMatrix matrix = flags.getShader()->GetLocalMatrix(); + + SkMatrix total_image_matrix = matrix; + total_image_matrix.preConcat(ctm); + SkRect src_rect = + SkRect::MakeIWH(paint_image.width(), paint_image.height()); + DrawImage draw_image(paint_image, RoundOutRect(src_rect), + flags.getFilterQuality(), total_image_matrix); + scoped_decoded_draw_image_ = + image_provider->GetDecodedDrawImage(draw_image); + + if (!scoped_decoded_draw_image_) + return; + const auto& decoded_image = scoped_decoded_draw_image_.decoded_image(); + DCHECK(decoded_image.image()); + + bool need_scale = !decoded_image.is_scale_adjustment_identity(); + if (need_scale) { + matrix.preScale(1.f / decoded_image.scale_adjustment().width(), + 1.f / decoded_image.scale_adjustment().height()); + } + + sk_sp<SkImage> sk_image = + sk_ref_sp<SkImage>(const_cast<SkImage*>(decoded_image.image().get())); + PaintImage decoded_paint_image = PaintImageBuilder() + .set_id(paint_image.stable_id()) + .set_image(std::move(sk_image)) + .TakePaintImage(); + decoded_flags_.emplace(flags); + decoded_flags_.value().setFilterQuality(decoded_image.filter_quality()); + decoded_flags_.value().setShader( + PaintShader::MakeImage(decoded_paint_image, flags.getShader()->tx(), + flags.getShader()->ty(), &matrix)); + } + + PaintFlags* decoded_flags() { + return decoded_flags_ ? &decoded_flags_.value() : nullptr; + } + + ~ScopedImageFlags() = default; + + private: + base::Optional<PaintFlags> decoded_flags_; + ImageProvider::ScopedDecodedDrawImage scoped_decoded_draw_image_; + + DISALLOW_COPY_AND_ASSIGN(ScopedImageFlags); +}; + void RasterWithAlpha(const PaintOp* op, SkCanvas* canvas, const PlaybackParams& params, @@ -59,7 +133,7 @@ // ImageProvider if it consists of an image shader. base::Optional<ScopedImageFlags> scoped_flags; const PaintFlags* decoded_flags = &flags_op->flags; - if (params.image_provider && flags_op->HasDiscardableImagesFromFlags()) { + if (params.image_provider && IsImageShader(flags_op->flags)) { scoped_flags.emplace(params.image_provider, flags_op->flags, canvas->getTotalMatrix()); decoded_flags = scoped_flags.value().decoded_flags(); @@ -1383,47 +1457,12 @@ return false; } -// static -bool PaintOp::OpHasDiscardableImages(const PaintOp* op) { - if (op->IsPaintOpWithFlags() && static_cast<const PaintOpWithFlags*>(op) - ->HasDiscardableImagesFromFlags()) { - return true; - } - - if (op->GetType() == PaintOpType::DrawImage && - static_cast<const DrawImageOp*>(op)->HasDiscardableImages()) { - return true; - } else if (op->GetType() == PaintOpType::DrawImageRect && - static_cast<const DrawImageRectOp*>(op)->HasDiscardableImages()) { - return true; - } else if (op->GetType() == PaintOpType::DrawRecord && - static_cast<const DrawRecordOp*>(op)->HasDiscardableImages()) { - return true; - } - - return false; -} - void PaintOp::DestroyThis() { auto func = g_destructor_functions[type]; if (func) func(this); } -bool PaintOpWithFlags::HasDiscardableImagesFromFlags() const { - if (!IsDrawOp()) - return false; - - if (!flags.HasShader()) - return false; - else if (flags.getShader()->shader_type() == PaintShader::Type::kImage) - return flags.getShader()->paint_image().IsLazyGenerated(); - else if (flags.getShader()->shader_type() == PaintShader::Type::kPaintRecord) - return flags.getShader()->paint_record()->HasDiscardableImages(); - - return false; -} - void PaintOpWithFlags::RasterWithFlags(SkCanvas* canvas, const PaintFlags* flags, const PlaybackParams& params) const { @@ -1701,8 +1740,7 @@ // general case we defer this to the SkCanvas but if we will be // using an ImageProvider for pre-decoding images, we can save // performing an expensive decode that will never be rasterized. - const bool skip_op = params.image_provider && - PaintOp::OpHasDiscardableImages(draw_op) && + const bool skip_op = params.image_provider && IsImageOp(draw_op) && QuickRejectDraw(draw_op, canvas); if (skip_op) { // Now that we know this op will be skipped, we can push the save @@ -1732,15 +1770,15 @@ } } - if (params.image_provider && PaintOp::OpHasDiscardableImages(op)) { + if (params.image_provider && IsImageOp(op)) { if (QuickRejectDraw(op, canvas)) continue; auto* flags_op = op->IsPaintOpWithFlags() ? static_cast<const PaintOpWithFlags*>(op) : nullptr; - if (flags_op && flags_op->HasDiscardableImagesFromFlags()) { - ScopedImageFlags scoped_flags(params.image_provider, flags_op->flags, + if (flags_op && IsImageShader(flags_op->flags)) { + ScopedImageFlags scoped_flags(image_provider, flags_op->flags, canvas->getTotalMatrix()); // Only rasterize the op if we successfully decoded the image.
diff --git a/cc/paint/paint_op_buffer.h b/cc/paint/paint_op_buffer.h index 96eb7f7..17405ec 100644 --- a/cc/paint/paint_op_buffer.h +++ b/cc/paint/paint_op_buffer.h
@@ -15,7 +15,6 @@ #include "base/memory/aligned_memory.h" #include "base/optional.h" #include "cc/base/math_util.h" -#include "cc/paint/image_provider.h" #include "cc/paint/paint_canvas.h" #include "cc/paint/paint_export.h" #include "cc/paint/paint_flags.h" @@ -30,6 +29,7 @@ namespace cc { class ImageDecodeCache; +class ImageProvider; class CC_PAINT_EXPORT ThreadsafeMatrix : public SkMatrix { public: @@ -137,10 +137,6 @@ // for the op. static bool GetBounds(const PaintOp* op, SkRect* rect); - // Returns true if executing this op will require decoding of any lazy - // generated images. - static bool OpHasDiscardableImages(const PaintOp* op); - int CountSlowPaths() const { return 0; } int CountSlowPathsFromFlags() const { return 0; } @@ -199,7 +195,14 @@ int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } bool HasNonAAPaint() const { return !flags.isAntiAlias(); } - bool HasDiscardableImagesFromFlags() const; + bool HasDiscardableImagesFromFlags() const { + if (!IsDrawOp()) + return false; + + SkShader* shader = flags.getSkShader(); + SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; + return image && image->isLazyGenerated(); + } void RasterWithFlags(SkCanvas* canvas, const PaintFlags* flags, @@ -978,7 +981,6 @@ friend class DisplayItemList; friend class PaintOpBufferOffsetsTest; friend class SolidColorAnalyzer; - friend class ScopedImageFlags; // Replays the paint op buffer into the canvas. If |indices| is specified, it // contains indices in an increasing order and only the indices specified in
diff --git a/cc/paint/paint_shader.cc b/cc/paint/paint_shader.cc index 6f0767086..7d0b8cf 100644 --- a/cc/paint/paint_shader.cc +++ b/cc/paint/paint_shader.cc
@@ -6,25 +6,9 @@ #include "base/memory/ptr_util.h" #include "cc/paint/paint_record.h" -#include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/effects/SkGradientShader.h" namespace cc { -namespace { - -sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record, - const SkRect& bounds, - const SkMatrix* matrix, - ImageProvider* image_provider) { - SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(bounds); - if (matrix) - canvas->setMatrix(*matrix); - record->Playback(canvas, image_provider); - return recorder.finishRecordingAsPicture(); -} - -} // namespace sk_sp<PaintShader> PaintShader::MakeColor(SkColor color) { sk_sp<PaintShader> shader(new PaintShader(Type::kColor)); @@ -155,96 +139,6 @@ PaintShader::PaintShader(Type type) : shader_type_(type) {} PaintShader::~PaintShader() = default; -bool PaintShader::GetRasterizationTileRect(const SkMatrix& ctm, - SkRect* tile_rect) const { - DCHECK_EQ(shader_type_, Type::kPaintRecord); - - // If we are using a fixed scale, the record is rasterized with the original - // tile size and scaling is applied to the generated output. - if (scaling_behavior_ == ScalingBehavior::kFixedScale) { - *tile_rect = tile_; - return true; - } - - SkMatrix matrix = ctm; - if (local_matrix_.has_value()) - matrix.preConcat(local_matrix_.value()); - - SkSize scale; - if (!matrix.decomposeScale(&scale)) { - // Decomposition failed, use an approximation. - scale.set(SkScalarSqrt(matrix.getScaleX() * matrix.getScaleX() + - matrix.getSkewX() * matrix.getSkewX()), - SkScalarSqrt(matrix.getScaleY() * matrix.getScaleY() + - matrix.getSkewY() * matrix.getSkewY())); - } - SkSize scaled_size = - SkSize::Make(SkScalarAbs(scale.width() * tile_.width()), - SkScalarAbs(scale.height() * tile_.height())); - - // Clamp the tile size to about 4M pixels. - // TODO(khushalsagar): We need to consider the max texture size as well. - static const SkScalar kMaxTileArea = 2048 * 2048; - SkScalar tile_area = scaled_size.width() * scaled_size.height(); - if (tile_area > kMaxTileArea) { - SkScalar clamp_scale = SkScalarSqrt(kMaxTileArea / tile_area); - scaled_size.set(scaled_size.width() * clamp_scale, - scaled_size.height() * clamp_scale); - } - - scaled_size = scaled_size.toCeil(); - if (scaled_size.isEmpty()) - return false; - - *tile_rect = SkRect::MakeWH(scaled_size.width(), scaled_size.height()); - return true; -} - -sk_sp<PaintShader> PaintShader::CreateDecodedPaintRecord( - const SkMatrix& ctm, - ImageProvider* image_provider) const { - DCHECK_EQ(shader_type_, Type::kPaintRecord); - - // For creating a decoded PaintRecord shader, we need to do the following: - // 1) Figure out the scale at which the record should be rasterization given - // the ctm and local_matrix on the shader. - // 2) Transform this record to an SkPicture with this scale and replace - // encoded images in this record with decodes from the ImageProvider. This - // is done by setting the rasterization_matrix_ for this shader to be used - // in GetSkShader. - // 3) Since the SkShader will use a scaled SkPicture, we use a kFixedScale for - // the decoded shader which creates an SkPicture backed SkImage for - // creating the decoded SkShader. - // Note that the scaling logic here is replicated from - // SkPictureShader::refBitmapShader. - SkRect tile_rect; - if (!GetRasterizationTileRect(ctm, &tile_rect)) - return nullptr; - - sk_sp<PaintShader> shader(new PaintShader(Type::kPaintRecord)); - shader->record_ = record_; - shader->tile_ = tile_rect; - // Use a fixed scale since we have already scaled the tile rect and fixed the - // raster scale. - shader->scaling_behavior_ = ScalingBehavior::kFixedScale; - shader->rasterization_matrix_.emplace(); - shader->rasterization_matrix_.value().setRectToRect( - tile_, tile_rect, SkMatrix::kFill_ScaleToFit); - shader->tx_ = tx_; - shader->ty_ = ty_; - - const SkSize tile_scale = - SkSize::Make(SkIntToScalar(tile_rect.width()) / tile_.width(), - SkIntToScalar(tile_rect.height()) / tile_.height()); - shader->local_matrix_ = GetLocalMatrix(); - shader->local_matrix_->preScale(1 / tile_scale.width(), - 1 / tile_scale.height()); - - shader->image_provider_ = image_provider; - - return shader; -} - sk_sp<SkShader> PaintShader::GetSkShader() const { if (cached_shader_) return cached_shader_; @@ -288,12 +182,7 @@ tx_, ty_, local_matrix_ ? &*local_matrix_ : nullptr); break; case Type::kPaintRecord: { - // Create a recording at the desired scale if this record has images which - // have been decoded before raster. - auto picture = ToSkPicture( - record_, tile_, - rasterization_matrix_ ? &rasterization_matrix_.value() : nullptr, - image_provider_); + auto picture = ToSkPicture(record_, tile_); switch (scaling_behavior_) { // For raster scale, we create a picture shader directly. @@ -302,7 +191,7 @@ std::move(picture), tx_, ty_, local_matrix_ ? &*local_matrix_ : nullptr, nullptr); break; - // For fixed scale, we create an image shader with an image backed by + // For fixed scale, we create an image shader with and image backed by // the picture. case ScalingBehavior::kFixedScale: { auto image = SkImage::MakeFromPicture(
diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h index 42ec44be..8a133709 100644 --- a/cc/paint/paint_shader.h +++ b/cc/paint/paint_shader.h
@@ -16,7 +16,7 @@ #include "third_party/skia/include/core/SkShader.h" namespace cc { -class ImageProvider; + class PaintOpBuffer; using PaintRecord = PaintOpBuffer; @@ -111,12 +111,8 @@ return image_; } - const sk_sp<PaintRecord>& paint_record() const { return record_; } - bool GetRasterizationTileRect(const SkMatrix& ctm, SkRect* tile_rect) const; - SkShader::TileMode tx() const { return tx_; } SkShader::TileMode ty() const { return ty_; } - SkRect tile() const { return tile_; } bool IsOpaque() const; @@ -131,17 +127,11 @@ friend class PaintOpReader; friend class PaintOpSerializationTestUtils; friend class PaintOpWriter; - friend class ScopedImageFlags; - FRIEND_TEST_ALL_PREFIXES(PaintShaderTest, DecodePaintRecord); explicit PaintShader(Type type); sk_sp<SkShader> GetSkShader() const; - sk_sp<PaintShader> CreateDecodedPaintRecord( - const SkMatrix& ctm, - ImageProvider* image_provider) const; - void SetColorsAndPositions(const SkColor* colors, const SkScalar* positions, int count); @@ -176,12 +166,6 @@ std::vector<SkColor> colors_; std::vector<SkScalar> positions_; - // The following are only used during raster to replace the decoded images in - // the record for this shader. The |image_provider_| and - // |decoded_image_stash_| must outlive this shader. - ImageProvider* image_provider_ = nullptr; - base::Optional<SkMatrix> rasterization_matrix_; - mutable sk_sp<SkShader> cached_shader_; DISALLOW_COPY_AND_ASSIGN(PaintShader);
diff --git a/cc/paint/paint_shader_unittest.cc b/cc/paint/paint_shader_unittest.cc deleted file mode 100644 index bda3fb6..0000000 --- a/cc/paint/paint_shader_unittest.cc +++ /dev/null
@@ -1,119 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/paint/paint_shader.h" - -#include "cc/paint/draw_image.h" -#include "cc/paint/image_provider.h" -#include "cc/paint/paint_image_builder.h" -#include "cc/paint/paint_op_buffer.h" -#include "cc/test/fake_paint_image_generator.h" -#include "cc/test/skia_common.h" -#include "cc/test/test_skcanvas.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkSurface.h" - -namespace cc { -namespace { - -class MockImageGenerator : public FakePaintImageGenerator { - public: - explicit MockImageGenerator(const gfx::Size& size) - : FakePaintImageGenerator( - SkImageInfo::MakeN32Premul(size.width(), size.height())) {} - - MOCK_METHOD5(GetPixels, - bool(const SkImageInfo&, void*, size_t, size_t, uint32_t)); -}; - -class MockImageProvider : public ImageProvider { - public: - MockImageProvider() = default; - ~MockImageProvider() override = default; - - ScopedDecodedDrawImage GetDecodedDrawImage( - const DrawImage& draw_image) override { - draw_image_ = draw_image; - - SkBitmap bitmap; - bitmap.allocN32Pixels(10, 10); - sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); - return ScopedDecodedDrawImage( - DecodedDrawImage(image, SkSize::MakeEmpty(), SkSize::Make(1.0f, 1.0f), - draw_image.filter_quality())); - } - - const DrawImage& draw_image() const { return draw_image_; } - - private: - DrawImage draw_image_; -}; - -} // namespace - -TEST(PaintShaderTest, RasterizationRectForRecordShaders) { - SkMatrix local_matrix = SkMatrix::MakeScale(0.5f, 0.5f); - auto record_shader = PaintShader::MakePaintRecord( - sk_make_sp<PaintOpBuffer>(), SkRect::MakeWH(100, 100), - SkShader::TileMode::kClamp_TileMode, SkShader::TileMode::kClamp_TileMode, - &local_matrix); - - SkRect tile_rect; - SkMatrix ctm = SkMatrix::MakeScale(0.5f, 0.5f); - EXPECT_TRUE(record_shader->GetRasterizationTileRect(ctm, &tile_rect)); - EXPECT_EQ(tile_rect, SkRect::MakeWH(25, 25)); -} - -TEST(PaintShaderTest, DecodePaintRecord) { - auto record = sk_make_sp<PaintOpBuffer>(); - - // Use a strict mock for the generator. It should never be used when - // rasterizing this shader, since the decode should be done by the - // ImageProvider. - auto generator = - sk_make_sp<testing::StrictMock<MockImageGenerator>>(gfx::Size(100, 100)); - PaintImage paint_image = PaintImageBuilder() - .set_id(PaintImage::GetNextId()) - .set_paint_image_generator(generator) - .TakePaintImage(); - - record->push<DrawImageOp>(paint_image, 0.f, 0.f, nullptr); - SkMatrix local_matrix = SkMatrix::MakeScale(0.5f, 0.5f); - auto record_shader = PaintShader::MakePaintRecord( - record, SkRect::MakeWH(100, 100), SkShader::TileMode::kClamp_TileMode, - SkShader::TileMode::kClamp_TileMode, &local_matrix); - - PaintOpBuffer buffer; - PaintFlags flags; - flags.setShader(record_shader); - buffer.push<ScaleOp>(0.5f, 0.5f); - buffer.push<DrawRectOp>(SkRect::MakeWH(100, 100), flags); - - MockImageProvider image_provider; - SaveCountingCanvas canvas; - buffer.Playback(&canvas, &image_provider); - - EXPECT_EQ(canvas.draw_rect_, SkRect::MakeWH(100, 100)); - SkShader* shader = canvas.paint_.getShader(); - ASSERT_TRUE(shader); - SkMatrix decoded_local_matrix; - SkShader::TileMode xy[2]; - SkImage* skia_image = shader->isAImage(&decoded_local_matrix, xy); - ASSERT_TRUE(skia_image); - EXPECT_TRUE(skia_image->isLazyGenerated()); - EXPECT_EQ(xy[0], record_shader->tx()); - EXPECT_EQ(xy[1], record_shader->ty()); - EXPECT_EQ(decoded_local_matrix, SkMatrix::MakeScale(2.f, 2.f)); - - // The rasterization of the shader is internal to skia, so use a raster canvas - // to verify that the decoded paint does not have the encoded image. - auto surface = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100)); - surface->getCanvas()->drawPaint(canvas.paint_); - - // Using the shader requests decode for images at the correct scale. - EXPECT_EQ(image_provider.draw_image().paint_image(), paint_image); - EXPECT_EQ(image_provider.draw_image().scale(), SkSize::Make(0.25f, 0.25f)); -} - -} // namespace cc
diff --git a/cc/paint/scoped_image_flags.cc b/cc/paint/scoped_image_flags.cc deleted file mode 100644 index cadb1da..0000000 --- a/cc/paint/scoped_image_flags.cc +++ /dev/null
@@ -1,103 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/paint/scoped_image_flags.h" - -#include "cc/paint/image_provider.h" -#include "cc/paint/paint_image_builder.h" - -namespace cc { -namespace { -SkIRect RoundOutRect(const SkRect& rect) { - SkIRect result; - rect.roundOut(&result); - return result; -} -} // namespace - -ScopedImageFlags::DecodeStashingImageProvider::DecodeStashingImageProvider( - ImageProvider* source_provider) - : source_provider_(source_provider) {} -ScopedImageFlags::DecodeStashingImageProvider::~DecodeStashingImageProvider() = - default; - -ImageProvider::ScopedDecodedDrawImage -ScopedImageFlags::DecodeStashingImageProvider::GetDecodedDrawImage( - const DrawImage& draw_image) { - auto decode = source_provider_->GetDecodedDrawImage(draw_image); - if (!decode) - return ScopedDecodedDrawImage(); - - // No need to add any destruction callback to the returned image. The images - // decoded here match the lifetime of this provider. - auto image_to_return = ScopedDecodedDrawImage(decode.decoded_image()); - decoded_images_.push_back(std::move(decode)); - return image_to_return; -} - -ScopedImageFlags::ScopedImageFlags(ImageProvider* image_provider, - const PaintFlags& flags, - const SkMatrix& ctm) - : decode_stashing_image_provider_(image_provider) { - if (flags.getShader()->shader_type() == PaintShader::Type::kImage) { - DecodeImageShader(flags, ctm); - } else { - DCHECK_EQ(flags.getShader()->shader_type(), - PaintShader::Type::kPaintRecord); - DecodeRecordShader(flags, ctm); - } -} - -ScopedImageFlags::~ScopedImageFlags() = default; - -void ScopedImageFlags::DecodeImageShader(const PaintFlags& flags, - const SkMatrix& ctm) { - const PaintImage& paint_image = flags.getShader()->paint_image(); - SkMatrix matrix = flags.getShader()->GetLocalMatrix(); - - SkMatrix total_image_matrix = matrix; - total_image_matrix.preConcat(ctm); - SkRect src_rect = SkRect::MakeIWH(paint_image.width(), paint_image.height()); - DrawImage draw_image(paint_image, RoundOutRect(src_rect), - flags.getFilterQuality(), total_image_matrix); - auto decoded_draw_image = - decode_stashing_image_provider_.GetDecodedDrawImage(draw_image); - - if (!decoded_draw_image) - return; - - const auto& decoded_image = decoded_draw_image.decoded_image(); - DCHECK(decoded_image.image()); - - bool need_scale = !decoded_image.is_scale_adjustment_identity(); - if (need_scale) { - matrix.preScale(1.f / decoded_image.scale_adjustment().width(), - 1.f / decoded_image.scale_adjustment().height()); - } - - sk_sp<SkImage> sk_image = - sk_ref_sp<SkImage>(const_cast<SkImage*>(decoded_image.image().get())); - PaintImage decoded_paint_image = PaintImageBuilder() - .set_id(paint_image.stable_id()) - .set_image(std::move(sk_image)) - .TakePaintImage(); - decoded_flags_.emplace(flags); - decoded_flags_.value().setFilterQuality(decoded_image.filter_quality()); - decoded_flags_.value().setShader( - PaintShader::MakeImage(decoded_paint_image, flags.getShader()->tx(), - flags.getShader()->ty(), &matrix)); -} - -void ScopedImageFlags::DecodeRecordShader(const PaintFlags& flags, - const SkMatrix& ctm) { - auto decoded_shader = flags.getShader()->CreateDecodedPaintRecord( - ctm, &decode_stashing_image_provider_); - if (!decoded_shader) - return; - - decoded_flags_.emplace(flags); - decoded_flags_.value().setShader(std::move(decoded_shader)); -} - -} // namespace cc
diff --git a/cc/paint/scoped_image_flags.h b/cc/paint/scoped_image_flags.h deleted file mode 100644 index 9c39bf8..0000000 --- a/cc/paint/scoped_image_flags.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_PAINT_SCOPED_IMAGE_FLAGS_H_ -#define CC_PAINT_SCOPED_IMAGE_FLAGS_H_ - -#include "base/macros.h" -#include "cc/paint/paint_export.h" -#include "cc/paint/paint_op_buffer.h" - -namespace cc { -class ImageProvider; - -// A helper class to decode images inside the provided |flags| and provide a -// PaintFlags with the decoded images that can directly be used for -// rasterization. -// This class should only be used if |flags| has any discardable images. -class CC_PAINT_EXPORT ScopedImageFlags { - public: - // |image_provider| must outlive this class. - ScopedImageFlags(ImageProvider* image_provider, - const PaintFlags& flags, - const SkMatrix& ctm); - ~ScopedImageFlags(); - - // The usage of these flags should not extend beyond the lifetime of this - // object. - PaintFlags* decoded_flags() { - return decoded_flags_ ? &decoded_flags_.value() : nullptr; - } - - private: - // An ImageProvider that passes decode requests through to the - // |source_provider| but keeps the decode cached throughtout its lifetime, - // instead of passing the ref to the caller. - class DecodeStashingImageProvider : public ImageProvider { - public: - // |source_provider| must outlive this class. - explicit DecodeStashingImageProvider(ImageProvider* source_provider); - ~DecodeStashingImageProvider() override; - - // ImageProvider implementation. - ScopedDecodedDrawImage GetDecodedDrawImage( - const DrawImage& draw_image) override; - - private: - ImageProvider* source_provider_; - std::vector<ScopedDecodedDrawImage> decoded_images_; - - DISALLOW_COPY_AND_ASSIGN(DecodeStashingImageProvider); - }; - - void DecodeImageShader(const PaintFlags& flags, const SkMatrix& ctm); - - void DecodeRecordShader(const PaintFlags& flags, const SkMatrix& ctm); - - base::Optional<PaintFlags> decoded_flags_; - DecodeStashingImageProvider decode_stashing_image_provider_; - - DISALLOW_COPY_AND_ASSIGN(ScopedImageFlags); -}; - -} // namespace cc - -#endif // CC_PAINT_SCOPED_IMAGE_FLAGS_H_
diff --git a/cc/paint/scoped_image_flags_unittest.cc b/cc/paint/scoped_image_flags_unittest.cc deleted file mode 100644 index b8e919a9..0000000 --- a/cc/paint/scoped_image_flags_unittest.cc +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/paint/scoped_image_flags.h" - -#include "base/bind.h" -#include "base/callback.h" -#include "cc/test/skia_common.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace cc { -namespace { -class MockImageProvider : public ImageProvider { - public: - MockImageProvider() = default; - ~MockImageProvider() override { EXPECT_EQ(ref_count_, 0); } - - ScopedDecodedDrawImage GetDecodedDrawImage( - const DrawImage& draw_image) override { - ref_count_++; - - SkBitmap bitmap; - bitmap.allocN32Pixels(10, 10); - sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); - - return ScopedDecodedDrawImage( - DecodedDrawImage(image, SkSize::MakeEmpty(), SkSize::Make(1.0f, 1.0f), - draw_image.filter_quality()), - base::BindOnce(&MockImageProvider::UnrefImage, base::Unretained(this))); - } - - void UnrefImage(DecodedDrawImage decoded_image) { - ref_count_--; - CHECK_GE(ref_count_, 0); - } - - int ref_count() const { return ref_count_; } - - private: - int ref_count_ = 0; -}; -} // namespace - -TEST(ScopedImageFlagsTest, KeepsDecodesAlive) { - auto record = sk_make_sp<PaintOpBuffer>(); - record->push<DrawImageOp>(CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, - 0.f, nullptr); - record->push<DrawImageOp>(CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, - 0.f, nullptr); - record->push<DrawImageOp>(CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, - 0.f, nullptr); - auto record_shader = PaintShader::MakePaintRecord( - record, SkRect::MakeWH(100, 100), SkShader::TileMode::kClamp_TileMode, - SkShader::TileMode::kClamp_TileMode, &SkMatrix::I()); - - MockImageProvider provider; - PaintFlags flags; - flags.setShader(record_shader); - { - ScopedImageFlags scoped_flags(&provider, flags, SkMatrix::I()); - ASSERT_TRUE(scoped_flags.decoded_flags()); - SkPaint paint = scoped_flags.decoded_flags()->ToSkPaint(); - ASSERT_TRUE(paint.getShader()); - EXPECT_EQ(provider.ref_count(), 3); - } - EXPECT_EQ(provider.ref_count(), 0); -} - -} // namespace cc
diff --git a/chrome/android/java/res/layout/chrome_home_iph_header.xml b/chrome/android/java/res/layout/chrome_home_iph_header.xml index 7aa4d23..c266830f 100644 --- a/chrome/android/java/res/layout/chrome_home_iph_header.xml +++ b/chrome/android/java/res/layout/chrome_home_iph_header.xml
@@ -3,45 +3,13 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:chrome="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/modern_light_grey" - android:orientation="horizontal" - android:paddingStart="16dp" > +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/OverflowMenuHeaderLayout" > - <!-- Top and bottom padding is used to achieve layout that best matches - UX spec. - While the text matches @style/BlankHint2, text size and color - are set explicitly. When shown in the overflow menu, the header - is inflated using the OverflowMenuTheme. The theme's textAppearance - will override any textAppearance set on this element. --> <TextView - android:layout_weight="1" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingTop="9dp" - android:paddingBottom="9dp" - android:text="@string/bottom_sheet_app_menu_iph" - android:textColor="@color/black_alpha_54" - android:textSize="@dimen/text_size_medium" /> + style="@style/OverflowMenuHeaderText" + android:text="@string/bottom_sheet_app_menu_iph" /> - <FrameLayout - android:layout_width="40dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" > - - <org.chromium.chrome.browser.widget.TintedImageView - android:layout_width="18dp" - android:layout_height="18dp" - android:layout_gravity="center_vertical|center_horizontal" - android:scaleType="centerInside" - android:src="@drawable/ic_help_white_24dp" - chrome:chrometint="@color/black_alpha_38" /> - - </FrameLayout> + <include layout="@layout/chrome_home_menu_header_icon" /> </LinearLayout>
diff --git a/chrome/android/java/res/layout/chrome_home_menu_header_icon.xml b/chrome/android/java/res/layout/chrome_home_menu_header_icon.xml new file mode 100644 index 0000000..b5253a9 --- /dev/null +++ b/chrome/android/java/res/layout/chrome_home_menu_header_icon.xml
@@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2017 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<merge + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:chrome="http://schemas.android.com/apk/res-auto"> + + <FrameLayout + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" > + + <org.chromium.chrome.browser.widget.TintedImageView + android:layout_width="18dp" + android:layout_height="18dp" + android:layout_gravity="center_vertical|center_horizontal" + android:scaleType="centerInside" + android:src="@drawable/ic_help_white_24dp" + chrome:chrometint="@color/black_alpha_38" /> + + </FrameLayout> + +</merge>
diff --git a/chrome/android/java/res/layout/chrome_home_promo_header.xml b/chrome/android/java/res/layout/chrome_home_promo_header.xml new file mode 100644 index 0000000..18d5040 --- /dev/null +++ b/chrome/android/java/res/layout/chrome_home_promo_header.xml
@@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2017 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/OverflowMenuHeaderLayout" > + + <TextView + style="@style/OverflowMenuHeaderText" + android:text="@string/chrome_home_opt_out_menu_item" /> + + <include layout="@layout/chrome_home_menu_header_icon" /> + +</LinearLayout>
diff --git a/chrome/android/java/res/layout/chrome_home_promo_toggle.xml b/chrome/android/java/res/layout/chrome_home_promo_toggle.xml index b3d538d..b03dcfb 100644 --- a/chrome/android/java/res/layout/chrome_home_promo_toggle.xml +++ b/chrome/android/java/res/layout/chrome_home_promo_toggle.xml
@@ -12,14 +12,6 @@ android:gravity="center_vertical" > <TextView - android:id="@+id/chrome_home_promo_state_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingEnd="4dp" - android:textStyle="bold" - style="@style/PromoDialogNormalText" /> - - <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"
diff --git a/chrome/android/java/res/layout/offline_download_header.xml b/chrome/android/java/res/layout/offline_download_header.xml index 68f25b2..daaa1cb 100644 --- a/chrome/android/java/res/layout/offline_download_header.xml +++ b/chrome/android/java/res/layout/offline_download_header.xml
@@ -24,18 +24,18 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > - + <TextView - android:id="@+id/page_count_text" - style="@style/DownloadTitleStyle" /> + android:id="@+id/title" + style="@style/DownloadTitleStyle" + android:text="@string/download_manager_offline_header_title" /> <ImageView android:id="@+id/expand_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_toEndOf="@+id/page_count_text" - android:layout_marginTop="0dp" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" android:paddingEnd="16dp" android:contentDescription="@null" android:src="@drawable/ic_expanded" /> @@ -43,14 +43,8 @@ <TextView android:id="@+id/description" style="@style/DownloadDescriptionStyle" - android:layout_toStartOf="@+id/filesize_view" - android:layout_below="@+id/page_count_text" + android:layout_below="@+id/title" android:text="@string/download_manager_offline_header_description" /> - - <TextView - android:id="@+id/filesize_view" - style="@style/DownloadFileSizeStyle" - android:layout_below="@+id/page_count_text" /> </RelativeLayout> </LinearLayout> </view> \ No newline at end of file
diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml index d5628a6..84d9845 100644 --- a/chrome/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml
@@ -284,6 +284,28 @@ @drawable/distilled_page_prefs_button_bg </item> </style> + <style name="OverflowMenuHeaderLayout"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:background">@color/modern_light_grey</item> + <item name="android:orientation">horizontal</item> + <item name="android:paddingStart">16dp</item> + </style> + <!-- Top and bottom padding is used to achieve layout that best matches + UX spec. While the text matches @style/BlankHint2, text size and color + are set explicitly. When shown in the overflow menu, the header + is inflated using the OverflowMenuTheme. The theme's textAppearance + will override any textAppearance set on this element. --> + <style name="OverflowMenuHeaderText"> + <item name="android:layout_weight">1</item> + <item name="android:layout_width">0dp</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_gravity">center_vertical</item> + <item name="android:paddingTop">9dp</item> + <item name="android:paddingBottom">9dp</item> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> <!-- Button bar styles --> <style name="ButtonBarTopSpacerLight"> @@ -340,7 +362,7 @@ <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">true</item> </style> - <style name="PromoDialogNormalText" parent="@style/BlackDisabledText2"> + <style name="PromoDialogNormalText" parent="@style/BlackBody"> <item name="android:lineSpacingMultiplier">1.3</item> </style> @@ -675,17 +697,6 @@ <item name="android:singleLine">true</item> <item name="android:textAppearance">@style/BlackDenseListText2</item> </style> - <style name="DownloadFileSizeStyle"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_alignParentBottom">true</item> - <item name="android:layout_alignParentEnd">true</item> - <item name="android:layout_marginTop">0dp</item> - <item name="android:paddingEnd">16dp</item> - <item name="android:textAlignment">viewEnd</item> - <item name="android:textColor">@color/google_grey_600</item> - <item name="android:singleLine">true</item> - </style> <style name="DownloadIconView" parent="@style/ListItemStartIcon"> <item name="android:background">@color/light_active_color</item> </style>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index c915479..74b09039 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -472,6 +472,7 @@ <!-- Modern List Item dimensions --> <dimen name="list_item_min_height">60dp</dimen> <dimen name="list_item_default_margin">16dp</dimen> + <dimen name="list_item_subsection_margin">40dp</dimen> <dimen name="list_item_top_bottom_padding">10dp</dimen> <dimen name="list_item_start_icon_right_margin">20dp</dimen> <dimen name="list_item_start_icon_width">36dp</dimen> @@ -491,6 +492,7 @@ <!-- Bottom sheet dimensions --> <dimen name="bottom_sheet_help_bubble_inset">10dp</dimen> <dimen name="bottom_nav_height">40dp</dimen> + <dimen name="bottom_nav_height_tall">48dp</dimen> <!-- Chrome Home dimensions --> <dimen name="chrome_home_empty_view_top_padding">72dp</dimen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index b7564604..4257bad 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -161,7 +161,10 @@ public static final String CHROME_HOME_DESTROY_SUGGESTIONS = "ChromeHomeDestroySuggestions"; public static final String CHROME_HOME_DOODLE = "ChromeHomeDoodle"; public static final String CHROME_HOME_EXPAND_BUTTON = "ChromeHomeExpandButton"; + public static final String CHROME_HOME_PERSONALIZED_OMNIBOX_SUGGESTIONS = + "ChromeHomePersonalizedOmniboxSuggestions"; public static final String CHROME_HOME_PROMO = "ChromeHomePromo"; + public static final String CHROME_MEMEX = "ChromeMemex"; public static final String CONTENT_SUGGESTIONS_FAVICONS_FROM_NEW_SERVER = "ContentSuggestionsFaviconsFromNewServer"; public static final String CONTENT_SUGGESTIONS_NOTIFICATIONS =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index 50bb824..7b02bca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -1519,6 +1519,11 @@ @Override public int getHeaderResourceId() { + if (getBottomSheet() != null + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME_PROMO)) { + return R.layout.chrome_home_promo_header; + } + if (getBottomSheet() != null && getAppMenuPropertiesDelegate().shouldShowPageMenu() && !getBottomSheet().isSheetOpen()) { return R.layout.chrome_home_iph_header; @@ -1532,6 +1537,15 @@ return new OnClickListener() { @Override public void onClick(View v) { + if (getBottomSheet() != null + && ChromeFeatureList.isEnabled( + ChromeFeatureList.CHROME_HOME_PROMO)) { + ChromeHomePromoDialog chDialog = + new ChromeHomePromoDialog(ChromeTabbedActivity.this); + chDialog.show(); + return; + } + getBottomSheet() .getBottomSheetMetrics() .recordInProductHelpMenuItemClicked();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsService.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsService.java index e5c60976..f45f745 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsService.java
@@ -10,7 +10,6 @@ import android.app.Service; import android.content.Context; import android.content.Intent; -import android.net.Uri; import android.os.IBinder; import android.text.TextUtils; @@ -28,15 +27,15 @@ import org.chromium.chrome.browser.notifications.channels.ChannelDefinitions; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; +import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.util.IntentUtils; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.common.Referrer; import org.chromium.ui.widget.Toast; import java.lang.ref.WeakReference; -import java.util.HashSet; -import java.util.Set; /** * The foreground service responsible for creating notifications for Browser Actions and keep the @@ -76,7 +75,11 @@ private static int sTitleResId; - private static Set<Integer> sLoadingTabSet = new HashSet<>(); + private static int sLoadingUrlNum; + + private BrowserActionsTabModelSelector mSelector; + + private TabModelObserver mObserver; @Override public IBinder onBind(Intent intent) { @@ -89,7 +92,7 @@ } @VisibleForTesting - static int getTitleRestId() { + static int getTitleResId() { return sTitleResId; } @@ -103,32 +106,30 @@ IntentUtils.safeGetStringExtra(intent, EXTRA_SOURCE_PACKAGE_NAME); Context context = ContextUtils.getApplicationContext(); int tabId = openTabInBackground(linkUrl, sourcePackageName); + updateTabIdForNotification(tabId); if (tabId != Tab.INVALID_TAB_ID) { - updateTabIdForNotification(tabId); - sLoadingTabSet.add(tabId); - Toast.makeText(context, R.string.browser_actions_open_in_background_toast_message, - Toast.LENGTH_SHORT) - .show(); - } else { - finishTabCreation(Tab.INVALID_TAB_ID); - Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl)); - launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - launchIntent.setClass(context, ChromeLauncherActivity.class); - launchIntent.putExtra( - ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_TO_PARENT, false); - IntentUtils.safeStartActivity(context, launchIntent); + finishTabCreation(); } - + Toast.makeText(context, R.string.browser_actions_open_in_background_toast_message, + Toast.LENGTH_SHORT) + .show(); NotificationUmaTracker.getInstance().onNotificationShown( NotificationUmaTracker.BROWSER_ACTIONS, ChannelDefinitions.CHANNEL_ID_BROWSER); } else if (TextUtils.equals(intent.getAction(), ACTION_TAB_CREATION_CHROME_DISPLAYED)) { - sLoadingTabSet.clear(); + setLoadingUrlNum(0); + if (mSelector != null) { + mSelector.getModel(false).removeObserver(mObserver); + } stopForeground(true); } // The service will not be restarted if Chrome get killed. return START_NOT_STICKY; } + private static void setLoadingUrlNum(int num) { + sLoadingUrlNum = num; + } + private void updateTabIdForNotification(int tabId) { sendBrowserActionsNotification(tabId); ContextUtils.getAppSharedPreferences() @@ -137,17 +138,37 @@ .apply(); } - private void finishTabCreation(int tabId) { - sLoadingTabSet.remove(tabId); - if (sLoadingTabSet.isEmpty()) { - stopForeground(false); + private void finishTabCreation() { + if (sLoadingUrlNum > 0) { + sLoadingUrlNum--; + if (sLoadingUrlNum == 0) { + stopForeground(false); + if (mSelector != null) { + mSelector.getModel(false).removeObserver(mObserver); + } + } } } + @VisibleForTesting + static boolean isBackgroundService() { + return sLoadingUrlNum == 0; + } + private int openTabInBackground(String linkUrl, String sourcePackageName) { Referrer referrer = IntentHandler.constructValidReferrerForAuthority(sourcePackageName); LoadUrlParams loadUrlParams = new LoadUrlParams(linkUrl); loadUrlParams.setReferrer(referrer); + Tab tab = launchTabInRunningTabbedActivity(loadUrlParams); + if (tab != null) { + sLoadingUrlNum++; + return tab.getId(); + } + launchTabInBrowserActionsModel(loadUrlParams); + return Tab.INVALID_TAB_ID; + } + + private Tab launchTabInRunningTabbedActivity(LoadUrlParams loadUrlParams) { for (WeakReference<Activity> ref : ApplicationStatus.getRunningActivities()) { if (!(ref.get() instanceof ChromeTabbedActivity)) continue; @@ -162,14 +183,32 @@ tab.addObserver(new EmptyTabObserver() { @Override public void onPageLoadFinished(Tab tab) { - finishTabCreation(tab.getId()); + finishTabCreation(); tab.removeObserver(this); } }); - return tab.getId(); + return tab; } } - return Tab.INVALID_TAB_ID; + return null; + } + + private void launchTabInBrowserActionsModel(LoadUrlParams loadUrlParams) { + mSelector = BrowserActionsTabModelSelector.getInstance(); + sLoadingUrlNum++; + if (mObserver == null) { + mObserver = new EmptyTabModelObserver() { + @Override + public void didAddTab(Tab tab, TabLaunchType type) { + assert mSelector != null; + if (!mSelector.isTabStateInitialized()) return; + assert tab != null; + finishTabCreation(); + } + }; + } + mSelector.getModel(false).addObserver(mObserver); + mSelector.openNewTab(loadUrlParams); } private void sendBrowserActionsNotification(int tabId) { @@ -221,7 +260,7 @@ public static void cancelBrowserActionsNotification() { // If Chrome is shown, force the foreground service to be killed so notification bound to it // will be dismissed. - if (!sLoadingTabSet.isEmpty()) { + if (sLoadingUrlNum != 0) { Context context = ContextUtils.getApplicationContext(); Intent intent = new Intent(context, BrowserActionsService.class); intent.setAction(ACTION_TAB_CREATION_CHROME_DISPLAYED);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabCreatorManager.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabCreatorManager.java new file mode 100644 index 0000000..f07fa3a8 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabCreatorManager.java
@@ -0,0 +1,93 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browseractions; + +import android.content.Context; + +import org.chromium.base.ContextUtils; +import org.chromium.chrome.browser.TabState; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tab.TabDelegateFactory; +import org.chromium.chrome.browser.tabmodel.TabCreatorManager; +import org.chromium.chrome.browser.tabmodel.TabModel; +import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; +import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.WebContents; +import org.chromium.ui.base.WindowAndroid; + +/** + * The manager returns a {@link BrowserActionsTabCreator} to create Tabs for Browser Actions. + */ +public class BrowserActionsTabCreatorManager implements TabCreatorManager { + private final BrowserActionsTabCreator mTabCreator; + + public BrowserActionsTabCreatorManager() { + mTabCreator = new BrowserActionsTabCreator(); + } + + /** + * This class creates various kinds of new tabs specific for Browser Actions. + * The created tabs are not bound with {@link ChromeActivity}. + */ + public class BrowserActionsTabCreator extends TabCreator { + private TabModel mTabModel; + + @Override + public boolean createsTabsAsynchronously() { + return false; + } + + @Override + public Tab createNewTab(LoadUrlParams loadUrlParams, TabLaunchType type, Tab parent) { + assert type == TabLaunchType.FROM_BROWSER_ACTIONS + || type + == TabLaunchType.FROM_RESTORE + : "tab launch type should be FROM_BROWSER_ACTIONS or FROM_RESTORE"; + Context context = ContextUtils.getApplicationContext(); + WindowAndroid windowAndroid = new WindowAndroid(context); + Tab tab = Tab.createTabForLazyLoad( + false, windowAndroid, type, Tab.INVALID_TAB_ID, loadUrlParams); + tab.initialize(null, null, new TabDelegateFactory(), true, false); + mTabModel.addTab(tab, -1, type); + return tab; + } + + @Override + public Tab createFrozenTab(TabState state, int id, int index) { + Tab tab = Tab.createFrozenTabFromState(id, false, null, Tab.INVALID_TAB_ID, state); + mTabModel.addTab(tab, index, TabLaunchType.FROM_RESTORE); + return tab; + } + + @Override + public Tab launchUrl(String url, TabLaunchType type) { + throw new UnsupportedOperationException("Browser Actions does not support launchUrl"); + } + + @Override + public boolean createTabWithWebContents( + Tab parent, WebContents webContents, int parentId, TabLaunchType type, String url) { + throw new UnsupportedOperationException( + "Browser Actions does not support createTabWithWebContents"); + } + + /** + * Sets the tab model to use when creating tabs. + * @param model The new {@link TabModel} to use. + */ + public void setTabModel(TabModel model) { + mTabModel = model; + } + } + + @Override + public TabCreator getTabCreator(boolean incognito) { + if (incognito) { + throw new IllegalStateException( + "Browser Actions does not support background incognito tabs"); + } + return mTabCreator; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabModelSelector.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabModelSelector.java new file mode 100644 index 0000000..287b2324 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabModelSelector.java
@@ -0,0 +1,193 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browseractions; + +import android.os.AsyncTask; + +import org.chromium.base.ThreadUtils; +import org.chromium.chrome.browser.browseractions.BrowserActionsTabCreatorManager.BrowserActionsTabCreator; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tabmodel.EmptyTabModel; +import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; +import org.chromium.chrome.browser.tabmodel.TabCreatorManager; +import org.chromium.chrome.browser.tabmodel.TabModel; +import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; +import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; +import org.chromium.chrome.browser.tabmodel.TabModelDelegate; +import org.chromium.chrome.browser.tabmodel.TabModelImpl; +import org.chromium.chrome.browser.tabmodel.TabModelObserver; +import org.chromium.chrome.browser.tabmodel.TabModelOrderController; +import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase; +import org.chromium.chrome.browser.tabmodel.TabPersistentStore; +import org.chromium.chrome.browser.tabmodel.TabPersistentStore.TabPersistentStoreObserver; +import org.chromium.content_public.browser.LoadUrlParams; + +import java.util.ArrayList; +import java.util.List; + +/** + * The tab model selector creates Tabs for Browser Actions. Tabs created by it are not shown in the + * foreground and don't need {@link TabContentMananger}. + */ +public class BrowserActionsTabModelSelector + extends TabModelSelectorBase implements TabModelDelegate { + /** The singleton reference. */ + private static BrowserActionsTabModelSelector sInstance; + private static final Object sInstanceLock = new Object(); + + private final TabCreatorManager mTabCreatorManager; + + private final TabPersistentStore mTabSaver; + + private final TabModelOrderController mOrderController; + + private final List<LoadUrlParams> mPendingUrls = new ArrayList<>(); + + private Runnable mTabCreationRunnable; + + /** + * Builds a {@link BrowserActionsTabModelSelector} instance. + */ + private BrowserActionsTabModelSelector() { + super(); + mTabCreatorManager = new BrowserActionsTabCreatorManager(); + final TabPersistentStoreObserver persistentStoreObserver = + new TabPersistentStoreObserver() { + @Override + public void onStateLoaded() { + markTabStateInitialized(); + } + }; + BrowserActionsTabPersistencePolicy persistencePolicy = + new BrowserActionsTabPersistencePolicy(); + mTabSaver = new TabPersistentStore( + persistencePolicy, this, mTabCreatorManager, persistentStoreObserver); + mOrderController = new TabModelOrderController(this); + } + + /** + * @return The singleton instance of {@link BrowserActionsTabModelSelector}. + */ + public static BrowserActionsTabModelSelector getInstance() { + synchronized (sInstanceLock) { + ThreadUtils.assertOnUiThread(); + if (sInstance == null) { + sInstance = new BrowserActionsTabModelSelector(); + sInstance.initializeSelector(); + } + return sInstance; + } + } + + private void initializeSelector() { + BrowserActionsTabCreator regularTabCreator = + (BrowserActionsTabCreator) mTabCreatorManager.getTabCreator(false); + TabModelImpl normalModel = new TabModelImpl(false, false, regularTabCreator, null, null, + mOrderController, null, mTabSaver, this, false); + TabModel incognitoModel = EmptyTabModel.getInstance(); + initialize(false, normalModel, incognitoModel); + regularTabCreator.setTabModel(getCurrentModel()); + } + + @Override + public void markTabStateInitialized() { + super.markTabStateInitialized(); + // Add observer when tab model is restored to prevent restored tabs updating tab model. + TabModelObserver tabModelObserver = new EmptyTabModelObserver() { + @Override + public void didAddTab(Tab tab, TabLaunchType type) { + if (tab != null) { + mTabSaver.addTabToSaveQueue(tab); + } + } + }; + getModel(false).addObserver(tabModelObserver); + if (mTabCreationRunnable != null) { + ThreadUtils.runOnUiThread(mTabCreationRunnable); + } + mTabCreationRunnable = null; + } + + /** + * Creates a new Tab with given url in Browser Actions tab model. + * @param loadUrlParams The url params to be opened. + */ + public void openNewTab(LoadUrlParams loadUrlParams) { + // If tab model is restored, directly create a new tab. + if (isTabStateInitialized()) { + createNewTab(loadUrlParams); + return; + } + if (mTabCreationRunnable == null) { + mTabCreationRunnable = new Runnable() { + @Override + public void run() { + for (int i = 0; i < mPendingUrls.size(); i++) { + createNewTab(mPendingUrls.get(i)); + } + mPendingUrls.clear(); + } + }; + new AsyncTask<Void, Void, Void>() { + @Override + protected Void doInBackground(Void... params) { + mTabSaver.loadState(true); + mTabSaver.restoreTabs(false); + return null; + } + } + .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + mPendingUrls.add(loadUrlParams); + } + + private void createNewTab(LoadUrlParams params) { + openNewTab(params, TabLaunchType.FROM_BROWSER_ACTIONS, null, false); + } + + @Override + public void requestToShowTab(Tab tab, TabSelectionType type) {} + + @Override + public boolean closeAllTabsRequest(boolean incognito) { + return false; + } + + @Override + public boolean isInOverviewMode() { + return false; + } + + @Override + public boolean isSessionRestoreInProgress() { + return false; + } + + /** + * @return Return the current tab model. For Browser Actions, it always returns the normal tab + * model. + */ + public TabModelImpl getModel() { + return (TabModelImpl) getModel(false); + } + + /** + * Save the whole tab list to the disk. + */ + public void saveState() { + commitAllTabClosures(); + mTabSaver.saveState(); + } + + @Override + public Tab openNewTab( + LoadUrlParams loadUrlParams, TabLaunchType type, Tab parent, boolean incognito) { + if (!isTabStateInitialized()) { + assert type == TabLaunchType.FROM_RESTORE; + } + return mTabCreatorManager.getTabCreator(incognito).createNewTab( + loadUrlParams, type, parent); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabPersistencePolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabPersistencePolicy.java new file mode 100644 index 0000000..05b7984 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabPersistencePolicy.java
@@ -0,0 +1,76 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browseractions; + +import org.chromium.base.Callback; +import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; +import org.chromium.chrome.browser.tabmodel.TabPersistencePolicy; +import org.chromium.chrome.browser.tabmodel.TabPersistentStore; +import org.chromium.chrome.browser.tabmodel.TabbedModeTabPersistencePolicy; + +import java.io.File; +import java.util.List; +import java.util.concurrent.Executor; + +import javax.annotation.Nullable; + +/** + * Handles the Browser Actions Tab specific behaviors of tab persistence. + */ +public class BrowserActionsTabPersistencePolicy implements TabPersistencePolicy { + @Override + public File getOrCreateStateDirectory() { + return TabbedModeTabPersistencePolicy.getOrCreateTabbedModeStateDirectory(); + } + + @Override + public String getStateFileName() { + return TabPersistentStore.getStateFileName("_browser_actions"); + } + + @Override + public boolean shouldMergeOnStartup() { + return false; + } + + @Override + @Nullable + public String getStateToBeMergedFileName() { + return null; + } + + @Override + public boolean performInitialization(Executor executor) { + return false; + } + + @Override + public void waitForInitializationToFinish() {} + + @Override + public boolean isMergeInProgress() { + return false; + } + + @Override + public void setMergeInProgress(boolean isStarted) { + assert false : "Merge not supported in Browser Actions"; + } + + @Override + public void cancelCleanupInProgress() {} + + @Override + public void cleanupUnusedFiles(Callback<List<String>> filesToDelete) {} + + @Override + public void setTabContentManager(TabContentManager cache) {} + + @Override + public void notifyStateLoaded(int tabCountAtStartup) {} + + @Override + public void destroy() {} +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java index d15eab9..fbd1ead 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java
@@ -35,6 +35,7 @@ public class DownloadItemView extends SelectableItemView<DownloadHistoryItemWrapper> implements ThumbnailProvider.ThumbnailRequest { private final int mMargin; + private final int mMarginSubsection; private final int mIconBackgroundColor; private final int mIconBackgroundColorSelected; private final ColorStateList mIconForegroundColorList; @@ -70,6 +71,8 @@ public DownloadItemView(Context context, AttributeSet attrs) { super(context, attrs); mMargin = context.getResources().getDimensionPixelSize(R.dimen.list_item_default_margin); + mMarginSubsection = + context.getResources().getDimensionPixelSize(R.dimen.list_item_subsection_margin); mIconBackgroundColor = DownloadUtils.getIconBackgroundColor(context); mIconBackgroundColorSelected = ApiCompatibilityUtils.getColor(context.getResources(), R.color.google_grey_600); @@ -154,6 +157,10 @@ mItem = item; setItem(item); + ApiCompatibilityUtils.setMarginStart( + (MarginLayoutParams) mLayoutContainer.getLayoutParams(), + item.isSuggested() ? mMarginSubsection : mMargin); + // Cancel any previous thumbnail request for the previously displayed item. ThumbnailProvider thumbnailProvider = provider.getThumbnailProvider(); thumbnailProvider.cancelRetrieval(this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java index 8526aa1f..df74132 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java
@@ -17,11 +17,13 @@ import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.download.ui.DownloadHistoryAdapter.SubsectionHeader; import org.chromium.chrome.browser.download.ui.DownloadItemSelectionDelegate.SubsectionHeaderSelectionObserver; +import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.widget.DateDividedAdapter.TimedItem; import org.chromium.chrome.browser.widget.TintedImageView; import org.chromium.chrome.browser.widget.selection.SelectableItemView; import java.util.Date; +import java.util.Locale; import java.util.Set; /** @@ -30,22 +32,33 @@ public class OfflineGroupHeaderView extends SelectableItemView<TimedItem> implements SubsectionHeaderSelectionObserver { private final int mIconBackgroundColorSelected; + private final int mIconBackgroundColor; + private final int mIconBackgroundResId; private final ColorStateList mIconForegroundColorList; + private final ColorStateList mCheckedIconForegroundColorList; private SubsectionHeader mHeader; private DownloadHistoryAdapter mAdapter; private DownloadItemSelectionDelegate mSelectionDelegate; - private TextView mPageCountHeader; - private TextView mFileSizeView; + private TextView mDescriptionView; private ImageView mExpandImage; private TintedImageView mIconView; public OfflineGroupHeaderView(Context context, AttributeSet attrs) { super(context, attrs); + mIconBackgroundColor = DownloadUtils.getIconBackgroundColor(context); mIconBackgroundColorSelected = ApiCompatibilityUtils.getColor(getResources(), R.color.google_grey_600); - mIconForegroundColorList = DownloadUtils.getIconForegroundColorList(context); + mCheckedIconForegroundColorList = DownloadUtils.getIconForegroundColorList(context); + mIconBackgroundResId = R.drawable.list_item_icon_modern_bg; + + if (FeatureUtilities.isChromeHomeEnabled()) { + mIconForegroundColorList = ApiCompatibilityUtils.getColorStateList( + context.getResources(), R.color.dark_mode_tint); + } else { + mIconForegroundColorList = DownloadUtils.getIconForegroundColorList(context); + } } @Override @@ -53,8 +66,7 @@ super.onFinishInflate(); mIconView = (TintedImageView) findViewById(R.id.icon_view); - mPageCountHeader = (TextView) findViewById(R.id.page_count_text); - mFileSizeView = (TextView) findViewById(R.id.filesize_view); + mDescriptionView = (TextView) findViewById(R.id.description); mExpandImage = (ImageView) findViewById(R.id.expand_icon); } @@ -87,9 +99,10 @@ public void displayHeader(SubsectionHeader header) { this.mHeader = header; // TODO(crbug.com/635567): Fix lint properly. - mPageCountHeader.setText(getResources().getString( - R.string.download_manager_offline_header_title, header.getItemCount())); - mFileSizeView.setText(Formatter.formatFileSize(getContext(), header.getTotalFileSize())); + String description = String.format(Locale.getDefault(), "%s - %s", + Formatter.formatFileSize(getContext(), header.getTotalFileSize()), + getContext().getString(R.string.download_manager_offline_header_description)); + mDescriptionView.setText(description); updateExpandIcon(header.isExpanded()); setChecked(mSelectionDelegate.isHeaderSelected(header)); } @@ -103,13 +116,27 @@ private void updateCheckIcon(boolean checked) { if (checked) { - mIconView.setBackgroundColor(mIconBackgroundColorSelected); + if (FeatureUtilities.isChromeHomeEnabled()) { + mIconView.setBackgroundResource(mIconBackgroundResId); + mIconView.getBackground().setLevel( + getResources().getInteger(R.integer.list_item_level_selected)); + } else { + mIconView.setBackgroundColor(mIconBackgroundColorSelected); + } + mIconView.setImageResource(R.drawable.ic_check_googblue_24dp); - mIconView.setTint(mIconForegroundColorList); + mIconView.setTint(mCheckedIconForegroundColorList); } else { - mIconView.setBackgroundResource(R.color.light_active_color); + if (FeatureUtilities.isChromeHomeEnabled()) { + mIconView.setBackgroundResource(mIconBackgroundResId); + mIconView.getBackground().setLevel( + getResources().getInteger(R.integer.list_item_level_default)); + } else { + mIconView.setBackgroundColor(mIconBackgroundColor); + } + mIconView.setImageResource(R.drawable.ic_chrome); - mIconView.setTint(null); + mIconView.setTint(mIconForegroundColorList); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/net/qualityprovider/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/net/qualityprovider/OWNERS index c3dd3cc..adcf030 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/net/qualityprovider/OWNERS +++ b/chrome/android/java/src/org/chromium/chrome/browser/net/qualityprovider/OWNERS
@@ -1,4 +1,4 @@ file://net/nqe/OWNERS -# TEAM: nqe-dev@chromium.org +# TEAM: net-dev@chromium.org # COMPONENT: Internals>Network>NetworkQuality
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java index b2452b8..1807c21a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
@@ -316,12 +316,18 @@ mRecyclerView = (SuggestionsRecyclerView) recyclerView; if (SuggestionsConfig.scrollToLoad()) { - mRecyclerView.addOnScrollListener(new ScrollToLoadListener( + mRecyclerView.setScrollToLoadListener(new ScrollToLoadListener( this, mRecyclerView.getLinearLayoutManager(), mSections)); } } @Override + public void onDetachedFromRecyclerView(RecyclerView recyclerView) { + super.onDetachedFromRecyclerView(recyclerView); + if (SuggestionsConfig.scrollToLoad()) mRecyclerView.clearScrollToLoadListener(); + } + + @Override public void onViewRecycled(NewTabPageViewHolder holder) { holder.recycle(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ScrollToLoadListener.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ScrollToLoadListener.java index c7fe0698..a76287e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ScrollToLoadListener.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ScrollToLoadListener.java
@@ -10,19 +10,25 @@ import org.chromium.base.ThreadUtils; /** - * An {@link RecyclerView.OnScrollListener} that is attached to the {@link SuggestionsRecyclerView} - * to trigger a suggestions load when the SuggestionsRecyclerView is scrolled near the bottom. + * The ScrollToLoadListener requests fetching more items when the user approaches the end of their + * feed, simulating an infinite feed. It is a {@link RecyclerView.OnScrollListener} to be attached + * to the {@link org.chromium.chrome.browser.suggestions.SuggestionsRecyclerView} and must be called + * manually to fetch more when the users approaches the end of their feed through dismissing items. + * + * To determine whether the user is close enough to the end of the feed to load more, it checks + * whether the sentinel is visible. The sentinel is a child of the RecyclerView that is + * {@link #SENTINEL_OFFSET} from the end. */ public class ScrollToLoadListener extends RecyclerView.OnScrollListener { - // TODO(peconn): Find better triggering logic than RELOAD_DISTANCE. - /** How many items from the end must be visible for us to trigger a reload. */ - private static final int RELOAD_DISTANCE = 5; + /** How far back from the end of the RecyclerView the sentinel is. */ + private static final int SENTINEL_OFFSET = 5; private final NewTabPageAdapter mAdapter; private final LinearLayoutManager mLayoutManager; private final SectionList mSections; - private boolean mItemVisiblePreviously; + private boolean mSentinelPreviouslyVisible; + private int mPreviousItemCount; public ScrollToLoadListener( NewTabPageAdapter adapter, LinearLayoutManager layoutManager, SectionList sections) { @@ -33,18 +39,47 @@ @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { - if (dy == 0) return; // We've been triggered by a layout change calculation. + // onScrolled is called both when the RecyclerView is scrolled and when its layout changes, + // for example when the RecyclerView is resized due to the BottomSheet being opened or + // because the phone orientation changes. if (mAdapter.getItemCount() == 0) return; // Adapter hasn't been populated yet. - boolean itemVisible = mLayoutManager.findLastVisibleItemPosition() - > mAdapter.getItemCount() - RELOAD_DISTANCE; + fetchMoreIfNearEnd(); + } - if (itemVisible && !mItemVisiblePreviously) { + /** + * To be called when an item on the SuggestionsRecyclerView is dismissed to allow loading more + * suggestions if that brings the user closer to the end of their feed. + */ + public void onItemDismissed() { + fetchMoreIfNearEnd(); + } + + private void fetchMoreIfNearEnd() { + boolean sentinelVisible = mLayoutManager.findLastVisibleItemPosition() + > mAdapter.getItemCount() - SENTINEL_OFFSET; + + // We fetch when the sentinel becomes visible - this means that the user is scrolling down + // and once the user is at the bottom (because a fetch returned no results) they will have + // to scroll up a fair amount then scroll back down again before triggering another fetch. + boolean sentinelBecameVisible = sentinelVisible && !mSentinelPreviouslyVisible; + + // We have an edge case where the user scrolls down, the sentinel becomes visible and we + // trigger a fetch. The fetch then returns a few items, increasing the size of the + // suggestions list, but not enough to make the sentinel be off screen. When the user + // scrolls down we want to fetch again, but since the sentinel has not become visible (it + // was already visible), we wouldn't trigger. To catch this case, we also trigger a fetch + // when the sentinel is visible and the number of items has changed. + boolean sentinelVisibleButTooFewItemsFetched = sentinelVisible + && mAdapter.getItemCount() > mPreviousItemCount; + + if (sentinelBecameVisible || sentinelVisibleButTooFewItemsFetched) { + mPreviousItemCount = mAdapter.getItemCount(); // We need to post this since onScrolled may run during a measure & layout pass. ThreadUtils.postOnUiThread(mSections::fetchMore); } - mItemVisiblePreviously = itemVisible; + mSentinelPreviouslyVisible = sentinelVisible; } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java index 5a227f16..deaac01 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
@@ -889,6 +889,10 @@ return nativeGetSupervisedUserSecondCustodianProfileImageURL(); } + public void setChromeHomePersonalizedOmniboxSuggestionsEnabled(boolean enabled) { + nativeSetChromeHomePersonalizedOmniboxSuggestionsEnabled(enabled); + } + private native boolean nativeIsContentSettingEnabled(int contentSettingType); private native boolean nativeIsContentSettingManaged(int contentSettingType); private native void nativeSetContentSettingEnabled(int contentSettingType, boolean allow); @@ -1056,4 +1060,5 @@ private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String version); private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); private native void nativeSetSupervisedUserId(String supervisedUserId); + private native void nativeSetChromeHomePersonalizedOmniboxSuggestionsEnabled(boolean enabled); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsRecyclerView.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsRecyclerView.java index 09ed9d0c..d02abcea 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsRecyclerView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsRecyclerView.java
@@ -12,6 +12,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Canvas; +import android.support.annotation.Nullable; import android.support.v4.view.ViewCompat; import android.support.v4.view.animation.FastOutLinearInInterpolator; import android.support.v7.view.ContextThemeWrapper; @@ -32,6 +33,7 @@ import org.chromium.chrome.browser.ntp.cards.CardViewHolder; import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder; +import org.chromium.chrome.browser.ntp.cards.ScrollToLoadListener; import org.chromium.chrome.browser.widget.displaystyle.UiConfig; import java.util.ArrayList; @@ -54,6 +56,9 @@ private final LinearLayoutManager mLayoutManager; private final SuggestionsMetrics.ScrollEventReporter mScrollEventReporter; + // The ScrollToLoadListener triggers loading more content when the user is near the end. + @Nullable private ScrollToLoadListener mScrollToLoadListener; + /** * Total height of the items being dismissed. Tracked to allow the bottom space to compensate * for their removal animation and avoid moving the scroll position. @@ -293,6 +298,7 @@ getNewTabPageAdapter().dismissItem(position, removedItemTitle -> { announceForAccessibility(getResources().getString( R.string.ntp_accessibility_item_removed, removedItemTitle)); + if (mScrollToLoadListener != null) mScrollToLoadListener.onItemDismissed(); }); } @@ -354,6 +360,24 @@ ((CardViewHolder) holder).getRecyclerView().updateViewStateForDismiss(0, holder); } + /** + * Sets the ScrollToLoadListener for the RecyclerView. + */ + public void setScrollToLoadListener(ScrollToLoadListener scrollToLoadListener) { + mScrollToLoadListener = scrollToLoadListener; + addOnScrollListener(mScrollToLoadListener); + } + + /** + * Clears the currently registered ScrollToLoadListener. + */ + public void clearScrollToLoadListener() { + if (mScrollToLoadListener == null) return; + + removeOnScrollListener(mScrollToLoadListener); + mScrollToLoadListener = null; + } + private class ItemTouchCallbacks extends ItemTouchHelper.Callback { @Override public void onSwiped(ViewHolder viewHolder, int direction) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java index 661788e6..0fab4d2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -110,29 +110,29 @@ * been loaded. * @param tabCountAtStartup How many tabs there are in the TabModels. */ - void onInitialized(int tabCountAtStartup) {} + public void onInitialized(int tabCountAtStartup) {} /** * Called when details about a Tab are read from the metadata file. */ - void onDetailsRead(int index, int id, String url, - boolean isStandardActiveIndex, boolean isIncognitoActiveIndex) {} + public void onDetailsRead(int index, int id, String url, boolean isStandardActiveIndex, + boolean isIncognitoActiveIndex) {} /** * To be called when the TabStates have all been loaded. */ - void onStateLoaded() {} + public void onStateLoaded() {} /** * To be called when the TabState from another instance has been merged. */ - void onStateMerged() {} + public void onStateMerged() {} /** * Called when the metadata file has been saved out asynchronously. * This currently does not get called when the metadata file is saved out on the UI thread. */ - void onMetadataSavedAsynchronously() {} + public void onMetadataSavedAsynchronously() {} } /** Stores information about a TabModel. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java index d7a1877..76f2079 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java
@@ -17,6 +17,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.widget.TintedDrawable; import java.util.Locale; @@ -109,6 +110,10 @@ } private String getTabCountString() { + if (ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + return "M"; + } if (mTabCount <= 0) { return ""; } else if (mTabCount > 99) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java index a04304ce..0334be6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java
@@ -719,6 +719,14 @@ if (mToolbarTabController != null) mToolbarTabController.openHomepage(); } + /** + * Opens the Memex UI in the current tab. + */ + protected void openMemexUI() { + getLocationBar().hideSuggestions(); + if (mToolbarTabController != null) mToolbarTabController.openMemexUI(); + } + @Override public void setMenuButtonHighlight(boolean highlight) { mHighlightingMenu = highlight;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java index a2da490..373b6b4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java
@@ -124,6 +124,8 @@ */ public static final int MINIMUM_LOAD_PROGRESS = 5; + private static final String CHROME_MEMEX_URL = "https://chrome-memex.corp.google.com"; + private final ToolbarLayout mToolbar; private final ToolbarControlContainer mControlContainer; @@ -967,6 +969,13 @@ currentTab.loadUrl(new LoadUrlParams(homePageUrl, PageTransition.HOME_PAGE)); } + @Override + public void openMemexUI() { + Tab currentTab = mToolbarModel.getTab(); + if (currentTab == null) return; + currentTab.loadUrl(new LoadUrlParams(CHROME_MEMEX_URL, PageTransition.AUTO_BOOKMARK)); + } + /** * Triggered when the URL input field has gained or lost focus. * @param hasFocus Whether the URL field has gained focus.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java index fb36e2d..a8d0f3a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
@@ -49,6 +49,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.compositor.Invalidator; import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost; import org.chromium.chrome.browser.device.DeviceClassManager; @@ -495,15 +496,12 @@ if (mLocationBar != null && mLocationBar.hasFocus()) return; if (mToggleTabStackButton == v) { - // The button is clickable before the native library is loaded - // and the listener is setup. - if (mToggleTabStackButton != null && mToggleTabStackButton.isClickable() - && mTabSwitcherListener != null) { - dismissTabSwitcherCallout(); - cancelAppMenuUpdateBadgeAnimation(); - mTabSwitcherListener.onClick(mToggleTabStackButton); - RecordUserAction.record("MobileToolbarShowStackView"); + if (ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + openMemexUI(); + return; } + handleToggleTabStack(); } else if (mNewTabButton == v) { v.setEnabled(false); @@ -518,8 +516,25 @@ } } + private void handleToggleTabStack() { + // The button is clickable before the native library is loaded + // and the listener is setup. + if (mToggleTabStackButton != null && mToggleTabStackButton.isClickable() + && mTabSwitcherListener != null) { + dismissTabSwitcherCallout(); + cancelAppMenuUpdateBadgeAnimation(); + mTabSwitcherListener.onClick(mToggleTabStackButton); + RecordUserAction.record("MobileToolbarShowStackView"); + } + } + @Override public boolean onLongClick(View v) { + if (v == mToggleTabStackButton && ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + handleToggleTabStack(); + return true; + } CharSequence description = null; if (v == mToggleTabStackButton) { description = getResources().getString(R.string.open_tabs);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTabController.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTabController.java index 54a58a6..b4e0a54 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTabController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTabController.java
@@ -32,4 +32,9 @@ * Opens hompage in the current tab. */ void openHomepage(); + + /** + * Opens the Memex UI in the current tab. + */ + void openMemexUI(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java index 2de979d..e8840bc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
@@ -18,6 +18,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.NavigationPopup; import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.ntp.NewTabPage; @@ -254,6 +255,12 @@ mSaveOfflineButton.setOnLongClickListener(this); mSecurityButton.setOnLongClickListener(this); + + // If Memex is enabled, enable the accessibility tab switcher button. + if (ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + onAccessibilityStatusChanged(true); + } } @Override @@ -312,6 +319,11 @@ RecordUserAction.record("MobileToolbarToggleBookmark"); } } else if (mAccessibilitySwitcherButton == v) { + if (ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + openMemexUI(); + return; + } if (mTabSwitcherListener != null) { cancelAppMenuUpdateBadgeAnimation(); mTabSwitcherListener.onClick(mAccessibilitySwitcherButton); @@ -509,6 +521,11 @@ @Override public void onAccessibilityStatusChanged(boolean enabled) { + // If Memex is enabled, don't allow the accessibility tab switcher button to be disabled. + if (!enabled && ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_MEMEX)) { + return; + } mShowTabStack = enabled; updateSwitcherButtonVisibility(enabled); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java index 4969c14..33887c1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java
@@ -30,6 +30,7 @@ import org.chromium.chrome.browser.firstrun.FirstRunUtils; import org.chromium.chrome.browser.omnibox.OmniboxPlaceholderFieldTrial; import org.chromium.chrome.browser.preferences.ChromePreferenceManager; +import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.tabmodel.DocumentModeAssassin; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.ui.base.DeviceFormFactor; @@ -244,7 +245,7 @@ } /** - * Cache whether or not Chrome Home is enabled. + * Cache whether or not Chrome Home and related features are enabled. */ public static void cacheChromeHomeEnabled() { // Chrome Home doesn't work with tablets. @@ -253,6 +254,12 @@ boolean isChromeHomeEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME); ChromePreferenceManager manager = ChromePreferenceManager.getInstance(); manager.setChromeHomeEnabled(isChromeHomeEnabled); + + PrefServiceBridge.getInstance().setChromeHomePersonalizedOmniboxSuggestionsEnabled( + !isChromeHomeEnabled() + ? false + : ChromeFeatureList.isEnabled( + ChromeFeatureList.CHROME_HOME_PERSONALIZED_OMNIBOX_SUGGESTIONS)); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java index daf6f750..f06b7c9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
@@ -17,6 +17,7 @@ import android.support.annotation.IntDef; import android.support.annotation.Nullable; import android.util.AttributeSet; +import android.util.DisplayMetrics; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -29,6 +30,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.Callback; +import org.chromium.base.ContextUtils; import org.chromium.base.ObserverList; import org.chromium.base.SysUtils; import org.chromium.base.VisibleForTesting; @@ -53,6 +55,7 @@ import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate; import org.chromium.chrome.browser.toolbar.BottomToolbarPhone; import org.chromium.chrome.browser.toolbar.ViewShiftingActionBarDelegate; +import org.chromium.chrome.browser.util.AccessibilityUtil; import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.MathUtils; import org.chromium.chrome.browser.util.ViewUtils; @@ -147,6 +150,9 @@ /** The fraction of the width of the screen that, when swiped, will cause the sheet to move. */ private static final float SWIPE_ALLOWED_FRACTION = 0.2f; + /** The threshold of application screen height for showing a tall bottom navigation bar. */ + private static final float TALL_BOTTOM_NAV_THRESHOLD_DP = 683.0f; + /** * Information about the different scroll states of the sheet. Order is important for these, * they go from smallest to largest. @@ -174,7 +180,10 @@ private final int mToolbarShadowHeight; /** The height of the bottom navigation bar that appears when the bottom sheet is expanded. */ - private final float mBottomNavHeight; + private final int mBottomNavHeight; + + /** Whether a tall bottom navigation bar should be used */ + private final boolean mUseTallBottomNav; /** The {@link BottomSheetMetrics} used to record user actions and histograms. */ private final BottomSheetMetrics mMetrics; @@ -443,9 +452,11 @@ * @return True if the touch is inside the swipable area of the toolbar. */ private boolean isTouchInSwipableXRange(MotionEvent e) { - // If the sheet is already open or the experiment is not enabled, no need to restrict the - // swipe area. - if (mActivity == null || isSheetOpen()) return true; + // If the sheet is already open, the experiment is not enabled, or accessibility is enabled + // there is no need to restrict the swipe area. + if (mActivity == null || isSheetOpen() || AccessibilityUtil.isAccessibilityEnabled()) { + return true; + } String logicType = FeatureUtilities.getChromeHomeSwipeLogicType(); @@ -490,7 +501,14 @@ mToolbarShadowHeight = getResources().getDimensionPixelOffset(R.dimen.toolbar_shadow_height); - mBottomNavHeight = getResources().getDimensionPixelSize(R.dimen.bottom_nav_height); + DisplayMetrics metrics = + ContextUtils.getApplicationContext().getResources().getDisplayMetrics(); + mUseTallBottomNav = + Float.compare(Math.max(metrics.heightPixels, metrics.widthPixels) / metrics.density, + TALL_BOTTOM_NAV_THRESHOLD_DP) + >= 0; + mBottomNavHeight = getResources().getDimensionPixelSize( + mUseTallBottomNav ? R.dimen.bottom_nav_height_tall : R.dimen.bottom_nav_height); mVelocityTracker = VelocityTracker.obtain(); @@ -707,8 +725,7 @@ getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; mBottomSheetContentContainer = (FrameLayout) findViewById(R.id.bottom_sheet_content); - mBottomSheetContentContainer.setPadding( - 0, 0, 0, (int) mBottomNavHeight - mToolbarShadowHeight); + mBottomSheetContentContainer.setPadding(0, 0, 0, mBottomNavHeight - mToolbarShadowHeight); // Listen to height changes on the root. root.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @@ -756,7 +773,7 @@ // Setting the padding is posted in a runnable for the sake of Android J. // See crbug.com/751013. final int finalPadding = - keyboardHeight + ((int) mBottomNavHeight - mToolbarShadowHeight); + keyboardHeight + (mBottomNavHeight - mToolbarShadowHeight); post(new Runnable() { @Override public void run() { @@ -1627,6 +1644,20 @@ } /** + * @return Whether a tall bottom navigation bar should be used. + */ + public boolean useTallBottomNav() { + return mUseTallBottomNav; + } + + /** + * @return The height of the bottom navigation bar. + */ + public int getBottomNavHeight() { + return mBottomNavHeight; + } + + /** * Checks whether the sheet can be moved. It cannot be moved when the activity is in overview * mode, when "find in page" is visible, or when the toolbar is hidden. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java index 5dfa513..5f4b484 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java
@@ -4,9 +4,14 @@ package org.chromium.chrome.browser.widget.bottomsheet; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; import android.app.Activity; import android.content.Context; import android.content.res.ColorStateList; +import android.graphics.PointF; +import android.graphics.drawable.Drawable; import android.support.annotation.IntDef; import android.support.annotation.Nullable; import android.util.AttributeSet; @@ -14,6 +19,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnGlobalLayoutListener; +import android.widget.FrameLayout; +import android.widget.ImageView; import org.chromium.base.ActivityState; import org.chromium.base.ApiCompatibilityUtils; @@ -34,6 +41,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.util.MathUtils; +import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.widget.ViewHighlighter; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; @@ -181,6 +189,7 @@ private Integer mHighlightItemId; private View mHighlightedView; private boolean mNavItemSelectedWhileOmniboxFocused; + private int mConsecutiveBookmarkTaps; public BottomSheetContentController(Context context, AttributeSet atts) { super(context, atts); @@ -237,8 +246,16 @@ setOnNavigationItemSelectedListener(this); hideMenuLabels(); - mSnackbarManager = new SnackbarManager( - mActivity, (ViewGroup) activity.findViewById(R.id.bottom_sheet_snackbar_container)); + ViewGroup snackbarContainer = + (ViewGroup) activity.findViewById(R.id.bottom_sheet_snackbar_container); + + if (mBottomSheet.useTallBottomNav()) { + getLayoutParams().height = mBottomSheet.getBottomNavHeight(); + ((MarginLayoutParams) snackbarContainer.getLayoutParams()).bottomMargin = + mBottomSheet.getBottomNavHeight(); + } + + mSnackbarManager = new SnackbarManager(mActivity, snackbarContainer); mSnackbarManager.onStart(); ApplicationStatus.registerStateListenerForActivity(new ActivityStateListener() { @@ -311,6 +328,13 @@ @Override public boolean onNavigationItemSelected(MenuItem item) { + mConsecutiveBookmarkTaps = + item.getItemId() == R.id.action_bookmarks ? mConsecutiveBookmarkTaps + 1 : 0; + if (mConsecutiveBookmarkTaps >= 5) { + mConsecutiveBookmarkTaps = 0; + doStarExplosion((ViewGroup) getRootView(), findViewById(R.id.action_bookmarks)); + } + if (mOmniboxHasFocus) mNavItemSelectedWhileOmniboxFocused = true; if (mBottomSheet.getSheetState() == BottomSheet.SHEET_STATE_PEEK @@ -440,4 +464,131 @@ contentIterator.remove(); } } + + /** + * Explode some stars from the center of the bookmarks icon. + * @param rootView The root view to run in. + * @param selectedItemView The item that was selected. + */ + private void doStarExplosion(ViewGroup rootView, View selectedItemView) { + if (rootView == null || selectedItemView == null) return; + + Drawable starFull = + ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.btn_star_filled); + Drawable starEmpty = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.btn_star); + + int[] outPosition = new int[2]; + ViewUtils.getRelativeDrawPosition(rootView, selectedItemView, outPosition); + + // Center the star's start position over the icon in the middle of the button. + outPosition[0] += selectedItemView.getWidth() / 2.f - starFull.getIntrinsicWidth() / 2.f; + outPosition[1] += selectedItemView.getHeight() / 2.f - starFull.getIntrinsicHeight() / 2.f; + + for (int i = 0; i < 5; i++) { + MagicStar star = new MagicStar(getContext(), outPosition[0], outPosition[1], 100 * i, + Math.random() > 0.5f ? starFull : starEmpty); + rootView.addView(star); + } + } + + /** + * This is an image view that runs a simple animation before detaching itself from the window. + */ + private static class MagicStar extends ImageView { + /** The starting position of the star. */ + private PointF mStartPosition; + + /** The direction of the star. */ + private PointF mVector; + + /** The velocity of the star. */ + private float mVelocity; + + /** The speed and direction that the star is rotating. Negative is counter-clockwise. */ + private float mRotationVelocity; + + /** The animation delay for the star. */ + private long mStartDelay; + + public MagicStar( + Context context, float startX, float startY, long startDelay, Drawable drawable) { + super(context); + + mStartPosition = new PointF(startX, startY); + mStartDelay = startDelay; + + // Fire stars within 45 degrees of 'up'. + float minAngle = (float) Math.toRadians(45.f); + float maxAngle = (float) Math.toRadians(135.f); + mVector = new PointF((float) Math.cos(getRandomInInterval(minAngle, maxAngle)), + (float) Math.sin(getRandomInInterval(minAngle, maxAngle))); + + mVelocity = getRandomInInterval(10.f, 15.f); + mRotationVelocity = getRandomInInterval(-2.f, 2.f); + + setImageDrawable(drawable); + } + + /** + * Get a random number between min and max. + * @param min The minimum value of the float. + * @param max The maximum value of the float. + * @return A random number between min and max. + */ + private float getRandomInInterval(float min, float max) { + return (float) (Math.random() * (max - min)) + min; + } + + @Override + public void onAttachedToWindow() { + super.onAttachedToWindow(); + + setAlpha(0.f); + + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight()); + setLayoutParams(params); + + setTranslationX(mStartPosition.x); + setTranslationY(mStartPosition.y); + + doAnimation(); + } + + /** + * Run the star's animation and detach it from the window when complete. + */ + private void doAnimation() { + ValueAnimator animator = ValueAnimator.ofFloat(0.f, 1.f); + animator.setDuration(500); + animator.setStartDelay(mStartDelay); + + animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + float value = (float) valueAnimator.getAnimatedValue(); + setAlpha(1.f - value); + setTranslationX(getTranslationX() - mVector.x * mVelocity); + setTranslationY(getTranslationY() - mVector.y * mVelocity); + setScaleX(0.4f + value); + setScaleY(0.4f + value); + setRotation((getRotation() + mRotationVelocity) % 360); + } + }); + + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + setAlpha(1.f); + } + + @Override + public void onAnimationEnd(Animator animation) { + ((ViewGroup) getParent()).removeView(MagicStar.this); + } + }); + + animator.start(); + } + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/ChromeHomePromoDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/ChromeHomePromoDialog.java index 3fd21f88..8cf9103 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/ChromeHomePromoDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/ChromeHomePromoDialog.java
@@ -10,7 +10,6 @@ import android.view.View; import android.widget.CompoundButton; import android.widget.Switch; -import android.widget.TextView; import org.chromium.base.ApplicationStatus; import org.chromium.chrome.R; @@ -62,25 +61,17 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final String onString = getContext().getString(R.string.text_on); - final String offString = getContext().getString(R.string.text_off); - View toggleLayout = getLayoutInflater().inflate(R.layout.chrome_home_promo_toggle, null); - final TextView toggleText = - (TextView) toggleLayout.findViewById(R.id.chrome_home_promo_state_text); Switch toggle = (Switch) toggleLayout.findViewById(R.id.chrome_home_toggle); toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean enabled) { mSwitchStateShouldEnable = enabled; - toggleText.setText(mSwitchStateShouldEnable ? onString : offString); } }); toggle.setChecked(FeatureUtilities.isChromeHomeEnabled()); - toggleText.setText(FeatureUtilities.isChromeHomeEnabled() ? onString : offString); - addControl(toggleLayout); }
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 6829f0b..bec085ed 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -1892,7 +1892,7 @@ Open <ph name="WEBAPK_NAME">%1$s<ex>Telegram</ex></ph> </message> <message name="IDS_OPEN_WEBAPK_FAILED" desc="Opening of a WebAPK failed."> - Could not launch app + Could not open app </message> <message name="IDS_MENU_ADD_TO_HOMESCREEN_INSTALL" desc="Menu item for adding a shortcut to the Home screen. [CHAR-LIMIT=27]"> Install web app @@ -1912,8 +1912,8 @@ <message name="IDS_NOTIFICATION_WEBAPK_INSTALL_IN_PROGRESS" desc="Indicates that the adding of a WebAPK is in progress."> Adding <ph name="WEBAPK_NAME">%1$s<ex>Progressive Web Apps</ex></ph>... </message> - <message name="IDS_NOTIFICATION_WEBAPK_INSTALLED" desc="Indicates that a WebAPK has been successfully added to home screen."> - Added to home screen. + <message name="IDS_NOTIFICATION_WEBAPK_INSTALLED" desc="Indicates that a WebAPK has been successfully added to Home screen."> + Added to Home screen </message> <!-- PageInfoPopup (PageInfo dialog) --> @@ -2172,8 +2172,8 @@ <message name="IDS_DOWNLOAD_MANAGER_NO_RESULTS" desc="Text explaining that no download items matched a search query."> No downloads found </message> - <message name="IDS_DOWNLOAD_MANAGER_OFFLINE_HEADER_TITLE" desc="Text explaining the number of suggested offline pages."> - <ph name="NUMBER_OF_SUGGESTIONS">%1$s<ex>10</ex></ph> Chrome suggestions + <message name="IDS_DOWNLOAD_MANAGER_OFFLINE_HEADER_TITLE" desc="The title for suggested offline pages header."> + Popular pages from Chrome </message> <message name="IDS_DOWNLOAD_MANAGER_OFFLINE_HEADER_DESCRIPTION" desc="Text containing the offline pages description."> Pages updated regularly @@ -2394,8 +2394,8 @@ <message name="IDS_ACCESSIBILITY_NTP_OFFLINE_BADGE" desc="Content description for the badge that indicates offline availability of a most visited item or content suggestion on the new tab page."> Available offline </message> - <message name="IDS_NTP_CHROME_HOME_PROMO" desc="Text below the search box on the New Tab Page that encourages the user to try Chrome Home. Part of the text is a link to open the promo dialog."> - Be the first to <ph name="BEGIN_LINK"><link></ph>try the new Chrome<ph name="END_LINK"></link></ph> + <message name="IDS_NTP_CHROME_HOME_PROMO" desc="Tappable line of text that appears when a user opens a new tab in Chrome. This text is promotional and is intended to suggest that users try a new feature called “Chrome Home” (which is a placeholder name, official naming is underway; for now, do not translate the feature name). When tapped, a dialog explaining the feature opens. “Try” is imperative. “To browse” (infinitive) means to browse the web."> + Try an <ph name="BEGIN_LINK"><link></ph>easier way to browse<ph name="END_LINK"></link></ph> </message> <message name="IDS_NTP_LEARN_MORE_ABOUT_SUGGESTED_CONTENT" desc="Text in the footer of the New Tab Page. Part of the text is a link to a help center page where the user can learn more about suggested content."> <ph name="BEGIN_LINK"><link></ph>Learn more<ph name="END_LINK"></link></ph> about suggested content @@ -3211,14 +3211,17 @@ <message name="IDS_BOTTOM_SHEET_APP_MENU_IPH" desc="Label for in-product help that appears in the Chrome three-dot menu (navigation menu). In previous versions of Chrome, the menu contained Bookmarks, Downloads, and History. In this version of Chrome, these three items have been moved out of the menu. Tapping this help text will show the user where they can find these three items. 'Bookmarks', 'Downloads', and 'History' should use the same translations as in Chrome settings and menu items. The tone of this string is that of the user asking Chrome, 'where are these 3 things?'"> Where are bookmarks, downloads, and history? </message> - <message name="IDS_CHROME_HOME_PROMO_DIALOG_TITLE" desc="The title for the dialog promoting the Chrome Home feature."> - Try the new Chrome + <message name="IDS_CHROME_HOME_PROMO_DIALOG_TITLE" desc="Dialog title text. Dialog describes a new feature called “Chrome Home” (which is a placeholder name, official naming is underway; for now, do not translate the feature name). Object is omitted; intended meaning is that we wish to introduce you, the user, to Chrome Home. Infinitive or other verb form may be used if the gerund is not appropriate in your language. "> + Introducing Chrome Home </message> - <message name="IDS_CHROME_HOME_PROMO_DIALOG_MESSAGE" desc="The message for the dialog promoting the Chrome Home feature. The message emphasizes the fact that both appearance and functionality have been updated."> - One swipe access to your shortcuts and bookmarks with a fresh new look. + <message name="IDS_CHROME_HOME_PROMO_DIALOG_MESSAGE" desc="Dialog body text. Dialog describes a new feature called “Chrome Home” (which is a placeholder name, official naming is underway; for now, do not translate the feature name). “Swipe up” (imperative) refers to the gesture on a mobile phone. “access” is a noun. “Popular” modifies both “sites and articles.” “Downloads” refers to items the user has downloaded in Chrome."> + Swipe up for easy access to popular sites and articles, downloads, and more </message> - <message name="IDS_CHROME_HOME_PROMO_DIALOG_CHANGE_LATER" desc="The message beside the toggle that would enable or disable the Chrome Home feature. This string is used to indicate that the user may change the setting later."> - (You can change this later) + <message name="IDS_CHROME_HOME_PROMO_DIALOG_CHANGE_LATER" desc="Dialog toggle/switch label. Dialog describes a new feature called “Chrome Home” ( which is a placeholder name; official naming is underway; for now, do not translate the feature name). Toggle is ON by default."> + Use Chrome Home + </message> + <message name="IDS_CHROME_HOME_OPT_OUT_MENU_ITEM" desc="Item that appears at the top Chrome options menu on mobile. Describes a new feature called “Chrome Home” (which is a placeholder name; official naming is underway; for now, do not translate the feature name). Gerund is used to indicate the current state, e.g. you are now using Chrome Home. Tapping this item opens a dialog that allows the user to turn off the Chrome Home feature."> + You're using Chrome Home </message> <!-- Photo picker -->
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 3a6ed550..53c328b 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -131,6 +131,9 @@ "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java", "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java", "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsService.java", + "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabCreatorManager.java", + "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabModelSelector.java", + "java/src/org/chromium/chrome/browser/browseractions/BrowserActionsTabPersistencePolicy.java", "java/src/org/chromium/chrome/browser/browserservices/BrowserSessionContentHandler.java", "java/src/org/chromium/chrome/browser/browserservices/BrowserSessionContentUtils.java", "java/src/org/chromium/chrome/browser/browserservices/BrowserSessionDataProvider.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java index cecbf4ff..b46fccc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java
@@ -18,7 +18,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.R; import org.chromium.chrome.browser.infobar.InfoBar; @@ -81,7 +80,6 @@ @Test @MediumTest @Feature({"Popup"}) - @FlakyTest(message = "crbug.com/733365") public void testPopupWindowsAppearWhenAllowed() throws Exception { final TabModelSelector selector = mActivityTestRule.getActivity().getTabModelSelector(); @@ -108,11 +106,11 @@ @Override public boolean isSatisfied() { if (getNumInfobarsShowing() != 0) return false; - return TextUtils.equals("Three", selector.getCurrentTab().getTitle()); + return TextUtils.equals("Two", selector.getCurrentTab().getTitle()); } }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); - Assert.assertEquals(4, selector.getTotalTabCount()); + Assert.assertEquals(3, selector.getTotalTabCount()); int currentTabId = selector.getCurrentTab().getId(); // Test that revisiting the original page makes popup windows immediately. @@ -121,8 +119,8 @@ @Override public boolean isSatisfied() { if (getNumInfobarsShowing() != 0) return false; - if (selector.getTotalTabCount() != 7) return false; - return TextUtils.equals("Three", selector.getCurrentTab().getTitle()); + if (selector.getTotalTabCount() != 5) return false; + return TextUtils.equals("Two", selector.getCurrentTab().getTitle()); } }, 7500, CriteriaHelper.DEFAULT_POLLING_INTERVAL); Assert.assertNotSame(currentTabId, selector.getCurrentTab().getId());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browseractions/BrowserActionActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browseractions/BrowserActionActivityTest.java index 4a3fb97..5589fa8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browseractions/BrowserActionActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browseractions/BrowserActionActivityTest.java
@@ -13,6 +13,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.os.StrictMode; import android.support.customtabs.browseractions.BrowserActionsIntent; import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; @@ -38,6 +39,10 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; import org.chromium.chrome.browser.firstrun.FirstRunStatus; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; +import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; +import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.util.IntentUtils; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -48,6 +53,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Callable; /** * Instrumentation tests for context menu of a {@link BrowserActionActivity}. @@ -65,10 +71,13 @@ private final CallbackHelper mOnOpenTabInBackgroundStartCallback = new CallbackHelper(); private final CallbackHelper mOnDownloadStartCallback = new CallbackHelper(); + private final CallbackHelper mDidAddTabCallback = new CallbackHelper(); + private SparseArray<PendingIntent> mCustomActions; private List<Pair<Integer, List<ContextMenuItem>>> mItems; private ProgressDialog mProgressDialog; private TestDelegate mTestDelegate; + private TabModelObserver mTestObserver; private EmbeddedTestServer mTestServer; private String mTestPage; private String mTestPage2; @@ -119,6 +128,12 @@ } }); mTestDelegate = new TestDelegate(); + mTestObserver = new EmptyTabModelObserver() { + @Override + public void didAddTab(Tab tab, TabLaunchType type) { + mDidAddTabCallback.notifyCalled(); + } + }; Context appContext = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getApplicationContext(); @@ -222,23 +237,10 @@ Assert.assertFalse(BrowserActionsService.hasBrowserActionsNotification()); // Open a tab in the background. - ThreadUtils.runOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - activity.getHelperForTesting().onItemSelected( - R.id.browser_actions_open_in_background); - } - }); - + openTabInBackground(activity); // Notification for single tab should be shown. - CriteriaHelper.pollUiThread(new Criteria() { - @Override - public boolean isSatisfied() { - return BrowserActionsService.hasBrowserActionsNotification(); - } - }); Assert.assertEquals(R.string.browser_actions_single_link_open_notification_title, - BrowserActionsService.getTitleRestId()); + BrowserActionsService.getTitleResId()); // Tabs should always be added at the end of the model. Assert.assertEquals(2, mActivityTestRule.getActivity().getCurrentTabModel().getCount()); @@ -277,42 +279,22 @@ mOnFinishNativeInitializationCallback.waitForCallback(0); Assert.assertEquals(1, mActivityTestRule.getActivity().getCurrentTabModel().getCount()); Assert.assertFalse(BrowserActionsService.hasBrowserActionsNotification()); - ThreadUtils.runOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - activity1.getHelperForTesting().onItemSelected( - R.id.browser_actions_open_in_background); - } - }); - // Preferences should update a Tab is created and notification title should be for single - // tab. - CriteriaHelper.pollUiThread(new Criteria() { - @Override - public boolean isSatisfied() { - return BrowserActionsService.hasBrowserActionsNotification(); - } - }); + openTabInBackground(activity1); Assert.assertEquals(R.string.browser_actions_single_link_open_notification_title, - BrowserActionsService.getTitleRestId()); + BrowserActionsService.getTitleResId()); final BrowserActionActivity activity2 = startBrowserActionActivity(mTestPage3, 1); mOnBrowserActionsMenuShownCallback.waitForCallback(1); mOnFinishNativeInitializationCallback.waitForCallback(1); Assert.assertEquals(2, mActivityTestRule.getActivity().getCurrentTabModel().getCount()); - ThreadUtils.runOnUiThreadBlocking(new Runnable() { - @Override - public void run() { - activity2.getHelperForTesting().onItemSelected( - R.id.browser_actions_open_in_background); - } - }); + openTabInBackground(activity2); // Notification title should be shown for multiple tabs. CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { return R.string.browser_actions_multi_links_open_notification_title - == BrowserActionsService.getTitleRestId(); + == BrowserActionsService.getTitleResId(); } }); @@ -343,6 +325,99 @@ } } + @Test + @SmallTest + public void testOpenSingleTabInBackgroundWhenChromeNotAvailable() throws Exception { + // Load Browser Actions menu completely. + final BrowserActionActivity activity = startBrowserActionActivity(mTestPage); + mOnBrowserActionsMenuShownCallback.waitForCallback(0); + mOnFinishNativeInitializationCallback.waitForCallback(0); + // No notification should be shown. + Assert.assertFalse(BrowserActionsService.hasBrowserActionsNotification()); + + BrowserActionsTabModelSelector selector = + ThreadUtils.runOnUiThreadBlocking(new Callable<BrowserActionsTabModelSelector>() { + @Override + public BrowserActionsTabModelSelector call() { + return BrowserActionsTabModelSelector.getInstance(); + } + }); + // Open a tab in the background. + selector.getModel(false).addObserver(mTestObserver); + openTabInBackground(activity); + Assert.assertEquals(R.string.browser_actions_single_link_open_notification_title, + BrowserActionsService.getTitleResId()); + mDidAddTabCallback.waitForCallback(0); + // New tab should be added to the BrowserActionTabModelSelector. + Assert.assertEquals(1, selector.getCurrentModel().getCount()); + Assert.assertEquals(mTestPage, selector.getCurrentModel().getTabAt(0).getUrl()); + } + + @Test + @SmallTest + public void testOpenMultipleTabsInBackgroundWhenChromeNotAvailable() throws Exception { + // Load Browser Actions menu completely and open a tab in the background. + final BrowserActionActivity activity1 = startBrowserActionActivity(mTestPage); + mOnBrowserActionsMenuShownCallback.waitForCallback(0); + mOnFinishNativeInitializationCallback.waitForCallback(0); + + BrowserActionsTabModelSelector selector = + ThreadUtils.runOnUiThreadBlocking(new Callable<BrowserActionsTabModelSelector>() { + @Override + public BrowserActionsTabModelSelector call() { + return BrowserActionsTabModelSelector.getInstance(); + } + }); + selector.getModel(false).addObserver(mTestObserver); + openTabInBackground(activity1); + Assert.assertEquals(R.string.browser_actions_single_link_open_notification_title, + BrowserActionsService.getTitleResId()); + mDidAddTabCallback.waitForCallback(0); + Assert.assertEquals(1, selector.getCurrentModel().getCount()); + + // Load Browser Actions menu again and open another tab in the background. + final BrowserActionActivity activity2 = startBrowserActionActivity(mTestPage2, 1); + mOnBrowserActionsMenuShownCallback.waitForCallback(1); + mOnFinishNativeInitializationCallback.waitForCallback(1); + openTabInBackground(activity2); + // Notification title should be shown for multiple tabs. + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return R.string.browser_actions_multi_links_open_notification_title + == BrowserActionsService.getTitleResId(); + } + }); + + // BrowserActionTabModelSelector should have two tabs and tabs should be added sequentially. + mDidAddTabCallback.waitForCallback(1); + Assert.assertEquals(2, selector.getCurrentModel().getCount()); + Assert.assertEquals(mTestPage, selector.getCurrentModel().getTabAt(0).getUrl()); + Assert.assertEquals(mTestPage2, selector.getCurrentModel().getTabAt(1).getUrl()); + } + + private void openTabInBackground(BrowserActionActivity activity) { + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); + try { + activity.getHelperForTesting().onItemSelected( + R.id.browser_actions_open_in_background); + } finally { + StrictMode.setThreadPolicy(oldPolicy); + } + } + }); + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + return BrowserActionsService.hasBrowserActionsNotification() + && BrowserActionsService.isBackgroundService(); + } + }); + } + private BrowserActionActivity startBrowserActionActivity(String url) throws Exception { return startBrowserActionActivity(url, 0); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java index b0b0515..83b7434 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java
@@ -158,8 +158,10 @@ mTimestamp = System.currentTimeMillis() - 5 * DateUtils.MINUTE_IN_MILLIS; - FeatureUtilities.resetChromeHomeEnabledForTests(); - FeatureUtilities.cacheChromeHomeEnabled(); + ThreadUtils.runOnUiThreadBlocking(() -> { + FeatureUtilities.resetChromeHomeEnabledForTests(); + FeatureUtilities.cacheChromeHomeEnabled(); + }); assertThat(FeatureUtilities.isChromeHomeEnabled(), is(mChromeHomeEnabled));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java index 7371660..c17c7783 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetCardsUiCaptureTest.java
@@ -18,9 +18,11 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ntp.NtpUiCaptureTestData; import org.chromium.chrome.browser.ntp.cards.ItemViewType; import org.chromium.chrome.browser.ntp.snippets.CategoryStatus; @@ -41,6 +43,7 @@ */ @RunWith(ChromeJUnit4ClassRunner.class) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones +@CommandLineFlags.Add({"disable-features=" + ChromeFeatureList.CONTENT_SUGGESTIONS_SCROLL_TO_LOAD}) public class HomeSheetCardsUiCaptureTest { @Rule public SuggestionsBottomSheetTestRule mActivityRule = new SuggestionsBottomSheetTestRule();
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 1276886d..fb04bb7 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7572,10 +7572,17 @@ <message name="IDS_COLLECTED_COOKIES_ALLOW_BUTTON" desc="A button that lets the use create a content settings exception to allow certain domains."> Allow </message> - <message name="IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON" desc="A button that lets the use create a content settings exception to allow certain domains for a session only. Please consider that this text will be displayed as a button when translating."> - Clear on exit - </message> - <message name="IDS_COLLECTED_COOKIES_BLOCK_BUTTON" desc="A button that lets the use create a content settings exception to block certain domains."> + <if expr="use_titlecase"> + <message name="IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON" desc="Text of the button used to clear cookies from a specified domain when the browser exits."> + Clear On Exit + </message> + </if> + <if expr="not use_titlecase"> + <message name="IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON" desc="Text of the button used to clear cookies from a specified domain when the browser exits."> + Clear on exit + </message> + </if> + <message name="IDS_COLLECTED_COOKIES_BLOCK_BUTTON" desc="Text of the button used to block cookies from a specified domain."> Block </message> <message name="IDS_COLLECTED_COOKIES_ALLOW_RULE_CREATED" desc="A notification that is displayed when a content exception to allow cookies was created.">
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index b95eae4..99077b32 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -245,6 +245,8 @@ "chrome_quota_permission_context.h", "chrome_service.cc", "chrome_service.h", + "client_hints/client_hints.cc", + "client_hints/client_hints.h", "client_hints/client_hints_observer.cc", "client_hints/client_hints_observer.h", "command_observer.h", @@ -3237,6 +3239,10 @@ sources += [ "signin/dice_response_handler.cc", "signin/dice_response_handler.h", + "signin/dice_tab_helper.cc", + "signin/dice_tab_helper.h", + "signin/process_dice_header_observer_impl.cc", + "signin/process_dice_header_observer_impl.h", ] }
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 709f2cf..15b961e 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1947,9 +1947,17 @@ flag_descriptions::kChromeHomeExpandButtonName, flag_descriptions::kChromeHomeExpandButtonDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kChromeHomeExpandButton)}, + {"enable-chrome-home-personalized-omnibox-suggestions", + flag_descriptions::kChromeHomePersonalizedOmniboxSuggestionsName, + flag_descriptions::kChromeHomePersonalizedOmniboxSuggestionsDescription, + kOsAndroid, + FEATURE_VALUE_TYPE(omnibox::kAndroidChromeHomePersonalizedSuggestions)}, {"chrome-home-swipe-logic", flag_descriptions::kChromeHomeSwipeLogicName, flag_descriptions::kChromeHomeSwipeLogicDescription, kOsAndroid, MULTI_VALUE_TYPE(kChromeHomeSwipeLogicChoices)}, + {"enable-chrome-memex", flag_descriptions::kChromeMemexName, + flag_descriptions::kChromeMemexDescription, kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kChromeMemexFeature)}, #endif // OS_ANDROID {"in-product-help-demo-mode-choice", flag_descriptions::kInProductHelpDemoModeChoiceName, @@ -3528,6 +3536,11 @@ FEATURE_VALUE_TYPE(features::kAsyncDns)}, #endif // defined(OS_ANDROID) + {"enable-overflow-icons-for-media-controls", + flag_descriptions::kOverflowIconsForMediaControlsName, + flag_descriptions::kOverflowIconsForMediaControlsDescription, kOsAll, + FEATURE_VALUE_TYPE(media::kOverflowIconsForMediaControls)}, + // NOTE: Adding new command-line switches requires adding corresponding // entries to enum "LoginCustomFlags" in histograms/enums.xml. See note in // enums.xml and don't forget to run AboutFlagsHistogramTest unit test.
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 9c7edea..a09e3c21 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -18,6 +18,7 @@ #include "components/ntp_snippets/features.h" #include "components/ntp_tiles/constants.h" #include "components/offline_pages/core/offline_page_feature.h" +#include "components/omnibox/browser/omnibox_field_trial.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/payments/core/features.h" #include "components/subresource_filter/core/browser/subresource_filter_features.h" @@ -63,6 +64,7 @@ &kChromeHomeExpandButton, &kChromeHomePromo, &kChromeHomeSwipeLogic, + &kChromeMemexFeature, &kContentSuggestionsLargeThumbnail, &kContentSuggestionsScrollToLoad, &kContentSuggestionsSettings, @@ -119,6 +121,7 @@ &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. &offline_pages::kOfflinePagesCTV2Feature, // See crbug.com/734753. &offline_pages::kOfflinePagesSharingFeature, + &omnibox::kAndroidChromeHomePersonalizedSuggestions, &password_manager::features::kViewPasswords, &subresource_filter::kSafeBrowsingSubresourceFilterExperimentalUI, }; @@ -178,6 +181,9 @@ const base::Feature kChromeHomeSwipeLogic{"ChromeHomeSwipeLogic", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kChromeMemexFeature{"ChromeMemex", + base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kContentSuggestionsLargeThumbnail{ "ContentSuggestionsLargeThumbnail", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h index 4a1fdfa7..7092cca 100644 --- a/chrome/browser/android/chrome_feature_list.h +++ b/chrome/browser/android/chrome_feature_list.h
@@ -27,6 +27,7 @@ extern const base::Feature kChromeHomeExpandButton; extern const base::Feature kChromeHomePromo; extern const base::Feature kChromeHomeSwipeLogic; +extern const base::Feature kChromeMemexFeature; extern const base::Feature kContentSuggestionsLargeThumbnail; extern const base::Feature kContentSuggestionsScrollToLoad; extern const base::Feature kContentSuggestionsSettings;
diff --git a/chrome/browser/android/download/download_controller.cc b/chrome/browser/android/download/download_controller.cc index 599dded..1f588cb 100644 --- a/chrome/browser/android/download/download_controller.cc +++ b/chrome/browser/android/download/download_controller.cc
@@ -463,7 +463,7 @@ void DownloadController::StartContextMenuDownload( const ContextMenuParams& params, WebContents* web_contents, bool is_link, const std::string& extra_headers) { - int process_id = web_contents->GetRenderProcessHost()->GetID(); + int process_id = web_contents->GetRenderViewHost()->GetProcess()->GetID(); int routing_id = web_contents->GetRenderViewHost()->GetRoutingID(); const content::ResourceRequestInfo::WebContentsGetter& wc_getter(
diff --git a/chrome/browser/android/net/OWNERS b/chrome/browser/android/net/OWNERS index c3dd3cc..adcf030 100644 --- a/chrome/browser/android/net/OWNERS +++ b/chrome/browser/android/net/OWNERS
@@ -1,4 +1,4 @@ file://net/nqe/OWNERS -# TEAM: nqe-dev@chromium.org +# TEAM: net-dev@chromium.org # COMPONENT: Internals>Network>NetworkQuality
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc index 2bed458..61c41d19 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
@@ -613,7 +613,8 @@ if (!profile) return; - if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) + if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + profile->GetPrefs())) return; // ZeroSuggestPrefetcher deletes itself after it's done prefetching.
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc index 931969e8..3e6d14d1 100644 --- a/chrome/browser/android/preferences/pref_service_bridge.cc +++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -40,6 +40,7 @@ #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/pref_names.h" #include "components/metrics/metrics_pref_names.h" +#include "components/omnibox/browser/omnibox_pref_names.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/common/safe_browsing_prefs.h" @@ -1019,3 +1020,11 @@ GetPrefService()->SetString(prefs::kSupervisedUserId, ConvertJavaStringToUTF8(env, pref)); } + +static void SetChromeHomePersonalizedOmniboxSuggestionsEnabled( + JNIEnv* env, + const JavaParamRef<jobject>& obj, + jboolean is_enabled) { + GetPrefService()->SetBoolean(omnibox::kZeroSuggestChromeHomePersonalized, + is_enabled); +}
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc index e1b29a94..974ea69 100644 --- a/chrome/browser/android/tab_android.cc +++ b/chrome/browser/android/tab_android.cc
@@ -468,7 +468,7 @@ // during shutdown. See https://codereview.chromium.org/146693011/ // and http://crbug.com/338709 for details. content::RenderProcessHost* process = - web_contents()->GetRenderProcessHost(); + web_contents()->GetMainFrame()->GetProcess(); if (process) process->FastShutdownIfPossible(1, false);
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc index 0bdc5d9..b39c4fa 100644 --- a/chrome/browser/android/tab_web_contents_delegate_android.cc +++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -26,6 +26,7 @@ #include "chrome/browser/ui/android/bluetooth_chooser_android.h" #include "chrome/browser/ui/android/infobars/framebust_block_infobar.h" #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" +#include "chrome/browser/ui/blocked_content/popup_tracker.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h" #include "chrome/browser/ui/interventions/framebust_block_message_delegate.h" @@ -386,6 +387,11 @@ // Can't create a new contents for the current tab - invalid case. DCHECK_NE(disposition, WindowOpenDisposition::CURRENT_TAB); + // At this point the |new_contents| is beyond the popup blocker, but we use + // the same logic for determining if the popup tracker needs to be attached. + if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition)) + PopupTracker::CreateForWebContents(new_contents, source); + TabHelpers::AttachTabHelpers(new_contents); JNIEnv* env = AttachCurrentThread();
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 9707c409..df6808e 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -522,7 +522,6 @@ <include name="IDR_ECHO_MANIFEST" file="resources\chromeos\echo\manifest.json" type="BINDATA" /> <include name="IDR_MERGE_SESSION_LOAD_HTML" file="resources\chromeos\merge_session_load.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_OS_CREDITS_HTML" file="resources\chromeos\about_os_credits.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_PROXY_SETTINGS_HTML" file="resources\chromeos\proxy_settings.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_INTERNET_DETAIL_DIALOG_HTML" file="resources\chromeos\internet_detail_dialog.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" /> <include name="IDR_INTERNET_DETAIL_DIALOG_JS" file="resources\chromeos\internet_detail_dialog.js" type="chrome_html" /> <include name="IDR_CERT_MANAGER_DIALOG_HTML" file="resources\chromeos\certificate_manager_dialog.html" flattenhtml="true" type="BINDATA" />
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 1454229..60280fa 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -42,6 +42,7 @@ #include "chrome/browser/chrome_content_browser_client_parts.h" #include "chrome/browser/chrome_quota_permission_context.h" #include "chrome/browser/chrome_service.h" +#include "chrome/browser/client_hints/client_hints.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" @@ -1888,6 +1889,14 @@ return prefs && prefs->GetBoolean(prefs::kDataSaverEnabled); } +std::unique_ptr<net::HttpRequestHeaders> +ChromeContentBrowserClient::GetAdditionalNavigationRequestHeaders( + content::BrowserContext* context, + const GURL& url) const { + return client_hints::GetAdditionalNavigationRequestClientHintsHeaders(context, + url); +} + bool ChromeContentBrowserClient::AllowAppCache( const GURL& manifest_url, const GURL& first_party,
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index dc08593c..6a32f57 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -148,6 +148,9 @@ std::string GetAcceptLangs(content::BrowserContext* context) override; const gfx::ImageSkia* GetDefaultFavicon() override; bool IsDataSaverEnabled(content::BrowserContext* context) override; + std::unique_ptr<net::HttpRequestHeaders> + GetAdditionalNavigationRequestHeaders(content::BrowserContext* context, + const GURL& url) const override; bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, content::ResourceContext* context) override;
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 94ca4e4..00dcb13 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -336,6 +336,8 @@ "arc/cast_receiver/arc_cast_receiver_service.h", "arc/downloads_watcher/arc_downloads_watcher_service.cc", "arc/downloads_watcher/arc_downloads_watcher_service.h", + "arc/enterprise/arc_cert_store_bridge.cc", + "arc/enterprise/arc_cert_store_bridge.h", "arc/enterprise/arc_enterprise_reporting_service.cc", "arc/enterprise/arc_enterprise_reporting_service.h", "arc/extensions/arc_support_message_host.cc", @@ -1054,6 +1056,8 @@ "login/ui/captive_portal_window_proxy.h", "login/ui/input_events_blocker.cc", "login/ui/input_events_blocker.h", + "login/ui/internet_detail_dialog.cc", + "login/ui/internet_detail_dialog.h", "login/ui/login_display.cc", "login/ui/login_display.h", "login/ui/login_display_host.cc", @@ -1068,8 +1072,6 @@ "login/ui/preloaded_web_view.h", "login/ui/preloaded_web_view_factory.cc", "login/ui/preloaded_web_view_factory.h", - "login/ui/proxy_settings_dialog.cc", - "login/ui/proxy_settings_dialog.h", "login/ui/simple_web_view_dialog.cc", "login/ui/simple_web_view_dialog.h", "login/ui/user_adding_screen.cc",
diff --git a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc index 353f722..f435677 100644 --- a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h" +#include <memory> #include <unordered_map> #include <utility> @@ -58,12 +59,12 @@ ArcAccessibilityHelperBridgeTest() = default; void SetUp() override { - wm_helper_ = base::MakeUnique<FakeWMHelper>(); + wm_helper_ = std::make_unique<FakeWMHelper>(); exo::WMHelper::SetInstance(wm_helper_.get()); - testing_profile_ = base::MakeUnique<TestingProfile>(); - bridge_service_ = base::MakeUnique<ArcBridgeService>(); + testing_profile_ = std::make_unique<TestingProfile>(); + bridge_service_ = std::make_unique<ArcBridgeService>(); accessibility_helper_bridge_ = - base::MakeUnique<ArcAccessibilityHelperBridge>(testing_profile_.get(), + std::make_unique<ArcAccessibilityHelperBridge>(testing_profile_.get(), bridge_service_.get()); }
diff --git a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc index e0011661..78ffadd5 100644 --- a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc +++ b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc
@@ -4,10 +4,11 @@ #include "chrome/browser/chromeos/arc/arc_migration_guide_notification.h" +#include <memory> + #include "ash/resources/vector_icons/vector_icons.h" #include "ash/system/power/power_status.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/app/vector_icons/vector_icons.h" @@ -56,7 +57,7 @@ void DoShowArcMigrationSuccessNotification( const message_center::NotifierId& notifier_id) { message_center::MessageCenter::Get()->AddNotification( - base::MakeUnique<message_center::Notification>( + std::make_unique<message_center::Notification>( message_center::NOTIFICATION_TYPE_SIMPLE, kSuccessNotificationId, base::string16(), // title l10n_util::GetStringUTF16(IDS_ARC_MIGRATE_ENCRYPTION_SUCCESS_MESSAGE), @@ -109,7 +110,7 @@ data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_RESTART_BUTTON))); message_center::MessageCenter::Get()->AddNotification( - base::MakeUnique<message_center::Notification>( + std::make_unique<message_center::Notification>( message_center::NOTIFICATION_TYPE_SIMPLE, kSuggestNotificationId, l10n_util::GetStringUTF16( IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE),
diff --git a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc index fa8d0cd..3339f83 100644 --- a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc +++ b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc
@@ -138,7 +138,7 @@ return; } - auth_notification_ = base::MakeUnique<ArcAuthNotification>(profile_); + auth_notification_ = std::make_unique<ArcAuthNotification>(profile_); } } // namespace arc
diff --git a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h index be636e6e..ce5dc67 100644 --- a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h +++ b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER_H_ #define CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER_H_ +#include <memory> + #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "components/prefs/pref_change_registrar.h"
diff --git a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler_unittest.cc b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler_unittest.cc index a13d70f0..6c386ea 100644 --- a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler_unittest.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/files/scoped_temp_dir.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/chromeos/arc/arc_auth_notification.h" @@ -38,7 +37,7 @@ void SetUp() override { chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( - base::MakeUnique<chromeos::FakeSessionManagerClient>()); + std::make_unique<chromeos::FakeSessionManagerClient>()); chromeos::DBusThreadManager::Initialize(); SetArcAvailableCommandLineForTesting( @@ -52,10 +51,10 @@ profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); profile_ = profile_builder.Build(); - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); preference_handler_ = - base::MakeUnique<ArcPlayStoreEnabledPreferenceHandler>( + std::make_unique<ArcPlayStoreEnabledPreferenceHandler>( profile_.get(), arc_session_manager_.get()); const AccountId account_id(AccountId::FromUserEmailGaiaId( profile()->GetProfileUserName(), "1234567890")); @@ -131,7 +130,7 @@ TEST_F(ArcPlayStoreEnabledPreferenceHandlerTest, RemoveDataDir_Managed) { // Set ARC to be managed and disabled. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcEnabled, std::make_unique<base::Value>(false)); // Starting session manager with prefs::kArcEnabled off in a managed profile // does automatically remove Android's data folder.
diff --git a/chrome/browser/chromeos/arc/arc_service_launcher.cc b/chrome/browser/chromeos/arc/arc_service_launcher.cc index 9104ca1..476b2ee 100644 --- a/chrome/browser/chromeos/arc/arc_service_launcher.cc +++ b/chrome/browser/chromeos/arc/arc_service_launcher.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h" #include "chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h" #include "chrome/browser/chromeos/arc/arc_session_manager.h" @@ -18,6 +17,7 @@ #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h" #include "chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.h" #include "chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h" +#include "chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h" #include "chrome/browser/chromeos/arc/enterprise/arc_enterprise_reporting_service.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.h" @@ -67,9 +67,9 @@ } // namespace ArcServiceLauncher::ArcServiceLauncher() - : arc_service_manager_(base::MakeUnique<ArcServiceManager>()), - arc_session_manager_(base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>( + : arc_service_manager_(std::make_unique<ArcServiceManager>()), + arc_session_manager_(std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>( base::Bind(ArcSession::Create, arc_service_manager_->arc_bridge_service())))) { DCHECK(g_arc_service_launcher == nullptr); @@ -136,6 +136,7 @@ ArcBootErrorNotification::GetForBrowserContext(profile); ArcBootPhaseMonitorBridge::GetForBrowserContext(profile); ArcCastReceiverService::GetForBrowserContext(profile); + ArcCertStoreBridge::GetForBrowserContext(profile); ArcClipboardBridge::GetForBrowserContext(profile); ArcCrashCollectorBridge::GetForBrowserContext(profile); ArcDownloadsWatcherService::GetForBrowserContext(profile); @@ -169,7 +170,7 @@ arc_session_manager_->Initialize(); arc_play_store_enabled_preference_handler_ = - base::MakeUnique<ArcPlayStoreEnabledPreferenceHandler>( + std::make_unique<ArcPlayStoreEnabledPreferenceHandler>( profile, arc_session_manager_.get()); arc_play_store_enabled_preference_handler_->Start(); } @@ -188,8 +189,8 @@ // No recreation of arc_service_manager. Pointers to its ArcBridgeService // may be referred from existing KeyedService, so destoying it would cause // unexpected behavior, specifically on test teardown. - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind( + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind( ArcSession::Create, arc_service_manager_->arc_bridge_service()))); }
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc index 052c9af3..9e3766f9 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -10,7 +10,6 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/strings/string16.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -306,7 +305,7 @@ (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_) && AreArcAllOptInPreferencesIgnorableForProfile(profile_)); if (!suppress_play_store_app) { - playstore_launcher_ = base::MakeUnique<ArcAppLauncher>( + playstore_launcher_ = std::make_unique<ArcAppLauncher>( profile_, kPlayStoreAppId, GetLaunchIntent(kPlayStorePackage, kPlayStoreActivity, {kInitialStartParam}), @@ -414,7 +413,7 @@ if (!g_disable_ui_for_testing && !IsArcOptInVerificationDisabled() && !IsArcKioskMode()) { DCHECK(!support_host_); - support_host_ = base::MakeUnique<ArcSupportHost>(profile_); + support_host_ = std::make_unique<ArcSupportHost>(profile_); support_host_->SetErrorDelegate(this); } data_remover_ = std::make_unique<ArcDataRemover>( @@ -422,7 +421,7 @@ cryptohome::Identification( multi_user_util::GetAccountIdFromProfile(profile_))); - context_ = base::MakeUnique<ArcAuthContext>(profile_); + context_ = std::make_unique<ArcAuthContext>(profile_); if (!g_disable_ui_for_testing || g_enable_check_android_management_for_testing) { @@ -514,11 +513,6 @@ observer.OnArcPlayStoreEnabledChanged(enabled); } -bool ArcSessionManager::IsSessionRunning() const { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - return arc_session_runner_->IsRunning(); -} - bool ArcSessionManager::IsSessionStopped() const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); return arc_session_runner_->IsStopped(); @@ -731,7 +725,7 @@ // Move to RequestEnabledImpl. if (!scoped_opt_in_tracker_ && !profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { - scoped_opt_in_tracker_ = base::MakeUnique<ScopedOptInFlowTracker>(); + scoped_opt_in_tracker_ = std::make_unique<ScopedOptInFlowTracker>(); } if (!IsArcTermsOfServiceNegotiationNeeded()) { @@ -744,11 +738,11 @@ if (IsOobeOptInActive()) { VLOG(1) << "Use OOBE negotiator."; terms_of_service_negotiator_ = - base::MakeUnique<ArcTermsOfServiceOobeNegotiator>(); + std::make_unique<ArcTermsOfServiceOobeNegotiator>(); } else if (support_host_) { VLOG(1) << "Use default negotiator."; terms_of_service_negotiator_ = - base::MakeUnique<ArcTermsOfServiceDefaultNegotiator>( + std::make_unique<ArcTermsOfServiceDefaultNegotiator>( profile_->GetPrefs(), support_host_.get()); } @@ -833,7 +827,7 @@ if (g_disable_ui_for_testing) return; - android_management_checker_ = base::MakeUnique<ArcAndroidManagementChecker>( + android_management_checker_ = std::make_unique<ArcAndroidManagementChecker>( profile_, context_->token_service(), context_->account_id(), false /* retry_on_error */); android_management_checker_->StartCheck( @@ -888,7 +882,7 @@ return; } - android_management_checker_ = base::MakeUnique<ArcAndroidManagementChecker>( + android_management_checker_ = std::make_unique<ArcAndroidManagementChecker>( profile_, context_->token_service(), context_->account_id(), true /* retry_on_error */); android_management_checker_->StartCheck(
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h index 4b645b3..f9b2983 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.h +++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -174,9 +174,8 @@ // subscribe to ArcSessionManager, and ArcSessionManager proxies the event. void NotifyArcPlayStoreEnabledChanged(bool enabled); - // Returns true if ARC instance is running/stopped, respectively. - // See ArcSessionRunner::IsRunning()/IsStopped() for details. - bool IsSessionRunning() const; + // Returns true if ARC instance is stopped. + // See ArcSessionRunner::IsStopped() for details. bool IsSessionStopped() const; // Called from ARC support platform app when user cancels signing.
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc index 04a624ea..8984d01 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
@@ -10,7 +10,6 @@ #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" @@ -130,7 +129,7 @@ ArcAuthNotification::DisableForTesting(); ArcSessionManager::EnableCheckAndroidManagementForTesting(); ArcSessionManager::Get()->SetArcSessionRunnerForTesting( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc index f3a0cec..6795f0b54 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager_unittest.cc
@@ -14,7 +14,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/observer_list.h" #include "base/run_loop.h" #include "base/values.h" @@ -106,7 +105,7 @@ } void BeforeSessionStart() override {} void Finalize(base::OnceClosure) override {} - void OpenProxySettings(const std::string& network_id) override {} + void OpenInternetDetailDialog(const std::string& network_id) override {} void SetStatusAreaVisible(bool visible) override {} void StartWizard(chromeos::OobeScreen first_screen) override { // Reset the controller first since there could only be one wizard @@ -159,7 +158,7 @@ void SetUp() override { chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( - base::MakeUnique<chromeos::FakeSessionManagerClient>()); + std::make_unique<chromeos::FakeSessionManagerClient>()); chromeos::DBusThreadManager::Initialize(); @@ -176,9 +175,9 @@ profile_ = profile_builder.Build(); StartPreferenceSyncing(); - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); // Check initial conditions. EXPECT_TRUE(arc_session_manager_->IsSessionStopped()); @@ -223,8 +222,8 @@ ->GetSyncableService(syncer::PREFERENCES) ->MergeDataAndStartSyncing( syncer::PREFERENCES, syncer::SyncDataList(), - base::MakeUnique<syncer::FakeSyncChangeProcessor>(), - base::MakeUnique<syncer::SyncErrorFactoryMock>()); + std::make_unique<syncer::FakeSyncChangeProcessor>(), + std::make_unique<syncer::SyncErrorFactoryMock>()); } content::TestBrowserThreadBundle thread_bundle_; @@ -283,7 +282,6 @@ EXPECT_FALSE(arc_session_manager()->arc_start_time().is_null()); ASSERT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - ASSERT_TRUE(arc_session_manager()->IsSessionRunning()); arc_session_manager()->Shutdown(); } @@ -394,7 +392,6 @@ arc_session_manager()->state()); arc_session_manager()->StartArcForTesting(); EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - EXPECT_TRUE(arc_session_manager()->IsSessionRunning()); // Here, provisining is not yet completed, so kArcSignedIn should be false. EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); @@ -405,7 +402,6 @@ arc_session_manager()->OnProvisioningFinished(ProvisioningResult::SUCCESS); EXPECT_TRUE(prefs->GetBoolean(prefs::kArcSignedIn)); EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - EXPECT_TRUE(arc_session_manager()->IsSessionRunning()); EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); EXPECT_TRUE(arc_session_manager()->IsPlaystoreLaunchRequestedForTesting()); } @@ -423,7 +419,6 @@ // Second start, no fetching code is expected. EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - EXPECT_TRUE(arc_session_manager()->IsSessionRunning()); // Report failure. arc_session_manager()->OnProvisioningFinished( @@ -432,7 +427,6 @@ // the ARC is still necessary to run on background for gathering the logs. EXPECT_TRUE(prefs->GetBoolean(prefs::kArcSignedIn)); EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - EXPECT_TRUE(arc_session_manager()->IsSessionRunning()); // Correctly stop service. arc_session_manager()->Shutdown(); @@ -618,7 +612,6 @@ base::RunLoop().RunUntilIdle(); ASSERT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); EXPECT_FALSE(arc_session_manager()->arc_start_time().is_null()); - ASSERT_TRUE(arc_session_manager()->IsSessionRunning()); arc_session_manager()->Shutdown(); } @@ -686,7 +679,7 @@ // Enable ARC through user pref or by policy, according to the test parameter. if (arc_enabled_pref_managed()) prefs->SetManagedPref(prefs::kArcEnabled, - base::MakeUnique<base::Value>(true)); + std::make_unique<base::Value>(true)); else prefs->SetBoolean(prefs::kArcEnabled, true); EXPECT_TRUE(IsArcPlayStoreEnabledForProfile(profile())); @@ -750,7 +743,7 @@ // Set ARC to be managed. prefs->SetManagedPref(prefs::kArcEnabled, - base::MakeUnique<base::Value>(true)); + std::make_unique<base::Value>(true)); EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); arc_session_manager()->SetProfile(profile()); @@ -829,7 +822,7 @@ protected: void CreateLoginDisplayHost() { - fake_login_display_host_ = base::MakeUnique<FakeLoginDisplayHost>(); + fake_login_display_host_ = std::make_unique<FakeLoginDisplayHost>(); } FakeLoginDisplayHost* login_display_host() { @@ -889,7 +882,7 @@ connector->OverrideIsManagedForTesting(true); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); } arc_session_manager()->SetProfile(profile());
diff --git a/chrome/browser/chromeos/arc/arc_support_host.cc b/chrome/browser/chromeos/arc/arc_support_host.cc index b44272f..c70e347 100644 --- a/chrome/browser/chromeos/arc/arc_support_host.cc +++ b/chrome/browser/chromeos/arc/arc_support_host.cc
@@ -11,7 +11,6 @@ #include "base/i18n/timezone.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" -#include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/browser_process.h" @@ -446,7 +445,7 @@ bool ArcSupportHost::Initialize() { DCHECK(message_host_); - auto loadtime_data = base::MakeUnique<base::DictionaryValue>(); + auto loadtime_data = std::make_unique<base::DictionaryValue>(); loadtime_data->SetString("appWindow", l10n_util::GetStringUTF16( IDS_ARC_PLAYSTORE_ICON_TITLE_BETA)); loadtime_data->SetString(
diff --git a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc index 12d248f..960dfe9 100644 --- a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/arc/arc_support_host.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/extensions/fake_arc_support.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" @@ -59,12 +58,12 @@ void SetUp() override { user_manager_enabler_ = - base::MakeUnique<chromeos::ScopedUserManagerEnabler>( + std::make_unique<chromeos::ScopedUserManagerEnabler>( new chromeos::FakeChromeUserManager()); - profile_ = base::MakeUnique<TestingProfile>(); - support_host_ = base::MakeUnique<ArcSupportHost>(profile_.get()); - fake_arc_support_ = base::MakeUnique<FakeArcSupport>(support_host_.get()); + profile_ = std::make_unique<TestingProfile>(); + support_host_ = std::make_unique<ArcSupportHost>(profile_.get()); + fake_arc_support_ = std::make_unique<FakeArcSupport>(support_host_.get()); } void TearDown() override { @@ -82,19 +81,19 @@ FakeArcSupport* fake_arc_support() { return fake_arc_support_.get(); } MockAuthDelegate* CreateMockAuthDelegate() { - auth_delegate_ = base::MakeUnique<MockAuthDelegate>(); + auth_delegate_ = std::make_unique<MockAuthDelegate>(); support_host_->SetAuthDelegate(auth_delegate_.get()); return auth_delegate_.get(); } MockTermsOfServiceDelegate* CreateMockTermsOfServiceDelegate() { - tos_delegate_ = base::MakeUnique<MockTermsOfServiceDelegate>(); + tos_delegate_ = std::make_unique<MockTermsOfServiceDelegate>(); support_host_->SetTermsOfServiceDelegate(tos_delegate_.get()); return tos_delegate_.get(); } MockErrorDelegate* CreateMockErrorDelegate() { - error_delegate_ = base::MakeUnique<MockErrorDelegate>(); + error_delegate_ = std::make_unique<MockErrorDelegate>(); support_host_->SetErrorDelegate(error_delegate_.get()); return error_delegate_.get(); }
diff --git a/chrome/browser/chromeos/arc/arc_util_unittest.cc b/chrome/browser/chromeos/arc/arc_util_unittest.cc index df1d5e9..88c5c5a 100644 --- a/chrome/browser/chromeos/arc/arc_util_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/sys_info.h" #include "base/test/scoped_command_line.h" #include "base/values.h"
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc index 3f07277..6bc475d 100644 --- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc +++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
@@ -5,11 +5,11 @@ #include "chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/arc/arc_optin_uma.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" @@ -62,7 +62,7 @@ DCHECK(callback_.is_null()); DCHECK(auth_session_id_.empty()); callback_ = std::move(callback); - dm_token_storage_ = base::MakeUnique<policy::DMTokenStorage>( + dm_token_storage_ = std::make_unique<policy::DMTokenStorage>( g_browser_process->local_state()); dm_token_storage_->RetrieveDMToken(base::BindOnce( &ArcActiveDirectoryEnrollmentTokenFetcher::OnDMTokenAvailable,
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc index 79586a7..89a7f4e 100644 --- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc +++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/arc/arc_support_host.h" @@ -295,21 +294,21 @@ void SetUpInProcessBrowserTestFixture() override { // Set fake cryptohome, because we want to fail DMToken retrieval - auto cryptohome_client = base::MakeUnique<chromeos::FakeCryptohomeClient>(); + auto cryptohome_client = std::make_unique<chromeos::FakeCryptohomeClient>(); fake_cryptohome_client_ = cryptohome_client.get(); chromeos::DBusThreadManager::GetSetterForTesting()->SetCryptohomeClient( std::move(cryptohome_client)); } void SetUpOnMainThread() override { - interceptor_ = base::MakeUnique<policy::TestRequestInterceptor>( + interceptor_ = std::make_unique<policy::TestRequestInterceptor>( "localhost", content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::IO)); - support_host_ = base::MakeUnique<ArcSupportHost>(browser()->profile()); + support_host_ = std::make_unique<ArcSupportHost>(browser()->profile()); support_host_->SetErrorDelegate(this); - fake_arc_support_ = base::MakeUnique<FakeArcSupport>(support_host_.get()); - token_fetcher_ = base::MakeUnique<ArcActiveDirectoryEnrollmentTokenFetcher>( + fake_arc_support_ = std::make_unique<FakeArcSupport>(support_host_.get()); + token_fetcher_ = std::make_unique<ArcActiveDirectoryEnrollmentTokenFetcher>( support_host_.get()); } @@ -330,7 +329,7 @@ fake_cryptohome_client_->SetServiceIsAvailable(true); // Store a fake DM token. base::RunLoop run_loop; - auto dm_token_storage = base::MakeUnique<policy::DMTokenStorage>( + auto dm_token_storage = std::make_unique<policy::DMTokenStorage>( g_browser_process->local_state()); dm_token_storage->StoreDMToken( kFakeDmToken, base::BindOnce(
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc index 9286b93..63a2f229 100644 --- a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc +++ b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/time/time.h" #include "chrome/browser/chromeos/arc/arc_optin_uma.h" @@ -220,7 +219,7 @@ // For Active Directory enrolled devices, we get an enrollment token for a // managed Google Play account from DMServer. auto enrollment_token_fetcher = - base::MakeUnique<ArcActiveDirectoryEnrollmentTokenFetcher>( + std::make_unique<ArcActiveDirectoryEnrollmentTokenFetcher>( ArcSessionManager::Get()->support_host()); enrollment_token_fetcher->Fetch( base::Bind(&ArcAuthService::OnEnrollmentTokenFetched, @@ -232,10 +231,10 @@ std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher; if (IsArcKioskMode()) { // In Kiosk mode, use Robot auth code fetching. - auth_code_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>(); + auth_code_fetcher = std::make_unique<ArcRobotAuthCodeFetcher>(); } else { // Optionally retrieve auth code in silent mode. - auth_code_fetcher = base::MakeUnique<ArcBackgroundAuthCodeFetcher>( + auth_code_fetcher = std::make_unique<ArcBackgroundAuthCodeFetcher>( profile_, ArcSessionManager::Get()->auth_context()); } auth_code_fetcher->Fetch(base::Bind(&ArcAuthService::OnAuthCodeFetched,
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc index 6adabbe0..226b333 100644 --- a/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc +++ b/chrome/browser/chromeos/arc/auth/arc_auth_service_browsertest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> #include <string> #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "chrome/browser/chromeos/arc/arc_auth_notification.h" #include "chrome/browser/chromeos/arc/arc_service_launcher.h" @@ -92,7 +92,7 @@ void SetUpOnMainThread() override { user_manager_enabler_ = - base::MakeUnique<chromeos::ScopedUserManagerEnabler>( + std::make_unique<chromeos::ScopedUserManagerEnabler>( new chromeos::FakeChromeUserManager()); // Init ArcSessionManager for testing. ArcServiceLauncher::Get()->ResetForTesting(); @@ -100,7 +100,7 @@ ArcAuthNotification::DisableForTesting(); ArcSessionManager::EnableCheckAndroidManagementForTesting(); ArcSessionManager::Get()->SetArcSessionRunnerForTesting( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); chromeos::ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true);
diff --git a/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc index 6503a11..2ea87539 100644 --- a/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc +++ b/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/arc/arc_session_manager.h" @@ -79,12 +78,12 @@ } void SetUpOnMainThread() override { - interceptor_ = base::MakeUnique<policy::TestRequestInterceptor>( + interceptor_ = std::make_unique<policy::TestRequestInterceptor>( "localhost", content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::IO)); user_manager_enabler_ = - base::MakeUnique<chromeos::ScopedUserManagerEnabler>( + std::make_unique<chromeos::ScopedUserManagerEnabler>( new chromeos::FakeChromeUserManager()); const AccountId account_id(AccountId::FromUserEmail(kFakeUserName)); @@ -97,7 +96,7 @@ connector->GetDeviceCloudPolicyManager(); cloud_policy_manager->StartConnection( - base::MakeUnique<policy::MockCloudPolicyClient>(), + std::make_unique<policy::MockCloudPolicyClient>(), connector->GetInstallAttributes()); policy::MockCloudPolicyClient* const cloud_policy_client = @@ -155,7 +154,7 @@ std::string auth_code; bool fetch_success = false; - auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>(); + auto robot_fetcher = std::make_unique<ArcRobotAuthCodeFetcher>(); FetchAuthCode(robot_fetcher.get(), &fetch_success, &auth_code); EXPECT_TRUE(fetch_success); @@ -172,7 +171,7 @@ std::string auth_code = "NOT-YET-FETCHED"; bool fetch_success = true; - auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>(); + auto robot_fetcher = std::make_unique<ArcRobotAuthCodeFetcher>(); FetchAuthCode(robot_fetcher.get(), &fetch_success, &auth_code); EXPECT_FALSE(fetch_success);
diff --git a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge.cc b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge.cc index de874b7f..16284d9 100644 --- a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge.cc +++ b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -20,7 +20,6 @@ #include "base/containers/queue.h" #include "base/json/json_writer.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/posix/eintr_wrapper.h" #include "base/strings/string_number_conversions.h" @@ -376,9 +375,9 @@ arc_bridge_service_->bluetooth()->AddObserver(this); app_observer_ = - base::MakeUnique<AppInstanceObserver>(this, arc_bridge_service_); + std::make_unique<AppInstanceObserver>(this, arc_bridge_service_); intent_helper_observer_ = - base::MakeUnique<IntentHelperInstanceObserver>(this, arc_bridge_service_); + std::make_unique<IntentHelperInstanceObserver>(this, arc_bridge_service_); if (BluetoothAdapterFactory::IsBluetoothSupported()) { VLOG(1) << "Registering bluetooth adapter."; @@ -1192,7 +1191,7 @@ return; } bluetooth_adapter_->StartDiscoverySessionWithFilter( - base::MakeUnique<BluetoothDiscoveryFilter>( + std::make_unique<BluetoothDiscoveryFilter>( device::BLUETOOTH_TRANSPORT_LE), base::Bind(&ArcBluetoothBridge::OnDiscoveryStarted, weak_factory_.GetWeakPtr()), @@ -1345,7 +1344,7 @@ void ArcBluetoothBridge::StartLEListen(StartLEListenCallback callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::unique_ptr<BluetoothAdvertisement::Data> adv_data = - base::MakeUnique<BluetoothAdvertisement::Data>( + std::make_unique<BluetoothAdvertisement::Data>( BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST); // TODO(crbug.com/730593): Remove AdaptCallbackForRepeating() by updating // the callee interface.
diff --git a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc index 0c569e2a..063e216 100644 --- a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc
@@ -4,11 +4,11 @@ #include "chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge.h" +#include <memory> #include <string> #include <utility> #include <vector> -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" @@ -78,23 +78,23 @@ std::unique_ptr<bluez::BluezDBusManagerSetter> dbus_setter = bluez::BluezDBusManager::GetSetterForTesting(); auto fake_bluetooth_device_client = - base::MakeUnique<bluez::FakeBluetoothDeviceClient>(); + std::make_unique<bluez::FakeBluetoothDeviceClient>(); fake_bluetooth_device_client->RemoveAllDevices(); dbus_setter->SetBluetoothDeviceClient( std::move(fake_bluetooth_device_client)); dbus_setter->SetBluetoothGattServiceClient( - base::MakeUnique<bluez::FakeBluetoothGattServiceClient>()); + std::make_unique<bluez::FakeBluetoothGattServiceClient>()); dbus_setter->SetBluetoothGattCharacteristicClient( - base::MakeUnique<bluez::FakeBluetoothGattCharacteristicClient>()); + std::make_unique<bluez::FakeBluetoothGattCharacteristicClient>()); dbus_setter->SetBluetoothGattDescriptorClient( - base::MakeUnique<bluez::FakeBluetoothGattDescriptorClient>()); + std::make_unique<bluez::FakeBluetoothGattDescriptorClient>()); - arc_bridge_service_ = base::MakeUnique<ArcBridgeService>(); - fake_bluetooth_instance_ = base::MakeUnique<FakeBluetoothInstance>(); + arc_bridge_service_ = std::make_unique<ArcBridgeService>(); + fake_bluetooth_instance_ = std::make_unique<FakeBluetoothInstance>(); arc_bridge_service_->bluetooth()->SetInstance( fake_bluetooth_instance_.get(), 2); // TODO(hidehiko): Use Singleton instance tied to BrowserContext. - arc_bluetooth_bridge_ = base::MakeUnique<ArcBluetoothBridge>( + arc_bluetooth_bridge_ = std::make_unique<ArcBluetoothBridge>( nullptr, arc_bridge_service_.get()); device::BluetoothAdapterFactory::GetAdapter(base::Bind( @@ -317,7 +317,7 @@ EXPECT_NE(kFailureAdvHandle, handle); EXPECT_EQ(0, NumActiveAdvertisements()); - auto adv_data = base::MakeUnique<device::BluetoothAdvertisement::Data>( + auto adv_data = std::make_unique<device::BluetoothAdvertisement::Data>( device::BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST); mojom::BluetoothGattStatus status = BroadcastAdvertisement(handle, std::move(adv_data));
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc index 71666dca..3933c8b 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc
@@ -150,7 +150,7 @@ if (arc_session_manager->is_directly_started()) { // Unless this is opt-in boot, start monitoring window activation changes to // prioritize/throttle the container when needed. - throttle_ = base::MakeUnique<ArcInstanceThrottle>(); + throttle_ = std::make_unique<ArcInstanceThrottle>(); VLOG(2) << "ArcInstanceThrottle created in OnBootCompleted()"; } @@ -163,7 +163,7 @@ void ArcBootPhaseMonitorBridge::OnArcInitialStart() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // ARC apps for opt-in finished doing their jobs. Start the throttle. - throttle_ = base::MakeUnique<ArcInstanceThrottle>(); + throttle_ = std::make_unique<ArcInstanceThrottle>(); VLOG(2) << "ArcInstanceThrottle created in OnArcInitialStart()"; }
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc index eb6acc7..dffe373 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h" +#include <memory> + #include "base/threading/platform_thread.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -24,17 +26,17 @@ void SetUp() override { chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( - base::MakeUnique<chromeos::FakeSessionManagerClient>()); + std::make_unique<chromeos::FakeSessionManagerClient>()); chromeos::DBusThreadManager::Initialize(); disable_cpu_restriction_counter_ = 0; record_uma_counter_ = 0; - testing_profile_ = base::MakeUnique<TestingProfile>(); - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); - bridge_service_ = base::MakeUnique<ArcBridgeService>(); + testing_profile_ = std::make_unique<TestingProfile>(); + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + bridge_service_ = std::make_unique<ArcBridgeService>(); - boot_phase_monitor_bridge_ = base::MakeUnique<ArcBootPhaseMonitorBridge>( + boot_phase_monitor_bridge_ = std::make_unique<ArcBootPhaseMonitorBridge>( testing_profile_.get(), bridge_service_.get()); boot_phase_monitor_bridge_->SetDelegateForTesting( std::make_unique<TestDelegateImpl>(this));
diff --git a/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.cc b/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.cc index 866b3c5..12f2f32 100644 --- a/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.cc +++ b/chrome/browser/chromeos/arc/cast_receiver/arc_cast_receiver_service.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/profiles/profile.h" @@ -57,7 +56,7 @@ : arc_bridge_service_(bridge_service) { arc_bridge_service_->cast_receiver()->AddObserver(this); - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init( Profile::FromBrowserContext(context)->GetPrefs()); // Observe prefs for the Cast Receiver. We can use base::Unretained() here
diff --git a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc index f11d74a1..f92bb0b 100644 --- a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc +++ b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
@@ -15,7 +15,6 @@ #include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/sequence_checker.h" #include "base/strings/string_util.h" @@ -296,7 +295,7 @@ last_notify_time_ = base::TimeTicks::Now(); last_timestamp_map_ = BuildTimestampMap(downloads_dir_); - watcher_ = base::MakeUnique<base::FilePathWatcher>(); + watcher_ = std::make_unique<base::FilePathWatcher>(); // On Linux, base::FilePathWatcher::Watch() always returns true. watcher_->Watch(downloads_dir_, true, base::Bind(&DownloadsWatcher::OnFilePathChanged, @@ -396,7 +395,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); StopWatchingDownloads(); DCHECK(!watcher_); - watcher_ = base::MakeUnique<DownloadsWatcher>( + watcher_ = std::make_unique<DownloadsWatcher>( context_, base::Bind(&ArcDownloadsWatcherService::OnDownloadsChanged, weak_ptr_factory_.GetWeakPtr())); file_task_runner_->PostTask(FROM_HERE,
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.cc b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.cc new file mode 100644 index 0000000..937df52 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.cc
@@ -0,0 +1,348 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h" + +#include <cert.h> + +#include "base/base64.h" +#include "base/callback.h" +#include "base/logging.h" +#include "base/memory/singleton.h" +#include "chrome/browser/chromeos/platform_keys/key_permissions.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/net/nss_context.h" +#include "chrome/browser/policy/profile_policy_connector.h" +#include "chrome/browser/policy/profile_policy_connector_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "components/arc/arc_bridge_service.h" +#include "components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "components/arc/arc_service_manager.h" +#include "components/policy/core/common/policy_namespace.h" +#include "components/policy/policy_constants.h" +#include "net/cert/x509_certificate.h" +#include "net/cert/x509_util_nss.h" + +namespace arc { + +namespace { + +// Singleton factory for ArcCertStoreBridge. +class ArcCertStoreBridgeFactory + : public internal::ArcBrowserContextKeyedServiceFactoryBase< + ArcCertStoreBridge, + ArcCertStoreBridgeFactory> { + public: + // Factory name used by ArcBrowserContextKeyedServiceFactoryBase. + static constexpr const char* kName = "ArcCertStoreBridgeFactory"; + + static ArcCertStoreBridgeFactory* GetInstance() { + return base::Singleton<ArcCertStoreBridgeFactory>::get(); + } + + private: + friend base::DefaultSingletonTraits<ArcCertStoreBridgeFactory>; + ArcCertStoreBridgeFactory() { + DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); + } + ~ArcCertStoreBridgeFactory() override = default; +}; + +bool LooksLikeAndroidPackageName(const std::string& name) { + return name.find(".") != std::string::npos; +} + +scoped_refptr<net::X509Certificate> FindCertificateByAlias( + const std::string& alias) { + // Searches certificate across all available slots without limiting to user's + // private slot. It's OK as all certificates are filtered by the pref. + net::ScopedCERTCertificate cert( + CERT_FindCertByNickname(CERT_GetDefaultCertDB(), alias.c_str())); + if (!cert) { + LOG(ERROR) << "Certificate with nickname=" << alias << " does not exist."; + return nullptr; + } + + scoped_refptr<net::X509Certificate> x509_cert = + net::x509_util::CreateX509CertificateFromCERTCertificate(cert.get()); + DVLOG_IF(1, !x509_cert) + << "x509_util::CreateX509CertificateFromCERTCertificate failed"; + return x509_cert; +} + +// Returns true if the certificate is allowed to be used by ARC. |cert| must be +// non-null. +// WARNING: Doesn't check the certificate slot, relies only on pref. +bool IsCertificateAllowed(const scoped_refptr<net::X509Certificate>& cert, + const PrefService* prefs) { + DCHECK(cert); + + std::string spki_der = chromeos::platform_keys::GetSubjectPublicKeyInfo(cert); + std::string public_key_spki_der_b64; + base::Base64Encode(spki_der, &public_key_spki_der_b64); + if (!chromeos::KeyPermissions::IsCorporateKeyForProfile( + public_key_spki_der_b64, prefs)) { + DVLOG(1) << "Certificate is not allowed to be used by ARC."; + return false; + } + return true; +} + +} // namespace + +// static +ArcCertStoreBridge* ArcCertStoreBridge::GetForBrowserContext( + content::BrowserContext* context) { + return ArcCertStoreBridgeFactory::GetForBrowserContext(context); +} + +ArcCertStoreBridge::ArcCertStoreBridge(content::BrowserContext* context, + ArcBridgeService* bridge_service) + : context_(context), + arc_bridge_service_(bridge_service), + binding_(this), + weak_ptr_factory_(this) { + DVLOG(1) << "ArcCertStoreBridge::ArcCertStoreBridge"; + + const auto* profile_policy_connector = + policy::ProfilePolicyConnectorFactory::GetForBrowserContext(context_); + policy_service_ = profile_policy_connector->policy_service(); + DCHECK(policy_service_); + + arc_bridge_service_->cert_store()->AddObserver(this); +} + +ArcCertStoreBridge::~ArcCertStoreBridge() { + DVLOG(1) << "ArcCertStoreBridge::~ArcCertStoreBridge"; + + arc_bridge_service_->cert_store()->RemoveObserver(this); +} + +void ArcCertStoreBridge::OnInstanceReady() { + DVLOG(1) << "ArcCertStoreBridge::OnInstanceReady"; + + policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); + net::CertDatabase::GetInstance()->AddObserver(this); + + auto* instance = + ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->cert_store(), Init); + DCHECK(instance); + + mojom::CertStoreHostPtr host_proxy; + binding_.Bind(mojo::MakeRequest(&host_proxy)); + instance->Init(std::move(host_proxy)); + + UpdateFromKeyPermissionsPolicy(); +} + +void ArcCertStoreBridge::OnInstanceClosed() { + DVLOG(1) << "ArcCertStoreBridge::OnInstanceClosed"; + + policy_service_->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); + net::CertDatabase::GetInstance()->RemoveObserver(this); +} + +void ArcCertStoreBridge::ListCertificates(ListCertificatesCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::ListCertificates"; + + if (!channel_enabled_) { + DVLOG(1) << "ARC certificate store channel is not enabled."; + std::move(callback).Run(std::vector<mojom::CertificatePtr>()); + return; + } + + GetNSSCertDatabaseForProfile( + Profile::FromBrowserContext(context_), + base::Bind(&ArcCertStoreBridge::OnGetNSSCertDatabaseForProfile, + weak_ptr_factory_.GetWeakPtr(), base::Passed(&callback))); +} + +void ArcCertStoreBridge::GetKeyCharacteristics( + const std::string& alias, + GetKeyCharacteristicsCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::GetKeyCharacteristics"; + + if (!channel_enabled_) { + LOG(WARNING) << "ARC certificate store channel is not enabled."; + std::move(callback).Run(mojom::KeymasterError::ERROR_INVALID_KEY_BLOB, + base::nullopt); + return; + } + + scoped_refptr<net::X509Certificate> cert = FindCertificateByAlias(alias); + if (!cert || !IsCertificateAllowed( + cert, Profile::FromBrowserContext(context_)->GetPrefs())) { + std::move(callback).Run(mojom::KeymasterError::ERROR_INVALID_KEY_BLOB, + base::nullopt); + return; + } + // TODO(pbond): implement. + std::move(callback).Run(mojom::KeymasterError::ERROR_UNIMPLEMENTED, + base::nullopt); +} + +void ArcCertStoreBridge::Begin(const std::string& alias, + const std::vector<mojom::KeyParamPtr> params, + BeginCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::Begin"; + + if (!channel_enabled_) { + LOG(WARNING) << "ARC certificate store channel is not enabled."; + std::move(callback).Run(mojom::KeymasterError::ERROR_INVALID_KEY_BLOB, 0); + return; + } + + scoped_refptr<net::X509Certificate> cert = FindCertificateByAlias(alias); + if (!cert || !IsCertificateAllowed( + cert, Profile::FromBrowserContext(context_)->GetPrefs())) { + std::move(callback).Run(mojom::KeymasterError::ERROR_INVALID_KEY_BLOB, 0); + return; + } + // TODO(pbond): implement. + std::move(callback).Run(mojom::KeymasterError::ERROR_UNIMPLEMENTED, 0); +} + +void ArcCertStoreBridge::Update(uint64_t operation_handle, + const std::vector<uint8_t>& data, + UpdateCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::Update"; + + if (!channel_enabled_) { + LOG(WARNING) << "ARC certificate store channel is not enabled."; + std::move(callback).Run( + mojom::KeymasterError::ERROR_INVALID_OPERATION_HANDLE, 0); + return; + } + // TODO(pbond): implement. + std::move(callback).Run(mojom::KeymasterError::ERROR_UNIMPLEMENTED, 0); +} + +void ArcCertStoreBridge::Finish(uint64_t operation_handle, + FinishCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::Finish"; + + if (!channel_enabled_) { + LOG(WARNING) << "ARC certificate store channel is not enabled."; + std::move(callback).Run( + mojom::KeymasterError::ERROR_INVALID_OPERATION_HANDLE, base::nullopt); + return; + } + // TODO(pbond): implement. + std::move(callback).Run(mojom::KeymasterError::ERROR_UNIMPLEMENTED, + base::nullopt); +} + +void ArcCertStoreBridge::Abort(uint64_t operation_handle, + AbortCallback callback) { + DVLOG(1) << "ArcCertStoreBridge::Abort"; + + if (!channel_enabled_) { + LOG(WARNING) << "ARC certificate store channel is not enabled."; + std::move(callback).Run( + mojom::KeymasterError::ERROR_INVALID_OPERATION_HANDLE); + return; + } + // TODO(pbond): implement. + std::move(callback).Run(mojom::KeymasterError::ERROR_UNIMPLEMENTED); +} + +void ArcCertStoreBridge::OnCertDBChanged() { + DVLOG(1) << "ArcCertStoreBridge::OnCertDBChanged"; + + UpdateCertificates(); +} + +void ArcCertStoreBridge::OnPolicyUpdated(const policy::PolicyNamespace& ns, + const policy::PolicyMap& previous, + const policy::PolicyMap& current) { + DVLOG(1) << "ArcCertStoreBridge::OnPolicyUpdated"; + + const base::Value* previous_value = + previous.GetValue(policy::key::kKeyPermissions); + const base::Value* current_value = + current.GetValue(policy::key::kKeyPermissions); + + // Check if KeyPermissions policy is changed. + bool keyPermissionsPolicyUnchanged = + ((previous_value == current_value) || + (previous_value && current_value && *previous_value == *current_value)); + if (!keyPermissionsPolicyUnchanged) + UpdateFromKeyPermissionsPolicy(); +} + +void ArcCertStoreBridge::OnGetNSSCertDatabaseForProfile( + ListCertificatesCallback callback, + net::NSSCertDatabase* database) { + DCHECK(database); + // Lists certificates from both public and private slots. It's OK as all + // certificates are filtered by prefs (corporate usage). + // If filtering logic is changed, make sure certificates slots are correct. + database->ListCerts(base::Bind(&ArcCertStoreBridge::OnCertificatesListed, + weak_ptr_factory_.GetWeakPtr(), + base::Passed(&callback))); +} + +void ArcCertStoreBridge::OnCertificatesListed( + ListCertificatesCallback callback, + net::ScopedCERTCertificateList cert_list) { + std::vector<mojom::CertificatePtr> permitted_certs; + for (const auto& cert : cert_list) { + scoped_refptr<net::X509Certificate> x509_cert = + net::x509_util::CreateX509CertificateFromCERTCertificate(cert.get()); + if (!x509_cert) { + DVLOG(1) << "x509_util::CreateX509CertificateFromCERTCertificate failed"; + continue; + } + if (IsCertificateAllowed( + x509_cert, Profile::FromBrowserContext(context_)->GetPrefs())) { + mojom::CertificatePtr certificate = mojom::Certificate::New(); + certificate->alias = cert->nickname; + net::X509Certificate::GetPEMEncoded(x509_cert->os_cert_handle(), + &certificate->cert); + permitted_certs.emplace_back(std::move(certificate)); + } + } + std::move(callback).Run(std::move(permitted_certs)); +} + +void ArcCertStoreBridge::UpdateFromKeyPermissionsPolicy() { + DVLOG(1) << "ArcCertStoreBridge::UpdateFromKeyPermissionsPolicy"; + + std::vector<std::string> app_ids = + chromeos::KeyPermissions::GetCorporateKeyUsageAllowedAppIds( + policy_service_); + std::vector<std::string> permissions; + for (const auto& app_id : app_ids) { + if (LooksLikeAndroidPackageName(app_id)) + permissions.push_back(app_id); + } + + channel_enabled_ = !permissions.empty(); + // If channel is enabled, the certificates must be updated. + UpdateCertificates(); + + auto* instance = ARC_GET_INSTANCE_FOR_METHOD( + arc_bridge_service_->cert_store(), OnKeyPermissionsChanged); + if (!instance) + return; + + instance->OnKeyPermissionsChanged(std::move(permissions)); +} + +void ArcCertStoreBridge::UpdateCertificates() { + DVLOG(1) << "ArcCertStoreBridge::UpdateCertificates"; + + if (!channel_enabled_) { + DVLOG(1) << "ARC certificate store channel is not enabled."; + return; + } + + auto* instance = ARC_GET_INSTANCE_FOR_METHOD( + arc_bridge_service_->cert_store(), OnCertificatesChanged); + if (!instance) + return; + instance->OnCertificatesChanged(); +} + +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h new file mode 100644 index 0000000..ccf0559 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h
@@ -0,0 +1,92 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_CERT_STORE_BRIDGE_H_ +#define CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_CERT_STORE_BRIDGE_H_ + +#include "base/memory/weak_ptr.h" +#include "components/arc/arc_bridge_service.h" +#include "components/arc/common/cert_store.mojom.h" +#include "components/arc/instance_holder.h" +#include "components/keyed_service/core/keyed_service.h" +#include "components/policy/core/common/policy_service.h" +#include "components/prefs/pref_service.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "net/cert/cert_database.h" +#include "net/cert/nss_cert_database.h" +#include "net/cert/scoped_nss_types.h" + +namespace content { +class BrowserContext; +} // namespace content + +namespace arc { + +class ArcBridgeService; + +class ArcCertStoreBridge + : public KeyedService, + public InstanceHolder<arc::mojom::CertStoreInstance>::Observer, + public mojom::CertStoreHost, + public net::CertDatabase::Observer, + public policy::PolicyService::Observer { + public: + // Returns singleton instance for the given BrowserContext, + // or nullptr if the browser |context| is not allowed to use ARC. + static ArcCertStoreBridge* GetForBrowserContext( + content::BrowserContext* context); + + ArcCertStoreBridge(content::BrowserContext* context, + ArcBridgeService* bridge_service); + ~ArcCertStoreBridge() override; + + // InstanceHolder<mojom::CertStoreInstance>::Observer overrides. + void OnInstanceReady() override; + void OnInstanceClosed() override; + + // CertStoreHost overrides. + void ListCertificates(ListCertificatesCallback callback) override; + void GetKeyCharacteristics(const std::string& alias, + GetKeyCharacteristicsCallback callback) override; + void Begin(const std::string& alias, + std::vector<mojom::KeyParamPtr> params, + BeginCallback callback) override; + void Update(uint64_t operation_handle, + const std::vector<uint8_t>& data, + UpdateCallback callback) override; + void Finish(uint64_t operation_handle, FinishCallback callback) override; + void Abort(uint64_t operation_handle, AbortCallback callback) override; + + // CertDatabase::Observer overrides. + void OnCertDBChanged() override; + + // PolicyService overrides. + void OnPolicyUpdated(const policy::PolicyNamespace& ns, + const policy::PolicyMap& previous, + const policy::PolicyMap& current) override; + + private: + void OnGetNSSCertDatabaseForProfile(ListCertificatesCallback callback, + net::NSSCertDatabase* database); + void OnCertificatesListed(ListCertificatesCallback callback, + net::ScopedCERTCertificateList cert_list); + void UpdateFromKeyPermissionsPolicy(); + void UpdateCertificates(); + + content::BrowserContext* const context_; + ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. + mojo::Binding<CertStoreHost> binding_; + policy::PolicyService* policy_service_ = nullptr; + // Set to true if at least one ARC app is whitelisted by KeyPermissions + // policy. + bool channel_enabled_ = false; + + base::WeakPtrFactory<ArcCertStoreBridge> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(ArcCertStoreBridge); +}; + +} // namespace arc + +#endif // CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_CERT_STORE_BRIDGE_H_
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge_browsertest.cc b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge_browsertest.cc new file mode 100644 index 0000000..52132eb --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge_browsertest.cc
@@ -0,0 +1,370 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <algorithm> +#include <tuple> +#include <vector> + +#include "base/command_line.h" +#include "base/json/json_writer.h" +#include "base/run_loop.h" +#include "chrome/browser/chromeos/arc/arc_service_launcher.h" +#include "chrome/browser/chromeos/arc/enterprise/arc_cert_store_bridge.h" +#include "chrome/browser/chromeos/platform_keys/key_permissions.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/policy/user_policy_test_helper.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" +#include "chrome/browser/net/nss_context.h" +#include "chrome/browser/policy/profile_policy_connector.h" +#include "chrome/browser/policy/profile_policy_connector_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/testing_profile.h" +#include "chromeos/chromeos_switches.h" +#include "components/arc/arc_bridge_service.h" +#include "components/arc/arc_prefs.h" +#include "components/arc/arc_service_manager.h" +#include "components/arc/arc_util.h" +#include "components/arc/common/cert_store.mojom.h" +#include "components/policy/policy_constants.h" +#include "content/public/browser/browser_thread.h" +#include "crypto/scoped_test_system_nss_key_slot.h" +#include "extensions/browser/extension_system.h" +#include "net/cert/nss_cert_database.h" +#include "net/cert/x509_util_nss.h" +#include "net/test/cert_test_util.h" +#include "net/test/test_data_directory.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +constexpr char kFakeUserName[] = "test@example.com"; +constexpr char kFakePackageName[] = "fake.package.name"; +constexpr char kFakeExtensionId[] = "fakeextensionid"; + +// Returns true if cert1 < cert2. +bool CertificatePtrLess(const arc::mojom::CertificatePtr& cert1, + const arc::mojom::CertificatePtr& cert2) { + if (!cert1 || !cert2) + return !cert2.is_null(); + return std::tie(cert1->alias, cert1->cert) < + std::tie(cert2->alias, cert2->cert); +} + +} // namespace + +namespace arc { + +class FakeArcCertStoreInstance : public mojom::CertStoreInstance { + public: + // mojom::CertStoreInstance: + void Init(mojom::CertStoreHostPtr host) override { host_ = std::move(host); } + + void OnKeyPermissionsChanged( + const std::vector<std::string>& permissions) override { + permissions_ = permissions; + } + + void OnCertificatesChanged() override { is_on_certs_changed_called_ = true; } + + const std::vector<std::string>& permissions() const { return permissions_; } + bool is_on_certs_changed_called() const { + return is_on_certs_changed_called_; + } + void clear_on_certs_changed() { is_on_certs_changed_called_ = false; } + + private: + mojom::CertStoreHostPtr host_; + std::vector<std::string> permissions_; + bool is_on_certs_changed_called_ = false; +}; + +class ArcCertStoreBridgeTest : public InProcessBrowserTest { + protected: + ArcCertStoreBridgeTest() = default; + + // InProcessBrowserTest: + void SetUpCommandLine(base::CommandLine* command_line) override { + InProcessBrowserTest::SetUpCommandLine(command_line); + + arc::SetArcAvailableCommandLineForTesting(command_line); + + policy_helper_ = + std::make_unique<policy::UserPolicyTestHelper>(kFakeUserName); + policy_helper_->Init( + base::DictionaryValue() /* empty mandatory policy */, + base::DictionaryValue() /* empty recommended policy */); + policy_helper_->UpdateCommandLine(command_line); + + command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, + kFakeUserName); + command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, + TestingProfile::kTestUserProfileDir); + } + + void SetUpOnMainThread() override { + InProcessBrowserTest::SetUpOnMainThread(); + + policy_helper_->WaitForInitialPolicy(browser()->profile()); + + // Init ArcSessionManager for testing. + ArcServiceLauncher::Get()->ResetForTesting(); + + chromeos::ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true); + + browser()->profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); + browser()->profile()->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, + true); + + ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared( + browser()->profile()); + + instance_ = std::make_unique<FakeArcCertStoreInstance>(); + ASSERT_TRUE(arc_bridge()); + arc_bridge()->cert_store()->SetInstance(instance_.get()); + } + + void TearDownOnMainThread() override { + ASSERT_TRUE(arc_bridge()); + arc_bridge()->cert_store()->SetInstance(nullptr); + instance_.reset(); + + // Since ArcServiceLauncher is (re-)set up with profile() in + // SetUpOnMainThread() it is necessary to Shutdown() before the profile() + // is destroyed. ArcServiceLauncher::Shutdown() will be called again on + // fixture destruction (because it is initialized with the original Profile + // instance in fixture, once), but it should be no op. + ArcServiceLauncher::Get()->Shutdown(); + chromeos::ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); + } + + ArcBridgeService* arc_bridge() { + return ArcServiceManager::Get()->arc_bridge_service(); + } + + FakeArcCertStoreInstance* instance() { return instance_.get(); } + + // Set up the test policy that gives app the permission to access + // corporate keys. + void SetCorporateKeyUsagePolicy(const std::string& app_id) { + base::DictionaryValue key_permissions_policy; + { + std::unique_ptr<base::DictionaryValue> cert_key_permission = + std::make_unique<base::DictionaryValue>(); + cert_key_permission->SetKey("allowCorporateKeyUsage", base::Value(true)); + key_permissions_policy.SetWithoutPathExpansion( + app_id, std::move(cert_key_permission)); + } + + std::string key_permissions_policy_str; + base::JSONWriter::WriteWithOptions(key_permissions_policy, + base::JSONWriter::OPTIONS_PRETTY_PRINT, + &key_permissions_policy_str); + + base::DictionaryValue user_policy; + user_policy.SetKey(policy::key::kKeyPermissions, + base::Value(key_permissions_policy_str)); + + policy_helper_->UpdatePolicy( + user_policy, base::DictionaryValue() /* empty recommended policy */, + browser()->profile()); + } + + void RegisterCorporateKeys() { + ASSERT_NO_FATAL_FAILURE(ImportCerts()); + + policy::ProfilePolicyConnector* const policy_connector = + policy::ProfilePolicyConnectorFactory::GetForBrowserContext( + browser()->profile()); + + extensions::StateStore* const state_store = + extensions::ExtensionSystem::Get(browser()->profile())->state_store(); + + chromeos::KeyPermissions permissions( + policy_connector->IsManaged(), browser()->profile()->GetPrefs(), + policy_connector->policy_service(), state_store); + + { + base::RunLoop run_loop; + permissions.GetPermissionsForExtension( + kFakeExtensionId, + base::Bind(&ArcCertStoreBridgeTest::GotPermissionsForExtension, + base::Unretained(this), run_loop.QuitClosure())); + run_loop.Run(); + } + } + + std::vector<mojom::CertificatePtr> ListCertificates( + ArcCertStoreBridge* cert_store_bridge) { + std::vector<mojom::CertificatePtr> result; + base::RunLoop loop; + cert_store_bridge->ListCertificates(base::BindOnce( + [](base::RunLoop* loop, std::vector<mojom::CertificatePtr>* result, + std::vector<mojom::CertificatePtr> certs) { + std::sort(certs.begin(), certs.end(), CertificatePtrLess); + *result = std::move(certs); + loop->Quit(); + }, + &loop, &result)); + loop.Run(); + + return result; + } + + // Imports certificates to NSS database. + // FATAL ERROR: if the certificates were not imported properly. + void ImportCerts() { + base::RunLoop loop; + GetNSSCertDatabaseForProfile( + browser()->profile(), + base::Bind(&ArcCertStoreBridgeTest::SetUpTestClientCerts, + base::Unretained(this), loop.QuitClosure())); + loop.Run(); + // Certificates must be imported. + ASSERT_NE(nullptr, client_cert1_); + } + + net::ScopedCERTCertificate client_cert1_; + net::ScopedCERTCertificate client_cert2_; + + private: + // Register only client_cert1_ for corporate usage to test that + // client_cert2_ is not allowed. + void GotPermissionsForExtension( + const base::Closure& done_callback, + std::unique_ptr<chromeos::KeyPermissions::PermissionsForExtension> + permissions_for_ext) { + std::string client_cert1_spki( + client_cert1_->derPublicKey.data, + client_cert1_->derPublicKey.data + client_cert1_->derPublicKey.len); + permissions_for_ext->RegisterKeyForCorporateUsage(client_cert1_spki); + done_callback.Run(); + } + + void SetUpTestClientCerts(const base::Closure& done_callback, + net::NSSCertDatabase* cert_db) { + net::ImportSensitiveKeyFromFile(net::GetTestCertsDirectory(), + "client_1.pk8", + cert_db->GetPrivateSlot().get()); + net::ScopedCERTCertificateList certs = + net::CreateCERTCertificateListFromFile( + net::GetTestCertsDirectory(), "client_1.pem", + net::X509Certificate::FORMAT_AUTO); + EXPECT_EQ(1U, certs.size()); + if (certs.size() != 1U) { + done_callback.Run(); + return; + } + + client_cert1_ = net::x509_util::DupCERTCertificate(certs[0].get()); + + // Import user certificate properly how it's done in PlatfromKeys. + cert_db->ImportUserCert(client_cert1_.get()); + + net::ImportClientCertAndKeyFromFile( + net::GetTestCertsDirectory(), "client_2.pem", "client_2.pk8", + cert_db->GetPrivateSlot().get(), &client_cert2_); + + done_callback.Run(); + } + + std::unique_ptr<policy::UserPolicyTestHelper> policy_helper_; + std::unique_ptr<FakeArcCertStoreInstance> instance_; + + DISALLOW_COPY_AND_ASSIGN(ArcCertStoreBridgeTest); +}; + +// Test OnKeyPermissionsChanged(). +IN_PROC_BROWSER_TEST_F(ArcCertStoreBridgeTest, KeyPermissionsTest) { + ArcCertStoreBridge* cert_store_bridge = + ArcCertStoreBridge::GetForBrowserContext(browser()->profile()); + ASSERT_TRUE(cert_store_bridge); + // Corporate usage keys are not allowed to any app/extension: + EXPECT_EQ(0U, instance()->permissions().size()); + EXPECT_FALSE(instance()->is_on_certs_changed_called()); + + // Allow corporate usage keys to ARC app. + SetCorporateKeyUsagePolicy(kFakePackageName); + + ASSERT_EQ(1U, instance()->permissions().size()); + EXPECT_EQ(kFakePackageName, instance()->permissions()[0]); + + EXPECT_TRUE(instance()->is_on_certs_changed_called()); + instance()->clear_on_certs_changed(); + + // Allow corporate usage keys only to Chrome extensions. + SetCorporateKeyUsagePolicy(kFakeExtensionId); + + EXPECT_EQ(0U, instance()->permissions().size()); + EXPECT_FALSE(instance()->is_on_certs_changed_called()); +} + +// Test ListCertificates() with no corporate usage keys. +IN_PROC_BROWSER_TEST_F(ArcCertStoreBridgeTest, ListCertificatesBasicTest) { + ArcCertStoreBridge* cert_store_bridge = + ArcCertStoreBridge::GetForBrowserContext(browser()->profile()); + ASSERT_TRUE(cert_store_bridge); + + // Import certificates. + ASSERT_NO_FATAL_FAILURE(ImportCerts()); + + // Allow corporate usage keys to ARC app. + SetCorporateKeyUsagePolicy(kFakePackageName); + + EXPECT_TRUE(ListCertificates(cert_store_bridge).empty()); +} + +// Test ListCertificates() with 2 corporate usage keys. +IN_PROC_BROWSER_TEST_F(ArcCertStoreBridgeTest, ListCertificatesTest) { + ArcCertStoreBridge* cert_store_bridge = + ArcCertStoreBridge::GetForBrowserContext(browser()->profile()); + ASSERT_TRUE(cert_store_bridge); + + // Import and register corporate certificates. + ASSERT_NO_FATAL_FAILURE(RegisterCorporateKeys()); + EXPECT_FALSE(instance()->is_on_certs_changed_called()); + + // No ARC app is allowed to use corporate usage keys. + EXPECT_TRUE(ListCertificates(cert_store_bridge).empty()); + + // Allow corporate usage keys to ARC app. + SetCorporateKeyUsagePolicy(kFakePackageName); + auto mojom_cert1 = mojom::Certificate::New(); + mojom_cert1->alias = client_cert1_->nickname; + auto x509_cert = net::x509_util::CreateX509CertificateFromCERTCertificate( + client_cert1_.get()); + net::X509Certificate::GetPEMEncoded(x509_cert->os_cert_handle(), + &mojom_cert1->cert); + + std::vector<mojom::CertificatePtr> expected_certs; + expected_certs.emplace_back(std::move(mojom_cert1)); + + const std::vector<mojom::CertificatePtr>& certs = + ListCertificates(cert_store_bridge); + + ASSERT_EQ(expected_certs.size(), certs.size()); + for (size_t i = 0; i < certs.size(); ++i) { + EXPECT_EQ(expected_certs[i]->alias, certs[i]->alias); + EXPECT_EQ(expected_certs[i]->cert, certs[i]->cert); + } +} + +IN_PROC_BROWSER_TEST_F(ArcCertStoreBridgeTest, OnCertificatesChangedTest) { + ArcCertStoreBridge* cert_store_bridge = + ArcCertStoreBridge::GetForBrowserContext(browser()->profile()); + ASSERT_TRUE(cert_store_bridge); + + // Allow corporate usage keys to ARC app. + SetCorporateKeyUsagePolicy(kFakePackageName); + instance()->clear_on_certs_changed(); + + // Import and register corporate certificates. + ASSERT_NO_FATAL_FAILURE(RegisterCorporateKeys()); + + EXPECT_TRUE(instance()->is_on_certs_changed_called()); +} + +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/extensions/arc_support_message_host_unittest.cc b/chrome/browser/chromeos/arc/extensions/arc_support_message_host_unittest.cc index 8200ac46..a31ba8b 100644 --- a/chrome/browser/chromeos/arc/extensions/arc_support_message_host_unittest.cc +++ b/chrome/browser/chromeos/arc/extensions/arc_support_message_host_unittest.cc
@@ -11,7 +11,6 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/values.h" #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/api/messaging/native_message_host.h" @@ -65,7 +64,7 @@ ~ArcSupportMessageHostTest() override = default; void SetUp() override { - client_ = base::MakeUnique<TestClient>(); + client_ = std::make_unique<TestClient>(); message_host_ = ArcSupportMessageHost::Create(); message_host_->Start(client_.get()); }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc index 9f85cf5..edaa17b 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc
@@ -8,7 +8,6 @@ #include <string> #include "base/location.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h" @@ -50,15 +49,15 @@ fake_file_system_.AddFile( File(kArcUrl, kData, kMimeType, File::Seekable::NO)); - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - profile_ = base::MakeUnique<TestingProfile>(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + profile_ = std::make_unique<TestingProfile>(); arc_service_manager_->set_browser_context(profile_.get()); ArcFileSystemOperationRunner::GetFactory()->SetTestingFactoryAndUse( profile_.get(), &CreateArcFileSystemOperationRunnerForTesting); arc_service_manager_->arc_bridge_service()->file_system()->SetInstance( &fake_file_system_); - async_file_util_ = base::MakeUnique<ArcContentFileSystemAsyncFileUtil>(); + async_file_util_ = std::make_unique<ArcContentFileSystemAsyncFileUtil>(); } protected:
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc index 19abf6ca..a99b40127 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h" @@ -37,7 +36,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_EQ(storage::kFileSystemTypeArcContent, url.type()); GURL arc_url = FileSystemUrlToArcUrl(url); - return base::MakeUnique<ArcContentFileSystemFileStreamReader>(arc_url, + return std::make_unique<ArcContentFileSystemFileStreamReader>(arc_url, offset); }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc index 36bceac0..9d76ff1 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc
@@ -9,7 +9,6 @@ #include <utility> #include "base/location.h" -#include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h" @@ -77,8 +76,8 @@ fake_file_system_.AddFile( File(kArcUrlPipe, kData, kMimeType, File::Seekable::NO)); - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - profile_ = base::MakeUnique<TestingProfile>(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + profile_ = std::make_unique<TestingProfile>(); arc_service_manager_->set_browser_context(profile_.get()); ArcFileSystemOperationRunner::GetFactory()->SetTestingFactoryAndUse( profile_.get(), &CreateFileSystemOperationRunnerForTesting);
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc index 0c08f26e..d9ffa81 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h" #include "content/public/browser/browser_thread.h" #include "storage/browser/fileapi/file_stream_reader.h" @@ -40,7 +39,7 @@ storage::FileSystemContext* context) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - return base::MakeUnique<ArcDocumentsProviderFileStreamReader>(url, offset); + return std::make_unique<ArcDocumentsProviderFileStreamReader>(url, offset); } std::unique_ptr<storage::FileStreamWriter>
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc index 2fbed23..40b5251 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h" #include "base/bind.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h" @@ -110,7 +109,7 @@ DCHECK(!content_url_resolved_); if (content_url.is_valid()) { - underlying_reader_ = base::MakeUnique<ArcContentFileSystemFileStreamReader>( + underlying_reader_ = std::make_unique<ArcContentFileSystemFileStreamReader>( content_url, offset_); } content_url_resolved_ = true;
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc index 74bbb02..c9d0aad 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc
@@ -11,7 +11,6 @@ #include "base/callback.h" #include "base/files/file.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" #include "base/timer/timer.h"
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.cc index 4de4a41..2a7a58a3e 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map_factory.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" @@ -55,7 +54,7 @@ for (const auto& spec : kDocumentsProviderWhitelist) { map_[Key(spec.authority, spec.root_document_id)] = - base::MakeUnique<ArcDocumentsProviderRoot>(runner, spec.authority, + std::make_unique<ArcDocumentsProviderRoot>(runner, spec.authority, spec.root_document_id); } }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc index 9da53c78..53a251b 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc
@@ -9,7 +9,6 @@ #include <utility> #include "base/files/file_path.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" @@ -124,8 +123,8 @@ fake_file_system_.AddDocument(ToDocument(spec)); } - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - profile_ = base::MakeUnique<TestingProfile>(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + profile_ = std::make_unique<TestingProfile>(); arc_service_manager_->set_browser_context(profile_.get()); ArcFileSystemOperationRunner::GetFactory()->SetTestingFactoryAndUse( profile_.get(), &CreateFileSystemOperationRunnerForTesting); @@ -136,7 +135,7 @@ base::RunLoop().RunUntilIdle(); ASSERT_TRUE(fake_file_system_.InitCalled()); - root_ = base::MakeUnique<ArcDocumentsProviderRoot>( + root_ = std::make_unique<ArcDocumentsProviderRoot>( ArcFileSystemOperationRunner::GetForBrowserContext(profile_.get()), kAuthority, kRootSpec.document_id); }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc index 12439c7..9efdd5e 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc
@@ -65,7 +65,7 @@ ArcFileSystemOperationRunner::CreateForTesting( content::BrowserContext* context, ArcBridgeService* bridge_service) { - // We can't use base::MakeUnique() here because we are calling a private + // We can't use std::make_unique() here because we are calling a private // constructor. return base::WrapUnique<ArcFileSystemOperationRunner>( new ArcFileSystemOperationRunner(context, bridge_service, false));
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_unittest.cc index 830793f..9587b95 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_unittest.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_unittest.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/optional.h" #include "base/run_loop.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h" @@ -37,12 +36,12 @@ ~ArcFileSystemOperationRunnerTest() override = default; void SetUp() override { - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - profile_ = base::MakeUnique<TestingProfile>(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + profile_ = std::make_unique<TestingProfile>(); ArcFileSystemBridge::GetFactory()->SetTestingFactoryAndUse( profile_.get(), [](content::BrowserContext* context) -> std::unique_ptr<KeyedService> { - return base::MakeUnique<ArcFileSystemBridge>( + return std::make_unique<ArcFileSystemBridge>( context, ArcServiceManager::Get()->arc_bridge_service()); }); runner_ = ArcFileSystemOperationRunner::CreateForTesting(
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc index b14850d..5cbdb2b 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service.cc
@@ -678,7 +678,7 @@ void ArcSettingsService::OnInstanceReady() { impl_ = - base::MakeUnique<ArcSettingsServiceImpl>(context_, arc_bridge_service_); + std::make_unique<ArcSettingsServiceImpl>(context_, arc_bridge_service_); } void ArcSettingsService::OnInstanceClosed() {
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc index c195c9e..e13db3c0 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc
@@ -10,7 +10,6 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/json/json_reader.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/values.h" @@ -340,7 +339,7 @@ policy::PolicyMap policy; policy.Set(policy::key::kArcBackupRestoreEnabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, - policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), + policy::POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr); UpdatePolicy(policy); @@ -360,7 +359,7 @@ // The policy is set to true. policy.Set(policy::key::kArcBackupRestoreEnabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, - policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), + policy::POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr); UpdatePolicy(policy); @@ -403,7 +402,7 @@ policy::PolicyMap policy; policy.Set(policy::key::kArcLocationServiceEnabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, - policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), + policy::POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr); UpdatePolicy(policy); @@ -424,7 +423,7 @@ // The policy is set to true. policy.Set(policy::key::kArcLocationServiceEnabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, - policy::POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), + policy::POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr); UpdatePolicy(policy); @@ -463,12 +462,12 @@ policy.Set( policy::key::kProxyMode, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(ProxyPrefs::kAutoDetectProxyModeName), + std::make_unique<base::Value>(ProxyPrefs::kAutoDetectProxyModeName), nullptr); UpdatePolicy(policy); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kAutoDetectProxyModeName); expected_proxy_config->SetString("pacUrl", "http://wpad/wpad.dat"); @@ -484,11 +483,11 @@ policy.Set(policy::key::kOpenNetworkConfiguration, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(kONCPolicy), nullptr); + std::make_unique<base::Value>(kONCPolicy), nullptr); UpdatePolicy(policy); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kPacScriptProxyModeName); expected_proxy_config->SetString("pacUrl", kONCPacUrl); @@ -506,15 +505,15 @@ policy.Set( policy::key::kProxyMode, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(ProxyPrefs::kFixedServersProxyModeName), + std::make_unique<base::Value>(ProxyPrefs::kFixedServersProxyModeName), nullptr); policy.Set(policy::key::kProxyServer, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>("proxy:8888"), nullptr); + std::make_unique<base::Value>("proxy:8888"), nullptr); UpdatePolicy(policy); std::unique_ptr<base::DictionaryValue> proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); proxy_config->SetString("mode", ProxyPrefs::kAutoDetectProxyModeName); ProxyConfigDictionary proxy_config_dict(std::move(proxy_config)); const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() @@ -525,7 +524,7 @@ RunUntilIdle(); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); expected_proxy_config->SetString("host", "proxy"); @@ -539,7 +538,7 @@ fake_intent_helper_instance_->clear_broadcasts(); std::unique_ptr<base::DictionaryValue> proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); proxy_config->SetString("mode", ProxyPrefs::kPacScriptProxyModeName); proxy_config->SetString("pac_url", "http://proxy"); browser()->profile()->GetPrefs()->Set(proxy_config::prefs::kProxy, @@ -547,7 +546,7 @@ RunUntilIdle(); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kPacScriptProxyModeName); expected_proxy_config->SetString("pacUrl", "http://proxy"); EXPECT_EQ(CountProxyBroadcasts(fake_intent_helper_instance_->broadcasts(), @@ -559,14 +558,14 @@ fake_intent_helper_instance_->clear_broadcasts(); std::unique_ptr<base::DictionaryValue> proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); proxy_config->SetString("server", "proxy:8080"); SetProxyConfigForNetworkService(kDefaultServicePath, proxy_config.get()); RunUntilIdle(); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); expected_proxy_config->SetString("host", "proxy"); @@ -581,7 +580,7 @@ fake_intent_helper_instance_->clear_broadcasts(); // Set proxy confog for default network. std::unique_ptr<base::DictionaryValue> default_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); default_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); default_proxy_config->SetString("server", "default/proxy:8080"); @@ -591,7 +590,7 @@ // Set proxy confog for WI-FI network. std::unique_ptr<base::DictionaryValue> wifi_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); wifi_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); wifi_proxy_config->SetString("server", "wifi/proxy:8080"); SetProxyConfigForNetworkService(kWifi0ServicePath, wifi_proxy_config.get()); @@ -599,7 +598,7 @@ // Observe default network proxy config broadcast. std::unique_ptr<base::DictionaryValue> expected_default_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_default_proxy_config->SetString( "mode", ProxyPrefs::kFixedServersProxyModeName); expected_default_proxy_config->SetString("host", "default/proxy"); @@ -614,7 +613,7 @@ // Observe WI-FI network proxy config broadcast. std::unique_ptr<base::DictionaryValue> expected_wifi_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_wifi_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); expected_wifi_proxy_config->SetString("host", "wifi/proxy"); @@ -648,15 +647,15 @@ policy.Set(policy::key::kOpenNetworkConfiguration, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(kUserONCPolicy), nullptr); + std::make_unique<base::Value>(kUserONCPolicy), nullptr); policy.Set(policy::key::kDeviceOpenNetworkConfiguration, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(kDeviceONCPolicy), nullptr); + std::make_unique<base::Value>(kDeviceONCPolicy), nullptr); UpdatePolicy(policy); std::unique_ptr<base::DictionaryValue> expected_proxy_config( - base::MakeUnique<base::DictionaryValue>()); + std::make_unique<base::DictionaryValue>()); expected_proxy_config->SetString("mode", ProxyPrefs::kFixedServersProxyModeName); expected_proxy_config->SetString("host", "proxy");
diff --git a/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge.cc b/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge.cc index eea98763..a5a86ad1 100644 --- a/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge.cc +++ b/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.h" @@ -60,7 +61,7 @@ std::unique_ptr<ArcKioskBridge> ArcKioskBridge::CreateForTesting( ArcBridgeService* arc_bridge_service, Delegate* delegate) { - // MakeUnique cannot be used because the ctor is private. + // std::make_unique() cannot be used because the ctor is private. return base::WrapUnique(new ArcKioskBridge(arc_bridge_service, delegate)); }
diff --git a/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge_unittest.cc b/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge_unittest.cc index 9b3b1f4..03beb3f7 100644 --- a/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge_unittest.cc
@@ -5,7 +5,6 @@ #include <memory> #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/kiosk/arc_kiosk_bridge.h" #include "components/arc/arc_bridge_service.h" #include "testing/gmock/include/gmock/gmock.h" @@ -28,8 +27,8 @@ class ArcKioskBridgeTest : public testing::Test { public: ArcKioskBridgeTest() - : bridge_service_(base::MakeUnique<ArcBridgeService>()), - delegate_(base::MakeUnique<MockArcKioskBridgeDelegate>()), + : bridge_service_(std::make_unique<ArcBridgeService>()), + delegate_(std::make_unique<MockArcKioskBridgeDelegate>()), kiosk_bridge_(ArcKioskBridge::CreateForTesting(bridge_service_.get(), delegate_.get())) {}
diff --git a/chrome/browser/chromeos/arc/notification/arc_boot_error_notification.cc b/chrome/browser/chromeos/arc/notification/arc_boot_error_notification.cc index 571f1cc..dd5a72d445 100644 --- a/chrome/browser/chromeos/arc/notification/arc_boot_error_notification.cc +++ b/chrome/browser/chromeos/arc/notification/arc_boot_error_notification.cc
@@ -4,8 +4,10 @@ #include "chrome/browser/chromeos/arc/notification/arc_boot_error_notification.h" +#include <memory> +#include <utility> + #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc index d2cb77f3..4e40cb6 100644 --- a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc +++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc
@@ -52,7 +52,7 @@ optional_fields.never_timeout = true; message_center::MessageCenter::Get()->AddNotification( - base::MakeUnique<message_center::Notification>( + std::make_unique<message_center::Notification>( message_center::NOTIFICATION_TYPE_SIMPLE, kManagedProvisionNotificationId, l10n_util::GetStringUTF16( @@ -107,7 +107,7 @@ content::BrowserContext* context, ArcBridgeService* bridge_service) : ArcProvisionNotificationService(context, - base::MakeUnique<DelegateImpl>()) {} + std::make_unique<DelegateImpl>()) {} ArcProvisionNotificationService::~ArcProvisionNotificationService() { // Make sure no notification is left being shown.
diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service_unittest.cc b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service_unittest.cc index c1fbca28..d1451ca 100644 --- a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service_unittest.cc +++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service_unittest.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/files/scoped_temp_dir.h" -#include "base/memory/ptr_util.h" #include "base/values.h" #include "chrome/browser/chromeos/arc/arc_auth_notification.h" #include "chrome/browser/chromeos/arc/arc_optin_uma.h" @@ -54,7 +53,7 @@ void SetUp() override { chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( - base::MakeUnique<chromeos::FakeSessionManagerClient>()); + std::make_unique<chromeos::FakeSessionManagerClient>()); chromeos::DBusThreadManager::Initialize(); SetArcAvailableCommandLineForTesting( @@ -68,11 +67,11 @@ profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); profile_ = profile_builder.Build(); - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); std::unique_ptr<MockArcProvisionNotificationServiceDelegate> - mock_arc_provision_notification_service_delegate = base::MakeUnique< + mock_arc_provision_notification_service_delegate = std::make_unique< StrictMock<MockArcProvisionNotificationServiceDelegate>>(); arc_provision_notification_service_delegate_ = mock_arc_provision_notification_service_delegate.get(); @@ -141,11 +140,11 @@ ManagedProvisionNotification_Basic) { // Set up managed ARC and assign managed values to all opt-in prefs. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcBackupRestoreEnabled, std::make_unique<base::Value>(false)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcLocationServiceEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcLocationServiceEnabled, std::make_unique<base::Value>(false)); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize(); @@ -182,11 +181,11 @@ // Set up managed ARC and assign managed values to all opt-in prefs. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcBackupRestoreEnabled, std::make_unique<base::Value>(false)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcLocationServiceEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcLocationServiceEnabled, std::make_unique<base::Value>(false)); // Set the pref that indicates that signing into ARC has already been // performed. profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); @@ -207,11 +206,11 @@ ManagedProvisionNotification_Failure) { // Set up managed ARC and assign managed values to all opt-in prefs. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcBackupRestoreEnabled, std::make_unique<base::Value>(false)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcLocationServiceEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcLocationServiceEnabled, std::make_unique<base::Value>(false)); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize(); @@ -244,11 +243,11 @@ ManagedProvisionNotification_FailureNotStopping) { // Set up managed ARC and assign managed values to all opt-in prefs. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcBackupRestoreEnabled, std::make_unique<base::Value>(false)); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcLocationServiceEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcLocationServiceEnabled, std::make_unique<base::Value>(false)); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize(); @@ -287,7 +286,7 @@ // Set ARC to be managed. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcEnabled, base::MakeUnique<base::Value>(true)); + prefs::kArcEnabled, std::make_unique<base::Value>(true)); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize();
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc index b0236fb..5bad4ed 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc
@@ -6,7 +6,6 @@ #include <string> -#include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h" namespace arc { @@ -26,7 +25,7 @@ void ArcTermsOfServiceDefaultNegotiator::StartNegotiationImpl() { DCHECK(!preference_handler_); preference_handler_ = - base::MakeUnique<ArcOptInPreferenceHandler>(this, pref_service_); + std::make_unique<ArcOptInPreferenceHandler>(this, pref_service_); // This automatically updates all preferences. preference_handler_->Start();
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc index 3fa9c6a9a..ee33898 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/values.h" #include "chrome/browser/chromeos/arc/arc_support_host.h" @@ -32,14 +31,14 @@ void SetUp() override { user_manager_enabler_ = - base::MakeUnique<chromeos::ScopedUserManagerEnabler>( + std::make_unique<chromeos::ScopedUserManagerEnabler>( new chromeos::FakeChromeUserManager()); - profile_ = base::MakeUnique<TestingProfile>(); + profile_ = std::make_unique<TestingProfile>(); - support_host_ = base::MakeUnique<ArcSupportHost>(profile_.get()); - fake_arc_support_ = base::MakeUnique<FakeArcSupport>(support_host_.get()); - negotiator_ = base::MakeUnique<ArcTermsOfServiceDefaultNegotiator>( + support_host_ = std::make_unique<ArcSupportHost>(profile_.get()); + fake_arc_support_ = std::make_unique<FakeArcSupport>(support_host_.get()); + negotiator_ = std::make_unique<ArcTermsOfServiceDefaultNegotiator>( profile_->GetPrefs(), support_host()); } @@ -124,10 +123,10 @@ // The preferences are assigned to the managed false value, and the // corresponding checkboxes are unchecked. profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcBackupRestoreEnabled, std::make_unique<base::Value>(false)); EXPECT_FALSE(fake_arc_support()->backup_and_restore_mode()); profile()->GetTestingPrefService()->SetManagedPref( - prefs::kArcLocationServiceEnabled, base::MakeUnique<base::Value>(false)); + prefs::kArcLocationServiceEnabled, std::make_unique<base::Value>(false)); EXPECT_FALSE(fake_arc_support()->location_service_mode()); // The managed preference values are removed, and the corresponding checkboxes
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc index 471c5c6..21d9f24e2 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/arc/policy/arc_policy_bridge.h" -#include <memory> #include <utility> #include <vector> @@ -13,7 +12,6 @@ #include "base/json/json_reader.h" #include "base/json/json_string_value_serializer.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" @@ -146,7 +144,7 @@ } std::unique_ptr<base::ListValue> ca_certs( - base::MakeUnique<base::ListValue>()); + std::make_unique<base::ListValue>()); for (const auto& entry : certificates) { const base::DictionaryValue* certificate = nullptr; if (!entry.GetAsDictionary(&certificate)) {
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc index b7506dd..c3e98198 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
@@ -6,7 +6,6 @@ #include <string> #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/values.h" #include "chrome/browser/chromeos/arc/policy/arc_policy_bridge.h" @@ -93,14 +92,14 @@ arc::ArcPolicyBridge::GetPoliciesCallback PolicyStringCallback( const std::string& expected) { - auto was_run = base::MakeUnique<CheckedBoolean>(); + auto was_run = std::make_unique<CheckedBoolean>(); return base::Bind(&ExpectString, base::Passed(&was_run), expected); } arc::ArcPolicyBridge::ReportComplianceCallback PolicyComplianceCallback( base::Closure quit_closure, const std::string& expected) { - auto was_run = base::MakeUnique<CheckedBoolean>(); + auto was_run = std::make_unique<CheckedBoolean>(); return base::Bind(&ExpectStringWithClosure, quit_closure, base::Passed(&was_run), expected); } @@ -117,7 +116,7 @@ ArcPolicyBridgeTest() {} void SetUp() override { - bridge_service_ = base::MakeUnique<ArcBridgeService>(); + bridge_service_ = std::make_unique<ArcBridgeService>(); EXPECT_CALL(policy_service_, GetPolicies(policy::PolicyNamespace( policy::POLICY_DOMAIN_CHROME, std::string()))) @@ -125,26 +124,26 @@ EXPECT_CALL(policy_service_, AddObserver(policy::POLICY_DOMAIN_CHROME, _)) .Times(1); - policy_instance_ = base::MakeUnique<FakePolicyInstance>(); + policy_instance_ = std::make_unique<FakePolicyInstance>(); bridge_service_->policy()->SetInstance(policy_instance_.get()); // Setting up user profile for ReportCompliance() tests. chromeos::FakeChromeUserManager* const fake_user_manager = new chromeos::FakeChromeUserManager(); user_manager_enabler_ = - base::MakeUnique<chromeos::ScopedUserManagerEnabler>(fake_user_manager); + std::make_unique<chromeos::ScopedUserManagerEnabler>(fake_user_manager); const AccountId account_id( AccountId::FromUserEmailGaiaId("user@gmail.com", "1111111111")); fake_user_manager->AddUser(account_id); fake_user_manager->LoginUser(account_id); - testing_profile_manager_ = base::MakeUnique<TestingProfileManager>( + testing_profile_manager_ = std::make_unique<TestingProfileManager>( TestingBrowserProcess::GetGlobal()); ASSERT_TRUE(testing_profile_manager_->SetUp()); profile_ = testing_profile_manager_->CreateTestingProfile("user@gmail.com"); ASSERT_TRUE(profile_); // TODO(hidehiko): Use Singleton instance tied to BrowserContext. - policy_bridge_ = base::MakeUnique<ArcPolicyBridge>( + policy_bridge_ = std::make_unique<ArcPolicyBridge>( profile_, bridge_service_.get(), &policy_service_); policy_bridge_->OverrideIsManagedForTesting(true); } @@ -190,7 +189,7 @@ policy_map().Set( policy::key::kArcPolicy, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>( + std::make_unique<base::Value>( "{\"applications\":" "[{\"packageName\":\"com.google.android.apps.youtube.kids\"," "\"installType\":\"REQUIRED\"," @@ -216,7 +215,7 @@ policy_map().Set( policy::key::kHomepageLocation, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>("http://chromium.org"), nullptr); + std::make_unique<base::Value>("http://chromium.org"), nullptr); policy_bridge()->GetPolicies(PolicyStringCallback("{}")); } @@ -224,7 +223,7 @@ policy_map().Set(policy::key::kDisableScreenshots, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(true), nullptr); + std::make_unique<base::Value>(true), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"screenCaptureDisabled\":true}")); } @@ -233,7 +232,7 @@ policy_map().Set(policy::key::kVideoCaptureAllowed, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(false), nullptr); + std::make_unique<base::Value>(false), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"cameraDisabled\":true}")); } @@ -242,7 +241,7 @@ policy_map().Set(policy::key::kAudioCaptureAllowed, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(false), nullptr); + std::make_unique<base::Value>(false), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"unmuteMicrophoneDisabled\":true}")); } @@ -251,19 +250,19 @@ policy_map().Set(policy::key::kDefaultGeolocationSetting, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(1), nullptr); + std::make_unique<base::Value>(1), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"shareLocationDisabled\":false}")); policy_map().Set(policy::key::kDefaultGeolocationSetting, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(2), nullptr); + std::make_unique<base::Value>(2), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"shareLocationDisabled\":true}")); policy_map().Set(policy::key::kDefaultGeolocationSetting, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(3), nullptr); + std::make_unique<base::Value>(3), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"shareLocationDisabled\":false}")); } @@ -272,7 +271,7 @@ policy_map().Set(policy::key::kExternalStorageDisabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(true), nullptr); + std::make_unique<base::Value>(true), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"mountPhysicalMediaDisabled\":true}")); } @@ -303,11 +302,11 @@ policy_map().Set( policy::key::kArcCertificatesSyncMode, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(ArcCertsSyncMode::COPY_CA_CERTS), nullptr); + std::make_unique<base::Value>(ArcCertsSyncMode::COPY_CA_CERTS), nullptr); policy_map().Set(policy::key::kOpenNetworkConfiguration, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(kFakeONC), nullptr); + std::make_unique<base::Value>(kFakeONC), nullptr); policy_bridge()->GetPolicies(PolicyStringCallback( "{\"caCerts\":" "[{\"X509\":\"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24" @@ -322,7 +321,7 @@ policy_map().Set( policy::key::kArcCertificatesSyncMode, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(ArcCertsSyncMode::SYNC_DISABLED), nullptr); + std::make_unique<base::Value>(ArcCertsSyncMode::SYNC_DISABLED), nullptr); policy_bridge()->GetPolicies(PolicyStringCallback("{}")); } @@ -330,7 +329,7 @@ policy_map().Set(policy::key::kDeveloperToolsDisabled, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(true), nullptr); + std::make_unique<base::Value>(true), nullptr); policy_bridge()->GetPolicies( PolicyStringCallback("{\"debuggingFeaturesDisabled\":true}")); } @@ -339,7 +338,7 @@ policy_map().Set( policy::key::kArcPolicy, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>( + std::make_unique<base::Value>( "{\"applications\":" "[{\"packageName\":\"com.google.android.apps.youtube.kids\"," "\"installType\":\"REQUIRED\"," @@ -351,11 +350,11 @@ policy_map().Set( policy::key::kHomepageLocation, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>("http://chromium.org"), nullptr); + std::make_unique<base::Value>("http://chromium.org"), nullptr); policy_map().Set(policy::key::kVideoCaptureAllowed, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - base::MakeUnique<base::Value>(false), nullptr); + std::make_unique<base::Value>(false), nullptr); policy_bridge()->GetPolicies(PolicyStringCallback( "{\"applications\":" "[{\"installType\":\"REQUIRED\","
diff --git a/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc b/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc index d9f3acb..5a89f4a 100644 --- a/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc +++ b/chrome/browser/chromeos/arc/test/arc_data_removed_waiter.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/browser/chromeos/arc/test/arc_data_removed_waiter.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" namespace arc { @@ -18,7 +17,7 @@ } void ArcDataRemovedWaiter::Wait() { - run_loop_ = base::MakeUnique<base::RunLoop>(); + run_loop_ = std::make_unique<base::RunLoop>(); run_loop_->Run(); run_loop_.reset(); }
diff --git a/chrome/browser/chromeos/arc/tts/arc_tts_service_unittest.cc b/chrome/browser/chromeos/arc/tts/arc_tts_service_unittest.cc index 29147a5..9de9620 100644 --- a/chrome/browser/chromeos/arc/tts/arc_tts_service_unittest.cc +++ b/chrome/browser/chromeos/arc/tts/arc_tts_service_unittest.cc
@@ -51,16 +51,16 @@ ~ArcTtsServiceTest() override = default; void SetUp() override { - arc_service_manager_ = base::MakeUnique<ArcServiceManager>(); - testing_profile_ = base::MakeUnique<TestingProfile>(); - arc_session_manager_ = base::MakeUnique<ArcSessionManager>( - base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); - tts_controller_ = base::MakeUnique<TestableTtsController>(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + testing_profile_ = std::make_unique<TestingProfile>(); + arc_session_manager_ = std::make_unique<ArcSessionManager>( + std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); + tts_controller_ = std::make_unique<TestableTtsController>(); ArcTtsService::GetFactory()->SetTestingFactoryAndUse( testing_profile_.get(), [](content::BrowserContext* context) -> std::unique_ptr<KeyedService> { - return base::MakeUnique<ArcTtsService>( + return std::make_unique<ArcTtsService>( context, ArcServiceManager::Get()->arc_bridge_service()); }); tts_service_ = ArcTtsService::GetForBrowserContext(testing_profile_.get());
diff --git a/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc b/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc index 78516e8..afc0758 100644 --- a/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc +++ b/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc
@@ -4,12 +4,12 @@ #include "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h" +#include <memory> #include <string> #include <utility> #include "base/location.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/message_loop/message_loop.h" #include "base/threading/thread_task_runner_handle.h" @@ -141,7 +141,7 @@ std::move(callback).Run(std::move(child_handle), token); mojo::MakeStrongBinding( - base::MakeUnique<VideoAcceleratorFactoryService>(), + std::make_unique<VideoAcceleratorFactoryService>(), mojom::VideoAcceleratorFactoryRequest(std::move(server_pipe))); }
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc index 74a19bb..8fda88e 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc +++ b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
@@ -107,7 +107,7 @@ if (blocked_layers.count(owner->layer()->parent())) return nullptr; if (blocked_layers.count(owner->layer())) { - auto layer = base::MakeUnique<ui::Layer>( + auto layer = std::make_unique<ui::Layer>( ui::LayerType::LAYER_SOLID_COLOR); layer->SetBounds(owner->layer()->bounds()); layer->SetColor(SK_ColorBLACK);
diff --git a/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc b/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc index 3ebea4ea5..8642b9ec 100644 --- a/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc +++ b/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc
@@ -11,7 +11,6 @@ #include "ash/shell.h" #include "ash/wallpaper/wallpaper_controller.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/task_scheduler/post_task.h" #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" @@ -202,7 +201,7 @@ wallpaper_id = -1; // Previous request will be cancelled at destructor of // ImageDecoder::ImageRequest. - decode_request_ = base::MakeUnique<DecodeRequest>(this, wallpaper_id); + decode_request_ = std::make_unique<DecodeRequest>(this, wallpaper_id); ImageDecoder::StartWithOptions(decode_request_.get(), data, ImageDecoder::DEFAULT_CODEC, true, gfx::Size());
diff --git a/chrome/browser/chromeos/login/active_directory_login_browsertest.cc b/chrome/browser/chromeos/login/active_directory_login_browsertest.cc new file mode 100644 index 0000000..9fbf8a7 --- /dev/null +++ b/chrome/browser/chromeos/login/active_directory_login_browsertest.cc
@@ -0,0 +1,320 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "base/command_line.h" +#include "base/location.h" +#include "base/run_loop.h" +#include "base/single_thread_task_runner.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/threading/thread_task_runner_handle.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/login/login_manager_test.h" +#include "chrome/browser/chromeos/login/startup_utils.h" +#include "chrome/browser/chromeos/login/test/js_checker.h" +#include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" +#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" +#include "chrome/browser/chromeos/login/wizard_controller.h" +#include "chrome/browser/chromeos/settings/stub_install_attributes.h" +#include "chrome/grit/generated_resources.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/interactive_test_utils.h" +#include "chromeos/chromeos_switches.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_auth_policy_client.h" +#include "components/signin/core/account_id/account_id.h" +#include "components/user_manager/user_names.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_utils.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/geometry/test/rect_test_util.h" + +using ::gfx::test::RectContains; + +namespace chromeos { +namespace { + +const char kPassword[] = "password"; + +constexpr char kAdOfflineAuthId[] = "offline-ad-auth"; + +constexpr char kDeviceId[] = "device_id"; +constexpr char kTestActiveDirectoryUser[] = "test-user"; +constexpr char kAdMachineInput[] = "machineNameInput"; +constexpr char kAdUserInput[] = "userInput"; +constexpr char kAdPasswordInput[] = "passwordInput"; +constexpr char kAdButton[] = "button"; +constexpr char kAdWelcomMessage[] = "welcomeMsg"; +constexpr char kAdAutocompleteRealm[] = "userInput /deep/ #domainLabel"; + +class TestAuthPolicyClient : public FakeAuthPolicyClient { + public: + TestAuthPolicyClient() { FakeAuthPolicyClient::set_started(true); } + + void AuthenticateUser(const std::string& user_principal_name, + const std::string& object_guid, + int password_fd, + AuthCallback callback) override { + authpolicy::ActiveDirectoryAccountInfo account_info; + if (auth_error_ == authpolicy::ERROR_NONE) { + if (object_guid.empty()) + account_info.set_account_id(base::MD5String(user_principal_name)); + else + account_info.set_account_id(object_guid); + } + if (!auth_closure_.is_null()) { + base::SequencedTaskRunnerHandle::Get()->PostNonNestableTask( + FROM_HERE, std::move(auth_closure_)); + } + base::SequencedTaskRunnerHandle::Get()->PostNonNestableTask( + FROM_HERE, + base::BindOnce(std::move(callback), auth_error_, account_info)); + } + + void set_auth_closure(base::OnceClosure auth_closure) { + auth_closure_ = std::move(auth_closure); + } + + protected: + // If set called before calling AuthCallback in AuthenticateUser. + base::OnceClosure auth_closure_; + + private: + DISALLOW_COPY_AND_ASSIGN(TestAuthPolicyClient); +}; + +class ActiveDirectoryLoginTest : public LoginManagerTest { + public: + ActiveDirectoryLoginTest() + : LoginManagerTest(true), + // Using the same realm as supervised user domain. Should be treated as + // normal realm. + test_realm_(user_manager::kSupervisedUserDomain), + install_attributes_( + ScopedStubInstallAttributes::CreateActiveDirectoryManaged( + test_realm_, + kDeviceId)) {} + + ~ActiveDirectoryLoginTest() override = default; + + void SetUp() override { + SetupTestAuthPolicyClient(); + LoginManagerTest::SetUp(); + } + + void SetUpCommandLine(base::CommandLine* command_line) override { + command_line->AppendSwitch(switches::kOobeSkipPostLogin); + LoginManagerTest::SetUpCommandLine(command_line); + } + + void SetUpOnMainThread() override { + LoginManagerTest::SetUpOnMainThread(); + fake_auth_policy_client()->DisableOperationDelayForTesting(); + } + + void MarkAsActiveDirectoryEnterprise() { + StartupUtils::MarkOobeCompleted(); + base::RunLoop loop; + fake_auth_policy_client()->RefreshDevicePolicy( + base::BindOnce(&ActiveDirectoryLoginTest::OnRefreshedPolicy, + base::Unretained(this), loop.QuitClosure())); + loop.Run(); + } + + void SetupTestAuthPolicyClient() { + auto test_client = base::MakeUnique<TestAuthPolicyClient>(); + fake_auth_policy_client_ = test_client.get(); + DBusThreadManager::GetSetterForTesting()->SetAuthPolicyClient( + std::move(test_client)); + } + + // Checks if Active Directory login is visible. + void TestLoginVisible() { + OobeScreenWaiter screen_waiter(OobeScreen::SCREEN_GAIA_SIGNIN); + screen_waiter.Wait(); + // Checks if Gaia signin is hidden. + JSExpect("document.querySelector('#signin-frame').hidden"); + + // Checks if Active Directory signin is visible. + JSExpect("!document.querySelector('#offline-ad-auth').hidden"); + JSExpect(JSElement(kAdOfflineAuthId, kAdMachineInput) + ".hidden"); + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdUserInput) + ".hidden"); + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdPasswordInput) + ".hidden"); + + const std::string innerText(".innerText"); + // Checks if Active Directory welcome message contains realm. + EXPECT_EQ(l10n_util::GetStringFUTF8(IDS_AD_DOMAIN_AUTH_WELCOME_MESSAGE, + base::UTF8ToUTF16(test_realm_)), + js_checker().GetString( + JSElement(kAdOfflineAuthId, kAdWelcomMessage) + innerText)); + + // Checks if realm is set to autocomplete username. + EXPECT_EQ( + "@" + test_realm_, + js_checker().GetString( + JSElement(kAdOfflineAuthId, kAdAutocompleteRealm) + innerText)); + + // Checks if bottom bar is visible. + JSExpect("!Oobe.getInstance().headerHidden"); + } + + // Checks if user input is marked as invalid. + void TestUserError() { + TestLoginVisible(); + JSExpect(JSElement(kAdOfflineAuthId, kAdUserInput) + ".isInvalid"); + } + + // Checks if password input is marked as invalid. + void TestPasswordError() { + TestLoginVisible(); + JSExpect(JSElement(kAdOfflineAuthId, kAdPasswordInput) + ".isInvalid"); + } + + // Checks that machine, password and user inputs are valid. + void TestNoError() { + TestLoginVisible(); + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdMachineInput) + ".isInvalid"); + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdUserInput) + ".isInvalid"); + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdPasswordInput) + + ".isInvalid"); + } + + // Checks if autocomplete domain is visible for the user input. + void TestDomainVisible() { + JSExpect("!" + JSElement(kAdOfflineAuthId, kAdAutocompleteRealm) + + ".hidden"); + } + + // Checks if autocomplete domain is hidden for the user input. + void TestDomainHidden() { + JSExpect(JSElement(kAdOfflineAuthId, kAdAutocompleteRealm) + ".hidden"); + } + + // Sets username and password for the Active Directory login and submits it. + void SubmitActiveDirectoryCredentials(const std::string& username, + const std::string& password) { + js_checker().ExecuteAsync(JSElement(kAdOfflineAuthId, kAdUserInput) + + ".value='" + username + "'"); + js_checker().ExecuteAsync(JSElement(kAdOfflineAuthId, kAdPasswordInput) + + ".value='" + password + "'"); + js_checker().Evaluate(JSElement(kAdOfflineAuthId, kAdButton) + + ".fire('tap')"); + } + + void SetupActiveDirectoryJSNotifications() { + js_checker().Evaluate( + "var testInvalidateAd = login.GaiaSigninScreen.invalidateAd;" + "login.GaiaSigninScreen.invalidateAd = function(user, errorState) {" + " testInvalidateAd(user, errorState);" + " window.domAutomationController.send('ShowAuthError');" + "}"); + } + + void WaitForMessage(content::DOMMessageQueue* message_queue, + const std::string& expected_message) { + std::string message; + do { + ASSERT_TRUE(message_queue->WaitForMessage(&message)); + } while (message != expected_message); + } + + protected: + // Returns string representing element with id=|element_id| inside Active + // Directory login element. + std::string JSElement(const std::string& parent_id, + const std::string& element_id) { + return "document.querySelector('#" + parent_id + " /deep/ #" + element_id + + "')"; + } + + TestAuthPolicyClient* fake_auth_policy_client() { + return fake_auth_policy_client_; + } + + const std::string test_realm_; + + private: + // Used for the callback from FakeAuthPolicy::RefreshDevicePolicy. + void OnRefreshedPolicy(const base::Closure& closure, bool status) { + EXPECT_TRUE(status); + closure.Run(); + } + + ScopedStubInstallAttributes install_attributes_; + TestAuthPolicyClient* fake_auth_policy_client_; + + DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryLoginTest); +}; + +} // namespace + +// Marks as Active Directory enterprise device and OOBE as completed. +IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, PRE_LoginSuccess) { + MarkAsActiveDirectoryEnterprise(); +} + +// Test successful Active Directory login. +// Fails on MSAN: https://crbug.com/770738. +IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, DISABLED_LoginSuccess) { + TestNoError(); + TestDomainVisible(); + + content::WindowedNotificationObserver session_start_waiter( + chrome::NOTIFICATION_SESSION_STARTED, + content::NotificationService::AllSources()); + SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); + session_start_waiter.Wait(); +} + +// Marks as Active Directory enterprise device and OOBE as completed. +IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, PRE_LoginErrors) { + MarkAsActiveDirectoryEnterprise(); +} + +// Test different UI errors for Active Directory login. +// Fails on MSAN: https://crbug.com/770738. +IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, DISABLED_LoginErrors) { + SetupActiveDirectoryJSNotifications(); + TestNoError(); + TestDomainVisible(); + + content::DOMMessageQueue message_queue; + + SubmitActiveDirectoryCredentials("", ""); + TestUserError(); + TestDomainVisible(); + + SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, ""); + TestPasswordError(); + TestDomainVisible(); + + SubmitActiveDirectoryCredentials(std::string(kTestActiveDirectoryUser) + "@", + kPassword); + TestUserError(); + TestDomainHidden(); + + fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_USER_NAME); + SubmitActiveDirectoryCredentials( + std::string(kTestActiveDirectoryUser) + "@" + test_realm_, kPassword); + WaitForMessage(&message_queue, "\"ShowAuthError\""); + TestUserError(); + TestDomainVisible(); + + fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_PASSWORD); + SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); + WaitForMessage(&message_queue, "\"ShowAuthError\""); + TestPasswordError(); + TestDomainVisible(); + + fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_UNKNOWN); + SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); + WaitForMessage(&message_queue, "\"ShowAuthError\""); + // Inputs are not invalidated for the unknown error. + TestNoError(); + TestDomainVisible(); +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index 2e33cf9..8c2629a0 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -184,149 +184,6 @@ } }; -const char kDeviceId[] = "device_id"; -const char kTestActiveDirectoryUser[] = "test-user"; -const char kAdMachineInput[] = "machineNameInput"; -const char kAdUserInput[] = "userInput"; -const char kAdPasswordInput[] = "passwordInput"; -const char kAdButton[] = "button"; -const char kAdWelcomMessage[] = "welcomeMsg"; -const char kAdAutocompleteRealm[] = "userInput /deep/ #domainLabel"; - -class ActiveDirectoryLoginTest : public LoginManagerTest { - public: - ActiveDirectoryLoginTest() - : LoginManagerTest(true), - // Using the same realm as supervised user domain. Should be treated as - // normal realm. - test_realm_(user_manager::kSupervisedUserDomain), - install_attributes_( - ScopedStubInstallAttributes::CreateActiveDirectoryManaged( - test_realm_, - kDeviceId)) {} - - ~ActiveDirectoryLoginTest() override = default; - - void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitch(switches::kOobeSkipPostLogin); - LoginManagerTest::SetUpCommandLine(command_line); - } - - void SetUpOnMainThread() override { - LoginManagerTest::SetUpOnMainThread(); - fake_auth_policy_client()->DisableOperationDelayForTesting(); - } - - void MarkAsActiveDirectoryEnterprise() { - StartupUtils::MarkOobeCompleted(); - base::RunLoop loop; - fake_auth_policy_client()->RefreshDevicePolicy( - base::BindOnce(&ActiveDirectoryLoginTest::OnRefreshedPolicy, - base::Unretained(this), loop.QuitClosure())); - loop.Run(); - } - - // Checks if Active Directory login is visible. - void TestLoginVisible() { - // Checks if Gaia signin is hidden. - JSExpect("document.querySelector('#signin-frame').hidden"); - - // Checks if Active Directory signin is visible. - JSExpect("!document.querySelector('#offline-ad-auth').hidden"); - JSExpect(JSElement(kAdMachineInput) + ".hidden"); - JSExpect("!" + JSElement(kAdUserInput) + ".hidden"); - JSExpect("!" + JSElement(kAdPasswordInput) + ".hidden"); - - const std::string innerText(".innerText"); - // Checks if Active Directory welcome message contains realm. - EXPECT_EQ(l10n_util::GetStringFUTF8(IDS_AD_DOMAIN_AUTH_WELCOME_MESSAGE, - base::UTF8ToUTF16(test_realm_)), - js_checker().GetString(JSElement(kAdWelcomMessage) + innerText)); - - // Checks if realm is set to autocomplete username. - EXPECT_EQ( - "@" + test_realm_, - js_checker().GetString(JSElement(kAdAutocompleteRealm) + innerText)); - - // Checks if bottom bar is visible. - JSExpect("!Oobe.getInstance().headerHidden"); - } - - // Checks if user input is marked as invalid. - void TestUserError() { - TestLoginVisible(); - JSExpect(JSElement(kAdUserInput) + ".isInvalid"); - } - - // Checks if password input is marked as invalid. - void TestPasswordError() { - TestLoginVisible(); - JSExpect(JSElement(kAdPasswordInput) + ".isInvalid"); - } - - // Checks if autocomplete domain is visible for the user input. - void TestDomainVisible() { - JSExpect("!" + JSElement(kAdAutocompleteRealm) + ".hidden"); - } - - // Checks if autocomplete domain is hidden for the user input. - void TestDomainHidden() { - JSExpect(JSElement(kAdAutocompleteRealm) + ".hidden"); - } - - // Sets username and password for the Active Directory login and submits it. - void SubmitActiveDirectoryCredentials(const std::string& username, - const std::string& password) { - js_checker().ExecuteAsync(JSElement(kAdUserInput) + ".value='" + username + - "'"); - js_checker().ExecuteAsync(JSElement(kAdPasswordInput) + ".value='" + - password + "'"); - js_checker().Evaluate(JSElement(kAdButton) + ".fire('tap')"); - } - - void SetupActiveDirectoryJSNotifications() { - js_checker().Evaluate( - "var testInvalidateAd = login.GaiaSigninScreen.invalidateAd;" - "login.GaiaSigninScreen.invalidateAd = function(user, errorState) {" - " testInvalidateAd(user, errorState);" - " window.domAutomationController.send('ShowAuthError');" - "}"); - } - - void WaitForMessage(content::DOMMessageQueue* message_queue, - const std::string& expected_message) { - std::string message; - do { - ASSERT_TRUE(message_queue->WaitForMessage(&message)); - } while (message != expected_message); - } - - protected: - // Returns string representing element with id=|element_id| inside Active - // Directory login element. - std::string JSElement(const std::string& element_id) { - return "document.querySelector('#offline-ad-auth /deep/ #" + element_id + - "')"; - } - FakeAuthPolicyClient* fake_auth_policy_client() { - return static_cast<FakeAuthPolicyClient*>( - DBusThreadManager::Get()->GetAuthPolicyClient()); - } - - const std::string test_realm_; - - private: - // Used for the callback from FakeAuthPolicy::RefreshDevicePolicy. - void OnRefreshedPolicy(const base::Closure& closure, bool status) { - EXPECT_TRUE(status); - closure.Run(); - } - - ScopedStubInstallAttributes install_attributes_; - - DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryLoginTest); -}; - // Used to make sure that the system tray is visible and within the screen // bounds after login. void TestSystemTrayIsVisible(bool otr) { @@ -427,64 +284,4 @@ TestSystemTrayIsVisible(false); } -// Marks as Active Directory enterprise device and OOBE as completed. -IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, PRE_LoginSuccess) { - MarkAsActiveDirectoryEnterprise(); -} - -// Test successful Active Directory login. -IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, LoginSuccess) { - TestLoginVisible(); - TestDomainVisible(); - - content::WindowedNotificationObserver session_start_waiter( - chrome::NOTIFICATION_SESSION_STARTED, - content::NotificationService::AllSources()); - SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); - session_start_waiter.Wait(); - - // Uncomment once flakiness is fixed, see http://crbug/692364. - // TestSystemTrayIsVisible(); -} - -// Marks as Active Directory enterprise device and OOBE as completed. -IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, PRE_LoginErrors) { - MarkAsActiveDirectoryEnterprise(); -} - -// Test different UI errors for Active Directory login. -IN_PROC_BROWSER_TEST_F(ActiveDirectoryLoginTest, LoginErrors) { - SetupActiveDirectoryJSNotifications(); - TestLoginVisible(); - TestDomainVisible(); - - content::DOMMessageQueue message_queue; - - SubmitActiveDirectoryCredentials("", ""); - TestUserError(); - TestDomainVisible(); - - SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, ""); - TestPasswordError(); - TestDomainVisible(); - - SubmitActiveDirectoryCredentials(std::string(kTestActiveDirectoryUser) + "@", - kPassword); - TestUserError(); - TestDomainHidden(); - - fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_USER_NAME); - SubmitActiveDirectoryCredentials( - std::string(kTestActiveDirectoryUser) + "@" + test_realm_, kPassword); - WaitForMessage(&message_queue, "\"ShowAuthError\""); - TestUserError(); - TestDomainVisible(); - - fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_PASSWORD); - SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); - WaitForMessage(&message_queue, "\"ShowAuthError\""); - TestPasswordError(); - TestDomainVisible(); -} - } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc b/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc index 04c69333..1ba7259 100644 --- a/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc +++ b/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
@@ -6,7 +6,7 @@ #include "base/metrics/histogram_macros.h" #include "chrome/browser/chromeos/login/ui/captive_portal_view.h" -#include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" +#include "chrome/browser/chromeos/login/ui/internet_detail_dialog.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "components/constrained_window/constrained_window_views.h" #include "components/web_modal/web_contents_modal_dialog_host.h" @@ -63,8 +63,8 @@ } void CaptivePortalWindowProxy::Show() { - if (ProxySettingsDialog::IsShown()) { - // ProxySettingsDialog is being shown, don't cover it. + if (InternetDetailDialog::IsShown()) { + // InternetDetailDialog is being shown, don't cover it. Close(); return; }
diff --git a/chrome/browser/chromeos/login/ui/internet_detail_dialog.cc b/chrome/browser/chromeos/login/ui/internet_detail_dialog.cc new file mode 100644 index 0000000..76207d4 --- /dev/null +++ b/chrome/browser/chromeos/login/ui/internet_detail_dialog.cc
@@ -0,0 +1,101 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/login/ui/internet_detail_dialog.h" + +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/login/helper.h" +#include "chrome/common/url_constants.h" +#include "chrome/grit/generated_resources.h" +#include "chromeos/network/network_handler.h" +#include "chromeos/network/network_state.h" +#include "chromeos/network/network_state_handler.h" +#include "chromeos/network/network_type_pattern.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/notification_service.h" +#include "net/base/escape.h" +#include "third_party/cros_system_api/dbus/service_constants.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" + +namespace { + +// Width matches the Settings UI, height is sized to match the content. +const int kInternetDetailDialogWidth = 640; +const int kInternetDetailDialogHeight = 480; + +} // namespace + +namespace chromeos { + +// static +int InternetDetailDialog::instance_count_ = 0; + +InternetDetailDialog::InternetDetailDialog( + content::BrowserContext* browser_context, + const NetworkState& network, + LoginWebDialog::Delegate* delegate, + gfx::NativeWindow window) + : LoginWebDialog(browser_context, + delegate, + window, + base::string16(), + GURL(chrome::kChromeUIIntenetDetailDialogURL)), + guid_(network.guid()) { + name_ = network.Matches(NetworkTypePattern::Ethernet()) + ? l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET) + : base::UTF8ToUTF16(network.name()); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + ++instance_count_; + SetDialogSize(kInternetDetailDialogWidth, kInternetDetailDialogHeight); +} + +InternetDetailDialog::~InternetDetailDialog() { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + --instance_count_; +} + +base::string16 InternetDetailDialog::GetDialogTitle() const { + return name_; +} + +std::string InternetDetailDialog::GetDialogArgs() const { + return guid_; +} + +void InternetDetailDialog::OnDialogClosed(const std::string& json_retval) { + LoginWebDialog::OnDialogClosed(json_retval); + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, + content::NotificationService::AllSources(), + content::NotificationService::NoDetails()); +} + +bool InternetDetailDialog::IsShown() { + return instance_count_ > 0; +} + +void InternetDetailDialog::ShowDialog(content::BrowserContext* browser_context, + gfx::NativeWindow window, + const std::string& network_id) { + auto* network_state_handler = NetworkHandler::Get()->network_state_handler(); + const NetworkState* network; + if (!network_id.empty()) + network = network_state_handler->GetNetworkStateFromGuid(network_id); + else + network = network_state_handler->DefaultNetwork(); + if (!network) { + LOG(ERROR) << "Network not found: " << network_id; + return; + } + InternetDetailDialog* dialog = + new InternetDetailDialog(browser_context, *network, nullptr, window); + dialog->Show(); +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/ui/internet_detail_dialog.h b/chrome/browser/chromeos/login/ui/internet_detail_dialog.h new file mode 100644 index 0000000..477c868 --- /dev/null +++ b/chrome/browser/chromeos/login/ui/internet_detail_dialog.h
@@ -0,0 +1,58 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_INTERNET_DETAIL_DIALOG_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_UI_INTERNET_DETAIL_DIALOG_H_ + +#include "base/macros.h" +#include "base/strings/string16.h" +#include "chrome/browser/chromeos/login/ui/login_web_dialog.h" +#include "ui/gfx/native_widget_types.h" + +namespace content { +class BrowserContext; +} + +namespace chromeos { + +class NetworkState; + +// Should be used on the UI thread only, because of static |instance_count_|. +class InternetDetailDialog : public LoginWebDialog { + public: + // Returns whether the dialog is being shown. + static bool IsShown(); + + InternetDetailDialog(content::BrowserContext* browser_context, + const NetworkState& network, + LoginWebDialog::Delegate* delegate, + gfx::NativeWindow window); + ~InternetDetailDialog() override; + + // LoginWebDialog + base::string16 GetDialogTitle() const override; + std::string GetDialogArgs() const override; + + static void ShowDialog(content::BrowserContext* browser_context, + gfx::NativeWindow window, + const std::string& network_id); + + protected: + // ui::WebDialogDelegate implementation. + void OnDialogClosed(const std::string& json_retval) override; + + private: + // TODO(altimofeev): consider avoidance static variable by extending current + // WebUI/login interfaces. + static int instance_count_; + + std::string guid_; + base::string16 name_; + + DISALLOW_COPY_AND_ASSIGN(InternetDetailDialog); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_INTERNET_DETAIL_DIALOG_H_
diff --git a/chrome/browser/chromeos/login/ui/login_display_host.h b/chrome/browser/chromeos/login/ui/login_display_host.h index f4643326..a72bdad 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host.h +++ b/chrome/browser/chromeos/login/ui/login_display_host.h
@@ -55,10 +55,9 @@ // instance is gone. virtual void Finalize(base::OnceClosure completion_callback) = 0; - // Open proxy settings dialog. If |network_id| is not empty, shows the proxy - // settings for that network. Note: The 'proxy' settings also includes other - // network settings, e.g. IP config and nameservers. - virtual void OpenProxySettings(const std::string& network_id) = 0; + // Open the internet details dialog. If |network_id| is not empty, shows the + // details dialog for that network. + virtual void OpenInternetDetailDialog(const std::string& network_id) = 0; // Toggles status area visibility. virtual void SetStatusAreaVisible(bool visible) = 0;
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index 0f63976..cd4d968 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc
@@ -45,6 +45,7 @@ #include "chrome/browser/chromeos/login/signin/token_handle_util.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" +#include "chrome/browser/chromeos/login/ui/internet_detail_dialog.h" #include "chrome/browser/chromeos/login/ui/webui_login_display.h" #include "chrome/browser/chromeos/login/ui/webui_login_view.h" #include "chrome/browser/chromeos/login/wizard_controller.h" @@ -52,6 +53,7 @@ #include "chrome/browser/chromeos/net/delay_network_call.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/enrollment_config.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/system/device_disabling_manager.h" #include "chrome/browser/chromeos/system/input_device_settings.h" @@ -627,9 +629,10 @@ } } -void LoginDisplayHostImpl::OpenProxySettings(const std::string& network_id) { - if (login_view_) - login_view_->OpenProxySettings(network_id); +void LoginDisplayHostImpl::OpenInternetDetailDialog( + const std::string& network_id) { + InternetDetailDialog::ShowDialog(ProfileHelper::GetSigninProfile(), + GetNativeWindow(), network_id); } void LoginDisplayHostImpl::SetStatusAreaVisible(bool visible) {
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.h b/chrome/browser/chromeos/login/ui/login_display_host_impl.h index e169b39e..0050a88 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.h +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.h
@@ -69,7 +69,7 @@ WebUILoginView* GetWebUILoginView() const override; void BeforeSessionStart() override; void Finalize(base::OnceClosure completion_callback) override; - void OpenProxySettings(const std::string& network_id) override; + void OpenInternetDetailDialog(const std::string& network_id) override; void SetStatusAreaVisible(bool visible) override; void StartWizard(OobeScreen first_screen) override; WizardController* GetWizardController() override;
diff --git a/chrome/browser/chromeos/login/ui/mock_login_display_host.h b/chrome/browser/chromeos/login/ui/mock_login_display_host.h index 4dab0d8a..f49a6e91 100644 --- a/chrome/browser/chromeos/login/ui/mock_login_display_host.h +++ b/chrome/browser/chromeos/login/ui/mock_login_display_host.h
@@ -29,7 +29,7 @@ MockFinalize(&completion_callback); } - MOCK_METHOD1(OpenProxySettings, void(const std::string&)); + MOCK_METHOD1(OpenInternetDetailDialog, void(const std::string&)); MOCK_METHOD1(SetStatusAreaVisible, void(bool)); MOCK_METHOD0(ShowBackground, void(void)); MOCK_METHOD1(StartWizard, void(OobeScreen));
diff --git a/chrome/browser/chromeos/login/ui/proxy_settings_dialog.cc b/chrome/browser/chromeos/login/ui/proxy_settings_dialog.cc deleted file mode 100644 index 917c7ead..0000000 --- a/chrome/browser/chromeos/login/ui/proxy_settings_dialog.cc +++ /dev/null
@@ -1,81 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" - -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/helper.h" -#include "chrome/common/url_constants.h" -#include "chrome/grit/generated_resources.h" -#include "chromeos/network/network_state.h" -#include "chromeos/network/network_type_pattern.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "net/base/escape.h" -#include "third_party/cros_system_api/dbus/service_constants.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/size.h" - -namespace { - -// Width matches the Settings UI, height is sized to match the content. -const int kProxySettingsDialogWidth = 640; -const int kProxySettingsDialogHeight = 480; - -} // namespace - -namespace chromeos { - -// static -int ProxySettingsDialog::instance_count_ = 0; - -ProxySettingsDialog::ProxySettingsDialog( - content::BrowserContext* browser_context, - const NetworkState& network, - LoginWebDialog::Delegate* delegate, - gfx::NativeWindow window) - : LoginWebDialog(browser_context, - delegate, - window, - base::string16(), - GURL(chrome::kChromeUIProxySettingsURL)), - guid_(network.guid()) { - name_ = network.Matches(NetworkTypePattern::Ethernet()) - ? l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET) - : base::UTF8ToUTF16(network.name()); - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - ++instance_count_; - SetDialogSize(kProxySettingsDialogWidth, kProxySettingsDialogHeight); -} - -ProxySettingsDialog::~ProxySettingsDialog() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - --instance_count_; -} - -base::string16 ProxySettingsDialog::GetDialogTitle() const { - return name_; -} - -std::string ProxySettingsDialog::GetDialogArgs() const { - return guid_; -} - -void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { - LoginWebDialog::OnDialogClosed(json_retval); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, - content::NotificationService::AllSources(), - content::NotificationService::NoDetails()); -} - -bool ProxySettingsDialog::IsShown() { - return instance_count_ > 0; -} - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/ui/proxy_settings_dialog.h b/chrome/browser/chromeos/login/ui/proxy_settings_dialog.h deleted file mode 100644 index 63fdd50b..0000000 --- a/chrome/browser/chromeos/login/ui/proxy_settings_dialog.h +++ /dev/null
@@ -1,54 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_PROXY_SETTINGS_DIALOG_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_UI_PROXY_SETTINGS_DIALOG_H_ - -#include "base/macros.h" -#include "base/strings/string16.h" -#include "chrome/browser/chromeos/login/ui/login_web_dialog.h" -#include "ui/gfx/native_widget_types.h" - -namespace content { -class BrowserContext; -} - -namespace chromeos { - -class NetworkState; - -// Should be used on the UI thread only, because of static |instance_count_|. -class ProxySettingsDialog : public LoginWebDialog { - public: - // Returns whether the dialog is being shown. - static bool IsShown(); - - ProxySettingsDialog(content::BrowserContext* browser_context, - const NetworkState& network, - LoginWebDialog::Delegate* delegate, - gfx::NativeWindow window); - ~ProxySettingsDialog() override; - - // LoginWebDialog - base::string16 GetDialogTitle() const override; - std::string GetDialogArgs() const override; - - protected: - // ui::WebDialogDelegate implementation. - void OnDialogClosed(const std::string& json_retval) override; - - private: - // TODO(altimofeev): consider avoidance static variable by extending current - // WebUI/login interfaces. - static int instance_count_; - - std::string guid_; - base::string16 name_; - - DISALLOW_COPY_AND_ASSIGN(ProxySettingsDialog); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_PROXY_SETTINGS_DIALOG_H_
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc index 5c09561..1e4bfd2 100644 --- a/chrome/browser/chromeos/login/ui/webui_login_view.cc +++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
@@ -24,10 +24,10 @@ #include "chrome/browser/chromeos/accessibility/accessibility_util.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/lock_screen_apps/state_controller.h" +#include "chrome/browser/chromeos/login/ui/internet_detail_dialog.h" #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" #include "chrome/browser/chromeos/login/ui/preloaded_web_view.h" #include "chrome/browser/chromeos/login/ui/preloaded_web_view_factory.h" -#include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" #include "chrome/browser/chromeos/login/ui/web_contents_forced_title.h" #include "chrome/browser/chromeos/login/ui/webui_login_display.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" @@ -354,22 +354,6 @@ return static_cast<OobeUI*>(GetWebUI()->GetController()); } -void WebUILoginView::OpenProxySettings(const std::string& network_id) { - auto* network_state_handler = NetworkHandler::Get()->network_state_handler(); - const NetworkState* network; - if (!network_id.empty()) - network = network_state_handler->GetNetworkStateFromGuid(network_id); - else - network = network_state_handler->DefaultNetwork(); - if (!network) { - LOG(ERROR) << "Network not found: " << network_id; - return; - } - ProxySettingsDialog* dialog = new ProxySettingsDialog( - ProfileHelper::GetSigninProfile(), *network, nullptr, GetNativeWindow()); - dialog->Show(); -} - void WebUILoginView::OnPostponedShow() { set_is_hidden(false); OnLoginPromptVisible();
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.h b/chrome/browser/chromeos/login/ui/webui_login_view.h index 31f66ecb..3eadde8 100644 --- a/chrome/browser/chromeos/login/ui/webui_login_view.h +++ b/chrome/browser/chromeos/login/ui/webui_login_view.h
@@ -101,10 +101,6 @@ // Returns instance of the OOBE WebUI. OobeUI* GetOobeUI(); - // Opens proxy settings dialog for the network matching |network_id| or the - // default network if |network_id| is empty. - void OpenProxySettings(const std::string& network_id); - // Called when WebUI is being shown after being initilized hidden. void OnPostponedShow();
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions.cc b/chrome/browser/chromeos/platform_keys/key_permissions.cc index 5acb208..ac8a3ab 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions.cc +++ b/chrome/browser/chromeos/platform_keys/key_permissions.cc
@@ -65,6 +65,87 @@ const char kPolicyAllowCorporateKeyUsage[] = "allowCorporateKeyUsage"; +const base::DictionaryValue* GetPrefsEntry( + const std::string& public_key_spki_der_b64, + const PrefService* const profile_prefs) { + if (!profile_prefs) + return nullptr; + + const base::DictionaryValue* platform_keys = + profile_prefs->GetDictionary(prefs::kPlatformKeys); + if (!platform_keys) + return nullptr; + + const base::Value* key_entry_value = + platform_keys->FindKey(public_key_spki_der_b64); + if (!key_entry_value) + return nullptr; + + const base::DictionaryValue* key_entry = nullptr; + key_entry_value->GetAsDictionary(&key_entry); + return key_entry; +} + +const base::DictionaryValue* GetKeyPermissionsMap( + policy::PolicyService* const profile_policies) { + if (!profile_policies) + return nullptr; + + const policy::PolicyMap& policies = profile_policies->GetPolicies( + policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())); + const base::Value* policy_value = + policies.GetValue(policy::key::kKeyPermissions); + if (!policy_value) { + DVLOG(1) << "KeyPermissions policy is not set"; + return nullptr; + } + const base::DictionaryValue* key_permissions_map = nullptr; + policy_value->GetAsDictionary(&key_permissions_map); + return key_permissions_map; +} + +bool GetCorporateKeyUsageFromPref( + const base::DictionaryValue* key_permissions_for_ext) { + if (!key_permissions_for_ext) + return false; + + const base::Value* allow_corporate_key_usage = + key_permissions_for_ext->FindKey(kPolicyAllowCorporateKeyUsage); + if (!allow_corporate_key_usage || !allow_corporate_key_usage->is_bool()) + return false; + return allow_corporate_key_usage->GetBool(); +} + +// Returns true if the extension with id |extension_id| is allowed to use +// corporate usage keys by policy in |profile_policies|. +bool PolicyAllowsCorporateKeyUsageForExtension( + const std::string& extension_id, + policy::PolicyService* const profile_policies) { + if (!profile_policies) + return false; + + const base::DictionaryValue* key_permissions_map = + GetKeyPermissionsMap(profile_policies); + if (!key_permissions_map) + return false; + + const base::Value* key_permissions_for_ext_value = + key_permissions_map->FindKey(extension_id); + const base::DictionaryValue* key_permissions_for_ext = nullptr; + if (!key_permissions_for_ext_value || + !key_permissions_for_ext_value->GetAsDictionary( + &key_permissions_for_ext) || + !key_permissions_for_ext) + return false; + + bool allow_corporate_key_usage = + GetCorporateKeyUsageFromPref(key_permissions_for_ext); + + VLOG_IF(allow_corporate_key_usage, 2) + << "Policy allows usage of corporate keys by extension " << extension_id; + return allow_corporate_key_usage; +} + } // namespace struct KeyPermissions::PermissionsForExtension::KeyEntry { @@ -202,33 +283,8 @@ bool KeyPermissions::PermissionsForExtension::PolicyAllowsCorporateKeyUsage() const { - const policy::PolicyMap& policies = profile_policies_->GetPolicies( - policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())); - const base::Value* policy_value = - policies.GetValue(policy::key::kKeyPermissions); - if (!policy_value) - return false; - - const base::DictionaryValue* key_permissions_map = nullptr; - policy_value->GetAsDictionary(&key_permissions_map); - if (!key_permissions_map) { - LOG(ERROR) << "Expected policy to be a dictionary."; - return false; - } - - const base::DictionaryValue* key_permissions_for_ext = nullptr; - key_permissions_map->GetDictionaryWithoutPathExpansion( - extension_id_, &key_permissions_for_ext); - if (!key_permissions_for_ext) - return false; - - bool allow_corporate_key_usage = false; - key_permissions_for_ext->GetBooleanWithoutPathExpansion( - kPolicyAllowCorporateKeyUsage, &allow_corporate_key_usage); - - VLOG_IF(allow_corporate_key_usage, 2) - << "Policy allows usage of corporate keys by extension " << extension_id_; - return allow_corporate_key_usage; + return PolicyAllowsCorporateKeyUsageForExtension(extension_id_, + profile_policies_); } void KeyPermissions::PermissionsForExtension::WriteToStateStore() { @@ -348,18 +404,50 @@ return !IsCorporateKey(public_key_spki_der_b64); } -bool KeyPermissions::IsCorporateKey( - const std::string& public_key_spki_der_b64) const { +// static +bool KeyPermissions::IsCorporateKeyForProfile( + const std::string& public_key_spki_der_b64, + const PrefService* const profile_prefs) { const base::DictionaryValue* prefs_entry = - GetPrefsEntry(public_key_spki_der_b64); + GetPrefsEntry(public_key_spki_der_b64, profile_prefs); if (prefs_entry) { - std::string key_usage; - prefs_entry->GetStringWithoutPathExpansion(kPrefKeyUsage, &key_usage); - return key_usage == kPrefKeyUsageCorporate; + const base::Value* key_usage = prefs_entry->FindKey(kPrefKeyUsage); + if (!key_usage || !key_usage->is_string()) + return false; + return key_usage->GetString() == kPrefKeyUsageCorporate; } return false; } +// static +std::vector<std::string> KeyPermissions::GetCorporateKeyUsageAllowedAppIds( + policy::PolicyService* const profile_policies) { + std::vector<std::string> permissions; + + const base::DictionaryValue* key_permissions_map = + GetKeyPermissionsMap(profile_policies); + if (!key_permissions_map) + return permissions; + + for (const auto& item : key_permissions_map->DictItems()) { + const auto& app_id = item.first; + const auto& key_permission = item.second; + const base::DictionaryValue* key_permissions_for_app = nullptr; + if (!key_permission.GetAsDictionary(&key_permissions_for_app) || + !key_permissions_for_app) { + continue; + } + if (GetCorporateKeyUsageFromPref(key_permissions_for_app)) + permissions.push_back(app_id); + } + return permissions; +} + +bool KeyPermissions::IsCorporateKey( + const std::string& public_key_spki_der_b64) const { + return IsCorporateKeyForProfile(public_key_spki_der_b64, profile_prefs_); +} + void KeyPermissions::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { // For the format of the dictionary see the documentation at kPrefKeyUsage. @@ -381,15 +469,4 @@ extension_id, kStateStorePlatformKeys, std::move(value)); } -const base::DictionaryValue* KeyPermissions::GetPrefsEntry( - const std::string& public_key_spki_der_b64) const { - const base::DictionaryValue* platform_keys = - profile_prefs_->GetDictionary(prefs::kPlatformKeys); - - const base::DictionaryValue* key_entry = nullptr; - platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, - &key_entry); - return key_entry; -} - } // namespace chromeos
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions.h b/chrome/browser/chromeos/platform_keys/key_permissions.h index 82b239c..587707d5 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions.h +++ b/chrome/browser/chromeos/platform_keys/key_permissions.h
@@ -16,7 +16,6 @@ class PrefService; namespace base { -class DictionaryValue; class Value; } @@ -90,7 +89,7 @@ ~PermissionsForExtension(); // Returns true if the private key matching |public_key_spki_der| can be - // used for signing by the extension with id |extension_id|. + // used for signing by the extension with id |extension_id_|. // |public_key_spki_der| must be the DER of a Subject Public Key Info. bool CanUseKeyForSigning(const std::string& public_key_spki_der); @@ -176,6 +175,16 @@ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); + // Returns true if |public_key_spki_der_b64| is a corporate usage key. + static bool IsCorporateKeyForProfile( + const std::string& public_key_spki_der_b64, + const PrefService* const profile_prefs); + + // Returns the list of apps and extensions ids allowed to use corporate usage + // keys by policy in |profile_policies|. + static std::vector<std::string> GetCorporateKeyUsageAllowedAppIds( + policy::PolicyService* const profile_policies); + private: bool IsCorporateKey(const std::string& public_key_spki_der_b64) const; @@ -190,9 +199,6 @@ void SetPlatformKeysOfExtension(const std::string& extension_id, std::unique_ptr<base::Value> value); - const base::DictionaryValue* GetPrefsEntry( - const std::string& public_key_spki_der_b64) const; - const bool profile_is_managed_; PrefService* const profile_prefs_; policy::PolicyService* const profile_policies_;
diff --git a/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc b/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc index 5ac546e..efd730aa 100644 --- a/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc +++ b/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc
@@ -24,8 +24,6 @@ namespace { -// TODO(rsorokin): Replace with MockAuthPolicyClient (see -// https://crbug.com/753355). class TestAuthPolicyClient : public chromeos::AuthPolicyClient { public: void Init(dbus::Bus* bus) override { NOTIMPLEMENTED(); }
diff --git a/chrome/browser/chromeos/profiles/profile_helper.h b/chrome/browser/chromeos/profiles/profile_helper.h index c4f5fb6..a14941c 100644 --- a/chrome/browser/chromeos/profiles/profile_helper.h +++ b/chrome/browser/chromeos/profiles/profile_helper.h
@@ -32,6 +32,7 @@ namespace arc { class ArcAuthServiceTest; +class ArcCertStoreBridgeTest; class ArcSessionManagerTest; } @@ -190,6 +191,7 @@ friend class ash::MultiUserWindowManagerChromeOSTest; friend class arc::ArcSessionManagerTest; friend class arc::ArcAuthServiceTest; + friend class arc::ArcCertStoreBridgeTest; friend class ::ArcAppTest; friend class ::SessionControllerClientTest; friend class ::test::BrowserFinderChromeOSTest;
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc index bde4dd9..02eaeb5e 100644 --- a/chrome/browser/chromeos/status/network_menu.cc +++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -13,7 +13,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" +#include "chrome/browser/chromeos/login/ui/internet_detail_dialog.h" #include "chrome/browser/chromeos/mobile_config.h" #include "chrome/browser/chromeos/options/network_config_view.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
diff --git a/chrome/browser/client_hints/DEPS b/chrome/browser/client_hints/DEPS new file mode 100644 index 0000000..5eb3384f --- /dev/null +++ b/chrome/browser/client_hints/DEPS
@@ -0,0 +1,11 @@ +include_rules = [ + # No inclusion of WebKit from the browser, other than strictly enum/POD, + # header-only types, and some selected common code. + "-third_party/WebKit", + "+third_party/WebKit/public/platform/WebClientHintsType.h", + + # Unlike other WebKit directories WebKit/common is for the files that + # are commonly referenced by renderer-side and browser-side code, and + # does not use Blink types like WTF. + "+third_party/WebKit/common", +] \ No newline at end of file
diff --git a/chrome/browser/client_hints/client_hints.cc b/chrome/browser/client_hints/client_hints.cc new file mode 100644 index 0000000..1b8c88f --- /dev/null +++ b/chrome/browser/client_hints/client_hints.cc
@@ -0,0 +1,78 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/client_hints/client_hints.h" + +#include "base/memory/ptr_util.h" +#include "base/strings/string_number_conversions.h" +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/client_hints/client_hints.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/common/origin_util.h" +#include "net/http/http_request_headers.h" +#include "third_party/WebKit/common/client_hints/client_hints.h" +#include "third_party/WebKit/common/device_memory/approximated_device_memory.h" +#include "third_party/WebKit/public/platform/WebClientHintsType.h" +#include "url/gurl.h" + +namespace client_hints { + +std::unique_ptr<net::HttpRequestHeaders> +GetAdditionalNavigationRequestClientHintsHeaders( + content::BrowserContext* context, + const GURL& url) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + // Get the client hint headers. + if (!url.is_valid() || !url.SchemeIs(url::kHttpsScheme)) + return nullptr; + + Profile* profile = Profile::FromBrowserContext(context); + if (!profile) + return nullptr; + + ContentSettingsForOneType client_hints_host_settings; + HostContentSettingsMapFactory::GetForProfile(profile)->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_CLIENT_HINTS, std::string(), + &client_hints_host_settings); + + blink::WebEnabledClientHints web_client_hints; + + GetAllowedClientHintsFromSource(url, client_hints_host_settings, + &web_client_hints); + + std::unique_ptr<net::HttpRequestHeaders> additional_headers( + base::MakeUnique<net::HttpRequestHeaders>()); + + // Currently, only "device-memory" client hint request header is added from + // the browser process. + if (web_client_hints.IsEnabled( + blink::mojom::WebClientHintsType::kDeviceMemory)) { + additional_headers->SetHeader( + blink::kClientHintsHeaderMapping[static_cast<int>( + blink::mojom::WebClientHintsType::kDeviceMemory)], + base::DoubleToString( + blink::ApproximatedDeviceMemory::GetApproximatedDeviceMemory())); + } + + // Static assert that triggers if a new client hint header is added. If a new + // client hint header is added, the following assertion should be updated. + // If possible, logic should be added above so that the request headers for + // the newly added client hint can be added to the request. + static_assert( + blink::mojom::WebClientHintsType::kViewportWidth == + blink::mojom::WebClientHintsType::kLast, + "Consider adding client hint request headers from the browser process"); + + // TODO(crbug.com/735518): If the request is redirected, the client hint + // headers stay attached to the redirected request. Consider removing/adding + // the client hints headers if the request is redirected with a change in + // scheme or a change in the origin. + return additional_headers; +} + +} // namespace client_hints
diff --git a/chrome/browser/client_hints/client_hints.h b/chrome/browser/client_hints/client_hints.h new file mode 100644 index 0000000..e2d92553 --- /dev/null +++ b/chrome/browser/client_hints/client_hints.h
@@ -0,0 +1,31 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_ +#define CHROME_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_ + +#include <memory> + +class GURL; + +namespace content { +class BrowserContext; +} + +namespace net { +class HttpRequestHeaders; +} + +namespace client_hints { + +// Allow the embedder to return additional headers related to client hints that +// should be sent when fetching |url|. May return a nullptr. +std::unique_ptr<net::HttpRequestHeaders> +GetAdditionalNavigationRequestClientHintsHeaders( + content::BrowserContext* context, + const GURL& url); + +} // namespace client_hints + +#endif // CHROME_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc index 162803e2..16e28d1 100644 --- a/chrome/browser/client_hints/client_hints_browsertest.cc +++ b/chrome/browser/client_hints/client_hints_browsertest.cc
@@ -4,6 +4,7 @@ #include "base/command_line.h" #include "base/run_loop.h" +#include "base/stl_util.h" #include "base/test/histogram_tester.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/metrics/subprocess_metrics_provider.h" @@ -93,19 +94,25 @@ private: // Called by |https_server_|. void MonitorResourceRequest(const net::test_server::HttpRequest& request) { - if (!content::IsBrowserSideNavigationEnabled() || - request.GetURL() != without_accept_ch_without_lifetime_url()) { - // When browser side navigation is enabled, client hints are currently not - // attached to the main frame request. - EXPECT_EQ(expect_client_hints_, - request.headers.find("dpr") != request.headers.end()); - EXPECT_EQ(expect_client_hints_, request.headers.find("viewport-width") != - request.headers.end()); - } - if (request.headers.find("dpr") != request.headers.end()) + bool is_main_frame_navigation = + request.GetURL().spec().find(".html") != std::string::npos; + + // When browser side navigation is enabled, dpr headers is not attached to + // the main frame request. + EXPECT_EQ( + expect_client_hints_ && (!content::IsBrowserSideNavigationEnabled() || + !is_main_frame_navigation), + base::ContainsKey(request.headers, "dpr")); + + // When browser side navigation is enabled, device-memory header is attached + // to the main frame request. + EXPECT_EQ(expect_client_hints_, + base::ContainsKey(request.headers, "device-memory")); + + if (base::ContainsKey(request.headers, "dpr")) count_client_hints_headers_seen_++; - if (request.headers.find("viewport-width") != request.headers.end()) + if (base::ContainsKey(request.headers, "device-memory")) count_client_hints_headers_seen_++; } @@ -190,13 +197,15 @@ SetClientHintExpectations(true); ui_test_utils::NavigateToURL(browser(), without_accept_ch_without_lifetime_url()); + if (content::IsBrowserSideNavigationEnabled()) { // When browser side navigation is enabled, two client hints are attached to - // the image request. - EXPECT_EQ(2u, count_client_hints_headers_seen()); + // the image request, and the device-memory header is attached to the main + // frame request. + EXPECT_EQ(3u, count_client_hints_headers_seen()); } else { // When browser side navigation is not enabled, two client hints are - // attached to both the HTML and the image requests. + // attached to each of the HTML and the image requests. EXPECT_EQ(4u, count_client_hints_headers_seen()); } }
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 26e1d99..aad7ee0943 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -241,8 +241,8 @@ codecs, std::string(1, kCdmSupportedCodecsValueDelimiter), base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); CdmRegistry::GetInstance()->RegisterCdm( - content::CdmInfo(kWidevineCdmType, kWidevineCdmGuid, cdm_version, - cdm_path, supported_codecs, kWidevineKeySystem, false)); + content::CdmInfo(kWidevineCdmType, cdm_version, cdm_path, + supported_codecs, kWidevineKeySystem, false)); } } // namespace
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 6b27cd842..4f596d2 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -947,6 +947,11 @@ const char kOriginTrialsDescription[] = "Enables origin trials for controlling access to feature/API experiments."; +const char kOverflowIconsForMediaControlsName[] = + "Icons on Media Controls Overflow Menu"; +const char kOverflowIconsForMediaControlsDescription[] = + "Displays icons on the overflow menu of the native media controls"; + const char kOverlayScrollbarsName[] = "Overlay Scrollbars"; const char kOverlayScrollbarsDescription[] = "Enable the experimental overlay scrollbars implementation. You must also " @@ -1588,6 +1593,11 @@ const char kChromeHomeExpandButtonDescription[] = "Enables the expand button for Chrome Home."; +const char kChromeHomePersonalizedOmniboxSuggestionsName[] = + "Chrome Home Personalized Omnibox Suggestions"; +const char kChromeHomePersonalizedOmniboxSuggestionsDescription[] = + "Enable personalized omnibox suggestions on focus for Chrome Home."; + const char kChromeHomePromoName[] = "Chrome Home Promo"; const char kChromeHomePromoDescription[] = "Force the Chrome Home promotion to show each time the browser restarts."; @@ -1603,6 +1613,11 @@ "Enables Chrome Home on Android. You must restart the browser" " twice for changes to take effect."; +const char kChromeMemexName[] = "Chrome Memex"; +const char kChromeMemexDescription[] = + "Enables Chrome Memex homepage on Android. Restricted to opted-in " + "Googlers."; + const char kContentSuggestionsCategoryOrderName[] = "Default content suggestions category order (e.g. on NTP)"; const char kContentSuggestionsCategoryOrderDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 254dd5d..9b8271e 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -589,6 +589,9 @@ extern const char kOmniboxUIVerticalMarginName[]; extern const char kOmniboxUIVerticalMarginDescription[]; +extern const char kOverflowIconsForMediaControlsName[]; +extern const char kOverflowIconsForMediaControlsDescription[]; + extern const char kOriginTrialsName[]; extern const char kOriginTrialsDescription[]; @@ -981,6 +984,9 @@ extern const char kChromeHomeExpandButtonName[]; extern const char kChromeHomeExpandButtonDescription[]; +extern const char kChromeHomePersonalizedOmniboxSuggestionsName[]; +extern const char kChromeHomePersonalizedOmniboxSuggestionsDescription[]; + extern const char kChromeHomePromoName[]; extern const char kChromeHomePromoDescription[]; @@ -992,6 +998,9 @@ extern const char kChromeHomeName[]; extern const char kChromeHomeDescription[]; +extern const char kChromeMemexName[]; +extern const char kChromeMemexDescription[]; + extern const char kContentSuggestionsCategoryOrderName[]; extern const char kContentSuggestionsCategoryOrderDescription[];
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index d44710f4..41af191 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -881,16 +881,6 @@ TestNonPlaybackCases(kExternalClearKeyStorageIdTestKeySystem, kUnitTestSuccess); } - -IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, MultipleCdmTypes) { - if (!IsUsingMojoCdm()) { - DVLOG(0) << "Skipping test; Mojo CDM specific."; - return; - } - - base::StringPairs empty_query_params; - RunMediaTestPage("multiple_cdm_types.html", empty_query_params, kEnded, true); -} #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } // namespace chrome
diff --git a/chrome/browser/media/midi_sysex_permission_context_unittest.cc b/chrome/browser/media/midi_sysex_permission_context_unittest.cc index 0ddf724..2718054 100644 --- a/chrome/browser/media/midi_sysex_permission_context_unittest.cc +++ b/chrome/browser/media/midi_sysex_permission_context_unittest.cc
@@ -3,6 +3,9 @@ // found in the LICENSE file. #include "chrome/browser/media/midi_sysex_permission_context.h" + +#include <string> + #include "base/bind.h" #include "base/macros.h" #include "build/build_config.h" @@ -13,6 +16,7 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/web_contents_tester.h" @@ -86,9 +90,9 @@ GURL url("http://www.example.com"); content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); - const PermissionRequestID id(web_contents()->GetRenderProcessHost()->GetID(), - web_contents()->GetMainFrame()->GetRoutingID(), - -1); + const PermissionRequestID id( + web_contents()->GetMainFrame()->GetProcess()->GetID(), + web_contents()->GetMainFrame()->GetRoutingID(), -1); permission_context.RequestPermission( web_contents(), id, url, true, base::Bind(&TestPermissionContext::TrackPermissionDecision,
diff --git a/chrome/browser/notifications/notification_template_builder.cc b/chrome/browser/notifications/notification_template_builder.cc index 446c448..4a9914f7 100644 --- a/chrome/browser/notifications/notification_template_builder.cc +++ b/chrome/browser/notifications/notification_template_builder.cc
@@ -32,7 +32,6 @@ const char kVisualElement[] = "visual"; // Name of the template used for default Chrome notifications. -// https://msdn.microsoft.com/library/1a437614-4259-426b-8e3f-ca57368b2e7a const char kDefaultTemplate[] = "ToastGeneric"; // The XML version header that has to be stripped from the output. @@ -55,8 +54,7 @@ // TODO(finnur): Set the correct binding template based on the |notification|. builder->StartBindingElement(kDefaultTemplate); - // Content for the ToastText04 toast template. - // https://msdn.microsoft.com/library/1a437614-4259-426b-8e3f-ca57368b2e7a#ToastText04 + // Content for the toast template. builder->WriteTextElement("1", base::UTF16ToUTF8(notification.title())); builder->WriteTextElement("2", base::UTF16ToUTF8(notification.message())); builder->WriteTextElement("3",
diff --git a/chrome/browser/notifications/notification_template_builder.h b/chrome/browser/notifications/notification_template_builder.h index e0d2f0f1..9fcaf89 100644 --- a/chrome/browser/notifications/notification_template_builder.h +++ b/chrome/browser/notifications/notification_template_builder.h
@@ -23,11 +23,7 @@ // Builds XML-based notification templates for displaying a given notification // in the Windows Action Center. // -// https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root -// https://msdn.microsoft.com/library/1a437614-4259-426b-8e3f-ca57368b2e7a -// -// The current builder is a best-effort implementation that supports the title -// body text and attribution of a notification. +// https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-adaptive-interactive-toasts // // libXml was preferred (over WinXml, which the samples tend to use) because it // is used frequently in Chrome, is nicer to use and has already been vetted. @@ -52,26 +48,21 @@ // Writes the <toast> element with the |notification_id| as the launch string. // Also closes the |xml_writer_| for writing as the toast is now complete. - // https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-toast void StartToastElement(const std::string& notification_id); void EndToastElement(); // Writes the <visual> element. - // https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-visual void StartVisualElement(); void EndVisualElement(); // Writes the <binding> element with the given |template_name|. - // https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-binding void StartBindingElement(const std::string& template_name); void EndBindingElement(); // Writes the <text> element with the given |id| and |content|. - // https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-text void WriteTextElement(const std::string& id, const std::string& content); // Writes the <actions> element. - // TODO(finnur): Add link to doc, once it becomes available. void StartActionsElement(); void EndActionsElement();
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index fbc673a..f1f3aa5c 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -4271,16 +4271,16 @@ const auto* const arc_session_manager = arc::ArcSessionManager::Get(); // ARC is switched off by default. - EXPECT_TRUE(arc_session_manager->IsSessionStopped()); EXPECT_FALSE(pref->GetBoolean(arc::prefs::kArcEnabled)); + EXPECT_FALSE(arc_session_manager->enable_requested()); // Enable ARC. SetArcEnabledByPolicy(true); - EXPECT_TRUE(arc_session_manager->IsSessionRunning()); + EXPECT_TRUE(arc_session_manager->enable_requested()); // Disable ARC. SetArcEnabledByPolicy(false); - EXPECT_TRUE(arc_session_manager->IsSessionStopped()); + EXPECT_FALSE(arc_session_manager->enable_requested()); } // Test ArcBackupRestoreEnabled policy.
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 46cf8d4..4df98650 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -184,6 +184,7 @@ #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h" #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h" #include "components/ntp_tiles/popular_sites_impl.h" +#include "components/omnibox/browser/omnibox_field_trial.h" #else #include "chrome/browser/gcm/gcm_product_util.h" #include "chrome/browser/signin/signin_promo.h" @@ -579,6 +580,7 @@ registry); ntp_snippets::RecentTabSuggestionsProvider::RegisterProfilePrefs(registry); ntp_snippets::SubscriptionManagerImpl::RegisterProfilePrefs(registry); + OmniboxFieldTrial::RegisterProfilePrefs(registry); #endif // defined(OS_ANDROID) #if !defined(OS_ANDROID)
diff --git a/chrome/browser/resources/chromeos/internet_detail_dialog.html b/chrome/browser/resources/chromeos/internet_detail_dialog.html index 16d8018..b524c63 100644 --- a/chrome/browser/resources/chromeos/internet_detail_dialog.html +++ b/chrome/browser/resources/chromeos/internet_detail_dialog.html
@@ -1,3 +1,4 @@ +<!doctype html> <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/cr_components/chromeos/network/network_apnlist.html"> @@ -10,6 +11,7 @@ <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> +<link rel="import" href="chrome://resources/html/load_time_data.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> @@ -74,13 +76,15 @@ </div> <!-- Device properties (Cellular only) --> - <div class="section single-column"> - <network-property-list - hidden$="[[!hasDeviceFields_(networkProperties)]]" - fields="[[getDeviceFields_(networkProperties)]]" - property-dict="[[networkProperties]]"> - </network-property-list> - </div> + <template is="dom-if" if="[[isCellular_(networkProperties)]]"> + <div class="section single-column"> + <network-property-list + hidden$="[[!hasDeviceFields_(networkProperties)]]" + fields="[[getDeviceFields_(networkProperties)]]" + property-dict="[[networkProperties]]"> + </network-property-list> + </div> + </template> <!-- Choose Mobile Network (Cellular only) --> <template is="dom-if" @@ -141,3 +145,10 @@ </template> <script src="internet_detail_dialog.js"></script> </dom-module> + +<html i18n-values="dir:textdirection;lang:language"> + <script src="chrome://internet-detail-dialog/strings.js"></script> + <body> + <internet-detail-dialog></internet-detail-dialog> + </body> +</html>
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.js b/chrome/browser/resources/chromeos/login/oobe_welcome.js index 9be1b6a..101c5199 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.js
@@ -219,7 +219,7 @@ polymerIcon: 'oobe-welcome-20:add-proxy', customData: { onTap: function() { - self.OpenProxySettingsDialog_(); + self.OpenInternetDetailDialog_(); }, }, }); @@ -294,8 +294,8 @@ * * @private */ - OpenProxySettingsDialog_: function(item) { - chrome.send('launchProxySettingsDialog'); + OpenInternetDetailDialog_: function(item) { + chrome.send('launchInternetDetailDialog'); }, /**
diff --git a/chrome/browser/resources/chromeos/login/screen_error_message.js b/chrome/browser/resources/chromeos/login/screen_error_message.js index 2049624..815324b 100644 --- a/chrome/browser/resources/chromeos/login/screen_error_message.js +++ b/chrome/browser/resources/chromeos/login/screen_error_message.js
@@ -193,14 +193,14 @@ '" class="signin-link" href="#">', '</a>'); $(FIX_PROXY_SETTINGS_ID).onclick = function() { - chrome.send('openProxySettings'); + chrome.send('openInternetDetailDialog'); }; $('update-proxy-message-text').innerHTML = loadTimeData.getStringF( 'updateProxyMessageText', '<a id="update-proxy-error-fix-proxy" class="signin-link" href="#">', '</a>'); $('update-proxy-error-fix-proxy').onclick = function() { - chrome.send('openProxySettings'); + chrome.send('openInternetDetailDialog'); }; $('signin-proxy-message-text').innerHTML = loadTimeData.getStringF( 'signinProxyMessageText', @@ -214,7 +214,7 @@ gaiaScreen.doReload(); }; $('signin-proxy-error-fix-proxy').onclick = function() { - chrome.send('openProxySettings'); + chrome.send('openInternetDetailDialog'); }; $('error-guest-signin').innerHTML = loadTimeData.getStringF(
diff --git a/chrome/browser/resources/chromeos/proxy_settings.html b/chrome/browser/resources/chromeos/proxy_settings.html deleted file mode 100644 index a816d2cd..0000000 --- a/chrome/browser/resources/chromeos/proxy_settings.html +++ /dev/null
@@ -1,17 +0,0 @@ -<!doctype html> -<html i18n-values="dir:textdirection;lang:language"> - - <head> - <meta charset="utf-8"> - <link rel="import" href="chrome://proxy-settings/internet_detail_dialog.html"> - <link rel="import" href="chrome://resources/html/cr.html"> - <link rel="import" href="chrome://resources/html/load_time_data.html"> - <link rel="import" href="chrome://resources/html/util.html"> - <script src="chrome://proxy-settings/strings.js"></script> - </head> - - <body> - <internet-detail-dialog></internet-detail-dialog> - </body> - -</html>
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js index d3bc45ea..d782ea5 100644 --- a/chrome/browser/resources/local_ntp/local_ntp.js +++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -103,6 +103,33 @@ /** + * The different types of events that are logged from the NTP. This enum is + * used to transfer information from the NTP JavaScript to the renderer and is + * not used as a UMA enum histogram's logged value. + * Note: Keep in sync with common/ntp_logging_events.h + * @enum {number} + * @const + */ +var LOG_TYPE = { + // A static Doodle was shown, coming from cache. + NTP_STATIC_LOGO_SHOWN_FROM_CACHE: 30, + // A static Doodle was shown, coming from the network. + NTP_STATIC_LOGO_SHOWN_FRESH: 31, + // A call-to-action Doodle image was shown, coming from cache. + NTP_CTA_LOGO_SHOWN_FROM_CACHE: 32, + // A call-to-action Doodle image was shown, coming from the network. + NTP_CTA_LOGO_SHOWN_FRESH: 33, + + // A static Doodle was clicked. + NTP_STATIC_LOGO_CLICKED: 34, + // A call-to-action Doodle was clicked. + NTP_CTA_LOGO_CLICKED: 35, + // An animated Doodle was clicked. + NTP_ANIMATED_LOGO_CLICKED: 36, +}; + + +/** * Background colors considered "white". Used to determine if it is possible * to display a Google Doodle, or if the notifier should be used instead. * @type {Array<string>} @@ -495,21 +522,31 @@ /** - * Event handler for the focus changed and blacklist messages on link elements. - * Used to toggle visual treatment on the tiles (depending on the message). + * Event handler for messages from the most visited iframe. * @param {Event} event Event received. */ function handlePostMessage(event) { var cmd = event.data.cmd; var args = event.data; - if (cmd == 'tileBlacklisted') { + if (cmd == 'loaded') { + if (configData.isGooglePage) { + // Load the OneGoogleBar script. It'll create a global variable name "og" + // which is a dict corresponding to the native OneGoogleBarData type. + // We do this only after all the tiles have loaded, to avoid slowing down + // the main page load. + var ogScript = document.createElement('script'); + ogScript.src = 'chrome-search://local-ntp/one-google.js'; + document.body.appendChild(ogScript); + ogScript.onload = function() { + injectOneGoogleBar(og); + }; + } + } else if (cmd == 'tileBlacklisted') { showNotification(); lastBlacklistedTile = args.tid; ntpApiHandle.deleteMostVisitedItem(args.tid); } - // TODO(treib): Should we also handle the 'loaded' message from the iframe - // here? We could hide the page until it arrives, to avoid flicker. } @@ -602,27 +639,19 @@ // Update the fakebox style to match the current key capturing state. setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled); - // Load the OneGoogleBar script. It'll create a global variable name "og" - // which is a dict corresponding to the native OneGoogleBarData type. - var ogScript = document.createElement('script'); - ogScript.src = 'chrome-search://local-ntp/one-google.js'; - document.body.appendChild(ogScript); - ogScript.onload = function() { - injectOneGoogleBar(og); - }; - // Load the Doodle. After the first request completes (getting cached // data), issue a second request for fresh Doodle data. loadDoodle(/*v=*/null, function(ddl) { if (ddl === null) { // Got no ddl object at all, the feature is probably disabled. Just show // the logo. - showLogoOrDoodle(null, null); + showLogoOrDoodle(null, null, /*fromCache=*/true); return; } // Got a (possibly empty) ddl object. Show logo or doodle. - showLogoOrDoodle(ddl.image || null, ddl.metadata || null); + showLogoOrDoodle( + ddl.image || null, ddl.metadata || null, /*fromCache=*/true); // If we got a valid ddl object (from cache), load a fresh one. if (ddl.v !== null) { loadDoodle(ddl.v, function(ddl) { @@ -781,11 +810,19 @@ }; -var showLogoOrDoodle = function(image, metadata) { +var showLogoOrDoodle = function(image, metadata, fromCache) { if (metadata !== null) { applyDoodleMetadata(metadata); $(IDS.LOGO_DOODLE_IMAGE).src = image; $(IDS.LOGO_DOODLE).style.opacity = 1; + + var isCta = !!metadata.animatedUrl; + var eventType = isCta ? + (fromCache ? LOG_TYPE.NTP_CTA_LOGO_SHOWN_FROM_CACHE : + LOG_TYPE.NTP_CTA_LOGO_SHOWN_FRESH) : + (fromCache ? LOG_TYPE.NTP_STATIC_LOGO_SHOWN_FROM_CACHE : + LOG_TYPE.NTP_STATIC_LOGO_SHOWN_FRESH); + ntpApiHandle.logEvent(eventType); } else { $(IDS.LOGO_DEFAULT).style.opacity = 1; } @@ -852,7 +889,8 @@ if (isFadedOut(logoDoodle) && isFadedOut(logoDefault)) { // Fade-out finished. Start fading in the appropriate logo. - showLogoOrDoodle(targetDoodle.image, targetDoodle.metadata); + showLogoOrDoodle( + targetDoodle.image, targetDoodle.metadata, /*fromCache=*/false); logoDefault.removeEventListener('transitionend', onDoodleTransitionEnd); logoDoodle.removeEventListener('transitionend', onDoodleTransitionEnd); @@ -869,14 +907,19 @@ if (metadata.animatedUrl) { logoDoodleLink.removeAttribute('href'); logoDoodleLink.onclick = function(e) { + ntpApiHandle.logEvent(LOG_TYPE.NTP_CTA_LOGO_CLICKED); e.preventDefault(); logoDoodleImage.src = metadata.animatedUrl; logoDoodleLink.href = metadata.onClickUrl; - logoDoodleLink.onclick = null; + logoDoodleLink.onclick = function() { + ntpApiHandle.logEvent(LOG_TYPE.NTP_ANIMATED_LOGO_CLICKED); + }; }; } else { logoDoodleLink.href = metadata.onClickUrl; - logoDoodleLink.onclick = null; + logoDoodleLink.onclick = function() { + ntpApiHandle.logEvent(LOG_TYPE.NTP_STATIC_LOGO_CLICKED); + }; } };
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js index 63a6f03..12eb39e 100644 --- a/chrome/browser/resources/local_ntp/most_visited_util.js +++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -225,13 +225,7 @@ domain: params.dom || '' }; } else { - var apiHandle = chrome.embeddedSearch.newTabPage; - // Note: This does not actually result in any logging; it's a workaround for - // crbug.com/698675. It effectively sets the "instant support" state of the - // tab to true, which makes later calls to fetch the most visited items - // succeed. - apiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_ALL_TILES_RECEIVED); - data = apiHandle.getMostVisitedItemData(params.rid); + data = chrome.embeddedSearch.newTabPage.getMostVisitedItemData(params.rid); if (!data) return; }
diff --git a/chrome/browser/resources/md_downloads/manager.html b/chrome/browser/resources/md_downloads/manager.html index 6c51444d..c8c6836 100644 --- a/chrome/browser/resources/md_downloads/manager.html +++ b/chrome/browser/resources/md_downloads/manager.html
@@ -38,12 +38,11 @@ z-index: 1; } - #toolbar::after { - content: ''; + #drop-shadow { @apply(--cr-container-shadow); } - :host([has-shadow_]) #toolbar::after { + :host([has-shadow_]) #drop-shadow { opacity: var(--cr-container-shadow-max-opacity); } @@ -89,6 +88,7 @@ <downloads-toolbar id="toolbar" spinner-active="{{spinnerActive_}}" role="none"> </downloads-toolbar> + <div id="drop-shadow"></div> <iron-list id="downloads-list" items="[[items_]]" hidden="[[!hasDownloads_]]"> <template>
diff --git a/chrome/browser/resources/md_history/app.html b/chrome/browser/resources/md_history/app.html index 76a4940..b4fd0e1 100644 --- a/chrome/browser/resources/md_history/app.html +++ b/chrome/browser/resources/md_history/app.html
@@ -50,7 +50,6 @@ #drop-shadow { @apply(--cr-container-shadow); - top: 0; } :host([toolbar-shadow_]) #drop-shadow { @@ -78,6 +77,7 @@ queryState_.searchTerm)]]"> </history-toolbar> + <div id="drop-shadow"></div> <div id="main-container"> <history-side-bar id="content-side-bar" selected-page="{{selectedPage_}}" show-footer="[[showSidebarFooter]]" @@ -102,7 +102,6 @@ </history-synced-device-manager> </template> </iron-pages> - <div id="drop-shadow"></div> </div> <template is="cr-lazy-render" id="drawer">
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn index 6add9dc..2b817ee 100644 --- a/chrome/browser/safe_browsing/BUILD.gn +++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -210,10 +210,6 @@ "incident_reporting/state_store.h", "incident_reporting/tracked_preference_incident.cc", "incident_reporting/tracked_preference_incident.h", - "incident_reporting/variations_seed_signature_analyzer.cc", - "incident_reporting/variations_seed_signature_analyzer.h", - "incident_reporting/variations_seed_signature_incident.cc", - "incident_reporting/variations_seed_signature_incident.h", "local_database_manager.cc", "local_database_manager.h", "protocol_manager.cc",
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 7f0903f6..5c620b6 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -591,7 +591,7 @@ safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); if (!ui_manager_->IsWhitelisted(resource)) { // We need to stop any pending navigations, otherwise the interstitial @@ -627,7 +627,7 @@ safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); if (!ui_manager_->IsWhitelisted(resource)) {
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index ece2d9f3..dd3738b 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -27,6 +27,7 @@ #include "components/safe_browsing/db/test_database_manager.h" #include "components/safe_browsing/proto/csd.pb.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/test/mock_render_process_host.h" @@ -370,7 +371,7 @@ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); resource.web_contents_getter = SafeBrowsingUIManager::UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); csd_host_->OnSafeBrowsingHit(resource); resource.callback.Reset();
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident.h b/chrome/browser/safe_browsing/incident_reporting/incident.h index 22325b5..75c1b1d 100644 --- a/chrome/browser/safe_browsing/incident_reporting/incident.h +++ b/chrome/browser/safe_browsing/incident_reporting/incident.h
@@ -26,7 +26,7 @@ BINARY_INTEGRITY = 2, OBSOLETE_BLACKLIST_LOAD = 3, OBSOLETE_OMNIBOX_INTERACTION = 4, - VARIATIONS_SEED_SIGNATURE = 5, + OBSOLETE_VARIATIONS_SEED_SIGNATURE = 5, RESOURCE_REQUEST = 6, OBSOLETE_SUSPICIOUS_MODULE = 7, // Values for new incident types go here.
diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc deleted file mode 100644 index 842d0d5..0000000 --- a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc +++ /dev/null
@@ -1,63 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h" - -#include <string> -#include <utility> - -#include "base/bind.h" -#include "base/location.h" -#include "base/memory/ptr_util.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" -#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h" -#include "chrome/browser/safe_browsing/safe_browsing_service.h" -#include "components/safe_browsing/proto/csd.pb.h" -#include "components/variations/service/variations_service.h" -#include "content/public/browser/browser_thread.h" - -namespace safe_browsing { - -namespace { - -void VerifyVariationsSeedSignatureOnUIThread( - std::unique_ptr<IncidentReceiver> incident_receiver) { - variations::VariationsService* variations_service = - g_browser_process->variations_service(); - if (!variations_service) - return; - std::string invalid_signature = - variations_service->GetInvalidVariationsSeedSignature(); - if (!invalid_signature.empty()) { - std::unique_ptr< - ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> - variations_seed_signature( - new ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident()); - variations_seed_signature->set_variations_seed_signature(invalid_signature); - incident_receiver->AddIncidentForProcess( - base::MakeUnique<VariationsSeedSignatureIncident>( - std::move(variations_seed_signature))); - } -} - -} // namespace - -void RegisterVariationsSeedSignatureAnalysis() { - scoped_refptr<SafeBrowsingService> safe_browsing_service( - g_browser_process->safe_browsing_service()); - - safe_browsing_service->RegisterDelayedAnalysisCallback( - base::Bind(&VerifyVariationsSeedSignature)); -} - -void VerifyVariationsSeedSignature( - std::unique_ptr<IncidentReceiver> incident_receiver) { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::BindOnce(&VerifyVariationsSeedSignatureOnUIThread, - base::Passed(&incident_receiver))); -} - -} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h deleted file mode 100644 index 661c580..0000000 --- a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_ANALYZER_H_ -#define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_ANALYZER_H_ - -#include <memory> - -#include "base/strings/string16.h" - -namespace safe_browsing { - -class IncidentReceiver; - -// Registers a process-wide analysis with the incident reporting service that -// will verify the variations seed signature. -void RegisterVariationsSeedSignatureAnalysis(); - -// Callback to pass to the incident reporting service. The incident reporting -// service will verify if the variations seed signature is invalid. -void VerifyVariationsSeedSignature( - std::unique_ptr<IncidentReceiver> incident_receiver); - -} // namespace safe_browsing - -#endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_ANALYZER_H_
diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.cc b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.cc deleted file mode 100644 index f358d0f..0000000 --- a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.cc +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h" - -#include "base/logging.h" -#include "chrome/browser/safe_browsing/incident_reporting/incident_handler_util.h" -#include "components/safe_browsing/proto/csd.pb.h" - -namespace safe_browsing { - -VariationsSeedSignatureIncident::VariationsSeedSignatureIncident( - std::unique_ptr< - ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> - variations_seed_signature_incident) { - DCHECK(variations_seed_signature_incident); - DCHECK(variations_seed_signature_incident->has_variations_seed_signature()); - payload()->set_allocated_variations_seed_signature( - variations_seed_signature_incident.release()); -} - -VariationsSeedSignatureIncident::~VariationsSeedSignatureIncident() { -} - -IncidentType VariationsSeedSignatureIncident::GetType() const { - return IncidentType::VARIATIONS_SEED_SIGNATURE; -} - -std::string VariationsSeedSignatureIncident::GetKey() const { - return "variations_seed_signature"; -} - -// Returns a digest computed over the payload. -uint32_t VariationsSeedSignatureIncident::ComputeDigest() const { - return HashMessage(payload()->variations_seed_signature()); -} - -} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h deleted file mode 100644 index bcbb65cc..0000000 --- a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_INCIDENT_H_ -#define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_INCIDENT_H_ - -#include <stdint.h> - -#include <memory> - -#include "base/macros.h" -#include "chrome/browser/safe_browsing/incident_reporting/incident.h" - -namespace safe_browsing { - -class ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident; - -// An incident representing an invalid variations seed signature. -class VariationsSeedSignatureIncident : public Incident { - public: - explicit VariationsSeedSignatureIncident( - std::unique_ptr< - ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> - variations_seed_signature); - ~VariationsSeedSignatureIncident() override; - - // Incident methods: - IncidentType GetType() const override; - std::string GetKey() const override; - uint32_t ComputeDigest() const override; - - private: - DISALLOW_COPY_AND_ASSIGN(VariationsSeedSignatureIncident); -}; - -} // namespace safe_browsing - -#endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_VARIATIONS_SEED_SIGNATURE_INCIDENT_H_
diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident_unittest.cc deleted file mode 100644 index 46a3f6a..0000000 --- a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident_unittest.cc +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_incident.h" - -#include <memory> -#include <utility> - -#include "base/memory/ptr_util.h" -#include "components/safe_browsing/proto/csd.pb.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace safe_browsing { - -namespace { - -std::unique_ptr<Incident> MakeIncident(bool alternate) { - std::unique_ptr< - ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> - incident( - new ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident); - if (alternate) { - incident->set_variations_seed_signature( - "AEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz" - "L7tXVLhURxUQcpiMg9eMLWO0U="); - } else { - incident->set_variations_seed_signature( - "MEUCID+QmAfajh/kk4zZyv0IUisZ84sIddnjiW9yAXjFJIMFAiEAtVUHhFA/4M6Bff2Gaz" - "L7tXVLhURxUQcpiMg9eMLWO0U="); - } - return base::MakeUnique<VariationsSeedSignatureIncident>(std::move(incident)); -} - -} // namespace - -TEST(VariationsSeedSignatureIncident, GetType) { - ASSERT_EQ(IncidentType::VARIATIONS_SEED_SIGNATURE, - MakeIncident(false)->GetType()); -} - -// Tests that GetKey returns a constant. -TEST(VariationsSeedSignatureIncident, KeyIsConstant) { - EXPECT_EQ(std::string("variations_seed_signature"), - MakeIncident(false)->GetKey()); - EXPECT_EQ(std::string("variations_seed_signature"), - MakeIncident(true)->GetKey()); -} - -// Tests that GetDigest returns the same value for the same incident. -TEST(VariationsSeedSignatureIncident, SameIncidentSameDigest) { - EXPECT_EQ(MakeIncident(false)->ComputeDigest(), - MakeIncident(false)->ComputeDigest()); -} - -// Tests that GetDigest returns different values for different incidents. -TEST(VariationsSeedSignatureIncident, DifferentIncidentDifferentDigest) { - EXPECT_NE(MakeIncident(false)->ComputeDigest(), - MakeIncident(true)->ComputeDigest()); -} - -} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 7faeb7c..dfa6af8 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -8,6 +8,8 @@ #include <algorithm> #include <map> +#include <memory> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -961,7 +963,7 @@ EXPECT_EQ(net::URLRequestMockHTTPJob::GetMockUrl(kMaliciousIframe).spec(), report.url()); std::vector<ClientSafeBrowsingReportRequest::Resource> resources; - for (auto resource: report.resources()) { + for (auto resource : report.resources()) { resources.push_back(resource); } // Sort resources based on their urls. @@ -1670,7 +1672,7 @@ resource.threat_type = testing::get<1>(GetParam()); resource.web_contents_getter = security_interstitials::UnsafeResource::GetWebContentsGetter( - contents->GetRenderProcessHost()->GetID(), + contents->GetMainFrame()->GetProcess()->GetID(), contents->GetMainFrame()->GetRoutingID()); resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3;
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index d2778485..57eefad4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -21,6 +21,7 @@ #include "components/strings/grit/components_strings.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/navigation_simulator.h" @@ -343,7 +344,7 @@ resource->threat_type = SB_THREAT_TYPE_URL_MALWARE; resource->web_contents_getter = security_interstitials::UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); resource->threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; } @@ -963,7 +964,7 @@ resource->threat_type = type; resource->web_contents_getter = security_interstitials::UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); resource->threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; }
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index a344cef..b30ec89 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -66,7 +66,6 @@ #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analyzer.h" #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h" #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h" -#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h" #include "chrome/browser/safe_browsing/protocol_manager.h" #include "components/safe_browsing/password_protection/password_protection_service.h" #endif @@ -320,7 +319,6 @@ void SafeBrowsingService::RegisterAllDelayedAnalysis() { #if defined(FULL_SAFE_BROWSING) RegisterBinaryIntegrityAnalysis(); - RegisterVariationsSeedSignatureAnalysis(); #endif }
diff --git a/chrome/browser/safe_browsing/threat_details_unittest.cc b/chrome/browser/safe_browsing/threat_details_unittest.cc index 8788a47a..65a7eb50 100644 --- a/chrome/browser/safe_browsing/threat_details_unittest.cc +++ b/chrome/browser/safe_browsing/threat_details_unittest.cc
@@ -24,6 +24,7 @@ #include "components/safe_browsing/browser/threat_details_history.h" #include "components/safe_browsing/common/safebrowsing_messages.h" #include "components/safe_browsing/proto/csd.pb.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_renderer_host.h" @@ -266,7 +267,7 @@ resource->threat_source = threat_source; resource->web_contents_getter = SafeBrowsingUIManager::UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); } @@ -297,7 +298,7 @@ static_cast<int>(actual_resource_map.size())); for (const ClientSafeBrowsingReportRequest::Resource& expected_resource : expected_pb.resources()) { - ASSERT_TRUE(actual_resource_map.count(expected_resource.id()) > 0); + ASSERT_GT(actual_resource_map.count(expected_resource.id()), 0u); VerifyResource(*actual_resource_map[expected_resource.id()], expected_resource); } @@ -313,7 +314,7 @@ // be unique). ASSERT_EQ(expected_pb.dom_size(), static_cast<int>(actual_dom_map.size())); for (const HTMLElement& expected_element : expected_pb.dom()) { - ASSERT_TRUE(actual_dom_map.count(expected_element.id()) > 0); + ASSERT_GT(actual_dom_map.count(expected_element.id()), 0u); VerifyElement(*actual_dom_map[expected_element.id()], expected_element); } @@ -375,7 +376,7 @@ static_cast<int>(actual_attributes_map.size())); for (const HTMLElement::Attribute& expected_attribute : expected.attribute()) { - ASSERT_TRUE(actual_attributes_map.count(expected_attribute.name()) > 0); + ASSERT_GT(actual_attributes_map.count(expected_attribute.name()), 0u); EXPECT_EQ(expected_attribute.value(), actual_attributes_map[expected_attribute.name()]); }
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc index fa3b0b8..caf93c0 100644 --- a/chrome/browser/safe_browsing/ui_manager_unittest.cc +++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -15,6 +15,7 @@ #include "components/safe_browsing/db/util.h" #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" @@ -119,7 +120,7 @@ resource.is_subresource = is_subresource; resource.web_contents_getter = security_interstitials::UnsafeResource::GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); resource.threat_type = SB_THREAT_TYPE_URL_MALWARE; return resource;
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc index 3d5469f..151862b4 100644 --- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -2457,6 +2457,25 @@ EXPECT_EQ(default_turl->url(), result_turl->url()); } +TEST_F(TemplateURLServiceSyncTest, MergePrepopulatedEngineIgnoresId0) { + // The newly registered keyword will have prepulate_id 0 since that is the + // default value. + model()->RegisterOmniboxKeyword("extension1", "unittest", "keyword1", + "http://extension1", Time()); + + // Try to merge in a turl with preopulate_id also set to 0. This should work. + syncer::SyncDataList initial_data; + std::unique_ptr<TemplateURL> turl(CreateTestTemplateURL( + ASCIIToUTF16("what"), "http://thewhat.com/{searchTerms}", "normal_guid", + 10, true, false, 0)); + initial_data.push_back( + TemplateURLService::CreateSyncDataFromTemplateURL(*turl)); + + syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( + syncer::SEARCH_ENGINES, initial_data, PassProcessor(), + CreateAndPassSyncErrorFactory()); +} + TEST_F(TemplateURLServiceSyncTest, GUIDUpdatedOnDefaultSearchChange) { const char kGUID[] = "initdefault"; model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"),
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc index 231b210..8e7f25e 100644 --- a/chrome/browser/signin/chrome_signin_helper.cc +++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/signin/chrome_signin_client.h" #include "chrome/browser/signin/chrome_signin_client_factory.h" #include "chrome/browser/signin/dice_response_handler.h" +#include "chrome/browser/signin/process_dice_header_observer_impl.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/common/url_constants.h" @@ -243,7 +244,9 @@ DiceResponseHandler* dice_response_handler = DiceResponseHandler::GetForProfile(profile); - dice_response_handler->ProcessDiceHeader(dice_params); + dice_response_handler->ProcessDiceHeader( + dice_params, + base::MakeUnique<ProcessDiceHeaderObserverImpl>(web_contents)); } #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
diff --git a/chrome/browser/signin/dice_response_handler.cc b/chrome/browser/signin/dice_response_handler.cc index b1a5024..8a1969d 100644 --- a/chrome/browser/signin/dice_response_handler.cc +++ b/chrome/browser/signin/dice_response_handler.cc
@@ -135,10 +135,12 @@ const std::string& authorization_code, SigninClient* signin_client, AccountReconcilor* account_reconcilor, + std::unique_ptr<ProcessDiceHeaderObserver> observer, DiceResponseHandler* dice_response_handler) : gaia_id_(gaia_id), email_(email), authorization_code_(authorization_code), + observer_(std::move(observer)), dice_response_handler_(dice_response_handler), timeout_closure_( base::Bind(&DiceResponseHandler::DiceTokenFetcher::OnTimeout, @@ -174,8 +176,8 @@ RecordDiceFetchTokenResult(kFetchSuccess); gaia_auth_fetcher_.reset(); timeout_closure_.Cancel(); - dice_response_handler_->OnTokenExchangeSuccess(this, gaia_id_, email_, - result); + dice_response_handler_->OnTokenExchangeSuccess( + this, gaia_id_, email_, result.refresh_token, std::move(observer_)); // |this| may be deleted at this point. } @@ -218,13 +220,15 @@ DiceResponseHandler::~DiceResponseHandler() {} void DiceResponseHandler::ProcessDiceHeader( - const signin::DiceResponseParams& dice_params) { + const signin::DiceResponseParams& dice_params, + std::unique_ptr<ProcessDiceHeaderObserver> observer) { DCHECK(signin::IsDiceFixAuthErrorsEnabled()); + DCHECK(observer); switch (dice_params.user_intention) { case signin::DiceAction::SIGNIN: - ProcessDiceSigninHeader(dice_params.signin_info.gaia_id, - dice_params.signin_info.email, - dice_params.signin_info.authorization_code); + ProcessDiceSigninHeader( + dice_params.signin_info.gaia_id, dice_params.signin_info.email, + dice_params.signin_info.authorization_code, std::move(observer)); return; case signin::DiceAction::SIGNOUT: { const signin::DiceResponseParams::SignoutInfo& signout_info = @@ -239,9 +243,7 @@ NOTREACHED() << "Invalid Dice response parameters."; return; } - NOTREACHED(); - return; } size_t DiceResponseHandler::GetPendingDiceTokenFetchersCountForTesting() const { @@ -269,7 +271,8 @@ void DiceResponseHandler::ProcessDiceSigninHeader( const std::string& gaia_id, const std::string& email, - const std::string& authorization_code) { + const std::string& authorization_code, + std::unique_ptr<ProcessDiceHeaderObserver> observer) { DCHECK(!gaia_id.empty()); DCHECK(!email.empty()); DCHECK(!authorization_code.empty()); @@ -288,10 +291,10 @@ return; // There is already a request in flight with the same parameters. } } - + observer->WillStartRefreshTokenFetch(gaia_id, email); token_fetchers_.push_back(base::MakeUnique<DiceTokenFetcher>( gaia_id, email, authorization_code, signin_client_, account_reconcilor_, - this)); + std::move(observer), this)); } void DiceResponseHandler::ProcessDiceSignoutHeader( @@ -357,17 +360,21 @@ void DiceResponseHandler::OnTokenExchangeSuccess( DiceTokenFetcher* token_fetcher, - const std::string& gaia_id, - const std::string& email, - const GaiaAuthConsumer::ClientOAuthResult& result) { + std::string gaia_id, + std::string email, + std::string refresh_token, + std::unique_ptr<ProcessDiceHeaderObserver> observer) { if (!CanGetTokenForAccount(gaia_id, email)) return; std::string account_id = account_tracker_service_->SeedAccountInfo(gaia_id, email); VLOG(1) << "[Dice] OAuth success for account: " << account_id; - token_service_->UpdateCredentials(account_id, result.refresh_token); DeleteTokenFetcher(token_fetcher); + + // Store the new account and start sync if needed. + token_service_->UpdateCredentials(account_id, refresh_token); + observer->DidFinishRefreshTokenFetch(gaia_id, email); } void DiceResponseHandler::OnTokenExchangeFailure(
diff --git a/chrome/browser/signin/dice_response_handler.h b/chrome/browser/signin/dice_response_handler.h index 378f695..883d0a0 100644 --- a/chrome/browser/signin/dice_response_handler.h +++ b/chrome/browser/signin/dice_response_handler.h
@@ -30,6 +30,20 @@ // Exposed for testing. extern const int kDiceTokenFetchTimeoutSeconds; +// Delegate interface for processing a dice request. +class ProcessDiceHeaderObserver { + public: + virtual ~ProcessDiceHeaderObserver() = default; + + // Called before starting to fetch a refresh token. + virtual void WillStartRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) = 0; + + // Called after the refresh token was fetched and added in the token service. + virtual void DidFinishRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) = 0; +}; + // Processes the Dice responses from Gaia. class DiceResponseHandler : public KeyedService { public: @@ -45,7 +59,8 @@ ~DiceResponseHandler() override; // Must be called when receiving a Dice response header. - void ProcessDiceHeader(const signin::DiceResponseParams& dice_params); + void ProcessDiceHeader(const signin::DiceResponseParams& dice_params, + std::unique_ptr<ProcessDiceHeaderObserver> observer); // Returns the number of pending DiceTokenFetchers. Exposed for testing. size_t GetPendingDiceTokenFetchersCountForTesting() const; @@ -59,6 +74,7 @@ const std::string& authorization_code, SigninClient* signin_client, AccountReconcilor* account_reconcilor, + std::unique_ptr<ProcessDiceHeaderObserver> observer, DiceResponseHandler* dice_response_handler); ~DiceTokenFetcher() override; @@ -83,6 +99,7 @@ std::string gaia_id_; std::string email_; std::string authorization_code_; + std::unique_ptr<ProcessDiceHeaderObserver> observer_; DiceResponseHandler* dice_response_handler_; base::CancelableClosure timeout_closure_; std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; @@ -99,9 +116,11 @@ const std::string& email); // Process the Dice signin action. - void ProcessDiceSigninHeader(const std::string& gaia_id, - const std::string& email, - const std::string& authorization_code); + void ProcessDiceSigninHeader( + const std::string& gaia_id, + const std::string& email, + const std::string& authorization_code, + std::unique_ptr<ProcessDiceHeaderObserver> observer); // Process the Dice signout action. void ProcessDiceSignoutHeader(const std::vector<std::string>& gaia_ids, @@ -111,9 +130,10 @@ // after DiceAction::SIGNIN. void OnTokenExchangeSuccess( DiceTokenFetcher* token_fetcher, - const std::string& gaia_id, - const std::string& email, - const GaiaAuthConsumer::ClientOAuthResult& result); + std::string gaia_id, + std::string email, + std::string refresh_token, + std::unique_ptr<ProcessDiceHeaderObserver> observer); void OnTokenExchangeFailure(DiceTokenFetcher* token_fetcher, const GoogleServiceAuthError& error);
diff --git a/chrome/browser/signin/dice_response_handler_unittest.cc b/chrome/browser/signin/dice_response_handler_unittest.cc index f4beb69..7750e62 100644 --- a/chrome/browser/signin/dice_response_handler_unittest.cc +++ b/chrome/browser/signin/dice_response_handler_unittest.cc
@@ -90,6 +90,20 @@ class DiceResponseHandlerTest : public testing::Test, public AccountReconcilor::Observer { + public: + void WillStartRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) { + start_token_fetch_gaia_id_ = gaia_id; + start_token_fetch_email_ = email; + } + + // Called after the refresh token was fetched and added in the token service. + void DidFinishRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) { + finish_token_fetch_gaia_id_ = gaia_id; + finish_token_fetch_email_ = email; + } + protected: DiceResponseHandlerTest() : loop_(base::MessageLoop::TYPE_IO), // URLRequestContext requires IO. @@ -160,6 +174,31 @@ DiceResponseHandler dice_response_handler_; int reconcilor_blocked_count_; int reconcilor_unblocked_count_; + std::string start_token_fetch_gaia_id_; + std::string start_token_fetch_email_; + std::string finish_token_fetch_gaia_id_; + std::string finish_token_fetch_email_; +}; + +class TestProcessDiceHeaderObserver : public ProcessDiceHeaderObserver { + public: + explicit TestProcessDiceHeaderObserver(DiceResponseHandlerTest* owner) + : owner_(owner) {} + ~TestProcessDiceHeaderObserver() override = default; + + void WillStartRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) override { + owner_->WillStartRefreshTokenFetch(gaia_id, email); + } + + // Called after the refresh token was fetched and added in the token service. + void DidFinishRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) override { + owner_->DidFinishRefreshTokenFetch(gaia_id, email); + } + + private: + DiceResponseHandlerTest* owner_; }; // Checks that a SIGNIN action triggers a token exchange request. @@ -168,11 +207,16 @@ DiceResponseParams dice_params = MakeDiceParams(DiceAction::SIGNIN); ASSERT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); EXPECT_EQ(1, reconcilor_blocked_count_); EXPECT_EQ(0, reconcilor_unblocked_count_); + EXPECT_EQ(dice_params.signin_info.gaia_id, start_token_fetch_gaia_id_); + EXPECT_EQ(dice_params.signin_info.email, start_token_fetch_email_); + EXPECT_EQ("", finish_token_fetch_gaia_id_); + EXPECT_EQ("", finish_token_fetch_email_); // Simulate GaiaAuthFetcher success. signin_client_.consumer_->OnClientOAuthSuccess( GaiaAuthConsumer::ClientOAuthResult("refresh_token", "access_token", 10)); @@ -182,6 +226,8 @@ // Check that the reconcilor was blocked and unblocked exactly once. EXPECT_EQ(1, reconcilor_blocked_count_); EXPECT_EQ(1, reconcilor_unblocked_count_); + EXPECT_EQ(dice_params.signin_info.gaia_id, finish_token_fetch_gaia_id_); + EXPECT_EQ(dice_params.signin_info.email, finish_token_fetch_email_); } // Checks that a GaiaAuthFetcher failure is handled correctly. @@ -190,7 +236,12 @@ DiceResponseParams dice_params = MakeDiceParams(DiceAction::SIGNIN); ASSERT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); + EXPECT_EQ(dice_params.signin_info.gaia_id, start_token_fetch_gaia_id_); + EXPECT_EQ(dice_params.signin_info.email, start_token_fetch_email_); + EXPECT_EQ("", finish_token_fetch_gaia_id_); + EXPECT_EQ("", finish_token_fetch_email_); // Check that a GaiaAuthFetcher has been created. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); EXPECT_EQ( @@ -203,6 +254,8 @@ // Check that the token has not been inserted in the token service. EXPECT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); + EXPECT_EQ("", finish_token_fetch_gaia_id_); + EXPECT_EQ("", finish_token_fetch_email_); } // Checks that a second token for the same account is not requested when a @@ -212,13 +265,17 @@ DiceResponseParams dice_params = MakeDiceParams(DiceAction::SIGNIN); ASSERT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); + EXPECT_EQ(dice_params.signin_info.gaia_id, start_token_fetch_gaia_id_); + EXPECT_EQ(dice_params.signin_info.email, start_token_fetch_email_); // Check that a GaiaAuthFetcher has been created. GaiaAuthConsumer* consumer = signin_client_.consumer_; ASSERT_THAT(consumer, testing::NotNull()); // Start a second request for the same account. signin_client_.consumer_ = nullptr; - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that there is no new request. ASSERT_THAT(signin_client_.consumer_, testing::IsNull()); // Simulate GaiaAuthFetcher success for the first request. @@ -227,6 +284,8 @@ // Check that the token has been inserted in the token service. EXPECT_TRUE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); + EXPECT_EQ(dice_params.signin_info.gaia_id, finish_token_fetch_gaia_id_); + EXPECT_EQ(dice_params.signin_info.email, finish_token_fetch_email_); } // Checks that two SIGNIN requests can happen concurrently. @@ -241,7 +300,8 @@ ASSERT_FALSE(token_service_.RefreshTokenIsAvailable( dice_params_2.signin_info.gaia_id)); // Start first request. - dice_response_handler_.ProcessDiceHeader(dice_params_1); + dice_response_handler_.ProcessDiceHeader( + dice_params_1, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created. GaiaAuthConsumer* consumer_1 = signin_client_.consumer_; ASSERT_THAT(consumer_1, testing::NotNull()); @@ -249,7 +309,8 @@ EXPECT_EQ(0, reconcilor_unblocked_count_); // Start second request. signin_client_.consumer_ = nullptr; - dice_response_handler_.ProcessDiceHeader(dice_params_2); + dice_response_handler_.ProcessDiceHeader( + dice_params_2, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); GaiaAuthConsumer* consumer_2 = signin_client_.consumer_; ASSERT_THAT(consumer_2, testing::NotNull()); // Simulate GaiaAuthFetcher success for the first request. @@ -274,7 +335,8 @@ DiceResponseParams dice_params = MakeDiceParams(DiceAction::SIGNIN); ASSERT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); EXPECT_EQ( @@ -308,12 +370,18 @@ EXPECT_TRUE(token_service_.RefreshTokenIsAvailable(kSecondaryGaiaID)); EXPECT_TRUE(signin_manager_.IsAuthenticated()); // Receive signout response for the main account. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); + EXPECT_EQ("", start_token_fetch_gaia_id_); + EXPECT_EQ("", start_token_fetch_email_); + // User is signed out and all tokens are cleared. EXPECT_FALSE(token_service_.RefreshTokenIsAvailable( dice_params.signout_info.gaia_id[0])); EXPECT_FALSE(token_service_.RefreshTokenIsAvailable(kSecondaryGaiaID)); EXPECT_FALSE(signin_manager_.IsAuthenticated()); + EXPECT_EQ("", finish_token_fetch_gaia_id_); + EXPECT_EQ("", finish_token_fetch_email_); // Check that the reconcilor was not blocked. EXPECT_EQ(0, reconcilor_blocked_count_); EXPECT_EQ(0, reconcilor_unblocked_count_); @@ -334,13 +402,19 @@ EXPECT_TRUE(token_service_.RefreshTokenIsAvailable(kMainGaiaID)); EXPECT_TRUE(signin_manager_.IsAuthenticated()); // Receive signout response for the secondary account. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); + EXPECT_EQ("", start_token_fetch_gaia_id_); + EXPECT_EQ("", start_token_fetch_email_); + // Only the token corresponding the the Dice parameter has been removed, and // the user is still signed in. EXPECT_FALSE(token_service_.RefreshTokenIsAvailable( dice_params.signout_info.gaia_id[0])); EXPECT_TRUE(token_service_.RefreshTokenIsAvailable(kMainGaiaID)); EXPECT_TRUE(signin_manager_.IsAuthenticated()); + EXPECT_EQ("", finish_token_fetch_gaia_id_); + EXPECT_EQ("", finish_token_fetch_email_); } TEST_F(DiceResponseHandlerTest, SignoutWebOnly) { @@ -357,7 +431,8 @@ EXPECT_TRUE(token_service_.RefreshTokenIsAvailable(kSecondaryGaiaID)); EXPECT_FALSE(signin_manager_.IsAuthenticated()); // Receive signout response. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Only the token corresponding the the Dice parameter has been removed. EXPECT_FALSE(token_service_.RefreshTokenIsAvailable( dice_params.signout_info.gaia_id[0])); @@ -380,7 +455,8 @@ DiceResponseParams dice_params_2 = MakeDiceParams(DiceAction::SIGNIN); dice_params_2.signin_info.email = "other_email"; dice_params_2.signin_info.gaia_id = "other_gaia_id"; - dice_response_handler_.ProcessDiceHeader(dice_params_2); + dice_response_handler_.ProcessDiceHeader( + dice_params_2, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created and is pending. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); EXPECT_EQ( @@ -388,7 +464,8 @@ ASSERT_FALSE(token_service_.RefreshTokenIsAvailable( dice_params_2.signin_info.gaia_id)); // Signout from main account while signin for the other account is in flight. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that the token fetcher has been canceled and all tokens erased. EXPECT_EQ( 0u, dice_response_handler_.GetPendingDiceTokenFetchersCountForTesting()); @@ -409,10 +486,12 @@ DiceResponseParams signin_params_2 = MakeDiceParams(DiceAction::SIGNIN); signin_params_2.signin_info.email = "other_email"; signin_params_2.signin_info.gaia_id = "other_gaia_id"; - dice_response_handler_.ProcessDiceHeader(signin_params_1); + dice_response_handler_.ProcessDiceHeader( + signin_params_1, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); signin_client_.consumer_ = nullptr; - dice_response_handler_.ProcessDiceHeader(signin_params_2); + dice_response_handler_.ProcessDiceHeader( + signin_params_2, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); EXPECT_EQ( 2u, dice_response_handler_.GetPendingDiceTokenFetchersCountForTesting()); @@ -421,7 +500,8 @@ ASSERT_FALSE(token_service_.RefreshTokenIsAvailable( signin_params_2.signin_info.gaia_id)); // Signout from one of the accounts while signin is in flight. - dice_response_handler_.ProcessDiceHeader(signout_params_1); + dice_response_handler_.ProcessDiceHeader( + signout_params_1, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that one of the fetchers is cancelled. EXPECT_EQ( 1u, dice_response_handler_.GetPendingDiceTokenFetchersCountForTesting()); @@ -443,7 +523,8 @@ DiceResponseParams dice_params = MakeDiceParams(DiceAction::SIGNIN); ASSERT_FALSE( token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has not been created. ASSERT_THAT(signin_client_.consumer_, testing::IsNull()); } @@ -461,7 +542,8 @@ token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); EXPECT_TRUE(signin_manager_.IsAuthenticated()); // Start re-authentication on the web. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); // Sign out. @@ -486,7 +568,8 @@ token_service_.RefreshTokenIsAvailable(dice_params.signin_info.gaia_id)); EXPECT_TRUE(signin_manager_.IsAuthenticated()); // Start re-authentication on the web. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // Check that a GaiaAuthFetcher has been created. ASSERT_THAT(signin_client_.consumer_, testing::NotNull()); // We need to listen for new token notifications, since there is no way to @@ -525,7 +608,8 @@ dice_params.signout_info.gaia_id[0])); EXPECT_TRUE(signin_manager_.IsAuthenticated()); // Receive signout response for the main account. - dice_response_handler_.ProcessDiceHeader(dice_params); + dice_response_handler_.ProcessDiceHeader( + dice_params, base::MakeUnique<TestProcessDiceHeaderObserver>(this)); // User is not signed out from Chrome. EXPECT_TRUE(token_service_.RefreshTokenIsAvailable( dice_params.signout_info.gaia_id[0]));
diff --git a/chrome/browser/signin/dice_tab_helper.cc b/chrome/browser/signin/dice_tab_helper.cc new file mode 100644 index 0000000..2fe2604 --- /dev/null +++ b/chrome/browser/signin/dice_tab_helper.cc
@@ -0,0 +1,48 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/signin/dice_tab_helper.h" + +#include "base/logging.h" +#include "chrome/browser/signin/dice_tab_helper.h" +#include "content/public/browser/navigation_handle.h" +#include "google_apis/gaia/gaia_urls.h" + +DEFINE_WEB_CONTENTS_USER_DATA_KEY(DiceTabHelper); + +DiceTabHelper::DiceTabHelper(content::WebContents* web_contents) + : content::WebContentsObserver(web_contents), + should_start_sync_after_web_signin_(true) { + DCHECK_EQ(GaiaUrls::GetInstance()->add_account_url(), + content::WebContentsObserver::web_contents()->GetVisibleURL()); +} + +DiceTabHelper::~DiceTabHelper() {} + +void DiceTabHelper::DidStartNavigation( + content::NavigationHandle* navigation_handle) { + if (!should_start_sync_after_web_signin_) + return; + + if (!navigation_handle->IsInMainFrame()) { + VLOG(1) << "Ignore subframe navigation to " << navigation_handle->GetURL(); + return; + } + if (navigation_handle->GetURL().GetOrigin() != + GaiaUrls::GetInstance()->gaia_url()) { + VLOG(1) << "Avoid starting sync after a user navigation to " + << navigation_handle->GetURL() + << " which is outside of Gaia domain (" + << GaiaUrls::GetInstance()->gaia_url() << ")"; + should_start_sync_after_web_signin_ = false; + return; + } + + // TODO(msarda): Figure out if this condition can be restricted even more + // (e.g. avoid starting sync after a browser initiated navigation). + // if (!navigation_handle->IsRendererInitiated()) { + // // Avoid starting sync if the navigations comes from the browser. + // should_start_sync_after_web_signin_ = false; + //} +}
diff --git a/chrome/browser/signin/dice_tab_helper.h b/chrome/browser/signin/dice_tab_helper.h new file mode 100644 index 0000000..669d7b30 --- /dev/null +++ b/chrome/browser/signin/dice_tab_helper.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SIGNIN_DICE_TAB_HELPER_H_ +#define CHROME_BROWSER_SIGNIN_DICE_TAB_HELPER_H_ + +#include "base/macros.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" + +// Tab helper used for DICE to mark that sync should start after a web sign-in +// with a Google account. +class DiceTabHelper : public content::WebContentsUserData<DiceTabHelper>, + public content::WebContentsObserver { + public: + ~DiceTabHelper() override; + + // content::WebContentsObserver: + void DidStartNavigation( + content::NavigationHandle* navigation_handle) override; + + // Returns true if sync should start after a Google web-signin flow. + bool should_start_sync_after_web_signin() { + return should_start_sync_after_web_signin_; + } + + private: + friend class content::WebContentsUserData<DiceTabHelper>; + explicit DiceTabHelper(content::WebContents* web_contents); + + bool should_start_sync_after_web_signin_; + + DISALLOW_COPY_AND_ASSIGN(DiceTabHelper); +}; + +#endif // CHROME_BROWSER_SIGNIN_DICE_TAB_HELPER_H_
diff --git a/chrome/browser/signin/process_dice_header_observer_impl.cc b/chrome/browser/signin/process_dice_header_observer_impl.cc new file mode 100644 index 0000000..198d3d42 --- /dev/null +++ b/chrome/browser/signin/process_dice_header_observer_impl.cc
@@ -0,0 +1,60 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/signin/process_dice_header_observer_impl.h" + +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/dice_tab_helper.h" +#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" +#include "components/signin/core/browser/signin_manager.h" +#include "components/signin/core/common/profile_management_switches.h" + +ProcessDiceHeaderObserverImpl::ProcessDiceHeaderObserverImpl( + content::WebContents* web_contents) + : content::WebContentsObserver(web_contents), should_start_sync_(false) {} + +void ProcessDiceHeaderObserverImpl::WillStartRefreshTokenFetch( + const std::string& gaia_id, + const std::string& email) { + if (!signin::IsAccountConsistencyDiceEnabled()) + return; + if (!web_contents()) + return; + + DiceTabHelper* tab_helper = DiceTabHelper::FromWebContents(web_contents()); + should_start_sync_ = + tab_helper && tab_helper->should_start_sync_after_web_signin(); +} + +void ProcessDiceHeaderObserverImpl::DidFinishRefreshTokenFetch( + const std::string& gaia_id, + const std::string& email) { + if (!signin::IsAccountConsistencyDiceEnabled()) + return; + content::WebContents* web_contents = this->web_contents(); + if (!web_contents || !should_start_sync_) { + VLOG(1) << "Do not start sync after web sign-in."; + return; + } + + Browser* browser = chrome::FindBrowserWithWebContents(web_contents); + DCHECK(browser); + Profile* profile = browser->profile(); + DCHECK(profile); + SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); + DCHECK(signin_manager); + if (signin_manager->IsAuthenticated()) { + VLOG(1) << "Do not start sync after web sign-in [already authenticated]."; + return; + } + + // OneClickSigninSyncStarter is suicidal (it will kill itself once it finishes + // enabling sync). + VLOG(1) << "Start sync after web sign-in."; + new OneClickSigninSyncStarter(profile, browser, gaia_id, email, web_contents, + OneClickSigninSyncStarter::Callback()); +}
diff --git a/chrome/browser/signin/process_dice_header_observer_impl.h b/chrome/browser/signin/process_dice_header_observer_impl.h new file mode 100644 index 0000000..debbda3 --- /dev/null +++ b/chrome/browser/signin/process_dice_header_observer_impl.h
@@ -0,0 +1,30 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SIGNIN_PROCESS_DICE_HEADER_OBSERVER_IMPL_H_ +#define CHROME_BROWSER_SIGNIN_PROCESS_DICE_HEADER_OBSERVER_IMPL_H_ + +#include "chrome/browser/signin/dice_response_handler.h" + +#include "base/macros.h" +#include "content/public/browser/web_contents_observer.h" + +class ProcessDiceHeaderObserverImpl : public ProcessDiceHeaderObserver, + public content::WebContentsObserver { + public: + explicit ProcessDiceHeaderObserverImpl(content::WebContents* web_contents); + ~ProcessDiceHeaderObserverImpl() override = default; + + // ProcessDiceHeaderObserver: + void WillStartRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) override; + void DidFinishRefreshTokenFetch(const std::string& gaia_id, + const std::string& email) override; + + private: + bool should_start_sync_; + DISALLOW_COPY_AND_ASSIGN(ProcessDiceHeaderObserverImpl); +}; + +#endif // CHROME_BROWSER_SIGNIN_PROCESS_DICE_HEADER_OBSERVER_IMPL_H_
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index b913bed..17d708b 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1203,6 +1203,8 @@ "webui/chromeos/first_run/first_run_ui.h", "webui/chromeos/image_source.cc", "webui/chromeos/image_source.h", + "webui/chromeos/internet_detail_dialog_ui.cc", + "webui/chromeos/internet_detail_dialog_ui.h", "webui/chromeos/keyboard_overlay_ui.cc", "webui/chromeos/keyboard_overlay_ui.h", "webui/chromeos/login/active_directory_password_change_screen_handler.cc", @@ -1296,8 +1298,6 @@ "webui/chromeos/network_ui.h", "webui/chromeos/power_ui.cc", "webui/chromeos/power_ui.h", - "webui/chromeos/proxy_settings_ui.cc", - "webui/chromeos/proxy_settings_ui.h", "webui/chromeos/set_time_ui.cc", "webui/chromeos/set_time_ui.h", "webui/chromeos/sim_unlock_ui.cc",
diff --git a/chrome/browser/ui/app_list/arc/arc_app_test.cc b/chrome/browser/ui/app_list/arc/arc_app_test.cc index 61cff8d..0111d38 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_test.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_test.cc
@@ -102,13 +102,10 @@ WaitForDefaultApps(); // Check initial conditions. - if (arc::ShouldArcAlwaysStart()) { - // When ARC first starts, it runs in opt-out mode of Play Store. - EXPECT_TRUE(arc_session_manager_->IsSessionRunning()); - } else { + if (!arc::ShouldArcAlwaysStart()) arc::SetArcPlayStoreEnabledForProfile(profile_, true); - EXPECT_FALSE(arc_session_manager_->IsSessionRunning()); - } + if (!arc::IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)) + EXPECT_TRUE(arc_session_manager_->enable_requested()); app_instance_.reset(new arc::FakeAppInstance(arc_app_list_pref_)); arc_service_manager_->arc_bridge_service()->app()->SetInstance(
diff --git a/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc b/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc index d4da0d25..5c768701 100644 --- a/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc +++ b/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
@@ -56,7 +56,10 @@ // TODO(jamescook|newcomer): Replace this with a unit test in //ash/app_list // after app list ownership moves out of the browser process into ash. // http://crbug.com/733662 -IN_PROC_BROWSER_TEST_F(AppListTest, PressAppListButtonToShowAndDismiss) { +// +// Disabled due to timeouts on ChromeOS: https://crbug.com/770138 +IN_PROC_BROWSER_TEST_F(AppListTest, + DISABLED_PressAppListButtonToShowAndDismiss) { aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); ash::Shelf* shelf = ash::Shelf::ForWindow(root_window); ash::ShelfWidget* shelf_widget = shelf->shelf_widget();
diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc index 5b9090d..4358ec0 100644 --- a/chrome/browser/ui/ash/system_tray_client.cc +++ b/chrome/browser/ui/ash/system_tray_client.cc
@@ -415,7 +415,8 @@ return; if (!LoginState::Get()->IsUserLoggedIn()) { DCHECK(!network_id.empty()); - chromeos::LoginDisplayHost::default_host()->OpenProxySettings(network_id); + chromeos::LoginDisplayHost::default_host()->OpenInternetDetailDialog( + network_id); return; } @@ -450,14 +451,6 @@ ShowSettingsSubPageForActiveUser(page); } -void SystemTrayClient::ShowProxySettings() { - LoginState* login_state = LoginState::Get(); - // User is not logged in. - CHECK(!login_state->IsUserLoggedIn() || - login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE); - chromeos::LoginDisplayHost::default_host()->OpenProxySettings(""); -} - void SystemTrayClient::SignOut() { chrome::AttemptUserExit(); }
diff --git a/chrome/browser/ui/ash/system_tray_client.h b/chrome/browser/ui/ash/system_tray_client.h index 4545e5c..5802b02 100644 --- a/chrome/browser/ui/ash/system_tray_client.h +++ b/chrome/browser/ui/ash/system_tray_client.h
@@ -81,7 +81,6 @@ void ShowNetworkCreate(const std::string& type) override; void ShowThirdPartyVpnCreate(const std::string& extension_id) override; void ShowNetworkSettings(const std::string& network_id) override; - void ShowProxySettings() override; void SignOut() override; void RequestRestartForUpdate() override;
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc b/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc index 5e3c488..353c2be 100644 --- a/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc
@@ -200,7 +200,8 @@ chrome::Navigate(&popup->params); #endif if (popup->params.target_contents) { - PopupTracker::CreateForWebContents(popup->params.target_contents); + PopupTracker::CreateForWebContents(popup->params.target_contents, + web_contents()); if (popup->params.disposition == WindowOpenDisposition::NEW_POPUP) { content::RenderFrameHost* host =
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc index db29b7b..a3d0139 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.cc
@@ -16,11 +16,25 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(PopupOpenerTabHelper); PopupOpenerTabHelper::~PopupOpenerTabHelper() { - // TODO(csharrison): Add breakout metrics for when this WebContents has opened - // a popup in its lifetime. - if (visibility_tracker_) { - UMA_HISTOGRAM_LONG_TIMES("Tab.VisibleTimeAfterCrossOriginRedirect", - visibility_tracker_->GetForegroundDuration()); + if (!visibility_tracker_) + return; + base::TimeDelta foreground_duration = + visibility_tracker_->GetForegroundDuration(); + UMA_HISTOGRAM_LONG_TIMES("Tab.VisibleTimeAfterCrossOriginRedirect", + foreground_duration); + if (!last_popup_open_time_before_redirect_.is_null()) { + UMA_HISTOGRAM_LONG_TIMES( + "Tab.OpenedPopup.VisibleTimeAfterCrossOriginRedirect", + foreground_duration); + } +} + +void PopupOpenerTabHelper::OnOpenedPopup(PopupTracker* popup_tracker) { + if (!visibility_tracker_) { + // Should still have clock ownership, since it is passed to the visibility + // tracker when that is instantiated. + DCHECK(tick_clock_); + last_popup_open_time_before_redirect_ = tick_clock_->NowTicks(); } } @@ -50,9 +64,11 @@ return; } - // Only consider navigations without a user gesture. - if (navigation_handle->HasUserGesture()) + // Only consider renderer-initiated navigations without a user gesture. + if (navigation_handle->HasUserGesture() || + !navigation_handle->IsRendererInitiated()) { return; + } // An empty previous URL indicates this was the first load. We filter these // out because we're primarily interested in sites which navigate themselves @@ -67,6 +83,15 @@ return; } + // Use the tick clock before passing ownership. + if (!last_popup_open_time_before_redirect_.is_null()) { + // If long times doesn't have enough resolution, consider switching the + // macro. + UMA_HISTOGRAM_LONG_TIMES( + "Tab.OpenedPopup.PopupToCrossOriginRedirectTime", + tick_clock_->NowTicks() - last_popup_open_time_before_redirect_); + } + visibility_tracker_ = base::MakeUnique<ScopedVisibilityTracker>( std::move(tick_clock_), false /* is_visible */); pending_background_navigations_.clear();
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h index 1385a70..5035939a1 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper.h
@@ -11,6 +11,7 @@ #include "base/containers/flat_set.h" #include "base/macros.h" #include "base/time/tick_clock.h" +#include "base/time/time.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -19,6 +20,7 @@ class WebContents; } // namespace content +class PopupTracker; class ScopedVisibilityTracker; // This class tracks WebContents for the purpose of logging metrics related to @@ -33,6 +35,8 @@ tick_clock_ = std::move(tick_clock); } + void OnOpenedPopup(PopupTracker* popup_tracker); + private: friend class content::WebContentsUserData<PopupOpenerTabHelper>; @@ -58,6 +62,10 @@ // background. std::unique_ptr<ScopedVisibilityTracker> visibility_tracker_; + // Measures the time this WebContents opened a popup before + // |visibility_tracker_| is instantiated. + base::TimeTicks last_popup_open_time_before_redirect_; + DISALLOW_COPY_AND_ASSIGN(PopupOpenerTabHelper); };
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc index 12764b35..d0e19a1 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc
@@ -6,12 +6,14 @@ #include <memory> #include <utility> +#include <vector> #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/test/histogram_tester.h" #include "base/test/simple_test_tick_clock.h" #include "base/time/time.h" +#include "chrome/browser/ui/blocked_content/popup_tracker.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "content/public/browser/web_contents.h" #include "content/public/test/navigation_simulator.h" @@ -20,6 +22,10 @@ constexpr char kTabVisibleTimeAfterRedirect[] = "Tab.VisibleTimeAfterCrossOriginRedirect"; +constexpr char kTabVisibleTimeAfterRedirectPopup[] = + "Tab.OpenedPopup.VisibleTimeAfterCrossOriginRedirect"; +constexpr char kPopupToRedirect[] = + "Tab.OpenedPopup.PopupToCrossOriginRedirectTime"; class PopupOpenerTabHelperTest : public ChromeRenderViewHostTestHarness { public: @@ -35,9 +41,18 @@ PopupOpenerTabHelper::FromWebContents(web_contents()) ->set_tick_clock_for_testing(std::move(tick_clock)); + // The tick clock needs to be advanced manually so it isn't set to null, + // which the code uses to determine if it is set yet. + raw_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); + EXPECT_TRUE(web_contents()->IsVisible()); } + void TearDown() override { + popups_.clear(); + ChromeRenderViewHostTestHarness::TearDown(); + } + void NavigateAndCommitWithoutGesture(const GURL& url) { std::unique_ptr<content::NavigationSimulator> simulator = content::NavigationSimulator::CreateRendererInitiated(url, main_rfh()); @@ -45,6 +60,18 @@ simulator->Commit(); } + // Simulates a popup opened by |web_contents()|. + content::WebContents* SimulatePopup() { + std::unique_ptr<content::WebContents> popup(CreateTestWebContents()); + content::WebContents* raw_popup = popup.get(); + popups_.push_back(std::move(popup)); + + PopupTracker::CreateForWebContents(raw_popup, web_contents() /* opener */); + web_contents()->WasHidden(); + raw_popup->WasShown(); + return raw_popup; + } + base::SimpleTestTickClock* raw_clock() { return raw_clock_; } base::HistogramTester* histogram_tester() { return &histogram_tester_; } @@ -53,6 +80,8 @@ base::HistogramTester histogram_tester_; base::SimpleTestTickClock* raw_clock_ = nullptr; + std::vector<std::unique_ptr<content::WebContents>> popups_; + DISALLOW_COPY_AND_ASSIGN(PopupOpenerTabHelperTest); }; @@ -130,8 +159,7 @@ } TEST_F(PopupOpenerTabHelperTest, HasUserGesture_NoLogging) { - content::NavigationSimulator::NavigateAndCommitFromDocument( - GURL("https://first.test/"), main_rfh()); + NavigateAndCommitWithoutGesture(GURL("https://first.test/")); web_contents()->WasHidden(); std::unique_ptr<content::NavigationSimulator> simulator = @@ -144,3 +172,61 @@ DeleteContents(); histogram_tester()->ExpectTotalCount(kTabVisibleTimeAfterRedirect, 0); } + +TEST_F(PopupOpenerTabHelperTest, OpenPopupNoRedirect_NoLogging) { + NavigateAndCommitWithoutGesture(GURL("https://first.test/")); + SimulatePopup(); + DeleteContents(); + histogram_tester()->ExpectTotalCount(kTabVisibleTimeAfterRedirectPopup, 0); + histogram_tester()->ExpectTotalCount(kPopupToRedirect, 0); +} + +TEST_F(PopupOpenerTabHelperTest, SimulateTabUnder_LogsMetrics) { + NavigateAndCommitWithoutGesture(GURL("https://first.test/")); + + // Popup and then navigate 50ms after. + SimulatePopup(); + raw_clock()->Advance(base::TimeDelta::FromMilliseconds(50)); + NavigateAndCommitWithoutGesture(GURL("https://example.test/")); + + // Spent 100 ms on the opener before closing it. + raw_clock()->Advance(base::TimeDelta::FromMinutes(1)); + web_contents()->WasShown(); + raw_clock()->Advance(base::TimeDelta::FromMilliseconds(100)); + DeleteContents(); + + histogram_tester()->ExpectUniqueSample(kTabVisibleTimeAfterRedirect, 100, 1); + histogram_tester()->ExpectUniqueSample(kTabVisibleTimeAfterRedirectPopup, 100, + 1); + histogram_tester()->ExpectUniqueSample(kPopupToRedirect, 50, 1); +} + +// Same as above tab-under case, but this one starts the navigation before +// issuing the popup. Currently, this case is not supported. +TEST_F(PopupOpenerTabHelperTest, SimulateTabUnderNavBeforePopup_LogsMetrics) { + NavigateAndCommitWithoutGesture(GURL("https://first.test/")); + + // Start navigating, then popup, then commit. + raw_clock()->Advance(base::TimeDelta::FromMilliseconds(50)); + std::unique_ptr<content::NavigationSimulator> simulator = + content::NavigationSimulator::CreateRendererInitiated( + GURL("https://example.test/"), main_rfh()); + simulator->SetHasUserGesture(false); + simulator->Start(); + SimulatePopup(); + simulator->Commit(); + + // Spent 100 ms on the opener before closing it. + raw_clock()->Advance(base::TimeDelta::FromMinutes(1)); + web_contents()->WasShown(); + raw_clock()->Advance(base::TimeDelta::FromMilliseconds(100)); + DeleteContents(); + + // No histograms are logged because: + // 1. The navigation starts in the foreground. + // 2. The popup is issued before the navigation, and the popup metrics only + // log for navigations after the popup. + histogram_tester()->ExpectTotalCount(kTabVisibleTimeAfterRedirect, 0); + histogram_tester()->ExpectTotalCount(kTabVisibleTimeAfterRedirectPopup, 0); + histogram_tester()->ExpectTotalCount(kPopupToRedirect, 0); +}
diff --git a/chrome/browser/ui/blocked_content/popup_tracker.cc b/chrome/browser/ui/blocked_content/popup_tracker.cc index a29da366..13ec1b2 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker.cc +++ b/chrome/browser/ui/blocked_content/popup_tracker.cc
@@ -7,22 +7,37 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_tick_clock.h" +#include "chrome/browser/ui/blocked_content/popup_opener_tab_helper.h" #include "chrome/browser/ui/blocked_content/scoped_visibility_tracker.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(PopupTracker); +void PopupTracker::CreateForWebContents(content::WebContents* contents, + content::WebContents* opener) { + DCHECK(contents); + DCHECK(opener); + if (!FromWebContents(contents)) { + contents->SetUserData(UserDataKey(), + base::WrapUnique(new PopupTracker(contents, opener))); + } +} + PopupTracker::~PopupTracker() { if (first_load_visibility_tracker_) { UMA_HISTOGRAM_LONG_TIMES( - "ContentSettings.Popups.FirstDocumentEngagementTime", + "ContentSettings.Popups.FirstDocumentEngagementTime2", first_load_visibility_tracker_->GetForegroundDuration()); } } -PopupTracker::PopupTracker(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents) {} +PopupTracker::PopupTracker(content::WebContents* contents, + content::WebContents* opener) + : content::WebContentsObserver(contents) { + if (auto* popup_opener = PopupOpenerTabHelper::FromWebContents(opener)) + popup_opener->OnOpenedPopup(this); +} void PopupTracker::DidFinishNavigation( content::NavigationHandle* navigation_handle) {
diff --git a/chrome/browser/ui/blocked_content/popup_tracker.h b/chrome/browser/ui/blocked_content/popup_tracker.h index 82bcf02..739422d 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker.h +++ b/chrome/browser/ui/blocked_content/popup_tracker.h
@@ -25,12 +25,14 @@ class PopupTracker : public content::WebContentsObserver, public content::WebContentsUserData<PopupTracker> { public: + static void CreateForWebContents(content::WebContents* contents, + content::WebContents* opener); ~PopupTracker() override; private: friend class content::WebContentsUserData<PopupTracker>; - explicit PopupTracker(content::WebContents* web_contents); + PopupTracker(content::WebContents* contents, content::WebContents* opener); // content::WebContentsObserver: void DidFinishNavigation(
diff --git a/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc index 08ba01b..df3ca5ce 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc +++ b/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc
@@ -30,7 +30,7 @@ #include "ui/events/keycodes/keyboard_codes.h" const char kPopupEngagement[] = - "ContentSettings.Popups.FirstDocumentEngagementTime"; + "ContentSettings.Popups.FirstDocumentEngagementTime2"; class PopupTrackerBrowserTest : public InProcessBrowserTest { public: @@ -175,3 +175,15 @@ tester.ExpectTotalCount(kPopupEngagement, 1); } + +IN_PROC_BROWSER_TEST_F(PopupTrackerBrowserTest, NoOpener_NoTracker) { + const GURL url = embedded_test_server()->GetURL("/title1.html"); + ui_test_utils::NavigateToURLWithDisposition( + browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + + content::WebContents* new_contents = + browser()->tab_strip_model()->GetWebContentsAt(1); + + EXPECT_FALSE(PopupTracker::FromWebContents(new_contents)); +}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index b234ae5..1a4b9a8 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1464,8 +1464,8 @@ if (params.user_gesture) nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; nav_params.user_gesture = params.user_gesture; - bool is_popup = - PopupBlockerTabHelper::ConsiderForPopupBlocking(params.disposition); + bool is_popup = source && PopupBlockerTabHelper::ConsiderForPopupBlocking( + params.disposition); if (is_popup && PopupBlockerTabHelper::MaybeBlockPopup( source, base::Optional<GURL>(), nav_params, ¶ms, blink::mojom::WindowFeatures())) { @@ -1475,7 +1475,7 @@ chrome::Navigate(&nav_params); if (is_popup && nav_params.target_contents) - PopupTracker::CreateForWebContents(nav_params.target_contents); + PopupTracker::CreateForWebContents(nav_params.target_contents, source); return nav_params.target_contents; } @@ -1519,8 +1519,8 @@ bool* was_blocked) { // At this point the |new_contents| is beyond the popup blocker, but we use // the same logic for determining if the popup tracker needs to be attached. - if (PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition)) - PopupTracker::CreateForWebContents(new_contents); + if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition)) + PopupTracker::CreateForWebContents(new_contents, source); chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, user_gesture); }
diff --git a/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm index 84838a2..e6edb8bb 100644 --- a/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm +++ b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.mm
@@ -112,7 +112,7 @@ void ExclusiveAccessController::UpdateFullscreenToolbar() { [[controller_ fullscreenToolbarController] - updateToolbarStyleExitingTabFullscreen:NO]; + layoutToolbarStyleIsExitingTabFullscreen:NO]; } // See the Fullscreen terminology section and the (Fullscreen) interface
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 85ce4e3..44009860 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1953,7 +1953,7 @@ (ExclusiveAccessContext::TabFullscreenState)state { DCHECK([self isInAnyFullscreenMode]); [fullscreenToolbarController_ - updateToolbarStyleExitingTabFullscreen: + layoutToolbarStyleIsExitingTabFullscreen: state == ExclusiveAccessContext::STATE_EXIT_TAB_FULLSCREEN]; }
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm index fd79d5f..091621c 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
@@ -12,6 +12,7 @@ #include "base/run_loop.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/histogram_tester.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/devtools/devtools_window_testing.h" @@ -28,12 +29,12 @@ #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" #import "chrome/browser/ui/cocoa/fast_resize_view.h" +#import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" #import "chrome/browser/ui/cocoa/history_overlay_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" -#import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" @@ -50,6 +51,8 @@ #include "chrome/test/base/testing_profile.h" #include "components/infobars/core/infobar_delegate.h" #include "components/infobars/core/simple_alert_infobar_delegate.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/testing_pref_service.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" @@ -396,7 +399,7 @@ // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. // This method toggles fullscreen and waits for the notification. - void ToggleFullscreenAndWaitForNotification() { + void ToggleBrowserFullscreenAndWaitForNotification() { std::unique_ptr<FullscreenNotificationObserver> waiter( new FullscreenNotificationObserver()); browser() @@ -406,6 +409,29 @@ waiter->Wait(); } + void EnterTabFullscreenAndWaitForNotification() { + std::unique_ptr<FullscreenNotificationObserver> waiter( + new FullscreenNotificationObserver()); + content::WebContents* contents = + browser()->tab_strip_model()->GetActiveWebContents(); + browser() + ->exclusive_access_manager() + ->fullscreen_controller() + ->EnterFullscreenModeForTab(contents, GURL()); + waiter->Wait(); + } + + void ToggleExtensionFullscreenAndWaitForNotification() { + std::unique_ptr<FullscreenNotificationObserver> waiter( + new FullscreenNotificationObserver()); + browser() + ->exclusive_access_manager() + ->fullscreen_controller() + ->ToggleBrowserFullscreenModeWithExtension( + GURL("https://www.google.com")); + waiter->Wait(); + } + // Verifies that the flags |blockLayoutSubviews_| and |blockFullscreenResize| // are false. void VerifyFullscreenResizeFlagsAfterTransition() { @@ -708,11 +734,11 @@ // are reset correctly after the transition. IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, FullscreenResizeFlags) { // Enter fullscreen and verify the flags. - ToggleFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); VerifyFullscreenResizeFlagsAfterTransition(); // Exit fullscreen and verify the flags. - ToggleFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); VerifyFullscreenResizeFlagsAfterTransition(); } @@ -728,7 +754,7 @@ [[controller() fullscreenToolbarController] setMenubarTracker:nil]; // Toggle fullscreen and check if the toolbar is shown. - ToggleFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); EXPECT_EQ( FullscreenToolbarStyle::TOOLBAR_PRESENT, [[controller() fullscreenToolbarController] computeLayout].toolbarStyle); @@ -743,8 +769,8 @@ // Toggle out and back into fullscreen and verify that the toolbar is still // hidden. - ToggleFullscreenAndWaitForNotification(); - ToggleFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); EXPECT_EQ( FullscreenToolbarStyle::TOOLBAR_HIDDEN, [[controller() fullscreenToolbarController] computeLayout].toolbarStyle); @@ -764,7 +790,7 @@ [controller() setFullscreenToolbarController:fullscreenToolbarController.get()]; - ToggleFullscreenAndWaitForNotification(); + ToggleBrowserFullscreenAndWaitForNotification(); // Insert a non-NTP new tab in the foreground. AddTabAtIndex(0, GURL("http://google.com"), ui::PAGE_TRANSITION_LINK); @@ -795,3 +821,79 @@ EXPECT_TRUE([fullscreenToolbarController isRevealingToolbar]); [fullscreenToolbarController resetToolbarFlag]; } + +// Tests if entering browser fullscreen would log into the histogram. +IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, FullscreenHistogram) { + base::HistogramTester histogram_tester; + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetBoolean(prefs::kShowFullscreenToolbar, true); + + // Enter browser fullscreen. + ToggleBrowserFullscreenAndWaitForNotification(); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.Enter.Source", + (int)FullscreenSource::BROWSER, 1); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.WindowLocation", 1); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Style", 1); + histogram_tester.ExpectBucketCount( + "OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_PRESENT, 1); + + // Exit browser fullscreen. + ToggleBrowserFullscreenAndWaitForNotification(); + + prefs->SetBoolean(prefs::kShowFullscreenToolbar, false); + ToggleBrowserFullscreenAndWaitForNotification(); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.Enter.Source", + (int)FullscreenSource::BROWSER, 2); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.WindowLocation", 2); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Style", 2); + histogram_tester.ExpectBucketCount( + "OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_HIDDEN, 1); + + prefs->SetBoolean(prefs::kShowFullscreenToolbar, true); + [[controller() fullscreenToolbarController] + layoutToolbarStyleIsExitingTabFullscreen:NO]; + histogram_tester.ExpectBucketCount( + "OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_PRESENT, 2); + + // Enter tab fullscreen. Since we're still in browser fullscreen, this + // should not log anything to OSX.Fullscreen.Enter. + EnterTabFullscreenAndWaitForNotification(); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Source", 2); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.WindowLocation", 2); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Style", 2); + + histogram_tester.ExpectBucketCount("OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_NONE, + 1); + + // Exit browser fullscreen. This will also cause tab fullscreen to exit. + ToggleBrowserFullscreenAndWaitForNotification(); + + EnterTabFullscreenAndWaitForNotification(); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.Enter.Source", + (int)FullscreenSource::TAB, 1); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.WindowLocation", 3); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Style", 3); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_NONE, + 2); + + ToggleBrowserFullscreenAndWaitForNotification(); + + // Enter fullscreen for extension. + ToggleExtensionFullscreenAndWaitForNotification(); + EXPECT_TRUE(browser() + ->exclusive_access_manager() + ->fullscreen_controller() + ->IsExtensionFullscreenOrPending()); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.Enter.Source", + (int)FullscreenSource::EXTENSION, 1); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.WindowLocation", 4); + histogram_tester.ExpectTotalCount("OSX.Fullscreen.Enter.Style", 4); + histogram_tester.ExpectBucketCount("OSX.Fullscreen.ToolbarStyle", + (int)FullscreenToolbarStyle::TOOLBAR_NONE, + 3); +}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.h b/chrome/browser/ui/cocoa/browser_window_controller_private.h index 698945e..f6815221 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.h +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.h
@@ -16,6 +16,24 @@ class WebContents; } // content. +// There are 2 mechanisms for invoking fullscreen: AppKit and Immersive. +// PRESENTATION_MODE = 1 had been removed, but the enums aren't renumbered +// since they are associated with a histogram. +enum FullscreenStyle { + IMMERSIVE_FULLSCREEN = 0, + CANONICAL_FULLSCREEN = 2, + FULLSCREEN_STYLE_COUNT = 3 +}; + +// The source that triggered fullscreen. The enums should not be renumbered +// since they're ssociated with a histogram. Exposed for testing. +enum class FullscreenSource { + BROWSER = 0, + TAB, + EXTENSION, + FULLSCREEN_SOURCE_COUNT +}; + // Private methods for the |BrowserWindowController|. This category should // contain the private methods used by different parts of the BWC; private // methods used only by single parts should be declared in their own file. @@ -159,6 +177,9 @@ // it when we are entering fullscreen. - (void)adjustUIForEnteringFullscreen; +// Records fullscreen metrics when the browser enters fullscreen. +- (void)recordEnterFullscreenMetrics:(FullscreenStyle)style; + // Accessor for the controller managing the fullscreen toolbar visibility // locks. - (FullscreenToolbarVisibilityLockController*)
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 3a6339a9..e186f92 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -81,37 +81,6 @@ WINDOW_LOCATION_COUNT = 3 }; -// There are 2 mechanisms for invoking fullscreen: AppKit and Immersive. -// PRESENTATION_MODE = 1 had been removed, but the enums aren't renumbered -// since they are associated with a histogram. -enum FullscreenStyle { - IMMERSIVE_FULLSCREEN = 0, - CANONICAL_FULLSCREEN = 2, - FULLSCREEN_STYLE_COUNT = 3 -}; - -// Emits a histogram entry indicating the Fullscreen window location. -void RecordFullscreenWindowLocation(NSWindow* window) { - NSArray* screens = [NSScreen screens]; - bool primary_screen = ([[window screen] isEqual:[screens objectAtIndex:0]]); - bool multiple_screens = [screens count] > 1; - - WindowLocation location = PRIMARY_SINGLE_SCREEN; - if (multiple_screens) { - location = - primary_screen ? PRIMARY_MULTIPLE_SCREEN : SECONDARY_MULTIPLE_SCREEN; - } - - UMA_HISTOGRAM_ENUMERATION( - "OSX.Fullscreen.Enter.WindowLocation", location, WINDOW_LOCATION_COUNT); -} - -// Emits a histogram entry indicating the Fullscreen style. -void RecordFullscreenStyle(FullscreenStyle style) { - UMA_HISTOGRAM_ENUMERATION( - "OSX.Fullscreen.Enter.Style", style, FULLSCREEN_STYLE_COUNT); -} - } // namespace @interface NSWindow (NSPrivateApis) @@ -460,8 +429,7 @@ } - (void)enterImmersiveFullscreen { - RecordFullscreenWindowLocation([self window]); - RecordFullscreenStyle(IMMERSIVE_FULLSCREEN); + [self recordEnterFullscreenMetrics:IMMERSIVE_FULLSCREEN]; // Set to NO by |-windowDidEnterFullScreen:|. enteringImmersiveFullscreen_ = YES; @@ -601,8 +569,7 @@ } - (void)windowWillEnterFullScreen:(NSNotification*)notification { - RecordFullscreenWindowLocation([self window]); - RecordFullscreenStyle(CANONICAL_FULLSCREEN); + [self recordEnterFullscreenMetrics:CANONICAL_FULLSCREEN]; if (notification) // For System Fullscreen when non-nil. [self registerForContentViewResizeNotifications]; @@ -812,6 +779,39 @@ [self layoutSubviews]; } +- (void)recordEnterFullscreenMetrics:(FullscreenStyle)style { + // Record fullscreen source. + FullscreenController* controller = + browser_->exclusive_access_manager()->fullscreen_controller(); + FullscreenSource source = FullscreenSource::BROWSER; + if (controller->IsWindowFullscreenForTabOrPending()) + source = FullscreenSource::TAB; + else if (controller->IsExtensionFullscreenOrPending()) + source = FullscreenSource::EXTENSION; + + UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.Enter.Source", source, + FullscreenSource::FULLSCREEN_SOURCE_COUNT); + + // Record fullscreen style. + UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.Enter.Style", style, + FULLSCREEN_STYLE_COUNT); + + // Record screen location. + NSArray* screens = [NSScreen screens]; + bool primary_screen = + [[[self window] screen] isEqual:[screens objectAtIndex:0]]; + bool multiple_screens = [screens count] > 1; + + WindowLocation location = PRIMARY_SINGLE_SCREEN; + if (multiple_screens) { + location = + primary_screen ? PRIMARY_MULTIPLE_SCREEN : SECONDARY_MULTIPLE_SCREEN; + } + + UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.Enter.WindowLocation", location, + WINDOW_LOCATION_COUNT); +} + - (CGFloat)toolbarDividerOpacity { return [bookmarkBarController_ toolbarDividerOpacity]; }
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm index 3347548..55cdd83 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm
@@ -140,7 +140,7 @@ state_ = FullscreenMenubarState::SHOWING; menubarFraction_ = progress; - [owner_ updateToolbarLayout]; + [owner_ layoutToolbar]; // AppKit drives the menu bar animation from a nested run loop. Flush // explicitly so that Chrome's UI updates during the animation. @@ -157,7 +157,7 @@ state_ = FullscreenMenubarState::HIDDEN; [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self withAnimation:NO]; - [owner_ updateToolbarLayout]; + [owner_ layoutToolbar]; } @end
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_controller.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_controller.mm index c26fdc5..960d6e5 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_controller.mm
@@ -121,7 +121,7 @@ void FullscreenToolbarAnimationController::AnimationProgressed( const gfx::Animation* animation) { - [owner_ updateToolbarLayout]; + [owner_ layoutToolbar]; } void FullscreenToolbarAnimationController::AnimationEnded(
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h index 7cc966b..c83a1470 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h
@@ -22,19 +22,25 @@ } // This enum class represents the appearance of the fullscreen toolbar, which -// includes the tab strip and omnibox. +// includes the tab strip and omnibox. These values are logged in a histogram +// and shouldn't be renumbered or removed. enum class FullscreenToolbarStyle { // The toolbar is present. Moving the cursor to the top // causes the menubar to appear and the toolbar to slide down. - TOOLBAR_PRESENT, + TOOLBAR_PRESENT = 0, // The toolbar is hidden. Moving cursor to top shows the // toolbar and menubar. TOOLBAR_HIDDEN, // Toolbar is hidden. Moving cursor to top causes the menubar // to appear, but not the toolbar. TOOLBAR_NONE, + // The last enum value. Used for logging in a histogram. + TOOLBAR_LAST = TOOLBAR_NONE }; +static constexpr int kFullscreenToolbarStyleCount = + (int)FullscreenToolbarStyle::TOOLBAR_LAST + 1; + // This struct contains the calculated values of the fullscreen toolbar layout. struct FullscreenToolbarLayout { // The toolbar style. @@ -118,10 +124,10 @@ // Updates the toolbar style. If the style has changed, then the toolbar will // relayout. -- (void)updateToolbarStyleExitingTabFullscreen:(BOOL)isExitingTabFullscreen; +- (void)layoutToolbarStyleIsExitingTabFullscreen:(BOOL)isExitingTabFullscreen; // Updates the toolbar by updating the layout. -- (void)updateToolbarLayout; +- (void)layoutToolbar; // Returns YES if the browser in in fullscreen. - (BOOL)isInFullscreen;
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm index 66c0ccc..87c9f98 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.mm
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/feature_list.h" +#include "base/metrics/histogram_macros.h" #include "chrome/browser/profiles/profile.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.h" @@ -23,8 +24,18 @@ const CGFloat kHideFraction = 0.0; const CGFloat kShowFraction = 1.0; +void RecordToolbarStyle(FullscreenToolbarStyle style) { + UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.ToolbarStyle", style, + kFullscreenToolbarStyleCount); +} + } // namespace +@interface FullscreenToolbarController () +// Updates |toolbarStyle_|. +- (void)updateToolbarStyle:(BOOL)isExitingTabFullscreen; +@end + @implementation FullscreenToolbarController - (id)initWithBrowserController:(BrowserWindowController*)controller { @@ -49,7 +60,8 @@ DCHECK(!inFullscreenMode_); inFullscreenMode_ = YES; - [self updateToolbarStyleExitingTabFullscreen:NO]; + [self updateToolbarStyle:NO]; + RecordToolbarStyle(toolbarStyle_); if ([browserController_ isInImmersiveFullscreen]) { immersiveFullscreenController_.reset([[ImmersiveFullscreenController alloc] @@ -149,9 +161,7 @@ [mouseTracker_ updateToolbarFrame:frame]; } -- (void)updateToolbarStyleExitingTabFullscreen:(BOOL)isExitingTabFullscreen { - FullscreenToolbarStyle oldStyle = toolbarStyle_; - +- (void)updateToolbarStyle:(BOOL)isExitingTabFullscreen { if ([browserController_ isFullscreenForTabContentOrExtension] && !isExitingTabFullscreen) { toolbarStyle_ = FullscreenToolbarStyle::TOOLBAR_NONE; @@ -161,12 +171,19 @@ ? FullscreenToolbarStyle::TOOLBAR_PRESENT : FullscreenToolbarStyle::TOOLBAR_HIDDEN; } - - if (oldStyle != toolbarStyle_) - [self updateToolbarLayout]; } -- (void)updateToolbarLayout { +- (void)layoutToolbarStyleIsExitingTabFullscreen:(BOOL)isExitingTabFullscreen { + FullscreenToolbarStyle oldStyle = toolbarStyle_; + [self updateToolbarStyle:isExitingTabFullscreen]; + + if (oldStyle != toolbarStyle_) { + [self layoutToolbar]; + RecordToolbarStyle(toolbarStyle_); + } +} + +- (void)layoutToolbar { [browserController_ layoutSubviews]; animationController_->ToolbarDidUpdate(); [mouseTracker_ updateTrackingArea];
diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_controller.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_controller.mm index 0f9ebf3b..644c345 100644 --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_controller.mm
@@ -57,7 +57,7 @@ if (animate) animationController_->AnimateToolbarIn(); else - [owner_ updateToolbarLayout]; + [owner_ layoutToolbar]; } - (void)releaseToolbarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { @@ -69,7 +69,7 @@ if (animate) animationController_->AnimateToolbarOutIfPossible(); else - [owner_ updateToolbarLayout]; + [owner_ layoutToolbar]; } @end
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc index 5751f542..7fd399d5 100644 --- a/chrome/browser/ui/passwords/password_manager_presenter.cc +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -245,9 +245,6 @@ } void PasswordManagerPresenter::UpdatePasswordLists() { - // Reset so that showing a password will require re-authentication. - last_authentication_time_ = base::TimeTicks(); - // Reset the current lists. password_list_.clear(); password_duplicates_.clear(); @@ -416,6 +413,8 @@ } } +// TODO(crbug.com/327331): Trigger Re-Auth after closing and opening the +// settings tab. bool PasswordManagerPresenter::IsUserAuthenticated() { #if defined(OS_ANDROID) NOTREACHED();
diff --git a/chrome/browser/ui/search/ntp_user_data_logger.cc b/chrome/browser/ui/search/ntp_user_data_logger.cc index f9c5669..beedc977 100644 --- a/chrome/browser/ui/search/ntp_user_data_logger.cc +++ b/chrome/browser/ui/search/ntp_user_data_logger.cc
@@ -132,6 +132,48 @@ } } +// This enum must match the numbering for NewTabPageLogoShown in enums.xml. +// Do not reorder or remove items, and only add new items before +// LOGO_IMPRESSION_TYPE_MAX. +enum LogoImpressionType { + // Static Doodle image. + LOGO_IMPRESSION_TYPE_STATIC = 0, + // Call-to-action Doodle image. + LOGO_IMPRESSION_TYPE_CTA = 1, + + LOGO_IMPRESSION_TYPE_MAX +}; + +// This enum must match the numbering for NewTabPageLogoClick in enums.xml. +// Do not reorder or remove items, and only add new items before +// LOGO_CLICK_TYPE_MAX. +enum LogoClickType { + // Static Doodle image. + LOGO_CLICK_TYPE_STATIC = 0, + // Call-to-action Doodle image. + LOGO_CLICK_TYPE_CTA = 1, + // Animated Doodle image. + LOGO_CLICK_TYPE_ANIMATED = 2, + + LOGO_CLICK_TYPE_MAX +}; + +// Converts |NTPLoggingEventType| to a |LogoClickType|, if the value +// is an error value. Otherwise, |LOGO_CLICK_TYPE_MAX| is returned. +LogoClickType LoggingEventToLogoClick(NTPLoggingEventType event) { + switch (event) { + case NTP_STATIC_LOGO_CLICKED: + return LOGO_CLICK_TYPE_STATIC; + case NTP_CTA_LOGO_CLICKED: + return LOGO_CLICK_TYPE_CTA; + case NTP_ANIMATED_LOGO_CLICKED: + return LOGO_CLICK_TYPE_ANIMATED; + default: + NOTREACHED(); + return LOGO_CLICK_TYPE_MAX; + } +} + } // namespace DEFINE_WEB_CONTENTS_USER_DATA_KEY(NTPUserDataLogger); @@ -210,6 +252,25 @@ LoggingEventToVoiceError(event), VOICE_ERROR_MAX); break; + case NTP_STATIC_LOGO_SHOWN_FROM_CACHE: + RecordDoodleImpression(time, /*is_cta=*/false, /*from_cache=*/true); + break; + case NTP_STATIC_LOGO_SHOWN_FRESH: + RecordDoodleImpression(time, /*is_cta=*/false, /*from_cache=*/false); + break; + case NTP_CTA_LOGO_SHOWN_FROM_CACHE: + RecordDoodleImpression(time, /*is_cta=*/true, /*from_cache=*/true); + break; + case NTP_CTA_LOGO_SHOWN_FRESH: + RecordDoodleImpression(time, /*is_cta=*/true, /*from_cache=*/false); + break; + case NTP_STATIC_LOGO_CLICKED: + case NTP_CTA_LOGO_CLICKED: + case NTP_ANIMATED_LOGO_CLICKED: + UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoClick", + LoggingEventToLogoClick(event), + LOGO_CLICK_TYPE_MAX); + break; } } @@ -246,6 +307,7 @@ impression_tile_source_(kNumMostVisited), impression_tile_type_(kNumMostVisited), has_emitted_(false), + should_record_doodle_load_time_(true), during_startup_(!AfterStartupTaskUtils::IsBrowserStartupComplete()) { // We record metrics about session data here because when this class typically // emits metrics it is too late. This session data would theoretically have @@ -269,6 +331,7 @@ impression_was_logged_.reset(); tiles_received_time_ = base::TimeDelta(); has_emitted_ = false; + should_record_doodle_load_time_ = true; } } @@ -363,3 +426,24 @@ has_emitted_ = true; during_startup_ = false; } + +void NTPUserDataLogger::RecordDoodleImpression(base::TimeDelta time, + bool is_cta, + bool from_cache) { + LogoImpressionType logo_type = + is_cta ? LOGO_IMPRESSION_TYPE_CTA : LOGO_IMPRESSION_TYPE_STATIC; + UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoShown", logo_type, + LOGO_IMPRESSION_TYPE_MAX); + if (from_cache) { + UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoShown.FromCache", logo_type, + LOGO_IMPRESSION_TYPE_MAX); + } else { + UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoShown.Fresh", logo_type, + LOGO_IMPRESSION_TYPE_MAX); + } + + if (should_record_doodle_load_time_) { + UMA_HISTOGRAM_MEDIUM_TIMES("NewTabPage.LogoShownTime2", time); + should_record_doodle_load_time_ = false; + } +}
diff --git a/chrome/browser/ui/search/ntp_user_data_logger.h b/chrome/browser/ui/search/ntp_user_data_logger.h index 05b290d..d81c7a0a 100644 --- a/chrome/browser/ui/search/ntp_user_data_logger.h +++ b/chrome/browser/ui/search/ntp_user_data_logger.h
@@ -85,6 +85,10 @@ // the tab/shutting down Chrome), or when the user navigates to a URL. void EmitNtpStatistics(base::TimeDelta load_time); + void RecordDoodleImpression(base::TimeDelta time, + bool is_cta, + bool from_cache); + // Records whether we have yet logged an impression for the tile at a given // index. A typical NTP will log 8 impressions, but could record fewer for new // users that haven't built up a history yet. @@ -113,6 +117,8 @@ // Whether we have already emitted NTP stats for this web contents. bool has_emitted_; + bool should_record_doodle_load_time_; + // Are stats being logged during Chrome startup? bool during_startup_;
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc index 5d708df..94015ab 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
@@ -54,7 +54,6 @@ // This class handles a user's fullscreen request (Shift+F4/F4). class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate, - public ash::wm::WindowStateObserver, public aura::WindowObserver { public: NativeAppWindowStateDelegate(AppWindow* app_window, @@ -67,14 +66,11 @@ // is the case when exiting immersive fullscreen via the "Restore" window // control. // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 - window_state_->AddObserver(this); window_state_->window()->AddObserver(this); } ~NativeAppWindowStateDelegate() override { - if (window_state_) { - window_state_->RemoveObserver(this); + if (window_state_) window_state_->window()->RemoveObserver(this); - } } private: @@ -95,27 +91,29 @@ return true; } - // Overridden from ash::wm::WindowStateObserver: - void OnPostWindowStateTypeChange( - ash::wm::WindowState* window_state, - ash::mojom::WindowStateType old_type) override { - // Since the window state might get set by a window manager, it is possible - // to come here before the application set its |BaseWindow|. - if (!window_state->IsFullscreen() && !window_state->IsMinimized() && - app_window_->GetBaseWindow() && - app_window_->GetBaseWindow()->IsFullscreenOrPending()) { - app_window_->Restore(); - // Usually OnNativeWindowChanged() is called when the window bounds are - // changed as a result of a state type change. Because the change in state - // type has already occurred, we need to call OnNativeWindowChanged() - // explicitly. - app_window_->OnNativeWindowChanged(); + // Overridden from aura::WindowObserver: + void OnWindowPropertyChanged(aura::Window* window, + const void* key, + intptr_t old) override { + if (key == ash::kWindowStateTypeKey) { + ash::mojom::WindowStateType new_state = + window->GetProperty(ash::kWindowStateTypeKey); + + if (new_state != ash::mojom::WindowStateType::FULLSCREEN && + new_state != ash::mojom::WindowStateType::MINIMIZED && + app_window_->GetBaseWindow() && + app_window_->GetBaseWindow()->IsFullscreenOrPending()) { + app_window_->Restore(); + // Usually OnNativeWindowChanged() is called when the window bounds are + // changed as a result of a state type change. Because the change in + // state type has already occurred, we need to call + // OnNativeWindowChanged() explicitly. + app_window_->OnNativeWindowChanged(); + } } } - // Overridden from aura::WindowObserver: void OnWindowDestroying(aura::Window* window) override { - window_state_->RemoveObserver(this); window_state_->window()->RemoveObserver(this); window_state_ = nullptr; }
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index f90e90b..7d0430c 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -76,6 +76,7 @@ provider->GetDistanceMetric(views::DISTANCE_BUTTON_MAX_LINKABLE_WIDTH); views::ColumnSet* column_set = layout->AddColumnSet(column_layout_id); + column_set->AddPaddingColumn(100.0, 0); column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); column_set->AddPaddingColumn(0, button_padding); @@ -258,6 +259,13 @@ } /////////////////////////////////////////////////////////////////////////////// +// CollectedCookiesViews, views::WidgetDelegate implementation: + +bool CollectedCookiesViews::ShouldShowCloseButton() const { + return false; +} + +/////////////////////////////////////////////////////////////////////////////// // CollectedCookiesViews, views::DialogDelegate implementation: base::string16 CollectedCookiesViews::GetWindowTitle() const { @@ -265,15 +273,15 @@ } int CollectedCookiesViews::GetDialogButtons() const { - return ui::DIALOG_BUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK; } base::string16 CollectedCookiesViews::GetDialogButtonLabel( ui::DialogButton button) const { - return l10n_util::GetStringUTF16(IDS_DONE); + return l10n_util::GetStringUTF16(IDS_CLOSE); } -bool CollectedCookiesViews::Cancel() { +bool CollectedCookiesViews::Accept() { // If the user closes our parent tab while we're still open, this method will // (eventually) be called in response to a WebContentsDestroyed() call from // the WebContentsImpl to its observers. But since the InfoBarService is also
diff --git a/chrome/browser/ui/views/collected_cookies_views.h b/chrome/browser/ui/views/collected_cookies_views.h index e57d090..500f4b1 100644 --- a/chrome/browser/ui/views/collected_cookies_views.h +++ b/chrome/browser/ui/views/collected_cookies_views.h
@@ -49,8 +49,9 @@ base::string16 GetWindowTitle() const override; int GetDialogButtons() const override; base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; - bool Cancel() override; + bool Accept() override; ui::ModalType GetModalType() const override; + bool ShouldShowCloseButton() const override; // views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override;
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index eeb92c5..73ab9102 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -140,12 +140,12 @@ #include "chrome/browser/ui/webui/chromeos/cryptohome_ui.h" #include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h" #include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h" +#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.h" #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" #include "chrome/browser/ui/webui/chromeos/network_ui.h" #include "chrome/browser/ui/webui/chromeos/power_ui.h" -#include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" #include "chrome/browser/ui/webui/chromeos/set_time_ui.h" #include "chrome/browser/ui/webui/chromeos/sim_unlock_ui.h" #include "chrome/browser/ui/webui/chromeos/slow_trace_ui.h" @@ -465,8 +465,8 @@ return &NewWebUI<chromeos::PowerUI>; if (url.host_piece() == proximity_auth::kChromeUIProximityAuthHost) return &NewWebUI<proximity_auth::ProximityAuthUI>; - if (url.host_piece() == chrome::kChromeUIProxySettingsHost) - return &NewWebUI<chromeos::ProxySettingsUI>; + if (url.host_piece() == chrome::kChromeUIInternetDetailDialogHost) + return &NewWebUI<chromeos::InternetDetailDialogUI>; if (url.host_piece() == chrome::kChromeUISetTimeHost) return &NewWebUI<chromeos::SetTimeUI>; if (url.host_piece() == chrome::kChromeUISimUnlockHost)
diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.cc similarity index 82% rename from chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc rename to chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.cc index 53455aa..ecc57cd 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc +++ b/chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" +#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h" @@ -44,25 +44,23 @@ } // namespace -ProxySettingsUI::ProxySettingsUI(content::WebUI* web_ui) +InternetDetailDialogUI::InternetDetailDialogUI(content::WebUI* web_ui) : ui::WebDialogUI(web_ui) { - content::WebUIDataSource* source = - content::WebUIDataSource::Create(chrome::kChromeUIProxySettingsHost); + content::WebUIDataSource* source = content::WebUIDataSource::Create( + chrome::kChromeUIInternetDetailDialogHost); AddInternetStrings(source); source->SetJsonPath("strings.js"); - source->SetDefaultResource(IDR_PROXY_SETTINGS_HTML); + source->SetDefaultResource(IDR_INTERNET_DETAIL_DIALOG_HTML); source->DisableContentSecurityPolicy(); - source->AddResourcePath("internet_detail_dialog.html", - IDR_INTERNET_DETAIL_DIALOG_HTML); source->AddResourcePath("internet_detail_dialog.js", IDR_INTERNET_DETAIL_DIALOG_JS); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); } -ProxySettingsUI::~ProxySettingsUI() {} +InternetDetailDialogUI::~InternetDetailDialogUI() {} } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.h b/chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.h new file mode 100644 index 0000000..5b9b367 --- /dev/null +++ b/chrome/browser/ui/webui/chromeos/internet_detail_dialog_ui.h
@@ -0,0 +1,26 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_INTERNET_DETAIL_DIALOG_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_INTERNET_DETAIL_DIALOG_UI_H_ + +#include "base/macros.h" +#include "ui/web_dialogs/web_dialog_ui.h" + +namespace chromeos { + +// A WebUI to host a subset of the network details page to allow setting of +// proxy, IP address, and nameservers in the login screen. +class InternetDetailDialogUI : public ui::WebDialogUI { + public: + explicit InternetDetailDialogUI(content::WebUI* web_ui); + ~InternetDetailDialogUI() override; + + private: + DISALLOW_COPY_AND_ASSIGN(InternetDetailDialogUI); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_INTERNET_DETAIL_DIALOG_UI_H_
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index 83f882e..ccc63b7 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -611,7 +611,8 @@ break; default: DLOG(WARNING) << "Unhandled error code: " << error; - LoadAuthExtension(true, false /* offline */); + CallJS("invalidateAd", username, + static_cast<int>(ActiveDirectoryErrorState::NONE)); core_oobe_view_->ShowSignInError( 0, l10n_util::GetStringUTF8(IDS_AD_AUTH_UNKNOWN_ERROR), std::string(), HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT);
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc index 27e7b3a8..002553f 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -151,7 +151,7 @@ } void NetworkDropdown::OpenButtonOptions() { - LoginDisplayHost::default_host()->OpenProxySettings(""); + LoginDisplayHost::default_host()->OpenInternetDetailDialog(""); } bool NetworkDropdown::ShouldOpenButtonOptions() const {
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc index d1c5b7a20..70f3982 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc
@@ -24,7 +24,7 @@ const char kJsApiNetworkDropdownShow[] = "networkDropdownShow"; const char kJsApiNetworkDropdownHide[] = "networkDropdownHide"; const char kJsApiNetworkDropdownRefresh[] = "networkDropdownRefresh"; -const char kJsApiLaunchProxySettingsDialog[] = "launchProxySettingsDialog"; +const char kJsApiLaunchInternetDetailDialog[] = "launchInternetDetailDialog"; const char kJsApiLaunchAddWiFiNetworkDialog[] = "launchAddWiFiNetworkDialog"; const char kJsApiShowNetworkDetails[] = "showNetworkDetails"; @@ -68,17 +68,17 @@ &NetworkDropdownHandler::HandleNetworkDropdownRefresh); // MD-OOBE - AddCallback(kJsApiLaunchProxySettingsDialog, - &NetworkDropdownHandler::HandleLaunchProxySettingsDialog); + AddCallback(kJsApiLaunchInternetDetailDialog, + &NetworkDropdownHandler::HandleLaunchInternetDetailDialog); AddCallback(kJsApiLaunchAddWiFiNetworkDialog, &NetworkDropdownHandler::HandleLaunchAddWiFiNetworkDialog); AddRawCallback(kJsApiShowNetworkDetails, &NetworkDropdownHandler::HandleShowNetworkDetails); } -void NetworkDropdownHandler::HandleLaunchProxySettingsDialog() { +void NetworkDropdownHandler::HandleLaunchInternetDetailDialog() { // Empty string opens the internet detail dialog for the default network. - LoginDisplayHost::default_host()->OpenProxySettings(""); + LoginDisplayHost::default_host()->OpenInternetDetailDialog(""); } void NetworkDropdownHandler::HandleLaunchAddWiFiNetworkDialog() { @@ -96,8 +96,7 @@ const base::ListValue* args) { std::string guid; args->GetString(0, &guid); - // OpenProxySettings shows the internet detail dialog for the network. - LoginDisplayHost::default_host()->OpenProxySettings(guid); + LoginDisplayHost::default_host()->OpenInternetDetailDialog(guid); } void NetworkDropdownHandler::OnConnectToNetworkRequested() {
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h index e7dc2d10..2bb1c14 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h
@@ -52,7 +52,7 @@ // Handles network drop-down refresh. void HandleNetworkDropdownRefresh(); - void HandleLaunchProxySettingsDialog(); + void HandleLaunchInternetDetailDialog(); void HandleLaunchAddWiFiNetworkDialog(); void HandleShowNetworkDetails(const base::ListValue* args);
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 336ebe8f..56a4fa8 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -497,8 +497,8 @@ &SigninScreenHandler::HandleAccountPickerReady); AddCallback("wallpaperReady", &SigninScreenHandler::HandleWallpaperReady); AddCallback("signOutUser", &SigninScreenHandler::HandleSignOutUser); - AddCallback("openProxySettings", - &SigninScreenHandler::HandleOpenProxySettings); + AddCallback("openInternetDetailDialog", + &SigninScreenHandler::HandleOpenInternetDetailDialog); AddCallback("loginVisible", &SigninScreenHandler::HandleLoginVisible); AddCallback("cancelPasswordChangedFlow", &SigninScreenHandler::HandleCancelPasswordChangedFlow); @@ -1319,8 +1319,8 @@ delegate_->Signout(); } -void SigninScreenHandler::HandleOpenProxySettings() { - LoginDisplayHost::default_host()->OpenProxySettings(""); +void SigninScreenHandler::HandleOpenInternetDetailDialog() { + LoginDisplayHost::default_host()->OpenInternetDetailDialog(""); } void SigninScreenHandler::HandleLoginVisible(const std::string& source) {
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h index 702d826..c2ba294 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -402,7 +402,7 @@ void HandleAccountPickerReady(); void HandleWallpaperReady(); void HandleSignOutUser(); - void HandleOpenProxySettings(); + void HandleOpenInternetDetailDialog(); void HandleLoginVisible(const std::string& source); void HandleCancelPasswordChangedFlow(const AccountId& account_id); void HandleCancelUserAdding();
diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h deleted file mode 100644 index f0f23a8..0000000 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_PROXY_SETTINGS_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_PROXY_SETTINGS_UI_H_ - -#include "base/macros.h" -#include "ui/web_dialogs/web_dialog_ui.h" - -namespace chromeos { - -// A WebUI to host a subset of the network details page to allow setting of -// proxy, IP address, and nameservers in the login screen. (Historically the -// dialog only contained proxy settings). -class ProxySettingsUI : public ui::WebDialogUI { - public: - explicit ProxySettingsUI(content::WebUI* web_ui); - ~ProxySettingsUI() override; - - private: - DISALLOW_COPY_AND_ASSIGN(ProxySettingsUI); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_PROXY_SETTINGS_UI_H_
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc index de42e4e..5cc148a 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" +#include "components/viz/common/switches.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" @@ -105,6 +106,14 @@ } }; +class ConstrainedWebDialogSurfaceSynchronizationBrowserTest + : public ConstrainedWebDialogBrowserTest { + public: + void SetUpCommandLine(base::CommandLine* command_line) override { + command_line->AppendSwitch(switches::kEnableSurfaceSynchronization); + } +}; + // Tests that opening/closing the constrained window won't crash it. IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, BasicTest) { // The delegate deletes itself. @@ -167,7 +176,7 @@ ASSERT_TRUE(web_contents); // Observes the next created WebContents. - content::TestNavigationObserver observer(NULL); + content::TestNavigationObserver observer(nullptr); observer.StartWatchingNewWebContents(); gfx::Size min_size = gfx::Size(100, 100); @@ -234,6 +243,82 @@ dialog_delegate))); } +// This test is equivalent to +// ConstrainedWebDialogBrowserTest.ContentResizeInAutoResizingDialog but +// has the surface synchronization flag turned on. Once surface synchronization +// is on by default, this test can be deleted. +// TODO(fsamuel): Fix tis for Mac too. +#if defined(USE_AURA) +IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogSurfaceSynchronizationBrowserTest, + ContentResizeInAutoResizingDialog) { + // During auto-resizing, dialogs size to (WebContents size) + 16. + const int dialog_border_space = 16; + + // Expected dialog sizes after auto-resizing. + const int initial_size = 150 + dialog_border_space; + const int new_size = 175 + dialog_border_space; + + // The delegate deletes itself. + WebDialogDelegate* delegate = + new AutoResizingTestWebDialogDelegate(GURL(kTestDataURL)); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + + // Observes the next created WebContents. + content::TestNavigationObserver observer(nullptr); + observer.StartWatchingNewWebContents(); + + gfx::Size min_size = gfx::Size(100, 100); + gfx::Size max_size = gfx::Size(200, 200); + gfx::Size initial_dialog_size; + + delegate->GetDialogSize(&initial_dialog_size); + + ConstrainedWebDialogDelegate* dialog_delegate = + ShowConstrainedWebDialogWithAutoResize(browser()->profile(), delegate, + web_contents, min_size, max_size); + ASSERT_TRUE(dialog_delegate); + EXPECT_TRUE(dialog_delegate->GetNativeDialog()); + ASSERT_FALSE(IsShowingWebContentsModalDialog(web_contents)); + EXPECT_EQ(min_size, dialog_delegate->GetConstrainedWebDialogMinimumSize()); + EXPECT_EQ(max_size, dialog_delegate->GetConstrainedWebDialogMaximumSize()); + + // Check for initial sizing. Dialog was created as a 400x400 dialog. + ASSERT_EQ(initial_dialog_size, + dialog_delegate->GetConstrainedWebDialogPreferredSize()); + + observer.Wait(); + + // Wait until the entire WebContents has loaded. + WaitForLoadStop(dialog_delegate->GetWebContents()); + + ASSERT_TRUE(IsShowingWebContentsModalDialog(web_contents)); + + // Resize to content's originally set dimensions. + ASSERT_TRUE(RunLoopUntil(base::Bind( + &IsEqualSizes, gfx::Size(initial_size, initial_size), dialog_delegate))); + + // Resize to dimensions within expected bounds. + EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), + GetChangeDimensionsScript(175))); + ASSERT_TRUE(RunLoopUntil(base::Bind( + &IsEqualSizes, gfx::Size(new_size, new_size), dialog_delegate))); + + // Resize to dimensions smaller than the minimum bounds. + EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), + GetChangeDimensionsScript(50))); + ASSERT_TRUE( + RunLoopUntil(base::Bind(&IsEqualSizes, min_size, dialog_delegate))); + + // Resize to dimensions greater than the maximum bounds. + EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), + GetChangeDimensionsScript(250))); + ASSERT_TRUE( + RunLoopUntil(base::Bind(&IsEqualSizes, max_size, dialog_delegate))); +} +#endif // USE_AURA + // Tests that dialog does not autoresize when autoresizing is not enabled. IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, ContentResizeInNonAutoResizingDialog) {
diff --git a/chrome/browser/ui/webui/signin/signin_dice_internals_handler.cc b/chrome/browser/ui/webui/signin/signin_dice_internals_handler.cc index f5534d09..c8868e9a 100644 --- a/chrome/browser/ui/webui/signin/signin_dice_internals_handler.cc +++ b/chrome/browser/ui/webui/signin/signin_dice_internals_handler.cc
@@ -7,11 +7,16 @@ #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/account_tracker_service_factory.h" +#include "chrome/browser/signin/dice_tab_helper.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" +#include "chrome/browser/ui/singleton_tabs.h" #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "google_apis/gaia/gaia_urls.h" SigninDiceInternalsHandler::SigninDiceInternalsHandler(Profile* profile) : profile_(profile) { @@ -43,7 +48,7 @@ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); std::vector<std::string> account_ids = token_service->GetAccounts(); if (account_ids.empty()) { - VLOG(1) << "[Dice] No accounts available in the token service"; + StartWebGaiaSigninAndStartSyncWhenDone(); return; } @@ -73,3 +78,14 @@ signin_manager->SignOut(signin_metrics::USER_TUNED_OFF_SYNC_FROM_DICE_UI, signin_metrics::SignoutDelete::IGNORE_METRIC); } + +void SigninDiceInternalsHandler::StartWebGaiaSigninAndStartSyncWhenDone() { + chrome::ScopedTabbedBrowserDisplayer displayer(profile_); + chrome::ShowSingletonTab(displayer.browser(), + GaiaUrls::GetInstance()->add_account_url()); + content::WebContents* active_contents = + displayer.browser()->tab_strip_model()->GetActiveWebContents(); + DCHECK_EQ(GaiaUrls::GetInstance()->add_account_url(), + active_contents->GetVisibleURL()); + DiceTabHelper::CreateForWebContents(active_contents); +}
diff --git a/chrome/browser/ui/webui/signin/signin_dice_internals_handler.h b/chrome/browser/ui/webui/signin/signin_dice_internals_handler.h index 7a1166b7..84513ef 100644 --- a/chrome/browser/ui/webui/signin/signin_dice_internals_handler.h +++ b/chrome/browser/ui/webui/signin/signin_dice_internals_handler.h
@@ -28,6 +28,10 @@ // Handler for disable sync event. void HandleDisableSync(const base::ListValue* args); + // Start a Gaia web-sign in and once done automatically start syncing with the + // account that was signed in. + void StartWebGaiaSigninAndStartSyncWhenDone(); + Profile* profile_; DISALLOW_COPY_AND_ASSIGN(SigninDiceInternalsHandler);
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc index eaf3940..1ab54cd6 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc
@@ -75,20 +75,9 @@ } // namespace -#if !defined(OS_CHROMEOS) -#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay \ - DISABLED_OpenBrowserUsingShelfOnOtherDisplay -#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay \ - DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay -#else -#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay \ - OpenBrowserUsingShelfOnOtherDisplay -#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay \ - OpenBrowserUsingContextMenuOnOtherDisplay -#endif - +// Disabled due to flaky failures on ChromeOS: https://crbug.com/770138 IN_PROC_BROWSER_TEST_F(WindowSizerTest, - MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { + DISABLED_OpenBrowserUsingShelfOnOtherDisplay) { // Don't shutdown when closing the last browser window. ScopedKeepAlive test_keep_alive(KeepAliveOrigin::BROWSER_PROCESS_CHROMEOS, KeepAliveRestartOption::DISABLED); @@ -172,8 +161,9 @@ } // namespace +// Disabled due to flaky failures on ChromeOS: https://crbug.com/770138 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, - MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { + DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay) { // Don't shutdown when closing the last browser window. ScopedKeepAlive test_keep_alive(KeepAliveOrigin::BROWSER_PROCESS_CHROMEOS, KeepAliveRestartOption::DISABLED);
diff --git a/chrome/browser/vr/elements/ui_texture.cc b/chrome/browser/vr/elements/ui_texture.cc index e34fb11..7cf466e 100644 --- a/chrome/browser/vr/elements/ui_texture.cc +++ b/chrome/browser/vr/elements/ui_texture.cc
@@ -89,8 +89,8 @@ int height = 0; int line_height = 0; for (size_t i = 0; i < strings.size(); i++) { - std::unique_ptr<gfx::RenderText> render_text = - CreateRenderText(strings[i], font_list, color, text_alignment); + std::unique_ptr<gfx::RenderText> render_text = CreateConfiguredRenderText( + strings[i], font_list, color, text_alignment); if (i == 0) { // Measure line and center text vertically. @@ -114,7 +114,7 @@ } else { std::unique_ptr<gfx::RenderText> render_text = - CreateRenderText(text, font_list, color, text_alignment); + CreateConfiguredRenderText(text, font_list, color, text_alignment); if (bounds->width() != 0) render_text->SetElideBehavior(gfx::TRUNCATE); else @@ -134,13 +134,22 @@ return lines; } -std::unique_ptr<gfx::RenderText> UiTexture::CreateRenderText( +std::unique_ptr<gfx::RenderText> UiTexture::CreateRenderText() { + std::unique_ptr<gfx::RenderText> render_text( + gfx::RenderText::CreateInstance()); + + // Subpixel rendering is counterproductive when drawing VR textures. + render_text->set_subpixel_rendering_suppressed(true); + + return render_text; +} + +std::unique_ptr<gfx::RenderText> UiTexture::CreateConfiguredRenderText( const base::string16& text, const gfx::FontList& font_list, SkColor color, UiTexture::TextAlignment text_alignment) { - std::unique_ptr<gfx::RenderText> render_text( - gfx::RenderText::CreateInstance()); + std::unique_ptr<gfx::RenderText> render_text(CreateRenderText()); render_text->SetText(text); render_text->SetFontList(font_list); render_text->SetColor(color);
diff --git a/chrome/browser/vr/elements/ui_texture.h b/chrome/browser/vr/elements/ui_texture.h index 85504d06..53ab160 100644 --- a/chrome/browser/vr/elements/ui_texture.h +++ b/chrome/browser/vr/elements/ui_texture.h
@@ -81,7 +81,9 @@ TextAlignment text_alignment, WrappingBehavior wrapping_behavior); - static std::unique_ptr<gfx::RenderText> CreateRenderText( + static std::unique_ptr<gfx::RenderText> CreateRenderText(); + + static std::unique_ptr<gfx::RenderText> CreateConfiguredRenderText( const base::string16& text, const gfx::FontList& font_list, SkColor color,
diff --git a/chrome/browser/vr/elements/url_bar_texture.cc b/chrome/browser/vr/elements/url_bar_texture.cc index 35c817f..001d139 100644 --- a/chrome/browser/vr/elements/url_bar_texture.cc +++ b/chrome/browser/vr/elements/url_bar_texture.cc
@@ -249,8 +249,7 @@ if (!GetFontList(pixel_font_height, chip_text, &font_list)) failure_callback_.Run(UiUnsupportedMode::kUnhandledCodePoint); - std::unique_ptr<gfx::RenderText> render_text( - gfx::RenderText::CreateInstance()); + std::unique_ptr<gfx::RenderText> render_text(CreateRenderText()); render_text->SetFontList(font_list); render_text->SetColor(chip_color); render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT); @@ -312,8 +311,7 @@ if (!GetFontList(pixel_font_height, text, &font_list)) failure_callback_.Run(UiUnsupportedMode::kUnhandledCodePoint); - std::unique_ptr<gfx::RenderText> render_text( - gfx::RenderText::CreateInstance()); + std::unique_ptr<gfx::RenderText> render_text(CreateRenderText()); render_text->SetFontList(font_list); render_text->SetColor(SK_ColorBLACK); render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
diff --git a/chrome/browser/vr/elements/webvr_url_toast_texture.cc b/chrome/browser/vr/elements/webvr_url_toast_texture.cc index 6fd7b15..f2eaa52 100644 --- a/chrome/browser/vr/elements/webvr_url_toast_texture.cc +++ b/chrome/browser/vr/elements/webvr_url_toast_texture.cc
@@ -96,10 +96,6 @@ void WebVrUrlToastTexture::RenderUrl(const gfx::Size& texture_size, const gfx::Rect& text_bounds) { - std::unique_ptr<gfx::RenderText> render_text( - gfx::RenderText::CreateInstance()); - render_text->SetDisplayRect(text_bounds); - int pixel_font_height = texture_size.height() * kFontHeight / kHeight; url::Parsed parsed; @@ -123,6 +119,8 @@ if (!UiTexture::GetFontList(pixel_font_height, formatted_url, &font_list)) failure_callback_.Run(UiUnsupportedMode::kUnhandledCodePoint); + std::unique_ptr<gfx::RenderText> render_text(CreateRenderText()); + render_text->SetDisplayRect(text_bounds); render_text->SetFontList(font_list); render_text->SetColor(color_scheme().transient_warning_foreground); render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
diff --git a/chrome/browser/vr/testapp/vr_test_context.cc b/chrome/browser/vr/testapp/vr_test_context.cc index 2f5d8a9b..d359f36 100644 --- a/chrome/browser/vr/testapp/vr_test_context.cc +++ b/chrome/browser/vr/testapp/vr_test_context.cc
@@ -6,6 +6,7 @@ #include "base/i18n/icu_util.h" #include "base/memory/ptr_util.h" +#include "base/numerics/ranges.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/vr/toolbar_state.h" @@ -28,16 +29,24 @@ namespace { -constexpr float kDefaultViewScale = 1.4f; -constexpr float kMousePaneWidth = 5.0f; -constexpr float kMousePaneDepth = 2.0f; +// Constants related to scaling of the UI for zooming, to let us look at +// elements up close. The adjustment factor determines how much the zoom changes +// at each adjustment step. +constexpr float kDefaultViewScaleFactor = 1.2f; +constexpr float kMinViewScaleFactor = 0.5f; +constexpr float kMaxViewScaleFactor = 5.0f; +constexpr float kViewScaleAdjustmentFactor = 0.2f; + +constexpr gfx::Point3F kLaserOrigin = {0.5f, -0.5f, 0.f}; } // namespace VrTestContext::VrTestContext() : ui_(base::MakeUnique<Ui>(this, this, UiInitialState())), - controller_info_(base::MakeUnique<ControllerInfo>()) { + controller_info_(base::MakeUnique<ControllerInfo>()), + view_scale_factor_(kDefaultViewScaleFactor) { controller_info_->reticle_render_target = nullptr; + controller_info_->laser_origin = kLaserOrigin; base::FilePath pak_path; PathService::Get(base::DIR_MODULE, &pak_path); @@ -66,20 +75,19 @@ void VrTestContext::DrawFrame() { base::TimeTicks current_time = base::TimeTicks::Now(); - const gfx::Transform proj_matrix(kDefaultViewScale, 0, 0, 0, 0, - kDefaultViewScale, 0, 0, 0, 0, -1, 0, 0, 0, + const gfx::Transform proj_matrix(view_scale_factor_, 0, 0, 0, 0, + view_scale_factor_, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0); - const gfx::Transform head_pose; RenderInfo render_info; - render_info.head_pose = head_pose; + render_info.head_pose = head_pose_; render_info.surface_texture_size = window_size_; render_info.left_eye_info.viewport = gfx::Rect(window_size_); - render_info.left_eye_info.view_matrix = head_pose; + render_info.left_eye_info.view_matrix = head_pose_; render_info.left_eye_info.proj_matrix = proj_matrix; - render_info.left_eye_info.view_proj_matrix = proj_matrix * head_pose; + render_info.left_eye_info.view_proj_matrix = proj_matrix * head_pose_; // Update the render position of all UI elements (including desktop). - ui_->scene()->OnBeginFrame(current_time, gfx::Vector3dF(0.f, 0.f, -1.0f)); + ui_->scene()->OnBeginFrame(current_time, gfx::Vector3dF(0.f, 0.f, -1.f)); ui_->scene()->PrepareToDraw(); ui_->OnProjMatrixChanged(render_info.left_eye_info.proj_matrix); ui_->ui_renderer()->Draw(render_info, *controller_info_); @@ -89,10 +97,36 @@ void VrTestContext::HandleInput(ui::Event* event) { if (event->IsKeyEvent()) { - const ui::KeyEvent* key_event = event->AsKeyEvent(); - if (key_event->code() == ui::DomCode::US_F) { - ui_->SetFullscreen(true); + if (event->type() != ui::ET_KEY_PRESSED) { + return; } + switch (event->AsKeyEvent()->code()) { + case ui::DomCode::ESCAPE: + view_scale_factor_ = kDefaultViewScaleFactor; + head_angle_x_degrees_ = 0; + head_angle_y_degrees_ = 0; + head_pose_ = gfx::Transform(); + break; + case ui::DomCode::US_F: + fullscreen_ = !fullscreen_; + ui_->SetFullscreen(fullscreen_); + break; + case ui::DomCode::US_I: + incognito_ = !incognito_; + ui_->SetIncognito(incognito_); + break; + default: + break; + } + return; + } + + if (event->IsMouseWheelEvent()) { + int direction = + base::ClampToRange(event->AsMouseWheelEvent()->y_offset(), -1, 1); + view_scale_factor_ *= (1 + direction * kViewScaleAdjustmentFactor); + view_scale_factor_ = base::ClampToRange( + view_scale_factor_, kMinViewScaleFactor, kMaxViewScaleFactor); return; } @@ -100,17 +134,42 @@ return; } - // Synthesize a controller direction based on mouse position in the window. const ui::MouseEvent* mouse_event = event->AsMouseEvent(); - gfx::Point3F laser_origin{0.5, -0.5, 0}; - gfx::Point3F target_point = { - kMousePaneWidth * (mouse_event->x() / window_size_.width() - 0.5), - kMousePaneWidth * window_size_.height() / window_size_.width() * - (-mouse_event->y() / window_size_.height() + 0.5), - -kMousePaneDepth}; - gfx::Vector3dF controller_direction = target_point - laser_origin; - controller_info_->laser_origin = laser_origin; - controller_info_->reticle_render_target = nullptr; + + // Move the head pose if needed. + if (mouse_event->IsRightMouseButton()) { + if (last_drag_x_pixels_ != 0 || last_drag_y_pixels_ != 0) { + float angle_y = 180.f * + ((mouse_event->x() - last_drag_x_pixels_) - 0.5f) / + window_size_.width(); + float angle_x = 180.f * + ((mouse_event->y() - last_drag_y_pixels_) - 0.5f) / + window_size_.height(); + head_angle_x_degrees_ += angle_x; + head_angle_y_degrees_ += angle_y; + head_angle_x_degrees_ = + base::ClampToRange(head_angle_x_degrees_, -90.f, 90.f); + } + last_drag_x_pixels_ = mouse_event->x(); + last_drag_y_pixels_ = mouse_event->y(); + } else { + last_drag_x_pixels_ = 0; + last_drag_y_pixels_ = 0; + } + + head_pose_ = gfx::Transform(); + head_pose_.RotateAboutXAxis(-head_angle_x_degrees_); + head_pose_.RotateAboutYAxis(-head_angle_y_degrees_); + + // Determine a controller beam angle. Compute the beam angle relative to the + // head pose so it's easier to hit something you're looking at. + float delta_x = -180.f * ((mouse_event->y() / window_size_.height()) - 0.5f); + float delta_y = -180.f * ((mouse_event->x() / window_size_.width()) - 0.5f); + gfx::Transform beam_transform; + beam_transform.RotateAboutYAxis(head_angle_y_degrees_ + delta_y); + beam_transform.RotateAboutXAxis(head_angle_x_degrees_ + delta_x); + gfx::Vector3dF controller_direction = {0, 0, -1.f}; + beam_transform.TransformVector(&controller_direction); GestureList gesture_list; ui_->input_manager()->HandleInput(
diff --git a/chrome/browser/vr/testapp/vr_test_context.h b/chrome/browser/vr/testapp/vr_test_context.h index 93fd2fe..598981e 100644 --- a/chrome/browser/vr/testapp/vr_test_context.h +++ b/chrome/browser/vr/testapp/vr_test_context.h
@@ -11,6 +11,7 @@ #include "chrome/browser/vr/content_input_delegate.h" #include "chrome/browser/vr/ui_browser_interface.h" +#include "ui/gfx/transform.h" namespace ui { class Event; @@ -66,6 +67,17 @@ std::unique_ptr<ControllerInfo> controller_info_; + gfx::Transform head_pose_; + float head_angle_x_degrees_ = 0; + float head_angle_y_degrees_ = 0; + int last_drag_x_pixels_ = 0; + int last_drag_y_pixels_ = 0; + + float view_scale_factor_ = 1.f; + + bool fullscreen_ = false; + bool incognito_ = false; + DISALLOW_COPY_AND_ASSIGN(VrTestContext); };
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 82f3aa08a..75242d3 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -551,40 +551,26 @@ // same directory as the installed adapter. const base::Version version(WIDEVINE_CDM_VERSION_STRING); DCHECK(version.IsValid()); - cdms->push_back(content::CdmInfo(kWidevineCdmType, kWidevineCdmGuid, - version, cdm_path, codecs_supported, - kWidevineKeySystem, false)); + cdms->push_back(content::CdmInfo(kWidevineCdmType, version, cdm_path, + codecs_supported, kWidevineKeySystem, + false)); } #endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) #if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Register Clear Key CDM if specified in command line. base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - base::FilePath clear_key_cdm_path = - command_line->GetSwitchValuePath(switches::kClearKeyCdmPathForTesting); + std::string clear_key_cdm_path = + command_line->GetSwitchValueASCII(switches::kClearKeyCdmPathForTesting); if (!clear_key_cdm_path.empty()) { - // TODO(crbug.com/764480): Remove these after we have a central place for + // TODO(crbug.com/764480): Remove this after we have a central place for // External Clear Key (ECK) related information. - // Normal External Clear Key key system. const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; - // A variant of ECK key system that has a different GUID. - const char kExternalClearKeyDifferentGuidTestKeySystem[] = - "org.chromium.externalclearkey.differentguid"; - - // Register kExternalClearKeyDifferentGuidTestKeySystem first separately. - // Otherwise, it'll be treated as a sub-key-system of normal - // kExternalClearKeyKeySystem. See MultipleCdmTypes test in - // ECKEncryptedMediaTest. - cdms->push_back(content::CdmInfo( - media::kClearKeyCdmType, media::kClearKeyCdmDifferentGuid, - base::Version("0.1.0.0"), clear_key_cdm_path, {}, - kExternalClearKeyDifferentGuidTestKeySystem, false)); - // Supported codecs are hard-coded in ExternalClearKeyProperties. cdms->push_back( - content::CdmInfo(media::kClearKeyCdmType, media::kClearKeyCdmGuid, - base::Version("0.1.0.0"), clear_key_cdm_path, {}, - kExternalClearKeyKeySystem, true)); + content::CdmInfo(media::kClearKeyCdmType, base::Version("0.1.0.0"), + base::FilePath::FromUTF8Unsafe(clear_key_cdm_path), + {}, kExternalClearKeyKeySystem, true)); } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) }
diff --git a/chrome/common/search/ntp_logging_events.h b/chrome/common/search/ntp_logging_events.h index 4552011..0a48154d 100644 --- a/chrome/common/search/ntp_logging_events.h +++ b/chrome/common/search/ntp_logging_events.h
@@ -8,7 +8,8 @@ // The different types of events that are logged from the NTP. This enum is used // to transfer information from the NTP javascript to the renderer and is *not* // used as a UMA enum histogram's logged value. -// Note: Keep in sync with browser/resources/local_ntp/most_visited_single.js +// Note: Keep in sync with browser/resources/local_ntp/local_ntp.js, voice.js, +// and most_visited_single.js. enum NTPLoggingEventType { // Deleted: NTP_SERVER_SIDE_SUGGESTION = 0, // Deleted: NTP_CLIENT_SIDE_SUGGESTION = 1, @@ -29,9 +30,8 @@ // The data for all NTP tiles (title, URL, etc, but not the thumbnail image) // has been received by the most visited iframe. In contrast to // NTP_ALL_TILES_LOADED, this is recorded before the actual DOM elements have - // loaded (in particular the thumbnail images). Logged by the single-iframe - // version of the NTP, and also by the multi-iframe version, but only as a - // workaround for crbug.com/698675. + // loaded (in particular the thumbnail images). Logged only by the + // single-iframe version of the NTP. NTP_ALL_TILES_RECEIVED = 12, // Activated by clicking on the fakebox icon. Logged by Voice Search. @@ -60,7 +60,23 @@ NTP_VOICE_ERROR_NO_MATCH = 28, NTP_VOICE_ERROR_OTHER = 29, - NTP_EVENT_TYPE_LAST = NTP_VOICE_ERROR_OTHER + // A static Doodle was shown, coming from cache. + NTP_STATIC_LOGO_SHOWN_FROM_CACHE = 30, + // A static Doodle was shown, coming from the network. + NTP_STATIC_LOGO_SHOWN_FRESH = 31, + // A call-to-action Doodle image was shown, coming from cache. + NTP_CTA_LOGO_SHOWN_FROM_CACHE = 32, + // A call-to-action Doodle image was shown, coming from the network. + NTP_CTA_LOGO_SHOWN_FRESH = 33, + + // A static Doodle was clicked. + NTP_STATIC_LOGO_CLICKED = 34, + // A call-to-action Doodle was clicked. + NTP_CTA_LOGO_CLICKED = 35, + // An animated Doodle was clicked. + NTP_ANIMATED_LOGO_CLICKED = 36, + + NTP_EVENT_TYPE_LAST = NTP_ANIMATED_LOGO_CLICKED }; #endif // CHROME_COMMON_SEARCH_NTP_LOGGING_EVENTS_H_
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 949dd94..5a71d39 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -129,7 +129,8 @@ const char kChromeUIMobileSetupURL[] = "chrome://mobilesetup/"; const char kChromeUIOobeURL[] = "chrome://oobe/"; const char kChromeUIOSCreditsURL[] = "chrome://os-credits/"; -const char kChromeUIProxySettingsURL[] = "chrome://proxy-settings/"; +const char kChromeUIIntenetDetailDialogURL[] = + "chrome://internet-detail-dialog/"; const char kChromeUIScreenlockIconURL[] = "chrome://screenlock-icon/"; const char kChromeUISetTimeURL[] = "chrome://set-time/"; const char kChromeUISimUnlockURL[] = "chrome://sim-unlock/"; @@ -315,7 +316,7 @@ const char kChromeUIOobeHost[] = "oobe"; const char kChromeUIOSCreditsHost[] = "os-credits"; const char kChromeUIPowerHost[] = "power"; -const char kChromeUIProxySettingsHost[] = "proxy-settings"; +const char kChromeUIInternetDetailDialogHost[] = "internet-detail-dialog"; const char kChromeUIRotateHost[] = "rotate"; const char kChromeUIScreenlockIconHost[] = "screenlock-icon"; const char kChromeUISetTimeHost[] = "set-time"; @@ -732,7 +733,7 @@ kChromeUIOobeHost, kChromeUIOSCreditsHost, kChromeUIPowerHost, - kChromeUIProxySettingsHost, + kChromeUIInternetDetailDialogHost, kChromeUIVoiceSearchHost, #endif #if defined(OS_WIN) || defined(OS_CHROMEOS)
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index cc30c1d..325769c 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -119,7 +119,7 @@ extern const char kChromeUIMobileSetupURL[]; extern const char kChromeUIOobeURL[]; extern const char kChromeUIOSCreditsURL[]; -extern const char kChromeUIProxySettingsURL[]; +extern const char kChromeUIIntenetDetailDialogURL[]; extern const char kChromeUIScreenlockIconURL[]; extern const char kChromeUISetTimeURL[]; extern const char kChromeUISimUnlockURL[]; @@ -299,7 +299,7 @@ extern const char kChromeUIOobeHost[]; extern const char kChromeUIOSCreditsHost[]; extern const char kChromeUIPowerHost[]; -extern const char kChromeUIProxySettingsHost[]; +extern const char kChromeUIInternetDetailDialogHost[]; extern const char kChromeUIRotateHost[]; extern const char kChromeUIScreenlockIconHost[]; extern const char kChromeUISetTimeHost[];
diff --git a/chrome/renderer/autofill/page_passwords_analyser_browsertest.cc b/chrome/renderer/autofill/page_passwords_analyser_browsertest.cc new file mode 100644 index 0000000..44c7dfb4 --- /dev/null +++ b/chrome/renderer/autofill/page_passwords_analyser_browsertest.cc
@@ -0,0 +1,204 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/autofill/content/renderer/page_passwords_analyser.h" + +#include "chrome/test/base/chrome_render_view_test.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/web/WebDocument.h" +#include "third_party/WebKit/public/web/WebElementCollection.h" +#include "third_party/WebKit/public/web/WebFormElement.h" + +namespace autofill { + +namespace { + +class MockPagePasswordsAnalyserLogger : public PagePasswordsAnalyserLogger { + public: + void Send(const std::string& message, + ConsoleLevel level, + const blink::WebNode& node) override { + Send(message, level, std::vector<blink::WebNode>{node}); + } + + MOCK_METHOD3(Send, + void(const std::string& message, + ConsoleLevel level, + const std::vector<blink::WebNode>& nodes)); + + MOCK_METHOD0(Flush, void()); +}; + +const char kPasswordFieldNotInForm[] = + "<input type='password' autocomplete='new-password'>"; + +const char kPasswordFormWithoutUsernameField[] = + "<form>" + " <input type='password' autocomplete='new-password'>" + "</form>"; + +const char kElementsWithDuplicateIds[] = + "<input id='duplicate'>" + "<input id='duplicate'>"; + +const char kPasswordFormTooComplex[] = + "<form>" + " <input type='text' autocomplete='username'>" + " <input type='password' autocomplete='current-password'>" + " <input type='text' autocomplete='username'>" + " <input type='password' autocomplete='current-password'>" + " <input type='password' autocomplete='new-password'>" + " <input type='password' autocomplete='new-password'>" + "</form>"; + +const char kInferredAutocompleteAttributes[] = + // Login form. + "<form>" + " <input type='text'>" + " <input type='password'>" + "</form>" + // Registration form. + "<form>" + " <input type='text'>" + " <input type='password'>" + " <input type='password'>" + "</form>" + // Change password form. + "<form>" + " <input type='text'>" + " <input type='password'>" + " <input type='password'>" + " <input type='password'>" + "</form>"; + +const std::string AutocompleteSuggestionString(const std::string& suggestion) { + return "Input elements should have autocomplete " + "attributes (suggested: \"" + + suggestion + "\"):"; +} + +} // namespace + +class PagePasswordsAnalyserTest : public ChromeRenderViewTest { + protected: + PagePasswordsAnalyserTest() {} + + void TearDown() override { + page_passwords_analyser.Reset(); + ChromeRenderViewTest::TearDown(); + } + + void LoadTestCase(const char* html) { + elements_.clear(); + LoadHTML(html); + blink::WebLocalFrame* frame = GetMainFrame(); + blink::WebElementCollection collection = frame->GetDocument().All(); + for (blink::WebElement element = collection.FirstItem(); !element.IsNull(); + element = collection.NextItem()) { + elements_.push_back(element); + } + // Remove the <html>, <head> and <body> elements. + elements_.erase(elements_.begin(), elements_.begin() + 3); + } + + void Expect(const std::string& message, + const ConsoleLevel level, + const std::vector<size_t>& element_indices) { + std::vector<blink::WebNode> nodes; + for (size_t index : element_indices) + nodes.push_back(elements_[index]); + EXPECT_CALL(mock_logger, Send(message, level, nodes)).RetiresOnSaturation(); + } + + void RunTestCase() { + EXPECT_CALL(mock_logger, Flush()); + page_passwords_analyser.AnalyseDocumentDOM(GetMainFrame(), &mock_logger); + } + + PagePasswordsAnalyser page_passwords_analyser; + MockPagePasswordsAnalyserLogger mock_logger; + + private: + DISALLOW_COPY_AND_ASSIGN(PagePasswordsAnalyserTest); + + std::vector<blink::WebElement> elements_; +}; + +TEST_F(PagePasswordsAnalyserTest, PasswordFieldNotInForm) { + LoadTestCase(kPasswordFieldNotInForm); + + Expect("Password field is not contained in a form:", + PagePasswordsAnalyserLogger::kVerbose, {0}); + + RunTestCase(); +} + +TEST_F(PagePasswordsAnalyserTest, PasswordFormWithoutUsernameField) { + LoadTestCase(kPasswordFormWithoutUsernameField); + + Expect( + "Password forms should have (optionally hidden) " + "username fields for accessibility:", + PagePasswordsAnalyserLogger::kVerbose, {0}); + + RunTestCase(); +} + +TEST_F(PagePasswordsAnalyserTest, ElementsWithDuplicateIds) { + LoadTestCase(kElementsWithDuplicateIds); + + Expect("Found 2 elements with non-unique id #duplicate:", + PagePasswordsAnalyserLogger::kError, {0, 1}); + + RunTestCase(); +} + +TEST_F(PagePasswordsAnalyserTest, PasswordFormTooComplex) { + LoadTestCase(kPasswordFormTooComplex); + + Expect( + "Multiple forms should be contained in their own " + "form elements; break up complex forms into ones that represent a " + "single action:", + PagePasswordsAnalyserLogger::kVerbose, {0}); + + RunTestCase(); +} + +TEST_F(PagePasswordsAnalyserTest, InferredAutocompleteAttributes) { + LoadTestCase(kInferredAutocompleteAttributes); + size_t element_index = 0; + + // Login form. + element_index++; + Expect(AutocompleteSuggestionString("username"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("current-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + + // Registration form. + element_index++; + Expect(AutocompleteSuggestionString("username"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("new-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("new-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + + // Change password form. + element_index++; + Expect(AutocompleteSuggestionString("username"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("current-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("new-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + Expect(AutocompleteSuggestionString("new-password"), + PagePasswordsAnalyserLogger::kVerbose, {element_index++}); + + RunTestCase(); +} + +} // namespace autofill
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc index 0c6eb3f..51f24da 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -84,8 +84,6 @@ "org.chromium.externalclearkey.verifycdmhosttest"; static const char kExternalClearKeyStorageIdTestKeySystem[] = "org.chromium.externalclearkey.storageidtest"; - static const char kExternalClearKeyDifferentGuidTestKeySystem[] = - "org.chromium.externalclearkey.differentguid"; std::vector<base::string16> additional_param_names; std::vector<base::string16> additional_param_values; @@ -135,10 +133,6 @@ // A key system that fetches the Storage ID in ClearKeyCdm. concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( kExternalClearKeyStorageIdTestKeySystem)); - - // A key system that is registered with a different CDM GUID. - concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( - kExternalClearKeyDifferentGuidTestKeySystem)); } #if defined(WIDEVINE_CDM_AVAILABLE)
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index c3c8f26..bbc9a41e 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -686,6 +686,7 @@ "../browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc", "../browser/chromeos/input_method/textinput_test_helper.cc", "../browser/chromeos/input_method/textinput_test_helper.h", + "../browser/chromeos/login/active_directory_login_browsertest.cc", "../browser/chromeos/login/eula_browsertest.cc", "../browser/chromeos/login/lock/screen_locker_browsertest.cc", "../browser/chromeos/login/lock/screen_locker_tester.cc", @@ -1579,6 +1580,7 @@ "../renderer/autofill/form_autofill_browsertest.cc", "../renderer/autofill/form_classifier_browsertest.cc", "../renderer/autofill/page_click_tracker_browsertest.cc", + "../renderer/autofill/page_passwords_analyser_browsertest.cc", "../renderer/autofill/password_autofill_agent_browsertest.cc", "../renderer/autofill/password_generation_agent_browsertest.cc", "../renderer/autofill/password_generation_test_utils.cc", @@ -2180,6 +2182,7 @@ "../browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc", "../browser/chromeos/arc/auth/arc_auth_service_browsertest.cc", "../browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc", + "../browser/chromeos/arc/enterprise/arc_cert_store_bridge_browsertest.cc", "../browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc", "../browser/chromeos/arc/user_session/arc_user_session_service_browsertest.cc", "../browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service_browsertest.cc", @@ -4422,7 +4425,6 @@ "../browser/safe_browsing/incident_reporting/resource_request_detector_unittest.cc", "../browser/safe_browsing/incident_reporting/state_store_unittest.cc", "../browser/safe_browsing/incident_reporting/tracked_preference_incident_unittest.cc", - "../browser/safe_browsing/incident_reporting/variations_seed_signature_incident_unittest.cc", "../browser/safe_browsing/local_database_manager_unittest.cc", "../browser/safe_browsing/local_two_phase_testserver.cc", "../browser/safe_browsing/local_two_phase_testserver.h",
diff --git a/chrome/test/data/android/popup_test.html b/chrome/test/data/android/popup_test.html index 626bcde..5b4025c 100644 --- a/chrome/test/data/android/popup_test.html +++ b/chrome/test/data/android/popup_test.html
@@ -5,11 +5,10 @@ function spawnWindows() { window.open('navigate/one.html'); window.open('navigate/two.html'); - window.open('navigate/three.html'); } </script> </head> <body onload="spawnWindows()"> - Spawning three popup windows... + Spawning two popup windows... </body> </html>
diff --git a/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers index d56f243..4c02f20 100644 --- a/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers
@@ -1,3 +1,3 @@ HTTP/1.1 200 OK -Accept-CH: dpr,viewport-width +Accept-CH: dpr,device-memory Accept-CH-Lifetime: 3600 \ No newline at end of file
diff --git a/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers index cb7bbcc..42ffdfff 100644 --- a/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers
@@ -1,2 +1,2 @@ HTTP/1.1 200 OK -Accept-CH: dpr,viewport-width \ No newline at end of file +Accept-CH: dpr,device-memory \ No newline at end of file
diff --git a/chrome/utility/mash_service_factory.cc b/chrome/utility/mash_service_factory.cc index 6cc1763..560d030 100644 --- a/chrome/utility/mash_service_factory.cc +++ b/chrome/utility/mash_service_factory.cc
@@ -72,9 +72,9 @@ void RegisterMashServices( content::ContentUtilityClient::StaticServiceMap* services) { RegisterMashService(services, ui::mojom::kServiceName, &CreateUiService); +#if defined(OS_CHROMEOS) RegisterMashService(services, mash::quick_launch::mojom::kServiceName, &CreateQuickLaunch); -#if defined(OS_CHROMEOS) RegisterMashService(services, ash::mojom::kServiceName, &CreateAshService); RegisterMashService(services, "accessibility_autoclick", &CreateAccessibilityAutoclick);
diff --git a/chrome_elf/BUILD.gn b/chrome_elf/BUILD.gn index 6d2491b3..1276a06a 100644 --- a/chrome_elf/BUILD.gn +++ b/chrome_elf/BUILD.gn
@@ -227,7 +227,6 @@ sources = [ "blacklist/test/blacklist_test.cc", "chrome_elf_util_unittest.cc", - "elf_imports_unittest.cc", "hook_util/test/hook_util_test.cc", "nt_registry/nt_registry_unittest.cc", "run_all_unittests.cc", @@ -244,7 +243,6 @@ ":security", "//base", "//base/test:test_support", - "//chrome", "//chrome/common:version_header", "//chrome/install_static:install_static_util", "//chrome/install_static/test:test_support", @@ -252,6 +250,28 @@ "//sandbox", "//testing/gtest", ] + data_deps = [ + ":blacklist_test_dll_1", + ":blacklist_test_dll_2", + ":blacklist_test_dll_3", + ":chrome_elf", + ] +} + +test("chrome_elf_import_unittests") { + output_name = "chrome_elf_import_unittests" + sources = [ + "elf_imports_unittest.cc", + ] + include_dirs = [ "$target_gen_dir" ] + deps = [ + "//base", + "//base/test:test_support", + "//chrome", + "//chrome/install_static:install_static_util", + "//chrome/install_static/test:test_support", + "//testing/gtest", + ] # It's not easily possible to have //chrome in data_deps without changing # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. @@ -261,9 +281,6 @@ "$root_out_dir/chrome.exe", ] data_deps = [ - ":blacklist_test_dll_1", - ":blacklist_test_dll_2", - ":blacklist_test_dll_3", ":chrome_elf", ]
diff --git a/chrome_elf/elf_imports_unittest.cc b/chrome_elf/elf_imports_unittest.cc index 96e078c..dfcb9b9 100644 --- a/chrome_elf/elf_imports_unittest.cc +++ b/chrome_elf/elf_imports_unittest.cc
@@ -9,6 +9,7 @@ #include <vector> #include "base/base_paths.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" @@ -17,7 +18,11 @@ #include "base/strings/pattern.h" #include "base/strings/string_util.h" #include "base/test/launcher/test_launcher.h" +#include "base/test/launcher/unit_test_launcher.h" +#include "base/test/test_suite.h" #include "base/win/pe_image.h" +#include "build/build_config.h" +#include "chrome/install_static/test/scoped_install_details.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -75,8 +80,9 @@ GetImports(dll, &elf_imports); // Check that ELF has imports. - ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests " - "target was built, instead of chrome_elf_unittests.exe"; + ASSERT_LT(0u, elf_imports.size()) + << "Ensure the chrome_elf_import_unittests " + "target was built, instead of chrome_elf_import_unittests.exe"; static const char* const kValidFilePatterns[] = { "KERNEL32.dll", @@ -141,9 +147,9 @@ ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dll)); dll = dll.Append(L"chrome_elf.dll"); - // We don't expect user32 to be loaded in chrome_elf_unittests. If this test - // case fails, then it means that a dependency on user32 has crept into the - // chrome_elf_unittests executable, which needs to be removed. + // We don't expect user32 to be loaded in chrome_elf_import_unittests. If this + // test case fails, then it means that a dependency on user32 has crept into + // the chrome_elf_imports_unittests executable, which needs to be removed. // NOTE: it may be a secondary dependency of another system DLL. If so, // try adding a "/DELAYLOAD:<blah>.dll" to the build.gn file. ASSERT_EQ(nullptr, ::GetModuleHandle(L"user32.dll")); @@ -166,13 +172,31 @@ GetImports(exe, &exe_imports); // Check that chrome.exe has imports. - ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " - "target was built, instead of chrome_elf_unittests.exe"; + ASSERT_LT(0u, exe_imports.size()) + << "Ensure the chrome_elf_import_unittests " + "target was built, instead of chrome_elf_import_unittests.exe"; // Chrome.exe's first import must be ELF. - EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << - "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " - "target was built, instead of just chrome_elf_unittests.exe)"; + EXPECT_EQ("chrome_elf.dll", exe_imports[0]) + << "Illegal import order in chrome.exe (ensure the " + "chrome_elf_import_unittest " + "target was built, instead of just chrome_elf_import_unittests.exe)"; } } // namespace + +int main(int argc, char** argv) { + // Ensure that the CommandLine instance honors the command line passed in + // instead of the default behavior on Windows which is to use the shell32 + // CommandLineToArgvW API. The chrome_elf_imports_unittests test suite should + // not depend on user32 directly or indirectly (For the curious shell32 + // depends on user32) + base::CommandLine::InitUsingArgvForTesting(argc, argv); + + install_static::ScopedInstallDetails scoped_install_details; + + base::TestSuite test_suite(argc, argv); + return base::LaunchUnitTests( + argc, argv, + base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); +}
diff --git a/chrome_elf/run_all_unittests.cc b/chrome_elf/run_all_unittests.cc index 0f2c930..1f00c731 100644 --- a/chrome_elf/run_all_unittests.cc +++ b/chrome_elf/run_all_unittests.cc
@@ -20,8 +20,7 @@ install_static::ScopedInstallDetails scoped_install_details; base::TestSuite test_suite(argc, argv); - int ret = base::LaunchUnitTests( + return base::LaunchUnitTests( argc, argv, base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); - return ret; }
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index 73163d3..3892066f 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn
@@ -95,6 +95,7 @@ "//chromecast/common/media:interfaces", "//chromecast/graphics", "//chromecast/media", + "//chromecast/media:libcast_media", "//chromecast/media/service", "//chromecast/net", "//chromecast/service",
diff --git a/chromecast/media/BUILD.gn b/chromecast/media/BUILD.gn index cea24a2ab..d7eda27 100644 --- a/chromecast/media/BUILD.gn +++ b/chromecast/media/BUILD.gn
@@ -15,6 +15,26 @@ ] } +# Any component calling CastMediaShlib:: static functions should depend on this. +# Handles the various differences between (ATV, Things, desktop, device builds). +group("libcast_media") { + if (is_android) { + if (is_cast_using_cma_backend) { + deps = [ + "//chromecast/media/cma/backend/android:cast_media_android", + ] + } else { + deps = [ + "//chromecast/media/cma/backend:cast_media_android_dummy", + ] + } + } else { + deps = [ + "//chromecast/media/cma/backend:libcast_media_1.0", + ] + } +} + test("cast_media_unittests") { sources = [ "audio/cast_audio_manager_unittest.cc", @@ -30,6 +50,7 @@ } deps = [ + ":libcast_media", ":media", "//base", "//base/test:test_support",
diff --git a/chromecast/media/base/BUILD.gn b/chromecast/media/base/BUILD.gn index 695d25d..791578d 100644 --- a/chromecast/media/base/BUILD.gn +++ b/chromecast/media/base/BUILD.gn
@@ -32,8 +32,6 @@ "decrypt_context_impl_clearkey.h", "media_caps.cc", "media_caps.h", - "media_codec_support.cc", - "media_codec_support.h", "media_resource_tracker.cc", "media_resource_tracker.h", "supported_codec_profile_levels_memo.cc", @@ -53,15 +51,33 @@ public_deps = [ ":key_systems", + ":media_codec_support", "//chromecast/public/media", ] deps = [ "//base", "//chromecast/base", + "//chromecast/media:libcast_media", "//crypto", "//crypto:platform", "//media", "//ui/gfx/geometry", ] } + +source_set("media_codec_support") { + sources = [ + "media_codec_support.cc", + "media_codec_support.h", + ] + + public_deps = [ + "//chromecast/public/media", + ] + + deps = [ + "//base", + "//media", + ] +}
diff --git a/chromecast/media/base/media_codec_support.cc b/chromecast/media/base/media_codec_support.cc index 930c46a..35da8721 100644 --- a/chromecast/media/base/media_codec_support.cc +++ b/chromecast/media/base/media_codec_support.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/strings/string_util.h" -#include "chromecast/media/base/media_caps.h" namespace chromecast { namespace media {
diff --git a/chromecast/media/cma/BUILD.gn b/chromecast/media/cma/BUILD.gn index 6e2dc6c..21b9bdf 100644 --- a/chromecast/media/cma/BUILD.gn +++ b/chromecast/media/cma/BUILD.gn
@@ -63,6 +63,7 @@ "//base/test:test_support", "//chromecast/base", "//chromecast/media", + "//chromecast/media:libcast_media", "//media", "//testing/gmock", "//testing/gtest",
diff --git a/chromecast/media/cma/backend/BUILD.gn b/chromecast/media/cma/backend/BUILD.gn index 584b3bc6..982742d 100644 --- a/chromecast/media/cma/backend/BUILD.gn +++ b/chromecast/media/cma/backend/BUILD.gn
@@ -27,18 +27,9 @@ deps = [ "//base", "//chromecast:chromecast_features", + "//chromecast/media:libcast_media", "//chromecast/media/cma/base", ] - - if (is_android) { - if (is_cast_using_cma_backend) { - deps += [ "//chromecast/media/cma/backend/android:cast_media_android" ] - } else { - deps += [ ":cast_media_android_dummy" ] - } - } else { - deps += [ ":libcast_media_1.0" ] - } } source_set("cast_media_android_dummy") {
diff --git a/chromecast/media/cma/base/BUILD.gn b/chromecast/media/cma/base/BUILD.gn index 56aa272a..8f04d93 100644 --- a/chromecast/media/cma/base/BUILD.gn +++ b/chromecast/media/cma/base/BUILD.gn
@@ -42,7 +42,7 @@ "//base", "//chromecast/base", "//chromecast/base/metrics", - "//chromecast/media/base", + "//chromecast/media/base:media_codec_support", "//media", "//media:shared_memory_support", ]
diff --git a/chromeos/dbus/fake_auth_policy_client.h b/chromeos/dbus/fake_auth_policy_client.h index 5b2f96c..e14019c 100644 --- a/chromeos/dbus/fake_auth_policy_client.h +++ b/chromeos/dbus/fake_auth_policy_client.h
@@ -100,11 +100,13 @@ base::TimeDelta::FromSeconds(0); } + protected: + authpolicy::ErrorType auth_error_ = authpolicy::ERROR_NONE; + private: bool started_ = false; // If valid called after GetUserStatusCallback is called. base::OnceClosure on_get_status_closure_; - authpolicy::ErrorType auth_error_ = authpolicy::ERROR_NONE; std::string display_name_; std::string given_name_; authpolicy::ActiveDirectoryUserStatus::PasswordStatus password_status_ =
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 59d79228..9a1e6882 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -162,6 +162,7 @@ "common/bluetooth.mojom", "common/boot_phase_monitor.mojom", "common/cast_receiver.mojom", + "common/cert_store.mojom", "common/clipboard.mojom", "common/crash_collector.mojom", "common/enterprise_reporting.mojom",
diff --git a/components/arc/arc_bridge_host_impl.cc b/components/arc/arc_bridge_host_impl.cc index 7a19c67..2e496f2 100644 --- a/components/arc/arc_bridge_host_impl.cc +++ b/components/arc/arc_bridge_host_impl.cc
@@ -121,6 +121,11 @@ std::move(cast_receiver_ptr)); } +void ArcBridgeHostImpl::OnCertStoreInstanceReady( + mojom::CertStoreInstancePtr instance_ptr) { + OnInstanceReady(arc_bridge_service_->cert_store(), std::move(instance_ptr)); +} + void ArcBridgeHostImpl::OnClipboardInstanceReady( mojom::ClipboardInstancePtr clipboard_ptr) { OnInstanceReady(arc_bridge_service_->clipboard(), std::move(clipboard_ptr));
diff --git a/components/arc/arc_bridge_host_impl.h b/components/arc/arc_bridge_host_impl.h index bbab05e..f22a917 100644 --- a/components/arc/arc_bridge_host_impl.h +++ b/components/arc/arc_bridge_host_impl.h
@@ -49,6 +49,8 @@ mojom::BootPhaseMonitorInstancePtr boot_phase_monitor_ptr) override; void OnCastReceiverInstanceReady( mojom::CastReceiverInstancePtr cast_receiver_ptr) override; + void OnCertStoreInstanceReady( + mojom::CertStoreInstancePtr instance_ptr) override; void OnClipboardInstanceReady( mojom::ClipboardInstancePtr clipboard_ptr) override; void OnCrashCollectorInstanceReady(
diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h index c503382..de0dec1 100644 --- a/components/arc/arc_bridge_service.h +++ b/components/arc/arc_bridge_service.h
@@ -21,6 +21,7 @@ class BluetoothInstance; class BootPhaseMonitorInstance; class CastReceiverInstance; +class CertStoreInstance; class ClipboardInstance; class CrashCollectorInstance; class EnterpriseReportingInstance; @@ -70,6 +71,9 @@ InstanceHolder<mojom::CastReceiverInstance>* cast_receiver() { return &cast_receiver_; } + InstanceHolder<mojom::CertStoreInstance>* cert_store() { + return &cert_store_; + } InstanceHolder<mojom::ClipboardInstance>* clipboard() { return &clipboard_; } InstanceHolder<mojom::CrashCollectorInstance>* crash_collector() { return &crash_collector_; @@ -129,6 +133,7 @@ InstanceHolder<mojom::BluetoothInstance> bluetooth_; InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_; InstanceHolder<mojom::CastReceiverInstance> cast_receiver_; + InstanceHolder<mojom::CertStoreInstance> cert_store_; InstanceHolder<mojom::ClipboardInstance> clipboard_; InstanceHolder<mojom::CrashCollectorInstance> crash_collector_; InstanceHolder<mojom::EnterpriseReportingInstance> enterprise_reporting_;
diff --git a/components/arc/common/arc_bridge.mojom b/components/arc/common/arc_bridge.mojom index 86872309..786334a 100644 --- a/components/arc/common/arc_bridge.mojom +++ b/components/arc/common/arc_bridge.mojom
@@ -11,6 +11,7 @@ import "bluetooth.mojom"; import "boot_phase_monitor.mojom"; import "cast_receiver.mojom"; +import "cert_store.mojom"; import "clipboard.mojom"; import "crash_collector.mojom"; import "enterprise_reporting.mojom"; @@ -38,9 +39,9 @@ import "volume_mounter.mojom"; import "wallpaper.mojom"; -// Next MinVersion: 31 +// Next MinVersion: 32 // Deprecated method IDs: 101, 105 -// Next method ID: 136 +// Next method ID: 137 interface ArcBridgeHost { // Keep the entries alphabetical. In order to do so without breaking // compatibility with the ARC instance, explicitly assign each interface a @@ -70,6 +71,10 @@ [MinVersion=27] OnCastReceiverInstanceReady@132( CastReceiverInstance instance_ptr); + // Notifies Chrome that the CertStoreInstance interface is ready. + [MinVersion=31] OnCertStoreInstanceReady@136( + CertStoreInstance instance_ptr); + // Notifies Chrome that the ClipboardInstance interface is ready. [MinVersion=2] OnClipboardInstanceReady@109(ClipboardInstance instance_ptr);
diff --git a/components/arc/common/cert_store.mojom b/components/arc/common/cert_store.mojom new file mode 100644 index 0000000..6af522b --- /dev/null +++ b/components/arc/common/cert_store.mojom
@@ -0,0 +1,121 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// +// CertStoreHost is modeled after Android keymaster interface +// hardware/libhardware/include/hardware/keymaster2.h +// +// and must follow the concept if extended in the future. +// Please keep names in sync as far as it is possible. +// +// Enums/structures are modeled after structures from +// hardware/libhardware/include/hardware/keymaster_defs.h +// + +module arc.mojom; + +// Describes a keymaster operation result. +[Extensible] +enum KeymasterError { + ERROR_OK = 0, + ERROR_INVALID_OPERATION_HANDLE = -28, + ERROR_INVALID_KEY_BLOB = -33, + ERROR_UNIMPLEMENTED = -100, + ERROR_UNKNOWN_ERROR = -1000, +}; + +// Enumerates the crypto algorithms supported by Host. +[Extensible] +enum Algorithm { + ALGORITHM_RSA = 1, + ALGORITHM_EC = 3, +}; + +// Enumerates the digests supported by Host. +[Extensible] +enum Digest { + DIGEST_NONE = 0, + DIGEST_SHA1 = 2, + DIGEST_SHA_2_224 = 3, + DIGEST_SHA_2_256 = 4, + DIGEST_SHA_2_384 = 5, + DIGEST_SHA_2_512 = 6, +}; + +// Enumerates the paddings supported by Host. +[Extensible] +enum Padding { + PAD_NONE = 1, + PAD_RSA_PKCS1_1_5_SIGN = 5, +}; + +// Describes a parameter of client certificate provided by Host. +union KeyParam { + Algorithm algorithm; + Digest digest; + Padding padding; +}; + +// Describes a client certificate provided by Host. +// Does not correspond to keymaster type. +struct Certificate { + // Nickname/alias of the certificate. + string alias; + + // PEM-encoded client certificate. + string cert; +}; + +// Next method ID: 6 +// The interface is modeled after keymaster interface and must follow the format +// if extended in the future. +interface CertStoreHost { + // The helper method, which does not correspond to keymaster interface. + // It returns a list of Chrome OS corporate usage client certificates if + // any Android app is whitelisted to use them, otherwise returns an + // empty list. + ListCertificates@0() => (array<Certificate> certs); + + // Retrieves key characteristics for the specified key with alias. + // params is null if any error occurred during retrieval. + GetKeyCharacteristics@1(string alias) + => (KeymasterError error, array<KeyParam>? params); + + // Begins the operation using the specified key with alias and operation + // parameters (such as algorithm, digest, padding). + // If all is well, returns ERROR_OK and creates an operation handle which + // must be passed to subsequent calls to Update(), Finish() or Abort(). + // Currently only signature operations are supported. + Begin@2(string alias, array<KeyParam> params) + => (KeymasterError error, uint64 operation_handle); + + // Provides data to an ongoing cryptographic operation begun with Begin(). + // Returns an amount of data consumed by Update(). + Update@3(uint64 operation_handle, array<uint8> data) + => (KeymasterError error, uint32 input_consumed); + + // Finalizes a cryptographic operation begun with Begin() and invalidates + // operation handle. Retrieves the result (signature). In case of any error, + // signed_data is null. + Finish@4(uint64 operation_handle) + => (KeymasterError error, array<uint8>? signed_data); + + // Aborts a cryptographic operation begun with Begin(), freeing all internal + // resources and invalidating operation handle. + Abort@5(uint64 operation_handle) => (KeymasterError error); +}; + +// Next method ID: 3 +interface CertStoreInstance { + // Establishes full-duplex communication with the host. + Init@0(CertStoreHost host_ptr); + + // Informs the key permissions are changed: only listed packages are allowed + // to use exposed certificates. + OnKeyPermissionsChanged@1(array<string> permissions); + + // Informs the certificates are changed (added, removed or updated): + // CertStoreInstance must call ListCertficates to update its database. + OnCertificatesChanged@2(); +};
diff --git a/components/autofill/content/renderer/page_passwords_analyser.cc b/components/autofill/content/renderer/page_passwords_analyser.cc index 9801dc1..b93f0ab 100644 --- a/components/autofill/content/renderer/page_passwords_analyser.cc +++ b/components/autofill/content/renderer/page_passwords_analyser.cc
@@ -11,7 +11,6 @@ #include "base/strings/utf_string_conversions.h" #include "components/autofill/content/renderer/form_autofill_util.h" #include "components/autofill/content/renderer/password_form_conversion_utils.h" -#include "third_party/WebKit/public/web/WebConsoleMessage.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebElementCollection.h" @@ -27,38 +26,33 @@ const char* kTypeAttributes[] = {"text", "email", "tel", "password"}; const char* kTypeTextAttributes[] = {"text", "email", "tel"}; -using ConsoleLevel = blink::WebConsoleMessage::Level; - // ConsoleLogger provides a convenient interface for logging messages to the // DevTools console, both in terms of wrapping and formatting console messages // along with their parameters, and in ordering messages so that higher-priority // warnings are displayed first. -class ConsoleLogger { +class ConsoleLogger : public PagePasswordsAnalyserLogger { public: - static const ConsoleLevel kError = blink::WebConsoleMessage::kLevelError; - static const ConsoleLevel kWarning = blink::WebConsoleMessage::kLevelWarning; - static const ConsoleLevel kVerbose = blink::WebConsoleMessage::kLevelVerbose; - - ConsoleLogger(blink::WebLocalFrame* frame) : frame_(frame) {} + ConsoleLogger(blink::WebLocalFrame* frame) + : PagePasswordsAnalyserLogger(), frame_(frame) {} void Send(const std::string& message, ConsoleLevel level, - const blink::WebNode& node) { + const blink::WebNode& node) override { Send(message, level, std::vector<blink::WebNode>{node}); } void Send(const std::string& message, ConsoleLevel level, - const std::vector<blink::WebNode>& nodes) { + const std::vector<blink::WebNode>& nodes) override { node_buffer_[level].push_back(Entry{message, nodes}); } - void Flush() { + void Flush() override { for (ConsoleLevel level : {kError, kWarning, kVerbose}) { for (Entry& entry : node_buffer_[level]) { std::string parameter_string; for (unsigned i = 0; i < entry.nodes.size(); ++i) - parameter_string += "%o"; + parameter_string += " %o"; frame_->AddMessageToConsole(blink::WebConsoleMessage( level, blink::WebString::FromUTF8("[DOM] " + entry.message + @@ -202,7 +196,7 @@ std::vector<FormInputCollection> ExtractFormsForAnalysis( const blink::WebDocument& document, std::set<blink::WebNode>* skip_nodes, - ConsoleLogger* console_logger) { + PagePasswordsAnalyserLogger* logger) { std::vector<FormInputCollection> form_input_collections; // Keep track of inputs that are inside <form> elements to find the complement @@ -242,8 +236,8 @@ continue; // Any password fields inside <form> elements will have been skipped, // leaving just those without associated forms. - console_logger->Send("Password field is not contained in a form:", - ConsoleLogger::kVerbose, password_inputs[i]); + logger->Send("Password field is not contained in a form:", + PagePasswordsAnalyserLogger::kVerbose, password_inputs[i]); } // Check for input fields that are not contained inside forms, to make sure // their id attributes don't conflict with other fields also not contained @@ -266,13 +260,13 @@ if (nodes.size() <= 1) continue; if (!id_attr.empty()) { - console_logger->Send( + logger->Send( base::StringPrintf("Found %zu elements with non-unique id #%s:", nodes.size(), id_attr.c_str()), - ConsoleLogger::kError, nodes); + PagePasswordsAnalyserLogger::kError, nodes); } else { - console_logger->Send("The id attribute must be unique and non-empty:", - ConsoleLogger::kError, nodes); + logger->Send("The id attribute must be unique and non-empty:", + PagePasswordsAnalyserLogger::kError, nodes); } } @@ -361,7 +355,7 @@ // Error and warning messages specific to an individual form (for example, // autocomplete attributes, or missing username fields, etc.). void AnalyseForm(const FormInputCollection& form_input_collection, - ConsoleLogger* console_logger) { + PagePasswordsAnalyserLogger* logger) { const blink::WebFormElement& form = form_input_collection.form; const std::vector<blink::WebFormControlElement>& inputs = form_input_collection.inputs; @@ -384,10 +378,10 @@ // every password field, but providing one ensures that the Password // Manager associates the correct account name with the password (for // example in password reset forms). - console_logger->Send( + logger->Send( "Password forms should have (optionally hidden) " "username fields for accessibility:", - ConsoleLogger::kVerbose, form); + PagePasswordsAnalyserLogger::kVerbose, form); } else { // By default (if the other heuristics fail), the first text field // preceding a password field will be considered the username field. @@ -399,11 +393,11 @@ } if (FormIsTooComplex(signature)) { - console_logger->Send( + logger->Send( "Multiple forms should be contained in their own " "form elements; break up complex forms into ones that represent a " "single action:", - ConsoleLogger::kVerbose, form); + PagePasswordsAnalyserLogger::kVerbose, form); return; } @@ -426,11 +420,11 @@ for (size_t i = 0; i < inputs.size(); ++i) { if (autocomplete_suggestions.count(i) && !inputs[i].HasAttribute("autocomplete")) - console_logger->Send( + logger->Send( "Input elements should have autocomplete " "attributes (suggested: \"" + autocomplete_suggestions[i] + "\"):", - ConsoleLogger::kVerbose, inputs[i]); + PagePasswordsAnalyserLogger::kVerbose, inputs[i]); } } @@ -445,22 +439,28 @@ skip_nodes_.clear(); } -void PagePasswordsAnalyser::AnalyseDocumentDOM(blink::WebLocalFrame* frame) { +void PagePasswordsAnalyser::AnalyseDocumentDOM( + blink::WebLocalFrame* frame, + PagePasswordsAnalyserLogger* logger) { DCHECK(frame); - ConsoleLogger console_logger(frame); blink::WebDocument document(frame->GetDocument()); // Extract all the forms from the DOM, and provide relevant warnings. std::vector<FormInputCollection> forms( - ExtractFormsForAnalysis(document, &skip_nodes_, &console_logger)); + ExtractFormsForAnalysis(document, &skip_nodes_, logger)); // Analyse each form in turn, for example with respect to autocomplete // attributes. for (const FormInputCollection& form_input_collection : forms) - AnalyseForm(form_input_collection, &console_logger); + AnalyseForm(form_input_collection, logger); // Finally, send all the warnings and errors to the console. - console_logger.Flush(); + logger->Flush(); +} + +void PagePasswordsAnalyser::AnalyseDocumentDOM(blink::WebLocalFrame* frame) { + ConsoleLogger console_logger(frame); + AnalyseDocumentDOM(frame, &console_logger); } } // namespace autofill \ No newline at end of file
diff --git a/components/autofill/content/renderer/page_passwords_analyser.h b/components/autofill/content/renderer/page_passwords_analyser.h index cdaceab..fed171f 100644 --- a/components/autofill/content/renderer/page_passwords_analyser.h +++ b/components/autofill/content/renderer/page_passwords_analyser.h
@@ -5,10 +5,32 @@ #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_PASSWORDS_ANALYSER_H_ #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_PASSWORDS_ANALYSER_H_ +#include "third_party/WebKit/public/web/WebConsoleMessage.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" namespace autofill { +using ConsoleLevel = blink::WebConsoleMessage::Level; + +// An interface for logging warnings relating to the Password Manager. +// Abstracted for testing purposes. +class PagePasswordsAnalyserLogger { + public: + static const ConsoleLevel kError = blink::WebConsoleMessage::kLevelError; + static const ConsoleLevel kWarning = blink::WebConsoleMessage::kLevelWarning; + static const ConsoleLevel kVerbose = blink::WebConsoleMessage::kLevelVerbose; + + virtual void Send(const std::string& message, + ConsoleLevel level, + const blink::WebNode& node) = 0; + + virtual void Send(const std::string& message, + ConsoleLevel level, + const std::vector<blink::WebNode>& nodes) = 0; + + virtual void Flush() = 0; +}; + // This class provides feedback to web developers about the password forms on // their webpages, in order to increase the accessibility of web forms to the // Password Manager. This is achieved by crawling the DOM whenever new forms are @@ -30,6 +52,11 @@ // DevTools console. Errors are logged for those issues that conflict with the // HTML specification. Warnings are logged for issues that cause problems with // identification of fields on the web-page for the Password Manager. + // Warning and error messages are logged to |logger|. + void AnalyseDocumentDOM(blink::WebLocalFrame* frame, + PagePasswordsAnalyserLogger* logger); + + // By default, the analyser will log to the DevTools console. void AnalyseDocumentDOM(blink::WebLocalFrame* frame); std::set<blink::WebNode> skip_nodes_;
diff --git a/components/autofill/core/browser/address_normalizer.h b/components/autofill/core/browser/address_normalizer.h index dd4ce5ec..81010da 100644 --- a/components/autofill/core/browser/address_normalizer.h +++ b/components/autofill/core/browser/address_normalizer.h
@@ -28,13 +28,6 @@ virtual ~Delegate() {} }; - // The interface for the normalization request. - class Request { - public: - virtual void OnRulesLoaded(bool success) = 0; - virtual ~Request() {} - }; - // Start loading the validation rules for the specified |region_code|. virtual void LoadRulesForRegion(const std::string& region_code) = 0;
diff --git a/components/autofill/core/browser/address_normalizer_impl.cc b/components/autofill/core/browser/address_normalizer_impl.cc index 00fb2487..d724012 100644 --- a/components/autofill/core/browser/address_normalizer_impl.cc +++ b/components/autofill/core/browser/address_normalizer_impl.cc
@@ -12,7 +12,6 @@ #include "base/cancelable_callback.h" #include "base/location.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" @@ -25,25 +24,28 @@ #include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h" namespace autofill { + namespace { using ::i18n::addressinput::Source; using ::i18n::addressinput::Storage; -class AddressNormalizationRequest : public AddressNormalizer::Request { +} // namespace + +class AddressNormalizerImpl::NormalizationRequest { public: // The |delegate| and |address_validator| need to outlive this Request. - AddressNormalizationRequest(const AutofillProfile& profile, - const std::string& region_code, - int timeout_seconds, - AddressNormalizer::Delegate* delegate, - AddressValidator* address_validator) + NormalizationRequest(const AutofillProfile& profile, + const std::string& region_code, + int timeout_seconds, + AddressNormalizer::Delegate* delegate, + AddressValidator* address_validator) : profile_(profile), region_code_(region_code), delegate_(delegate), address_validator_(address_validator), has_responded_(false), - on_timeout_(base::Bind(&AddressNormalizationRequest::OnRulesLoaded, + on_timeout_(base::Bind(&NormalizationRequest::OnRulesLoaded, base::Unretained(this), false)) { base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( @@ -51,9 +53,9 @@ base::TimeDelta::FromSeconds(timeout_seconds)); } - ~AddressNormalizationRequest() override {} + ~NormalizationRequest() {} - void OnRulesLoaded(bool success) override { + void OnRulesLoaded(bool success) { on_timeout_.Cancel(); // Check if the timeout happened before the rules were loaded. @@ -115,11 +117,9 @@ bool has_responded_; base::CancelableCallback<void()> on_timeout_; - DISALLOW_COPY_AND_ASSIGN(AddressNormalizationRequest); + DISALLOW_COPY_AND_ASSIGN(NormalizationRequest); }; -} // namespace - AddressNormalizerImpl::AddressNormalizerImpl(std::unique_ptr<Source> source, std::unique_ptr<Storage> storage) : address_validator_(std::move(source), std::move(storage), this) {} @@ -142,32 +142,35 @@ AddressNormalizer::Delegate* requester) { DCHECK_GE(timeout_seconds, 0); - std::unique_ptr<AddressNormalizationRequest> request( - base::MakeUnique<AddressNormalizationRequest>(profile, region_code, - timeout_seconds, requester, - &address_validator_)); + std::unique_ptr<NormalizationRequest> request = + std::make_unique<NormalizationRequest>(profile, region_code, + timeout_seconds, requester, + &address_validator_); - // Check if the rules are already loaded. + // If the rules are already loaded for |region_code|, the |request| will call + // back to the delegate (|requester|) synchronously. if (AreRulesLoadedForRegion(region_code)) { request->OnRulesLoaded(true); - } else { - // Setup the variables so the profile gets normalized when the rules have - // finished loading. - auto it = pending_normalization_.find(region_code); - if (it == pending_normalization_.end()) { - // If no entry exists yet, create the entry and assign it to |it|. - it = pending_normalization_ - .insert(std::make_pair(region_code, - std::vector<std::unique_ptr<Request>>())) - .first; - } - - it->second.push_back(std::move(request)); - - // Start loading the rules for that region. If the rules were already in the - // process of being loaded, this call will do nothing. - LoadRulesForRegion(region_code); + return; } + + // Setup the variables so the profile gets normalized when the rules have + // finished loading. + auto it = pending_normalization_.find(region_code); + if (it == pending_normalization_.end()) { + // If no entry exists yet, create the entry and assign it to |it|. + it = pending_normalization_ + .insert(std::make_pair( + region_code, + std::vector<std::unique_ptr<NormalizationRequest>>())) + .first; + } + + it->second.push_back(std::move(request)); + + // Start loading the rules for that region. If the rules were already in the + // process of being loaded, this call will do nothing. + LoadRulesForRegion(region_code); } void AddressNormalizerImpl::OnAddressValidationRulesLoaded(
diff --git a/components/autofill/core/browser/address_normalizer_impl.h b/components/autofill/core/browser/address_normalizer_impl.h index 27ace767..3d40ea0 100644 --- a/components/autofill/core/browser/address_normalizer_impl.h +++ b/components/autofill/core/browser/address_normalizer_impl.h
@@ -46,7 +46,8 @@ bool success) override; // Map associating a region code to pending normalizations. - std::map<std::string, std::vector<std::unique_ptr<Request>>> + class NormalizationRequest; + std::map<std::string, std::vector<std::unique_ptr<NormalizationRequest>>> pending_normalization_; // The address validator used to normalize addresses.
diff --git a/components/autofill/core/browser/autofill_experiments.cc b/components/autofill/core/browser/autofill_experiments.cc index dd4dd6a..09958a4 100644 --- a/components/autofill/core/browser/autofill_experiments.cc +++ b/components/autofill/core/browser/autofill_experiments.cc
@@ -11,7 +11,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" #include "build/build_config.h" #include "components/autofill/core/browser/suggestion.h" #include "components/autofill/core/common/autofill_pref_names.h" @@ -39,6 +38,8 @@ "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillCreditCardLastUsedDateDisplay{ "AutofillCreditCardLastUsedDateDisplay", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kAutofillDeleteDisusedAddresses{ + "AutofillDeleteDisusedAddresses", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillDeleteDisusedCreditCards{ "AutofillDeleteDisusedCreditCards", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillOfferLocalSaveIfServerCardManuallyEntered{ @@ -62,9 +63,6 @@ const base::Feature kAutofillUpstreamUseAutofillProfileComparator{ "AutofillUpstreamUseAutofillProfileComparator", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kAutofillUpstreamUseNotRecentlyUsedAutofillProfile{ - "AutofillUpstreamUseNotRecentlyUsedAutofillProfile", - base::FEATURE_DISABLED_BY_DEFAULT}; const char kCreditCardSigninPromoImpressionLimitParamKey[] = "impression_limit"; const char kAutofillCreditCardPopupBackgroundColorKey[] = "background_color"; const char kAutofillCreditCardPopupDividerColorKey[] = "dropdown_divider_color"; @@ -77,8 +75,6 @@ const char kAutofillPopupMarginKey[] = "margin"; const char kAutofillCreditCardLastUsedDateShowExpirationDateKey[] = "show_expiration_date"; -const char kAutofillUpstreamMaxMinutesSinceAutofillProfileUseKey[] = - "max_minutes_since_autofill_profile_use"; #if defined(OS_MACOSX) const base::Feature kCreditCardAutofillTouchBar{ @@ -300,16 +296,6 @@ #endif } -base::TimeDelta GetMaxTimeSinceAutofillProfileUseForCardUpload() { - int value; - const std::string param_value = variations::GetVariationParamValueByFeature( - kAutofillUpstreamUseNotRecentlyUsedAutofillProfile, - kAutofillUpstreamMaxMinutesSinceAutofillProfileUseKey); - if (!param_value.empty() && base::StringToInt(param_value, &value)) - return base::TimeDelta::FromMinutes(value); - return base::TimeDelta(); -} - #if defined(OS_MACOSX) bool IsCreditCardAutofillTouchBarExperimentEnabled() { return base::FeatureList::IsEnabled(kCreditCardAutofillTouchBar);
diff --git a/components/autofill/core/browser/autofill_experiments.h b/components/autofill/core/browser/autofill_experiments.h index ecbbc64..3c0d404 100644 --- a/components/autofill/core/browser/autofill_experiments.h +++ b/components/autofill/core/browser/autofill_experiments.h
@@ -8,7 +8,6 @@ #include <string> #include "base/strings/string16.h" -#include "base/time/time.h" #include "build/build_config.h" #include "third_party/skia/include/core/SkColor.h" @@ -33,6 +32,7 @@ extern const base::Feature kAutofillCreditCardBankNameDisplay; extern const base::Feature kAutofillCreditCardPopupLayout; extern const base::Feature kAutofillCreditCardLastUsedDateDisplay; +extern const base::Feature kAutofillDeleteDisusedAddresses; extern const base::Feature kAutofillDeleteDisusedCreditCards; extern const base::Feature kAutofillOfferLocalSaveIfServerCardManuallyEntered; extern const base::Feature kAutofillRationalizeFieldTypePredictions; @@ -43,7 +43,6 @@ extern const base::Feature kAutofillUpstreamShowGoogleLogo; extern const base::Feature kAutofillUpstreamShowNewUi; extern const base::Feature kAutofillUpstreamUseAutofillProfileComparator; -extern const base::Feature kAutofillUpstreamUseNotRecentlyUsedAutofillProfile; extern const char kCreditCardSigninPromoImpressionLimitParamKey[]; extern const char kAutofillCreditCardLastUsedDateShowExpirationDateKey[]; extern const char kAutofillUpstreamMaxMinutesSinceAutofillProfileUseKey[]; @@ -141,11 +140,6 @@ // new save card bubble/infobar design. bool IsAutofillUpstreamShowNewUiExperimentEnabled(); -// Returns the maximum time that could have elapsed since an address profile's -// most recent use for the adress profile to be included in the candidate set -// for card upload. Returns 0 if the experiment is not enabled. -base::TimeDelta GetMaxTimeSinceAutofillProfileUseForCardUpload(); - #if defined(OS_MACOSX) // Returns whether the Credit Card Autofill Touch Bar experiment is enabled. bool IsCreditCardAutofillTouchBarExperimentEnabled();
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 84341f1c..36d5676 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -33,7 +33,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" -#include "base/time/time.h" #include "build/build_config.h" #include "components/autofill/core/browser/autocomplete_history_manager.h" #include "components/autofill/core/browser/autofill_client.h" @@ -283,6 +282,9 @@ registry->RegisterIntegerPref( prefs::kAutofillLastVersionDeduped, 0, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); + registry->RegisterIntegerPref( + prefs::kAutofillLastVersionDisusedAddressesDeleted, 0, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); // These choices are made on a per-device basis, so they're not syncable. registry->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled, true); registry->RegisterBooleanPref( @@ -1379,23 +1381,6 @@ AutofillMetrics::LogHasModifiedProfileOnCreditCardFormSubmission( has_modified_profile); - // If there are no recently used or modified profiles and experiment to use - // profiles that were not recently used is enabled, collect the profiles that - // used within the maximum time specified in the experiment. - if (candidate_profiles.empty()) { - const base::TimeDelta max_time_since_use = - GetMaxTimeSinceAutofillProfileUseForCardUpload(); - if (!max_time_since_use.is_zero()) { - for (AutofillProfile* profile : personal_data_->GetProfiles()) - if ((now - profile->modification_date()) < max_time_since_use || - (now - profile->use_date()) < max_time_since_use) - candidate_profiles.push_back(*profile); - if (!candidate_profiles.empty()) - upload_request->active_experiments.push_back( - kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name); - } - } - if (candidate_profiles.empty()) { upload_decision_metrics |= has_profile
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index e216bcb..bb37ef9c 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -5604,62 +5604,6 @@ } TEST_F(AutofillManagerTest, - UploadCreditCard_NoRecentlyUsedProfile_CanUseOldProfile) { - variation_params_.SetVariationParamsWithFeatureAssociations( - kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name, - {{kAutofillUpstreamMaxMinutesSinceAutofillProfileUseKey, - base::IntToString((kMuchLaterTime - kArbitraryTime).InMinutes() + 1)}}, - {kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name}); - - // Create the test clock and set the time to a specific value. - TestAutofillClock test_clock; - test_clock.SetNow(kArbitraryTime); - - personal_data_.ClearAutofillProfiles(); - autofill_manager_->set_credit_card_upload_enabled(true); - - // Create, fill and submit an address form in order to establish a profile. - FormData address_form; - test::CreateTestAddressFormData(&address_form); - FormsSeen({address_form}); - - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); - FormSubmitted(address_form); - - // Advance the current time. Although |address_form| is not a recently used - // address profile, we will include it in the candidate profiles because - // there are no recently used address profiles and the feature to use older - // profiles is enabled. - test_clock.SetNow(kMuchLaterTime); - - // Set up our credit card form data. - FormData credit_card_form; - CreateTestCreditCardFormData(&credit_card_form, true, false); - FormsSeen(std::vector<FormData>(1, credit_card_form)); - - // Edit the data, and submit. - credit_card_form.fields[0].value = ASCIIToUTF16("Flo Master"); - credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111"); - credit_card_form.fields[2].value = ASCIIToUTF16("11"); - credit_card_form.fields[3].value = ASCIIToUTF16("2017"); - credit_card_form.fields[4].value = ASCIIToUTF16("123"); - - base::HistogramTester histogram_tester; - - // Upload should be offered. - EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); - FormSubmitted(credit_card_form); - EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded()); - EXPECT_THAT(autofill_manager_->GetActiveExperiments(), - UnorderedElementsAre( - kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name)); - - // Verify that the correct histogram entry (and only that) was logged. - ExpectUniqueCardUploadDecision(histogram_tester, - AutofillMetrics::UPLOAD_OFFERED); -} - -TEST_F(AutofillManagerTest, UploadCreditCard_CvcUnavailableAndNoProfileAvailable) { personal_data_.ClearAutofillProfiles(); autofill_manager_->set_credit_card_upload_enabled(true); @@ -6404,64 +6348,6 @@ AutofillMetrics::UPLOAD_OFFERED); } -TEST_F(AutofillManagerTest, - UploadCreditCard_IgnoreOldProfiles_CanUseOldProfiles) { - variation_params_.SetVariationParamsWithFeatureAssociations( - kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name, - {{kAutofillUpstreamMaxMinutesSinceAutofillProfileUseKey, - base::IntToString((kMuchLaterTime - kArbitraryTime).InMinutes() + 1)}}, - {kAutofillUpstreamUseNotRecentlyUsedAutofillProfile.name}); - - // Create the test clock and set the time to a specific value. - TestAutofillClock test_clock; - test_clock.SetNow(kArbitraryTime); - - personal_data_.ClearAutofillProfiles(); - autofill_manager_->set_credit_card_upload_enabled(true); - - // Create, fill and submit two address forms with different names. - FormData address_form1, address_form2; - test::CreateTestAddressFormData(&address_form1); - test::CreateTestAddressFormData(&address_form2); - FormsSeen({address_form1, address_form2}); - - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1); - FormSubmitted(address_form1); - - // Advance the current time. Since |address_form1| will not be a recently - // used address profile, we will not include it in the candidate profiles - // because we have a recently used address. - test_clock.SetNow(kMuchLaterTime); - - ManuallyFillAddressForm("Master", "Blaster", "77401", "US", &address_form2); - FormSubmitted(address_form2); - - // Set up our credit card form data. - FormData credit_card_form; - CreateTestCreditCardFormData(&credit_card_form, true, false); - FormsSeen(std::vector<FormData>(1, credit_card_form)); - - // Edit the data, but use yet another name, and submit. - credit_card_form.fields[0].value = ASCIIToUTF16("Master Blaster"); - credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111"); - credit_card_form.fields[2].value = ASCIIToUTF16("11"); - credit_card_form.fields[3].value = ASCIIToUTF16("2017"); - credit_card_form.fields[4].value = ASCIIToUTF16("123"); - - base::HistogramTester histogram_tester; - - // Name matches recently used profile, should offer upload. - EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0); - FormSubmitted(credit_card_form); - EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded()); - // Recently used profile was available, so did not need to use old profile. - EXPECT_TRUE(autofill_manager_->GetActiveExperiments().empty()); - - // Verify that the correct histogram entry (and only that) was logged. - ExpectUniqueCardUploadDecision(histogram_tester, - AutofillMetrics::UPLOAD_OFFERED); -} - TEST_F(AutofillManagerTest, UploadCreditCard_LogPreviousUseDate) { // Create the test clock and set the time to a specific value. TestAutofillClock test_clock;
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index 1a6c0bf..9645cd3 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -934,6 +934,12 @@ } // static +void AutofillMetrics::LogNumberOfAddressesDeletedForDisuse( + size_t num_profiles) { + UMA_HISTOGRAM_COUNTS_1000("Autofill.AddressesDeletedForDisuse", num_profiles); +} + +// static void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); }
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index b464de6..1377ed7e 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h
@@ -787,6 +787,12 @@ // always offered, regardless of how recently they have been used. static void LogNumberOfAddressesSuppressedForDisuse(size_t num_profiles); + // Log the number of unverified autofill addresses deleted because they have + // not been used for a long time, and are not used as billing addresses of + // valid credit cards. Note the deletion only happens once per major version + // upgrade. + static void LogNumberOfAddressesDeletedForDisuse(size_t num_profiles); + // Log the number of Autofill address suggestions presented to the user when // filling a form. static void LogAddressSuggestionsCount(size_t num_suggestions);
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 13128ac..d78e02a5 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -67,6 +67,8 @@ base::TimeDelta::FromDays(180); constexpr base::TimeDelta kDisusedCreditCardDeletionTimeDelta = base::TimeDelta::FromDays(395); +constexpr base::TimeDelta kDisusedAddressDeletionTimeDelta = + base::TimeDelta::FromDays(395); // Time delta to create test data. base::TimeDelta DeletableUseDateDelta() { @@ -318,6 +320,31 @@ return profile; } +AutofillProfile CreateDisusedDeletableTestAddress(const std::string& locale) { + const base::Time use_date = + AutofillClock::Now() - base::TimeDelta::FromDays(400); + AutofillProfile profile; + profile.SetInfo(NAME_FULL, base::UTF8ToUTF16("Polly Deletable"), locale); + profile.SetInfo(COMPANY_NAME, + base::UTF8ToUTF16(base::StringPrintf( + "%lld Inc.", static_cast<long long>(use_date.ToTimeT()))), + locale); + profile.SetInfo(EMAIL_ADDRESS, + base::UTF8ToUTF16("polly.deletable@fake.chromium.org"), + locale); + profile.SetInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("459 Deletable Lane"), + locale); + profile.SetInfo(ADDRESS_HOME_LINE2, base::UTF8ToUTF16("Apt. B"), locale); + profile.SetInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Austin"), locale); + profile.SetInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Texas"), locale); + profile.SetInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("73301"), locale); + profile.SetInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("US"), locale); + profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("844-555-0274"), + locale); + profile.set_use_date(use_date); + return profile; +} + // Create a card expiring 500 days from now which was last used 10 days ago. CreditCard CreateBasicTestCreditCard(const std::string& locale) { const base::Time now = AutofillClock::Now(); @@ -442,6 +469,7 @@ if (!IsSyncEnabledFor(sync_service, syncer::AUTOFILL_PROFILE)) { ApplyProfileUseDatesFix(); // One-time fix, otherwise NOP. ApplyDedupingRoutine(); // Once per major version, otherwise NOP. + DeleteDisusedAddresses(); // Once per major version, otherwise NOP. CreateTestAddresses(); // Once per user profile startup. } @@ -524,6 +552,7 @@ if (model_type == syncer::AUTOFILL_PROFILE) { ApplyProfileUseDatesFix(); // One-time fix, otherwise NOP. ApplyDedupingRoutine(); // Once per major version, otherwise NOP. + DeleteDisusedAddresses(); // Once per major version, otherwise NOP. CreateTestAddresses(); // Once per user profile startup. } @@ -824,6 +853,24 @@ server_credit_cards_.push_back(std::move(credit_card)); } +void PersonalDataManager:: + RemoveAutofillProfileByGUIDAndBlankCreditCardReferecne( + const std::string& guid) { + database_->RemoveAutofillProfile(guid); + + // Reset the billing_address_id of any card that refered to this profile. + for (CreditCard* credit_card : GetCreditCards()) { + if (credit_card->billing_address_id() == guid) { + credit_card->set_billing_address_id(""); + + if (credit_card->record_type() == CreditCard::LOCAL_CARD) + database_->UpdateCreditCard(*credit_card); + else + database_->UpdateServerCardMetadata(*credit_card); + } + } +} + void PersonalDataManager::RemoveByGUID(const std::string& guid) { if (is_off_the_record_) return; @@ -840,19 +887,7 @@ if (is_credit_card) { database_->RemoveCreditCard(guid); } else { - database_->RemoveAutofillProfile(guid); - - // Reset the billing_address_id of any card that refered to this profile. - for (CreditCard* credit_card : GetCreditCards()) { - if (credit_card->billing_address_id() == guid) { - credit_card->set_billing_address_id(""); - - if (credit_card->record_type() == CreditCard::LOCAL_CARD) - database_->UpdateCreditCard(*credit_card); - else - database_->UpdateServerCardMetadata(*credit_card); - } - } + RemoveAutofillProfileByGUIDAndBlankCreditCardReferecne(guid); } // Refresh our local cache and send notifications to observers. @@ -2278,6 +2313,7 @@ AddProfile(CreateBasicTestAddress(app_locale_)); AddProfile(CreateDisusedTestAddress(app_locale_)); + AddProfile(CreateDisusedDeletableTestAddress(app_locale_)); } void PersonalDataManager::CreateTestCreditCards() { @@ -2293,6 +2329,14 @@ AddCreditCard(CreateDisusedDeletableTestCreditCard(app_locale_)); } +bool PersonalDataManager::IsCreditCardDeletable(CreditCard* card) { + const base::Time deletion_threshold = + AutofillClock::Now() - kDisusedCreditCardDeletionTimeDelta; + + return card->use_date() < deletion_threshold && + card->IsExpired(deletion_threshold); +} + bool PersonalDataManager::DeleteDisusedCreditCards() { if (!base::FeatureList::IsEnabled(kAutofillDeleteDisusedCreditCards)) { return false; @@ -2322,13 +2366,9 @@ return true; } - const base::Time deletion_threshold = - AutofillClock::Now() - kDisusedCreditCardDeletionTimeDelta; - std::vector<std::string> guid_to_delete; for (CreditCard* card : cards) { - if (card->use_date() < deletion_threshold && - card->IsExpired(deletion_threshold)) { + if (IsCreditCardDeletable(card)) { guid_to_delete.push_back(card->guid()); } } @@ -2348,4 +2388,70 @@ return true; } -} // namespace autofill +bool PersonalDataManager::IsAddressDeletable( + AutofillProfile* profile, + std::unordered_set<std::string> const& used_billing_address_guids) { + const base::Time deletion_threshold = + AutofillClock::Now() - kDisusedAddressDeletionTimeDelta; + + return profile->use_date() < deletion_threshold && !profile->IsVerified() && + used_billing_address_guids.find(profile->guid()) == + used_billing_address_guids.end(); +} + +bool PersonalDataManager::DeleteDisusedAddresses() { + if (!base::FeatureList::IsEnabled(kAutofillDeleteDisusedAddresses)) { + return false; + } + + // Check if address deletion has already been performed this major version. + int current_major_version = atoi(version_info::GetVersionNumber().c_str()); + if (pref_service_->GetInteger( + prefs::kAutofillLastVersionDisusedAddressesDeleted) >= + current_major_version) { + DVLOG(1) + << "Autofill addresses deletion already performed for this version"; + return false; + } + + // Set the pref to the current major version. + pref_service_->SetInteger(prefs::kAutofillLastVersionDisusedAddressesDeleted, + current_major_version); + + const std::vector<AutofillProfile*>& profiles = GetProfiles(); + + // Early exit when there are no profiles. + if (profiles.empty()) { + return true; + } + + std::unordered_set<std::string> used_billing_address_guids; + for (CreditCard* card : GetCreditCards()) { + if (!IsCreditCardDeletable(card)) { + used_billing_address_guids.insert(card->billing_address_id()); + } + } + + std::vector<std::string> guids_to_delete; + for (AutofillProfile* profile : profiles) { + if (IsAddressDeletable(profile, used_billing_address_guids)) { + guids_to_delete.push_back(profile->guid()); + } + } + + size_t num_deleted_addresses = guids_to_delete.size(); + + for (auto const guid : guids_to_delete) { + RemoveAutofillProfileByGUIDAndBlankCreditCardReferecne(guid); + } + + if (num_deleted_addresses > 0) { + Refresh(); + } + + AutofillMetrics::LogNumberOfAddressesDeletedForDisuse(num_deleted_addresses); + + return true; +} + +} // namespace autofill \ No newline at end of file
diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index d18b04c..3d06880 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h
@@ -230,6 +230,10 @@ bool field_is_autofilled, const std::vector<ServerFieldType>& other_field_types); + // Tries to delete disused addresses once per major version if the + // feature is enabled. + bool DeleteDisusedAddresses(); + // Returns the credit cards to suggest to the user. Those have been deduped // and ordered by frecency with the expired cards put at the end of the // vector. @@ -529,6 +533,10 @@ const base::string16& field_contents, const std::vector<CreditCard*>& cards_to_suggest) const; + // Returns true if the given credit card can be deleted in a major version + // upgrade. The card will need to be local and disused, to be deletable. + bool IsCreditCardDeletable(CreditCard* card); + // Runs the Autofill use date fix routine if it's never been done. Returns // whether the routine was run. void ApplyProfileUseDatesFix(); @@ -594,6 +602,20 @@ const AutofillProfile& server_address, std::vector<AutofillProfile>* existing_profiles); + // Removes profile from web database according to |guid| and resets credit + // card's billing address if that address is used by any credit cards. + // The method does not refresh, this allows multiple removal with one + // refreshing in the end. + void RemoveAutofillProfileByGUIDAndBlankCreditCardReferecne( + const std::string& guid); + + // Returns true if an address can be deleted in a major version upgrade. + // An address is deletable if it is unverified, and not used by a valid + // credit card as billing address, and not used for a long time(13 months). + bool IsAddressDeletable( + AutofillProfile* profile, + const std::unordered_set<std::string>& used_billing_address_guids); + // If the AutofillCreateDataForTest feature is enabled, this helper creates // autofill address data that would otherwise be difficult to create // manually using the UI.
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 1066f0f..6c1dc816 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -259,6 +259,18 @@ EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); } + // Helper method to create a profile that was last used 400 days ago. + // This profile is supposed to be deleted during a major version upgrade. + void CreateDeletableDisusedProfile() { + AutofillProfile profile0(test::GetFullProfile()); + profile0.set_use_date(AutofillClock::Now() - + base::TimeDelta::FromDays(400)); + personal_data_->AddProfile(profile0); + + WaitForOnPersonalDataChanged(); + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); + } + // Helper methods that simply forward the call to the private member (to avoid // having to friend every test that needs to access the private // PersonalDataManager::ImportAddressProfile or ImportCreditCard). @@ -6283,6 +6295,132 @@ EXPECT_EQ(2U, personal_data_->GetProfiles().size()); } +// Tests that DeleteDisusedAddresses is not run if the feature is disabled. +TEST_F(PersonalDataManagerTest, DeleteDisusedAddresses_DoNothingWhenDisabled) { + // Make sure feature is disabled by default. + EXPECT_FALSE(base::FeatureList::IsEnabled(kAutofillDeleteDisusedAddresses)); + + CreateDeletableDisusedProfile(); + + // DeleteDisusedCreditCards should return false to indicate it was not run. + EXPECT_FALSE(personal_data_->DeleteDisusedAddresses()); + + personal_data_->Refresh(); + + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); +} + +// Tests that DeleteDisusedAddresses is not run a second time on the same +// major version. +TEST_F(PersonalDataManagerTest, DeleteDisusedAddresses_OncePerVersion) { + // Enable the feature. + base::test::ScopedFeatureList scoped_features; + scoped_features.InitAndEnableFeature(kAutofillDeleteDisusedAddresses); + + CreateDeletableDisusedProfile(); + + EXPECT_TRUE(personal_data_->DeleteDisusedAddresses()); + WaitForOnPersonalDataChanged(); + + EXPECT_EQ(0U, personal_data_->GetProfiles().size()); + + // Add the profile back. + CreateDeletableDisusedProfile(); + + // DeleteDisusedAddresses should return false to indicate it was not run. + EXPECT_FALSE(personal_data_->DeleteDisusedAddresses()); + + personal_data_->Refresh(); + + EXPECT_EQ(1U, personal_data_->GetProfiles().size()); +} + +// Tests that DeleteDisusedAddresses only deletes the addresses that are +// supposed to be deleted. +TEST_F(PersonalDataManagerTest, + DeleteDisusedAddresses_DeleteDesiredAddressesOnly) { + // Enable the feature. + base::test::ScopedFeatureList scoped_features; + scoped_features.InitAndEnableFeature(kAutofillDeleteDisusedAddresses); + + auto now = AutofillClock::Now(); + + // Create unverified/disused/not-used-by-valid-credit-card + // address(deletable). + AutofillProfile profile0(base::GenerateGUID(), "https://www.example.com"); + test::SetProfileInfo(&profile0, "Alice", "", "Delete", "", "ACME", + "1234 Evergreen Terrace", "Bld. 6", "Springfield", "IL", + "32801", "US", "15151231234"); + profile0.set_use_date(now - base::TimeDelta::FromDays(400)); + personal_data_->AddProfile(profile0); + + // Create unverified/disused/used-by-expired-credit-card address(deletable). + AutofillProfile profile1(base::GenerateGUID(), "https://www.example.com"); + test::SetProfileInfo(&profile1, "Bob", "", "Delete", "", "ACME", + "1234 Evergreen Terrace", "Bld. 7", "Springfield", "IL", + "32801", "US", "15151231234"); + profile1.set_use_date(now - base::TimeDelta::FromDays(400)); + CreditCard credit_card0(base::GenerateGUID(), "https://www.example.com"); + test::SetCreditCardInfo(&credit_card0, "Bob", + "5105105105105100" /* Mastercard */, "04", "1999", + "1"); + credit_card0.set_use_date(now - base::TimeDelta::FromDays(400)); + credit_card0.set_billing_address_id(profile1.guid()); + personal_data_->AddProfile(profile1); + personal_data_->AddCreditCard(credit_card0); + + // Create verified/disused/not-used-by-valid-credit-card address(not + // deletable). + AutofillProfile profile2(base::GenerateGUID(), "https://www.example.com"); + test::SetProfileInfo(&profile2, "Charlie", "", "Keep", "", "ACME", + "1234 Evergreen Terrace", "Bld. 8", "Springfield", "IL", + "32801", "US", "15151231234"); + profile2.set_origin(kSettingsOrigin); + profile2.set_use_date(now - base::TimeDelta::FromDays(400)); + personal_data_->AddProfile(profile2); + + // Create unverified/recently-used/not-used-by-valid-credit-card address(not + // deletable). + AutofillProfile profile3(base::GenerateGUID(), "https://www.example.com"); + test::SetProfileInfo(&profile3, "Dave", "", "Keep", "", "ACME", + "1234 Evergreen Terrace", "Bld. 9", "Springfield", "IL", + "32801", "US", "15151231234"); + profile3.set_use_date(now - base::TimeDelta::FromDays(4)); + personal_data_->AddProfile(profile3); + + // Create unverified/disused/used-by-valid-credit-card address(not deletable). + AutofillProfile profile4(base::GenerateGUID(), "https://www.example.com"); + test::SetProfileInfo(&profile4, "Emma", "", "Keep", "", "ACME", + "1234 Evergreen Terrace", "Bld. 10", "Springfield", "IL", + "32801", "US", "15151231234"); + profile4.set_use_date(now - base::TimeDelta::FromDays(400)); + CreditCard credit_card1(CreditCard::MASKED_SERVER_CARD, "c987"); + test::SetCreditCardInfo(&credit_card1, "Emma", "6543", "01", "2999", "1"); + credit_card1.SetNetworkForMaskedCard(kVisaCard); + credit_card1.set_billing_address_id(profile4.guid()); + credit_card1.set_use_date(now - base::TimeDelta::FromDays(1)); + personal_data_->AddProfile(profile4); + personal_data_->AddCreditCard(credit_card1); + + WaitForOnPersonalDataChanged(); + + EXPECT_EQ(5U, personal_data_->GetProfiles().size()); + EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); + + // DeleteDisusedAddresses should return true. + EXPECT_TRUE(personal_data_->DeleteDisusedAddresses()); + WaitForOnPersonalDataChanged(); + + EXPECT_EQ(3U, personal_data_->GetProfiles().size()); + EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); + EXPECT_EQ(base::UTF8ToUTF16("Keep"), + personal_data_->GetProfiles()[0]->GetRawInfo(NAME_LAST)); + EXPECT_EQ(base::UTF8ToUTF16("Keep"), + personal_data_->GetProfiles()[1]->GetRawInfo(NAME_LAST)); + EXPECT_EQ(base::UTF8ToUTF16("Keep"), + personal_data_->GetProfiles()[2]->GetRawInfo(NAME_LAST)); +} + // Tests that DeleteDisusedCreditCards is not run if the feature is disabled. TEST_F(PersonalDataManagerTest, DeleteDisusedCreditCards_DoNothingWhenDisabled) { @@ -7431,7 +7569,7 @@ const std::vector<AutofillProfile*> addresses = personal_data_->GetProfiles(); const std::vector<CreditCard*> credit_cards = personal_data_->GetCreditCards(); - ASSERT_EQ(2U, addresses.size()); + ASSERT_EQ(3U, addresses.size()); ASSERT_EQ(3U, credit_cards.size()); const base::Time disused_threshold = @@ -7461,6 +7599,18 @@ EXPECT_LT((*it)->use_date(), disused_threshold); } + // Verify that there was a disused deletable address created. + { + auto it = std::find_if( + addresses.begin(), addresses.end(), [this](const AutofillProfile* p) { + return p->GetInfo(NAME_FULL, this->personal_data_->app_locale()) == + base::UTF8ToUTF16("Polly Deletable"); + }); + ASSERT_TRUE(it != addresses.end()); + EXPECT_LT((*it)->use_date(), deletion_threshold); + EXPECT_FALSE((*it)->IsVerified()); + } + // Verify that there was a valid credit card created. { auto it = std::find_if(
diff --git a/components/autofill/core/common/autofill_pref_names.cc b/components/autofill/core/common/autofill_pref_names.cc index 2361815..4f52b45 100644 --- a/components/autofill/core/common/autofill_pref_names.cc +++ b/components/autofill/core/common/autofill_pref_names.cc
@@ -26,6 +26,11 @@ // was run. This routine will be run once per version. const char kAutofillLastVersionDeduped[] = "autofill.last_version_deduped"; +// Integer that is set to the last version where disused addresses were +// deleted. This deletion will be run once per version. +const char kAutofillLastVersionDisusedAddressesDeleted[] = + "autofill.last_version_disused_addresses_deleted"; + // Integer that is set to the last version where disused credit cards were // deleted. This deletion will be run once per version. const char kAutofillLastVersionDisusedCreditCardsDeleted[] =
diff --git a/components/autofill/core/common/autofill_pref_names.h b/components/autofill/core/common/autofill_pref_names.h index 658dab4..692a9bd 100644 --- a/components/autofill/core/common/autofill_pref_names.h +++ b/components/autofill/core/common/autofill_pref_names.h
@@ -14,9 +14,10 @@ extern const char kAutofillAcceptSaveCreditCardPromptState[]; extern const char kAutofillCreditCardSigninPromoImpressionCount[]; extern const char kAutofillEnabled[]; -extern const char kAutofillProfileUseDatesFixed[]; extern const char kAutofillLastVersionDeduped[]; +extern const char kAutofillLastVersionDisusedAddressesDeleted[]; extern const char kAutofillLastVersionDisusedCreditCardsDeleted[]; +extern const char kAutofillProfileUseDatesFixed[]; extern const char kAutofillWalletImportEnabled[]; extern const char kAutofillWalletImportStorageCheckboxState[];
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/MetricsTestUtil.java b/components/cronet/android/test/javatests/src/org/chromium/net/MetricsTestUtil.java index c47476f..0492390 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/MetricsTestUtil.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/MetricsTestUtil.java
@@ -164,7 +164,7 @@ RequestFinishedInfo.Metrics metrics = info.getMetrics(); assertNotNull("RequestFinishedInfo.getMetrics() must not be null", metrics); // Check old (deprecated) timing metrics - assertTrue(metrics.getTotalTimeMs() > 0); + assertTrue(metrics.getTotalTimeMs() >= 0); assertTrue(metrics.getTotalTimeMs() >= metrics.getTtfbMs()); // Check new timing metrics checkTimingMetrics(metrics, startTime, endTime);
diff --git a/components/exo/notification_surface.cc b/components/exo/notification_surface.cc index 73f7735..dcc4fecb 100644 --- a/components/exo/notification_surface.cc +++ b/components/exo/notification_surface.cc
@@ -35,6 +35,7 @@ void NotificationSurface::OnSurfaceCommit() { SurfaceTreeHost::OnSurfaceCommit(); + SubmitCompositorFrame(); gfx::Rect bounds = host_window()->bounds(); auto& size = host_window()->bounds().size();
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc index 9819e07..d37859d0 100644 --- a/components/exo/pointer.cc +++ b/components/exo/pointer.cc
@@ -156,6 +156,7 @@ void Pointer::OnSurfaceCommit() { SurfaceTreeHost::OnSurfaceCommit(); + SubmitCompositorFrame(); // Capture new cursor to reflect result of commit. if (focus_surface_)
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 15da1b1..2a377b5 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -370,6 +370,9 @@ DCHECK(!scoped_configure_); if (resizer_) EndDrag(false /* revert */); + // Remove activation observer before hiding widget to prevent it from + // casuing the configure callback to be called. + WMHelper::GetInstance()->RemoveActivationObserver(this); if (widget_) { ash::wm::GetWindowState(widget_->GetNativeWindow())->RemoveObserver(this); widget_->GetNativeWindow()->RemoveObserver(this); @@ -380,7 +383,6 @@ widget_->Hide(); widget_->CloseNow(); } - WMHelper::GetInstance()->RemoveActivationObserver(this); WMHelper::GetInstance()->RemoveDisplayConfigurationObserver(this); display::Screen::GetScreen()->RemoveObserver(this); if (parent_) @@ -767,6 +769,18 @@ SurfaceTreeHost::OnSurfaceCommit(); + if (enabled() && !widget_) { + // Defer widget creation until surface contains some contents. + if (root_surface()->content_size().IsEmpty()) { + Configure(); + return; + } + + CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); + } + + SubmitCompositorFrame(); + // Apply the accumulated pending origin offset to reflect acknowledged // configure requests. origin_offset_ += pending_origin_offset_; @@ -843,19 +857,6 @@ } } -void ShellSurface::OnSurfaceContentSizeChanged() { - SurfaceTreeHost::OnSurfaceContentSizeChanged(); - if (enabled() && !widget_) { - // Defer widget creation until surface contains some contents. - if (root_surface()->content_size().IsEmpty()) { - Configure(); - return; - } - - CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); - } -} - void ShellSurface::OnSetFrame(SurfaceFrameType type) { // TODO(reveman): Allow frame to change after surface has been enabled. switch (type) {
diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h index 5e592376..71dc8ec2 100644 --- a/components/exo/shell_surface.h +++ b/components/exo/shell_surface.h
@@ -228,7 +228,6 @@ // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; - void OnSurfaceContentSizeChanged() override; void OnSetFrame(SurfaceFrameType type) override; // Overridden from SurfaceObserver:
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc index 38bd476..ed17c05 100644 --- a/components/exo/shell_surface_unittest.cc +++ b/components/exo/shell_surface_unittest.cc
@@ -548,6 +548,11 @@ base::Bind(&Configure, base::Unretained(&suggested_size), base::Unretained(&has_state_type), base::Unretained(&is_resizing), base::Unretained(&is_active))); + // Commit without contents should result in a configure callback with empty + // suggested size as a mechanims to ask the client size itself. + surface->Commit(); + EXPECT_EQ(gfx::Size(), suggested_size); + shell_surface->Maximize(); shell_surface->AcknowledgeConfigure(0); EXPECT_EQ(CurrentContext()->bounds().width(), suggested_size.width());
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index 7cf36be..b5a8c82 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -204,7 +204,6 @@ void SurfaceTreeHost::OnSurfaceCommit() { root_surface_->CommitSurfaceHierarchy(gfx::Point(), &frame_callbacks_, &presentation_callbacks_); - SubmitCompositorFrame(); } void SurfaceTreeHost::OnSurfaceContentSizeChanged() { @@ -293,6 +292,9 @@ SubmitCompositorFrame(); } +//////////////////////////////////////////////////////////////////////////////// +// SurfaceTreeHost, protected: + void SurfaceTreeHost::SubmitCompositorFrame() { DCHECK(root_surface_); viz::CompositorFrame frame;
diff --git a/components/exo/surface_tree_host.h b/components/exo/surface_tree_host.h index 437a05d..fdc47ce6 100644 --- a/components/exo/surface_tree_host.h +++ b/components/exo/surface_tree_host.h
@@ -104,9 +104,11 @@ // Overridden from ui::ContextFactoryObserver: void OnLostResources() override; - private: + protected: + // Call this to submit a compositor frame. void SubmitCompositorFrame(); + private: Surface* root_surface_ = nullptr; std::unique_ptr<aura::Window> host_window_; std::unique_ptr<LayerTreeFrameSinkHolder> layer_tree_frame_sink_holder_;
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc index 0e2877f..5f59196d 100644 --- a/components/exo/wayland/server.cc +++ b/components/exo/wayland/server.cc
@@ -30,8 +30,10 @@ #include <algorithm> #include <cstdlib> #include <iterator> +#include <map> #include <string> #include <utility> +#include <vector> #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/window_properties.h" @@ -90,6 +92,7 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_observer.h" #include "ui/wm/core/coordinate_conversion.h" +#include "ui/wm/core/window_animations.h" #if defined(USE_OZONE) #include <drm_fourcc.h> @@ -1147,7 +1150,7 @@ class WaylandPrimaryDisplayObserver : public display::DisplayObserver { public: - WaylandPrimaryDisplayObserver(wl_resource* output_resource) + explicit WaylandPrimaryDisplayObserver(wl_resource* output_resource) : output_resource_(output_resource) { display::Screen::GetScreen()->AddObserver(this); SendDisplayMetrics(); @@ -2089,8 +2092,12 @@ uint32_t type) { if (type == ZCR_REMOTE_SURFACE_V1_WINDOW_TYPE_SYSTEM_UI) { auto* widget = GetUserDataAs<ShellSurface>(resource)->GetWidget(); - if (widget) + if (widget) { widget->GetNativeWindow()->SetProperty(ash::kShowInOverviewKey, false); + + wm::SetWindowVisibilityAnimationType( + widget->GetNativeWindow(), wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); + } } } @@ -4302,7 +4309,8 @@ class WaylandExtendedKeyboardImpl : public KeyboardObserver { public: - WaylandExtendedKeyboardImpl(Keyboard* keyboard) : keyboard_(keyboard) { + explicit WaylandExtendedKeyboardImpl(Keyboard* keyboard) + : keyboard_(keyboard) { keyboard_->AddObserver(this); keyboard_->SetNeedKeyboardKeyAcks(true); }
diff --git a/components/filesystem/manifest.json b/components/filesystem/manifest.json index e44d8ed..1bc538a 100644 --- a/components/filesystem/manifest.json +++ b/components/filesystem/manifest.json
@@ -1,6 +1,7 @@ { "name": "filesystem", "display_name": "File System Service", + "sandbox_type": "none", "interface_provider_specs": { "service_manager:connector": { "provides": {
diff --git a/components/image_fetcher/ios/ios_image_decoder_impl.mm b/components/image_fetcher/ios/ios_image_decoder_impl.mm index 0b9bce1a..2e7ca0e 100644 --- a/components/image_fetcher/ios/ios_image_decoder_impl.mm +++ b/components/image_fetcher/ios/ios_image_decoder_impl.mm
@@ -93,10 +93,7 @@ // "Most likely" always returns 1x images. UIImage* ui_image = [UIImage imageWithData:image_data scale:1]; if (ui_image) { - // This constructor does not retain the image, but expects to take the - // ownership, therefore, |ui_image| is retained here, but not released - // afterwards. - gfx::Image gfx_image(ui_image, base::scoped_policy::RETAIN); + gfx::Image gfx_image(ui_image); callback.Run(gfx_image); return; }
diff --git a/components/leveldb/manifest.json b/components/leveldb/manifest.json index 616eea3..2b5c39a 100644 --- a/components/leveldb/manifest.json +++ b/components/leveldb/manifest.json
@@ -1,6 +1,7 @@ { "name": "leveldb", "display_name": "LevelDB Service", + "sandbox_type": "none", "interface_provider_specs": { "service_manager:connector": { "provides": {
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index e7e0679..d299387 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -16,15 +16,20 @@ #include "base/strings/string_util.h" #include "base/sys_info.h" #include "base/time/time.h" -#include "build/build_config.h" #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/browser/omnibox_switches.h" #include "components/omnibox/browser/url_index_private_data.h" +#include "components/prefs/pref_service.h" #include "components/search/search.h" #include "components/variations/active_field_trials.h" #include "components/variations/metrics_util.h" #include "components/variations/variations_associated_data.h" +#if defined(OS_ANDROID) +#include "components/omnibox/browser/omnibox_pref_names.h" +#include "components/pref_registry/pref_registry_syncable.h" +#endif + using metrics::OmniboxEventProto; namespace omnibox { @@ -70,6 +75,12 @@ const base::Feature kAndroidFakeboxDemotionOnPhones{ "OmniboxAndroidFakeboxDemotionOnPhones", base::FEATURE_DISABLED_BY_DEFAULT}; +// Feature to enable personalized omnibox suggestions on focus when Android's +// Chrome Home feature is enabled. +const base::Feature kAndroidChromeHomePersonalizedSuggestions{ + "ChromeHomePersonalizedOmniboxSuggestions", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Feature to enable the search provider to send a request to the suggest // server on focus. This allows the suggest server to warm up, by, for // example, loading per-user models into memory. Having a per-user model @@ -244,6 +255,15 @@ return pow(2.0, -half_life_intervals); } +#if defined(OS_ANDROID) +// static +void OmniboxFieldTrial::RegisterProfilePrefs( + user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterBooleanPref(omnibox::kZeroSuggestChromeHomePersonalized, + false); +} +#endif + int OmniboxFieldTrial::GetDisabledProviderTypes() { const std::string& types_string = variations::GetVariationParamValue( kBundledExperimentFieldTrialName, @@ -287,14 +307,15 @@ #endif } -bool OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial() { - return InZeroSuggestMostVisitedWithoutSerpFieldTrial() || +bool OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(PrefService* prefs) { + return InZeroSuggestMostVisitedWithoutSerpFieldTrial(prefs) || variations::GetVariationParamValue( kBundledExperimentFieldTrialName, kZeroSuggestVariantRule) == "MostVisited"; } -bool OmniboxFieldTrial::InZeroSuggestMostVisitedWithoutSerpFieldTrial() { +bool OmniboxFieldTrial::InZeroSuggestMostVisitedWithoutSerpFieldTrial( + PrefService* prefs) { std::string variant(variations::GetVariationParamValue( kBundledExperimentFieldTrialName, kZeroSuggestVariantRule)); @@ -302,16 +323,29 @@ return true; #if defined(OS_ANDROID) // Android defaults to MostVisitedWithoutSERP - return variant.empty(); + if (variant.empty() && !InChromeHomePersonalizedZeroSuggest(prefs)) + return true; + + return false; #else return false; #endif } -bool OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() { - return variations::GetVariationParamValue( - kBundledExperimentFieldTrialName, - kZeroSuggestVariantRule) == "Personalized"; +bool OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + PrefService* prefs) { + std::string variant(variations::GetVariationParamValue( + kBundledExperimentFieldTrialName, kZeroSuggestVariantRule)); + if (variant == "Personalized") + return true; +#if defined(OS_ANDROID) + if (variant.empty() && InChromeHomePersonalizedZeroSuggest(prefs)) + return true; + + return false; +#else + return false; +#endif } // static @@ -858,3 +892,17 @@ it = params.find(rule + ":*:*"); return (it != params.end()) ? it->second : std::string(); } + +#if defined(OS_ANDROID) +// static +bool OmniboxFieldTrial::InChromeHomePersonalizedZeroSuggest( + PrefService* prefs) { + // Android's Java code sets a preference controlling whether personalized + // suggestions are enabled based on whether Chrome Home is enabled and + // whether the |kAndroidChromeHomePersonalizedSuggestions| feature is + // enabled. + return prefs->GetBoolean(omnibox::kZeroSuggestChromeHomePersonalized) && + base::FeatureList::IsEnabled( + omnibox::kAndroidChromeHomePersonalizedSuggestions); +} +#endif
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index be60b2e..e090a32 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -13,15 +13,24 @@ #include <vector> #include "base/macros.h" +#include "build/build_config.h" #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_match_type.h" +class PrefService; + namespace base { struct Feature; class TimeDelta; } +#if defined(OS_ANDROID) +namespace user_prefs { +class PrefRegistrySyncable; +} +#endif + namespace omnibox { extern const base::Feature kNewOmniboxAnswerTypes; @@ -30,6 +39,7 @@ extern const base::Feature kEnableClipboardProvider; extern const base::Feature kAndroidFakeboxDemotion; extern const base::Feature kAndroidFakeboxDemotionOnPhones; +extern const base::Feature kAndroidChromeHomePersonalizedSuggestions; extern const base::Feature kSearchProviderWarmUpOnFocus; extern const base::Feature kSearchProviderContextAllowHttpsUrls; extern const base::Feature kZeroSuggestRedirectToChrome; @@ -145,6 +155,10 @@ EMPHASIZE_NEVER = 3 }; +#if defined(OS_ANDROID) + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); +#endif + // --------------------------------------------------------- // For any experiment that's part of the bundled omnibox field trial. @@ -184,16 +198,16 @@ // Returns whether the user is in a ZeroSuggest field trial, which shows // most visited URLs. This is true for both "MostVisited" and // "MostVisitedWithoutSERP" trials. - static bool InZeroSuggestMostVisitedFieldTrial(); + static bool InZeroSuggestMostVisitedFieldTrial(PrefService* prefs); // Returns whether the user is in ZeroSuggest field trial showing most // visited URLs except it doesn't show suggestions on Google search result // pages. - static bool InZeroSuggestMostVisitedWithoutSerpFieldTrial(); + static bool InZeroSuggestMostVisitedWithoutSerpFieldTrial(PrefService* prefs); // Returns whether the user is in a ZeroSuggest field trial, but should // show recently searched-for queries instead. - static bool InZeroSuggestPersonalizedFieldTrial(); + static bool InZeroSuggestPersonalizedFieldTrial(PrefService* prefs); // --------------------------------------------------------- // For the Zero Suggest Redirect to Chrome field trial. @@ -519,6 +533,12 @@ const std::string& rule, metrics::OmniboxEventProto::PageClassification page_classification); +#if defined(OS_ANDROID) + // Checks whether Chrome Home personalized omnibox suggestions on focus are + // enabled. + static bool InChromeHomePersonalizedZeroSuggest(PrefService* pref); +#endif + DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); };
diff --git a/components/omnibox/browser/omnibox_field_trial_unittest.cc b/components/omnibox/browser/omnibox_field_trial_unittest.cc index eb4ce0c..06b1161 100644 --- a/components/omnibox/browser/omnibox_field_trial_unittest.cc +++ b/components/omnibox/browser/omnibox_field_trial_unittest.cc
@@ -13,19 +13,32 @@ #include "base/strings/string16.h" #include "build/build_config.h" #include "components/metrics/proto/omnibox_event.pb.h" +#include "components/prefs/testing_pref_service.h" #include "components/search/search.h" #include "components/variations/entropy_provider.h" #include "components/variations/variations_associated_data.h" #include "testing/gtest/include/gtest/gtest.h" +#if defined(OS_ANDROID) +#include "base/test/scoped_feature_list.h" +#include "components/omnibox/browser/omnibox_pref_names.h" +#include "components/prefs/pref_registry_simple.h" +#endif + using metrics::OmniboxEventProto; class OmniboxFieldTrialTest : public testing::Test { public: OmniboxFieldTrialTest() { ResetFieldTrialList(); +#if defined(OS_ANDROID) + pref_service_.registry()->RegisterBooleanPref( + omnibox::kZeroSuggestChromeHomePersonalized, false); +#endif } + PrefService* GetPrefs() { return &pref_service_; } + void ResetFieldTrialList() { // Destroy the existing FieldTrialList before creating a new one to avoid // a DCHECK. @@ -80,6 +93,7 @@ private: std::unique_ptr<base::FieldTrialList> field_trial_list_; + TestingPrefServiceSimple pref_service_; DISALLOW_COPY_AND_ASSIGN(OmniboxFieldTrialTest); }; @@ -215,9 +229,11 @@ OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestFieldTrial()); #if defined(OS_ANDROID) - EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); #else - EXPECT_FALSE(OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); #endif ResetFieldTrialList(); @@ -228,7 +244,8 @@ base::FieldTrialList::CreateFieldTrial( OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestFieldTrial()); - EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); ResetFieldTrialList(); params.erase(std::string(OmniboxFieldTrial::kZeroSuggestVariantRule)); @@ -238,11 +255,50 @@ OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params)); EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestFieldTrial()); #if defined(OS_ANDROID) - EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); #else - EXPECT_FALSE(OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); #endif } +#if defined(OS_ANDROID) + { + SCOPED_TRACE("Chrome Home personalized suggestions."); + ResetFieldTrialList(); + std::map<std::string, std::string> params; + params[std::string(OmniboxFieldTrial::kZeroSuggestRule)] = "true"; + ASSERT_TRUE(variations::AssociateVariationParams( + OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params)); + base::FieldTrialList::CreateFieldTrial( + OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); + EXPECT_TRUE(OmniboxFieldTrial::InZeroSuggestFieldTrial()); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(GetPrefs())); + + GetPrefs()->SetBoolean(omnibox::kZeroSuggestChromeHomePersonalized, true); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(GetPrefs())); + + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature( + omnibox::kAndroidChromeHomePersonalizedSuggestions); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(GetPrefs())); + + GetPrefs()->SetBoolean(omnibox::kZeroSuggestChromeHomePersonalized, false); + EXPECT_TRUE( + OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(GetPrefs())); + EXPECT_FALSE( + OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(GetPrefs())); + } +#endif } TEST_F(OmniboxFieldTrialTest, GetDemotionsByTypeWithFallback) {
diff --git a/components/omnibox/browser/omnibox_pref_names.cc b/components/omnibox/browser/omnibox_pref_names.cc index 3d3a5495..fd2d2fd 100644 --- a/components/omnibox/browser/omnibox_pref_names.cc +++ b/components/omnibox/browser/omnibox_pref_names.cc
@@ -9,4 +9,9 @@ // A cache of zero suggest results using JSON serialized into a string. const char kZeroSuggestCachedResults[] = "zerosuggest.cachedresults"; +// Whether personalized omnibox suggestions on focus for Chrome Home are +// enabled. +const char kZeroSuggestChromeHomePersonalized[] = + "zerosuggest.chromehomepersonalized"; + } // namespace omnibox
diff --git a/components/omnibox/browser/omnibox_pref_names.h b/components/omnibox/browser/omnibox_pref_names.h index 46339d5..0e0745251 100644 --- a/components/omnibox/browser/omnibox_pref_names.h +++ b/components/omnibox/browser/omnibox_pref_names.h
@@ -11,6 +11,7 @@ // Keep alphabetized, and document each in the .cc file. extern const char kZeroSuggestCachedResults[]; +extern const char kZeroSuggestChromeHomePersonalized[]; } // namespace metrics
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc index 68ac5eb..e753e89 100644 --- a/components/omnibox/browser/zero_suggest_provider.cc +++ b/components/omnibox/browser/zero_suggest_provider.cc
@@ -150,8 +150,10 @@ bool can_attach_current_url = can_send_current_url && - !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() && - !OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(); + !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + client()->GetPrefs()) && + !OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial( + client()->GetPrefs()); if (!can_attach_current_url && !ShouldShowNonContextualZeroSuggest(input.current_url())) { @@ -165,7 +167,8 @@ // suggestions, if based on local browsing history. MaybeUseCachedSuggestions(); - if (OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()) { + if (OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial( + client()->GetPrefs())) { most_visited_urls_.clear(); scoped_refptr<history::TopSites> ts = client()->GetTopSites(); if (ts) { @@ -218,7 +221,8 @@ } void ZeroSuggestProvider::DeleteMatch(const AutocompleteMatch& match) { - if (OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) { + if (OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + client()->GetPrefs())) { // Remove the deleted match from the cache, so it is not shown to the user // again. Since we cannot remove just one result, blow away the cache. client()->GetPrefs()->SetString(omnibox::kZeroSuggestCachedResults, @@ -336,7 +340,8 @@ bool ZeroSuggestProvider::StoreSuggestionResponse( const std::string& json_data, const base::Value& parsed_data) { - if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() || + if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + client()->GetPrefs()) || json_data.empty()) return false; client()->GetPrefs()->SetString(omnibox::kZeroSuggestCachedResults, @@ -434,7 +439,8 @@ UMA_HISTOGRAM_COUNTS("ZeroSuggest.AllResults", num_results); // Show Most Visited results after ZeroSuggest response is received. - if (OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()) { + if (OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial( + client()->GetPrefs())) { if (!current_url_match_.destination_url.is_valid()) return; matches_.push_back(current_url_match_); @@ -499,8 +505,13 @@ // If we cannot send URLs, then only the MostVisited and Personalized // variations can be shown. - if (!OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial() && - !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) + // The const-cast allows the non-const AutocompleteProviderClient::GetPrefs() + // function to be called. OmniboxFieldTrial does not modify prefs, so the + // cast is safe in this application. + if (!OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial( + const_cast<AutocompleteProviderClient*>(client())->GetPrefs()) && + !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + const_cast<AutocompleteProviderClient*>(client())->GetPrefs())) return false; // Only show zero suggest for HTTP[S] pages. @@ -512,7 +523,8 @@ (current_page_url.scheme() != url::kHttpsScheme))) return false; - if (OmniboxFieldTrial::InZeroSuggestMostVisitedWithoutSerpFieldTrial() && + if (OmniboxFieldTrial::InZeroSuggestMostVisitedWithoutSerpFieldTrial( + const_cast<AutocompleteProviderClient*>(client())->GetPrefs()) && client() ->GetTemplateURLService() ->IsSearchResultsPageFromDefaultSearchProvider(current_page_url)) @@ -522,7 +534,8 @@ } void ZeroSuggestProvider::MaybeUseCachedSuggestions() { - if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) + if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial( + client()->GetPrefs())) return; std::string json_data =
diff --git a/components/policy/proto/device_management_backend.proto b/components/policy/proto/device_management_backend.proto index 1f09109..460c793 100644 --- a/components/policy/proto/device_management_backend.proto +++ b/components/policy/proto/device_management_backend.proto
@@ -270,6 +270,10 @@ // have the key which matches this hash string, that could indicate malicious // or out-of-date Chrome client. optional string verification_key_hash = 9; + + // Encoded information from a policy invalidation notification. This is opaque + // to the client and should be forwarded from the invalidation notification. + optional string policy_invalidation_info = 10; } // This message customizes how the device behaves when it is disabled by its @@ -445,6 +449,15 @@ // Used as the display domain when the primary domain gets renamed. This field // is present only for device policies. optional string display_domain = 25; + + // Invalidation key for devices. Clients register for messages using this key + // in order to receive notifications for device policy changes. + optional string policy_invalidation_key = 26; + + // Invalidation key for commands. Clients register for messages using this key + // in order to receive notifications that one or more commands are available + // for execution. + optional string command_invalidation_key = 27; } message PolicyFetchResponse {
diff --git a/components/safe_browsing/proto/csd.proto b/components/safe_browsing/proto/csd.proto index 38ff988..0d0a196b 100644 --- a/components/safe_browsing/proto/csd.proto +++ b/components/safe_browsing/proto/csd.proto
@@ -708,21 +708,6 @@ repeated ContainedFile contained_file = 5; } - message BlacklistLoadIncident { - optional string path = 1; - optional ClientDownloadRequest.Digests digest = 2; - optional string version = 3; - optional bool blacklist_initialized = 4; - optional ClientDownloadRequest.SignatureInfo signature = 5; - optional ClientDownloadRequest.ImageHeaders image_headers = 6; - } - - message OmniboxInteractionIncident { optional string origin = 1; } - - message VariationsSeedSignatureIncident { - optional string variations_seed_signature = 1; - } - message ResourceRequestIncident { enum Type { UNKNOWN = 0; @@ -733,25 +718,14 @@ optional Type type = 3 [default = UNKNOWN]; } - message SuspiciousModuleIncident { - optional string path = 1; - optional ClientDownloadRequest.Digests digest = 2; - optional string version = 3; - optional ClientDownloadRequest.SignatureInfo signature = 4; - optional ClientDownloadRequest.ImageHeaders image_headers = 5; - } - optional int64 incident_time_msec = 1; optional TrackedPreferenceIncident tracked_preference = 2; optional BinaryIntegrityIncident binary_integrity = 3; - optional BlacklistLoadIncident DEPRECATED_blacklist_load = 4 - [deprecated = true]; - optional OmniboxInteractionIncident DEPRECATED_omnibox_interaction = 5 - [deprecated = true]; - optional VariationsSeedSignatureIncident variations_seed_signature = 6; + // Note: skip tag 4,5,6 because they were previously used. + reserved 4 to 6; optional ResourceRequestIncident resource_request = 7; - optional SuspiciousModuleIncident DEPRECATED_suspicious_module = 8 - [deprecated = true]; + // Note: skip tag 8 because it was previously used. + reserved 8; } repeated IncidentData incident = 1;
diff --git a/components/safe_browsing/triggers/ad_sampler_trigger.cc b/components/safe_browsing/triggers/ad_sampler_trigger.cc index a8abe44..c73dadc 100644 --- a/components/safe_browsing/triggers/ad_sampler_trigger.cc +++ b/components/safe_browsing/triggers/ad_sampler_trigger.cc
@@ -4,6 +4,8 @@ #include "components/safe_browsing/triggers/ad_sampler_trigger.h" +#include <string> + #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" @@ -145,7 +147,7 @@ resource.threat_type = SB_THREAT_TYPE_AD_SAMPLE; resource.url = web_contents()->GetURL(); resource.web_contents_getter = resource.GetWebContentsGetter( - web_contents()->GetRenderProcessHost()->GetID(), + web_contents()->GetMainFrame()->GetProcess()->GetID(), web_contents()->GetMainFrame()->GetRoutingID()); if (!trigger_manager_->StartCollectingThreatDetails(
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index 54dbae5..532ebd1 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -2200,7 +2200,9 @@ // Remove the entry from the local data so it isn't pushed up to Sync. local_data->erase(guid); } - } else { + // prepopulate_id 0 effectively means unspecified; i.e. that the turl isn't + // a pre-populated one, so we want to ignore that case. + } else if (sync_turl->prepopulate_id() != 0) { // Check for a turl with a conflicting prepopulate_id. This detects the case // where the user changes a prepopulated engine's keyword on one client, // then begins syncing on another client. We want to reflect this keyword @@ -2315,6 +2317,7 @@ TemplateURL* TemplateURLService::FindPrepopulatedTemplateURL( int prepopulated_id) { + DCHECK(prepopulated_id); for (const auto& turl : template_urls_) { if (turl->prepopulate_id() == prepopulated_id) return turl.get();
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index 01b48fa..b352008 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc
@@ -703,11 +703,6 @@ local_state_->SetInteger(prefs::kVariationsFailedToFetchSeedStreak, 0); } -std::string VariationsService::GetInvalidVariationsSeedSignature() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return field_trial_creator_.seed_store().GetInvalidSignature(); -} - void VariationsService::GetClientFilterableStateForVersionCalledForTesting() { const base::Version current_version(version_info::GetVersionNumber()); if (!current_version.IsValid())
diff --git a/components/variations/service/variations_service.h b/components/variations/service/variations_service.h index 0ea096c..0883f579 100644 --- a/components/variations/service/variations_service.h +++ b/components/variations/service/variations_service.h
@@ -157,11 +157,6 @@ policy_pref_service_ = service; } - // Returns the invalid variations seed signature in base64 format, or an empty - // string if the signature was valid, missing, or if signature verification is - // disabled. - std::string GetInvalidVariationsSeedSignature() const; - // Exposed for testing. void GetClientFilterableStateForVersionCalledForTesting();
diff --git a/components/variations/variations_seed_store.cc b/components/variations/variations_seed_store.cc index 73cb6b4..299ab2f 100644 --- a/components/variations/variations_seed_store.cc +++ b/components/variations/variations_seed_store.cc
@@ -112,8 +112,6 @@ } bool VariationsSeedStore::LoadSeed(VariationsSeed* seed) { - invalid_base64_signature_.clear(); - #if defined(OS_ANDROID) if (!local_state_->HasPrefPath(prefs::kVariationsSeedSignature)) ImportFirstRunJavaSeed(); @@ -135,8 +133,6 @@ UMA_HISTOGRAM_ENUMERATION("Variations.LoadSeedSignature", result, VerifySignatureResult::ENUM_SIZE); if (result != VerifySignatureResult::VALID_SIGNATURE) { - // Record the invalid signature. - invalid_base64_signature_ = base64_signature; ClearPrefs(); RecordLoadSeedResult(LoadSeedResult::INVALID_SIGNATURE); return false; @@ -199,7 +195,6 @@ } // If the data is delta compressed, first decode it. - DCHECK(invalid_base64_signature_.empty()); RecordStoreSeedResult(StoreSeedResult::DELTA_COUNT); std::string existing_seed_data; @@ -252,10 +247,6 @@ server_date_fetched.ToInternalValue()); } -std::string VariationsSeedStore::GetInvalidSignature() const { - return invalid_base64_signature_; -} - // static void VariationsSeedStore::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterStringPref(prefs::kVariationsCompressedSeed, std::string());
diff --git a/components/variations/variations_seed_store.h b/components/variations/variations_seed_store.h index b2406efc..d0c0a70 100644 --- a/components/variations/variations_seed_store.h +++ b/components/variations/variations_seed_store.h
@@ -64,10 +64,6 @@ return variations_serial_number_; } - // Returns the invalid signature in base64 format, or an empty string if the - // signature was valid, missing, or if signature verification is disabled. - std::string GetInvalidSignature() const; - // Registers Local State prefs used by this class. static void RegisterPrefs(PrefRegistrySimple* registry); @@ -118,9 +114,6 @@ // Cached serial number from the most recently fetched variations seed. std::string variations_serial_number_; - // Keeps track of an invalid signature. - std::string invalid_base64_signature_; - DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); };
diff --git a/components/variations/variations_seed_store_unittest.cc b/components/variations/variations_seed_store_unittest.cc index 9958c7c..2cd3edc 100644 --- a/components/variations/variations_seed_store_unittest.cc +++ b/components/variations/variations_seed_store_unittest.cc
@@ -137,71 +137,6 @@ EXPECT_FALSE(seed_store.LoadSeed(&loaded_seed)); } -TEST(VariationsSeedStoreTest, GetInvalidSignature) { - TestingPrefServiceSimple prefs; - VariationsSeedStore::RegisterPrefs(prefs.registry()); - - // The below seed and signature pair were generated using the server's - // private key. - const std::string uncompressed_base64_seed_data = - "CigxZDI5NDY0ZmIzZDc4ZmYxNTU2ZTViNTUxYzY0NDdjYmM3NGU1ZmQwEr0BCh9VTUEtVW5p" - "Zm9ybWl0eS1UcmlhbC0xMC1QZXJjZW50GICckqUFOAFCB2RlZmF1bHRKCwoHZGVmYXVsdBAB" - "SgwKCGdyb3VwXzAxEAFKDAoIZ3JvdXBfMDIQAUoMCghncm91cF8wMxABSgwKCGdyb3VwXzA0" - "EAFKDAoIZ3JvdXBfMDUQAUoMCghncm91cF8wNhABSgwKCGdyb3VwXzA3EAFKDAoIZ3JvdXBf" - "MDgQAUoMCghncm91cF8wORAB"; - const std::string base64_seed_signature = - "MEQCIDD1IVxjzWYncun+9IGzqYjZvqxxujQEayJULTlbTGA/AiAr0oVmEgVUQZBYq5VLOSvy" - "96JkMYgzTkHPwbv7K/CmgA=="; - const std::string base64_seed_signature_invalid = - "AEQCIDD1IVxjzWYncun+9IGzqYjZvqxxujQEayJULTlbTGA/AiAr0oVmEgVUQZBYq5VLOSvy" - "96JkMYgzTkHPwbv7K/CmgA=="; - - std::string uncompressed_seed_data; - ASSERT_TRUE(base::Base64Decode(uncompressed_base64_seed_data, - &uncompressed_seed_data)); - std::string compressed_base64_seed_data; - base::Base64Encode(Compress(uncompressed_seed_data), - &compressed_base64_seed_data); - - // Set seed and valid signature in prefs. - prefs.SetString(prefs::kVariationsCompressedSeed, - compressed_base64_seed_data); - prefs.SetString(prefs::kVariationsSeedSignature, base64_seed_signature); - - VariationsSeedStore seed_store(&prefs); - VariationsSeed loaded_seed; - EXPECT_TRUE(seed_store.LoadSeed(&loaded_seed)); - std::string invalid_signature = seed_store.GetInvalidSignature(); - // Valid signature so we get an empty string. - EXPECT_EQ(std::string(), invalid_signature); - - prefs.SetString(prefs::kVariationsSeedSignature, - base64_seed_signature_invalid); -#if defined(OS_IOS) || defined(OS_ANDROID) - EXPECT_TRUE(seed_store.LoadSeed(&loaded_seed)); -#else - EXPECT_FALSE(seed_store.LoadSeed(&loaded_seed)); -#endif - // Invalid signature, so we should get the signature itself, except on mobile - // where we should get an empty string because verification is not enabled. - invalid_signature = seed_store.GetInvalidSignature(); -#if defined(OS_IOS) || defined(OS_ANDROID) - EXPECT_EQ(std::string(), invalid_signature); -#else - EXPECT_EQ(base64_seed_signature_invalid, invalid_signature); -#endif - - prefs.SetString(prefs::kVariationsSeedSignature, std::string()); -#if defined(OS_IOS) || defined(OS_ANDROID) - EXPECT_TRUE(seed_store.LoadSeed(&loaded_seed)); -#else - EXPECT_FALSE(seed_store.LoadSeed(&loaded_seed)); -#endif - invalid_signature = seed_store.GetInvalidSignature(); - // Empty signature, not considered invalid. - EXPECT_EQ(std::string(), invalid_signature); -} - TEST(VariationsSeedStoreTest, StoreSeedData) { const VariationsSeed seed = CreateTestSeed(); const std::string serialized_seed = SerializeSeed(seed);
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn index 15cb98f..c9d8af50 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn
@@ -210,6 +210,7 @@ testonly = true sources = [ "display/bsp_tree_unittest.cc", + "display/copy_output_scaling_pixeltest.cc", "display/display_scheduler_unittest.cc", "display/display_unittest.cc", "display/draw_polygon_unittest.cc",
diff --git a/components/viz/service/display/copy_output_scaling_pixeltest.cc b/components/viz/service/display/copy_output_scaling_pixeltest.cc new file mode 100644 index 0000000..54c7693 --- /dev/null +++ b/components/viz/service/display/copy_output_scaling_pixeltest.cc
@@ -0,0 +1,209 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stdint.h> + +#include <memory> +#include <tuple> + +#include "base/bind.h" +#include "base/run_loop.h" +#include "cc/test/pixel_test.h" +#include "cc/test/pixel_test_utils.h" +#include "cc/test/render_pass_test_utils.h" +#include "components/viz/common/frame_sinks/copy_output_request.h" +#include "components/viz/common/frame_sinks/copy_output_result.h" +#include "components/viz/common/frame_sinks/copy_output_util.h" +#include "components/viz/common/quads/render_pass.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" + +namespace viz { +namespace { + +template <typename RendererType> +class CopyOutputScalingPixelTest + : public cc::RendererPixelTest<RendererType>, + public testing::WithParamInterface<std::tuple<int, int, int, int>> { + public: + // Include the public accessor method from the parent class. + using cc::RendererPixelTest<RendererType>::renderer; + + // This tests that copy requests requesting scaled results execute correctly. + // The test procedure creates a scene similar to the wall art that can be + // found in the stairwell of a certain Google office building: A white + // background" (W=white) and four blocks of different colors (r=red, g=green, + // b=blue, y=yellow). + // + // WWWWWWWWWWWWWWWWWWWWWWWW + // WWWWWWWWWWWWWWWWWWWWWWWW + // WWWWrrrrWWWWWWWWggggWWWW + // WWWWrrrrWWWWWWWWggggWWWW + // WWWWWWWWWWWWWWWWWWWWWWWW + // WWWWWWWWWWWWWWWWWWWWWWWW + // WWWWbbbbWWWWWWWWyyyyWWWW + // WWWWbbbbWWWWWWWWyyyyWWWW + // WWWWWWWWWWWWWWWWWWWWWWWW + // WWWWWWWWWWWWWWWWWWWWWWWW + // + // The scene is drawn, which also causes the copy request to execute. Then, + // the resulting bitmap is compared against an expected bitmap. + // + // TODO(crbug/760348): This is the same as in software_renderer_unittest.cc. + // It should be de-duped moved into a common location. + void RunTest() { + constexpr gfx::Size viewport_size = gfx::Size(24, 10); + constexpr int x_block = 4; + constexpr int y_block = 2; + constexpr SkColor smaller_pass_colors[4] = {SK_ColorRED, SK_ColorGREEN, + SK_ColorBLUE, SK_ColorYELLOW}; + constexpr SkColor root_pass_color = SK_ColorWHITE; + + // Test parameters: The scaling ratios for the copy requests. + const gfx::Vector2d scale_from(std::get<0>(GetParam()), + std::get<1>(GetParam())); + const gfx::Vector2d scale_to(std::get<2>(GetParam()), + std::get<3>(GetParam())); + + RenderPassList list; + + // Create the render passes drawn on top of the root render pass. + RenderPass* smaller_passes[4]; + gfx::Rect smaller_pass_rects[4]; + int pass_id = 5; + for (int i = 0; i < 4; ++i, --pass_id) { + smaller_pass_rects[i] = gfx::Rect( + i % 2 == 0 ? x_block : (viewport_size.width() - 2 * x_block), + i / 2 == 0 ? y_block : (viewport_size.height() - 2 * y_block), + x_block, y_block); + smaller_passes[i] = + AddRenderPass(&list, pass_id, smaller_pass_rects[i], gfx::Transform(), + cc::FilterOperations()); + cc::AddQuad(smaller_passes[i], smaller_pass_rects[i], + smaller_pass_colors[i]); + } + + // Create the root render pass and add all the child passes to it. + RenderPass* root_pass = + cc::AddRenderPass(&list, pass_id, gfx::Rect(viewport_size), + gfx::Transform(), cc::FilterOperations()); + for (int i = 0; i < 4; ++i) + cc::AddRenderPassQuad(root_pass, smaller_passes[i]); + cc::AddQuad(root_pass, gfx::Rect(viewport_size), root_pass_color); + + renderer()->DecideRenderPassAllocationsForFrame(list); + + // Make a copy request and execute it by drawing a frame. A subset of the + // viewport is requested, to test that scaled offsets are being computed + // correctly as well. + const gfx::Rect copy_rect(x_block, y_block, + viewport_size.width() - 2 * x_block, + viewport_size.height() - 2 * y_block); + std::unique_ptr<CopyOutputResult> result; + { + base::RunLoop loop; + std::unique_ptr<CopyOutputRequest> request(new CopyOutputRequest( + CopyOutputRequest::ResultFormat::RGBA_BITMAP, + base::BindOnce( + [](std::unique_ptr<CopyOutputResult>* test_result, + const base::Closure& quit_closure, + std::unique_ptr<CopyOutputResult> result_from_renderer) { + *test_result = std::move(result_from_renderer); + quit_closure.Run(); + }, + &result, loop.QuitClosure()))); + request->set_area(copy_rect); + request->SetScaleRatio(scale_from, scale_to); + list.back()->copy_requests.push_back(std::move(request)); + renderer()->DrawFrame(&list, 1.0f, viewport_size); + loop.Run(); + } + + // Check that the result succeeded and provides a bitmap of the expected + // size. + const gfx::Rect expected_result_rect = + copy_output::ComputeResultRect(copy_rect, scale_from, scale_to); + EXPECT_EQ(expected_result_rect, result->rect()); + const SkBitmap result_bitmap = result->AsSkBitmap(); + ASSERT_TRUE(result_bitmap.readyToDraw()); + ASSERT_EQ(expected_result_rect.width(), result_bitmap.width()); + ASSERT_EQ(expected_result_rect.height(), result_bitmap.height()); + + // Create the "expected result" bitmap. + SkBitmap expected_bitmap; + expected_bitmap.allocN32Pixels(expected_result_rect.width(), + expected_result_rect.height()); + expected_bitmap.eraseColor(root_pass_color); + for (int i = 0; i < 4; ++i) { + gfx::Rect rect = smaller_pass_rects[i] - copy_rect.OffsetFromOrigin(); + rect = copy_output::ComputeResultRect(rect, scale_from, scale_to); + expected_bitmap.erase( + smaller_pass_colors[i], + SkIRect{rect.x(), rect.y(), rect.right(), rect.bottom()}); + } + + // Do an approximate comparison of the result bitmap to the expected one to + // confirm the position and size of the color values in the result is + // correct. Allow for pixel values to be a bit off: The scaler algorithms + // are not using a naïve box filter, and so will blend things together at + // edge boundaries. + int num_bad_pixels = 0; + gfx::Point first_failure_position; + for (int y = 0; y < expected_bitmap.height(); ++y) { + for (int x = 0; x < expected_bitmap.width(); ++x) { + const SkColor expected = expected_bitmap.getColor(x, y); + const SkColor actual = result_bitmap.getColor(x, y); + const bool red_bad = + (SkColorGetR(expected) < 0x80) != (SkColorGetR(actual) < 0x80); + const bool green_bad = + (SkColorGetG(expected) < 0x80) != (SkColorGetG(actual) < 0x80); + const bool blue_bad = + (SkColorGetB(expected) < 0x80) != (SkColorGetB(actual) < 0x80); + const bool alpha_bad = + (SkColorGetA(expected) < 0x80) != (SkColorGetA(actual) < 0x80); + if (red_bad || green_bad || blue_bad || alpha_bad) { + if (num_bad_pixels == 0) + first_failure_position = gfx::Point(x, y); + ++num_bad_pixels; + } + } + } + EXPECT_EQ(0, num_bad_pixels) + << "First failure position at: " << first_failure_position.ToString() + << "\nExpected bitmap: " << cc::GetPNGDataUrl(expected_bitmap) + << "\nActual bitmap: " << cc::GetPNGDataUrl(result_bitmap); + } +}; + +// Parameters common to all test instantiations. These are tuples consisting of +// {scale_from_x, scale_from_y, scale_to_x, scale_to_y}. +const auto kParameters = testing::Values(std::make_tuple(1, 1, 1, 1), + std::make_tuple(1, 1, 2, 1), + std::make_tuple(1, 1, 3, 1), + std::make_tuple(1, 1, 1, 2), + std::make_tuple(1, 1, 1, 3), + std::make_tuple(2, 1, 1, 1), + std::make_tuple(1, 2, 1, 1), + std::make_tuple(2, 2, 1, 1)); + +using GLCopyOutputScalingPixelTest = CopyOutputScalingPixelTest<GLRenderer>; +// TODO(crbug/760348): To be enabled once GLRenderer impl lands. +TEST_P(GLCopyOutputScalingPixelTest, DISABLED_ScaledCopyOfDrawnFrame) { + RunTest(); +} +INSTANTIATE_TEST_CASE_P(, GLCopyOutputScalingPixelTest, kParameters); + +using SoftwareCopyOutputScalingPixelTest = + CopyOutputScalingPixelTest<SoftwareRenderer>; +TEST_P(SoftwareCopyOutputScalingPixelTest, ScaledCopyOfDrawnFrame) { + RunTest(); +} +INSTANTIATE_TEST_CASE_P(, SoftwareCopyOutputScalingPixelTest, kParameters); + +} // namespace +} // namespace viz
diff --git a/components/viz/service/display/software_renderer_unittest.cc b/components/viz/service/display/software_renderer_unittest.cc index c3c51e3..6ba715e 100644 --- a/components/viz/service/display/software_renderer_unittest.cc +++ b/components/viz/service/display/software_renderer_unittest.cc
@@ -19,7 +19,6 @@ #include "cc/test/test_shared_bitmap_manager.h" #include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_result.h" -#include "components/viz/common/frame_sinks/copy_output_util.h" #include "components/viz/common/quads/compositor_frame_metadata.h" #include "components/viz/common/quads/render_pass.h" #include "components/viz/common/quads/render_pass_draw_quad.h" @@ -450,160 +449,5 @@ EXPECT_EQ(gfx::RectF(2, 2, 3, 3), device->clip_rect_at_end()); } -class SoftwareRendererScaledCopyOutputTest - : public SoftwareRendererTest, - public testing::WithParamInterface<std::tuple<int, int, int, int>> {}; - -// This tests that copy requests requesting scaled results execute correctly. -// The test procedure creates a scene similar to the wall art that can be found -// in the stairwell of a certain Google office building: A white "background" -// (W=white) and four blocks of different colors (r=red, g=green, b=blue, -// y=yellow). -// -// WWWWWWWWWWWWWWWWWWWWWWWW -// WWWWWWWWWWWWWWWWWWWWWWWW -// WWWWrrrrWWWWWWWWggggWWWW -// WWWWrrrrWWWWWWWWggggWWWW -// WWWWWWWWWWWWWWWWWWWWWWWW -// WWWWWWWWWWWWWWWWWWWWWWWW -// WWWWbbbbWWWWWWWWyyyyWWWW -// WWWWbbbbWWWWWWWWyyyyWWWW -// WWWWWWWWWWWWWWWWWWWWWWWW -// WWWWWWWWWWWWWWWWWWWWWWWW -// -// The scene is drawn, which also causes the copy request to execute. Then, the -// resulting bitmap is compared against an expected bitmap. -TEST_P(SoftwareRendererScaledCopyOutputTest, ScaledCopyOfDrawnFrame) { - constexpr gfx::Size viewport_size = gfx::Size(24, 10); - constexpr int x_block = 4; - constexpr int y_block = 2; - constexpr SkColor smaller_pass_colors[4] = {SK_ColorRED, SK_ColorGREEN, - SK_ColorBLUE, SK_ColorYELLOW}; - constexpr SkColor root_pass_color = SK_ColorWHITE; - - // Test parameters: The scaling ratios for the copy requests. - const gfx::Vector2d scale_from(std::get<0>(GetParam()), - std::get<1>(GetParam())); - const gfx::Vector2d scale_to(std::get<2>(GetParam()), - std::get<3>(GetParam())); - - InitializeRenderer(base::WrapUnique(new SoftwareOutputDevice)); - RenderPassList list; - - // Create the render passes drawn on top of the root render pass. - RenderPass* smaller_passes[4]; - gfx::Rect smaller_pass_rects[4]; - int pass_id = 5; - for (int i = 0; i < 4; ++i, --pass_id) { - smaller_pass_rects[i] = - gfx::Rect(i % 2 == 0 ? x_block : (viewport_size.width() - 2 * x_block), - i / 2 == 0 ? y_block : (viewport_size.height() - 2 * y_block), - x_block, y_block); - smaller_passes[i] = AddRenderPass(&list, pass_id, smaller_pass_rects[i], - gfx::Transform(), cc::FilterOperations()); - cc::AddQuad(smaller_passes[i], smaller_pass_rects[i], - smaller_pass_colors[i]); - } - - // Create the root render pass and add all the child passes to it. - RenderPass* root_pass = - cc::AddRenderPass(&list, pass_id, gfx::Rect(viewport_size), - gfx::Transform(), cc::FilterOperations()); - for (int i = 0; i < 4; ++i) - cc::AddRenderPassQuad(root_pass, smaller_passes[i]); - cc::AddQuad(root_pass, gfx::Rect(viewport_size), root_pass_color); - - renderer()->DecideRenderPassAllocationsForFrame(list); - - // Make a copy request and execute it by drawing a frame. A subset of the - // viewport is requested, to test that scaled offsets are being computed - // correctly as well. - const gfx::Rect copy_rect(x_block, y_block, - viewport_size.width() - 2 * x_block, - viewport_size.height() - 2 * y_block); - std::unique_ptr<CopyOutputResult> result; - { - base::RunLoop loop; - std::unique_ptr<CopyOutputRequest> request(new CopyOutputRequest( - CopyOutputRequest::ResultFormat::RGBA_BITMAP, - base::BindOnce( - [](std::unique_ptr<CopyOutputResult>* test_result, - const base::Closure& quit_closure, - std::unique_ptr<CopyOutputResult> result_from_renderer) { - *test_result = std::move(result_from_renderer); - quit_closure.Run(); - }, - &result, loop.QuitClosure()))); - request->set_area(copy_rect); - request->SetScaleRatio(scale_from, scale_to); - list.back()->copy_requests.push_back(std::move(request)); - renderer()->DrawFrame(&list, 1.0f, viewport_size); - loop.Run(); - } - - // Check that the result succeeded and provides a bitmap of the expected size. - const gfx::Rect expected_result_rect = - copy_output::ComputeResultRect(copy_rect, scale_from, scale_to); - EXPECT_EQ(expected_result_rect, result->rect()); - const SkBitmap result_bitmap = result->AsSkBitmap(); - ASSERT_TRUE(result_bitmap.readyToDraw()); - ASSERT_EQ(expected_result_rect.width(), result_bitmap.width()); - ASSERT_EQ(expected_result_rect.height(), result_bitmap.height()); - - // Create the "expected result" bitmap. - SkBitmap expected_bitmap; - expected_bitmap.allocN32Pixels(expected_result_rect.width(), - expected_result_rect.height()); - expected_bitmap.eraseColor(root_pass_color); - for (int i = 0; i < 4; ++i) { - gfx::Rect rect = smaller_pass_rects[i] - copy_rect.OffsetFromOrigin(); - rect = copy_output::ComputeResultRect(rect, scale_from, scale_to); - expected_bitmap.erase( - smaller_pass_colors[i], - SkIRect{rect.x(), rect.y(), rect.right(), rect.bottom()}); - } - - // Do an approximate comparison of the result bitmap to the expected one to - // confirm the position and size of the color values in the result is correct. - // Allow for pixel values to be a bit off: The scaler algorithms are not using - // a naïve box filter, and so will blend things together at edge boundaries. - int num_bad_pixels = 0; - gfx::Point first_failure_position; - for (int y = 0; y < expected_bitmap.height(); ++y) { - for (int x = 0; x < expected_bitmap.width(); ++x) { - const SkColor expected = expected_bitmap.getColor(x, y); - const SkColor actual = result_bitmap.getColor(x, y); - const bool red_bad = - (SkColorGetR(expected) < 0x80) != (SkColorGetR(actual) < 0x80); - const bool green_bad = - (SkColorGetG(expected) < 0x80) != (SkColorGetG(actual) < 0x80); - const bool blue_bad = - (SkColorGetB(expected) < 0x80) != (SkColorGetB(actual) < 0x80); - const bool alpha_bad = - (SkColorGetA(expected) < 0x80) != (SkColorGetA(actual) < 0x80); - if (red_bad || green_bad || blue_bad || alpha_bad) { - if (num_bad_pixels == 0) - first_failure_position = gfx::Point(x, y); - ++num_bad_pixels; - } - } - } - EXPECT_EQ(0, num_bad_pixels) - << "First failure position at: " << first_failure_position.ToString() - << "\nExpected bitmap: " << cc::GetPNGDataUrl(expected_bitmap) - << "\nActual bitmap: " << cc::GetPNGDataUrl(result_bitmap); -} - -INSTANTIATE_TEST_CASE_P(, - SoftwareRendererScaledCopyOutputTest, - ::testing::Values(std::make_tuple(1, 1, 1, 1), - std::make_tuple(1, 1, 2, 1), - std::make_tuple(1, 1, 3, 1), - std::make_tuple(1, 1, 1, 2), - std::make_tuple(1, 1, 1, 3), - std::make_tuple(2, 1, 1, 1), - std::make_tuple(1, 2, 1, 1), - std::make_tuple(2, 2, 1, 1))); - } // namespace } // namespace viz
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 082b55f0..99c8db7c 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc
@@ -184,44 +184,56 @@ #endif // OS #if !defined(CHROME_MULTIPLE_DLL_BROWSER) gin::V8Initializer::LoadV8ContextSnapshot(); -#endif // !CHROME_MULTIPLE_DLL_BROWSER +#endif } -void InitializeV8IfNeeded( - const base::CommandLine& command_line, - const std::string& process_type) { - if (process_type == switches::kGpuProcess) - return; - +void LoadV8SnapshotFile() { #if defined(V8_USE_EXTERNAL_STARTUP_DATA) #if defined(OS_POSIX) && !defined(OS_MACOSX) base::FileDescriptorStore& file_descriptor_store = base::FileDescriptorStore::GetInstance(); base::MemoryMappedFile::Region region; - base::ScopedFD v8_snapshot_fd = + base::ScopedFD fd = file_descriptor_store.MaybeTakeFD(kV8SnapshotDataDescriptor, ®ion); - if (v8_snapshot_fd.is_valid()) { - gin::V8Initializer::LoadV8SnapshotFromFD(v8_snapshot_fd.get(), - region.offset, region.size); - } else { - gin::V8Initializer::LoadV8Snapshot(); + if (fd.is_valid()) { + gin::V8Initializer::LoadV8SnapshotFromFD(fd.get(), region.offset, + region.size); + return; } - base::ScopedFD v8_natives_fd = - file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); - if (v8_natives_fd.is_valid()) { - gin::V8Initializer::LoadV8NativesFromFD(v8_natives_fd.get(), region.offset, - region.size); - } else { - gin::V8Initializer::LoadV8Natives(); - } -#else +#endif // OS_POSIX && !OS_MACOSX #if !defined(CHROME_MULTIPLE_DLL_BROWSER) gin::V8Initializer::LoadV8Snapshot(); - gin::V8Initializer::LoadV8Natives(); -#endif // !CHROME_MULTIPLE_DLL_BROWSER -#endif // OS_POSIX && !OS_MACOSX +#endif #endif // V8_USE_EXTERNAL_STARTUP_DATA +} +void LoadV8NativesFile() { +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) +#if defined(OS_POSIX) && !defined(OS_MACOSX) + base::FileDescriptorStore& file_descriptor_store = + base::FileDescriptorStore::GetInstance(); + base::MemoryMappedFile::Region region; + base::ScopedFD fd = + file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion); + if (fd.is_valid()) { + gin::V8Initializer::LoadV8NativesFromFD(fd.get(), region.offset, + region.size); + return; + } +#endif // OS_POSIX && !OS_MACOSX +#if !defined(CHROME_MULTIPLE_DLL_BROWSER) + gin::V8Initializer::LoadV8Natives(); +#endif +#endif // V8_USE_EXTERNAL_STARTUP_DATA +} + +void InitializeV8IfNeeded(const base::CommandLine& command_line, + const std::string& process_type) { + if (process_type == switches::kGpuProcess) + return; + + LoadV8SnapshotFile(); + LoadV8NativesFile(); LoadV8ContextSnapshotFile(); }
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc index e6f4daf..20a46b14 100644 --- a/content/browser/background_fetch/background_fetch_context.cc +++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -85,7 +85,7 @@ registration.id = registration_id.id(); registration.icons = options.icons; registration.title = options.title; - registration.total_download_size = options.total_download_size; + registration.download_total = options.download_total; std::move(callback).Run(blink::mojom::BackgroundFetchError::NONE, registration);
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc index a52f41a..6660863a 100644 --- a/content/browser/background_fetch/background_fetch_data_manager.cc +++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -568,7 +568,7 @@ registration.id = iter->first.id(); registration.icons = options.icons; registration.title = options.title; - registration.total_download_size = options.total_download_size; + registration.download_total = options.download_total; std::move(callback).Run(blink::mojom::BackgroundFetchError::NONE, registration);
diff --git a/content/browser/background_fetch/background_fetch_service_unittest.cc b/content/browser/background_fetch/background_fetch_service_unittest.cc index 4335b75..0d59b9a 100644 --- a/content/browser/background_fetch/background_fetch_service_unittest.cc +++ b/content/browser/background_fetch/background_fetch_service_unittest.cc
@@ -243,7 +243,7 @@ options.icons.push_back(CreateIcon("funny_cat.png", "256x256", "image/png")); options.icons.push_back(CreateIcon("silly_cat.gif", "512x512", "image/gif")); options.title = "My Background Fetch!"; - options.total_download_size = 9001; + options.download_total = 9001; blink::mojom::BackgroundFetchError error; BackgroundFetchRegistration registration; @@ -262,7 +262,7 @@ } EXPECT_EQ(registration.title, options.title); - EXPECT_EQ(registration.total_download_size, options.total_download_size); + EXPECT_EQ(registration.download_total, options.download_total); blink::mojom::BackgroundFetchError second_error; BackgroundFetchRegistration second_registration; @@ -281,8 +281,7 @@ } EXPECT_EQ(second_registration.title, options.title); - EXPECT_EQ(second_registration.total_download_size, - options.total_download_size); + EXPECT_EQ(second_registration.download_total, options.download_total); } TEST_F(BackgroundFetchServiceTest, FetchDuplicatedRegistrationFailure) {
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 9733148..277409c 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -155,6 +155,13 @@ if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context)) headers->SetHeaderIfMissing("Save-Data", "on"); + // Attach additional request headers specified by embedder. + std::unique_ptr<net::HttpRequestHeaders> embedder_additional_headers = + GetContentClient()->browser()->GetAdditionalNavigationRequestHeaders( + browser_context, url); + if (embedder_additional_headers) + headers->MergeFrom(*(embedder_additional_headers.get())); + headers->SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, user_agent_override.empty() ? GetContentClient()->GetUserAgent()
diff --git a/content/browser/media/cdm_registry_impl_unittest.cc b/content/browser/media/cdm_registry_impl_unittest.cc index 066d5bd..260a9678 100644 --- a/content/browser/media/cdm_registry_impl_unittest.cc +++ b/content/browser/media/cdm_registry_impl_unittest.cc
@@ -19,8 +19,7 @@ namespace content { -const char kTestCdmType[] = "Test CDM"; -const char kTestCdmGuid[] = "62FE9C4B-384E-48FD-B28A-9F6F248BC8CC"; +const char kTestCdmType[] = "test"; const char kTestPath[] = "/aa/bb"; const char kVersion1[] = "1.1.1.1"; const char kVersion2[] = "1.1.1.2"; @@ -45,10 +44,9 @@ const std::vector<std::string> codecs = base::SplitString(supported_codecs, kCodecDelimiter, base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - cdm_registry_.RegisterCdm( - CdmInfo(type, kTestCdmGuid, base::Version(version), - base::FilePath::FromUTF8Unsafe(path), codecs, - supported_key_system, supports_sub_key_systems)); + cdm_registry_.RegisterCdm(CdmInfo( + type, base::Version(version), base::FilePath::FromUTF8Unsafe(path), + codecs, supported_key_system, supports_sub_key_systems)); } bool IsRegistered(const std::string& type, const std::string& version) {
diff --git a/content/browser/media/media_interface_proxy.cc b/content/browser/media/media_interface_proxy.cc index 31ce607a..7505e28 100644 --- a/content/browser/media/media_interface_proxy.cc +++ b/content/browser/media/media_interface_proxy.cc
@@ -27,7 +27,6 @@ #endif #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#include "base/guid.h" #include "content/public/browser/cdm_registry.h" #include "content/public/common/cdm_info.h" #include "media/base/key_system_names.h" @@ -47,7 +46,7 @@ binding_.set_connection_error_handler(error_handler); - // |interface_factory_ptr_| and |cdm_interface_factory_map_| will be lazily + // |interface_factory_ptr_| and |cdm_interface_factory_ptr_| will be lazily // connected in GetMediaInterfaceFactory() and GetCdmInterfaceFactory(). } @@ -59,7 +58,7 @@ void MediaInterfaceProxy::CreateAudioDecoder( media::mojom::AudioDecoderRequest request) { DCHECK(thread_checker_.CalledOnValidThread()); - InterfaceFactory* factory = GetMediaInterfaceFactory(); + media::mojom::InterfaceFactory* factory = GetMediaInterfaceFactory(); if (factory) factory->CreateAudioDecoder(std::move(request)); } @@ -67,7 +66,7 @@ void MediaInterfaceProxy::CreateVideoDecoder( media::mojom::VideoDecoderRequest request) { DCHECK(thread_checker_.CalledOnValidThread()); - InterfaceFactory* factory = GetMediaInterfaceFactory(); + media::mojom::InterfaceFactory* factory = GetMediaInterfaceFactory(); if (factory) factory->CreateVideoDecoder(std::move(request)); } @@ -76,7 +75,7 @@ const std::string& audio_device_id, media::mojom::RendererRequest request) { DCHECK(thread_checker_.CalledOnValidThread()); - InterfaceFactory* factory = GetMediaInterfaceFactory(); + media::mojom::InterfaceFactory* factory = GetMediaInterfaceFactory(); if (factory) factory->CreateRenderer(audio_device_id, std::move(request)); } @@ -85,18 +84,48 @@ const std::string& key_system, media::mojom::ContentDecryptionModuleRequest request) { DCHECK(thread_checker_.CalledOnValidThread()); - - InterfaceFactory* factory = -#if !BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) - GetMediaInterfaceFactory(); -#else - GetCdmInterfaceFactory(key_system); -#endif - + media::mojom::InterfaceFactory* factory = GetCdmInterfaceFactory(key_system); if (factory) factory->CreateCdm(key_system, std::move(request)); } +media::mojom::InterfaceFactory* +MediaInterfaceProxy::GetMediaInterfaceFactory() { + DCHECK(thread_checker_.CalledOnValidThread()); + + if (!interface_factory_ptr_) + ConnectToMediaService(); + + return interface_factory_ptr_.get(); +} + +media::mojom::InterfaceFactory* MediaInterfaceProxy::GetCdmInterfaceFactory( + const std::string& key_system) { + DCHECK(thread_checker_.CalledOnValidThread()); +#if !BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) + return GetMediaInterfaceFactory(); +#else + if (!cdm_interface_factory_ptr_) + ConnectToCdmService(key_system); + + return cdm_interface_factory_ptr_.get(); +#endif +} + +void MediaInterfaceProxy::OnMediaServiceConnectionError() { + DVLOG(1) << __func__; + DCHECK(thread_checker_.CalledOnValidThread()); + + interface_factory_ptr_.reset(); +} + +void MediaInterfaceProxy::OnCdmServiceConnectionError() { + DVLOG(1) << __func__; + DCHECK(thread_checker_.CalledOnValidThread()); + + cdm_interface_factory_ptr_.reset(); +} + service_manager::mojom::InterfaceProviderPtr MediaInterfaceProxy::GetFrameServices() { // Register frame services. @@ -125,16 +154,6 @@ return interfaces; } -media::mojom::InterfaceFactory* -MediaInterfaceProxy::GetMediaInterfaceFactory() { - DCHECK(thread_checker_.CalledOnValidThread()); - - if (!interface_factory_ptr_) - ConnectToMediaService(); - - return interface_factory_ptr_.get(); -} - void MediaInterfaceProxy::ConnectToMediaService() { DVLOG(1) << __func__; DCHECK(!interface_factory_ptr_); @@ -154,18 +173,7 @@ base::Unretained(this))); } -void MediaInterfaceProxy::OnMediaServiceConnectionError() { - DVLOG(1) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - - interface_factory_ptr_.reset(); -} - -#if BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) - #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -// Returns CdmInfo registered for |key_system|. Returns null if no CdmInfo is -// registered for |key_system|, or if the CdmInfo registered is invalid. static std::unique_ptr<CdmInfo> GetCdmInfoForKeySystem( const std::string& key_system) { DVLOG(2) << __func__ << ": key_system = " << key_system; @@ -181,84 +189,45 @@ } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) -media::mojom::InterfaceFactory* MediaInterfaceProxy::GetCdmInterfaceFactory( - const std::string& key_system) { - DCHECK(thread_checker_.CalledOnValidThread()); - - // Set the CDM GUID to be the default user ID used when connecting to mojo - // services. This is needed when ENABLE_STANDALONE_CDM_SERVICE is true but - // ENABLE_LIBRARY_CDMS is false. - std::string cdm_guid = service_manager::mojom::kInheritUserID; - - base::FilePath cdm_path; +void MediaInterfaceProxy::ConnectToCdmService(const std::string& key_system) { + DVLOG(1) << __func__ << ": key_system = " << key_system; + DCHECK(!cdm_interface_factory_ptr_); #if BUILDFLAG(ENABLE_LIBRARY_CDMS) - std::unique_ptr<CdmInfo> cdm_info = GetCdmInfoForKeySystem(key_system); + // The |key_system| comes from the render process which we cannot fully trust. + // Handle failure cases gracefully! + auto cdm_info = GetCdmInfoForKeySystem(key_system); if (!cdm_info) { - NOTREACHED() << "No valid CdmInfo for " << key_system; - return nullptr; + NOTREACHED() << "Key system " << key_system << " not registered."; + return; } - if (cdm_info->path.empty()) { + base::FilePath cdm_path = cdm_info->path; + if (cdm_path.empty()) { NOTREACHED() << "CDM path for " << key_system << " is empty."; - return nullptr; + return; } - if (!base::IsValidGUID(cdm_info->guid)) { - NOTREACHED() << "Invalid CDM GUID " << cdm_info->guid; - return nullptr; - } - cdm_guid = cdm_info->guid; - cdm_path = cdm_info->path; #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - auto found = cdm_interface_factory_map_.find(cdm_guid); - if (found != cdm_interface_factory_map_.end()) - return found->second.get(); - - return ConnectToCdmService(cdm_guid, cdm_path); -} - -media::mojom::InterfaceFactory* MediaInterfaceProxy::ConnectToCdmService( - const std::string& cdm_guid, - const base::FilePath& cdm_path) { - DVLOG(1) << __func__ << ": cdm_guid = " << cdm_guid; - - DCHECK(!cdm_interface_factory_map_.count(cdm_guid)); - service_manager::Identity identity(media::mojom::kCdmServiceName, cdm_guid); - // TODO(slan): Use the BrowserContext Connector instead. See crbug.com/638950. service_manager::Connector* connector = ServiceManagerConnection::GetForProcess()->GetConnector(); + // TODO(crbug.com/510604): Use different "User ID" for different CDM types to + // run each type of CDM in its own process. media::mojom::MediaServicePtr media_service; - connector->BindInterface(identity, &media_service); + connector->BindInterface(media::mojom::kCdmServiceName, &media_service); #if BUILDFLAG(ENABLE_LIBRARY_CDMS) // LoadCdm() should always be called before CreateInterfaceFactory(). media_service->LoadCdm(cdm_path); #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - InterfaceFactoryPtr interface_factory_ptr; - media_service->CreateInterfaceFactory(MakeRequest(&interface_factory_ptr), - GetFrameServices()); - interface_factory_ptr.set_connection_error_handler( + media_service->CreateInterfaceFactory( + MakeRequest(&cdm_interface_factory_ptr_), GetFrameServices()); + + cdm_interface_factory_ptr_.set_connection_error_handler( base::BindOnce(&MediaInterfaceProxy::OnCdmServiceConnectionError, - base::Unretained(this), cdm_guid)); - - InterfaceFactory* cdm_interface_factory = interface_factory_ptr.get(); - cdm_interface_factory_map_.emplace(cdm_guid, - std::move(interface_factory_ptr)); - return cdm_interface_factory; + base::Unretained(this))); } -void MediaInterfaceProxy::OnCdmServiceConnectionError( - const std::string& cdm_guid) { - DVLOG(1) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - - DCHECK(cdm_interface_factory_map_.count(cdm_guid)); - cdm_interface_factory_map_.erase(cdm_guid); -} - -#endif // BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) - } // namespace content
diff --git a/content/browser/media/media_interface_proxy.h b/content/browser/media/media_interface_proxy.h index 431a3ba0..859fb07 100644 --- a/content/browser/media/media_interface_proxy.h +++ b/content/browser/media/media_interface_proxy.h
@@ -5,7 +5,6 @@ #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERFACE_PROXY_H_ #define CONTENT_BROWSER_MEDIA_MEDIA_INTERFACE_PROXY_H_ -#include <map> #include <memory> #include <vector> @@ -24,13 +23,9 @@ class RenderFrameHost; -// This implements the media::mojom::InterfaceFactory interface for a -// RenderFrameHostImpl. Upon InterfaceFactory calls, it will -// figure out where to forward to the interface requests. For example, -// - When |enable_standalone_cdm_service| is true, forward CDM request to a -// standalone CDM service rather than the general media service. -// - Forward CDM requests to different CDM service instances based on library -// CDM types. +// This implements the media::mojom::InterfaceFactory interface for +// RenderFrameHostImpl. Upon media::mojom::InterfaceFactory calls, it will +// figure out where to forward to the interface requests. class MediaInterfaceProxy : public media::mojom::InterfaceFactory { public: // Constructs MediaInterfaceProxy and bind |this| to the |request|. When @@ -50,59 +45,42 @@ media::mojom::ContentDecryptionModuleRequest request) final; private: - using InterfaceFactoryPtr = media::mojom::InterfaceFactoryPtr; + // Get the |interface_factory_ptr_|. Returns null if expected error happened. + media::mojom::InterfaceFactory* GetMediaInterfaceFactory(); - // Gets services provided by the browser (at RenderFrameHost level) to the - // mojo media (or CDM) service running remotely. + // Get the |cdm_interface_factory_ptr_|. Returns null if expected error + // happened. + media::mojom::InterfaceFactory* GetCdmInterfaceFactory( + const std::string& key_system); + + // Callback for connection error from |interface_factory_ptr_| or + // |cdm_interface_factory_ptr_|. + void OnMediaServiceConnectionError(); + void OnCdmServiceConnectionError(); + service_manager::mojom::InterfaceProviderPtr GetFrameServices(); - // Gets the MediaService |interface_factory_ptr_|. Returns null if unexpected - // error happened. - InterfaceFactory* GetMediaInterfaceFactory(); - void ConnectToMediaService(); - - // Callback for connection error from |interface_factory_ptr_|. - void OnMediaServiceConnectionError(); - -#if BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) - // Gets a CDM InterfaceFactory pointer for |key_system|. Returns null if - // unexpected error happened. - InterfaceFactory* GetCdmInterfaceFactory(const std::string& key_system); - - // Connects to the CDM service associated with |key_system|, adds the new - // InterfaceFactoryPtr to the |cdm_interface_factory_map_|, and returns the - // newly created InterfaceFactory pointer. Returns nullptr if unexpected error - // happened. - InterfaceFactory* ConnectToCdmService(const std::string& cdm_guid, - const base::FilePath& cdm_path); - - // Callback for connection error from the InterfaceFactoryPtr in the - // |cdm_interface_factory_map_| associated with |cdm_guid|. - void OnCdmServiceConnectionError(const std::string& cdm_guid); -#endif // BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) + void ConnectToCdmService(const std::string& key_system); // Safe to hold a raw pointer since |this| is owned by RenderFrameHostImpl. - RenderFrameHost* const render_frame_host_; - - // Binding for incoming InterfaceFactoryRequest from the the RenderFrameImpl. - mojo::Binding<InterfaceFactory> binding_; + RenderFrameHost* render_frame_host_; // TODO(xhwang): Replace InterfaceProvider with a dedicated host interface. // See http://crbug.com/660573 std::vector<std::unique_ptr<media::MediaInterfaceProvider>> media_registries_; - // InterfacePtr to the remote InterfaceFactory implementation + mojo::Binding<media::mojom::InterfaceFactory> binding_; + + // InterfacePtr to the remote media::mojom::InterfaceFactory implementation // in the service named kMediaServiceName hosted in the process specified by // the "mojo_media_host" gn argument. Available options are browser, GPU and // utility processes. - InterfaceFactoryPtr interface_factory_ptr_; + media::mojom::InterfaceFactoryPtr interface_factory_ptr_; -#if BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) - // CDM GUID to CDM InterfaceFactoryPtr mapping, where the InterfaceFactory - // instances live in the standalone kCdmServiceName service instances. - std::map<std::string, InterfaceFactoryPtr> cdm_interface_factory_map_; -#endif // BUILDFLAG(ENABLE_STANDALONE_CDM_SERVICE) + // InterfacePtr to the remote media::mojom::InterfaceFactory implementation + // in the service named kCdmServiceName hosted in the utility process. + media::mojom::InterfaceFactoryPtr cdm_interface_factory_ptr_; base::ThreadChecker thread_checker_;
diff --git a/content/browser/payments/payment_app_info_fetcher.cc b/content/browser/payments/payment_app_info_fetcher.cc index 8997449..6a3e0050 100644 --- a/content/browser/payments/payment_app_info_fetcher.cc +++ b/content/browser/payments/payment_app_info_fetcher.cc
@@ -16,17 +16,6 @@ namespace content { -namespace { - -// TODO(gogerald): Choose appropriate icon size dynamically on different -// platforms. -// Here we choose a large ideal icon size to be big enough for all platforms. -// Note that we only scale down for this icon size but not scale up. -const int kPaymentAppIdealIconSize = 0xFFFF; -const int kPaymentAppMinimumIconSize = 0; - -} // namespace - PaymentAppInfoFetcher::PaymentAppInfo::PaymentAppInfo() {} PaymentAppInfoFetcher::PaymentAppInfo::~PaymentAppInfo() {} @@ -125,6 +114,13 @@ return; } + // TODO(gogerald): Choose appropriate icon size dynamically on different + // platforms. + // Here we choose a large ideal icon size to be big enough for all platforms. + // Note that we only scale down for this icon size but not scale up. + const int kPaymentAppIdealIconSize = 0xFFFF; + const int kPaymentAppMinimumIconSize = 0; + GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( manifest.icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, Manifest::Icon::ANY); @@ -179,4 +175,4 @@ std::move(fetched_payment_app_info_))); } -} // namespace content \ No newline at end of file +} // namespace content
diff --git a/content/browser/renderer_host/OWNERS b/content/browser/renderer_host/OWNERS index 870c2a2c8..735db3b 100644 --- a/content/browser/renderer_host/OWNERS +++ b/content/browser/renderer_host/OWNERS
@@ -1,3 +1,6 @@ +# General renderer_host owners +kenrb@chromium.org + # for *aura* per-file *aura*=sadrul@chromium.org
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 8ddb922..1f1c765 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2055,8 +2055,9 @@ new_auto_size_ = params.view_size; if (post_callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(&RenderWidgetHostImpl::DelayedAutoResized, - weak_factory_.GetWeakPtr())); + FROM_HERE, + base::BindOnce(&RenderWidgetHostImpl::DelayedAutoResized, + weak_factory_.GetWeakPtr(), params.sequence_number)); } } @@ -2437,7 +2438,7 @@ return true; } -void RenderWidgetHostImpl::DelayedAutoResized() { +void RenderWidgetHostImpl::DelayedAutoResized(uint64_t sequence_number) { gfx::Size new_size = new_auto_size_; // Clear the new_auto_size_ since the empty value is used as a flag to // indicate that no callback is in progress (i.e. without this line @@ -2448,6 +2449,12 @@ if (delegate_) delegate_->ResizeDueToAutoResize(this, new_size); + + viz::LocalSurfaceId local_surface_id(view_->GetLocalSurfaceId()); + if (local_surface_id.is_valid()) { + Send(new ViewMsg_SetLocalSurfaceIdForAutoResize( + routing_id_, sequence_number, local_surface_id)); + } } void RenderWidgetHostImpl::DetachDelegate() {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index f7f7f5f..0cf5fad5 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -745,7 +745,7 @@ // Called when there is a new auto resize (using a post to avoid a stack // which may get in recursive loops). - void DelayedAutoResized(); + void DelayedAutoResized(uint64_t sequence_number); void WindowSnapshotReachedScreen(int snapshot_id);
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 33a38a7..bfc63fc 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -24,6 +24,7 @@ #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" #include "content/common/frame_messages.h" #include "content/public/browser/gpu_data_manager.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_paths.h" @@ -264,15 +265,15 @@ { CommitBeforeSwapAckSentHelper commit_helper(web_contents); EXPECT_TRUE(WaitForLoadStop(web_contents)); - EXPECT_NE(web_contents->GetRenderProcessHost(), - new_web_contents->GetRenderProcessHost()); + EXPECT_NE(web_contents->GetMainFrame()->GetProcess(), + new_web_contents->GetMainFrame()->GetProcess()); } // Go back and verify that the renderer continues to draw new frames. shell()->GoBackOrForward(-1); EXPECT_TRUE(WaitForLoadStop(web_contents)); - EXPECT_EQ(web_contents->GetRenderProcessHost(), - new_web_contents->GetRenderProcessHost()); + EXPECT_EQ(web_contents->GetMainFrame()->GetProcess(), + new_web_contents->GetMainFrame()->GetProcess()); FrameWatcher(web_contents).WaitFrames(5); }
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc index 6f43308..fdd1f5b 100644 --- a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc +++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc
@@ -59,6 +59,12 @@ IPC::Sender* sender = g_sender_override; + // Hack for crbug.com/631254: set the sender if we can get one, so that when + // Flash calls into the font proxy from a different thread we will have a + // sender available. + if (!sender && ChildThreadImpl::current()) + sender = ChildThreadImpl::current()->thread_safe_sender(); + if (!g_font_collection) { mswr::MakeAndInitialize<DWriteFontCollectionProxy>( &g_font_collection, factory.Get(), sender);
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h index b7e666b..96c7732 100644 --- a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h +++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h
@@ -23,7 +23,7 @@ // font IPC messages. This should only be called when running as a test. CONTENT_EXPORT void SetDWriteFontProxySenderForTesting(IPC::Sender* sender); -// Allows ChildThreadImpl to register a thread saef sender to DWriteFontProxy +// Allows ChildThreadImpl to register a thread safe sender to DWriteFontProxy // so we don't depend on being on the main thread to use DWriteFontProxy. CONTENT_EXPORT void UpdateDWriteFontProxySender(IPC::Sender*);
diff --git a/content/common/background_fetch/background_fetch_struct_traits.cc b/content/common/background_fetch/background_fetch_struct_traits.cc index 1fe3b79..a4f5161 100644 --- a/content/common/background_fetch/background_fetch_struct_traits.cc +++ b/content/common/background_fetch/background_fetch_struct_traits.cc
@@ -19,7 +19,7 @@ if (!data.ReadIcons(&options->icons) || !data.ReadTitle(&options->title)) return false; - options->total_download_size = data.total_download_size(); + options->download_total = data.download_total(); return true; } @@ -34,7 +34,10 @@ return false; } - registration->total_download_size = data.total_download_size(); + registration->upload_total = data.upload_total(); + registration->uploaded = data.uploaded(); + registration->download_total = data.download_total(); + registration->downloaded = data.downloaded(); return true; }
diff --git a/content/common/background_fetch/background_fetch_struct_traits.h b/content/common/background_fetch/background_fetch_struct_traits.h index 2f2c67a..634531e 100644 --- a/content/common/background_fetch/background_fetch_struct_traits.h +++ b/content/common/background_fetch/background_fetch_struct_traits.h
@@ -32,9 +32,9 @@ const content::BackgroundFetchOptions& options) { return options.title; } - static int64_t total_download_size( + static uint64_t download_total( const content::BackgroundFetchOptions& options) { - return options.total_download_size; + return options.download_total; } static bool Read(blink::mojom::BackgroundFetchOptionsDataView data, @@ -49,6 +49,22 @@ const content::BackgroundFetchRegistration& registration) { return registration.id; } + static uint64_t upload_total( + const content::BackgroundFetchRegistration& registration) { + return registration.upload_total; + } + static uint64_t uploaded( + const content::BackgroundFetchRegistration& registration) { + return registration.uploaded; + } + static uint64_t download_total( + const content::BackgroundFetchRegistration& registration) { + return registration.download_total; + } + static uint64_t downloaded( + const content::BackgroundFetchRegistration& registration) { + return registration.downloaded; + } static const std::vector<content::IconDefinition>& icons( const content::BackgroundFetchRegistration& registration) { return registration.icons; @@ -57,10 +73,6 @@ const content::BackgroundFetchRegistration& registration) { return registration.title; } - static int64_t total_download_size( - const content::BackgroundFetchRegistration& registration) { - return registration.total_download_size; - } static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, content::BackgroundFetchRegistration* registration);
diff --git a/content/common/background_fetch/background_fetch_struct_traits_unittest.cc b/content/common/background_fetch/background_fetch_struct_traits_unittest.cc index c44f4ae..aad9429 100644 --- a/content/common/background_fetch/background_fetch_struct_traits_unittest.cc +++ b/content/common/background_fetch/background_fetch_struct_traits_unittest.cc
@@ -40,7 +40,7 @@ CreateIconDefinition("my_icon.png", "256x256", "image/png"), CreateIconDefinition("my_small_icon.jpg", "128x128", "image/jpg")}; options.title = "My Background Fetch"; - options.total_download_size = 9001; + options.download_total = 9001; BackgroundFetchOptions roundtrip_options; ASSERT_TRUE(blink::mojom::BackgroundFetchOptions::Deserialize( @@ -54,7 +54,7 @@ } EXPECT_EQ(roundtrip_options.title, options.title); - EXPECT_EQ(roundtrip_options.total_download_size, options.total_download_size); + EXPECT_EQ(roundtrip_options.download_total, options.download_total); } TEST(BackgroundFetchStructTraitsTest, BackgroundFetchRegistrationRoundTrip) { @@ -64,7 +64,7 @@ CreateIconDefinition("my_icon.png", "256x256", "image/png"), CreateIconDefinition("my_small_icon.jpg", "128x128", "image/jpg")}; registration.title = "My Background Fetch"; - registration.total_download_size = 9001; + registration.download_total = 9001; BackgroundFetchRegistration roundtrip_registration; ASSERT_TRUE(blink::mojom::BackgroundFetchRegistration::Deserialize( @@ -80,8 +80,7 @@ } EXPECT_EQ(roundtrip_registration.title, registration.title); - EXPECT_EQ(roundtrip_registration.total_download_size, - registration.total_download_size); + EXPECT_EQ(roundtrip_registration.download_total, registration.download_total); } TEST(BackgroundFetchStructTraitsTest, IconDefinitionRoundtrip) {
diff --git a/content/common/background_fetch/background_fetch_types.h b/content/common/background_fetch/background_fetch_types.h index 9286000..7fbc60b 100644 --- a/content/common/background_fetch/background_fetch_types.h +++ b/content/common/background_fetch/background_fetch_types.h
@@ -41,7 +41,7 @@ std::vector<IconDefinition> icons; std::string title; - int64_t total_download_size = 0; + uint64_t download_total = 0; }; // Represents the information associated with a Background Fetch registration. @@ -53,11 +53,15 @@ ~BackgroundFetchRegistration(); std::string id; + uint64_t upload_total = 0; + uint64_t uploaded = 0; + uint64_t download_total = 0; + uint64_t downloaded = 0; + // TODO(crbug.com/699957): Support the `activeFetches` member. + + // TODO(crbug.com/769770): Remove the following deprecated members. std::vector<IconDefinition> icons; std::string title; - int64_t total_download_size = 0; - - // TODO(peter): Support the `activeFetches` member of the specification. }; // Represents a request/response pair for a settled Background Fetch fetch.
diff --git a/content/common/fileapi/file_system_messages.h b/content/common/fileapi/file_system_messages.h index a7812f3..db4d87b3 100644 --- a/content/common/fileapi/file_system_messages.h +++ b/content/common/fileapi/file_system_messages.h
@@ -32,7 +32,8 @@ IPC_STRUCT_TRAITS_MEMBER(mount_type) IPC_STRUCT_TRAITS_END() -IPC_ENUM_TRAITS(storage::FileSystemType) +IPC_ENUM_TRAITS_MAX_VALUE(storage::FileSystemType, + storage::FileSystemType::kFileSystemTypeLast) IPC_ENUM_TRAITS_MAX_VALUE(storage::QuotaLimitType, storage::kQuotaLimitTypeLast) // File system messages sent from the browser to the child process.
diff --git a/content/common/media/cdm_info.cc b/content/common/media/cdm_info.cc index 3d8fdc3..fb03e84 100644 --- a/content/common/media/cdm_info.cc +++ b/content/common/media/cdm_info.cc
@@ -4,27 +4,20 @@ #include "content/public/common/cdm_info.h" -#include "base/guid.h" -#include "base/logging.h" - namespace content { CdmInfo::CdmInfo(const std::string& type, - const std::string& guid, const base::Version& version, const base::FilePath& path, const std::vector<std::string>& supported_codecs, const std::string& supported_key_system, bool supports_sub_key_systems) : type(type), - guid(guid), version(version), path(path), supported_codecs(supported_codecs), supported_key_system(supported_key_system), - supports_sub_key_systems(supports_sub_key_systems) { - DCHECK(base::IsValidGUID(guid)); -} + supports_sub_key_systems(supports_sub_key_systems) {} CdmInfo::CdmInfo(const CdmInfo& other) = default;
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 858c7ee..36e4f43 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h
@@ -305,6 +305,10 @@ // which would indicate that this paint message is an ACK for multiple // request messages. IPC_STRUCT_MEMBER(int, flags) + + // A unique monotonically increasing sequence number used to identify this + // ACK. + IPC_STRUCT_MEMBER(uint64_t, sequence_number) IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -346,6 +350,12 @@ // we don't have to fetch it every time WebKit asks for it. IPC_MESSAGE_ROUTED1(ViewMsg_Resize, content::ResizeParams /* params */) +// Tells the widget to use the provided viz::LocalSurfaceId to submit +// CompositorFrames for autosize. +IPC_MESSAGE_ROUTED2(ViewMsg_SetLocalSurfaceIdForAutoResize, + uint64_t /* sequence_number */, + viz::LocalSurfaceId /* local_surface_id */) + // Enables device emulation. See WebDeviceEmulationParams for description. IPC_MESSAGE_ROUTED1(ViewMsg_EnableDeviceEmulation, blink::WebDeviceEmulationParams /* params */)
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 60f3339..c382b2b0 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -194,6 +194,13 @@ return false; } +std::unique_ptr<net::HttpRequestHeaders> +ContentBrowserClient::GetAdditionalNavigationRequestHeaders( + BrowserContext* context, + const GURL& url) const { + return nullptr; +} + bool ContentBrowserClient::AllowGetCookie(const GURL& url, const GURL& first_party, const net::CookieList& cookie_list,
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index c6a9a9b..54e127f 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -83,6 +83,7 @@ class ClientCertIdentity; using ClientCertIdentityList = std::vector<std::unique_ptr<ClientCertIdentity>>; class CookieOptions; +class HttpRequestHeaders; class NetLog; class SSLCertRequestInfo; class SSLInfo; @@ -378,6 +379,12 @@ virtual bool IsDataSaverEnabled(BrowserContext* context); + // Allow the embedder to return additional headers that should be sent when + // fetching |url|. May return a nullptr. + virtual std::unique_ptr<net::HttpRequestHeaders> + GetAdditionalNavigationRequestHeaders(BrowserContext* context, + const GURL& url) const; + // Allow the embedder to control if the given cookie can be read. // This is called on the IO thread. virtual bool AllowGetCookie(const GURL& url,
diff --git a/content/public/common/cdm_info.h b/content/public/common/cdm_info.h index cd4f1d4f9..ba61eeb 100644 --- a/content/public/common/cdm_info.h +++ b/content/public/common/cdm_info.h
@@ -17,7 +17,6 @@ // Represents a Content Decryption Module implementation and its capabilities. struct CONTENT_EXPORT CdmInfo { CdmInfo(const std::string& type, - const std::string& guid, const base::Version& version, const base::FilePath& path, const std::vector<std::string>& supported_codecs, @@ -29,9 +28,6 @@ // Type of the CDM (e.g. Widevine). std::string type; - // A version 4 GUID to uniquely identify this type of CDM. - std::string guid; - // Version of the CDM. May be empty if the version is not known. base::Version version;
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 35e57c4..394c487 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -724,6 +724,10 @@ layer_tree_host_->SetNeedsRedrawRect(damage_rect); } +bool RenderWidgetCompositor::IsSurfaceSynchronizationEnabled() const { + return layer_tree_host_->GetSettings().enable_surface_synchronization; +} + void RenderWidgetCompositor::SetNeedsForcedRedraw() { layer_tree_host_->SetNeedsCommitWithForcedRedraw(); }
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index d532948..375541d 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h
@@ -93,6 +93,9 @@ void SetNeedsDisplayOnAllLayers(); void SetRasterizeOnlyVisibleContent(); void SetNeedsRedrawRect(gfx::Rect damage_rect); + + bool IsSurfaceSynchronizationEnabled() const; + // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. // Redraw will be forced after the next commit void SetNeedsForcedRedraw();
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc index 3f3e844..9d5c8ab 100644 --- a/content/renderer/media/media_stream_video_source.cc +++ b/content/renderer/media/media_stream_video_source.cc
@@ -139,6 +139,9 @@ void MediaStreamVideoSource::OnStopForRestartDone(bool did_stop_for_restart) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (state_ == ENDED) + return; + DCHECK_EQ(state_, STOPPING_FOR_RESTART); if (did_stop_for_restart) { state_ = STOPPED_FOR_RESTART; @@ -178,8 +181,10 @@ void MediaStreamVideoSource::OnRestartDone(bool did_restart) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_EQ(state_, RESTARTING); + if (state_ == ENDED) + return; + DCHECK_EQ(state_, RESTARTING); if (did_restart) { state_ = STARTED; StartFrameMonitoring(); @@ -253,6 +258,9 @@ void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(3) << "OnStartDone({result =" << result << "})"; + if (state_ == ENDED) + return; + if (result == MEDIA_DEVICE_OK) { DCHECK_EQ(STARTING, state_); state_ = STARTED;
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc index fb34126..f8f124b 100644 --- a/content/renderer/media/user_media_client_impl.cc +++ b/content/renderer/media/user_media_client_impl.cc
@@ -13,7 +13,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/task_runner.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "content/public/renderer/render_frame.h" #include "content/renderer/media/media_stream_dispatcher.h" #include "content/renderer/media/peer_connection_tracker.h" @@ -27,6 +27,7 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" +#include "third_party/WebKit/public/web/WebUserMediaRequest.h" namespace content { namespace { @@ -50,6 +51,34 @@ } // namespace +UserMediaClientImpl::Request::Request(std::unique_ptr<UserMediaRequest> request) + : user_media_request_(std::move(request)) { + DCHECK(user_media_request_); + DCHECK(apply_constraints_request_.IsNull()); +} + +UserMediaClientImpl::Request::Request( + const blink::WebApplyConstraintsRequest& request) + : apply_constraints_request_(request) { + DCHECK(!apply_constraints_request_.IsNull()); + DCHECK(!user_media_request_); +} + +UserMediaClientImpl::Request::Request(Request&& other) + : user_media_request_(std::move(other.user_media_request_)), + apply_constraints_request_(other.apply_constraints_request_) { + DCHECK(!IsApplyConstraints() || !IsUserMedia()); +} + +UserMediaClientImpl::Request& UserMediaClientImpl::Request::operator=( + Request&& other) = default; +UserMediaClientImpl::Request::~Request() = default; + +std::unique_ptr<UserMediaRequest> +UserMediaClientImpl::Request::MoveUserMediaRequest() { + return std::move(user_media_request_); +} + UserMediaClientImpl::UserMediaClientImpl( RenderFrame* render_frame, std::unique_ptr<UserMediaProcessor> user_media_processor) @@ -118,10 +147,22 @@ base::MakeUnique<UserMediaRequest>( request_id, web_request, blink::WebUserGestureIndicator::IsProcessingUserGesture()); - pending_request_infos_.push_back(std::move(request_info)); + pending_request_infos_.push_back(Request(std::move(request_info))); if (!is_processing_request_) { - // TODO(guidou): Invoke directly instead of posting. http://crbug.com/764293 - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&UserMediaClientImpl::MaybeProcessNextRequestInfo, + weak_factory_.GetWeakPtr())); + } +} + +void UserMediaClientImpl::ApplyConstraints( + const blink::WebApplyConstraintsRequest& web_request) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + // TODO(guidou): Implement applyConstraints(). http://crbug.com/338503 + pending_request_infos_.push_back(Request(web_request)); + if (!is_processing_request_) { + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&UserMediaClientImpl::MaybeProcessNextRequestInfo, weak_factory_.GetWeakPtr())); @@ -133,24 +174,32 @@ if (is_processing_request_ || pending_request_infos_.empty()) return; - std::unique_ptr<UserMediaRequest> current_request = - std::move(pending_request_infos_.front()); + Request current_request = std::move(pending_request_infos_.front()); pending_request_infos_.pop_front(); is_processing_request_ = true; // base::Unretained() is safe here because |this| owns // |user_media_processor_|. - user_media_processor_->ProcessRequest( - std::move(current_request), - base::BindOnce(&UserMediaClientImpl::CurrentRequestCompleted, - base::Unretained(this))); + if (current_request.IsUserMedia()) { + user_media_processor_->ProcessRequest( + current_request.MoveUserMediaRequest(), + base::BindOnce(&UserMediaClientImpl::CurrentRequestCompleted, + base::Unretained(this))); + } else { + DCHECK(current_request.IsApplyConstraints()); + blink::WebApplyConstraintsRequest request = + current_request.apply_constraints_request(); + request.RequestFailed( + blink::WebString(), + "applyConstraints not supported for this type of track"); + } } void UserMediaClientImpl::CurrentRequestCompleted() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); is_processing_request_ = false; if (!pending_request_infos_.empty()) { - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&UserMediaClientImpl::MaybeProcessNextRequestInfo, weak_factory_.GetWeakPtr())); @@ -172,14 +221,15 @@ bool did_remove_request = false; if (user_media_processor_->DeleteWebRequest(web_request)) { did_remove_request = true; - } - - for (auto it = pending_request_infos_.begin(); - it != pending_request_infos_.end(); ++it) { - if ((*it)->web_request == web_request) { - pending_request_infos_.erase(it); - did_remove_request = true; - break; + } else { + for (auto it = pending_request_infos_.begin(); + it != pending_request_infos_.end(); ++it) { + if (it->IsUserMedia() && + it->user_media_request()->web_request == web_request) { + pending_request_infos_.erase(it); + did_remove_request = true; + break; + } } }
diff --git a/content/renderer/media/user_media_client_impl.h b/content/renderer/media/user_media_client_impl.h index 19e4d74..a8890477 100644 --- a/content/renderer/media/user_media_client_impl.h +++ b/content/renderer/media/user_media_client_impl.h
@@ -20,6 +20,7 @@ #include "content/renderer/media/media_devices_event_dispatcher.h" #include "content/renderer/media/user_media_processor.h" #include "third_party/WebKit/public/platform/WebVector.h" +#include "third_party/WebKit/public/web/WebApplyConstraintsRequest.h" #include "third_party/WebKit/public/web/WebMediaDeviceChangeObserver.h" #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" #include "third_party/WebKit/public/web/WebUserMediaClient.h" @@ -65,6 +66,8 @@ const blink::WebMediaDevicesRequest& media_devices_request) override; void SetMediaDeviceChangeObserver( const blink::WebMediaDeviceChangeObserver& observer) override; + void ApplyConstraints( + const blink::WebApplyConstraintsRequest& web_request) override; // RenderFrameObserver override void WillCommitProvisionalLoad() override; @@ -81,6 +84,35 @@ blink::WebVector<blink::WebMediaDeviceInfo>& devices); private: + class Request { + public: + explicit Request(std::unique_ptr<UserMediaRequest> request); + explicit Request(const blink::WebApplyConstraintsRequest& request); + Request(Request&& other); + Request& operator=(Request&& other); + ~Request(); + + std::unique_ptr<UserMediaRequest> MoveUserMediaRequest(); + + UserMediaRequest* user_media_request() const { + return user_media_request_.get(); + } + + const blink::WebApplyConstraintsRequest& apply_constraints_request() const { + return apply_constraints_request_; + } + + bool IsApplyConstraints() const { + return !apply_constraints_request_.IsNull(); + } + + bool IsUserMedia() const { return !!user_media_request_; } + + private: + std::unique_ptr<UserMediaRequest> user_media_request_; + blink::WebApplyConstraintsRequest apply_constraints_request_; + }; + void MaybeProcessNextRequestInfo(); void CurrentRequestCompleted(); @@ -109,7 +141,7 @@ // is a flag that indicates if a request is being processed at a given time, // and |pending_request_infos_| is a list of queued requests. bool is_processing_request_ = false; - std::list<std::unique_ptr<UserMediaRequest>> pending_request_infos_; + std::list<Request> pending_request_infos_; MediaDevicesEventDispatcher::SubscriptionIdList device_change_subscription_ids_;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 2b6d8fd4..2dddd11 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -1958,6 +1958,8 @@ return; auto_resize_mode_ = true; + AutoResizeCompositor(); + if (IsUseZoomForDSFEnabled()) { webview()->EnableAutoResizeMode( gfx::ScaleToCeiledSize(min_size, device_scale_factor_),
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 5de8d96..3988ed7 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -632,6 +632,8 @@ IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) + IPC_MESSAGE_HANDLER(ViewMsg_SetLocalSurfaceIdForAutoResize, + OnSetLocalSurfaceIdForAutoResize) IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, OnEnableDeviceEmulation) IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, @@ -762,6 +764,15 @@ Resize(params); } +void RenderWidget::OnSetLocalSurfaceIdForAutoResize( + uint64_t sequence_number, + const viz::LocalSurfaceId& local_surface_id) { + if (!auto_resize_mode_ || resize_or_repaint_ack_num_ != sequence_number) + return; + local_surface_id_ = local_surface_id; + compositor_->SetViewportSize(physical_backing_size_, local_surface_id); +} + void RenderWidget::OnEnableDeviceEmulation( const blink::WebDeviceEmulationParams& params) { if (!screen_metrics_emulator_) { @@ -967,18 +978,7 @@ void RenderWidget::DidReceiveCompositorFrameAck() { TRACE_EVENT0("renderer", "RenderWidget::DidReceiveCompositorFrameAck"); - - if (!next_paint_flags_ && !need_update_rect_for_auto_resize_) { - return; - } - - ViewHostMsg_UpdateRect_Params params; - params.view_size = size_; - params.flags = next_paint_flags_; - - Send(new ViewHostMsg_UpdateRect(routing_id_, params)); - next_paint_flags_ = 0; - need_update_rect_for_auto_resize_ = false; + DidResizeAck(); } bool RenderWidget::IsClosing() const { @@ -1271,11 +1271,15 @@ local_surface_id_ = *params.local_surface_id; if (compositor_) { - // If surface synchronization is enable, then this will use the provided + // If surface synchronization is enabled, then this will use the provided // |local_surface_id_| to submit the next generated CompositorFrame. // If the ID is not valid, then the compositor will defer commits until // it receives a valid surface ID. This is a no-op if surface // synchronization is disabled. + // TODO(crbug.com/758387): Re-enable this DCHECK once the mash login screen + // is fixed. + // DCHECK(!compositor_->IsSurfaceSynchronizationEnabled() || + // local_surface_id_.is_valid()); compositor_->SetViewportSize(params.physical_backing_size, local_surface_id_); compositor_->SetBrowserControlsHeight( @@ -2162,8 +2166,17 @@ AutoResizeCompositor(); - if (!resizing_mode_selector_->is_synchronous_mode()) + if (!resizing_mode_selector_->is_synchronous_mode()) { need_update_rect_for_auto_resize_ = true; + // If surface synchronization is off, then ResizeAcks go to the browser in + // response to a DidReceiveCompositorFrame. With surface synchronization + // on, that notification will not arrive here because the compositor is + // deferring commits and thus submission of CompositorFrames. + if (!size_.IsEmpty() && compositor_ && + compositor_->IsSurfaceSynchronizationEnabled()) { + DidResizeAck(); + } + } } } @@ -2467,6 +2480,20 @@ widget_binding_.Bind(std::move(request)); } +void RenderWidget::DidResizeAck() { + if (!next_paint_flags_ && !need_update_rect_for_auto_resize_) + return; + + ViewHostMsg_UpdateRect_Params params; + params.view_size = size_; + params.flags = next_paint_flags_; + params.sequence_number = ++resize_or_repaint_ack_num_; + + Send(new ViewHostMsg_UpdateRect(routing_id_, params)); + next_paint_flags_ = 0; + need_update_rect_for_auto_resize_ = false; +} + #if BUILDFLAG(ENABLE_PLUGINS) PepperPluginInstanceImpl* RenderWidget::GetFocusedPepperPluginInsideWidget() { if (!GetWebWidget() || !GetWebWidget()->IsWebFrameWidget())
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 5880debc..481a0287 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -457,6 +457,8 @@ TTFAP_5MIN_AFTER_BACKGROUNDED, }; + void DidResizeAck(); + protected: // Friend RefCounted so that the dtor can be non-public. Using this class // without ref-counting is an error. @@ -523,6 +525,9 @@ void OnClose(); void OnCreatingNewAck(); virtual void OnResize(const ResizeParams& params); + void OnSetLocalSurfaceIdForAutoResize( + uint64_t sequence_number, + const viz::LocalSurfaceId& local_surface_id); void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params); void OnDisableDeviceEmulation(); virtual void OnWasHidden(); @@ -691,6 +696,9 @@ // an already-completed auto-resize. bool need_update_rect_for_auto_resize_; + // The sequence number used for ViewHostMsg_UpdateRect. + uint64_t resize_or_repaint_ack_num_ = 0; + // Set to true if we should ignore RenderWidget::Show calls. bool did_show_;
diff --git a/content/shell/test_runner/mock_web_user_media_client.cc b/content/shell/test_runner/mock_web_user_media_client.cc index 77066d3..2663225 100644 --- a/content/shell/test_runner/mock_web_user_media_client.cc +++ b/content/shell/test_runner/mock_web_user_media_client.cc
@@ -16,11 +16,14 @@ #include "third_party/WebKit/public/platform/WebMediaStream.h" #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" +#include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebVector.h" +#include "third_party/WebKit/public/web/WebApplyConstraintsRequest.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" #include "third_party/WebKit/public/web/WebUserMediaRequest.h" +using blink::WebApplyConstraintsRequest; using blink::WebMediaConstraints; using blink::WebMediaDeviceInfo; using blink::WebMediaDevicesRequest; @@ -135,4 +138,16 @@ media_device_change_observer_ = observer; } +void MockWebUserMediaClient::ApplyConstraints( + const WebApplyConstraintsRequest& web_request) { + WebApplyConstraintsRequest request = web_request; + if (request.Constraints().Basic().device_id.HasExact()) { + request.RequestFailed( + WebString::FromASCII(request.Constraints().Basic().device_id.GetName()), + "deviceId cannot be set with applyConstraints"); + return; + } + request.RequestSucceeded(); +} + } // namespace test_runner
diff --git a/content/shell/test_runner/mock_web_user_media_client.h b/content/shell/test_runner/mock_web_user_media_client.h index e6ce7ee..d9f320a 100644 --- a/content/shell/test_runner/mock_web_user_media_client.h +++ b/content/shell/test_runner/mock_web_user_media_client.h
@@ -24,6 +24,7 @@ void RequestMediaDevices(const blink::WebMediaDevicesRequest&) override; void SetMediaDeviceChangeObserver( const blink::WebMediaDeviceChangeObserver&) override; + void ApplyConstraints(const blink::WebApplyConstraintsRequest&) override; private: WebTestDelegate* delegate_;
diff --git a/content/test/data/accessibility/aria/aria-posinset-expected-mac.txt b/content/test/data/accessibility/aria/aria-posinset-expected-mac.txt index 0027c71..d2d98d6f 100644 --- a/content/test/data/accessibility/aria/aria-posinset-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-posinset-expected-mac.txt
@@ -8,25 +8,25 @@ ++AXGroup AXRoleDescription='form' ++++AXRadioButton AXRoleDescription='radio button' AXValue='0' AXARIASetSize='4' AXARIAPosInSet='3' ++++AXStaticText AXRoleDescription='text' AXValue='1' -++++AXUnknown AXRoleDescription='unknown' AXTitle='<newline>' +++++AXGroup AXRoleDescription='group' AXTitle='<newline>' ++++AXRadioButton AXRoleDescription='radio button' AXValue='0' AXARIASetSize='4' AXARIAPosInSet='4' ++++AXStaticText AXRoleDescription='text' AXValue='2' ++AXRadioButton AXRoleDescription='radio button' AXValue='0' AXARIASetSize='2' AXARIAPosInSet='1' ++AXStaticText AXRoleDescription='text' AXValue='Apple' -++AXUnknown AXRoleDescription='unknown' AXTitle='<newline>' +++AXGroup AXRoleDescription='group' AXTitle='<newline>' ++AXRadioButton AXRoleDescription='radio button' AXValue='0' AXARIASetSize='2' AXARIAPosInSet='2' ++AXStaticText AXRoleDescription='text' AXValue='Banana' ++AXGroup AXRoleDescription='group' AXTitle='Cake' ++++AXGroup AXRoleDescription='group' ++++++AXStaticText AXRoleDescription='text' AXValue='Cake' ++++AXRadioButton AXRoleDescription='radio button' AXTitle='Chiffon cakes' AXValue='1' AXARIASetSize='2' AXARIAPosInSet='1' -++++AXUnknown AXRoleDescription='unknown' AXTitle='<newline>' +++++AXGroup AXRoleDescription='group' AXTitle='<newline>' ++++AXRadioButton AXRoleDescription='radio button' AXTitle='Chocolate cakes' AXValue='0' AXARIASetSize='2' AXARIAPosInSet='2' ++AXGroup AXRoleDescription='form' ++++AXGroup AXRoleDescription='group' ++++++AXButton AXRoleDescription='button' AXTitle='changedFromRadio' ++++++AXGroup AXRoleDescription='group' ++++++++AXStaticText AXRoleDescription='text' AXValue='red' -++++++AXUnknown AXRoleDescription='unknown' AXTitle='<newline>' +++++++AXGroup AXRoleDescription='group' AXTitle='<newline>' ++++++AXRadioButton AXRoleDescription='radio button' AXTitle='blue' AXValue='0' AXARIASetSize='1' AXARIAPosInSet='1' -++AXStaticText AXRoleDescription='text' AXValue='Done' +++AXStaticText AXRoleDescription='text' AXValue='Done' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-mac.txt b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-mac.txt index 595e1953..44814ad 100644 --- a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-mac.txt
@@ -3,5 +3,5 @@ ++++AXStaticText AXRoleDescription='text' AXValue='Single line.' ++AXTextArea AXRoleDescription='text entry area' AXValue='Multiple<newline>lines.' ++++AXStaticText AXRoleDescription='text' AXValue='Multiple' -++++AXUnknown AXRoleDescription='unknown' AXTitle='<newline>' -++++AXStaticText AXRoleDescription='text' AXValue='lines.' +++++AXGroup AXRoleDescription='group' AXTitle='<newline>' +++++AXStaticText AXRoleDescription='text' AXValue='lines.' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/contenteditable-with-embedded-contenteditables-expected-mac.txt b/content/test/data/accessibility/html/contenteditable-with-embedded-contenteditables-expected-mac.txt index b074b10e..e8f0ab47 100644 --- a/content/test/data/accessibility/html/contenteditable-with-embedded-contenteditables-expected-mac.txt +++ b/content/test/data/accessibility/html/contenteditable-with-embedded-contenteditables-expected-mac.txt
@@ -3,7 +3,7 @@ ++++AXGroup ++++++AXStaticText AXValue='This is editable.' ++++AXStaticText AXValue='This is not editable.' -++++AXUnknown AXTitle='<newline>' +++++AXGroup AXTitle='<newline>' ++++AXGroup AXValue='But this one is.' ++++++AXStaticText AXValue='But this one is.' ++++AXGroup AXValue='So is this one.'
diff --git a/content/test/data/accessibility/html/input-radio-expected-mac.txt b/content/test/data/accessibility/html/input-radio-expected-mac.txt index 52457e38..53cd5c9 100644 --- a/content/test/data/accessibility/html/input-radio-expected-mac.txt +++ b/content/test/data/accessibility/html/input-radio-expected-mac.txt
@@ -2,7 +2,7 @@ ++AXGroup ++++AXRadioButton AXValue='0' AXLinkedUIElements=["AXRadioButton 0"] ++++AXStaticText AXValue='Radio1' -++++AXUnknown AXTitle='<newline>' +++++AXGroup AXTitle='<newline>' ++++AXRadioButton AXValue='0' AXLinkedUIElements=["AXRadioButton 0"] ++++AXStaticText AXValue='Radio2' ++AXGroup
diff --git a/content/test/fuzzer/BUILD.gn b/content/test/fuzzer/BUILD.gn index 63d8988..d787556 100644 --- a/content/test/fuzzer/BUILD.gn +++ b/content/test/fuzzer/BUILD.gn
@@ -54,6 +54,7 @@ deps = [ ":fuzzer_support", ] + additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] } fuzzer_test("clear_site_data_fuzzer") { @@ -77,6 +78,7 @@ ":html_tree_proto", "//third_party/libprotobuf-mutator", ] + additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] } proto_library("html_tree_proto") {
diff --git a/docs/memory-infra/memory_benchmarks.md b/docs/memory-infra/memory_benchmarks.md index 5014ede..4dbc607 100644 --- a/docs/memory-infra/memory_benchmarks.md +++ b/docs/memory-infra/memory_benchmarks.md
@@ -117,16 +117,14 @@ This will run the story with a default of 3 repetitions and produce a `results.html` file comparing results from this and any previous benchmark -runs. +runs. In addition, you'll also get individual [trace files][memory-infra] +for each story run by the benchmark.  Other useful options for this command are: * `--pageset-repeat [n]` - override the default number of repetitions -* `--output-format html --output-format json` - select *both* output formats - to get individual [trace files][memory-infra] in addition to the - `results.html` file. * `--reset-results` - clear results from any previous benchmark runs in the `results.html` file. * `--results-label [label]` - give meaningful names to your benchmark runs,
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index 0b1c99c..3a987260 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json
@@ -340,7 +340,7 @@ "matches": [ "chrome://network/*", "chrome://oobe/*", - "chrome://proxy-settings/*", + "chrome://internet-detail-dialog/*", "chrome://settings/*" ] }],
diff --git a/extensions/common/features/feature_provider_unittest.cc b/extensions/common/features/feature_provider_unittest.cc index 3890f0f..c2e6537 100644 --- a/extensions/common/features/feature_provider_unittest.cc +++ b/extensions/common/features/feature_provider_unittest.cc
@@ -47,14 +47,7 @@ const FeatureProvider* provider = FeatureProvider::GetByName("manifest"); scoped_refptr<const Extension> extension = - ExtensionBuilder() - .SetManifest(DictionaryBuilder() - .Set("name", "test extension") - .Set("version", "1") - .Set("description", "hello there") - .Build()) - .Build(); - ASSERT_TRUE(extension.get()); + ExtensionBuilder("test extension").Build(); const Feature* feature = provider->GetFeature("description"); EXPECT_EQ(Feature::IS_AVAILABLE, @@ -104,24 +97,9 @@ const FeatureProvider* provider = FeatureProvider::GetByName("permission"); scoped_refptr<const Extension> app = - ExtensionBuilder() - .SetManifest( - DictionaryBuilder() - .Set("name", "test app") - .Set("version", "1") - .Set("app", - DictionaryBuilder() - .Set("background", - DictionaryBuilder() - .Set("scripts", ListBuilder() - .Append("background.js") - .Build()) - .Build()) - .Build()) - .Set("permissions", ListBuilder().Append("power").Build()) - .Build()) + ExtensionBuilder("test app", ExtensionBuilder::Type::PLATFORM_APP) + .AddPermission("power") .Build(); - ASSERT_TRUE(app.get()); ASSERT_TRUE(app->is_platform_app()); // A permission requested in the manifest is available.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc index af0bf10b..88b2603 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
@@ -613,6 +613,7 @@ glRequestExtensionANGLE(default_extension); } } + context->ReinitializeDynamicBindings(); } // Each context initializes its own feature info because some extensions may
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h index 2f65e5de..701d60d 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h +++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h
@@ -16,6 +16,7 @@ @protocol BrowserCommands; @class ContentSuggestionsHeaderViewController; @protocol OmniboxFocuser; +@protocol SnackbarCommands; @protocol UrlLoader; class WebStateList; @@ -32,6 +33,7 @@ @property(nonatomic, weak) id<ApplicationCommands, BrowserCommands, OmniboxFocuser, + SnackbarCommands, UrlLoader> dispatcher; // Whether the Suggestions UI is displayed. If this is true, start is a no-op.
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm index 8ca8079e..3994ad98 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
@@ -146,6 +146,7 @@ self.suggestionsViewController.overscrollDelegate = self; self.suggestionsViewController.metricsRecorder = self.metricsRecorder; self.suggestionsViewController.containsToolbar = YES; + self.suggestionsViewController.dispatcher = self.dispatcher; self.NTPMediator.webState = self.webStateList->GetActiveWebState(); self.NTPMediator.dispatcher = self.dispatcher;
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_mediator.h b/ios/chrome/browser/content_suggestions/ntp_home_mediator.h index 62d7e1e..7a71274 100644 --- a/ios/chrome/browser/content_suggestions/ntp_home_mediator.h +++ b/ios/chrome/browser/content_suggestions/ntp_home_mediator.h
@@ -27,6 +27,7 @@ @class ContentSuggestionsViewController; @protocol OmniboxFocuser; @class NTPHomeMetrics; +@protocol SnackbarCommands; @protocol UrlLoader; // Mediator for the NTP Home panel, handling the interactions with the @@ -39,7 +40,8 @@ // The web state associated with this NTP. @property(nonatomic, assign) web::WebState* webState; // Dispatcher. -@property(nonatomic, weak) id<BrowserCommands, UrlLoader> dispatcher; +@property(nonatomic, weak) id<BrowserCommands, SnackbarCommands, UrlLoader> + dispatcher; // Suggestions service used to get the suggestions. @property(nonatomic, assign) ntp_snippets::ContentSuggestionsService* suggestionsService;
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm b/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm index 404a2416..06613bf9 100644 --- a/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm +++ b/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm
@@ -20,6 +20,7 @@ #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/reading_list_add_command.h" +#import "ios/chrome/browser/ui/commands/snackbar_commands.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h" @@ -373,7 +374,7 @@ IDS_IOS_NEW_TAB_MOST_VISITED_ITEM_REMOVED)]; message.action = action; message.category = @"MostVisitedUndo"; - [MDCSnackbarManager showMessage:message]; + [self.dispatcher showSnackbarMessage:message]; } @end
diff --git a/ios/chrome/browser/ui/activity_services/BUILD.gn b/ios/chrome/browser/ui/activity_services/BUILD.gn index bec9812..5cc7ee8e 100644 --- a/ios/chrome/browser/ui/activity_services/BUILD.gn +++ b/ios/chrome/browser/ui/activity_services/BUILD.gn
@@ -41,6 +41,9 @@ "//ui/base", "//url", ] + public_deps = [ + "//ios/third_party/material_components_ios", + ] libs = [ "MobileCoreServices.framework", "UIKit.framework",
diff --git a/ios/chrome/browser/ui/activity_services/activity_service_controller.mm b/ios/chrome/browser/ui/activity_services/activity_service_controller.mm index 18423911..ddc74ef1 100644 --- a/ios/chrome/browser/ui/activity_services/activity_service_controller.mm +++ b/ios/chrome/browser/ui/activity_services/activity_service_controller.mm
@@ -23,12 +23,19 @@ #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h" +#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #include "ui/base/l10n/l10n_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +namespace { +// Snackbar category for activity services. +NSString* const kActivityServicesSnackbarCategory = + @"ActivityServicesSnackbarCategory"; +} // namespace + @interface ActivityServiceController () { BOOL active_; __weak id<ActivityServicePassword> passwordProvider_; @@ -319,6 +326,7 @@ completionMessage:(NSString*)message { switch (shareStatus) { case ShareTo::SHARE_SUCCESS: { + __weak ActivityServiceController* weakSelf = self; // Flag to limit user feedback after form filled to just once. __block BOOL shown = NO; id<PasswordFormFiller> passwordFormFiller = @@ -330,8 +338,7 @@ return; TriggerHapticFeedbackForNotification( UINotificationFeedbackTypeSuccess); - [dispatcher_ - showSnackbarWithMessage:message]; + [weakSelf showSnackbar:message]; shown = YES; }]; break; @@ -352,7 +359,7 @@ case ShareTo::SHARE_SUCCESS: if ([message length]) { TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); - [dispatcher_ showSnackbarWithMessage:message]; + [self showSnackbar:message]; } break; case ShareTo::SHARE_ERROR: @@ -379,6 +386,14 @@ [presentationProvider_ showErrorAlertWithStringTitle:title message:message]; } +- (void)showSnackbar:(NSString*)text { + MDCSnackbarMessage* message = [MDCSnackbarMessage messageWithText:text]; + message.accessibilityLabel = text; + message.duration = 2.0; + message.category = kActivityServicesSnackbarCategory; + [dispatcher_ showSnackbarMessage:message]; +} + #pragma mark - For Testing - (void)setProvidersForTesting:
diff --git a/ios/chrome/browser/ui/activity_services/activity_service_controller_unittest.mm b/ios/chrome/browser/ui/activity_services/activity_service_controller_unittest.mm index 4e5d5aa..53e6419 100644 --- a/ios/chrome/browser/ui/activity_services/activity_service_controller_unittest.mm +++ b/ios/chrome/browser/ui/activity_services/activity_service_controller_unittest.mm
@@ -18,6 +18,7 @@ #import "ios/chrome/browser/ui/activity_services/share_to_data.h" #import "ios/chrome/browser/ui/commands/snackbar_commands.h" #include "ios/chrome/grit/ios_strings.h" +#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "testing/gtest_mac.h" #include "testing/platform_test.h" @@ -159,8 +160,8 @@ return self.parentViewController.view; } -- (void)showSnackbarWithMessage:(NSString*)message { - _latestSnackbarMessage = [message copy]; +- (void)showSnackbarMessage:(MDCSnackbarMessage*)message { + _latestSnackbarMessage = [message.text copy]; } - (void)resetState {
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 5174bb67..d78605f 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -195,6 +195,7 @@ #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h" #include "ios/public/provider/chrome/browser/voice/voice_search_controller_delegate.h" #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" +#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #include "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" #include "ios/web/public/referrer_util.h" @@ -297,6 +298,10 @@ return !(url.SchemeIs(kChromeUIScheme) && url.host() == kChromeUIHistoryHost); } +// Snackbar category for browser view controller. +NSString* const kBrowserViewControllerSnackbarCategory = + @"BrowserViewControllerSnackbarCategory"; + } // namespace #pragma mark - HeaderDefinition helper @@ -762,6 +767,8 @@ - (void)tabLoadComplete:(Tab*)tab withSuccess:(BOOL)success; // Evaluates Javascript asynchronously using the current page context. - (void)openJavascript:(NSString*)javascript; +// Shows a self-dismissing snackbar displaying |message|. +- (void)showSnackbar:(NSString*)message; // Induces an intentional crash in the browser process. - (void)induceBrowserCrash; // Saves the image or display error message, based on privacy settings. @@ -3192,17 +3199,16 @@ [self.dispatcher closeCurrentTab]; break; case OverscrollAction::REFRESH: { - if ([[[_model currentTab] webController] loadPhase] == - web::PAGE_LOADING) { - [_model currentTab].webState->Stop(); - } - web::WebState* webState = [_model currentTab].webState; - if (webState) + if (webState) { + if (webState->IsLoading()) { + webState->Stop(); + } // |check_for_repost| is true because the reload is explicitly initiated // by the user. webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, true /* check_for_repost */); + } break; } case OverscrollAction::NONE: @@ -3673,9 +3679,8 @@ reading_list::ADDED_VIA_CURRENT_APP); TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); - [self.dispatcher - showSnackbarWithMessage:l10n_util::GetNSString( - IDS_IOS_READING_LIST_SNACKBAR_MESSAGE)]; + [self showSnackbar:l10n_util::GetNSString( + IDS_IOS_READING_LIST_SNACKBAR_MESSAGE)]; } #pragma mark - Keyboard commands management @@ -3690,7 +3695,9 @@ // If there is no first responder, try to make the webview the first // responder. if (!GetFirstResponder()) { - [_model.currentTab.webController.webViewProxy becomeFirstResponder]; + web::WebState* webState = _model.currentTab.webState; + if (webState) + [webState->GetWebViewProxy() becomeFirstResponder]; } return YES; @@ -4209,9 +4216,7 @@ // the UI. if (![currentTab viewForPrinting]) { TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeError); - [self.dispatcher - showSnackbarWithMessage:l10n_util::GetNSString( - IDS_IOS_CANNOT_PRINT_PAGE_ERROR)]; + [self showSnackbar:l10n_util::GetNSString(IDS_IOS_CANNOT_PRINT_PAGE_ERROR)]; return; } DCHECK(_browserState); @@ -4940,6 +4945,14 @@ [_alertCoordinator start]; } +- (void)showSnackbar:(NSString*)text { + MDCSnackbarMessage* message = [MDCSnackbarMessage messageWithText:text]; + message.accessibilityLabel = text; + message.duration = 2.0; + message.category = kBrowserViewControllerSnackbarCategory; + [self.dispatcher showSnackbarMessage:message]; +} + #pragma mark - Show Mail Composer methods - (void)netExportTabHelper:(NetExportTabHelper*)tabHelper
diff --git a/ios/chrome/browser/ui/commands/browser_commands.h b/ios/chrome/browser/ui/commands/browser_commands.h index 451303e..e038d288 100644 --- a/ios/chrome/browser/ui/commands/browser_commands.h +++ b/ios/chrome/browser/ui/commands/browser_commands.h
@@ -11,6 +11,7 @@ #import "ios/chrome/browser/ui/commands/history_popup_commands.h" #import "ios/chrome/browser/ui/commands/page_info_commands.h" #import "ios/chrome/browser/ui/commands/qr_scanner_commands.h" +#import "ios/chrome/browser/ui/commands/snackbar_commands.h" @class OpenNewTabCommand; @class ReadingListAddCommand; @@ -21,6 +22,7 @@ ActivityServiceCommands, PageInfoCommands, QRScannerCommands, + SnackbarCommands, TabHistoryPopupCommands> // Closes the current tab.
diff --git a/ios/chrome/browser/ui/commands/snackbar_commands.h b/ios/chrome/browser/ui/commands/snackbar_commands.h index 8d8ff79..b07f737 100644 --- a/ios/chrome/browser/ui/commands/snackbar_commands.h +++ b/ios/chrome/browser/ui/commands/snackbar_commands.h
@@ -7,12 +7,14 @@ #import <Foundation/Foundation.h> +@class MDCSnackbarMessage; + // Commands related to Snackbar. @protocol SnackbarCommands -// Shows a snackbar with |message|. This method uses a default category. Only -// the last message of the default category will be shown. Any currently showing -// or pending message of the default category will be dismissed. -- (void)showSnackbarWithMessage:(NSString*)message; + +// Shows a snackbar with |message|. +- (void)showSnackbarMessage:(MDCSnackbarMessage*)message; + @end #endif // IOS_CHROME_BROWSER_UI_COMMANDS_SNACKBAR_COMMANDS_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/BUILD.gn index bca327f..40b3ea55 100644 --- a/ios/chrome/browser/ui/content_suggestions/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
@@ -35,6 +35,7 @@ "//components/strings", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/collection_view", + "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/content_suggestions/cells:cells_ui", "//ios/chrome/browser/ui/content_suggestions/identifier", "//ios/chrome/browser/ui/favicon:favicon_ui",
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h index 46a5341..6926861 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h
@@ -11,6 +11,7 @@ @class ContentSuggestionsSectionInformation; @class ContentSuggestionsViewController; @protocol ContentSuggestionsDataSource; +@protocol SnackbarCommands; @protocol SuggestedContent; // Enum defining the type of a ContentSuggestions. @@ -38,6 +39,8 @@ @property(nonatomic, weak) ContentSuggestionsViewController* collectionViewController; +@property(nonatomic, weak) id<SnackbarCommands> dispatcher; + // Returns whether the section should use the default, non-card style. - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm index 2567e78..1a0d37f 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
@@ -13,6 +13,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" +#import "ios/chrome/browser/ui/commands/snackbar_commands.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.h" @@ -162,6 +163,7 @@ @synthesize promoAdded = _promoAdded; @synthesize sectionIdentifiersFromContentSuggestions = _sectionIdentifiersFromContentSuggestions; +@synthesize dispatcher = _dispatcher; - (instancetype)init { self = [super init]; @@ -778,7 +780,7 @@ MDCSnackbarMessage* message = [MDCSnackbarMessage messageWithText:text]; message.accessibilityLabel = text; message.category = kContentSuggestionsCollectionUpdaterSnackbarCategory; - [MDCSnackbarManager showMessage:message]; + [self.dispatcher showSnackbarMessage:message]; } }
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm index 8228f9f..da7d7d3 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
@@ -438,10 +438,6 @@ // disposition of the collection takes into account the previous scroll, even // when more is tapped. - (void)testOpenPageAndGoBackWithMoreContent { - // TODO(crbug.com/769253): reenable when test pass on iPhone X. - if (IsIPhoneX()) { - EARL_GREY_TEST_DISABLED(@"Test disabled on iPhone X."); - } // Set server up. self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse)); GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h index 8b30e23..37bde63 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h
@@ -17,6 +17,7 @@ @protocol ContentSuggestionsMetricsRecording; @protocol ContentSuggestionsViewControllerAudience; @protocol OverscrollActionsControllerDelegate; +@protocol SnackbarCommands; @protocol SuggestedContent; // CollectionViewController to display the suggestions items. @@ -51,6 +52,7 @@ @property(nonatomic, assign) BOOL containsToolbar; - (void)setDataSource:(id<ContentSuggestionsDataSource>)dataSource; +- (void)setDispatcher:(id<SnackbarCommands>)dispatcher; // Removes the entry at |indexPath|, from the collection and its model. - (void)dismissEntryAtIndexPath:(NSIndexPath*)indexPath;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index 7b51421..72df682d 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -92,6 +92,10 @@ self.collectionUpdater.dataSource = dataSource; } +- (void)setDispatcher:(id<SnackbarCommands>)dispatcher { + self.collectionUpdater.dispatcher = dispatcher; +} + - (void)dismissEntryAtIndexPath:(NSIndexPath*)indexPath { if (!indexPath || ![self.collectionViewModel hasItemAtIndexPath:indexPath]) { return;
diff --git a/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.mm b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.mm index db468c2..da8bc032 100644 --- a/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.mm +++ b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.mm
@@ -9,6 +9,7 @@ #include "base/ios/block_types.h" #include "base/logging.h" #include "base/mac/foundation_util.h" +#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" @@ -209,6 +210,18 @@ [self.collectionViewModel itemTypeForIndexPath:indexPath] != ItemTypeApp; } +- (CGFloat)collectionView:(UICollectionView*)collectionView + cellHeightAtIndexPath:(NSIndexPath*)indexPath { + CollectionViewItem* item = + [self.collectionViewModel itemAtIndexPath:indexPath]; + UIEdgeInsets inset = [self collectionView:collectionView + layout:collectionView.collectionViewLayout + insetForSectionAtIndex:indexPath.section]; + CGFloat width = + CGRectGetWidth(collectionView.bounds) - inset.left - inset.right; + return [MDCCollectionViewCell cr_preferredHeightForWidth:width forItem:item]; +} + #pragma mark - Private - (void)didToggleAlwaysAskSwitch:(UISwitch*)sender {
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.h b/ios/chrome/browser/ui/ntp/new_tab_page_controller.h index e0e7eae1..e4d5ac7 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.h
@@ -36,6 +36,7 @@ @protocol IncognitoViewControllerDelegate; @protocol NewTabPagePanelProtocol; @protocol OmniboxFocuser; +@protocol SnackbarCommands; @class TabModel; @protocol UrlLoader; @@ -89,6 +90,7 @@ dispatcher:(id<ApplicationCommands, BrowserCommands, OmniboxFocuser, + SnackbarCommands, UrlLoader>)dispatcher safeAreaInset:(UIEdgeInsets)safeAreaInset;
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm index 0c2c8bc..94d9afcb 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
@@ -182,6 +182,7 @@ @property(nonatomic, weak) id<ApplicationCommands, BrowserCommands, OmniboxFocuser, + SnackbarCommands, UrlLoader> dispatcher; @@ -220,6 +221,7 @@ dispatcher:(id<ApplicationCommands, BrowserCommands, OmniboxFocuser, + SnackbarCommands, UrlLoader>)dispatcher safeAreaInset:(UIEdgeInsets)safeAreaInset { self = [super initWithNibName:nil url:url];
diff --git a/ios/chrome/browser/ui/qr_scanner/camera_controller.h b/ios/chrome/browser/ui/qr_scanner/camera_controller.h index fdbf560d..45c4bcc 100644 --- a/ios/chrome/browser/ui/qr_scanner/camera_controller.h +++ b/ios/chrome/browser/ui/qr_scanner/camera_controller.h
@@ -30,7 +30,9 @@ MULTIPLE_FOREGROUND_APPS, // The application does not have the permission to use the camera. CAMERA_PERMISSION_DENIED, - // The camera is unavailable. + // Camera unavailable due to "system pressure". + CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE, + // The camera is unavailable for an unspecified reason. CAMERA_UNAVAILABLE, // The camera was not yet loaded. CAMERA_NOT_LOADED,
diff --git a/ios/chrome/browser/ui/qr_scanner/camera_controller.mm b/ios/chrome/browser/ui/qr_scanner/camera_controller.mm index e5ecb32..e1e7b455 100644 --- a/ios/chrome/browser/ui/qr_scanner/camera_controller.mm +++ b/ios/chrome/browser/ui/qr_scanner/camera_controller.mm
@@ -353,6 +353,11 @@ case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps: [self setCameraState:qr_scanner::MULTIPLE_FOREGROUND_APPS]; break; +#if defined(__IPHONE_11_1) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_1) + case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure: + [self setCameraState:qr_scanner::CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE]; + break; +#endif case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient: NOTREACHED(); break;
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_alerts.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_alerts.mm index fa6fc93e..27ecbbe 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_alerts.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_alerts.mm
@@ -121,6 +121,7 @@ case qr_scanner::CAMERA_PERMISSION_DENIED: return CameraPermissionDeniedDialog(cancelBlock); + case qr_scanner::CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE: case qr_scanner::CAMERA_UNAVAILABLE: dialogTitle = l10n_util::GetNSString( IDS_IOS_QR_SCANNER_CAMERA_UNAVAILABLE_ALERT_TITLE);
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm index c9a8bd2f..58bf54257 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm
@@ -312,6 +312,7 @@ case qr_scanner::CAMERA_IN_USE_BY_ANOTHER_APPLICATION: case qr_scanner::MULTIPLE_FOREGROUND_APPS: case qr_scanner::CAMERA_PERMISSION_DENIED: + case qr_scanner::CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE: case qr_scanner::CAMERA_UNAVAILABLE: { // Dismiss any presented alerts. if ([self presentedViewController]) {
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm index c45eabcc..d6f5928 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -380,6 +380,7 @@ case CAMERA_PERMISSION_DENIED: return l10n_util::GetNSString( IDS_IOS_QR_SCANNER_CAMERA_PERMISSIONS_HELP_TITLE_GO_TO_SETTINGS); + case CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE: case CAMERA_UNAVAILABLE: return l10n_util::GetNSString( IDS_IOS_QR_SCANNER_CAMERA_UNAVAILABLE_ALERT_TITLE);
diff --git a/ios/chrome/browser/ui/snackbar/snackbar_coordinator.mm b/ios/chrome/browser/ui/snackbar/snackbar_coordinator.mm index 03cbdc2..78491860 100644 --- a/ios/chrome/browser/ui/snackbar/snackbar_coordinator.mm +++ b/ios/chrome/browser/ui/snackbar/snackbar_coordinator.mm
@@ -12,11 +12,6 @@ #error "This file requires ARC support." #endif -namespace { -// The default category for all messages. -NSString* const kDefaultSnackbarCategory = @"DefaultSnackbarCategory"; -} // namespace - @implementation SnackbarCoordinator @synthesize dispatcher = _dispatcher; @@ -31,13 +26,8 @@ #pragma mark - SnackbarCommands -- (void)showSnackbarWithMessage:(NSString*)message { - MDCSnackbarMessage* snackbarMessage = - [MDCSnackbarMessage messageWithText:message]; - snackbarMessage.accessibilityLabel = message; - snackbarMessage.duration = 2.0; - snackbarMessage.category = kDefaultSnackbarCategory; - [MDCSnackbarManager showMessage:snackbarMessage]; +- (void)showSnackbarMessage:(MDCSnackbarMessage*)message { + [MDCSnackbarManager showMessage:message]; } @end
diff --git a/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm b/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm index a5eabce9..efb2905 100644 --- a/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm
@@ -23,6 +23,5 @@ forProtocol:@protocol(SnackbarCommands)]; [coordinator start]; EXPECT_OCMOCK_VERIFY(dispatcher); - EXPECT_TRUE( - [coordinator respondsToSelector:@selector(showSnackbarWithMessage:)]); + EXPECT_TRUE([coordinator respondsToSelector:@selector(showSnackbarMessage:)]); }
diff --git a/ios/chrome/browser/upgrade/upgrade_center.mm b/ios/chrome/browser/upgrade/upgrade_center.mm index 9b12d171..70a1ff4 100644 --- a/ios/chrome/browser/upgrade/upgrade_center.mm +++ b/ios/chrome/browser/upgrade/upgrade_center.mm
@@ -93,8 +93,7 @@ gfx::Image GetIcon() const override { if (icon_.IsEmpty()) { - icon_ = gfx::Image([UIImage imageNamed:@"infobar_update"], - base::scoped_policy::RETAIN); + icon_ = gfx::Image([UIImage imageNamed:@"infobar_update"]); } return icon_; }
diff --git a/ios/clean/chrome/browser/ui/adaptor/browser_commands_adaptor.mm b/ios/clean/chrome/browser/ui/adaptor/browser_commands_adaptor.mm index 08a73a8..a528221 100644 --- a/ios/clean/chrome/browser/ui/adaptor/browser_commands_adaptor.mm +++ b/ios/clean/chrome/browser/ui/adaptor/browser_commands_adaptor.mm
@@ -150,6 +150,10 @@ [self showAlert:@"requestMobileSite"]; } +- (void)showSnackbarMessage:(MDCSnackbarMessage*)message { + [self showAlert:@"showSnackbarMessage:"]; +} + #pragma mark - Private // TODO(crbug.com/740793): Remove this method once no method is using it.
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.mm b/ios/web/navigation/wk_based_navigation_manager_impl.mm index 65c23390..2e82caab 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl.mm +++ b/ios/web/navigation/wk_based_navigation_manager_impl.mm
@@ -295,17 +295,11 @@ } void WKBasedNavigationManagerImpl::GoBack() { - if (transient_item_) { - transient_item_.reset(); - delegate_->ClearTransientContent(); - return; - } - [delegate_->GetWebViewNavigationProxy() goBack]; + GoToIndex(GetIndexForOffset(-1)); } void WKBasedNavigationManagerImpl::GoForward() { - DiscardNonCommittedItems(); - [delegate_->GetWebViewNavigationProxy() goForward]; + GoToIndex(GetIndexForOffset(1)); } NavigationItemList WKBasedNavigationManagerImpl::GetBackwardItems() const { @@ -399,6 +393,7 @@ } void WKBasedNavigationManagerImpl::FinishGoToIndex(int index) { + DiscardNonCommittedItems(); WKBackForwardListItem* wk_item = GetWKItemAtIndex(index); DCHECK(wk_item); [delegate_->GetWebViewNavigationProxy() goToBackForwardListItem:wk_item];
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl_unittest.mm b/ios/web/navigation/wk_based_navigation_manager_impl_unittest.mm index 55ab328..c8505cd 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl_unittest.mm +++ b/ios/web/navigation/wk_based_navigation_manager_impl_unittest.mm
@@ -301,38 +301,84 @@ } // Tests that in the absence of a transient item, going back is delegated to the -// underlying WKWebView without any sanity checks such as whether any back -// history exists. +// underlying WKWebView. TEST_F(WKBasedNavigationManagerTest, GoBackWithoutTransientItem) { + ASSERT_FALSE(manager_->CanGoBack()); + + manager_->AddPendingItem( + GURL("http://www.0.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.0.com"]; + + manager_->AddPendingItem( + GURL("http://www.1.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.1.com" + backListURLs:@[ @"http://www.0.com" ] + forwardListURLs:nil]; + + ASSERT_TRUE(manager_->CanGoBack()); + // The cast is necessary because without it, compiler cannot disambiguate // between UIWebView's goBack and WKWebView's goBack. Not using C++ style cast // because it doesn't work on id type. - [(WKWebView*)[mock_web_view_ expect] goBack]; + [(WKWebView*)[mock_web_view_ expect] + goToBackForwardListItem:mock_wk_list_.backList[0]]; manager_->GoBack(); [mock_web_view_ verify]; } // Tests that going back from a transient item will discard the transient item -// without any navigations on the underlying WKBackForwardList. +// and the pending item associated with it. TEST_F(WKBasedNavigationManagerTest, GoBackFromTransientItem) { manager_->AddPendingItem( GURL("http://www.0.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, web::NavigationInitiationType::USER_INITIATED, web::NavigationManager::UserAgentOverrideOption::DESKTOP); - manager_->AddTransientItem(GURL("http://www.1.com")); + [mock_wk_list_ setCurrentURL:@"http://www.0.com"]; + manager_->CommitPendingItem(); - [(WKWebView*)[mock_web_view_ reject] goBack]; + manager_->AddPendingItem( + GURL("http://www.1.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + manager_->AddTransientItem(GURL("http://www.1.com/transient")); + + ASSERT_TRUE(manager_->CanGoBack()); + [(WKWebView*)[mock_web_view_ expect] + goToBackForwardListItem:mock_wk_list_.currentItem]; manager_->GoBack(); [mock_web_view_ verify]; - EXPECT_NE(nullptr, manager_->GetPendingItem()); + EXPECT_EQ(nullptr, manager_->GetPendingItem()); EXPECT_EQ(nullptr, manager_->GetTransientItem()); } // Tests that going forward is always delegated to the underlying WKWebView // without any sanity checks such as whether any forward history exists. TEST_F(WKBasedNavigationManagerTest, GoForward) { - [(WKWebView*)[mock_web_view_ expect] goForward]; + manager_->AddPendingItem( + GURL("http://www.0.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.0.com"]; + manager_->CommitPendingItem(); + + manager_->AddPendingItem( + GURL("http://www.1.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.1.com" + backListURLs:@[ @"http://www.0.com" ] + forwardListURLs:nil]; + + [mock_wk_list_ moveCurrentToIndex:0]; + ASSERT_TRUE(manager_->CanGoForward()); + + [(WKWebView*)[mock_web_view_ expect] + goToBackForwardListItem:mock_wk_list_.forwardList[0]]; manager_->GoForward(); [mock_web_view_ verify]; } @@ -343,12 +389,33 @@ GURL("http://www.0.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, web::NavigationInitiationType::USER_INITIATED, web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.0.com"]; + manager_->CommitPendingItem(); + + manager_->AddPendingItem( + GURL("http://www.1.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); + [mock_wk_list_ setCurrentURL:@"http://www.1.com" + backListURLs:@[ @"http://www.0.com" ] + forwardListURLs:nil]; + + [mock_wk_list_ moveCurrentToIndex:0]; + ASSERT_TRUE(manager_->CanGoForward()); + + manager_->AddPendingItem( + GURL("http://www.0.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, + web::NavigationInitiationType::USER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::DESKTOP); manager_->AddTransientItem(GURL("http://www.1.com")); EXPECT_NE(nullptr, manager_->GetPendingItem()); EXPECT_NE(nullptr, manager_->GetTransientItem()); + [(WKWebView*)[mock_web_view_ expect] + goToBackForwardListItem:mock_wk_list_.forwardList[0]]; manager_->GoForward(); + [mock_web_view_ verify]; EXPECT_EQ(nullptr, manager_->GetPendingItem()); EXPECT_EQ(nullptr, manager_->GetTransientItem());
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 8aab9bd..0d8c66f 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -281,7 +281,7 @@ // supported platforms. On platforms that do not support ECK, this feature has // no effect. const base::Feature kExternalClearKeyForTesting{ - "ExternalClearKeyForTesting", base::FEATURE_DISABLED_BY_DEFAULT}; + "external-clear-key-for-testing", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSupportExperimentalCdmInterface{ "SupportExperimentalCdmInterface", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/media/cdm/cdm_paths.cc b/media/cdm/cdm_paths.cc index c72f49f..0c1bdb9 100644 --- a/media/cdm/cdm_paths.cc +++ b/media/cdm/cdm_paths.cc
@@ -25,9 +25,9 @@ #endif const char kClearKeyCdmDisplayName[] = "Clear Key CDM"; + const char kClearKeyCdmType[] = "Clear Key CDM"; -const char kClearKeyCdmGuid[] = "C1A6B4E3-FE48-4D53-9F52-244AEEAD5335"; -const char kClearKeyCdmDifferentGuid[] = "747C565D-34EE-4B0D-AC1E-4F9FB17DDB40"; + const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm"; // Note: This file must be in sync with cdm_paths.gni.
diff --git a/media/cdm/cdm_paths.h b/media/cdm/cdm_paths.h index 06e4985..0e6b9be5 100644 --- a/media/cdm/cdm_paths.h +++ b/media/cdm/cdm_paths.h
@@ -25,13 +25,6 @@ // The CDM type used to register Clear Key CDM. extern const char kClearKeyCdmType[]; -// The default GUID for Clear Key Cdm. -extern const char kClearKeyCdmGuid[]; - -// A different GUID for Clear Key Cdm for testing running different types of -// CDMs in the system. -extern const char kClearKeyCdmDifferentGuid[]; - // Pepper type for Clear Key CDM. // TODO(xhwang): Remove after switching to mojo CDM. extern const char kClearKeyCdmPepperMimeType[];
diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc index 22f1994..d96df62 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
@@ -70,8 +70,6 @@ "org.chromium.externalclearkey.verifycdmhosttest"; const char kExternalClearKeyStorageIdTestKeySystem[] = "org.chromium.externalclearkey.storageidtest"; -const char kExternalClearKeyDifferentGuidTestKeySystem[] = - "org.chromium.externalclearkey.differentguid"; const int64_t kSecondsPerMinute = 60; const int64_t kMsPerSecond = 1000; @@ -258,8 +256,7 @@ key_system_string != kExternalClearKeyPlatformVerificationTestKeySystem && key_system_string != kExternalClearKeyCrashKeySystem && key_system_string != kExternalClearKeyVerifyCdmHostTestKeySystem && - key_system_string != kExternalClearKeyStorageIdTestKeySystem && - key_system_string != kExternalClearKeyDifferentGuidTestKeySystem) { + key_system_string != kExternalClearKeyStorageIdTestKeySystem) { DVLOG(1) << "Unsupported key system:" << key_system_string; return nullptr; } @@ -696,7 +693,7 @@ // that the session is properly closed. if (!last_session_id_.empty() && key_system_ == kExternalClearKeyCrashKeySystem) { - CHECK(false) << "Crash in decrypt-and-decode with crash key system."; + CHECK(false); } scoped_refptr<media::DecoderBuffer> buffer; @@ -860,13 +857,6 @@ CdmKeysInfo keys_info) { DVLOG(1) << __func__ << ": size = " << keys_info.size(); - // Crash if the special key ID "crash" is present. - const std::vector<uint8_t> kCrashKeyId{'c', 'r', 'a', 's', 'h'}; - for (const auto& key_info : keys_info) { - if (key_info->key_id == kCrashKeyId) - CHECK(false) << "Crash on special crash key ID."; - } - std::vector<cdm::KeyInformation> keys_vector; ConvertCdmKeysInfo(keys_info, &keys_vector); host_->OnSessionKeysChange(session_id.data(), session_id.length(),
diff --git a/media/gpu/android/android_video_surface_chooser.h b/media/gpu/android/android_video_surface_chooser.h index c50de22..dc738138 100644 --- a/media/gpu/android/android_video_surface_chooser.h +++ b/media/gpu/android/android_video_surface_chooser.h
@@ -62,8 +62,9 @@ // Sets the client callbacks to be called when a new surface choice is made. // Must be called before UpdateState(); - virtual void SetClientCallbacks(UseOverlayCB use_overlay_cb, - UseSurfaceTextureCB use_surface_texture_cb); + virtual void SetClientCallbacks( + UseOverlayCB use_overlay_cb, + UseSurfaceTextureCB use_surface_texture_cb) = 0; // Updates the current state and makes a new surface choice with the new // state. If |new_factory| is empty, the factory is left as-is. Otherwise,
diff --git a/media/gpu/v4l2_image_processor.cc b/media/gpu/v4l2_image_processor.cc index 08bd66e..8db32c8 100644 --- a/media/gpu/v4l2_image_processor.cc +++ b/media/gpu/v4l2_image_processor.cc
@@ -19,12 +19,16 @@ #include "base/threading/thread_task_runner_handle.h" #include "media/gpu/v4l2_image_processor.h" -#define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value, type_str) \ - do { \ - if (device_->Ioctl(type, arg) != 0) { \ - PLOG(ERROR) << __func__ << "(): ioctl() failed: " << type_str; \ - return value; \ - } \ +#define DVLOGF(level) DVLOG(level) << __func__ << "(): " +#define VLOGF(level) VLOG(level) << __func__ << "(): " +#define VPLOGF(level) VPLOG(level) << __func__ << "(): " + +#define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value, type_str) \ + do { \ + if (device_->Ioctl(type, arg) != 0) { \ + VPLOGF(1) << "ioctl() failed: " << type_str; \ + return value; \ + } \ } while (0) #define IOCTL_OR_ERROR_RETURN(type, arg) \ @@ -33,10 +37,10 @@ #define IOCTL_OR_ERROR_RETURN_FALSE(type, arg) \ IOCTL_OR_ERROR_RETURN_VALUE(type, arg, false, #type) -#define IOCTL_OR_LOG_ERROR(type, arg) \ - do { \ - if (device_->Ioctl(type, arg) != 0) \ - PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \ +#define IOCTL_OR_LOG_ERROR(type, arg) \ + do { \ + if (device_->Ioctl(type, arg) != 0) \ + VPLOGF(1) << "ioctl() failed: " << #type; \ } while (0) namespace media { @@ -85,7 +89,7 @@ } void V4L2ImageProcessor::NotifyError() { - LOG(ERROR) << __func__; + VLOGF(1); DCHECK(!child_task_runner_->BelongsToCurrentThread()); child_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2ImageProcessor::NotifyErrorOnChildThread, @@ -108,6 +112,7 @@ gfx::Size output_allocated_size, int num_buffers, const base::Closure& error_cb) { + VLOGF(2); DCHECK(!error_cb.is_null()); DCHECK_GT(num_buffers, 0); DCHECK(input_memory_type == V4L2_MEMORY_USERPTR || @@ -124,7 +129,7 @@ num_buffers_ = num_buffers; if (!input_format_fourcc_ || !output_format_fourcc_) { - LOG(ERROR) << "Unrecognized format(s)"; + VLOGF(1) << "Unrecognized format(s)"; return false; } @@ -136,9 +141,9 @@ output_allocated_size_ = output_allocated_size; if (!device_->Open(V4L2Device::Type::kImageProcessor, input_format_fourcc_)) { - LOG(ERROR) << "Failed to open device for input format: " - << VideoPixelFormatToString(input_format) - << " fourcc: " << std::hex << "0x" << input_format_fourcc_; + VLOGF(1) << "Failed to open device for input format: " + << VideoPixelFormatToString(input_format) + << " fourcc: " << std::hex << "0x" << input_format_fourcc_; return false; } @@ -148,8 +153,8 @@ const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); if ((caps.capabilities & kCapsRequired) != kCapsRequired) { - LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " - << "caps check failed: 0x" << std::hex << caps.capabilities; + VLOGF(1) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " + << "caps check failed: 0x" << std::hex << caps.capabilities; return false; } @@ -157,7 +162,7 @@ return false; if (!device_thread_.Start()) { - LOG(ERROR) << "Initialize(): device thread failed to start"; + VLOGF(1) << "Initialize(): device thread failed to start"; return false; } @@ -166,7 +171,7 @@ FROM_HERE, base::Bind(&V4L2ImageProcessor::StartDevicePoll, base::Unretained(this))); - DVLOG(1) << "V4L2ImageProcessor initialized for " + VLOGF(2) << "V4L2ImageProcessor initialized for " << " input_format:" << VideoPixelFormatToString(input_format) << ", output_format:" << VideoPixelFormatToString(output_format) << ", input_visible_size: " << input_visible_size.ToString() @@ -222,7 +227,7 @@ uint32_t output_pixelformat, gfx::Size* size, size_t* num_planes) { - DVLOG(1) << __func__ << ": size=" << size->ToString(); + VLOGF(2) << "size=" << size->ToString(); scoped_refptr<V4L2Device> device = V4L2Device::Create(); if (!device || !device->Open(V4L2Device::Type::kImageProcessor, input_pixelformat)) @@ -239,7 +244,7 @@ *num_planes = format.fmt.pix_mp.num_planes; *size = V4L2Device::CodedSizeFromV4L2Format(format); - DVLOG(1) << __func__ << ": adjusted output coded size=" << size->ToString() + VLOGF(2) << "adjusted output coded size=" << size->ToString() << ", num_planes=" << *num_planes; return true; } @@ -248,12 +253,12 @@ int output_buffer_index, std::vector<base::ScopedFD> output_dmabuf_fds, const FrameReadyCB& cb) { - DVLOG(3) << __func__ << ": ts=" << frame->timestamp().InMilliseconds(); + DVLOGF(4) << "ts=" << frame->timestamp().InMilliseconds(); size_t expected_num_fds = (output_memory_type_ == V4L2_MEMORY_DMABUF ? output_planes_count_ : 0); if (expected_num_fds != output_dmabuf_fds.size()) { - LOG(ERROR) << __func__ << ": wrong number of output fds. Expected " - << expected_num_fds << ", actual " << output_dmabuf_fds.size(); + VLOGF(1) << "wrong number of output fds. Expected " << expected_num_fds + << ", actual " << output_dmabuf_fds.size(); return false; } @@ -271,7 +276,7 @@ void V4L2ImageProcessor::ProcessTask(std::unique_ptr<JobRecord> job_record) { int index = job_record->output_buffer_index; - DVLOG(3) << __func__ << ": Reusing output buffer, index=" << index; + DVLOGF(4) << "Reusing output buffer, index=" << index; DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); DCHECK(output_buffer_map_[index].dmabuf_fds.empty()); output_buffer_map_[index].dmabuf_fds = @@ -283,7 +288,7 @@ } bool V4L2ImageProcessor::Reset() { - DVLOG(3) << __func__; + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(device_thread_.IsRunning()); @@ -295,7 +300,7 @@ weak_this_ = weak_this_factory_.GetWeakPtr(); if (!device_thread_.Start()) { - LOG(ERROR) << "Reset(): device thread failed to start"; + VLOGF(1) << "device thread failed to start"; return false; } device_thread_.task_runner()->PostTask( @@ -305,7 +310,7 @@ } void V4L2ImageProcessor::Destroy() { - DVLOG(3) << __func__; + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); weak_this_factory_.InvalidateWeakPtrs(); @@ -326,7 +331,7 @@ } bool V4L2ImageProcessor::CreateInputBuffers() { - DVLOG(3) << __func__; + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(!input_streamon_); @@ -377,7 +382,7 @@ selection_arg.target = V4L2_SEL_TGT_CROP; selection_arg.r = visible_rect; if (device_->Ioctl(VIDIOC_S_SELECTION, &selection_arg) != 0) { - DVLOG(2) << "Fallback to VIDIOC_S_CROP for input buffers."; + VLOGF(2) << "Fallback to VIDIOC_S_CROP for input buffers."; struct v4l2_crop crop; memset(&crop, 0, sizeof(crop)); crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; @@ -392,8 +397,8 @@ reqbufs.memory = input_memory_type_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_REQBUFS, &reqbufs); if (static_cast<int>(reqbufs.count) != num_buffers_) { - LOG(ERROR) << "Failed to allocate input buffers. reqbufs.count=" - << reqbufs.count << ", num_buffers=" << num_buffers_; + VLOGF(1) << "Failed to allocate input buffers. reqbufs.count=" + << reqbufs.count << ", num_buffers=" << num_buffers_; return false; } @@ -407,7 +412,7 @@ } bool V4L2ImageProcessor::CreateOutputBuffers() { - DVLOG(3) << __func__; + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(!output_streamon_); @@ -440,7 +445,7 @@ selection_arg.target = V4L2_SEL_TGT_COMPOSE; selection_arg.r = visible_rect; if (device_->Ioctl(VIDIOC_S_SELECTION, &selection_arg) != 0) { - DVLOG(2) << "Fallback to VIDIOC_S_CROP for output buffers."; + VLOGF(2) << "Fallback to VIDIOC_S_CROP for output buffers."; struct v4l2_crop crop; memset(&crop, 0, sizeof(crop)); crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; @@ -455,8 +460,8 @@ reqbufs.memory = output_memory_type_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_REQBUFS, &reqbufs); if (static_cast<int>(reqbufs.count) != num_buffers_) { - LOG(ERROR) << "Failed to allocate output buffers. reqbufs.count=" - << reqbufs.count << ", num_buffers=" << num_buffers_; + VLOGF(1) << "Failed to allocate output buffers. reqbufs.count=" + << reqbufs.count << ", num_buffers=" << num_buffers_; return false; } @@ -467,6 +472,7 @@ } void V4L2ImageProcessor::DestroyInputBuffers() { + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(!input_streamon_); @@ -482,6 +488,7 @@ } void V4L2ImageProcessor::DestroyOutputBuffers() { + VLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(!output_streamon_); @@ -496,6 +503,7 @@ } void V4L2ImageProcessor::DevicePollTask(bool poll_device) { + DVLOGF(4); DCHECK(device_poll_thread_.task_runner()->BelongsToCurrentThread()); bool event_pending; @@ -512,6 +520,7 @@ } void V4L2ImageProcessor::ServiceDeviceTask() { + DVLOGF(4); DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); // ServiceDeviceTask() should only ever be scheduled from DevicePollTask(), // so either: @@ -536,15 +545,16 @@ FROM_HERE, base::Bind(&V4L2ImageProcessor::DevicePollTask, base::Unretained(this), poll_device)); - DVLOG(2) << __func__ << ": buffer counts: INPUT[" << input_queue_.size() - << "] => DEVICE[" << free_input_buffers_.size() << "+" - << input_buffer_queued_count_ << "/" << input_buffer_map_.size() - << "->" << output_buffer_map_.size() - output_buffer_queued_count_ - << "+" << output_buffer_queued_count_ << "/" - << output_buffer_map_.size() << "]"; + DVLOGF(3) << __func__ << ": buffer counts: INPUT[" << input_queue_.size() + << "] => DEVICE[" << free_input_buffers_.size() << "+" + << input_buffer_queued_count_ << "/" << input_buffer_map_.size() + << "->" << output_buffer_map_.size() - output_buffer_queued_count_ + << "+" << output_buffer_queued_count_ << "/" + << output_buffer_map_.size() << "]"; } void V4L2ImageProcessor::EnqueueInput() { + DVLOGF(4); DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); const int old_inputs_queued = input_buffer_queued_count_; @@ -569,6 +579,7 @@ } void V4L2ImageProcessor::EnqueueOutput(int index) { + DVLOGF(4); DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); const int old_outputs_queued = output_buffer_queued_count_; @@ -592,6 +603,7 @@ } void V4L2ImageProcessor::Dequeue() { + DVLOGF(4); DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); // Dequeue completed input (VIDEO_OUTPUT) buffers, @@ -611,7 +623,7 @@ // EAGAIN if we're just out of buffers to dequeue. break; } - PLOG(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; + VPLOGF(1) << "ioctl() failed: VIDIOC_DQBUF"; NotifyError(); return; } @@ -638,7 +650,7 @@ // EAGAIN if we're just out of buffers to dequeue. break; } - PLOG(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; + VPLOGF(1) << "ioctl() failed: VIDIOC_DQBUF"; NotifyError(); return; } @@ -653,7 +665,7 @@ linked_ptr<JobRecord> job_record = running_jobs_.front(); running_jobs_.pop(); - DVLOG(3) << "Processing finished, returning frame, index=" << dqbuf.index; + DVLOGF(4) << "Processing finished, returning frame, index=" << dqbuf.index; child_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2ImageProcessor::FrameReady, weak_this_, @@ -662,6 +674,7 @@ } bool V4L2ImageProcessor::EnqueueInputRecord() { + DVLOGF(4); DCHECK(!input_queue_.empty()); DCHECK(!free_input_buffers_.empty()); @@ -700,13 +713,14 @@ free_input_buffers_.pop_back(); input_buffer_queued_count_++; - DVLOG(3) << __func__ << ": enqueued frame ts=" - << job_record->frame->timestamp().InMilliseconds() << " to device."; + DVLOGF(4) << "enqueued frame ts=" + << job_record->frame->timestamp().InMilliseconds() << " to device."; return true; } bool V4L2ImageProcessor::EnqueueOutputRecord(int index) { + DVLOGF(4); DCHECK_GE(index, 0); DCHECK_LT(static_cast<size_t>(index), output_buffer_map_.size()); // Enqueue an output (VIDEO_CAPTURE) buffer. @@ -732,13 +746,13 @@ } void V4L2ImageProcessor::StartDevicePoll() { - DVLOG(3) << __func__ << ": starting device poll"; + DVLOGF(3) << "starting device poll"; DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); DCHECK(!device_poll_thread_.IsRunning()); // Start up the device poll thread and schedule its first DevicePollTask(). if (!device_poll_thread_.Start()) { - LOG(ERROR) << "StartDevicePoll(): Device thread failed to start"; + VLOGF(1) << "StartDevicePoll(): Device thread failed to start"; NotifyError(); return; } @@ -750,7 +764,7 @@ } void V4L2ImageProcessor::StopDevicePoll() { - DVLOG(3) << __func__ << ": stopping device poll"; + DVLOGF(3) << "stopping device poll"; DCHECK(device_thread_.task_runner()->BelongsToCurrentThread()); // Signal the DevicePollTask() to stop, and stop the device poll thread.
diff --git a/media/test/data/multiple_cdm_types.html b/media/test/data/multiple_cdm_types.html deleted file mode 100644 index ad313ea6..0000000 --- a/media/test/data/multiple_cdm_types.html +++ /dev/null
@@ -1,103 +0,0 @@ -<!DOCTYPE html> -<title>Test running different types of CDM in the system</title> -<div id="console"></div> -<script src='eme_player_js/app_loader.js' type='text/javascript'></script> -<script type='text/javascript'> - - function log(message) { - let consoleElement = document.getElementById('console'); - let entry = document.createElement('div'); - entry.appendChild(document.createTextNode(message)); - consoleElement.appendChild(entry); - console.log(message); - } - - const EXTERNAL_CLEARKEY_DIFFERENTGUID - = 'org.chromium.externalclearkey.differentguid'; - const crashKeyId = 'crash'; - const normalJwkSet = Utils.createJWKData(KEY_ID, KEY); - const crashJwkSet = Utils.createJWKData(crashKeyId, KEY); - - var config = { - initDataTypes : [ 'keyids' ], - videoCapabilities: [{contentType: 'video/webm; codecs="vp8"'}], - persistentState: 'optional', - sessionTypes: ['temporary'], - }; - - function createMediaKeySession(key_system) { - var mediaKeySession; - return navigator.requestMediaKeySystemAccess(key_system, [config]) - .then(function(access) { - initDataType = access.getConfiguration().initDataTypes[0]; - initData = Utils.createKeyIdsInitializationData(KEY_ID) - return access.createMediaKeys(); - }).then(function(result) { - log('CDM created'); - var mediaKeys = result; - mediaKeySession = mediaKeys.createSession(); - return mediaKeySession.generateRequest(initDataType, initData); - }).then(function() { - mediaKeySession.update(normalJwkSet); - }).then(function() { - return mediaKeySession; - }); - } - - log('Start test'); - - // Using EXTERNAL_CLEARKEY - var session1; - - // Both using EXTERNAL_CLEARKEY_DIFFERENTGUID - var session2; - var session3; - - // The following creates 3 MediaKeys instances each with a MediaKeySession. - // MediaKeys using different CDM GUID will run in different processes. - // |session1| uses EXTERNAL_CLEARKEY that is registered with the default GUID - // for Clear Key CDM. |session2/3| use EXTERNAL_CLEARKEY_DIFFERENTGUID that is - // registered with a different GUID. So |session1| will run in process1, and - // |session2/3| will run in process2. - // - // Then we send a special response |crashJwkSet| to session2 which will cause - // the process2 to crash. This will close both |session2/3| as they run in the - // same process. |session1| should not be affected. Then we try to create - // another MediaKeySession using EXTERNAL_CLEARKEY_DIFFERENTGUID, and the - // creation should work as a new process should be started. - - createMediaKeySession(EXTERNAL_CLEARKEY).then(function(session) { - log('Session1 created'); - session1 = session; - return createMediaKeySession(EXTERNAL_CLEARKEY_DIFFERENTGUID); - }).then(function(session) { - log('Session2 created'); - session2 = session; - return createMediaKeySession(EXTERNAL_CLEARKEY_DIFFERENTGUID); - }).then(function(session) { - log('Session3 created'); - session3 = session; - log('Crash session2'); - return session.update(crashJwkSet); - }).then(function() { - log('Session2 crashed'); - return session2.closed; - }).then(function() { - log('Session2 closed'); - return session3.closed; - }).then(function() { - log('Session3 also closed'); - return session1.update(normalJwkSet); - }).then(function() { - log('Session1 still works'); - return createMediaKeySession(EXTERNAL_CLEARKEY_DIFFERENTGUID); - }).then(function(session) { - log('Can still create a session after crash'); - Utils.setResultInTitle('ENDED'); - }).catch(function(error) { - log('Error: ' + error); - Utils.failTest('Test failed: ' + error); - }); - -</script> -</html>
diff --git a/net/BUILD.gn b/net/BUILD.gn index bda4db0b..d2b2c06 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -1528,6 +1528,8 @@ "spdy/chromium/header_coalescer.h", "spdy/chromium/http2_priority_dependencies.cc", "spdy/chromium/http2_priority_dependencies.h", + "spdy/chromium/http2_push_promise_index.cc", + "spdy/chromium/http2_push_promise_index.h", "spdy/chromium/multiplexed_http_stream.cc", "spdy/chromium/multiplexed_http_stream.h", "spdy/chromium/multiplexed_session.cc",
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 15f0830..9e23d53 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -5195,8 +5195,8 @@ // CONNECT to mail.example.org:443 via SPDY. SpdyHeaderBlock connect2_block; - connect2_block[spdy_util_.GetMethodKey()] = "CONNECT"; - connect2_block[spdy_util_.GetHostKey()] = "mail.example.org:443"; + connect2_block[kHttp2MethodHeader] = "CONNECT"; + connect2_block[kHttp2AuthorityHeader] = "mail.example.org:443"; SpdySerializedFrame connect2(spdy_util_.ConstructSpdyHeaders( 3, std::move(connect2_block), LOWEST, false)); @@ -6345,7 +6345,7 @@ 1, std::move(request_headers0), LOWEST, true)); SpdyHeaderBlock response_headers0; - response_headers0[spdy_util_.GetStatusKey()] = "401"; + response_headers0[kHttp2StatusHeader] = "401"; response_headers0["www-authenticate"] = "NTLM"; SpdySerializedFrame resp(spdy_util_.ConstructSpdyResponseHeaders( 1, std::move(response_headers0), true)); @@ -14001,7 +14001,7 @@ SpdySerializedFrame resp1(spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); SpdySerializedFrame body1(spdy_util_.ConstructSpdyDataFrame(1, true)); SpdyHeaderBlock response_headers; - response_headers[SpdyTestUtil::GetStatusKey()] = "421"; + response_headers[kHttp2StatusHeader] = "421"; SpdySerializedFrame resp2( spdy_util_.ConstructSpdyReply(3, std::move(response_headers))); MockRead reads1[] = {CreateMockRead(resp1, 1), CreateMockRead(body1, 2), @@ -14129,7 +14129,7 @@ SpdySerializedFrame resp1(spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); SpdySerializedFrame body1(spdy_util_.ConstructSpdyDataFrame(1, true)); SpdyHeaderBlock response_headers; - response_headers[SpdyTestUtil::GetStatusKey()] = "421"; + response_headers[kHttp2StatusHeader] = "421"; SpdySerializedFrame resp2( spdy_util_.ConstructSpdyReply(3, response_headers.Clone())); MockRead reads1[] = {CreateMockRead(resp1, 1), CreateMockRead(body1, 2), @@ -14685,10 +14685,10 @@ // SPDY GET for HTTP URL (through the proxy, but not the tunnel). SpdyHeaderBlock req2_block; - req2_block[spdy_util_.GetMethodKey()] = "GET"; - req2_block[spdy_util_.GetHostKey()] = "www.example.org:8080"; - req2_block[spdy_util_.GetSchemeKey()] = "http"; - req2_block[spdy_util_.GetPathKey()] = "/"; + req2_block[kHttp2MethodHeader] = "GET"; + req2_block[kHttp2AuthorityHeader] = "www.example.org:8080"; + req2_block[kHttp2SchemeHeader] = "http"; + req2_block[kHttp2PathHeader] = "/"; SpdySerializedFrame req2( spdy_util_.ConstructSpdyHeaders(3, std::move(req2_block), MEDIUM, true));
diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 8a2b6c3..2423889 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc
@@ -296,11 +296,13 @@ const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { const scoped_refptr<HttpProxySocketParams>* casted_params = static_cast<const scoped_refptr<HttpProxySocketParams>*>(params); - base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); + base_.RequestSockets(group_name, *casted_params, num_sockets, net_log, + motivation); } void HttpProxyClientSocketPool::CancelRequest(
diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h index 24c4517..9564c033 100644 --- a/net/http/http_proxy_client_socket_pool.h +++ b/net/http/http_proxy_client_socket_pool.h
@@ -163,7 +163,8 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override; + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override; void SetPriority(const std::string& group_name, ClientSocketHandle* handle,
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index 5417859..f442a517 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -323,7 +323,7 @@ CreateMockWrite(req, 0, ASYNC), CreateMockWrite(rst, 2, ASYNC), }; SpdyHeaderBlock resp_block; - resp_block[spdy_util_.GetStatusKey()] = "407"; + resp_block[kHttp2StatusHeader] = "407"; resp_block["proxy-authenticate"] = "Basic realm=\"MyRealm1\""; SpdySerializedFrame resp(
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index a0cd965..56699bb3a 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc
@@ -960,7 +960,8 @@ GetSocketGroup(), destination_, request_info_.extra_headers, request_info_.load_flags, priority_, session_, proxy_info_, expect_spdy_, server_ssl_config_, proxy_ssl_config_, - request_info_.privacy_mode, net_log_, num_streams_); + request_info_.privacy_mode, net_log_, num_streams_, + request_info_.motivation); } // If we can't use a SPDY session, don't bother checking for one after @@ -1168,12 +1169,6 @@ destination_.HostForURL()); } - // We only set the socket motivation if we're the first to use - // this socket. Is there a race for two SPDY requests? We really - // need to plumb this through to the connect level. - if (connection_->socket() && !connection_->is_reused()) - SetSocketMotivation(); - if (!using_spdy_) { DCHECK(!expect_spdy_); // We may get ftp scheme when fetching ftp resources through proxy. @@ -1296,14 +1291,6 @@ next_state_ = STATE_INIT_CONNECTION; } -void HttpStreamFactoryImpl::Job::SetSocketMotivation() { - if (request_info_.motivation == HttpRequestInfo::PRECONNECT_MOTIVATED) - connection_->socket()->SetSubresourceSpeculation(); - else if (request_info_.motivation == HttpRequestInfo::OMNIBOX_MOTIVATED) - connection_->socket()->SetOmniboxSpeculation(); - // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). -} - void HttpStreamFactoryImpl::Job::InitSSLConfig(SSLConfig* ssl_config, bool is_proxy) const { if (!is_proxy) {
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 3d0a912..ba9eff3 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -352,6 +352,7 @@ request.method = "GET"; request.url = url; request.load_flags = 0; + request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; session->http_stream_factory()->PreconnectStreams(num_streams, request); mock_factory->WaitForPreconnects(); @@ -377,6 +378,10 @@ return last_num_streams_; } + base::Optional<HttpRequestInfo::RequestMotivation> last_motivation() const { + return last_motivation_; + } + // Resets |last_num_streams_| to its default value. void reset_last_num_streams() { last_num_streams_ = -1; } @@ -394,8 +399,10 @@ void RequestSockets(const std::string& group_name, const void* socket_params, int num_sockets, - const NetLogWithSource& net_log) override { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override { last_num_streams_ = num_sockets; + last_motivation_ = motivation; } void CancelRequest(const std::string& group_name, @@ -427,6 +434,7 @@ private: int last_num_streams_; + base::Optional<HttpRequestInfo::RequestMotivation> last_motivation_; }; typedef CapturePreconnectsSocketPool<TransportClientSocketPool> @@ -646,6 +654,26 @@ EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); } +// Verify that preconnects correctly set motivation for the SocketPool. +TEST_F(HttpStreamFactoryTest, PreconnectSetsMotivation) { + SpdySessionDependencies session_deps(ProxyService::CreateDirect()); + std::unique_ptr<HttpNetworkSession> session( + SpdySessionDependencies::SpdyCreateSession(&session_deps)); + HttpNetworkSessionPeer peer(session.get()); + CapturePreconnectsTransportSocketPool* transport_conn_pool = + new CapturePreconnectsTransportSocketPool( + session_deps.host_resolver.get(), session_deps.cert_verifier.get(), + session_deps.transport_security_state.get(), + session_deps.cert_transparency_verifier.get(), + session_deps.ct_policy_enforcer.get()); + auto mock_pool_manager = std::make_unique<MockClientSocketPoolManager>(); + mock_pool_manager->SetTransportSocketPool(transport_conn_pool); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); + PreconnectHelperForURL(1, GURL("http://www.google.com"), session.get()); + EXPECT_EQ(HttpRequestInfo::PRECONNECT_MOTIVATED, + transport_conn_pool->last_motivation()); +} + TEST_F(HttpStreamFactoryTest, JobNotifiesProxy) { const char* kProxyString = "PROXY bad:99; PROXY maybe:80; DIRECT"; SpdySessionDependencies session_deps(
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc index 9c62fb8..855c730b 100644 --- a/net/http/transport_security_state.cc +++ b/net/http/transport_security_state.cc
@@ -1495,7 +1495,9 @@ base::TimeDelta max_age; bool enforce; GURL report_uri; - if (!ParseExpectCTHeader(value, &max_age, &enforce, &report_uri)) + bool parsed = ParseExpectCTHeader(value, &max_age, &enforce, &report_uri); + UMA_HISTOGRAM_BOOLEAN("Net.ExpectCTHeader.ParseSuccess", parsed); + if (!parsed) return; // Do not persist Expect-CT headers if the connection was not chained to a // public root or did not comply with CT policy.
diff --git a/net/http/transport_security_state_unittest.cc b/net/http/transport_security_state_unittest.cc index 9f14b2cf..3f0ad7f 100644 --- a/net/http/transport_security_state_unittest.cc +++ b/net/http/transport_security_state_unittest.cc
@@ -3399,4 +3399,46 @@ EXPECT_EQ(sct_list[0].sct, reporter.signed_certificate_timestamps()[0].sct); } +// Tests that the dynamic Expect-CT UMA histogram is recorded correctly. +TEST_F(TransportSecurityStateTest, DynamicExpectCTUMA) { + const char kHistogramName[] = "Net.ExpectCTHeader.ParseSuccess"; + SSLInfo ssl; + ssl.is_issued_by_known_root = true; + ssl.ct_compliance_details_available = true; + ssl.ct_cert_policy_compliance = + ct::CertPolicyCompliance::CERT_POLICY_COMPLIES_VIA_SCTS; + + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature( + TransportSecurityState::kDynamicExpectCTFeature); + + // Test that the histogram is recorded correctly when the header successfully + // parses. + { + const char kHeader[] = "max-age=123,enforce,report-uri=\"http://foo.test\""; + base::HistogramTester histograms; + TransportSecurityState state; + MockExpectCTReporter reporter; + state.SetExpectCTReporter(&reporter); + state.ProcessExpectCTHeader(kHeader, HostPortPair("example.test", 443), + ssl); + histograms.ExpectTotalCount(kHistogramName, 1); + histograms.ExpectBucketCount(kHistogramName, true, 1); + } + + // Test that the histogram is recorded correctly when the header fails to + // parse (due to semi-colons instead of commas). + { + const char kHeader[] = "max-age=123;enforce;report-uri=\"http://foo.test\""; + base::HistogramTester histograms; + TransportSecurityState state; + MockExpectCTReporter reporter; + state.SetExpectCTReporter(&reporter); + state.ProcessExpectCTHeader(kHeader, HostPortPair("example.test", 443), + ssl); + histograms.ExpectTotalCount(kHistogramName, 1); + histograms.ExpectBucketCount(kHistogramName, false, 1); + } +} + } // namespace net
diff --git a/net/nqe/OWNERS b/net/nqe/OWNERS index 93f44fa..fa91285a 100644 --- a/net/nqe/OWNERS +++ b/net/nqe/OWNERS
@@ -2,5 +2,5 @@ tbansal@chromium.org ryansturm@chromium.org -# TEAM: nqe-dev@chromium.org +# TEAM: net-dev@chromium.org # COMPONENT: Internals>Network>NetworkQuality \ No newline at end of file
diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index 77fe4c2..8652bce 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h
@@ -16,6 +16,7 @@ #include "net/base/net_export.h" #include "net/base/request_priority.h" #include "net/dns/host_resolver.h" +#include "net/http/http_request_info.h" namespace base { class DictionaryValue; @@ -117,11 +118,15 @@ // ClientSocketPool will assign a priority to the new connections, if any. // This priority will probably be lower than all others, since this method // is intended to make sure ahead of time that |num_sockets| sockets are - // available to talk to a host. - virtual void RequestSockets(const std::string& group_name, - const void* params, - int num_sockets, - const NetLogWithSource& net_log) = 0; + // available to talk to a host. The |motivation| is threaded through connect + // jobs and passed down to StreamSocket implementations. Note that it is not + // passed into already created or idle sockets. + virtual void RequestSockets( + const std::string& group_name, + const void* params, + int num_sockets, + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) = 0; // Called to change the priority of a RequestSocket call that returned // ERR_IO_PENDING and has not yet asynchronously completed. The same handle @@ -210,8 +215,9 @@ const std::string& group_name, const scoped_refptr<typename PoolType::SocketParams>& params, int num_sockets, - const NetLogWithSource& net_log) { - pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { + pool->RequestSockets(group_name, ¶ms, num_sockets, net_log, motivation); } } // namespace net
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 457eb0d..c422fe8 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc
@@ -39,6 +39,15 @@ // after a certain timeout has passed without receiving an ACK. bool g_connect_backup_jobs_enabled = true; +void SetSocketMotivation(StreamSocket* socket, + HttpRequestInfo::RequestMotivation motivation) { + if (motivation == HttpRequestInfo::PRECONNECT_MOTIVATED) + socket->SetSubresourceSpeculation(); + else if (motivation == HttpRequestInfo::OMNIBOX_MOTIVATED) + socket->SetOmniboxSpeculation(); + // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). +} + } // namespace ConnectJob::ConnectJob(const std::string& group_name, @@ -54,6 +63,7 @@ respect_limits_(respect_limits), delegate_(delegate), net_log_(net_log), + motivation_(HttpRequestInfo::NORMAL_MOTIVATION), idle_(true) { DCHECK(!group_name.empty()); DCHECK(delegate); @@ -122,6 +132,9 @@ Delegate* delegate = delegate_; delegate_ = NULL; + if (socket_) + SetSocketMotivation(socket_.get(), motivation_); + LogConnectCompletion(rv); delegate->OnConnectJobComplete(rv, this); } @@ -300,7 +313,8 @@ request->net_log().BeginEvent(NetLogEventType::SOCKET_POOL); Group* group = GetOrCreateGroup(group_name); - int rv = RequestSocketInternal(group_name, *request); + int rv = RequestSocketInternal(group_name, *request, + HttpRequestInfo::NORMAL_MOTIVATION); if (rv != ERR_IO_PENDING) { request->net_log().EndEventWithNetErrorCode(NetLogEventType::SOCKET_POOL, rv); @@ -326,7 +340,8 @@ void ClientSocketPoolBaseHelper::RequestSockets( const std::string& group_name, const Request& request, - int num_sockets) { + int num_sockets, + HttpRequestInfo::RequestMotivation motivation) { DCHECK(request.callback().is_null()); DCHECK(!request.handle()); @@ -350,7 +365,7 @@ for (int num_iterations_left = num_sockets; group->NumActiveSocketSlots() < num_sockets && num_iterations_left > 0 ; num_iterations_left--) { - rv = RequestSocketInternal(group_name, request); + rv = RequestSocketInternal(group_name, request, motivation); if (rv < 0 && rv != ERR_IO_PENDING) { // We're encountering a synchronous error. Give up. if (!base::ContainsKey(group_map_, group_name)) @@ -377,7 +392,8 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal( const std::string& group_name, - const Request& request) { + const Request& request, + HttpRequestInfo::RequestMotivation motivation) { ClientSocketHandle* const handle = request.handle(); const bool preconnecting = !handle; Group* group = GetOrCreateGroup(group_name); @@ -431,6 +447,8 @@ std::unique_ptr<ConnectJob> connect_job( connect_job_factory_->NewConnectJob(group_name, request, this)); + connect_job->set_motivation(motivation); + int rv = connect_job->Connect(); if (rv == OK) { LogBoundConnectJobToRequest(connect_job->net_log().source(), request); @@ -1048,7 +1066,8 @@ return; } - int rv = RequestSocketInternal(group_name, *next_request); + int rv = RequestSocketInternal(group_name, *next_request, + HttpRequestInfo::NORMAL_MOTIVATION); if (rv != ERR_IO_PENDING) { std::unique_ptr<Request> request = group->PopNextPendingRequest(); DCHECK(request);
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index f5073c9..b2474e0 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h
@@ -103,6 +103,10 @@ // error. std::unique_ptr<StreamSocket> PassSocket(); + void set_motivation(HttpRequestInfo::RequestMotivation motivation) { + motivation_ = motivation; + } + // Begins connecting the socket. Returns OK on success, ERR_IO_PENDING if it // cannot complete synchronously without blocking, or another net error code // on error. In asynchronous completion, the ConnectJob will notify @@ -167,6 +171,7 @@ Delegate* delegate_; std::unique_ptr<StreamSocket> socket_; NetLogWithSource net_log_; + HttpRequestInfo::RequestMotivation motivation_; // A ConnectJob is idle until Connect() has been called. bool idle_; @@ -281,7 +286,8 @@ // See ClientSocketPool::RequestSockets for documentation on this function. void RequestSockets(const std::string& group_name, const Request& request, - int num_sockets); + int num_sockets, + HttpRequestInfo::RequestMotivation motivation); // See ClientSocketPool::SetPriority for documentation on this function. void SetPriority(const std::string& group_name, @@ -607,7 +613,8 @@ // it does not handle logging into NetLog of the queueing status of // |request|. int RequestSocketInternal(const std::string& group_name, - const Request& request); + const Request& request, + HttpRequestInfo::RequestMotivation motivation); // Assigns an idle socket for the group to the request. // Returns |true| if an idle socket is available, false otherwise. @@ -795,12 +802,13 @@ void RequestSockets(const std::string& group_name, const scoped_refptr<SocketParams>& params, int num_sockets, - const NetLogWithSource& net_log) { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { const Request request(nullptr /* no handle */, CompletionCallback(), IDLE, ClientSocketPool::RespectLimits::ENABLED, internal::ClientSocketPoolBaseHelper::NO_IDLE_SOCKETS, params, net_log); - helper_.RequestSockets(group_name, request, num_sockets); + helper_.RequestSockets(group_name, request, num_sockets, motivation); } void SetPriority(const std::string& group_name,
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index dd58be9..4911242 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -128,7 +128,8 @@ : connected_(false), has_unread_data_(false), net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)), - was_used_to_convey_data_(false) {} + was_used_to_convey_data_(false), + motivation_(HttpRequestInfo::NORMAL_MOTIVATION) {} // Sets whether the socket has unread data. If true, the next call to Read() // will return 1 byte and IsConnectedAndIdle() will return false. @@ -136,6 +137,8 @@ has_unread_data_ = has_unread_data; } + HttpRequestInfo::RequestMotivation motivation() const { return motivation_; } + // Socket implementation. int Read(IOBuffer* /* buf */, int len, @@ -179,8 +182,12 @@ const NetLogWithSource& NetLog() const override { return net_log_; } - void SetSubresourceSpeculation() override {} - void SetOmniboxSpeculation() override {} + void SetSubresourceSpeculation() override { + motivation_ = HttpRequestInfo::PRECONNECT_MOTIVATED; + } + void SetOmniboxSpeculation() override { + motivation_ = HttpRequestInfo::OMNIBOX_MOTIVATED; + } bool WasEverUsed() const override { return was_used_to_convey_data_; } bool WasAlpnNegotiated() const override { return false; } NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } @@ -200,6 +207,7 @@ bool has_unread_data_; NetLogWithSource net_log_; bool was_used_to_convey_data_; + HttpRequestInfo::RequestMotivation motivation_; DISALLOW_COPY_AND_ASSIGN(MockClientSocket); }; @@ -522,11 +530,13 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override { const scoped_refptr<TestSocketParams>* casted_params = static_cast<const scoped_refptr<TestSocketParams>*>(params); - base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); + base_.RequestSockets(group_name, *casted_params, num_sockets, net_log, + motivation); } void SetPriority(const std::string& group_name, @@ -3085,7 +3095,8 @@ CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); @@ -3139,7 +3150,8 @@ EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); @@ -3201,7 +3213,8 @@ EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(3, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); @@ -3225,7 +3238,8 @@ ASSERT_FALSE(pool_->HasGroup("a")); - pool_->RequestSockets("a", ¶ms_, kDefaultMaxSockets, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, kDefaultMaxSockets, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(kDefaultMaxSockets, pool_->NumConnectJobsInGroup("a")); @@ -3233,7 +3247,8 @@ ASSERT_FALSE(pool_->HasGroup("b")); - pool_->RequestSockets("b", ¶ms_, kDefaultMaxSockets, NetLogWithSource()); + pool_->RequestSockets("b", ¶ms_, kDefaultMaxSockets, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_FALSE(pool_->HasGroup("b")); } @@ -3245,7 +3260,7 @@ ASSERT_FALSE(pool_->HasGroup("a")); pool_->RequestSockets("a", ¶ms_, kDefaultMaxSockets - 1, - NetLogWithSource()); + NetLogWithSource(), HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(kDefaultMaxSockets - 1, pool_->NumConnectJobsInGroup("a")); @@ -3255,7 +3270,8 @@ ASSERT_FALSE(pool_->HasGroup("b")); - pool_->RequestSockets("b", ¶ms_, kDefaultMaxSockets, NetLogWithSource()); + pool_->RequestSockets("b", ¶ms_, kDefaultMaxSockets, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("b")); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("b")); @@ -3281,7 +3297,8 @@ EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); @@ -3307,7 +3324,8 @@ EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); @@ -3320,7 +3338,7 @@ connect_job_factory_->set_job_type(TestConnectJob::kMockJob); pool_->RequestSockets("a", ¶ms_, kDefaultMaxSocketsPerGroup, - NetLogWithSource()); + NetLogWithSource(), HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); @@ -3328,7 +3346,7 @@ EXPECT_EQ(kDefaultMaxSocketsPerGroup, pool_->IdleSocketCountInGroup("a")); pool_->RequestSockets("b", ¶ms_, kDefaultMaxSocketsPerGroup, - NetLogWithSource()); + NetLogWithSource(), HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("b")); EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("b")); @@ -3340,14 +3358,14 @@ connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); pool_->RequestSockets("a", ¶ms_, kDefaultMaxSocketsPerGroup, - NetLogWithSource()); + NetLogWithSource(), HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_FALSE(pool_->HasGroup("a")); connect_job_factory_->set_job_type( TestConnectJob::kMockAdditionalErrorStateJob); pool_->RequestSockets("a", ¶ms_, kDefaultMaxSocketsPerGroup, - NetLogWithSource()); + NetLogWithSource(), HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_FALSE(pool_->HasGroup("a")); } @@ -3356,14 +3374,16 @@ CreatePool(4, 4); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(2, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(2, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); @@ -3399,7 +3419,8 @@ EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(2, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(2, pool_->IdleSocketCountInGroup("a")); @@ -3409,24 +3430,28 @@ CreatePool(4, 4); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(2, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 3, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 3, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(3, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(3, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(3, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(3, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); @@ -3436,7 +3461,8 @@ CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); @@ -3470,7 +3496,8 @@ TEST_F(ClientSocketPoolBaseTest, ConnectedPreconnectJobsHaveNoConnectTimes) { CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type(TestConnectJob::kMockJob); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); @@ -3540,7 +3567,8 @@ // Requesting 2 preconnected sockets for "a" should fail to allocate any more // sockets for "a", and "b" should still have 2 active sockets. - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); @@ -3558,7 +3586,8 @@ EXPECT_EQ(2, pool_->IdleSocketCountInGroup("b")); EXPECT_EQ(0, pool_->NumActiveSocketsInGroup("b")); - pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); @@ -3577,7 +3606,8 @@ connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); connect_job_factory_->set_timeout_duration( base::TimeDelta::FromMilliseconds(500)); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); @@ -3599,7 +3629,8 @@ // Make the ConnectJob hang forever. connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); EXPECT_EQ(1, pool_->NumUnassignedConnectJobsInGroup("a")); EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); @@ -3634,7 +3665,8 @@ CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); connect_job_factory_->set_job_type(TestConnectJob::kMockUnreadDataJob); - pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource()); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); ASSERT_TRUE(pool_->HasGroup("a")); EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); @@ -3666,6 +3698,86 @@ EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); } +// Tests that a socket pool correctly sets a motivation for a preconnected +// socket. +TEST_F(ClientSocketPoolBaseTest, PreconnectSetsMotivation) { + CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); + connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); + + for (auto motivation : {HttpRequestInfo::NORMAL_MOTIVATION, + HttpRequestInfo::PRECONNECT_MOTIVATED, + HttpRequestInfo::OMNIBOX_MOTIVATED}) { + SCOPED_TRACE(::testing::Message() << "motivation: " << motivation); + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), motivation); + + ClientSocketHandle handle; + TestCompletionCallback callback; + EXPECT_EQ( + ERR_IO_PENDING, + handle.Init("a", params_, DEFAULT_PRIORITY, + ClientSocketPool::RespectLimits::ENABLED, + callback.callback(), pool_.get(), NetLogWithSource())); + + EXPECT_THAT(callback.WaitForResult(), IsOk()); + EXPECT_TRUE(handle.is_initialized()); + ASSERT_TRUE(handle.socket()); + EXPECT_EQ(motivation, + static_cast<MockClientSocket*>(handle.socket())->motivation()); + handle.socket()->Disconnect(); + handle.Reset(); + EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); + EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); + EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); + } +} + +// Tests that a socket pool doesn't change motivation on existing sockets. +TEST_F(ClientSocketPoolBaseTest, PreconnectPreservesExistingMotivation) { + CreatePool(3, 3); + connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); + + // We should get one socket of each motivation. + pool_->RequestSockets("a", ¶ms_, 1, NetLogWithSource(), + HttpRequestInfo::NORMAL_MOTIVATION); + pool_->RequestSockets("a", ¶ms_, 2, NetLogWithSource(), + HttpRequestInfo::PRECONNECT_MOTIVATED); + pool_->RequestSockets("a", ¶ms_, 3, NetLogWithSource(), + HttpRequestInfo::OMNIBOX_MOTIVATED); + + EXPECT_EQ(3, pool_->NumConnectJobsInGroup("a")); + EXPECT_EQ(3, pool_->NumUnassignedConnectJobsInGroup("a")); + EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); + + std::vector<ClientSocketHandle> handles(3); + std::vector<TestCompletionCallback> callbacks(3); + + for (size_t i = 0; i < 3; ++i) { + EXPECT_EQ(ERR_IO_PENDING, + handles[i].Init("a", params_, DEFAULT_PRIORITY, + ClientSocketPool::RespectLimits::ENABLED, + callbacks[i].callback(), pool_.get(), + NetLogWithSource())); + } + + for (size_t i = 0; i < 3; ++i) { + EXPECT_THAT(callbacks[i].WaitForResult(), IsOk()); + EXPECT_TRUE(handles[i].is_initialized()); + EXPECT_TRUE(handles[i].socket()); + } + + EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); + EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); + EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); + EXPECT_EQ(3, pool_->NumActiveSocketsInGroup("a")); + + EXPECT_EQ(HttpRequestInfo::NORMAL_MOTIVATION, + static_cast<MockClientSocket*>(handles[0].socket())->motivation()); + EXPECT_EQ(HttpRequestInfo::PRECONNECT_MOTIVATED, + static_cast<MockClientSocket*>(handles[1].socket())->motivation()); + EXPECT_EQ(HttpRequestInfo::OMNIBOX_MOTIVATED, + static_cast<MockClientSocket*>(handles[2].socket())->motivation()); +} + class MockLayeredPool : public HigherLayeredPool { public: MockLayeredPool(TestClientSocketPool* pool,
diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc index 00933b5b..d621708 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc
@@ -80,7 +80,8 @@ ClientSocketHandle* socket_handle, HttpNetworkSession::SocketPoolType socket_pool_type, const OnHostResolutionCallback& resolution_callback, - const CompletionCallback& callback) { + const CompletionCallback& callback, + HttpRequestInfo::RequestMotivation motivation) { scoped_refptr<HttpProxySocketParams> http_proxy_params; scoped_refptr<SOCKSSocketParams> socks_params; std::unique_ptr<HostPortPair> proxy_host_port; @@ -213,7 +214,7 @@ if (num_preconnect_streams) { RequestSocketsForPool(ssl_pool, connection_group, ssl_params, - num_preconnect_streams, net_log); + num_preconnect_streams, net_log, motivation); return OK; } @@ -228,7 +229,7 @@ session->GetSocketPoolForHTTPProxy(socket_pool_type, *proxy_host_port); if (num_preconnect_streams) { RequestSocketsForPool(pool, connection_group, http_proxy_params, - num_preconnect_streams, net_log); + num_preconnect_streams, net_log, motivation); return OK; } @@ -242,7 +243,7 @@ session->GetSocketPoolForSOCKSProxy(socket_pool_type, *proxy_host_port); if (num_preconnect_streams) { RequestSocketsForPool(pool, connection_group, socks_params, - num_preconnect_streams, net_log); + num_preconnect_streams, net_log, motivation); return OK; } @@ -258,7 +259,7 @@ session->GetTransportSocketPool(socket_pool_type); if (num_preconnect_streams) { RequestSocketsForPool(pool, connection_group, tcp_params, - num_preconnect_streams, net_log); + num_preconnect_streams, net_log, motivation); return OK; } @@ -355,7 +356,7 @@ request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin, ssl_config_for_proxy, /*force_tunnel=*/false, privacy_mode, net_log, 0, socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL, - resolution_callback, callback); + resolution_callback, callback, HttpRequestInfo::NORMAL_MOTIVATION); } int InitSocketHandleForWebSocketRequest( @@ -380,7 +381,7 @@ request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin, ssl_config_for_proxy, /*force_tunnel=*/true, privacy_mode, net_log, 0, socket_handle, HttpNetworkSession::WEBSOCKET_SOCKET_POOL, - resolution_callback, callback); + resolution_callback, callback, HttpRequestInfo::NORMAL_MOTIVATION); } int InitSocketHandleForRawConnect(const HostPortPair& host_port_pair, @@ -402,7 +403,7 @@ proxy_info, false, ssl_config_for_origin, ssl_config_for_proxy, /*force_tunnel=*/true, privacy_mode, net_log, 0, socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL, OnHostResolutionCallback(), - callback); + callback, HttpRequestInfo::NORMAL_MOTIVATION); } int InitSocketHandleForTlsConnect(const HostPortPair& endpoint, @@ -424,7 +425,7 @@ /*expect_spdy=*/false, ssl_config_for_origin, ssl_config_for_proxy, /*force_tunnel=*/true, privacy_mode, net_log, 0, socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL, OnHostResolutionCallback(), - callback); + callback, HttpRequestInfo::NORMAL_MOTIVATION); } int PreconnectSocketsForHttpRequest( @@ -440,13 +441,14 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetLogWithSource& net_log, - int num_preconnect_streams) { + int num_preconnect_streams, + HttpRequestInfo::RequestMotivation motivation) { return InitSocketPoolHelper( group_type, endpoint, request_extra_headers, request_load_flags, request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin, ssl_config_for_proxy, /*force_tunnel=*/false, privacy_mode, net_log, num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, - OnHostResolutionCallback(), CompletionCallback()); + OnHostResolutionCallback(), CompletionCallback(), motivation); } } // namespace net
diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index 9c0dae8..125544d 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h
@@ -193,7 +193,8 @@ const SSLConfig& ssl_config_for_proxy, PrivacyMode privacy_mode, const NetLogWithSource& net_log, - int num_preconnect_streams); + int num_preconnect_streams, + HttpRequestInfo::RequestMotivation motivation); } // namespace net
diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index e8a8fb7..f2632f3 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc
@@ -226,14 +226,17 @@ respect_limits, handle, callback, net_log); } -void SOCKSClientSocketPool::RequestSockets(const std::string& group_name, - const void* params, - int num_sockets, - const NetLogWithSource& net_log) { +void SOCKSClientSocketPool::RequestSockets( + const std::string& group_name, + const void* params, + int num_sockets, + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { const scoped_refptr<SOCKSSocketParams>* casted_params = static_cast<const scoped_refptr<SOCKSSocketParams>*>(params); - base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); + base_.RequestSockets(group_name, *casted_params, num_sockets, net_log, + motivation); } void SOCKSClientSocketPool::SetPriority(const std::string& group_name,
diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h index 5b55b6ca3..4eb72e8e 100644 --- a/net/socket/socks_client_socket_pool.h +++ b/net/socket/socks_client_socket_pool.h
@@ -130,7 +130,8 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override; + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override; void SetPriority(const std::string& group_name, ClientSocketHandle* handle,
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 8be83e5..fbeb4762 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc
@@ -649,14 +649,17 @@ respect_limits, handle, callback, net_log); } -void SSLClientSocketPool::RequestSockets(const std::string& group_name, - const void* params, - int num_sockets, - const NetLogWithSource& net_log) { +void SSLClientSocketPool::RequestSockets( + const std::string& group_name, + const void* params, + int num_sockets, + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { const scoped_refptr<SSLSocketParams>* casted_params = static_cast<const scoped_refptr<SSLSocketParams>*>(params); - base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); + base_.RequestSockets(group_name, *casted_params, num_sockets, net_log, + motivation); } void SSLClientSocketPool::SetPriority(const std::string& group_name,
diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index 2d155d4..097cf6c 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h
@@ -225,7 +225,8 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override; + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override; void SetPriority(const std::string& group_name, ClientSocketHandle* handle,
diff --git a/net/socket/stream_socket.cc b/net/socket/stream_socket.cc index 7199cd8..ec5500a 100644 --- a/net/socket/stream_socket.cc +++ b/net/socket/stream_socket.cc
@@ -40,30 +40,13 @@ was_used_to_convey_data_ = true; } - void StreamSocket::UseHistory::set_subresource_speculation() { DCHECK(was_ever_connected_); - // TODO(jar): We should transition to marking a socket (or stream) at - // construction time as being created for speculative reasons. This current - // approach of trying to track use of a socket to convey data can make - // mistakes when other sockets (such as ones sitting in the pool for a long - // time) are issued. Unused sockets can be left over when a when a set of - // connections to a host are made, and one is "unlucky" and takes so long to - // complete a connection, that another socket is used, and recycled before a - // second connection comes available. Similarly, re-try connections can leave - // an original (slow to connect socket) in the pool, and that can be issued - // to a speculative requester. In any cases such old sockets will fail when an - // attempt is made to used them!... and then it will look like a speculative - // socket was discarded without any user!?!?! - if (was_used_to_convey_data_) - return; subresource_speculation_ = true; } void StreamSocket::UseHistory::set_omnibox_speculation() { DCHECK(was_ever_connected_); - if (was_used_to_convey_data_) - return; omnibox_speculation_ = true; }
diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index 2d4484f..1288c09 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc
@@ -517,7 +517,8 @@ const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { const scoped_refptr<TransportSocketParams>* casted_params = static_cast<const scoped_refptr<TransportSocketParams>*>(params); @@ -529,7 +530,8 @@ &casted_params->get()->destination().host_port_pair())); } - base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); + base_.RequestSockets(group_name, *casted_params, num_sockets, net_log, + motivation); } void TransportClientSocketPool::SetPriority(const std::string& group_name,
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index 2aa844b..7633977 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h
@@ -208,7 +208,8 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override; + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override; void SetPriority(const std::string& group_name, ClientSocketHandle* handle, RequestPriority priority) override;
diff --git a/net/socket/websocket_transport_client_socket_pool.cc b/net/socket/websocket_transport_client_socket_pool.cc index 5493385f..785f345d 100644 --- a/net/socket/websocket_transport_client_socket_pool.cc +++ b/net/socket/websocket_transport_client_socket_pool.cc
@@ -386,7 +386,8 @@ const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) { + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) { NOTIMPLEMENTED(); }
diff --git a/net/socket/websocket_transport_client_socket_pool.h b/net/socket/websocket_transport_client_socket_pool.h index 5758e9d7..b6d7392 100644 --- a/net/socket/websocket_transport_client_socket_pool.h +++ b/net/socket/websocket_transport_client_socket_pool.h
@@ -162,7 +162,8 @@ void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const NetLogWithSource& net_log) override; + const NetLogWithSource& net_log, + HttpRequestInfo::RequestMotivation motivation) override; void SetPriority(const std::string& group_name, ClientSocketHandle* handle, RequestPriority priority) override;
diff --git a/net/spdy/chromium/http2_push_promise_index.cc b/net/spdy/chromium/http2_push_promise_index.cc new file mode 100644 index 0000000..0f2da20 --- /dev/null +++ b/net/spdy/chromium/http2_push_promise_index.cc
@@ -0,0 +1,97 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/spdy/chromium/http2_push_promise_index.h" + +#include <utility> + +#include "net/spdy/chromium/spdy_session.h" + +namespace net { + +Http2PushPromiseIndex::Http2PushPromiseIndex() {} +Http2PushPromiseIndex::~Http2PushPromiseIndex() {} + +base::WeakPtr<SpdySession> Http2PushPromiseIndex::Find( + const SpdySessionKey& key, + const GURL& url) { + UnclaimedPushedStreamMap::iterator url_it = + unclaimed_pushed_streams_.find(url); + if (!url.is_empty() && url_it != unclaimed_pushed_streams_.end()) { + DCHECK(url.SchemeIsCryptographic()); + for (WeakSessionList::iterator it = url_it->second.begin(); + it != url_it->second.end();) { + base::WeakPtr<SpdySession> spdy_session = *it; + // Lazy deletion of destroyed SpdySessions. + if (!spdy_session) { + it = url_it->second.erase(it); + continue; + } + ++it; + const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); + if (!(spdy_session_key.proxy_server() == key.proxy_server()) || + !(spdy_session_key.privacy_mode() == key.privacy_mode())) { + continue; + } + if (!spdy_session->VerifyDomainAuthentication( + key.host_port_pair().host())) { + continue; + } + return spdy_session; + } + if (url_it->second.empty()) { + unclaimed_pushed_streams_.erase(url_it); + } + } + + return base::WeakPtr<SpdySession>(); +} + +void Http2PushPromiseIndex::RegisterUnclaimedPushedStream( + GURL url, + base::WeakPtr<SpdySession> spdy_session) { + DCHECK(!url.is_empty()); + // Use lower_bound() so that if key does not exists, then insertion can use + // its return value as a hint. + UnclaimedPushedStreamMap::iterator url_it = + unclaimed_pushed_streams_.lower_bound(url); + if (url_it == unclaimed_pushed_streams_.end() || url_it->first != url) { + WeakSessionList list; + list.push_back(std::move(spdy_session)); + UnclaimedPushedStreamMap::value_type value(std::move(url), std::move(list)); + unclaimed_pushed_streams_.insert(url_it, std::move(value)); + return; + } + url_it->second.push_back(spdy_session); +} + +void Http2PushPromiseIndex::UnregisterUnclaimedPushedStream( + const GURL& url, + SpdySession* spdy_session) { + DCHECK(!url.is_empty()); + UnclaimedPushedStreamMap::iterator url_it = + unclaimed_pushed_streams_.find(url); + DCHECK(url_it != unclaimed_pushed_streams_.end()); + size_t removed = 0; + for (WeakSessionList::iterator it = url_it->second.begin(); + it != url_it->second.end();) { + // Lazy deletion of destroyed SpdySessions. + if (!*it) { + it = url_it->second.erase(it); + continue; + } + if (it->get() == spdy_session) { + it = url_it->second.erase(it); + ++removed; + break; + } + ++it; + } + if (url_it->second.empty()) { + unclaimed_pushed_streams_.erase(url_it); + } + DCHECK_EQ(1u, removed); +} + +} // namespace net
diff --git a/net/spdy/chromium/http2_push_promise_index.h b/net/spdy/chromium/http2_push_promise_index.h new file mode 100644 index 0000000..1c149f1 --- /dev/null +++ b/net/spdy/chromium/http2_push_promise_index.h
@@ -0,0 +1,51 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_SPDY_CHROMIUM_HTTP2_PUSH_PROMISE_INDEX_H_ +#define NET_SPDY_CHROMIUM_HTTP2_PUSH_PROMISE_INDEX_H_ + +#include <map> +#include <vector> + +#include "base/memory/weak_ptr.h" +#include "net/base/net_export.h" +#include "net/spdy/chromium/spdy_session_key.h" +#include "url/gurl.h" + +namespace net { + +class SpdySession; + +class NET_EXPORT Http2PushPromiseIndex { + public: + Http2PushPromiseIndex(); + ~Http2PushPromiseIndex(); + Http2PushPromiseIndex(const Http2PushPromiseIndex&) = delete; + + // If there is a session for |key| that has an unclaimed push stream for + // |url|, return it. Otherwise return nullptr. + base::WeakPtr<SpdySession> Find(const SpdySessionKey& key, const GURL& url); + + // (Un)register a SpdySession with an unclaimed pushed stream for |url|, so + // that the right SpdySession can be served by FindAvailableSession. + void RegisterUnclaimedPushedStream(GURL url, + base::WeakPtr<SpdySession> spdy_session); + void UnregisterUnclaimedPushedStream(const GURL& url, + SpdySession* spdy_session); + + private: + typedef std::vector<base::WeakPtr<SpdySession>> WeakSessionList; + typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap; + + // A map of all SpdySessions owned by |this| that have an unclaimed pushed + // streams for a GURL. Might contain invalid WeakPtr's. + // A single SpdySession can only have at most one pushed stream for each GURL, + // but it is possible that multiple SpdySessions have pushed streams for the + // same GURL. + UnclaimedPushedStreamMap unclaimed_pushed_streams_; +}; + +} // namespace net + +#endif // NET_SPDY_CHROMIUM_HTTP2_PUSH_PROMISE_INDEX_H_
diff --git a/net/spdy/chromium/spdy_http_utils.cc b/net/spdy/chromium/spdy_http_utils.cc index e623b84..7af36e3 100644 --- a/net/spdy/chromium/spdy_http_utils.cc +++ b/net/spdy/chromium/spdy_http_utils.cc
@@ -43,7 +43,7 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, HttpResponseInfo* response) { // The ":status" header is required. - SpdyHeaderBlock::const_iterator it = headers.find(":status"); + SpdyHeaderBlock::const_iterator it = headers.find(kHttp2StatusHeader); if (it == headers.end()) return false; SpdyString status = it->second.as_string(); @@ -89,13 +89,13 @@ const HttpRequestHeaders& request_headers, bool direct, SpdyHeaderBlock* headers) { - (*headers)[":method"] = info.method; + (*headers)[kHttp2MethodHeader] = info.method; if (info.method == "CONNECT") { - (*headers)[":authority"] = GetHostAndPort(info.url); + (*headers)[kHttp2AuthorityHeader] = GetHostAndPort(info.url); } else { - (*headers)[":authority"] = GetHostAndOptionalPort(info.url); - (*headers)[":scheme"] = info.url.scheme(); - (*headers)[":path"] = info.url.PathForRequest(); + (*headers)[kHttp2AuthorityHeader] = GetHostAndOptionalPort(info.url); + (*headers)[kHttp2SchemeHeader] = info.url.scheme(); + (*headers)[kHttp2PathHeader] = info.url.PathForRequest(); } HttpRequestHeaders::Iterator it(request_headers); @@ -148,18 +148,18 @@ } GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers) { - SpdyHeaderBlock::const_iterator it = headers.find(":scheme"); + SpdyHeaderBlock::const_iterator it = headers.find(kHttp2SchemeHeader); if (it == headers.end()) return GURL(); SpdyString url = it->second.as_string(); url.append("://"); - it = headers.find(":authority"); + it = headers.find(kHttp2AuthorityHeader); if (it == headers.end()) return GURL(); url.append(it->second.as_string()); - it = headers.find(":path"); + it = headers.find(kHttp2PathHeader); if (it == headers.end()) return GURL(); url.append(it->second.as_string());
diff --git a/net/spdy/chromium/spdy_network_transaction_unittest.cc b/net/spdy/chromium/spdy_network_transaction_unittest.cc index e3a319b..3a95020 100644 --- a/net/spdy/chromium/spdy_network_transaction_unittest.cc +++ b/net/spdy/chromium/spdy_network_transaction_unittest.cc
@@ -2887,9 +2887,9 @@ // those pieces in. SpdyFramer response_spdy_framer(SpdyFramer::ENABLE_COMPRESSION); SpdyHeaderBlock push_promise_header_block; - push_promise_header_block[spdy_util_.GetHostKey()] = ""; - push_promise_header_block[spdy_util_.GetSchemeKey()] = ""; - push_promise_header_block[spdy_util_.GetPathKey()] = "/index.html"; + push_promise_header_block[kHttp2AuthorityHeader] = ""; + push_promise_header_block[kHttp2SchemeHeader] = ""; + push_promise_header_block[kHttp2PathHeader] = "/index.html"; SpdyPushPromiseIR push_promise(1, 2, std::move(push_promise_header_block)); SpdySerializedFrame push_promise_frame( @@ -2964,7 +2964,7 @@ SpdySerializedFrame stream1_reply( spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); SpdyHeaderBlock incomplete_headers; - incomplete_headers[spdy_util_.GetStatusKey()] = "200 OK"; + incomplete_headers[kHttp2StatusHeader] = "200 OK"; incomplete_headers["hello"] = "bye"; SpdySerializedFrame stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( std::move(incomplete_headers), 2, 1)); @@ -3269,26 +3269,26 @@ {true, {1, 3}, {{"cookie", "val1,val2", nullptr}, - {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), - "/index.php", "vary", "cookie", nullptr}}}, + {kHttp2StatusHeader, "200", kHttp2PathHeader, "/index.php", "vary", + "cookie", nullptr}}}, {// Multiple vary fields. true, {2, 4}, {{"friend", "barney", "enemy", "snaggletooth", nullptr}, - {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), - "/index.php", "vary", "friend", "vary", "enemy", nullptr}}}, + {kHttp2StatusHeader, "200", kHttp2PathHeader, "/index.php", "vary", + "friend", "vary", "enemy", nullptr}}}, {// Test a '*' vary field. false, {1, 3}, {{"cookie", "val1,val2", nullptr}, - {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), - "/index.php", "vary", "*", nullptr}}}, + {kHttp2StatusHeader, "200", kHttp2PathHeader, "/index.php", "vary", "*", + nullptr}}}, {// Multiple comma-separated vary fields. true, {2, 3}, {{"friend", "barney", "enemy", "snaggletooth", nullptr}, - {spdy_util_.GetStatusKey(), "200", spdy_util_.GetPathKey(), - "/index.php", "vary", "friend,enemy", nullptr}}}}; + {kHttp2StatusHeader, "200", kHttp2PathHeader, "/index.php", "vary", + "friend,enemy", nullptr}}}}; for (size_t i = 0; i < arraysize(test_cases); ++i) { SpdyTestUtil spdy_test_util; @@ -3370,12 +3370,12 @@ // Response headers missing status header { 3, - {spdy_util_.GetPathKey(), "/index.php", "cookie", "val1", "cookie", - "val2", nullptr}, + {kHttp2PathHeader, "/index.php", "cookie", "val1", "cookie", "val2", + nullptr}, }, // Response headers missing version header { - 1, {spdy_util_.GetPathKey(), "/index.php", "status", "200", nullptr}, + 1, {kHttp2PathHeader, "/index.php", "status", "200", nullptr}, }, // Response headers with no headers { @@ -3607,11 +3607,11 @@ ASSERT_TRUE(entries[pos].params->GetList("headers", &header_list)); std::vector<SpdyString> expected; - expected.push_back(SpdyString(spdy_util_.GetHostKey()) + ": www.example.org"); - expected.push_back(SpdyString(spdy_util_.GetPathKey()) + ": /"); - expected.push_back(SpdyString(spdy_util_.GetSchemeKey()) + ": " + + expected.push_back(SpdyString(kHttp2AuthorityHeader) + ": www.example.org"); + expected.push_back(SpdyString(kHttp2PathHeader) + ": /"); + expected.push_back(SpdyString(kHttp2SchemeHeader) + ": " + default_url_.scheme()); - expected.push_back(SpdyString(spdy_util_.GetMethodKey()) + ": GET"); + expected.push_back(SpdyString(kHttp2MethodHeader) + ": GET"); expected.push_back("user-agent: Chrome"); EXPECT_EQ(expected.size(), header_list->GetSize()); for (std::vector<SpdyString>::const_iterator it = expected.begin(); @@ -4711,7 +4711,7 @@ std::move(initial_headers), 2, 1)); SpdyHeaderBlock late_headers; - late_headers[spdy_util_.GetStatusKey()] = "200"; + late_headers[kHttp2StatusHeader] = "200"; late_headers["hello"] = "bye"; SpdySerializedFrame stream2_headers(spdy_util_.ConstructSpdyResponseHeaders( 2, std::move(late_headers), false)); @@ -4770,7 +4770,7 @@ std::move(initial_headers), 2, 1)); SpdySerializedFrame stream1_body(spdy_util_.ConstructSpdyDataFrame(1, true)); SpdyHeaderBlock late_headers; - late_headers[spdy_util_.GetStatusKey()] = "200"; + late_headers[kHttp2StatusHeader] = "200"; late_headers["hello"] = "bye"; SpdySerializedFrame stream2_headers(spdy_util_.ConstructSpdyResponseHeaders( 2, std::move(late_headers), false)); @@ -6495,7 +6495,7 @@ MockWrite writes[] = {CreateMockWrite(req, 0)}; SpdyHeaderBlock informational_headers; - informational_headers[spdy_util_.GetStatusKey()] = "100"; + informational_headers[kHttp2StatusHeader] = "100"; SpdySerializedFrame informational_response( spdy_util_.ConstructSpdyReply(1, std::move(informational_headers))); SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
diff --git a/net/spdy/chromium/spdy_proxy_client_socket_unittest.cc b/net/spdy/chromium/spdy_proxy_client_socket_unittest.cc index 372d162..657f36b 100644 --- a/net/spdy/chromium/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/chromium/spdy_proxy_client_socket_unittest.cc
@@ -297,14 +297,14 @@ void SpdyProxyClientSocketTest::PopulateConnectRequestIR( SpdyHeaderBlock* block) { - (*block)[spdy_util_.GetMethodKey()] = "CONNECT"; - (*block)[spdy_util_.GetHostKey()] = kOriginHostPort; + (*block)[kHttp2MethodHeader] = "CONNECT"; + (*block)[kHttp2AuthorityHeader] = kOriginHostPort; (*block)["user-agent"] = kUserAgent; } void SpdyProxyClientSocketTest::PopulateConnectReplyIR(SpdyHeaderBlock* block, const char* status) { - (*block)[spdy_util_.GetStatusKey()] = status; + (*block)[kHttp2StatusHeader] = status; } // Constructs a standard SPDY HEADERS frame for a CONNECT request.
diff --git a/net/spdy/chromium/spdy_session.cc b/net/spdy/chromium/spdy_session.cc index bc50626b..0c45f142 100644 --- a/net/spdy/chromium/spdy_session.cc +++ b/net/spdy/chromium/spdy_session.cc
@@ -640,8 +640,8 @@ DCHECK(it != end()); // Only allow cross-origin push for secure resources. if (it->first.SchemeIsCryptographic()) { - spdy_session_->pool_->UnregisterUnclaimedPushedStream(it->first, - spdy_session_); + spdy_session_->pool_->push_promise_index()->UnregisterUnclaimedPushedStream( + it->first, spdy_session_); } return streams_.erase(it); } @@ -655,7 +655,7 @@ DCHECK(spdy_session_->pool_); // Only allow cross-origin push for https resources. if (url.SchemeIsCryptographic()) { - spdy_session_->pool_->RegisterUnclaimedPushedStream( + spdy_session_->pool_->push_promise_index()->RegisterUnclaimedPushedStream( url, spdy_session_->GetWeakPtr()); } return streams_.insert( @@ -1632,7 +1632,7 @@ // "Promised requests MUST be cacheable and MUST be safe [...]" (RFC7540 // Section 8.2). Only cacheable safe request methods are GET and HEAD. - SpdyHeaderBlock::const_iterator it = headers.find(":method"); + SpdyHeaderBlock::const_iterator it = headers.find(kHttp2MethodHeader); if (it == headers.end() || (it->second.compare("GET") != 0 && it->second.compare("HEAD") != 0)) { EnqueueResetStreamFrame(
diff --git a/net/spdy/chromium/spdy_session_pool.cc b/net/spdy/chromium/spdy_session_pool.cc index fe5c61a3..0385182f 100644 --- a/net/spdy/chromium/spdy_session_pool.cc +++ b/net/spdy/chromium/spdy_session_pool.cc
@@ -136,33 +136,9 @@ const GURL& url, bool enable_ip_based_pooling, const NetLogWithSource& net_log) { - UnclaimedPushedStreamMap::iterator url_it = - unclaimed_pushed_streams_.find(url); - if (!url.is_empty() && url_it != unclaimed_pushed_streams_.end()) { - DCHECK(url.SchemeIsCryptographic()); - for (WeakSessionList::iterator it = url_it->second.begin(); - it != url_it->second.end();) { - base::WeakPtr<SpdySession> spdy_session = *it; - // Lazy deletion of destroyed SpdySessions. - if (!spdy_session) { - it = url_it->second.erase(it); - continue; - } - ++it; - const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); - if (!(spdy_session_key.proxy_server() == key.proxy_server()) || - !(spdy_session_key.privacy_mode() == key.privacy_mode())) { - continue; - } - if (!spdy_session->VerifyDomainAuthentication( - key.host_port_pair().host())) { - continue; - } - return spdy_session; - } - if (url_it->second.empty()) { - unclaimed_pushed_streams_.erase(url_it); - } + base::WeakPtr<SpdySession> session = push_promise_index_.Find(key, url); + if (session) { + return session; } AvailableSessionMap::iterator it = LookupAvailableSessionByKey(key); @@ -305,52 +281,6 @@ } } -void SpdySessionPool::RegisterUnclaimedPushedStream( - GURL url, - base::WeakPtr<SpdySession> spdy_session) { - DCHECK(!url.is_empty()); - // This SpdySessionPool must own |spdy_session|. - DCHECK(base::ContainsKey(sessions_, spdy_session.get())); - UnclaimedPushedStreamMap::iterator url_it = - unclaimed_pushed_streams_.lower_bound(url); - if (url_it == unclaimed_pushed_streams_.end() || url_it->first != url) { - WeakSessionList list; - list.push_back(std::move(spdy_session)); - UnclaimedPushedStreamMap::value_type value(std::move(url), std::move(list)); - unclaimed_pushed_streams_.insert(url_it, std::move(value)); - return; - } - url_it->second.push_back(spdy_session); -} - -void SpdySessionPool::UnregisterUnclaimedPushedStream( - const GURL& url, - SpdySession* spdy_session) { - DCHECK(!url.is_empty()); - UnclaimedPushedStreamMap::iterator url_it = - unclaimed_pushed_streams_.find(url); - DCHECK(url_it != unclaimed_pushed_streams_.end()); - size_t removed = 0; - for (WeakSessionList::iterator it = url_it->second.begin(); - it != url_it->second.end();) { - // Lazy deletion of destroyed SpdySessions. - if (!*it) { - it = url_it->second.erase(it); - continue; - } - if (it->get() == spdy_session) { - it = url_it->second.erase(it); - ++removed; - break; - } - ++it; - } - if (url_it->second.empty()) { - unclaimed_pushed_streams_.erase(url_it); - } - DCHECK_EQ(1u, removed); -} - std::unique_ptr<base::Value> SpdySessionPool::SpdySessionPoolInfoToValue() const { auto list = std::make_unique<base::ListValue>();
diff --git a/net/spdy/chromium/spdy_session_pool.h b/net/spdy/chromium/spdy_session_pool.h index 077fc56f..8b3ba5e 100644 --- a/net/spdy/chromium/spdy_session_pool.h +++ b/net/spdy/chromium/spdy_session_pool.h
@@ -25,6 +25,7 @@ #include "net/http/http_stream_factory_impl_request.h" #include "net/proxy/proxy_config.h" #include "net/proxy/proxy_server.h" +#include "net/spdy/chromium/http2_push_promise_index.h" #include "net/spdy/chromium/server_push_delegate.h" #include "net/spdy/chromium/spdy_session_key.h" #include "net/spdy/core/spdy_protocol.h" @@ -126,13 +127,6 @@ // closing the current ones. void CloseAllSessions(); - // (Un)register a SpdySession with an unclaimed pushed stream for |url|, so - // that the right SpdySession can be served by FindAvailableSession. - void RegisterUnclaimedPushedStream(GURL url, - base::WeakPtr<SpdySession> spdy_session); - void UnregisterUnclaimedPushedStream(const GURL& url, - SpdySession* spdy_session); - // Creates a Value summary of the state of the spdy session pool. std::unique_ptr<base::Value> SpdySessionPoolInfoToValue() const; @@ -140,6 +134,8 @@ return http_server_properties_; } + Http2PushPromiseIndex* push_promise_index() { return &push_promise_index_; } + void set_server_push_delegate(ServerPushDelegate* push_delegate) { push_delegate_ = push_delegate; } @@ -207,7 +203,6 @@ typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> > AvailableSessionMap; typedef std::map<IPEndPoint, SpdySessionKey> AliasMap; - typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap; // Returns true iff |session| is in |available_sessions_|. bool IsSessionAvailable(const base::WeakPtr<SpdySession>& session) const; @@ -256,12 +251,8 @@ // A map of IPEndPoint aliases for sessions. AliasMap aliases_; - // A map of all SpdySessions owned by |this| that have an unclaimed pushed - // streams for a GURL. Might contain invalid WeakPtr's. - // A single SpdySession can only have at most one pushed stream for each GURL, - // but it is possible that multiple SpdySessions have pushed streams for the - // same GURL. - UnclaimedPushedStreamMap unclaimed_pushed_streams_; + // The index of all unclaimed pushed streams of all SpdySessions in this pool. + Http2PushPromiseIndex push_promise_index_; const scoped_refptr<SSLConfigService> ssl_config_service_; HostResolver* const resolver_;
diff --git a/net/spdy/chromium/spdy_stream.cc b/net/spdy/chromium/spdy_stream.cc index 005dc57b..8448ef7 100644 --- a/net/spdy/chromium/spdy_stream.cc +++ b/net/spdy/chromium/spdy_stream.cc
@@ -379,7 +379,8 @@ DCHECK(response_headers_.empty()); { - SpdyHeaderBlock::const_iterator it = response_headers.find(":status"); + SpdyHeaderBlock::const_iterator it = + response_headers.find(kHttp2StatusHeader); if (it == response_headers.end()) { const SpdyString error("Response headers do not include :status."); LogStreamError(ERR_SPDY_PROTOCOL_ERROR, error);
diff --git a/net/spdy/chromium/spdy_stream_unittest.cc b/net/spdy/chromium/spdy_stream_unittest.cc index 7b416f7..09cfa5c 100644 --- a/net/spdy/chromium/spdy_stream_unittest.cc +++ b/net/spdy/chromium/spdy_stream_unittest.cc
@@ -194,7 +194,7 @@ EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); EXPECT_TRUE(delegate.send_headers_completed()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(kPostBody, kPostBodyLength), delegate.TakeReceivedData()); EXPECT_TRUE(data.AllWriteDataConsumed()); @@ -272,7 +272,7 @@ EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); EXPECT_TRUE(delegate.send_headers_completed()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); const SpdyHeaderBlock& received_trailers = delegate.trailers(); SpdyHeaderBlock::const_iterator it = received_trailers.find("foo"); EXPECT_EQ("bar", it->second); @@ -364,11 +364,11 @@ EXPECT_FALSE(load_timing_info.push_end.is_null()); EXPECT_THAT(delegate.WaitForClose(), IsOk()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(msg, delegate.TakeReceivedData()); EXPECT_THAT(push_delegate.WaitForClose(), IsOk()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(pushed_msg, push_delegate.TakeReceivedData()); } @@ -422,7 +422,7 @@ const SpdyStreamId stream_id = delegate.stream_id(); EXPECT_TRUE(delegate.send_headers_completed()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(kPostBody, kPostBodyLength), delegate.TakeReceivedData()); EXPECT_TRUE(data.AllWriteDataConsumed()); @@ -492,7 +492,7 @@ EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); EXPECT_TRUE(delegate.send_headers_completed()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(), delegate.TakeReceivedData()); EXPECT_TRUE(data.AllWriteDataConsumed()); } @@ -545,7 +545,7 @@ EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); EXPECT_TRUE(delegate.send_headers_completed()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(), delegate.TakeReceivedData()); EXPECT_TRUE(data.AllWriteDataConsumed()); } @@ -676,10 +676,10 @@ // Response headers without ":status" header field: protocol error. SpdyHeaderBlock header_block_without_status; - header_block_without_status[spdy_util_.GetMethodKey()] = "GET"; - header_block_without_status[spdy_util_.GetHostKey()] = "www.example.org"; - header_block_without_status[spdy_util_.GetSchemeKey()] = "https"; - header_block_without_status[spdy_util_.GetPathKey()] = "/"; + header_block_without_status[kHttp2MethodHeader] = "GET"; + header_block_without_status[kHttp2AuthorityHeader] = "www.example.org"; + header_block_without_status[kHttp2SchemeHeader] = "https"; + header_block_without_status[kHttp2PathHeader] = "/"; SpdySerializedFrame reply( spdy_util_.ConstructSpdyReply(1, std::move(header_block_without_status))); AddRead(reply); @@ -741,10 +741,10 @@ // Response headers without ":status" header field: protocol error. SpdyHeaderBlock header_block_without_status; - header_block_without_status[spdy_util_.GetMethodKey()] = "GET"; - header_block_without_status[spdy_util_.GetHostKey()] = "www.example.org"; - header_block_without_status[spdy_util_.GetSchemeKey()] = "https"; - header_block_without_status[spdy_util_.GetPathKey()] = "/"; + header_block_without_status[kHttp2MethodHeader] = "GET"; + header_block_without_status[kHttp2AuthorityHeader] = "www.example.org"; + header_block_without_status[kHttp2SchemeHeader] = "https"; + header_block_without_status[kHttp2PathHeader] = "/"; SpdySerializedFrame pushed_reply( spdy_util_.ConstructSpdyReply(2, std::move(header_block_without_status))); AddRead(pushed_reply); @@ -785,7 +785,7 @@ EXPECT_EQ(kDefaultUrl, stream->GetUrlFromHeaders().spec()); EXPECT_THAT(delegate.WaitForClose(), IsOk()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(kPostBody, kPostBodyLength), delegate.TakeReceivedData()); @@ -895,7 +895,7 @@ EXPECT_EQ(kDefaultUrl, stream->GetUrlFromHeaders().spec()); EXPECT_THAT(delegate.WaitForClose(), IsOk()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(kPostBody, kPostBodyLength), delegate.TakeReceivedData()); @@ -1074,7 +1074,7 @@ EXPECT_EQ(kDefaultUrl, stream->GetUrlFromHeaders().spec()); EXPECT_THAT(delegate.WaitForClose(), IsOk()); - EXPECT_EQ("200", delegate.GetResponseHeaderValue(spdy_util_.GetStatusKey())); + EXPECT_EQ("200", delegate.GetResponseHeaderValue(kHttp2StatusHeader)); EXPECT_EQ(SpdyString(kPostBody, kPostBodyLength), delegate.TakeReceivedData());
diff --git a/net/spdy/chromium/spdy_test_util_common.cc b/net/spdy/chromium/spdy_test_util_common.cc index 0f376f1..213b208 100644 --- a/net/spdy/chromium/spdy_test_util_common.cc +++ b/net/spdy/chromium/spdy_test_util_common.cc
@@ -677,9 +677,9 @@ SpdyHeaderBlock* headers) const { SpdyString scheme, host, path; ParseUrl(url, &scheme, &host, &path); - (*headers)[GetHostKey()] = host; - (*headers)[GetSchemeKey()] = scheme; - (*headers)[GetPathKey()] = path; + (*headers)[kHttp2AuthorityHeader] = host; + (*headers)[kHttp2SchemeHeader] = scheme; + (*headers)[kHttp2PathHeader] = path; } // static @@ -820,7 +820,7 @@ RequestPriority request_priority, bool direct) { SpdyHeaderBlock block; - block[GetMethodKey()] = "GET"; + block[kHttp2MethodHeader] = "GET"; AddUrlToHeaderBlock(default_url_.spec(), &block); AppendToHeaderBlock(extra_headers, extra_header_count, &block); return ConstructSpdyHeaders(stream_id, std::move(block), request_priority, @@ -834,8 +834,8 @@ RequestPriority priority, const HostPortPair& host_port_pair) { SpdyHeaderBlock block; - block[GetMethodKey()] = "CONNECT"; - block[GetHostKey()] = host_port_pair.ToString(); + block[kHttp2MethodHeader] = "CONNECT"; + block[kHttp2AuthorityHeader] = host_port_pair.ToString(); AppendToHeaderBlock(extra_headers, extra_header_count, &block); return ConstructSpdyHeaders(stream_id, std::move(block), priority, false); } @@ -847,7 +847,7 @@ int associated_stream_id, const char* url) { SpdyHeaderBlock push_promise_header_block; - push_promise_header_block[GetMethodKey()] = "GET"; + push_promise_header_block[kHttp2MethodHeader] = "GET"; AddUrlToHeaderBlock(url, &push_promise_header_block); SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, std::move(push_promise_header_block)); @@ -855,7 +855,7 @@ response_spdy_framer_.SerializeFrame(push_promise)); SpdyHeaderBlock headers_header_block; - headers_header_block[GetStatusKey()] = "200"; + headers_header_block[kHttp2StatusHeader] = "200"; headers_header_block["hello"] = "bye"; AppendToHeaderBlock(extra_headers, extra_header_count, &headers_header_block); SpdyHeadersIR headers(stream_id, std::move(headers_header_block)); @@ -874,7 +874,7 @@ const char* status, const char* location) { SpdyHeaderBlock push_promise_header_block; - push_promise_header_block[GetMethodKey()] = "GET"; + push_promise_header_block[kHttp2MethodHeader] = "GET"; AddUrlToHeaderBlock(url, &push_promise_header_block); SpdyPushPromiseIR push_promise(associated_stream_id, stream_id, std::move(push_promise_header_block)); @@ -883,7 +883,7 @@ SpdyHeaderBlock headers_header_block; headers_header_block["hello"] = "bye"; - headers_header_block[GetStatusKey()] = status; + headers_header_block[kHttp2StatusHeader] = status; headers_header_block["location"] = location; AppendToHeaderBlock(extra_headers, extra_header_count, &headers_header_block); SpdyHeadersIR headers(stream_id, std::move(headers_header_block)); @@ -908,7 +908,7 @@ const char* const extra_headers[], int extra_header_count) { SpdyHeaderBlock header_block; - header_block[GetStatusKey()] = "200"; + header_block[kHttp2StatusHeader] = "200"; AppendToHeaderBlock(extra_headers, extra_header_count, &header_block); SpdyHeadersIR headers(stream_id, std::move(header_block)); return SpdySerializedFrame(response_spdy_framer_.SerializeFrame(headers)); @@ -968,7 +968,7 @@ int extra_header_count, int stream_id) { SpdyHeaderBlock block; - block[GetStatusKey()] = status; + block[kHttp2StatusHeader] = status; block["hello"] = "bye"; AppendToHeaderBlock(extra_headers, extra_header_count, &block); @@ -984,7 +984,7 @@ int extra_header_count, int stream_id) { SpdyHeaderBlock block; - block[GetStatusKey()] = "200"; + block[kHttp2StatusHeader] = "200"; block["hello"] = "bye"; AppendToHeaderBlock(extra_headers, extra_header_count, &block); @@ -1007,7 +1007,7 @@ const char* const extra_headers[], int extra_header_count) { SpdyHeaderBlock block; - block[GetMethodKey()] = "POST"; + block[kHttp2MethodHeader] = "POST"; AddUrlToHeaderBlock(default_url_.spec(), &block); AppendToHeaderBlock(extra_headers, extra_header_count, &block); return ConstructSpdyHeaders(1, std::move(block), LOWEST, false); @@ -1072,41 +1072,16 @@ } // static -const char* SpdyTestUtil::GetMethodKey() { - return ":method"; -} - -// static -const char* SpdyTestUtil::GetStatusKey() { - return ":status"; -} - -// static -const char* SpdyTestUtil::GetHostKey() { - return ":authority"; -} - -// static -const char* SpdyTestUtil::GetSchemeKey() { - return ":scheme"; -} - -// static -const char* SpdyTestUtil::GetPathKey() { - return ":path"; -} - -// static SpdyHeaderBlock SpdyTestUtil::ConstructHeaderBlock(SpdyStringPiece method, SpdyStringPiece url, int64_t* content_length) { SpdyString scheme, host, path; ParseUrl(url, &scheme, &host, &path); SpdyHeaderBlock headers; - headers[GetMethodKey()] = method.as_string(); - headers[GetHostKey()] = host.c_str(); - headers[GetSchemeKey()] = scheme.c_str(); - headers[GetPathKey()] = path.c_str(); + headers[kHttp2MethodHeader] = method.as_string(); + headers[kHttp2AuthorityHeader] = host.c_str(); + headers[kHttp2SchemeHeader] = scheme.c_str(); + headers[kHttp2PathHeader] = path.c_str(); if (content_length) { SpdyString length_str = base::Int64ToString(*content_length); headers["content-length"] = length_str;
diff --git a/net/spdy/chromium/spdy_test_util_common.h b/net/spdy/chromium/spdy_test_util_common.h index cde3bd4..830ec523 100644 --- a/net/spdy/chromium/spdy_test_util_common.h +++ b/net/spdy/chromium/spdy_test_util_common.h
@@ -503,12 +503,6 @@ void set_default_url(const GURL& url) { default_url_ = url; } - static const char* GetMethodKey(); - static const char* GetStatusKey(); - static const char* GetHostKey(); - static const char* GetSchemeKey(); - static const char* GetPathKey(); - private: // |content_length| may be NULL, in which case the content-length // header will be omitted.
diff --git a/net/spdy/core/spdy_protocol.h b/net/spdy/core/spdy_protocol.h index 4672535..8cd216f6 100644 --- a/net/spdy/core/spdy_protocol.h +++ b/net/spdy/core/spdy_protocol.h
@@ -302,13 +302,13 @@ extern const char* const kHttp2Npn; // Names of pseudo-headers defined for HTTP/2 requests. -extern const char* const kHttp2AuthorityHeader; -extern const char* const kHttp2MethodHeader; -extern const char* const kHttp2PathHeader; -extern const char* const kHttp2SchemeHeader; +SPDY_EXPORT_PRIVATE extern const char* const kHttp2AuthorityHeader; +SPDY_EXPORT_PRIVATE extern const char* const kHttp2MethodHeader; +SPDY_EXPORT_PRIVATE extern const char* const kHttp2PathHeader; +SPDY_EXPORT_PRIVATE extern const char* const kHttp2SchemeHeader; // Name of pseudo-header defined for HTTP/2 responses. -extern const char* const kHttp2StatusHeader; +SPDY_EXPORT_PRIVATE extern const char* const kHttp2StatusHeader; // Variant type (i.e. tagged union) that is either a SPDY 3.x priority value, // or else an HTTP/2 stream dependency tuple {parent stream ID, weight,
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index bda77db..9421166 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc
@@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "base/optional.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -242,9 +243,17 @@ // Notify EventHandler. event_handler_->OnSessionAuthenticated(this); + const HostSessionOptions host_session_options( + host_experiment_session_plugin_.configuration()); + + base::Optional<std::string> video_codec = + host_session_options.Get("Video-Codec"); + if (video_codec) { + connection_->SetPreferredVideoCodec(*video_codec); + } + DesktopEnvironmentOptions options = desktop_environment_options_; - options.ApplyHostSessionOptions(HostSessionOptions( - host_experiment_session_plugin_.configuration())); + options.ApplyHostSessionOptions(host_session_options); // Create the desktop environment. Drop the connection if it could not be // created for any reason (for instance the curtain could not initialize). desktop_environment_ =
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index ce7934f9..9de3b861 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h
@@ -62,11 +62,11 @@ std::unique_ptr<MessagePipe> pipe) = 0; protected: - virtual ~EventHandler() {} + virtual ~EventHandler() = default; }; - ConnectionToClient() {} - virtual ~ConnectionToClient() {} + ConnectionToClient() = default; + virtual ~ConnectionToClient() = default; // Set |event_handler| for connection events. Must be called once when this // object is created. @@ -99,6 +99,10 @@ virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; virtual void set_host_stub(HostStub* host_stub) = 0; virtual void set_input_stub(InputStub* input_stub) = 0; + + // Set the preferred video codec for the connection. Implementations can + // ignore this function if no extra codec can be chosen from. + virtual void SetPreferredVideoCodec(const std::string& codec) {} }; } // namespace protocol
diff --git a/remoting/protocol/sdp_message.cc b/remoting/protocol/sdp_message.cc index 3cd8354..27dda80b 100644 --- a/remoting/protocol/sdp_message.cc +++ b/remoting/protocol/sdp_message.cc
@@ -4,6 +4,10 @@ #include "remoting/protocol/sdp_message.h" +#include <algorithm> + +#include "base/logging.h" +#include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -11,8 +15,8 @@ namespace protocol { SdpMessage::SdpMessage(const std::string& sdp) { - sdp_lines_ = - SplitString(sdp, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + sdp_lines_ = base::SplitString( + sdp, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); for (const auto& line : sdp_lines_) { if (base::StartsWith(line, "m=audio", base::CompareCase::SENSITIVE)) has_audio_ = true; @@ -40,6 +44,52 @@ return true; } +bool SdpMessage::PreferVideoCodec(const std::string& codec) { + if (!has_video_) { + return false; + } + std::string payload_type; + if (!FindCodec(codec, nullptr, &payload_type)) { + return false; + } + + for (size_t i = 0; i < sdp_lines_.size(); i++) { + if (!base::StartsWith(sdp_lines_[i], + "m=video", + base::CompareCase::SENSITIVE)) { + continue; + } + + // A valid SDP contains only one "m=video" line. So instead of continue, if + // this line is invalid, we should return false immediately. + std::vector<base::StringPiece> fields = base::SplitStringPiece( + sdp_lines_[i], " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + // The first three fields are "m=video", port and proto. + static constexpr int kSkipFields = 3; + if (fields.size() <= kSkipFields) { + return false; + } + + const auto first_codec_pos = fields.begin() + kSkipFields; + auto pos = std::find(first_codec_pos, + fields.end(), + base::StringPiece(payload_type)); + // The codec has not been found in codec list. + if (pos == fields.end()) { + return false; + } + + std::rotate(first_codec_pos, pos, pos + 1); + sdp_lines_[i] = base::JoinString(fields, " "); + return true; + } + + // If has_video_ is true (tested at the very beginning of the function), we + // should always return within the for-loop above. + NOTREACHED(); + return false; +} + bool SdpMessage::FindCodec(const std::string& codec, int* line_num, std::string* payload_type) const { @@ -53,9 +103,13 @@ continue; if (line.substr(space_pos + 1, codec.size()) == codec && line[space_pos + 1 + codec.size()] == '/') { - *line_num = i; - *payload_type = - line.substr(kRtpMapPrefix.size(), space_pos - kRtpMapPrefix.size()); + if (line_num) { + *line_num = i; + } + if (payload_type) { + *payload_type = + line.substr(kRtpMapPrefix.size(), space_pos - kRtpMapPrefix.size()); + } return true; } }
diff --git a/remoting/protocol/sdp_message.h b/remoting/protocol/sdp_message.h index 0bc9d05..f5a23350 100644 --- a/remoting/protocol/sdp_message.h +++ b/remoting/protocol/sdp_message.h
@@ -8,8 +8,6 @@ #include <string> #include <vector> -#include "base/macros.h" - namespace remoting { namespace protocol { @@ -38,6 +36,10 @@ bool AddCodecParameter(const std::string& codec, const std::string& parameters_to_add); + // Prefers |codec| in current session description. Returns false if |codec| is + // not found. + bool PreferVideoCodec(const std::string& codec); + private: // Finds the line of the form "a=rtpmap:<payload_type> <codec>/.." with the // specified |codec|. Sets |line_num| to line number and |payload_type| to the @@ -50,8 +52,6 @@ bool has_audio_ = false; bool has_video_ = false; - - DISALLOW_COPY_AND_ASSIGN(SdpMessage); }; } // namespace protocol
diff --git a/remoting/protocol/sdp_message_unittest.cc b/remoting/protocol/sdp_message_unittest.cc index 3ab612e..3fbcccc 100644 --- a/remoting/protocol/sdp_message_unittest.cc +++ b/remoting/protocol/sdp_message_unittest.cc
@@ -49,5 +49,126 @@ EXPECT_EQ(kSourceSdp, sdp_message.ToString()); } +TEST(SdpMessages, PreferVideoCodec_SdpIsUnchanged) { + static const std::string kSourceSdp = + "m=video 98 UDP/TLS/RTP/SAVPF 96 97 98 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n"; + SdpMessage sdp_message(kSourceSdp); + EXPECT_TRUE(sdp_message.PreferVideoCodec("VP8")); + EXPECT_EQ(kSourceSdp, sdp_message.ToString()); +} + +TEST(SdpMessages, PreferVideoCodec_MoveToTheStartOfTheList) { + static const std::string kSourceSdp = + "m=video 98 UDP/TLS/RTP/SAVPF 96 97 98 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n"; + SdpMessage sdp_message(kSourceSdp); + EXPECT_TRUE(sdp_message.PreferVideoCodec("VP8.1")); + EXPECT_EQ("m=video 98 UDP/TLS/RTP/SAVPF 97 96 98 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n", + sdp_message.ToString()); + + sdp_message = SdpMessage(kSourceSdp); + EXPECT_TRUE(sdp_message.PreferVideoCodec("VP9")); + EXPECT_EQ("m=video 98 UDP/TLS/RTP/SAVPF 98 96 97 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n", + sdp_message.ToString()); + + sdp_message = SdpMessage(kSourceSdp); + EXPECT_TRUE(sdp_message.PreferVideoCodec("VP9.1")); + EXPECT_EQ("m=video 98 UDP/TLS/RTP/SAVPF 99 96 97 98 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n", + sdp_message.ToString()); + + sdp_message = SdpMessage(kSourceSdp); + EXPECT_TRUE(sdp_message.PreferVideoCodec("H264")); + EXPECT_EQ("m=video 98 UDP/TLS/RTP/SAVPF 100 96 97 98 99\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n", + sdp_message.ToString()); +} + +TEST(SdpMessages, PreferVideoCodec_UnknownCodec) { + static const std::string kSourceSdp = + "m=video 98 UDP/TLS/RTP/SAVPF 96 97 98 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n"; + SdpMessage sdp_message(kSourceSdp); + EXPECT_FALSE(sdp_message.PreferVideoCodec("VP7")); + EXPECT_EQ("m=video 98 UDP/TLS/RTP/SAVPF 96 97 98 99 100\n" + "a=rtpmap:96 VP8/90000\n" + "a=fmtp:96\n" + "a=rtpmap:97 VP8.1/90000\n" + "a=fmtp:97\n" + "a=rtpmap:98 VP9/90000\n" + "a=fmtp:98\n" + "a=rtpmap:99 VP9.1/90000\n" + "a=fmtp:99\n" + "a=rtpmap:100 H264/90000\n" + "a=fmtp:100\n", + sdp_message.ToString()); +} + } // namespace protocol } // namespace remoting
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc index fc1c335..c53893a 100644 --- a/remoting/protocol/webrtc_connection_to_client.cc +++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -122,6 +122,12 @@ event_dispatcher_->set_input_stub(input_stub); } +void WebrtcConnectionToClient::SetPreferredVideoCodec( + const std::string& codec) { + DCHECK(transport_); + transport_->SetPreferredVideoCodec(codec); +} + void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) { DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h index a5e9ef0..da364cf 100644 --- a/remoting/protocol/webrtc_connection_to_client.h +++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -50,6 +50,7 @@ void set_clipboard_stub(ClipboardStub* clipboard_stub) override; void set_host_stub(HostStub* host_stub) override; void set_input_stub(InputStub* input_stub) override; + void SetPreferredVideoCodec(const std::string& codec) override; // Session::EventHandler interface. void OnSessionStateChange(Session::State state) override;
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc index 3e30b345..c6649457 100644 --- a/remoting/protocol/webrtc_transport.cc +++ b/remoting/protocol/webrtc_transport.cc
@@ -483,6 +483,9 @@ SdpMessage sdp_message(description_sdp); UpdateCodecParameters(&sdp_message, /*incoming=*/false); + if (!preferred_video_codec_.empty()) { + sdp_message.PreferVideoCodec(preferred_video_codec_); + } description_sdp = sdp_message.ToString(); webrtc::SdpParseError parse_error; description.reset(webrtc::CreateSessionDescription( @@ -728,5 +731,9 @@ event_handler_->OnWebrtcTransportError(error); } +void WebrtcTransport::SetPreferredVideoCodec(const std::string& codec) { + preferred_video_codec_ = codec; +} + } // namespace protocol } // namespace remoting
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h index faf72be..99a6cd1d 100644 --- a/remoting/protocol/webrtc_transport.h +++ b/remoting/protocol/webrtc_transport.h
@@ -84,6 +84,8 @@ bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; void Close(ErrorCode error); + void SetPreferredVideoCodec(const std::string& codec); + private: // PeerConnectionWrapper is responsible for PeerConnection creation, // ownership. It passes all events to the corresponding methods below. This is @@ -144,6 +146,8 @@ std::vector<std::unique_ptr<webrtc::IceCandidateInterface>> pending_incoming_candidates_; + std::string preferred_video_codec_; + base::WeakPtrFactory<WebrtcTransport> weak_factory_; DISALLOW_COPY_AND_ASSIGN(WebrtcTransport);
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc index 24700d41..ce5d63c 100644 --- a/remoting/protocol/webrtc_video_stream.cc +++ b/remoting/protocol/webrtc_video_stream.cc
@@ -250,12 +250,15 @@ void WebrtcVideoStream::OnEncoderCreated(webrtc::VideoCodecType codec_type) { DCHECK(thread_checker_.CalledOnValidThread()); if (codec_type == webrtc::kVideoCodecVP8) { + LOG(ERROR) << "Using VP8 video codec."; encoder_ = base::MakeUnique<WebrtcVideoEncoderProxy>( WebrtcVideoEncoderVpx::CreateForVP8(), encode_task_runner_); } else if (codec_type == webrtc::kVideoCodecVP9) { + LOG(ERROR) << "Using VP9 video codec."; encoder_ = base::MakeUnique<WebrtcVideoEncoderProxy>( WebrtcVideoEncoderVpx::CreateForVP9(), encode_task_runner_); } else if (codec_type == webrtc::kVideoCodecH264) { + LOG(ERROR) << "Using H264 video codec."; // TODO(gusss): Whenever the H264 encoder is ready, this is how it will be // initialized. // encoder_ = base::MakeUnique<WebrtcVideoEncoderProxy>(
diff --git a/services/preferences/tracked/pref_hash_calculator.cc b/services/preferences/tracked/pref_hash_calculator.cc index 207221c..fe62ab8 100644 --- a/services/preferences/tracked/pref_hash_calculator.cc +++ b/services/preferences/tracked/pref_hash_calculator.cc
@@ -103,7 +103,8 @@ digest_string)) { return VALID; } - if (VerifyDigestString(seed_, + if (!legacy_device_id_.empty() && + VerifyDigestString(seed_, GetMessage(legacy_device_id_, path, value_as_string), digest_string)) { return VALID_SECURE_LEGACY;
diff --git a/services/preferences/tracked/pref_hash_calculator_unittest.cc b/services/preferences/tracked/pref_hash_calculator_unittest.cc index 8712d4f3..84f367d9 100644 --- a/services/preferences/tracked/pref_hash_calculator_unittest.cc +++ b/services/preferences/tracked/pref_hash_calculator_unittest.cc
@@ -197,7 +197,7 @@ .Validate("pref.path", &string_value, kExpectedValue)); } -TEST(PrefHashCalculatorTest, TestCompatibleWithEmptyLegacyDeviceId) { +TEST(PrefHashCalculatorTest, TestNotCompatibleWithEmptyLegacyDeviceId) { static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF"; static const char kNewDeviceId[] = "unused"; static const char kLegacyDeviceId[] = ""; @@ -206,7 +206,7 @@ static const char kExpectedValue[] = "F14F989B7CAABF3B36ECAE34492C4D8094D2500E7A86D9A3203E54B274C27CB5"; - EXPECT_EQ(PrefHashCalculator::VALID_SECURE_LEGACY, + EXPECT_EQ(PrefHashCalculator::INVALID, PrefHashCalculator(kSeed, kNewDeviceId, kLegacyDeviceId) .Validate("pref.path", &string_value, kExpectedValue)); }
diff --git a/services/preferences/tracked/pref_hash_store_impl.cc b/services/preferences/tracked/pref_hash_store_impl.cc index dcd7c089..e38697d 100644 --- a/services/preferences/tracked/pref_hash_store_impl.cc +++ b/services/preferences/tracked/pref_hash_store_impl.cc
@@ -26,12 +26,8 @@ std::string device_id; MachineIdStatus status = GetDeterministicMachineSpecificId(&device_id); - if (status != MachineIdStatus::NOT_IMPLEMENTED) { - // TODO(proberge): Remove this histogram once we validate that machine id - // generation is not flaky and consider adding a CHECK or DCHECK. - UMA_HISTOGRAM_BOOLEAN("Settings.MachineIdGenerationSuccess", - status == MachineIdStatus::SUCCESS); - } + DCHECK(status == MachineIdStatus::NOT_IMPLEMENTED || + status == MachineIdStatus::SUCCESS); if (status == MachineIdStatus::SUCCESS) { cached_device_id = device_id;
diff --git a/services/resource_coordinator/BUILD.gn b/services/resource_coordinator/BUILD.gn index 8e49a7f..3611dc8 100644 --- a/services/resource_coordinator/BUILD.gn +++ b/services/resource_coordinator/BUILD.gn
@@ -28,6 +28,10 @@ "coordination_unit/process_coordination_unit_impl.h", "memory_instrumentation/coordinator_impl.cc", "memory_instrumentation/coordinator_impl.h", + "memory_instrumentation/graph.cc", + "memory_instrumentation/graph.h", + "memory_instrumentation/graph_processor.cc", + "memory_instrumentation/graph_processor.h", "memory_instrumentation/process_map.cc", "memory_instrumentation/process_map.h", "observers/background_metrics_reporter.h", @@ -81,6 +85,8 @@ "coordination_unit/mock_coordination_unit_graphs.h", "coordination_unit/page_coordination_unit_impl_unittest.cc", "memory_instrumentation/coordinator_impl_unittest.cc", + "memory_instrumentation/graph_processor_unittest.cc", + "memory_instrumentation/graph_unittest.cc", "memory_instrumentation/process_map_unittest.cc", "observers/coordination_unit_graph_observer_unittest.cc", "observers/metrics_collector_unittest.cc",
diff --git a/services/resource_coordinator/memory_instrumentation/graph.cc b/services/resource_coordinator/memory_instrumentation/graph.cc new file mode 100644 index 0000000..61f49be --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph.cc
@@ -0,0 +1,107 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/resource_coordinator/memory_instrumentation/graph.h" + +#include "base/strings/string_tokenizer.h" + +namespace memory_instrumentation { + +using base::trace_event::MemoryAllocatorDumpGuid; +using Process = GlobalDumpGraph::Process; +using Node = GlobalDumpGraph::Node; + +GlobalDumpGraph::GlobalDumpGraph() {} +GlobalDumpGraph::~GlobalDumpGraph() {} + +Process* GlobalDumpGraph::CreateGraphForProcess(base::ProcessId process_id) { + auto id_to_dump_iterator = + process_dump_graphs_.emplace(process_id, std::make_unique<Process>(this)); + DCHECK(id_to_dump_iterator.second); // Check for duplicate pids + return id_to_dump_iterator.first->second.get(); +} + +Node* GlobalDumpGraph::CreateNode(Process* process_graph) { + all_nodes_.emplace_front(process_graph); + return &*all_nodes_.begin(); +} + +Process::Process(GlobalDumpGraph* global_graph) + : global_graph_(global_graph), root_(global_graph->CreateNode(this)) {} +Process::~Process() {} + +Node* Process::CreateNode(MemoryAllocatorDumpGuid guid, + base::StringPiece path) { + std::string path_string = path.as_string(); + base::StringTokenizer tokenizer(path_string, "/"); + + // Perform a tree traversal, creating the nodes if they do not + // already exist on the path to the child. + Node* current = root_; + while (tokenizer.GetNext()) { + base::StringPiece key = tokenizer.token_piece(); + Node* parent = current; + current = current->GetChild(key); + if (!current) { + current = global_graph_->CreateNode(this); + parent->InsertChild(key, current); + } + } + + // Add to the global guid map as well. + global_graph_->nodes_by_guid_.emplace(guid, current); + return current; +} + +Node* Process::FindNode(base::StringPiece path) { + std::string path_string = path.as_string(); + base::StringTokenizer tokenizer(path_string, "/"); + Node* current = root_; + while (tokenizer.GetNext()) { + base::StringPiece key = tokenizer.token_piece(); + current = current->GetChild(key); + if (!current) + return nullptr; + } + return current; +} + +Node::Node(Process* dump_graph) : dump_graph_(dump_graph) {} +Node::~Node() {} + +Node* Node::GetChild(base::StringPiece name) { + DCHECK(!name.empty()); + DCHECK_EQ(std::string::npos, name.find('/')); + + auto child = children_.find(name.as_string()); + return child == children_.end() ? nullptr : child->second; +} + +void Node::InsertChild(base::StringPiece name, Node* node) { + DCHECK(!name.empty()); + DCHECK_EQ(std::string::npos, name.find('/')); + + children_.emplace(name.as_string(), node); +} + +void Node::AddEntry(std::string name, + Node::Entry::ScalarUnits units, + uint64_t value) { + entries_.emplace(name, Node::Entry(units, value)); +} + +void Node::AddEntry(std::string name, std::string value) { + entries_.emplace(name, Node::Entry(value)); +} + +Node::Entry::Entry(Entry::ScalarUnits units, uint64_t value) + : type(Node::Entry::Type::kUInt64), units(units), value_uint64(value) {} + +Node::Entry::Entry(std::string value) + : type(Node::Entry::Type::kString), + units(Node::Entry::ScalarUnits::kObjects), + value_string(value), + value_uint64(0) {} + +} // namespace memory_instrumentation \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph.h b/services/resource_coordinator/memory_instrumentation/graph.h new file mode 100644 index 0000000..a3e0fdc --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph.h
@@ -0,0 +1,141 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_H_ +#define SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_H_ + +#include <forward_list> +#include <map> +#include <memory> + +#include "base/gtest_prod_util.h" +#include "base/process/process_handle.h" +#include "base/trace_event/memory_allocator_dump_guid.h" + +namespace memory_instrumentation { + +// Contains processed dump graphs for each process and in the global space. +// This class is also the arena which owns the nodes of the graph. +class GlobalDumpGraph { + public: + class Node; + + // Graph of dumps either associated with a process or with + // the shared space. + class Process { + public: + explicit Process(GlobalDumpGraph* global_graph); + ~Process(); + + // Creates a node in the dump graph which is associated with the + // given |guid| and |path| and returns it. + GlobalDumpGraph::Node* CreateNode( + base::trace_event::MemoryAllocatorDumpGuid guid, + base::StringPiece path); + + // Returns the node in the graph at the given |path| or nullptr + // if no such node exists in the provided |graph|. + GlobalDumpGraph::Node* FindNode(base::StringPiece path); + + private: + GlobalDumpGraph* const global_graph_; + GlobalDumpGraph::Node* root_; + + DISALLOW_COPY_AND_ASSIGN(Process); + }; + + // A single node in the graph of allocator dumps associated with a + // certain path and containing the entries for this path. + class Node { + public: + // Auxilary data (a scalar number or a string) about this node each + // associated with a key. + struct Entry { + enum Type { + kUInt64, + kString, + }; + + // The units of the entry if the entry is a scalar. The scalar + // refers to either a number of objects or a size in bytes. + enum ScalarUnits { + kObjects, + kBytes, + }; + + // Creates the entry with the appropriate type. + Entry(ScalarUnits units, uint64_t value); + Entry(std::string value); + + const Type type; + const ScalarUnits units; + + // The value of the entry if this entry has a string type. + const std::string value_string; + + // The value of the entry if this entry has a integer type. + const uint64_t value_uint64; + }; + + explicit Node(GlobalDumpGraph::Process* dump_graph); + ~Node(); + + // Gets the direct child of a node for the given |subpath|. + Node* GetChild(base::StringPiece name); + + // Inserts the given |node| as a child of the current node + // with the given |subpath| as the key. + void InsertChild(base::StringPiece name, Node* node); + + // Adds an entry for this dump node with the given |name|, |units| and + // type. + void AddEntry(std::string name, Entry::ScalarUnits units, uint64_t value); + void AddEntry(std::string name, std::string value); + + const GlobalDumpGraph::Process* dump_graph() const { return dump_graph_; } + const std::map<std::string, Entry>& entries() const { return entries_; } + + private: + GlobalDumpGraph::Process* const dump_graph_; + std::map<std::string, Entry> entries_; + std::map<std::string, Node*> children_; + + DISALLOW_COPY_AND_ASSIGN(Node); + }; + + using ProcessDumpGraphMap = + std::map<base::ProcessId, std::unique_ptr<GlobalDumpGraph::Process>>; + using GuidNodeMap = + std::map<base::trace_event::MemoryAllocatorDumpGuid, Node*>; + + GlobalDumpGraph(); + ~GlobalDumpGraph(); + + // Creates a container for all the dump graphs for the process given + // by the given |process_id|. + GlobalDumpGraph::Process* CreateGraphForProcess(base::ProcessId process_id); + + const GuidNodeMap& nodes_by_guid() const { return nodes_by_guid_; } + GlobalDumpGraph::Process* shared_memory_graph() const { + return shared_memory_graph_.get(); + } + const ProcessDumpGraphMap& process_dump_graphs() const { + return process_dump_graphs_; + } + + private: + // Creates a node in the arena which is associated with the given + // |dump_graph|. + Node* CreateNode(GlobalDumpGraph::Process* dump_graph); + + std::forward_list<Node> all_nodes_; + GuidNodeMap nodes_by_guid_; + std::unique_ptr<GlobalDumpGraph::Process> shared_memory_graph_; + ProcessDumpGraphMap process_dump_graphs_; + + DISALLOW_COPY_AND_ASSIGN(GlobalDumpGraph); +}; + +} // namespace memory_instrumentation +#endif \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor.cc b/services/resource_coordinator/memory_instrumentation/graph_processor.cc new file mode 100644 index 0000000..95f7e5a7 --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph_processor.cc
@@ -0,0 +1,93 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/resource_coordinator/memory_instrumentation/graph_processor.h" + +#include "base/logging.h" +#include "base/strings/string_split.h" + +namespace memory_instrumentation { + +using base::CompareCase; +using base::ProcessId; +using base::trace_event::MemoryAllocatorDump; +using base::trace_event::MemoryAllocatorDumpGuid; +using base::trace_event::ProcessMemoryDump; +using Node = memory_instrumentation::GlobalDumpGraph::Node; +using Process = memory_instrumentation::GlobalDumpGraph::Process; + +namespace { + +Node::Entry::ScalarUnits EntryUnitsFromString(std::string units) { + if (units == MemoryAllocatorDump::kUnitsBytes) { + return Node::Entry::ScalarUnits::kBytes; + } else if (units == MemoryAllocatorDump::kUnitsObjects) { + return Node::Entry::ScalarUnits::kObjects; + } else { + // Invalid units so we just return a value of the correct type. + return Node::Entry::ScalarUnits::kObjects; + } +} + +void AddEntryToNode(Node* node, const MemoryAllocatorDump::Entry& entry) { + switch (entry.entry_type) { + case MemoryAllocatorDump::Entry::EntryType::kUint64: + node->AddEntry(entry.name, EntryUnitsFromString(entry.units), + entry.value_uint64); + break; + case MemoryAllocatorDump::Entry::EntryType::kString: + node->AddEntry(entry.name, entry.value_string); + break; + } +} + +void CollectAllocatorDumps(const base::trace_event::ProcessMemoryDump& source, + GlobalDumpGraph* global_graph, + Process* process_graph) { + for (const auto& path_to_dump : source.allocator_dumps()) { + const std::string& path = path_to_dump.first; + const MemoryAllocatorDump& dump = *path_to_dump.second; + + bool is_global = base::StartsWith(path, "global/", CompareCase::SENSITIVE); + Process* graph = + is_global ? global_graph->shared_memory_graph() : process_graph; + + Node* node; + auto node_iterator = global_graph->nodes_by_guid().find(dump.guid()); + if (node_iterator == global_graph->nodes_by_guid().end()) { + node = graph->CreateNode(dump.guid(), path); + } else { + node = node_iterator->second; + + DCHECK_EQ(node, graph->FindNode(path)) + << "Nodes have different paths but same GUIDs"; + DCHECK(is_global) << "Multiple nodes have same GUID without being global"; + } + + // Copy any entries not already present into the node. + for (auto& entry : dump.entries()) { + // Check that there are not multiple entries with the same name. + DCHECK(node->entries().find(entry.name) == node->entries().end()); + AddEntryToNode(node, entry); + } + } +} + +} // namespace + +std::unique_ptr<GlobalDumpGraph> ComputeMemoryGraph( + const std::map<ProcessId, ProcessMemoryDump>& process_dumps) { + auto global_graph = std::make_unique<GlobalDumpGraph>(); + + for (auto& pid_to_dump : process_dumps) { + auto* graph = global_graph->CreateGraphForProcess(pid_to_dump.first); + + // Collects the allocator dumps into a graph and populates the graph + // with entries. + CollectAllocatorDumps(pid_to_dump.second, global_graph.get(), graph); + } + return global_graph; +} + +} // namespace memory_instrumentation \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor.h b/services/resource_coordinator/memory_instrumentation/graph_processor.h new file mode 100644 index 0000000..04f77df --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph_processor.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_PROCESSOR_H_ +#define SERVICES_RESOURCE_COORDINATOR_MEMORY_INSTRUMENTATION_GRAPH_PROCESSOR_H_ + +#include <memory> + +#include "base/process/process_handle.h" +#include "base/trace_event/process_memory_dump.h" +#include "services/resource_coordinator/memory_instrumentation/graph.h" + +namespace memory_instrumentation { + +// Processes memory dumps to compute the memory dump graph which allows +// subsequent computation of metrics such as effective sizes. +std::unique_ptr<GlobalDumpGraph> ComputeMemoryGraph( + const std::map<base::ProcessId, base::trace_event::ProcessMemoryDump>& + process_dumps); + +} // namespace memory_instrumentation +#endif \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc b/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc new file mode 100644 index 0000000..3dbb2b7 --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph_processor_unittest.cc
@@ -0,0 +1,52 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/resource_coordinator/memory_instrumentation/graph_processor.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace memory_instrumentation { + +using base::ProcessId; +using base::trace_event::HeapProfilerSerializationState; +using base::trace_event::MemoryAllocatorDump; +using base::trace_event::MemoryDumpArgs; +using base::trace_event::MemoryDumpLevelOfDetail; +using base::trace_event::ProcessMemoryDump; + +TEST(GraphProcessorTest, ComputeMemoryGraph) { + std::map<ProcessId, ProcessMemoryDump> process_dumps; + + MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED}; + ProcessMemoryDump pmd(new HeapProfilerSerializationState, dump_args); + + auto* allocator_dump = pmd.CreateAllocatorDump("test1/test2/test3"); + allocator_dump->AddScalar(MemoryAllocatorDump::kNameSize, + MemoryAllocatorDump::kUnitsBytes, 10); + + process_dumps.emplace(0, std::move(pmd)); + + auto global_dump = ComputeMemoryGraph(std::move(process_dumps)); + ASSERT_EQ(1u, global_dump->process_dump_graphs().size()); + + auto id_to_dump_it = global_dump->process_dump_graphs().begin(); + auto* first_child = id_to_dump_it->second->FindNode("test1"); + ASSERT_TRUE(first_child != nullptr); + + auto* second_child = first_child->GetChild("test2"); + ASSERT_TRUE(second_child != nullptr); + + auto* third_child = second_child->GetChild("test3"); + ASSERT_TRUE(third_child != nullptr); + + auto* direct = id_to_dump_it->second->FindNode("test1/test2/test3"); + ASSERT_TRUE(third_child == direct); + + ASSERT_EQ(third_child->entries().size(), 1ul); + + auto size = third_child->entries().find(MemoryAllocatorDump::kNameSize); + ASSERT_EQ(10ul, size->second.value_uint64); +} + +} // namespace memory_instrumentation \ No newline at end of file
diff --git a/services/resource_coordinator/memory_instrumentation/graph_unittest.cc b/services/resource_coordinator/memory_instrumentation/graph_unittest.cc new file mode 100644 index 0000000..f0e1fdd --- /dev/null +++ b/services/resource_coordinator/memory_instrumentation/graph_unittest.cc
@@ -0,0 +1,92 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/resource_coordinator/memory_instrumentation/graph.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace memory_instrumentation { + +using base::trace_event::MemoryAllocatorDumpGuid; +using Node = memory_instrumentation::GlobalDumpGraph::Node; +using Process = memory_instrumentation::GlobalDumpGraph::Process; + +TEST(GlobalDumpGraphTest, CreateContainerForProcess) { + GlobalDumpGraph global_dump_graph; + + Process* dump = global_dump_graph.CreateGraphForProcess(10); + ASSERT_TRUE(dump != nullptr); + + auto* map = global_dump_graph.process_dump_graphs().find(10)->second.get(); + ASSERT_EQ(dump, map); +} + +TEST(DumpGraphTest, CreateAndFindNode) { + GlobalDumpGraph global_dump_graph; + Process graph(&global_dump_graph); + + Node* first = graph.CreateNode(MemoryAllocatorDumpGuid(1), "simple/test/1"); + Node* second = graph.CreateNode(MemoryAllocatorDumpGuid(2), "simple/test/2"); + Node* third = graph.CreateNode(MemoryAllocatorDumpGuid(3), "simple/other/1"); + Node* fourth = graph.CreateNode(MemoryAllocatorDumpGuid(4), "complex/path"); + Node* fifth = + graph.CreateNode(MemoryAllocatorDumpGuid(5), "complex/path/child/1"); + + ASSERT_EQ(graph.FindNode("simple/test/1"), first); + ASSERT_EQ(graph.FindNode("simple/test/2"), second); + ASSERT_EQ(graph.FindNode("simple/other/1"), third); + ASSERT_EQ(graph.FindNode("complex/path"), fourth); + ASSERT_EQ(graph.FindNode("complex/path/child/1"), fifth); + + auto& nodes_by_guid = global_dump_graph.nodes_by_guid(); + ASSERT_EQ(nodes_by_guid.find(MemoryAllocatorDumpGuid(1))->second, first); + ASSERT_EQ(nodes_by_guid.find(MemoryAllocatorDumpGuid(2))->second, second); + ASSERT_EQ(nodes_by_guid.find(MemoryAllocatorDumpGuid(3))->second, third); + ASSERT_EQ(nodes_by_guid.find(MemoryAllocatorDumpGuid(4))->second, fourth); + ASSERT_EQ(nodes_by_guid.find(MemoryAllocatorDumpGuid(5))->second, fifth); +} + +TEST(NodeTest, GetChild) { + GlobalDumpGraph global_dump_graph; + Node node(global_dump_graph.shared_memory_graph()); + + ASSERT_EQ(node.GetChild("test"), nullptr); + + Node child(global_dump_graph.shared_memory_graph()); + node.InsertChild("child", &child); + ASSERT_EQ(node.GetChild("child"), &child); +} + +TEST(NodeTest, InsertChild) { + GlobalDumpGraph global_dump_graph; + Node node(global_dump_graph.shared_memory_graph()); + + ASSERT_EQ(node.GetChild("test"), nullptr); + + Node child(global_dump_graph.shared_memory_graph()); + node.InsertChild("child", &child); + ASSERT_EQ(node.GetChild("child"), &child); +} + +TEST(NodeTest, AddEntry) { + GlobalDumpGraph global_dump_graph; + Node node(global_dump_graph.shared_memory_graph()); + + node.AddEntry("scalar", Node::Entry::ScalarUnits::kBytes, 100ul); + ASSERT_EQ(node.entries().size(), 1ul); + + node.AddEntry("string", "data"); + ASSERT_EQ(node.entries().size(), 2ul); + + auto scalar = node.entries().find("scalar"); + ASSERT_EQ(scalar->first, "scalar"); + ASSERT_EQ(scalar->second.units, Node::Entry::ScalarUnits::kBytes); + ASSERT_EQ(scalar->second.value_uint64, 100ul); + + auto string = node.entries().find("string"); + ASSERT_EQ(string->first, "string"); + ASSERT_EQ(string->second.value_string, "data"); +} + +} // namespace memory_instrumentation \ No newline at end of file
diff --git a/services/service_manager/BUILD.gn b/services/service_manager/BUILD.gn index b2215bc..9643822df 100644 --- a/services/service_manager/BUILD.gn +++ b/services/service_manager/BUILD.gn
@@ -49,6 +49,7 @@ "//services/service_manager/public/cpp", "//services/service_manager/public/interfaces", "//services/service_manager/runner/host:lib", + "//services/service_manager/sandbox", ] }
diff --git a/services/service_manager/public/cpp/standalone_service/main.cc b/services/service_manager/public/cpp/standalone_service/main.cc index 6d34578..4161488 100644 --- a/services/service_manager/public/cpp/standalone_service/main.cc +++ b/services/service_manager/public/cpp/standalone_service/main.cc
@@ -53,9 +53,6 @@ #endif service_manager::WaitForDebuggerIfNecessary(); - - base::TaskScheduler::CreateAndStartWithDefaultParams("StandaloneService"); - service_manager::RunStandaloneService(base::Bind(&RunServiceMain)); base::TaskScheduler::GetInstance()->Shutdown();
diff --git a/services/service_manager/public/cpp/standalone_service/standalone_service.cc b/services/service_manager/public/cpp/standalone_service/standalone_service.cc index 5a5d194..9894afd 100644 --- a/services/service_manager/public/cpp/standalone_service/standalone_service.cc +++ b/services/service_manager/public/cpp/standalone_service/standalone_service.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/synchronization/waitable_event.h" +#include "base/task_scheduler/task_scheduler.h" #include "base/threading/thread.h" #include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/incoming_broker_client_invitation.h" @@ -75,6 +76,7 @@ mojo::edk::Init(); + base::TaskScheduler::CreateAndStartWithDefaultParams("StandaloneService"); base::Thread io_thread("io_thread"); io_thread.StartWithOptions( base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
diff --git a/services/service_manager/runner/host/BUILD.gn b/services/service_manager/runner/host/BUILD.gn index a25b25c..84b082b 100644 --- a/services/service_manager/runner/host/BUILD.gn +++ b/services/service_manager/runner/host/BUILD.gn
@@ -30,6 +30,7 @@ "//services/service_manager/public/cpp", "//services/service_manager/runner:init", "//services/service_manager/runner/common", + "//services/service_manager/sandbox", ] public_deps = [
diff --git a/services/service_manager/runner/host/service_process_launcher.cc b/services/service_manager/runner/host/service_process_launcher.cc index 79998db..9d85ef3 100644 --- a/services/service_manager/runner/host/service_process_launcher.cc +++ b/services/service_manager/runner/host/service_process_launcher.cc
@@ -46,7 +46,6 @@ const base::FilePath& service_path) : launch_process_runner_(launch_process_runner), delegate_(delegate), - start_sandboxed_(false), service_path_(service_path), start_child_process_event_( base::WaitableEvent::ResetPolicy::AUTOMATIC, @@ -62,11 +61,11 @@ mojom::ServicePtr ServiceProcessLauncher::Start( const Identity& target, - bool start_sandboxed, + SandboxType sandbox_type, const ProcessReadyCallback& callback) { DCHECK(!child_process_.IsValid()); - start_sandboxed_ = start_sandboxed; + sandbox_type_ = sandbox_type; target_ = target; const base::CommandLine& parent_command_line = @@ -81,9 +80,10 @@ child_command_line->AppendSwitchASCII("u", target.user_id()); #endif - if (start_sandboxed_) + if (!IsUnsandboxedSandboxType(sandbox_type_)) { + // TODO(tsepez): pass along sandbox information on command line. child_command_line->AppendSwitch(switches::kEnableSandbox); - + } mojo_ipc_channel_.reset(new mojo::edk::PlatformChannelPair); mojo_ipc_channel_->PrepareToPassClientHandleToChildProcess( child_command_line.get(), &handle_passing_info_); @@ -157,7 +157,7 @@ } #elif defined(OS_FUCHSIA) // LaunchProcess will share stdin/out/err with the child process by default. - if (start_sandboxed_) + if (!IsUnsandboxedSandboxType(sandbox_type_)) NOTIMPLEMENTED(); options.handles_to_transfer = std::move(handle_passing_info_); #elif defined(OS_POSIX) @@ -169,7 +169,7 @@ DVLOG(2) << "Launching child with command line: " << child_command_line->GetCommandLineString(); #if defined(OS_LINUX) - if (start_sandboxed_) { + if (!IsUnsandboxedSandboxType(sandbox_type_)) { child_process_ = sandbox::NamespaceSandbox::LaunchProcess(*child_command_line, options); if (!child_process_.IsValid()) {
diff --git a/services/service_manager/runner/host/service_process_launcher.h b/services/service_manager/runner/host/service_process_launcher.h index b8afbe4..7f2f954 100644 --- a/services/service_manager/runner/host/service_process_launcher.h +++ b/services/service_manager/runner/host/service_process_launcher.h
@@ -19,6 +19,7 @@ #include "mojo/edk/embedder/platform_channel_pair.h" #include "services/service_manager/public/interfaces/service_factory.mojom.h" #include "services/service_manager/runner/host/service_process_launcher_delegate.h" +#include "services/service_manager/sandbox/sandbox_type.h" namespace base { class CommandLine; @@ -53,7 +54,7 @@ // |Start()|s the child process; calls |DidStart()| (on the thread on which // |Start()| was called) when the child has been started (or failed to start). mojom::ServicePtr Start(const Identity& target, - bool start_sandboxed, + SandboxType sandbox_type, const ProcessReadyCallback& callback); // Waits for the child process to terminate. @@ -65,7 +66,7 @@ scoped_refptr<base::TaskRunner> launch_process_runner_; ServiceProcessLauncherDelegate* delegate_ = nullptr; - bool start_sandboxed_ = false; + SandboxType sandbox_type_ = SANDBOX_TYPE_NO_SANDBOX; Identity target_; base::FilePath service_path_; base::Process child_process_;
diff --git a/services/service_manager/runner/host/service_process_launcher_unittest.cc b/services/service_manager/runner/host/service_process_launcher_unittest.cc index 642e27e..e431362 100644 --- a/services/service_manager/runner/host/service_process_launcher_unittest.cc +++ b/services/service_manager/runner/host/service_process_launcher_unittest.cc
@@ -86,8 +86,7 @@ test_service_path); base::RunLoop run_loop; launcher.Start( - Identity(), - false, + Identity(), SANDBOX_TYPE_NO_SANDBOX, base::Bind(&ProcessReadyCallbackAdapater, run_loop.QuitClosure())); run_loop.Run();
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc index 4ad4adea..62af9b6 100644 --- a/services/service_manager/service_manager.cc +++ b/services/service_manager/service_manager.cc
@@ -36,6 +36,7 @@ #include "services/service_manager/public/interfaces/service.mojom.h" #include "services/service_manager/public/interfaces/service_control.mojom.h" #include "services/service_manager/public/interfaces/service_manager.mojom.h" +#include "services/service_manager/sandbox/sandbox_type.h" #if !defined(OS_IOS) #include "services/service_manager/runner/host/service_process_launcher.h" @@ -262,7 +263,7 @@ base::Unretained(this))); } - bool StartWithFilePath(const base::FilePath& path) { + bool StartWithFilePath(const base::FilePath& path, SandboxType sandbox_type) { #if defined(OS_IOS) // iOS does not support launching services in their own processes. NOTREACHED(); @@ -273,9 +274,8 @@ runner_ = service_manager_->service_process_launcher_factory_->Create(path); if (!runner_) return false; - bool start_sandboxed = false; mojom::ServicePtr service = runner_->Start( - identity_, start_sandboxed, + identity_, sandbox_type, base::Bind(&Instance::PIDAvailable, weak_factory_.GetWeakPtr())); StartWithService(std::move(service)); return true; @@ -860,46 +860,46 @@ instance->BindPIDReceiver(params->TakePIDReceiverRequest()); instance->StartWithService(params->TakeService()); return; + } + // The catalog was unable to read a manifest for this service. We can't do + // anything more. + if (result_interface_provider_specs_empty) { + LOG(ERROR) + << "Error: The catalog was unable to read a manifest for service \"" + << entry->name() << "\"."; + params->set_response_data(mojom::ConnectResult::ACCESS_DENIED, Identity()); + return; + } + + if (entry->parent()) { + // This service is provided by another service via a ServiceFactory. + const std::string* target_user_id = &target.user_id(); + std::string factory_instance_name = instance_name; + + // Use the original user ID so the existing embedder factory can + // be found and used to create the new service. + target_user_id = &original_target.user_id(); + Identity packaged_service_target(target); + packaged_service_target.set_user_id(original_target.user_id()); + instance->set_identity(packaged_service_target); + + mojom::ServicePtr service; + Identity factory(entry->parent()->name(), *target_user_id, + factory_instance_name); + CreateServiceWithFactory(factory, target.name(), + mojo::MakeRequest(&service)); + instance->StartWithService(std::move(service)); } else { - // The catalog was unable to read a manifest for this service. We can't do - // anything more. - if (result_interface_provider_specs_empty) { - LOG(ERROR) - << "Error: The catalog was unable to read a manifest for service \"" - << entry->name() << "\"."; - params->set_response_data(mojom::ConnectResult::ACCESS_DENIED, + base::FilePath package_path = entry->path(); + DCHECK(!package_path.empty()); + if (!instance->StartWithFilePath( + package_path, + UtilitySandboxTypeFromString(entry->sandbox_type()))) { + OnInstanceError(instance); + params->set_response_data(mojom::ConnectResult::INVALID_ARGUMENT, Identity()); return; } - - if (entry->parent()) { - // This service is provided by another service via a ServiceFactory. - const std::string* target_user_id = &target.user_id(); - std::string factory_instance_name = instance_name; - - // Use the original user ID so the existing embedder factory can - // be found and used to create the new service. - target_user_id = &original_target.user_id(); - Identity packaged_service_target(target); - packaged_service_target.set_user_id(original_target.user_id()); - instance->set_identity(packaged_service_target); - - mojom::ServicePtr service; - Identity factory(entry->parent()->name(), *target_user_id, - factory_instance_name); - CreateServiceWithFactory(factory, target.name(), - mojo::MakeRequest(&service)); - instance->StartWithService(std::move(service)); - } else { - base::FilePath package_path = entry->path(); - DCHECK(!package_path.empty()); - if (!instance->StartWithFilePath(package_path)) { - OnInstanceError(instance); - params->set_response_data(mojom::ConnectResult::INVALID_ARGUMENT, - Identity()); - return; - } - } } params->set_response_data(mojom::ConnectResult::SUCCEEDED,
diff --git a/storage/common/fileapi/file_system_types.h b/storage/common/fileapi/file_system_types.h index 23ed077d..8f2aadd 100644 --- a/storage/common/fileapi/file_system_types.h +++ b/storage/common/fileapi/file_system_types.h
@@ -123,6 +123,8 @@ // A filesystem to provide access to documents providers in ARC. kFileSystemTypeArcDocumentsProvider, + kFileSystemTypeLast = kFileSystemTypeArcDocumentsProvider, + // -------------------------------------------------------------------- // Marks the end of internal type enum. (This is not the actual fs type) // New internal filesystem types must be added above this line.
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 6116aaf..f0c447cb 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -2243,6 +2243,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, { @@ -5885,6 +5891,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, { @@ -6187,6 +6199,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, {
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index 36fd2aa..4fbc8ad 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -84,6 +84,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, { @@ -608,6 +614,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, { @@ -1191,6 +1203,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, { @@ -1742,6 +1760,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "chrome_elf_import_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "chrome_elf_unittests" }, {
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter index 34233e6..409686f 100644 --- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -120,6 +120,7 @@ -NavigationControllerBrowserTest.ErrorPageReplacement -NavigationControllerBrowserTest.NavigateFromLoadDataWithBaseURL -NavigationControllerBrowserTest.RefererStoredForSubFrame +-NavigationControllerBrowserTest.BackSameDocumentAfterBlockedSubframe -NavigationHandleImplBrowserTest.ErrorCodeOnRedirect -NavigationHandleImplBrowserTest.RedirectToRendererDebugUrl -PlzNavigateNavigationHandleImplBrowserTest.ErrorPageNetworkError
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 5d6e218..a17f052 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -272,6 +272,10 @@ "label": "//chrome/test:chrome_app_unittests", "type": "console_test_launcher", }, + "chrome_elf_import_unittests": { + "label": "//chrome_elf:chrome_elf_import_unittests", + "type": "raw", + }, "chrome_elf_unittests": { "label": "//chrome_elf:chrome_elf_unittests", "type": "raw",
diff --git a/testing/libfuzzer/README.md b/testing/libfuzzer/README.md index ad29f1559..ec32834a 100644 --- a/testing/libfuzzer/README.md +++ b/testing/libfuzzer/README.md
@@ -14,8 +14,7 @@ engineers to uncover potential security & stability problems earlier. *** note -**Requirements:** libFuzzer in Chrome is supported with GN on Linux only. -Check [Reference] for experimental platform availability. +**Requirements:** libFuzzer in Chrome is supported with GN on Mac and Linux only. *** ## Integration Status @@ -58,7 +57,7 @@ [Efficient Fuzzer Guide]: efficient_fuzzer.md [Guide to libprotobuf-mutator]: libprotobuf-mutator.md [ClusterFuzz Integration]: clusterfuzz.md -[Reproducing]: reproducing.md +[Reproducing]: https://github.com/google/clusterfuzz-tools [Reference]: reference.md [ClusterFuzz Bugs]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label:Stability-LibFuzzer%20label:ClusterFuzz&sort=-modified&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified [Pdfium Bugs]: https://bugs.chromium.org/p/pdfium/issues/list?can=1&q=libfuzzer&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&cells=tiles
diff --git a/testing/libfuzzer/reference.md b/testing/libfuzzer/reference.md index f406f67..7830a2d6 100644 --- a/testing/libfuzzer/reference.md +++ b/testing/libfuzzer/reference.md
@@ -4,7 +4,7 @@ ### Linux -Linux is fully supported by libFuzzer and ClusterFuzz with following sanitizer +Linux is fully supported by libFuzzer and ClusterFuzz with following sanitizer configurations: | GN Argument | Description | @@ -22,8 +22,7 @@ ### Mac -Mac is experimentally supported by libFuzzer with `is_asan` configuration. Mac -support is not provided by ClusterFuzz. +Mac is supported by libFuzzer with `is_asan` configuration. Configuration example:
diff --git a/testing/libfuzzer/reproducing.md b/testing/libfuzzer/reproducing.md deleted file mode 100644 index 86ba681..0000000 --- a/testing/libfuzzer/reproducing.md +++ /dev/null
@@ -1,124 +0,0 @@ -# Reproducing ClusterFuzz bugs locally - -ClusterFuzz will report bugs in the bug tracker in the following form: - -``` -Detailed report: https://cluster-fuzz.appspot.com/testcase?key=... - -Fuzzer: libfuzzer_media_pipeline_integration_fuzzer -Job Type: libfuzzer_chrome_asan -Platform Id: linux - -Crash Type: Heap-buffer-overflow READ {*} -Crash Address: 0x60500000c64d -Crash State: - stack_frame1 - stack_frame2 - stack_frame3 - -Recommended Security Severity: Medium - -Regressed: <LINK> - -Minimized Testcase (6.86 Kb): <LINK> - -Filer: ... -``` - -You can click the "Detailed report" link for the full stack trace, and -additional information/links. - -## Steps to reproduce - -1. Download the testcase given by the "Minimized Testcase" link. - -2. (**Important**) In the following sections, `$FUZZER_NAME` will be the the - string specified after the "Fuzzer :" in the report, but *without* the - "libfuzzer_" or "afl_" prefix. In this case, the `$FUZZER_NAME` is - "media_pipeline_integration_fuzzer". - -3. Follow the steps in one of the subsequent sections (from a chromium - checkout). The string specified after the "Job Type: " will be either - `afl_chrome_asan`, `libfuzzer_chrome_asan`, `libfuzzer_chrome_msan`, or - `libfuzzer_chrome_ubsan`, indicating which one to use. - - -*Notes*: - -* `is_debug`: ClusterFuzz uses release builds by default (`is_debug=false`). -For ASan builds, both Debug and Release configurations are supported. -Check a job type of the report for presence of `_debug` suffix. - -* `ffmpeg_branding`: For Linux `ffmpeg_branding` should be set to `ChromeOS`. -For other platforms, use `ffmpeg_branding=Chrome`. - -### Reproducing AFL + ASan bugs -```bash -$ gn gen out/afl '--args=is_debug=false use_afl=true is_asan=true enable_nacl=false proprietary_codecs=true ffmpeg_branding="ChromeOS"' -$ ninja -C out/afl $FUZZER_NAME -$ out/afl/$FUZZER_NAME < /path/to/repro -``` - -### Reproducing LibFuzzer + ASan bugs - -```bash -$ gn gen out/libfuzzer '--args=is_debug=false use_libfuzzer=true is_asan=true enable_nacl=false proprietary_codecs=true ffmpeg_branding="ChromeOS"' -$ ninja -C out/libfuzzer $FUZZER_NAME -$ out/libfuzzer/$FUZZER_NAME /path/to/repro -``` - -### Reproducing LibFuzzer + MSan bugs - -```bash -# The gclient runhooks is necessary to pull in instrumented libraries. -$ GYP_DEFINES='msan=1 use_prebuilt_instrumented_libraries=1' gclient runhooks -$ gn gen out/libfuzzer '--args=is_debug=false use_libfuzzer=true is_msan=true msan_track_origins=2 use_prebuilt_instrumented_libraries=true enable_nacl=false proprietary_codecs=true ffmpeg_branding="ChromeOS"' -$ ninja -C out/libfuzzer $FUZZER_NAME -$ out/libfuzzer/$FUZZER_NAME /path/to/repro -``` - -### Reproducing LibFuzzer + UBSan bugs - -```bash -$ gn gen out/libfuzzer '--args=is_debug=false use_libfuzzer=true is_ubsan_security=true enable_nacl=false proprietary_codecs=true ffmpeg_branding="ChromeOS"' -$ ninja -C out/libfuzzer $FUZZER_NAME -$ export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 -$ out/libfuzzer/$FUZZER_NAME /path/to/repro -``` - -### Symbolization - -Memory tools (ASan, MSan, UBSan) use [llvm-symbolizer] binary from the Clang -distribution to symbolize the stack traces. To get a symbolized crash report, -make sure `llvm-symbolizer` is in `PATH` or provide it in separate -`ASAN_SYMBOLIZER_PATH` environment variable. - -In Chromium repository `llvm-symbolizer` is located in -`third_party/llvm-build/Release+Asserts/bin` directory. - -```bash -$ export ASAN_SYMBOLIZER_PATH=/path/to/chromium/src/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer -$ out/libfuzzer/$FUZZER_NAME /path/to/repro -``` - -The same approach works for `MSAN_SYMBOLIZER_PATH` and `UBSAN_SYMBOLIZER_PATH`. - -Additional information regarding symbolization is available in sanitizers -documentation: [AddressSanitizerCallStack]. - - -### Debugging - -Please look at [AddressSanitizerAndDebugger] page for some tips on debugging of -binaries built with ASan. - -If you want gdb to stop after an error has been reported, use: - -* `ASAN_OPTIONS=abort_on_error=1` for binaries built with ASan. -* `MSAN_OPTIONS=abort_on_error=1` for binaries built with MSan. - - - -[AddressSanitizerAndDebugger]: https://github.com/google/sanitizers/wiki/AddressSanitizerAndDebugger -[AddressSanitizerCallStack]: https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack -[llvm-symbolizer]: http://llvm.org/docs/CommandGuide/llvm-symbolizer.html
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 2d9b95e3..09a6cce 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -467,6 +467,7 @@ crbug.com/591099 compositing/tiled-layers-hidpi.html [ Failure ] crbug.com/591099 compositing/update-paint-phases.html [ Failure ] crbug.com/591099 compositing/video-frame-size-change.html [ Failure Pass ] +crbug.com/591099 compositing/video/video-controls-layer-creation.html [ Failure ] crbug.com/591099 compositing/visibility/layer-visible-content.html [ Failure ] crbug.com/591099 compositing/visibility/visibility-composited-transforms.html [ Failure Pass ] crbug.com/591099 compositing/visibility/visibility-composited.html [ Failure Pass ] @@ -628,7 +629,6 @@ crbug.com/591099 css2.1/20110323/margin-applies-to-015.htm [ Failure Pass ] crbug.com/591099 css2.1/20110323/margin-collapse-012.htm [ Failure ] crbug.com/591099 css2.1/20110323/outline-color-applies-to-008.htm [ Failure ] -crbug.com/591099 css2.1/20110323/outline-color-applies-to-010.htm [ Failure Pass ] crbug.com/591099 css2.1/20110323/outline-color-applies-to-014.htm [ Failure Pass ] crbug.com/591099 css2.1/20110323/overflow-applies-to-010.htm [ Failure Pass ] crbug.com/591099 css2.1/20110323/table-caption-001.htm [ Failure Pass ] @@ -1201,7 +1201,6 @@ crbug.com/591099 css3/filters/regions-expanding.html [ Crash Failure ] crbug.com/591099 css3/filters/remove-filter-rendering.html [ Failure ] crbug.com/591099 css3/filters/simple-filter-rendering.html [ Failure ] -crbug.com/591099 css3/flexbox/bug527039.html [ Failure Pass ] crbug.com/591099 css3/flexbox/button.html [ Failure ] crbug.com/591099 css3/flexbox/child-overflow.html [ Failure Pass ] crbug.com/591099 css3/flexbox/flex-align-vertical-writing-mode.html [ Failure Pass ] @@ -2227,7 +2226,6 @@ crbug.com/591099 editing/pasteboard/drag-and-drop-inputimage-contenteditable.html [ Timeout ] crbug.com/591099 editing/pasteboard/drag-and-drop-objectimage-contenteditable.html [ Timeout ] crbug.com/591099 editing/pasteboard/drag-drop-dead-frame.html [ Timeout ] -crbug.com/591099 editing/pasteboard/drag-drop-list.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/drag-drop-modifies-page.html [ Failure ] crbug.com/591099 editing/pasteboard/drag-drop-url-text.html [ Crash Failure ] crbug.com/591099 editing/pasteboard/drag-drop-url-with-style.html [ Failure ] @@ -2469,7 +2467,6 @@ crbug.com/591099 editing/spelling/spellcheck_test.html [ Crash Failure ] crbug.com/591099 editing/spelling/spelling-backward.html [ Failure ] crbug.com/591099 editing/spelling/spelling-changed-text.html [ Failure ] -crbug.com/591099 editing/spelling/spelling-huge-text.html [ Pass Timeout ] crbug.com/591099 editing/spelling/spelling-marker-description.html [ Failure ] crbug.com/591099 editing/style/4916887.html [ Failure ] crbug.com/591099 editing/style/5065910.html [ Failure ] @@ -2966,9 +2963,7 @@ crbug.com/591099 external/wpt/css/css-writing-modes-3/abs-pos-non-replaced-vrl-222.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/abs-pos-non-replaced-vrl-226.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/abs-pos-non-replaced-vrl-228.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vlr-022.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-012.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-021.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-024.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-026.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/central-baseline-alignment-002.xht [ Failure ] @@ -2997,7 +2992,6 @@ crbug.com/591099 external/wpt/css/css-writing-modes-3/inline-replaced-vrl-004.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/inline-table-alignment-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/inline-table-alignment-004.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes-3/line-box-direction-vlr-020.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes-3/line-box-direction-vrl-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/line-box-direction-vrl-005.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/line-box-direction-vrl-006.xht [ Failure ] @@ -3269,6 +3263,9 @@ crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/reversed-1e.html [ Failure Pass ] crbug.com/591099 external/wpt/html/semantics/interactive-elements/the-dialog-element/centering.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html [ Failure ] +crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports.html [ Pass ] +crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-external-module.html [ Pass ] +crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-inline-module.html [ Pass ] crbug.com/591099 external/wpt/html/semantics/text-level-semantics/the-br-element/br-bidi-in-inline-ancestors.html [ Failure ] crbug.com/591099 external/wpt/html/syntax/parsing/named-character-references.html [ Pass Timeout ] crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-1.htm [ Timeout ] @@ -3296,7 +3293,6 @@ crbug.com/591099 external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/performance-timeline/po-callback-mutate.any.html [ Pass ] crbug.com/591099 external/wpt/performance-timeline/po-callback-mutate.any.worker.html [ Pass ] -crbug.com/591099 external/wpt/pointerevents/compat/pointerevent_touch-action_two-finger_interaction-manual.html [ Pass Timeout ] crbug.com/591099 external/wpt/pointerevents/pointerevent_attributes_hoverable_pointers-manual.html [ Crash Pass Timeout ] crbug.com/591099 external/wpt/pointerevents/pointerevent_attributes_nohover_pointers-manual.html [ Crash Pass Timeout ] crbug.com/591099 external/wpt/pointerevents/pointerevent_click_during_capture-manual.html [ Crash Timeout ] @@ -3473,7 +3469,6 @@ crbug.com/591099 fast/block/float/float-in-float-hit-testing.html [ Failure ] crbug.com/591099 fast/block/float/float-in-float-painting.html [ Failure ] crbug.com/591099 fast/block/float/float-inserted-into-clean-line.html [ Failure ] -crbug.com/635619 fast/block/float/float-not-removed-from-first-letter.html [ Crash Failure Pass ] crbug.com/591099 fast/block/float/float-overflow-hidden-containing-block-width.html [ Failure ] crbug.com/591099 fast/block/float/floats-and-text-indent-rl.html [ Failure ] crbug.com/591099 fast/block/float/floats-and-text-indent.html [ Failure ] @@ -4010,7 +4005,6 @@ crbug.com/591099 fast/css/getComputedStyle/getComputedStyle-resolved-values.html [ Crash Timeout ] crbug.com/591099 fast/css/getPropertyValue-column-rule.html [ Failure ] crbug.com/591099 fast/css/h1-in-section-elements.html [ Failure ] -crbug.com/591099 fast/css/heightless-list-item.html [ Crash Failure Pass ] crbug.com/591099 fast/css/hover-active-quirks.html [ Failure ] crbug.com/591099 fast/css/hover-affects-ancestor.html [ Crash Failure ] crbug.com/591099 fast/css/hover-after-clicking-embed.html [ Failure ] @@ -4650,7 +4644,6 @@ crbug.com/591099 fast/forms/search/search-rtl.html [ Crash Failure ] crbug.com/591099 fast/forms/search/search-vertical-alignment.html [ Crash Failure ] crbug.com/591099 fast/forms/search/searchfield-heights.html [ Crash Failure ] -crbug.com/591099 fast/forms/select-popup/popup-menu-appearance-fractional-width.html [ Failure Pass ] crbug.com/591099 fast/forms/select-popup/popup-menu-appearance-rtl-default.html [ Failure ] crbug.com/591099 fast/forms/select-popup/popup-menu-appearance-rtl.html [ Failure ] crbug.com/591099 fast/forms/select/003.html [ Crash Failure ] @@ -4747,35 +4740,18 @@ crbug.com/591099 fast/forms/submit-add-remove-element.html [ Crash Failure ] crbug.com/591099 fast/forms/submit-onFocus-invalidForm.html [ Crash Failure ] crbug.com/591099 fast/forms/submit/submit-appearance-basic.html [ Failure ] -crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom125.html [ Crash Failure Timeout ] crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom200.html [ Crash Failure ] crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-appearance.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html [ Crash Failure Pass Timeout ] -crbug.com/591099 fast/forms/suggestion-picker/date-suggestion-picker-mouse-operations.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew.html [ Crash Failure Timeout ] -crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-key-operations.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-mouse-operations.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/month-suggestion-picker-appearance.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/month-suggestion-picker-key-operations.html [ Crash Failure Pass Timeout ] -crbug.com/591099 fast/forms/suggestion-picker/month-suggestion-picker-mouse-operations.html [ Failure Pass Timeout ] crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew.html [ Crash Failure ] -crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl.html [ Crash Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar.html [ Crash Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-appearance.html [ Failure Pass Timeout ] -crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-key-operations.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/time-suggestion-picker-mouse-operations.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl.html [ Failure Pass ] crbug.com/591099 fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/week-suggestion-picker-appearance.html [ Failure Pass ] -crbug.com/591099 fast/forms/suggestion-picker/week-suggestion-picker-key-operations.html [ Crash Failure Pass Timeout ] -crbug.com/591099 fast/forms/suggestion-picker/week-suggestion-picker-mouse-operations.html [ Failure Pass ] crbug.com/591099 fast/forms/tabbing-input-iframe.html [ Crash Failure ] crbug.com/591099 fast/forms/targeted-frame-submission.html [ Failure ] crbug.com/591099 fast/forms/text-control-intrinsic-widths.html [ Timeout ] @@ -5114,14 +5090,11 @@ crbug.com/591099 fast/lists/li-values.html [ Failure Pass ] crbug.com/591099 fast/lists/list-color-change-no-layout.html [ Failure Pass ] crbug.com/591099 fast/lists/list-item-line-height.html [ Failure ] -crbug.com/591099 fast/lists/list-marker-avoid-float-2.html [ Failure Pass ] -crbug.com/591099 fast/lists/list-marker-avoid-float.html [ Crash Failure Pass ] crbug.com/591099 fast/lists/list-marker-before-content-table.html [ Failure ] crbug.com/591099 fast/lists/list-marker-before-float-nested-rtl.html [ Crash Failure ] crbug.com/591099 fast/lists/list-marker-before-float-nested.html [ Crash Failure ] crbug.com/591099 fast/lists/list-marker-before-float-rtl.html [ Crash Failure ] crbug.com/591099 fast/lists/list-marker-before-float.html [ Crash Failure ] -crbug.com/591099 fast/lists/list-marker-inside-overflow-hidden.html [ Failure Pass ] crbug.com/591099 fast/lists/list-marker-padding-overflow-hidden-rtl.html [ Failure ] crbug.com/591099 fast/lists/list-marker-padding-overflow-hidden.html [ Failure ] crbug.com/591099 fast/lists/list-marker-with-line-height.html [ Crash Failure ] @@ -6317,14 +6290,13 @@ crbug.com/591099 fragmentation/table-row-dimensions.html [ Failure ] crbug.com/591099 fragmentation/unbreakable-tall-float-before-block.html [ Failure ] crbug.com/591099 fragmentation/unbreakable-tall-float-before-line.html [ Failure ] -crbug.com/591099 fullscreen/compositor-touch-hit-rects-fullscreen-video-controls.html [ Failure ] +crbug.com/591099 fullscreen/compositor-touch-hit-rects-fullscreen-video-controls.html [ Failure Pass ] crbug.com/591099 fullscreen/full-screen-iframe-allowed-nested.html [ Timeout ] crbug.com/591099 fullscreen/full-screen-iframe-not-allowed.html [ Failure ] crbug.com/591099 fullscreen/full-screen-line-boxes-crash.html [ Crash Failure ] crbug.com/591099 fullscreen/full-screen-placeholder.html [ Failure ] crbug.com/591099 fullscreen/full-screen-with-flex-item.html [ Crash Failure ] crbug.com/591099 hittesting/border-hittest-inlineFlowBox.html [ Failure ] -crbug.com/591099 hittesting/culled-inline-crash.html [ Failure Pass ] crbug.com/591099 hittesting/hittest-child-of-inlineblock.html [ Crash Failure ] crbug.com/591099 hittesting/image-with-border-radius.html [ Failure ] crbug.com/591099 hittesting/inline-with-clip-path.html [ Failure ] @@ -6514,7 +6486,6 @@ crbug.com/591099 http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/sources/debugger/properties-special.html [ Failure Pass ] crbug.com/591099 http/tests/devtools/startup/console/console-uncaught-promise-no-inspector.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/startup/sources/debugger/linkifier.html [ Failure Pass Timeout ] crbug.com/591099 http/tests/devtools/text-autosizing-override.html [ Failure ] crbug.com/591099 http/tests/devtools/tracing/timeline-js/timeline-runtime-stats.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/tracing/timeline-layout/timeline-layout-with-invalidations.html [ Crash Failure ] @@ -6835,7 +6806,7 @@ crbug.com/591099 inspector-protocol/accessibility/accessibility-nameSources-input.js [ Crash Failure Timeout ] crbug.com/591099 inspector-protocol/accessibility/accessibility-nameSources-labelledby.js [ Crash Failure Timeout ] crbug.com/591099 inspector-protocol/accessibility/accessibility-nameSources-visiblity.js [ Crash Failure Timeout ] -crbug.com/591099 inspector-protocol/css/css-add-rule.js [ Timeout ] +crbug.com/591099 inspector-protocol/css/css-add-rule.js [ Pass Timeout ] crbug.com/591099 inspector-protocol/css/css-set-style-text.js [ Pass Timeout ] crbug.com/591099 inspector-protocol/dom-snapshot/dom-snapshot-getSnapshot.js [ Crash Failure Timeout ] crbug.com/591099 inspector-protocol/emulation/device-emulation-small-dw.js [ Failure ] @@ -6848,12 +6819,13 @@ crbug.com/591099 intersection-observer/remove-element.html [ Failure ] crbug.com/591099 intersection-observer/same-document-root.html [ Crash Failure ] crbug.com/591099 media/autoplay/document-user-activation.html [ Failure ] -crbug.com/591099 media/controls-drag-timebar-rendering.html [ Pass ] +crbug.com/591099 media/controls-drag-timebar-rendering.html [ Failure Pass ] crbug.com/591099 media/controls-timeline.html [ Failure ] crbug.com/591099 media/controls-volume-slider.html [ Failure ] crbug.com/591099 media/controls/paint-controls-webkit-appearance-none-custom-bg.html [ Failure ] crbug.com/591099 media/controls/paint-controls-webkit-appearance-none.html [ Failure ] crbug.com/591099 media/controls/video-controls-with-cast-rendering.html [ Failure ] +crbug.com/591099 media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html [ Timeout ] crbug.com/591099 media/controls/video-overlay-cast-dark-rendering.html [ Failure ] crbug.com/591099 media/controls/video-overlay-cast-light-rendering.html [ Failure ] crbug.com/591099 media/media-document-audio-repaint.html [ Failure ] @@ -6864,6 +6836,7 @@ crbug.com/591099 media/video-canvas-alpha.html [ Failure ] crbug.com/591099 media/video-colorspace-yuv420.html [ Failure ] crbug.com/591099 media/video-colorspace-yuv422.html [ Failure ] +crbug.com/591099 media/video-controls-fullscreen.html [ Timeout ] crbug.com/591099 media/video-controls-visible-audio-only.html [ Failure ] crbug.com/591099 media/video-layer-crash.html [ Failure ] crbug.com/591099 media/video-poster-scale.html [ Failure ] @@ -7245,9 +7218,12 @@ crbug.com/591099 paint/invalidation/outline-become-affected-by-descendant.html [ Failure ] crbug.com/591099 paint/invalidation/outline-become-not-affected-by-descendant.html [ Failure ] crbug.com/591099 paint/invalidation/outline-change-continuations.html [ Failure ] +crbug.com/591099 paint/invalidation/outline-change-in-scrollers.html [ Failure ] crbug.com/591099 paint/invalidation/outline-change-invalidation.html [ Failure ] crbug.com/591099 paint/invalidation/outline-change-offset.html [ Failure Pass ] crbug.com/591099 paint/invalidation/outline-change-repaint.html [ Failure Pass ] +crbug.com/591099 paint/invalidation/outline-change-scrollable.html [ Failure ] +crbug.com/591099 paint/invalidation/outline-change-vertical-rl.html [ Failure ] crbug.com/591099 paint/invalidation/outline-child-repaint.html [ Failure ] crbug.com/591099 paint/invalidation/outline-clip-change.html [ Crash Failure ] crbug.com/591099 paint/invalidation/outline-containing-image-in-non-standard-mode.html [ Failure ] @@ -7779,7 +7755,6 @@ crbug.com/591099 svg/as-image/svg-non-integer-scaled-image.html [ Failure ] crbug.com/591099 svg/as-image/svg-object-intrinsic-size.html [ Failure ] crbug.com/591099 svg/as-image/svgview-references-use-counters.html [ Failure ] -crbug.com/591099 svg/as-list-image/svg-list-image-intrinsic-size-zoom.html [ Failure Pass ] crbug.com/591099 svg/as-object/object-box-sizing-no-width-height.html [ Failure Pass ] crbug.com/591099 svg/as-object/svg-embedded-in-html-in-iframe.html [ Failure Pass Timeout ] crbug.com/591099 svg/canvas/canvas-default-object-sizing.html [ Failure Pass ] @@ -8260,6 +8235,7 @@ crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-animated-images.html [ Crash Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html [ Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-ellipse-connecting-line.html [ Failure Pass ] +crbug.com/591099 virtual/gpu/fast/canvas/canvas-imageSmoothingQuality.html [ Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-measure-bidi-text.html [ Failure Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-render-layer.html [ Failure Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-shadow-source-in.html [ Failure Pass ] @@ -8281,11 +8257,9 @@ crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/drag-image.html [ Failure ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ] -crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/data-suggestion-picker-appearance.html [ Crash Failure Pass ] crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/drag-image.html [ Failure ] crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ] -crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/data-suggestion-picker-appearance.html [ Crash Failure Pass ] crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/drag-image.html [ Failure ] crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/MSANExpectations b/third_party/WebKit/LayoutTests/MSANExpectations index d7f1b2a..dba9855 100644 --- a/third_party/WebKit/LayoutTests/MSANExpectations +++ b/third_party/WebKit/LayoutTests/MSANExpectations
@@ -38,6 +38,8 @@ crbug.com/462190 [ Linux ] inspector-protocol/heap-profiler/heap-snapshot-with-detached-dom-tree.js [ Timeout ] crbug.com/462190 [ Linux ] inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.js [ Timeout ] +crbug.com/667560 [ Linux ] http/tests/devtools/startup/console/console-format-startup.html [ Timeout Pass ] +crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/startup/console/console-format-startup.html [ Timeout Pass ] crbug.com/751906 [ Linux ] http/tests/devtools/console/console-correct-suggestions.js [ Timeout Pass ] crbug.com/751906 [ Linux ] virtual/mojo-loading/http/tests/devtools/console/console-correct-suggestions.js [ Timeout Pass ]
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests index dd3efc8b..2c41914f 100644 --- a/third_party/WebKit/LayoutTests/SlowTests +++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -137,6 +137,7 @@ crbug.com/246190 [ Release ] virtual/mojo-loading/http/tests/devtools/indexeddb/ [ Slow ] crbug.com/451577 [ Mac ] http/tests/devtools/extensions/extensions-sidebar.html [ Slow ] crbug.com/451577 [ Mac ] http/tests/devtools/extensions/extensions-events.html [ Slow ] +crbug.com/667560 http/tests/devtools/startup/console/console-format-startup.html [ Slow ] # Random slow tests webkit.org/b/90488 [ Release ] http/tests/devtools/compiler-source-mapping-debug.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 92ed9cba..492cf58 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1365,6 +1365,8 @@ crbug.com/733494 [ Linux ] media/autoplay/document-user-activation.html [ Skip ] crbug.com/733495 [ Linux ] http/tests/devtools/elements/styles-4/styles-history.html [ Skip ] crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/elements/styles-4/styles-history.html [ Skip ] +crbug.com/769885 [ Linux ] virtual/android/fullscreen/full-screen-frameset.html [ Skip ] + # Temporarily disabled after chromium change crbug.com/492511 [ Mac ] fast/text/atsui-negative-spacing-features.html [ Failure ] @@ -2898,6 +2900,66 @@ crbug.com/737959 http/tests/misc/video-poster-image-load-outlives-gc-without-crashing.html [ Failure Pass Crash ] +# These tests are failing on Mac-10.12 when using an Intel GPU. +crbug.com/736177 [ Mac10.12 ] css2.1/t1202-counter-04-b.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] css2.1/t1202-counters-04-b.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/block/basic/001.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/block/float/intruding-painted-twice.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/borders/inline-mask-overlay-image-outset.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css-generated-content/012.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css-generated-content/014.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css/acid2-pixel.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css/clip-zooming.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css/h1-in-section-elements.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css/rem-calc-dynamic-scaling.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/css/rem-dynamic-scaling.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/dom/HTMLMeterElement/meter-optimums.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/dynamic/012.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/forms/form-element-geometry.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/inline/absolute-positioned-inline-in-centred-block.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/lists/ordered-list-with-no-ol-tag.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/selectors/166.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/text/color-emoji.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/text/emoticons.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/text/fallback-traits-fixup.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] fast/text/unicode-fallback-font.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] html/details_summary/details-marker-style.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] http/tests/misc/acid2-pixel.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] virtual/mojo-loading/http/tests/misc/acid2-pixel.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] media/video-zoom-controls.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] paint/markers/document-markers-zoom-150.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] scrollbars/custom-scrollbar-with-incomplete-style.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/W3C-SVG-1.1/script-handle-02-b.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/W3C-SVG-1.1/script-handle-03-b.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/W3C-SVG-1.1/script-handle-04-b.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/W3C-SVG-1.1/struct-use-05-b.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/W3C-SVG-1.1/text-fonts-01-t.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/as-border-image/svg-as-border-image-2.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/batik/text/textLayout.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/custom/focus-ring-text.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/text/surrogate-pair-queries.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/text/text-path-middle-align.svg [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/transforms/svg-css-transforms-clip-path.xhtml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] svg/transforms/svg-css-transforms.xhtml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug18359.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug2479-3.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug2479-4.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug46480-1.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug46480-2.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug8032-1.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/bugs/bug8858.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/other/test3.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/other/test6.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/other/wa_table_thtd_rowspan.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla/other/wa_table_tr_align.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla_expected_failures/bugs/bug1128.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla_expected_failures/bugs/bug2479-5.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] tables/mozilla_expected_failures/bugs/bug91057.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] transforms/svg-vs-css.xhtml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] virtual/layout_ng/fast/block/basic/001.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 ] virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style.html [ Failure Pass ] # These tests are failing on both Mac-10.12 when using an Intel GPU and Mac-10.11.6 when using no GPU crbug.com/736177 [ Mac ] fast/forms/control-restrict-line-height.html [ Failure Pass ] crbug.com/736177 [ Mac ] fast/forms/input-appearance-height.html [ Failure Pass ] @@ -2908,41 +2970,41 @@ crbug.com/736177 [ Mac ] fast/forms/search/search-rtl.html [ Failure Pass ] crbug.com/736177 [ Mac ] fast/forms/search/searchfield-heights.html [ Failure Pass ] # These tests are failing on Mac-10.12 when using an Intel GPU and Mac Retina -crbug.com/736177 [ Retina ] compositing/overflow/theme-affects-visual-overflow.html [ Failure Pass ] -crbug.com/736177 [ Retina ] css1/box_properties/acid_test.html [ Failure Pass ] -crbug.com/736177 [ Retina ] virtual/mojo-loading/css1/box_properties/acid_test.html [ Failure Pass ] -crbug.com/736177 [ Retina ] css2.1/t09-c5526c-display-00-e.html [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/html/css3-modsel-25.html [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/html/css3-modsel-70.html [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/xhtml/css3-modsel-25.xml [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/xhtml/css3-modsel-70.xml [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/xml/css3-modsel-25.xml [ Failure Pass ] -crbug.com/736177 [ Retina ] css3/selectors3/xml/css3-modsel-70.xml [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/block/basic/011.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/block/margin-collapse/103.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/css/non-standard-checkbox-size.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/001.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/basic-inputs.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/checkbox/checkbox-appearance-basic.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/file/file-input-disabled.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/formmove.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/formmove2.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/indeterminate.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/input-value.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/forms/radio/radio-appearance-basic.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/inline/positionedLifetime.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/parser/bad-xml-slash.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/replaced/replaced-breaking.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/text/textIteratorNilRenderer.html [ Failure Pass ] -crbug.com/736177 [ Retina ] fast/text/whitespace/normal-after-nowrap-breaking.html [ Failure Pass ] -crbug.com/736177 [ Retina ] paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown.html [ Failure Pass ] -crbug.com/736177 [ Retina ] paint/invalidation/forms/radio-focus-by-mouse-then-keydown.html [ Failure Pass ] -crbug.com/736177 [ Retina ] tables/mozilla/bugs/bug1318.html [ Failure Pass ] -crbug.com/736177 [ Retina ] tables/mozilla/bugs/bug4527.html [ Failure Pass ] -crbug.com/736177 [ Retina ] tables/mozilla_expected_failures/core/captions1.html [ Failure Pass ] -crbug.com/736177 [ Retina ] tables/mozilla_expected_failures/core/captions2.html [ Failure Pass ] -crbug.com/736177 [ Retina ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/theme-affects-visual-overflow.html [ Failure Pass ] -crbug.com/736177 [ Retina ] virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] compositing/overflow/theme-affects-visual-overflow.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css1/box_properties/acid_test.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] virtual/mojo-loading/css1/box_properties/acid_test.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css2.1/t09-c5526c-display-00-e.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/html/css3-modsel-25.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/html/css3-modsel-70.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/xhtml/css3-modsel-25.xml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/xhtml/css3-modsel-70.xml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/xml/css3-modsel-25.xml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] css3/selectors3/xml/css3-modsel-70.xml [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/block/basic/011.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/block/margin-collapse/103.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/css/non-standard-checkbox-size.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/001.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/basic-inputs.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/checkbox/checkbox-appearance-basic.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/file/file-input-disabled.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/formmove.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/formmove2.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/indeterminate.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/input-value.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/forms/radio/radio-appearance-basic.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/inline/positionedLifetime.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/parser/bad-xml-slash.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/replaced/replaced-breaking.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/text/textIteratorNilRenderer.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] fast/text/whitespace/normal-after-nowrap-breaking.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] paint/invalidation/forms/radio-focus-by-mouse-then-keydown.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] tables/mozilla/bugs/bug1318.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] tables/mozilla/bugs/bug4527.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] tables/mozilla_expected_failures/core/captions1.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] tables/mozilla_expected_failures/core/captions2.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/theme-affects-visual-overflow.html [ Failure Pass ] +crbug.com/736177 [ Mac10.12 Retina ] virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure Pass ] # These tests are failing on Mac-10.9.5 when using no GPU crbug.com/736177 [ Mac10.9 ] editing/selection/modify_move/move_left_right_character_in_mixed_bidi.html [ Skip ] crbug.com/736177 [ Mac10.9 ] external/wpt/css/css-writing-modes-3/bidi-isolate-override-007.html [ Skip ] @@ -2973,9 +3035,7 @@ crbug.com/717643 external/wpt/html/semantics/scripting-1/the-script-element/module/module-in-xhtml.xhtml [ Failure ] # dynamic module import is under development -crbug.com/711706 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import [ Failure ] -crbug.com/711706 virtual/dynamic-import/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-external-classic.html [ Failure ] -crbug.com/711706 virtual/dynamic-import/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-inline-classic.html [ Failure ] +crbug.com/711706 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import [ Skip ] # Geolocation tests crbug.com/745079 external/wpt/geolocation-API/PositionOptions.https.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html index 23dea1a1..36966d4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html
@@ -20,5 +20,5 @@ }) // 3. Wait 50ms after the GC runs for the disconnection event to come back. // There's nothing to assert other than that only valid memory is used. - .then(() => new Promise(resolve => setTimeout(resolve, 50))), test_desc); + .then(() => new Promise(resolve => step_timeout(resolve, 50))), test_desc); </script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html index 700572dc..35d1fcb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html
@@ -24,7 +24,7 @@ device.gatt.disconnect(), ])) // 3. Wait to catch disconnect events. - .then(() => new Promise(resolve => setTimeout(resolve, 50))) + .then(() => new Promise(resolve => step_timeout(resolve, 50))) // 4. Ensure there is exactly 1 disconnection recorded. .then(() => assert_equals(num_events, 1)), test_desc); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-expected.txt index 7c8c66f..f29d844 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-expected.txt
@@ -10,33 +10,43 @@ PASS BackgroundFetchManager interface: operation fetch(DOMString, [object Object],[object Object], BackgroundFetchOptions) PASS BackgroundFetchManager interface: operation get(DOMString) PASS BackgroundFetchManager interface: operation getIds() -PASS BackgroundFetchRegistration interface: existence and properties of interface object +FAIL BackgroundFetchRegistration interface: existence and properties of interface object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface object length PASS BackgroundFetchRegistration interface object name -PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object +FAIL BackgroundFetchRegistration interface: existence and properties of interface prototype object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object's "constructor" property PASS BackgroundFetchRegistration interface: attribute id -PASS BackgroundFetchRegistration interface: attribute icons -PASS BackgroundFetchRegistration interface: attribute totalDownloadSize -PASS BackgroundFetchRegistration interface: attribute title -FAIL BackgroundFetchRegistration interface: attribute fetches assert_true: The prototype object must have a property "fetches" expected true got false -FAIL BackgroundFetchRegistration interface: operation abort() assert_throws: calling operation with this = null didn't throw TypeError function "function () {\n fn.apply(obj, args);\n }" did not throw -FAIL BackgroundFetchFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object length assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object name assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: attribute request assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing +PASS BackgroundFetchRegistration interface: attribute uploadTotal +PASS BackgroundFetchRegistration interface: attribute uploaded +PASS BackgroundFetchRegistration interface: attribute downloadTotal +PASS BackgroundFetchRegistration interface: attribute downloaded +FAIL BackgroundFetchRegistration interface: attribute activeFetches assert_true: The prototype object must have a property "activeFetches" expected true got false +PASS BackgroundFetchRegistration interface: attribute onprogress +PASS BackgroundFetchRegistration interface: operation abort() +PASS BackgroundFetchFetch interface: existence and properties of interface object +PASS BackgroundFetchFetch interface object length +PASS BackgroundFetchFetch interface object name +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object's "constructor" property +PASS BackgroundFetchFetch interface: attribute request FAIL BackgroundFetchActiveFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing -FAIL BackgroundFetchActiveFetches interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation match(RequestInfo) assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation values() assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing PASS BackgroundFetchEvent interface: existence and properties of interface object -PASS BackgroundFetchEndEvent interface: existence and properties of interface object +PASS BackgroundFetchSettledEvent interface: existence and properties of interface object PASS BackgroundFetchSettledFetches interface: existence and properties of interface object -PASS BackgroundFetchFailEvent interface: existence and properties of interface object +PASS BackgroundFetchSettledFetch interface: existence and properties of interface object +PASS BackgroundFetchUpdateEvent interface: existence and properties of interface object PASS BackgroundFetchClickEvent interface: existence and properties of interface object Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-worker.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-worker.https-expected.txt index 12452cd..7d204a4b 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-worker.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-worker.https-expected.txt
@@ -14,54 +14,69 @@ PASS BackgroundFetchManager interface: operation fetch(DOMString, [object Object],[object Object], BackgroundFetchOptions) PASS BackgroundFetchManager interface: operation get(DOMString) PASS BackgroundFetchManager interface: operation getIds() -PASS BackgroundFetchRegistration interface: existence and properties of interface object +FAIL BackgroundFetchRegistration interface: existence and properties of interface object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface object length PASS BackgroundFetchRegistration interface object name -PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object +FAIL BackgroundFetchRegistration interface: existence and properties of interface prototype object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object's "constructor" property PASS BackgroundFetchRegistration interface: attribute id -PASS BackgroundFetchRegistration interface: attribute icons -PASS BackgroundFetchRegistration interface: attribute totalDownloadSize -PASS BackgroundFetchRegistration interface: attribute title -FAIL BackgroundFetchRegistration interface: attribute fetches assert_true: The prototype object must have a property "fetches" expected true got false -FAIL BackgroundFetchRegistration interface: operation abort() assert_throws: calling operation with this = null didn't throw TypeError function "function () {\n fn.apply(obj, args);\n }" did not throw -FAIL BackgroundFetchFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object length assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object name assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: attribute request assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing +PASS BackgroundFetchRegistration interface: attribute uploadTotal +PASS BackgroundFetchRegistration interface: attribute uploaded +PASS BackgroundFetchRegistration interface: attribute downloadTotal +PASS BackgroundFetchRegistration interface: attribute downloaded +FAIL BackgroundFetchRegistration interface: attribute activeFetches assert_true: The prototype object must have a property "activeFetches" expected true got false +PASS BackgroundFetchRegistration interface: attribute onprogress +PASS BackgroundFetchRegistration interface: operation abort() +PASS BackgroundFetchFetch interface: existence and properties of interface object +PASS BackgroundFetchFetch interface object length +PASS BackgroundFetchFetch interface object name +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object's "constructor" property +PASS BackgroundFetchFetch interface: attribute request FAIL BackgroundFetchActiveFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing -FAIL BackgroundFetchActiveFetches interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation match(RequestInfo) assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation values() assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing FAIL BackgroundFetchEvent interface: existence and properties of interface object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchEvent interface object length PASS BackgroundFetchEvent interface object name FAIL BackgroundFetchEvent interface: existence and properties of interface prototype object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchEvent interface: existence and properties of interface prototype object's "constructor" property PASS BackgroundFetchEvent interface: attribute id -FAIL BackgroundFetchEndEvent interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface object length assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface object name assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface: attribute completeFetches assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing -FAIL BackgroundFetchEndEvent interface: operation updateUI(DOMString) assert_own_property: self does not have own property "BackgroundFetchEndEvent" expected property "BackgroundFetchEndEvent" missing +FAIL BackgroundFetchSettledEvent interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing +FAIL BackgroundFetchSettledEvent interface object length assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing +FAIL BackgroundFetchSettledEvent interface object name assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing +FAIL BackgroundFetchSettledEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing +FAIL BackgroundFetchSettledEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing +FAIL BackgroundFetchSettledEvent interface: attribute fetches assert_own_property: self does not have own property "BackgroundFetchSettledEvent" expected property "BackgroundFetchSettledEvent" missing FAIL BackgroundFetchSettledFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing FAIL BackgroundFetchSettledFetches interface object length assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing FAIL BackgroundFetchSettledFetches interface object name assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing FAIL BackgroundFetchSettledFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing FAIL BackgroundFetchSettledFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing -FAIL BackgroundFetchSettledFetches interface: attribute response assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing -FAIL BackgroundFetchFailEvent interface: existence and properties of interface object assert_own_property: should inherit from BackgroundFetchEndEvent, but self has no such property expected property "BackgroundFetchEndEvent" missing -PASS BackgroundFetchFailEvent interface object length -PASS BackgroundFetchFailEvent interface object name -FAIL BackgroundFetchFailEvent interface: existence and properties of interface prototype object assert_own_property: should inherit from BackgroundFetchEndEvent, but self has no such property expected property "BackgroundFetchEndEvent" missing -PASS BackgroundFetchFailEvent interface: existence and properties of interface prototype object's "constructor" property -FAIL BackgroundFetchFailEvent interface: attribute failedFetches assert_true: The prototype object must have a property "failedFetches" expected true got false +FAIL BackgroundFetchSettledFetches interface: operation match(RequestInfo) assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing +FAIL BackgroundFetchSettledFetches interface: operation values() assert_own_property: self does not have own property "BackgroundFetchSettledFetches" expected property "BackgroundFetchSettledFetches" missing +PASS BackgroundFetchSettledFetch interface: existence and properties of interface object +FAIL BackgroundFetchSettledFetch interface object length assert_equals: wrong value for BackgroundFetchSettledFetch.length expected 0 but got 2 +PASS BackgroundFetchSettledFetch interface object name +PASS BackgroundFetchSettledFetch interface: existence and properties of interface prototype object +PASS BackgroundFetchSettledFetch interface: existence and properties of interface prototype object's "constructor" property +PASS BackgroundFetchSettledFetch interface: attribute response +FAIL BackgroundFetchUpdateEvent interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing +FAIL BackgroundFetchUpdateEvent interface object length assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing +FAIL BackgroundFetchUpdateEvent interface object name assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing +FAIL BackgroundFetchUpdateEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing +FAIL BackgroundFetchUpdateEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing +FAIL BackgroundFetchUpdateEvent interface: operation updateUI(DOMString) assert_own_property: self does not have own property "BackgroundFetchUpdateEvent" expected property "BackgroundFetchUpdateEvent" missing PASS BackgroundFetchClickEvent interface: existence and properties of interface object PASS BackgroundFetchClickEvent interface object length PASS BackgroundFetchClickEvent interface object name
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.idl b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.idl index d8b2fed..77cdfff 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.idl +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.idl
@@ -1,10 +1,19 @@ -// 3.1. Extensions to ServiceWorkerRegistration +// 4.1. Extensions to ServiceWorkerGlobalScope + +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onbackgroundfetched; + attribute EventHandler onbackgroundfetchfail; + attribute EventHandler onbackgroundfetchabort; + attribute EventHandler onbackgroundfetchclick; +}; + +// 4.2. Extensions to ServiceWorkerRegistration partial interface ServiceWorkerRegistration { readonly attribute BackgroundFetchManager backgroundFetch; }; -// 3.2. BackgroundFetchManager +// 4.3. BackgroundFetchManager [Exposed=(Window,Worker)] interface BackgroundFetchManager { @@ -17,7 +26,7 @@ dictionary BackgroundFetchOptions { sequence<IconDefinition> icons; DOMString title; - long totalDownloadSize; + unsigned long long downloadTotal; }; // This is taken from https://w3c.github.io/manifest/#icons-member. @@ -28,40 +37,40 @@ DOMString type; }; -// 3.3. BackgroundFetchRegistration +// 4.4. BackgroundFetchRegistration [Exposed=(Window,Worker)] -interface BackgroundFetchRegistration { +interface BackgroundFetchRegistration : EventTarget { readonly attribute DOMString id; - readonly attribute FrozenArray<IconDefinition> icons; - readonly attribute long totalDownloadSize; - readonly attribute DOMString title; - readonly attribute FrozenArray<BackgroundFetchActiveFetches> fetches; + readonly attribute unsigned long long uploadTotal; + readonly attribute unsigned long long uploaded; + readonly attribute unsigned long long downloadTotal; + readonly attribute unsigned long long downloaded; + readonly attribute BackgroundFetchActiveFetches activeFetches; - void abort(); + attribute EventHandler onprogress; + + Promise<boolean> abort(); }; [Exposed=(Window,Worker)] -interface BackgroundFetchFetches { +interface BackgroundFetchFetch { readonly attribute Request request; }; [Exposed=(Window,Worker)] -interface BackgroundFetchActiveFetches : BackgroundFetchFetches { +interface BackgroundFetchActiveFetches { + Promise<BackgroundFetchActiveFetch> match(RequestInfo request); + Promise<FrozenArray<BackgroundFetchActiveFetch>> values(); +}; + +[Exposed=(Window,Worker)] +interface BackgroundFetchActiveFetch : BackgroundFetchFetch { readonly attribute Promise<Response> responseReady; - // TODO: this will include fetch controller/observer objects + // In future this will include a fetch observer }; -// 3.4. Events - -partial interface ServiceWorkerGlobalScope { - attribute EventHandler onbackgroundfetched; - attribute EventHandler onbackgroundfetchfail; - attribute EventHandler onbackgroundfetchabort; - attribute EventHandler onbackgroundfetchclick; -}; - -// 3.4.1. BackgroundFetchEvent +// 4.4.3. BackgroundFetchEvent [Constructor(DOMString type, BackgroundFetchEventInit init), Exposed=ServiceWorker] interface BackgroundFetchEvent : ExtendableEvent { @@ -72,38 +81,38 @@ required DOMString id; }; -// 3.4.2. BackgroundFetchEndEvent +// 4.4.4. BackgroundFetchSettledEvent -[Constructor(DOMString type, BackgroundFetchEndEventInit init), Exposed=ServiceWorker] -interface BackgroundFetchEndEvent : BackgroundFetchEvent { - readonly attribute FrozenArray<BackgroundFetchSettledFetches> completeFetches; - - Promise<void> updateUI(DOMString title); +[Constructor(DOMString type, BackgroundFetchSettledEventInit init), Exposed=ServiceWorker] +interface BackgroundFetchSettledEvent : BackgroundFetchEvent { + readonly attribute BackgroundFetchSettledFetches fetches; }; -dictionary BackgroundFetchEndEventInit : BackgroundFetchEventInit { - required BackgroundFetchSettledFetches completeFetches; +dictionary BackgroundFetchSettledEventInit : BackgroundFetchEventInit { + required BackgroundFetchSettledFetches fetches; }; [Exposed=ServiceWorker] -interface BackgroundFetchSettledFetches : BackgroundFetchFetches { +interface BackgroundFetchSettledFetches { + Promise<BackgroundFetchSettledFetch> match(RequestInfo request); + Promise<FrozenArray<BackgroundFetchSettledFetch>> values(); +}; + +[Exposed=ServiceWorker] +interface BackgroundFetchSettledFetch : BackgroundFetchFetch { readonly attribute Response? response; }; -// 3.4.3. BackgroundFetchFailEvent +// 4.4.5. BackgroundFetchUpdateEvent -[Constructor(DOMString type, BackgroundFetchEndEventInit init), Exposed=ServiceWorker] -interface BackgroundFetchFailEvent : BackgroundFetchEndEvent { - readonly attribute FrozenArray<BackgroundFetchSettledFetches> failedFetches; +[Constructor(DOMString type, BackgroundFetchSettledEventInit init), Exposed=ServiceWorker] +interface BackgroundFetchUpdateEvent : BackgroundFetchSettledEvent { + Promise<void> updateUI(DOMString title); }; -dictionary BackgroundFetchFailEventInit : BackgroundFetchEndEventInit { - required BackgroundFetchSettledFetches failedFetches; -}; +// 4.4.6. BackgroundFetchClickEvent -// 3.4.4. BackgroundFetchClickEvent - -[Constructor(DOMString type, BackgroundFetchEndEventInit init), Exposed=ServiceWorker] +[Constructor(DOMString type, BackgroundFetchClickEventInit init), Exposed=ServiceWorker] interface BackgroundFetchClickEvent : BackgroundFetchEvent { readonly attribute BackgroundFetchState state; };
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker-expected.txt index 3d9d60e..207da556 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker-expected.txt
@@ -1,5 +1,4 @@ This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'abort' on 'BackgroundFetchRegistration': Illegal invocation PASS Exposed interfaces in a Service Worker. FAIL ServiceWorkerRegistration interface: existence and properties of interface object assert_false: expected false got true PASS ServiceWorkerGlobalScope interface: existence and properties of interface object @@ -11,33 +10,43 @@ PASS BackgroundFetchManager interface: operation fetch(DOMString, [object Object],[object Object], BackgroundFetchOptions) PASS BackgroundFetchManager interface: operation get(DOMString) PASS BackgroundFetchManager interface: operation getIds() -PASS BackgroundFetchRegistration interface: existence and properties of interface object +FAIL BackgroundFetchRegistration interface: existence and properties of interface object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface object length PASS BackgroundFetchRegistration interface object name -PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object +FAIL BackgroundFetchRegistration interface: existence and properties of interface prototype object Cannot read property 'has_extended_attribute' of undefined PASS BackgroundFetchRegistration interface: existence and properties of interface prototype object's "constructor" property PASS BackgroundFetchRegistration interface: attribute id -PASS BackgroundFetchRegistration interface: attribute icons -PASS BackgroundFetchRegistration interface: attribute totalDownloadSize -PASS BackgroundFetchRegistration interface: attribute title -FAIL BackgroundFetchRegistration interface: attribute fetches assert_true: The prototype object must have a property "fetches" expected true got false -FAIL BackgroundFetchRegistration interface: operation abort() assert_throws: calling operation with this = null didn't throw TypeError function "function () {\n fn.apply(obj, args);\n }" did not throw -FAIL BackgroundFetchFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object length assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface object name assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing -FAIL BackgroundFetchFetches interface: attribute request assert_own_property: self does not have own property "BackgroundFetchFetches" expected property "BackgroundFetchFetches" missing +PASS BackgroundFetchRegistration interface: attribute uploadTotal +PASS BackgroundFetchRegistration interface: attribute uploaded +PASS BackgroundFetchRegistration interface: attribute downloadTotal +PASS BackgroundFetchRegistration interface: attribute downloaded +FAIL BackgroundFetchRegistration interface: attribute activeFetches assert_true: The prototype object must have a property "activeFetches" expected true got false +PASS BackgroundFetchRegistration interface: attribute onprogress +PASS BackgroundFetchRegistration interface: operation abort() +PASS BackgroundFetchFetch interface: existence and properties of interface object +PASS BackgroundFetchFetch interface object length +PASS BackgroundFetchFetch interface object name +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object +PASS BackgroundFetchFetch interface: existence and properties of interface prototype object's "constructor" property +PASS BackgroundFetchFetch interface: attribute request FAIL BackgroundFetchActiveFetches interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing FAIL BackgroundFetchActiveFetches interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing -FAIL BackgroundFetchActiveFetches interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation match(RequestInfo) assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetches interface: operation values() assert_own_property: self does not have own property "BackgroundFetchActiveFetches" expected property "BackgroundFetchActiveFetches" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object length assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface object name assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing +FAIL BackgroundFetchActiveFetch interface: attribute responseReady assert_own_property: self does not have own property "BackgroundFetchActiveFetch" expected property "BackgroundFetchActiveFetch" missing PASS BackgroundFetchEvent interface: existence and properties of interface object -PASS BackgroundFetchEndEvent interface: existence and properties of interface object +PASS BackgroundFetchSettledEvent interface: existence and properties of interface object PASS BackgroundFetchSettledFetches interface: existence and properties of interface object -PASS BackgroundFetchFailEvent interface: existence and properties of interface object +PASS BackgroundFetchSettledFetch interface: existence and properties of interface object +PASS BackgroundFetchUpdateEvent interface: existence and properties of interface object PASS BackgroundFetchClickEvent interface: existence and properties of interface object Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker.js b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker.js index d3145b9..a5fc4ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker.js +++ b/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker.js
@@ -14,3 +14,5 @@ idlArray.test(); }); }, 'Exposed interfaces in a Service Worker.'); + +done();
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-after-load.html b/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-after-load.html index 1fe2407..73557d2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-after-load.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-after-load.html
@@ -23,10 +23,6 @@ </script> <script> -if (window.testRunner) { - testRunner.waitUntilDone(); -} - var blob = new Blob([document.getElementById('code').textContent], {type: 'text/javascript'}); var frame_cnt = 0;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-before-load.html b/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-before-load.html index 2232cd4..483d16cf 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-before-load.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css-paint-api/valid-image-before-load.html
@@ -23,10 +23,6 @@ </script> <script> -if (window.testRunner) { - testRunner.waitUntilDone(); -} - var el = document.getElementById('output'); el.style.backgroundImage = 'paint(green)';
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001.html index 624a7bb..795bf6b7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001.html
@@ -172,8 +172,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001a.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001a.html index e4372283..6811313f 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001a.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001a.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001b.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001b.html index 048306e7..97013917 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001b.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001b.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001c.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001c.html index 352b68a..4a18f32 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001c.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001c.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001d.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001d.html index 8050aa59..95e71466 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001d.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001d.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001e.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001e.html index 31f17bc..7347b676 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001e.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001e.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001f.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001f.html index 02c66a8..35dbaca2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001f.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001f.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001g.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001g.html index a4f9525d..b7730a6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001g.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001g.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001h.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001h.html index f10633b..adca0e9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001h.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001h.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001i.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001i.html index 62073f0..6fb680e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001i.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001i.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001j.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001j.html index fbc401c..a9a4a62 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001j.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001j.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001k.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001k.html index d0ea4cc..931cefc 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001k.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001k.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001l.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001l.html index de00ffb..f3482a1 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001l.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001l.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001m.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001m.html index 1c39d495..e686838 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001m.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001m.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001n.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001n.html index 52ea609..84ac183 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001n.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001n.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001o.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001o.html index 85c1f99..82599c9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001o.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001o.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001p.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001p.html index 613292a..653dc374 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001p.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001p.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001q.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001q.html index c2fe4a5..070f08b6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001q.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001q.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001r.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001r.html index 53515105..86ffb3f7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001r.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001r.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001s.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001s.html index bcfeb62..24cf31e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001s.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001s.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001t.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001t.html index e0e93baf..c5c9ca3 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001t.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001t.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001u.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001u.html index c4e381a..c49d1ef 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001u.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001u.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001v.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001v.html index a20c54f6..01bc8f8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001v.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001v.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001w.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001w.html index d7f3211..27b00d9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001w.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001w.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001x.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001x.html index fb79a2a6..0ec5d97 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001x.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001x.html
@@ -80,8 +80,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/tools/generators/orthogonal-parent-shrink-to-fit.ejs b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/tools/generators/orthogonal-parent-shrink-to-fit.ejs index 987c4a1f..b395a7c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/tools/generators/orthogonal-parent-shrink-to-fit.ejs +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-writing-modes-3/tools/generators/orthogonal-parent-shrink-to-fit.ejs
@@ -121,8 +121,6 @@ } }, title); }); - if (window.testRunner) - container.style.display = "none"; done(); } </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/inline-event-handler.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/inline-event-handler.html new file mode 100644 index 0000000..13cc8b66 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/inline-event-handler.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id='div' onmousedown='import("./../imports-a.js").then(window.continueTest);'></div> +<script> +const div = document.getElementById('div'); + +promise_test(t => { + const promise = new Promise(resolve => window.continueTest = resolve); + + const event = new MouseEvent('mousedown', {'button': 1}); + div.dispatchEvent(event); + + return promise.then(() => { + assert_true(window.evaluated_imports_a); + div.parentNode.removeChild(div); + }); +}, "dynamic import should work when triggered from inline event handlers"); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html index d7abd00..2168e3e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html
@@ -11,10 +11,6 @@ var path = base_path() + 'resources/fetch-access-control.py'; var host_info = get_host_info(); -if (window.testRunner) { - testRunner.setCanOpenWindows(); -} - function getLoadedObject(win, contentFunc, closeFunc) { return new Promise(function(resolve) { function done(contentString) {
diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html index 94781a23..de7807e 100644 --- a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html +++ b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html
@@ -52,18 +52,18 @@ var stream = canvas.captureStream(); var videoTrack = stream.getVideoTracks()[0]; - var expectedException = + var expectedError = new DOMException('Unsupported constraint(s)', 'NotSupportedError'); // Use e.g. |torch| as an example of unsupported constraint. assert_false("torch" in videoTrack.getCapabilities()); return promise_rejects( - t, expectedException, + t, expectedError, videoTrack.applyConstraints({advanced : [ {torch : true} ]})); }, 'MediaStreamTrack.applyConstraints() with unsupported constraint'); // This test verifies that applyConstraints() rejects the returned Promise if -// passed a non-supported constraint. +// passed mixed ImageCapture and non-ImageCapture constraints. // TODO(mcasas): remove entirely after https://crbug.com/338503. promise_test(function(t) { var canvas = document.getElementById('canvas'); @@ -74,13 +74,12 @@ var stream = canvas.captureStream(); var videoTrack = stream.getVideoTracks()[0]; - var expectedException = new DOMException( - 'Only Image-Capture constraints supported (https://crbug.com/338503)', - 'NotSupportedError'); + var expectedError = new OverconstrainedError( + '', 'Mixing ImageCapture and non-ImageCapture constraints is not currently supported'); return promise_rejects( - t, expectedException, - videoTrack.applyConstraints({advanced : [ {width : 640} ]})); + t, expectedError, + videoTrack.applyConstraints({advanced : [ {width : 640, torch: true} ]})); }, 'MediaStreamTrack.applyConstraints() with non Image-Capture constraint'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-applyConstraints.html b/third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-applyConstraints.html new file mode 100644 index 0000000..0776e46 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-applyConstraints.html
@@ -0,0 +1,179 @@ +<!DOCTYPE HTML> +<html> +<head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +</head> +<body> +<script> + +// If a constraint is set with applyConstraints, it should come back in +// getConstraints(). +promise_test(() => { + return navigator.mediaDevices.getUserMedia({video: {width: {exact: 800}}}) + .then(s => { + var track = s.getVideoTracks()[0]; + var constraints = track.getConstraints(); + assert_equals(Object.keys(constraints).length, 1); + assert_true(constraints.hasOwnProperty('width')); + assert_equals(constraints.width.exact, 800); + + return track.applyConstraints({width: {exact: 640}}) + .then(() => { + constraints = track.getConstraints(); + assert_equals(Object.keys(constraints).length, 1); + assert_true(constraints.hasOwnProperty('width')); + assert_equals(constraints.width.exact, 640); + }) + }); +}, 'applyConstraints() sets the value of a constraint set by getUserMedia()'); + +// The deviceId constraint must be rejected, since the source of a track cannot +// be changed with applyConstraints. +promise_test(test => { + return promise_rejects(test, + new OverconstrainedError('deviceId', ''), + navigator.mediaDevices.getUserMedia({audio: true}) + .then(s => { + return s.getAudioTracks()[0].applyConstraints( + { deviceId: {exact: 'mydevice-id'}}); + })); +}, 'Attempting to change the deviceId with applyConstraints() fails'); + +promise_test(() => { + return navigator.mediaDevices.getUserMedia({audio: true}) + .then(s => { + var track = s.getAudioTracks()[0]; + return track.applyConstraints( + { echoCancellation: { exact: true}, notKnownName: { exact: true }}) + .then(() => { + constraints = track.getConstraints(); + assert_equals(Object.keys(constraints).length, 1); + assert_false(constraints.hasOwnProperty('notKnownName')); + }); + }); +}, 'An unsupported constraint is ignored by applyConstraints()'); + +function constraintElementsEqual(a, b) { + if (a === b) + return true; + if (!(a instanceof Object)) + return false; + if (!(b instanceof Object)) + return false; + if (Object.keys(a).length != Object.keys(b).length) + return false; + for (var p in a) { + if (!a.hasOwnProperty(p)) + continue; // Skip prototypes and such things. + if (!b.hasOwnProperty(p)) + return false; + if (a[p] instanceof Object && b[p] instanceof Object) { + if (!constraintElementsEqual(a[p], b[p])) + return false; + continue; + } + if (a[p] !== b[p]) return false; // Simple types. + } + return true; +} + +promise_test(() => { + // Construct a constraint set that covers constraints that make sense for + // video. + const complexConstraintSet = { + width: { min: 30, max: 480 }, + height: { min: 30, max: 480, exact: 350 }, + aspectRatio: { ideal: 1.3333333, exact: 1.4444 }, + frameRate: { exact: 30.0 }, + facingMode: { exact: "user" } + }; + // These constraints are syntactically valid, but may cause rejection. + // They are included in an "advanced" constraint. + const ignorableConstraintSet = { + volume: { ideal: 1.0 }, + sampleRate: { ideal: 42 }, + sampleSize: { ideal: 3 }, + echoCancellation: { ideal: false }, + latency: { ideal: 0.22 }, + channelCount: { ideal: 2 }, + deviceId: { ideal: ["foo", "fooz"] }, + groupId: { ideal: ["bar", "baz"] } + }; + let complexConstraints = complexConstraintSet; + complexConstraints.advanced = [ ignorableConstraintSet ]; + + return navigator.mediaDevices.getUserMedia({video: true}) + .then(s => { + var track = s.getVideoTracks()[0]; + return track.applyConstraints(complexConstraints).then(() => { + constraints = track.getConstraints(); + assert_true(constraintElementsEqual(constraints, complexConstraints), + "Unexpected result: In: " + + JSON.stringify(complexConstraints, null, 2) + + " Out: " + JSON.stringify(constraints, null, 2)); + }); + }); +}, 'All valid keys are returned for complex constraints'); + +// Syntax tests for constraints. +// These work by putting the constraints into an advanced constraint +// (so that they can be ignored), calling getUserMedia, and then +// inspecting the constraints. +// In advanced constraints, naked values mean "exact", and "exact" values +// are thus unwrapped, which is the opposite behavior from the "basic" +// constraint set (outside advanced). +function constraintSyntaxTestWithChange(name, constraints, expected_result) { + promise_test(() => { + return navigator.mediaDevices.getUserMedia( + {'video': true}) + .then(s => { + var track = s.getVideoTracks()[0]; + track.applyConstraints({ 'advanced': [ constraints ]}).then(() => { + var constraints_out = track.getConstraints().advanced[0]; + assert_true(constraintElementsEqual(expected_result, constraints_out), + "Unexpected result: Expected: " + + JSON.stringify(expected_result, null, 2) + + " Out: " + JSON.stringify(constraints_out, null, 2)); + }) + }) + }, name); +} + +function constraintSyntaxTest(name, constraints) { + constraintSyntaxTestWithChange(name, constraints, constraints); +} + +constraintSyntaxTest('Simple integer', { height: 42 }); +constraintSyntaxTest('Ideal integer', { height: { ideal: 42 }}); +constraintSyntaxTest('Min/max integer', { height: { min: 42, max: 43 }}); +constraintSyntaxTestWithChange('Exact unwrapped integer', + { height: { exact: 42 } }, { height: 42 }); + +constraintSyntaxTest('Simple double', { aspectRatio: 1.5 }); +constraintSyntaxTest('Ideal double', { aspectRatio: { ideal: 1.5 }}); +constraintSyntaxTest('Min/max double', { aspectRatio: { min: 1.5, max: 2.0 }}); +constraintSyntaxTestWithChange( + 'Exact unwrapped double', + { aspectRatio: { exact: 1.5 } }, { aspectRatio: 1.5 }); + +constraintSyntaxTest('Simple String', { facingMode: "user1" }); +constraintSyntaxTest('Ideal String', { facingMode: { ideal: "user2" }}); +constraintSyntaxTest('Multiple String in Brackets', + { facingMode: { ideal: ["user3", "left3"]}}); +constraintSyntaxTest('Multiple Bracketed Naked String', + { facingMode: ["user4", "left4"] }); +constraintSyntaxTestWithChange( + 'Single Bracketed string unwrapped', + { 'facingMode': ["user5"]}, { facingMode: "user5" }); +constraintSyntaxTest('Both Ideal and Exact string', + { facingMode: { ideal: "user6", exact: "left6" }}); + +constraintSyntaxTest('Simple boolean', { echoCancellation: true }); +constraintSyntaxTest('Ideal boolean', { echoCancellation: { ideal: true }}); +constraintSyntaxTestWithChange('Exact unwrapped boolean', + { echoCancellation: { exact: true } }, { echoCancellation: true }); + +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified-expected.html b/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified-expected.html new file mode 100644 index 0000000..23802bd --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified-expected.html
@@ -0,0 +1,13 @@ +<!DOCTYPE html> +<style> +.test { + overflow:hidden; + width:100px; + white-space:nowrap; + display:inline-block; + text-overflow:ellipsis; + word-wrap:break-word; +} +</style> +<p>crbug.com/769980: You should see text with an ellipsis below.</p> +<div class="test">this is a long sentence of text that overflows</div>
diff --git a/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified.html b/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified.html new file mode 100644 index 0000000..32a4edfe --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/text/ellipsis-in-static-div-with-left-specified.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<style> +.test { + overflow:hidden; + width:100px; + white-space:nowrap; + display:inline-block; + text-overflow:ellipsis; + position:static; + word-wrap:break-word; + left:100px; +} +</style> +<p>crbug.com/769980: You should see text with an ellipsis below.</p> +<div class="test">this is a long sentence of text that overflows</div>
diff --git a/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.https.html b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.https.html index f01b8a7..8880f68 100644 --- a/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.https.html +++ b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.https.html
@@ -81,7 +81,7 @@ } ], title: 'My Background Fetch', - totalDownloadSize: 1024 + downloadTotal: 1024 }; let registration = null; @@ -96,8 +96,11 @@ assert_true(backgroundFetchRegistration instanceof BackgroundFetchRegistration); assert_equals(backgroundFetchRegistration.id, id); assert_object_equals(backgroundFetchRegistration.icons, options.icons); - assert_equals(backgroundFetchRegistration.totalDownloadSize, options.totalDownloadSize); + assert_equals(backgroundFetchRegistration.downloadTotal, options.downloadTotal); assert_equals(backgroundFetchRegistration.title, options.title); + + // TODO(crbug.com/769770): Remove support for the deprecated attributes. + assert_equals(backgroundFetchRegistration.totalDownloadSize, options.downloadTotal); }); }, 'BackgroundFetchManager.fetch() returns a BackgroundFetchRegistration object.');
diff --git a/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html index 73eff2a..5b679cf0 100644 --- a/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html +++ b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html
@@ -59,7 +59,7 @@ } ], title: 'My Background Fetch', - totalDownloadSize: 1024 + downloadTotal: 1024 }; let registration = null; @@ -78,8 +78,11 @@ assert_true(secondBackgroundFetchRegistration instanceof BackgroundFetchRegistration); assert_equals(secondBackgroundFetchRegistration.id, id); assert_object_equals(secondBackgroundFetchRegistration.icons, options.icons); - assert_equals(secondBackgroundFetchRegistration.totalDownloadSize, options.totalDownloadSize); + assert_equals(secondBackgroundFetchRegistration.downloadTotal, options.downloadTotal); assert_equals(secondBackgroundFetchRegistration.title, options.title); + + // TODO(crbug.com/769770): Remove support for the deprecated attributes. + assert_equals(secondBackgroundFetchRegistration.totalDownloadSize, options.downloadTotal); }); }); }, 'BackgroundFetchManager.get() can return created fetches.');
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup-expected.txt new file mode 100644 index 0000000..97110a4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup-expected.txt
@@ -0,0 +1,1437 @@ +CONSOLE MESSAGE: line 25: test,test2,,,test4,,,,, +CONSOLE MESSAGE: line 26: %o +CONSOLE MESSAGE: line 27: %O +CONSOLE MESSAGE: line 28: Test for zero "%f" in formatter +CONSOLE MESSAGE: line 29: %% self-escape1 +CONSOLE MESSAGE: line 30: %%s self-escape2 +CONSOLE MESSAGE: line 31: %%ss self-escape3 +CONSOLE MESSAGE: line 32: %%s%s%%s self-escape4 +CONSOLE MESSAGE: line 33: %%%%% self-escape5 +CONSOLE MESSAGE: line 34: %%%s self-escape6 +CONSOLE MESSAGE: line 157: null +CONSOLE MESSAGE: line 159: Array of arrays +CONSOLE MESSAGE: line 160: 1,2,3,4,5,6 +CONSOLE MESSAGE: line 162: Large array of arrays +CONSOLE MESSAGE: line 163: 1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6 +CONSOLE MESSAGE: line 165: Array or array and object +CONSOLE MESSAGE: line 166: 1,2,3,[object Object] +CONSOLE MESSAGE: line 168: Object table +CONSOLE MESSAGE: line 169: [object Object] +CONSOLE MESSAGE: line 171: Null as columns +CONSOLE MESSAGE: line 172: 1,2,3,4,5,6 +CONSOLE MESSAGE: line 174: Digit as columns +CONSOLE MESSAGE: line 175: 1,2,3,4,5,6 +CONSOLE MESSAGE: line 177: String as columns +CONSOLE MESSAGE: line 178: 1,2,3,4,5,6 +CONSOLE MESSAGE: line 180: Random string as columns +CONSOLE MESSAGE: line 181: 1,2,3,4,5,6 +CONSOLE MESSAGE: line 183: Array of strings as columns +CONSOLE MESSAGE: line 184: [object Object],[object Object] +CONSOLE MESSAGE: line 186: Good and bad column names +CONSOLE MESSAGE: line 187: [object Object],[object Object] +CONSOLE MESSAGE: line 189: Missing column name +CONSOLE MESSAGE: line 190: [object Object],[object Object] +CONSOLE MESSAGE: line 192: Shallow array +CONSOLE MESSAGE: line 193: 1,foo, +CONSOLE MESSAGE: line 195: Shallow array with 'Value' column +CONSOLE MESSAGE: line 196: 1,[object Object] +CONSOLE MESSAGE: line 198: Deep and shallow array +CONSOLE MESSAGE: line 199: 1,foo,2 +CONSOLE MESSAGE: line 210: [object HTMLCollection] +CONSOLE MESSAGE: line 214: [object HTMLCollection] +CONSOLE MESSAGE: line 218: [object HTMLOptionsCollection] +CONSOLE MESSAGE: line 222: [object HTMLAllCollection] +CONSOLE MESSAGE: line 226: [object HTMLFormControlsCollection] +CONSOLE MESSAGE: line 230: [object RadioNodeList] +CONSOLE MESSAGE: line 236: 1,2, +CONSOLE MESSAGE: line 239: [object Object] +CONSOLE MESSAGE: line 246: [object Arguments] +CONSOLE MESSAGE: line 250: [object DOMTokenList] +CONSOLE MESSAGE: line 253: [object Object] +CONSOLE MESSAGE: line 254: [object Object] +CONSOLE MESSAGE: line 256: [object Object] +CONSOLE MESSAGE: line 257: [object Object] +CONSOLE MESSAGE: line 258: [object Object] +CONSOLE MESSAGE: line 259: [object Object] +CONSOLE MESSAGE: line 260: [object Object] +CONSOLE MESSAGE: line 261: [object Object] +CONSOLE MESSAGE: line 11: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +CONSOLE MESSAGE: line 12: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +CONSOLE MESSAGE: line 11: /foo\\bar\sbaz/i +CONSOLE MESSAGE: line 12: /foo\\bar\sbaz/i +CONSOLE MESSAGE: line 11: test +CONSOLE MESSAGE: line 12: test +CONSOLE MESSAGE: line 11: test named "test" +CONSOLE MESSAGE: line 12: test named "test" +CONSOLE MESSAGE: line 11: Error +CONSOLE MESSAGE: line 12: Error +CONSOLE MESSAGE: line 11: Error: my error message +CONSOLE MESSAGE: line 12: Error: my error message +CONSOLE MESSAGE: line 11: Error: my multiline +error message +CONSOLE MESSAGE: line 12: Error: my multiline +error message +CONSOLE MESSAGE: line 11: [object HTMLParagraphElement] +CONSOLE MESSAGE: line 12: [object HTMLParagraphElement] +CONSOLE MESSAGE: line 11: function () { return 1; } +CONSOLE MESSAGE: line 12: function () { return 1; } +CONSOLE MESSAGE: line 11: function () { + return 2; + } +CONSOLE MESSAGE: line 12: function () { + return 2; + } +CONSOLE MESSAGE: line 11: 0.12 +CONSOLE MESSAGE: line 12: 0.12 +CONSOLE MESSAGE: line 11: http://webkit.org/ +CONSOLE MESSAGE: line 12: http://webkit.org/ +CONSOLE MESSAGE: line 11: null +CONSOLE MESSAGE: line 12: +CONSOLE MESSAGE: line 11: undefined +CONSOLE MESSAGE: line 12: +CONSOLE MESSAGE: line 11: [object Attr] +CONSOLE MESSAGE: line 12: [object Attr] +CONSOLE MESSAGE: line 11: [object Attr] +CONSOLE MESSAGE: line 12: [object Attr] +CONSOLE MESSAGE: line 11: [object Attr] +CONSOLE MESSAGE: line 12: [object Attr] +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: NaN +CONSOLE MESSAGE: line 12: NaN +CONSOLE MESSAGE: line 11: Infinity +CONSOLE MESSAGE: line 12: Infinity +CONSOLE MESSAGE: line 11: -Infinity +CONSOLE MESSAGE: line 12: -Infinity +CONSOLE MESSAGE: line 11: test,test2,,,test4,,,,, +CONSOLE MESSAGE: line 12: test,test2,,,test4,,,,, +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: function () {} +CONSOLE MESSAGE: line 12: function () {} +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: [object SVGSVGElement] +CONSOLE MESSAGE: line 12: [object SVGSVGElement] +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: 0 +CONSOLE MESSAGE: line 12: 0 +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: function Object() { [native code] } +CONSOLE MESSAGE: line 12: function Object() { [native code] } +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: function ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +CONSOLE MESSAGE: line 12: function ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +CONSOLE MESSAGE: line 11: 42.0000 +CONSOLE MESSAGE: line 12: 42.0000 +CONSOLE MESSAGE: line 11: abc +CONSOLE MESSAGE: line 12: abc +CONSOLE MESSAGE: line 11: [object Uint16Array] +CONSOLE MESSAGE: line 12: [object Uint16Array] +CONSOLE MESSAGE: line 11: [object Text] +CONSOLE MESSAGE: line 12: [object Text] +CONSOLE MESSAGE: line 11: [object DOMException] +CONSOLE MESSAGE: line 12: [object DOMException] +CONSOLE MESSAGE: line 11: [object Uint8Array] +CONSOLE MESSAGE: line 12: [object Uint8Array] +CONSOLE MESSAGE: line 11: [object Uint8Array] +CONSOLE MESSAGE: line 12: [object Uint8Array] +CONSOLE MESSAGE: line 11: [object Uint8Array] +CONSOLE MESSAGE: line 12: [object Uint8Array] +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +CONSOLE MESSAGE: line 12: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +CONSOLE MESSAGE: line 11: test +CONSOLE MESSAGE: line 12: test +CONSOLE MESSAGE: line 11: 42.0000 +CONSOLE MESSAGE: line 12: 42.0000 +CONSOLE MESSAGE: line 11: abc +CONSOLE MESSAGE: line 12: abc +CONSOLE MESSAGE: line 11: [object Promise] +CONSOLE MESSAGE: line 12: [object Promise] +CONSOLE MESSAGE: line 11: [object Promise] +CONSOLE MESSAGE: line 12: [object Promise] +CONSOLE MESSAGE: line 11: [object Promise] +CONSOLE MESSAGE: line 12: [object Promise] +CONSOLE MESSAGE: line 11: Symbol() +CONSOLE MESSAGE: line 12: Symbol() +CONSOLE MESSAGE: line 11: Symbol(a) +CONSOLE MESSAGE: line 12: Symbol(a) +CONSOLE MESSAGE: line 11: [object Object] +CONSOLE MESSAGE: line 12: [object Object] +CONSOLE MESSAGE: line 11: [object Map] +CONSOLE MESSAGE: line 12: [object Map] +CONSOLE MESSAGE: line 11: [object WeakMap] +CONSOLE MESSAGE: line 12: [object WeakMap] +CONSOLE MESSAGE: line 11: [object Set] +CONSOLE MESSAGE: line 12: [object Set] +CONSOLE MESSAGE: line 11: [object WeakSet] +CONSOLE MESSAGE: line 12: [object WeakSet] +CONSOLE MESSAGE: line 11: [object Map] +CONSOLE MESSAGE: line 12: [object Map] +CONSOLE MESSAGE: line 11: [object Map] +CONSOLE MESSAGE: line 12: [object Map] +CONSOLE MESSAGE: line 11: [object Set] +CONSOLE MESSAGE: line 12: [object Set] +CONSOLE MESSAGE: line 11: [object Set] +CONSOLE MESSAGE: line 12: [object Set] +CONSOLE MESSAGE: line 11: [object Map] +CONSOLE MESSAGE: line 12: [object Map] +CONSOLE MESSAGE: line 11: [object Generator] +CONSOLE MESSAGE: line 12: [object Generator] +Tests console logging for messages that happen before DevTools is open. + + console-format-startup.html:25 Array(10) +console-format-startup.html:26 Array(10) +console-format-startup.html:27 Array(10) +console-format-startup.html:28 Test for zero "0" in formatter +console-format-startup.html:29 % self-escape1 dummy +console-format-startup.html:30 %s self-escape2 dummy +console-format-startup.html:31 %ss self-escape3 dummy +console-format-startup.html:32 %sdummy%s self-escape4 +console-format-startup.html:33 %%% self-escape5 dummy +console-format-startup.html:34 %dummy self-escape6 +console-format-startup.html:157 +console-format-startup.html:159 Array of arrays +console-format-startup.html:160 +console-format-startup.html:162 Large array of arrays +console-format-startup.html:163 +console-format-startup.html:165 Array or array and object +console-format-startup.html:166 +console-format-startup.html:168 Object table +console-format-startup.html:169 +console-format-startup.html:171 Null as columns +console-format-startup.html:172 +console-format-startup.html:174 Digit as columns +console-format-startup.html:175 +console-format-startup.html:177 String as columns +console-format-startup.html:178 +console-format-startup.html:180 Random string as columns +console-format-startup.html:181 +console-format-startup.html:183 Array of strings as columns +console-format-startup.html:184 +console-format-startup.html:186 Good and bad column names +console-format-startup.html:187 +console-format-startup.html:189 Missing column name +console-format-startup.html:190 +console-format-startup.html:192 Shallow array +console-format-startup.html:193 +console-format-startup.html:195 Shallow array with 'Value' column +console-format-startup.html:196 +console-format-startup.html:198 Deep and shallow array +console-format-startup.html:199 +console-format-startup.html:210 HTMLCollection(1) +console-format-startup.html:214 HTMLCollection(4) +console-format-startup.html:218 HTMLOptionsCollection(2) +console-format-startup.html:222 HTMLAllCollection(18) +console-format-startup.html:226 HTMLFormControlsCollection(3) +console-format-startup.html:230 RadioNodeList(2) +console-format-startup.html:236 Array(2) +console-format-startup.html:239 NonArrayWithLength +console-format-startup.html:246 Arguments(2) +console-format-startup.html:250 DOMTokenList(0) +console-format-startup.html:253 ArrayLike(5) +console-format-startup.html:254 ArrayLike(4294967295) +console-format-startup.html:256 ArrayLike +console-format-startup.html:257 ArrayLike +console-format-startup.html:258 ArrayLike +console-format-startup.html:259 ArrayLike +console-format-startup.html:260 ArrayLike +console-format-startup.html:261 ArrayLike +console-format-startup.html:11 /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +console-format-startup.html:12 [/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\…?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i] +globals[0] +/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +console-format-startup.html:11 /foo\\bar\sbaz/i +console-format-startup.html:12 [/foo\\bar\sbaz/i] +globals[1] +/foo\\bar\sbaz/i +console-format-startup.html:11 test +console-format-startup.html:12 ["test"] +globals[2] +"test" +console-format-startup.html:11 test named "test" +console-format-startup.html:12 ["test named "test""] +globals[3] +"test named "test"" +console-format-startup.html:11 Error +console-format-startup.html:12 [Error +] +globals[4] +Error +console-format-startup.html:11 Error: my error message +console-format-startup.html:12 [Error: my error message +] +globals[5] +Error: my error message +console-format-startup.html:11 Error: my multiline +error message +console-format-startup.html:12 [Error: my multiline +error message +] +globals[6] +Error: my multiline +error message +console-format-startup.html:11 + <p id="p"></p> +console-format-startup.html:12 [p#p] +globals[7] + <p id="p"></p> +console-format-startup.html:11 ƒ () { return 1; } +console-format-startup.html:12 [ƒ] +globals[8] +ƒ () { return 1; } +console-format-startup.html:11 ƒ () { + return 2; + } +console-format-startup.html:12 [ƒ] +globals[9] +ƒ () { + return 2; + } +console-format-startup.html:11 0.12 +console-format-startup.html:12 [0.12] +globals[10] +0.12 +console-format-startup.html:11 http://webkit.org/ +console-format-startup.html:12 ["http://webkit.org/"] +globals[11] +"http://webkit.org/" +console-format-startup.html:11 null +console-format-startup.html:12 [null] +globals[12] +null +console-format-startup.html:11 undefined +console-format-startup.html:12 [undefined] +globals[13] +undefined +console-format-startup.html:11 + attr="" +console-format-startup.html:12 [attr] +globals[14] + attr="" +console-format-startup.html:11 + attr="value" +console-format-startup.html:12 [attr] +globals[15] + attr="value" +console-format-startup.html:11 + id="x" +console-format-startup.html:12 [id] +globals[16] + id="x" +console-format-startup.html:11 {} +console-format-startup.html:12 [{…}] +globals[17] +{} +console-format-startup.html:11 NaN +console-format-startup.html:12 [NaN] +globals[18] +NaN +console-format-startup.html:11 Infinity +console-format-startup.html:12 [Infinity] +globals[19] +Infinity +console-format-startup.html:11 -Infinity +console-format-startup.html:12 [-Infinity] +globals[20] +-Infinity +console-format-startup.html:11 (10) ["test", "test2", empty × 2, "test4", empty × 5, foo: {…}] +console-format-startup.html:12 [Array(10)] +globals[21] +(10) ["test", "test2", empty × 2, "test4", empty × 5, foo: {…}] +console-format-startup.html:11 {} +console-format-startup.html:12 [{…}] +globals[22] +{} +console-format-startup.html:11 [ƒ] +console-format-startup.html:12 [Array(1)] +globals[23] +[ƒ] +console-format-startup.html:11 {bar: "bar"} +console-format-startup.html:12 [{…}] +globals[24] +{bar: "bar"} +console-format-startup.html:11 + <svg id="svg-node"></svg> +console-format-startup.html:12 [svg#svg-node] +globals[25] + <svg id="svg-node"></svg> +console-format-startup.html:11 {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …} +console-format-startup.html:12 [{…}] +globals[26] +{enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …} +console-format-startup.html:11 -0 +console-format-startup.html:12 [-0] +globals[27] +-0 +console-format-startup.html:11 {} +console-format-startup.html:12 [{…}] +globals[28] +{} +console-format-startup.html:11 ƒ Object() { [native code] } +console-format-startup.html:12 [ƒ] +globals[29] +ƒ Object() { [native code] } +console-format-startup.html:11 {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …} +console-format-startup.html:12 [{…}] +globals[30] +{constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …} +console-format-startup.html:11 ƒ ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +console-format-startup.html:12 [ƒ] +globals[31] +ƒ ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +console-format-startup.html:11 Number {42} +console-format-startup.html:12 [Number] +globals[32] +Number {42} +console-format-startup.html:11 String {"abc"} +console-format-startup.html:12 [String] +globals[33] +String {"abc"} +console-format-startup.html:11 Uint16Array(3) [1, 2, 3] +console-format-startup.html:12 [Uint16Array(3)] +globals[34] +Uint16Array(3) [1, 2, 3] +console-format-startup.html:11 #text +console-format-startup.html:12 [text] +globals[35] +#text +console-format-startup.html:11 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. +console-format-startup.html:12 [DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of th…] +globals[36] +DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. +console-format-startup.html:11 Uint8Array [3] +console-format-startup.html:12 [Uint8Array(1)] +globals[37] +Uint8Array [3] +console-format-startup.html:11 Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] +console-format-startup.html:12 [Uint8Array(400)] +globals[38] +Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] +console-format-startup.html:11 Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] +console-format-startup.html:12 [Uint8Array(400000000)] +globals[39] +Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] +console-format-startup.html:11 namespace.longSubNamespace.x.className {} +console-format-startup.html:12 [n…e.l…e.x.className] +globals[40] +namespace.longSubNamespace.x.className {} +console-format-startup.html:11 (200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …] +console-format-startup.html:12 [Array(200)] +globals[41] +(200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …] +console-format-startup.html:11 ["test"] +console-format-startup.html:12 [Array(1)] +globals[42] +["test"] +console-format-startup.html:11 Number {42, 1: "foo", a: "bar"} +console-format-startup.html:12 [Number] +globals[43] +Number {42, 1: "foo", a: "bar"} +console-format-startup.html:11 String {"abc", 3: "foo", 01: "foo", a: "bar"} +console-format-startup.html:12 [String] +globals[44] +String {"abc", 3: "foo", 01: "foo", a: "bar"} +console-format-startup.html:11 Promise {<rejected>: -0} +console-format-startup.html:12 [Promise] +globals[45] +Promise {<rejected>: -0} +console-format-startup.html:11 Promise {<resolved>: 1} +console-format-startup.html:12 [Promise] +globals[46] +Promise {<resolved>: 1} +console-format-startup.html:11 Promise {<pending>} +console-format-startup.html:12 [Promise] +globals[47] +Promise {<pending>} +console-format-startup.html:11 Symbol() +console-format-startup.html:12 [Symbol()] +globals[48] +Symbol() +console-format-startup.html:11 Symbol(a) +console-format-startup.html:12 [Symbol(a)] +globals[49] +Symbol(a) +console-format-startup.html:11 {a: Symbol(), Symbol(a): 2} +console-format-startup.html:12 [{…}] +globals[50] +{a: Symbol(), Symbol(a): 2} +console-format-startup.html:11 Map(1) {{…} => {…}} +console-format-startup.html:12 [Map(1)] +globals[51] +Map(1) {{…} => {…}} +console-format-startup.html:11 WeakMap {{…} => {…}} +console-format-startup.html:12 [WeakMap] +globals[52] +WeakMap {{…} => {…}} +console-format-startup.html:11 Set(1) {{…}} +console-format-startup.html:12 [Set(1)] +globals[53] +Set(1) {{…}} +console-format-startup.html:11 WeakSet {{…}} +console-format-startup.html:12 [WeakSet] +globals[54] +WeakSet {{…}} +console-format-startup.html:11 Map(1) {Map(0) => WeakMap} +console-format-startup.html:12 [Map(1)] +globals[55] +Map(1) {Map(0) => WeakMap} +console-format-startup.html:11 Map(1) {Map(1) => WeakMap} +console-format-startup.html:12 [Map(1)] +globals[56] +Map(1) {Map(1) => WeakMap} +console-format-startup.html:11 Set(1) {WeakSet} +console-format-startup.html:12 [Set(1)] +globals[57] +Set(1) {WeakSet} +console-format-startup.html:11 Set(1) {WeakSet} +console-format-startup.html:12 [Set(1)] +globals[58] +Set(1) {WeakSet} +console-format-startup.html:11 Map(6) {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, {…} => {…}, …} +console-format-startup.html:12 [Map(6)] +globals[59] +Map(6) {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, {…} => {…}, …} +console-format-startup.html:11 genFunction {<suspended>} +console-format-startup.html:12 [genFunction] +globals[60] +genFunction {<suspended>} +Expanded all messages +console-format-startup.html:25 Array(10) + 0: "test" + 1: "test2" + 4: "test4" + foo: {} + length: 10 + __proto__: Array(0) +console-format-startup.html:26 Array(10) + 0: "test" + 1: "test2" + 4: "test4" + foo: {} + length: 10 + __proto__: Array(0) +console-format-startup.html:27 Array(10) + 0: "test" + 1: "test2" + 4: "test4" + foo: {} + length: 10 + __proto__: Array(0) +console-format-startup.html:28 Test for zero "0" in formatter +console-format-startup.html:29 % self-escape1 dummy +console-format-startup.html:30 %s self-escape2 dummy +console-format-startup.html:31 %ss self-escape3 dummy +console-format-startup.html:32 %sdummy%s self-escape4 +console-format-startup.html:33 %%% self-escape5 dummy +console-format-startup.html:34 %dummy self-escape6 +console-format-startup.html:157 +console-format-startup.html:159 Array of arrays +console-format-startup.html:160 +console-format-startup.html:162 Large array of arrays +console-format-startup.html:163 +console-format-startup.html:165 Array or array and object +console-format-startup.html:166 +console-format-startup.html:168 Object table +console-format-startup.html:169 +console-format-startup.html:171 Null as columns +console-format-startup.html:172 +console-format-startup.html:174 Digit as columns +console-format-startup.html:175 +console-format-startup.html:177 String as columns +console-format-startup.html:178 +console-format-startup.html:180 Random string as columns +console-format-startup.html:181 +console-format-startup.html:183 Array of strings as columns +console-format-startup.html:184 +console-format-startup.html:186 Good and bad column names +console-format-startup.html:187 +console-format-startup.html:189 Missing column name +console-format-startup.html:190 +console-format-startup.html:192 Shallow array +console-format-startup.html:193 +console-format-startup.html:195 Shallow array with 'Value' column +console-format-startup.html:196 +console-format-startup.html:198 Deep and shallow array +console-format-startup.html:199 +console-format-startup.html:210 HTMLCollection(1) + 0: select#sel + length: 1 + sel: select#sel + __proto__: HTMLCollection +console-format-startup.html:214 HTMLCollection(4) + 0: script + 1: script + 2: script + 3: script + length: 4 + __proto__: HTMLCollection +console-format-startup.html:218 HTMLOptionsCollection(2) + 0: option + 1: option + length: 2 + selectedIndex: 0 + __proto__: HTMLOptionsCollection +console-format-startup.html:222 HTMLAllCollection(18) + 0: html + 1: head + 2: script + 3: script + 4: script + 5: script + 6: body + 7: p + 8: div#x + 9: p#p + 10: svg#svg-node + 11: div.c1.c2.c3 + 12: form#f + 13: select#sel + 14: option + 15: option + 16: input + 17: input + length: 18 + f: form#f + p: p#p + sel: select#sel + svg-node: svg#svg-node + x: (3) [div#x, input, input] + __proto__: HTMLAllCollection +console-format-startup.html:226 HTMLFormControlsCollection(3) + 0: select#sel + 1: input + 2: input + length: 3 + sel: select#sel + x: (2) [input, input, value: ""] + __proto__: HTMLFormControlsCollection +console-format-startup.html:230 RadioNodeList(2) + 0: input + 1: input + length: 2 + value: "" + __proto__: RadioNodeList +console-format-startup.html:236 Array(2) + 0: 1 + 1: (2) [2, Array(2)] + length: 2 + __proto__: Array(0) +console-format-startup.html:239 NonArrayWithLength + keys: [] + length: (...) + __proto__: Object +console-format-startup.html:246 Arguments(2) + 0: 1 + 1: "2" + callee: ƒ generateArguments(foo, bar) + length: 2 + Symbol(Symbol.iterator): ƒ values() + __proto__: Object +console-format-startup.html:250 DOMTokenList(0) + length: 0 + value: "" + __proto__: DOMTokenList +console-format-startup.html:253 ArrayLike(5) + length: 5 + __proto__: Object +console-format-startup.html:254 ArrayLike(4294967295) + length: 4294967295 + __proto__: Object +console-format-startup.html:256 ArrayLike + length: -5 + __proto__: Object +console-format-startup.html:257 ArrayLike + length: 5.6 + __proto__: Object +console-format-startup.html:258 ArrayLike + length: NaN + __proto__: Object +console-format-startup.html:259 ArrayLike + length: Infinity + __proto__: Object +console-format-startup.html:260 ArrayLike + length: -0 + __proto__: Object +console-format-startup.html:261 ArrayLike + length: 4294967296 + __proto__: Object +console-format-startup.html:11 /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +console-format-startup.html:12 [/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\…?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i] + 0: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i + length: 1 + __proto__: Array(0) +globals[0] +/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i +console-format-startup.html:11 /foo\\bar\sbaz/i +console-format-startup.html:12 [/foo\\bar\sbaz/i] + 0: /foo\\bar\sbaz/i + length: 1 + __proto__: Array(0) +globals[1] +/foo\\bar\sbaz/i +console-format-startup.html:11 test +console-format-startup.html:12 ["test"] + 0: "test" + length: 1 + __proto__: Array(0) +globals[2] +"test" +console-format-startup.html:11 test named "test" +console-format-startup.html:12 ["test named "test""] + 0: "test named "test"" + length: 1 + __proto__: Array(0) +globals[3] +"test named "test"" +console-format-startup.html:11 Error +console-format-startup.html:12 [Error +] + 0: Error + length: 1 + __proto__: Array(0) +globals[4] +Error +console-format-startup.html:11 Error: my error message +console-format-startup.html:12 [Error: my error message +] + 0: Error: my error message + length: 1 + __proto__: Array(0) +globals[5] +Error: my error message +console-format-startup.html:11 Error: my multiline +error message +console-format-startup.html:12 [Error: my multiline +error message +] + 0: Error: my multiline +error message + length: 1 + __proto__: Array(0) +globals[6] +Error: my multiline +error message +console-format-startup.html:11 + <p id="p"></p> +console-format-startup.html:12 [p#p] + 0: p#p + length: 1 + __proto__: Array(0) +globals[7] + <p id="p"></p> +console-format-startup.html:11 ƒ () { return 1; } +console-format-startup.html:12 [ƒ] + 0: ƒ () + length: 1 + __proto__: Array(0) +globals[8] +ƒ () { return 1; } +console-format-startup.html:11 ƒ () { + return 2; + } +console-format-startup.html:12 [ƒ] + 0: ƒ () + length: 1 + __proto__: Array(0) +globals[9] +ƒ () { + return 2; + } +console-format-startup.html:11 0.12 +console-format-startup.html:12 [0.12] + 0: 0.12 + length: 1 + __proto__: Array(0) +globals[10] +0.12 +console-format-startup.html:11 http://webkit.org/ +console-format-startup.html:12 ["http://webkit.org/"] + 0: "http://webkit.org/" + length: 1 + __proto__: Array(0) +globals[11] +"http://webkit.org/" +console-format-startup.html:11 null +console-format-startup.html:12 [null] + 0: null + length: 1 + __proto__: Array(0) +globals[12] +null +console-format-startup.html:11 undefined +console-format-startup.html:12 [undefined] + 0: undefined + length: 1 + __proto__: Array(0) +globals[13] +undefined +console-format-startup.html:11 + attr="" +console-format-startup.html:12 [attr] + 0: attr + length: 1 + __proto__: Array(0) +globals[14] + attr="" +console-format-startup.html:11 + attr="value" +console-format-startup.html:12 [attr] + 0: attr + length: 1 + __proto__: Array(0) +globals[15] + attr="value" +console-format-startup.html:11 + id="x" +console-format-startup.html:12 [id] + 0: id + length: 1 + __proto__: Array(0) +globals[16] + id="x" +console-format-startup.html:11 {} + length: (...) + get length: ƒ length() + __proto__: Object +console-format-startup.html:12 [{…}] + 0: {} + length: 1 + __proto__: Array(0) +globals[17] +{} + length: (...) + get length: ƒ length() + __proto__: Object +console-format-startup.html:11 NaN +console-format-startup.html:12 [NaN] + 0: NaN + length: 1 + __proto__: Array(0) +globals[18] +NaN +console-format-startup.html:11 Infinity +console-format-startup.html:12 [Infinity] + 0: Infinity + length: 1 + __proto__: Array(0) +globals[19] +Infinity +console-format-startup.html:11 -Infinity +console-format-startup.html:12 [-Infinity] + 0: -Infinity + length: 1 + __proto__: Array(0) +globals[20] +-Infinity +console-format-startup.html:11 (10) ["test", "test2", empty × 2, "test4", empty × 5, foo: {…}] + 0: "test" + 1: "test2" + 4: "test4" + foo: {} + length: 10 + __proto__: Array(0) +console-format-startup.html:12 [Array(10)] + 0: (10) ["test", "test2", empty × 2, "test4", empty × 5, foo: {…}] + length: 1 + __proto__: Array(0) +globals[21] +(10) ["test", "test2", empty × 2, "test4", empty × 5, foo: {…}] + 0: "test" + 1: "test2" + 4: "test4" + foo: {} + length: 10 + __proto__: Array(0) +console-format-startup.html:11 {} + __proto__: Object +console-format-startup.html:12 [{…}] + 0: {} + length: 1 + __proto__: Array(0) +globals[22] +{} + __proto__: Object +console-format-startup.html:11 [ƒ] + 0: ƒ () + length: 1 + __proto__: Array(0) +console-format-startup.html:12 [Array(1)] + 0: [ƒ] + length: 1 + __proto__: Array(0) +globals[23] +[ƒ] + 0: ƒ () + length: 1 + __proto__: Array(0) +console-format-startup.html:11 {bar: "bar"} + bar: "bar" + __proto__: Object +console-format-startup.html:12 [{…}] + 0: {bar: "bar"} + length: 1 + __proto__: Array(0) +globals[24] +{bar: "bar"} + bar: "bar" + __proto__: Object +console-format-startup.html:11 + <svg id="svg-node"></svg> +console-format-startup.html:12 [svg#svg-node] + 0: svg#svg-node + length: 1 + __proto__: Array(0) +globals[25] + <svg id="svg-node"></svg> +console-format-startup.html:11 {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …} + enumerableProp: 4 + __underscoreEnumerableProp__: 5 + abc: 3 + bar: (...) + getFoo: ƒ () + __underscoreNonEnumerableProp: 2 + get bar: ƒ () + set bar: ƒ (x) + __proto__: Object +console-format-startup.html:12 [{…}] + 0: {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …} + length: 1 + __proto__: Array(0) +globals[26] +{enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …} + enumerableProp: 4 + __underscoreEnumerableProp__: 5 + abc: 3 + bar: (...) + getFoo: ƒ () + __underscoreNonEnumerableProp: 2 + get bar: ƒ () + set bar: ƒ (x) + __proto__: Object +console-format-startup.html:11 -0 +console-format-startup.html:12 [-0] + 0: -0 + length: 1 + __proto__: Array(0) +globals[27] +-0 +console-format-startup.html:11 {} + No properties +console-format-startup.html:12 [{…}] + 0: {} + length: 1 + __proto__: Array(0) +globals[28] +{} + No properties +console-format-startup.html:11 ƒ Object() { [native code] } +console-format-startup.html:12 [ƒ] + 0: ƒ Object() + length: 1 + __proto__: Array(0) +globals[29] +ƒ Object() { [native code] } +console-format-startup.html:11 {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …} + constructor: ƒ Object() + hasOwnProperty: ƒ hasOwnProperty() + isPrototypeOf: ƒ isPrototypeOf() + propertyIsEnumerable: ƒ propertyIsEnumerable() + toLocaleString: ƒ toLocaleString() + toString: ƒ toString() + valueOf: ƒ valueOf() + __defineGetter__: ƒ __defineGetter__() + __defineSetter__: ƒ __defineSetter__() + __lookupGetter__: ƒ __lookupGetter__() + __lookupSetter__: ƒ __lookupSetter__() + get __proto__: ƒ __proto__() + set __proto__: ƒ __proto__() +console-format-startup.html:12 [{…}] + 0: {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …} + length: 1 + __proto__: Array(0) +globals[30] +{constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …} + constructor: ƒ Object() + hasOwnProperty: ƒ hasOwnProperty() + isPrototypeOf: ƒ isPrototypeOf() + propertyIsEnumerable: ƒ propertyIsEnumerable() + toLocaleString: ƒ toLocaleString() + toString: ƒ toString() + valueOf: ƒ valueOf() + __defineGetter__: ƒ __defineGetter__() + __defineSetter__: ƒ __defineSetter__() + __lookupGetter__: ƒ __lookupGetter__() + __lookupSetter__: ƒ __lookupSetter__() + get __proto__: ƒ __proto__() + set __proto__: ƒ __proto__() +console-format-startup.html:11 ƒ ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +console-format-startup.html:12 [ƒ] + 0: ƒ ( /**/ foo/**/, /*/**/bar, /**/baz) + length: 1 + __proto__: Array(0) +globals[31] +ƒ ( /**/ foo/**/, /*/**/bar, + /**/baz) {} +console-format-startup.html:11 Number {42} + __proto__: Number + [[PrimitiveValue]]: 42 +console-format-startup.html:12 [Number] + 0: Number {42} + length: 1 + __proto__: Array(0) +globals[32] +Number {42} + __proto__: Number + [[PrimitiveValue]]: 42 +console-format-startup.html:11 String {"abc"} + 0: "a" + 1: "b" + 2: "c" + length: 3 + __proto__: String + [[PrimitiveValue]]: "abc" +console-format-startup.html:12 [String] + 0: String {"abc"} + length: 1 + __proto__: Array(0) +globals[33] +String {"abc"} + 0: "a" + 1: "b" + 2: "c" + length: 3 + __proto__: String + [[PrimitiveValue]]: "abc" +console-format-startup.html:11 Uint16Array(3) [1, 2, 3] + 0: 1 + 1: 2 + 2: 3 + buffer: (...) + byteLength: (...) + byteOffset: (...) + length: (...) + Symbol(Symbol.toStringTag): (...) + __proto__: TypedArray +console-format-startup.html:12 [Uint16Array(3)] + 0: Uint16Array(3) [1, 2, 3] + length: 1 + __proto__: Array(0) +globals[34] +Uint16Array(3) [1, 2, 3] + 0: 1 + 1: 2 + 2: 3 + buffer: (...) + byteLength: (...) + byteOffset: (...) + length: (...) + Symbol(Symbol.toStringTag): (...) + __proto__: TypedArray +console-format-startup.html:11 #text +console-format-startup.html:12 [text] + 0: text + length: 1 + __proto__: Array(0) +globals[35] +#text +console-format-startup.html:11 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. +console-format-startup.html:12 [DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of th…] + 0: DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. + length: 1 + __proto__: Array(0) +globals[36] +DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. +console-format-startup.html:11 Uint8Array [3] + 0: 3 + buffer: (...) + byteLength: (...) + byteOffset: (...) + length: (...) + Symbol(Symbol.toStringTag): (...) + __proto__: TypedArray +console-format-startup.html:12 [Uint8Array(1)] + 0: Uint8Array [3] + length: 1 + __proto__: Array(0) +globals[37] +Uint8Array [3] + 0: 3 + buffer: (...) + byteLength: (...) + byteOffset: (...) + length: (...) + Symbol(Symbol.toStringTag): (...) + __proto__: TypedArray +console-format-startup.html:11 Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + [0 … 99] + [100 … 199] + [200 … 299] + [300 … 399] + foo: "bar" + __proto__: TypedArray +console-format-startup.html:12 [Uint8Array(400)] + 0: Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + length: 1 + __proto__: Array(0) +globals[38] +Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + [0 … 99] + [100 … 199] + [200 … 299] + [300 … 399] + foo: "bar" + __proto__: TypedArray +console-format-startup.html:11 Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + [0 … 99999999] + [100000000 … 199999999] + [200000000 … 299999999] + [300000000 … 399999999] + __proto__: TypedArray +console-format-startup.html:12 [Uint8Array(400000000)] + 0: Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + length: 1 + __proto__: Array(0) +globals[39] +Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] + [0 … 99999999] + [100000000 … 199999999] + [200000000 … 299999999] + [300000000 … 399999999] + __proto__: TypedArray +console-format-startup.html:11 namespace.longSubNamespace.x.className {} + __proto__: Object +console-format-startup.html:12 [n…e.l…e.x.className] + 0: namespace.longSubNamespace.x.className {} + length: 1 + __proto__: Array(0) +globals[40] +namespace.longSubNamespace.x.className {} + __proto__: Object +console-format-startup.html:11 (200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …] + [0 … 99] + [100 … 199] + length: 200 + __proto__: Array(0) +console-format-startup.html:12 [Array(200)] + 0: (200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …] + length: 1 + __proto__: Array(0) +globals[41] +(200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …] + [0 … 99] + [100 … 199] + length: 200 + __proto__: Array(0) +console-format-startup.html:11 ["test"] + 0: "test" + length: 1 + __proto__: Array(0) +console-format-startup.html:12 [Array(1)] + 0: ["test"] + length: 1 + __proto__: Array(0) +globals[42] +["test"] + 0: "test" + length: 1 + __proto__: Array(0) +console-format-startup.html:11 Number {42, 1: "foo", a: "bar"} + 1: "foo" + a: "bar" + __proto__: Number + [[PrimitiveValue]]: 42 +console-format-startup.html:12 [Number] + 0: Number {42, 1: "foo", a: "bar"} + length: 1 + __proto__: Array(0) +globals[43] +Number {42, 1: "foo", a: "bar"} + 1: "foo" + a: "bar" + __proto__: Number + [[PrimitiveValue]]: 42 +console-format-startup.html:11 String {"abc", 3: "foo", 01: "foo", a: "bar"} + 0: "a" + 01: "foo" + 1: "b" + 2: "c" + 3: "foo" + a: "bar" + length: 3 + __proto__: String + [[PrimitiveValue]]: "abc" +console-format-startup.html:12 [String] + 0: String {"abc", 3: "foo", 01: "foo", a: "bar"} + length: 1 + __proto__: Array(0) +globals[44] +String {"abc", 3: "foo", 01: "foo", a: "bar"} + 0: "a" + 01: "foo" + 1: "b" + 2: "c" + 3: "foo" + a: "bar" + length: 3 + __proto__: String + [[PrimitiveValue]]: "abc" +console-format-startup.html:11 Promise {<rejected>: -0} + __proto__: Promise + [[PromiseStatus]]: "rejected" + [[PromiseValue]]: -0 +console-format-startup.html:12 [Promise] + 0: Promise {<rejected>: -0} + length: 1 + __proto__: Array(0) +globals[45] +Promise {<rejected>: -0} + __proto__: Promise + [[PromiseStatus]]: "rejected" + [[PromiseValue]]: -0 +console-format-startup.html:11 Promise {<resolved>: 1} + __proto__: Promise + [[PromiseStatus]]: "resolved" + [[PromiseValue]]: 1 +console-format-startup.html:12 [Promise] + 0: Promise {<resolved>: 1} + length: 1 + __proto__: Array(0) +globals[46] +Promise {<resolved>: 1} + __proto__: Promise + [[PromiseStatus]]: "resolved" + [[PromiseValue]]: 1 +console-format-startup.html:11 Promise {<pending>} + __proto__: Promise + [[PromiseStatus]]: "pending" + [[PromiseValue]]: undefined +console-format-startup.html:12 [Promise] + 0: Promise {<pending>} + length: 1 + __proto__: Array(0) +globals[47] +Promise {<pending>} + __proto__: Promise + [[PromiseStatus]]: "pending" + [[PromiseValue]]: undefined +console-format-startup.html:11 Symbol() +console-format-startup.html:12 [Symbol()] + 0: Symbol() + length: 1 + __proto__: Array(0) +globals[48] +Symbol() +console-format-startup.html:11 Symbol(a) +console-format-startup.html:12 [Symbol(a)] + 0: Symbol(a) + length: 1 + __proto__: Array(0) +globals[49] +Symbol(a) +console-format-startup.html:11 {a: Symbol(), Symbol(a): 2} + a: Symbol() + getter: (...) + Symbol(a): 2 + get getter: ƒ getter() + __proto__: Object +console-format-startup.html:12 [{…}] + 0: {a: Symbol(), Symbol(a): 2} + length: 1 + __proto__: Array(0) +globals[50] +{a: Symbol(), Symbol(a): 2} + a: Symbol() + getter: (...) + Symbol(a): 2 + get getter: ƒ getter() + __proto__: Object +console-format-startup.html:11 Map(1) {{…} => {…}} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Object => Object} + length: 1 +console-format-startup.html:12 [Map(1)] + 0: Map(1) {{…} => {…}} + length: 1 + __proto__: Array(0) +globals[51] +Map(1) {{…} => {…}} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Object => Object} + length: 1 +console-format-startup.html:11 WeakMap {{…} => {…}} + __proto__: WeakMap + [[Entries]]: Array(1) + 0: {Object => Object} + length: 1 +console-format-startup.html:12 [WeakMap] + 0: WeakMap {{…} => {…}} + length: 1 + __proto__: Array(0) +globals[52] +WeakMap {{…} => {…}} + __proto__: WeakMap + [[Entries]]: Array(1) + 0: {Object => Object} + length: 1 +console-format-startup.html:11 Set(1) {{…}} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: Object + length: 1 +console-format-startup.html:12 [Set(1)] + 0: Set(1) {{…}} + length: 1 + __proto__: Array(0) +globals[53] +Set(1) {{…}} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: Object + length: 1 +console-format-startup.html:11 WeakSet {{…}} + __proto__: WeakSet + [[Entries]]: Array(1) + 0: Object + length: 1 +console-format-startup.html:12 [WeakSet] + 0: WeakSet {{…}} + length: 1 + __proto__: Array(0) +globals[54] +WeakSet {{…}} + __proto__: WeakSet + [[Entries]]: Array(1) + 0: Object + length: 1 +console-format-startup.html:11 Map(1) {Map(0) => WeakMap} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Map(0) => WeakMap} + length: 1 +console-format-startup.html:12 [Map(1)] + 0: Map(1) {Map(0) => WeakMap} + length: 1 + __proto__: Array(0) +globals[55] +Map(1) {Map(0) => WeakMap} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Map(0) => WeakMap} + length: 1 +console-format-startup.html:11 Map(1) {Map(1) => WeakMap} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Map(1) => WeakMap} + length: 1 +console-format-startup.html:12 [Map(1)] + 0: Map(1) {Map(1) => WeakMap} + length: 1 + __proto__: Array(0) +globals[56] +Map(1) {Map(1) => WeakMap} + size: (...) + __proto__: Map + [[Entries]]: Array(1) + 0: {Map(1) => WeakMap} + length: 1 +console-format-startup.html:11 Set(1) {WeakSet} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: WeakSet + length: 1 +console-format-startup.html:12 [Set(1)] + 0: Set(1) {WeakSet} + length: 1 + __proto__: Array(0) +globals[57] +Set(1) {WeakSet} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: WeakSet + length: 1 +console-format-startup.html:11 Set(1) {WeakSet} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: WeakSet + length: 1 +console-format-startup.html:12 [Set(1)] + 0: Set(1) {WeakSet} + length: 1 + __proto__: Array(0) +globals[58] +Set(1) {WeakSet} + size: (...) + __proto__: Set + [[Entries]]: Array(1) + 0: WeakSet + length: 1 +console-format-startup.html:11 Map(6) {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, {…} => {…}, …} + size: (...) + __proto__: Map + [[Entries]]: Array(6) + 0: {" from str " => " to str "} + 1: {undefined => undefined} + 2: {null => null} + 3: {42 => 42} + 4: {Object => Object} + 5: {Array(1) => Array(1)} + length: 6 +console-format-startup.html:12 [Map(6)] + 0: Map(6) {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, {…} => {…}, …} + length: 1 + __proto__: Array(0) +globals[59] +Map(6) {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, {…} => {…}, …} + size: (...) + __proto__: Map + [[Entries]]: Array(6) + 0: {" from str " => " to str "} + 1: {undefined => undefined} + 2: {null => null} + 3: {42 => 42} + 4: {Object => Object} + 5: {Array(1) => Array(1)} + length: 6 +console-format-startup.html:11 genFunction {<suspended>} + __proto__: Generator + [[GeneratorStatus]]: "suspended" + [[GeneratorFunction]]: ƒ* () + [[GeneratorReceiver]]: Window + [[GeneratorLocation]]: console-format-startup.html:132 + [[Scopes]]: Scopes[2] +console-format-startup.html:12 [genFunction] + 0: genFunction {<suspended>} + length: 1 + __proto__: Array(0) +globals[60] +genFunction {<suspended>} + __proto__: Generator + [[GeneratorStatus]]: "suspended" + [[GeneratorFunction]]: ƒ* () + [[GeneratorReceiver]]: Window + [[GeneratorLocation]]: console-format-startup.html:132 + [[Scopes]]: Scopes[2] +
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup.html b/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup.html new file mode 100644 index 0000000..608a815c --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/startup/console/console-format-startup.html
@@ -0,0 +1,357 @@ +<html> +<head> +<script src="../../../inspector/inspector-test.js"></script> +<script src="../../../inspector/console-test.js"></script> +<script type="text/javascript"> + // Global Values +var globals = []; + +function log(current) +{ + console.log(globals[current]); + console.log([globals[current]]); +} +function onload() +{ + var foo = { foo: "foo"}; + var bar = { bar: "bar" }; + bar.__proto__ = foo; + var singleArray = ["test"]; + var array = ["test", "test2"]; array.length = 10; + array.foo = {}; + array[4] = "test4"; + + var svg = document.getElementById("svg-node"); + console.log(array); + console.log("%o", array); + console.log("%O", array); + console.log("Test for zero \"%f\" in formatter", 0); + console.log("%% self-escape1", "dummy"); + console.log("%%s self-escape2", "dummy"); + console.log("%%ss self-escape3", "dummy"); + console.log("%%s%s%%s self-escape4", "dummy"); + console.log("%%%%% self-escape5", "dummy"); + console.log("%%%s self-escape6", "dummy"); + + // Populate Globals + var regex1 = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i; + var regex2 = new RegExp("foo\\\\bar\\sbaz", "i"); + var str = "test"; + var str2 = "test named \"test\""; + var error = new Error; + var errorWithMessage = new Error("my error message"); + var errorWithMultilineMessage = new Error("my multiline\nerror message"); + var node = document.getElementById("p"); + var func = function() { return 1; }; + var multilinefunc = function() { + return 2; + }; + var num = 1.2e-1; + var linkify = "http://webkit.org/"; + var valuelessAttribute = document.createAttribute("attr"); + var valuedAttribute = document.createAttribute("attr"); + valuedAttribute.value = "value"; + var existingAttribute = document.getElementById("x").attributes[0]; + var throwingLengthGetter = {get length() { throw "Length called"; }}; + var objectWithNonEnumerables = Object.create({ foo: 1 }, { + __underscoreNonEnumerableProp: { value: 2, enumerable: false }, + abc: { value: 3, enumerable: false }, + getFoo: { value: function() { return this.foo; } }, + bar: { get: function() { return this.bar; }, set: function(x) { this.bar = x; } } + }); + objectWithNonEnumerables.enumerableProp = 4; + objectWithNonEnumerables.__underscoreEnumerableProp__ = 5; + var negZero = 1 / Number.NEGATIVE_INFINITY; + var textNode = document.getElementById("x").nextSibling; + var arrayLikeFunction = function( /**/ foo/**/, /*/**/bar, + /**/baz) {}; + arrayLikeFunction.splice = function() {}; + var tinyTypedArray = new Uint8Array([3]); + var smallTypedArray = new Uint8Array(new ArrayBuffer(400)); + smallTypedArray["foo"] = "bar"; + var bigTypedArray = new Uint8Array(new ArrayBuffer(400 * 1000 * 1000)); + bigTypedArray["FAIL"] = "FAIL: Object.getOwnPropertyNames() should not have been run"; + var namespace = {}; + namespace.longSubNamespace = {}; + namespace.longSubNamespace.x = {}; + namespace.longSubNamespace.x.className = function(){}; + var instanceWithLongClassName = new namespace.longSubNamespace.x.className(); + var bigArray = []; + bigArray.length = 200; + bigArray.fill(1); + var boxedNumberWithProps = new Number(42); + boxedNumberWithProps[1] = "foo"; + boxedNumberWithProps["a"] = "bar"; + var boxedStringWithProps = new String("abc"); + boxedStringWithProps["01"] = "foo"; + boxedStringWithProps[3] = "foo"; + boxedStringWithProps["a"] = "bar"; + + var p = Promise.reject(-0); + p.catch(function() {}); + + var p2 = Promise.resolve(1); + var p3 = new Promise(() => {}); + + var smb1 = Symbol(); + var smb2 = Symbol("a"); + var obj = { + get getter() {} + }; + obj["a"] = smb1; + obj[smb2] = 2; + + var map = new Map(); + var weakMap = new WeakMap(); + map.set(obj, {foo: 1}); + weakMap.set(obj, {foo: 1}); + + var set = new Set(); + var weakSet = new WeakSet(); + set.add(obj); + weakSet.add(obj); + + var mapMap0 = new Map(); + mapMap0.set(new Map(), new WeakMap()); + var mapMap = new Map(); + mapMap.set(map, weakMap); + + var setSet0 = new Set(); + setSet0.add(new WeakSet()); + var setSet = new Set(); + setSet.add(weakSet); + + var bigmap = new Map(); + bigmap.set(" from str ", " to str "); + bigmap.set(undefined, undefined); + bigmap.set(null, null); + bigmap.set(42, 42); + bigmap.set({foo:"from"}, {foo:"to"}); + bigmap.set(["from"], ["to"]); + + var genFunction = function *() { + yield 1; + yield 2; + } + var generator = genFunction(); + + globals = [ + regex1, regex2, str, str2, error, errorWithMessage, errorWithMultilineMessage, node, func, multilinefunc, + num, linkify, null, undefined, valuelessAttribute, valuedAttribute, existingAttribute, throwingLengthGetter, + NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, {}, [function() {}], bar, svg, + objectWithNonEnumerables, negZero, Object.create(null), Object, Object.prototype, arrayLikeFunction, + new Number(42), new String("abc"), new Uint16Array([1, 2, 3]), textNode, domException(), + tinyTypedArray, smallTypedArray, bigTypedArray, instanceWithLongClassName, bigArray, singleArray, + boxedNumberWithProps, boxedStringWithProps, + p, p2, p3, smb1, smb2, obj, map, weakMap, set, weakSet, + mapMap0, mapMap, setSet0, setSet, bigmap, generator, + ]; + logTable(); + logCollections(); + runTest(); +} + +function logTable() +{ + console.table(); + console.table(null); + + console.log("Array of arrays"); + console.table([[1,2,3], [4,5,6]]); + + console.log("Large array of arrays"); + console.table([[1,2,3], [4,5,6], [1,2,3], [4,5,6], [1,2,3], [4,5,6], [1,2,3], [4,5,6]]); + + console.log("Array or array and object"); + console.table([[1,2,3], {a:1, b:2, c:3}]); + + console.log("Object table"); + console.table({"foo": {a:1, b:2}, "bar": {a:3, b:4}}); + + console.log("Null as columns"); + console.table([[1,2,3], [4,5,6]], null); + + console.log("Digit as columns"); + console.table([[1,2,3], [4,5,6]], 0); + + console.log("String as columns"); + console.table([[1,2,3], [4,5,6]], "0"); + + console.log("Random string as columns"); + console.table([[1,2,3], [4,5,6]], "Foo"); + + console.log("Array of strings as columns"); + console.table([{a:1, b:2, c:3}, {a:"foo", b:"bar"}], ["a", "b"]); + + console.log("Good and bad column names"); + console.table([{a:1, b:2, c:3}, {a:"foo"}], ["a", "b", "d"]); + + console.log("Missing column name"); + console.table([{a:1, b:2, c:3}, {a:"foo"}], ["d"]); + + console.log("Shallow array"); + console.table([1, "foo", null]); + + console.log("Shallow array with 'Value' column"); + console.table([1, {Value: 2}]); + + console.log("Deep and shallow array"); + console.table([1, "foo", [2]]); +} + +function logCollections() +{ + var formElement = document.getElementById("f"); + var selectElement = document.getElementById("sel"); + var spanElement = document.getElementById("span"); + + // NodeList + var nodelist = document.getElementsByTagName("select"); + console.log(nodelist); + + // HTMLCollection + var htmlcollection = document.head.children; + console.log(htmlcollection); + + // HTMLOptionsCollection + var options = selectElement.options; + console.log(options); + + // HTMLAllCollection + var all = document.all; + console.log(all); + + // HTMLFormControlsCollection (currently shows HTMLCollection) + var formControls = formElement.elements; + console.log(formControls); + + // RadioNodeList + var radioNodeList = formElement.x; + console.log(radioNodeList); + + // Cross-referencing arrays. + var arrayX = [1]; + var arrayY = [2, arrayX]; + arrayX.push(arrayY); + console.log(arrayX); + + var nonArray = new NonArrayWithLength(); + console.log(nonArray); + + // Arguments + function generateArguments(foo, bar) + { + return arguments; + } + console.log(generateArguments(1, "2")); + + // DOMTokenList + var div = document.getElementsByTagName("div")[0]; + console.log(div.classList); + + // Array-like's. + console.log(new ArrayLike(5)); + console.log(new ArrayLike(0xFFFFFFFF)); + // Array-like's with wrong length. + console.log(new ArrayLike(-5)); + console.log(new ArrayLike(5.6)); + console.log(new ArrayLike(NaN)); + console.log(new ArrayLike(Infinity)); + console.log(new ArrayLike(-0)); + console.log(new ArrayLike(0xFFFFFFFF + 1)); +} + +function NonArrayWithLength() +{ + this.keys = []; +} + +NonArrayWithLength.prototype.__defineGetter__("length", function() +{ + console.log("FAIL: 'length' should not be called"); + return this.keys.length; +}); + +function ArrayLike(length) +{ + this.length = length; +} +ArrayLike.prototype.splice = function() {}; + +function domException() +{ + var result = "FAIL"; + try { + var a = document.createElement("div"); + var b = document.createElement("div"); + a.removeChild(b); + } catch(e) { + e.stack = ""; + result = e; + } + return result; +} + +function showInspectorAndRunTest() +{ + if (window.testRunner) + testRunner.showWebInspector(); + runTest(); +} +</script> +<script> +function test() { + TestRunner.hideInspectorView(); + TestRunner.evaluateInPage('globals.length', loopOverGlobals.bind(this, 0)); + + function loopOverGlobals(current, total) { + function advance() { + var next = current + 1; + if (next == total.description) + ConsoleTestRunner.waitForRemoteObjectsConsoleMessages(onRemoteObjectsLoaded); + else + loopOverGlobals(next, total); + } + + function onRemoteObjectsLoaded() { + ConsoleTestRunner.dumpConsoleMessagesIgnoreErrorStackFrames(); + TestRunner.addResult('Expanded all messages'); + ConsoleTestRunner.expandConsoleMessages( + ConsoleTestRunner.expandConsoleMessagesErrorParameters.bind(this, finish), undefined, function(section) { + return section.element.firstChild.textContent !== '#text'; + }); + } + + function finish() { + ConsoleTestRunner.dumpConsoleMessagesIgnoreErrorStackFrames(); + TestRunner.completeTest(); + } + + TestRunner.evaluateInPage('log(' + current + ')'); + TestRunner.deprecatedRunAfterPendingDispatches(evalInConsole); + function evalInConsole() { + ConsoleTestRunner.evaluateInConsole('globals[' + current + ']'); + TestRunner.deprecatedRunAfterPendingDispatches(advance); + } + } +} +</script> +</head> +<body onload="onload()"> +<p>Tests console logging for messages that happen before DevTools is open.</p> +<div id="x"></div> +<p id="p"></p> +</body> +<svg id="svg-node"></svg> +<div style="display:none" class="c1 c2 c3"> + <form id="f"> + <select id="sel" name="sel"> + <option value="1">one</option> + <option value="2">two</option> + </select> + <input type="radio" name="x" value="x1" /> x1 + <input type="radio" name="x" value="x2" /> x2 + </form> +</div> +</body> +</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index f69b7d6ff..63df5bba 100644 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -25,14 +25,20 @@ method fetch method get method getIds -interface BackgroundFetchRegistration +interface BackgroundFetchRegistration : EventTarget attribute @@toStringTag + getter downloadTotal + getter downloaded getter icons getter id + getter onprogress getter title getter totalDownloadSize + getter uploadTotal + getter uploaded method abort method constructor + setter onprogress interface BackgroundFetchSettledFetch : BackgroundFetchFetch attribute @@toStringTag getter response
diff --git a/third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html b/third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html index d6a07c6..c9a83efc 100644 --- a/third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html +++ b/third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints-reject.html
@@ -72,8 +72,6 @@ capabilities => ({ zoom: capabilities.zoom.max + 1 }), capabilities => ({ zoom: capabilities.zoom.min - 1 }), capabilities => ({ torch: true }), - - capabilities => ({ nonSenseConstraint: 3.141592 }), ]; for (key in constraintGenerators) {
diff --git a/third_party/WebKit/LayoutTests/images/color-profile-background-image-space-expected.png b/third_party/WebKit/LayoutTests/images/color-profile-background-image-space-expected.png index c5d0b0f0..a811512 100644 --- a/third_party/WebKit/LayoutTests/images/color-profile-background-image-space-expected.png +++ b/third_party/WebKit/LayoutTests/images/color-profile-background-image-space-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint-expected.txt index ddb2533..855659a 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/video-mute-repaint-expected.txt
@@ -34,7 +34,7 @@ "bounds": [700, 525], "paintInvalidations": [ { - "object": "LayoutBlockFlow (positioned) DIV class='-internal-track-segment-highlight-after'", + "object": "LayoutBlockFlow (positioned) DIV", "rect": [580, 508, 70, 2], "reason": "disappeared" }, @@ -83,7 +83,7 @@ "reason": "full" }, { - "object": "LayoutBlockFlow (positioned) DIV class='-internal-track-segment-highlight-after'", + "object": "LayoutBlockFlow (positioned) DIV", "reason": "disappeared" } ]
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint-expected.txt index a8a8335e..0d90df2 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/video-unmute-repaint-expected.txt
@@ -49,7 +49,7 @@ "reason": "full" }, { - "object": "LayoutBlockFlow (positioned) DIV class='-internal-track-segment-highlight-after'", + "object": "LayoutBlockFlow (positioned) DIV", "rect": [580, 508, 35, 2], "reason": "appeared" }, @@ -83,7 +83,7 @@ "reason": "full" }, { - "object": "LayoutBlockFlow (positioned) DIV class='-internal-track-segment-highlight-after'", + "object": "LayoutBlockFlow (positioned) DIV", "reason": "appeared" } ]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/linux/http/tests/misc/slow-loading-image-in-pattern-expected.png index cabe47b..424b4db 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/linux/images/color-profile-svg-fill-text-expected.png index 5d8eaeae..c7e1f7b 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png index 9c73ba8..66498a7 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png index cabe47b..424b4db 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/images/color-profile-svg-fill-text-expected.png index 08343bfa..a773132 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png index 05ebe12..07a3c2c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/fast/block/basic/001-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/basic/001-expected.png similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/fast/block/basic/001-expected.png rename to third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/basic/001-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/float/intruding-painted-twice-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/float/intruding-painted-twice-expected.png new file mode 100644 index 0000000..e655f08 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/block/float/intruding-painted-twice-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/borders/inline-mask-overlay-image-outset-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/borders/inline-mask-overlay-image-outset-expected.png new file mode 100644 index 0000000..2fe6dd9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/borders/inline-mask-overlay-image-outset-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/012-expected.png new file mode 100644 index 0000000..aa0bb9a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/014-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/014-expected.png new file mode 100644 index 0000000..e60a978 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css-generated-content/014-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/clip-zooming-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/clip-zooming-expected.png new file mode 100644 index 0000000..4ca955c5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/clip-zooming-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/h1-in-section-elements-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/h1-in-section-elements-expected.png new file mode 100644 index 0000000..12a1c5e5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/h1-in-section-elements-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-calc-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-calc-dynamic-scaling-expected.png new file mode 100644 index 0000000..73d6433c --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-calc-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-dynamic-scaling-expected.png new file mode 100644 index 0000000..73d6433c --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/css/rem-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dom/HTMLMeterElement/meter-optimums-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dom/HTMLMeterElement/meter-optimums-expected.png new file mode 100644 index 0000000..edb4c57 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dom/HTMLMeterElement/meter-optimums-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dynamic/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dynamic/012-expected.png new file mode 100644 index 0000000..8c5ef4fd --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/dynamic/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/checkbox/checkbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/checkbox/checkbox-appearance-basic-expected.png new file mode 100644 index 0000000..8da23bd --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/checkbox/checkbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/radio/radio-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/radio/radio-appearance-basic-expected.png new file mode 100644 index 0000000..dfa3f4f --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/radio/radio-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/absolute-positioned-inline-in-centred-block-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/absolute-positioned-inline-in-centred-block-expected.png new file mode 100644 index 0000000..e5684878 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/absolute-positioned-inline-in-centred-block-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png new file mode 100644 index 0000000..ec3bb0e --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/lists/ordered-list-with-no-ol-tag-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/lists/ordered-list-with-no-ol-tag-expected.png new file mode 100644 index 0000000..16a7d46 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/lists/ordered-list-with-no-ol-tag-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/selectors/166-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/selectors/166-expected.png new file mode 100644 index 0000000..9509b15 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/selectors/166-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.png new file mode 100644 index 0000000..12fbaa8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.txt new file mode 100644 index 0000000..c93354f7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/html/details_summary/details-marker-style-expected.txt
@@ -0,0 +1,29 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x474 + LayoutBlockFlow {HTML} at (0,0) size 800x473.53 + LayoutBlockFlow {BODY} at (8,8) size 784x457.53 + LayoutBlockFlow {DIV} at (0,0) size 784x85.83 + LayoutBlockFlow {DETAILS} at (0,0) size 784x85.83 + LayoutBlockFlow {SUMMARY} at (0,0) size 784x85.83 + LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: right + LayoutText {#text} at (121,57) size 94x29 + text run at (121,57) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,85.83) size 117.83x182.77 + LayoutBlockFlow {DETAILS} at (0,0) size 117.83x182.77 + LayoutBlockFlow {SUMMARY} at (0,0) size 117.83x182.77 + LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: down + LayoutText {#text} at (89,89) size 29x94 + text run at (89,89) width 95: "Summary" + LayoutBlockFlow {DIV} at (0,268.59) size 784x46 + LayoutBlockFlow {DETAILS} at (0,0) size 784x46 + LayoutBlockFlow {SUMMARY} at (0,0) size 784x46 + LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: right + LayoutText {#text} at (73,18) size 94x28 + text run at (73,18) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,314.59) size 70x142.94 + LayoutBlockFlow {DETAILS} at (0,0) size 70x142.94 + LayoutBlockFlow {SUMMARY} at (0,0) size 70x142.94 + LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: down + LayoutText {#text} at (42,49) size 28x94 + text run at (42,49) width 94: "Summary"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/misc/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/media/video-zoom-controls-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/media/video-zoom-controls-expected.png new file mode 100644 index 0000000..d144fd2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/media/video-zoom-controls-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt new file mode 100644 index 0000000..81ae72b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt
@@ -0,0 +1,24 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "paintInvalidations": [ + { + "object": "LayoutBlockFlow INPUT", + "rect": [5, 7, 23, 22], + "reason": "subtree" + } + ] + } + ], + "objectPaintInvalidations": [ + { + "object": "LayoutBlockFlow INPUT", + "reason": "subtree" + } + ] +} +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt new file mode 100644 index 0000000..aec3da4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt
@@ -0,0 +1,24 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "paintInvalidations": [ + { + "object": "LayoutBlockFlow INPUT", + "rect": [5, 6, 23, 23], + "reason": "subtree" + } + ] + } + ], + "objectPaintInvalidations": [ + { + "object": "LayoutBlockFlow INPUT", + "reason": "subtree" + } + ] +} +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/markers/document-markers-zoom-150-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/markers/document-markers-zoom-150-expected.png new file mode 100644 index 0000000..49dba773 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/paint/markers/document-markers-zoom-150-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-02-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-02-b-expected.png new file mode 100644 index 0000000..35ba1dfe --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-02-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-03-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-03-b-expected.png new file mode 100644 index 0000000..5dce83562 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-03-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-04-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-04-b-expected.png new file mode 100644 index 0000000..264a5d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/script-handle-04-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/struct-use-05-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/struct-use-05-b-expected.png new file mode 100644 index 0000000..9dabc97 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/W3C-SVG-1.1/struct-use-05-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.png new file mode 100644 index 0000000..d7605218 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.txt new file mode 100644 index 0000000..a3a2b52 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/as-border-image/svg-as-border-image-2-expected.txt
@@ -0,0 +1,42 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x600 + LayoutBlockFlow {HTML} at (0,0) size 800x600 + LayoutBlockFlow {BODY} at (8,8) size 784x584 + LayoutBlockFlow {DIV} at (0,0) size 370x437.81 [border: (1px solid #000000)] + LayoutBlockFlow {H2} at (1,20.91) size 368x28 + LayoutText {#text} at (0,0) size 195x28 + text run at (0,0) width 195: "SVG border-image" + LayoutBlockFlow (anonymous) at (1,68.81) size 368x368 + LayoutBlockFlow {DIV} at (10,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,166) size 4x18 + text run at (180,166) width 4: " " + LayoutBlockFlow {DIV} at (194,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (364,166) size 4x18 + text run at (364,166) width 4: " " + LayoutBR {BR} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (10,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,350) size 4x18 + text run at (180,350) width 4: " " + LayoutBlockFlow {DIV} at (194,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (370,418) size 4x19 + text run at (370,418) width 4: " " + LayoutBlockFlow {DIV} at (374,0) size 370x437.81 [border: (1px solid #000000)] + LayoutBlockFlow {H2} at (1,20.91) size 368x28 + LayoutText {#text} at (0,0) size 196x28 + text run at (0,0) width 196: "PNG border-image" + LayoutBlockFlow (anonymous) at (1,68.81) size 368x368 + LayoutBlockFlow {DIV} at (10,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,166) size 4x18 + text run at (180,166) width 4: " " + LayoutBlockFlow {DIV} at (194,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (364,166) size 4x18 + text run at (364,166) width 4: " " + LayoutBR {BR} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (10,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,350) size 4x18 + text run at (180,350) width 4: " " + LayoutBlockFlow {DIV} at (194,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.png new file mode 100644 index 0000000..44a3a057 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.txt new file mode 100644 index 0000000..a96c4ca --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/batik/text/textLayout-expected.txt
@@ -0,0 +1,224 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 450x500 + LayoutSVGRoot {svg} at (0,0) size 450x500 + LayoutSVGHiddenContainer {defs} at (0,-14) size 45.31x18 + LayoutSVGText {text} at (0,-14) size 45.31x18 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (0,-14) size 45.31x18 + chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 6 width 45.32: "sample" + LayoutSVGContainer {g} at (40,36) size 367.97x421 + LayoutSVGText {text} at (150.38,36) size 149.23x17.16 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (150.38,36) size 149.23x17.16 + chunk 1 (middle anchor) text run 1 at (150.38,50.00) startOffset 0 endOffset 22 width 149.25: "Text Layout Properties" + LayoutSVGText {text} at (171.38,65) size 107.22x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (171.38,65) size 107.22x13 + chunk 1 (middle anchor) text run 1 at (171.39,75.00) startOffset 0 endOffset 26 width 107.23: "Explicit Glyph Positioning" + LayoutSVGContainer {g} at (40,88) size 110.64x39 + LayoutSVGText {text} at (40,88) size 110.64x28 contains 1 chunk(s) + LayoutSVGTSpan {tspan} at (40,88) size 110.64x28 + LayoutSVGInlineText {#text} at (40,88) size 110.64x28 + chunk 1 text run 1 at (40.00,110.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 1 at (60.00,110.00) startOffset 0 endOffset 1 width 10.65: "a" + chunk 1 text run 1 at (80.00,110.00) startOffset 0 endOffset 1 width 18.67: "m" + chunk 1 text run 1 at (105.00,110.00) startOffset 0 endOffset 1 width 12.00: "p" + chunk 1 text run 1 at (125.00,110.00) startOffset 0 endOffset 1 width 6.67: "l" + chunk 1 text run 1 at (140.00,110.00) startOffset 0 endOffset 1 width 10.65: "e" + LayoutSVGText {text} at (40,118) size 103.92x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,118) size 103.92x9 + chunk 1 text run 1 at (40.00,125.00) startOffset 0 endOffset 30 width 103.93: "tspan x=\"40,60,80,105,125,140\"" + LayoutSVGContainer {g} at (185,88) size 68.19x39 + LayoutSVGText {text} at (185,88) size 67.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,88) size 67.97x28 + chunk 1 text run 1 at (185.00,110.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (185,118) size 68.19x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,118) size 68.19x9 + chunk 1 text run 1 at (185.00,125.00) startOffset 0 endOffset 22 width 68.20: "Serif, default spacing" + LayoutSVGContainer {g} at (290,88) size 117.97x39 + LayoutSVGText {text} at (290,88) size 117.97x28 contains 1 chunk(s) + LayoutSVGTSpan {tspan} at (290,88) size 117.97x28 + LayoutSVGInlineText {#text} at (290,88) size 117.97x28 + chunk 1 text run 1 at (290.00,110.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (309.34,110.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (329.99,110.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (358.66,110.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (380.66,110.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (397.33,110.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (290,118) size 102.08x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,118) size 102.08x9 + chunk 1 text run 1 at (290.00,125.00) startOffset 0 endOffset 29 width 102.09: "x=\"175\" dx=\"0,10,10,10,10,10\"" + LayoutSVGText {text} at (102.80,140) size 244.38x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (102.80,140) size 244.38x13 + chunk 1 (middle anchor) text run 1 at (102.81,150.00) startOffset 0 endOffset 59 width 244.39: "Letter Spacing Adjustment and Explicit Length Specification" + LayoutSVGContainer {g} at (40,158) size 119.98x39 + LayoutSVGText {text} at (40,158) size 119.98x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,158) size 119.98x28 + chunk 1 text run 1 at (40.00,180.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (59.74,180.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (80.80,180.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (109.87,180.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (132.28,180.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (149.35,180.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (40,188) size 57.69x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,188) size 57.69x9 + chunk 1 text run 1 at (40.00,195.00) startOffset 0 endOffset 16 width 57.70: "textLength=\"120\"" + LayoutSVGContainer {g} at (185,158) size 69.98x39 + LayoutSVGText {text} at (185,158) size 69.98x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,158) size 69.98x28 + chunk 1 text run 1 at (185.00,180.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (194.74,180.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (205.80,180.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (224.87,180.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (237.28,180.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (244.35,180.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (185,188) size 53.69x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,188) size 53.69x9 + chunk 1 text run 1 at (185.00,195.00) startOffset 0 endOffset 15 width 53.70: "textLength=\"70\"" + LayoutSVGContainer {g} at (40,203) size 120x49 + LayoutSVGText {text} at (40,203) size 120x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,203) size 120x28 + chunk 1 text run 1 at (40.00,225.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (40,233) size 113.70x19 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,233) size 61.69x9 + chunk 1 text run 1 at (40.00,240.00) startOffset 0 endOffset 18 width 61.70: "textLength=\"120\", " + LayoutSVGTSpan {tspan} at (40,233) size 113.70x19 + LayoutSVGInlineText {#text} at (40,243) size 113.70x9 + chunk 1 text run 1 at (40.00,250.00) startOffset 0 endOffset 31 width 113.70: "lengthAdjust=\"spacingAndGlyphs\"" + LayoutSVGContainer {g} at (185,203) size 113.70x49 + LayoutSVGText {text} at (185,203) size 70x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,203) size 70x28 + chunk 1 text run 1 at (185.00,225.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (185,233) size 113.70x19 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,233) size 55.69x9 + chunk 1 text run 1 at (185.00,240.00) startOffset 0 endOffset 16 width 55.70: "textLength=\"70\" " + LayoutSVGTSpan {tspan} at (185,233) size 113.70x19 + LayoutSVGInlineText {#text} at (185,243) size 113.70x9 + chunk 1 text run 1 at (185.00,250.00) startOffset 0 endOffset 31 width 113.70: "lengthAdjust=\"spacingAndGlyphs\"" + LayoutSVGContainer {g} at (40,253) size 103.97x39 + LayoutSVGText {text} at (40,253) size 103.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,253) size 103.97x28 + chunk 1 text run 1 at (40.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (56.54,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (74.39,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (100.26,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (119.46,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (133.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (40,283) size 74.19x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,283) size 74.19x9 + chunk 1 text run 1 at (40.00,290.00) startOffset 0 endOffset 22 width 74.20: "letter-spacing=\"0.3em\"" + LayoutSVGContainer {g} at (185,253) size 61.08x39 + LayoutSVGText {text} at (185,253) size 52.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,253) size 52.97x28 + chunk 1 text run 1 at (185.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (191.34,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (198.99,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (214.66,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (223.66,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (227.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (185,283) size 61.08x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,283) size 61.08x9 + chunk 1 text run 1 at (185.00,290.00) startOffset 0 endOffset 19 width 61.09: "letter-spacing=\"-3\"" + LayoutSVGContainer {g} at (290,253) size 117.97x39 + LayoutSVGText {text} at (290,253) size 117.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,253) size 117.97x28 + chunk 1 text run 1 at (290.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (309.34,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (329.99,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (358.66,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (380.66,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (397.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (290,283) size 62.42x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,283) size 62.42x9 + chunk 1 text run 1 at (290.00,290.00) startOffset 0 endOffset 19 width 62.42: "letter-spacing=\"10\"" + LayoutSVGText {text} at (172.06,310) size 105.86x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (172.06,310) size 105.86x13 + chunk 1 (middle anchor) text run 1 at (172.07,320.00) startOffset 0 endOffset 23 width 105.85: "Word Spacing Adjustment" + LayoutSVGContainer {g} at (40,337) size 349.98x30 + LayoutSVGText {text} at (40,337) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,337) size 349.98x17 + chunk 1 text run 1 at (40.00,350.00) startOffset 0 endOffset 1 width 14.16: "W" + chunk 1 text run 2 at (54.41,350.00) startOffset 1 endOffset 2 width 4.17: "i" + chunk 1 text run 3 at (59.42,350.00) startOffset 2 endOffset 3 width 7.50: "d" + chunk 1 text run 4 at (67.76,350.00) startOffset 3 endOffset 4 width 6.66: "e" + chunk 1 text run 5 at (75.26,350.00) startOffset 4 endOffset 5 width 3.75: " " + chunk 1 text run 6 at (124.85,350.00) startOffset 5 endOffset 6 width 5.84: "s" + chunk 1 text run 7 at (131.53,350.00) startOffset 6 endOffset 7 width 6.66: "e" + chunk 1 text run 8 at (139.03,350.00) startOffset 7 endOffset 8 width 7.50: "p" + chunk 1 text run 9 at (147.37,350.00) startOffset 8 endOffset 9 width 6.66: "a" + chunk 1 text run 10 at (154.87,350.00) startOffset 9 endOffset 10 width 5.00: "r" + chunk 1 text run 11 at (160.71,350.00) startOffset 10 endOffset 11 width 6.66: "a" + chunk 1 text run 12 at (168.21,350.00) startOffset 11 endOffset 12 width 4.17: "t" + chunk 1 text run 13 at (173.22,350.00) startOffset 12 endOffset 13 width 4.17: "i" + chunk 1 text run 14 at (178.23,350.00) startOffset 13 endOffset 14 width 7.50: "o" + chunk 1 text run 15 at (186.57,350.00) startOffset 14 endOffset 15 width 7.50: "n" + chunk 1 text run 16 at (194.91,350.00) startOffset 15 endOffset 16 width 3.75: " " + chunk 1 text run 17 at (244.51,350.00) startOffset 16 endOffset 17 width 7.50: "b" + chunk 1 text run 18 at (252.85,350.00) startOffset 17 endOffset 18 width 6.66: "e" + chunk 1 text run 19 at (260.35,350.00) startOffset 18 endOffset 19 width 4.17: "t" + chunk 1 text run 20 at (265.36,350.00) startOffset 19 endOffset 20 width 10.83: "w" + chunk 1 text run 21 at (277.03,350.00) startOffset 20 endOffset 21 width 6.66: "e" + chunk 1 text run 22 at (284.53,350.00) startOffset 21 endOffset 22 width 6.66: "e" + chunk 1 text run 23 at (292.03,350.00) startOffset 22 endOffset 23 width 7.50: "n" + chunk 1 text run 24 at (300.37,350.00) startOffset 23 endOffset 24 width 3.75: " " + chunk 1 text run 25 at (349.97,350.00) startOffset 24 endOffset 25 width 10.83: "w" + chunk 1 text run 26 at (361.64,350.00) startOffset 25 endOffset 26 width 7.50: "o" + chunk 1 text run 27 at (369.98,350.00) startOffset 26 endOffset 27 width 5.00: "r" + chunk 1 text run 28 at (375.82,350.00) startOffset 27 endOffset 28 width 7.50: "d" + chunk 1 text run 29 at (384.16,350.00) startOffset 28 endOffset 29 width 5.84: "s" + LayoutSVGText {text} at (40,358) size 128.05x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,358) size 128.05x9 + chunk 1 text run 1 at (40.00,365.00) startOffset 0 endOffset 35 width 128.06: "textLength=\"350\" word-spacing=\"3em\"" + LayoutSVGContainer {g} at (40,382) size 349.98x30 + LayoutSVGText {text} at (40,382) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,382) size 349.98x17 + chunk 1 text run 1 at (40.00,395.00) startOffset 0 endOffset 1 width 10.83: "N" + chunk 1 text run 2 at (56.15,395.00) startOffset 1 endOffset 2 width 6.66: "a" + chunk 1 text run 3 at (68.13,395.00) startOffset 2 endOffset 3 width 5.00: "r" + chunk 1 text run 4 at (78.45,395.00) startOffset 3 endOffset 4 width 5.00: "r" + chunk 1 text run 5 at (88.77,395.00) startOffset 4 endOffset 5 width 7.50: "o" + chunk 1 text run 6 at (101.59,395.00) startOffset 5 endOffset 6 width 10.83: "w" + chunk 1 text run 7 at (117.74,395.00) startOffset 6 endOffset 7 width 3.75: " " + chunk 1 text run 8 at (121.82,395.00) startOffset 7 endOffset 8 width 5.84: "s" + chunk 1 text run 9 at (132.98,395.00) startOffset 8 endOffset 9 width 6.66: "e" + chunk 1 text run 10 at (144.96,395.00) startOffset 9 endOffset 10 width 7.50: "p" + chunk 1 text run 11 at (157.78,395.00) startOffset 10 endOffset 11 width 6.66: "a" + chunk 1 text run 12 at (169.76,395.00) startOffset 11 endOffset 12 width 5.00: "r" + chunk 1 text run 13 at (180.07,395.00) startOffset 12 endOffset 13 width 6.66: "a" + chunk 1 text run 14 at (192.05,395.00) startOffset 13 endOffset 14 width 4.17: "t" + chunk 1 text run 15 at (201.54,395.00) startOffset 14 endOffset 15 width 4.17: "i" + chunk 1 text run 16 at (211.03,395.00) startOffset 15 endOffset 16 width 7.50: "o" + chunk 1 text run 17 at (223.85,395.00) startOffset 16 endOffset 17 width 7.50: "n" + chunk 1 text run 18 at (236.68,395.00) startOffset 17 endOffset 18 width 3.75: " " + chunk 1 text run 19 at (240.75,395.00) startOffset 18 endOffset 19 width 7.50: "b" + chunk 1 text run 20 at (253.57,395.00) startOffset 19 endOffset 20 width 6.66: "e" + chunk 1 text run 21 at (265.55,395.00) startOffset 20 endOffset 21 width 4.17: "t" + chunk 1 text run 22 at (275.04,395.00) startOffset 21 endOffset 22 width 10.83: "w" + chunk 1 text run 23 at (291.19,395.00) startOffset 22 endOffset 23 width 6.66: "e" + chunk 1 text run 24 at (303.17,395.00) startOffset 23 endOffset 24 width 6.66: "e" + chunk 1 text run 25 at (315.15,395.00) startOffset 24 endOffset 25 width 7.50: "n" + chunk 1 text run 26 at (327.98,395.00) startOffset 25 endOffset 26 width 3.75: " " + chunk 1 text run 27 at (332.05,395.00) startOffset 26 endOffset 27 width 10.83: "w" + chunk 1 text run 28 at (348.20,395.00) startOffset 27 endOffset 28 width 7.50: "o" + chunk 1 text run 29 at (361.02,395.00) startOffset 28 endOffset 29 width 5.00: "r" + chunk 1 text run 30 at (371.34,395.00) startOffset 29 endOffset 30 width 7.50: "d" + chunk 1 text run 31 at (384.16,395.00) startOffset 30 endOffset 31 width 5.84: "s" + LayoutSVGText {text} at (40,403) size 120.94x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,403) size 120.94x9 + chunk 1 text run 1 at (40.00,410.00) startOffset 0 endOffset 34 width 120.95: "textLength=\"350\" word-spacing=\"-5\"" + LayoutSVGContainer {g} at (40,427) size 349.98x30 + LayoutSVGText {text} at (40,427) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,427) size 349.98x17 + chunk 1 text run 1 at (40.00,440.00) startOffset 0 endOffset 7 width 49.56: "Narrow " + chunk 1 text run 2 at (84.56,440.00) startOffset 7 endOffset 18 width 65.39: "separation " + chunk 1 text run 3 at (144.95,440.00) startOffset 18 endOffset 26 width 53.72: "between " + chunk 1 text run 4 at (193.68,440.00) startOffset 26 endOffset 31 width 36.67: "words" + LayoutSVGText {text} at (40,448) size 236.64x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,448) size 236.64x9 + chunk 1 text run 1 at (40.00,455.00) startOffset 0 endOffset 66 width 236.65: "textLength=\"350\" lengthAdjust=\"spacingAndGlyphs\" word-spacing=\"-5\"" + LayoutSVGContainer {use} at (1,1) size 446x496 + LayoutSVGContainer {g} at (1,1) size 446x496 + LayoutSVGRect {rect} at (1,1) size 446x496 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=446.00] [height=496.00] + LayoutSVGContainer {g} at (0.23,-0.02) size 26.48x27.69 [transform={m=((1.00,0.00)(0.00,1.00)) t=(418.00,467.00)}] + LayoutSVGViewportContainer {svg} at (-0.05,-0.35) size 539x563.74 + LayoutSVGPath {path} at (-0.05,41.47) size 246.37x345.82 [fill={[type=SOLID] [color=#6666FF]}] [data="M 172 44 C 137 60 31 135 11 199 c -8 27 22 48 44 33 C 14 306 -1 332 0 356 c 0 14 13 42 44 27 c 8 -4 35 -25 52 -41 c 14 -1 24 -11 42 -28 c 17 14 36 10 52 -7 c 22 2 82 -78 44 -108 c -3 -24 -30 -37 -53 -18 c -6 -2 -13 -1 -18 1 c 22 -35 43 -82 49 -105 C 219 47 188 36 172 44 Z"] + LayoutSVGPath {path} at (294,-0.35) size 244.95x298.02 [fill={[type=SOLID] [color=#FF0000]}] [data="M 400 0 c -18 3 -49 31 -49 31 c -29 23 -43 58 -28 95 c -13 14 -29 44 -29 67 c 0 28 20 52 50 29 c 7 8 21 16 37 5 c -5 29 3 48 26 49 c 1 10 13 31 36 17 c 16 -10 58 -39 79 -56 c 25 -23 25 -94 -18 -89 c 33 -59 -3 -96 -27 -84 c -10 4 -46 25 -52 30 c -1 -7 -5 -12 -11 -14 C 436 45 436 -5 401 0 Z"] + LayoutSVGPath {path} at (158.32,352.17) size 286.68x211.23 [fill={[type=SOLID] [color=#33CC33]}] [data="M 275 353 c -46 12 -88 43 -114 91 c -9 16 6 37 25 33 c -14 24 -40 67 -15 81 c 28 16 52 -8 60 -15 c 18 21 50 10 81 -17 c 41 14 68 -2 103 -53 c 8 -12 30 -43 30 -65 c 0 -16 -15 -30 -35 -21 c -1 -12 -9 -38 -53 -19 c -10 -6 -31 -5 -54 17 C 308 375 300 347 275 353 Z"]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/custom/focus-ring-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/custom/focus-ring-text-expected.png new file mode 100644 index 0000000..d9f0041 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/custom/focus-ring-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/text/text-path-middle-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/text/text-path-middle-align-expected.png new file mode 100644 index 0000000..70837802 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/text/text-path-middle-align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-clip-path-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-clip-path-expected.png new file mode 100644 index 0000000..71b782d --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-clip-path-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-expected.png new file mode 100644 index 0000000..5ebbdc03 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/svg/transforms/svg-css-transforms-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug2479-4-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug2479-4-expected.png new file mode 100644 index 0000000..6545916 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug2479-4-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-1-expected.png new file mode 100644 index 0000000..611822a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-2-expected.png new file mode 100644 index 0000000..27884584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug46480-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8032-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8032-1-expected.png new file mode 100644 index 0000000..3750390 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8032-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8858-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8858-expected.png new file mode 100644 index 0000000..4afce09 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/bugs/bug8858-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test3-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test3-expected.png new file mode 100644 index 0000000..13f0e52 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test3-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test6-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test6-expected.png new file mode 100644 index 0000000..cd51948a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/test6-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_thtd_rowspan-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_thtd_rowspan-expected.png new file mode 100644 index 0000000..f91a196 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_thtd_rowspan-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_tr_align-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_tr_align-expected.png new file mode 100644 index 0000000..62b36f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla/other/wa_table_tr_align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug1128-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug1128-expected.png new file mode 100644 index 0000000..fc3fd5b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug1128-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug91057-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug91057-expected.png new file mode 100644 index 0000000..2f496d96 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/tables/mozilla_expected_failures/bugs/bug91057-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/transforms/svg-vs-css-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/transforms/svg-vs-css-expected.png new file mode 100644 index 0000000..87c38ee --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/transforms/svg-vs-css-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/css3/masking/mask-repeat-space-padding-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/css3/masking/mask-repeat-space-padding-expected.png index eedee93..47ed2d1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/css3/masking/mask-repeat-space-padding-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/css3/masking/mask-repeat-space-padding-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/images/color-profile-svg-fill-text-expected.png index b2aeb5a..cde34596 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png index 1df1cd43..0f4a16b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/fast/block/basic/001-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/basic/001-expected.png similarity index 100% copy from third_party/WebKit/LayoutTests/platform/mac/virtual/layout_ng/fast/block/basic/001-expected.png copy to third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/basic/001-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/float/intruding-painted-twice-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/float/intruding-painted-twice-expected.png new file mode 100644 index 0000000..e655f08 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/float/intruding-painted-twice-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/margin-collapse/103-expected.png index 5a9bc9d..b7934c7 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/margin-collapse/103-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/block/margin-collapse/103-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/borders/inline-mask-overlay-image-outset-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/borders/inline-mask-overlay-image-outset-expected.png new file mode 100644 index 0000000..2fe6dd9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/borders/inline-mask-overlay-image-outset-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/012-expected.png new file mode 100644 index 0000000..aa0bb9a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/014-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/014-expected.png new file mode 100644 index 0000000..e60a978 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css-generated-content/014-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/clip-zooming-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/clip-zooming-expected.png new file mode 100644 index 0000000..4ca955c5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/clip-zooming-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/h1-in-section-elements-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/h1-in-section-elements-expected.png new file mode 100644 index 0000000..12a1c5e5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/h1-in-section-elements-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-calc-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-calc-dynamic-scaling-expected.png new file mode 100644 index 0000000..73d6433c --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-calc-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-dynamic-scaling-expected.png new file mode 100644 index 0000000..73d6433c --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/css/rem-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dom/HTMLMeterElement/meter-optimums-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dom/HTMLMeterElement/meter-optimums-expected.png new file mode 100644 index 0000000..edb4c57 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dom/HTMLMeterElement/meter-optimums-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dynamic/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dynamic/012-expected.png new file mode 100644 index 0000000..8c5ef4fd --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/dynamic/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/checkbox/checkbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/checkbox/checkbox-appearance-basic-expected.png index 48cda7e..766c25d 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/checkbox/checkbox-appearance-basic-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/checkbox/checkbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/file/file-input-disabled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/file/file-input-disabled-expected.png index 62e26db..84cc56a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/file/file-input-disabled-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/file/file-input-disabled-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/placeholder-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/placeholder-position-expected.png new file mode 100644 index 0000000..68da93f71 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/placeholder-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/radio/radio-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/radio/radio-appearance-basic-expected.png index a0322738..fb7a1e0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/radio/radio-appearance-basic-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/radio/radio-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/search/search-appearance-basic-expected.png new file mode 100644 index 0000000..acf9689 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/search/search-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/absolute-positioned-inline-in-centred-block-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/absolute-positioned-inline-in-centred-block-expected.png new file mode 100644 index 0000000..e5684878 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/absolute-positioned-inline-in-centred-block-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png new file mode 100644 index 0000000..ec3bb0e --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/lists/ordered-list-with-no-ol-tag-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/lists/ordered-list-with-no-ol-tag-expected.png new file mode 100644 index 0000000..16a7d46 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/lists/ordered-list-with-no-ol-tag-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/replaced/replaced-breaking-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/replaced/replaced-breaking-expected.png index c77156f1..a9b8f9b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/replaced/replaced-breaking-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/replaced/replaced-breaking-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/selectors/166-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/selectors/166-expected.png new file mode 100644 index 0000000..9509b15 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/selectors/166-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/text/textIteratorNilRenderer-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/text/textIteratorNilRenderer-expected.png index ebb20e19..1767344b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/text/textIteratorNilRenderer-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/text/textIteratorNilRenderer-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.png new file mode 100644 index 0000000..12fbaa8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.txt new file mode 100644 index 0000000..c93354f7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/html/details_summary/details-marker-style-expected.txt
@@ -0,0 +1,29 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x474 + LayoutBlockFlow {HTML} at (0,0) size 800x473.53 + LayoutBlockFlow {BODY} at (8,8) size 784x457.53 + LayoutBlockFlow {DIV} at (0,0) size 784x85.83 + LayoutBlockFlow {DETAILS} at (0,0) size 784x85.83 + LayoutBlockFlow {SUMMARY} at (0,0) size 784x85.83 + LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: right + LayoutText {#text} at (121,57) size 94x29 + text run at (121,57) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,85.83) size 117.83x182.77 + LayoutBlockFlow {DETAILS} at (0,0) size 117.83x182.77 + LayoutBlockFlow {SUMMARY} at (0,0) size 117.83x182.77 + LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: down + LayoutText {#text} at (89,89) size 29x94 + text run at (89,89) width 95: "Summary" + LayoutBlockFlow {DIV} at (0,268.59) size 784x46 + LayoutBlockFlow {DETAILS} at (0,0) size 784x46 + LayoutBlockFlow {SUMMARY} at (0,0) size 784x46 + LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: right + LayoutText {#text} at (73,18) size 94x28 + text run at (73,18) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,314.59) size 70x142.94 + LayoutBlockFlow {DETAILS} at (0,0) size 70x142.94 + LayoutBlockFlow {SUMMARY} at (0,0) size 70x142.94 + LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: down + LayoutText {#text} at (42,49) size 28x94 + text run at (42,49) width 94: "Summary"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/misc/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/media/video-zoom-controls-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/media/video-zoom-controls-expected.png new file mode 100644 index 0000000..d144fd2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/media/video-zoom-controls-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/paint/markers/document-markers-zoom-150-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/paint/markers/document-markers-zoom-150-expected.png new file mode 100644 index 0000000..49dba773 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/paint/markers/document-markers-zoom-150-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-02-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-02-b-expected.png new file mode 100644 index 0000000..35ba1dfe --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-02-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-03-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-03-b-expected.png new file mode 100644 index 0000000..5dce83562 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-03-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-04-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-04-b-expected.png new file mode 100644 index 0000000..264a5d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/script-handle-04-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/struct-use-05-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/struct-use-05-b-expected.png new file mode 100644 index 0000000..9dabc97 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/struct-use-05-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.png new file mode 100644 index 0000000..d7605218 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.txt new file mode 100644 index 0000000..a3a2b52 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/as-border-image/svg-as-border-image-2-expected.txt
@@ -0,0 +1,42 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x600 + LayoutBlockFlow {HTML} at (0,0) size 800x600 + LayoutBlockFlow {BODY} at (8,8) size 784x584 + LayoutBlockFlow {DIV} at (0,0) size 370x437.81 [border: (1px solid #000000)] + LayoutBlockFlow {H2} at (1,20.91) size 368x28 + LayoutText {#text} at (0,0) size 195x28 + text run at (0,0) width 195: "SVG border-image" + LayoutBlockFlow (anonymous) at (1,68.81) size 368x368 + LayoutBlockFlow {DIV} at (10,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,166) size 4x18 + text run at (180,166) width 4: " " + LayoutBlockFlow {DIV} at (194,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (364,166) size 4x18 + text run at (364,166) width 4: " " + LayoutBR {BR} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (10,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,350) size 4x18 + text run at (180,350) width 4: " " + LayoutBlockFlow {DIV} at (194,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (370,418) size 4x19 + text run at (370,418) width 4: " " + LayoutBlockFlow {DIV} at (374,0) size 370x437.81 [border: (1px solid #000000)] + LayoutBlockFlow {H2} at (1,20.91) size 368x28 + LayoutText {#text} at (0,0) size 196x28 + text run at (0,0) width 196: "PNG border-image" + LayoutBlockFlow (anonymous) at (1,68.81) size 368x368 + LayoutBlockFlow {DIV} at (10,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,166) size 4x18 + text run at (180,166) width 4: " " + LayoutBlockFlow {DIV} at (194,10) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (364,166) size 4x18 + text run at (364,166) width 4: " " + LayoutBR {BR} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (10,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (180,350) size 4x18 + text run at (180,350) width 4: " " + LayoutBlockFlow {DIV} at (194,194) size 160x160 [border: (30px solid #000000)] + LayoutText {#text} at (0,0) size 0x0 + LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.png new file mode 100644 index 0000000..44a3a057 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.txt new file mode 100644 index 0000000..a96c4ca --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/batik/text/textLayout-expected.txt
@@ -0,0 +1,224 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 450x500 + LayoutSVGRoot {svg} at (0,0) size 450x500 + LayoutSVGHiddenContainer {defs} at (0,-14) size 45.31x18 + LayoutSVGText {text} at (0,-14) size 45.31x18 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (0,-14) size 45.31x18 + chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 6 width 45.32: "sample" + LayoutSVGContainer {g} at (40,36) size 367.97x421 + LayoutSVGText {text} at (150.38,36) size 149.23x17.16 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (150.38,36) size 149.23x17.16 + chunk 1 (middle anchor) text run 1 at (150.38,50.00) startOffset 0 endOffset 22 width 149.25: "Text Layout Properties" + LayoutSVGText {text} at (171.38,65) size 107.22x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (171.38,65) size 107.22x13 + chunk 1 (middle anchor) text run 1 at (171.39,75.00) startOffset 0 endOffset 26 width 107.23: "Explicit Glyph Positioning" + LayoutSVGContainer {g} at (40,88) size 110.64x39 + LayoutSVGText {text} at (40,88) size 110.64x28 contains 1 chunk(s) + LayoutSVGTSpan {tspan} at (40,88) size 110.64x28 + LayoutSVGInlineText {#text} at (40,88) size 110.64x28 + chunk 1 text run 1 at (40.00,110.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 1 at (60.00,110.00) startOffset 0 endOffset 1 width 10.65: "a" + chunk 1 text run 1 at (80.00,110.00) startOffset 0 endOffset 1 width 18.67: "m" + chunk 1 text run 1 at (105.00,110.00) startOffset 0 endOffset 1 width 12.00: "p" + chunk 1 text run 1 at (125.00,110.00) startOffset 0 endOffset 1 width 6.67: "l" + chunk 1 text run 1 at (140.00,110.00) startOffset 0 endOffset 1 width 10.65: "e" + LayoutSVGText {text} at (40,118) size 103.92x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,118) size 103.92x9 + chunk 1 text run 1 at (40.00,125.00) startOffset 0 endOffset 30 width 103.93: "tspan x=\"40,60,80,105,125,140\"" + LayoutSVGContainer {g} at (185,88) size 68.19x39 + LayoutSVGText {text} at (185,88) size 67.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,88) size 67.97x28 + chunk 1 text run 1 at (185.00,110.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (185,118) size 68.19x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,118) size 68.19x9 + chunk 1 text run 1 at (185.00,125.00) startOffset 0 endOffset 22 width 68.20: "Serif, default spacing" + LayoutSVGContainer {g} at (290,88) size 117.97x39 + LayoutSVGText {text} at (290,88) size 117.97x28 contains 1 chunk(s) + LayoutSVGTSpan {tspan} at (290,88) size 117.97x28 + LayoutSVGInlineText {#text} at (290,88) size 117.97x28 + chunk 1 text run 1 at (290.00,110.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (309.34,110.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (329.99,110.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (358.66,110.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (380.66,110.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (397.33,110.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (290,118) size 102.08x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,118) size 102.08x9 + chunk 1 text run 1 at (290.00,125.00) startOffset 0 endOffset 29 width 102.09: "x=\"175\" dx=\"0,10,10,10,10,10\"" + LayoutSVGText {text} at (102.80,140) size 244.38x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (102.80,140) size 244.38x13 + chunk 1 (middle anchor) text run 1 at (102.81,150.00) startOffset 0 endOffset 59 width 244.39: "Letter Spacing Adjustment and Explicit Length Specification" + LayoutSVGContainer {g} at (40,158) size 119.98x39 + LayoutSVGText {text} at (40,158) size 119.98x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,158) size 119.98x28 + chunk 1 text run 1 at (40.00,180.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (59.74,180.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (80.80,180.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (109.87,180.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (132.28,180.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (149.35,180.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (40,188) size 57.69x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,188) size 57.69x9 + chunk 1 text run 1 at (40.00,195.00) startOffset 0 endOffset 16 width 57.70: "textLength=\"120\"" + LayoutSVGContainer {g} at (185,158) size 69.98x39 + LayoutSVGText {text} at (185,158) size 69.98x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,158) size 69.98x28 + chunk 1 text run 1 at (185.00,180.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (194.74,180.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (205.80,180.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (224.87,180.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (237.28,180.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (244.35,180.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (185,188) size 53.69x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,188) size 53.69x9 + chunk 1 text run 1 at (185.00,195.00) startOffset 0 endOffset 15 width 53.70: "textLength=\"70\"" + LayoutSVGContainer {g} at (40,203) size 120x49 + LayoutSVGText {text} at (40,203) size 120x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,203) size 120x28 + chunk 1 text run 1 at (40.00,225.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (40,233) size 113.70x19 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,233) size 61.69x9 + chunk 1 text run 1 at (40.00,240.00) startOffset 0 endOffset 18 width 61.70: "textLength=\"120\", " + LayoutSVGTSpan {tspan} at (40,233) size 113.70x19 + LayoutSVGInlineText {#text} at (40,243) size 113.70x9 + chunk 1 text run 1 at (40.00,250.00) startOffset 0 endOffset 31 width 113.70: "lengthAdjust=\"spacingAndGlyphs\"" + LayoutSVGContainer {g} at (185,203) size 113.70x49 + LayoutSVGText {text} at (185,203) size 70x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,203) size 70x28 + chunk 1 text run 1 at (185.00,225.00) startOffset 0 endOffset 6 width 67.98: "sample" + LayoutSVGText {text} at (185,233) size 113.70x19 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,233) size 55.69x9 + chunk 1 text run 1 at (185.00,240.00) startOffset 0 endOffset 16 width 55.70: "textLength=\"70\" " + LayoutSVGTSpan {tspan} at (185,233) size 113.70x19 + LayoutSVGInlineText {#text} at (185,243) size 113.70x9 + chunk 1 text run 1 at (185.00,250.00) startOffset 0 endOffset 31 width 113.70: "lengthAdjust=\"spacingAndGlyphs\"" + LayoutSVGContainer {g} at (40,253) size 103.97x39 + LayoutSVGText {text} at (40,253) size 103.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,253) size 103.97x28 + chunk 1 text run 1 at (40.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (56.54,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (74.39,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (100.26,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (119.46,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (133.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (40,283) size 74.19x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,283) size 74.19x9 + chunk 1 text run 1 at (40.00,290.00) startOffset 0 endOffset 22 width 74.20: "letter-spacing=\"0.3em\"" + LayoutSVGContainer {g} at (185,253) size 61.08x39 + LayoutSVGText {text} at (185,253) size 52.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,253) size 52.97x28 + chunk 1 text run 1 at (185.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (191.34,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (198.99,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (214.66,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (223.66,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (227.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (185,283) size 61.08x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (185,283) size 61.08x9 + chunk 1 text run 1 at (185.00,290.00) startOffset 0 endOffset 19 width 61.09: "letter-spacing=\"-3\"" + LayoutSVGContainer {g} at (290,253) size 117.97x39 + LayoutSVGText {text} at (290,253) size 117.97x28 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,253) size 117.97x28 + chunk 1 text run 1 at (290.00,275.00) startOffset 0 endOffset 1 width 9.34: "s" + chunk 1 text run 2 at (309.34,275.00) startOffset 1 endOffset 2 width 10.65: "a" + chunk 1 text run 3 at (329.99,275.00) startOffset 2 endOffset 3 width 18.67: "m" + chunk 1 text run 4 at (358.66,275.00) startOffset 3 endOffset 4 width 12.00: "p" + chunk 1 text run 5 at (380.66,275.00) startOffset 4 endOffset 5 width 6.67: "l" + chunk 1 text run 6 at (397.33,275.00) startOffset 5 endOffset 6 width 10.65: "e" + LayoutSVGText {text} at (290,283) size 62.42x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (290,283) size 62.42x9 + chunk 1 text run 1 at (290.00,290.00) startOffset 0 endOffset 19 width 62.42: "letter-spacing=\"10\"" + LayoutSVGText {text} at (172.06,310) size 105.86x13 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (172.06,310) size 105.86x13 + chunk 1 (middle anchor) text run 1 at (172.07,320.00) startOffset 0 endOffset 23 width 105.85: "Word Spacing Adjustment" + LayoutSVGContainer {g} at (40,337) size 349.98x30 + LayoutSVGText {text} at (40,337) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,337) size 349.98x17 + chunk 1 text run 1 at (40.00,350.00) startOffset 0 endOffset 1 width 14.16: "W" + chunk 1 text run 2 at (54.41,350.00) startOffset 1 endOffset 2 width 4.17: "i" + chunk 1 text run 3 at (59.42,350.00) startOffset 2 endOffset 3 width 7.50: "d" + chunk 1 text run 4 at (67.76,350.00) startOffset 3 endOffset 4 width 6.66: "e" + chunk 1 text run 5 at (75.26,350.00) startOffset 4 endOffset 5 width 3.75: " " + chunk 1 text run 6 at (124.85,350.00) startOffset 5 endOffset 6 width 5.84: "s" + chunk 1 text run 7 at (131.53,350.00) startOffset 6 endOffset 7 width 6.66: "e" + chunk 1 text run 8 at (139.03,350.00) startOffset 7 endOffset 8 width 7.50: "p" + chunk 1 text run 9 at (147.37,350.00) startOffset 8 endOffset 9 width 6.66: "a" + chunk 1 text run 10 at (154.87,350.00) startOffset 9 endOffset 10 width 5.00: "r" + chunk 1 text run 11 at (160.71,350.00) startOffset 10 endOffset 11 width 6.66: "a" + chunk 1 text run 12 at (168.21,350.00) startOffset 11 endOffset 12 width 4.17: "t" + chunk 1 text run 13 at (173.22,350.00) startOffset 12 endOffset 13 width 4.17: "i" + chunk 1 text run 14 at (178.23,350.00) startOffset 13 endOffset 14 width 7.50: "o" + chunk 1 text run 15 at (186.57,350.00) startOffset 14 endOffset 15 width 7.50: "n" + chunk 1 text run 16 at (194.91,350.00) startOffset 15 endOffset 16 width 3.75: " " + chunk 1 text run 17 at (244.51,350.00) startOffset 16 endOffset 17 width 7.50: "b" + chunk 1 text run 18 at (252.85,350.00) startOffset 17 endOffset 18 width 6.66: "e" + chunk 1 text run 19 at (260.35,350.00) startOffset 18 endOffset 19 width 4.17: "t" + chunk 1 text run 20 at (265.36,350.00) startOffset 19 endOffset 20 width 10.83: "w" + chunk 1 text run 21 at (277.03,350.00) startOffset 20 endOffset 21 width 6.66: "e" + chunk 1 text run 22 at (284.53,350.00) startOffset 21 endOffset 22 width 6.66: "e" + chunk 1 text run 23 at (292.03,350.00) startOffset 22 endOffset 23 width 7.50: "n" + chunk 1 text run 24 at (300.37,350.00) startOffset 23 endOffset 24 width 3.75: " " + chunk 1 text run 25 at (349.97,350.00) startOffset 24 endOffset 25 width 10.83: "w" + chunk 1 text run 26 at (361.64,350.00) startOffset 25 endOffset 26 width 7.50: "o" + chunk 1 text run 27 at (369.98,350.00) startOffset 26 endOffset 27 width 5.00: "r" + chunk 1 text run 28 at (375.82,350.00) startOffset 27 endOffset 28 width 7.50: "d" + chunk 1 text run 29 at (384.16,350.00) startOffset 28 endOffset 29 width 5.84: "s" + LayoutSVGText {text} at (40,358) size 128.05x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,358) size 128.05x9 + chunk 1 text run 1 at (40.00,365.00) startOffset 0 endOffset 35 width 128.06: "textLength=\"350\" word-spacing=\"3em\"" + LayoutSVGContainer {g} at (40,382) size 349.98x30 + LayoutSVGText {text} at (40,382) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,382) size 349.98x17 + chunk 1 text run 1 at (40.00,395.00) startOffset 0 endOffset 1 width 10.83: "N" + chunk 1 text run 2 at (56.15,395.00) startOffset 1 endOffset 2 width 6.66: "a" + chunk 1 text run 3 at (68.13,395.00) startOffset 2 endOffset 3 width 5.00: "r" + chunk 1 text run 4 at (78.45,395.00) startOffset 3 endOffset 4 width 5.00: "r" + chunk 1 text run 5 at (88.77,395.00) startOffset 4 endOffset 5 width 7.50: "o" + chunk 1 text run 6 at (101.59,395.00) startOffset 5 endOffset 6 width 10.83: "w" + chunk 1 text run 7 at (117.74,395.00) startOffset 6 endOffset 7 width 3.75: " " + chunk 1 text run 8 at (121.82,395.00) startOffset 7 endOffset 8 width 5.84: "s" + chunk 1 text run 9 at (132.98,395.00) startOffset 8 endOffset 9 width 6.66: "e" + chunk 1 text run 10 at (144.96,395.00) startOffset 9 endOffset 10 width 7.50: "p" + chunk 1 text run 11 at (157.78,395.00) startOffset 10 endOffset 11 width 6.66: "a" + chunk 1 text run 12 at (169.76,395.00) startOffset 11 endOffset 12 width 5.00: "r" + chunk 1 text run 13 at (180.07,395.00) startOffset 12 endOffset 13 width 6.66: "a" + chunk 1 text run 14 at (192.05,395.00) startOffset 13 endOffset 14 width 4.17: "t" + chunk 1 text run 15 at (201.54,395.00) startOffset 14 endOffset 15 width 4.17: "i" + chunk 1 text run 16 at (211.03,395.00) startOffset 15 endOffset 16 width 7.50: "o" + chunk 1 text run 17 at (223.85,395.00) startOffset 16 endOffset 17 width 7.50: "n" + chunk 1 text run 18 at (236.68,395.00) startOffset 17 endOffset 18 width 3.75: " " + chunk 1 text run 19 at (240.75,395.00) startOffset 18 endOffset 19 width 7.50: "b" + chunk 1 text run 20 at (253.57,395.00) startOffset 19 endOffset 20 width 6.66: "e" + chunk 1 text run 21 at (265.55,395.00) startOffset 20 endOffset 21 width 4.17: "t" + chunk 1 text run 22 at (275.04,395.00) startOffset 21 endOffset 22 width 10.83: "w" + chunk 1 text run 23 at (291.19,395.00) startOffset 22 endOffset 23 width 6.66: "e" + chunk 1 text run 24 at (303.17,395.00) startOffset 23 endOffset 24 width 6.66: "e" + chunk 1 text run 25 at (315.15,395.00) startOffset 24 endOffset 25 width 7.50: "n" + chunk 1 text run 26 at (327.98,395.00) startOffset 25 endOffset 26 width 3.75: " " + chunk 1 text run 27 at (332.05,395.00) startOffset 26 endOffset 27 width 10.83: "w" + chunk 1 text run 28 at (348.20,395.00) startOffset 27 endOffset 28 width 7.50: "o" + chunk 1 text run 29 at (361.02,395.00) startOffset 28 endOffset 29 width 5.00: "r" + chunk 1 text run 30 at (371.34,395.00) startOffset 29 endOffset 30 width 7.50: "d" + chunk 1 text run 31 at (384.16,395.00) startOffset 30 endOffset 31 width 5.84: "s" + LayoutSVGText {text} at (40,403) size 120.94x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,403) size 120.94x9 + chunk 1 text run 1 at (40.00,410.00) startOffset 0 endOffset 34 width 120.95: "textLength=\"350\" word-spacing=\"-5\"" + LayoutSVGContainer {g} at (40,427) size 349.98x30 + LayoutSVGText {text} at (40,427) size 349.98x17 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,427) size 349.98x17 + chunk 1 text run 1 at (40.00,440.00) startOffset 0 endOffset 7 width 49.56: "Narrow " + chunk 1 text run 2 at (84.56,440.00) startOffset 7 endOffset 18 width 65.39: "separation " + chunk 1 text run 3 at (144.95,440.00) startOffset 18 endOffset 26 width 53.72: "between " + chunk 1 text run 4 at (193.68,440.00) startOffset 26 endOffset 31 width 36.67: "words" + LayoutSVGText {text} at (40,448) size 236.64x9 contains 1 chunk(s) + LayoutSVGInlineText {#text} at (40,448) size 236.64x9 + chunk 1 text run 1 at (40.00,455.00) startOffset 0 endOffset 66 width 236.65: "textLength=\"350\" lengthAdjust=\"spacingAndGlyphs\" word-spacing=\"-5\"" + LayoutSVGContainer {use} at (1,1) size 446x496 + LayoutSVGContainer {g} at (1,1) size 446x496 + LayoutSVGRect {rect} at (1,1) size 446x496 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=446.00] [height=496.00] + LayoutSVGContainer {g} at (0.23,-0.02) size 26.48x27.69 [transform={m=((1.00,0.00)(0.00,1.00)) t=(418.00,467.00)}] + LayoutSVGViewportContainer {svg} at (-0.05,-0.35) size 539x563.74 + LayoutSVGPath {path} at (-0.05,41.47) size 246.37x345.82 [fill={[type=SOLID] [color=#6666FF]}] [data="M 172 44 C 137 60 31 135 11 199 c -8 27 22 48 44 33 C 14 306 -1 332 0 356 c 0 14 13 42 44 27 c 8 -4 35 -25 52 -41 c 14 -1 24 -11 42 -28 c 17 14 36 10 52 -7 c 22 2 82 -78 44 -108 c -3 -24 -30 -37 -53 -18 c -6 -2 -13 -1 -18 1 c 22 -35 43 -82 49 -105 C 219 47 188 36 172 44 Z"] + LayoutSVGPath {path} at (294,-0.35) size 244.95x298.02 [fill={[type=SOLID] [color=#FF0000]}] [data="M 400 0 c -18 3 -49 31 -49 31 c -29 23 -43 58 -28 95 c -13 14 -29 44 -29 67 c 0 28 20 52 50 29 c 7 8 21 16 37 5 c -5 29 3 48 26 49 c 1 10 13 31 36 17 c 16 -10 58 -39 79 -56 c 25 -23 25 -94 -18 -89 c 33 -59 -3 -96 -27 -84 c -10 4 -46 25 -52 30 c -1 -7 -5 -12 -11 -14 C 436 45 436 -5 401 0 Z"] + LayoutSVGPath {path} at (158.32,352.17) size 286.68x211.23 [fill={[type=SOLID] [color=#33CC33]}] [data="M 275 353 c -46 12 -88 43 -114 91 c -9 16 6 37 25 33 c -14 24 -40 67 -15 81 c 28 16 52 -8 60 -15 c 18 21 50 10 81 -17 c 41 14 68 -2 103 -53 c 8 -12 30 -43 30 -65 c 0 -16 -15 -30 -35 -21 c -1 -12 -9 -38 -53 -19 c -10 -6 -31 -5 -54 17 C 308 375 300 347 275 353 Z"]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/custom/focus-ring-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/custom/focus-ring-text-expected.png new file mode 100644 index 0000000..d9f0041 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/custom/focus-ring-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/text/text-path-middle-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/text/text-path-middle-align-expected.png new file mode 100644 index 0000000..70837802 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/text/text-path-middle-align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-clip-path-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-clip-path-expected.png new file mode 100644 index 0000000..71b782d --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-clip-path-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-expected.png new file mode 100644 index 0000000..5ebbdc03 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/transforms/svg-css-transforms-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug1318-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug1318-expected.png index 48a9bda..1e714aea 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug1318-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug1318-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug2479-4-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug2479-4-expected.png new file mode 100644 index 0000000..6545916 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug2479-4-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-1-expected.png new file mode 100644 index 0000000..611822a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-2-expected.png new file mode 100644 index 0000000..27884584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug46480-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8032-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8032-1-expected.png new file mode 100644 index 0000000..3750390 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8032-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8858-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8858-expected.png new file mode 100644 index 0000000..4afce09 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/bugs/bug8858-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test3-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test3-expected.png new file mode 100644 index 0000000..13f0e52 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test3-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test6-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test6-expected.png new file mode 100644 index 0000000..cd51948a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/test6-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_thtd_rowspan-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_thtd_rowspan-expected.png new file mode 100644 index 0000000..f91a196 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_thtd_rowspan-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_tr_align-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_tr_align-expected.png new file mode 100644 index 0000000..62b36f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla/other/wa_table_tr_align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug1128-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug1128-expected.png new file mode 100644 index 0000000..fc3fd5b --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug1128-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug91057-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug91057-expected.png new file mode 100644 index 0000000..2f496d96 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/tables/mozilla_expected_failures/bugs/bug91057-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/transforms/svg-vs-css-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/transforms/svg-vs-css-expected.png new file mode 100644 index 0000000..87c38ee --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/transforms/svg-vs-css-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png new file mode 100644 index 0000000..e2836b18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png new file mode 100644 index 0000000..05a1584 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png index 33476fa1..9bf5b711 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counter-04-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counter-04-b-expected.png index 42fa7f1e..f8f3f5b3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counter-04-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counter-04-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counters-04-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counters-04-b-expected.png index 2427fbb..8213b33 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counters-04-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t1202-counters-04-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/masking/mask-repeat-space-padding-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/masking/mask-repeat-space-padding-expected.png index 636b74b..eb90563 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/css3/masking/mask-repeat-space-padding-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/css3/masking/mask-repeat-space-padding-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/background-repeat-with-background-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/background-repeat-with-background-color-expected.png index 6f502775..4dba2a8b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/background-repeat-with-background-color-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/background-repeat-with-background-color-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/basic/001-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/basic/001-expected.png index b9409a0..a2a49ae 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/basic/001-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/basic/001-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/intruding-painted-twice-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/intruding-painted-twice-expected.png index e655f08..c891f89 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/intruding-painted-twice-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/intruding-painted-twice-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png index 2fe6dd9..ac1bb8f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/012-expected.png index aa0bb9a..1c6fa60 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/012-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/014-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/014-expected.png index e60a978..ee74cdf 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/014-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css-generated-content/014-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/acid2-pixel-expected.png index e2836b18..8122dd6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/acid2-pixel-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/clip-zooming-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/clip-zooming-expected.png index 4ca955c5..bc342cc 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/clip-zooming-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/clip-zooming-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/h1-in-section-elements-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/h1-in-section-elements-expected.png index 12a1c5e5..bd8fbb5 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/h1-in-section-elements-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/h1-in-section-elements-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-calc-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-calc-dynamic-scaling-expected.png index 73d6433c..dc4d98b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-calc-dynamic-scaling-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-calc-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-dynamic-scaling-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-dynamic-scaling-expected.png index 73d6433c..dc4d98b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-dynamic-scaling-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/rem-dynamic-scaling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-optimums-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-optimums-expected.png index edb4c57..9003d82 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-optimums-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-optimums-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/012-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/012-expected.png index 8c5ef4fd..2109e468 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/012-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/012-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/checkbox/checkbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/checkbox/checkbox-appearance-basic-expected.png index 8da23bd..f94dd60 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/checkbox/checkbox-appearance-basic-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/checkbox/checkbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png index fb08703..865dfd16 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt index 5076100..7f675de 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt
@@ -18,7 +18,7 @@ LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1] LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)] LayoutInline {FONT} at (0,0) size 51x28 - LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -42,7 +42,7 @@ LayoutTableRow {TR} at (0,2) size 169x24 LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1] LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)] - LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -64,7 +64,7 @@ LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1] LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)] LayoutInline {FONT} at (0,0) size 51x13 - LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (2,2) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -89,12 +89,12 @@ LayoutTableCell {TD} at (2,2) size 77x25 [r=0 c=0 rs=1 cs=1] LayoutBlockFlow {DIV} at (1,1) size 75x23 [border: (2px solid #0000FF)] LayoutTextControl {INPUT} at (2,2) size 71x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)] - LayoutTableCell {TD} at (81,2) size 39x64.75 [r=0 c=1 rs=1 cs=1] - LayoutBlockFlow {DIV} at (1,1) size 37x62.75 [border: (2px solid #0000FF)] + LayoutTableCell {TD} at (81,2) size 39x65 [r=0 c=1 rs=1 cs=1] + LayoutBlockFlow {DIV} at (1,1) size 37x63 [border: (2px solid #0000FF)] LayoutTableCell {TD} at (122,2) size 242x24 [r=0 c=2 rs=1 cs=1] LayoutBlockFlow {DIV} at (1,1) size 240x22 [border: (2px solid #0000FF)] LayoutFileUploadControl {INPUT} at (2,2) size 236x18 "No file chosen" - LayoutButton {INPUT} at (0,0) size 76.61x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (0,0) size 76.61x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 60.61x13 LayoutText {#text} at (0,0) size 61x13 text run at (0,0) width 61: "Choose File" @@ -107,7 +107,7 @@ LayoutInline {FONT} at (0,0) size 206x28 LayoutText {#text} at (0,0) size 42x28 text run at (0,0) width 42: "text " - LayoutButton {INPUT} at (41.98,9) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (41.98,9) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -127,7 +127,7 @@ LayoutBlockFlow {DIV} at (0,393.06) size 784x19 LayoutText {#text} at (0,0) size 28x18 text run at (0,0) width 28: "text " - LayoutButton {INPUT} at (27.98,1) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (27.98,1) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -148,7 +148,7 @@ LayoutInline {FONT} at (0,0) size 171x13 LayoutText {#text} at (0,4) size 18x13 text run at (0,4) width 18: "text " - LayoutButton {INPUT} at (17.48,1) size 50.09x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (17.48,1) size 50.09x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 34.09x13 LayoutText {#text} at (0,0) size 35x13 text run at (0,0) width 35: "button" @@ -172,7 +172,7 @@ LayoutText {#text} at (98,18) size 5x18 text run at (98,18) width 5: " " LayoutFileUploadControl {INPUT} at (102.98,19) size 236x18 "No file chosen" - LayoutButton {INPUT} at (0,0) size 76.61x18 [bgcolor=#FFFFFF] + LayoutButton {INPUT} at (0,0) size 76.61x18 [bgcolor=#C0C0C0] LayoutBlockFlow (anonymous) at (8,2) size 60.61x13 LayoutText {#text} at (0,0) size 61x13 text run at (0,0) width 61: "Choose File" @@ -244,8 +244,8 @@ LayoutBlockFlow {DIV} at (3,3) size 65x13 LayoutText {#text} at (0,0) size 46x13 text run at (0,0) width 46: "text field" -layer at (92,241) size 32x59 clip at (93,242) size 19x57 scrollHeight 71 - LayoutListBox {SELECT} at (2,2) size 32.23x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] +layer at (92,242) size 32x59 clip at (93,243) size 19x56 scrollHeight 71 + LayoutListBox {SELECT} at (2,2.25) size 32.23x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 19.23x14.19 LayoutText {#text} at (2,0) size 16x13 text run at (2,0) width 16: "list"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/radio/radio-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/radio/radio-appearance-basic-expected.png index dfa3f4f..cc19a4a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/radio/radio-appearance-basic-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/radio/radio-appearance-basic-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/inline/absolute-positioned-inline-in-centred-block-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/inline/absolute-positioned-inline-in-centred-block-expected.png index e5684878..7306d228 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/inline/absolute-positioned-inline-in-centred-block-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/inline/absolute-positioned-inline-in-centred-block-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png index ec3bb0e..8740f2e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/ordered-list-with-no-ol-tag-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/ordered-list-with-no-ol-tag-expected.png index 16a7d46..272e183 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/ordered-list-with-no-ol-tag-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/ordered-list-with-no-ol-tag-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/166-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/166-expected.png index 9509b15..23fb09e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/166-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/166-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/color-emoji-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/color-emoji-expected.png index e91bbd69..7ec71e5f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/color-emoji-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/color-emoji-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/emoticons-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/emoticons-expected.png index 564ff19f..a7c44c3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/emoticons-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/emoticons-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/fallback-traits-fixup-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/fallback-traits-fixup-expected.png index 932cac0..05f687b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/fallback-traits-fixup-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/fallback-traits-fixup-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/unicode-fallback-font-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/unicode-fallback-font-expected.png index 8b89f37b..84f1b70 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/unicode-fallback-font-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/unicode-fallback-font-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.png index 12fbaa8..1d3037c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.txt index c93354f7..e65c8eb 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/html/details_summary/details-marker-style-expected.txt
@@ -1,27 +1,27 @@ layer at (0,0) size 800x600 LayoutView at (0,0) size 800x600 layer at (0,0) size 800x474 - LayoutBlockFlow {HTML} at (0,0) size 800x473.53 - LayoutBlockFlow {BODY} at (8,8) size 784x457.53 - LayoutBlockFlow {DIV} at (0,0) size 784x85.83 - LayoutBlockFlow {DETAILS} at (0,0) size 784x85.83 - LayoutBlockFlow {SUMMARY} at (0,0) size 784x85.83 + LayoutBlockFlow {HTML} at (0,0) size 800x473.70 + LayoutBlockFlow {BODY} at (8,8) size 784x457.70 + LayoutBlockFlow {DIV} at (0,0) size 784x86 + LayoutBlockFlow {DETAILS} at (0,0) size 784x86 + LayoutBlockFlow {SUMMARY} at (0,0) size 784x86 LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: right - LayoutText {#text} at (121,57) size 94x29 - text run at (121,57) width 94: "Summary" - LayoutBlockFlow {DIV} at (0,85.83) size 117.83x182.77 - LayoutBlockFlow {DETAILS} at (0,0) size 117.83x182.77 - LayoutBlockFlow {SUMMARY} at (0,0) size 117.83x182.77 + LayoutText {#text} at (121,58) size 94x28 + text run at (121,58) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,86) size 118x182.77 + LayoutBlockFlow {DETAILS} at (0,0) size 118x182.77 + LayoutBlockFlow {SUMMARY} at (0,0) size 118x182.77 LayoutDetailsMarker {DIV} at (0,0) size 111.83x79.83 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: down - LayoutText {#text} at (89,89) size 29x94 - text run at (89,89) width 95: "Summary" - LayoutBlockFlow {DIV} at (0,268.59) size 784x46 + LayoutText {#text} at (90,89) size 28x94 + text run at (90,89) width 94: "Summary" + LayoutBlockFlow {DIV} at (0,268.77) size 784x46 LayoutBlockFlow {DETAILS} at (0,0) size 784x46 LayoutBlockFlow {SUMMARY} at (0,0) size 784x46 LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: right LayoutText {#text} at (73,18) size 94x28 text run at (73,18) width 94: "Summary" - LayoutBlockFlow {DIV} at (0,314.59) size 70x142.94 + LayoutBlockFlow {DIV} at (0,314.77) size 70x142.94 LayoutBlockFlow {DETAILS} at (0,0) size 70x142.94 LayoutBlockFlow {SUMMARY} at (0,0) size 70x142.94 LayoutDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: down
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.png index e2836b18..8122dd6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/slow-loading-image-in-pattern-expected.png index 5c897cc..d8181498 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-svg-fill-text-expected.png index 5773e7e..75c356c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/mac/images/cross-fade-background-size-expected.png index 3359ed2..13c9b2e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.png index d144fd2..b219c0e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt index 81ae72b..55c21ae4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/checkbox-focus-by-mouse-then-keydown-expected.txt
@@ -4,7 +4,7 @@ "name": "LayoutView #document", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", + "drawsContent": true, "paintInvalidations": [ { "object": "LayoutBlockFlow INPUT",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt index aec3da4..d41908a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/forms/radio-focus-by-mouse-then-keydown-expected.txt
@@ -4,7 +4,7 @@ "name": "LayoutView #document", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", + "drawsContent": true, "paintInvalidations": [ { "object": "LayoutBlockFlow INPUT",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/markers/document-markers-zoom-150-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/markers/document-markers-zoom-150-expected.png index 49dba773..77e3dd99 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/markers/document-markers-zoom-150-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/markers/document-markers-zoom-150-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/scrollbars/custom-scrollbar-with-incomplete-style-expected.png index 05a1584..0b35586b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/scrollbars/custom-scrollbar-with-incomplete-style-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-02-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-02-b-expected.png index 35ba1dfe..6b1dae7 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-02-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-02-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-03-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-03-b-expected.png index 5dce83562..5cc09eff 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-03-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-03-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-04-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-04-b-expected.png index 264a5d2..f7e8225 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-04-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/script-handle-04-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-use-05-b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-use-05-b-expected.png index 9dabc97..c6d85f2 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-use-05-b-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-use-05-b-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-fonts-01-t-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-fonts-01-t-expected.png index ef86140..43b27b0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-fonts-01-t-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-fonts-01-t-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.png index d7605218..351ec07 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.txt index a3a2b52..290e3de 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/as-border-image/svg-as-border-image-2-expected.txt
@@ -20,7 +20,7 @@ text run at (180,350) width 4: " " LayoutBlockFlow {DIV} at (194,194) size 160x160 [border: (30px solid #000000)] LayoutText {#text} at (0,0) size 0x0 - LayoutText {#text} at (370,418) size 4x19 + LayoutText {#text} at (370,418) size 4x18 text run at (370,418) width 4: " " LayoutBlockFlow {DIV} at (374,0) size 370x437.81 [border: (1px solid #000000)] LayoutBlockFlow {H2} at (1,20.91) size 368x28
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.png index 44a3a057..36a636f4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt index a96c4ca..e4bce52 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt
@@ -217,8 +217,8 @@ LayoutSVGContainer {use} at (1,1) size 446x496 LayoutSVGContainer {g} at (1,1) size 446x496 LayoutSVGRect {rect} at (1,1) size 446x496 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=446.00] [height=496.00] - LayoutSVGContainer {g} at (0.23,-0.02) size 26.48x27.69 [transform={m=((1.00,0.00)(0.00,1.00)) t=(418.00,467.00)}] - LayoutSVGViewportContainer {svg} at (-0.05,-0.35) size 539x563.74 - LayoutSVGPath {path} at (-0.05,41.47) size 246.37x345.82 [fill={[type=SOLID] [color=#6666FF]}] [data="M 172 44 C 137 60 31 135 11 199 c -8 27 22 48 44 33 C 14 306 -1 332 0 356 c 0 14 13 42 44 27 c 8 -4 35 -25 52 -41 c 14 -1 24 -11 42 -28 c 17 14 36 10 52 -7 c 22 2 82 -78 44 -108 c -3 -24 -30 -37 -53 -18 c -6 -2 -13 -1 -18 1 c 22 -35 43 -82 49 -105 C 219 47 188 36 172 44 Z"] - LayoutSVGPath {path} at (294,-0.35) size 244.95x298.02 [fill={[type=SOLID] [color=#FF0000]}] [data="M 400 0 c -18 3 -49 31 -49 31 c -29 23 -43 58 -28 95 c -13 14 -29 44 -29 67 c 0 28 20 52 50 29 c 7 8 21 16 37 5 c -5 29 3 48 26 49 c 1 10 13 31 36 17 c 16 -10 58 -39 79 -56 c 25 -23 25 -94 -18 -89 c 33 -59 -3 -96 -27 -84 c -10 4 -46 25 -52 30 c -1 -7 -5 -12 -11 -14 C 436 45 436 -5 401 0 Z"] - LayoutSVGPath {path} at (158.32,352.17) size 286.68x211.23 [fill={[type=SOLID] [color=#33CC33]}] [data="M 275 353 c -46 12 -88 43 -114 91 c -9 16 6 37 25 33 c -14 24 -40 67 -15 81 c 28 16 52 -8 60 -15 c 18 21 50 10 81 -17 c 41 14 68 -2 103 -53 c 8 -12 30 -43 30 -65 c 0 -16 -15 -30 -35 -21 c -1 -12 -9 -38 -53 -19 c -10 -6 -31 -5 -54 17 C 308 375 300 347 275 353 Z"] + LayoutSVGContainer {g} at (0.19,-0.25) size 26.92x28.44 [transform={m=((1.00,0.00)(0.00,1.00)) t=(418.00,467.00)}] + LayoutSVGViewportContainer {svg} at (-1,-5) size 548x579 + LayoutSVGPath {path} at (-1,36) size 273x362 [fill={[type=SOLID] [color=#6666FF]}] [data="M 172 44 C 137 60 31 135 11 199 c -8 27 22 48 44 33 C 14 306 -1 332 0 356 c 0 14 13 42 44 27 c 8 -4 35 -25 52 -41 c 14 -1 24 -11 42 -28 c 17 14 36 10 52 -7 c 22 2 82 -78 44 -108 c -3 -24 -30 -37 -53 -18 c -6 -2 -13 -1 -18 1 c 22 -35 43 -82 49 -105 C 219 47 188 36 172 44 Z"] + LayoutSVGPath {path} at (294,-5) size 253x312 [fill={[type=SOLID] [color=#FF0000]}] [data="M 400 0 c -18 3 -49 31 -49 31 c -29 23 -43 58 -28 95 c -13 14 -29 44 -29 67 c 0 28 20 52 50 29 c 7 8 21 16 37 5 c -5 29 3 48 26 49 c 1 10 13 31 36 17 c 16 -10 58 -39 79 -56 c 25 -23 25 -94 -18 -89 c 33 -59 -3 -96 -27 -84 c -10 4 -46 25 -52 30 c -1 -7 -5 -12 -11 -14 C 436 45 436 -5 401 0 Z"] + LayoutSVGPath {path} at (146,347) size 299x227 [fill={[type=SOLID] [color=#33CC33]}] [data="M 275 353 c -46 12 -88 43 -114 91 c -9 16 6 37 25 33 c -14 24 -40 67 -15 81 c 28 16 52 -8 60 -15 c 18 21 50 10 81 -17 c 41 14 68 -2 103 -53 c 8 -12 30 -43 30 -65 c 0 -16 -15 -30 -35 -21 c -1 -12 -9 -38 -53 -19 c -10 -6 -31 -5 -54 17 C 308 375 300 347 275 353 Z"]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/focus-ring-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/focus-ring-text-expected.png index d9f0041..b3adb7f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/focus-ring-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/focus-ring-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/text/surrogate-pair-queries-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/text/surrogate-pair-queries-expected.png index b5d7024..97fb4ab 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/text/surrogate-pair-queries-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/text/surrogate-pair-queries-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/text/text-path-middle-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/text/text-path-middle-align-expected.png index 70837802..9f6de63 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/text/text-path-middle-align-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/text/text-path-middle-align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-clip-path-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-clip-path-expected.png index 71b782d..26b547e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-clip-path-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-clip-path-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-expected.png index 5ebbdc03..28ce2f8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/transforms/svg-css-transforms-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png index 16fb165..5cb693c4e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png index b32c451..bd9850f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.png index 6545916..d864ef3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-1-expected.png index 611822a..a0227a1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-1-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-2-expected.png index 27884584..78745b4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-2-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46480-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8032-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8032-1-expected.png index 3750390..30ca33f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8032-1-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8032-1-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8858-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8858-expected.png index 4afce09..9adc2002 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8858-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug8858-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test3-expected.png index 13f0e52..b718b59 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test3-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test3-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test6-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test6-expected.png index cd51948a..13ba63f0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test6-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/test6-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_thtd_rowspan-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_thtd_rowspan-expected.png index f91a196..5566ddb 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_thtd_rowspan-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_thtd_rowspan-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_tr_align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_tr_align-expected.png index 62b36f6..7436324 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_tr_align-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/wa_table_tr_align-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1128-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1128-expected.png index fc3fd5b..c02d9469 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1128-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1128-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png index f7c5686..56a120a4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug91057-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug91057-expected.png index 2f496d96..cd374613 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug91057-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug91057-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/transforms/svg-vs-css-expected.png b/third_party/WebKit/LayoutTests/platform/mac/transforms/svg-vs-css-expected.png index 87c38ee..5f82658 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/transforms/svg-vs-css-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/transforms/svg-vs-css-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png deleted file mode 100644 index 7b65507..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png index 8cde405..41f9297 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/cross-fade-background-size-expected.png index 73cbaf7a..f268586 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/exotic-color-space/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png index e138bc81..94f1612 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png index e2836b18..8122dd6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/acid2-pixel-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png index 5c897cc..d8181498 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png index 05a1584..0b35586b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png index 05a1584..0b35586b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/rootlayerscrolls/scrollbars/custom-scrollbar-with-incomplete-style-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png index c7ae74a..22d7cca 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt index 7689d2bc..1f9542d 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3971,6 +3971,12 @@ method constructor method setPeriodicWave setter type +interface OverconstrainedError + attribute @@toStringTag + getter constraint + getter message + getter name + method constructor interface PageTransitionEvent : Event attribute @@toStringTag getter persisted
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/masking/mask-repeat-space-padding-expected.png b/third_party/WebKit/LayoutTests/platform/win/css3/masking/mask-repeat-space-padding-expected.png index 6dd1e66..391076d 100644 --- a/third_party/WebKit/LayoutTests/platform/win/css3/masking/mask-repeat-space-padding-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/css3/masking/mask-repeat-space-padding-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/background-repeat-with-background-color-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/background-repeat-with-background-color-expected.png index 47bfe99..f6ab2241 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/background-repeat-with-background-color-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/background-repeat-with-background-color-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/win/http/tests/misc/slow-loading-image-in-pattern-expected.png index fe19eb5..2304502 100644 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/win/images/color-profile-svg-fill-text-expected.png index 7d0f474..15b2a7c8 100644 --- a/third_party/WebKit/LayoutTests/platform/win/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/win/images/cross-fade-background-size-expected.png index af34a7c..6dd3d20b 100644 --- a/third_party/WebKit/LayoutTests/platform/win/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png index a8f389c6..8b8e6e0a 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png index 6a319b8..e6b8478 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/color-profile-svg-fill-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/cross-fade-background-size-expected.png index 2699d76..6965947 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/exotic-color-space/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png index 0123a81..54806de 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/cross-fade-background-size-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png index fe19eb5..2304502 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/misc/slow-loading-image-in-pattern-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt index a83cfb2e..8149f1b7 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3900,6 +3900,12 @@ method constructor method setPeriodicWave setter type +interface OverconstrainedError + attribute @@toStringTag + getter constraint + getter message + getter name + method constructor interface PageTransitionEvent : Event attribute @@toStringTag getter persisted
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js index 98cbb28..645ced2 100644 --- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -265,7 +265,7 @@ return new Promise( function(resolve, reject) { GCController.collect(); - setTimeout(resolve, 0); + step_timeout(resolve, 0); }); } @@ -349,9 +349,9 @@ assert_unreached('Object should not fire an event.'); }; object.addEventListener(event_name, event_listener); - // TODO(ortuno): Remove timeout. + // TODO: Remove timeout. // http://crbug.com/543884 - setTimeout(() => { + step_timeout(() => { object.removeEventListener(event_name, event_listener); resolve(); }, 100);
diff --git a/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png b/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png new file mode 100644 index 0000000..9e5603dc --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/exotic-color-space/images/color-profile-background-image-space-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt index fc624ba..fd99e3c 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -15,14 +15,20 @@ [Worker] method fetch [Worker] method get [Worker] method getIds -[Worker] interface BackgroundFetchRegistration +[Worker] interface BackgroundFetchRegistration : EventTarget [Worker] attribute @@toStringTag +[Worker] getter downloadTotal +[Worker] getter downloaded [Worker] getter icons [Worker] getter id +[Worker] getter onprogress [Worker] getter title [Worker] getter totalDownloadSize +[Worker] getter uploadTotal +[Worker] getter uploaded [Worker] method abort [Worker] method constructor +[Worker] setter onprogress [Worker] interface BarcodeDetector [Worker] attribute @@toStringTag [Worker] method constructor
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 81c2484..e010624 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -425,14 +425,20 @@ method fetch method get method getIds -interface BackgroundFetchRegistration +interface BackgroundFetchRegistration : EventTarget attribute @@toStringTag + getter downloadTotal + getter downloaded getter icons getter id + getter onprogress getter title getter totalDownloadSize + getter uploadTotal + getter uploaded method abort method constructor + setter onprogress interface BarProp attribute @@toStringTag getter visible @@ -4747,6 +4753,12 @@ method constructor method setPeriodicWave setter type +interface OverconstrainedError + attribute @@toStringTag + getter constraint + getter message + getter name + method constructor interface PageTransitionEvent : Event attribute @@toStringTag getter persisted
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt index 768f9fd..ee7d0a1c 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -15,14 +15,20 @@ [Worker] method fetch [Worker] method get [Worker] method getIds -[Worker] interface BackgroundFetchRegistration +[Worker] interface BackgroundFetchRegistration : EventTarget [Worker] attribute @@toStringTag +[Worker] getter downloadTotal +[Worker] getter downloaded [Worker] getter icons [Worker] getter id +[Worker] getter onprogress [Worker] getter title [Worker] getter totalDownloadSize +[Worker] getter uploadTotal +[Worker] getter uploaded [Worker] method abort [Worker] method constructor +[Worker] setter onprogress [Worker] interface BarcodeDetector [Worker] attribute @@toStringTag [Worker] method constructor
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp index cda37fc..88650ea 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp
@@ -7,25 +7,38 @@ namespace blink { ScriptSourceCode::ScriptSourceCode() - : start_position_(TextPosition::MinimumPosition()) {} + : parser_state_(kNotParserInserted), + start_position_(TextPosition::MinimumPosition()) {} ScriptSourceCode::ScriptSourceCode(const String& source, const KURL& url, + const String& nonce, + ParserDisposition parser_state, const TextPosition& start_position) - : source_(source), url_(url), start_position_(start_position) { + : source_(source), + url_(url), + nonce_(nonce), + parser_state_(parser_state), + start_position_(start_position) { TreatNullSourceAsEmpty(); if (!url_.IsEmpty()) url_.RemoveFragmentIdentifier(); } -ScriptSourceCode::ScriptSourceCode(ScriptResource* resource) - : ScriptSourceCode(nullptr, resource) {} +ScriptSourceCode::ScriptSourceCode(ScriptResource* resource, + const String& nonce, + ParserDisposition parser_state) + : ScriptSourceCode(nullptr, resource, nonce, parser_state) {} ScriptSourceCode::ScriptSourceCode(ScriptStreamer* streamer, - ScriptResource* resource) + ScriptResource* resource, + const String& nonce, + ParserDisposition parser_state) : source_(resource->SourceText()), resource_(resource), streamer_(streamer), + nonce_(nonce), + parser_state_(parser_state), start_position_(TextPosition::MinimumPosition()) { TreatNullSourceAsEmpty(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h b/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h index 7fe6b98d..4278ea3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h
@@ -35,6 +35,7 @@ #include "core/CoreExport.h" #include "core/loader/resource/ScriptResource.h" #include "platform/heap/Handle.h" +#include "platform/loader/fetch/ResourceLoaderOptions.h" #include "platform/weborigin/KURL.h" #include "platform/wtf/text/TextPosition.h" #include "platform/wtf/text/WTFString.h" @@ -48,12 +49,17 @@ ScriptSourceCode(); // We lose the encoding information from ScriptResource. // Not sure if that matters. - explicit ScriptSourceCode(ScriptResource*); + ScriptSourceCode(ScriptResource*, const String& nonce, ParserDisposition); ScriptSourceCode( - const String&, + const String& source, const KURL& = KURL(), + const String& nonce = String(), + ParserDisposition parser_state = kNotParserInserted, const TextPosition& start_position = TextPosition::MinimumPosition()); - ScriptSourceCode(ScriptStreamer*, ScriptResource*); + ScriptSourceCode(ScriptStreamer*, + ScriptResource*, + const String& nonce, + ParserDisposition); ~ScriptSourceCode(); DECLARE_TRACE(); @@ -66,6 +72,8 @@ ScriptResource* GetResource() const { return resource_; } const KURL& Url() const; int StartLine() const { return start_position_.line_.OneBasedInt(); } + const String& Nonce() const { return nonce_; } + ParserDisposition ParserState() const { return parser_state_; } const TextPosition& StartPosition() const { return start_position_; } String SourceMapUrl() const; @@ -78,6 +86,8 @@ Member<ScriptResource> resource_; Member<ScriptStreamer> streamer_; mutable KURL url_; + const String nonce_; + const ParserDisposition parser_state_; TextPosition start_position_; };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index 600aa646..f86715c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -48,6 +48,7 @@ .WillRepeatedly(::testing::Return(String())); EXPECT_CALL(*element, GetDocument()) .WillRepeatedly(::testing::ReturnRef(*dummy_document_.Get())); + EXPECT_CALL(*element, Loader()).WillRepeatedly(::testing::Return(nullptr)); pending_script_ = ClassicPendingScript::Create(element, resource_.Get()); ScriptStreamer::SetSmallScriptThresholdForTesting(0);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp index 5bfca45c..c8c5cc6 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
@@ -419,9 +419,13 @@ V8ThrowException::ThrowError(isolate, "Source file too large."); return v8::Local<v8::Script>(); } - // TODO(kouhei) crbug.com/711706 : Plumb nonce/parser_state through - // ScriptSourceCode. - const ReferrerScriptInfo referrer_info; + // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options + // The "default classic fetch options" credentials mode is "omit". + // TODO(kouhei): Follow html spec proposal to allow different credentials + // mode. https://github.com/whatwg/html/pull/3044 + const ReferrerScriptInfo referrer_info( + WebURLRequest::kFetchCredentialsModeOmit, source.Nonce(), + source.ParserState()); return CompileScript( script_state, V8String(isolate, source.Source()), source.Url(), source.SourceMapUrl(), source.StartPosition(), source.GetResource(), @@ -463,13 +467,6 @@ AccessControlStatus access_control_status, V8CacheOptions cache_options, const ReferrerScriptInfo& referrer_info) { - // As specified in [HIMD] Step 5-6, the credentials mode for a classic script - // is always "omit". - // [HIMD] - // https://github.com/tc39/proposal-dynamic-import/blob/master/HTML%20Integration.md#hostimportmoduledynamicallyreferencingscriptormodule-specifier-promisecapability - DCHECK_EQ(WebURLRequest::kFetchCredentialsModeOmit, - referrer_info.CredentialsMode()); - TRACE_EVENT2( "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(), "data",
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp index b9915fde..81663fd 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp
@@ -7,51 +7,27 @@ #include "core/dom/Element.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" -#include "core/frame/PerformanceMonitor.h" #include "core/frame/Settings.h" -#include "core/html/HTMLElement.h" #include "core/layout/LayoutObject.h" -#include "core/testing/DummyPageHolder.h" -#include "core/timing/Performance.h" +#include "core/layout/LayoutTestHelper.h" #include "platform/DragImage.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { -class DataTransferTest : public ::testing::Test { +class DataTransferTest : public RenderingTest { protected: - DataTransferTest() = default; - ~DataTransferTest() override = default; - - Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } - Page& GetPage() const { return dummy_page_holder_->GetPage(); } + Page& GetPage() const { return *GetDocument().GetPage(); } LocalFrame& GetFrame() const { return *GetDocument().GetFrame(); } - Performance* GetPerformance() const { return performance_; } - - void SetBodyContent(const std::string& body_content) { - GetDocument().body()->SetInnerHTMLFromString( - String::FromUTF8(body_content.c_str())); - UpdateAllLifecyclePhases(); - } - void UpdateAllLifecyclePhases() { GetDocument().View()->UpdateAllLifecyclePhases(); } - - private: - void SetUp() override { - dummy_page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); - performance_ = Performance::Create(GetDocument().domWindow()); - } - - std::unique_ptr<DummyPageHolder> dummy_page_holder_; - Persistent<Performance> performance_; }; -TEST_F(DataTransferTest, nodeImage) { - SetBodyContent( +TEST_F(DataTransferTest, NodeImage) { + SetBodyInnerHTML( "<style>" - "#sample { width: 100px; height: 100px; }" + " #sample { width: 100px; height: 100px; }" "</style>" "<div id=sample></div>"); Element* sample = GetDocument().getElementById("sample"); @@ -60,11 +36,11 @@ EXPECT_EQ(IntSize(100, 100), image->Size()); } -TEST_F(DataTransferTest, nodeImageWithNestedElement) { - SetBodyContent( +TEST_F(DataTransferTest, NodeImageWithNestedElement) { + SetBodyInnerHTML( "<style>" - "div { -webkit-user-drag: element }" - "span:-webkit-drag { color: #0F0 }" + " div { -webkit-user-drag: element }" + " span:-webkit-drag { color: #0F0 }" "</style>" "<div id=sample><span>Green when dragged</span></div>"); Element* sample = GetDocument().getElementById("sample"); @@ -76,11 +52,11 @@ << "Descendants node should have :-webkit-drag."; } -TEST_F(DataTransferTest, nodeImageWithPsuedoClassWebKitDrag) { - SetBodyContent( +TEST_F(DataTransferTest, NodeImageWithPsuedoClassWebKitDrag) { + SetBodyInnerHTML( "<style>" - "#sample { width: 100px; height: 100px; }" - "#sample:-webkit-drag { width: 200px; height: 200px; }" + " #sample { width: 100px; height: 100px; }" + " #sample:-webkit-drag { width: 200px; height: 200px; }" "</style>" "<div id=sample></div>"); Element* sample = GetDocument().getElementById("sample"); @@ -90,11 +66,11 @@ << ":-webkit-drag should affect dragged image."; } -TEST_F(DataTransferTest, nodeImageWithoutDraggedLayoutObject) { - SetBodyContent( +TEST_F(DataTransferTest, NodeImageWithoutDraggedLayoutObject) { + SetBodyInnerHTML( "<style>" - "#sample { width: 100px; height: 100px; }" - "#sample:-webkit-drag { display:none }" + " #sample { width: 100px; height: 100px; }" + " #sample:-webkit-drag { display:none }" "</style>" "<div id=sample></div>"); Element* sample = GetDocument().getElementById("sample"); @@ -103,11 +79,11 @@ EXPECT_EQ(nullptr, image.get()) << ":-webkit-drag blows away layout object"; } -TEST_F(DataTransferTest, nodeImageWithChangingLayoutObject) { - SetBodyContent( +TEST_F(DataTransferTest, NodeImageWithChangingLayoutObject) { + SetBodyInnerHTML( "<style>" - "#sample { color: blue; }" - "#sample:-webkit-drag { display: inline-block; color: red; }" + " #sample { color: blue; }" + " #sample:-webkit-drag { display: inline-block; color: red; }" "</style>" "<span id=sample>foo</span>"); Element* sample = GetDocument().getElementById("sample"); @@ -131,7 +107,7 @@ } TEST_F(DataTransferTest, NodeImageExceedsViewportBounds) { - SetBodyContent( + SetBodyInnerHTML( "<style>" " * { margin: 0; } " " #node { width: 2000px; height: 2000px; }" @@ -143,7 +119,7 @@ } TEST_F(DataTransferTest, NodeImageUnderScrollOffset) { - SetBodyContent( + SetBodyInnerHTML( "<style>" " * { margin: 0; } " " #first { width: 500px; height: 500px; }" @@ -173,7 +149,7 @@ } TEST_F(DataTransferTest, NodeImageSizeWithPageScaleFactor) { - SetBodyContent( + SetBodyInnerHTML( "<style>" " * { margin: 0; } " " html, body { height: 2000px; }" @@ -205,7 +181,7 @@ TEST_F(DataTransferTest, NodeImageWithPageScaleFactor) { // #bluegreen is a 2x1 rectangle where the left pixel is blue and the right // pixel is green. The element is offset by a margin of 1px. - SetBodyContent( + SetBodyInnerHTML( "<style>" " * { margin: 0; } " " #bluegreen {"
diff --git a/third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp b/third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp index 4945e5a..2559fc2 100644 --- a/third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp +++ b/third_party/WebKit/Source/core/css/LocalFontFaceSource.cpp
@@ -20,18 +20,25 @@ RefPtr<SimpleFontData> LocalFontFaceSource::CreateFontData( const FontDescription& font_description, const FontSelectionCapabilities&) { - // FIXME(drott) crbug.com/627143: We still have the issue of matching family - // name instead of postscript name for local fonts. However, we should - // definitely not try to take into account the full requested font description - // including the width, slope, weight styling when trying to match against - // local fonts. - FontDescription description_without_styling(font_description); - description_without_styling.SetStretch(NormalWidthValue()); - description_without_styling.SetStyle(NormalSlopeValue()); - description_without_styling.SetWeight(NormalWeightValue()); + // FIXME(drott) crbug.com/627143: We still have the issue of matching + // family name instead of postscript name for local fonts. However, we + // should definitely not try to take into account the full requested + // font description including the width, slope, weight styling when + // trying to match against local fonts. An unstyled FontDescription + // needs to be used here, or practically none at all. Instead we + // should only look for the postscript or full font name. + // However, when passing a style-neutral FontDescription we can't + // match Roboto Bold and Thin anymore on Android given the CSS Google + // Fonts sends, compare crbug.com/765980. So for now, we continue to + // pass font_description to avoid breaking Google Fonts. + FontDescription unstyled_description(font_description); +#if !defined(OS_ANDROID) + unstyled_description.SetStretch(NormalWidthValue()); + unstyled_description.SetStyle(NormalSlopeValue()); + unstyled_description.SetWeight(NormalWeightValue()); +#endif RefPtr<SimpleFontData> font_data = FontCache::GetFontCache()->GetFontData( - description_without_styling, font_name_, - AlternateFontName::kLocalUniqueFace); + unstyled_description, font_name_, AlternateFontName::kLocalUniqueFace); histograms_.Record(font_data.get()); return font_data; }
diff --git a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp index 1725e05..7289e7a3 100644 --- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp +++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
@@ -8,6 +8,7 @@ #include "bindings/core/v8/ScriptStreamer.h" #include "bindings/core/v8/V8BindingForCore.h" #include "core/dom/Document.h" +#include "core/dom/ScriptLoader.h" #include "core/dom/TaskRunnerHelper.h" #include "core/frame/LocalFrame.h" #include "core/loader/SubresourceIntegrityHelper.h" @@ -166,16 +167,25 @@ DCHECK(IsReady()); error_occurred = ErrorOccurred(); + const ScriptLoader* loader = GetElement()->Loader(); + // Here, we use the nonce snapshot at "#prepare-a-script". + // Note that |loader| may be nullptr if ScriptStreamerTest. + const String& nonce = loader ? loader->Nonce() : String(); + const ParserDisposition parser_state = (loader && loader->IsParserInserted()) + ? kParserInserted + : kNotParserInserted; if (!GetResource()) { - return ClassicScript::Create(ScriptSourceCode( - GetElement()->TextFromChildren(), document_url, StartingPosition())); + return ClassicScript::Create( + ScriptSourceCode(GetElement()->TextFromChildren(), document_url, nonce, + parser_state, StartingPosition())); } DCHECK(GetResource()->IsLoaded()); bool streamer_ready = (ready_state_ == kReady) && streamer_ && !streamer_->StreamingSuppressed(); return ClassicScript::Create( - ScriptSourceCode(streamer_ready ? streamer_ : nullptr, GetResource())); + ScriptSourceCode(streamer_ready ? streamer_ : nullptr, GetResource(), + nonce, parser_state)); } void ClassicPendingScript::SetStreamer(ScriptStreamer* streamer) {
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 69e6070f..b4776c1 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6319,23 +6319,20 @@ static void RunAddConsoleMessageTask(MessageSource source, MessageLevel level, const String& message, - Vector<DOMNodeId> nodes, ExecutionContext* context) { ConsoleMessage* console_message = ConsoleMessage::Create(source, level, message); - console_message->SetNodes(std::move(nodes)); context->AddConsoleMessage(console_message); } void Document::AddConsoleMessage(ConsoleMessage* console_message) { if (!IsContextThread()) { TaskRunnerHelper::Get(TaskType::kUnthrottled, this) - ->PostTask( - BLINK_FROM_HERE, - CrossThreadBind( - &RunAddConsoleMessageTask, console_message->Source(), - console_message->Level(), console_message->Message(), - console_message->Nodes(), WrapCrossThreadPersistent(this))); + ->PostTask(BLINK_FROM_HERE, + CrossThreadBind( + &RunAddConsoleMessageTask, console_message->Source(), + console_message->Level(), console_message->Message(), + WrapCrossThreadPersistent(this))); return; } @@ -6355,7 +6352,7 @@ console_message->Source(), console_message->Level(), console_message->Message(), SourceLocation::Create(Url().GetString(), line_number, 0, nullptr)); - console_message->SetNodes(std::move(nodes)); + console_message->SetNodes(frame_, std::move(nodes)); } frame_->Console().AddMessage(console_message); }
diff --git a/third_party/WebKit/Source/core/dom/DynamicModuleResolver.cpp b/third_party/WebKit/Source/core/dom/DynamicModuleResolver.cpp index 90cea65..b9bc540 100644 --- a/third_party/WebKit/Source/core/dom/DynamicModuleResolver.cpp +++ b/third_party/WebKit/Source/core/dom/DynamicModuleResolver.cpp
@@ -157,8 +157,13 @@ // Step 2.1. "Let url be the result of resolving a module specifier // given referencing script and specifier." [spec text] - DCHECK(referrer_url.IsValid()); - KURL url = Modulator::ResolveModuleSpecifier(specifier, referrer_url); + KURL context_url = + referrer_url.IsValid() + ? referrer_url + : ExecutionContext::From(modulator_->GetScriptState())->Url(); + DCHECK(context_url.IsValid()); + + KURL url = Modulator::ResolveModuleSpecifier(specifier, context_url); if (!url.IsValid()) { // Step 2.2.1. "If the result is failure, then:" [spec text] // Step 2.2.2.1. "Let completion be Completion { [[Type]]: throw, [[Value]]:
diff --git a/third_party/WebKit/Source/core/dom/DynamicModuleResolverTest.cpp b/third_party/WebKit/Source/core/dom/DynamicModuleResolverTest.cpp index cb90687..eba9109 100644 --- a/third_party/WebKit/Source/core/dom/DynamicModuleResolverTest.cpp +++ b/third_party/WebKit/Source/core/dom/DynamicModuleResolverTest.cpp
@@ -10,6 +10,7 @@ #include "bindings/core/v8/ScriptValue.h" #include "bindings/core/v8/V8BindingForCore.h" #include "bindings/core/v8/V8BindingForTesting.h" +#include "core/dom/Document.h" #include "core/dom/ModuleScript.h" #include "core/loader/modulescript/ModuleScriptFetchRequest.h" #include "core/testing/DummyModulator.h" @@ -306,4 +307,42 @@ EXPECT_EQ("bar", capture->Message()); } +TEST(DynamicModuleResolverTest, ResolveWithNullReferrerScriptSuccess) { + V8TestingScope scope; + scope.GetDocument().SetURL(KURL(kParsedURLString, "https://example.com")); + + auto modulator = + new DynamicModuleResolverTestModulator(scope.GetScriptState()); + + auto promise_resolver = ScriptPromiseResolver::Create(scope.GetScriptState()); + ScriptPromise promise = promise_resolver->Promise(); + + auto capture = + new CaptureExportedStringFunction(scope.GetScriptState(), "foo"); + promise.Then(capture->Bind(), + NotReached::CreateFunction(scope.GetScriptState())); + + auto resolver = DynamicModuleResolver::Create(modulator); + resolver->ResolveDynamically("./dependency.js", /* null referrer */ KURL(), + ReferrerScriptInfo(), promise_resolver); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + EXPECT_FALSE(capture->WasCalled()); + + ScriptModule record = ScriptModule::Compile( + scope.GetIsolate(), "export const foo = 'hello';", TestDependencyURL(), + kSharableCrossOrigin, WebURLRequest::kFetchCredentialsModeOmit, "", + kParserInserted, TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION); + ModuleScript* module_script = ModuleScript::CreateForTest( + modulator, record, TestDependencyURL(), "nonce", kNotParserInserted, + WebURLRequest::kFetchCredentialsModeOmit); + record.Instantiate(scope.GetScriptState()); + EXPECT_FALSE(module_script->IsErrored()); + modulator->ResolveTreeFetch(module_script); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + EXPECT_TRUE(capture->WasCalled()); + EXPECT_EQ("hello", capture->CapturedValue()); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index 8b07098..db0775d 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -349,7 +349,7 @@ // 17. "If the script element has a nonce attribute, // then let cryptographic nonce be that attribute's value. // Otherwise, let cryptographic nonce be the empty string." - String nonce = element_->GetNonceForElement(); + nonce_ = element_->GetNonceForElement(); // 18. is handled below. @@ -425,7 +425,7 @@ SubresourceIntegrityHelper::DoReport(element_document, report_info); } - if (!FetchClassicScript(url, element_document.Fetcher(), nonce, + if (!FetchClassicScript(url, element_document.Fetcher(), nonce_, integrity_metadata, parser_state, cross_origin, element_document.GetSecurityOrigin(), encoding)) { // TODO(hiroshige): Make this asynchronous. Currently we fire the error @@ -446,7 +446,7 @@ Modulator* modulator = Modulator::From( ToScriptStateForMainWorld(context_document->GetFrame())); - FetchModuleScriptTree(url, modulator, nonce, parser_state, + FetchModuleScriptTree(url, modulator, nonce_, parser_state, credentials_mode); DCHECK(!resource_); @@ -498,7 +498,7 @@ Modulator* modulator = Modulator::From( ToScriptStateForMainWorld(context_document->GetFrame())); ModuleScript* module_script = ModuleScript::Create( - element_->TextFromChildren(), modulator, base_url, nonce, + element_->TextFromChildren(), modulator, base_url, nonce_, parser_state, credentials_mode, kSharableCrossOrigin, position); // 3. "If this returns null, set the script's script to null and abort @@ -695,6 +695,9 @@ CrossOriginAttributeValue cross_origin, SecurityOrigin* security_origin, const WTF::TextEncoding& encoding) { + // TODO(hiroshige): remove nonce from the method argument. + DCHECK_EQ(nonce_, nonce); + // https://html.spec.whatwg.org/#prepare-a-script // 21.6, "classic": // "Fetch a classic script given url, settings, ..." @@ -729,7 +732,7 @@ FetchParameters params(resource_request, options); // "... cryptographic nonce, ..." - params.SetContentSecurityPolicyNonce(nonce); + params.SetContentSecurityPolicyNonce(nonce_); // "... integrity metadata, ..." params.SetIntegrityMetadata(integrity_metadata); @@ -767,12 +770,15 @@ const String& nonce, ParserDisposition parser_state, WebURLRequest::FetchCredentialsMode credentials_mode) { + // TODO(hiroshige): remove nonce from the method argument. + DCHECK_EQ(nonce_, nonce); + // https://html.spec.whatwg.org/#prepare-a-script // 21.6, "module": // "Fetch a module script graph given url, settings, "script", // cryptographic nonce, parser state, and // module script credentials mode." - ModuleScriptFetchRequest module_request(url, nonce, parser_state, + ModuleScriptFetchRequest module_request(url, nonce_, parser_state, credentials_mode); module_tree_client_ = ModulePendingScriptTreeClient::Create();
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.h b/third_party/WebKit/Source/core/dom/ScriptLoader.h index 30e120c..88bf47f 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.h +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.h
@@ -55,7 +55,7 @@ static ScriptLoader* Create(ScriptElementBase* element, bool created_by_parser, bool is_evaluated, - bool created_during_document_write = false) { + bool created_during_document_write) { return new ScriptLoader(element, created_by_parser, is_evaluated, created_during_document_write); } @@ -128,6 +128,8 @@ } void SetFetchDocWrittenScriptDeferIdle(); + const String& Nonce() const { return nonce_; } + // To support script streaming, the ScriptRunner may need to access the // PendingScript. This breaks the intended layering, so please use with // care. (Method is virtual to support testing.) @@ -241,6 +243,8 @@ TraceWrapperMember<PendingScript> pending_script_; TraceWrapperMember<ModulePendingScriptTreeClient> module_tree_client_; + String nonce_; + // The context document at the time when PrepareScript() is executed. // This is only used to check whether the script element is moved between // documents and thus doesn't retain a strong reference.
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.h b/third_party/WebKit/Source/core/editing/EditingUtilities.h index 16b43712..70a0868 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilities.h +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.h
@@ -215,6 +215,7 @@ // TODO(editing-dev): Renaming these two functions below is a first step // of moving all call sites from |Node*| to use |const Node&| as a parameter. // See crbug.com/766448 +// Instead of deprecated functions please use const-ref implementation below. inline Position FirstPositionInOrBeforeNodeDeprecated(Node* node) { return Position::FirstPositionInOrBeforeNodeDeprecated(node); } @@ -223,6 +224,15 @@ return Position::LastPositionInOrAfterNodeDeprecated(node); } +// This is a |const Node&| versions of two deprecated functions above. +inline Position FirstPositionInOrBeforeNode(const Node& node) { + return Position::FirstPositionInOrBeforeNode(node); +} + +inline Position LastPositionInOrAfterNode(const Node& node) { + return Position::LastPositionInOrAfterNode(node); +} + CORE_EXPORT Position FirstEditablePositionAfterPositionInRoot(const Position&, Node&); CORE_EXPORT Position LastEditablePositionBeforePositionInRoot(const Position&,
diff --git a/third_party/WebKit/Source/core/editing/Position.cpp b/third_party/WebKit/Source/core/editing/Position.cpp index 360b9a3..91e24d9 100644 --- a/third_party/WebKit/Source/core/editing/Position.cpp +++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -538,8 +538,7 @@ PositionTemplate<Strategy>::FirstPositionInOrBeforeNodeDeprecated(Node* node) { if (!node) return PositionTemplate<Strategy>(); - return EditingIgnoresContent(*node) ? BeforeNode(*node) - : FirstPositionInNode(*node); + return FirstPositionInOrBeforeNode(*node); } // static @@ -548,8 +547,23 @@ PositionTemplate<Strategy>::LastPositionInOrAfterNodeDeprecated(Node* node) { if (!node) return PositionTemplate<Strategy>(); - return EditingIgnoresContent(*node) ? AfterNode(*node) - : LastPositionInNode(*node); + return LastPositionInOrAfterNode(*node); +} + +// static +template <typename Strategy> +PositionTemplate<Strategy> +PositionTemplate<Strategy>::FirstPositionInOrBeforeNode(const Node& node) { + return EditingIgnoresContent(node) ? BeforeNode(node) + : FirstPositionInNode(node); +} + +// static +template <typename Strategy> +PositionTemplate<Strategy> +PositionTemplate<Strategy>::LastPositionInOrAfterNode(const Node& node) { + return EditingIgnoresContent(node) ? AfterNode(node) + : LastPositionInNode(node); } PositionInFlatTree ToPositionInFlatTree(const Position& pos) {
diff --git a/third_party/WebKit/Source/core/editing/Position.h b/third_party/WebKit/Source/core/editing/Position.h index bb15258..4edebd1 100644 --- a/third_party/WebKit/Source/core/editing/Position.h +++ b/third_party/WebKit/Source/core/editing/Position.h
@@ -193,10 +193,16 @@ static PositionTemplate<Strategy> FirstPositionInNode( const Node& anchor_node); static PositionTemplate<Strategy> LastPositionInNode(const Node& anchor_node); + // TODO(editing-dev): Instead of these two deprecated functions please use + // const-ref implementation below. static PositionTemplate<Strategy> FirstPositionInOrBeforeNodeDeprecated( Node* anchor_node); static PositionTemplate<Strategy> LastPositionInOrAfterNodeDeprecated( Node* anchor_node); + static PositionTemplate<Strategy> FirstPositionInOrBeforeNode( + const Node& anchor_node); + static PositionTemplate<Strategy> LastPositionInOrAfterNode( + const Node& anchor_node); String ToAnchorTypeAndOffsetString() const; #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index f2d80fc..058dcba 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -63,6 +63,7 @@ #include "core/events/MouseEvent.h" #include "core/exported/WebRemoteFrameImpl.h" #include "core/exported/WebViewImpl.h" +#include "core/frame/BrowserControls.h" #include "core/frame/FrameTestHelpers.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" @@ -8973,6 +8974,42 @@ EXPECT_EQ(size.height, page->GetVisualViewport().Size().Height()); } +// Verify that size changes to browser controls while the main frame is remote +// are preserved when the main frame swaps to a local frame. See +// https://crbug.com/769321. +TEST_P(WebFrameSwapTest, + ValidateBrowserControlsSizeOnRemoteToLocalMainFrameSwap) { + WebRemoteFrame* remote_frame = FrameTestHelpers::CreateRemote(); + MainFrame()->Swap(remote_frame); + + // Create a provisional main frame frame but don't swap it in yet. + WebLocalFrame* local_frame = + FrameTestHelpers::CreateProvisional(*remote_frame); + + WebViewImpl* web_view = static_cast<WebViewImpl*>(local_frame->View()); + EXPECT_TRUE(web_view->MainFrame() && + web_view->MainFrame()->IsWebRemoteFrame()); + + // Resize the browser controls. + float top_browser_controls_height = 40; + float bottom_browser_controls_height = 60; + web_view->ResizeWithBrowserControls(WebSize(100, 100), + top_browser_controls_height, + bottom_browser_controls_height, false); + + // Swap the provisional frame in and verify that the browser controls size is + // correct. + remote_frame->Swap(local_frame); + Page* page = static_cast<WebViewImpl*>(local_frame->View()) + ->GetPage() + ->MainFrame() + ->GetPage(); + EXPECT_EQ(top_browser_controls_height, + page->GetBrowserControls().TopHeight()); + EXPECT_EQ(bottom_browser_controls_height, + page->GetBrowserControls().BottomHeight()); +} + namespace { class SwapMainFrameWhenTitleChangesWebFrameClient @@ -12031,4 +12068,16 @@ web_view_helper.LocalMainFrame()->FirstChild()->FirstChild())); } +TEST_F(WebFrameTest, ExecuteCommandProducesUserGesture) { + FrameTestHelpers::WebViewHelper web_view_helper; + web_view_helper.InitializeAndLoad("about:blank"); + WebLocalFrameImpl* frame = web_view_helper.LocalMainFrame(); + + EXPECT_FALSE(frame->GetFrame()->HasReceivedUserGesture()); + frame->ExecuteScript(WebScriptSource(WebString("document.execCommand('copy');"))); + EXPECT_FALSE(frame->GetFrame()->HasReceivedUserGesture()); + frame->ExecuteCommand(WebString::FromUTF8("Paste")); + EXPECT_TRUE(frame->GetFrame()->HasReceivedUserGesture()); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/exported/WebScriptSource.cpp b/third_party/WebKit/Source/core/exported/WebScriptSource.cpp index f222395..c795a02 100644 --- a/third_party/WebKit/Source/core/exported/WebScriptSource.cpp +++ b/third_party/WebKit/Source/core/exported/WebScriptSource.cpp
@@ -12,7 +12,10 @@ WebScriptSource::operator ScriptSourceCode() const { TextPosition position(OrdinalNumber::FromOneBasedInt(start_line), OrdinalNumber::First()); - return ScriptSourceCode(code, url, position); + // Scripts injected from outside web platform don't carry nonce info, and are + // not inserted via parser. + return ScriptSourceCode(code, url, String() /* nonce */, kNotParserInserted, + position); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp index 49eaf70..37634a25 100644 --- a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
@@ -1763,6 +1763,9 @@ size_ = new_size; GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); GetPage()->GetVisualViewport().SetSize(size_); + GetPage()->GetBrowserControls().SetHeight(top_controls_height, + bottom_controls_height, + browser_controls_shrink_layout); return; }
diff --git a/third_party/WebKit/Source/core/frame/FrameConsole.cpp b/third_party/WebKit/Source/core/frame/FrameConsole.cpp index f4b27dd..b3a56d9 100644 --- a/third_party/WebKit/Source/core/frame/FrameConsole.cpp +++ b/third_party/WebKit/Source/core/frame/FrameConsole.cpp
@@ -56,10 +56,11 @@ provisional_loader->CopySourceLocation(); if (source_location) { Vector<DOMNodeId> nodes(console_message->Nodes()); + LocalFrame* frame = console_message->Frame(); console_message = ConsoleMessage::Create( console_message->Source(), console_message->Level(), console_message->Message(), std::move(source_location)); - console_message->SetNodes(std::move(nodes)); + console_message->SetNodes(frame, std::move(nodes)); } }
diff --git a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp index 8d88a12..1789a22 100644 --- a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp
@@ -723,7 +723,7 @@ message_source, web_core_message_level, message.text, SourceLocation::Create(message.url, message.line_number, message.column_number, nullptr)); - console_message->SetNodes(std::move(nodes)); + console_message->SetNodes(GetFrame(), std::move(nodes)); GetFrame()->GetDocument()->AddConsoleMessage(console_message); } @@ -1046,6 +1046,9 @@ ? context_menu_node_ : nullptr; + std::unique_ptr<UserGestureIndicator> gesture_indicator = + LocalFrame::CreateUserGesture(GetFrame(), UserGestureToken::kNewGesture); + WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(plugin_lookup_context_node); if (plugin_container && plugin_container->ExecuteEditCommand(name)) @@ -1058,6 +1061,9 @@ const WebString& value) { DCHECK(GetFrame()); + std::unique_ptr<UserGestureIndicator> gesture_indicator = + LocalFrame::CreateUserGesture(GetFrame(), UserGestureToken::kNewGesture); + WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(); if (plugin_container && plugin_container->ExecuteEditCommand(name, value))
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp index 38c1b3a..7bf1e40 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp
@@ -6,6 +6,7 @@ #include "bindings/core/v8/SourceLocation.h" #include "core/dom/Node.h" +#include "core/frame/LocalFrame.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/CurrentTime.h" #include "public/web/WebConsoleMessage.h" @@ -63,7 +64,8 @@ message_(message), location_(std::move(location)), request_identifier_(0), - timestamp_(WTF::CurrentTimeMS()) {} + timestamp_(WTF::CurrentTimeMS()), + frame_(nullptr) {} ConsoleMessage::~ConsoleMessage() {} @@ -95,15 +97,22 @@ return worker_id_; } +LocalFrame* ConsoleMessage::Frame() const { + return frame_; +} + Vector<DOMNodeId>& ConsoleMessage::Nodes() { return nodes_; } -void ConsoleMessage::SetNodes(Vector<DOMNodeId> nodes) { +void ConsoleMessage::SetNodes(LocalFrame* frame, Vector<DOMNodeId> nodes) { + frame_ = frame; nodes_ = std::move(nodes); } -DEFINE_TRACE(ConsoleMessage) {} +DEFINE_TRACE(ConsoleMessage) { + visitor->Trace(frame_); +} STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelVerbose, kVerboseMessageLevel); STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelInfo, kInfoMessageLevel);
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h index f2451374..dcce60f2 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h
@@ -14,6 +14,7 @@ namespace blink { +class LocalFrame; class SourceLocation; class CORE_EXPORT ConsoleMessage final @@ -52,8 +53,9 @@ MessageLevel Level() const; const String& Message() const; const String& WorkerId() const; + LocalFrame* Frame() const; Vector<DOMNodeId>& Nodes(); - void SetNodes(Vector<DOMNodeId> nodes); + void SetNodes(LocalFrame*, Vector<DOMNodeId> nodes); DECLARE_TRACE(); @@ -70,6 +72,7 @@ unsigned long request_identifier_; double timestamp_; String worker_id_; + WeakMember<LocalFrame> frame_; Vector<DOMNodeId> nodes_; };
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp index 7bfeeefb..002f0a7 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorLogAgent.cpp
@@ -132,18 +132,28 @@ entry->setNetworkRequestId( IdentifiersFactory::RequestId(message->RequestIdentifier())); - if (v8_session_ && !message->Nodes().IsEmpty()) { + if (v8_session_ && message->Frame() && !message->Nodes().IsEmpty()) { ScriptForbiddenScope::AllowUserAgentScript allow_script; std::unique_ptr< protocol::Array<v8_inspector::protocol::Runtime::API::RemoteObject>> remote_objects = protocol::Array< v8_inspector::protocol::Runtime::API::RemoteObject>::create(); for (DOMNodeId node_id : message->Nodes()) { + std::unique_ptr<v8_inspector::protocol::Runtime::API::RemoteObject> + remote_object = nullptr; Node* node = DOMNodeIds::NodeForId(node_id); - if (node) { - auto remote_object = ResolveNode(v8_session_, node, "console"); - if (remote_object) - remote_objects->addItem(std::move(remote_object)); + if (node) + remote_object = ResolveNode(v8_session_, node, "console"); + if (!remote_object) { + remote_object = + NullRemoteObject(v8_session_, message->Frame(), "console"); + } + if (remote_object) { + remote_objects->addItem(std::move(remote_object)); + } else { + // If a null object could not be referenced, we do not send the message + // at all, to avoid situations in which the arguments are misleading. + return; } } entry->setArgs(std::move(remote_objects));
diff --git a/third_party/WebKit/Source/core/inspector/ResolveNode.cpp b/third_party/WebKit/Source/core/inspector/ResolveNode.cpp index 1daf1ce..a9107ca9 100644 --- a/third_party/WebKit/Source/core/inspector/ResolveNode.cpp +++ b/third_party/WebKit/Source/core/inspector/ResolveNode.cpp
@@ -8,6 +8,7 @@ #include "bindings/core/v8/V8BindingForCore.h" #include "core/dom/Document.h" #include "core/dom/Node.h" +#include "core/frame/LocalFrame.h" #include "core/inspector/V8InspectorString.h" namespace blink { @@ -25,6 +26,9 @@ v8_inspector::V8InspectorSession* v8_session, Node* node, const String& object_group) { + if (!node) + return nullptr; + Document* document = node->IsDocumentNode() ? &node->GetDocument() : node->ownerDocument(); LocalFrame* frame = document ? document->GetFrame() : nullptr; @@ -41,4 +45,22 @@ ToV8InspectorStringView(object_group)); } +std::unique_ptr<v8_inspector::protocol::Runtime::API::RemoteObject> +NullRemoteObject(v8_inspector::V8InspectorSession* v8_session, + LocalFrame* frame, + const String& object_group) { + if (!frame) + return nullptr; + + ScriptState* script_state = ToScriptStateForMainWorld(frame); + if (!script_state) + return nullptr; + + ScriptState::Scope scope(script_state); + return v8_session->wrapObject( + script_state->GetContext(), + NodeV8Value(script_state->GetContext(), nullptr), + ToV8InspectorStringView(object_group)); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/ResolveNode.h b/third_party/WebKit/Source/core/inspector/ResolveNode.h index a1c21f4c..bedf988 100644 --- a/third_party/WebKit/Source/core/inspector/ResolveNode.h +++ b/third_party/WebKit/Source/core/inspector/ResolveNode.h
@@ -13,6 +13,7 @@ namespace blink { +class LocalFrame; class Node; v8::Local<v8::Value> NodeV8Value(v8::Local<v8::Context>, Node*); @@ -22,6 +23,11 @@ Node*, const String& object_group); +std::unique_ptr<v8_inspector::protocol::Runtime::API::RemoteObject> +NullRemoteObject(v8_inspector::V8InspectorSession* v8_session, + LocalFrame*, + const String& object_group); + } // namespace blink #endif // ResolveNode_h
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index 96a24d7..04d8e4c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -716,6 +716,7 @@ } LayoutSize LayoutBoxModelObject::RelativePositionOffset() const { + DCHECK(IsRelPositioned()); LayoutSize offset = AccumulateInFlowPositionOffsets(); LayoutBlock* containing_block = this->ContainingBlock();
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp index d6df6f7..cae1382 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp
@@ -26,7 +26,6 @@ #include "core/CSSValueKeywords.h" #include "core/layout/LayoutThemeFontProvider.h" -#include "core/paint/MediaControlsPainter.h" #include "core/style/ComputedStyle.h" #include "platform/DataResourceHelper.h" #include "platform/LayoutTestSupport.h" @@ -174,8 +173,6 @@ } else if (style.Appearance() == kSliderThumbVerticalPart) { style.SetWidth(Length(size.Height() * zoom_level, kFixed)); style.SetHeight(Length(size.Width() * zoom_level, kFixed)); - } else { - MediaControlsPainter::AdjustMediaSliderThumbSize(style); } }
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.h b/third_party/WebKit/Source/core/layout/LayoutThemeMac.h index c883e7e..469c35b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.h +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.h
@@ -170,7 +170,6 @@ static const int kSliderTrackBorderWidth = 1; protected: - void AdjustMediaSliderThumbSize(ComputedStyle&) const; String ExtraFullscreenStyleSheet() override; // Controls color values returned from platformFocusRingColor(). systemColor()
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm index b9635a99..cfd5805 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -29,7 +29,6 @@ #import "core/fileapi/FileList.h" #import "core/layout/LayoutProgress.h" #import "core/layout/LayoutView.h" -#import "core/paint/MediaControlsPainter.h" #import "core/style/ShadowList.h" #import "platform/DataResourceHelper.h" #import "platform/LayoutTestSupport.h" @@ -950,8 +949,6 @@ Length(static_cast<int>(kSliderThumbWidth * zoom_level), kFixed)); style.SetHeight( Length(static_cast<int>(kSliderThumbHeight * zoom_level), kFixed)); - } else { - AdjustMediaSliderThumbSize(style); } } @@ -1082,10 +1079,6 @@ [cell setControlTint:tint]; } -void LayoutThemeMac::AdjustMediaSliderThumbSize(ComputedStyle& style) const { - MediaControlsPainter::AdjustMediaSliderThumbSize(style); -} - String LayoutThemeMac::ExtraFullscreenStyleSheet() { // FIXME: Chromium may wish to style its default media controls differently in // fullscreen.
diff --git a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp index 22da14f7..5d9f4630 100644 --- a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp
@@ -1105,11 +1105,7 @@ // Ensure thumb position is correctly calculated even at ridiculously large // scales. -#if defined(OS_ANDROID) -TEST_P(ScrollbarAppearanceTest, DISABLED_HugeScrollingThumbPosition) { -#else TEST_P(ScrollbarAppearanceTest, HugeScrollingThumbPosition) { -#endif ScopedTestingPlatformSupport<ScrollbarTestingPlatformSupport> platform; v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); @@ -1127,12 +1123,36 @@ scrollable_area->SetScrollOffset(ScrollOffset(0, 10000000), kProgrammaticScroll); + Compositor().BeginFrame(); + int scroll_y = scrollable_area->GetScrollOffset().Height(); ASSERT_EQ(9999000, scroll_y); Scrollbar* scrollbar = scrollable_area->VerticalScrollbar(); ASSERT_TRUE(scrollbar); + // TODO(bokan): Added a bunch of asserting here to fish out a flake. I + // suspect we're sometimes either keeping a horizontal scrollbar around a bit + // too long or the mock theme hasn't yet taken effect. Not sure how that might + // be happening but these should help decide where to look next (or the newly + // added BeginFrame after setting the ScrollOffset will help. In any case, + // remove once this bug is closed: crbug.com/769350. + { + ASSERT_FALSE(scrollable_area->HorizontalScrollbar()); + WebThemeEngine* engine = Platform::Current()->ThemeEngine(); + ASSERT_EQ( + engine->GetSize(StubWebThemeEngine::kPartScrollbarVerticalThumb).width, + 15); + ASSERT_EQ( + engine->GetSize(StubWebThemeEngine::kPartScrollbarVerticalThumb).height, + StubWebThemeEngine::kMinimumVerticalLength); + + StubWebThemeEngine::ScrollbarStyle style; + engine->GetOverlayScrollbarStyle(&style); + ASSERT_EQ(style.thumb_thickness, 3); + ASSERT_EQ(style.scrollbar_margin, 0); + } + int maximumThumbPosition = WebView().Size().height - StubWebThemeEngine::kMinimumVerticalLength;
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutItem.h b/third_party/WebKit/Source/core/layout/api/LineLayoutItem.h index 3c409f62..2fdc91ea 100644 --- a/third_party/WebKit/Source/core/layout/api/LineLayoutItem.h +++ b/third_party/WebKit/Source/core/layout/api/LineLayoutItem.h
@@ -254,6 +254,8 @@ return layout_object_->IsInFlowPositioned(); } + bool IsRelPositioned() const { return layout_object_->IsRelPositioned(); } + // TODO(dgrogan/eae): Can we change this to GlobalToLocal and vice versa // instead of having 4 methods? See localToAbsoluteQuad below. PositionWithAffinity PositionForPoint(const LayoutPoint& point) {
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp index 26f90ac9..0f604d5 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -1277,8 +1277,10 @@ flow->LogicalLayoutOverflowRect(line_top, line_bottom); child_layout_overflow.Unite( LogicalFrameRectIncludingLineHeight(line_top, line_bottom)); - child_layout_overflow.Move( - flow->BoxModelObject().RelativePositionLogicalOffset()); + if (flow->BoxModelObject().IsRelPositioned()) { + child_layout_overflow.Move( + flow->BoxModelObject().RelativePositionLogicalOffset()); + } logical_layout_overflow.Unite(child_layout_overflow); } else { AddReplacedChildOverflow(curr, logical_layout_overflow, @@ -1504,7 +1506,7 @@ // otherwise iterate from right to left. Varying the order allows us to // correctly hide the boxes following the ellipsis. LayoutUnit relative_offset = - BoxModelObject().IsInline() + BoxModelObject().IsInline() && BoxModelObject().IsRelPositioned() ? BoxModelObject().RelativePositionLogicalOffset().Width() : LayoutUnit(); logical_left_offset += relative_offset;
diff --git a/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp b/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp index e932937..fb33179 100644 --- a/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp +++ b/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp
@@ -52,7 +52,8 @@ } else { was_script_load_successful_ = true; client_->NotifyWorkletScriptLoadingFinished( - this, ScriptSourceCode(static_cast<ScriptResource*>(resource))); + this, ScriptSourceCode(static_cast<ScriptResource*>(resource), + String() /* nonce */, kNotParserInserted)); } fetcher_ = nullptr; client_ = nullptr;
diff --git a/third_party/WebKit/Source/core/paint/BUILD.gn b/third_party/WebKit/Source/core/paint/BUILD.gn index 4709526..b99baa5 100644 --- a/third_party/WebKit/Source/core/paint/BUILD.gn +++ b/third_party/WebKit/Source/core/paint/BUILD.gn
@@ -100,8 +100,6 @@ "ListItemPainter.h", "ListMarkerPainter.cpp", "ListMarkerPainter.h", - "MediaControlsPainter.cpp", - "MediaControlsPainter.h", "MultiColumnSetPainter.cpp", "MultiColumnSetPainter.h", "NinePieceImageGrid.cpp",
diff --git a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp b/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp deleted file mode 100644 index 9c418f77..0000000 --- a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp +++ /dev/null
@@ -1,655 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. - * Copyright (C) 2009 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 "core/paint/MediaControlsPainter.h" - -#include "bindings/core/v8/ExceptionState.h" -#include "core/html/HTMLDivElement.h" -#include "core/html/HTMLMediaElement.h" -#include "core/html/TimeRanges.h" -#include "core/html/media/MediaControls.h" -#include "core/layout/LayoutBox.h" -#include "core/paint/PaintInfo.h" -#include "core/style/ComputedStyle.h" -#include "platform/graphics/Gradient.h" -#include "platform/graphics/GraphicsContext.h" - -namespace blink { - -namespace { - -const double kCurrentTimeBufferedDelta = 1.0; - -typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; -MediaControlImageMap* g_media_control_image_map = 0; - -// Slider thumb sizes, shard between time and volume. -const int kMediaSliderThumbTouchWidth = 36; // Touch zone size. -const int kMediaSliderThumbTouchHeight = 48; -const int kMediaSliderThumbPaintWidth = 12; // Painted area. -const int kMediaSliderThumbPaintHeight = 12; - -// Overlay play button size. If this changes, it must also be changed in -// core/html/shadow/MediaControls.cpp. -const int kMediaOverlayPlayButtonWidth = 48; -const int kMediaOverlayPlayButtonHeight = 48; - -// Alpha for disabled elements. -const float kDisabledAlpha = 0.4; - -const HTMLMediaElement* ToParentMediaElement(const Node* node) { - if (!node) - return nullptr; - const Node* media_node = node->OwnerShadowHost(); - if (!media_node) - return nullptr; - if (!IsHTMLMediaElement(media_node)) - return nullptr; - - return ToHTMLMediaElement(media_node); -} - -const HTMLMediaElement* ToParentMediaElement( - const LayoutObject& layout_object) { - return ToParentMediaElement(layout_object.GetNode()); -} - -} // anonymous namespace - -static Image* PlatformResource(const char* name) { - if (!g_media_control_image_map) - g_media_control_image_map = new MediaControlImageMap(); - if (Image* image = g_media_control_image_map->at(name)) - return image; - if (Image* image = Image::LoadPlatformResource(name).LeakRef()) { - g_media_control_image_map->Set(name, image); - return image; - } - NOTREACHED(); - return 0; -} - -static bool HasSource(const HTMLMediaElement* media_element) { - return media_element->getNetworkState() != HTMLMediaElement::kNetworkEmpty && - media_element->getNetworkState() != HTMLMediaElement::kNetworkNoSource; -} - -static FloatRect AdjustRectForPadding(IntRect rect, - const LayoutObject* object) { - FloatRect adjusted_rect(rect); - - if (!object) - return adjusted_rect; - - // TODO(liberato): make this more elegant, crbug.com/598861 . - if (const ComputedStyle* style = object->Style()) { - const float padding_left = style->PaddingLeft().GetFloatValue(); - const float padding_top = style->PaddingTop().GetFloatValue(); - const float padding_right = style->PaddingRight().GetFloatValue(); - const float padding_bottom = style->PaddingBottom().GetFloatValue(); - adjusted_rect = FloatRect(rect.X() + padding_left, rect.Y() + padding_top, - rect.Width() - padding_left - padding_right, - rect.Height() - padding_top - padding_bottom); - } - - return adjusted_rect; -} - -static bool PaintMediaButton(GraphicsContext& context, - const IntRect& rect, - Image* image, - const LayoutObject* object, - bool is_enabled) { - FloatRect draw_rect = AdjustRectForPadding(rect, object); - - if (!is_enabled) - context.BeginLayer(kDisabledAlpha); - - context.DrawImage(image, draw_rect); - - if (!is_enabled) - context.EndLayer(); - - return true; -} - -static bool PaintMediaButton(GraphicsContext& context, - const IntRect& rect, - Image* image, - bool is_enabled = true) { - return PaintMediaButton(context, rect, image, 0, is_enabled); -} - -bool MediaControlsPainter::PaintMediaMuteButton(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* sound_not_muted = PlatformResource("mediaplayerSoundNotMuted"); - static Image* sound_muted = PlatformResource("mediaplayerSoundMuted"); - - if (!HasSource(media_element) || !media_element->HasAudio()) { - return PaintMediaButton(paint_info.context, rect, sound_muted, &object, - false); - } - - if (media_element->muted() || media_element->volume() <= 0) - return PaintMediaButton(paint_info.context, rect, sound_muted, &object, - true); - - return PaintMediaButton(paint_info.context, rect, sound_not_muted, &object, - true); -} - -bool MediaControlsPainter::PaintMediaPlayButton(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_play = PlatformResource("mediaplayerPlay"); - static Image* media_pause = PlatformResource("mediaplayerPause"); - - // Draw the regular play button grayed out. - if (!HasSource(media_element)) - return PaintMediaButton(paint_info.context, rect, media_play, &object, - false); - - Image* image = media_element->paused() ? media_play : media_pause; - return PaintMediaButton(paint_info.context, rect, image, &object, true); -} - -bool MediaControlsPainter::PaintMediaOverlayPlayButton( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - if (!HasSource(media_element) || !media_element->paused()) - return false; - - static Image* media_overlay_play = PlatformResource("mediaplayerOverlayPlay"); - - IntRect button_rect(rect); - - // Overlay play button covers the entire player, so center and draw a - // smaller button. Center in the entire element. - // TODO(liberato): object.enclosingBox()? - const LayoutBox* box = media_element->GetLayoutObject()->EnclosingBox(); - if (!box) - return false; - int media_height = box->PixelSnappedHeight(); - - int media_panel_height = 0; - if (media_element->GetMediaControls()) { - if (LayoutObject* object = - media_element->GetMediaControls()->PanelLayoutObject()) { - if (object->IsBox()) { - media_panel_height = - AdjustLayoutUnitForAbsoluteZoom(ToLayoutBox(object)->ClientHeight(), - *ToLayoutBox(object)) - .Round(); - } - } - } - - button_rect.SetX(rect.Center().X() - kMediaOverlayPlayButtonWidth / 2); - button_rect.SetY(rect.Center().Y() - kMediaOverlayPlayButtonHeight / 2 + - (media_height - rect.Height() - media_panel_height) / 2); - button_rect.SetWidth(kMediaOverlayPlayButtonWidth); - button_rect.SetHeight(kMediaOverlayPlayButtonHeight); - - return PaintMediaButton(paint_info.context, button_rect, media_overlay_play); -} - -static void PaintRoundedSliderBackground(const IntRect& rect, - const ComputedStyle& style, - GraphicsContext& context, - Color slider_background_color) { - float border_radius = rect.Height() / 2; - FloatSize radii(border_radius, border_radius); - - context.FillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), - slider_background_color); -} - -bool MediaControlsPainter::PaintMediaRemotingCastIcon( - const LayoutObject& object, - const PaintInfo& paintInfo, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - static Image* cast_icon = PlatformResource("mediaRemotingCastIcon"); - - return PaintMediaButton(paintInfo.context, rect, cast_icon); -} - -static void PaintSliderRangeHighlight(const IntRect& rect, - const ComputedStyle& style, - GraphicsContext& context, - int start_position, - int end_position, - Color start_color, - Color end_color) { - // Calculate border radius; need to avoid being smaller than half the slider - // height because of https://bugs.webkit.org/show_bug.cgi?id=30143. - float border_radius = rect.Height() / 2.0f; - FloatSize radii(border_radius, border_radius); - - // Calculate highlight rectangle and edge dimensions. - int start_offset = start_position; - int end_offset = rect.Width() - end_position; - int range_width = end_position - start_position; - - if (range_width <= 0) - return; - - // Make sure the range width is bigger than border radius at the edges to - // retain rounded corners. - if (start_offset < border_radius && range_width < border_radius) - range_width = border_radius; - if (end_offset < border_radius && range_width < border_radius) - range_width = border_radius; - - // Set rectangle to highlight range. - IntRect highlight_rect = rect; - highlight_rect.Move(start_offset, 0); - highlight_rect.SetWidth(range_width); - - // Don't bother drawing an empty area. - if (highlight_rect.IsEmpty()) - return; - - // Calculate white-grey gradient. - FloatPoint slider_top_left = highlight_rect.Location(); - FloatPoint slider_bottom_left = slider_top_left; - slider_bottom_left.Move(0, highlight_rect.Height()); - RefPtr<Gradient> gradient = - Gradient::CreateLinear(slider_top_left, slider_bottom_left); - gradient->AddColorStop(0.0, start_color); - gradient->AddColorStop(1.0, end_color); - - // Fill highlight rectangle with gradient, potentially rounded if on left or - // right edge. - PaintFlags gradient_flags(context.FillFlags()); - gradient->ApplyToFlags(gradient_flags, SkMatrix::I()); - - if (start_offset < border_radius && end_offset < border_radius) { - context.DrawRRect( - FloatRoundedRect(highlight_rect, radii, radii, radii, radii), - gradient_flags); - } else if (start_offset < border_radius) { - context.DrawRRect(FloatRoundedRect(highlight_rect, radii, FloatSize(0, 0), - radii, FloatSize(0, 0)), - gradient_flags); - } else if (end_offset < border_radius) { - context.DrawRRect(FloatRoundedRect(highlight_rect, FloatSize(0, 0), radii, - FloatSize(0, 0), radii), - gradient_flags); - } else { - context.DrawRect(highlight_rect, gradient_flags); - } -} - -bool MediaControlsPainter::PaintMediaSlider(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - GraphicsContext& context = paint_info.context; - - // Should we paint the slider partially transparent? - bool draw_ui_grayed = !HasSource(media_element); - if (draw_ui_grayed) - context.BeginLayer(kDisabledAlpha); - - PaintMediaSliderInternal(object, paint_info, rect); - - if (draw_ui_grayed) - context.EndLayer(); - - return true; -} - -void MediaControlsPainter::PaintMediaSliderInternal(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return; - - const ComputedStyle& style = object.StyleRef(); - GraphicsContext& context = paint_info.context; - - // Paint the slider bar in the "no data buffered" state. - PaintRoundedSliderBackground(rect, style, context, Color(0xda, 0xda, 0xda)); - - // Draw the buffered range. Since the element may have multiple buffered - // ranges and it'd be distracting/'busy' to show all of them, show only the - // buffered range containing the current play head. - TimeRanges* buffered_time_ranges = media_element->buffered(); - float duration = media_element->duration(); - float current_time = media_element->currentTime(); - if (std::isnan(duration) || std::isinf(duration) || !duration || - std::isnan(current_time)) - return; - - for (unsigned i = 0; i < buffered_time_ranges->length(); ++i) { - float start = buffered_time_ranges->start(i, ASSERT_NO_EXCEPTION); - float end = buffered_time_ranges->end(i, ASSERT_NO_EXCEPTION); - // The delta is there to avoid corner cases when buffered - // ranges is out of sync with current time because of - // asynchronous media pipeline and current time caching in - // HTMLMediaElement. - // This is related to https://www.w3.org/Bugs/Public/show_bug.cgi?id=28125 - // FIXME: Remove this workaround when WebMediaPlayer - // has an asynchronous pause interface. - if (std::isnan(start) || std::isnan(end) || - start > current_time + kCurrentTimeBufferedDelta || end < current_time) - continue; - int start_position = int(start * rect.Width() / duration); - int current_position = int(current_time * rect.Width() / duration); - int end_position = int(end * rect.Width() / duration); - - // Draw highlight before current time. - Color start_color = Color(0x42, 0x85, 0xf4); - Color end_color = Color(0x42, 0x85, 0xf4); - - if (current_position > start_position) { - PaintSliderRangeHighlight(rect, style, context, start_position, - current_position, start_color, end_color); - } - - // Draw dark grey highlight after current time. - start_color = end_color = Color(0x5a, 0x5a, 0x5a); - - if (end_position > current_position) { - PaintSliderRangeHighlight(rect, style, context, current_position, - end_position, start_color, end_color); - } - return; - } -} - -void MediaControlsPainter::AdjustMediaSliderThumbPaintSize( - const IntRect& rect, - const ComputedStyle& style, - IntRect& rect_out) { - // Adjust the rectangle to be centered, the right size for the image. - // We do this because it's quite hard to get the thumb touch target - // to match. So, we provide the touch target size with - // adjustMediaSliderThumbSize(), and scale it back when we paint. - rect_out = rect; - - const float zoom_level = style.EffectiveZoom(); - const float zoomed_paint_width = kMediaSliderThumbPaintWidth * zoom_level; - const float zoomed_paint_height = kMediaSliderThumbPaintHeight * zoom_level; - - rect_out.SetX(rect.Center().X() - zoomed_paint_width / 2); - rect_out.SetY(rect.Center().Y() - zoomed_paint_height / 2); - rect_out.SetWidth(zoomed_paint_width); - rect_out.SetHeight(zoomed_paint_height); -} - -bool MediaControlsPainter::PaintMediaSliderThumb(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - if (!object.GetNode()) - return false; - - const HTMLMediaElement* media_element = - ToParentMediaElement(object.GetNode()->OwnerShadowHost()); - if (!media_element) - return false; - - if (!HasSource(media_element)) - return true; - - static Image* media_slider_thumb = PlatformResource("mediaplayerSliderThumb"); - IntRect paint_rect; - const ComputedStyle& style = object.StyleRef(); - AdjustMediaSliderThumbPaintSize(rect, style, paint_rect); - return PaintMediaButton(paint_info.context, paint_rect, media_slider_thumb); -} - -bool MediaControlsPainter::PaintMediaVolumeSlider(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - GraphicsContext& context = paint_info.context; - const ComputedStyle& style = object.StyleRef(); - - // Paint the slider bar. - PaintRoundedSliderBackground(rect, style, context, Color(0x5a, 0x5a, 0x5a)); - - // Calculate volume position for white background rectangle. - float volume = media_element->volume(); - if (std::isnan(volume) || volume < 0) - return true; - if (volume > 1) - volume = 1; - if (!HasSource(media_element) || !media_element->HasAudio() || - media_element->muted()) { - volume = 0; - } - - // Calculate the position relative to the center of the thumb. - const float fill_width = volume * rect.Width(); - static const Color kColor = Color(0x42, 0x85, 0xf4); // blue - PaintSliderRangeHighlight(rect, style, context, 0.0, fill_width, kColor, - kColor); - - return true; -} - -bool MediaControlsPainter::PaintMediaVolumeSliderThumb( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - if (!object.GetNode()) - return false; - - const HTMLMediaElement* media_element = - ToParentMediaElement(object.GetNode()->OwnerShadowHost()); - if (!media_element) - return false; - - if (!HasSource(media_element) || !media_element->HasAudio()) - return true; - - static Image* media_volume_slider_thumb = - PlatformResource("mediaplayerVolumeSliderThumb"); - - IntRect paint_rect; - const ComputedStyle& style = object.StyleRef(); - AdjustMediaSliderThumbPaintSize(rect, style, paint_rect); - return PaintMediaButton(paint_info.context, paint_rect, - media_volume_slider_thumb); -} - -bool MediaControlsPainter::PaintMediaFullscreenButton( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_enter_fullscreen_button = - PlatformResource("mediaplayerEnterFullscreen"); - static Image* media_exit_fullscreen_button = - PlatformResource("mediaplayerExitFullscreen"); - - Image* image = media_element->IsFullscreen() ? media_exit_fullscreen_button - : media_enter_fullscreen_button; - const bool is_enabled = HasSource(media_element); - return PaintMediaButton(paint_info.context, rect, image, &object, is_enabled); -} - -bool MediaControlsPainter::PaintMediaToggleClosedCaptionsButton( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_closed_caption_button = - PlatformResource("mediaplayerClosedCaption"); - static Image* media_closed_caption_button_disabled = - PlatformResource("mediaplayerClosedCaptionDisabled"); - - Image* image = media_element->TextTracksVisible() - ? media_closed_caption_button - : media_closed_caption_button_disabled; - const bool is_enabled = media_element->HasClosedCaptions(); - return PaintMediaButton(paint_info.context, rect, image, &object, is_enabled); -} - -bool MediaControlsPainter::PaintMediaCastButton(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_cast_on = PlatformResource("mediaplayerCastOn"); - static Image* media_cast_off = PlatformResource("mediaplayerCastOff"); - // To ensure that the overlaid cast button is visible when overlaid on pale - // videos we use a different version of it for the overlaid case with a - // semi-opaque background. - static Image* media_overlay_cast_off = - PlatformResource("mediaplayerOverlayCastOff"); - - bool is_enabled = media_element->HasRemoteRoutes(); - bool playing_remotely = media_element->IsPlayingRemotely(); - bool native_controls = media_element->ShouldShowControls(); - - if (playing_remotely) { - if (native_controls) { - return PaintMediaButton(paint_info.context, rect, media_cast_on, &object, - is_enabled); - } - return PaintMediaButton(paint_info.context, rect, media_cast_on); - } - - if (native_controls) { - return PaintMediaButton(paint_info.context, rect, media_cast_off, &object, - is_enabled); - } - - return PaintMediaButton(paint_info.context, rect, media_overlay_cast_off); -} - -bool MediaControlsPainter::PaintMediaTrackSelectionCheckmark( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_track_selection_checkmark = - PlatformResource("mediaplayerTrackSelectionCheckmark"); - return PaintMediaButton(paint_info.context, rect, - media_track_selection_checkmark); -} - -bool MediaControlsPainter::PaintMediaClosedCaptionsIcon( - const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_closed_captions_icon = - PlatformResource("mediaplayerClosedCaptionsIcon"); - return PaintMediaButton(paint_info.context, rect, media_closed_captions_icon); -} - -bool MediaControlsPainter::PaintMediaSubtitlesIcon(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_subtitles_icon = - PlatformResource("mediaplayerSubtitlesIcon"); - return PaintMediaButton(paint_info.context, rect, media_subtitles_icon); -} - -bool MediaControlsPainter::PaintMediaOverflowMenu(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - static Image* media_overflow_button = - PlatformResource("mediaplayerOverflowMenu"); - return PaintMediaButton(paint_info.context, rect, media_overflow_button, - &object, true); -} - -bool MediaControlsPainter::PaintMediaDownloadIcon(const LayoutObject& object, - const PaintInfo& paint_info, - const IntRect& rect) { - const HTMLMediaElement* media_element = ToParentMediaElement(object); - if (!media_element) - return false; - - bool is_enabled = HasSource(media_element); - - static Image* media_download_icon = - PlatformResource("mediaplayerDownloadIcon"); - return PaintMediaButton(paint_info.context, rect, media_download_icon, - &object, is_enabled); -} - -void MediaControlsPainter::AdjustMediaSliderThumbSize(ComputedStyle& style) { - const float zoom_level = style.EffectiveZoom(); - - style.SetWidth(Length( - static_cast<int>(kMediaSliderThumbTouchWidth * zoom_level), kFixed)); - style.SetHeight(Length( - static_cast<int>(kMediaSliderThumbTouchHeight * zoom_level), kFixed)); -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/MediaControlsPainter.h b/third_party/WebKit/Source/core/paint/MediaControlsPainter.h deleted file mode 100644 index 2784624..0000000 --- a/third_party/WebKit/Source/core/paint/MediaControlsPainter.h +++ /dev/null
@@ -1,106 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. - * Copyright (C) 2009 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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. - */ - -#ifndef MediaControlsPainter_h -#define MediaControlsPainter_h - -#include "platform/wtf/Allocator.h" - -namespace blink { - -struct PaintInfo; - -class ComputedStyle; -class IntRect; -class LayoutObject; - -class MediaControlsPainter { - STATIC_ONLY(MediaControlsPainter); - - public: - static bool PaintMediaMuteButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaPlayButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaToggleClosedCaptionsButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaSlider(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaSliderThumb(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaVolumeSlider(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaVolumeSliderThumb(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaFullscreenButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaOverlayPlayButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaCastButton(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaTrackSelectionCheckmark(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaClosedCaptionsIcon(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaSubtitlesIcon(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaOverflowMenu(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static bool PaintMediaDownloadIcon(const LayoutObject&, - const PaintInfo&, - const IntRect&); - static void AdjustMediaSliderThumbSize(ComputedStyle&); - static bool PaintMediaRemotingCastIcon(const LayoutObject&, - const PaintInfo&, - const IntRect&); - - private: - static void AdjustMediaSliderThumbPaintSize(const IntRect&, - const ComputedStyle&, - IntRect& rect_out); - static void PaintMediaSliderInternal(const LayoutObject&, - const PaintInfo&, - const IntRect&); -}; - -} // namespace blink - -#endif // MediaControlsPainter_h
diff --git a/third_party/WebKit/Source/core/paint/ThemePainter.cpp b/third_party/WebKit/Source/core/paint/ThemePainter.cpp index c11abe2..c97924d 100644 --- a/third_party/WebKit/Source/core/paint/ThemePainter.cpp +++ b/third_party/WebKit/Source/core/paint/ThemePainter.cpp
@@ -32,7 +32,6 @@ #include "core/html/shadow/ShadowElementNames.h" #include "core/layout/LayoutTheme.h" #include "core/layout/LayoutView.h" -#include "core/paint/MediaControlsPainter.h" #include "core/paint/PaintInfo.h" #include "core/style/ComputedStyle.h" #include "platform/Theme.h" @@ -112,47 +111,27 @@ return PaintSliderThumb(o, paint_info, r); case kMediaEnterFullscreenButtonPart: case kMediaExitFullscreenButtonPart: - return MediaControlsPainter::PaintMediaFullscreenButton(o, paint_info, r); case kMediaPlayButtonPart: - return MediaControlsPainter::PaintMediaPlayButton(o, paint_info, r); case kMediaOverlayPlayButtonPart: - return MediaControlsPainter::PaintMediaOverlayPlayButton(o, paint_info, - r); case kMediaMuteButtonPart: - return MediaControlsPainter::PaintMediaMuteButton(o, paint_info, r); case kMediaToggleClosedCaptionsButtonPart: - return MediaControlsPainter::PaintMediaToggleClosedCaptionsButton( - o, paint_info, r); case kMediaSliderPart: - return MediaControlsPainter::PaintMediaSlider(o, paint_info, r); case kMediaSliderThumbPart: - return MediaControlsPainter::PaintMediaSliderThumb(o, paint_info, r); case kMediaVolumeSliderContainerPart: - return true; case kMediaVolumeSliderPart: - return MediaControlsPainter::PaintMediaVolumeSlider(o, paint_info, r); case kMediaVolumeSliderThumbPart: - return MediaControlsPainter::PaintMediaVolumeSliderThumb(o, paint_info, - r); case kMediaTimeRemainingPart: case kMediaCurrentTimePart: case kMediaControlsBackgroundPart: - return true; case kMediaCastOffButtonPart: case kMediaOverlayCastOffButtonPart: - return MediaControlsPainter::PaintMediaCastButton(o, paint_info, r); case kMediaTrackSelectionCheckmarkPart: - return MediaControlsPainter::PaintMediaTrackSelectionCheckmark( - o, paint_info, r); case kMediaClosedCaptionsIconPart: - return MediaControlsPainter::PaintMediaClosedCaptionsIcon(o, paint_info, - r); case kMediaSubtitlesIconPart: - return MediaControlsPainter::PaintMediaSubtitlesIcon(o, paint_info, r); case kMediaOverflowMenuButtonPart: - return MediaControlsPainter::PaintMediaOverflowMenu(o, paint_info, r); + case kMediaRemotingCastIconPart: case kMediaDownloadIconPart: - return MediaControlsPainter::PaintMediaDownloadIcon(o, paint_info, r); + return true; case kMenulistButtonPart: case kTextFieldPart: case kTextAreaPart: @@ -161,8 +140,6 @@ return PaintSearchField(o, paint_info, r); case kSearchFieldCancelButtonPart: return PaintSearchFieldCancelButton(o, paint_info, r); - case kMediaRemotingCastIconPart: - return MediaControlsPainter::PaintMediaRemotingCastIcon(o, paint_info, r); default: break; }
diff --git a/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp b/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp index 33ed7d8..b0716b77 100644 --- a/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp +++ b/third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp
@@ -28,7 +28,6 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutProgress.h" #include "core/layout/LayoutThemeDefault.h" -#include "core/paint/MediaControlsPainter.h" #include "core/paint/PaintInfo.h" #include "platform/LayoutTestSupport.h" #include "platform/graphics/Color.h"
diff --git a/third_party/WebKit/Source/core/workers/BUILD.gn b/third_party/WebKit/Source/core/workers/BUILD.gn index 4a01246..a4aaef1 100644 --- a/third_party/WebKit/Source/core/workers/BUILD.gn +++ b/third_party/WebKit/Source/core/workers/BUILD.gn
@@ -12,14 +12,14 @@ "DedicatedWorkerGlobalScope.h", "DedicatedWorkerMessagingProxy.cpp", "DedicatedWorkerMessagingProxy.h", + "DedicatedWorkerObjectProxy.cpp", + "DedicatedWorkerObjectProxy.h", "DedicatedWorkerThread.cpp", "DedicatedWorkerThread.h", "GlobalScopeCreationParams.cpp", "GlobalScopeCreationParams.h", "InProcessWorkerBase.cpp", "InProcessWorkerBase.h", - "InProcessWorkerObjectProxy.cpp", - "InProcessWorkerObjectProxy.h", "InstalledScriptsManager.cpp", "InstalledScriptsManager.h", "MainThreadWorkletGlobalScope.cpp",
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp index 19c06e3..176c78b 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp
@@ -36,9 +36,9 @@ #include "core/dom/ExecutionContext.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/origin_trials/OriginTrialContext.h" +#include "core/workers/DedicatedWorkerObjectProxy.h" #include "core/workers/DedicatedWorkerThread.h" #include "core/workers/GlobalScopeCreationParams.h" -#include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerClients.h" #include "platform/bindings/ScriptState.h" @@ -98,7 +98,7 @@ std::move(channels)); } -InProcessWorkerObjectProxy& DedicatedWorkerGlobalScope::WorkerObjectProxy() +DedicatedWorkerObjectProxy& DedicatedWorkerGlobalScope::WorkerObjectProxy() const { return static_cast<DedicatedWorkerThread*>(GetThread())->WorkerObjectProxy(); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h index 981df32..bf5acdc1 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h
@@ -39,8 +39,8 @@ namespace blink { +class DedicatedWorkerObjectProxy; class DedicatedWorkerThread; -class InProcessWorkerObjectProxy; class ScriptState; struct GlobalScopeCreationParams; @@ -81,7 +81,7 @@ std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); - InProcessWorkerObjectProxy& WorkerObjectProxy() const; + DedicatedWorkerObjectProxy& WorkerObjectProxy() const; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp index 8c7bdbb..741ef21 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp
@@ -12,10 +12,10 @@ #include "core/events/MessageEvent.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/origin_trials/OriginTrialContext.h" +#include "core/workers/DedicatedWorkerObjectProxy.h" #include "core/workers/DedicatedWorkerThread.h" #include "core/workers/GlobalScopeCreationParams.h" #include "core/workers/InProcessWorkerBase.h" -#include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerInspectorProxy.h" #include "platform/CrossThreadFunctional.h" @@ -36,7 +36,7 @@ : ThreadedMessagingProxyBase(execution_context, worker_clients), worker_object_(worker_object) { worker_object_proxy_ = - InProcessWorkerObjectProxy::Create(this, GetParentFrameTaskRunners()); + DedicatedWorkerObjectProxy::Create(this, GetParentFrameTaskRunners()); } DedicatedWorkerMessagingProxy::~DedicatedWorkerMessagingProxy() = default; @@ -86,7 +86,7 @@ if (GetWorkerThread()) { WTF::CrossThreadClosure task = CrossThreadBind( - &InProcessWorkerObjectProxy::ProcessMessageFromWorkerObject, + &DedicatedWorkerObjectProxy::ProcessMessageFromWorkerObject, CrossThreadUnretained(&WorkerObjectProxy()), std::move(message), WTF::Passed(std::move(channels)), CrossThreadUnretained(GetWorkerThread())); @@ -104,7 +104,7 @@ for (auto& queued_task : queued_early_tasks_) { WTF::CrossThreadClosure task = CrossThreadBind( - &InProcessWorkerObjectProxy::ProcessMessageFromWorkerObject, + &DedicatedWorkerObjectProxy::ProcessMessageFromWorkerObject, CrossThreadUnretained(&WorkerObjectProxy()), std::move(queued_task.message), WTF::Passed(std::move(queued_task.channels)), @@ -158,7 +158,7 @@ TaskRunnerHelper::Get(TaskType::kDOMManipulation, GetWorkerThread()) ->PostTask(BLINK_FROM_HERE, CrossThreadBind( - &InProcessWorkerObjectProxy::ProcessUnhandledException, + &DedicatedWorkerObjectProxy::ProcessUnhandledException, CrossThreadUnretained(worker_object_proxy_.get()), exception_id, CrossThreadUnretained(GetWorkerThread()))); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h index 28a26489..3220d37 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h
@@ -17,13 +17,14 @@ namespace blink { +class DedicatedWorkerObjectProxy; class InProcessWorkerBase; -class InProcessWorkerObjectProxy; class SerializedScriptValue; class WorkerClients; -// TODO(nhiroki): Add the class-level comment once -// InProcessWorker->DedicatedWorker move is done (https://crbug.com/688116). +// A proxy class to talk to the DedicatedWorkerGlobalScope on a worker thread +// via the DedicatedWorkerMessagingProxy from the main thread. See class +// comments on ThreadedMessagingProxyBase for the lifetime and thread affinity. class CORE_EXPORT DedicatedWorkerMessagingProxy : public ThreadedMessagingProxyBase { WTF_MAKE_NONCOPYABLE(DedicatedWorkerMessagingProxy); @@ -48,14 +49,14 @@ bool HasPendingActivity() const; // These methods come from worker context thread via - // InProcessWorkerObjectProxy and are called on the parent context thread. + // DedicatedWorkerObjectProxy and are called on the parent context thread. void PostMessageToWorkerObject(RefPtr<SerializedScriptValue>, Vector<MessagePortChannel>); void DispatchErrorEvent(const String& error_message, std::unique_ptr<SourceLocation>, int exception_id); - InProcessWorkerObjectProxy& WorkerObjectProxy() { + DedicatedWorkerObjectProxy& WorkerObjectProxy() { return *worker_object_proxy_.get(); } @@ -69,7 +70,7 @@ std::unique_ptr<WorkerThread> CreateWorkerThread() override; - std::unique_ptr<InProcessWorkerObjectProxy> worker_object_proxy_; + std::unique_ptr<DedicatedWorkerObjectProxy> worker_object_proxy_; // This must be weak. The base class (i.e., ThreadedMessagingProxyBase) has a // strong persistent reference to itself via SelfKeepAlive (see class-level
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.cpp similarity index 86% rename from third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp rename to third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.cpp index eee1b63..2ea4b9f 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/workers/InProcessWorkerObjectProxy.h" +#include "core/workers/DedicatedWorkerObjectProxy.h" #include <memory> #include "bindings/core/v8/SourceLocation.h" @@ -50,17 +50,17 @@ namespace blink { -std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::Create( +std::unique_ptr<DedicatedWorkerObjectProxy> DedicatedWorkerObjectProxy::Create( DedicatedWorkerMessagingProxy* messaging_proxy_weak_ptr, ParentFrameTaskRunners* parent_frame_task_runners) { DCHECK(messaging_proxy_weak_ptr); - return WTF::WrapUnique(new InProcessWorkerObjectProxy( + return WTF::WrapUnique(new DedicatedWorkerObjectProxy( messaging_proxy_weak_ptr, parent_frame_task_runners)); } -InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {} +DedicatedWorkerObjectProxy::~DedicatedWorkerObjectProxy() {} -void InProcessWorkerObjectProxy::PostMessageToWorkerObject( +void DedicatedWorkerObjectProxy::PostMessageToWorkerObject( RefPtr<SerializedScriptValue> message, Vector<MessagePortChannel> channels) { GetParentFrameTaskRunners() @@ -72,7 +72,7 @@ WTF::Passed(std::move(channels)))); } -void InProcessWorkerObjectProxy::ProcessMessageFromWorkerObject( +void DedicatedWorkerObjectProxy::ProcessMessageFromWorkerObject( RefPtr<SerializedScriptValue> message, Vector<MessagePortChannel> channels, WorkerThread* worker_thread) { @@ -83,7 +83,7 @@ global_scope->DispatchEvent(MessageEvent::Create(ports, std::move(message))); } -void InProcessWorkerObjectProxy::ProcessUnhandledException( +void DedicatedWorkerObjectProxy::ProcessUnhandledException( int exception_id, WorkerThread* worker_thread) { WorkerGlobalScope* global_scope = @@ -91,7 +91,7 @@ global_scope->ExceptionUnhandled(exception_id); } -void InProcessWorkerObjectProxy::ReportException( +void DedicatedWorkerObjectProxy::ReportException( const String& error_message, std::unique_ptr<SourceLocation> location, int exception_id) { @@ -104,24 +104,24 @@ WTF::Passed(location->Clone()), exception_id)); } -void InProcessWorkerObjectProxy::DidCreateWorkerGlobalScope( +void DedicatedWorkerObjectProxy::DidCreateWorkerGlobalScope( WorkerOrWorkletGlobalScope* global_scope) { DCHECK(!worker_global_scope_); worker_global_scope_ = ToWorkerGlobalScope(global_scope); } -void InProcessWorkerObjectProxy::WillDestroyWorkerGlobalScope() { +void DedicatedWorkerObjectProxy::WillDestroyWorkerGlobalScope() { worker_global_scope_ = nullptr; } -InProcessWorkerObjectProxy::InProcessWorkerObjectProxy( +DedicatedWorkerObjectProxy::DedicatedWorkerObjectProxy( DedicatedWorkerMessagingProxy* messaging_proxy_weak_ptr, ParentFrameTaskRunners* parent_frame_task_runners) : ThreadedObjectProxyBase(parent_frame_task_runners), messaging_proxy_weak_ptr_(messaging_proxy_weak_ptr) {} CrossThreadWeakPersistent<ThreadedMessagingProxyBase> -InProcessWorkerObjectProxy::MessagingProxyWeakPtr() { +DedicatedWorkerObjectProxy::MessagingProxyWeakPtr() { return messaging_proxy_weak_ptr_; }
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.h similarity index 81% rename from third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h rename to third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.h index 551fdaf..2e62dbb7 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerObjectProxy.h
@@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef InProcessWorkerObjectProxy_h -#define InProcessWorkerObjectProxy_h +#ifndef DedicatedWorkerObjectProxy_h +#define DedicatedWorkerObjectProxy_h #include <memory> #include "core/CoreExport.h" @@ -49,20 +49,18 @@ class WorkerOrWorkletGlobalScope; class WorkerThread; -// A proxy to talk to the parent worker object. See class comments on -// ThreadedObjectProxyBase.h for lifetime of this class etc. -// -// This also checks pending activities on WorkerGlobalScope and reports a result -// to the message proxy when an exponential backoff timer is fired. -class CORE_EXPORT InProcessWorkerObjectProxy : public ThreadedObjectProxyBase { - USING_FAST_MALLOC(InProcessWorkerObjectProxy); - WTF_MAKE_NONCOPYABLE(InProcessWorkerObjectProxy); +// A proxy class to talk to a Worker object on the main thread via the +// DedicatedWorkerMessagingProxy from a worker thread. See class comments on +// ThreadedObjectProxyBase.h for the lifetime and thread affinity. +class CORE_EXPORT DedicatedWorkerObjectProxy : public ThreadedObjectProxyBase { + USING_FAST_MALLOC(DedicatedWorkerObjectProxy); + WTF_MAKE_NONCOPYABLE(DedicatedWorkerObjectProxy); public: - static std::unique_ptr<InProcessWorkerObjectProxy> Create( + static std::unique_ptr<DedicatedWorkerObjectProxy> Create( DedicatedWorkerMessagingProxy*, ParentFrameTaskRunners*); - ~InProcessWorkerObjectProxy() override; + ~DedicatedWorkerObjectProxy() override; void PostMessageToWorkerObject(RefPtr<SerializedScriptValue>, Vector<MessagePortChannel>); @@ -79,14 +77,14 @@ void WillDestroyWorkerGlobalScope() override; protected: - InProcessWorkerObjectProxy(DedicatedWorkerMessagingProxy*, + DedicatedWorkerObjectProxy(DedicatedWorkerMessagingProxy*, ParentFrameTaskRunners*); CrossThreadWeakPersistent<ThreadedMessagingProxyBase> MessagingProxyWeakPtr() final; private: - friend class InProcessWorkerObjectProxyForTest; + friend class DedicatedWorkerObjectProxyForTest; // No guarantees about the lifetimes of tasks posted by this proxy wrt the // DedicatedWorkerMessagingProxy so a weak pointer must be used when posting @@ -99,4 +97,4 @@ } // namespace blink -#endif // InProcessWorkerObjectProxy_h +#endif // DedicatedWorkerObjectProxy_h
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp index 57d67667..7ce78e2 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
@@ -10,9 +10,9 @@ #include "core/testing/DummyPageHolder.h" #include "core/workers/DedicatedWorkerGlobalScope.h" #include "core/workers/DedicatedWorkerMessagingProxy.h" +#include "core/workers/DedicatedWorkerObjectProxy.h" #include "core/workers/DedicatedWorkerThread.h" #include "core/workers/GlobalScopeCreationParams.h" -#include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerBackingThreadStartupData.h" #include "core/workers/WorkerInspectorProxy.h" #include "core/workers/WorkerThread.h" @@ -26,7 +26,7 @@ class DedicatedWorkerThreadForTest final : public DedicatedWorkerThread { public: - DedicatedWorkerThreadForTest(InProcessWorkerObjectProxy& worker_object_proxy) + DedicatedWorkerThreadForTest(DedicatedWorkerObjectProxy& worker_object_proxy) : DedicatedWorkerThread(nullptr /* ThreadableLoadingContext */, worker_object_proxy) { worker_backing_thread_ = WorkerBackingThread::CreateForTest("Test thread"); @@ -75,27 +75,27 @@ } }; -class InProcessWorkerObjectProxyForTest final - : public InProcessWorkerObjectProxy { +class DedicatedWorkerObjectProxyForTest final + : public DedicatedWorkerObjectProxy { public: - InProcessWorkerObjectProxyForTest( + DedicatedWorkerObjectProxyForTest( DedicatedWorkerMessagingProxy* messaging_proxy, ParentFrameTaskRunners* parent_frame_task_runners) - : InProcessWorkerObjectProxy(messaging_proxy, parent_frame_task_runners), + : DedicatedWorkerObjectProxy(messaging_proxy, parent_frame_task_runners), reported_features_(static_cast<int>(WebFeature::kNumberOfFeatures)) {} void CountFeature(WebFeature feature) override { // Any feature should be reported only one time. EXPECT_FALSE(reported_features_.QuickGet(static_cast<int>(feature))); reported_features_.QuickSet(static_cast<int>(feature)); - InProcessWorkerObjectProxy::CountFeature(feature); + DedicatedWorkerObjectProxy::CountFeature(feature); } void CountDeprecation(WebFeature feature) override { // Any feature should be reported only one time. EXPECT_FALSE(reported_features_.QuickGet(static_cast<int>(feature))); reported_features_.QuickSet(static_cast<int>(feature)); - InProcessWorkerObjectProxy::CountDeprecation(feature); + DedicatedWorkerObjectProxy::CountDeprecation(feature); } private: @@ -109,7 +109,7 @@ : DedicatedWorkerMessagingProxy(execution_context, nullptr /* workerObject */, nullptr /* workerClients */) { - worker_object_proxy_ = WTF::MakeUnique<InProcessWorkerObjectProxyForTest>( + worker_object_proxy_ = WTF::MakeUnique<DedicatedWorkerObjectProxyForTest>( this, GetParentFrameTaskRunners()); } @@ -229,7 +229,7 @@ EXPECT_TRUE(UseCounter::IsCounted(GetDocument(), kFeature1)); // API use should be reported to the Document only one time. See comments in - // InProcessWorkerObjectProxyForTest::CountFeature. + // DedicatedWorkerObjectProxyForTest::CountFeature. TaskRunnerHelper::Get(TaskType::kUnspecedTimer, GetWorkerThread()) ->PostTask( BLINK_FROM_HERE, @@ -252,7 +252,7 @@ EXPECT_TRUE(UseCounter::IsCounted(GetDocument(), kFeature2)); // API use should be reported to the Document only one time. See comments in - // InProcessWorkerObjectProxyForTest::CountDeprecation. + // DedicatedWorkerObjectProxyForTest::CountDeprecation. TaskRunnerHelper::Get(TaskType::kUnspecedTimer, GetWorkerThread()) ->PostTask( BLINK_FROM_HERE,
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp index f2a9abe..bab26ab 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp
@@ -33,8 +33,8 @@ #include <memory> #include "core/workers/DedicatedWorkerGlobalScope.h" +#include "core/workers/DedicatedWorkerObjectProxy.h" #include "core/workers/GlobalScopeCreationParams.h" -#include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerBackingThread.h" #include "platform/wtf/PtrUtil.h" @@ -42,14 +42,14 @@ std::unique_ptr<DedicatedWorkerThread> DedicatedWorkerThread::Create( ThreadableLoadingContext* loading_context, - InProcessWorkerObjectProxy& worker_object_proxy) { + DedicatedWorkerObjectProxy& worker_object_proxy) { return WTF::WrapUnique( new DedicatedWorkerThread(loading_context, worker_object_proxy)); } DedicatedWorkerThread::DedicatedWorkerThread( ThreadableLoadingContext* loading_context, - InProcessWorkerObjectProxy& worker_object_proxy) + DedicatedWorkerObjectProxy& worker_object_proxy) : WorkerThread(loading_context, worker_object_proxy), worker_backing_thread_( WorkerBackingThread::Create("DedicatedWorker Thread")),
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h index a0bccd4..7bccc3e9 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
@@ -35,33 +35,33 @@ namespace blink { -class InProcessWorkerObjectProxy; +class DedicatedWorkerObjectProxy; struct GlobalScopeCreationParams; class CORE_EXPORT DedicatedWorkerThread : public WorkerThread { public: static std::unique_ptr<DedicatedWorkerThread> Create( ThreadableLoadingContext*, - InProcessWorkerObjectProxy&); + DedicatedWorkerObjectProxy&); ~DedicatedWorkerThread() override; WorkerBackingThread& GetWorkerBackingThread() override { return *worker_backing_thread_; } void ClearWorkerBackingThread() override; - InProcessWorkerObjectProxy& WorkerObjectProxy() const { + DedicatedWorkerObjectProxy& WorkerObjectProxy() const { return worker_object_proxy_; } private: friend class DedicatedWorkerThreadForTest; - DedicatedWorkerThread(ThreadableLoadingContext*, InProcessWorkerObjectProxy&); + DedicatedWorkerThread(ThreadableLoadingContext*, DedicatedWorkerObjectProxy&); WorkerOrWorkletGlobalScope* CreateWorkerGlobalScope( std::unique_ptr<GlobalScopeCreationParams>) override; std::unique_ptr<WorkerBackingThread> worker_backing_thread_; - InProcessWorkerObjectProxy& worker_object_proxy_; + DedicatedWorkerObjectProxy& worker_object_proxy_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h b/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h index cf597dc..1e4fda2 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h +++ b/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
@@ -15,10 +15,10 @@ class ParentFrameTaskRunners; class ThreadedMessagingProxyBase; -// A proxy to talk to the parent object. This object is created and destroyed on -// the main thread, and used on the worker thread for proxying messages to the -// ThreadedMessagingProxyBase on the main thread. ThreadedMessagingProxyBase -// always outlives this proxy. +// The base proxy class to talk to a Worker or *Worklet object on the main +// thread via the ThreadedMessagingProxyBase from a worker thread. This is +// created and destroyed on the main thread, and used on the worker thread. +// ThreadedMessagingProxyBase always outlives this proxy. class CORE_EXPORT ThreadedObjectProxyBase : public WorkerReportingProxy { USING_FAST_MALLOC(ThreadedObjectProxyBase); WTF_MAKE_NONCOPYABLE(ThreadedObjectProxyBase);
diff --git a/third_party/WebKit/Source/devtools/front_end/help/features.txt b/third_party/WebKit/Source/devtools/front_end/help/features.txt deleted file mode 100644 index feab1dad..0000000 --- a/third_party/WebKit/Source/devtools/front_end/help/features.txt +++ /dev/null
@@ -1 +0,0 @@ -Full-size screenshots in Device Mode.
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/concatenate_protocols.js b/third_party/WebKit/Source/devtools/scripts/gulp/concatenate_protocols.js deleted file mode 100644 index 44beb81..0000000 --- a/third_party/WebKit/Source/devtools/scripts/gulp/concatenate_protocols.js +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var path = require('path'); - -var jsonfile = require('jsonfile'); - -var utils = require('../utils'); - -module.exports = function main(protocols, output) { - var domains = []; - var version; - for (var i = 0; i < protocols.length; i++) { - var protocol = protocols[i]; - if (!utils.isFile(protocol)) - throw new Error(`Cannot find ${protocol}`); - var json = require(protocol); - domains = domains.concat(json.domains); - version = json.version; - } - var combinedProtocol = {version, domains}; - jsonfile.writeFileSync(output, combinedProtocol, {spaces: 4}); -};
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js b/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js deleted file mode 100644 index 5bd65d9..0000000 --- a/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js +++ /dev/null
@@ -1,141 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var childProcess = require('child_process'); -var fs = require('fs'); -var path = require('path'); -var shell = childProcess.execSync; - -var del = require('del'); -var fsPromise = require('fs-promise'); -var gulp = require('gulp'); - -var concatenateProtocols = require('./concatenate_protocols.js'); -var utils = require('../utils.js'); - -var devtoolsPath = path.resolve(path.join(__dirname, '../..')); -var frontendPath = path.join(devtoolsPath, 'front_end'); -var releasePath = path.join(devtoolsPath, 'release'); -var scriptsPath = path.join(devtoolsPath, 'scripts'); - -gulp.task('default', ['build']); - -gulp.task('clean', cleanTask); -function cleanTask() { - del.sync([releasePath], {force: true}); - fs.mkdirSync(releasePath); -} - -gulp.task( - 'build', - ['generateProtocol', 'generateSupportedCSSProperties', 'generateDevtoolsExtensionAPI', 'copyDevtoolsFiles'], - buildTask); -function buildTask() { - var script = path.join(scriptsPath, 'build', 'build_release_applications.py'); - var args = [ - 'inspector', - 'toolbox', - 'formatter_worker', - 'heap_snapshot_worker', - '--input_path', - frontendPath, - '--output_path', - releasePath, - ]; - runPythonScript(script, args); -} - -gulp.task('generateProtocol', ['concatenateProtocol'], generateProtocolTask); -function generateProtocolTask() { - var script = path.join(scriptsPath, 'build', 'code_generator_frontend.py'); - var args = [ - path.join(releasePath, 'protocol.json'), - '--output_js_dir', - releasePath, - ]; - runPythonScript(script, args); - del.sync( - [ - path.join(releasePath, 'browser_protocol.json'), - path.join(releasePath, 'js_protocol.json'), - path.join(releasePath, 'protocol.json'), - ], - {force: true}); -} - -gulp.task('concatenateProtocol', ['fetchProtocol'], concatenateProtocolTask); -function concatenateProtocolTask() { - var protocols = [ - path.join(releasePath, 'browser_protocol.json'), - path.join(releasePath, 'js_protocol.json'), - ]; - var output = path.join(releasePath, 'protocol.json'); - concatenateProtocols(protocols, output); -} - -gulp.task('fetchProtocol', ['clean'], fetchProtocolTask); -function fetchProtocolTask(done) { - var browserProtocolURL = - 'https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT'; - var browserProtocolFile = path.join(releasePath, 'browser_protocol.json'); - var browserProtocolPromise = fetchAndSaveCodePromise(browserProtocolURL, browserProtocolFile); - - var jsProtocolURL = 'https://chromium.googlesource.com/v8/v8/+/master/src/inspector/js_protocol.json?format=TEXT'; - var jsProtocolFile = path.join(releasePath, 'js_protocol.json'); - var jsProtocolPromise = fetchAndSaveCodePromise(jsProtocolURL, jsProtocolFile); - - Promise.all([browserProtocolPromise, jsProtocolPromise]) - .then(() => done()) - .catch(err => console.log('Error fetching protocols:', err)); -} - -gulp.task('generateSupportedCSSProperties', ['fetchSupportedCSSProperties'], generateSupportedCSSProperties); -function generateSupportedCSSProperties() { - var script = path.join(scriptsPath, 'build', 'generate_supported_css.py'); - var inputs = [path.join(releasePath, 'CSSProperties.json5')]; - var outputs = [path.join(releasePath, 'SupportedCSSProperties.js')]; - var args = inputs.concat(outputs); - runPythonScript(script, args); - del.sync([path.join(releasePath, 'CSSProperties.json5')], {force: true}); -} - -gulp.task('fetchSupportedCSSProperties', ['clean'], fetchSupportedCSSProperties); -function fetchSupportedCSSProperties(done) { - var supportedCSSPropertiesURL = - 'https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/Source/core/css/CSSProperties.json5?format=TEXT'; - var supportedCSSPropertiesFile = path.join(releasePath, 'CSSProperties.json5'); - fetchAndSaveCodePromise(supportedCSSPropertiesURL, supportedCSSPropertiesFile) - .then(() => done()) - .catch(err => console.log('Error fetching CSS properties:', err)); -} - -gulp.task('generateDevtoolsExtensionAPI', ['clean'], generateDevtoolsExtensionAPITask); -function generateDevtoolsExtensionAPITask() { - var script = path.join(scriptsPath, 'build', 'generate_devtools_extension_api.py'); - var inputs = [path.join(frontendPath, 'extensions', 'ExtensionAPI.js')]; - var outputs = [path.join(releasePath, 'devtools_extension_api.js')]; - var args = outputs.concat(inputs); - runPythonScript(script, args); -} - -gulp.task('copyDevtoolsFiles', ['clean'], copyDevtoolsFilesTask); -function copyDevtoolsFilesTask() { - gulp.src(path.join(frontendPath, 'devtools.js')).pipe(gulp.dest(releasePath)); - gulp.src(path.join(frontendPath, 'Tests.js')).pipe(gulp.dest(releasePath)); - gulp.src(path.join(frontendPath, 'Images/*.*')).pipe(gulp.dest(path.join(releasePath, 'Images'))); - gulp.src(path.join(frontendPath, 'emulated_devices/*.svg')) - .pipe(gulp.dest(path.join(releasePath, 'emulated_devices'))); - gulp.src(path.join(frontendPath, 'emulated_devices/*.png')) - .pipe(gulp.dest(path.join(releasePath, 'emulated_devices'))); -} - -function fetchAndSaveCodePromise(url, file) { - return utils.fetch(url) - .then(buffer => utils.atob(buffer.toString('binary'))) - .then(data => fsPromise.writeFile(file, data)); -} - -function runPythonScript(script, args) { - shell(`python ${script} ${args.join(' ')}`); -}
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/package.json b/third_party/WebKit/Source/devtools/scripts/gulp/package.json deleted file mode 100644 index 01697db..0000000 --- a/third_party/WebKit/Source/devtools/scripts/gulp/package.json +++ /dev/null
@@ -1,20 +0,0 @@ -{ - "name": "chrome-devtools-build", - "description": "Build scripts for Chrome DevTools", - "scripts": { - "build": "npm run gulp -- build", - "gulp": "gulp" - }, - "version": "0.1.0", - "author": "The Chromium Authors", - "license": "SEE LICENSE IN https://chromium.googlesource.com/chromium/src/+/master/LICENSE", - "bugs": { - "url": "https://bugs.chromium.org/p/chromium/issues/list?can=2&q=component:Platform%3EDevTools%20&sort=-opened&colspec=ID%20Stars%20Owner%20Summary%20Modified%20Opened" - }, - "devDependencies": { - "del": "2.2.2", - "fs-promise": "0.5.0", - "gulp": "3.9.1", - "jsonfile": "2.4.0" - } -}
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/release_mode_diff.txt b/third_party/WebKit/Source/devtools/scripts/gulp/release_mode_diff.txt deleted file mode 100644 index d1031f27f..0000000 --- a/third_party/WebKit/Source/devtools/scripts/gulp/release_mode_diff.txt +++ /dev/null
@@ -1,3 +0,0 @@ -Only in ../../release/Images: cookie.png -Only in ../../release/Images: transformControls_2x.png -Only in ../../release/Images: transformControls.png
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/test.sh b/third_party/WebKit/Source/devtools/scripts/gulp/test.sh deleted file mode 100755 index ddfdbac9..0000000 --- a/third_party/WebKit/Source/devtools/scripts/gulp/test.sh +++ /dev/null
@@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" - -CHROMIUM_ROOT_PATH=${SCRIPT_PATH}"/../../../../../.." -OUT_PATH=${CHROMIUM_ROOT_PATH}"/out/Release" - -ninja -C ${OUT_PATH} -j 1000 chrome blink_tests -npm run build -echo ======================= -echo DIFF -diff -rq ../../release ~/chromium/src/out/Release/resources/inspector | grep -ivE "out/Release/resources/inspector: debug$" | tee "release_mode_diff.txt"
diff --git a/third_party/WebKit/Source/modules/EventTargetModulesFactory.json5 b/third_party/WebKit/Source/modules/EventTargetModulesFactory.json5 index 3829b73a8..6c490b9 100644 --- a/third_party/WebKit/Source/modules/EventTargetModulesFactory.json5 +++ b/third_party/WebKit/Source/modules/EventTargetModulesFactory.json5
@@ -5,6 +5,7 @@ }, data: [ + "modules/background_fetch/BackgroundFetchRegistration", "modules/battery/BatteryManager", "modules/bluetooth/BluetoothDevice", "modules/bluetooth/BluetoothRemoteGATTCharacteristic",
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchOptions.idl b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchOptions.idl index 6fb2a17..408371e 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchOptions.idl +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchOptions.idl
@@ -7,5 +7,6 @@ dictionary BackgroundFetchOptions { sequence<IconDefinition> icons = []; DOMString title = ""; - long totalDownloadSize = 0; + [ImplementedAs=downloadTotal] unsigned long long totalDownloadSize = 0; + unsigned long long downloadTotal = 0; };
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp index b904985..e91d8e1 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp
@@ -5,6 +5,7 @@ #include "modules/background_fetch/BackgroundFetchRegistration.h" #include "core/dom/DOMException.h" +#include "modules/EventTargetModulesNames.h" #include "modules/background_fetch/BackgroundFetchBridge.h" #include "modules/background_fetch/IconDefinition.h" #include "modules/serviceworkers/ServiceWorkerRegistration.h" @@ -14,12 +15,18 @@ BackgroundFetchRegistration::BackgroundFetchRegistration( String id, + unsigned long long upload_total, + unsigned long long uploaded, + unsigned long long download_total, + unsigned long long downloaded, HeapVector<IconDefinition> icons, - long long total_download_size, String title) : id_(id), + upload_total_(upload_total), + uploaded_(uploaded), + download_total_(download_total), + downloaded_(downloaded), icons_(icons), - total_download_size_(total_download_size), title_(title) {} BackgroundFetchRegistration::~BackgroundFetchRegistration() = default; @@ -34,18 +41,39 @@ return id_; } +unsigned long long BackgroundFetchRegistration::uploadTotal() const { + return upload_total_; +} + +unsigned long long BackgroundFetchRegistration::uploaded() const { + return uploaded_; +} + +unsigned long long BackgroundFetchRegistration::downloadTotal() const { + return download_total_; +} + +unsigned long long BackgroundFetchRegistration::downloaded() const { + return downloaded_; +} + HeapVector<IconDefinition> BackgroundFetchRegistration::icons() const { return icons_; } -long long BackgroundFetchRegistration::totalDownloadSize() const { - return total_download_size_; -} - String BackgroundFetchRegistration::title() const { return title_; } +const AtomicString& BackgroundFetchRegistration::InterfaceName() const { + return EventTargetNames::BackgroundFetchRegistration; +} + +ExecutionContext* BackgroundFetchRegistration::GetExecutionContext() const { + DCHECK(registration_); + return registration_->GetExecutionContext(); +} + ScriptPromise BackgroundFetchRegistration::abort(ScriptState* script_state) { ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); @@ -84,6 +112,7 @@ DEFINE_TRACE(BackgroundFetchRegistration) { visitor->Trace(registration_); visitor->Trace(icons_); + EventTargetWithInlineData::Trace(visitor); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h index 76d249a..de0fddf 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h
@@ -6,6 +6,7 @@ #define BackgroundFetchRegistration_h #include "bindings/core/v8/ScriptPromise.h" +#include "core/dom/events/EventTarget.h" #include "platform/bindings/ScriptWrappable.h" #include "platform/heap/GarbageCollected.h" #include "platform/heap/Handle.h" @@ -21,15 +22,16 @@ // Represents an individual Background Fetch registration. Gives developers // access to its properties, options, and enables them to abort the fetch. -class BackgroundFetchRegistration final - : public GarbageCollectedFinalized<BackgroundFetchRegistration>, - public ScriptWrappable { +class BackgroundFetchRegistration final : public EventTargetWithInlineData { DEFINE_WRAPPERTYPEINFO(); public: BackgroundFetchRegistration(String id, + unsigned long long upload_total, + unsigned long long uploaded, + unsigned long long download_total, + unsigned long long downloaded, HeapVector<IconDefinition> icons, - long long total_download_size, String title); ~BackgroundFetchRegistration(); @@ -38,13 +40,24 @@ void SetServiceWorkerRegistration(ServiceWorkerRegistration*); String id() const; - HeapVector<IconDefinition> icons() const; - long long totalDownloadSize() const; - String title() const; + unsigned long long uploadTotal() const; + unsigned long long uploaded() const; + unsigned long long downloadTotal() const; + unsigned long long downloaded() const; + + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); ScriptPromise abort(ScriptState*); - DECLARE_TRACE(); + // TODO(crbug.com/769770): Remove the following deprecated attributes. + HeapVector<IconDefinition> icons() const; + String title() const; + + // EventTargetWithInlineData implementation. + const AtomicString& InterfaceName() const override; + ExecutionContext* GetExecutionContext() const override; + + DECLARE_VIRTUAL_TRACE(); private: void DidAbort(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError); @@ -52,8 +65,11 @@ Member<ServiceWorkerRegistration> registration_; String id_; + unsigned long long upload_total_; + unsigned long long uploaded_; + unsigned long long download_total_; + unsigned long long downloaded_; HeapVector<IconDefinition> icons_; - long long total_download_size_; String title_; };
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.idl b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.idl index 3b7ef66..07356fed 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.idl +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.idl
@@ -7,12 +7,20 @@ [ Exposed=(Window,Worker), RuntimeEnabled=BackgroundFetch -] interface BackgroundFetchRegistration { +] interface BackgroundFetchRegistration : EventTarget { readonly attribute DOMString id; - readonly attribute FrozenArray<IconDefinition> icons; - readonly attribute long totalDownloadSize; - readonly attribute DOMString title; + readonly attribute unsigned long long uploadTotal; + readonly attribute unsigned long long uploaded; + readonly attribute unsigned long long downloadTotal; + readonly attribute unsigned long long downloaded; // TODO(crbug.com/699957): Implement the `activeFetches` attribute. + attribute EventHandler onprogress; + [CallWith=ScriptState] Promise<bool> abort(); + + // TODO(crbug.com/769770): Remove the following deprecated attributes. + readonly attribute FrozenArray<IconDefinition> icons; + [ImplementedAs=downloadTotal] readonly attribute long totalDownloadSize; + readonly attribute DOMString title; };
diff --git a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchTypeConverters.cpp b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchTypeConverters.cpp index 1781622f..17bded5 100644 --- a/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchTypeConverters.cpp +++ b/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchTypeConverters.cpp
@@ -25,8 +25,9 @@ icons.push_back(iconPtr.To<blink::IconDefinition>()); return new blink::BackgroundFetchRegistration( - mojoRegistration->id, std::move(icons), - mojoRegistration->total_download_size, mojoRegistration->title); + mojoRegistration->id, mojoRegistration->upload_total, + mojoRegistration->uploaded, mojoRegistration->download_total, + mojoRegistration->downloaded, std::move(icons), mojoRegistration->title); } blink::mojom::blink::BackgroundFetchOptionsPtr TypeConverter< @@ -43,7 +44,7 @@ mojoIcons.push_back(blink::mojom::blink::IconDefinition::From(icon)); mojoOptions->icons = std::move(mojoIcons); - mojoOptions->total_download_size = options.totalDownloadSize(); + mojoOptions->download_total = options.downloadTotal(); mojoOptions->title = options.title(); return mojoOptions;
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.h b/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.h index b7214753..ba3644a 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.h +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.h
@@ -13,6 +13,11 @@ class LocalFrame; +// Represents the animation worklet on the main thread. All the logic for +// loading a new source module is implemented in its parent class |Worklet|. The +// sole responsibility of this class it to create the appropriate +// |WorkletGlobalScopeProxy| instances that are responsible to proxy a +// corresponding |AnimationWorkletGlobalScope| on the worklet thread. class MODULES_EXPORT AnimationWorklet final : public Worklet { WTF_MAKE_NONCOPYABLE(AnimationWorklet);
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.h b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.h index 54b9c91..73d6f960 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.h +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScope.h
@@ -17,6 +17,15 @@ class ExceptionState; class WorkerClients; +// Represents the animation worklet global scope and implements all methods that +// the global scope exposes to user script (See +// |AnimationWorkletGlobalScope.idl|). The instances of this class live on the +// worklet thread but have a corresponding proxy on the main thread which is +// accessed by the animation worklet instance. User scripts can register +// animator definitions with the global scope (via |registerAnimator| method). +// The scope keeps a map of these animator definitions and can look them up +// based on their name. The scope also owns a list of active animators that it +// animates. class MODULES_EXPORT AnimationWorkletGlobalScope : public ThreadedWorkletGlobalScope { DEFINE_WRAPPERTYPEINFO(); @@ -35,8 +44,11 @@ bool IsAnimationWorkletGlobalScope() const final { return true; } Animator* CreateInstance(const String& name); + + // Invokes the |animate| function of all of its active animators. void Mutate(); + // Registers a animator definition with the given name and constructor. void registerAnimator(const String& name, const ScriptValue& ctorValue, ExceptionState&);
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletMessagingProxy.h b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletMessagingProxy.h index 72647ee..2193b84 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletMessagingProxy.h +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletMessagingProxy.h
@@ -15,6 +15,11 @@ class WorkerClients; class WorkerThread; +// Acts as a proxy for the animation worklet global scopes that live on the +// worklet thread. The logic to actually proxy an off thread global scope is +// implemented in its parent. The main contribution of this class is to +// create an appropriate worklet thread type (in this case an +// |AnimationWorkletThread|) as part of the the worklet initialization process. class AnimationWorkletMessagingProxy final : public ThreadedWorkletMessagingProxy { public:
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.h b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.h index 6e5a82c..f6a6369 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.h +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.h
@@ -14,6 +14,11 @@ class ThreadableLoadingContext; class WorkerReportingProxy; +// Represents the shared backing thread that is used by all animation worklets +// and participates in Blink garbage collection process. At the moment, instead +// of creating a dedicated backing thread it uses the existing compositor thread +// (i.e., |Platform::CompositorThread()|). +// TODO(petermayo): Use a dedicated thread: https://crbug.com/731727 class MODULES_EXPORT AnimationWorkletThread final : public WorkerThread { public: static std::unique_ptr<AnimationWorkletThread> Create(
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp index e35a914..0443f103 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp
@@ -12,7 +12,6 @@ #include "core/dom/AnimationWorkletProxyClient.h" #include "core/inspector/ConsoleMessage.h" #include "core/workers/GlobalScopeCreationParams.h" -#include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/ParentFrameTaskRunners.h" #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerOrWorkletGlobalScope.h"
diff --git a/third_party/WebKit/Source/modules/compositorworker/Animator.h b/third_party/WebKit/Source/modules/compositorworker/Animator.h index 8844819c..7e3ccef52 100644 --- a/third_party/WebKit/Source/modules/compositorworker/Animator.h +++ b/third_party/WebKit/Source/modules/compositorworker/Animator.h
@@ -16,6 +16,9 @@ class AnimatorDefinition; class ScriptState; +// Represents an animator instance. It owns the underlying |v8::Object| for the +// instance and knows how to invoke the |animate| function on it. +// See also |AnimationWorkletGlobalScope::CreateInstance|. class Animator final : public GarbageCollectedFinalized<Animator>, public TraceWrapperBase { public:
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h index 83c0991..691e959d 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h +++ b/third_party/WebKit/Source/modules/compositorworker/AnimatorDefinition.h
@@ -13,11 +13,11 @@ namespace blink { -// This class represents a valid registered Javascript animator. Note that it -// assumed the argument passed to its constructor have been validated to have -// proper type. -// It can be used to instantiate new animators and also to call the Javascript -// 'animate' callback on a given instance. +// Represents a valid registered Javascript animator. In particular it owns two +// |v8::Function|s that are the "constructor" and "animate" functions of the +// registered class. It does not do any validation itself and relies on +// |AnimationWorkletGlobalScope::registerAnimator| to validate the provided +// Javascript class before completing the registration. class MODULES_EXPORT AnimatorDefinition final : public GarbageCollectedFinalized<AnimatorDefinition>, public TraceWrapperBase {
diff --git a/third_party/WebKit/Source/modules/compositorworker/README.md b/third_party/WebKit/Source/modules/compositorworker/README.md new file mode 100644 index 0000000..2368af0 --- /dev/null +++ b/third_party/WebKit/Source/modules/compositorworker/README.md
@@ -0,0 +1,13 @@ +# Animation Worklet +This directory contains source code that implements Animation Worklet API and Compositor Worker. + +See [Animation Worklet Explainer](https://github.com/WICG/animation-worklet/blob/gh-pages/README.md) +for the set of web-exposed API that implements. + + +## Testing + +Layout tests that cover web-exposed API for Animation Worklet are tested in [`LayoutTests/virtual/th +readed/fast/compositorworker/`](../../../LayoutTests/virtual/threaded/fast/compositorworker/). + +There are unit tests covering animation worklet and global scope in [`modules/compositorworker`](.). \ No newline at end of file
diff --git a/third_party/WebKit/Source/modules/exported/BUILD.gn b/third_party/WebKit/Source/modules/exported/BUILD.gn index 207c806..5b6fc406 100644 --- a/third_party/WebKit/Source/modules/exported/BUILD.gn +++ b/third_party/WebKit/Source/modules/exported/BUILD.gn
@@ -6,6 +6,7 @@ blink_modules_sources("exported") { sources = [ "WebAXObject.cpp", + "WebApplyConstraintsRequest.cpp", "WebCryptoNormalize.cpp", "WebDOMFileSystem.cpp", "WebDOMMediaStreamTrack.cpp",
diff --git a/third_party/WebKit/Source/modules/exported/WebApplyConstraintsRequest.cpp b/third_party/WebKit/Source/modules/exported/WebApplyConstraintsRequest.cpp new file mode 100644 index 0000000..6cb3766 --- /dev/null +++ b/third_party/WebKit/Source/modules/exported/WebApplyConstraintsRequest.cpp
@@ -0,0 +1,65 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "public/web/WebApplyConstraintsRequest.h" + +#include "modules/mediastream/ApplyConstraintsRequest.h" +#include "platform/wtf/text/WTFString.h" +#include "public/platform/WebMediaConstraints.h" +#include "public/platform/WebMediaStreamTrack.h" +#include "public/platform/WebString.h" + +namespace blink { + +WebApplyConstraintsRequest::WebApplyConstraintsRequest( + ApplyConstraintsRequest* request) + : private_(request) {} + +WebApplyConstraintsRequest::~WebApplyConstraintsRequest() { + Reset(); +} + +WebApplyConstraintsRequest WebApplyConstraintsRequest::CreateForTesting( + const WebMediaStreamTrack& track, + const WebMediaConstraints& constraints) { + return WebApplyConstraintsRequest( + ApplyConstraintsRequest::CreateForTesting(track, constraints)); +} + +void WebApplyConstraintsRequest::Reset() { + private_.Reset(); +} + +WebMediaStreamTrack WebApplyConstraintsRequest::Track() const { + DCHECK(!IsNull()); + return private_->Track(); +} + +WebMediaConstraints WebApplyConstraintsRequest::Constraints() const { + DCHECK(!IsNull()); + return private_->Constraints(); +} + +void WebApplyConstraintsRequest::RequestSucceeded() { + DCHECK(!IsNull()); + private_->RequestSucceeded(); +} + +void WebApplyConstraintsRequest::RequestFailed(const WebString& constraint, + const WebString& message) { + DCHECK(!IsNull()); + private_->RequestFailed(constraint, message); +} + +bool WebApplyConstraintsRequest::operator==( + const WebApplyConstraintsRequest& other) const { + return private_.Get() == other.private_.Get(); +} + +void WebApplyConstraintsRequest::Assign( + const WebApplyConstraintsRequest& other) { + private_ = other.private_; +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp index ec218ae..2caf86a5 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -4,6 +4,8 @@ #include "modules/imagecapture/ImageCapture.h" +#include <utility> + #include "bindings/core/v8/CallbackPromiseAdapter.h" #include "bindings/core/v8/ScriptPromiseResolver.h" #include "core/dom/DOMException.h" @@ -554,9 +556,8 @@ return current_constraints_; } -void ImageCapture::ClearMediaTrackConstraints(ScriptPromiseResolver* resolver) { +void ImageCapture::ClearMediaTrackConstraints() { current_constraints_ = MediaTrackConstraintSet(); - resolver->Resolve(); // TODO(mcasas): Clear also any PhotoSettings that the device might have got // configured, for that we need to know a "default" state of the device; take @@ -600,26 +601,6 @@ settings.setTorch(settings_.torch()); } -bool ImageCapture::HasNonImageCaptureConstraints( - const MediaTrackConstraints& constraints) const { - if (!constraints.hasAdvanced()) - return false; - - const auto& advanced_constraints = constraints.advanced(); - for (const auto& constraint : advanced_constraints) { - if (!constraint.hasWhiteBalanceMode() && !constraint.hasExposureMode() && - !constraint.hasFocusMode() && !constraint.hasPointsOfInterest() && - !constraint.hasExposureCompensation() && - !constraint.hasColorTemperature() && !constraint.hasIso() && - !constraint.hasBrightness() && !constraint.hasContrast() && - !constraint.hasSaturation() && !constraint.hasSharpness() && - !constraint.hasZoom() && !constraint.hasTorch()) { - return true; - } - } - return false; -} - ImageCapture::ImageCapture(ExecutionContext* context, MediaStreamTrack* track) : ContextLifecycleObserver(context), stream_track_(track) { DCHECK(stream_track_);
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h index 28513a706..aa25f72 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h
@@ -71,12 +71,9 @@ void SetMediaTrackConstraints(ScriptPromiseResolver*, const HeapVector<MediaTrackConstraintSet>&); const MediaTrackConstraintSet& GetMediaTrackConstraints() const; - void ClearMediaTrackConstraints(ScriptPromiseResolver*); + void ClearMediaTrackConstraints(); void GetMediaTrackSettings(MediaTrackSettings&) const; - // TODO(mcasas): Remove this service method, https://crbug.com/338503. - bool HasNonImageCaptureConstraints(const MediaTrackConstraints&) const; - DECLARE_VIRTUAL_TRACE(); private:
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp index ff853da..bbbd30ce 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -77,6 +77,14 @@ #include "platform/EventDispatchForbiddenScope.h" #include "platform/runtime_enabled_features.h" +namespace { + +bool IsModern() { + return blink::RuntimeEnabledFeatures::ModernMediaControlsEnabled(); +} + +} // namespace. + namespace blink { namespace { @@ -281,6 +289,7 @@ toggle_closed_captions_button_(nullptr), text_track_list_(nullptr), overflow_list_(nullptr), + media_button_panel_(nullptr), cast_button_(nullptr), fullscreen_button_(nullptr), download_button_(nullptr), @@ -355,33 +364,38 @@ // | (-webkit-media-controls-overlay-enclosure) // | +-MediaControlOverlayPlayButtonElement // | | (-webkit-media-controls-overlay-play-button) -// | | {if mediaControlsOverlayPlayButtonEnabled} +// | | {if mediaControlsOverlayPlayButtonEnabled or +// | | if ModernMediaControls is enabled} // | \-MediaControlCastButtonElement // | (-internal-media-controls-overlay-cast-button) // \-MediaControlPanelEnclosureElement // | (-webkit-media-controls-enclosure) // \-MediaControlPanelElement // | (-webkit-media-controls-panel) -// +-MediaControlPlayButtonElement -// | (-webkit-media-controls-play-button) -// +-MediaControlCurrentTimeDisplayElement -// | (-webkit-media-controls-current-time-display) -// +-MediaControlRemainingTimeDisplayElement -// | (-webkit-media-controls-time-remaining-display) -// +-MediaControlTimelineElement -// | (-webkit-media-controls-timeline) -// +-MediaControlMuteButtonElement -// | (-webkit-media-controls-mute-button) -// +-MediaControlVolumeSliderElement -// | (-webkit-media-controls-volume-slider) -// +-MediaControlFullscreenButtonElement -// | (-webkit-media-controls-fullscreen-button) -// +-MediaControlDownloadButtonElement -// | (-internal-media-controls-download-button) -// +-MediaControlToggleClosedCaptionsButtonElement -// | (-webkit-media-controls-toggle-closed-captions-button) -// \-MediaControlCastButtonElement -// (-internal-media-controls-cast-button) +// | {if ModernMediaControlsEnabled, otherwise +// | contents are directly attached to parent. +// +-HTMLDivElement +// | | (-internal-media-controls-button-panel) +// | +-MediaControlPlayButtonElement +// | | (-webkit-media-controls-play-button) +// | +-MediaControlCurrentTimeDisplayElement +// | | (-webkit-media-controls-current-time-display) +// | +-MediaControlRemainingTimeDisplayElement +// | | (-webkit-media-controls-time-remaining-display) +// | +-MediaControlMuteButtonElement +// | | (-webkit-media-controls-mute-button) +// | +-MediaControlVolumeSliderElement +// | | (-webkit-media-controls-volume-slider) +// | +-MediaControlFullscreenButtonElement +// | | (-webkit-media-controls-fullscreen-button) +// | +-MediaControlDownloadButtonElement +// | | (-internal-media-controls-download-button) +// | +-MediaControlToggleClosedCaptionsButtonElement +// | | (-webkit-media-controls-toggle-closed-captions-button) +// | +-MediaControlCastButtonElement +// | (-internal-media-controls-cast-button) +// \-MediaControlTimelineElement +// (-webkit-media-controls-timeline) // +-MediaControlTextTrackListElement // | (-internal-media-controls-text-track-list) // | {for each renderable text track} @@ -396,7 +410,8 @@ void MediaControlsImpl::InitializeControls() { overlay_enclosure_ = new MediaControlOverlayEnclosureElement(*this); - if (RuntimeEnabledFeatures::MediaControlsOverlayPlayButtonEnabled()) { + if (RuntimeEnabledFeatures::MediaControlsOverlayPlayButtonEnabled() || + IsModern()) { overlay_play_button_ = new MediaControlOverlayPlayButtonElement(*this); overlay_enclosure_->AppendChild(overlay_play_button_); } @@ -412,39 +427,50 @@ panel_ = new MediaControlPanelElement(*this); + // If using the modern media controls, the buttons should belong to a + // seperate button panel. This is because they are displayed in two lines. + Element* button_panel = panel_; + if (IsModern()) { + media_button_panel_ = HTMLDivElement::Create(GetDocument()); + media_button_panel_->SetShadowPseudoId( + "-internal-media-controls-button-panel"); + panel_->AppendChild(media_button_panel_); + button_panel = media_button_panel_; + } + play_button_ = new MediaControlPlayButtonElement(*this); - panel_->AppendChild(play_button_); + button_panel->AppendChild(play_button_); current_time_display_ = new MediaControlCurrentTimeDisplayElement(*this); current_time_display_->SetIsWanted(true); - panel_->AppendChild(current_time_display_); + button_panel->AppendChild(current_time_display_); duration_display_ = new MediaControlRemainingTimeDisplayElement(*this); - panel_->AppendChild(duration_display_); + button_panel->AppendChild(duration_display_); timeline_ = new MediaControlTimelineElement(*this); panel_->AppendChild(timeline_); mute_button_ = new MediaControlMuteButtonElement(*this); - panel_->AppendChild(mute_button_); + button_panel->AppendChild(mute_button_); volume_slider_ = new MediaControlVolumeSliderElement(*this); - panel_->AppendChild(volume_slider_); + button_panel->AppendChild(volume_slider_); if (PreferHiddenVolumeControls(GetDocument())) volume_slider_->SetIsWanted(false); fullscreen_button_ = new MediaControlFullscreenButtonElement(*this); - panel_->AppendChild(fullscreen_button_); + button_panel->AppendChild(fullscreen_button_); download_button_ = new MediaControlDownloadButtonElement(*this); - panel_->AppendChild(download_button_); + button_panel->AppendChild(download_button_); cast_button_ = new MediaControlCastButtonElement(*this, false); - panel_->AppendChild(cast_button_); + button_panel->AppendChild(cast_button_); toggle_closed_captions_button_ = new MediaControlToggleClosedCaptionsButtonElement(*this); - panel_->AppendChild(toggle_closed_captions_button_); + button_panel->AppendChild(toggle_closed_captions_button_); enclosure_->AppendChild(panel_); @@ -454,7 +480,7 @@ AppendChild(text_track_list_); overflow_menu_ = new MediaControlOverflowMenuButtonElement(*this); - panel_->AppendChild(overflow_menu_); + button_panel->AppendChild(overflow_menu_); overflow_list_ = new MediaControlOverflowMenuListElement(*this); AppendChild(overflow_list_); @@ -1125,6 +1151,10 @@ // This might be better suited for a layout, but since JS media controls // won't benefit from that anwyay, we just do it here like JS will. + // TODO(beccahughes): Update this for modern controls. + if (IsModern()) + return; + // Controls that we'll hide / show, in order of decreasing priority. MediaControlElementBase* elements[] = { // Exclude m_overflowMenu; we handle it specially. @@ -1370,6 +1400,7 @@ visitor->Trace(orientation_lock_delegate_); visitor->Trace(rotate_to_fullscreen_delegate_); visitor->Trace(download_iph_manager_); + visitor->Trace(media_button_panel_); MediaControls::Trace(visitor); HTMLDivElement::Trace(visitor); }
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h index 2ac2e4f..0e9f761 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h
@@ -268,6 +268,7 @@ Member<MediaControlTextTrackListElement> text_track_list_; Member<MediaControlOverflowMenuButtonElement> overflow_menu_; Member<MediaControlOverflowMenuListElement> overflow_list_; + Member<HTMLDivElement> media_button_panel_; Member<MediaControlCastButtonElement> cast_button_; Member<MediaControlFullscreenButtonElement> fullscreen_button_;
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp index a8042bd..9ecf8f5d 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp
@@ -92,25 +92,25 @@ ShadowRoot& shadow_root = Shadow()->OldestShadowRoot(); Element* track = shadow_root.getElementById(AtomicString("track")); DCHECK(track); - track->setAttribute("class", "-internal-media-controls-segmented-track"); + track->SetShadowPseudoId("-internal-media-controls-segmented-track"); // Add the following structure to #track. // - // div.-internal-track-segment-background (container) - // - div.-internal-track-segment-highlight-before (blue highlight) - // - div.-internal-track-segment-highlight-after (dark gray highlight) + // div::internal-track-segment-background (container) + // - div::internal-track-segment-highlight-before (blue highlight) + // - div::internal-track-segment-highlight-after (dark gray highlight) HTMLDivElement* background = HTMLDivElement::Create(GetDocument()); - background->setAttribute("class", "-internal-track-segment-background"); + background->SetShadowPseudoId("-internal-track-segment-background"); track->appendChild(background); segment_highlight_before_ = HTMLDivElement::Create(GetDocument()); - segment_highlight_before_->setAttribute( - "class", "-internal-track-segment-highlight-before"); + segment_highlight_before_->SetShadowPseudoId( + "-internal-track-segment-highlight-before"); background->appendChild(segment_highlight_before_); segment_highlight_after_ = HTMLDivElement::Create(GetDocument()); - segment_highlight_after_->setAttribute( - "class", "-internal-track-segment-highlight-after"); + segment_highlight_after_->SetShadowPseudoId( + "-internal-track-segment-highlight-after"); background->appendChild(segment_highlight_after_); }
diff --git a/third_party/WebKit/Source/modules/media_controls/resources/legacyMediaControls.css b/third_party/WebKit/Source/modules/media_controls/resources/legacyMediaControls.css index 2391a21e..261d516 100644 --- a/third_party/WebKit/Source/modules/media_controls/resources/legacyMediaControls.css +++ b/third_party/WebKit/Source/modules/media_controls/resources/legacyMediaControls.css
@@ -416,12 +416,19 @@ * Segmented Track */ -div.-internal-media-controls-segmented-track { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-media-controls-segmented-track { margin: 0 -18px; position: relative; + + flex: 1 1 0%; + min-width: 0; + align-self: center; + box-sizing: border-box; } -div.-internal-media-controls-segmented-track .-internal-track-segment-background { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-background { width: auto; position: absolute; background: #dadada; @@ -432,8 +439,10 @@ top: 50%; } -div.-internal-media-controls-segmented-track .-internal-track-segment-highlight-before, -div.-internal-media-controls-segmented-track .-internal-track-segment-highlight-after { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before { height: auto; position: absolute; top: 50%; @@ -443,11 +452,13 @@ margin-top: -1px; } -div.-internal-media-controls-segmented-track .-internal-track-segment-highlight-after { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after { background-color: #4285f4; } -div.-internal-media-controls-segmented-track .-internal-track-segment-highlight-before { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before { background-color: #5a5a5a; } @@ -464,7 +475,7 @@ background-repeat: no-repeat; background-position: center center; - height: 36px; + height: 48px; z-index: 2; width: 36px; margin: 0;
diff --git a/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css b/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css index 772ad9e..37e6af16 100644 --- a/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css +++ b/third_party/WebKit/Source/modules/media_controls/resources/modernMediaControls.css
@@ -1,3 +1,293 @@ /* Copyright (c) 2017 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.*/ + +/** + * Panel Structure + */ + +audio::-webkit-media-controls, +video::-webkit-media-controls { + width: inherit; + height: inherit; + position: relative; + direction: ltr; + display: flex; + flex-direction: column; + font-family: 'Roboto', 'Noto', sans-serif; + color: #000; + justify-content: flex-end; + align-items: center; + font-size: 14px; +} + +audio::-webkit-media-controls-enclosure, +video::-webkit-media-controls-enclosure { + width: 100%; + height: 96px; + flex-shrink: 0; + bottom: 0; + text-indent: 0; + padding: 0; + margin: 0; + box-sizing: border-box; +} + +audio::-webkit-media-controls-panel, +video::-webkit-media-controls-panel { + -webkit-appearance: -internal-media-control; + + display: flex; + flex-direction: column; + justify-content: flex-end; + -webkit-user-select: none; + z-index: 0; + overflow: hidden; + bottom: auto; + + width: 100%; + height: 96px; + min-width: 48px; + + font-size: 12px; + font-weight: normal; /* Make sure that we don't inherit non-defaults. */ + font-style: normal; + + background: linear-gradient(to bottom, + rgba(255, 255, 255, 0) 0%, + rgba(255, 255, 255, .4) 32px, + rgba(255, 255, 255, .8) 64px, + rgba(255, 255, 255, .8) 89px, + rgba(255, 255, 255, 0) 89px, + rgba(255, 255, 255, 0) 91px, + rgba(255, 255, 255, .8) 91px); +} + +audio::-internal-media-controls-button-panel, +video::-internal-media-controls-button-panel { + -webkit-appearance: -internal-media-control; + + flex-direction: row; + align-items: flex-end; + display: flex; + + /* We use flex-start here to ensure that the play button is visible even + * if we are too small to show all controls. + */ + justify-content: flex-start; + -webkit-user-select: none; + position: relative; + width: 100%; + z-index: 0; + overflow: hidden; + text-align: right; + bottom: auto; + height: 32px; + min-width: 48px; + line-height: 32px; + padding: 0; +} + +/** + * Media Buttons + */ + +audio::-webkit-media-controls-play-button, +video::-webkit-media-controls-play-button { + /* The play button is not used in the new design and will be removed in the + * future. */ + display: none; +} + +audio::-webkit-media-controls-mute-button, +video::-webkit-media-controls-mute-button, +video::-internal-media-controls-cast-icon, +video::-webkit-media-controls-fullscreen-button, +audio::-webkit-media-controls-fullscreen-button, +video::-internal-media-controls-cast-button, +audio::-internal-media-controls-cast-button, +video::-internal-media-controls-overflow-button, +audio::-internal-media-controls-overflow-button, +video::-webkit-media-controls-toggle-closed-captions-button, +audio::-internal-media-controls-download-button, +video::-internal-media-controls-download-button { + -webkit-appearance: -internal-media-control; + background-size: 32px; + background-repeat: no-repeat; + background-position: center center; + width: 32px; + height: 32px; + padding: 0; + border-width: 0; + background-color: initial; + color: inherit; +} + +audio::-webkit-media-controls-mute-button, +video::-webkit-media-controls-mute-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_sound_not_muted.png) 1x); +} + +audio::-webkit-media-controls-mute-button.muted, +video::-webkit-media-controls-mute-button.muted { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_sound_muted.png) 1x); +} + +video::-internal-media-remoting-cast-icon { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaremoting_cast.png) 1x, + url(default_200_percent/legacy/mediaremoting_cast.png) 2x); +} + +audio::-webkit-media-controls-fullscreen-button, +video::-webkit-media-controls-fullscreen-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_enter_fullscreen.png) 1x); +} + +audio::-webkit-media-controls-fullscreen-button.fullscreen, +video::-webkit-media-controls-fullscreen-button.fullscreen { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_exit_fullscreen.png) 1x); +} + +audio::-internal-media-controls-cast-button, +video::-internal-media-controls-cast-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_cast_off.png) 1x); +} + +audio::-internal-media-controls-cast-button.on, +video::-internal-media-controls-cast-button.on { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_cast_on.png) 1x); +} + +audio::-webkit-media-controls-toggle-closed-captions-button { + display: none; +} + +video::-webkit-media-controls-toggle-closed-captions-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_closedcaption_disabled.png) 1x); +} + +video::-webkit-media-controls-toggle-closed-captions-button.visible { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_closedcaption.png) 1x); +} + +video::-internal-media-controls-download-button, +audio::-internal-media-controls-download-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_download.png) 1x); +} + +video::-internal-media-controls-overflow-button, +audio::-internal-media-controls-overflow-button { + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_overflow_menu.png) 1x); +} + +/** + * Timeline + */ + +audio::-webkit-media-controls-timeline, +video::-webkit-media-controls-timeline { + -webkit-appearance: -internal-media-control; + + height: 2px; + padding: 0; + margin: 5px 0; + background: transparent; +} + +input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { + -webkit-appearance: -internal-media-control; + + flex: 1; + background: rgba(0, 0, 0, .2); + position: relative; +} + +input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { + -webkit-appearance: -internal-media-control; + background: black; + + width: 8px; + height: 8px; + border-radius: 4px; + margin-top: -3px; + flex: 0 0 0; +} + +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background { + position: absolute; + width: 100%; + top: 0; +} + +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before { + height: 2px; + background: black; +} + +audio::-webkit-media-controls-volume-slider, +video::-webkit-media-controls-volume-slider { + display: none; +} + +/** + * Time Display + */ + +audio::-webkit-media-controls-time-remaining-display, +video::-webkit-media-controls-time-remaining-display { + flex: 1; + text-align: left; +} + +/** + * Overlay + */ + +audio::-webkit-media-controls-overlay-enclosure { + display: none; +} + +video::-webkit-media-controls-overlay-enclosure { + display: flex; + position: relative; + flex-direction: column; + justify-content: flex-end; + align-items: center; + flex: 1 1; + min-height: 0; + width: 100%; + margin-bottom: -52px; + text-indent: 0; + box-sizing: border-box; + overflow: hidden; +} + +video::-webkit-media-controls-overlay-play-button { + -webkit-appearance: -internal-media-control; + display: flex; + position: absolute; + top: 0; + left: 0; + margin: 0; + border-width: 0px; + width: 100%; + height: 100%; + padding: 0; + background-size: 48px; + background-repeat: no-repeat; + background-position: center center; + background-image: -webkit-image-set( + url(default_100_percent/legacy/mediaplayer_overlay_play.png) 1x); + background-color: transparent; +}
diff --git a/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.cpp b/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.cpp new file mode 100644 index 0000000..f09bc909 --- /dev/null +++ b/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.cpp
@@ -0,0 +1,58 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "modules/mediastream/ApplyConstraintsRequest.h" + +#include "bindings/core/v8/ScriptPromiseResolver.h" +#include "core/dom/DOMException.h" +#include "modules/mediastream/OverconstrainedError.h" + +namespace blink { + +ApplyConstraintsRequest* ApplyConstraintsRequest::Create( + const WebMediaStreamTrack& track, + const WebMediaConstraints& constraints, + ScriptPromiseResolver* resolver) { + return new ApplyConstraintsRequest(track, constraints, resolver); +} + +ApplyConstraintsRequest* ApplyConstraintsRequest::CreateForTesting( + const WebMediaStreamTrack& track, + const WebMediaConstraints& constraints) { + return Create(track, constraints, nullptr); +} + +ApplyConstraintsRequest::ApplyConstraintsRequest( + const WebMediaStreamTrack& track, + const WebMediaConstraints& constraints, + ScriptPromiseResolver* resolver) + : track_(track), constraints_(constraints), resolver_(resolver) {} + +WebMediaStreamTrack ApplyConstraintsRequest::Track() const { + return track_; +} + +WebMediaConstraints ApplyConstraintsRequest::Constraints() const { + return constraints_; +} + +void ApplyConstraintsRequest::RequestSucceeded() { + track_.SetConstraints(constraints_); + if (resolver_) + resolver_->Resolve(); + track_.Reset(); +} + +void ApplyConstraintsRequest::RequestFailed(const String& constraint, + const String& message) { + if (resolver_) + resolver_->Reject(OverconstrainedError::Create(constraint, message)); + track_.Reset(); +} + +DEFINE_TRACE(ApplyConstraintsRequest) { + visitor->Trace(resolver_); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.h b/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.h new file mode 100644 index 0000000..3507cb467 --- /dev/null +++ b/third_party/WebKit/Source/modules/mediastream/ApplyConstraintsRequest.h
@@ -0,0 +1,47 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ApplyConstraintsRequest_h +#define ApplyConstraintsRequest_h + +#include "modules/ModulesExport.h" +#include "platform/heap/GarbageCollected.h" +#include "platform/heap/Visitor.h" +#include "public/platform/WebMediaConstraints.h" +#include "public/platform/WebMediaStreamTrack.h" + +namespace blink { + +class ScriptPromiseResolver; + +class MODULES_EXPORT ApplyConstraintsRequest final + : public GarbageCollectedFinalized<ApplyConstraintsRequest> { + public: + static ApplyConstraintsRequest* Create(const WebMediaStreamTrack&, + const WebMediaConstraints&, + ScriptPromiseResolver*); + static ApplyConstraintsRequest* CreateForTesting(const WebMediaStreamTrack&, + const WebMediaConstraints&); + + WebMediaStreamTrack Track() const; + WebMediaConstraints Constraints() const; + + void RequestSucceeded(); + void RequestFailed(const String& constraint, const String& message); + + DECLARE_VIRTUAL_TRACE(); + + private: + ApplyConstraintsRequest(const WebMediaStreamTrack&, + const WebMediaConstraints&, + ScriptPromiseResolver*); + + WebMediaStreamTrack track_; + WebMediaConstraints constraints_; + Member<ScriptPromiseResolver> resolver_; +}; + +} // namespace blink + +#endif // ApplyConstraintsRequest_h
diff --git a/third_party/WebKit/Source/modules/mediastream/BUILD.gn b/third_party/WebKit/Source/modules/mediastream/BUILD.gn index 2652520..2f88e84 100644 --- a/third_party/WebKit/Source/modules/mediastream/BUILD.gn +++ b/third_party/WebKit/Source/modules/mediastream/BUILD.gn
@@ -6,6 +6,8 @@ blink_modules_sources("mediastream") { sources = [ + "ApplyConstraintsRequest.cpp", + "ApplyConstraintsRequest.h", "DOMWindowMediaStream.h", "MediaConstraintsImpl.cpp", "MediaConstraintsImpl.h", @@ -36,6 +38,8 @@ "NavigatorUserMediaError.h", "NavigatorUserMediaErrorCallback.h", "NavigatorUserMediaSuccessCallback.h", + "OverconstrainedError.cpp", + "OverconstrainedError.h", "URLMediaStream.cpp", "URLMediaStream.h", "UserMediaClient.cpp",
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index 800be6bc..1d10d88 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -35,11 +35,13 @@ #include "core/dom/events/Event.h" #include "core/frame/Deprecation.h" #include "modules/imagecapture/ImageCapture.h" +#include "modules/mediastream/ApplyConstraintsRequest.h" #include "modules/mediastream/MediaConstraintsImpl.h" #include "modules/mediastream/MediaStream.h" #include "modules/mediastream/MediaTrackCapabilities.h" #include "modules/mediastream/MediaTrackConstraints.h" #include "modules/mediastream/MediaTrackSettings.h" +#include "modules/mediastream/OverconstrainedError.h" #include "modules/mediastream/UserMediaController.h" #include "platform/mediastream/MediaStreamCenter.h" #include "platform/mediastream/MediaStreamComponent.h" @@ -49,11 +51,85 @@ namespace blink { namespace { + static const char kContentHintStringNone[] = ""; static const char kContentHintStringAudioSpeech[] = "speech"; static const char kContentHintStringAudioMusic[] = "music"; static const char kContentHintStringVideoMotion[] = "motion"; static const char kContentHintStringVideoDetail[] = "detail"; + +// The set of constrainable properties for image capture is available at +// https://w3c.github.io/mediacapture-image/#constrainable-properties +// TODO(guidou): Integrate image-capture constraints processing with the +// spec-compliant main implementation and remove these support functions. +// http://crbug.com/708723 +bool ConstraintSetHasImageCapture( + const MediaTrackConstraintSet& constraint_set) { + return constraint_set.hasWhiteBalanceMode() || + constraint_set.hasExposureMode() || constraint_set.hasFocusMode() || + constraint_set.hasPointsOfInterest() || + constraint_set.hasExposureCompensation() || + constraint_set.hasColorTemperature() || constraint_set.hasIso() || + constraint_set.hasBrightness() || constraint_set.hasContrast() || + constraint_set.hasSaturation() || constraint_set.hasSharpness() || + constraint_set.hasZoom() || constraint_set.hasTorch(); +} + +bool ConstraintSetHasNonImageCapture( + const MediaTrackConstraintSet& constraint_set) { + return constraint_set.hasAspectRatio() || constraint_set.hasChannelCount() || + constraint_set.hasDepthFar() || constraint_set.hasDepthNear() || + constraint_set.hasDeviceId() || constraint_set.hasEchoCancellation() || + constraint_set.hasFacingMode() || constraint_set.hasFocalLengthX() || + constraint_set.hasFocalLengthY() || constraint_set.hasFrameRate() || + constraint_set.hasGroupId() || constraint_set.hasHeight() || + constraint_set.hasLatency() || constraint_set.hasSampleRate() || + constraint_set.hasSampleSize() || constraint_set.hasVideoKind() || + constraint_set.hasVolume() || constraint_set.hasWidth(); +} + +bool ConstraintSetHasImageAndNonImageCapture( + const MediaTrackConstraintSet& constraint_set) { + return ConstraintSetHasImageCapture(constraint_set) && + ConstraintSetHasNonImageCapture(constraint_set); +} + +bool ConstraintSetIsNonEmpty(const MediaTrackConstraintSet& constraint_set) { + return ConstraintSetHasImageCapture(constraint_set) || + ConstraintSetHasNonImageCapture(constraint_set); +} + +template <typename ConstraintSetCondition> +bool ConstraintsSatisfyCondition(ConstraintSetCondition condition, + const MediaTrackConstraints& constraints) { + if (condition(constraints)) + return true; + + if (!constraints.hasAdvanced()) + return false; + + for (const auto& advanced_set : constraints.advanced()) { + if (condition(advanced_set)) + return true; + } + + return false; +} + +bool ConstraintsHaveImageAndNonImageCapture( + const MediaTrackConstraints& constraints) { + return ConstraintsSatisfyCondition(ConstraintSetHasImageAndNonImageCapture, + constraints); +} + +bool ConstraintsAreEmpty(const MediaTrackConstraints& constraints) { + return !ConstraintsSatisfyCondition(ConstraintSetIsNonEmpty, constraints); +} + +bool ConstraintsHaveImageCapture(const MediaTrackConstraints& constraints) { + return ConstraintsSatisfyCondition(ConstraintSetHasImageCapture, constraints); +} + } // namespace MediaStreamTrack* MediaStreamTrack::Create(ExecutionContext* context, @@ -319,25 +395,74 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); - // TODO(mcasas): Until https://crbug.com/338503 is landed, we only support - // ImageCapture-related constraints. - if (!image_capture_ || - image_capture_->HasNonImageCaptureConstraints(constraints)) { - resolver->Reject(DOMException::Create( - kNotSupportedError, - "Only Image-Capture constraints supported (https://crbug.com/338503)")); + MediaErrorState error_state; + ExecutionContext* execution_context = ExecutionContext::From(script_state); + WebMediaConstraints web_constraints = + MediaConstraintsImpl::Create(execution_context, constraints, error_state); + if (error_state.HadException()) { + resolver->Reject( + OverconstrainedError::Create(String(), "Cannot parse constraints")); return promise; } - // |constraints| empty means "remove/clear all current constraints". - if (!constraints.hasAdvanced() || constraints.advanced().IsEmpty()) - image_capture_->ClearMediaTrackConstraints(resolver); - else - image_capture_->SetMediaTrackConstraints(resolver, constraints.advanced()); + if (image_capture_) { + // TODO(guidou): Integrate image-capture constraints processing with the + // spec-compliant main implementation. http://crbug.com/708723 + if (ConstraintsHaveImageAndNonImageCapture(constraints)) { + resolver->Reject(OverconstrainedError::Create( + String(), + "Mixing ImageCapture and non-ImageCapture " + "constraints is not currently supported")); + return promise; + } + if (ConstraintsAreEmpty(constraints)) { + // Do not resolve the promise. Instead, just clear the ImageCapture + // constraints and then pass the empty constraints to the general + // implementation. + image_capture_->ClearMediaTrackConstraints(); + } else if (ConstraintsHaveImageCapture(constraints)) { + applyConstraintsImageCapture(resolver, constraints); + return promise; + } + } + + // Resolve empty constraints here instead of relying on UserMediaController + // because the empty constraints have already been applied to image capture + // and the promise must resolve. Empty constraints do not change any setting, + // so resolving here is OK. + if (ConstraintsAreEmpty(constraints)) { + SetConstraints(web_constraints); + resolver->Resolve(); + return promise; + } + + Document* document = ToDocument(execution_context); + UserMediaController* user_media = + UserMediaController::From(document->GetFrame()); + if (!user_media) { + resolver->Reject(OverconstrainedError::Create( + String(), "Cannot apply constraints due to unexpected error")); + return promise; + } + + user_media->ApplyConstraints( + ApplyConstraintsRequest::Create(Component(), web_constraints, resolver)); return promise; } +void MediaStreamTrack::applyConstraintsImageCapture( + ScriptPromiseResolver* resolver, + const MediaTrackConstraints& constraints) { + // |constraints| empty means "remove/clear all current constraints". + if (!constraints.hasAdvanced() || constraints.advanced().IsEmpty()) { + image_capture_->ClearMediaTrackConstraints(); + resolver->Resolve(); + } else { + image_capture_->SetMediaTrackConstraints(resolver, constraints.advanced()); + } +} + bool MediaStreamTrack::Ended() const { return stopped_ || (ready_state_ == MediaStreamSource::kReadyStateEnded); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h index e928374..71632f7b 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
@@ -45,6 +45,7 @@ class MediaTrackConstraints; class MediaStream; class MediaTrackSettings; +class ScriptPromiseResolver; class ScriptState; class MODULES_EXPORT MediaStreamTrack @@ -118,6 +119,8 @@ void SourceChangedState() override; void PropagateTrackEnded(); + void applyConstraintsImageCapture(ScriptPromiseResolver*, + const MediaTrackConstraints&); MediaStreamSource::ReadyState ready_state_; HeapHashSet<Member<MediaStream>> registered_media_streams_;
diff --git a/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.cpp b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.cpp new file mode 100644 index 0000000..63d34c79 --- /dev/null +++ b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.cpp
@@ -0,0 +1,18 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "modules/mediastream/OverconstrainedError.h" + +namespace blink { + +OverconstrainedError* OverconstrainedError::Create(const String& constraint, + const String& message) { + return new OverconstrainedError(constraint, message); +} + +OverconstrainedError::OverconstrainedError(const String& constraint, + const String& message) + : constraint_(constraint), message_(message) {} + +} // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.h b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.h new file mode 100644 index 0000000..64416113 --- /dev/null +++ b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef OverconstrainedError_h +#define OverconstrainedError_h + +#include "platform/bindings/ScriptWrappable.h" +#include "platform/wtf/text/WTFString.h" + +namespace blink { + +class OverconstrainedError final + : public GarbageCollectedFinalized<OverconstrainedError>, + public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); + + public: + static OverconstrainedError* Create(const String& constraint, + const String& message); + + String name() const { return "OverconstrainedError"; } + const String& constraint() const { return constraint_; } + const String& message() const { return message_; } + + DEFINE_INLINE_TRACE() {} + + private: + OverconstrainedError(const String& constraint, const String& message); + + String constraint_; + String message_; +}; + +} // namespace blink + +#endif // OverconstrainedError_h
diff --git a/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.idl b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.idl new file mode 100644 index 0000000..328a7686 --- /dev/null +++ b/third_party/WebKit/Source/modules/mediastream/OverconstrainedError.idl
@@ -0,0 +1,15 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://w3c.github.io/mediacapture-main/#overconstrainederror-object + +// TODO(guidou): OverconstrainedError should be an Error subclass and not an +// interface. http://crbug.com/769726 +[ + Constructor(DOMString constraint, DOMString message) +] interface OverconstrainedError { + readonly attribute DOMString name; + readonly attribute DOMString? message; + readonly attribute DOMString? constraint; +};
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaClient.cpp b/third_party/WebKit/Source/modules/mediastream/UserMediaClient.cpp index 25e90881..4ab7a77 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaClient.cpp +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaClient.cpp
@@ -30,8 +30,10 @@ #include "modules/mediastream/UserMediaClient.h" +#include "modules/mediastream/ApplyConstraintsRequest.h" #include "modules/mediastream/UserMediaRequest.h" #include "platform/wtf/RefPtr.h" +#include "public/web/WebApplyConstraintsRequest.h" #include "public/web/WebFrameClient.h" #include "public/web/WebMediaDeviceChangeObserver.h" #include "public/web/WebMediaDevicesRequest.h" @@ -67,4 +69,10 @@ } } +void UserMediaClient::ApplyConstraints(ApplyConstraintsRequest* request) { + if (client_) { + client_->ApplyConstraints(WebApplyConstraintsRequest(request)); + } +} + } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaClient.h b/third_party/WebKit/Source/modules/mediastream/UserMediaClient.h index b00b8f99..6b713b63 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaClient.h +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaClient.h
@@ -31,6 +31,8 @@ #ifndef UserMediaClient_h #define UserMediaClient_h +#include <memory> + #include "modules/ModulesExport.h" #include "modules/mediastream/UserMediaClient.h" #include "platform/wtf/PtrUtil.h" @@ -38,6 +40,7 @@ namespace blink { +class ApplyConstraintsRequest; class LocalFrame; class MediaDevices; class MediaDevicesRequest; @@ -54,6 +57,7 @@ void CancelUserMediaRequest(UserMediaRequest*); void RequestMediaDevices(MediaDevicesRequest*); void SetMediaDeviceChangeObserver(MediaDevices*); + void ApplyConstraints(ApplyConstraintsRequest*); private: explicit UserMediaClient(WebUserMediaClient*);
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h index 72e45c2..884aadd6 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h
@@ -25,11 +25,14 @@ #ifndef UserMediaController_h #define UserMediaController_h +#include <memory> + #include "core/frame/LocalFrame.h" #include "modules/mediastream/UserMediaClient.h" namespace blink { +class ApplyConstraintsRequest; class MediaDevices; class MediaDevicesRequest; class UserMediaRequest; @@ -49,6 +52,7 @@ void CancelUserMediaRequest(UserMediaRequest*); void RequestMediaDevices(MediaDevicesRequest*); void SetMediaDeviceChangeObserver(MediaDevices*); + void ApplyConstraints(ApplyConstraintsRequest*); static const char* SupplementName(); static UserMediaController* From(LocalFrame* frame) { @@ -79,6 +83,11 @@ client_->SetMediaDeviceChangeObserver(observer); } +inline void UserMediaController::ApplyConstraints( + ApplyConstraintsRequest* request) { + client_->ApplyConstraints(request); +} + } // namespace blink #endif // UserMediaController_h
diff --git a/third_party/WebKit/Source/modules/modules_idl_files.gni b/third_party/WebKit/Source/modules/modules_idl_files.gni index 4e16c54..cd9f170 100644 --- a/third_party/WebKit/Source/modules/modules_idl_files.gni +++ b/third_party/WebKit/Source/modules/modules_idl_files.gni
@@ -188,6 +188,7 @@ "mediastream/NavigatorUserMediaError.idl", "mediastream/NavigatorUserMediaErrorCallback.idl", "mediastream/NavigatorUserMediaSuccessCallback.idl", + "mediastream/OverconstrainedError.idl", "netinfo/NetworkInformation.idl", "nfc/MessageCallback.idl", "nfc/NFC.idl",
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContextTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContextTest.cpp index 6d43a6e..95bd39c 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioContextTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioContextTest.cpp
@@ -96,10 +96,6 @@ dummy_page_holder_ = DummyPageHolder::Create(); } - void TearDown() override { - AudioWorkletThread::ClearSharedBackingThread(); - } - Document& GetDocument() { return dummy_page_holder_->GetDocument(); } private:
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp index a1a4efe..9e83478 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.cpp
@@ -9,7 +9,6 @@ #include "core/frame/LocalFrame.h" #include "core/workers/WorkerClients.h" #include "modules/webaudio/AudioWorkletMessagingProxy.h" -#include "modules/webaudio/AudioWorkletThread.h" #include "modules/webaudio/BaseAudioContext.h" namespace blink { @@ -27,6 +26,11 @@ void AudioWorklet::RegisterContext(BaseAudioContext* context) { DCHECK(!contexts_.Contains(context)); contexts_.insert(context); + + // Check if AudioWorklet loads the script and has an active + // AudioWorkletGlobalScope before getting the messaging proxy. + if (IsWorkletMessagingProxyCreated()) + context->SetWorkletMessagingProxy(FindAvailableMessagingProxy()); } void AudioWorklet::UnregisterContext(BaseAudioContext* context) { @@ -37,6 +41,14 @@ contexts_.erase(context); } +AudioWorkletMessagingProxy* AudioWorklet::FindAvailableMessagingProxy() { + return static_cast<AudioWorkletMessagingProxy*>(FindAvailableGlobalScope()); +} + +bool AudioWorklet::IsWorkletMessagingProxyCreated() const { + return GetNumberOfGlobalScopes() > 0; +} + bool AudioWorklet::NeedsToCreateGlobalScope() { // TODO(hongchan): support multiple WorkletGlobalScopes, one scope per a // BaseAudioContext. In order to do it, FindAvailableGlobalScope() needs to @@ -46,12 +58,20 @@ WorkletGlobalScopeProxy* AudioWorklet::CreateGlobalScope() { DCHECK(NeedsToCreateGlobalScope()); - AudioWorkletThread::EnsureSharedBackingThread(); WorkerClients* worker_clients = WorkerClients::Create(); AudioWorkletMessagingProxy* proxy = new AudioWorkletMessagingProxy(GetExecutionContext(), worker_clients); proxy->Initialize(); + + for (BaseAudioContext* context : contexts_) { + // TODO(hongchan): Currently all BaseAudioContexts shares a single + // AudioWorkletMessagingProxy. Fix this to support one messaging proxy for + // each BaseAudioContext. + if (!context->WorkletMessagingProxy()) + context->SetWorkletMessagingProxy(proxy); + } + return proxy; }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.h b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.h index 3826c24..abe880ef 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorklet.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorklet.h
@@ -11,6 +11,7 @@ namespace blink { +class AudioWorkletMessagingProxy; class BaseAudioContext; class LocalFrame; @@ -24,6 +25,8 @@ void RegisterContext(BaseAudioContext*); void UnregisterContext(BaseAudioContext*); + AudioWorkletMessagingProxy* FindAvailableMessagingProxy(); + DECLARE_VIRTUAL_TRACE(); private: @@ -33,6 +36,8 @@ bool NeedsToCreateGlobalScope() final; WorkletGlobalScopeProxy* CreateGlobalScope() final; + bool IsWorkletMessagingProxyCreated() const; + // AudioWorklet keeps the reference of all active BaseAudioContexts, so it // can notify the contexts when a script is loaded in AudioWorkletGlobalScope. HeapHashSet<Member<BaseAudioContext>> contexts_;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp index d937dd8c..1a688a65 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp
@@ -47,8 +47,6 @@ SecurityOrigin::Create(KURL(kParsedURLString, "http://fake.url/")); } - void TearDown() override { AudioWorkletThread::ClearSharedBackingThread(); } - std::unique_ptr<AudioWorkletThread> CreateAudioWorkletThread() { std::unique_ptr<AudioWorkletThread> thread = AudioWorkletThread::Create(nullptr, *reporting_proxy_);
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.cpp index 64893c1..0036fb4 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.cpp
@@ -39,6 +39,11 @@ return processor_info_map_.at(name); } +WebThread* AudioWorkletMessagingProxy::GetWorkletBackingThread() { + auto worklet_thread = static_cast<AudioWorkletThread*>(GetWorkerThread()); + return worklet_thread->GetSharedBackingThread(); +} + std::unique_ptr<ThreadedWorkletObjectProxy> AudioWorkletMessagingProxy::CreateObjectProxy( ThreadedWorkletMessagingProxy* messaging_proxy,
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.h index b20d4d5c5..313d8915 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.h
@@ -13,6 +13,7 @@ class CrossThreadAudioParamInfo; class CrossThreadAudioWorkletProcessorInfo; class ExecutionContext; +class WebThread; class WorkerThread; // AudioWorkletMessagingProxy is a main thread interface for @@ -37,6 +38,8 @@ const Vector<CrossThreadAudioParamInfo> GetParamInfoListForProcessor( const String& name) const; + WebThread* GetWorkletBackingThread(); + private: ~AudioWorkletMessagingProxy() override;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.cpp index a9fffe3..5aa9b2d 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.cpp
@@ -24,12 +24,13 @@ WebThread* AudioWorkletThread::s_backing_thread_ = nullptr; +unsigned AudioWorkletThread::s_ref_count_ = 0; + std::unique_ptr<AudioWorkletThread> AudioWorkletThread::Create( ThreadableLoadingContext* loading_context, WorkerReportingProxy& worker_reporting_proxy) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("audio-worklet"), "AudioWorkletThread::create"); - DCHECK(IsMainThread()); return WTF::WrapUnique( new AudioWorkletThread(loading_context, worker_reporting_proxy)); } @@ -37,9 +38,17 @@ AudioWorkletThread::AudioWorkletThread( ThreadableLoadingContext* loading_context, WorkerReportingProxy& worker_reporting_proxy) - : WorkerThread(loading_context, worker_reporting_proxy) {} + : WorkerThread(loading_context, worker_reporting_proxy) { + DCHECK(IsMainThread()); + if (++s_ref_count_ == 1) + EnsureSharedBackingThread(); +} -AudioWorkletThread::~AudioWorkletThread() {} +AudioWorkletThread::~AudioWorkletThread() { + DCHECK(IsMainThread()); + if (--s_ref_count_ == 0) + ClearSharedBackingThread(); +} WorkerBackingThread& AudioWorkletThread::GetWorkerBackingThread() { return *WorkletThreadHolder<AudioWorkletThread>::GetInstance()->GetThread(); @@ -72,6 +81,8 @@ void AudioWorkletThread::ClearSharedBackingThread() { DCHECK(IsMainThread()); + DCHECK(s_backing_thread_); + DCHECK_EQ(s_ref_count_, 0u); WorkletThreadHolder<AudioWorkletThread>::ClearInstance(); delete s_backing_thread_; s_backing_thread_ = nullptr; @@ -85,7 +96,9 @@ } void AudioWorkletThread::CreateSharedBackingThreadForTest() { - WorkletThreadHolder<AudioWorkletThread>::CreateForTest("AudioWorkletThread"); + if (!s_backing_thread_) + s_backing_thread_ = Platform::Current()->CreateWebAudioThread().release(); + WorkletThreadHolder<AudioWorkletThread>::CreateForTest(s_backing_thread_); } WorkerOrWorkletGlobalScope* AudioWorkletThread::CreateWorkerGlobalScope(
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h index 477cd13b..b1d8dd9 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h
@@ -17,7 +17,8 @@ // AudioWorkletThread is a per-frame singleton object that represents the // backing thread for the processing of AudioWorkletNode/AudioWorkletProcessor. -// It is supposed to run an instance of V8 isolate. +// It is supposed to run an instance of V8 isolate. The life cycle of this +// object is managed by the reference counting of the static backing thread. class MODULES_EXPORT AudioWorkletThread final : public WorkerThread { public: @@ -54,6 +55,10 @@ // This raw pointer gets assigned in EnsureSharedBackingThread() and manually // released by ClearSharedBackingThread(). static WebThread* s_backing_thread_; + + // This is only accessed by the main thread. Incremented by the constructor, + // and decremented by destructor. + static unsigned s_ref_count_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp index 1cf5111..7bc1d4d 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp
@@ -37,8 +37,6 @@ SecurityOrigin::Create(KURL(kParsedURLString, "http://fake.url/")); } - void TearDown() override { AudioWorkletThread::ClearSharedBackingThread(); } - std::unique_ptr<AudioWorkletThread> CreateAudioWorkletThread() { std::unique_ptr<AudioWorkletThread> thread = AudioWorkletThread::Create(nullptr, *reporting_proxy_);
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp index 3bc02b5..d9c163ba 100644 --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
@@ -50,6 +50,7 @@ #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" #include "modules/webaudio/AudioWorklet.h" +#include "modules/webaudio/AudioWorkletMessagingProxy.h" #include "modules/webaudio/BiquadFilterNode.h" #include "modules/webaudio/ChannelMergerNode.h" #include "modules/webaudio/ChannelSplitterNode.h" @@ -160,10 +161,11 @@ } // Check if a document or a frame supports AudioWorklet. If not, AudioWorklet - // cannot be accssed. - if (RuntimeEnabledFeatures::AudioWorkletEnabled() && - WindowAudioWorklet::audioWorklet(this)) { - WindowAudioWorklet::audioWorklet(this)->RegisterContext(this); + // cannot be accessed. + if (RuntimeEnabledFeatures::AudioWorkletEnabled()) { + AudioWorklet* audioWorklet = WindowAudioWorklet::audioWorklet(this); + if (audioWorklet) + audioWorklet->RegisterContext(this); } } @@ -180,9 +182,12 @@ // AudioWorklet may be destroyed before the context goes away. So we have to // check the pointer. See: crbug.com/503845 - if (RuntimeEnabledFeatures::AudioWorkletEnabled() && - WindowAudioWorklet::audioWorklet(this)) { - WindowAudioWorklet::audioWorklet(this)->UnregisterContext(this); + if (RuntimeEnabledFeatures::AudioWorkletEnabled()) { + AudioWorklet* audioWorklet = WindowAudioWorklet::audioWorklet(this); + if (audioWorklet) { + audioWorklet->UnregisterContext(this); + worklet_messaging_proxy_.Clear(); + } } if (!IsDestinationInitialized()) @@ -997,11 +1002,11 @@ visitor->Trace(success_callbacks_); visitor->Trace(error_callbacks_); visitor->Trace(decode_audio_resolvers_); - visitor->Trace(periodic_wave_sine_); visitor->Trace(periodic_wave_square_); visitor->Trace(periodic_wave_sawtooth_); visitor->Trace(periodic_wave_triangle_); + visitor->Trace(worklet_messaging_proxy_); EventTargetWithInlineData::Trace(visitor); SuspendableObject::Trace(visitor); } @@ -1026,4 +1031,15 @@ return nullptr; } +void BaseAudioContext::SetWorkletMessagingProxy( + AudioWorkletMessagingProxy* proxy) { + DCHECK(!worklet_messaging_proxy_); + worklet_messaging_proxy_ = proxy; +} + +AudioWorkletMessagingProxy* BaseAudioContext::WorkletMessagingProxy() { + DCHECK(!worklet_messaging_proxy_); + return worklet_messaging_proxy_; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h index 5cc8e10..0734f9e 100644 --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h
@@ -55,6 +55,7 @@ class AudioBufferSourceNode; class AudioContextOptions; class AudioListener; +class AudioWorkletMessagingProxy; class BiquadFilterNode; class ChannelMergerNode; class ChannelSplitterNode; @@ -333,6 +334,10 @@ // gesture while the AudioContext requires a user gesture. void MaybeRecordStartAttempt(); + void SetWorkletMessagingProxy(AudioWorkletMessagingProxy*); + + AudioWorkletMessagingProxy* WorkletMessagingProxy(); + protected: enum ContextType { kRealtimeContext, kOfflineContext }; @@ -508,6 +513,8 @@ Optional<AutoplayStatus> autoplay_status_; AudioIOPosition output_position_; + + Member<AudioWorkletMessagingProxy> worklet_messaging_proxy_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp index c3bdab2..c6f4e5f 100644 --- a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
@@ -28,8 +28,8 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" -#include "modules/webaudio/AudioWorkletThread.h" #include "modules/webaudio/BaseAudioContext.h" +#include "modules/webaudio/AudioWorkletMessagingProxy.h" namespace blink { @@ -85,12 +85,13 @@ } void DefaultAudioDestinationHandler::StartDestination() { - // Use Experimental AudioWorkletThread only when AudioWorklet is enabled. - if (RuntimeEnabledFeatures::AudioWorkletEnabled()) { - AudioWorkletThread::EnsureSharedBackingThread(); - DCHECK(AudioWorkletThread::GetSharedBackingThread()); + // Use Experimental AudioWorkletThread only when AudioWorklet is enabled and + // there is an active AudioWorkletGlobalScope. + if (RuntimeEnabledFeatures::AudioWorkletEnabled() && + Context()->WorkletMessagingProxy()) { + DCHECK(Context()->WorkletMessagingProxy()->GetWorkletBackingThread()); destination_->StartWithWorkletThread( - AudioWorkletThread::GetSharedBackingThread()); + Context()->WorkletMessagingProxy()->GetWorkletBackingThread()); } else { destination_->Start(); }
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp index cc5d288..54211f8 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -29,6 +29,7 @@ #include "core/dom/TaskRunnerHelper.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" +#include "modules/webaudio/AudioWorkletMessagingProxy.h" #include "modules/webaudio/AudioWorkletThread.h" #include "modules/webaudio/BaseAudioContext.h" #include "modules/webaudio/OfflineAudioContext.h" @@ -141,9 +142,13 @@ AudioBuffer* render_target) { DCHECK(IsMainThread()); - if (RuntimeEnabledFeatures::AudioWorkletEnabled()) { - AudioWorkletThread::EnsureSharedBackingThread(); - worklet_backing_thread_ = AudioWorkletThread::GetSharedBackingThread(); + // Use Experimental AudioWorkletThread only when AudioWorklet is enabled and + // there is an active AudioWorkletGlobalScope. + if (RuntimeEnabledFeatures::AudioWorkletEnabled() && + Context()->WorkletMessagingProxy()) { + DCHECK(Context()->WorkletMessagingProxy()->GetWorkletBackingThread()); + worklet_backing_thread_ = + Context()->WorkletMessagingProxy()->GetWorkletBackingThread(); } else { render_thread_ = Platform::Current()->CreateThread("offline audio renderer"); @@ -364,7 +369,10 @@ WebThread* OfflineAudioDestinationHandler::GetRenderingThread() { DCHECK(IsInitialized()); - if (RuntimeEnabledFeatures::AudioWorkletEnabled()) { + // Use Experimental AudioWorkletThread only when AudioWorklet is enabled and + // there is an active AudioWorkletGlobalScope. + if (RuntimeEnabledFeatures::AudioWorkletEnabled() && + Context()->WorkletMessagingProxy()) { DCHECK(!render_thread_ && worklet_backing_thread_); return worklet_backing_thread_; }
diff --git a/third_party/WebKit/Source/platform/Histogram.h b/third_party/WebKit/Source/platform/Histogram.h index ec4c13a..581e83c 100644 --- a/third_party/WebKit/Source/platform/Histogram.h +++ b/third_party/WebKit/Source/platform/Histogram.h
@@ -78,6 +78,11 @@ CustomCountHistogram& counter_; }; +#define SCOPED_BLINK_UMA_HISTOGRAM_TIMER_IMPL(name, allow_cross_thread) \ + DEFINE_STATIC_LOCAL_IMPL(CustomCountHistogram, scoped_us_counter, \ + (name, 0, 10000000, 50), allow_cross_thread); \ + ScopedUsHistogramTimer timer(scoped_us_counter); + // Use code like this to record time, in microseconds, to execute a block of // code: // @@ -87,10 +92,13 @@ // } // This macro records all times between 0us and 10 seconds. // Do not change this macro without renaming all metrics that use it! -#define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ - DEFINE_STATIC_LOCAL(CustomCountHistogram, scoped_us_counter, \ - (name, 0, 10000000, 50)); \ - ScopedUsHistogramTimer timer(scoped_us_counter); +#define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ + SCOPED_BLINK_UMA_HISTOGRAM_TIMER_IMPL(name, false) + +// Thread-safe variant of SCOPED_BLINK_UMA_HISTOGRAM_TIMER. +// Use if the histogram can be accessed by multiple threads. +#define SCOPED_BLINK_UMA_HISTOGRAM_TIMER_THREAD_SAFE(name) \ + SCOPED_BLINK_UMA_HISTOGRAM_TIMER_IMPL(name, true) } // namespace blink
diff --git a/third_party/WebKit/Source/platform/fonts/FontVariantEastAsian.cpp b/third_party/WebKit/Source/platform/fonts/FontVariantEastAsian.cpp index 51bff78..7e184b3 100644 --- a/third_party/WebKit/Source/platform/fonts/FontVariantEastAsian.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontVariantEastAsian.cpp
@@ -8,7 +8,7 @@ namespace blink { -static const char* kUnknownString = "Unknown"; +static const char* kUnknownEastAsianString = "Unknown"; String FontVariantEastAsian::ToString(EastAsianForm form) { switch (form) { @@ -27,7 +27,7 @@ case EastAsianForm::kTraditional: return "Traditional"; } - return kUnknownString; + return kUnknownEastAsianString; } String FontVariantEastAsian::ToString(EastAsianWidth width) { @@ -39,7 +39,7 @@ case FontVariantEastAsian::kProportionalWidth: return "Proportional"; } - return kUnknownString; + return kUnknownEastAsianString; } String FontVariantEastAsian::ToString() const {
diff --git a/third_party/WebKit/Source/platform/fonts/FontVariantNumeric.cpp b/third_party/WebKit/Source/platform/fonts/FontVariantNumeric.cpp index 7face8c..99e58d0c 100644 --- a/third_party/WebKit/Source/platform/fonts/FontVariantNumeric.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontVariantNumeric.cpp
@@ -8,7 +8,7 @@ namespace blink { -static const char* kUnknownString = "Unknown"; +static const char* kUnknownNumericString = "Unknown"; String FontVariantNumeric::ToString(NumericFigure figure) { switch (figure) { @@ -19,7 +19,7 @@ case kOldstyleNums: return "OldstyleNums"; } - return kUnknownString; + return kUnknownNumericString; } String FontVariantNumeric::ToString(NumericSpacing spacing) { @@ -31,7 +31,7 @@ case kTabularNums: return "TabularNums"; } - return kUnknownString; + return kUnknownNumericString; } String FontVariantNumeric::ToString(NumericFraction fraction) { @@ -43,7 +43,7 @@ case kStackedFractions: return "Stacked"; } - return kUnknownString; + return kUnknownNumericString; } String FontVariantNumeric::ToString(Ordinal ordinal) { @@ -53,7 +53,7 @@ case kOrdinalOn: return "On"; } - return kUnknownString; + return kUnknownNumericString; } String FontVariantNumeric::ToString(SlashedZero slashed) { @@ -63,7 +63,7 @@ case kSlashedZeroOn: return "On"; } - return kUnknownString; + return kUnknownNumericString; } String FontVariantNumeric::ToString() const {
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index a066b73..7b2fee5 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -121,27 +121,27 @@ } void ThreadHeapStats::IncreaseAllocatedObjectSize(size_t delta) { - AtomicAdd(&allocated_object_size_, static_cast<long>(delta)); + allocated_object_size_ += delta; ProcessHeap::IncreaseTotalAllocatedObjectSize(delta); } void ThreadHeapStats::DecreaseAllocatedObjectSize(size_t delta) { - AtomicSubtract(&allocated_object_size_, static_cast<long>(delta)); + allocated_object_size_ -= delta; ProcessHeap::DecreaseTotalAllocatedObjectSize(delta); } void ThreadHeapStats::IncreaseMarkedObjectSize(size_t delta) { - AtomicAdd(&marked_object_size_, static_cast<long>(delta)); + marked_object_size_ += delta; ProcessHeap::IncreaseTotalMarkedObjectSize(delta); } void ThreadHeapStats::IncreaseAllocatedSpace(size_t delta) { - AtomicAdd(&allocated_space_, static_cast<long>(delta)); + allocated_space_ += delta; ProcessHeap::IncreaseTotalAllocatedSpace(delta); } void ThreadHeapStats::DecreaseAllocatedSpace(size_t delta) { - AtomicSubtract(&allocated_space_, static_cast<long>(delta)); + allocated_space_ -= delta; ProcessHeap::DecreaseTotalAllocatedSpace(delta); } @@ -510,7 +510,6 @@ ProcessHeap::DecreaseTotalMarkedObjectSize(stats_.MarkedObjectSize()); stats_.Reset(); - thread_state_->ResetHeapCounters(); } ThreadHeap* ThreadHeap::main_thread_heap_ = nullptr;
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h index 53cf251..fbb9cf6 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.h +++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -168,38 +168,30 @@ public: ThreadHeapStats(); void SetMarkedObjectSizeAtLastCompleteSweep(size_t size) { - ReleaseStore(&marked_object_size_at_last_complete_sweep_, size); + marked_object_size_at_last_complete_sweep_ = size; } size_t MarkedObjectSizeAtLastCompleteSweep() { - return AcquireLoad(&marked_object_size_at_last_complete_sweep_); + return marked_object_size_at_last_complete_sweep_; } void IncreaseAllocatedObjectSize(size_t delta); void DecreaseAllocatedObjectSize(size_t delta); - size_t AllocatedObjectSize() { return AcquireLoad(&allocated_object_size_); } + size_t AllocatedObjectSize() { return allocated_object_size_; } void IncreaseMarkedObjectSize(size_t delta); - size_t MarkedObjectSize() { return AcquireLoad(&marked_object_size_); } + size_t MarkedObjectSize() { return marked_object_size_; } void IncreaseAllocatedSpace(size_t delta); void DecreaseAllocatedSpace(size_t delta); - size_t AllocatedSpace() { return AcquireLoad(&allocated_space_); } - size_t ObjectSizeAtLastGC() { return AcquireLoad(&object_size_at_last_gc_); } - void IncreaseWrapperCount(size_t delta) { - AtomicAdd(&wrapper_count_, static_cast<long>(delta)); - } - void DecreaseWrapperCount(size_t delta) { - AtomicSubtract(&wrapper_count_, static_cast<long>(delta)); - } + size_t AllocatedSpace() { return allocated_space_; } + size_t ObjectSizeAtLastGC() { return object_size_at_last_gc_; } + void IncreaseWrapperCount(size_t delta) { wrapper_count_ += delta; } + void DecreaseWrapperCount(size_t delta) { wrapper_count_ -= delta; } size_t WrapperCount() { return AcquireLoad(&wrapper_count_); } - size_t WrapperCountAtLastGC() { - return AcquireLoad(&wrapper_count_at_last_gc_); - } + size_t WrapperCountAtLastGC() { return wrapper_count_at_last_gc_; } void IncreaseCollectedWrapperCount(size_t delta) { - AtomicAdd(&collected_wrapper_count_, static_cast<long>(delta)); + collected_wrapper_count_ += delta; } - size_t CollectedWrapperCount() { - return AcquireLoad(&collected_wrapper_count_); - } + size_t CollectedWrapperCount() { return collected_wrapper_count_; } size_t PartitionAllocSizeAtLastGC() { - return AcquireLoad(&partition_alloc_size_at_last_gc_); + return partition_alloc_size_at_last_gc_; } void SetEstimatedMarkingTimePerByte(double estimated_marking_time_per_byte) { estimated_marking_time_per_byte_ = estimated_marking_time_per_byte;
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp index f4de14b..145d16c 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -728,7 +728,7 @@ if (start_of_gap != page->PayloadEnd()) AddToFreeList(start_of_gap, page->PayloadEnd() - start_of_gap); } - GetThreadState()->DecreaseAllocatedObjectSize(freed_size); + GetThreadState()->Heap().HeapStats().DecreaseAllocatedObjectSize(freed_size); DCHECK_EQ(promptly_freed_size_, freed_size); promptly_freed_size_ = 0; return true; @@ -851,17 +851,17 @@ // - if smaller, a net reduction in size since last call to // updateRemainingAllocationSize(). if (last_remaining_allocation_size_ > remaining_allocation_size_) - GetThreadState()->IncreaseAllocatedObjectSize( + GetThreadState()->Heap().HeapStats().IncreaseAllocatedObjectSize( last_remaining_allocation_size_ - remaining_allocation_size_); else if (last_remaining_allocation_size_ != remaining_allocation_size_) - GetThreadState()->DecreaseAllocatedObjectSize( + GetThreadState()->Heap().HeapStats().DecreaseAllocatedObjectSize( remaining_allocation_size_ - last_remaining_allocation_size_); last_remaining_allocation_size_ = remaining_allocation_size_; } void NormalPageArena::UpdateRemainingAllocationSize() { if (last_remaining_allocation_size_ > RemainingAllocationSize()) { - GetThreadState()->IncreaseAllocatedObjectSize( + GetThreadState()->Heap().HeapStats().IncreaseAllocatedObjectSize( last_remaining_allocation_size_ - RemainingAllocationSize()); last_remaining_allocation_size_ = RemainingAllocationSize(); } @@ -1027,7 +1027,8 @@ GetThreadState()->Heap().HeapStats().IncreaseAllocatedSpace( large_object->size()); - GetThreadState()->IncreaseAllocatedObjectSize(large_object->size()); + GetThreadState()->Heap().HeapStats().IncreaseAllocatedObjectSize( + large_object->size()); return result; } @@ -1369,8 +1370,10 @@ #endif } - if (marked_object_size) - page_arena->GetThreadState()->IncreaseMarkedObjectSize(marked_object_size); + if (marked_object_size) { + page_arena->GetThreadState()->Heap().HeapStats().IncreaseMarkedObjectSize( + marked_object_size); + } } void NormalPage::SweepAndCompact(CompactionContext& context) { @@ -1467,8 +1470,10 @@ allocation_point += size; DCHECK(allocation_point <= current_page->PayloadSize()); } - if (marked_object_size) - page_arena->GetThreadState()->IncreaseMarkedObjectSize(marked_object_size); + if (marked_object_size) { + page_arena->GetThreadState()->Heap().HeapStats().IncreaseMarkedObjectSize( + marked_object_size); + } #if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) @@ -1733,7 +1738,8 @@ void LargeObjectPage::Sweep() { GetHeapObjectHeader()->Unmark(); - Arena()->GetThreadState()->IncreaseMarkedObjectSize(size()); + Arena()->GetThreadState()->Heap().HeapStats().IncreaseMarkedObjectSize( + size()); } void LargeObjectPage::MakeConsistentForMutator() {
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 4df4a15f..d24f1eef 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -130,8 +130,6 @@ #if defined(LEAK_SANITIZER) disabled_static_persistent_registration_(0), #endif - allocated_object_size_(0), - marked_object_size_(0), reported_memory_to_v8_(0) { DCHECK(CheckThread()); DCHECK(!**thread_specific_); @@ -1194,33 +1192,14 @@ if (!isolate_) return; - size_t current_heap_size = allocated_object_size_ + marked_object_size_; + size_t current_heap_size = heap_->HeapStats().AllocatedObjectSize() + + heap_->HeapStats().MarkedObjectSize(); int64_t diff = static_cast<int64_t>(current_heap_size) - static_cast<int64_t>(reported_memory_to_v8_); isolate_->AdjustAmountOfExternalAllocatedMemory(diff); reported_memory_to_v8_ = current_heap_size; } -void ThreadState::ResetHeapCounters() { - allocated_object_size_ = 0; - marked_object_size_ = 0; -} - -void ThreadState::IncreaseAllocatedObjectSize(size_t delta) { - allocated_object_size_ += delta; - heap_->HeapStats().IncreaseAllocatedObjectSize(delta); -} - -void ThreadState::DecreaseAllocatedObjectSize(size_t delta) { - allocated_object_size_ -= delta; - heap_->HeapStats().DecreaseAllocatedObjectSize(delta); -} - -void ThreadState::IncreaseMarkedObjectSize(size_t delta) { - marked_object_size_ += delta; - heap_->HeapStats().IncreaseMarkedObjectSize(delta); -} - void ThreadState::CopyStackUntilSafePointScope() { if (!safe_point_scope_marker_ || stack_state_ == BlinkGC::kNoHeapPointersOnStack)
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h index d5055a2..4d18d53 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.h +++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -540,11 +540,6 @@ void leaveStaticReferenceRegistrationDisabledScope(); #endif - void ResetHeapCounters(); - void IncreaseAllocatedObjectSize(size_t); - void DecreaseAllocatedObjectSize(size_t); - void IncreaseMarkedObjectSize(size_t); - v8::Isolate* GetIsolate() const { return isolate_; } BlinkGC::StackState GetStackState() const { return stack_state_; } @@ -748,9 +743,6 @@ kLikelyToBePromptlyFreedArraySize - 1; std::unique_ptr<int[]> likely_to_be_promptly_freed_; - // Stats for heap memory of this thread. - size_t allocated_object_size_; - size_t marked_object_size_; size_t reported_memory_to_v8_; int gc_age_ = 0;
diff --git a/third_party/WebKit/Source/platform/loader/BUILD.gn b/third_party/WebKit/Source/platform/loader/BUILD.gn index a00696b..9a9d6db 100644 --- a/third_party/WebKit/Source/platform/loader/BUILD.gn +++ b/third_party/WebKit/Source/platform/loader/BUILD.gn
@@ -99,6 +99,7 @@ "//mojo/public/cpp/system:system", "//storage/public/interfaces:interfaces_blink", "//third_party/WebKit/Source/platform:make_platform_generated", + "//third_party/WebKit/common:blink_common", "//third_party/WebKit/public:mojo_bindings_blink", ]
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp index ce37b08..88f65de 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
@@ -4,26 +4,18 @@ #include "platform/loader/fetch/ClientHintsPreferences.h" +#include "base/macros.h" #include "platform/HTTPNames.h" #include "platform/loader/fetch/ResourceResponse.h" #include "platform/network/HTTPParsers.h" #include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" +#include "third_party/WebKit/common/client_hints/client_hints.h" namespace blink { namespace { -// Mapping from WebClientHintsType to the header value for enabling the -// corresponding client hint. The ordering should match the ordering of enums in -// WebClientHintsType. -static constexpr const char* kHeaderMapping[] = {"device-memory", "dpr", - "width", "viewport-width"}; - -static_assert(static_cast<int>(mojom::WebClientHintsType::kLast) + 1 == - arraysize(kHeaderMapping), - "unhandled client hint type"); - void ParseAcceptChHeader(const String& header_value, WebEnabledClientHints& enabled_hints) { CommaDelimitedHeaderSet accept_client_hints_header; @@ -33,7 +25,7 @@ ++i) { enabled_hints.SetIsEnabled( static_cast<mojom::WebClientHintsType>(i), - accept_client_hints_header.Contains(kHeaderMapping[i])); + accept_client_hints_header.Contains(kClientHintsHeaderMapping[i])); } enabled_hints.SetIsEnabled( @@ -44,7 +36,10 @@ } // namespace -ClientHintsPreferences::ClientHintsPreferences() {} +ClientHintsPreferences::ClientHintsPreferences() { + DCHECK_EQ(static_cast<size_t>(mojom::WebClientHintsType::kLast) + 1, + kClientHintsHeaderMappingCount); +} void ClientHintsPreferences::UpdateFrom( const ClientHintsPreferences& preferences) {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index fc319f4..e5f1ce3 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -657,7 +657,8 @@ ResourceRequest& resource_request = params.MutableResourceRequest(); network_instrumentation::ScopedResourceLoadTracker scoped_resource_load_tracker(identifier, resource_request); - SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Fetch.RequestResourceTime"); + SCOPED_BLINK_UMA_HISTOGRAM_TIMER_THREAD_SAFE( + "Blink.Fetch.RequestResourceTime"); // TODO(dproy): Remove this. http://crbug.com/659666 TRACE_EVENT1("blink", "ResourceFetcher::requestResource", "url", UrlForTraceEvent(params.Url())); @@ -1593,39 +1594,52 @@ NOTREACHED(); } } - DEFINE_STATIC_LOCAL(CustomCountHistogram, image_preloads, - ("PreloadScanner.Counts2.Image", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, image_preload_misses, - ("PreloadScanner.Counts2.Miss.Image", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, script_preloads, - ("PreloadScanner.Counts2.Script", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, script_preload_misses, - ("PreloadScanner.Counts2.Miss.Script", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, stylesheet_preloads, - ("PreloadScanner.Counts2.CSSStyleSheet", 0, 100, 25)); - DEFINE_STATIC_LOCAL( + + DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, image_preloads, + ("PreloadScanner.Counts2.Image", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, image_preload_misses, + ("PreloadScanner.Counts2.Miss.Image", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, script_preloads, + ("PreloadScanner.Counts2.Script", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, script_preload_misses, + ("PreloadScanner.Counts2.Miss.Script", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, stylesheet_preloads, + ("PreloadScanner.Counts2.CSSStyleSheet", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( CustomCountHistogram, stylesheet_preload_misses, ("PreloadScanner.Counts2.Miss.CSSStyleSheet", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, font_preloads, - ("PreloadScanner.Counts2.Font", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, font_preload_misses, - ("PreloadScanner.Counts2.Miss.Font", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, media_preloads, - ("PreloadScanner.Counts2.Media", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, media_preload_misses, - ("PreloadScanner.Counts2.Miss.Media", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, text_track_preloads, - ("PreloadScanner.Counts2.TextTrack", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, text_track_preload_misses, - ("PreloadScanner.Counts2.Miss.TextTrack", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, import_preloads, - ("PreloadScanner.Counts2.Import", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, import_preload_misses, - ("PreloadScanner.Counts2.Miss.Import", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, raw_preloads, - ("PreloadScanner.Counts2.Raw", 0, 100, 25)); - DEFINE_STATIC_LOCAL(CustomCountHistogram, raw_preload_misses, - ("PreloadScanner.Counts2.Miss.Raw", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, font_preloads, + ("PreloadScanner.Counts2.Font", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, font_preload_misses, + ("PreloadScanner.Counts2.Miss.Font", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, media_preloads, + ("PreloadScanner.Counts2.Media", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, media_preload_misses, + ("PreloadScanner.Counts2.Miss.Media", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, text_track_preloads, + ("PreloadScanner.Counts2.TextTrack", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, text_track_preload_misses, + ("PreloadScanner.Counts2.Miss.TextTrack", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, import_preloads, + ("PreloadScanner.Counts2.Import", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, import_preload_misses, + ("PreloadScanner.Counts2.Miss.Import", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, raw_preloads, + ("PreloadScanner.Counts2.Raw", 0, 100, 25)); + DEFINE_THREAD_SAFE_STATIC_LOCAL( + CustomCountHistogram, raw_preload_misses, + ("PreloadScanner.Counts2.Miss.Raw", 0, 100, 25)); + if (images) image_preloads.Count(images); if (image_misses)
diff --git a/third_party/WebKit/Source/platform/wtf/DequeTest.cpp b/third_party/WebKit/Source/platform/wtf/DequeTest.cpp index 5e20a39..6704a31 100644 --- a/third_party/WebKit/Source/platform/wtf/DequeTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/DequeTest.cpp
@@ -25,10 +25,11 @@ #include "platform/wtf/Deque.h" +#include <memory> #include "platform/wtf/HashSet.h" #include "platform/wtf/PtrUtil.h" +#include "platform/wtf/WTFTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace WTF { @@ -158,19 +159,6 @@ ReverseTest<2>(); } -class DestructCounter { - public: - explicit DestructCounter(int i, int* destruct_number) - : i_(i), destruct_number_(destruct_number) {} - - ~DestructCounter() { ++(*destruct_number_); } - int Get() const { return i_; } - - private: - int i_; - int* destruct_number_; -}; - template <typename OwnPtrDeque> void OwnPtrTest() { int destruct_number = 0; @@ -242,27 +230,6 @@ OwnPtrTest<Deque<std::unique_ptr<DestructCounter>, 2>>(); } -class MoveOnly { - public: - explicit MoveOnly(int i = 0) : i_(i) {} - - MoveOnly(MoveOnly&& other) : i_(other.i_) { other.i_ = 0; } - - MoveOnly& operator=(MoveOnly&& other) { - if (this != &other) { - i_ = other.i_; - other.i_ = 0; - } - return *this; - } - - int Value() const { return i_; } - - private: - WTF_MAKE_NONCOPYABLE(MoveOnly); - int i_; -}; - TEST(DequeTest, MoveOnlyType) { Deque<MoveOnly> deque; deque.push_back(MoveOnly(1)); @@ -282,37 +249,8 @@ EXPECT_EQ(0u, deque.size()); } -// WrappedInt class will fail if it was memmoved or memcpyed. HashSet<void*> g_constructed_wrapped_ints; -class WrappedInt { - public: - WrappedInt(int i = 0) : original_this_ptr_(this), i_(i) { - g_constructed_wrapped_ints.insert(this); - } - - WrappedInt(const WrappedInt& other) : original_this_ptr_(this), i_(other.i_) { - g_constructed_wrapped_ints.insert(this); - } - - WrappedInt& operator=(const WrappedInt& other) { - i_ = other.i_; - return *this; - } - - ~WrappedInt() { - EXPECT_EQ(original_this_ptr_, this); - EXPECT_TRUE(g_constructed_wrapped_ints.Contains(this)); - g_constructed_wrapped_ints.erase(this); - } - - int Get() const { return i_; } - - private: - void* original_this_ptr_; - int i_; -}; - template <size_t inlineCapacity> void SwapWithOrWithoutInlineCapacity() { Deque<WrappedInt, inlineCapacity> deque_a; @@ -362,16 +300,6 @@ SwapWithOrWithoutInlineCapacity<2>(); } -class LivenessCounter { - public: - void AddRef() const { live_++; } - void Release() const { live_--; } - - static unsigned live_; -}; - -unsigned LivenessCounter::live_ = 0; - // Filter a few numbers out to improve the running speed of the tests. The // test has nested loops, and removing even numbers from 4 and up from the // loops makes it run 10 times faster. @@ -380,7 +308,7 @@ } template <size_t inlineCapacity> -void TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity() { +void TestDequeDestructorAndConstructorCallsWhenSwappingWithInlineCapacity() { LivenessCounter::live_ = 0; LivenessCounter counter; EXPECT_EQ(0u, LivenessCounter::live_); @@ -446,13 +374,13 @@ } TEST(DequeTest, SwapWithConstructorsAndDestructors) { - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<0>(); - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<4>(); - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<9>(); + TestDequeDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<0>(); + TestDequeDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<4>(); + TestDequeDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<9>(); } template <size_t inlineCapacity> -void TestValuesMovedAndSwappedWithInlineCapacity() { +void TestDequeValuesMovedAndSwappedWithInlineCapacity() { Deque<unsigned, inlineCapacity> deque; Deque<unsigned, inlineCapacity> deque2; @@ -501,9 +429,9 @@ } TEST(DequeTest, ValuesMovedAndSwappedWithInlineCapacity) { - TestValuesMovedAndSwappedWithInlineCapacity<0>(); - TestValuesMovedAndSwappedWithInlineCapacity<4>(); - TestValuesMovedAndSwappedWithInlineCapacity<9>(); + TestDequeValuesMovedAndSwappedWithInlineCapacity<0>(); + TestDequeValuesMovedAndSwappedWithInlineCapacity<4>(); + TestDequeValuesMovedAndSwappedWithInlineCapacity<9>(); } TEST(DequeTest, UniquePtr) { @@ -537,24 +465,6 @@ deque.clear(); } -class CountCopy final { - public: - explicit CountCopy(int* counter = nullptr) : counter_(counter) {} - CountCopy(const CountCopy& other) : counter_(other.counter_) { - if (counter_) - ++*counter_; - } - CountCopy& operator=(const CountCopy& other) { - counter_ = other.counter_; - if (counter_) - ++*counter_; - return *this; - } - - private: - int* counter_; -}; - TEST(DequeTest, MoveShouldNotMakeCopy) { // Because data in inline buffer may be swapped or moved individually, we // force the creation of out-of-line buffer so we can make sure there's no
diff --git a/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp b/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp index ae40eab4..d0aed16 100644 --- a/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/FunctionalTest.cpp
@@ -28,6 +28,7 @@ #include <memory> #include <utility> #include "platform/wtf/RefCounted.h" +#include "platform/wtf/WTFTestHelper.h" #include "platform/wtf/WeakPtr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -429,26 +430,6 @@ EXPECT_TRUE(all_bound()); } -class MoveOnly { - public: - explicit MoveOnly(int value) : value_(value) {} - MoveOnly(MoveOnly&& other) : value_(other.value_) { - // Reset the value on move. - other.value_ = 0; - } - - int Value() const { return value_; } - - private: - MoveOnly(const MoveOnly&) = delete; - MoveOnly& operator=(const MoveOnly&) = delete; - - // Disable move-assignment, since it isn't used within bind(). - MoveOnly& operator=(MoveOnly&&) = delete; - - int value_; -}; - int SingleMoveOnlyByRvalueReference(MoveOnly&& move_only) { int value = move_only.Value(); MoveOnly(std::move(move_only)); @@ -497,42 +478,42 @@ EXPECT_EQ(0, bound()); } -class CountCopy { +class CountGeneration { public: - CountCopy() : copies_(0) {} - CountCopy(const CountCopy& other) : copies_(other.copies_ + 1) {} + CountGeneration() : copies_(0) {} + CountGeneration(const CountGeneration& other) : copies_(other.copies_ + 1) {} int Copies() const { return copies_; } private: // Copy/move-assignment is not needed in the test. - CountCopy& operator=(const CountCopy&) = delete; - CountCopy& operator=(CountCopy&&) = delete; + CountGeneration& operator=(const CountGeneration&) = delete; + CountGeneration& operator=(CountGeneration&&) = delete; int copies_; }; -int TakeCountCopyAsConstReference(const CountCopy& counter) { +int TakeCountCopyAsConstReference(const CountGeneration& counter) { return counter.Copies(); } -int TakeCountCopyAsValue(CountCopy counter) { +int TakeCountCopyAsValue(CountGeneration counter) { return counter.Copies(); } TEST(FunctionalTest, CountCopiesOfBoundArguments) { - CountCopy lvalue; + CountGeneration lvalue; Function<int()> bound = Bind(TakeCountCopyAsConstReference, lvalue); EXPECT_EQ(2, bound()); // wrapping and unwrapping. - bound = Bind(TakeCountCopyAsConstReference, CountCopy()); // Rvalue. + bound = Bind(TakeCountCopyAsConstReference, CountGeneration()); // Rvalue. EXPECT_EQ(2, bound()); bound = Bind(TakeCountCopyAsValue, lvalue); // wrapping, unwrapping and copying in the final function argument. EXPECT_EQ(3, bound()); - bound = Bind(TakeCountCopyAsValue, CountCopy()); + bound = Bind(TakeCountCopyAsValue, CountGeneration()); EXPECT_EQ(3, bound()); } @@ -556,17 +537,18 @@ } TEST(FunctionalTest, CountCopiesOfUnboundArguments) { - CountCopy lvalue; - Function<int(const CountCopy&)> bound1 = Bind(TakeCountCopyAsConstReference); + CountGeneration lvalue; + Function<int(const CountGeneration&)> bound1 = + Bind(TakeCountCopyAsConstReference); EXPECT_EQ(0, bound1(lvalue)); // No copies! - EXPECT_EQ(0, bound1(CountCopy())); + EXPECT_EQ(0, bound1(CountGeneration())); - Function<int(CountCopy)> bound2 = Bind(TakeCountCopyAsValue); + Function<int(CountGeneration)> bound2 = Bind(TakeCountCopyAsValue); // At Function::operator(), at Callback::Run() and at the destination // function. EXPECT_EQ(3, bound2(lvalue)); // Compiler is allowed to optimize one copy away if the argument is rvalue. - EXPECT_LE(bound2(CountCopy()), 2); + EXPECT_LE(bound2(CountGeneration()), 2); } TEST(FunctionalTest, WeakPtr) {
diff --git a/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp b/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp index 36b03b37..7bb871d 100644 --- a/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/HashMapTest.cpp
@@ -30,10 +30,13 @@ #include "platform/wtf/RefCounted.h" #include "platform/wtf/RefPtr.h" #include "platform/wtf/Vector.h" +#include "platform/wtf/WTFTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" namespace WTF { +int DummyRefCounted::ref_invokes_count_ = 0; + namespace { using IntHashMap = HashMap<int, int>; @@ -88,19 +91,6 @@ EXPECT_EQ(3, map.at(kNegativeZeroKey)); } -class DestructCounter { - public: - explicit DestructCounter(int i, int* destruct_number) - : i_(i), destruct_number_(destruct_number) {} - - ~DestructCounter() { ++(*destruct_number_); } - int Get() const { return i_; } - - private: - int i_; - int* destruct_number_; -}; - using OwnPtrHashMap = HashMap<int, std::unique_ptr<DestructCounter>>; TEST(HashMapTest, OwnPtrAsValue) { @@ -135,35 +125,6 @@ EXPECT_EQ(2, destruct_number); } -class DummyRefCounted : public RefCounted<DummyRefCounted> { - public: - DummyRefCounted(bool& is_deleted) : is_deleted_(is_deleted) { - is_deleted_ = false; - } - ~DummyRefCounted() { - DCHECK(!is_deleted_); - is_deleted_ = true; - } - - void AddRef() { - DCHECK(!is_deleted_); - WTF::RefCounted<DummyRefCounted>::AddRef(); - ++ref_invokes_count_; - } - - void Release() { - DCHECK(!is_deleted_); - WTF::RefCounted<DummyRefCounted>::Release(); - } - - static int ref_invokes_count_; - - private: - bool& is_deleted_; -}; - -int DummyRefCounted::ref_invokes_count_ = 0; - TEST(HashMapTest, RefPtrAsKey) { bool is_deleted = false; DummyRefCounted::ref_invokes_count_ = 0; @@ -295,75 +256,11 @@ EXPECT_EQ(0, InstanceCounter::counter_); } -class MoveOnly { - public: - // kEmpty and kDeleted have special meanings when MoveOnly is used as the key - // of a hash table. - enum { kEmpty = 0, kDeleted = -1, kMovedOut = -2 }; - - explicit MoveOnly(int value = kEmpty) : value_(value) {} - MoveOnly(MoveOnly&& other) : value_(other.value_) { - other.value_ = kMovedOut; - } - MoveOnly& operator=(MoveOnly&& other) { - value_ = other.value_; - other.value_ = kMovedOut; - return *this; - } - - int Value() const { return value_; } - - private: - MoveOnly(const MoveOnly&) = delete; - MoveOnly& operator=(const MoveOnly&) = delete; - - int value_; -}; - -struct MoveOnlyHashTraits : public GenericHashTraits<MoveOnly> { - // This is actually true, but we pretend that it's false to disable the - // optimization. - static const bool kEmptyValueIsZero = false; - - static const bool kHasIsEmptyValueFunction = true; - static bool IsEmptyValue(const MoveOnly& value) { - return value.Value() == MoveOnly::kEmpty; - } - static void ConstructDeletedValue(MoveOnly& slot, bool) { - slot = MoveOnly(MoveOnly::kDeleted); - } - static bool IsDeletedValue(const MoveOnly& value) { - return value.Value() == MoveOnly::kDeleted; - } -}; - -struct MoveOnlyHash { - static unsigned GetHash(const MoveOnly& value) { - return DefaultHash<int>::Hash::GetHash(value.Value()); - } - static bool Equal(const MoveOnly& left, const MoveOnly& right) { - return DefaultHash<int>::Hash::Equal(left.Value(), right.Value()); - } - static const bool safe_to_compare_to_empty_or_deleted = true; -}; - -} // anonymous namespace - -template <> -struct HashTraits<MoveOnly> : public MoveOnlyHashTraits {}; - -template <> -struct DefaultHash<MoveOnly> { - using Hash = MoveOnlyHash; -}; - -namespace { - TEST(HashMapTest, MoveOnlyValueType) { - using TheMap = HashMap<int, MoveOnly>; + using TheMap = HashMap<int, MoveOnlyHashValue>; TheMap map; { - TheMap::AddResult add_result = map.insert(1, MoveOnly(10)); + TheMap::AddResult add_result = map.insert(1, MoveOnlyHashValue(10)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->key); EXPECT_EQ(10, add_result.stored_value->value.Value()); @@ -378,7 +275,7 @@ // Try to add more to trigger rehashing. for (int i = 2; i < 32; ++i) { - TheMap::AddResult add_result = map.insert(i, MoveOnly(i * 10)); + TheMap::AddResult add_result = map.insert(i, MoveOnlyHashValue(i * 10)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(i, add_result.stored_value->key); EXPECT_EQ(i * 10, add_result.stored_value->value.Value()); @@ -395,7 +292,7 @@ EXPECT_EQ(70, iter->value.Value()); { - TheMap::AddResult add_result = map.Set(9, MoveOnly(999)); + TheMap::AddResult add_result = map.Set(9, MoveOnlyHashValue(999)); EXPECT_FALSE(add_result.is_new_entry); EXPECT_EQ(9, add_result.stored_value->key); EXPECT_EQ(999, add_result.stored_value->value.Value()); @@ -405,7 +302,7 @@ iter = map.find(11); EXPECT_TRUE(iter == map.end()); - MoveOnly one_thirty(map.Take(13)); + MoveOnlyHashValue one_thirty(map.Take(13)); EXPECT_EQ(130, one_thirty.Value()); iter = map.find(13); EXPECT_TRUE(iter == map.end()); @@ -416,77 +313,58 @@ TEST(HashMapTest, MoveOnlyKeyType) { // The content of this test is similar to the test above, except that the // types of key and value are swapped. - using TheMap = HashMap<MoveOnly, int>; + using TheMap = HashMap<MoveOnlyHashValue, int>; TheMap map; { - TheMap::AddResult add_result = map.insert(MoveOnly(1), 10); + TheMap::AddResult add_result = map.insert(MoveOnlyHashValue(1), 10); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->key.Value()); EXPECT_EQ(10, add_result.stored_value->value); } - auto iter = map.find(MoveOnly(1)); + auto iter = map.find(MoveOnlyHashValue(1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.Value()); EXPECT_EQ(10, iter->value); - iter = map.find(MoveOnly(2)); + iter = map.find(MoveOnlyHashValue(2)); EXPECT_TRUE(iter == map.end()); for (int i = 2; i < 32; ++i) { - TheMap::AddResult add_result = map.insert(MoveOnly(i), i * 10); + TheMap::AddResult add_result = map.insert(MoveOnlyHashValue(i), i * 10); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(i, add_result.stored_value->key.Value()); EXPECT_EQ(i * 10, add_result.stored_value->value); } - iter = map.find(MoveOnly(1)); + iter = map.find(MoveOnlyHashValue(1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.Value()); EXPECT_EQ(10, iter->value); - iter = map.find(MoveOnly(7)); + iter = map.find(MoveOnlyHashValue(7)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(7, iter->key.Value()); EXPECT_EQ(70, iter->value); { - TheMap::AddResult add_result = map.Set(MoveOnly(9), 999); + TheMap::AddResult add_result = map.Set(MoveOnlyHashValue(9), 999); EXPECT_FALSE(add_result.is_new_entry); EXPECT_EQ(9, add_result.stored_value->key.Value()); EXPECT_EQ(999, add_result.stored_value->value); } - map.erase(MoveOnly(11)); - iter = map.find(MoveOnly(11)); + map.erase(MoveOnlyHashValue(11)); + iter = map.find(MoveOnlyHashValue(11)); EXPECT_TRUE(iter == map.end()); - int one_thirty = map.Take(MoveOnly(13)); + int one_thirty = map.Take(MoveOnlyHashValue(13)); EXPECT_EQ(130, one_thirty); - iter = map.find(MoveOnly(13)); + iter = map.find(MoveOnlyHashValue(13)); EXPECT_TRUE(iter == map.end()); map.clear(); } -class CountCopy final { - public: - CountCopy() : counter_(nullptr) {} - explicit CountCopy(int& counter) : counter_(&counter) {} - CountCopy(const CountCopy& other) : counter_(other.counter_) { - if (counter_) - ++*counter_; - } - CountCopy& operator=(const CountCopy& other) { - counter_ = other.counter_; - if (counter_) - ++*counter_; - return *this; - } - - private: - int* counter_; -}; - TEST(HashMapTest, MoveShouldNotMakeCopy) { HashMap<int, CountCopy> map; int counter = 0; @@ -596,72 +474,74 @@ } TEST(HashMapTest, MoveOnlyPairKeyType) { - using Pair = std::pair<MoveOnly, int>; + using Pair = std::pair<MoveOnlyHashValue, int>; using TheMap = HashMap<Pair, int>; TheMap map; { - TheMap::AddResult add_result = map.insert(Pair(MoveOnly(1), -1), 10); + TheMap::AddResult add_result = + map.insert(Pair(MoveOnlyHashValue(1), -1), 10); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->key.first.Value()); EXPECT_EQ(-1, add_result.stored_value->key.second); EXPECT_EQ(10, add_result.stored_value->value); } - auto iter = map.find(Pair(MoveOnly(1), -1)); + auto iter = map.find(Pair(MoveOnlyHashValue(1), -1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.first.Value()); EXPECT_EQ(-1, iter->key.second); EXPECT_EQ(10, iter->value); - iter = map.find(Pair(MoveOnly(1), 0)); + iter = map.find(Pair(MoveOnlyHashValue(1), 0)); EXPECT_TRUE(iter == map.end()); for (int i = 2; i < 32; ++i) { - TheMap::AddResult add_result = map.insert(Pair(MoveOnly(i), -i), i * 10); + TheMap::AddResult add_result = + map.insert(Pair(MoveOnlyHashValue(i), -i), i * 10); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(i, add_result.stored_value->key.first.Value()); EXPECT_EQ(-i, add_result.stored_value->key.second); EXPECT_EQ(i * 10, add_result.stored_value->value); } - iter = map.find(Pair(MoveOnly(1), -1)); + iter = map.find(Pair(MoveOnlyHashValue(1), -1)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(1, iter->key.first.Value()); EXPECT_EQ(-1, iter->key.second); EXPECT_EQ(10, iter->value); - iter = map.find(Pair(MoveOnly(7), -7)); + iter = map.find(Pair(MoveOnlyHashValue(7), -7)); ASSERT_TRUE(iter != map.end()); EXPECT_EQ(7, iter->key.first.Value()); EXPECT_EQ(-7, iter->key.second); EXPECT_EQ(70, iter->value); { - TheMap::AddResult add_result = map.Set(Pair(MoveOnly(9), -9), 999); + TheMap::AddResult add_result = map.Set(Pair(MoveOnlyHashValue(9), -9), 999); EXPECT_FALSE(add_result.is_new_entry); EXPECT_EQ(9, add_result.stored_value->key.first.Value()); EXPECT_EQ(-9, add_result.stored_value->key.second); EXPECT_EQ(999, add_result.stored_value->value); } - map.erase(Pair(MoveOnly(11), -11)); - iter = map.find(Pair(MoveOnly(11), -11)); + map.erase(Pair(MoveOnlyHashValue(11), -11)); + iter = map.find(Pair(MoveOnlyHashValue(11), -11)); EXPECT_TRUE(iter == map.end()); - int one_thirty = map.Take(Pair(MoveOnly(13), -13)); + int one_thirty = map.Take(Pair(MoveOnlyHashValue(13), -13)); EXPECT_EQ(130, one_thirty); - iter = map.find(Pair(MoveOnly(13), -13)); + iter = map.find(Pair(MoveOnlyHashValue(13), -13)); EXPECT_TRUE(iter == map.end()); map.clear(); } -bool IsOneTwoThree(const HashMap<int, int>& map) { +bool IsOneTwoThreeMap(const HashMap<int, int>& map) { return map.size() == 3 && map.Contains(1) && map.Contains(2) && map.Contains(3) && map.at(1) == 11 && map.at(2) == 22 && map.at(3) == 33; }; -HashMap<int, int> ReturnOneTwoThree() { +HashMap<int, int> ReturnOneTwoThreeMap() { return {{1, 11}, {2, 22}, {3, 33}}; }; @@ -707,8 +587,8 @@ // Other ways of construction: as a function parameter and in a return // statement. - EXPECT_TRUE(IsOneTwoThree({{1, 11}, {2, 22}, {3, 33}})); - EXPECT_TRUE(IsOneTwoThree(ReturnOneTwoThree())); + EXPECT_TRUE(IsOneTwoThreeMap({{1, 11}, {2, 22}, {3, 33}})); + EXPECT_TRUE(IsOneTwoThreeMap(ReturnOneTwoThreeMap())); } } // anonymous namespace
diff --git a/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp b/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp index c3c1121..51044f4c 100644 --- a/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/HashSetTest.cpp
@@ -25,13 +25,17 @@ #include "platform/wtf/HashSet.h" +#include <memory> #include "platform/wtf/PtrUtil.h" #include "platform/wtf/RefCounted.h" +#include "platform/wtf/WTFTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace WTF { +int* const CountCopy::kDeletedValue = + reinterpret_cast<int*>(static_cast<uintptr_t>(-1)); + namespace { template <unsigned size> @@ -77,14 +81,6 @@ TestReserveCapacity<128>(); } -struct Dummy { - Dummy(bool& deleted) : deleted(deleted) {} - - ~Dummy() { deleted = true; } - - bool& deleted; -}; - TEST(HashSetTest, HashSetOwnPtr) { bool deleted1 = false, deleted2 = false; @@ -158,26 +154,6 @@ EXPECT_EQ(ptr2, own_ptr2.get()); } -class DummyRefCounted : public RefCounted<DummyRefCounted> { - public: - DummyRefCounted(bool& is_deleted) : is_deleted_(is_deleted) { - is_deleted_ = false; - } - ~DummyRefCounted() { is_deleted_ = true; } - - void AddRef() { - WTF::RefCounted<DummyRefCounted>::AddRef(); - ++ref_invokes_count_; - } - - static int ref_invokes_count_; - - private: - bool& is_deleted_; -}; - -int DummyRefCounted::ref_invokes_count_ = 0; - TEST(HashSetTest, HashSetRefPtr) { bool is_deleted = false; RefPtr<DummyRefCounted> ptr = WTF::AdoptRef(new DummyRefCounted(is_deleted)); @@ -203,64 +179,6 @@ EXPECT_EQ(1, DummyRefCounted::ref_invokes_count_); } -class CountCopy final { - public: - static int* const kDeletedValue; - - explicit CountCopy(int* counter = nullptr) : counter_(counter) {} - CountCopy(const CountCopy& other) : counter_(other.counter_) { - if (counter_ && counter_ != kDeletedValue) - ++*counter_; - } - CountCopy& operator=(const CountCopy& other) { - counter_ = other.counter_; - if (counter_ && counter_ != kDeletedValue) - ++*counter_; - return *this; - } - const int* Counter() const { return counter_; } - - private: - int* counter_; -}; - -int* const CountCopy::kDeletedValue = - reinterpret_cast<int*>(static_cast<uintptr_t>(-1)); - -struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { - static const bool kEmptyValueIsZero = false; - static const bool kHasIsEmptyValueFunction = true; - static bool IsEmptyValue(const CountCopy& value) { return !value.Counter(); } - static void ConstructDeletedValue(CountCopy& slot, bool) { - slot = CountCopy(CountCopy::kDeletedValue); - } - static bool IsDeletedValue(const CountCopy& value) { - return value.Counter() == CountCopy::kDeletedValue; - } -}; - -struct CountCopyHash : public PtrHash<const int*> { - static unsigned GetHash(const CountCopy& value) { - return PtrHash<const int>::GetHash(value.Counter()); - } - static bool Equal(const CountCopy& left, const CountCopy& right) { - return PtrHash<const int>::Equal(left.Counter(), right.Counter()); - } - static const bool safe_to_compare_to_empty_or_deleted = true; -}; - -} // anonymous namespace - -template <> -struct HashTraits<CountCopy> : public CountCopyHashTraits {}; - -template <> -struct DefaultHash<CountCopy> { - using Hash = CountCopyHash; -}; - -namespace { - TEST(HashSetTest, MoveShouldNotMakeCopy) { HashSet<CountCopy> set; int counter = 0; @@ -276,125 +194,55 @@ EXPECT_EQ(0, counter); } -class MoveOnly { - public: - // kEmpty and kDeleted have special meanings when MoveOnly is used as the key - // of a hash table. - enum { kEmpty = 0, kDeleted = -1, kMovedOut = -2 }; - - explicit MoveOnly(int value = kEmpty, int id = 0) : value_(value), id_(id) {} - MoveOnly(MoveOnly&& other) : value_(other.value_), id_(other.id_) { - other.value_ = kMovedOut; - other.id_ = 0; - } - MoveOnly& operator=(MoveOnly&& other) { - value_ = other.value_; - id_ = other.id_; - other.value_ = kMovedOut; - other.id_ = 0; - return *this; - } - - int Value() const { return value_; } - // id() is used for distinguishing MoveOnlys with the same value(). - int Id() const { return id_; } - - private: - MoveOnly(const MoveOnly&) = delete; - MoveOnly& operator=(const MoveOnly&) = delete; - - int value_; - int id_; -}; - -struct MoveOnlyHashTraits : public GenericHashTraits<MoveOnly> { - // This is actually true, but we pretend that it's false to disable the - // optimization. - static const bool kEmptyValueIsZero = false; - - static const bool kHasIsEmptyValueFunction = true; - static bool IsEmptyValue(const MoveOnly& value) { - return value.Value() == MoveOnly::kEmpty; - } - static void ConstructDeletedValue(MoveOnly& slot, bool) { - slot = MoveOnly(MoveOnly::kDeleted); - } - static bool IsDeletedValue(const MoveOnly& value) { - return value.Value() == MoveOnly::kDeleted; - } -}; - -struct MoveOnlyHash { - static unsigned GetHash(const MoveOnly& value) { - return DefaultHash<int>::Hash::GetHash(value.Value()); - } - static bool Equal(const MoveOnly& left, const MoveOnly& right) { - return DefaultHash<int>::Hash::Equal(left.Value(), right.Value()); - } - static const bool safe_to_compare_to_empty_or_deleted = true; -}; - -} // anonymous namespace - -template <> -struct HashTraits<MoveOnly> : public MoveOnlyHashTraits {}; - -template <> -struct DefaultHash<MoveOnly> { - using Hash = MoveOnlyHash; -}; - -namespace { - TEST(HashSetTest, MoveOnlyValue) { - using TheSet = HashSet<MoveOnly>; + using TheSet = HashSet<MoveOnlyHashValue>; TheSet set; { - TheSet::AddResult add_result = set.insert(MoveOnly(1, 1)); + TheSet::AddResult add_result = set.insert(MoveOnlyHashValue(1, 1)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->Value()); EXPECT_EQ(1, add_result.stored_value->Id()); } - auto iter = set.find(MoveOnly(1)); + auto iter = set.find(MoveOnlyHashValue(1)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(1, iter->Value()); - iter = set.find(MoveOnly(2)); + iter = set.find(MoveOnlyHashValue(2)); EXPECT_TRUE(iter == set.end()); for (int i = 2; i < 32; ++i) { - TheSet::AddResult add_result = set.insert(MoveOnly(i, i)); + TheSet::AddResult add_result = set.insert(MoveOnlyHashValue(i, i)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(i, add_result.stored_value->Value()); EXPECT_EQ(i, add_result.stored_value->Id()); } - iter = set.find(MoveOnly(1)); + iter = set.find(MoveOnlyHashValue(1)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(1, iter->Value()); EXPECT_EQ(1, iter->Id()); - iter = set.find(MoveOnly(7)); + iter = set.find(MoveOnlyHashValue(7)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(7, iter->Value()); EXPECT_EQ(7, iter->Id()); { - TheSet::AddResult add_result = - set.insert(MoveOnly(7, 777)); // With different ID for identification. + TheSet::AddResult add_result = set.insert( + MoveOnlyHashValue(7, 777)); // With different ID for identification. EXPECT_FALSE(add_result.is_new_entry); EXPECT_EQ(7, add_result.stored_value->Value()); EXPECT_EQ(7, add_result.stored_value->Id()); } - set.erase(MoveOnly(11)); - iter = set.find(MoveOnly(11)); + set.erase(MoveOnlyHashValue(11)); + iter = set.find(MoveOnlyHashValue(11)); EXPECT_TRUE(iter == set.end()); - MoveOnly thirteen(set.Take(MoveOnly(13))); + MoveOnlyHashValue thirteen(set.Take(MoveOnlyHashValue(13))); EXPECT_EQ(13, thirteen.Value()); EXPECT_EQ(13, thirteen.Id()); - iter = set.find(MoveOnly(13)); + iter = set.find(MoveOnlyHashValue(13)); EXPECT_TRUE(iter == set.end()); set.clear(); @@ -449,12 +297,12 @@ } } -bool IsOneTwoThree(const HashSet<int>& set) { +bool IsOneTwoThreeSet(const HashSet<int>& set) { return set.size() == 3 && set.Contains(1) && set.Contains(2) && set.Contains(3); } -HashSet<int> ReturnOneTwoThree() { +HashSet<int> ReturnOneTwoThreeSet() { return {1, 2, 3}; } @@ -498,8 +346,8 @@ // Other ways of construction: as a function parameter and in a return // statement. - EXPECT_TRUE(IsOneTwoThree({1, 2, 3})); - EXPECT_TRUE(IsOneTwoThree(ReturnOneTwoThree())); + EXPECT_TRUE(IsOneTwoThreeSet({1, 2, 3})); + EXPECT_TRUE(IsOneTwoThreeSet(ReturnOneTwoThreeSet())); } enum TestEnum {
diff --git a/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp b/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp index f21400ca..191c09f 100644 --- a/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/ListHashSetTest.cpp
@@ -31,6 +31,7 @@ #include "platform/wtf/PtrUtil.h" #include "platform/wtf/RefCounted.h" #include "platform/wtf/RefPtr.h" +#include "platform/wtf/WTFTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" namespace WTF { @@ -535,14 +536,6 @@ EXPECT_EQ(base_line, Complicated::objects_constructed_); } -struct Dummy { - Dummy(bool& deleted) : deleted(deleted) {} - - ~Dummy() { deleted = true; } - - bool& deleted; -}; - TEST(ListHashSetTest, WithOwnPtr) { bool deleted1 = false, deleted2 = false; @@ -614,55 +607,6 @@ EXPECT_EQ(ptr2, own_ptr2.get()); } -class CountCopy final { - public: - static int* const kDeletedValue; - - explicit CountCopy(int* counter = nullptr) : counter_(counter) {} - CountCopy(const CountCopy& other) : counter_(other.counter_) { - if (counter_ && counter_ != kDeletedValue) - ++*counter_; - } - const int* Counter() const { return counter_; } - - private: - int* counter_; -}; - -int* const CountCopy::kDeletedValue = - reinterpret_cast<int*>(static_cast<uintptr_t>(-1)); - -struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { - static bool IsEmptyValue(const CountCopy& value) { return !value.Counter(); } - static void ConstructDeletedValue(CountCopy& slot, bool) { - slot = CountCopy(CountCopy::kDeletedValue); - } - static bool IsDeletedValue(const CountCopy& value) { - return value.Counter() == CountCopy::kDeletedValue; - } -}; - -struct CountCopyHash : public PtrHash<const int> { - static unsigned GetHash(const CountCopy& value) { - return PtrHash<const int>::GetHash(value.Counter()); - } - static bool Equal(const CountCopy& left, const CountCopy& right) { - return PtrHash<const int>::Equal(left.Counter(), right.Counter()); - } -}; - -} // anonymous namespace - -template <> -struct HashTraits<CountCopy> : public CountCopyHashTraits {}; - -template <> -struct DefaultHash<CountCopy> { - using Hash = CountCopyHash; -}; - -namespace { - template <typename Set> class ListOrLinkedHashSetCountCopyTest : public ::testing::Test {}; @@ -695,61 +639,12 @@ EXPECT_EQ(0, counter); } -class MoveOnly { - public: - // kEmpty and kDeleted have special meanings when MoveOnly is used as the key - // of a hash table. - enum { kEmpty = 0, kDeleted = -1, kMovedOut = -2 }; - - explicit MoveOnly(int value = kEmpty, int id = 0) : value_(value), id_(id) {} - MoveOnly(MoveOnly&& other) : value_(other.value_), id_(other.id_) { - other.value_ = kMovedOut; - other.id_ = 0; - } - MoveOnly& operator=(MoveOnly&& other) { - value_ = other.value_; - id_ = other.id_; - other.value_ = kMovedOut; - other.id_ = 0; - return *this; - } - - int Value() const { return value_; } - // id() is used for distinguishing MoveOnlys with the same value(). - int Id() const { return id_; } - - private: - MoveOnly(const MoveOnly&) = delete; - MoveOnly& operator=(const MoveOnly&) = delete; - - int value_; - int id_; -}; - -struct MoveOnlyHash { - static unsigned GetHash(const MoveOnly& value) { - return DefaultHash<int>::Hash::GetHash(value.Value()); - } - static bool Equal(const MoveOnly& left, const MoveOnly& right) { - return DefaultHash<int>::Hash::Equal(left.Value(), right.Value()); - } -}; - -} // anonymous namespace - -template <> -struct DefaultHash<MoveOnly> { - using Hash = MoveOnlyHash; -}; - -namespace { - template <typename Set> class ListOrLinkedHashSetMoveOnlyTest : public ::testing::Test {}; -using MoveOnlySetTypes = ::testing::Types<ListHashSet<MoveOnly>, - ListHashSet<MoveOnly, 1>, - LinkedHashSet<MoveOnly>>; +using MoveOnlySetTypes = ::testing::Types<ListHashSet<MoveOnlyHashValue>, + ListHashSet<MoveOnlyHashValue, 1>, + LinkedHashSet<MoveOnlyHashValue>>; TYPED_TEST_CASE(ListOrLinkedHashSetMoveOnlyTest, MoveOnlySetTypes); TYPED_TEST(ListOrLinkedHashSetMoveOnlyTest, MoveOnlyValue) { @@ -757,56 +652,57 @@ using AddResult = typename Set::AddResult; Set set; { - AddResult add_result = set.insert(MoveOnly(1, 1)); + AddResult add_result = set.insert(MoveOnlyHashValue(1, 1)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->Value()); EXPECT_EQ(1, add_result.stored_value->Id()); } { - AddResult add_result = set.insert(MoveOnly(1, 111)); + AddResult add_result = set.insert(MoveOnlyHashValue(1, 111)); EXPECT_FALSE(add_result.is_new_entry); EXPECT_EQ(1, add_result.stored_value->Value()); EXPECT_EQ(1, add_result.stored_value->Id()); } - auto iter = set.find(MoveOnly(1)); + auto iter = set.find(MoveOnlyHashValue(1)); ASSERT_TRUE(iter != set.end()); EXPECT_EQ(1, iter->Value()); EXPECT_EQ(1, iter->Id()); - iter = set.find(MoveOnly(2)); + iter = set.find(MoveOnlyHashValue(2)); EXPECT_TRUE(iter == set.end()); // ListHashSet and LinkedHashSet have several flavors of add(). - iter = set.AddReturnIterator(MoveOnly(2, 2)); + iter = set.AddReturnIterator(MoveOnlyHashValue(2, 2)); EXPECT_EQ(2, iter->Value()); EXPECT_EQ(2, iter->Id()); - iter = set.AddReturnIterator(MoveOnly(2, 222)); + iter = set.AddReturnIterator(MoveOnlyHashValue(2, 222)); EXPECT_EQ(2, iter->Value()); EXPECT_EQ(2, iter->Id()); { - AddResult add_result = set.AppendOrMoveToLast(MoveOnly(3, 3)); + AddResult add_result = set.AppendOrMoveToLast(MoveOnlyHashValue(3, 3)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(3, add_result.stored_value->Value()); EXPECT_EQ(3, add_result.stored_value->Id()); } { - AddResult add_result = set.PrependOrMoveToFirst(MoveOnly(4, 4)); + AddResult add_result = set.PrependOrMoveToFirst(MoveOnlyHashValue(4, 4)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(4, add_result.stored_value->Value()); EXPECT_EQ(4, add_result.stored_value->Id()); } { - AddResult add_result = set.InsertBefore(MoveOnly(4), MoveOnly(5, 5)); + AddResult add_result = + set.InsertBefore(MoveOnlyHashValue(4), MoveOnlyHashValue(5, 5)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(5, add_result.stored_value->Value()); EXPECT_EQ(5, add_result.stored_value->Id()); } { - iter = set.find(MoveOnly(5)); + iter = set.find(MoveOnlyHashValue(5)); ASSERT_TRUE(iter != set.end()); - AddResult add_result = set.InsertBefore(iter, MoveOnly(6, 6)); + AddResult add_result = set.InsertBefore(iter, MoveOnlyHashValue(6, 6)); EXPECT_TRUE(add_result.is_new_entry); EXPECT_EQ(6, add_result.stored_value->Value()); EXPECT_EQ(6, add_result.stored_value->Id()); @@ -814,7 +710,7 @@ // ... but they don't have any pass-out (like take()) methods. - set.erase(MoveOnly(3)); + set.erase(MoveOnlyHashValue(3)); set.clear(); }
diff --git a/third_party/WebKit/Source/platform/wtf/VectorTest.cpp b/third_party/WebKit/Source/platform/wtf/VectorTest.cpp index a6d7b798..297b1e1 100644 --- a/third_party/WebKit/Source/platform/wtf/VectorTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/VectorTest.cpp
@@ -25,15 +25,19 @@ #include "platform/wtf/Vector.h" +#include <memory> #include "platform/wtf/HashSet.h" #include "platform/wtf/Optional.h" #include "platform/wtf/PtrUtil.h" +#include "platform/wtf/WTFTestHelper.h" #include "platform/wtf/text/WTFString.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace WTF { +HashSet<void*> g_constructed_wrapped_ints; +unsigned LivenessCounter::live_ = 0; + namespace { TEST(VectorTest, Basic) { @@ -242,27 +246,6 @@ EXPECT_EQ(count, static_cast<size_t>(destruct_number)); } -class MoveOnly { - public: - explicit MoveOnly(int i = 0) : i_(i) {} - - MoveOnly(MoveOnly&& other) : i_(other.i_) { other.i_ = 0; } - - MoveOnly& operator=(MoveOnly&& other) { - if (this != &other) { - i_ = other.i_; - other.i_ = 0; - } - return *this; - } - - int Value() const { return i_; } - - private: - WTF_MAKE_NONCOPYABLE(MoveOnly); - int i_; -}; - TEST(VectorTest, MoveOnlyType) { WTF::Vector<MoveOnly> vector; vector.push_back(MoveOnly(1)); @@ -300,36 +283,6 @@ EXPECT_EQ(count, vector.size()); } -// WrappedInt class will fail if it was memmoved or memcpyed. -static HashSet<void*> g_constructed_wrapped_ints; -class WrappedInt { - public: - WrappedInt(int i = 0) : original_this_ptr_(this), i_(i) { - g_constructed_wrapped_ints.insert(this); - } - - WrappedInt(const WrappedInt& other) : original_this_ptr_(this), i_(other.i_) { - g_constructed_wrapped_ints.insert(this); - } - - WrappedInt& operator=(const WrappedInt& other) { - i_ = other.i_; - return *this; - } - - ~WrappedInt() { - EXPECT_EQ(original_this_ptr_, this); - EXPECT_TRUE(g_constructed_wrapped_ints.Contains(this)); - g_constructed_wrapped_ints.erase(this); - } - - int Get() const { return i_; } - - private: - void* original_this_ptr_; - int i_; -}; - TEST(VectorTest, SwapWithInlineCapacity) { const size_t kInlineCapacity = 2; Vector<WrappedInt, kInlineCapacity> vector_a; @@ -485,21 +438,11 @@ static_assert(!VectorTraits<MojoMoveOnlyType>::kCanCopyWithMemcpy, "MojoMoveOnlyType can't be copied with memcpy."); -class LivenessCounter { - public: - void AddRef() const { live_++; } - void Release() const { live_--; } - - static unsigned live_; -}; - -unsigned LivenessCounter::live_ = 0; - class VectorWithDifferingInlineCapacityTest : public ::testing::TestWithParam<size_t> {}; template <size_t inlineCapacity> -void TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity() { +void TestVectorDestructorAndConstructorCallsWhenSwappingWithInlineCapacity() { LivenessCounter::live_ = 0; LivenessCounter counter; EXPECT_EQ(0u, LivenessCounter::live_); @@ -549,13 +492,13 @@ } TEST(VectorTest, SwapWithConstructorsAndDestructors) { - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<0>(); - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<2>(); - TestDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<10>(); + TestVectorDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<0>(); + TestVectorDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<2>(); + TestVectorDestructorAndConstructorCallsWhenSwappingWithInlineCapacity<10>(); } template <size_t inlineCapacity> -void TestValuesMovedAndSwappedWithInlineCapacity() { +void TestVectorValuesMovedAndSwappedWithInlineCapacity() { Vector<unsigned, inlineCapacity> vector; Vector<unsigned, inlineCapacity> vector2; @@ -579,9 +522,9 @@ } TEST(VectorTest, ValuesMovedAndSwappedWithInlineCapacity) { - TestValuesMovedAndSwappedWithInlineCapacity<0>(); - TestValuesMovedAndSwappedWithInlineCapacity<2>(); - TestValuesMovedAndSwappedWithInlineCapacity<10>(); + TestVectorValuesMovedAndSwappedWithInlineCapacity<0>(); + TestVectorValuesMovedAndSwappedWithInlineCapacity<2>(); + TestVectorValuesMovedAndSwappedWithInlineCapacity<10>(); } TEST(VectorTest, UniquePtr) {
diff --git a/third_party/WebKit/Source/platform/wtf/WTFTestHelper.h b/third_party/WebKit/Source/platform/wtf/WTFTestHelper.h new file mode 100644 index 0000000..613a436 --- /dev/null +++ b/third_party/WebKit/Source/platform/wtf/WTFTestHelper.h
@@ -0,0 +1,248 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WTF_WTFTestHelper_h +#define WTF_WTFTestHelper_h + +#include "platform/wtf/HashFunctions.h" +#include "platform/wtf/HashSet.h" +#include "platform/wtf/RefCounted.h" +#include "platform/wtf/RefPtr.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace WTF { + +class DestructCounter { + public: + explicit DestructCounter(int i, int* destruct_number) + : i_(i), destruct_number_(destruct_number) {} + + ~DestructCounter() { ++(*destruct_number_); } + int Get() const { return i_; } + + private: + int i_; + int* destruct_number_; +}; + +class MoveOnly { + public: + explicit MoveOnly(int i = 0) : i_(i) {} + + MoveOnly(MoveOnly&& other) : i_(other.i_) { other.i_ = 0; } + + MoveOnly& operator=(MoveOnly&& other) { + if (this != &other) { + i_ = other.i_; + other.i_ = 0; + } + return *this; + } + + int Value() const { return i_; } + + private: + WTF_MAKE_NONCOPYABLE(MoveOnly); + int i_; +}; + +class MoveOnlyHashValue { + public: + // kEmpty and kDeleted have special meanings when MoveOnlyHashValue is used as + // the key of a hash table. + enum { kEmpty = 0, kDeleted = -1, kMovedOut = -2 }; + + explicit MoveOnlyHashValue(int value = kEmpty, int id = 0) + : value_(value), id_(id) {} + MoveOnlyHashValue(MoveOnlyHashValue&& other) + : value_(other.value_), id_(other.id_) { + other.value_ = kMovedOut; + other.id_ = 0; + } + MoveOnlyHashValue& operator=(MoveOnlyHashValue&& other) { + value_ = other.value_; + id_ = other.id_; + other.value_ = kMovedOut; + other.id_ = 0; + return *this; + } + + int Value() const { return value_; } + // id() is used for distinguishing MoveOnlys with the same value(). + int Id() const { return id_; } + + private: + MoveOnlyHashValue(const MoveOnlyHashValue&) = delete; + MoveOnlyHashValue& operator=(const MoveOnlyHashValue&) = delete; + + int value_; + int id_; +}; + +struct MoveOnlyHashTraits : public GenericHashTraits<MoveOnlyHashValue> { + // This is actually true, but we pretend that it's false to disable the + // optimization. + static const bool kEmptyValueIsZero = false; + + static const bool kHasIsEmptyValueFunction = true; + static bool IsEmptyValue(const MoveOnlyHashValue& value) { + return value.Value() == MoveOnlyHashValue::kEmpty; + } + static void ConstructDeletedValue(MoveOnlyHashValue& slot, bool) { + slot = MoveOnlyHashValue(MoveOnlyHashValue::kDeleted); + } + static bool IsDeletedValue(const MoveOnlyHashValue& value) { + return value.Value() == MoveOnlyHashValue::kDeleted; + } +}; + +struct MoveOnlyHash { + static unsigned GetHash(const MoveOnlyHashValue& value) { + return DefaultHash<int>::Hash::GetHash(value.Value()); + } + static bool Equal(const MoveOnlyHashValue& left, + const MoveOnlyHashValue& right) { + return DefaultHash<int>::Hash::Equal(left.Value(), right.Value()); + } + static const bool safe_to_compare_to_empty_or_deleted = true; +}; + +template <> +struct HashTraits<MoveOnlyHashValue> : public MoveOnlyHashTraits {}; + +template <> +struct DefaultHash<MoveOnlyHashValue> { + using Hash = MoveOnlyHash; +}; + +class CountCopy final { + public: + static int* const kDeletedValue; + + CountCopy() : counter_(nullptr) {} + explicit CountCopy(int* counter) : counter_(counter) {} + explicit CountCopy(int& counter) : counter_(&counter) {} + CountCopy(const CountCopy& other) : counter_(other.counter_) { + if (counter_ && counter_ != kDeletedValue) + ++*counter_; + } + CountCopy& operator=(const CountCopy& other) { + counter_ = other.counter_; + if (counter_ && counter_ != kDeletedValue) + ++*counter_; + return *this; + } + + const int* Counter() const { return counter_; } + + private: + int* counter_; +}; + +struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { + static const bool kEmptyValueIsZero = false; + static const bool kHasIsEmptyValueFunction = true; + static bool IsEmptyValue(const CountCopy& value) { return !value.Counter(); } + static void ConstructDeletedValue(CountCopy& slot, bool) { + slot = CountCopy(CountCopy::kDeletedValue); + } + static bool IsDeletedValue(const CountCopy& value) { + return value.Counter() == CountCopy::kDeletedValue; + } +}; + +struct CountCopyHash : public PtrHash<const int*> { + static unsigned GetHash(const CountCopy& value) { + return PtrHash<const int>::GetHash(value.Counter()); + } + static bool Equal(const CountCopy& left, const CountCopy& right) { + return PtrHash<const int>::Equal(left.Counter(), right.Counter()); + } + static const bool safe_to_compare_to_empty_or_deleted = true; +}; + +template <> +struct HashTraits<CountCopy> : public CountCopyHashTraits {}; + +template <> +struct DefaultHash<CountCopy> { + using Hash = CountCopyHash; +}; + +class DummyRefCounted : public RefCounted<DummyRefCounted> { + public: + DummyRefCounted(bool& is_deleted) : is_deleted_(is_deleted) { + is_deleted_ = false; + } + ~DummyRefCounted() { + DCHECK(!is_deleted_); + is_deleted_ = true; + } + + void AddRef() { + DCHECK(!is_deleted_); + WTF::RefCounted<DummyRefCounted>::AddRef(); + ++ref_invokes_count_; + } + + void Release() { + DCHECK(!is_deleted_); + WTF::RefCounted<DummyRefCounted>::Release(); + } + + static int ref_invokes_count_; + + private: + bool& is_deleted_; +}; + +struct Dummy { + Dummy(bool& deleted) : deleted(deleted) {} + + ~Dummy() { deleted = true; } + + bool& deleted; +}; + +// WrappedInt class will fail if it was memmoved or memcpyed. +extern HashSet<void*> g_constructed_wrapped_ints; +class WrappedInt { + public: + WrappedInt(int i = 0) : original_this_ptr_(this), i_(i) { + g_constructed_wrapped_ints.insert(this); + } + + WrappedInt(const WrappedInt& other) : original_this_ptr_(this), i_(other.i_) { + g_constructed_wrapped_ints.insert(this); + } + + WrappedInt& operator=(const WrappedInt& other) { + i_ = other.i_; + return *this; + } + + ~WrappedInt() { + EXPECT_EQ(original_this_ptr_, this); + EXPECT_TRUE(g_constructed_wrapped_ints.Contains(this)); + g_constructed_wrapped_ints.erase(this); + } + + int Get() const { return i_; } + + private: + void* original_this_ptr_; + int i_; +}; + +class LivenessCounter { + public: + void AddRef() { live_++; } + void Release() { live_--; } + + static unsigned live_; +}; + +} // namespace WTF + +#endif // WTF_WTFTestHelper_h
diff --git a/third_party/WebKit/common/BUILD.gn b/third_party/WebKit/common/BUILD.gn index 768fb29..59da0b3 100644 --- a/third_party/WebKit/common/BUILD.gn +++ b/third_party/WebKit/common/BUILD.gn
@@ -21,6 +21,8 @@ defines = [ "BLINK_COMMON_IMPLEMENTATION=1" ] sources = [ + "client_hints/client_hints.cc", + "client_hints/client_hints.h", "common_export.h", "device_memory/approximated_device_memory.cc", "device_memory/approximated_device_memory.h",
diff --git a/third_party/WebKit/common/client_hints/client_hints.cc b/third_party/WebKit/common/client_hints/client_hints.cc new file mode 100644 index 0000000..0c754cd0 --- /dev/null +++ b/third_party/WebKit/common/client_hints/client_hints.cc
@@ -0,0 +1,17 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/WebKit/common/client_hints/client_hints.h" + +#include "base/macros.h" + +namespace blink { + +const char* const kClientHintsHeaderMapping[] = {"device-memory", "dpr", + "width", "viewport-width"}; + +const size_t kClientHintsHeaderMappingCount = + arraysize(kClientHintsHeaderMapping); + +} // namespace blink
diff --git a/third_party/WebKit/common/client_hints/client_hints.h b/third_party/WebKit/common/client_hints/client_hints.h new file mode 100644 index 0000000..47fab9d --- /dev/null +++ b/third_party/WebKit/common/client_hints/client_hints.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_WEBKIT_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_ +#define THIRD_PARTY_WEBKIT_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_ + +#include <stddef.h> + +#include "third_party/WebKit/common/common_export.h" + +namespace blink { + +// Mapping from WebClientHintsType to the header value for enabling the +// corresponding client hint. The ordering should match the ordering of enums in +// third_party/WebKit/public/platform/WebClientHintsType.h. +BLINK_COMMON_EXPORT extern const char* const kClientHintsHeaderMapping[]; + +BLINK_COMMON_EXPORT extern const size_t kClientHintsHeaderMappingCount; + +} // namespace blink + +#endif // THIRD_PARTY_WEBKIT_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn index 13bb842b..d2f7440 100644 --- a/third_party/WebKit/public/BUILD.gn +++ b/third_party/WebKit/public/BUILD.gn
@@ -470,6 +470,7 @@ "web/WebAXEnums.h", "web/WebAXObject.h", "web/WebActiveWheelFlingParameters.h", + "web/WebApplyConstraintsRequest.h", "web/WebArrayBuffer.h", "web/WebArrayBufferConverter.h", "web/WebArrayBufferView.h",
diff --git a/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom b/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom index 8983a779..67ee5ba 100644 --- a/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom +++ b/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom
@@ -29,7 +29,7 @@ // https://wicg.github.io/background-fetch/#background-fetch-manager struct BackgroundFetchOptions { array<IconDefinition> icons; - int64 total_download_size; + uint64 download_total; string title; }; @@ -38,8 +38,11 @@ // https://wicg.github.io/background-fetch/#background-fetch-registration struct BackgroundFetchRegistration { string id; + uint64 upload_total; + uint64 uploaded; + uint64 download_total; + uint64 downloaded; array<IconDefinition> icons; - int64 total_download_size; string title; };
diff --git a/third_party/WebKit/public/web/WebApplyConstraintsRequest.h b/third_party/WebKit/public/web/WebApplyConstraintsRequest.h new file mode 100644 index 0000000..dfe13cc --- /dev/null +++ b/third_party/WebKit/public/web/WebApplyConstraintsRequest.h
@@ -0,0 +1,59 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WebApplyConstraintsRequest_h +#define WebApplyConstraintsRequest_h + +#include "public/platform/WebCommon.h" +#include "public/platform/WebPrivatePtr.h" + +namespace blink { + +class ApplyConstraintsRequest; +class WebMediaConstraints; +class WebMediaStreamTrack; +class WebString; + +class BLINK_EXPORT WebApplyConstraintsRequest { + public: + WebApplyConstraintsRequest() = default; + WebApplyConstraintsRequest(const WebApplyConstraintsRequest& other) { + Assign(other); + } + WebApplyConstraintsRequest& operator=( + const WebApplyConstraintsRequest& other) { + Assign(other); + return *this; + } + ~WebApplyConstraintsRequest(); + + bool operator==(const WebApplyConstraintsRequest& other) const; + + void Reset(); + bool IsNull() const { return private_.IsNull(); } + + WebMediaStreamTrack Track() const; + WebMediaConstraints Constraints() const; + + void RequestSucceeded(); + void RequestFailed(const WebString& constraint, const WebString& message); + + // For testing in content/ + static WebApplyConstraintsRequest CreateForTesting( + const WebMediaStreamTrack&, + const WebMediaConstraints&); + +#if INSIDE_BLINK + explicit WebApplyConstraintsRequest(ApplyConstraintsRequest*); +#endif + + private: + void Assign(const WebApplyConstraintsRequest&); + + WebPrivatePtr<ApplyConstraintsRequest> private_; +}; + +} // namespace blink + +#endif // WebApplyConstraintsRequest_h
diff --git a/third_party/WebKit/public/web/WebUserMediaClient.h b/third_party/WebKit/public/web/WebUserMediaClient.h index b4eb5cd..5bf3e8c 100644 --- a/third_party/WebKit/public/web/WebUserMediaClient.h +++ b/third_party/WebKit/public/web/WebUserMediaClient.h
@@ -33,6 +33,7 @@ namespace blink { +class WebApplyConstraintsRequest; class WebMediaDevicesRequest; class WebUserMediaRequest; class WebMediaDeviceChangeObserver; @@ -46,6 +47,7 @@ virtual void RequestMediaDevices(const WebMediaDevicesRequest&) = 0; virtual void SetMediaDeviceChangeObserver( const WebMediaDeviceChangeObserver&) = 0; + virtual void ApplyConstraints(const WebApplyConstraintsRequest&) = 0; }; } // namespace blink
diff --git a/third_party/widevine/cdm/widevine_cdm_common.h b/third_party/widevine/cdm/widevine_cdm_common.h index 84179fd..8ab44bdb 100644 --- a/third_party/widevine/cdm/widevine_cdm_common.h +++ b/third_party/widevine/cdm/widevine_cdm_common.h
@@ -18,8 +18,6 @@ // This type is used to register the Widevine CDM. const char kWidevineCdmType[] = "Widevine"; -const char kWidevineCdmGuid[] = "AD87877A-0213-49A8-8849-9E93B075E477"; - // Widevine CDM files are in a directory with this name. const char kWidevineCdmBaseDirectory[] = "WidevineCdm";
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 1578278..4dd18f5b 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -378,6 +378,12 @@ 'Battor Agent Win': 'official_goma_minimal_symbols_clang', }, + 'chromium.sandbox': { + 'Linux Builder SANDBOX': 'release_bot', + 'Deterministic Linux SANDBOX': 'release_bot', + 'Fuchsia Compile SANDBOX': 'release_bot_fuchsia', + }, + 'chromium.swarm': { 'Android N5 Swarm': 'android_release_bot_minimal_symbols', 'Android N5X Swarm': 'android_release_bot_minimal_symbols_arm64',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 962cf7f..d64cbe7 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -23443,6 +23443,7 @@ <int value="-1327676774" label="disable-accelerated-mjpeg-decode"/> <int value="-1322882747" label="disable-datasaver-prompt"/> <int value="-1319688939" label="ignore-gpu-blacklist"/> + <int value="-1318914924" label="OverflowIconsForMediaControls:enabled"/> <int value="-1310737697" label="MaterialDesignSettings:enabled"/> <int value="-1302904242" label="enable-navigation-tracing"/> <int value="-1294050129" label="ContentFullscreen:disabled"/> @@ -23524,6 +23525,7 @@ <int value="-1052782474" label="enable-cloud-devices"/> <int value="-1052415111" label="malware-interstitial-v2"/> <int value="-1052219252" label="disable-captive-portal-bypass-proxy"/> + <int value="-1048901516" label="ChromeMemex:enabled"/> <int value="-1045900007" label="NoCreditCardAbort:disabled"/> <int value="-1045882995" label="UseNewDoodleApi:enabled"/> <int value="-1041650038" label="enable-forced-migration-to-tabbed-mode"/> @@ -23905,6 +23907,8 @@ <int value="75747474" label="disable-webview-signin-flow"/> <int value="78998551" label="disable-hosted-app-shim-creation"/> <int value="79503461" label="disable-account-consistency"/> + <int value="83422372" + label="ChromeHomePersonalizedOmniboxSuggestions:enabled"/> <int value="84911198" label="ScanCardsInWebPayments:disabled"/> <int value="88437020" label="FeaturePolicy:enabled"/> <int value="91938915" label="enable-suggestions-service"/> @@ -23969,6 +23973,7 @@ <int value="346711293" label="enable-save-password-bubble"/> <int value="348854923" label="v8-cache-strategies-for-cache-storage"/> <int value="352191859" label="disabled-new-style-notification"/> + <int value="352937987" label="OverflowIconsForMediaControls:disabled"/> <int value="358399482" label="enable-high-dpi-fixed-position-compositing"/> <int value="358493847" label="BackgroundLoader:disabled"/> <int value="360391863" label="NTPOfflineBadge:enabled"/> @@ -24124,6 +24129,7 @@ <int value="783270752" label="AndroidHistoryManager:enabled"/> <int value="803282885" label="PreferHtmlOverPlugins:disabled"/> <int value="806334184" label="AndroidSpellChecker:enabled"/> + <int value="807447752" label="ChromeMemex:disabled"/> <int value="807734471" label="tab-management-experiment-type-disabled"/> <int value="811374216" label="disable-new-bookmark-apps"/> <int value="820650704" label="disable-ntp-popular-sites"/> @@ -24399,6 +24405,8 @@ <int value="1548776701" label="AllBookmarks:disabled"/> <int value="1548942246" label="PassiveDocumentEventListeners:disabled"/> <int value="1560188739" label="reader-mode-heuristics"/> + <int value="1567839560" + label="ChromeHomePersonalizedOmniboxSuggestions:disabled"/> <int value="1579461102" label="MemoryCoordinator:disabled"/> <int value="1586022426" label="AutofillCreditCardAssist:enabled"/> <int value="1589341623" label="disable-easy-unlock"/> @@ -29048,6 +29056,18 @@ </int> </enum> +<enum name="OSXFullscreenSource"> + <int value="0" label="BROWSER"> + The window entered fullscreen for the browser. + </int> + <int value="1" label="TAB_CONTENT"> + The window entered fullscreen for the tab contents. + </int> + <int value="2" label="EXTENSION"> + The window entered fullscreen for an extension. + </int> +</enum> + <enum name="OSXFullscreenStyle"> <int value="0" label="IMMERSIVE"> The window was fullscreened using the immersive mechanism. @@ -29062,6 +29082,14 @@ </int> </enum> +<enum name="OSXFullscreenToolbarStyle"> + <int value="0" label="PRESENT">The fullscreen toolbar is always shown.</int> + <int value="1" label="HIDDEN"> + The fullscreen toolbar only appears when the menubar drops down. + </int> + <int value="2" label="NONE">The fullscreen toolbar is not visible.</int> +</enum> + <enum name="OSXFullscreenWindowLocation"> <int value="0" label="PRIMARY_SINGLE_SCREEN"> The window was located on the primary screen, and there is only a single @@ -40744,7 +40772,7 @@ <int value="1354146226" label="chrome://tab-modal-confirm-dialog/"/> <int value="1371905827" label="chrome://flags/"/> <int value="1396129399" label="chrome://flash/"/> - <int value="1403605293" label="chrome://proxy-settings/"/> + <int value="1403605293" label="chrome://internet-detail-dialog/"/> <int value="1427179406" label="chrome://gcm-internals/"/> <int value="1454088830" label="chrome://uber-frame/"/> <int value="1457759734" label="chrome://user-manager/"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 167b6d18..e9e5e80 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -4532,7 +4532,16 @@ </summary> </histogram> -<histogram name="Autofill.AddressesSuppressedForDisuse"> +<histogram name="Autofill.AddressesDeletedForDisuse" units="addresses"> + <owner>wuandy@chromium.org</owner> + <summary> + The number of unverified autofill addresses deleted because they have not + been used for a long time, and are not used as billing addresses of valid + credit cards. Note the deletion only happens once per major version upgrade. + </summary> +</histogram> + +<histogram name="Autofill.AddressesSuppressedForDisuse" units="addresses"> <owner>rogerm@chromium.org</owner> <summary> The number of address suggestions not shown in the Autofill popup because @@ -10415,6 +10424,20 @@ </histogram> <histogram name="ContentSettings.Popups.FirstDocumentEngagementTime" units="ms"> + <obsolete> + Deprecated in favor of ContentSettings.Popups.FirstDocumentEngagementTime2. + </obsolete> + <owner>csharrison@chromium.org</owner> + <summary> + Measures the total duration a popup WebContents is visible / foregrounded + for the duration of its first document load. This time is measured from the + first navigation commit to the time either the WebContents is destroyed or + when a new navigation commits. + </summary> +</histogram> + +<histogram name="ContentSettings.Popups.FirstDocumentEngagementTime2" + units="ms"> <owner>csharrison@chromium.org</owner> <summary> Measures the total duration a popup WebContents is visible / foregrounded @@ -40069,6 +40092,17 @@ </summary> </histogram> +<histogram name="Net.ExpectCTHeader.ParseSuccess" enum="BooleanSuccess"> + <owner>estark@chromium.org</owner> + <summary> + Sites can send an Expect-CT header to Chrome to indicate that they intend + their sites to comply with Chrome's Certificate Transparency policy. This + histogram is recorded whenever an Expect-CT header is processed on a + connection. True indicates that the header parsed successfully, and false + indicates that there was a parse failure. + </summary> +</histogram> + <histogram name="Net.ExpectCTHeaderResult" enum="ExpectCTHeaderResult"> <obsolete> Deprecated 04/2017. @@ -47873,7 +47907,7 @@ </histogram> <histogram name="NewTabPage.AnimatedLogoDownloadTime" units="ms"> - <owner>ianwen@chromium.org</owner> + <owner>treib@chromium.org</owner> <summary> The amount of time it takes to download the animated logo. Android only. </summary> @@ -48621,30 +48655,28 @@ </histogram> <histogram name="NewTabPage.LogoClick" enum="NewTabPageLogoClick"> - <owner>ianwen@chromium.org</owner> + <owner>treib@chromium.org</owner> <summary> - Histogram tracking how many users click on the static logo or animated logo - on NTP. Android and iOS only. + The number of clicks on the static/call-to-action/animated logo on the NTP. </summary> </histogram> <histogram name="NewTabPage.LogoDownloadOutcome" enum="NewTabPageLogoDownloadOutcome"> - <owner>ianwen@chromium.org</owner> + <owner>treib@chromium.org</owner> <summary> Outcome of downloading search provider's logos. It measures whether download/parsing is successful, revalidation and parsing work properly, etc. - Android and iOS only. </summary> </histogram> <histogram name="NewTabPage.LogoDownloadTime" units="ms"> - <owner>ianwen@chromium.org</owner> + <owner>treib@chromium.org</owner> <summary> The amount of time it took to download the static logo. This includes requests where there was no logo, or where an existing logo was revalidated (so no new image data was downloaded), but it does not include failed - requests. Android and iOS only. + requests. </summary> </histogram> @@ -48659,9 +48691,9 @@ <histogram name="NewTabPage.LogoShown" enum="NewTabPageLogoShown"> <owner>treib@chromium.org</owner> <summary> - The number of static logos and animated logos shown to users. Note that this - is recorded both for logos from the cache and for fresh (or revalidated) - logos, so it can be recorded twice per NTP impression. Android and iOS only. + The number of static logos and animated logos shown to users. Note that the + base version of this histogram is recorded both for logos from the cache and + for fresh logos, so it can be recorded twice per NTP impression. </summary> </histogram> @@ -48681,7 +48713,7 @@ <owner>treib@chromium.org</owner> <summary> The amount of time between opening an NTP and the logo appearing. Only - recorded when there is a logo, and only recorded once per NTP. Android only. + recorded when there is a logo, and only recorded once per NTP. </summary> </histogram> @@ -52874,6 +52906,15 @@ </summary> </histogram> +<histogram name="OSX.Fullscreen.Enter.Source" enum="OSXFullscreenSource"> + <owner>spqchan@chromium.org</owner> + <summary> + This event is recorded each time a user triggers fullscreen for a browser + window. It indicates if the fullscreen is triggered for the browser or the + tab content. + </summary> +</histogram> + <histogram name="OSX.Fullscreen.Enter.Style" enum="OSXFullscreenStyle"> <owner>erikchen@chromium.org</owner> <summary> @@ -52893,6 +52934,14 @@ </summary> </histogram> +<histogram name="OSX.Fullscreen.ToolbarStyle" enum="OSXFullscreenToolbarStyle"> + <owner>spqchan@chromium.org</owner> + <summary> + This event is recorded each time a user triggers fullscreen and when the + fullscreen toolbar is updated with a new style. + </summary> +</histogram> + <histogram name="OSX.Handoff.Origin" enum="OSXHandoffOrigin"> <owner>erikchen@chromium.org</owner> <summary> @@ -74930,6 +74979,10 @@ </histogram> <histogram name="Settings.MachineIdGenerationSuccess" enum="BooleanSuccess"> + <obsolete> + Deprecated in Chrome 63, as we verified that machine id generation was not + flaky. + </obsolete> <owner>proberge@chromium.org</owner> <summary> Whether generation of the deterministic machine-specific device id was @@ -82899,6 +82952,25 @@ </summary> </histogram> +<histogram name="Tab.OpenedPopup.PopupToCrossOriginRedirectTime" units="ms"> + <owner>csharrison@chromium.org</owner> + <summary> + Measures the time from when a tab opens a popup to when it navigates itself + cross-origin in the background. + </summary> +</histogram> + +<histogram name="Tab.OpenedPopup.VisibleTimeAfterCrossOriginRedirect" + units="ms"> + <owner>csharrison@chromium.org</owner> + <summary> + Measures the total time a tab is visible after it navigates itself + cross-origin in the background. Measured at WebContents destruction. The tab + must have opened a popup (as classified by the popup blocker) before the + navigation. + </summary> +</histogram> + <histogram name="Tab.PerceivedRestoreTime" units="ms"> <owner>lliabraa@chromium.org</owner> <summary>
diff --git a/tools/perf/page_sets/system_health/expectations.py b/tools/perf/page_sets/system_health/expectations.py index 627aab63..6231af1a 100644 --- a/tools/perf/page_sets/system_health/expectations.py +++ b/tools/perf/page_sets/system_health/expectations.py
@@ -12,10 +12,6 @@ self.DisableStory('browse:search:google', [expectations.ALL_WIN], 'win:crbug.com/673775, mac:crbug.com/756027') - self.DisableStory('browse:tools:maps', [expectations.ALL], - 'crbug.com/712694') - self.DisableStory('browse:tools:earth', [expectations.ALL], - 'crbug.com/708590') self.DisableStory('play:media:google_play_music', [expectations.ALL], 'crbug.com/649392') self.DisableStory('play:media:soundcloud', [expectations.ALL_WIN], @@ -37,10 +33,6 @@ 'crbug.com/676336') self.DisableStory('browse:search:google', [expectations.ALL_WIN], 'crbug.com/673775') - self.DisableStory('browse:tools:maps', [expectations.ALL], - 'crbug.com/712694') - self.DisableStory('browse:tools:earth', [expectations.ALL], - 'crbug.com/708590') self.DisableStory('load:games:miniclip', [expectations.ALL_MAC], 'crbug.com/664661') self.DisableStory('play:media:google_play_music', [expectations.ALL], @@ -127,10 +119,6 @@ 'crbug.com/759777') self.DisableStory('browse:news:cnn', [expectations.ALL_DESKTOP], 'mac:crbug.com/728576, all:crbug.com/759777') - self.DisableStory('browse:tools:earth', [expectations.ALL_DESKTOP], - 'crbug.com/708590') - self.DisableStory('browse:tools:maps', [expectations.ALL_DESKTOP], - 'crbug.com/712694') # Should only include browse:*:* stories.
diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm index bb310eb..fdc0cb47 100644 --- a/ui/accessibility/platform/ax_platform_node_mac.mm +++ b/ui/accessibility/platform/ax_platform_node_mac.mm
@@ -81,6 +81,7 @@ {ui::AX_ROLE_INPUT_TIME, @"AXTimeField"}, {ui::AX_ROLE_LABEL_TEXT, NSAccessibilityGroupRole}, {ui::AX_ROLE_LEGEND, NSAccessibilityGroupRole}, + {ui::AX_ROLE_LINE_BREAK, NSAccessibilityGroupRole}, {ui::AX_ROLE_LINK, NSAccessibilityLinkRole}, {ui::AX_ROLE_LIST, NSAccessibilityListRole}, {ui::AX_ROLE_LIST_BOX, NSAccessibilityListRole},
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index 530c656..6af7dd5 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -2352,7 +2352,7 @@ start_offset = static_cast<LONG>(sel_end); } if (end_offset == IA2_TEXT_OFFSET_LENGTH) { - end_offset = static_cast<LONG>(text_str.size()); + end_offset = len; } else if (end_offset == IA2_TEXT_OFFSET_CARET) { end_offset = static_cast<LONG>(sel_end); }
diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index 718a508..3124791 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm
@@ -161,8 +161,7 @@ return GetEmptyImage(); } - // The gfx::Image takes ownership. - image = gfx::Image(ui_image, base::scoped_policy::RETAIN); + image = gfx::Image(ui_image); } DCHECK(sequence_checker_.CalledOnValidSequence());
diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc index 7b49776f..82786c7 100644 --- a/ui/gfx/image/image.cc +++ b/ui/gfx/image/image.cc
@@ -350,13 +350,10 @@ } #if defined(OS_IOS) -Image::Image(UIImage* image) : Image(image, base::scoped_policy::RETAIN) {} - -Image::Image(UIImage* image, base::scoped_policy::OwnershipPolicy policy) - : storage_(new internal::ImageStorage(Image::kImageRepCocoaTouch)) { +Image::Image(UIImage* image) { if (image) { - if (policy == base::scoped_policy::RETAIN) - base::mac::NSObjectRetain(image); + base::mac::NSObjectRetain(image); + storage_ = new internal::ImageStorage(Image::kImageRepCocoaTouch); AddRepresentation(base::MakeUnique<internal::ImageRepCocoaTouch>(image)); } } @@ -585,7 +582,11 @@ return IsEmpty() ? ImageSkia() : *ToImageSkia(); } -#if defined(OS_MACOSX) && !defined(OS_IOS) +#if defined(OS_IOS) +UIImage* Image::AsUIImage() const { + return IsEmpty() ? nil : ToUIImage(); +} +#elif defined(OS_MACOSX) NSImage* Image::AsNSImage() const { return IsEmpty() ? nil : ToNSImage(); }
diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h index f0d6cbb..3aef49e 100644 --- a/ui/gfx/image/image.h +++ b/ui/gfx/image/image.h
@@ -70,10 +70,6 @@ #if defined(OS_IOS) // Retains |image|. explicit Image(UIImage* image); - - // Retains argument according to |policy|. - Image(UIImage* image, base::scoped_policy::OwnershipPolicy policy); - #elif defined(OS_MACOSX) // Does not retain |image|; expects to take ownership. // A single NSImage object can contain multiple bitmaps so there's no reason @@ -140,8 +136,10 @@ // image is empty. ImageSkia AsImageSkia() const; -#if defined(OS_MACOSX) && !defined(OS_IOS) // Same as ToSkBitmap(), but returns nil if this image is empty. +#if defined(OS_IOS) + UIImage* AsUIImage() const; +#elif defined(OS_MACOSX) NSImage* AsNSImage() const; #endif
diff --git a/ui/webui/resources/cr_elements/shared_vars_css.html b/ui/webui/resources/cr_elements/shared_vars_css.html index 3a52984..d6f0ad9 100644 --- a/ui/webui/resources/cr_elements/shared_vars_css.html +++ b/ui/webui/resources/cr_elements/shared_vars_css.html
@@ -86,11 +86,12 @@ box-shadow: inset 0 5px 6px -3px rgba(0, 0, 0, 0.4); height: 6px; left: 0; + margin-bottom: -6px; opacity: 0; pointer-events: none; - position: absolute; + position: relative; right: 0; - top: 56px; + top: 0px; transition: opacity 500ms; z-index: 1; }