diff --git a/AUTHORS b/AUTHORS index e013ae1b..2513321 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -450,6 +450,7 @@ Leung Wing Chung <lwchkg@gmail.com> Li Yin <li.yin@intel.com> Lidwine Genevet <lgenevet@cisco.com> +Lingyun Cai <lingyun.cai@intel.com> Lionel Landwerlin <lionel.g.landwerlin@intel.com> Loo Rong Jie <loorongjie@gmail.com> Lorenzo Stoakes <lstoakes@gmail.com> @@ -727,6 +728,7 @@ Suyash Sengar <suyash.s@samsung.com> Sunil Ratnu <sunil.ratnu@samsung.com> Suvanjan Mukherjee <suvanjanmukherjee@gmail.com> +Swarali Raut <swarali.sr@samsung.com> Swati Jaiswal <swa.jaiswal@samsung.com> Sylvain Zimmer <sylvinus@gmail.com> Sylvestre Ledru <sylvestre.ledru@gmail.com>
diff --git a/DEPS b/DEPS index 29a9fd8..33001cf 100644 --- a/DEPS +++ b/DEPS
@@ -33,6 +33,7 @@ 'pdfium_git': 'https://pdfium.googlesource.com', 'boringssl_git': 'https://boringssl.googlesource.com', 'skia_git': 'https://skia.googlesource.com', + 'webrtc_git': 'https://webrtc.googlesource.com', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling sfntly # and whatever else without interference from each other. @@ -40,11 +41,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'adf17dc52ff4b56720174f71a3e9507a682f8487', + 'skia_revision': '0f96bb303adfc712baba7830e036df1d0972d7f3', # 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': 'fd1dd40d65273a69c8850e5689f86d104d772121', + 'v8_revision': '491d777ea4f081125e424e5c489879c114803320', # 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. @@ -52,7 +53,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '9df395c86494d760fb4caf20177ad7b6d1ca2b3f', + 'angle_revision': '715e7f1a4ca78ed4826977987e95e064b9b60061', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -64,7 +65,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': 'f2ca50ffa2d26a6c023add24e92adbe6b28bfcc9', + 'pdfium_revision': '038740c2fbd27f5a6a0fad8903546ecb69a2f9a4', # 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. @@ -88,7 +89,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling NaCl # and whatever else without interference from each other. - 'nacl_revision': '081ae0f5c1a70c28df835123ea7110b7600192bc', + 'nacl_revision': 'c5704931e21b54757b6e169c991a3e17b7890523', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -96,7 +97,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': '49fbcfa16b5d148a595cc50036d5e8354739f13f', + 'catapult_revision': 'dd30f4f3837eee42feb07e49dd02c8777b700fb2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -108,7 +109,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. - 'libprotobuf-mutator': 'b3323e24eca853345cff45c4b3ab89e09d17b9f0', + 'libprotobuf-mutator': '52af4b0f6f55f9d8836acb605e902db49eb8e6b4', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -120,6 +121,7 @@ 'pdfium.googlesource.com', 'skia.googlesource.com', 'swiftshader.googlesource.com', + 'webrtc.googlesource.com', ] deps = { @@ -241,10 +243,10 @@ Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067', 'src/third_party/webrtc': - Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '29826f277a161347a2b9e3bc1d2ee6a66cae0c2e', # commit position 19767 + Var('webrtc_git') + '/src/webrtc.git' + '@' + '29826f277a161347a2b9e3bc1d2ee6a66cae0c2e', # commit position 19767 'src/third_party/openmax_dl': - Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'), + Var('webrtc_git') + '/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'), 'src/third_party/jsoncpp/source': Var('chromium_git') + '/external/github.com/open-source-parsers/jsoncpp.git' + '@' + 'f572e8e42e22cfcf5ab0aea26574f408943edfa4', # from svn 248 @@ -404,7 +406,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': - Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '59ba2f846e9197a1e0912a6097d5efd1010d214e', + Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'edcefea34e6071e9fdd673a9e0932932453df515', # Dependency of chromite.git and skia. 'src/third_party/pyelftools':
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/ContentSettingsAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/ContentSettingsAdapter.java index ed26278..a07d349 100644 --- a/android_webview/glue/java/src/com/android/webview/chromium/ContentSettingsAdapter.java +++ b/android_webview/glue/java/src/com/android/webview/chromium/ContentSettingsAdapter.java
@@ -425,7 +425,19 @@ @Override public synchronized void setPluginState(PluginState state) { - mAwSettings.setPluginState(state); + switch (state) { + case OFF: + mAwSettings.setPluginState(AwSettings.PLUGIN_STATE_OFF); + return; + case ON: + mAwSettings.setPluginState(AwSettings.PLUGIN_STATE_ON); + return; + case ON_DEMAND: + mAwSettings.setPluginState(AwSettings.PLUGIN_STATE_ON_DEMAND); + return; + default: + throw new IllegalArgumentException("Unsupported value: " + state); + } } @Override @@ -506,7 +518,17 @@ @Override public synchronized PluginState getPluginState() { - return mAwSettings.getPluginState(); + int value = mAwSettings.getPluginState(); + switch (value) { + case AwSettings.PLUGIN_STATE_OFF: + return PluginState.OFF; + case AwSettings.PLUGIN_STATE_ON: + return PluginState.ON; + case AwSettings.PLUGIN_STATE_ON_DEMAND: + return PluginState.ON_DEMAND; + default: + throw new IllegalArgumentException("Unsupported value: " + value); + } } @Override
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java index 26e7759..659c1f85 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -13,7 +13,6 @@ import android.support.annotation.IntDef; import android.util.Log; import android.webkit.WebSettings; -import android.webkit.WebSettings.PluginState; import org.chromium.base.BuildInfo; import org.chromium.base.ThreadUtils; @@ -53,6 +52,14 @@ public static final int LAYOUT_ALGORITHM_NARROW_COLUMNS = 2; public static final int LAYOUT_ALGORITHM_TEXT_AUTOSIZING = 3; + /* See {@link android.webkit.WebSettings}. */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({PLUGIN_STATE_ON, PLUGIN_STATE_ON_DEMAND, PLUGIN_STATE_OFF}) + public @interface PluginState {} + public static final int PLUGIN_STATE_ON = 0; + public static final int PLUGIN_STATE_ON_DEMAND = 1; + public static final int PLUGIN_STATE_OFF = 2; + // This class must be created on the UI thread. Afterwards, it can be // used from any thread. Internally, the class uses a message queue // to call native code on the UI thread only. @@ -88,7 +95,7 @@ private boolean mAllowFileAccessFromFileURLs; private boolean mJavaScriptCanOpenWindowsAutomatically; private boolean mSupportMultipleWindows; - private PluginState mPluginState = PluginState.OFF; + private @PluginState int mPluginState = PLUGIN_STATE_OFF; private boolean mAppCacheEnabled; private boolean mDomStorageEnabled; private boolean mDatabaseEnabled; @@ -1123,13 +1130,13 @@ */ public void setPluginsEnabled(boolean flag) { if (TRACE) Log.d(LOGTAG, "setPluginsEnabled=" + flag); - setPluginState(flag ? PluginState.ON : PluginState.OFF); + setPluginState(flag ? PLUGIN_STATE_ON : PLUGIN_STATE_OFF); } /** * See {@link android.webkit.WebSettings#setPluginState}. */ - public void setPluginState(PluginState state) { + public void setPluginState(@PluginState int state) { if (TRACE) Log.d(LOGTAG, "setPluginState=" + state); synchronized (mAwSettingsLock) { if (mPluginState != state) { @@ -1144,7 +1151,7 @@ */ public boolean getPluginsEnabled() { synchronized (mAwSettingsLock) { - return mPluginState == PluginState.ON; + return mPluginState == PLUGIN_STATE_ON; } } @@ -1155,13 +1162,14 @@ @CalledByNative private boolean getPluginsDisabledLocked() { assert Thread.holdsLock(mAwSettingsLock); - return mPluginState == PluginState.OFF; + return mPluginState == PLUGIN_STATE_OFF; } /** * See {@link android.webkit.WebSettings#getPluginState}. */ - public PluginState getPluginState() { + @PluginState + public int getPluginState() { synchronized (mAwSettingsLock) { return mPluginState; }
diff --git a/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java b/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java index 75ab7ec..1f1e39f 100644 --- a/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java +++ b/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java
@@ -4,7 +4,6 @@ package org.chromium.android_webview.variations; -import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Service; import android.app.job.JobInfo; @@ -143,13 +142,15 @@ } } - // TODO(crbug.com/762607): Fix getPendingJob API level and remove suppression. - @SuppressLint("NewApi") private static boolean pendingJobExists() { Context context = ContextUtils.getApplicationContext(); JobScheduler scheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); - return scheduler.getPendingJob(TaskIds.WEBVIEW_VARIATIONS_SEED_FETCH_JOB_ID) != null; + List<JobInfo> pendingJobs = scheduler.getAllPendingJobs(); + for (JobInfo job : pendingJobs) { + if (job.getId() == TaskIds.WEBVIEW_VARIATIONS_SEED_FETCH_JOB_ID) return true; + } + return false; } private static void scheduleSeedFetchJob() {
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index d37010d..650b8bf 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -623,6 +623,8 @@ "system/web_notification/web_notification_tray.h", "touch/ash_touch_transform_controller.cc", "touch/ash_touch_transform_controller.h", + "touch/touch_devices_controller.cc", + "touch/touch_devices_controller.h", "touch/touch_hud_debug.cc", "touch/touch_hud_debug.h", "touch/touch_hud_projection.cc", @@ -1160,21 +1162,40 @@ ] } -# This target includes the tests that are run by both ash and mash. Eventually -# the majority of tests in |ash_unittests| should move here. -source_set("common_unittests") { - testonly = true +test("ash_unittests") { sources = [ "accelerators/accelerator_commands_unittest.cc", "accelerators/accelerator_controller_unittest.cc", "accelerators/accelerator_filter_unittest.cc", "accelerators/accelerator_table_unittest.cc", + "accelerators/magnifier_key_scroller_unittest.cc", "accelerators/spoken_feedback_toggler_unittest.cc", "accessibility/accessibility_controller_unittest.cc", + "app_list/app_list_presenter_delegate_unittest.cc", "ash_touch_exploration_manager_chromeos_unittest.cc", "autoclick/autoclick_unittest.cc", + "dip_unittest.cc", + "display/cursor_window_controller_unittest.cc", + "display/display_color_manager_chromeos_unittest.cc", "display/display_configuration_controller_unittest.cc", + "display/display_error_observer_chromeos_unittest.cc", + "display/display_manager_unittest.cc", + "display/display_util_unittest.cc", + "display/extended_mouse_warp_controller_unittest.cc", + "display/mirror_window_controller_unittest.cc", + "display/mouse_cursor_event_filter_unittest.cc", + "display/projecting_observer_chromeos_unittest.cc", + "display/resolution_notification_controller_unittest.cc", + "display/root_window_transformers_unittest.cc", + "display/screen_ash_unittest.cc", + "display/screen_position_controller_unittest.cc", + "display/touch_calibrator_controller_unittest.cc", + "display/unified_mouse_warp_controller_unittest.cc", + "display/window_tree_host_manager_unittest.cc", + "drag_drop/drag_drop_controller_unittest.cc", + "drag_drop/drag_drop_tracker_unittest.cc", "drag_drop/drag_image_view_unittest.cc", + "extended_desktop_unittest.cc", "fast_ink/fast_ink_points_unittest.cc", "first_run/first_run_helper_unittest.cc", "focus_cycler_unittest.cc", @@ -1201,6 +1222,8 @@ "login/ui/login_test_utils.cc", "login/ui/login_test_utils.h", "login/ui/login_user_view_unittest.cc", + "magnifier/magnification_controller_unittest.cc", + "magnifier/partial_magnification_controller_unittest.cc", "metrics/desktop_task_switch_metric_recorder_unittest.cc", "metrics/pointer_metrics_recorder_unittest.cc", "metrics/task_switch_metrics_recorder_unittest.cc", @@ -1208,6 +1231,7 @@ "metrics/user_metrics_recorder_unittest.cc", "mus/window_manager_common_unittests.cc", "mus_property_mirror_ash_unittest.cc", + "pointer_watcher_adapter_classic_unittest.cc", "root_window_controller_unittest.cc", "rotator/screen_rotation_animation_unittest.cc", "rotator/screen_rotation_animator_unittest.cc", @@ -1263,6 +1287,8 @@ "system/power/tablet_power_button_controller_unittest.cc", "system/power/tray_power_unittest.cc", "system/power/video_activity_notifier_unittest.cc", + "system/rotation/tray_rotation_lock_unittest.cc", + "system/screen_layout_observer_unittest.cc", "system/screen_security/screen_tray_item_unittest.cc", "system/session/logout_button_tray_unittest.cc", "system/session/logout_confirmation_controller_unittest.cc", @@ -1287,30 +1313,44 @@ "system/web_notification/login_state_notification_blocker_unittest.cc", "system/web_notification/web_notification_tray_unittest.cc", "test/ash_test_helper_unittest.cc", + "test/ash_unittests.cc", "tooltips/tooltip_controller_unittest.cc", + "touch/touch_devices_controller_unittest.cc", + "touch/touch_observer_hud_unittest.cc", "tray_action/test_tray_action_client.cc", "tray_action/test_tray_action_client.h", "tray_action/tray_action_unittest.cc", + "utility/screenshot_controller_unittest.cc", + "virtual_keyboard_controller_unittest.cc", "wallpaper/wallpaper_controller_unittest.cc", "window_user_data_unittest.cc", + "wm/always_on_top_controller_unittest.cc", "wm/ash_focus_rules_unittest.cc", "wm/container_finder_unittest.cc", + "wm/drag_window_resizer_unittest.cc", + "wm/gestures/overview_gesture_handler_unittest.cc", "wm/immersive_fullscreen_controller_unittest.cc", + "wm/lock_action_handler_layout_manager_unittest.cc", + "wm/lock_layout_manager_unittest.cc", "wm/lock_state_controller_unittest.cc", "wm/mru_window_tracker_unittest.cc", + "wm/native_cursor_manager_ash_unittest.cc", "wm/overlay_event_filter_unittest.cc", "wm/overview/cleanup_animation_observer_unittest.cc", "wm/overview/window_selector_unittest.cc", "wm/panels/panel_layout_manager_unittest.cc", "wm/panels/panel_window_resizer_unittest.cc", + "wm/resize_shadow_and_cursor_unittest.cc", "wm/root_window_layout_manager_unittest.cc", "wm/screen_dimmer_unittest.cc", "wm/screen_pinning_controller_unittest.cc", "wm/session_state_animator_impl_unittest.cc", "wm/splitview/split_view_controller_unittest.cc", "wm/stacking_controller_unittest.cc", + "wm/system_gesture_event_filter_unittest.cc", "wm/system_modal_container_layout_manager_unittest.cc", "wm/tablet_mode/accelerometer_test_data_literals.cc", + "wm/tablet_mode/tablet_mode_controller_unittest.cc", "wm/tablet_mode/tablet_mode_window_manager_unittest.cc", "wm/tablet_mode/touchpad_and_keyboard_disabler_unittest.cc", "wm/toplevel_window_event_handler_unittest.cc", @@ -1323,157 +1363,13 @@ "wm/window_state_unittest.cc", "wm/window_util_unittest.cc", "wm/workspace/magnetism_matcher_unittest.cc", + "wm/workspace/multi_window_resize_controller_unittest.cc", "wm/workspace/workspace_event_handler_unittest.cc", + "wm/workspace/workspace_layout_manager_keyboard_unittest.cc", "wm/workspace/workspace_layout_manager_unittest.cc", "wm/workspace/workspace_window_resizer_unittest.cc", "wm/workspace_controller_unittest.cc", ] - deps = [ - ":test_support_without_content", - "//ash", - "//ash/mus:lib", - "//ash/public/cpp:ash_public_cpp", - "//ash/public/cpp:unit_tests", - "//ash/resources/vector_icons", - "//base", - "//base/test:test_support", - "//chromeos", - "//chromeos:power_manager_proto", - "//chromeos:test_support", - "//chromeos:test_support_without_gmock", - "//components/prefs:test_support", - "//components/session_manager/core", - "//components/user_manager:test_support", - "//device/bluetooth", - "//services/ui/public/interfaces", - "//testing/gmock", - "//ui/accessibility", - "//ui/app_list/presenter", - "//ui/app_list/presenter:test_support", - "//ui/aura", - "//ui/aura:test_support", - "//ui/base", - "//ui/base:test_support", - "//ui/chromeos/events", - "//ui/compositor:test_support", - "//ui/display", - "//ui/events:test_support", - "//ui/gfx:test_support", - "//ui/keyboard", - "//ui/keyboard:test_support", - "//ui/message_center", - "//ui/message_center:test_support", - "//ui/message_center/public/cpp", - "//ui/views", - "//ui/views:test_support", - "//ui/wm", - "//ui/wm:test_support", - "//ui/wm/public", - ] - public_deps = [ - ":test_support_without_content", - ] -} - -test("ash_unittests") { - sources = [ - # TODO: move to common_unittests. Fails because of http://crbug.com/557401. - "accelerators/magnifier_key_scroller_unittest.cc", - - # Specific to classic-ash. - "app_list/app_list_presenter_delegate_unittest.cc", - "pointer_watcher_adapter_classic_unittest.cc", - - # TODO: decide if this needs to be ported. http://crbug.com/695566. - "dip_unittest.cc", - - # TODO: tests in display generally use display_manger(), which doesn't - # exist in mash. Decide which of these tests need to be ported to mash. - # http://crbug.com/695569 - "display/cursor_window_controller_unittest.cc", - "display/display_color_manager_chromeos_unittest.cc", - "display/display_error_observer_chromeos_unittest.cc", - "display/display_manager_unittest.cc", - "display/display_util_unittest.cc", - "display/extended_mouse_warp_controller_unittest.cc", - "display/mirror_window_controller_unittest.cc", - "display/mouse_cursor_event_filter_unittest.cc", - "display/projecting_observer_chromeos_unittest.cc", - "display/resolution_notification_controller_unittest.cc", - "display/root_window_transformers_unittest.cc", - "display/screen_ash_unittest.cc", - "display/screen_position_controller_unittest.cc", - "display/touch_calibrator_controller_unittest.cc", - "display/unified_mouse_warp_controller_unittest.cc", - "display/window_tree_host_manager_unittest.cc", - - # These exercise classic-ash specific functionality. - "drag_drop/drag_drop_controller_unittest.cc", - "drag_drop/drag_drop_tracker_unittest.cc", - - # TODO: port to mash. http://crbug.com/695570. - "extended_desktop_unittest.cc", - - # TODO: magnifier not supported in mash. http://crbug.com/647438. - "magnifier/magnification_controller_unittest.cc", - "magnifier/partial_magnification_controller_unittest.cc", - - # TODO: investigate failure in mash, http://crbug.com/695887. - "system/rotation/tray_rotation_lock_unittest.cc", - - # TODO: fails as ScreenLayoutObserver is not installed in mash, - # http://crbug.com/696752. - "system/screen_layout_observer_unittest.cc", - "test/ash_unittests.cc", - - # TODO(riajiang): port to work with mash. http://crbug.com/698032. - "touch/touch_observer_hud_unittest.cc", - - # TODO(moshayedi): port to work with mash. http://crbug.com/698033. - "utility/screenshot_controller_unittest.cc", - - # TODO: keyboard is not enabled in mash. http://crbug.com/648733. - "virtual_keyboard_controller_unittest.cc", - - # TODO: keyboard is not enabled in mash. http://crbug.com/648733. - "wm/always_on_top_controller_unittest.cc", - - # TODO: mash doesn't support CursorManager. http://crbug.com/631103. - "wm/native_cursor_manager_ash_unittest.cc", - - # TODO: mash doesn't support DragWindowResizer. http://crbug.com/633782. - "wm/drag_window_resizer_unittest.cc", - - # TODO: mash doesn't support OverviewGestureHandler. - # http://crbug.com/634994. - "wm/gestures/overview_gesture_handler_unittest.cc", - - # TODO: fails because keyboard is not enabled in mash. - # http://crbug.com/648733. - "wm/lock_action_handler_layout_manager_unittest.cc", - - # TODO: fails because keyboard is not enabled in mash. - # http://crbug.com/648733. - "wm/lock_layout_manager_unittest.cc", - - # TODO: investigate failures in mash. http://crbug.com/698092. - "wm/tablet_mode/tablet_mode_controller_unittest.cc", - - # TODO: mash doesn't support CursorManager. http://crbug.com/631103. - "wm/resize_shadow_and_cursor_unittest.cc", - - # TODO: mash doesn't support SetFirstDisplayAsInternalDisplay(), which all - # the tests in this file use. http://crbug.com/698091. - "wm/system_gesture_event_filter_unittest.cc", - - # TODO: MultiWindowResizeControllerTests fail in mash. - # http://crbug.com/699172. - "wm/workspace/multi_window_resize_controller_unittest.cc", - - # TODO: fails because the virtual keyboard is not enabled in mash. - # http://crbug.com/648733. - "wm/workspace/workspace_layout_manager_keyboard_unittest.cc", - ] configs += [ "//build/config:precompiled_headers", "//build/config/compiler:no_size_t_to_int_warning", @@ -1481,10 +1377,11 @@ deps = [ ":ash", - ":common_unittests", ":test_support_without_content", "//ash/autoclick/common:autoclick", + "//ash/mus:lib", "//ash/public/cpp:ash_public_cpp", + "//ash/public/cpp:unit_tests", "//ash/resources", "//ash/resources/vector_icons", "//ash/strings", @@ -1492,10 +1389,15 @@ "//base", "//base/test:test_support", "//chromeos", + "//chromeos:power_manager_proto", + "//chromeos:test_support", "//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", "//device/bluetooth", "//mojo/edk/system", "//net:net", @@ -1514,6 +1416,7 @@ "//ui/base:test_support", "//ui/base/ime", "//ui/chromeos", + "//ui/chromeos/events", "//ui/compositor", "//ui/compositor:test_support", "//ui/display", @@ -1524,17 +1427,20 @@ "//ui/events:test_support", "//ui/events/devices", "//ui/gfx", + "//ui/gfx:test_support", "//ui/gfx/geometry", "//ui/gl:test_support", "//ui/keyboard", "//ui/keyboard:test_support", "//ui/message_center", + "//ui/message_center:test_support", "//ui/message_center/public/cpp", "//ui/resources", "//ui/strings", "//ui/views", "//ui/views:test_support", "//ui/wm", + "//ui/wm:test_support", "//ui/wm/public", "//url", ]
diff --git a/ash/accelerators/debug_commands.cc b/ash/accelerators/debug_commands.cc index 0411bf3..7d2f6ef 100644 --- a/ash/accelerators/debug_commands.cc +++ b/ash/accelerators/debug_commands.cc
@@ -6,12 +6,11 @@ #include "ash/accelerators/accelerator_commands.h" #include "ash/ash_switches.h" -#include "ash/public/cpp/touchscreen_enabled_source.h" #include "ash/root_window_controller.h" #include "ash/shell.h" -#include "ash/shell_delegate.h" #include "ash/system/toast/toast_data.h" #include "ash/system/toast/toast_manager.h" +#include "ash/touch/touch_devices_controller.h" #include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_delegate.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" @@ -137,14 +136,14 @@ void HandleToggleTouchpad() { base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad")); - Shell::Get()->shell_delegate()->ToggleTouchpad(); + Shell::Get()->touch_devices_controller()->ToggleTouchpad(); } void HandleToggleTouchscreen() { base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen")); - ShellDelegate* delegate = Shell::Get()->shell_delegate(); - delegate->SetTouchscreenEnabled( - !delegate->GetTouchscreenEnabled(TouchscreenEnabledSource::USER_PREF), + TouchDevicesController* controller = Shell::Get()->touch_devices_controller(); + controller->SetTouchscreenEnabled( + !controller->GetTouchscreenEnabled(TouchscreenEnabledSource::USER_PREF), TouchscreenEnabledSource::USER_PREF); }
diff --git a/ash/accessibility/accessibility_controller.cc b/ash/accessibility/accessibility_controller.cc index 9318e6e..843ce75a 100644 --- a/ash/accessibility/accessibility_controller.cc +++ b/ash/accessibility/accessibility_controller.cc
@@ -138,15 +138,7 @@ PrefService* AccessibilityController::GetActivePrefService() const { if (pref_service_for_test_) return pref_service_for_test_; - - SessionController* session = Shell::Get()->session_controller(); - // Use the active user prefs once they become available. Check the PrefService - // object instead of session state because prefs load is async after login. - PrefService* user_prefs = session->GetLastActiveUserPrefService(); - if (user_prefs) - return user_prefs; - - return session->GetSigninScreenPrefService(); + return Shell::Get()->session_controller()->GetActivePrefService(); } void AccessibilityController::UpdateLargeCursorFromPref() {
diff --git a/ash/accessibility/accessibility_controller.h b/ash/accessibility/accessibility_controller.h index 75e4ddb..c0653653 100644 --- a/ash/accessibility/accessibility_controller.h +++ b/ash/accessibility/accessibility_controller.h
@@ -54,8 +54,8 @@ // initial settings. void ObservePrefs(PrefService* prefs); - // Before login returns the signin screen profile prefs. After login returns - // the active user profile prefs. Returns null early during startup. + // Returns |pref_service_for_test_| if not null, otherwise return + // SessionController::GetActivePrefService(). PrefService* GetActivePrefService() const; void UpdateLargeCursorFromPref();
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index ae37466..40e14a04 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -963,29 +963,11 @@ <message name="IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT" desc="The text of the notification when a peripheral device is in low battery condition."> Battery low (<ph name="percentage">$1<ex>56</ex></ph>%) </message> - <message name="IDS_ASH_LOW_STYLUS_BATTERY_NOTIFICATION_TITLE" desc="The title of the notification which notifies user of the battery level of a stylus."> - Stylus battery is low - </message> - <message name="IDS_ASH_LOW_STYLUS_BATTERY_NOTIFICATION_BODY" desc="The message of the notification which notifies user of the battery level of a stylus."> - Please replace the battery - </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS" desc="The title of the notification when a screenshot was taken."> - Screenshot taken + <message name="IDS_ASH_LOW_STYLUS_BATTERY_NOTIFICATION_TITLE" desc="The title of the notification which notifies user of the battery level of a stylus."> + Stylus battery is low </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_DISABLED" desc="The title of the notification when taking a screenshot failed because screenshots are disabled."> - Screenshots disabled - </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_FAIL" desc="The title of the notification when taking a screenshot failed."> - An error occurred - </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS" desc="The text of the notification when a screenshot was taken. If clicked, the screenshot file is displayed in the Files app."> - Show in folder - </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_DISABLED" desc="The text of the notification when taking a screenshot failed because screenshots are disabled by administrator policy."> - The ability to take screenshots has been disabled by your administrator. - </message> - <message name="IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_FAIL" desc="The text of the notification when taking a screenshot failed."> - Failed to save screenshot + <message name="IDS_ASH_LOW_STYLUS_BATTERY_NOTIFICATION_BODY" desc="The message of the notification which notifies user of the battery level of a stylus."> + Please replace the battery </message> <message name="IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT" desc="The text of the popup when the user preses the exit shortcut in chrome-os."> Press Ctrl+Shift+Q twice to sign out. @@ -1011,7 +993,7 @@ Help us improve Chromebooks </message> <message name="IDS_ASH_HATS_NOTIFICATION_BODY" desc="The body of the notification for Happiness Tracking Survey."> - Let us know how we’re doing by answering a few questions. + Let us know how we’re doing. </message> <message name="IDS_ASH_HATS_NOTIFICATION_TAKE_SURVEY_BUTTON" desc="The title of the button in the notification for Happiness Tracking Survey to take the said survey."> Take survey
diff --git a/ash/host/ash_window_tree_host.cc b/ash/host/ash_window_tree_host.cc index 912dd793..ff7fc5f 100644 --- a/ash/host/ash_window_tree_host.cc +++ b/ash/host/ash_window_tree_host.cc
@@ -10,6 +10,7 @@ #include "ash/shell_port.h" #include "base/memory/ptr_util.h" #include "ui/aura/client/screen_position_client.h" +#include "ui/aura/env.h" #include "ui/aura/window_tree_host.h" #include "ui/events/event.h" #include "ui/gfx/geometry/rect.h" @@ -21,6 +22,11 @@ AshWindowTreeHost::~AshWindowTreeHost() = default; void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { + // NOTE: This code is not called in mus/mash, it is handled on the server + // side. + // TODO(sky): remove this when mus is the default http://crbug.com/763996. + DCHECK_EQ(aura::Env::Mode::LOCAL, aura::Env::GetInstance()->mode()); + if (event->IsTouchEvent()) return;
diff --git a/ash/mus/shell_delegate_mus.cc b/ash/mus/shell_delegate_mus.cc index ec96e247..feb5d826 100644 --- a/ash/mus/shell_delegate_mus.cc +++ b/ash/mus/shell_delegate_mus.cc
@@ -120,17 +120,6 @@ return gfx::Image(); } -bool ShellDelegateMus::GetTouchscreenEnabled( - TouchscreenEnabledSource source) const { - NOTIMPLEMENTED(); - return true; -} - -void ShellDelegateMus::SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) { - NOTIMPLEMENTED(); -} - ui::InputDeviceControllerClient* ShellDelegateMus::GetInputDeviceControllerClient() { if (!connector_)
diff --git a/ash/mus/shell_delegate_mus.h b/ash/mus/shell_delegate_mus.h index 793023e..2238820 100644 --- a/ash/mus/shell_delegate_mus.h +++ b/ash/mus/shell_delegate_mus.h
@@ -42,9 +42,6 @@ GPUSupport* CreateGPUSupport() override; base::string16 GetProductName() const override; gfx::Image GetDeprecatedAcceleratorImage() const override; - bool GetTouchscreenEnabled(TouchscreenEnabledSource source) const override; - void SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; private:
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index 1a5667c..46aeac6 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -43,7 +43,6 @@ "shelf_types.h", "shell_window_ids.cc", "shell_window_ids.h", - "touchscreen_enabled_source.h", "voice_interaction_state.h", "window_pin_type.cc", "window_pin_type.h",
diff --git a/ash/public/cpp/ash_pref_names.cc b/ash/public/cpp/ash_pref_names.cc index dc4dbe93..ec855427 100644 --- a/ash/public/cpp/ash_pref_names.cc +++ b/ash/public/cpp/ash_pref_names.cc
@@ -135,6 +135,10 @@ const char kSystemBluetoothAdapterEnabled[] = "ash.system.bluetooth.adapter_enabled"; +// Boolean prefs for the status of the touchscreen and the touchpad. +const char kTouchpadEnabled[] = "events.touch_pad.enabled"; +const char kTouchscreenEnabled[] = "events.touch_screen.enabled"; + // String pref storing the salt for the pin quick unlock mechanism. const char kQuickUnlockPinSalt[] = "quick_unlock.pin.salt";
diff --git a/ash/public/cpp/ash_pref_names.h b/ash/public/cpp/ash_pref_names.h index 1197c63b..dac71eb2 100644 --- a/ash/public/cpp/ash_pref_names.h +++ b/ash/public/cpp/ash_pref_names.h
@@ -52,6 +52,9 @@ ASH_PUBLIC_EXPORT extern const char kUserBluetoothAdapterEnabled[]; ASH_PUBLIC_EXPORT extern const char kSystemBluetoothAdapterEnabled[]; +ASH_PUBLIC_EXPORT extern const char kTouchpadEnabled[]; +ASH_PUBLIC_EXPORT extern const char kTouchscreenEnabled[]; + ASH_PUBLIC_EXPORT extern const char kQuickUnlockPinSalt[]; } // namespace prefs
diff --git a/ash/public/cpp/touchscreen_enabled_source.h b/ash/public/cpp/touchscreen_enabled_source.h deleted file mode 100644 index 4da79f7..0000000 --- a/ash/public/cpp/touchscreen_enabled_source.h +++ /dev/null
@@ -1,20 +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 ASH_PUBLIC_CPP_TOUCHSCREEN_ENABLED_SOURCE_H_ -#define ASH_PUBLIC_CPP_TOUCHSCREEN_ENABLED_SOURCE_H_ - -namespace ash { - -// Different sources for requested touchscreen enabled/disabled state. -enum class TouchscreenEnabledSource { - // User-requested state set via a debug accelerator and stored in a pref. - USER_PREF, - // Transient global state used to disable touchscreen via power button. - GLOBAL, -}; - -} // namespace ash - -#endif // ASH_PUBLIC_CPP_TOUCHSCREEN_ENABLED_SOURCE_H_
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index 5578817..1737ce5d 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -75,6 +75,7 @@ "notification_bluetooth.icon", "notification_capslock.1x.icon", "notification_capslock.icon", + "notification_charging_usb_c.icon", "notification_chromevox.1x.icon", "notification_chromevox.icon", "notification_display_error.icon",
diff --git a/ash/resources/vector_icons/notification_charging_usb_c.icon b/ash/resources/vector_icons/notification_charging_usb_c.icon new file mode 100644 index 0000000..81cd8562 --- /dev/null +++ b/ash/resources/vector_icons/notification_charging_usb_c.icon
@@ -0,0 +1,38 @@ +// 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. + +CANVAS_DIMENSIONS, 18, +MOVE_TO, 6, 2, +R_H_LINE_TO, 6, +R_CUBIC_TO, 0.55f, 0, 1, 0.45f, 1, 1, +R_V_LINE_TO, 13, +R_CUBIC_TO, 0, 0.55f, -0.45f, 1, -1, 1, +H_LINE_TO, 6, +R_CUBIC_TO, -0.55f, 0, -1, -0.45f, -1, -1, +V_LINE_TO, 3, +R_CUBIC_TO, 0, -0.55f, 0.45f, -1, 1, -1, +CLOSE, +R_MOVE_TO, 1, -1, +R_H_LINE_TO, 4, +R_V_LINE_TO, 1, +H_LINE_TO, 7, +V_LINE_TO, 1, +CLOSE, +R_MOVE_TO, 2, 4, +R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, +R_V_LINE_TO, 5, +R_CUBIC_TO, 0, 1.11f, 0.9f, 2, 2, 2, +R_CUBIC_TO, 1.1f, 0, 2, -0.89f, 2, -2, +V_LINE_TO, 7, +R_CUBIC_TO, 0, -1.1f, -0.89f, -2, -2, -2, +CLOSE, +R_MOVE_TO, 0, 1, +R_CUBIC_TO, 0.55f, 0, 1, 0.45f, 1, 1, +R_V_LINE_TO, 5, +R_CUBIC_TO, 0, 0.55f, -0.45f, 1, -1, 1, +R_CUBIC_TO, -0.55f, 0, -1, -0.45f, -1, -1, +V_LINE_TO, 7, +R_CUBIC_TO, 0, -0.55f, 0.45f, -1, 1, -1, +CLOSE, +END
diff --git a/ash/session/session_controller.cc b/ash/session/session_controller.cc index 053afbf2..4164505 100644 --- a/ash/session/session_controller.cc +++ b/ash/session/session_controller.cc
@@ -241,10 +241,18 @@ return nullptr; } -PrefService* SessionController::GetLastActiveUserPrefService() { +PrefService* SessionController::GetLastActiveUserPrefService() const { return last_active_user_prefs_; } +PrefService* SessionController::GetActivePrefService() const { + // Use the active user prefs once they become available. Check the PrefService + // object instead of session state because prefs load is async after login. + if (last_active_user_prefs_) + return last_active_user_prefs_; + return signin_screen_prefs_.get(); +} + void SessionController::AddObserver(SessionObserver* observer) { observers_.AddObserver(observer); }
diff --git a/ash/session/session_controller.h b/ash/session/session_controller.h index 5727cf0..7930089 100644 --- a/ash/session/session_controller.h +++ b/ash/session/session_controller.h
@@ -147,9 +147,12 @@ PrefService* GetUserPrefServiceForUser(const AccountId& account_id); // Returns the PrefService for the last active user that had one or null if no - // PrefService connection has been successfully established. Returns the - // signin screen profile prefs when at the login screen. - PrefService* GetLastActiveUserPrefService(); + // PrefService connection has been successfully established. + PrefService* GetLastActiveUserPrefService() const; + + // Before login returns the signin screen profile prefs. After login returns + // the active user profile prefs. Returns null early during startup. + PrefService* GetActivePrefService() const; void AddObserver(SessionObserver* observer); void RemoveObserver(SessionObserver* observer);
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 08b55d4..7c78608 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -2213,6 +2213,16 @@ layout_manager->LayoutShelf(); EXPECT_EQ(orig_work_area, display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); +} + +// Change accessibility keyboard work area in sticky mode. +TEST_F(ShelfLayoutManagerKeyboardTest, ShelfShouldChangeWorkAreaInStickyMode) { + ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); + InitKeyboardBounds(); + keyboard::KeyboardController* kb_controller = + keyboard::KeyboardController::GetInstance(); + gfx::Rect orig_work_area( + display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); // Open keyboard in sticky mode. kb_controller->ShowKeyboard(true);
diff --git a/ash/shell.cc b/ash/shell.cc index 75c950f58..55383b64 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -93,6 +93,7 @@ #include "ash/system/tray_caps_lock.h" #include "ash/system/web_notification/message_center_controller.h" #include "ash/touch/ash_touch_transform_controller.h" +#include "ash/touch/touch_devices_controller.h" #include "ash/tray_action/tray_action.h" #include "ash/utility/screenshot_controller.h" #include "ash/virtual_keyboard_controller.h" @@ -348,6 +349,7 @@ TrayCapsLock::RegisterProfilePrefs(registry, for_test); BluetoothPowerController::RegisterProfilePrefs(registry); LockScreenController::RegisterProfilePrefs(registry, for_test); + TouchDevicesController::RegisterProfilePrefs(registry); } views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( @@ -829,6 +831,9 @@ // BluetoothPowerController depends on the PrefService and must be destructed // before it. bluetooth_power_controller_ = nullptr; + // TouchDevicesController depends on the PrefService and must be destructed + // before it. + touch_devices_controller_ = nullptr; // NightLightController depeneds on the PrefService and must be destructed // before it. crbug.com/724231. night_light_controller_ = nullptr; @@ -848,6 +853,8 @@ if (NightLightController::IsFeatureEnabled()) night_light_controller_ = base::MakeUnique<NightLightController>(); + touch_devices_controller_ = std::make_unique<TouchDevicesController>(); + bluetooth_power_controller_ = base::MakeUnique<BluetoothPowerController>(); wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate();
diff --git a/ash/shell.h b/ash/shell.h index 29c0df10..136ef6d 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -160,6 +160,7 @@ class SystemTrayNotifier; class ToplevelWindowEventHandler; class ToastManager; +class TouchDevicesController; class TrayAction; class TrayBluetoothHelper; class VirtualKeyboardController; @@ -305,47 +306,126 @@ AccessibilityDelegate* accessibility_delegate() { return accessibility_delegate_.get(); } + ::wm::ActivationClient* activation_client(); app_list::AppList* app_list() { return app_list_.get(); } AshDisplayController* ash_display_controller() { return ash_display_controller_.get(); } + chromeos::AudioA11yController* audio_a11y_controller() { + return audio_a11y_controller_.get(); + } + AutoclickController* autoclick_controller() { + return autoclick_controller_.get(); + } + BluetoothPowerController* bluetooth_power_controller() { + return bluetooth_power_controller_.get(); + } BrightnessControlDelegate* brightness_control_delegate() { return brightness_control_delegate_.get(); } CastConfigController* cast_config() { return cast_config_.get(); } + ::wm::CursorManager* cursor_manager() { return cursor_manager_.get(); } display::DisplayManager* display_manager() { return display_manager_.get(); } DisplayConfigurationController* display_configuration_controller() { return display_configuration_controller_.get(); } - EventClientImpl* event_client() { return event_client_.get(); } + + // TODO(oshima): Move these objects to WindowTreeHostManager. + display::DisplayConfigurator* display_configurator() { + return display_configurator_.get(); + } + DisplayErrorObserver* display_error_observer() { + return display_error_observer_.get(); + } + ::wm::CompoundEventFilter* env_filter() { return env_filter_.get(); } + EventClientImpl* event_client() { return event_client_.get(); } + EventTransformationHandler* event_transformation_handler() { + return event_transformation_handler_.get(); + } FocusCycler* focus_cycler() { return focus_cycler_.get(); } + GPUSupport* gpu_support() { return gpu_support_.get(); } + HighlighterController* highlighter_controller() { + return highlighter_controller_.get(); + } + HighContrastController* high_contrast_controller() { + return high_contrast_controller_.get(); + } ImeController* ime_controller() { return ime_controller_.get(); } KeyboardBrightnessControlDelegate* keyboard_brightness_control_delegate() { return keyboard_brightness_control_delegate_.get(); } KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); } + LaserPointerController* laser_pointer_controller() { + return laser_pointer_controller_.get(); + } LocaleNotificationController* locale_notification_controller() { return locale_notification_controller_.get(); } - LogoutConfirmationController* logout_confirmation_controller() { - return logout_confirmation_controller_.get(); - } LockScreenController* lock_screen_controller() { return lock_screen_controller_.get(); } + LockStateController* lock_state_controller() { + return lock_state_controller_.get(); + } + LogoutConfirmationController* logout_confirmation_controller() { + return logout_confirmation_controller_.get(); + } + MagnificationController* magnification_controller() { + return magnification_controller_.get(); + } MediaController* media_controller() { return media_controller_.get(); } + UserMetricsRecorder* metrics() { return user_metrics_recorder_.get(); } + MouseCursorEventFilter* mouse_cursor_filter() { + return mouse_cursor_filter_.get(); + } MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } NewWindowController* new_window_controller() { return new_window_controller_.get(); } NightLightController* night_light_controller(); + OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); } + PaletteDelegate* palette_delegate() { return palette_delegate_.get(); } + PartialMagnificationController* partial_magnification_controller() { + return partial_magnification_controller_.get(); + } + PowerButtonController* power_button_controller() { + return power_button_controller_.get(); + } + PowerEventObserver* power_event_observer() { + return power_event_observer_.get(); + } + ResizeShadowController* resize_shadow_controller() { + return resize_shadow_controller_.get(); + } + ResolutionNotificationController* resolution_notification_controller() { + return resolution_notification_controller_.get(); + } + ScreenshotController* screenshot_controller() { + return screenshot_controller_.get(); + } + ScreenLayoutObserver* screen_layout_observer() { + return screen_layout_observer_.get(); + } + ScreenOrientationController* screen_orientation_controller() { + return screen_orientation_controller_.get(); + } + ScreenPinningController* screen_pinning_controller() { + return screen_pinning_controller_.get(); + } SessionController* session_controller() { return session_controller_.get(); } ShelfController* shelf_controller() { return shelf_controller_.get(); } ShelfModel* shelf_model(); + ShellDelegate* shell_delegate() { return shell_delegate_.get(); } ShutdownController* shutdown_controller() { return shutdown_controller_.get(); } + SplitViewController* split_view_controller() { + return split_view_controller_.get(); + } + StickyKeysController* sticky_keys_controller() { + return sticky_keys_controller_.get(); + } SystemTrayController* system_tray_controller() { return system_tray_controller_.get(); } @@ -355,75 +435,39 @@ TabletModeController* tablet_mode_controller() { return tablet_mode_controller_.get(); } + ToastManager* toast_manager() { return toast_manager_.get(); } views::corewm::TooltipController* tooltip_controller() { return tooltip_controller_.get(); } - TrayAction* tray_action() { return tray_action_.get(); } - VpnList* vpn_list() { return vpn_list_.get(); } - WindowCycleController* window_cycle_controller() { - return window_cycle_controller_.get(); - } - WindowSelectorController* window_selector_controller() { - return window_selector_controller_.get(); - } - OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); } - PowerButtonController* power_button_controller() { - return power_button_controller_.get(); - } - LockStateController* lock_state_controller() { - return lock_state_controller_.get(); - } - PaletteDelegate* palette_delegate() { return palette_delegate_.get(); } - ShellDelegate* shell_delegate() { return shell_delegate_.get(); } - VideoDetector* video_detector() { return video_detector_.get(); } - WallpaperController* wallpaper_controller() { - return wallpaper_controller_.get(); - } - WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } - WindowTreeHostManager* window_tree_host_manager() { - return window_tree_host_manager_.get(); - } - PowerEventObserver* power_event_observer() { - return power_event_observer_.get(); + TouchDevicesController* touch_devices_controller() { + return touch_devices_controller_.get(); } AshTouchTransformController* touch_transformer_controller() { return touch_transformer_controller_.get(); } - LaserPointerController* laser_pointer_controller() { - return laser_pointer_controller_.get(); + TrayAction* tray_action() { return tray_action_.get(); } + TrayBluetoothHelper* tray_bluetooth_helper() { + return tray_bluetooth_helper_.get(); } - PartialMagnificationController* partial_magnification_controller() { - return partial_magnification_controller_.get(); + VideoDetector* video_detector() { return video_detector_.get(); } + VirtualKeyboardController* virtual_keyboard_controller() { + return virtual_keyboard_controller_.get(); } - HighlighterController* highlighter_controller() { - return highlighter_controller_.get(); + VpnList* vpn_list() { return vpn_list_.get(); } + WallpaperController* wallpaper_controller() { + return wallpaper_controller_.get(); } - ScreenshotController* screenshot_controller() { - return screenshot_controller_.get(); + WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } + WindowCycleController* window_cycle_controller() { + return window_cycle_controller_.get(); } - MouseCursorEventFilter* mouse_cursor_filter() { - return mouse_cursor_filter_.get(); + WindowPositioner* window_positioner() { return window_positioner_.get(); } + WindowSelectorController* window_selector_controller() { + return window_selector_controller_.get(); } - EventTransformationHandler* event_transformation_handler() { - return event_transformation_handler_.get(); + WindowTreeHostManager* window_tree_host_manager() { + return window_tree_host_manager_.get(); } - ::wm::CursorManager* cursor_manager() { return cursor_manager_.get(); } - - HighContrastController* high_contrast_controller() { - return high_contrast_controller_.get(); - } - - MagnificationController* magnification_controller() { - return magnification_controller_.get(); - } - - AutoclickController* autoclick_controller() { - return autoclick_controller_.get(); - } - - ToastManager* toast_manager() { return toast_manager_.get(); } - - ::wm::ActivationClient* activation_client(); // Force the shelf to query for it's current visibility state. // TODO(jamescook): Move to Shelf. @@ -446,58 +490,9 @@ initially_hide_cursor_ = hide; } - ResizeShadowController* resize_shadow_controller() { - return resize_shadow_controller_.get(); - } - - // Made available for tests. - ::wm::ShadowController* shadow_controller() { - return shadow_controller_.get(); - } - // Starts the animation that occurs on first login. void DoInitialWorkspaceAnimation(); - // TODO(oshima): Move these objects to WindowTreeHostManager. - display::DisplayConfigurator* display_configurator() { - return display_configurator_.get(); - } - DisplayErrorObserver* display_error_observer() { - return display_error_observer_.get(); - } - - ScreenLayoutObserver* screen_layout_observer() { - return screen_layout_observer_.get(); - } - - ResolutionNotificationController* resolution_notification_controller() { - return resolution_notification_controller_.get(); - } - - ScreenOrientationController* screen_orientation_controller() { - return screen_orientation_controller_.get(); - } - - TrayBluetoothHelper* tray_bluetooth_helper() { - return tray_bluetooth_helper_.get(); - } - - BluetoothPowerController* bluetooth_power_controller() { - return bluetooth_power_controller_.get(); - } - - VirtualKeyboardController* virtual_keyboard_controller() { - return virtual_keyboard_controller_.get(); - } - - chromeos::AudioA11yController* audio_a11y_controller() { - return audio_a11y_controller_.get(); - } - - WindowPositioner* window_positioner() { return window_positioner_.get(); } - - UserMetricsRecorder* metrics() { return user_metrics_recorder_.get(); } - void SetTouchHudProjectionEnabled(bool enabled); bool is_touch_hud_projection_enabled() const { @@ -519,19 +514,6 @@ // compositing is enabled, and vice versa. void SetCursorCompositingEnabled(bool enabled); - StickyKeysController* sticky_keys_controller() { - return sticky_keys_controller_.get(); - } - - ScreenPinningController* screen_pinning_controller() { - return screen_pinning_controller_.get(); - } - - GPUSupport* gpu_support() { return gpu_support_.get(); } - - SplitViewController* split_view_controller() { - return split_view_controller_.get(); - } // Returns true if split view mode is active. bool IsSplitViewModeActive() const; @@ -707,6 +689,7 @@ std::unique_ptr<SystemTrayController> system_tray_controller_; std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; std::unique_ptr<ToastManager> toast_manager_; + std::unique_ptr<TouchDevicesController> touch_devices_controller_; std::unique_ptr<TrayAction> tray_action_; std::unique_ptr<VpnList> vpn_list_; std::unique_ptr<WallpaperController> wallpaper_controller_;
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 78d5d95..caf30f6 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc
@@ -139,15 +139,6 @@ return gfx::Image(); } -bool ShellDelegateImpl::GetTouchscreenEnabled( - TouchscreenEnabledSource source) const { - return true; -} - -void ShellDelegateImpl::SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) { -} - ui::InputDeviceControllerClient* ShellDelegateImpl::GetInputDeviceControllerClient() { return nullptr;
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 2e6bd071c..87a25eb 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h
@@ -44,9 +44,6 @@ GPUSupport* CreateGPUSupport() override; base::string16 GetProductName() const override; gfx::Image GetDeprecatedAcceleratorImage() const override; - bool GetTouchscreenEnabled(TouchscreenEnabledSource source) const override; - void SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; private:
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index d9ad03b7..a35504d 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -41,7 +41,6 @@ class NetworkingConfigDelegate; class PaletteDelegate; class WallpaperDelegate; -enum class TouchscreenEnabledSource; // Delegate of the Shell. class ASH_EXPORT ShellDelegate { @@ -114,20 +113,6 @@ virtual gfx::Image GetDeprecatedAcceleratorImage() const = 0; - // Returns the current touchscreen enabled status as specified by |source|. - // Note that the actual state of the touchscreen device is automatically - // determined based on the requests of multiple sources. - virtual bool GetTouchscreenEnabled(TouchscreenEnabledSource source) const = 0; - - // Sets |source|'s requested touchscreen enabled status to |enabled|. Note - // that the actual state of the touchscreen device is automatically determined - // based on the requests of multiple sources. - virtual void SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) = 0; - - // Toggles the status of touchpad between enabled and disabled. - virtual void ToggleTouchpad() {} - // Creator of Shell owns this; it's assumed this outlives Shell. virtual ui::InputDeviceControllerClient* GetInputDeviceControllerClient() = 0; };
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc index f09829d21..38aa127 100644 --- a/ash/system/overview/overview_button_tray.cc +++ b/ash/system/overview/overview_button_tray.cc
@@ -56,6 +56,14 @@ UpdateIconVisibility(); } +void OverviewButtonTray::OnGestureEvent(ui::GestureEvent* event) { + Button::OnGestureEvent(event); + if (event->type() == ui::ET_GESTURE_LONG_PRESS) { + Shell::Get()->window_selector_controller()->OnOverviewButtonTrayLongPressed( + event->location()); + } +} + bool OverviewButtonTray::PerformAction(const ui::Event& event) { if (event.type() == ui::ET_GESTURE_TAP) { if (event.AsGestureEvent()->details().tap_count() == 2) {
diff --git a/ash/system/overview/overview_button_tray.h b/ash/system/overview/overview_button_tray.h index a77c70a..3e5ce95d 100644 --- a/ash/system/overview/overview_button_tray.h +++ b/ash/system/overview/overview_button_tray.h
@@ -11,6 +11,7 @@ #include "ash/system/tray/tray_background_view.h" #include "ash/wm/tablet_mode/tablet_mode_observer.h" #include "base/macros.h" +#include "ui/events/event_constants.h" namespace views { class ImageView; @@ -35,6 +36,9 @@ // state of TabletMode virtual void UpdateAfterLoginStatusChange(LoginStatus status); + // views::Button: + void OnGestureEvent(ui::GestureEvent* event) override; + // ActionableView: bool PerformAction(const ui::Event& event) override;
diff --git a/ash/system/power/dual_role_notification.cc b/ash/system/power/dual_role_notification.cc index 4f803d8..e724ba7d 100644 --- a/ash/system/power/dual_role_notification.cc +++ b/ash/system/power/dual_role_notification.cc
@@ -7,6 +7,7 @@ #include <set> #include "ash/resources/grit/ash_resources.h" +#include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/power/power_status.h" @@ -140,16 +141,20 @@ IDS_ASH_STATUS_TRAY_CHARGING_DUAL_ROLE_DEVICES_TITLE); } - std::unique_ptr<Notification> notification(new Notification( - message_center::NOTIFICATION_TYPE_SIMPLE, kDualRoleNotificationId, title, - l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DUAL_ROLE_MESSAGE), - ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), - base::string16(), GURL(), - message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, - system_notifier::kNotifierDualRole), - message_center::RichNotificationData(), - new DualRoleNotificationDelegate)); + std::unique_ptr<Notification> notification = + system_notifier::CreateSystemNotification( + message_center::NOTIFICATION_TYPE_SIMPLE, kDualRoleNotificationId, + title, + l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DUAL_ROLE_MESSAGE), + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), + base::string16(), GURL(), + message_center::NotifierId( + message_center::NotifierId::SYSTEM_COMPONENT, + system_notifier::kNotifierDualRole), + message_center::RichNotificationData(), + new DualRoleNotificationDelegate, kNotificationChargingUsbCIcon, + message_center::SystemNotificationWarningLevel::NORMAL); notification->set_priority(message_center::MIN_PRIORITY); return notification; }
diff --git a/ash/system/power/power_button_display_controller.cc b/ash/system/power/power_button_display_controller.cc index 18b3853d..b7ab992 100644 --- a/ash/system/power/power_button_display_controller.cc +++ b/ash/system/power/power_button_display_controller.cc
@@ -6,9 +6,8 @@ #include "ash/accessibility_delegate.h" #include "ash/media_controller.h" -#include "ash/public/cpp/touchscreen_enabled_source.h" #include "ash/shell.h" -#include "ash/shell_delegate.h" +#include "ash/touch/touch_devices_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/logging.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -153,7 +152,7 @@ void PowerButtonDisplayController::UpdateTouchscreenStatus() { const bool enable_touchscreen = !backlights_forced_off_ && (screen_state_ != ScreenState::OFF_AUTO); - Shell::Get()->shell_delegate()->SetTouchscreenEnabled( + Shell::Get()->touch_devices_controller()->SetTouchscreenEnabled( enable_touchscreen, TouchscreenEnabledSource::GLOBAL); }
diff --git a/ash/system/power/tablet_power_button_controller_unittest.cc b/ash/system/power/tablet_power_button_controller_unittest.cc index ff6a0ca..ddc5317 100644 --- a/ash/system/power/tablet_power_button_controller_unittest.cc +++ b/ash/system/power/tablet_power_button_controller_unittest.cc
@@ -9,14 +9,13 @@ #include "ash/ash_switches.h" #include "ash/media_controller.h" #include "ash/public/cpp/config.h" -#include "ash/public/cpp/touchscreen_enabled_source.h" #include "ash/session/session_controller.h" #include "ash/session/test_session_controller_client.h" #include "ash/shell.h" #include "ash/shell_test_api.h" #include "ash/test/ash_test_base.h" #include "ash/test_media_client.h" -#include "ash/test_shell_delegate.h" +#include "ash/touch/touch_devices_controller.h" #include "ash/wm/lock_state_controller.h" #include "ash/wm/lock_state_controller_test_api.h" #include "ash/wm/power_button_controller.h" @@ -86,8 +85,6 @@ lock_state_controller_ = Shell::Get()->lock_state_controller(); lock_state_test_api_ = std::make_unique<LockStateControllerTestApi>(lock_state_controller_); - shell_delegate_ = - static_cast<TestShellDelegate*>(Shell::Get()->shell_delegate()); generator_ = &AshTestBase::GetEventGenerator(); power_manager_client_->SendBrightnessChanged(kNonZeroBrightness, false); EXPECT_FALSE(GetBacklightsForcedOff()); @@ -186,7 +183,7 @@ } bool GetGlobalTouchscreenEnabled() const { - return shell_delegate_->GetTouchscreenEnabled( + return Shell::Get()->touch_devices_controller()->GetTouchscreenEnabled( TouchscreenEnabledSource::GLOBAL); } @@ -207,7 +204,6 @@ std::unique_ptr<TabletPowerButtonController::TestApi> test_api_; std::unique_ptr<LockStateControllerTestApi> lock_state_test_api_; base::SimpleTestTickClock* tick_clock_ = nullptr; // Not owned. - TestShellDelegate* shell_delegate_ = nullptr; // Not owned. ui::test::EventGenerator* generator_ = nullptr; DISALLOW_COPY_AND_ASSIGN(TabletPowerButtonControllerTest); @@ -605,8 +601,8 @@ // Tests that with system reboot, the global touchscreen enabled status should // be synced with new backlights forced off state from powerd. TEST_F(TabletPowerButtonControllerTest, SyncTouchscreenEnabled) { - shell_delegate_->SetTouchscreenEnabled(false, - TouchscreenEnabledSource::GLOBAL); + Shell::Get()->touch_devices_controller()->SetTouchscreenEnabled( + false, TouchscreenEnabledSource::GLOBAL); ASSERT_FALSE(GetGlobalTouchscreenEnabled()); // Simulate system reboot by resetting backlights forced off state in powerd
diff --git a/ash/test_shell_delegate.cc b/ash/test_shell_delegate.cc index 7967085a..40276b16 100644 --- a/ash/test_shell_delegate.cc +++ b/ash/test_shell_delegate.cc
@@ -10,7 +10,6 @@ #include "ash/keyboard/test_keyboard_ui.h" #include "ash/palette_delegate.h" #include "ash/public/cpp/shell_window_ids.h" -#include "ash/public/cpp/touchscreen_enabled_source.h" #include "ash/root_window_controller.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" @@ -130,19 +129,6 @@ return gfx::Image(); } -bool TestShellDelegate::GetTouchscreenEnabled( - TouchscreenEnabledSource source) const { - return source == TouchscreenEnabledSource::GLOBAL - ? global_touchscreen_enabled_ - : true; -} - -void TestShellDelegate::SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) { - DCHECK_EQ(TouchscreenEnabledSource::GLOBAL, source); - global_touchscreen_enabled_ = enabled; -} - ui::InputDeviceControllerClient* TestShellDelegate::GetInputDeviceControllerClient() { return nullptr;
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index f965d55..fee409a 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -49,9 +49,6 @@ GPUSupport* CreateGPUSupport() override; base::string16 GetProductName() const override; gfx::Image GetDeprecatedAcceleratorImage() const override; - bool GetTouchscreenEnabled(TouchscreenEnabledSource source) const override; - void SetTouchscreenEnabled(bool enabled, - TouchscreenEnabledSource source) override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; int num_exit_requests() const { return num_exit_requests_; } @@ -64,7 +61,6 @@ int num_exit_requests_ = 0; bool multi_profiles_enabled_ = false; bool force_maximize_on_first_run_ = false; - bool global_touchscreen_enabled_ = true; std::unique_ptr<ShelfInitializer> shelf_initializer_; DISALLOW_COPY_AND_ASSIGN(TestShellDelegate);
diff --git a/ash/touch/touch_devices_controller.cc b/ash/touch/touch_devices_controller.cc new file mode 100644 index 0000000..775022b --- /dev/null +++ b/ash/touch/touch_devices_controller.cc
@@ -0,0 +1,134 @@ +// 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 "ash/touch/touch_devices_controller.h" + +#include "ash/public/cpp/ash_pref_names.h" +#include "ash/session/session_controller.h" +#include "ash/shell.h" +#include "ash/shell_delegate.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" +#include "services/ui/public/cpp/input_devices/input_device_controller_client.h" + +namespace ash { + +namespace { + +void OnSetTouchpadEnabledDone(bool succeeded) { + if (!succeeded) + LOG(ERROR) << "Failed to set touchpad enabled state."; +} + +ui::InputDeviceControllerClient* GetInputDeviceControllerClient() { + return Shell::Get()->shell_delegate()->GetInputDeviceControllerClient(); +} + +} // namespace + +// static +void TouchDevicesController::RegisterProfilePrefs( + PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(prefs::kTouchpadEnabled, PrefRegistry::PUBLIC); + registry->RegisterBooleanPref(prefs::kTouchscreenEnabled, + PrefRegistry::PUBLIC); +} + +TouchDevicesController::TouchDevicesController() { + Shell::Get()->session_controller()->AddObserver(this); +} + +TouchDevicesController::~TouchDevicesController() { + Shell::Get()->session_controller()->RemoveObserver(this); +} + +void TouchDevicesController::ToggleTouchpad() { + PrefService* prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + if (!prefs) + return; + const bool touchpad_enabled = prefs->GetBoolean(prefs::kTouchpadEnabled); + prefs->SetBoolean(prefs::kTouchpadEnabled, !touchpad_enabled); +} + +bool TouchDevicesController::GetTouchscreenEnabled( + TouchscreenEnabledSource source) const { + if (source == TouchscreenEnabledSource::GLOBAL) + return global_touchscreen_enabled_; + + PrefService* prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + return prefs && prefs->GetBoolean(prefs::kTouchscreenEnabled); +} + +void TouchDevicesController::SetTouchscreenEnabled( + bool enabled, + TouchscreenEnabledSource source) { + if (source == TouchscreenEnabledSource::GLOBAL) { + global_touchscreen_enabled_ = enabled; + // Explicitly call |UpdateTouchscreenEnabled()| to update the actual + // touchscreen state from multiple sources. + UpdateTouchscreenEnabled(); + return; + } + + PrefService* prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + if (!prefs) + return; + prefs->SetBoolean(prefs::kTouchscreenEnabled, enabled); +} + +void TouchDevicesController::OnSigninScreenPrefServiceInitialized( + PrefService* prefs) { + ObservePrefs(prefs); +} + +void TouchDevicesController::OnActiveUserPrefServiceChanged( + PrefService* prefs) { + ObservePrefs(prefs); +} + +void TouchDevicesController::ObservePrefs(PrefService* prefs) { + // Watch for pref updates. + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); + pref_change_registrar_->Init(prefs); + pref_change_registrar_->Add( + prefs::kTouchpadEnabled, + base::Bind(&TouchDevicesController::UpdateTouchpadEnabled, + base::Unretained(this))); + pref_change_registrar_->Add( + prefs::kTouchscreenEnabled, + base::Bind(&TouchDevicesController::UpdateTouchscreenEnabled, + base::Unretained(this))); + // Load current state. + UpdateTouchpadEnabled(); + UpdateTouchscreenEnabled(); +} + +void TouchDevicesController::UpdateTouchpadEnabled() { + if (!GetInputDeviceControllerClient()) + return; // Happens in tests. + + PrefService* prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + if (!prefs) + return; + + GetInputDeviceControllerClient()->SetInternalTouchpadEnabled( + prefs->GetBoolean(prefs::kTouchpadEnabled), + base::BindOnce(&OnSetTouchpadEnabledDone)); +} + +void TouchDevicesController::UpdateTouchscreenEnabled() { + if (!GetInputDeviceControllerClient()) + return; // Happens in tests. + + GetInputDeviceControllerClient()->SetTouchscreensEnabled( + GetTouchscreenEnabled(TouchscreenEnabledSource::GLOBAL) && + GetTouchscreenEnabled(TouchscreenEnabledSource::USER_PREF)); +} + +} // namespace ash
diff --git a/ash/touch/touch_devices_controller.h b/ash/touch/touch_devices_controller.h new file mode 100644 index 0000000..fc0021d --- /dev/null +++ b/ash/touch/touch_devices_controller.h
@@ -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. + +#ifndef ASH_TOUCH_TOUCH_DEVICES_CONTROLLER_H_ +#define ASH_TOUCH_TOUCH_DEVICES_CONTROLLER_H_ + +#include <memory> + +#include "ash/ash_export.h" +#include "ash/session/session_observer.h" + +class PrefChangeRegistrar; +class PrefRegistrySimple; +class PrefService; + +namespace ash { + +// Different sources for requested touchscreen enabled/disabled state. +enum class TouchscreenEnabledSource { + // User-requested state set via a debug accelerator and stored in a pref. + USER_PREF, + // Transient global state used to disable touchscreen via power button. + GLOBAL, +}; + +// Controls the enabled state of touchpad and touchscreen. +class ASH_EXPORT TouchDevicesController : public SessionObserver { + public: + TouchDevicesController(); + ~TouchDevicesController() override; + + static void RegisterProfilePrefs(PrefRegistrySimple* registry); + + // Toggles the status of touchpad between enabled and disabled. + void ToggleTouchpad(); + + // Returns the current touchscreen enabled status as specified by |source|. + // Note that the actual state of the touchscreen device is automatically + // determined based on the requests of multiple sources. + bool GetTouchscreenEnabled(TouchscreenEnabledSource source) const; + + // Sets |source|'s requested touchscreen enabled status to |enabled|. Note + // that the actual state of the touchscreen device is automatically determined + // based on the requests of multiple sources. + void SetTouchscreenEnabled(bool enabled, TouchscreenEnabledSource source); + + private: + // Overridden from SessionObserver: + void OnSigninScreenPrefServiceInitialized(PrefService* prefs) override; + void OnActiveUserPrefServiceChanged(PrefService* prefs) override; + + // Observes either the signin screen prefs or active user prefs and loads + // initial state. + void ObservePrefs(PrefService* prefs); + + // Updates the actual enabled/disabled status of the touchpad. + void UpdateTouchpadEnabled(); + + // Updates the actual enabled/disabled status of the touchscreen. Touchscreen + // is enabled if all the touchscreen enabled sources are enabled. + void UpdateTouchscreenEnabled(); + + // The touchscreen state which is associated with the global touchscreen + // enabled source. + bool global_touchscreen_enabled_ = false; + + // Observes user profile prefs for touch devices. + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; + + DISALLOW_COPY_AND_ASSIGN(TouchDevicesController); +}; + +} // namespace ash + +#endif // ASH_TOUCH_TOUCH_DEVICES_CONTROLLER_H_
diff --git a/ash/touch/touch_devices_controller_unittest.cc b/ash/touch/touch_devices_controller_unittest.cc new file mode 100644 index 0000000..d99ae4dd --- /dev/null +++ b/ash/touch/touch_devices_controller_unittest.cc
@@ -0,0 +1,112 @@ +// 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 "ash/touch/touch_devices_controller.h" + +#include "ash/accelerators/debug_commands.h" +#include "ash/ash_switches.h" +#include "ash/public/cpp/ash_pref_names.h" +#include "ash/session/session_controller.h" +#include "ash/session/test_session_controller_client.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "base/command_line.h" +#include "components/prefs/pref_service.h" + +namespace ash { + +namespace { + +constexpr char kUser1Email[] = "user1@test.com"; +constexpr char kUser2Email[] = "user2@test.com"; + +bool GetTouchpadEnabled() { + PrefService* prefs = + Shell::Get()->session_controller()->GetLastActiveUserPrefService(); + return prefs && prefs->GetBoolean(prefs::kTouchpadEnabled); +} + +bool GetUserPrefTouchscreenEnabled() { + return Shell::Get()->touch_devices_controller()->GetTouchscreenEnabled( + TouchscreenEnabledSource::USER_PREF); +} + +bool GetGlobalTouchscreenEnabled() { + return Shell::Get()->touch_devices_controller()->GetTouchscreenEnabled( + TouchscreenEnabledSource::GLOBAL); +} + +} // namespace + +class TouchDevicesControllerTest : public NoSessionAshTestBase { + public: + TouchDevicesControllerTest() = default; + ~TouchDevicesControllerTest() override = default; + + // NoSessionAshTestBase: + void SetUp() override { + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kAshDebugShortcuts); + NoSessionAshTestBase::SetUp(); + CreateTestUserSessions(); + + // Simulate user 1 login. + SwitchActiveUser(kUser1Email); + + ASSERT_TRUE(debug::DebugAcceleratorsEnabled()); + } + + void CreateTestUserSessions() { + GetSessionControllerClient()->Reset(); + GetSessionControllerClient()->AddUserSession(kUser1Email); + GetSessionControllerClient()->AddUserSession(kUser2Email); + } + + void SwitchActiveUser(const std::string& email) { + GetSessionControllerClient()->SwitchActiveUser( + AccountId::FromUserEmail(email)); + } + + private: + DISALLOW_COPY_AND_ASSIGN(TouchDevicesControllerTest); +}; + +// Tests that touchpad enabled user pref works properly under debug accelerator. +TEST_F(TouchDevicesControllerTest, ToggleTouchpad) { + ASSERT_TRUE(GetTouchpadEnabled()); + debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_PAD); + EXPECT_FALSE(GetTouchpadEnabled()); + + // Switch to user 2 and switch back. + SwitchActiveUser(kUser2Email); + EXPECT_TRUE(GetTouchpadEnabled()); + SwitchActiveUser(kUser1Email); + EXPECT_FALSE(GetTouchpadEnabled()); + + debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_PAD); + EXPECT_TRUE(GetTouchpadEnabled()); +} + +// Tests that touchscreen enabled user pref works properly under debug +// accelerator. +TEST_F(TouchDevicesControllerTest, SetTouchscreenEnabled) { + const bool kInitialGlobalTouchscreenEnabled = GetGlobalTouchscreenEnabled(); + ASSERT_TRUE(GetUserPrefTouchscreenEnabled()); + debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_SCREEN); + EXPECT_FALSE(GetUserPrefTouchscreenEnabled()); + EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled()); + + // Switch to user 2 and switch back. + SwitchActiveUser(kUser2Email); + EXPECT_TRUE(GetUserPrefTouchscreenEnabled()); + SwitchActiveUser(kUser1Email); + EXPECT_FALSE(GetUserPrefTouchscreenEnabled()); + EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled()); + + debug::PerformDebugActionIfEnabled(DEBUG_TOGGLE_TOUCH_SCREEN); + EXPECT_TRUE(GetUserPrefTouchscreenEnabled()); + EXPECT_EQ(kInitialGlobalTouchscreenEnabled, GetGlobalTouchscreenEnabled()); +} + +} // namespace ash
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc index e3b95c34..880a284 100644 --- a/ash/wm/overview/window_selector.cc +++ b/ash/wm/overview/window_selector.cc
@@ -506,6 +506,15 @@ split_view_overview_overlay_->SetVisible(visible, event_location); } +WindowGrid* WindowSelector::GetGridWithRootWindow(aura::Window* root_window) { + for (std::unique_ptr<WindowGrid>& grid : grid_list_) { + if (grid->root_window() == root_window) + return grid.get(); + } + + return nullptr; +} + void WindowSelector::RemoveWindowSelectorItem(WindowSelectorItem* item) { if (item->GetWindow()->HasObserver(this)) { item->GetWindow()->RemoveObserver(this);
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h index 7d1c1216..ec2fd04 100644 --- a/ash/wm/overview/window_selector.h +++ b/ash/wm/overview/window_selector.h
@@ -96,6 +96,9 @@ // |split_view_overview_overlays_|'s widget, if necessary. void SetSplitViewOverviewOverlayVisible(bool visible, const gfx::Point& event_location); + // Retrieves the window grid whose root window matches |root_window|. Returns + // nullptr if the window grid is not found. + WindowGrid* GetGridWithRootWindow(aura::Window* root_window); // Removes the window selector item from the overview window grid. void RemoveWindowSelectorItem(WindowSelectorItem* item);
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc index 8ff60b1..97038091 100644 --- a/ash/wm/overview/window_selector_controller.cc +++ b/ash/wm/overview/window_selector_controller.cc
@@ -14,9 +14,11 @@ #include "ash/wm/overview/window_grid.h" #include "ash/wm/overview/window_selector.h" #include "ash/wm/overview/window_selector_item.h" +#include "ash/wm/root_window_finder.h" #include "ash/wm/screen_pinning_controller.h" #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/window_state.h" +#include "ash/wm/window_util.h" #include "base/metrics/histogram_macros.h" namespace ash { @@ -129,6 +131,75 @@ window_selector_->restoring_minimized_windows(); } +void WindowSelectorController::OnOverviewButtonTrayLongPressed( + const gfx::Point& event_location) { + // Depending on the state of the windows and split view, a long press has many + // different results. + // 1. Already in split view - exit split view. + // 2. Not in overview mode - enter split view iff + // a) there is an active window + // b) there are at least two windows in the mru list + // c) the active window is snappable + // 3. In overview mode - enter split view iff + // a) there are at least two windows in the mru list + // b) the first window in the mru list is snappable + + auto* split_view_controller = Shell::Get()->split_view_controller(); + // Exit split view mode if we are already in it. + if (split_view_controller->IsSplitViewModeActive()) { + split_view_controller->EndSplitView(); + return; + } + + auto* active_window = wm::GetActiveWindow(); + // Do nothing if there are no active windows, less than two windows to work + // with, or the active window is not snappable. + // TODO(sammiequon): Bounce the window if it is not snappable. + if (!active_window || + Shell::Get()->mru_window_tracker()->BuildMruWindowList().size() < 2u || + !SplitViewController::CanSnap(active_window)) { + return; + } + + // If we are not in overview mode snap the window left and enter overview + // mode. + if (!IsSelecting()) { + split_view_controller->SnapWindow(active_window, SplitViewController::LEFT); + ToggleOverview(); + return; + } + + // Currently in overview mode, with no snapped windows. Retrieve the first + // window selector item and attempt to snap that window. + DCHECK(window_selector_); + WindowSelectorItem* item_to_snap = nullptr; + WindowGrid* current_grid = window_selector_->GetGridWithRootWindow( + wm::GetRootWindowAt(event_location)); + if (current_grid) { + const auto& windows = current_grid->window_list(); + if (windows.size() > 0) + item_to_snap = windows[0].get(); + } + + // Do nothing if no item was retrieved, or if the retrieved item is + // unsnappable. + // TODO(sammiequon): Bounce the window if it is not snappable. + if (!item_to_snap || + !SplitViewController::CanSnap(item_to_snap->GetWindow())) { + return; + } + + // Snap the window selector item and remove it from the grid. + item_to_snap->EnsureVisible(); + item_to_snap->RestoreWindow(); + aura::Window* window = item_to_snap->GetWindow(); + window_selector_->RemoveWindowSelectorItem(item_to_snap); + split_view_controller->SnapWindow(window, SplitViewController::LEFT); + window_selector_->SetBoundsForWindowGridsInScreen( + split_view_controller->GetSnappedWindowBoundsInScreen( + window, SplitViewController::RIGHT)); +} + std::vector<aura::Window*> WindowSelectorController::GetWindowsListInOverviewGridsForTesting() { std::vector<aura::Window*> windows;
diff --git a/ash/wm/overview/window_selector_controller.h b/ash/wm/overview/window_selector_controller.h index dfd6556..806b79cc 100644 --- a/ash/wm/overview/window_selector_controller.h +++ b/ash/wm/overview/window_selector_controller.h
@@ -49,6 +49,11 @@ // are visible during overview mode. bool IsRestoringMinimizedWindows() const; + // Called when the overview button tray has been long pressed. Enters + // splitview mode if the active window is snappable. Also enters overview mode + // if device is not currently in overview mode. + void OnOverviewButtonTrayLongPressed(const gfx::Point& event_location); + // Gets the windows list that are shown in the overview windows grids if the // overview mode is active for testing. std::vector<aura::Window*> GetWindowsListInOverviewGridsForTesting();
diff --git a/ash/wm/splitview/split_view_controller.cc b/ash/wm/splitview/split_view_controller.cc index 140b5c5..b20a48a 100644 --- a/ash/wm/splitview/split_view_controller.cc +++ b/ash/wm/splitview/split_view_controller.cc
@@ -28,12 +28,6 @@ // Five fixed position ratios of the divider. constexpr float kFixedPositionRatios[] = {0.0f, 0.33f, 0.5f, 0.67f, 1.0f}; -// Returns true if |window| can be activated and snapped. -bool CanSnap(aura::Window* window) { - return wm::CanActivateWindow(window) ? wm::GetWindowState(window)->CanSnap() - : false; -} - float FindClosestFixedPositionRatio( int x_position, const gfx::Rect& work_area_bounds_in_screen) { @@ -73,6 +67,12 @@ return true; } +// static +bool SplitViewController::CanSnap(aura::Window* window) { + return wm::CanActivateWindow(window) ? wm::GetWindowState(window)->CanSnap() + : false; +} + bool SplitViewController::IsSplitViewModeActive() const { return state_ != NO_SNAP; } @@ -282,6 +282,30 @@ } } +void SplitViewController::EndSplitView() { + if (!IsSplitViewModeActive()) + return; + + // Remove observers when the split view mode ends. + Shell::Get()->RemoveShellObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); + + StopObserving(left_window_); + StopObserving(right_window_); + left_window_ = nullptr; + right_window_ = nullptr; + split_view_divider_.reset(); + black_scrim_layer_.reset(); + default_snap_position_ = NONE; + divider_position_ = -1; + + State previous_state = state_; + state_ = NO_SNAP; + NotifySplitViewStateChanged(previous_state, state_); + + Shell::Get()->NotifySplitViewModeEnded(); +} + void SplitViewController::AddObserver(Observer* observer) { observers_.AddObserver(observer); } @@ -382,30 +406,6 @@ } } -void SplitViewController::EndSplitView() { - if (!IsSplitViewModeActive()) - return; - - // Remove observers when the split view mode ends. - Shell::Get()->RemoveShellObserver(this); - Shell::Get()->activation_client()->RemoveObserver(this); - - StopObserving(left_window_); - StopObserving(right_window_); - left_window_ = nullptr; - right_window_ = nullptr; - split_view_divider_.reset(); - black_scrim_layer_.reset(); - default_snap_position_ = NONE; - divider_position_ = -1; - - State previous_state = state_; - state_ = NO_SNAP; - NotifySplitViewStateChanged(previous_state, state_); - - Shell::Get()->NotifySplitViewModeEnded(); -} - void SplitViewController::StartObserving(aura::Window* window) { if (window && !window->HasObserver(this)) { window->AddObserver(this);
diff --git a/ash/wm/splitview/split_view_controller.h b/ash/wm/splitview/split_view_controller.h index d2f8a63..4ef7c16 100644 --- a/ash/wm/splitview/split_view_controller.h +++ b/ash/wm/splitview/split_view_controller.h
@@ -50,6 +50,9 @@ // mode is only supported in tablet mode (tablet mode). static bool ShouldAllowSplitView(); + // Returns true if |window| can be activated and snapped. + static bool CanSnap(aura::Window* window); + // Returns true if split view mode is active. bool IsSplitViewModeActive() const; @@ -79,6 +82,9 @@ void Resize(const gfx::Point& location_in_screen); void EndResize(const gfx::Point& location_in_screen); + // Ends the split view mode. + void EndSplitView(); + void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); @@ -109,9 +115,6 @@ friend class SplitViewControllerTest; friend class WindowSelectorTest; - // Ends the split view mode. - void EndSplitView(); - // Starts/Stops observing |window|. void StartObserving(aura::Window* window); void StopObserving(aura::Window* window);
diff --git a/ash/wm/splitview/split_view_controller_unittest.cc b/ash/wm/splitview/split_view_controller_unittest.cc index e1890b96..76a0f09 100644 --- a/ash/wm/splitview/split_view_controller_unittest.cc +++ b/ash/wm/splitview/split_view_controller_unittest.cc
@@ -6,7 +6,11 @@ #include "ash/ash_switches.h" #include "ash/shell.h" +#include "ash/system/overview/overview_button_tray.h" +#include "ash/system/status_area_widget.h" +#include "ash/system/status_area_widget_test_helper.h" #include "ash/test/ash_test_base.h" +#include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/window_selector_controller.h" #include "ash/wm/splitview/split_view_divider.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" @@ -54,6 +58,14 @@ Shell::Get()->window_selector_controller()->ToggleOverview(); } + void LongPressOnOverivewButtonTray() { + ui::GestureEvent event(0, 0, 0, base::TimeTicks(), + ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS)); + StatusAreaWidgetTestHelper::GetStatusAreaWidget() + ->overview_button_tray() + ->OnGestureEvent(&event); + } + std::vector<aura::Window*> GetWindowsInOverviewGrids() { return Shell::Get() ->window_selector_controller() @@ -366,4 +378,110 @@ EXPECT_EQ(split_view_controller()->right_window(), window2.get()); } +// Verifies that by long pressing on the overview button tray, split view gets +// activated iff we have two or more windows in the mru list. +TEST_F(SplitViewControllerTest, LongPressEntersSplitView) { + // Verify that with no active windows, split view does not get activated. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + const gfx::Rect bounds(0, 0, 200, 200); + std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); + wm::ActivateWindow(window1.get()); + + // Verify that with only one window, split view does not get activated. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + // Verify that with two windows, split view gets activated. + std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); + wm::ActivateWindow(window2.get()); + LongPressOnOverivewButtonTray(); + EXPECT_TRUE(split_view_controller()->IsSplitViewModeActive()); +} + +// Verify that when in split view mode with either one snapped or two snapped +// windows, split view mode gets exited when the overview button gets a long +// press event. +TEST_F(SplitViewControllerTest, LongPressExitsSplitView) { + const gfx::Rect bounds(0, 0, 200, 200); + std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); + std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); + wm::ActivateWindow(window2.get()); + wm::ActivateWindow(window1.get()); + split_view_controller()->SnapWindow(window1.get(), SplitViewController::LEFT); + ASSERT_TRUE(split_view_controller()->IsSplitViewModeActive()); + + // Verify that by long pressing on the overview button tray with one snapped + // window, split view mode gets exited. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + // Snap two windows. + split_view_controller()->SnapWindow(window1.get(), SplitViewController::LEFT); + split_view_controller()->SnapWindow(window2.get(), + SplitViewController::RIGHT); + ASSERT_TRUE(split_view_controller()->IsSplitViewModeActive()); + + // Verify that by long pressing on the overview button tray with two snapped + // windows, split view mode gets exited. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); +} + +// Verify that split view mode get activated when long pressing on the overview +// button while in overview mode iff we have more than two windows in the mru +// list. +TEST_F(SplitViewControllerTest, LongPressInOverviewMode) { + ToggleOverview(); + + const gfx::Rect bounds(0, 0, 200, 200); + std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); + wm::ActivateWindow(window1.get()); + ASSERT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + // Nothing happens if there is only one window. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + // Verify that with two windows, a long press on the overview button tray will + // enter splitview. + std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); + wm::ActivateWindow(window2.get()); + LongPressOnOverivewButtonTray(); + EXPECT_TRUE(split_view_controller()->IsSplitViewModeActive()); + EXPECT_EQ(window2.get(), split_view_controller()->left_window()); +} + +TEST_F(SplitViewControllerTest, LongPressWithUnsnappableWindow) { + // Add one unsnappable window and two regular windows. + const gfx::Rect bounds(0, 0, 200, 200); + std::unique_ptr<aura::Window> unsnappable_window(CreateWindow(bounds)); + unsnappable_window->SetProperty(aura::client::kResizeBehaviorKey, + ui::mojom::kResizeBehaviorNone); + ASSERT_FALSE(split_view_controller()->IsSplitViewModeActive()); + std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); + std::unique_ptr<aura::Window> window3(CreateWindow(bounds)); + wm::ActivateWindow(window2.get()); + wm::ActivateWindow(window3.get()); + wm::ActivateWindow(unsnappable_window.get()); + ASSERT_EQ(unsnappable_window.get(), wm::GetActiveWindow()); + + // Verify split view is not activated when long press occurs when active + // window is unsnappable. + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + + // Verify split view is not activated when long press occurs in overview mode + // and the most recent window is unsnappable. + ToggleOverview(); + ASSERT_TRUE(Shell::Get()->mru_window_tracker()->BuildMruWindowList().size() > + 0); + ASSERT_EQ(unsnappable_window.get(), + Shell::Get()->mru_window_tracker()->BuildMruWindowList()[0]); + LongPressOnOverivewButtonTray(); + EXPECT_FALSE(split_view_controller()->IsSplitViewModeActive()); + ToggleOverview(); +} + } // namespace ash
diff --git a/base/BUILD.gn b/base/BUILD.gn index d2352aa..d1328f99 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -565,6 +565,7 @@ "metrics/persistent_memory_allocator.h", "metrics/persistent_sample_map.cc", "metrics/persistent_sample_map.h", + "metrics/record_histogram_checker.h", "metrics/sample_map.cc", "metrics/sample_map.h", "metrics/sample_vector.cc", @@ -1787,6 +1788,7 @@ test("base_perftests") { sources = [ + "message_loop/message_loop_perftest.cc", "message_loop/message_pump_perftest.cc", # "test/run_all_unittests.cc",
diff --git a/base/android/jni_android.cc b/base/android/jni_android.cc index e91e6f9..ffe2a95 100644 --- a/base/android/jni_android.cc +++ b/base/android/jni_android.cc
@@ -285,6 +285,9 @@ env, static_cast<jstring>( env->CallObjectMethod(bytearray_output_stream.obj(), bytearray_output_stream_tostring))); + if (ClearException(env)) { + return "Java OOM'd in exception handling, check logcat"; + } return ConvertJavaStringToUTF8(exception_string); }
diff --git a/base/message_loop/message_loop_perftest.cc b/base/message_loop/message_loop_perftest.cc new file mode 100644 index 0000000..867e8fe --- /dev/null +++ b/base/message_loop/message_loop_perftest.cc
@@ -0,0 +1,254 @@ +// 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 <memory> +#include <vector> + +#include "base/atomicops.h" +#include "base/bind.h" +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "base/strings/stringprintf.h" +#include "base/synchronization/atomic_flag.h" +#include "base/synchronization/waitable_event.h" +#include "base/threading/platform_thread.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_test.h" + +namespace base { + +namespace { + +// A thread that waits for the caller to signal an event before proceeding to +// call Action::Run(). +class PostingThread { + public: + class Action { + public: + virtual ~Action() = default; + + // Called after the thread is started and |start_event_| is signalled. + virtual void Run() = 0; + + protected: + Action() = default; + + private: + DISALLOW_COPY_AND_ASSIGN(Action); + }; + + // Creates a PostingThread where the thread waits on |start_event| before + // calling action->Run(). If a thread is returned, the thread is guaranteed to + // be allocated and running and the caller must call Join() before destroying + // the PostingThread. + static std::unique_ptr<PostingThread> Create(WaitableEvent* start_event, + std::unique_ptr<Action> action) { + auto posting_thread = + WrapUnique(new PostingThread(start_event, std::move(action))); + + if (!posting_thread->Start()) + return nullptr; + + return posting_thread; + } + + ~PostingThread() { DCHECK_EQ(!thread_handle_.is_null(), join_called_); } + + void Join() { + PlatformThread::Join(thread_handle_); + join_called_ = true; + } + + private: + class Delegate final : public PlatformThread::Delegate { + public: + Delegate(PostingThread* outer, std::unique_ptr<Action> action) + : outer_(outer), action_(std::move(action)) { + DCHECK(outer_); + DCHECK(action_); + } + + ~Delegate() override = default; + + private: + void ThreadMain() override { + outer_->thread_started_.Signal(); + outer_->start_event_->Wait(); + action_->Run(); + } + + PostingThread* const outer_; + const std::unique_ptr<Action> action_; + + DISALLOW_COPY_AND_ASSIGN(Delegate); + }; + + PostingThread(WaitableEvent* start_event, std::unique_ptr<Action> delegate) + : start_event_(start_event), + thread_started_(WaitableEvent::ResetPolicy::MANUAL, + WaitableEvent::InitialState::NOT_SIGNALED), + delegate_(this, std::move(delegate)) { + DCHECK(start_event_); + } + + bool Start() { + bool thread_created = + PlatformThread::Create(0, &delegate_, &thread_handle_); + if (thread_created) + thread_started_.Wait(); + + return thread_created; + } + + bool join_called_ = false; + WaitableEvent* const start_event_; + WaitableEvent thread_started_; + Delegate delegate_; + + PlatformThreadHandle thread_handle_; + + DISALLOW_COPY_AND_ASSIGN(PostingThread); +}; + +class MessageLoopPerfTest : public ::testing::TestWithParam<int> { + public: + MessageLoopPerfTest() + : message_loop_task_runner_(SequencedTaskRunnerHandle::Get()), + run_posting_threads_(WaitableEvent::ResetPolicy::MANUAL, + WaitableEvent::InitialState::NOT_SIGNALED) {} + + static std::string ParamInfoToString( + ::testing::TestParamInfo<int> param_info) { + return PostingThreadCountToString(param_info.param); + } + + static std::string PostingThreadCountToString(int posting_threads) { + // Special case 1 thread for thread vs threads. + if (posting_threads == 1) + return "1_Posting_Thread"; + + return StringPrintf("%d_Posting_Threads", posting_threads); + } + + protected: + class ContinuouslyPostTasks final : public PostingThread::Action { + public: + ContinuouslyPostTasks(MessageLoopPerfTest* outer) : outer_(outer) { + DCHECK(outer_); + } + ~ContinuouslyPostTasks() override = default; + + private: + void Run() override { + RepeatingClosure task_to_run = + BindRepeating([](size_t* num_tasks_run) { ++*num_tasks_run; }, + &outer_->num_tasks_run_); + while (!outer_->stop_posting_threads_.IsSet()) { + outer_->message_loop_task_runner_->PostTask(FROM_HERE, task_to_run); + subtle::NoBarrier_AtomicIncrement(&outer_->num_tasks_posted_, 1); + } + } + + MessageLoopPerfTest* const outer_; + + DISALLOW_COPY_AND_ASSIGN(ContinuouslyPostTasks); + }; + + void SetUp() override { + // This check is here because we can't ASSERT_TRUE in the constructor. + ASSERT_TRUE(message_loop_task_runner_); + } + + // Runs ActionType::Run() on |num_posting_threads| and requests test + // termination around |duration|. + template <typename ActionType> + void RunTest(const int num_posting_threads, TimeDelta duration) { + std::vector<std::unique_ptr<PostingThread>> threads; + for (int i = 0; i < num_posting_threads; ++i) { + threads.emplace_back(PostingThread::Create( + &run_posting_threads_, std::make_unique<ActionType>(this))); + // Don't assert here to simplify the code that requires a Join() call for + // every created PostingThread. + EXPECT_TRUE(threads[i]); + } + + RunLoop run_loop; + message_loop_task_runner_->PostDelayedTask( + FROM_HERE, + BindOnce( + [](RunLoop* run_loop, AtomicFlag* stop_posting_threads) { + stop_posting_threads->Set(); + run_loop->Quit(); + }, + &run_loop, &stop_posting_threads_), + duration); + + TimeTicks post_task_start = TimeTicks::Now(); + run_posting_threads_.Signal(); + + TimeTicks run_loop_start = TimeTicks::Now(); + run_loop.Run(); + tasks_run_duration_ = TimeTicks::Now() - run_loop_start; + + for (auto& thread : threads) + thread->Join(); + + tasks_posted_duration_ = TimeTicks::Now() - post_task_start; + } + + size_t num_tasks_posted() const { + return subtle::NoBarrier_Load(&num_tasks_posted_); + } + + TimeDelta tasks_posted_duration() const { return tasks_posted_duration_; } + + size_t num_tasks_run() const { return num_tasks_run_; } + + TimeDelta tasks_run_duration() const { return tasks_run_duration_; } + + private: + MessageLoop message_loop_; + + // Accessed on multiple threads, thread-safe or constant: + const scoped_refptr<SequencedTaskRunner> message_loop_task_runner_; + WaitableEvent run_posting_threads_; + AtomicFlag stop_posting_threads_; + subtle::AtomicWord num_tasks_posted_ = 0; + + // Accessed only on the test case thread: + TimeDelta tasks_posted_duration_; + TimeDelta tasks_run_duration_; + size_t num_tasks_run_ = 0; + + DISALLOW_COPY_AND_ASSIGN(MessageLoopPerfTest); +}; + +} // namespace + +TEST_P(MessageLoopPerfTest, PostTaskRate) { + // Measures the average rate of posting tasks from different threads and the + // average rate that the message loop is running those tasks. + RunTest<ContinuouslyPostTasks>(GetParam(), TimeDelta::FromSeconds(3)); + perf_test::PrintResult("task_posting", "", + PostingThreadCountToString(GetParam()), + tasks_posted_duration().InMicroseconds() / + static_cast<double>(num_tasks_posted()), + "us/task", true); + perf_test::PrintResult("task_running", "", + PostingThreadCountToString(GetParam()), + tasks_run_duration().InMicroseconds() / + static_cast<double>(num_tasks_run()), + "us/task", true); +} + +INSTANTIATE_TEST_CASE_P(, + MessageLoopPerfTest, + ::testing::Values(1, 5, 10), + MessageLoopPerfTest::ParamInfoToString); +} // namespace base
diff --git a/base/metrics/record_histogram_checker.h b/base/metrics/record_histogram_checker.h new file mode 100644 index 0000000..686bf676 --- /dev/null +++ b/base/metrics/record_histogram_checker.h
@@ -0,0 +1,27 @@ +// 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 BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_ +#define BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_ + +#include <stdint.h> + +#include "base/base_export.h" + +namespace base { + +// RecordHistogramChecker provides an interface for checking whether +// the given histogram should be recorded. +class BASE_EXPORT RecordHistogramChecker { + public: + virtual ~RecordHistogramChecker() {} + + // Returns true iff the given histogram should be recorded. + // This method may be called on any thread, so it should not mutate any state. + virtual bool ShouldRecord(uint64_t histogram_hash) const = 0; +}; + +} // namespace base + +#endif // BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc index 634f7b4c..aee7b49d 100644 --- a/base/metrics/statistics_recorder.cc +++ b/base/metrics/statistics_recorder.cc
@@ -15,6 +15,7 @@ #include "base/metrics/histogram_snapshot_manager.h" #include "base/metrics/metrics_hashes.h" #include "base/metrics/persistent_histogram_allocator.h" +#include "base/metrics/record_histogram_checker.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/values.h" @@ -45,6 +46,7 @@ callbacks_ = existing_callbacks_.release(); ranges_ = existing_ranges_.release(); providers_ = existing_providers_.release(); + record_checker_ = existing_record_checker_.release(); } // static @@ -435,6 +437,17 @@ } // static +void StatisticsRecorder::SetRecordChecker( + std::unique_ptr<RecordHistogramChecker> record_checker) { + record_checker_ = record_checker.release(); +} + +// static +bool StatisticsRecorder::ShouldRecordHistogram(uint64_t histogram_hash) { + return !record_checker_ || record_checker_->ShouldRecord(histogram_hash); +} + +// static std::vector<HistogramBase*> StatisticsRecorder::GetKnownHistograms( bool include_persistent) { std::vector<HistogramBase*> known; @@ -478,11 +491,13 @@ existing_callbacks_.reset(callbacks_); existing_ranges_.reset(ranges_); existing_providers_.reset(providers_); + existing_record_checker_.reset(record_checker_); histograms_ = new HistogramMap; callbacks_ = new CallbackMap; ranges_ = new RangesMap; providers_ = new HistogramProviders; + record_checker_ = nullptr; InitLogOnShutdownWithoutLock(); } @@ -496,21 +511,23 @@ // static void StatisticsRecorder::Reset() { - std::unique_ptr<HistogramMap> histograms_deleter; std::unique_ptr<CallbackMap> callbacks_deleter; std::unique_ptr<RangesMap> ranges_deleter; std::unique_ptr<HistogramProviders> providers_deleter; + std::unique_ptr<RecordHistogramChecker> record_checker_deleter; { base::AutoLock auto_lock(lock_.Get()); histograms_deleter.reset(histograms_); callbacks_deleter.reset(callbacks_); ranges_deleter.reset(ranges_); providers_deleter.reset(providers_); + record_checker_deleter.reset(record_checker_); histograms_ = nullptr; callbacks_ = nullptr; ranges_ = nullptr; providers_ = nullptr; + record_checker_ = nullptr; } // We are going to leak the histograms and the ranges. } @@ -532,6 +549,8 @@ // static StatisticsRecorder::HistogramProviders* StatisticsRecorder::providers_; // static +RecordHistogramChecker* StatisticsRecorder::record_checker_ = nullptr; +// static base::LazyInstance<base::Lock>::Leaky StatisticsRecorder::lock_ = LAZY_INSTANCE_INITIALIZER;
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h index b1063d71..16b462ab 100644 --- a/base/metrics/statistics_recorder.h +++ b/base/metrics/statistics_recorder.h
@@ -25,6 +25,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_base.h" +#include "base/metrics/record_histogram_checker.h" #include "base/strings/string_piece.h" #include "base/synchronization/lock.h" @@ -189,6 +190,21 @@ // by a call to Initialize(). static void UninitializeForTesting(); + // Sets the record checker for determining if a histogram should be recorded. + // Record checker doesn't affect any already recorded histograms, so this + // method must be called very early, before any threads have started. + // Record checker methods can be called on any thread, so they shouldn't + // mutate any state. + // TODO(iburak): This is not yet hooked up to histogram recording + // infrastructure. + static void SetRecordChecker( + std::unique_ptr<RecordHistogramChecker> record_checker); + + // Returns true iff the given histogram should be recorded based on + // the ShouldRecord() method of the record checker. + // If the record checker is not set, returns true. + static bool ShouldRecordHistogram(uint64_t histogram_hash); + private: // We keep a map of callbacks to histograms, so that as histograms are // created, we can set the callback properly. @@ -228,6 +244,7 @@ std::unique_ptr<CallbackMap> existing_callbacks_; std::unique_ptr<RangesMap> existing_ranges_; std::unique_ptr<HistogramProviders> existing_providers_; + std::unique_ptr<RecordHistogramChecker> existing_record_checker_; bool vlog_initialized_ = false; @@ -238,6 +255,7 @@ static CallbackMap* callbacks_; static RangesMap* ranges_; static HistogramProviders* providers_; + static RecordHistogramChecker* record_checker_; // Lock protects access to above maps. This is a LazyInstance to avoid races // when the above methods are used before Initialize(). Previously each method
diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc index 7d0cd8f9..39b1f4d 100644 --- a/base/metrics/statistics_recorder_unittest.cc +++ b/base/metrics/statistics_recorder_unittest.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <memory> +#include <utility> #include <vector> #include "base/bind.h" @@ -15,6 +16,7 @@ #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/persistent_histogram_allocator.h" +#include "base/metrics/record_histogram_checker.h" #include "base/metrics/sparse_histogram.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,6 +39,17 @@ DISALLOW_COPY_AND_ASSIGN(LogStateSaver); }; +// Test implementation of RecordHistogramChecker interface. +class OddRecordHistogramChecker : public base::RecordHistogramChecker { + public: + ~OddRecordHistogramChecker() override {} + + // base::RecordHistogramChecker: + bool ShouldRecord(uint64_t histogram_hash) const override { + return histogram_hash % 2; + } +}; + } // namespace namespace base { @@ -715,4 +728,13 @@ EXPECT_EQ(1, snapshot->GetCount(5)); } +TEST_P(StatisticsRecorderTest, RecordHistogramChecker) { + // Record checker isn't set + EXPECT_TRUE(base::StatisticsRecorder::ShouldRecordHistogram(0)); + auto record_checker = std::make_unique<OddRecordHistogramChecker>(); + base::StatisticsRecorder::SetRecordChecker(std::move(record_checker)); + EXPECT_TRUE(base::StatisticsRecorder::ShouldRecordHistogram(1)); + EXPECT_FALSE(base::StatisticsRecorder::ShouldRecordHistogram(2)); +} + } // namespace base
diff --git a/base/numerics/BUILD.gn b/base/numerics/BUILD.gn index 51eb7945..0bb8dd10 100644 --- a/base/numerics/BUILD.gn +++ b/base/numerics/BUILD.gn
@@ -20,6 +20,8 @@ public = [ "checked_math.h", "clamped_math.h", + "math_constants.h", + "ranges.h", "safe_conversions.h", "safe_math.h", ]
diff --git a/base/numerics/math_constants.h b/base/numerics/math_constants.h new file mode 100644 index 0000000..9a5b8ef --- /dev/null +++ b/base/numerics/math_constants.h
@@ -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. + +#ifndef BASE_NUMERICS_MATH_CONSTANTS_H_ +#define BASE_NUMERICS_MATH_CONSTANTS_H_ + +namespace base { + +constexpr double kPiDouble = 3.14159265358979323846; +constexpr float kPiFloat = 3.14159265358979323846f; + +} // namespace base + +#endif // BASE_NUMERICS_MATH_CONSTANTS_H_
diff --git a/base/numerics/ranges.h b/base/numerics/ranges.h new file mode 100644 index 0000000..0ef2288 --- /dev/null +++ b/base/numerics/ranges.h
@@ -0,0 +1,19 @@ +// 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 BASE_NUMERICS_RANGES_H_ +#define BASE_NUMERICS_RANGES_H_ + +#include <algorithm> + +namespace base { + +template <typename T> +T ClampToRange(T value, T min, T max) { + return std::min(std::max(value, min), max); +} + +} // namespace base + +#endif // BASE_NUMERICS_RANGES_H_
diff --git a/base/optional.h b/base/optional.h index 2be2f82..cd9c106 100644 --- a/base/optional.h +++ b/base/optional.h
@@ -171,7 +171,7 @@ } template <class U> - typename std::enable_if<std::is_same<std::decay<U>, T>::value, + typename std::enable_if<std::is_same<std::decay_t<U>, T>::value, Optional&>::type operator=(U&& value) { InitOrAssign(std::forward<U>(value));
diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc index 8b9a1ae..262c87a 100644 --- a/base/optional_unittest.cc +++ b/base/optional_unittest.cc
@@ -33,12 +33,16 @@ : foo_(foo), bar_(bar), state_(State::VALUE_CONSTRUCTED) {} TestObject(const TestObject& other) - : foo_(other.foo_), bar_(other.bar_), state_(State::COPY_CONSTRUCTED) {} + : foo_(other.foo_), + bar_(other.bar_), + state_(State::COPY_CONSTRUCTED), + move_ctors_count_(other.move_ctors_count_) {} TestObject(TestObject&& other) : foo_(std::move(other.foo_)), bar_(std::move(other.bar_)), - state_(State::MOVE_CONSTRUCTED) { + state_(State::MOVE_CONSTRUCTED), + move_ctors_count_(other.move_ctors_count_ + 1) { other.state_ = State::MOVED_FROM; } @@ -46,6 +50,7 @@ foo_ = other.foo_; bar_ = other.bar_; state_ = State::COPY_ASSIGNED; + move_ctors_count_ = other.move_ctors_count_; return *this; } @@ -53,6 +58,7 @@ foo_ = other.foo_; bar_ = other.bar_; state_ = State::MOVE_ASSIGNED; + move_ctors_count_ = other.move_ctors_count_; other.state_ = State::MOVED_FROM; return *this; } @@ -61,6 +67,7 @@ using std::swap; swap(foo_, other->foo_); swap(bar_, other->bar_); + swap(move_ctors_count_, other->move_ctors_count_); state_ = State::SWAPPED; other->state_ = State::SWAPPED; } @@ -71,11 +78,13 @@ int foo() const { return foo_; } State state() const { return state_; } + int move_ctors_count() const { return move_ctors_count_; } private: int foo_; double bar_; State state_; + int move_ctors_count_ = 0; }; // Implementing Swappable concept. @@ -1343,4 +1352,14 @@ EXPECT_FALSE(a.has_value()); } +TEST(OptionalTest, AssignFromRValue) { + Optional<TestObject> a; + EXPECT_FALSE(a.has_value()); + + TestObject obj; + a = std::move(obj); + EXPECT_TRUE(a.has_value()); + EXPECT_EQ(1, a->move_ctors_count()); +} + } // namespace base
diff --git a/base/process/process.h b/base/process/process.h index c46ec7c0..57d72fb1 100644 --- a/base/process/process.h +++ b/base/process/process.h
@@ -145,9 +145,6 @@ // Returns true if the priority was changed, false otherwise. If // |port_provider| is null, this is a no-op and it returns false. bool SetProcessBackgrounded(PortProvider* port_provider, bool value); - - // Returns |true| if helper processes should participate in AppNap. - static bool IsAppNapEnabled(); #else // A process is backgrounded when it's priority is lower than normal. // Return true if this process is backgrounded, false otherwise.
diff --git a/base/process/process_mac.cc b/base/process/process_mac.cc index bc045cd72a..f83fbb99 100644 --- a/base/process/process_mac.cc +++ b/base/process/process_mac.cc
@@ -8,27 +8,15 @@ #include "base/feature_list.h" #include "base/mac/mach_logging.h" -#include "base/metrics/field_trial_params.h" namespace base { -namespace { -const char kAppNapFeatureParamName[] = "app_nap"; -} - // Enables backgrounding hidden renderers on Mac. const Feature kMacAllowBackgroundingProcesses{"MacAllowBackgroundingProcesses", FEATURE_DISABLED_BY_DEFAULT}; -bool Process::IsAppNapEnabled() { - return !base::GetFieldTrialParamValueByFeature( - kMacAllowBackgroundingProcesses, kAppNapFeatureParamName) - .empty(); -} - bool Process::CanBackgroundProcesses() { - return FeatureList::IsEnabled(kMacAllowBackgroundingProcesses) && - !IsAppNapEnabled(); + return FeatureList::IsEnabled(kMacAllowBackgroundingProcesses); } bool Process::IsProcessBackgrounded(PortProvider* port_provider) const {
diff --git a/base/synchronization/atomic_flag_unittest.cc b/base/synchronization/atomic_flag_unittest.cc index a7c4d9c..f7daafa5 100644 --- a/base/synchronization/atomic_flag_unittest.cc +++ b/base/synchronization/atomic_flag_unittest.cc
@@ -117,12 +117,17 @@ // Checks that Set() can't be called from another sequence after being called // on this one. AtomicFlag should die on a DCHECK if Set() is called again // from another sequence. + + // Note: flag must be declared before the Thread so that its destructor runs + // later. Otherwise there's a race between destructing flag and running + // ExpectSetFlagDeath. + AtomicFlag flag; + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; Thread t("AtomicFlagTest.SetOnDifferentThreadDeathTest"); ASSERT_TRUE(t.Start()); EXPECT_TRUE(t.WaitUntilThreadStarted()); - AtomicFlag flag; flag.Set(); t.task_runner()->PostTask(FROM_HERE, BindOnce(&ExpectSetFlagDeath, &flag)); }
diff --git a/base/trace_event/memory_allocator_dump.h b/base/trace_event/memory_allocator_dump.h index 1efdda3..625fbcb 100644 --- a/base/trace_event/memory_allocator_dump.h +++ b/base/trace_event/memory_allocator_dump.h
@@ -133,7 +133,7 @@ // expected to have the same guid. const MemoryAllocatorDumpGuid& guid() const { return guid_; } - const std::vector<Entry>& entries_for_testing() const { return entries_; } + const std::vector<Entry>& entries() const { return entries_; } // Only for mojo serialization, which can mutate the collection. std::vector<Entry>* mutable_entries_for_serialization() const { @@ -144,8 +144,8 @@ return const_cast<std::vector<Entry>*>(&entries_); } - // Decprecated testing method. Use entries_for_testing instead. - // TODO(hjd): Remove this and refactor callers to use entries_for_testing then + // Decprecated testing method. Use |entries()| instead. + // TODO(hjd): Remove this and refactor callers to use |entries()| then // inline DumpAttributes. std::unique_ptr<TracedValue> attributes_for_testing() const;
diff --git a/base/trace_event/memory_allocator_dump_unittest.cc b/base/trace_event/memory_allocator_dump_unittest.cc index c598a6a..ca78399 100644 --- a/base/trace_event/memory_allocator_dump_unittest.cc +++ b/base/trace_event/memory_allocator_dump_unittest.cc
@@ -185,9 +185,8 @@ MemoryAllocatorDump::Entry expected_scalar("one", "byte", 1); MemoryAllocatorDump::Entry expected_string("one", "object", "one"); - EXPECT_THAT( - dump->entries_for_testing(), - ElementsAre(Eq(ByRef(expected_scalar)), Eq(ByRef(expected_string)))); + EXPECT_THAT(dump->entries(), ElementsAre(Eq(ByRef(expected_scalar)), + Eq(ByRef(expected_string)))); } TEST(MemoryAllocatorDumpTest, MovingAnEntry) {
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index 6a727900..b45198b 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py
@@ -12,7 +12,6 @@ import random import re import shlex -import subprocess import sys import devil_chromium @@ -32,6 +31,7 @@ from incremental_install import installer from pylib import constants +from pylib.symbols import deobfuscator def _Colorize(color, text): @@ -354,7 +354,15 @@ print 'Total: %skb (%.1fmb)' % (total, total / 1024.0) -def _RunLogcat(device, package_name, verbose): +def _RunLogcat(device, package_name, verbose, mapping_path): + if mapping_path: + try: + deobfuscate = deobfuscator.Deobfuscator(mapping_path) + except OSError: + sys.stderr.write('Error executing "bin/java_deobfuscate". ' + 'Did you forget to build it?\n') + sys.exit(1) + def get_my_pids(): my_pids = [] for pids in device.GetPids(package_name).values(): @@ -363,46 +371,52 @@ def process_line(line, fast=False): if verbose: - if not fast: - sys.stdout.write(line) + if fast: + return else: - if line.startswith('------'): + if not line or line.startswith('------'): return tokens = line.split(None, 4) pid = int(tokens[2]) priority = tokens[4] if pid in my_pids or (not fast and priority == 'F'): - sys.stdout.write(line) + pass # write elif pid in not_my_pids: return elif fast: # Skip checking whether our package spawned new processes. not_my_pids.add(pid) + return else: # Check and add the pid if it is a new one from our package. my_pids.update(get_my_pids()) - if pid in my_pids: - sys.stdout.write(line) - else: + if pid not in my_pids: not_my_pids.add(pid) + return + if mapping_path: + line = '\n'.join(deobfuscate.TransformLines([line.rstrip()])) + '\n' + sys.stdout.write(line) - adb_path = adb_wrapper.AdbWrapper.GetAdbPath() - cmd = [adb_path, '-s', device.serial, 'logcat', '-v', 'threadtime'] - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1) - my_pids = set(get_my_pids()) - not_my_pids = set() - - nonce = 'apk_wrappers.py nonce={}'.format(random.random()) - device.RunShellCommand(['log', nonce]) - fast = True try: - while True: - line = process.stdout.readline() - process_line(line, fast) + my_pids = set(get_my_pids()) + not_my_pids = set() + + nonce = 'apk_wrappers.py nonce={}'.format(random.random()) + device.RunShellCommand(['log', nonce]) + fast = True + for line in device.adb.Logcat(logcat_format='threadtime'): + try: + process_line(line, fast) + except: + sys.stderr.write('Failed to process line: ' + line) + raise if fast and nonce in line: fast = False except KeyboardInterrupt: - process.terminate() + pass # Don't show stack trace upon Ctrl-C + finally: + if mapping_path: + deobfuscate.Close() def _RunPs(devices, package_name): @@ -788,8 +802,20 @@ calls_exec = True def Run(self): + mapping = self.args.proguard_mapping_path + if self.args.no_deobfuscate: + mapping = None _RunLogcat(self.devices[0], self.args.package_name, - bool(self.args.verbose_count)) + bool(self.args.verbose_count), mapping) + + def _RegisterExtraArgs(self, group): + if self._from_wrapper_script: + group.add_argument('--no-deobfuscate', action='store_true', + help='Disables ProGuard deobfuscation of logcat.') + else: + group.set_defaults(no_deobfuscate=False) + group.add_argument('--proguard-mapping-path', + help='Path to ProGuard map (enables deobfuscation)') class _PsCommand(_Command): @@ -913,7 +939,7 @@ # TODO(agrieve): Remove =None from target_cpu on or after October 2017. # It exists only so that stale wrapper scripts continue to work. def Run(output_directory, apk_path, incremental_json, command_line_flags_file, - target_cpu=None): + target_cpu, proguard_mapping_path): """Entry point for generated wrapper scripts.""" constants.SetOutputDirectory(output_directory) devil_chromium.Initialize(output_directory=output_directory) @@ -923,7 +949,8 @@ command_line_flags_file=command_line_flags_file, target_cpu=target_cpu, apk_path=exists_or_none(apk_path), - incremental_json=exists_or_none(incremental_json)) + incremental_json=exists_or_none(incremental_json), + proguard_mapping_path=proguard_mapping_path) _RunInternal(parser, output_directory=output_directory) @@ -933,4 +960,4 @@ if __name__ == '__main__': - sys.exit(main()) + main()
diff --git a/build/android/java_assertion_enabler/OWNERS b/build/android/buildhooks/OWNERS similarity index 71% rename from build/android/java_assertion_enabler/OWNERS rename to build/android/buildhooks/OWNERS index ea2bde4..a512a5a 100644 --- a/build/android/java_assertion_enabler/OWNERS +++ b/build/android/buildhooks/OWNERS
@@ -1,4 +1,5 @@ agrieve@chromium.org +estevenson@chromium.org zpeng@chromium.org # COMPONENT: Build
diff --git a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java index 9095b37d..7eb1477 100644 --- a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java +++ b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java
@@ -4,6 +4,8 @@ package org.chromium.build; +import android.content.Context; +import android.content.res.AssetManager; import android.content.res.Resources; /** @@ -17,18 +19,47 @@ * implementation is supplied to an android_apk target (via build_hooks_android_impl_deps). */ public abstract class BuildHooksAndroid { - private static BuildHooksAndroidImpl sInstance = new BuildHooksAndroidImpl(); + private static final BuildHooksAndroidImpl sInstance = new BuildHooksAndroidImpl(); - /** - * Hook to provide custom resources. - * @param resources fallback resources to use if custom resources aren't available. - * @return custom resources. - */ - public static Resources getResources(Resources resources) { - return sInstance.getResourcesImpl(resources); + public static Resources getResources(Context context) { + return sInstance.getResourcesImpl(context); } - protected Resources getResourcesImpl(Resources resources) { - return resources; + protected abstract Resources getResourcesImpl(Context context); + + public static AssetManager getAssets(Context context) { + return sInstance.getAssetsImpl(context); } + + protected abstract AssetManager getAssetsImpl(Context context); + + public static Resources.Theme getTheme(Context context) { + return sInstance.getThemeImpl(context); + } + + protected abstract Resources.Theme getThemeImpl(Context context); + + public static void setTheme(Context context, int theme) { + sInstance.setThemeImpl(context, theme); + } + + protected abstract void setThemeImpl(Context context, int theme); + + public static Context createConfigurationContext(Context context) { + return sInstance.createConfigurationContextImpl(context); + } + + protected abstract Context createConfigurationContextImpl(Context context); + + public static boolean isEnabled() { + return sInstance.isEnabledImpl(); + } + + protected abstract boolean isEnabledImpl(); + + public static void init() { + sInstance.initImpl(); + } + + protected abstract void initImpl(); } \ No newline at end of file
diff --git a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java index 3986116..7a66e1c 100644 --- a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java +++ b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java
@@ -4,7 +4,35 @@ package org.chromium.build; +import android.content.Context; +import android.content.res.AssetManager; +import android.content.res.Resources; + /** - * Instantiatable version of {@link BuildHooksAndroid}, don't add anything to this class! + * Instantiatable version of {@link BuildHooksAndroid} with dummy implementations. */ -public class BuildHooksAndroidImpl extends BuildHooksAndroid {} \ No newline at end of file +public class BuildHooksAndroidImpl extends BuildHooksAndroid { + protected final Resources getResourcesImpl(Context context) { + return null; + } + + protected AssetManager getAssetsImpl(Context context) { + return null; + } + + protected Resources.Theme getThemeImpl(Context context) { + return null; + } + + protected void setThemeImpl(Context context, int theme) {} + + protected Context createConfigurationContextImpl(Context context) { + return null; + } + + protected boolean isEnabledImpl() { + return false; + } + + protected void initImpl() {} +}
diff --git a/build/android/bytecode/BUILD.gn b/build/android/bytecode/BUILD.gn new file mode 100644 index 0000000..3a206901 --- /dev/null +++ b/build/android/bytecode/BUILD.gn
@@ -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. + +import("//build/config/android/rules.gni") + +assert(current_toolchain == default_toolchain) + +java_binary("java_bytecode_rewriter") { + java_files = [ + "java/org/chromium/bytecode/AssertionEnablerClassAdapter.java", + "java/org/chromium/bytecode/ByteCodeProcessor.java", + "java/org/chromium/bytecode/CustomClassLoaderClassWriter.java", + "java/org/chromium/bytecode/CustomResourcesClassAdapter.java", + "java/org/chromium/bytecode/TypeUtils.java", + ] + main_class = "org.chromium.bytecode.ByteCodeProcessor" + deps = [ + "//third_party/ow2_asm:asm_java", + "//third_party/ow2_asm:asm_util_java", + ] + wrapper_script_name = "helper/java_bytecode_rewriter" +}
diff --git a/build/android/java_assertion_enabler/OWNERS b/build/android/bytecode/OWNERS similarity index 71% copy from build/android/java_assertion_enabler/OWNERS copy to build/android/bytecode/OWNERS index ea2bde4..a512a5a 100644 --- a/build/android/java_assertion_enabler/OWNERS +++ b/build/android/bytecode/OWNERS
@@ -1,4 +1,5 @@ agrieve@chromium.org +estevenson@chromium.org zpeng@chromium.org # COMPONENT: Build
diff --git a/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java b/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java new file mode 100644 index 0000000..ac0239c --- /dev/null +++ b/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java
@@ -0,0 +1,109 @@ +// 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.bytecode; + +import static org.chromium.bytecode.TypeUtils.ASSERTION_ERROR; +import static org.chromium.bytecode.TypeUtils.BUILD_HOOKS; +import static org.chromium.bytecode.TypeUtils.VOID; + +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +/** + * An ClassVisitor for replacing Java ASSERT statements with a function by modifying Java bytecode. + * + * We do this in two steps, first step is to enable assert. + * Following bytecode is generated for each class with ASSERT statements: + * 0: ldc #8 // class CLASSNAME + * 2: invokevirtual #9 // Method java/lang/Class.desiredAssertionStatus:()Z + * 5: ifne 12 + * 8: iconst_1 + * 9: goto 13 + * 12: iconst_0 + * 13: putstatic #2 // Field $assertionsDisabled:Z + * Replaces line #13 to the following: + * 13: pop + * Consequently, $assertionsDisabled is assigned the default value FALSE. + * This is done in the first if statement in overridden visitFieldInsn. We do this per per-assert. + * + * Second step is to replace assert statement with a function: + * The followed instructions are generated by a java assert statement: + * getstatic #3 // Field $assertionsDisabled:Z + * ifne 118 // Jump to instruction as if assertion if not enabled + * ... + * ifne 19 + * new #4 // class java/lang/AssertionError + * dup + * ldc #5 // String (don't have this line if no assert message given) + * invokespecial #6 // Method java/lang/AssertionError. + * athrow + * Replace athrow with: + * invokestatic #7 // Method org/chromium/base/JavaExceptionReporter.assertFailureHandler + * goto 118 + * JavaExceptionReporter.assertFailureHandler is a function that handles the AssertionError, + * 118 is the instruction to execute as if assertion if not enabled. + */ +class AssertionEnablerClassAdapter extends ClassVisitor { + AssertionEnablerClassAdapter(ClassVisitor visitor) { + super(Opcodes.ASM5, visitor); + } + + @Override + public MethodVisitor visitMethod(final int access, final String name, String desc, + String signature, String[] exceptions) { + return new RewriteAssertMethodVisitorWriter( + Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)); + } + + static class RewriteAssertMethodVisitorWriter extends MethodVisitor { + static final String ASSERTION_DISABLED_NAME = "$assertionsDisabled"; + static final String INSERT_INSTRUCTION_NAME = "assertFailureHandler"; + static final String INSERT_INSTRUCTION_DESC = + TypeUtils.getMethodDescriptor(VOID, ASSERTION_ERROR); + static final boolean INSERT_INSTRUCTION_ITF = false; + + boolean mStartLoadingAssert; + Label mGotoLabel; + + public RewriteAssertMethodVisitorWriter(int api, MethodVisitor mv) { + super(api, mv); + } + + @Override + public void visitFieldInsn(int opcode, String owner, String name, String desc) { + if (opcode == Opcodes.PUTSTATIC && name.equals(ASSERTION_DISABLED_NAME)) { + super.visitInsn(Opcodes.POP); // enable assert + } else if (opcode == Opcodes.GETSTATIC && name.equals(ASSERTION_DISABLED_NAME)) { + mStartLoadingAssert = true; + super.visitFieldInsn(opcode, owner, name, desc); + } else { + super.visitFieldInsn(opcode, owner, name, desc); + } + } + + @Override + public void visitJumpInsn(int opcode, Label label) { + if (mStartLoadingAssert && opcode == Opcodes.IFNE && mGotoLabel == null) { + mGotoLabel = label; + } + super.visitJumpInsn(opcode, label); + } + + @Override + public void visitInsn(int opcode) { + if (!mStartLoadingAssert || opcode != Opcodes.ATHROW) { + super.visitInsn(opcode); + } else { + super.visitMethodInsn(Opcodes.INVOKESTATIC, BUILD_HOOKS, INSERT_INSTRUCTION_NAME, + INSERT_INSTRUCTION_DESC, INSERT_INSTRUCTION_ITF); + super.visitJumpInsn(Opcodes.GOTO, mGotoLabel); + mStartLoadingAssert = false; + mGotoLabel = null; + } + } + } +} \ No newline at end of file
diff --git a/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java b/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java new file mode 100644 index 0000000..a8d6c8b --- /dev/null +++ b/build/android/bytecode/java/org/chromium/bytecode/ByteCodeProcessor.java
@@ -0,0 +1,157 @@ +// 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.bytecode; + +import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +/** + * Java application that takes in an input jar, performs a series of bytecode transformations, + * and generates an output jar. + * + * Two types of transformations are performed: + * 1) Enabling assertions via {@link AssertionEnablerClassAdapter} + * 2) Providing support for custom resources via {@link CustomResourcesClassAdapter} + */ +class ByteCodeProcessor { + private static final String CLASS_FILE_SUFFIX = ".class"; + private static final String TEMPORARY_FILE_SUFFIX = ".temp"; + private static final int BUFFER_SIZE = 16384; + + private static void process(String inputJarPath, String outputJarPath, boolean shouldAssert, + boolean shouldUseCustomResources, ClassLoader classPathJarsClassLoader) { + String tempJarPath = outputJarPath + TEMPORARY_FILE_SUFFIX; + try (ZipInputStream inputStream = new ZipInputStream( + new BufferedInputStream(new FileInputStream(inputJarPath))); + ZipOutputStream tempStream = new ZipOutputStream( + new BufferedOutputStream(new FileOutputStream(tempJarPath)))) { + ZipEntry entry; + + while ((entry = inputStream.getNextEntry()) != null) { + // Copy all non-.class files to the output jar. + if (entry.isDirectory() || !entry.getName().endsWith(CLASS_FILE_SUFFIX)) { + tempStream.putNextEntry(entry); + tempStream.write(readAllBytes(inputStream)); + tempStream.closeEntry(); + continue; + } + + ClassReader reader = new ClassReader(readAllBytes(inputStream)); + + ClassWriter writer; + if (shouldUseCustomResources) { + // Use the COMPUTE_FRAMES flag to have asm figure out the stack map frames. + // This is necessary because GCMBaseIntentService in android_gcm_java contains + // incorrect stack map frames. This option slows down processing time by 2x. + writer = new CustomClassLoaderClassWriter( + classPathJarsClassLoader, reader, COMPUTE_FRAMES); + } else { + writer = new ClassWriter(reader, 0); + } + ClassVisitor chain = writer; + /* DEBUGGING: + To see the bytecode for a specific class: + if (entry.getName().contains("YourClassName")) { + chain = new TraceClassVisitor(chain, new PrintWriter(System.out)); + } + To see objectweb.asm code that will generate bytecode for a given class: + java -cp "third_party/ow2_asm/lib/asm-5.0.1.jar:third_party/ow2_asm/lib/"\ + "asm-util-5.0.1.jar:out/Debug/lib.java/jar_containing_yourclass.jar" \ + org.objectweb.asm.util.ASMifier org.package.YourClassName + */ + if (shouldAssert) { + chain = new AssertionEnablerClassAdapter(chain); + } + if (shouldUseCustomResources) { + chain = new CustomResourcesClassAdapter(chain, reader.getClassName(), + reader.getSuperName(), classPathJarsClassLoader); + } + reader.accept(chain, 0); + byte[] patchedByteCode = writer.toByteArray(); + tempStream.putNextEntry(new ZipEntry(entry.getName())); + tempStream.write(patchedByteCode); + tempStream.closeEntry(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + try { + Path src = Paths.get(tempJarPath); + Path dest = Paths.get(outputJarPath); + Files.move(src, dest, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException ioException) { + throw new RuntimeException(ioException); + } + } + + private static byte[] readAllBytes(InputStream inputStream) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int numRead = 0; + byte[] data = new byte[BUFFER_SIZE]; + while ((numRead = inputStream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, numRead); + } + return buffer.toByteArray(); + } + + /** + * Loads a list of jars and returns a ClassLoader capable of loading all classes found in the + * given jars. + */ + private static ClassLoader loadJars(ArrayList<String> paths) { + URL[] jarUrls = new URL[paths.size()]; + for (int i = 0; i < paths.size(); ++i) { + try { + jarUrls[i] = new File(paths.get(i)).toURI().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + return new URLClassLoader(jarUrls); + } + + public static void main(String[] args) { + // Invoke this script using //build/android/gyp/bytecode_processor.py + String inputJarPath = args[0]; + String outputJarPath = args[1]; + boolean shouldAssert = args[2].equals("--enable-assert"); + boolean shouldUseCustomResources = args[3].equals("--enable-custom-resources"); + + // Load all jars that are on the classpath for the input jar for analyzing class hierarchy. + ClassLoader classPathJarsClassLoader = null; + if (shouldUseCustomResources) { + ArrayList<String> classPathJarsPaths = new ArrayList<>(); + classPathJarsPaths.add(inputJarPath); + classPathJarsPaths.addAll(Arrays.asList(Arrays.copyOfRange(args, 4, args.length))); + classPathJarsClassLoader = loadJars(classPathJarsPaths); + } + process(inputJarPath, outputJarPath, shouldAssert, shouldUseCustomResources, + classPathJarsClassLoader); + } +}
diff --git a/build/android/bytecode/java/org/chromium/bytecode/CustomClassLoaderClassWriter.java b/build/android/bytecode/java/org/chromium/bytecode/CustomClassLoaderClassWriter.java new file mode 100644 index 0000000..d4eeb78a --- /dev/null +++ b/build/android/bytecode/java/org/chromium/bytecode/CustomClassLoaderClassWriter.java
@@ -0,0 +1,50 @@ +// 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.bytecode; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassWriter; + +/** + * A ClassWriter that uses a custom class loader. + */ +class CustomClassLoaderClassWriter extends ClassWriter { + private ClassLoader mClassLoader; + + public CustomClassLoaderClassWriter(ClassLoader classLoader, ClassReader reader, int flags) { + super(reader, flags); + this.mClassLoader = classLoader; + } + + /** + * The only modifications from the org.objectweb.asm.ClassWriter implementations is that this + * method is final and it uses a custom ClassLoader. + * + * See https://github.com/llbit/ow2-asm/blob/master/src/org/objectweb/asm/ClassWriter.java. + */ + protected final String getCommonSuperClass(final String type1, final String type2) { + Class<?> c, d; + try { + c = Class.forName(type1.replace('/', '.'), false, mClassLoader); + d = Class.forName(type2.replace('/', '.'), false, mClassLoader); + } catch (Exception e) { + throw new RuntimeException(e.toString()); + } + if (c.isAssignableFrom(d)) { + return type1; + } + if (d.isAssignableFrom(c)) { + return type2; + } + if (c.isInterface() || d.isInterface()) { + return "java/lang/Object"; + } else { + do { + c = c.getSuperclass(); + } while (!c.isAssignableFrom(d)); + return c.getName().replace('.', '/'); + } + } +}
diff --git a/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java b/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java new file mode 100644 index 0000000..2a7b846 --- /dev/null +++ b/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java
@@ -0,0 +1,279 @@ +// 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.bytecode; + +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ARETURN; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.BIPUSH; +import static org.objectweb.asm.Opcodes.GETSTATIC; +import static org.objectweb.asm.Opcodes.IFNE; +import static org.objectweb.asm.Opcodes.IF_ICMPGE; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.RETURN; + +import static org.chromium.bytecode.TypeUtils.ASSET_MANAGER; +import static org.chromium.bytecode.TypeUtils.BASE_CHROMIUM_APPLICATION; +import static org.chromium.bytecode.TypeUtils.BOOLEAN; +import static org.chromium.bytecode.TypeUtils.BUILD_HOOKS_ANDROID; +import static org.chromium.bytecode.TypeUtils.CONFIGURATION; +import static org.chromium.bytecode.TypeUtils.CONTEXT; +import static org.chromium.bytecode.TypeUtils.CONTEXT_WRAPPER; +import static org.chromium.bytecode.TypeUtils.DISPLAY_LEAK_ACTIVITY; +import static org.chromium.bytecode.TypeUtils.INT; +import static org.chromium.bytecode.TypeUtils.RESOURCES; +import static org.chromium.bytecode.TypeUtils.THEME; +import static org.chromium.bytecode.TypeUtils.VOID; + +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +import java.util.Arrays; +import java.util.List; + +/** + * A ClassVisitor for providing access to custom resources via BuildHooksAndroid. + * + * The goal of this class is to provide hooks into all places where android resources + * are available so that they can be modified before use. This is done by rewriting the bytecode + * for all callable definitions of certain Context methods, specifically: + * - getResources + * - getAssets + * - getTheme + * - setTheme + * - createConfigurationContext + * + * Only classes at the framework boundary are rewritten since presumably all other indirect Context + * subclasses will end up calling their respective super methods (i.e. we bytecode rewrite + * BaseChromiumApplication since it extends Application, but not ContentApplication since it + * extends a non-framework subclass. + */ +class CustomResourcesClassAdapter extends ClassVisitor { + private static final String IS_ENABLED_METHOD = "isEnabled"; + private static final String IS_ENABLED_DESCRIPTOR = TypeUtils.getMethodDescriptor(BOOLEAN); + + // Existing methods are more difficult to handle, and not currently needed. + private static final List<String> PROHIBITED_METHODS = Arrays.asList( + TypeUtils.getMethodSignature("getResources", RESOURCES), + TypeUtils.getMethodSignature("getAssets", ASSET_MANAGER), + TypeUtils.getMethodSignature("getTheme", THEME), + TypeUtils.getMethodSignature("createConfigurationContext", CONTEXT, CONFIGURATION), + TypeUtils.getMethodSignature("setTheme", VOID, INT)); + + private static final List<String> EXCEPTED_CLASS_METHODS = Arrays.asList( + DISPLAY_LEAK_ACTIVITY + TypeUtils.getMethodSignature("setTheme", VOID, INT), + BASE_CHROMIUM_APPLICATION + TypeUtils.getMethodSignature("getResources", RESOURCES)); + + private boolean mShouldTransform; + private String mClassName; + private String mSuperClassName; + private ClassLoader mClassLoader; + + CustomResourcesClassAdapter(ClassVisitor visitor, String className, String superClassName, + ClassLoader classLoader) { + super(ASM5, visitor); + this.mClassName = className; + this.mSuperClassName = superClassName; + this.mClassLoader = classLoader; + } + + @Override + public void visit(int version, int access, String name, String signature, String superName, + String[] interfaces) { + super.visit(version, access, name, signature, superName, interfaces); + mShouldTransform = shouldTransform(); + } + + @Override + public MethodVisitor visitMethod(final int access, final String name, String desc, + String signature, String[] exceptions) { + if (mShouldTransform) { + String methodSignature = name + desc; + if (requiresModifyingExisting(methodSignature)) { + throw new RuntimeException("Rewriting existing methods not supported: " + mClassName + + "#" + methodSignature); + } + } + return super.visitMethod(access, name, desc, signature, exceptions); + } + + @Override + public void visitEnd() { + if (mShouldTransform) { + delegateCreateConfigurationContext(); + delegateSetTheme(); + delegateGet("getAssets", ASSET_MANAGER); + delegateGet("getTheme", THEME); + delegateGet("getResources", RESOURCES); + } + super.visitEnd(); + } + + private boolean requiresModifyingExisting(String methodDescriptor) { + // TODO(estevenson): Remove LeakCanary special casing once we get rid of LeakCanary. + return PROHIBITED_METHODS.contains(methodDescriptor) + && !EXCEPTED_CLASS_METHODS.contains(mClassName + methodDescriptor); + } + + private boolean shouldTransform() { + if (!isDescendantOfContext()) { + return false; + } + if (!superClassIsFrameworkClass()) { + return false; + } + return !superClassIsContextWrapper(); + } + + private boolean superClassIsFrameworkClass() { + return loadClass(mSuperClassName).getProtectionDomain().toString().contains("android.jar"); + } + + private boolean isDescendantOfContext() { + return isSubClass(mClassName, CONTEXT); + } + + private boolean superClassIsContextWrapper() { + return mSuperClassName.equals(CONTEXT_WRAPPER); + } + + private boolean isSubClass(String candidate, String other) { + Class<?> candidateClazz = loadClass(candidate); + Class<?> parentClazz = loadClass(other); + return parentClazz.isAssignableFrom(candidateClazz); + } + + private Class<?> loadClass(String className) { + try { + return mClassLoader.loadClass(className.replace('/', '.')); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + + /** + * Generates: + * + * <pre> + * public Context createConfigurationContext(Configuration configuration) { + * // createConfigurationContext does not exist before API level 17. + * if (Build.VERSION.SDK_INT < 17) return null; + * if (!BuildHooksAndroid.isEnabled()) return super.createConfigurationContext(configuration); + * return BuildHooksAndroid.createConfigurationContext( + * super.createConfigurationContext(configuration)); + * } + * </pre> + * } + */ + private void delegateCreateConfigurationContext() { + String methodName = "createConfigurationContext"; + String methodDescriptor = TypeUtils.getMethodDescriptor(CONTEXT, CONFIGURATION); + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, methodName, methodDescriptor, null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "android/os/Build$VERSION", "SDK_INT", INT); + mv.visitIntInsn(BIPUSH, 17); + Label l0 = new Label(); + mv.visitJumpInsn(IF_ICMPGE, l0); + mv.visitInsn(ACONST_NULL); + mv.visitInsn(ARETURN); + mv.visitLabel(l0); + mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); + mv.visitMethodInsn( + INVOKESTATIC, BUILD_HOOKS_ANDROID, IS_ENABLED_METHOD, IS_ENABLED_DESCRIPTOR, false); + Label l1 = new Label(); + mv.visitJumpInsn(IFNE, l1); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESPECIAL, mSuperClassName, methodName, methodDescriptor, false); + mv.visitInsn(ARETURN); + mv.visitLabel(l1); + mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESPECIAL, mSuperClassName, methodName, methodDescriptor, false); + mv.visitMethodInsn(INVOKESTATIC, BUILD_HOOKS_ANDROID, methodName, + TypeUtils.getMethodDescriptor(CONTEXT, CONTEXT), false); + mv.visitInsn(ARETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + + /** + * Generates: + * + * <pre> + * public void setTheme(int theme) { + * if (!BuildHooksAndroid.isEnabled()) { + * super.setTheme(theme); + * return; + * } + * BuildHooksAndroid.setTheme(this, theme); + * } + * </pre> + */ + private void delegateSetTheme() { + String methodName = "setTheme"; + String methodDescriptor = TypeUtils.getMethodDescriptor(VOID, INT); + String buildHooksMethodDescriptor = TypeUtils.getMethodDescriptor(VOID, CONTEXT, INT); + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, methodName, methodDescriptor, null, null); + mv.visitCode(); + mv.visitMethodInsn( + INVOKESTATIC, BUILD_HOOKS_ANDROID, IS_ENABLED_METHOD, IS_ENABLED_DESCRIPTOR, false); + Label l0 = new Label(); + mv.visitJumpInsn(IFNE, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 1); + mv.visitMethodInsn(INVOKESPECIAL, mSuperClassName, methodName, methodDescriptor, false); + mv.visitInsn(RETURN); + mv.visitLabel(l0); + mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 1); + mv.visitMethodInsn( + INVOKESTATIC, BUILD_HOOKS_ANDROID, methodName, buildHooksMethodDescriptor, false); + mv.visitInsn(RETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + + /** + * Generates: + * + * <pre> + * public returnType methodName() { + * if (!BuildHooksAndroid.isEnabled()) return super.methodName(); + * return BuildHooksAndroid.methodName(this); + * } + * </pre> + */ + private void delegateGet(String methodName, String returnType) { + String getMethodDescriptor = TypeUtils.getMethodDescriptor(returnType); + String buildHooksGetMethodDescriptor = TypeUtils.getMethodDescriptor(returnType, CONTEXT); + MethodVisitor mv = + super.visitMethod(ACC_PUBLIC, methodName, getMethodDescriptor, null, null); + mv.visitCode(); + mv.visitMethodInsn( + INVOKESTATIC, BUILD_HOOKS_ANDROID, IS_ENABLED_METHOD, IS_ENABLED_DESCRIPTOR, false); + Label l0 = new Label(); + mv.visitJumpInsn(IFNE, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, mSuperClassName, methodName, getMethodDescriptor, false); + mv.visitInsn(ARETURN); + mv.visitLabel(l0); + mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, BUILD_HOOKS_ANDROID, methodName, + buildHooksGetMethodDescriptor, false); + mv.visitInsn(ARETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } +}
diff --git a/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java b/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java new file mode 100644 index 0000000..1ae24c7d --- /dev/null +++ b/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java
@@ -0,0 +1,89 @@ +// 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.bytecode; + +import org.objectweb.asm.Type; + +import java.util.HashMap; +import java.util.Map; + +/** + * Utility methods for accessing {@link Type}s Strings. + * + * Useful definitions to keep in mind when using this class: + * Internal name - The fully qualified name for a type with dots replaced by slashes. Not really + * relevant for primitive types. + * Type descriptor - Single letters for primitive types, "L" + internal name + ";" for class types. + * + * The methods in this class accept internal names or primitive type descriptors. + */ +class TypeUtils { + static final String ASSERTION_ERROR = "java/lang/AssertionError"; + static final String ASSET_MANAGER = "android/content/res/AssetManager"; + static final String BASE_CHROMIUM_APPLICATION = "org/chromium/base/BaseChromiumApplication"; + static final String BUILD_HOOKS = "org/chromium/build/BuildHooks"; + static final String BUILD_HOOKS_ANDROID = "org/chromium/build/BuildHooksAndroid"; + static final String CONFIGURATION = "android/content/res/Configuration"; + static final String CONTEXT = "android/content/Context"; + static final String CONTEXT_WRAPPER = "android/content/ContextWrapper"; + static final String DISPLAY_LEAK_ACTIVITY = + "com/squareup/leakcanary/internal/DisplayLeakActivity"; + static final String RESOURCES = "android/content/res/Resources"; + static final String THEME = "android/content/res/Resources$Theme"; + static final String BOOLEAN = "Z"; + static final String INT = "I"; + static final String VOID = "V"; + private static final Map<String, Type> PRIMITIVE_DESCRIPTORS; + + static { + PRIMITIVE_DESCRIPTORS = new HashMap<>(); + PRIMITIVE_DESCRIPTORS.put(Type.BOOLEAN_TYPE.toString(), Type.BOOLEAN_TYPE); + PRIMITIVE_DESCRIPTORS.put(Type.INT_TYPE.toString(), Type.INT_TYPE); + PRIMITIVE_DESCRIPTORS.put(Type.VOID_TYPE.toString(), Type.VOID_TYPE); + } + + /** + * Returns the full method signature with internal names. + * + * @param methodName Name of the method (ex. "getResources"). + * @param returnType Internal name for the return type. + * @param argumentTypes List of internal names for argument types. + * @return String representation of the method signature. + */ + static String getMethodSignature( + String methodName, String returnType, String... argumentTypes) { + return methodName + getMethodDescriptor(returnType, argumentTypes); + } + + /** + * Builds a method descriptor suitable for use with {@link org.objectweb.asm.MethodVisitor}. + * + * @param returnType Internal name for the return type of the method (primitive or class). + * @param argumentTypes Internal names for the argument types (primitive or class). + * @return The generated method descriptor. + */ + static String getMethodDescriptor(String returnType, String... argumentTypes) { + Type[] typedArguments = new Type[argumentTypes.length]; + for (int i = 0; i < argumentTypes.length; ++i) { + // Argument list should be empty in this case, not V (void). + assert !Type.VOID_TYPE.toString().equals(argumentTypes[i]); + typedArguments[i] = convert(argumentTypes[i]); + } + return Type.getMethodDescriptor(convert(returnType), typedArguments); + } + + /** + * Converts an internal name for a type to a {@link Type}. + * + * @param type Internal name for a type (primitive or class). + * @return The resulting Type. + */ + private static Type convert(String type) { + if (PRIMITIVE_DESCRIPTORS.containsKey(type)) { + return PRIMITIVE_DESCRIPTORS.get(type); + } + return Type.getObjectType(type); + } +}
diff --git a/build/android/diff_resource_sizes.py b/build/android/diff_resource_sizes.py new file mode 100644 index 0000000..5f7157011 --- /dev/null +++ b/build/android/diff_resource_sizes.py
@@ -0,0 +1,149 @@ +# 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. + +"""Runs resource_sizes.py on two apks and outputs the diff.""" + +import argparse +import json +import os +import subprocess +import sys + +from pylib.constants import host_paths +from pylib.utils import shared_preference_utils + +with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): + import perf_tests_results_helper # pylint: disable=import-error + +_ANDROID_DIR = os.path.dirname(os.path.abspath(__file__)) +with host_paths.SysPath(os.path.join(_ANDROID_DIR, 'gyp', 'util')): + import build_utils # pylint: disable=import-error + + +_BASE_CHART = { + 'format_version': '0.1', + 'benchmark_name': 'resource_sizes_diff', + 'benchmark_description': 'APK resource size diff information', + 'trace_rerun_options': [], + 'charts': {}, +} + +_RESULTS_FILENAME = 'results-chart.json' + + +def DiffResults(chartjson, base_results, diff_results): + """Reports the diff between the two given results. + + Args: + chartjson: A dictionary that chartjson results will be placed in, or None + to only print results. + base_results: The chartjson-formatted size results of the base APK. + diff_results: The chartjson-formatted size results of the diff APK. + """ + for graph_title, graph in base_results['charts'].iteritems(): + for trace_title, trace in graph.iteritems(): + perf_tests_results_helper.ReportPerfResult( + chartjson, graph_title, trace_title, + diff_results['charts'][graph_title][trace_title]['value'] + - trace['value'], + trace['units'], trace['improvement_direction'], + trace['important']) + + +def AddIntermediateResults(chartjson, base_results, diff_results): + """Copies the intermediate size results into the output chartjson. + + Args: + chartjson: A dictionary that chartjson results will be placed in. + base_results: The chartjson-formatted size results of the base APK. + diff_results: The chartjson-formatted size results of the diff APK. + """ + for graph_title, graph in base_results['charts'].iteritems(): + for trace_title, trace in graph.iteritems(): + perf_tests_results_helper.ReportPerfResult( + chartjson, graph_title + '_base_apk', trace_title, + trace['value'], trace['units'], trace['improvement_direction'], + trace['important']) + + # Both base_results and diff_results should have the same charts/traces, but + # loop over them separately in case they don't + for graph_title, graph in diff_results['charts'].iteritems(): + for trace_title, trace in graph.iteritems(): + perf_tests_results_helper.ReportPerfResult( + chartjson, graph_title + '_diff_apk', trace_title, + trace['value'], trace['units'], trace['improvement_direction'], + trace['important']) + + +def _CreateArgparser(): + argparser = argparse.ArgumentParser( + description='Diff resource sizes of two APKs. Arguments not listed here ' + 'will be passed on to both invocations of resource_sizes.py.') + argparser.add_argument('--chromium-output-directory-base', + dest='out_dir_base', + help='Location of the build artifacts for the base ' + 'APK, i.e. what the size increase/decrease will ' + 'be measured from.') + argparser.add_argument('--chromium-output-directory-diff', + dest='out_dir_diff', + help='Location of the build artifacts for the diff ' + 'APK.') + argparser.add_argument('--chartjson', + action='store_true', + help='Sets output mode to chartjson.') + argparser.add_argument('--include-intermediate-results', + action='store_true', + help='Include the results from the resource_sizes.py ' + 'runs in the chartjson output.') + argparser.add_argument('--output-dir', + default='.', + help='Directory to save chartjson to.') + argparser.add_argument('--base-apk', + required=True, + help='Path to the base APK, i.e. what the size ' + 'increase/decrease will be measured from.') + argparser.add_argument('--diff-apk', + required=True, + help='Path to the diff APK, i.e. the APK whose size ' + 'increase/decrease will be measured against the ' + 'base APK.') + return argparser + + +def main(): + args, unknown_args = _CreateArgparser().parse_known_args() + chartjson = _BASE_CHART.copy() if args.chartjson else None + + with build_utils.TempDir() as base_dir, build_utils.TempDir() as diff_dir: + # Run resource_sizes.py on the two APKs + resource_sizes_path = os.path.join(_ANDROID_DIR, 'resource_sizes.py') + shared_args = (['python', resource_sizes_path, '--chartjson'] + + unknown_args) + + base_args = shared_args + ['--output-dir', base_dir, args.base_apk] + if args.out_dir_base: + base_args += ['--chromium-output-directory', args.out_dir_base] + subprocess.check_output(base_args, stderr=subprocess.STDOUT) + + diff_args = shared_args + ['--output-dir', diff_dir, args.diff_apk] + if args.out_dir_diff: + base_args += ['--chromium-output-directory', args.out_dir_diff] + subprocess.check_output(diff_args, stderr=subprocess.STDOUT) + + # Combine the separate results + base_file = os.path.join(base_dir, _RESULTS_FILENAME) + diff_file = os.path.join(diff_dir, _RESULTS_FILENAME) + base_results = shared_preference_utils.ExtractSettingsFromJson(base_file) + diff_results = shared_preference_utils.ExtractSettingsFromJson(diff_file) + DiffResults(chartjson, base_results, diff_results) + if args.include_intermediate_results: + AddIntermediateResults(chartjson, base_results, diff_results) + + if args.chartjson: + with open(os.path.join(os.path.abspath(args.output_dir), + _RESULTS_FILENAME), 'w') as outfile: + json.dump(chartjson, outfile) + +if __name__ == '__main__': + sys.exit(main())
diff --git a/build/android/gyp/bytecode_processor.py b/build/android/gyp/bytecode_processor.py new file mode 100755 index 0000000..c12ec54 --- /dev/null +++ b/build/android/gyp/bytecode_processor.py
@@ -0,0 +1,48 @@ +#!/usr/bin/env python +# 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. + +"""Wraps bin/helper/java_bytecode_rewriter and expands @FileArgs.""" + +import argparse +import os +import sys + +from util import build_utils + + +def _AddSwitch(parser, val): + parser.add_argument( + val, action='store_const', default='--disabled', const=val) + + +def main(argv): + argv = build_utils.ExpandFileArgs(argv[1:]) + parser = argparse.ArgumentParser() + build_utils.AddDepfileOption(parser) + parser.add_argument('--script', required=True, + help='Path to the java binary wrapper script.') + parser.add_argument('--input-jar', required=True) + parser.add_argument('--output-jar', required=True) + parser.add_argument('--extra-classpath-jar', dest='extra_jars', + action='append', default=[], + help='Extra inputs, passed last to the binary script.') + _AddSwitch(parser, '--enable-custom-resources') + _AddSwitch(parser, '--enable-assert') + args = parser.parse_args(argv) + extra_classpath_jars = [] + for a in args.extra_jars: + extra_classpath_jars.extend(build_utils.ParseGnList(a)) + + cmd = [args.script, args.input_jar, args.output_jar, args.enable_assert, + args.enable_custom_resources] + extra_classpath_jars + build_utils.CheckOutput(cmd) + + if args.depfile: + inputs = [args.script, args.input_jar] + extra_classpath_jars + build_utils.WriteDepfile(args.depfile, args.output_jar, inputs) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
diff --git a/build/android/gyp/create_apk_operations_script.py b/build/android/gyp/create_apk_operations_script.py index 7fa94c1..cd2722f9 100755 --- a/build/android/gyp/create_apk_operations_script.py +++ b/build/android/gyp/create_apk_operations_script.py
@@ -26,11 +26,13 @@ import apk_operations output_dir = resolve(${OUTPUT_DIR}) try: - apk_operations.Run(output_dir, - resolve(${APK_PATH}), - resolve(${INC_JSON_PATH}), - ${FLAGS_FILE}, - target_cpu=${TARGET_CPU}) + apk_operations.Run( + output_dir, + resolve(${APK_PATH}), + resolve(${INC_JSON_PATH}), + ${FLAGS_FILE}, + ${TARGET_CPU}, + resolve(${MAPPING_PATH})) except TypeError: rel_output_dir = os.path.relpath(output_dir) rel_script_path = os.path.relpath(sys.argv[0], output_dir) @@ -52,6 +54,7 @@ parser.add_argument('--incremental-install-json-path') parser.add_argument('--command-line-flags-file') parser.add_argument('--target-cpu') + parser.add_argument('--proguard-mapping-path') args = parser.parse_args(args) def relativize(path): @@ -68,6 +71,7 @@ 'OUTPUT_DIR': repr(relativize('.')), 'APK_PATH': repr(relativize(args.apk_path)), 'INC_JSON_PATH': repr(relativize(args.incremental_install_json_path)), + 'MAPPING_PATH': repr(relativize(args.proguard_mapping_path)), 'FLAGS_FILE': repr(args.command_line_flags_file), 'TARGET_CPU': repr(args.target_cpu), }
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index 4294c79..34b2297 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py
@@ -588,6 +588,7 @@ extra_jars = build_utils.ParseGnList(options.extra_classpath_jars) deps_info['extra_classpath_jars'] = extra_jars javac_classpath += extra_jars + java_full_classpath += extra_jars # The java code for an instrumentation test apk is assembled differently for # ProGuard vs. non-ProGuard.
diff --git a/build/android/java_assertion_enabler/BUILD.gn b/build/android/java_assertion_enabler/BUILD.gn deleted file mode 100644 index 7d819c0..0000000 --- a/build/android/java_assertion_enabler/BUILD.gn +++ /dev/null
@@ -1,17 +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. - -import("//build/config/android/rules.gni") - -assert(current_toolchain == default_toolchain) - -java_binary("java_assertion_enabler") { - java_files = - [ "java/org/chromium/javaassertionenabler/AssertionEnabler.java" ] - main_class = "org.chromium.javaassertionenabler.AssertionEnabler" - deps = [ - "//third_party/ow2_asm:asm_java", - ] - wrapper_script_name = "helper/java_assertion_enabler" -}
diff --git a/build/android/java_assertion_enabler/java/org/chromium/javaassertionenabler/AssertionEnabler.java b/build/android/java_assertion_enabler/java/org/chromium/javaassertionenabler/AssertionEnabler.java deleted file mode 100644 index e4a525c..0000000 --- a/build/android/java_assertion_enabler/java/org/chromium/javaassertionenabler/AssertionEnabler.java +++ /dev/null
@@ -1,189 +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. - -package org.chromium.javaassertionenabler; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -/** - * An application that replace Java ASSERT statements with a function by modifying Java bytecode. It - * takes in a JAR file, modifies bytecode of classes that use ASSERT, and outputs the bytecode to a - * new JAR file. - * - * We do this in two steps, first step is to enable assert. - * Following bytecode is generated for each class with ASSERT statements: - * 0: ldc #8 // class CLASSNAME - * 2: invokevirtual #9 // Method java/lang/Class.desiredAssertionStatus:()Z - * 5: ifne 12 - * 8: iconst_1 - * 9: goto 13 - * 12: iconst_0 - * 13: putstatic #2 // Field $assertionsDisabled:Z - * Replaces line #13 to the following: - * 13: pop - * Consequently, $assertionsDisabled is assigned the default value FALSE. - * This is done in the first if statement in overridden visitFieldInsn. We do this per per-assert. - * - * Second step is to replace assert statement with a function: - * The followed instructions are generated by a java assert statement: - * getstatic #3 // Field $assertionsDisabled:Z - * ifne 118 // Jump to instruction as if assertion if not enabled - * ... - * ifne 19 - * new #4 // class java/lang/AssertionError - * dup - * ldc #5 // String (don't have this line if no assert message given) - * invokespecial #6 // Method java/lang/AssertionError. - * athrow - * Replace athrow with: - * invokestatic #7 // Method org/chromium/base/JavaExceptionReporter.assertFailureHandler - * goto 118 - * JavaExceptionReporter.assertFailureHandler is a function that handles the AssertionError, - * 118 is the instruction to execute as if assertion if not enabled. - */ -class AssertionEnabler { - static final String CLASS_FILE_SUFFIX = ".class"; - static final String TEMPORARY_FILE_SUFFIX = ".temp"; - static final int BUFFER_SIZE = 16384; - - static class AssertionEnablerVisitor extends ClassVisitor { - AssertionEnablerVisitor(ClassWriter writer) { - super(Opcodes.ASM5, writer); - } - - @Override - public MethodVisitor visitMethod(final int access, final String name, String desc, - String signature, String[] exceptions) { - return new RewriteAssertMethodVisitorWriter( - Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)); - } - } - - static class RewriteAssertMethodVisitorWriter extends MethodVisitor { - static final String ASSERTION_DISABLED_NAME = "$assertionsDisabled"; - static final String INSERT_INSTRUCTION_OWNER = "org/chromium/build/BuildHooks"; - static final String INSERT_INSTRUCTION_NAME = "assertFailureHandler"; - static final String INSERT_INSTRUCTION_DESC = "(Ljava/lang/AssertionError;)V"; - static final boolean INSERT_INSTRUCTION_ITF = false; - - boolean mStartLoadingAssert; - Label mGotoLabel; - - public RewriteAssertMethodVisitorWriter(int api, MethodVisitor mv) { - super(api, mv); - } - - @Override - public void visitFieldInsn(int opcode, String owner, String name, String desc) { - if (opcode == Opcodes.PUTSTATIC && name.equals(ASSERTION_DISABLED_NAME)) { - super.visitInsn(Opcodes.POP); // enable assert - } else if (opcode == Opcodes.GETSTATIC && name.equals(ASSERTION_DISABLED_NAME)) { - mStartLoadingAssert = true; - super.visitFieldInsn(opcode, owner, name, desc); - } else { - super.visitFieldInsn(opcode, owner, name, desc); - } - } - - @Override - public void visitJumpInsn(int opcode, Label label) { - if (mStartLoadingAssert && opcode == Opcodes.IFNE && mGotoLabel == null) { - mGotoLabel = label; - } - super.visitJumpInsn(opcode, label); - } - - @Override - public void visitInsn(int opcode) { - if (!mStartLoadingAssert || opcode != Opcodes.ATHROW) { - super.visitInsn(opcode); - } else { - super.visitMethodInsn(Opcodes.INVOKESTATIC, INSERT_INSTRUCTION_OWNER, - INSERT_INSTRUCTION_NAME, INSERT_INSTRUCTION_DESC, INSERT_INSTRUCTION_ITF); - super.visitJumpInsn(Opcodes.GOTO, mGotoLabel); - mStartLoadingAssert = false; - mGotoLabel = null; - } - } - } - - static byte[] readAllBytes(InputStream inputStream) throws IOException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int numRead = 0; - byte[] data = new byte[BUFFER_SIZE]; - while ((numRead = inputStream.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, numRead); - } - return buffer.toByteArray(); - } - - static void enableAssertionInJar(String inputJarPath, String outputJarPath) { - String tempJarPath = outputJarPath + TEMPORARY_FILE_SUFFIX; - try (ZipInputStream inputStream = new ZipInputStream( - new BufferedInputStream(new FileInputStream(inputJarPath))); - ZipOutputStream tempStream = new ZipOutputStream( - new BufferedOutputStream(new FileOutputStream(tempJarPath)))) { - ZipEntry entry = null; - - while ((entry = inputStream.getNextEntry()) != null) { - byte[] byteCode = readAllBytes(inputStream); - - if (entry.isDirectory() || !entry.getName().endsWith(CLASS_FILE_SUFFIX)) { - tempStream.putNextEntry(entry); - tempStream.write(byteCode); - tempStream.closeEntry(); - continue; - } - ClassReader reader = new ClassReader(byteCode); - ClassWriter writer = new ClassWriter(reader, 0); - reader.accept(new AssertionEnablerVisitor(writer), 0); - byte[] patchedByteCode = writer.toByteArray(); - tempStream.putNextEntry(new ZipEntry(entry.getName())); - tempStream.write(patchedByteCode); - tempStream.closeEntry(); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - - try { - Path src = Paths.get(tempJarPath); - Path dest = Paths.get(outputJarPath); - Files.move(src, dest, StandardCopyOption.REPLACE_EXISTING); - } catch (IOException ioException) { - throw new RuntimeException(ioException); - } - } - - public static void main(String[] args) { - if (args.length != 2) { - System.out.println("Incorrect number of arguments."); - System.out.println("Example usage: java_assertion_enabler input.jar output.jar"); - System.exit(-1); - } - String inputJarPath = args[0]; - String outputJarPath = args[1]; - enableAssertionInJar(inputJarPath, outputJarPath); - } -}
diff --git a/build/android/pylib/symbols/deobfuscator.py b/build/android/pylib/symbols/deobfuscator.py index 2342be68..a85050e4 100644 --- a/build/android/pylib/symbols/deobfuscator.py +++ b/build/android/pylib/symbols/deobfuscator.py
@@ -21,13 +21,15 @@ script_path = os.path.join( constants.GetOutDirectory(), 'bin', 'java_deobfuscate') cmd = [script_path, mapping_path] + # Allow only one thread to call TransformLines() at a time. + self._lock = threading.Lock() + self._closed_called = False + # Assign to None so that attribute exists if Popen() throws. + self._proc = None # Start process eagerly to hide start-up latency. self._proc = subprocess.Popen( cmd, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) - # Allow only one thread to call TransformLines() at a time. - self._lock = threading.Lock() - self._closed_called = False def IsClosed(self): return self._closed_called or self._proc.returncode is not None @@ -113,7 +115,8 @@ self._proc.wait() def __del__(self): - if not self._closed_called: + # self._proc is None when Popen() fails. + if not self._closed_called and self._proc: logging.error('Forgot to Close() deobfuscator')
diff --git a/build/android/pylib/utils/shared_preference_utils.py b/build/android/pylib/utils/shared_preference_utils.py index ce78010..c42163c 100644 --- a/build/android/pylib/utils/shared_preference_utils.py +++ b/build/android/pylib/utils/shared_preference_utils.py
@@ -8,6 +8,26 @@ import logging +def UnicodeToStr(data): + """Recursively converts any Unicode to Python strings. + + Args: + data: The data to be converted. + + Return: + A copy of the given data, but with instances of Unicode converted to Python + strings. + """ + if isinstance(data, dict): + return {UnicodeToStr(key): UnicodeToStr(value) + for key, value in data.iteritems()} + elif isinstance(data, list): + return [UnicodeToStr(element) for element in data] + elif isinstance(data, unicode): + return data.encode('utf-8') + return data + + def ExtractSettingsFromJson(filepath): """Extracts the settings data from the given JSON file. @@ -19,18 +39,8 @@ """ # json.load() loads strings as unicode, which causes issues when trying # to edit string values in preference files, so convert to Python strings - def unicode_to_str(data): - if isinstance(data, dict): - return {unicode_to_str(key): unicode_to_str(value) - for key, value in data.iteritems()} - elif isinstance(data, list): - return [unicode_to_str(element) for element in data] - elif isinstance(data, unicode): - return data.encode('utf-8') - return data - with open(filepath) as prefs_file: - return unicode_to_str(json.load(prefs_file)) + return UnicodeToStr(json.load(prefs_file)) def ApplySharedPreferenceSetting(shared_pref, setting):
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py index c1c1cdbd..81fe881 100755 --- a/build/android/resource_sizes.py +++ b/build/android/resource_sizes.py
@@ -295,28 +295,6 @@ return output -def ReportPerfResult(chart_data, graph_title, trace_title, value, units, - improvement_direction='down', important=True): - """Outputs test results in correct format. - - If chart_data is None, it outputs data in old format. If chart_data is a - dictionary, formats in chartjson format. If any other format defaults to - old format. - """ - if chart_data and isinstance(chart_data, dict): - chart_data['charts'].setdefault(graph_title, {}) - chart_data['charts'][graph_title][trace_title] = { - 'type': 'scalar', - 'value': value, - 'units': units, - 'improvement_direction': improvement_direction, - 'important': important - } - else: - perf_tests_results_helper.PrintPerfResult( - graph_title, trace_title, [value], units) - - class _FileGroup(object): """Represents a category that apk files can fall into.""" @@ -437,11 +415,14 @@ total_install_size += group.ComputeExtractedSize() zip_overhead -= actual_size - ReportPerfResult(chartjson, apk_basename + '_Breakdown', - group.name + ' size', actual_size, 'bytes') - ReportPerfResult(chartjson, apk_basename + '_InstallBreakdown', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Breakdown', group.name + ' size', + actual_size, 'bytes') + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_InstallBreakdown', group.name + ' size', install_size, 'bytes') - ReportPerfResult(chartjson, apk_basename + '_Uncompressed', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Uncompressed', group.name + ' size', group.ComputeUncompressedSize(), 'bytes') @@ -449,40 +430,49 @@ # * 30 byte entry header + len(file name) # * 46 byte central directory entry + len(file name) # * 0-3 bytes for zipalign. - ReportPerfResult(chartjson, apk_basename + '_Breakdown', 'Zip Overhead', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Breakdown', 'Zip Overhead', zip_overhead, 'bytes') - ReportPerfResult(chartjson, apk_basename + '_InstallSize', 'APK size', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_InstallSize', 'APK size', total_apk_size, 'bytes') - ReportPerfResult(chartjson, apk_basename + '_InstallSize', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_InstallSize', 'Estimated installed size', total_install_size, 'bytes') transfer_size = _CalculateCompressedSize(apk_filename) - ReportPerfResult(chartjson, apk_basename + '_TransferSize', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_TransferSize', 'Transfer size (deflate)', transfer_size, 'bytes') # Size of main dex vs remaining. main_dex_info = java_code.FindByPattern('classes.dex') if main_dex_info: main_dex_size = main_dex_info.file_size - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'main dex size', main_dex_size, 'bytes') secondary_size = java_code.ComputeUncompressedSize() - main_dex_size - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'secondary dex size', secondary_size, 'bytes') # Size of main .so vs remaining. main_lib_info = native_code.FindLargest() if main_lib_info: main_lib_size = main_lib_info.file_size - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'main lib size', main_lib_size, 'bytes') secondary_size = native_code.ComputeUncompressedSize() - main_lib_size - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'other lib size', secondary_size, 'bytes') main_lib_section_sizes = _ExtractMainLibSectionSizesFromApk( apk_filename, main_lib_info.filename, tool_prefix) for metric_name, size in main_lib_section_sizes.iteritems(): - ReportPerfResult(chartjson, apk_basename + '_MainLibInfo', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_MainLibInfo', metric_name, size, 'bytes') # Main metric that we want to monitor for jumps. @@ -518,10 +508,12 @@ normalized_apk_size += int( _NormalizeResourcesArsc(apk_filename, num_arsc_translations)) - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'normalized apk size', normalized_apk_size, 'bytes') - ReportPerfResult(chartjson, apk_basename + '_Specifics', + perf_tests_results_helper.ReportPerfResult(chartjson, + apk_basename + '_Specifics', 'file count', len(apk_contents), 'zip entries') for info in unknown.AllEntries(): @@ -735,11 +727,12 @@ graph_title = os.path.basename(apk_filename) + '_Dex' dex_metrics = method_count.CONTRIBUTORS_TO_DEX_CACHE for key, label in dex_metrics.iteritems(): - ReportPerfResult(chartjson, graph_title, label, sizes[key], 'entries') + perf_tests_results_helper.ReportPerfResult(chartjson, graph_title, label, + sizes[key], 'entries') graph_title = '%sCache' % graph_title - ReportPerfResult(chartjson, graph_title, 'DexCache', sizes['dex_cache_size'], - 'bytes') + perf_tests_results_helper.ReportPerfResult(chartjson, graph_title, 'DexCache', + sizes['dex_cache_size'], 'bytes') def _PrintPatchSizeEstimate(new_apk, builder, bucket, chartjson=None): @@ -756,10 +749,12 @@ tmp_name = os.path.join(tmp, 'patch.tmp') bsdiff = apk_patch_size_estimator.calculate_bsdiff( old_apk, new_apk, None, tmp_name) - ReportPerfResult(chartjson, title, 'BSDiff (gzipped)', bsdiff, 'bytes') + perf_tests_results_helper.ReportPerfResult(chartjson, title, + 'BSDiff (gzipped)', bsdiff, 'bytes') fbf = apk_patch_size_estimator.calculate_filebyfile( old_apk, new_apk, None, tmp_name) - ReportPerfResult(chartjson, title, 'FileByFile (gzipped)', fbf, 'bytes') + perf_tests_results_helper.ReportPerfResult(chartjson, title, + 'FileByFile (gzipped)', fbf, 'bytes') @contextmanager @@ -845,8 +840,8 @@ si_count = AnalyzeStaticInitializers( args.apk, tool_prefix, args.dump_sis, out_dir) - ReportPerfResult(chartjson, 'StaticInitializersCount', 'count', si_count, - 'count') + perf_tests_results_helper.ReportPerfResult( + chartjson, 'StaticInitializersCount', 'count', si_count, 'count') if args.estimate_patch_size: _PrintPatchSizeEstimate(args.apk, args.reference_apk_builder,
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index b8b736d..cffe747c 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -1170,6 +1170,9 @@ defined(invoker.enable_build_hooks) && invoker.enable_build_hooks && (is_java_debug || dcheck_always_on) + _enable_custom_resources = defined(invoker.enable_build_hooks_android) && + invoker.enable_build_hooks_android + _desugar = defined(invoker.supports_android) && invoker.supports_android _jar_excluded_patterns = [] @@ -1183,15 +1186,26 @@ _deps = [] _previous_output_jar = _input_jar_path - if (_enable_assert) { - _assert_target = "${target_name}__assert" - _assert_input_jar = _previous_output_jar - _assert_output_jar = "$target_out_dir/$target_name-asserted.jar" + assert(!defined(invoker.alternative_android_sdk_ijar) || + invoker.alternative_android_sdk_ijar != "") + assert(!defined(invoker.alternative_android_sdk_ijar_dep) || + invoker.alternative_android_sdk_ijar_dep != "") + assert(!defined(invoker.alternative_android_sdk_jar) || + invoker.alternative_android_sdk_jar != "") - action(_assert_target) { - script = "$root_build_dir/bin/helper/java_assertion_enabler" + if (_enable_assert || _enable_custom_resources) { + _java_bytecode_rewriter_target = "${target_name}__bytecode_rewrite" + _java_bytecode_rewriter_input_jar = _previous_output_jar + _java_bytecode_rewriter_output_jar = + "$target_out_dir/$target_name-bytecode-rewritten.jar" + + action(_java_bytecode_rewriter_target) { + script = "//build/android/gyp/bytecode_processor.py" + depfile = "$target_gen_dir/$target_name.d" + _bytecode_rewriter_script = + "$root_build_dir/bin/helper/java_bytecode_rewriter" deps = [ - "//build/android/java_assertion_enabler($default_toolchain)", + "//build/android/bytecode:java_bytecode_rewriter($default_toolchain)", ] deps += _deps if (defined(invoker.deps)) { @@ -1200,29 +1214,47 @@ if (defined(invoker.public_deps)) { public_deps = invoker.public_deps } + _android_sdk_jar = android_sdk_jar + if (defined(invoker.alternative_android_sdk_jar)) { + _android_sdk_jar = invoker.alternative_android_sdk_jar + } inputs = [ - _assert_input_jar, + _android_sdk_jar, + _java_bytecode_rewriter_input_jar, + _build_config, ] outputs = [ - _assert_output_jar, + _java_bytecode_rewriter_output_jar, ] args = [ - rebase_path(_assert_input_jar, root_build_dir), - rebase_path(_assert_output_jar, root_build_dir), + "--depfile", + rebase_path(depfile, root_build_dir), + "--script", + rebase_path(_bytecode_rewriter_script, root_build_dir), + "--input-jar", + rebase_path(_java_bytecode_rewriter_input_jar, root_build_dir), + "--output-jar", + rebase_path(_java_bytecode_rewriter_output_jar, root_build_dir), + ] + if (_enable_assert) { + args += [ "--enable-assert" ] + } + if (_enable_custom_resources) { + args += [ "--enable-custom-resources" ] + } + args += [ + "--extra-classpath-jar", + rebase_path(_android_sdk_jar, root_build_dir), + "--extra-classpath-jar", + "@FileArg($_rebased_build_config:deps_info:java:full_classpath)", ] } _deps = [] - _deps = [ ":$_assert_target" ] - _previous_output_jar = _assert_output_jar + _deps = [ ":$_java_bytecode_rewriter_target" ] + _previous_output_jar = _java_bytecode_rewriter_output_jar } - assert(!defined(invoker.alternative_android_sdk_ijar) || - invoker.alternative_android_sdk_ijar != "") - assert(!defined(invoker.alternative_android_sdk_ijar_dep) || - invoker.alternative_android_sdk_ijar_dep != "") - assert(!defined(invoker.alternative_android_sdk_jar) || - invoker.alternative_android_sdk_jar != "") if (_desugar) { _desugar_target = "${target_name}__desugar" _desugar_input_jar = _previous_output_jar @@ -1987,6 +2019,8 @@ forward_variables_from(invoker, [ "testonly" ]) _supports_android = defined(invoker.supports_android) && invoker.supports_android + _requires_android = + defined(invoker.requires_android) && invoker.requires_android assert(defined(invoker.jar_path)) if (defined(invoker.output_name)) { @@ -2032,6 +2066,16 @@ _deps += [ "//build/android/buildhooks:build_hooks_java" ] } + # Some testonly targets use their own resources and the code being + # tested will use custom resources so there's no need to enable this + # for testonly targets. + _enable_build_hooks_android = + _enable_build_hooks && _requires_android && + (!defined(invoker.testonly) || !invoker.testonly) + if (_enable_build_hooks_android) { + _deps += [ "//build/android/buildhooks:build_hooks_android_java" ] + } + write_build_config(_build_config_target_name) { type = "java_prebuilt" is_prebuilt_binary = defined(invoker.main_class) @@ -2041,8 +2085,7 @@ "proguard_configs", ]) supports_android = _supports_android - requires_android = - defined(invoker.requires_android) && invoker.requires_android + requires_android = _requires_android if (defined(invoker.deps)) { possible_config_deps = _deps @@ -2077,6 +2120,7 @@ supports_android = _supports_android enable_build_hooks = _enable_build_hooks + enable_build_hooks_android = _enable_build_hooks_android build_config = _build_config input_jar_path = invoker.jar_path output_jar_path = _jar_path @@ -2641,6 +2685,7 @@ requires_android = _requires_android emma_instrument = _emma_instrument enable_build_hooks = _enable_build_hooks + enable_build_hooks_android = _enable_build_hooks_android deps = _accumulated_deps } _accumulated_deps += [ ":$_compile_java_target" ]
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 708f6e7..026e042 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -1141,6 +1141,12 @@ _build_config = "$target_gen_dir/$target_name.build_config" _build_config_target_name = "${target_name}__build_config" + if (defined(invoker.deps)) { + # This dep is required if any deps require android (but it doesn't hurt + # to add it regardless) and is used by bytecode rewritten classes. + invoker.deps += + [ "//build/android/buildhooks:build_hooks_android_impl_java" ] + } write_build_config(_build_config_target_name) { type = "junit_binary" build_config = _build_config @@ -2492,6 +2498,12 @@ outputs = [ _generated_script, ] + if (_proguard_enabled) { + # Required by logcat command. + data_deps = [ + "//build/android/stacktrace:java_deobfuscate", + ] + } args = [ "--script-output-path", rebase_path(_generated_script, root_build_dir), @@ -2511,6 +2523,12 @@ rebase_path(_incremental_install_json_path, root_build_dir), ] } + if (_proguard_enabled) { + args += [ + "--proguard-mapping-path", + rebase_path("$_final_apk_path.mapping", root_build_dir), + ] + } } _apk_operations += [ ":$_apk_operations_target_name" ] _incremental_apk_operations += [ ":$_apk_operations_target_name" ] @@ -2686,7 +2704,6 @@ proguard_configs = [] } proguard_configs += [ "//testing/android/proguard_for_test.flags" ] - data_deps += [ "//build/android/stacktrace:java_deobfuscate" ] if (defined(final_apk_path)) { _final_apk_path = final_apk_path } else { @@ -2828,11 +2845,11 @@ } shared_libraries = [ invoker.shared_library ] deps += [ + ":${target_name}__runtime_deps", + ":${target_name}__secondary_abi_runtime_deps", "//base:base_java", "//testing/android/appurify_support:appurify_support_java", "//testing/android/reporter:reporter_java", - ":${target_name}__runtime_deps", - ":${target_name}__secondary_abi_runtime_deps", ] data_deps += [ "//build/android/pylib/device/commands",
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn index d617396d..bd4e4aa 100644 --- a/build/config/sanitizers/BUILD.gn +++ b/build/config/sanitizers/BUILD.gn
@@ -361,13 +361,20 @@ } if (use_cfi_diag) { - cflags += [ - "-fno-sanitize-trap=cfi", - "-fno-inline-functions", - "-fno-inline", - "-fno-omit-frame-pointer", - "-O1", - ] + cflags += [ "-fno-sanitize-trap=cfi" ] + if (is_win) { + cflags += [ + "/Oy-", + "/Ob0", + ] + } else { + cflags += [ + "-fno-inline-functions", + "-fno-inline", + "-fno-omit-frame-pointer", + "-O1", + ] + } if (use_cfi_recover) { cflags += [ "-fsanitize-recover=cfi" ] }
diff --git a/build/util/lib/common/perf_tests_results_helper.py b/build/util/lib/common/perf_tests_results_helper.py index 6cb058b2..59bb5e43 100644 --- a/build/util/lib/common/perf_tests_results_helper.py +++ b/build/util/lib/common/perf_tests_results_helper.py
@@ -164,3 +164,37 @@ print output sys.stdout.flush() return output + + +def ReportPerfResult(chart_data, graph_title, trace_title, value, units, + improvement_direction='down', important=True): + """Outputs test results in correct format. + + If chart_data is None, it outputs data in old format. If chart_data is a + dictionary, formats in chartjson format. If any other format defaults to + old format. + + Args: + chart_data: A dictionary corresponding to perf results in the chartjson + format. + graph_title: A string containing the name of the chart to add the result + to. + trace_title: A string containing the name of the trace within the chart + to add the result to. + value: The value of the result being reported. + units: The units of the value being reported. + improvement_direction: A string denoting whether higher or lower is + better for the result. Either 'up' or 'down'. + important: A boolean denoting whether the result is important or not. + """ + if chart_data and isinstance(chart_data, dict): + chart_data['charts'].setdefault(graph_title, {}) + chart_data['charts'][graph_title][trace_title] = { + 'type': 'scalar', + 'value': value, + 'units': units, + 'improvement_direction': improvement_direction, + 'important': important + } + else: + PrintPerfResult(graph_title, trace_title, [value], units)
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc index 5126a71..f2e5a75 100644 --- a/cc/animation/element_animations.cc +++ b/cc/animation/element_animations.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/numerics/ranges.h" #include "cc/animation/animation_delegate.h" #include "cc/animation/animation_events.h" #include "cc/animation/animation_host.h" @@ -17,7 +18,6 @@ #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/transform_operations.h" #include "cc/base/filter_operations.h" -#include "cc/base/math_util.h" #include "cc/trees/mutator_host_client.h" #include "ui/gfx/geometry/box_f.h" @@ -262,7 +262,7 @@ int target_property_id, Animation* animation) { DCHECK(animation->target_property_id() == TargetProperty::OPACITY); - opacity = MathUtil::ClampToRange(opacity, 0.0f, 1.0f); + opacity = base::ClampToRange(opacity, 0.0f, 1.0f); if (AnimationAffectsActiveElements(animation)) OnOpacityAnimated(ElementListType::ACTIVE, opacity); if (AnimationAffectsPendingElements(animation))
diff --git a/cc/animation/transform_operation.cc b/cc/animation/transform_operation.cc index 689d359..8758a8b 100644 --- a/cc/animation/transform_operation.cc +++ b/cc/animation/transform_operation.cc
@@ -2,16 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Needed on Windows to get |M_PI| from <cmath> -#ifdef _WIN32 -#define _USE_MATH_DEFINES -#endif - #include <algorithm> -#include <cmath> #include <limits> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "cc/animation/transform_operation.h" #include "cc/animation/transform_operations.h" #include "cc/base/math_util.h" @@ -72,7 +67,7 @@ to->rotate.axis.y * from->rotate.axis.y + to->rotate.axis.z * from->rotate.axis.z; SkMScalar error = - std::abs(SK_MScalar1 - (dot * dot) / (length_2 * other_length_2)); + SkMScalarAbs(SK_MScalar1 - (dot * dot) / (length_2 * other_length_2)); bool result = error < kAngleEpsilon; if (result) { *axis_x = to->rotate.axis.x; @@ -293,7 +288,7 @@ *num_candidates = 4; candidates[0] = phi; for (int i = 1; i < *num_candidates; ++i) - candidates[i] = candidates[i - 1] + M_PI_2; + candidates[i] = candidates[i - 1] + base::kPiDouble / 2; if (nz < 0.f) { for (int i = 0; i < *num_candidates; ++i) candidates[i] *= -1.f; @@ -301,11 +296,11 @@ } static float RadiansToDegrees(float radians) { - return (180.f * radians) / M_PI; + return (180.f * radians) / base::kPiFloat; } static float DegreesToRadians(float degrees) { - return (M_PI * degrees) / 180.f; + return (base::kPiFloat * degrees) / 180.f; } static void BoundingBoxForArc(const gfx::Point3F& point, @@ -411,13 +406,13 @@ // maximum/minimum x, y, z values. // x'(t) = r*cos(t)*v2.x - r*sin(t)*v1.x = 0 // tan(t) = v2.x/v1.x - // t = atan2(v2.x, v1.x) + n*M_PI; + // t = atan2(v2.x, v1.x) + n*pi; candidates[0] = atan2(v2.x(), v1.x()); - candidates[1] = candidates[0] + M_PI; + candidates[1] = candidates[0] + base::kPiDouble; candidates[2] = atan2(v2.y(), v1.y()); - candidates[3] = candidates[2] + M_PI; + candidates[3] = candidates[2] + base::kPiDouble; candidates[4] = atan2(v2.z(), v1.z()); - candidates[5] = candidates[4] + M_PI; + candidates[5] = candidates[4] + base::kPiDouble; } double min_radians = DegreesToRadians(min_degrees); @@ -426,9 +421,9 @@ for (int i = 0; i < num_candidates; ++i) { double radians = candidates[i]; while (radians < min_radians) - radians += 2.0 * M_PI; + radians += 2.0 * base::kPiDouble; while (radians > max_radians) - radians -= 2.0 * M_PI; + radians -= 2.0 * base::kPiDouble; if (radians < min_radians) continue;
diff --git a/cc/base/filter_operation.cc b/cc/base/filter_operation.cc index 19afa9b..74cfb7d 100644 --- a/cc/base/filter_operation.cc +++ b/cc/base/filter_operation.cc
@@ -6,6 +6,7 @@ #include <algorithm> +#include "base/numerics/ranges.h" #include "base/trace_event/trace_event_argument.h" #include "base/values.h" #include "cc/base/filter_operation.h" @@ -197,7 +198,7 @@ case FilterOperation::INVERT: case FilterOperation::OPACITY: case FilterOperation::ALPHA_THRESHOLD: - return MathUtil::ClampToRange(amount, 0.f, 1.f); + return base::ClampToRange(amount, 0.f, 1.f); case FilterOperation::SATURATE: case FilterOperation::BRIGHTNESS: case FilterOperation::CONTRAST:
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index 5f7544c0..d109320 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc
@@ -23,9 +23,6 @@ namespace cc { -const double MathUtil::kPiDouble = 3.14159265358979323846; -const float MathUtil::kPiFloat = 3.14159265358979323846f; - static HomogeneousCoordinate ProjectHomogeneousPoint( const gfx::Transform& transform, const gfx::PointF& p) {
diff --git a/cc/base/math_util.h b/cc/base/math_util.h index 52fc6f0..a2c0f29 100644 --- a/cc/base/math_util.h +++ b/cc/base/math_util.h
@@ -5,12 +5,12 @@ #ifndef CC_BASE_MATH_UTIL_H_ #define CC_BASE_MATH_UTIL_H_ -#include <algorithm> -#include <cmath> +#include <limits> #include <memory> #include <vector> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "build/build_config.h" #include "cc/base/base_export.h" #include "ui/gfx/geometry/box_f.h" @@ -82,14 +82,11 @@ class CC_BASE_EXPORT MathUtil { public: - static const double kPiDouble; - static const float kPiFloat; + static double Deg2Rad(double deg) { return deg * base::kPiDouble / 180.0; } + static double Rad2Deg(double rad) { return rad * 180.0 / base::kPiDouble; } - static double Deg2Rad(double deg) { return deg * kPiDouble / 180.0; } - static double Rad2Deg(double rad) { return rad * 180.0 / kPiDouble; } - - static float Deg2Rad(float deg) { return deg * kPiFloat / 180.0f; } - static float Rad2Deg(float rad) { return rad * 180.0f / kPiFloat; } + static float Deg2Rad(float deg) { return deg * base::kPiFloat / 180.0f; } + static float Rad2Deg(float rad) { return rad * 180.0f / base::kPiFloat; } // Returns true if rounded up value does not overflow, false otherwise. template <typename T> @@ -147,10 +144,6 @@ return RoundDownInternal(n, mul); } - template <typename T> static T ClampToRange(T value, T min, T max) { - return std::min(std::max(value, min), max); - } - template <typename T> static bool ApproximatelyEqual(T lhs, T rhs, T tolerance) { DCHECK_LE(0, tolerance);
diff --git a/cc/base/render_surface_filters.cc b/cc/base/render_surface_filters.cc index 9efbc80..9d7b66eb 100644 --- a/cc/base/render_surface_filters.cc +++ b/cc/base/render_surface_filters.cc
@@ -8,6 +8,7 @@ #include <algorithm> +#include "base/numerics/math_constants.h" #include "cc/base/filter_operation.h" #include "cc/base/filter_operations.h" #include "third_party/skia/include/core/SkImageFilter.h" @@ -69,10 +70,8 @@ } void GetHueRotateMatrix(float hue, SkScalar matrix[20]) { - const float kPi = 3.1415926535897932384626433832795f; - - float cos_hue = cosf(hue * kPi / 180.f); - float sin_hue = sinf(hue * kPi / 180.f); + float cos_hue = cosf(hue * base::kPiFloat / 180.f); + float sin_hue = sinf(hue * base::kPiFloat / 180.f); matrix[0] = 0.213f + cos_hue * 0.787f - sin_hue * 0.213f; matrix[1] = 0.715f - cos_hue * 0.715f - sin_hue * 0.715f; matrix[2] = 0.072f - cos_hue * 0.072f + sin_hue * 0.928f;
diff --git a/cc/blink/web_layer_impl.h b/cc/blink/web_layer_impl.h index dc419b9..a40883f 100644 --- a/cc/blink/web_layer_impl.h +++ b/cc/blink/web_layer_impl.h
@@ -43,11 +43,6 @@ cc::Layer* layer() const; - // If set to true, content opaqueness cannot be changed using setOpaque. - // However, it can still be modified using SetContentsOpaque on the - // cc::Layer. - void SetContentsOpaqueIsFixed(bool fixed); - // WebLayer implementation. int Id() const override; void InvalidateRect(const blink::WebRect&) override; @@ -65,6 +60,8 @@ void SetMaskLayer(blink::WebLayer* mask) override; void SetOpacity(float opacity) override; float Opacity() const override; + void SetContentsOpaqueIsFixed(bool fixed) override; + void SetBlendMode(blink::WebBlendMode blend_mode) override; blink::WebBlendMode BlendMode() const override; void SetIsRootForIsolatedGroup(bool root) override;
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 9fe8c9ec..3c830ccd 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc
@@ -1320,10 +1320,6 @@ inputs_.client->didChangeScrollbarsHidden(hidden); } -gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { - return CurrentScrollOffset(); -} - // On<Property>Animated is called due to an ongoing accelerated animation. // Since this animation is also being run on the compositor thread, there // is no need to request a commit to push this value over, so the value is
diff --git a/cc/layers/layer.h b/cc/layers/layer.h index caf9e1d..72a040a6 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h
@@ -487,7 +487,6 @@ friend class LayerTreeHost; // Interactions with attached animations. - gfx::ScrollOffset ScrollOffsetForAnimation() const; void OnFilterAnimated(const FilterOperations& filters); void OnOpacityAnimated(float opacity); void OnTransformAnimated(const gfx::Transform& transform);
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index c8e1b22b..6201d64d 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -492,10 +492,6 @@ return GetEffectTree().Node(effect_tree_index())->subtree_has_copy_request; } -gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { - return CurrentScrollOffset(); -} - bool LayerImpl::IsActive() const { return layer_tree_impl_->IsActiveTree(); }
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 14b06dc..06048de 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h
@@ -84,7 +84,6 @@ int id() const { return layer_id_; } // Interactions with attached animations. - gfx::ScrollOffset ScrollOffsetForAnimation() const; bool IsActive() const; void SetHasTransformNode(bool val) { has_transform_node_ = val; }
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index b8e7307..e8e5745 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc
@@ -28,6 +28,7 @@ #include "cc/quads/stream_video_draw_quad.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/display_resource_provider.h" +#include "cc/resources/layer_tree_resource_provider.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/geometry_test_utils.h" @@ -264,17 +265,36 @@ return pass; } -viz::ResourceId CreateResource(ResourceProvider* resource_provider, - const gfx::Size& size, - bool is_overlay_candidate) { - viz::TextureMailbox mailbox = - viz::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), - GL_TEXTURE_2D, size, is_overlay_candidate, false); - std::unique_ptr<SingleReleaseCallbackImpl> release_callback = +static void CollectResources(std::vector<viz::ReturnedResource>* array, + const std::vector<viz::ReturnedResource>& returned, + BlockingTaskRunner* main_thread_task_runner) {} + +viz::ResourceId CreateResource( + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, + const gfx::Size& size, + bool is_overlay_candidate) { + viz::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), + GL_TEXTURE_2D, size, is_overlay_candidate, false); + auto release_callback = SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); - return resource_provider->CreateResourceFromTextureMailbox( - mailbox, std::move(release_callback)); + viz::ResourceId resource_id = + child_resource_provider->CreateResourceFromTextureMailbox( + mailbox, std::move(release_callback)); + + std::vector<viz::ReturnedResource> returned_to_child; + int child_id = parent_resource_provider->CreateChild( + base::Bind(&CollectResources, &returned_to_child)); + + // Transfer resource to the parent. + ResourceProvider::ResourceIdArray resource_ids_to_transfer; + resource_ids_to_transfer.push_back(resource_id); + std::vector<viz::TransferableResource> list; + child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, &list); + parent_resource_provider->ReceiveFromChild(child_id, list); + viz::ResourceId parent_resource_id = list[0].id; + return parent_resource_id; } SolidColorDrawQuad* CreateSolidColorQuadAt( @@ -288,10 +308,12 @@ return quad; } -TextureDrawQuad* CreateCandidateQuadAt(ResourceProvider* resource_provider, - const SharedQuadState* shared_quad_state, - RenderPass* render_pass, - const gfx::Rect& rect) { +TextureDrawQuad* CreateCandidateQuadAt( + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, + const SharedQuadState* shared_quad_state, + RenderPass* render_pass, + const gfx::Rect& rect) { bool needs_blending = false; bool premultiplied_alpha = false; bool flipped = false; @@ -299,8 +321,9 @@ float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; gfx::Size resource_size_in_pixels = rect.size(); bool is_overlay_candidate = true; - viz::ResourceId resource_id = CreateResource( - resource_provider, resource_size_in_pixels, is_overlay_candidate); + viz::ResourceId resource_id = + CreateResource(parent_resource_provider, child_resource_provider, + resource_size_in_pixels, is_overlay_candidate); TextureDrawQuad* overlay_quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); @@ -314,7 +337,9 @@ } TextureDrawQuad* CreateTransparentCandidateQuadAt( - ResourceProvider* resource_provider, + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, + const SharedQuadState* shared_quad_state, RenderPass* render_pass, const gfx::Rect& rect) { @@ -325,8 +350,9 @@ float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; gfx::Size resource_size_in_pixels = rect.size(); bool is_overlay_candidate = true; - viz::ResourceId resource_id = CreateResource( - resource_provider, resource_size_in_pixels, is_overlay_candidate); + viz::ResourceId resource_id = + CreateResource(parent_resource_provider, child_resource_provider, + resource_size_in_pixels, is_overlay_candidate); TextureDrawQuad* overlay_quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); @@ -340,7 +366,8 @@ } StreamVideoDrawQuad* CreateCandidateVideoQuadAt( - ResourceProvider* resource_provider, + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, const SharedQuadState* shared_quad_state, RenderPass* render_pass, const gfx::Rect& rect, @@ -348,8 +375,9 @@ bool needs_blending = false; gfx::Size resource_size_in_pixels = rect.size(); bool is_overlay_candidate = true; - viz::ResourceId resource_id = CreateResource( - resource_provider, resource_size_in_pixels, is_overlay_candidate); + viz::ResourceId resource_id = + CreateResource(parent_resource_provider, child_resource_provider, + resource_size_in_pixels, is_overlay_candidate); StreamVideoDrawQuad* overlay_quad = render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); @@ -360,25 +388,29 @@ } TextureDrawQuad* CreateFullscreenCandidateQuad( - ResourceProvider* resource_provider, + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, const SharedQuadState* shared_quad_state, RenderPass* render_pass) { - return CreateCandidateQuadAt(resource_provider, shared_quad_state, + return CreateCandidateQuadAt(parent_resource_provider, + child_resource_provider, shared_quad_state, render_pass, render_pass->output_rect); } StreamVideoDrawQuad* CreateFullscreenCandidateVideoQuad( - ResourceProvider* resource_provider, + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, const SharedQuadState* shared_quad_state, RenderPass* render_pass, const gfx::Transform& transform) { - return CreateCandidateVideoQuadAt(resource_provider, shared_quad_state, - render_pass, render_pass->output_rect, - transform); + return CreateCandidateVideoQuadAt( + parent_resource_provider, child_resource_provider, shared_quad_state, + render_pass, render_pass->output_rect, transform); } YUVVideoDrawQuad* CreateFullscreenCandidateYUVVideoQuad( - ResourceProvider* resource_provider, + DisplayResourceProvider* parent_resource_provider, + LayerTreeResourceProvider* child_resource_provider, const SharedQuadState* shared_quad_state, RenderPass* render_pass) { bool needs_blending = false; @@ -386,8 +418,9 @@ gfx::Rect rect = render_pass->output_rect; gfx::Size resource_size_in_pixels = rect.size(); bool is_overlay_candidate = true; - viz::ResourceId resource_id = CreateResource( - resource_provider, resource_size_in_pixels, is_overlay_candidate); + viz::ResourceId resource_id = + CreateResource(parent_resource_provider, child_resource_provider, + resource_size_in_pixels, is_overlay_candidate); YUVVideoDrawQuad* overlay_quad = render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); @@ -474,6 +507,12 @@ resource_provider_ = FakeResourceProvider::Create<DisplayResourceProvider>( provider_.get(), shared_bitmap_manager_.get()); + child_provider_ = TestContextProvider::Create(); + child_provider_->BindToCurrentThread(); + child_resource_provider_ = + FakeResourceProvider::Create<LayerTreeResourceProvider>( + child_provider_.get(), shared_bitmap_manager_.get()); + overlay_processor_.reset(new OverlayProcessor(output_surface_.get())); overlay_processor_->Initialize(); } @@ -483,6 +522,8 @@ FakeOutputSurfaceClient client_; std::unique_ptr<viz::SharedBitmapManager> shared_bitmap_manager_; std::unique_ptr<DisplayResourceProvider> resource_provider_; + scoped_refptr<TestContextProvider> child_provider_; + std::unique_ptr<LayerTreeResourceProvider> child_resource_provider_; std::unique_ptr<OverlayProcessor> overlay_processor_; gfx::Rect damage_rect_; std::vector<gfx::Rect> content_bounds_; @@ -527,8 +568,8 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); gfx::Rect output_rect = pass->output_rect; TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( - resource_provider_.get(), pass->shared_quad_state_list.back(), - pass.get()); + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); unsigned original_resource_id = original_quad->resource_id(); // Add something behind it. @@ -562,9 +603,9 @@ TEST_F(FullscreenOverlayTest, AlphaFail) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateTransparentCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), pass.get()->output_rect); + CreateTransparentCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), pass.get()->output_rect); // Check for potential candidates. OverlayCandidateList candidate_list; @@ -588,8 +629,8 @@ TEST_F(FullscreenOverlayTest, ResourceSizeInPixelsFail) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( - resource_provider_.get(), pass->shared_quad_state_list.back(), - pass.get()); + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); original_quad->set_resource_size_in_pixels(gfx::Size(64, 64)); // Check for potential candidates. @@ -618,9 +659,9 @@ pass->shared_quad_state_list.back(), pass.get(), kOverlayTopLeftRect); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); // Check for potential candidates. OverlayCandidateList candidate_list; @@ -644,9 +685,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); gfx::Rect inset_rect = pass->output_rect; inset_rect.Inset(0, 1, 0, 1); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - inset_rect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), inset_rect); // Check for potential candidates. OverlayCandidateList candidate_list; @@ -676,9 +717,9 @@ SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); shared_state->opacity = 1.f; - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); // Check for potential candidates. OverlayCandidateList candidate_list; @@ -701,10 +742,9 @@ TEST_F(SingleOverlayOnTopTest, SuccessfulOverlay) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - TextureDrawQuad* original_quad = - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); unsigned original_resource_id = original_quad->resource_id(); // Add something behind it. @@ -743,17 +783,17 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); // Add a small quad. const auto kSmallCandidateRect = gfx::Rect(0, 0, 16, 16); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kSmallCandidateRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kSmallCandidateRect); output_surface_->GetOverlayCandidateValidator()->AddExpectedRect( gfx::RectF(kSmallCandidateRect)); // Add a bigger quad below the previous one, but not occluded. const auto kBigCandidateRect = gfx::Rect(20, 20, 32, 32); TextureDrawQuad* quad_big = CreateCandidateQuadAt( - resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), - kBigCandidateRect); + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kBigCandidateRect); output_surface_->GetOverlayCandidateValidator()->AddExpectedRect( gfx::RectF(kBigCandidateRect)); @@ -786,9 +826,9 @@ TEST_F(SingleOverlayOnTopTest, DamageRect) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); damage_rect_ = kOverlayRect; // Add something behind it. @@ -850,9 +890,9 @@ CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); RenderPassList pass_list; pass_list.push_back(std::move(pass)); @@ -875,9 +915,9 @@ // Test with multiple render passes. TEST_F(SingleOverlayOnTopTest, MultipleRenderPasses) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); // Add something behind it. CreateFullscreenOpaqueQuad(resource_provider_.get(), @@ -900,10 +940,9 @@ TEST_F(SingleOverlayOnTopTest, AcceptBlending) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - TextureDrawQuad* quad = - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + TextureDrawQuad* quad = CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); quad->needs_blending = true; OverlayCandidateList candidate_list; @@ -925,10 +964,9 @@ TEST_F(SingleOverlayOnTopTest, RejectBackgroundColor) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - TextureDrawQuad* quad = - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + TextureDrawQuad* quad = CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); quad->background_color = SK_ColorBLACK; OverlayCandidateList candidate_list; @@ -945,9 +983,9 @@ TEST_F(SingleOverlayOnTopTest, RejectBlendMode) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->blend_mode = SkBlendMode::kScreen; OverlayCandidateList candidate_list; @@ -964,9 +1002,9 @@ TEST_F(SingleOverlayOnTopTest, RejectOpacity) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->opacity = 0.5f; OverlayCandidateList candidate_list; @@ -983,9 +1021,9 @@ TEST_F(SingleOverlayOnTopTest, RejectNonAxisAlignedTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutXAxis(45.f); @@ -1003,9 +1041,9 @@ TEST_F(SingleOverlayOnTopTest, AllowClipped) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->is_clipped = true; pass->shared_quad_state_list.back()->clip_rect = kOverlayClipRect; @@ -1027,6 +1065,7 @@ rect.Offset(0, -rect.height()); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(2.0f, -1.0f); @@ -1050,6 +1089,7 @@ rect.Offset(-rect.width(), 0); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(-1.0f, 2.0f); @@ -1073,6 +1113,7 @@ rect.set_width(rect.width() / 2); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(2.0f, 1.0f); @@ -1093,6 +1134,7 @@ rect.Offset(0, -rect.height()); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(1.f, -1.f); @@ -1114,6 +1156,7 @@ rect.Offset(0, -rect.height()); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(90.f); @@ -1136,6 +1179,7 @@ rect.Offset(-rect.width(), -rect.height()); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(180.f); @@ -1158,6 +1202,7 @@ rect.Offset(-rect.width(), 0); std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(270.f); @@ -1183,10 +1228,9 @@ CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), kOverlayTopLeftRect); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1211,8 +1255,9 @@ kOverlayBottomRightRect); shared_state = pass->CreateAndAppendSharedQuadState(); shared_state->opacity = 1.f; - CreateCandidateQuadAt(resource_provider_.get(), shared_state, pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), shared_state, + pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1234,9 +1279,9 @@ CreateSolidColorQuadAt(pass->shared_quad_state_list.back(), SK_ColorTRANSPARENT, pass.get(), kOverlayBottomRightRect); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1258,8 +1303,9 @@ kOverlayBottomRightRect); shared_state = pass->CreateAndAppendSharedQuadState(); shared_state->opacity = 1.f; - CreateCandidateQuadAt(resource_provider_.get(), shared_state, pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), shared_state, + pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1279,8 +1325,9 @@ CreateSolidColorQuadAt(shared_state, SK_ColorTRANSPARENT, pass.get(), kOverlayBottomRightRect) ->needs_blending = false; - CreateCandidateQuadAt(resource_provider_.get(), shared_state, pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), shared_state, + pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1296,9 +1343,9 @@ TEST_F(SingleOverlayOnTopTest, RejectVideoSwapTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), kSwapTransform); + CreateFullscreenCandidateVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kSwapTransform); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1314,9 +1361,9 @@ TEST_F(UnderlayTest, AllowVideoXMirrorTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), kXMirrorTransform); + CreateFullscreenCandidateVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kXMirrorTransform); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1332,9 +1379,9 @@ TEST_F(UnderlayTest, AllowVideoBothMirrorTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), kBothMirrorTransform); + CreateFullscreenCandidateVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kBothMirrorTransform); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1350,9 +1397,9 @@ TEST_F(UnderlayTest, AllowVideoNormalTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), kNormalTransform); + CreateFullscreenCandidateVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kNormalTransform); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1368,9 +1415,9 @@ TEST_F(SingleOverlayOnTopTest, AllowVideoYMirrorTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get(), kYMirrorTransform); + CreateFullscreenCandidateVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kYMirrorTransform); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1391,9 +1438,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1419,9 +1466,9 @@ TEST_F(UnderlayTest, AllowOnTop) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->CreateAndAppendSharedQuadState()->opacity = 0.5f; CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); @@ -1450,9 +1497,9 @@ // The first time an underlay is scheduled its damage must not be subtracted. TEST_F(UnderlayTest, InitialUnderlayDamageNotSubtracted) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); damage_rect_ = kOverlayRect; @@ -1474,9 +1521,9 @@ TEST_F(UnderlayTest, DamageSubtractedForConsecutiveIdenticalUnderlays) { for (int i = 0; i < 2; ++i) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); damage_rect_ = kOverlayRect; @@ -1510,9 +1557,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - overlay_rects[i]); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), overlay_rects[i]); damage_rect_ = overlay_rects[i]; @@ -1539,9 +1586,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); if (has_fullscreen_candidate[i]) { - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); } damage_rect_ = kOverlayRect; @@ -1570,9 +1617,9 @@ // Add an overlapping quad above the candidate. CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); damage_rect_ = kOverlayRect; @@ -1601,6 +1648,7 @@ pass->shared_quad_state_list.back(), pass.get(), kOverlayTopLeftRect); CreateCandidateQuadAt(resource_provider_.get(), + child_resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); @@ -1641,9 +1689,9 @@ TEST_F(UnderlayCastTest, FullScreenOverlayContentBounds) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1667,9 +1715,9 @@ const gfx::Rect kTopRight(128, 0, 128, 128); std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), kLeftSide, SK_ColorBLACK); @@ -1696,9 +1744,9 @@ CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), kOverlayTopLeftRect); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1722,9 +1770,9 @@ CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayRect); OverlayCandidateList candidate_list; OverlayProcessor::FilterOperationsMap render_pass_filters; @@ -1751,9 +1799,9 @@ transform.Translate(0.5f, 0.5f); std::unique_ptr<RenderPass> pass = CreateRenderPassWithTransform(transform); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - overlay_rect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), overlay_rect); CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), gfx::Rect(0, 0, 10, 10), SK_ColorWHITE); @@ -1784,9 +1832,9 @@ transform.Translate(0.5f, 0.5f); std::unique_ptr<RenderPass> pass = CreateRenderPassWithTransform(transform); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - overlay_rect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), overlay_rect); CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), gfx::Rect(0, 0, 255, 255), SK_ColorWHITE); @@ -1817,9 +1865,9 @@ TEST_F(CALayerOverlayTest, AllowNonAxisAlignedTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(45.f); @@ -1842,9 +1890,9 @@ TEST_F(CALayerOverlayTest, ThreeDTransform) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutXAxis(45.f); @@ -1870,9 +1918,9 @@ TEST_F(CALayerOverlayTest, AllowContainingClip) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->is_clipped = true; pass->shared_quad_state_list.back()->clip_rect = kOverlayRect; @@ -1895,9 +1943,9 @@ TEST_F(CALayerOverlayTest, NontrivialClip) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->is_clipped = true; pass->shared_quad_state_list.back()->clip_rect = gfx::Rect(64, 64, 128, 128); @@ -1923,9 +1971,9 @@ TEST_F(CALayerOverlayTest, SkipTransparent) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->opacity = 0; gfx::Rect damage_rect; @@ -1963,9 +2011,9 @@ feature_list.InitAndEnableFeature( features::kDirectCompositionComplexOverlays); std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateYUVVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(45.f); @@ -1995,8 +2043,8 @@ features::kDirectCompositionNonrootOverlays); std::unique_ptr<RenderPass> pass = CreateRenderPass(); YUVVideoDrawQuad* yuv_quad = CreateFullscreenCandidateYUVVideoQuad( - resource_provider_.get(), pass->shared_quad_state_list.back(), - pass.get()); + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); yuv_quad->require_overlay = true; pass->shared_quad_state_list.back() ->quad_to_target_transform.RotateAboutZAxis(45.f); @@ -2029,9 +2077,9 @@ CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), gfx::Rect(0, 2, 100, 100), SK_ColorWHITE); - CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateYUVVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); gfx::Rect damage_rect; DCLayerOverlayList dc_layer_list; @@ -2058,9 +2106,9 @@ CreateOpaqueQuadAt(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get(), gfx::Rect(2, 2, 100, 100), SK_ColorWHITE); - CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateYUVVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); gfx::Rect damage_rect; DCLayerOverlayList dc_layer_list; @@ -2088,9 +2136,9 @@ TEST_P(DCLayerOverlayTest, DamageRect) { for (int i = 0; i < 2; i++) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateYUVVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); gfx::Rect damage_rect; DCLayerOverlayList dc_layer_list; @@ -2125,8 +2173,8 @@ std::unique_ptr<RenderPass> pass1 = CreateRenderPass(); pass1->id = child_pass_id; YUVVideoDrawQuad* yuv_quad = CreateFullscreenCandidateYUVVideoQuad( - resource_provider_.get(), pass1->shared_quad_state_list.back(), - pass1.get()); + resource_provider_.get(), child_resource_provider_.get(), + pass1->shared_quad_state_list.back(), pass1.get()); yuv_quad->require_overlay = true; pass1->damage_rect = gfx::Rect(); pass1->transform_to_root_target.Translate(0, 100); @@ -2204,6 +2252,7 @@ SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); shared_state->opacity = 1.f; CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), + child_resource_provider_.get(), shared_state, pass.get()); shared_state->is_clipped = true; // Clipped rect shouldn't be overlapped by clipped opaque quad rect. @@ -2241,9 +2290,9 @@ // frame. for (size_t i = 0; i < 2; ++i) { std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateYUVVideoQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateYUVVideoQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); pass->shared_quad_state_list.back()->opacity = 0.5f; DCLayerOverlayList dc_layer_list; @@ -2328,6 +2377,12 @@ provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); + + child_provider_ = TestContextProvider::Create(); + child_provider_->BindToCurrentThread(); + child_resource_provider_ = + FakeResourceProvider::Create<LayerTreeResourceProvider>( + child_provider_.get(), nullptr); } void Init(bool use_validator) { @@ -2370,6 +2425,8 @@ std::unique_ptr<DisplayResourceProvider> resource_provider_; std::unique_ptr<OverlayInfoRendererGL> renderer_; scoped_refptr<TestContextProvider> provider_; + scoped_refptr<TestContextProvider> child_provider_; + std::unique_ptr<LayerTreeResourceProvider> child_resource_provider_; MockOverlayScheduler scheduler_; }; @@ -2384,9 +2441,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateCandidateQuadAt(resource_provider_.get(), - pass->shared_quad_state_list.back(), pass.get(), - kOverlayBottomRightRect); + CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get(), kOverlayBottomRightRect); CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); CreateFullscreenOpaqueQuad(resource_provider_.get(), @@ -2428,9 +2485,9 @@ CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); RenderPassList pass_list; pass_list.push_back(std::move(pass)); @@ -2463,9 +2520,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); @@ -2497,9 +2554,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); CreateFullscreenOpaqueQuad(resource_provider_.get(), @@ -2528,9 +2585,9 @@ std::unique_ptr<RenderPass> pass = CreateRenderPass(); - CreateFullscreenCandidateQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), - pass.get()); + CreateFullscreenCandidateQuad( + resource_provider_.get(), child_resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); CreateFullscreenOpaqueQuad(resource_provider_.get(), pass->shared_quad_state_list.back(), pass.get()); @@ -2556,11 +2613,14 @@ renderer_->set_expect_overlays(true); viz::ResourceId resource1 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); viz::ResourceId resource2 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); viz::ResourceId resource3 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); std::unique_ptr<RenderPass> pass = CreateRenderPass(); RenderPassList pass_list; @@ -2694,11 +2754,14 @@ renderer_->set_expect_overlays(true); viz::ResourceId resource1 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); viz::ResourceId resource2 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); viz::ResourceId resource3 = - CreateResource(resource_provider_.get(), gfx::Size(32, 32), true); + CreateResource(resource_provider_.get(), child_resource_provider_.get(), + gfx::Size(32, 32), true); std::unique_ptr<RenderPass> pass = CreateRenderPass(); RenderPassList pass_list;
diff --git a/cc/output/vulkan_renderer.cc b/cc/output/vulkan_renderer.cc index dc917ed4..dcdb00a 100644 --- a/cc/output/vulkan_renderer.cc +++ b/cc/output/vulkan_renderer.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "cc/output/vulkan_renderer.h" +#include "cc/output/output_surface.h" #include "cc/output/output_surface_frame.h" namespace cc { @@ -15,9 +16,9 @@ output_surface_->SwapBuffers(std::move(output_frame)); } -VulkanRenderer::VulkanRenderer(const RendererSettings* settings, +VulkanRenderer::VulkanRenderer(const viz::RendererSettings* settings, OutputSurface* output_surface, - ResourceProvider* resource_provider, + DisplayResourceProvider* resource_provider, TextureMailboxDeleter* texture_mailbox_deleter, int highp_threshold_min) : DirectRenderer(settings, output_surface, resource_provider) {} @@ -26,12 +27,15 @@ NOTIMPLEMENTED(); } -void VulkanRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { +void VulkanRenderer::BindFramebufferToOutputSurface() { NOTIMPLEMENTED(); } -bool VulkanRenderer::BindFramebufferToTexture(DrawingFrame* frame, - const ScopedResource* resource) { +viz::ResourceFormat VulkanRenderer::BackbufferFormat() const { + return resource_provider_->best_texture_format(); +} + +bool VulkanRenderer::BindFramebufferToTexture(const ScopedResource* resource) { NOTIMPLEMENTED(); return false; } @@ -41,23 +45,25 @@ } void VulkanRenderer::PrepareSurfaceForPass( - DrawingFrame* frame, SurfaceInitializationMode initialization_mode, const gfx::Rect& render_pass_scissor) { NOTIMPLEMENTED(); } -void VulkanRenderer::DoDrawQuad(DrawingFrame* frame, - const viz::DrawQuad* quad, +void VulkanRenderer::SetEnableDCLayers(bool enable) { + NOTIMPLEMENTED(); +} + +void VulkanRenderer::DoDrawQuad(const DrawQuad* quad, const gfx::QuadF* clip_region) { NOTIMPLEMENTED(); } -void VulkanRenderer::BeginDrawingFrame(DrawingFrame* frame) { +void VulkanRenderer::BeginDrawingFrame() { NOTIMPLEMENTED(); } -void VulkanRenderer::FinishDrawingFrame(DrawingFrame* frame) { +void VulkanRenderer::FinishDrawingFrame() { NOTIMPLEMENTED(); } @@ -65,7 +71,7 @@ NOTIMPLEMENTED(); } -bool VulkanRenderer::FlippedFramebuffer(const DrawingFrame* frame) const { +bool VulkanRenderer::FlippedFramebuffer() const { NOTIMPLEMENTED(); return false; } @@ -79,7 +85,6 @@ } void VulkanRenderer::CopyDrawnRenderPass( - DrawingFrame* frame, std::unique_ptr<viz::CopyOutputRequest> request) { NOTIMPLEMENTED(); }
diff --git a/cc/output/vulkan_renderer.h b/cc/output/vulkan_renderer.h index 32b2cd9..e0d8917 100644 --- a/cc/output/vulkan_renderer.h +++ b/cc/output/vulkan_renderer.h
@@ -5,19 +5,20 @@ #ifndef CC_OUTPUT_VULKAN_RENDERER_H_ #define CC_OUTPUT_VULKAN_RENDERER_H_ -#include "cc/base/cc_export.h" +#include "cc/cc_export.h" #include "cc/output/direct_renderer.h" #include "ui/latency/latency_info.h" namespace cc { class TextureMailboxDeleter; +class OutputSurface; class CC_EXPORT VulkanRenderer : public DirectRenderer { public: - VulkanRenderer(const RendererSettings* settings, + VulkanRenderer(const viz::RendererSettings* settings, OutputSurface* output_surface, - ResourceProvider* resource_provider, + DisplayResourceProvider* resource_provider, TextureMailboxDeleter* texture_mailbox_deleter, int highp_threshold_min); ~VulkanRenderer() override; @@ -28,28 +29,25 @@ protected: // Implementations of protected Renderer functions. void DidChangeVisibility() override; + viz::ResourceFormat BackbufferFormat() const override; // Implementations of protected DirectRenderer functions. - void BindFramebufferToOutputSurface(DrawingFrame* frame) override; - bool BindFramebufferToTexture(DrawingFrame* frame, - const ScopedResource* resource) override; + void BindFramebufferToOutputSurface() override; + bool BindFramebufferToTexture(const ScopedResource* resource) override; void SetScissorTestRect(const gfx::Rect& scissor_rect) override; - void PrepareSurfaceForPass(DrawingFrame* frame, - SurfaceInitializationMode initialization_mode, + void PrepareSurfaceForPass(SurfaceInitializationMode initialization_mode, const gfx::Rect& render_pass_scissor) override; - void DoDrawQuad(DrawingFrame* frame, - const viz::DrawQuad* quad, - const gfx::QuadF* clip_region) override; - void BeginDrawingFrame(DrawingFrame* frame) override; - void FinishDrawingFrame(DrawingFrame* frame) override; + void DoDrawQuad(const DrawQuad* quad, const gfx::QuadF* clip_region) override; + void BeginDrawingFrame() override; + void FinishDrawingFrame() override; void FinishDrawingQuadList() override; - bool FlippedFramebuffer(const DrawingFrame* frame) const override; + bool FlippedFramebuffer() const override; void EnsureScissorTestEnabled() override; void EnsureScissorTestDisabled() override; void CopyDrawnRenderPass( - DrawingFrame* frame, std::unique_ptr<viz::CopyOutputRequest> request) override; bool CanPartialSwap() override; + void SetEnableDCLayers(bool enable) override; private: DISALLOW_COPY_AND_ASSIGN(VulkanRenderer);
diff --git a/cc/quads/draw_polygon_unittest.cc b/cc/quads/draw_polygon_unittest.cc index 870a867..41e3a6c 100644 --- a/cc/quads/draw_polygon_unittest.cc +++ b/cc/quads/draw_polygon_unittest.cc
@@ -2,17 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// We would like to use M_PI on windows too. -#ifdef _WIN32 -#define _USE_MATH_DEFINES -#endif - #include <stddef.h> #include <limits> #include <vector> #include "base/memory/ptr_util.h" +#include "base/numerics/math_constants.h" #include "base/stl_util.h" #include "cc/output/bsp_compare_result.h" #include "cc/quads/draw_polygon.h" @@ -160,10 +156,10 @@ std::vector<gfx::Point3F> vertices_c; std::vector<gfx::Point3F> vertices_d; for (int i = 0; i < 100; i++) { - vertices_c.push_back( - gfx::Point3F(cos(i * M_PI / 50), sin(i * M_PI / 50), 0.0f)); - vertices_d.push_back(gfx::Point3F(cos(i * M_PI / 50) + 99.0f, - sin(i * M_PI / 50) + 99.0f, 100.0f)); + const double step = i * base::kPiDouble / 50; + vertices_c.push_back(gfx::Point3F(cos(step), sin(step), 0.0f)); + vertices_d.push_back( + gfx::Point3F(cos(step) + 99.0f, sin(step) + 99.0f, 100.0f)); } CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_c, vertices_c, 3); EXPECT_NORMAL(polygon_c, 0.0f, 0.0f, 1.0f);
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc index 8b916de..ec0234a 100644 --- a/cc/tiles/tile_manager.cc +++ b/cc/tiles/tile_manager.cc
@@ -242,7 +242,7 @@ if (!dependency->HasCompleted()) { InsertNodeForDecodeTask(graph, dependency, use_foreground_category, priority); - graph->edges.push_back(TaskGraph::Edge(dependency, task)); + graph->edges.emplace_back(dependency, task); dependency_count = 1u; } } @@ -293,7 +293,7 @@ priority); } - graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); + graph->edges.emplace_back(decode_task, raster_task); } InsertNodeForTask( @@ -915,10 +915,10 @@ for (const auto* original_draw_image : images_in_tile) { DrawImage draw_image(*original_draw_image, tile->raster_transform().scale(), raster_color_space); + if (checker_image_tracker_.ShouldCheckerImage( draw_image, tree, tile->required_for_activation())) { - image_decode_queue->push_back(CheckerImageTracker::ImageDecodeRequest( - draw_image.paint_image(), decode_type)); + image_decode_queue->emplace_back(draw_image.paint_image(), decode_type); } } } @@ -978,16 +978,14 @@ if (tile->required_for_activation()) { required_for_activate_count++; - graph_.edges.push_back( - TaskGraph::Edge(task, required_for_activation_done_task.get())); + graph_.edges.emplace_back(task, required_for_activation_done_task.get()); } if (tile->required_for_draw()) { required_for_draw_count++; - graph_.edges.push_back( - TaskGraph::Edge(task, required_for_draw_done_task.get())); + graph_.edges.emplace_back(task, required_for_draw_done_task.get()); } all_count++; - graph_.edges.push_back(TaskGraph::Edge(task, all_done_task.get())); + graph_.edges.emplace_back(task, all_done_task.get()); // A tile should use a foreground task cateogry if it is either blocking // future compositing (required for draw or required for activation), or if @@ -1017,9 +1015,8 @@ // For checkered-images, send them to the decode service. for (auto& image : checkered_images) { - work_to_schedule.checker_image_decode_queue.push_back( - CheckerImageTracker::ImageDecodeRequest( - std::move(image), CheckerImageTracker::DecodeType::kPreDecode)); + work_to_schedule.checker_image_decode_queue.emplace_back( + std::move(image), CheckerImageTracker::DecodeType::kPreDecode); } } @@ -1043,7 +1040,7 @@ InsertNodeForDecodeTask(&graph_, task.get(), false, priority++); all_count++; - graph_.edges.push_back(TaskGraph::Edge(task.get(), all_done_task.get())); + graph_.edges.emplace_back(task.get(), all_done_task.get()); } // The old locked images tasks have to stay around until past the @@ -1148,9 +1145,8 @@ // skipping images for these tiles, we don't need to decode them since // they will not be required on the next active tree. if (prioritized_tile.should_decode_checkered_images_for_tile()) { - checker_image_decode_queue->push_back( - CheckerImageTracker::ImageDecodeRequest( - image, CheckerImageTracker::DecodeType::kRaster)); + checker_image_decode_queue->emplace_back( + image, CheckerImageTracker::DecodeType::kRaster); } } }
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index e1faf99..e4ba75e 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -1458,9 +1458,7 @@ gfx::ScrollOffset LayerTreeHost::GetScrollOffsetForAnimation( ElementId element_id) const { - Layer* layer = LayerByElementId(element_id); - DCHECK(layer); - return layer->ScrollOffsetForAnimation(); + return property_trees()->scroll_tree.current_scroll_offset(element_id); } void LayerTreeHost::QueueImageDecode(
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 61839e6..0d7c6f4 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -349,6 +349,7 @@ // UseLayerLists() is true, which also implies that Slimming Paint // v2 is enabled. PropertyTrees* property_trees() { return &property_trees_; } + const PropertyTrees* property_trees() const { return &property_trees_; } void SetNeedsDisplayOnAllLayers();
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 86d05b6..31a0e2e 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -4430,9 +4430,8 @@ gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( ElementId element_id) const { if (active_tree()) { - LayerImpl* layer = active_tree()->LayerByElementId(element_id); - if (layer) - return layer->ScrollOffsetForAnimation(); + return active_tree()->property_trees()->scroll_tree.current_scroll_offset( + element_id); } return gfx::ScrollOffset();
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 3ef88ede..36cfb9ae 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -754,6 +754,8 @@ break; } default: + EXPECT_GE(scroll_layer_->scroll_offset().x(), 10); + EXPECT_GE(scroll_layer_->scroll_offset().y(), 20); if (scroll_layer_->scroll_offset().x() > 10 && scroll_layer_->scroll_offset().y() > 20) EndTest(); @@ -975,8 +977,12 @@ void BeginMainFrame(const viz::BeginFrameArgs& args) override { switch (layer_tree_host()->SourceFrameNumber()) { case 0: + EXPECT_EQ(scroll_layer_->scroll_offset().x(), 100); + EXPECT_EQ(scroll_layer_->scroll_offset().y(), 200); break; case 1: { + EXPECT_GE(scroll_layer_->scroll_offset().x(), 100); + EXPECT_GE(scroll_layer_->scroll_offset().y(), 200); Animation* animation = player_child_->GetAnimation(TargetProperty::SCROLL_OFFSET); player_child_->RemoveAnimation(animation->id());
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 1be26cd..bf40cf9 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -167,6 +167,7 @@ // DCHECK(lifecycle().AllowsPropertyTreeAccess()); return &property_trees_; } + const PropertyTrees* property_trees() const { return &property_trees_; } void PushPropertyTreesTo(LayerTreeImpl* tree_impl); void PushPropertiesTo(LayerTreeImpl* tree_impl);
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc index 2d20af4..7d55388 100644 --- a/cc/trees/occlusion_tracker.cc +++ b/cc/trees/occlusion_tracker.cc
@@ -136,7 +136,7 @@ const RenderSurfaceImpl* new_occlusion_immune_ancestor = new_target_surface->nearest_occlusion_immune_ancestor(); - stack_.push_back(StackObject(new_target_surface)); + stack_.emplace_back(new_target_surface); // We copy the screen occlusion into the new RenderSurfaceImpl subtree, but we // never copy in the occlusion from inside the target, since we are looking
diff --git a/chrome/MAJOR_BRANCH_DATE b/chrome/MAJOR_BRANCH_DATE new file mode 100644 index 0000000..07d7ff7 --- /dev/null +++ b/chrome/MAJOR_BRANCH_DATE
@@ -0,0 +1 @@ +MAJOR_BRANCH_DATE=2017/08/31
diff --git a/chrome/VERSION b/chrome/VERSION index 79d37823..d6f44eae 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=63 MINOR=0 -BUILD=3215 +BUILD=3216 PATCH=0
diff --git a/chrome/android/java/res/menu/bottom_sheet_nav_menu.xml b/chrome/android/java/res/menu/bottom_sheet_nav_menu.xml index 36937c1a..d2b798feb 100644 --- a/chrome/android/java/res/menu/bottom_sheet_nav_menu.xml +++ b/chrome/android/java/res/menu/bottom_sheet_nav_menu.xml
@@ -6,14 +6,18 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/action_home" android:title="@string/accessibility_toolbar_btn_home" - android:icon="@drawable/ic_home_grey600_24dp" /> + android:icon="@drawable/ic_home_grey600_24dp" + android:contentDescription="@string/accessibility_toolbar_btn_home" /> <item android:id="@+id/action_downloads" android:title="@string/menu_downloads" - android:icon="@drawable/ic_file_download_white_24dp" /> + android:icon="@drawable/ic_file_download_white_24dp" + android:contentDescription="@string/menu_downloads" /> <item android:id="@+id/action_bookmarks" android:title="@string/menu_bookmarks" - android:icon="@drawable/btn_star_filled" /> + android:icon="@drawable/btn_star_filled" + android:contentDescription="@string/menu_bookmarks" /> <item android:id="@+id/action_history" android:title="@string/menu_history" - android:icon="@drawable/ic_watch_later_24dp" /> + android:icon="@drawable/ic_watch_later_24dp" + android:contentDescription="@string/menu_history" /> </menu> \ No newline at end of file
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 3079ce9..0e9a07af 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -119,6 +119,7 @@ import org.chromium.chrome.browser.vr_shell.VrShellDelegate; import org.chromium.chrome.browser.widget.ViewHighlighter; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; +import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetMetrics; import org.chromium.chrome.browser.widget.emptybackground.EmptyBackgroundViewWrapper; import org.chromium.chrome.browser.widget.textbubble.ViewAnchoredTextBubble; @@ -875,7 +876,7 @@ // Since reusing/creating a new NTP when using Chrome Home brings up the bottom // sheet, we need to record it in our metrics. bottomSheet.getBottomSheetMetrics().recordSheetOpenReason( - BottomSheetMetrics.OPENED_BY_STARTUP); + StateChangeReason.STARTUP); return true; } return false; @@ -920,9 +921,8 @@ private boolean maybeSetBottomSheetStateToHalfOnStartup(BottomSheet bottomSheet) { if (getTimeSinceLastBackgroundedMs() >= TIME_SINCE_BACKGROUNDED_TO_SHOW_BOTTOM_SHEET_HALF_MS) { - bottomSheet.getBottomSheetMetrics().recordSheetOpenReason( - BottomSheetMetrics.OPENED_BY_STARTUP); - bottomSheet.setSheetState(BottomSheet.SHEET_STATE_HALF, true); + bottomSheet.setSheetState( + BottomSheet.SHEET_STATE_HALF, true, StateChangeReason.STARTUP); return true; } return false;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuAdapter.java index 4014e1c..ad7b699 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuAdapter.java
@@ -371,6 +371,9 @@ animation.setStartDelay(startDelay); } else { animation.playTogether(ObjectAnimator.ofFloat(view, View.ALPHA, 0.f, 1.f)); + // Start delay is set to make sure disabling the animation in battery saver mode does + // not cause the view to stay at alpha 0 on Android O. + animation.setStartDelay(ENTER_ITEM_BASE_DELAY_MS); } animation.setDuration(ENTER_ITEM_DURATION_MS); animation.setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java index 008f9c4..1c6c4c99 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -7,6 +7,7 @@ import android.app.Activity; import android.app.Fragment; import android.os.Bundle; +import android.support.annotation.StringRes; import android.text.TextUtils; import org.chromium.base.ActivityState; @@ -523,7 +524,7 @@ } @Override - public void showInfoPage(int url) { + public void showInfoPage(@StringRes int url) { CustomTabActivity.showInfoPage( this, LocalizationUtils.substituteLocalePlaceholder(getString(url))); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java index 5f9bea9..3275053 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.firstrun; import android.os.Bundle; +import android.support.annotation.StringRes; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; @@ -164,7 +165,7 @@ * Show an informational web page. The page doesn't show navigation control. * @param url Resource id for the URL of the web page. */ - public void showInfoPage(int url) { + public void showInfoPage(@StringRes int url) { CustomTabActivity.showInfoPage( this, LocalizationUtils.substituteLocalePlaceholder(getString(url))); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSource.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSource.java index c62f3c8..26d4e15d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSource.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSource.java
@@ -22,6 +22,9 @@ public static final String AUTOJOIN_TAB_AND_ORIGIN_SCOPED = "tab_and_origin_scoped"; public static final String AUTOJOIN_ORIGIN_SCOPED = "origin_scoped"; public static final String AUTOJOIN_PAGE_SCOPED = "page_scoped"; + private static final List<String> AUTOJOIN_POLICIES = + Arrays.asList(AUTOJOIN_CUSTOM_CONTROLLER_SCOPED, AUTOJOIN_TAB_AND_ORIGIN_SCOPED, + AUTOJOIN_ORIGIN_SCOPED, AUTOJOIN_PAGE_SCOPED); private static final String CAST_SOURCE_ID_SEPARATOR = "/"; private static final String CAST_SOURCE_ID_APPLICATION_ID = "__castAppId__"; @@ -30,13 +33,28 @@ private static final String CAST_APP_CAPABILITIES_PREFIX = "("; private static final String CAST_APP_CAPABILITIES_SUFFIX = ")"; private static final String CAST_APP_CAPABILITIES_SEPARATOR = ","; - private static final String CAST_APP_CAPABILITIES[] = { - "video_out", - "audio_out", - "video_in", - "audio_in", - "multizone_group" - }; + private static final List<String> CAST_APP_CAPABILITIES = + Arrays.asList("video_out", "audio_out", "video_in", "audio_in", "multizone_group"); + + /** + * The protocol for Cast Presentation URLs. + */ + private static final String CAST_URL_PROTOCOL = "cast:"; + + /** + * The query parameter key for Cast Client ID in a Cast Presentation URL. + */ + private static final String CAST_URL_CLIENT_ID = "clientId"; + + /** + * The query parameter key for autojoin policy in a Cast Presentation URL. + */ + private static final String CAST_URL_AUTOJOIN_POLICY = "autoJoinPolicy"; + + /** + * The query parameter key for app capabilities in a Cast Presentation URL. + */ + private static final String CAST_URL_CAPABILITIES = "capabilities"; /** * The original presentation URL that the {@link MediaSource} object was created from. @@ -74,30 +92,8 @@ @Nullable public static MediaSource from(String sourceId) { assert sourceId != null; - - Uri sourceUri = Uri.parse(sourceId); - - String uriFragment = sourceUri.getFragment(); - if (uriFragment == null) return null; - - String[] parameters = uriFragment.split(CAST_SOURCE_ID_SEPARATOR); - - String applicationId = extractParameter(parameters, CAST_SOURCE_ID_APPLICATION_ID); - if (applicationId == null) return null; - - String[] capabilities = null; - int capabilitiesIndex = applicationId.indexOf(CAST_APP_CAPABILITIES_PREFIX); - if (capabilitiesIndex != -1) { - capabilities = extractCapabilities(applicationId.substring(capabilitiesIndex)); - if (capabilities == null) return null; - - applicationId = applicationId.substring(0, capabilitiesIndex); - } - - String clientId = extractParameter(parameters, CAST_SOURCE_ID_CLIENT_ID); - String autoJoinPolicy = extractParameter(parameters, CAST_SOURCE_ID_AUTOJOIN_POLICY); - - return new MediaSource(sourceId, applicationId, clientId, autoJoinPolicy, capabilities); + return sourceId.startsWith(CAST_URL_PROTOCOL) ? fromCastUrl(sourceId) + : fromLegacyUrl(sourceId); } /** @@ -186,15 +182,81 @@ return null; } - List<String> supportedCapabilities = Arrays.asList(CAST_APP_CAPABILITIES); - String capabilitiesList = capabilitiesParameter.substring( CAST_APP_CAPABILITIES_PREFIX.length(), capabilitiesParameter.length() - CAST_APP_CAPABILITIES_SUFFIX.length()); String[] capabilities = capabilitiesList.split(CAST_APP_CAPABILITIES_SEPARATOR); for (String capability : capabilities) { - if (!supportedCapabilities.contains(capability)) return null; + if (!CAST_APP_CAPABILITIES.contains(capability)) return null; } return capabilities; } + + /** + * Helper method to create a MediaSource object from a Cast (cast:) presentation URL. + * @param sourceId the source id for the Cast media source. + * @return an initialized media source if the uri is a valid Cast presentation URL, null + * otherwise. + */ + @Nullable + private static MediaSource fromCastUrl(String sourceId) { + // Strip the scheme as the Uri parser works better without it. + Uri sourceUri = Uri.parse(sourceId.substring(CAST_URL_PROTOCOL.length())); + String applicationId = sourceUri.getPath(); + if (applicationId == null) return null; + + String clientId = sourceUri.getQueryParameter(CAST_URL_CLIENT_ID); + String autoJoinPolicy = sourceUri.getQueryParameter(CAST_URL_AUTOJOIN_POLICY); + if (autoJoinPolicy != null && !AUTOJOIN_POLICIES.contains(autoJoinPolicy)) { + return null; + } + + String[] capabilities = null; + String capabilitiesParam = sourceUri.getQueryParameter(CAST_URL_CAPABILITIES); + if (capabilitiesParam != null) { + capabilities = capabilitiesParam.split(CAST_APP_CAPABILITIES_SEPARATOR); + for (String capability : capabilities) { + if (!CAST_APP_CAPABILITIES.contains(capability)) return null; + } + } + + return new MediaSource(sourceId, applicationId, clientId, autoJoinPolicy, capabilities); + } + + /** + * @deprecated Legacy Cast Presentation URLs are deprecated in favor of cast: URLs. + * TODO(crbug.com/757358): remove this method when we drop support for legacy URLs. + * Helper method to create a MediaSource object from a legacy (https:) presentation URL. + * @param sourceId the source id for the Cast media source. + * @return an initialized media source if the uri is a valid https presentation URL, null + * otherwise. + */ + @Deprecated + @Nullable + private static MediaSource fromLegacyUrl(String sourceId) { + Uri sourceUri = Uri.parse(sourceId); + String uriFragment = sourceUri.getFragment(); + if (uriFragment == null) return null; + + String[] parameters = uriFragment.split(CAST_SOURCE_ID_SEPARATOR); + + String applicationId = extractParameter(parameters, CAST_SOURCE_ID_APPLICATION_ID); + if (applicationId == null) return null; + + String[] capabilities = null; + int capabilitiesIndex = applicationId.indexOf(CAST_APP_CAPABILITIES_PREFIX); + if (capabilitiesIndex != -1) { + capabilities = extractCapabilities(applicationId.substring(capabilitiesIndex)); + if (capabilities == null) return null; + + applicationId = applicationId.substring(0, capabilitiesIndex); + } + + String clientId = extractParameter(parameters, CAST_SOURCE_ID_CLIENT_ID); + String autoJoinPolicy = extractParameter(parameters, CAST_SOURCE_ID_AUTOJOIN_POLICY); + if (autoJoinPolicy != null && !AUTOJOIN_POLICIES.contains(autoJoinPolicy)) { + return null; + } + return new MediaSource(sourceId, applicationId, clientId, autoJoinPolicy, capabilities); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NativePageFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NativePageFactory.java index ac108f9..0d06082 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NativePageFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NativePageFactory.java
@@ -22,7 +22,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; -import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetMetrics; +import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; import org.chromium.content_public.browser.LoadUrlParams; /** @@ -38,9 +38,7 @@ if (activity.getBottomSheet() != null) { BottomSheet sheet = activity.getBottomSheet(); sheet.getBottomSheetMetrics().recordNativeNewTabPageShown(); - sheet.getBottomSheetMetrics().recordSheetOpenReason( - BottomSheetMetrics.OPENED_BY_NEW_TAB_CREATION); - sheet.setSheetState(BottomSheet.SHEET_STATE_FULL, true); + sheet.setSheetState(BottomSheet.SHEET_STATE_FULL, true, StateChangeReason.NEW_TAB); return null; } else if (tab.isIncognito()) { return new IncognitoNewTabPage(activity);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index 4ba6405..94266a2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -405,19 +405,8 @@ String suggestionMatchUrl = updateSuggestionUrlIfNeeded(suggestionMatch, suggestionMatchPosition, skipOutOfBoundsCheck); - - - // It's important to use the page transition from the suggestion or we might end - // up saving generated URLs as typed URLs, which would then pollute the subsequent - // omnibox results. There is one special case where the suggestion text was pasted, - // where we want the transition type to be LINK. - int transition = suggestionMatch.getType() == OmniboxSuggestionType.URL_WHAT_YOU_TYPED - && mUrlBar.wasLastEditPaste() - ? PageTransition.LINK - : suggestionMatch.getTransition(); - - loadUrlFromOmniboxMatch(suggestionMatchUrl, transition, suggestionMatchPosition, - suggestionMatch.getType()); + loadUrlFromOmniboxMatch(suggestionMatchUrl, suggestionMatch.getTransition(), + suggestionMatchPosition, suggestionMatch.getType()); } } @@ -2193,6 +2182,26 @@ mUrlBar.getAutocompleteLength(), webContents); } + if (((transition & PageTransition.CORE_MASK) == PageTransition.TYPED) + && TextUtils.equals(url, mToolbarDataProvider.getCurrentUrl())) { + // When the user hit enter on the existing permanent URL, treat it like a + // reload for scoring purposes. We could detect this by just checking + // user_input_in_progress_, but it seems better to treat "edits" that end + // up leaving the URL unchanged (e.g. deleting the last character and then + // retyping it) as reloads too. We exclude non-TYPED transitions because if + // the transition is GENERATED, the user input something that looked + // different from the current URL, even if it wound up at the same place + // (e.g. manually retyping the same search query), and it seems wrong to + // treat this as a reload. + transition = PageTransition.RELOAD; + } else if (type == OmniboxSuggestionType.URL_WHAT_YOU_TYPED && mUrlBar.wasLastEditPaste()) { + // It's important to use the page transition from the suggestion or we might end + // up saving generated URLs as typed URLs, which would then pollute the subsequent + // omnibox results. There is one special case where the suggestion text was pasted, + // where we want the transition type to be LINK. + + transition = PageTransition.LINK; + } loadUrl(url, transition); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java index f4b27ce..8b37705f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java
@@ -14,9 +14,12 @@ import android.os.SystemClock; import org.chromium.base.Log; +import org.chromium.base.PathUtils; +import org.chromium.base.ThreadUtils; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; +import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import java.io.FileDescriptor; import java.io.IOException; @@ -42,6 +45,12 @@ @Override public void onCreate() { try { + // The decoder service relies on PathUtils. + ThreadUtils.runOnUiThreadBlocking(() -> { + PathUtils.setPrivateDataDirectorySuffix( + ChromeBrowserInitializer.PRIVATE_DATA_DIRECTORY_SUFFIX); + }); + LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).ensureInitialized(); nativeInitializePhotoPickerSandbox();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsCarousel.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsCarousel.java index 9c6c4ca..0cb7987 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsCarousel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsCarousel.java
@@ -11,8 +11,8 @@ import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; -import android.text.TextUtils; import android.view.ViewGroup; +import android.webkit.URLUtil; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; @@ -24,6 +24,7 @@ import org.chromium.chrome.browser.ntp.cards.OptionalLeaf; import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; +import org.chromium.chrome.browser.util.UrlUtilities; import org.chromium.chrome.browser.widget.displaystyle.UiConfig; import org.chromium.ui.widget.Toast; @@ -68,7 +69,7 @@ * was shown. */ public void refresh(final Context context, @Nullable final String newUrl) { - if (TextUtils.isEmpty(newUrl)) { + if (!URLUtil.isNetworkUrl(newUrl)) { clearSuggestions(); return; } @@ -80,7 +81,7 @@ mWasScrolledSinceShown = false; // Do nothing if there are already suggestions in the carousel for the new context. - if (TextUtils.equals(newUrl, mCurrentContextUrl)) return; + if (UrlUtilities.urlsMatchIgnoringFragments(newUrl, mCurrentContextUrl)) return; String text = "Fetching contextual suggestions..."; Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java index 3b4f991..71c9cc7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java
@@ -42,7 +42,6 @@ import org.chromium.chrome.browser.widget.ToolbarProgressBar; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; -import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetMetrics; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetObserver; import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver; import org.chromium.ui.UiUtils; @@ -477,14 +476,8 @@ if (mBottomSheet == null || !hasFocus) return; - boolean wasSheetOpen = mBottomSheet.isSheetOpen(); mBottomSheet.setSheetState( BottomSheet.SHEET_STATE_FULL, true, StateChangeReason.OMNIBOX_FOCUS); - - if (!wasSheetOpen) { - mBottomSheet.getBottomSheetMetrics().recordSheetOpenReason( - BottomSheetMetrics.OPENED_BY_OMNIBOX_FOCUS); - } } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewHighlighter.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewHighlighter.java index cff38f3..867a4355 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewHighlighter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewHighlighter.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.widget; import android.content.res.Resources; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.view.View; @@ -27,6 +28,31 @@ public static final int IPH_MIN_DELAY_BETWEEN_TWO_HIGHLIGHTS = 200; /** + * Gets a Rect that contains the View's padding values. + * + * @param view The View whose padding we're requesting. + * @return A Rect containing all the padding values in px. + */ + private static Rect getPaddingRect(View view) { + int paddingBottom = view.getPaddingBottom(); + int paddingTop = view.getPaddingTop(); + int paddingLeft = view.getPaddingLeft(); + int paddingRight = view.getPaddingRight(); + return new Rect(paddingLeft, paddingTop, paddingRight, paddingBottom); + } + + /** + * Sets the padding for the View based on a Rect containing the padding values. This is + * currently necessary for Jelly Bean devices. + * + * @param view The View whose padding we're setting. + * @param padding The Rect containing the padding values in px. + */ + private static void setPaddingRect(View view, Rect padding) { + view.setPadding(padding.left, padding.top, padding.right, padding.bottom); + } + + /** * Create a highlight layer over the view. * @param view The view to be highlighted. * @param circular Whether the highlight should be a circle or rectangle. @@ -34,6 +60,7 @@ public static void turnOnHighlight(View view, boolean circular) { if (view == null) return; + Rect padding = getPaddingRect(view); boolean highlighted = view.getTag(R.id.highlight_state) != null ? (boolean) view.getTag(R.id.highlight_state) : false; @@ -54,6 +81,8 @@ : new Drawable[] {background, pulseDrawable}); view.setBackground(drawable); view.setTag(R.id.highlight_state, true); + setPaddingRect(view, padding); + pulseDrawable.start(); } @@ -64,6 +93,7 @@ public static void turnOffHighlight(View view) { if (view == null) return; + Rect padding = getPaddingRect(view); boolean highlighted = view.getTag(R.id.highlight_state) != null ? (boolean) view.getTag(R.id.highlight_state) : false; @@ -81,5 +111,6 @@ view.setBackground(null); } } + setPaddingRect(view, padding); } } \ No newline at end of file
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 2cb0aa1..bfec104 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
@@ -102,11 +102,21 @@ public static final int SHEET_STATE_SCROLLING = 3; /** The different reasons that the sheet's state can change. */ - @IntDef({StateChangeReason.NONE, StateChangeReason.OMNIBOX_FOCUS}) + @IntDef({StateChangeReason.NONE, StateChangeReason.OMNIBOX_FOCUS, StateChangeReason.SWIPE, + StateChangeReason.NEW_TAB, StateChangeReason.EXPAND_BUTTON, StateChangeReason.STARTUP, + StateChangeReason.BACK_PRESS, StateChangeReason.TAP_SCRIM, + StateChangeReason.NAVIGATION}) @Retention(RetentionPolicy.SOURCE) public @interface StateChangeReason { int NONE = 0; int OMNIBOX_FOCUS = 1; + int SWIPE = 2; + int NEW_TAB = 3; + int EXPAND_BUTTON = 4; + int STARTUP = 5; + int BACK_PRESS = 6; + int TAP_SCRIM = 7; + int NAVIGATION = 8; } /** @@ -381,13 +391,9 @@ if (currentShownRatio <= getPeekRatio() && distanceY < 0) return false; float newOffset = getSheetOffsetFromBottom() + distanceY; - boolean wasOpenBeforeSwipe = mIsSheetOpen; setSheetOffsetFromBottom(MathUtils.clamp(newOffset, getMinOffset(), getMaxOffset())); - setInternalCurrentState(SHEET_STATE_SCROLLING, StateChangeReason.NONE); - if (!wasOpenBeforeSwipe && mIsSheetOpen) { - mMetrics.recordSheetOpenReason(BottomSheetMetrics.OPENED_BY_SWIPE); - } + setInternalCurrentState(SHEET_STATE_SCROLLING, StateChangeReason.SWIPE); mIsScrolling = true; return true; @@ -398,7 +404,6 @@ if (!isTouchInSwipableXRange(e2) || !mIsScrolling) return false; cancelAnimation(); - boolean wasOpenBeforeSwipe = mIsSheetOpen; // Figure out the projected state of the sheet and animate there. Note that a swipe up // will have a negative velocity, swipe down will have a positive velocity. Negate this @@ -412,10 +417,6 @@ setSheetState(targetState, true); mIsScrolling = false; - if (!wasOpenBeforeSwipe && mIsSheetOpen) { - mMetrics.recordSheetOpenReason(BottomSheetMetrics.OPENED_BY_SWIPE); - } - return true; } } @@ -567,8 +568,7 @@ * A notification that the "expand" button for the bottom sheet has been pressed. */ public void onExpandButtonPressed() { - mMetrics.recordSheetOpenReason(BottomSheetMetrics.OPENED_BY_EXPAND_BUTTON); - setSheetState(BottomSheet.SHEET_STATE_HALF, true); + setSheetState(BottomSheet.SHEET_STATE_HALF, true, StateChangeReason.EXPAND_BUTTON); } /** Immediately end all animations and null the animators. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetMetrics.java index 92fd1f0..a45f0e5f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetMetrics.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetMetrics.java
@@ -9,6 +9,7 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent; +import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -25,12 +26,12 @@ @IntDef({OPENED_BY_SWIPE, OPENED_BY_OMNIBOX_FOCUS, OPENED_BY_NEW_TAB_CREATION, OPENED_BY_EXPAND_BUTTON, OPENED_BY_STARTUP}) @Retention(RetentionPolicy.SOURCE) - public @interface SheetOpenReason {} - public static final int OPENED_BY_SWIPE = 0; - public static final int OPENED_BY_OMNIBOX_FOCUS = 1; - public static final int OPENED_BY_NEW_TAB_CREATION = 2; - public static final int OPENED_BY_EXPAND_BUTTON = 3; - public static final int OPENED_BY_STARTUP = 4; + private @interface SheetOpenReason {} + private static final int OPENED_BY_SWIPE = 0; + private static final int OPENED_BY_OMNIBOX_FOCUS = 1; + private static final int OPENED_BY_NEW_TAB_CREATION = 2; + private static final int OPENED_BY_EXPAND_BUTTON = 3; + private static final int OPENED_BY_STARTUP = 4; private static final int OPENED_BY_BOUNDARY = 5; /** The different ways that the bottom sheet can be closed. */ @@ -84,6 +85,8 @@ "Android.ChromeHome.TimeBetweenCloseAndNextOpen", mLastOpenTime - mLastCloseTime, TimeUnit.MILLISECONDS); } + + recordSheetOpenReason(reason); } @Override @@ -145,37 +148,48 @@ /** * Records the reason the sheet was opened. - * @param reason The {@link SheetOpenReason} that caused the bottom sheet to open. + * @param reason The {@link StateChangeReason} that caused the bottom sheet to open. */ - public void recordSheetOpenReason(@SheetOpenReason int reason) { + public void recordSheetOpenReason(@StateChangeReason int reason) { + @SheetOpenReason + int metricsReason = OPENED_BY_SWIPE; switch (reason) { - case OPENED_BY_SWIPE: + case StateChangeReason.SWIPE: + metricsReason = OPENED_BY_SWIPE; RecordUserAction.record("Android.ChromeHome.OpenedBySwipe"); break; - case OPENED_BY_OMNIBOX_FOCUS: + case StateChangeReason.OMNIBOX_FOCUS: + metricsReason = OPENED_BY_OMNIBOX_FOCUS; RecordUserAction.record("Android.ChromeHome.OpenedByOmnibox"); break; - case OPENED_BY_NEW_TAB_CREATION: + case StateChangeReason.NEW_TAB: + metricsReason = OPENED_BY_NEW_TAB_CREATION; RecordUserAction.record("Android.ChromeHome.OpenedByNTP"); break; - case OPENED_BY_EXPAND_BUTTON: + case StateChangeReason.EXPAND_BUTTON: + metricsReason = OPENED_BY_EXPAND_BUTTON; RecordUserAction.record("Android.ChromeHome.OpenedByExpandButton"); break; - case OPENED_BY_STARTUP: + case StateChangeReason.STARTUP: + metricsReason = OPENED_BY_STARTUP; RecordUserAction.record("Android.ChromeHome.OpenedByStartup"); break; + case StateChangeReason.NONE: + // Intentionally empty. + break; default: assert false; } + RecordHistogram.recordEnumeratedHistogram( - "Android.ChromeHome.OpenReason", reason, OPENED_BY_BOUNDARY); + "Android.ChromeHome.OpenReason", metricsReason, OPENED_BY_BOUNDARY); } /** * Records the reason the sheet was closed. * @param reason The {@link SheetCloseReason} that cause the bottom sheet to close. */ - public void recordSheetCloseReason(@SheetCloseReason int reason) { + private void recordSheetCloseReason(@SheetCloseReason int reason) { switch (reason) { case CLOSED_BY_SWIPE: RecordUserAction.record("Android.ChromeHome.ClosedBySwipe");
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabController.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabController.java index 43198b3..5daee72 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabController.java
@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.toolbar.BottomToolbarPhone; import org.chromium.chrome.browser.util.FeatureUtilities; +import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason; import java.util.ArrayList; import java.util.List; @@ -157,9 +158,7 @@ ? BottomSheet.SHEET_STATE_FULL : BottomSheet.SHEET_STATE_HALF; if (mBottomSheet.getSheetState() != sheetState) { - mBottomSheet.setSheetState(sheetState, true); - mBottomSheet.getBottomSheetMetrics().recordSheetOpenReason( - BottomSheetMetrics.OPENED_BY_NEW_TAB_CREATION); + mBottomSheet.setSheetState(sheetState, true, StateChangeReason.NEW_TAB); } for (Observer observer : mObservers) observer.onNewTabShown();
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 936da9c0..11a3a936 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -1635,7 +1635,7 @@ "javatests/src/org/chromium/chrome/browser/permissions/GeolocationTest.java", "javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java", "javatests/src/org/chromium/chrome/browser/permissions/PermissionNavigationTest.java", - "javatests/src/org/chromium/chrome/browser/permissions/PermissionTestCaseBase.java", + "javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java", "javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java", "javatests/src/org/chromium/chrome/browser/preferences/NotificationsPreferencesTest.java", "javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java index 26278c0..6ede035 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
@@ -232,6 +232,7 @@ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=" + ChromeFeatureList.CCT_BACKGROUND_TAB}) + @RetryOnFailure public void testOnlyOneHiddenTab() throws Exception { Assert.assertTrue("Failed warmup()", mCustomTabsConnection.warmup(0)); CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/GeolocationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/GeolocationTest.java index 08f64a45..497ec88 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/GeolocationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/GeolocationTest.java
@@ -8,13 +8,22 @@ import android.support.test.filters.MediumTest; import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.RetryOnFailure; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.permissions.PermissionTestRule.PermissionUpdateWaiter; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil; +import org.chromium.content.browser.test.util.TouchCommon; import org.chromium.device.geolocation.LocationProviderFactory; import org.chromium.device.geolocation.MockLocationProvider; @@ -25,32 +34,36 @@ * - Global location is enabled. * - Google location is enabled. */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ + ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, +}) @RetryOnFailure -public class GeolocationTest extends PermissionTestCaseBase { - private static final String LOCATION_PROVIDER_MOCK = "locationProviderMock"; - private static final double LATITUDE = 51.01; - private static final double LONGITUDE = 0.23; - private static final float ACCURACY = 10; +public class GeolocationTest { + @Rule + public PermissionTestRule mPermissionRule = new PermissionTestRule(); + private static final String TEST_FILE = "/content/test/data/android/geolocation.html"; private static final String PERSIST_ACCEPT_HISTOGRAM = "Permissions.Prompt.Accepted.Persisted.Geolocation"; public GeolocationTest() {} - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { LocationSettingsTestUtil.setSystemLocationSettingEnabled(true); LocationProviderFactory.setLocationProviderImpl(new MockLocationProvider()); } private void runTest(String javascript, int nUpdates, boolean withGesture, boolean isDialog, boolean hasSwitch, boolean toggleSwitch) throws Exception { - Tab tab = getActivity().getActivityTab(); - PermissionUpdateWaiter updateWaiter = new PermissionUpdateWaiter("Count:"); + Tab tab = mPermissionRule.getActivity().getActivityTab(); + PermissionUpdateWaiter updateWaiter = + new PermissionUpdateWaiter("Count:", mPermissionRule.getActivity()); tab.addObserver(updateWaiter); - runAllowTest(updateWaiter, TEST_FILE, javascript, nUpdates, withGesture, isDialog, - hasSwitch, toggleSwitch); + mPermissionRule.runAllowTest(updateWaiter, TEST_FILE, javascript, nUpdates, withGesture, + isDialog, hasSwitch, toggleSwitch); tab.removeObserver(updateWaiter); if (hasSwitch) { int bucket = toggleSwitch ? 0 : 1; @@ -64,8 +77,9 @@ * Verify Geolocation creates an InfoBar and receives a mock location. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("disable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("disable-features=" + PermissionTestRule.MODAL_FLAG) @Feature({"Location", "Main"}) public void testGeolocationPlumbingAllowedInfoBar() throws Exception { runTest("initiate_getCurrentPosition()", 1, false, false, false, false); @@ -75,8 +89,9 @@ * Verify Geolocation creates a dialog and receives a mock location. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("enable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_FLAG) @Feature({"Location", "Main"}) public void testGeolocationPlumbingAllowedDialog() throws Exception { runTest("initiate_getCurrentPosition()", 1, true, true, false, false); @@ -87,8 +102,9 @@ * enabled and there is no user gesture. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("enable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_FLAG) @Feature({"Location", "Main"}) public void testGeolocationPlumbingAllowedDialogNoGesture() throws Exception { runTest("initiate_getCurrentPosition()", 1, false, true, false, false); @@ -98,8 +114,9 @@ * Verify Geolocation creates an InfoBar and receives multiple locations. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("disable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("disable-features=" + PermissionTestRule.MODAL_FLAG) @Feature({"Location"}) public void testGeolocationWatchInfoBar() throws Exception { runTest("initiate_watchPosition()", 2, false, false, false, false); @@ -109,8 +126,9 @@ * Verify Geolocation creates a dialog and receives multiple locations. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("enable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_FLAG) @Feature({"Location"}) public void testGeolocationWatchDialog() throws Exception { runTest("initiate_watchPosition()", 2, true, true, false, false); @@ -121,8 +139,10 @@ * Check the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({"enable-features=" + TOGGLE_FLAG, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({"enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"Location"}) public void testGeolocationPersistenceAllowedInfoBar() throws Exception { runTest("initiate_getCurrentPosition()", 1, false, false, true, false); @@ -133,8 +153,9 @@ * Check the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("enable-features=" + MODAL_TOGGLE_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG) @Feature({"Location"}) public void testGeolocationPersistenceAllowedDialog() throws Exception { runTest("initiate_getCurrentPosition()", 1, true, true, true, false); @@ -145,23 +166,26 @@ * Check the switch toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({"enable-features=" + TOGGLE_FLAG, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({"enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"Location"}) public void testGeolocationPersistenceOffAllowedInfoBar() throws Exception { - Tab tab = getActivity().getActivityTab(); - PermissionUpdateWaiter updateWaiter = new PermissionUpdateWaiter("Count:"); + Tab tab = mPermissionRule.getActivity().getActivityTab(); + PermissionUpdateWaiter updateWaiter = + new PermissionUpdateWaiter("Count:", mPermissionRule.getActivity()); tab.addObserver(updateWaiter); - runAllowTest(updateWaiter, TEST_FILE, "initiate_getCurrentPosition()", 1, false, false, - true, true); + mPermissionRule.runAllowTest(updateWaiter, TEST_FILE, "initiate_getCurrentPosition()", 1, + false, false, true, true); // Ask for permission again and make sure it doesn't prompt again (grant is cached in the // Blink layer). - runJavaScriptCodeInCurrentTab("initiate_getCurrentPosition()"); + mPermissionRule.runJavaScriptCodeInCurrentTab("initiate_getCurrentPosition()"); updateWaiter.waitForNumUpdates(2); // Ask for permission a third time and make sure it doesn't prompt again. - runJavaScriptCodeInCurrentTab("initiate_getCurrentPosition()"); + mPermissionRule.runJavaScriptCodeInCurrentTab("initiate_getCurrentPosition()"); updateWaiter.waitForNumUpdates(3); tab.removeObserver(updateWaiter); @@ -172,23 +196,25 @@ * Check the switch toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add("enable-features=" + MODAL_TOGGLE_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG) @Feature({"Location"}) public void testGeolocationPersistenceOffAllowedDialog() throws Exception { - Tab tab = getActivity().getActivityTab(); - PermissionUpdateWaiter updateWaiter = new PermissionUpdateWaiter("Count:"); + Tab tab = mPermissionRule.getActivity().getActivityTab(); + PermissionUpdateWaiter updateWaiter = + new PermissionUpdateWaiter("Count:", mPermissionRule.getActivity()); tab.addObserver(updateWaiter); - runAllowTest(updateWaiter, TEST_FILE, "initiate_getCurrentPosition()", 1, true, true, true, - true); + mPermissionRule.runAllowTest(updateWaiter, TEST_FILE, "initiate_getCurrentPosition()", 1, + true, true, true, true); // Ask for permission again and make sure it doesn't prompt again (grant is cached in the // Blink layer). - singleClickView(getActivity().getActivityTab().getView()); + TouchCommon.singleClickView(mPermissionRule.getActivity().getActivityTab().getView()); updateWaiter.waitForNumUpdates(2); // Ask for permission a third time and make sure it doesn't prompt again. - singleClickView(getActivity().getActivityTab().getView()); + TouchCommon.singleClickView(mPermissionRule.getActivity().getActivityTab().getView()); updateWaiter.waitForNumUpdates(3); tab.removeObserver(updateWaiter); @@ -199,8 +225,10 @@ * that feature is enabled. Use an infobar. * @throws Exception */ + @Test @LargeTest - @CommandLineFlags.Add({"enable-features=" + TOGGLE_FLAG, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({"enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"Location"}) public void testGeolocationWatchPersistenceOffAllowedInfoBar() throws Exception { runTest("initiate_watchPosition()", 2, false, false, true, true); @@ -211,8 +239,9 @@ * that feature is enabled. Use a dialog. * @throws Exception */ + @Test @LargeTest - @CommandLineFlags.Add("enable-features=" + MODAL_TOGGLE_FLAG) + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG) @Feature({"Location"}) public void testGeolocationWatchPersistenceOffAllowedDialog() throws Exception { runTest("initiate_watchPosition()", 2, true, true, true, true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java index ca6458b..520355d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java
@@ -6,17 +6,33 @@ import android.support.test.filters.MediumTest; +import org.junit.Rule; +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.RetryOnFailure; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.permissions.PermissionTestRule.PermissionUpdateWaiter; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content.common.ContentSwitches; /** * Test suite for media permissions requests. */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ + ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, +}) @RetryOnFailure -public class MediaTest extends PermissionTestCaseBase { +public class MediaTest { + @Rule + public PermissionTestRule mPermissionRule = new PermissionTestRule(); + private static final String FAKE_DEVICE = ContentSwitches.USE_FAKE_DEVICE_FOR_MEDIA_STREAM; private static final String TEST_FILE = "/content/test/data/android/media_permissions.html"; @@ -25,11 +41,12 @@ private void testMediaPermissionsPlumbing(String prefix, String script, int numUpdates, boolean withGesture, boolean isDialog, boolean hasSwitch, boolean toggleSwitch) throws Exception { - Tab tab = getActivity().getActivityTab(); - PermissionUpdateWaiter updateWaiter = new PermissionUpdateWaiter(prefix); + Tab tab = mPermissionRule.getActivity().getActivityTab(); + PermissionUpdateWaiter updateWaiter = + new PermissionUpdateWaiter(prefix, mPermissionRule.getActivity()); tab.addObserver(updateWaiter); - runAllowTest(updateWaiter, TEST_FILE, script, numUpdates, withGesture, isDialog, hasSwitch, - toggleSwitch); + mPermissionRule.runAllowTest(updateWaiter, TEST_FILE, script, numUpdates, withGesture, + isDialog, hasSwitch, toggleSwitch); tab.removeObserver(updateWaiter); } @@ -37,9 +54,10 @@ * Verify asking for microphone creates an InfoBar and works when the permission is granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + PermissionTestRule.MODAL_FLAG}) public void testMicrophonePermissionsPlumbingInfoBar() throws Exception { testMediaPermissionsPlumbing( "Mic count:", "initiate_getMicrophone()", 1, false, false, false, false); @@ -49,9 +67,10 @@ * Verify asking for microphone creates a dialog and works when the permission is granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_FLAG}) public void testMicrophoneMediaPermissionsPlumbingDialog() throws Exception { testMediaPermissionsPlumbing( "Mic count:", "initiate_getMicrophone()", 1, true, true, false, false); @@ -61,9 +80,10 @@ * Verify asking for camera creates an InfoBar and works when the permission is granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + PermissionTestRule.MODAL_FLAG}) public void testCameraPermissionsPlumbingInfoBar() throws Exception { testMediaPermissionsPlumbing( "Camera count:", "initiate_getCamera()", 1, false, false, false, false); @@ -74,9 +94,10 @@ * and works when the permission is granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_FLAG}) public void testCameraPermissionsPlumbingDialog() throws Exception { testMediaPermissionsPlumbing( "Camera count:", "initiate_getCamera()", 1, false, true, false, false); @@ -87,9 +108,10 @@ * permissions are granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "disable-features=" + PermissionTestRule.MODAL_FLAG}) public void testCombinedPermissionsPlumbing() throws Exception { testMediaPermissionsPlumbing( "Combined count:", "initiate_getCombined()", 1, false, false, false, false); @@ -100,9 +122,10 @@ * permissions are granted. * @throws Exception */ + @Test @MediumTest @Feature({"MediaPermissions", "Main"}) - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_FLAG}) public void testCombinedPermissionsPlumbingDialog() throws Exception { testMediaPermissionsPlumbing( "Combined count:", "initiate_getCombined()", 1, true, true, false, false); @@ -113,11 +136,10 @@ * Check the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testMicrophonePersistenceOnInfoBar() throws Exception { testMediaPermissionsPlumbing( @@ -129,11 +151,10 @@ * Check the switch appears and that permission is granted with it toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testMicrophonePersistenceOffInfoBar() throws Exception { testMediaPermissionsPlumbing( @@ -145,8 +166,9 @@ * Check the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG}) @Feature({"MediaPermissions"}) public void testMicrophonePersistenceOnDialog() throws Exception { testMediaPermissionsPlumbing( @@ -158,8 +180,9 @@ * Check the switch appears and that permission is granted with it toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG}) @Feature({"MediaPermissions"}) public void testMicrophonePersistenceOffDialog() throws Exception { testMediaPermissionsPlumbing( @@ -171,11 +194,10 @@ * switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testCameraPersistenceOn() throws Exception { testMediaPermissionsPlumbing( @@ -187,11 +209,10 @@ * switch appears and that permission is granted with it toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testCameraPersistenceOff() throws Exception { testMediaPermissionsPlumbing( @@ -203,11 +224,10 @@ * Check the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testCombinedPersistenceOnInfoBar() throws Exception { testMediaPermissionsPlumbing( @@ -219,11 +239,10 @@ * Check the switch appears and that permission is granted with it toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({ - FAKE_DEVICE, - "enable-features=" + TOGGLE_FLAG, - "disable-features=" + MODAL_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.TOGGLE_FLAG, + "disable-features=" + PermissionTestRule.MODAL_FLAG}) @Feature({"MediaPermissions"}) public void testCombinedPersistenceOffInfoBar() throws Exception { testMediaPermissionsPlumbing( @@ -235,8 +254,9 @@ * the switch appears and that permission is granted with it toggled on. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG}) @Feature({"MediaPermissions"}) public void testCombinedPersistenceOnDialog() throws Exception { testMediaPermissionsPlumbing( @@ -248,8 +268,9 @@ * the switch appears and that permission is granted with it toggled off. * @throws Exception */ + @Test @MediumTest - @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG}) + @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + PermissionTestRule.MODAL_TOGGLE_FLAG}) @Feature({"MediaPermissions"}) public void testCombinedPersistenceOffDialog() throws Exception { testMediaPermissionsPlumbing(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionNavigationTest.java index a03bffa..2cbe130 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionNavigationTest.java
@@ -4,19 +4,35 @@ package org.chromium.chrome.browser.permissions; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.RetryOnFailure; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.permissions.PermissionTestRule.DialogShownCriteria; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content.browser.test.util.CriteriaHelper; /** * Test suite for interaction between permissions requests and navigation. */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ + ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, +}) @RetryOnFailure -public class PermissionNavigationTest extends PermissionTestCaseBase { +public class PermissionNavigationTest { + @Rule + public PermissionTestRule mPermissionRule = new PermissionTestRule(); + private static final String TEST_FILE = "/content/test/data/android/permission_navigation.html"; public PermissionNavigationTest() {} @@ -29,18 +45,19 @@ */ // @MediumTest // @Feature({"Permissions"}) - @CommandLineFlags.Add("enable-features=" + MODAL_FLAG) + @Test + @CommandLineFlags.Add("enable-features=" + PermissionTestRule.MODAL_FLAG) // Flaky on official bots, https://crbug.com/699851#c8 @DisabledTest public void testNavigationDismissesModalPermissionPrompt() throws Exception { - setUpUrl(TEST_FILE); - runJavaScriptCodeInCurrentTab("requestGeolocationPermission()"); + mPermissionRule.setUpUrl(TEST_FILE); + mPermissionRule.runJavaScriptCodeInCurrentTab("requestGeolocationPermission()"); DialogShownCriteria criteriaShown = new DialogShownCriteria("Dialog not shown", true); CriteriaHelper.pollUiThread(criteriaShown); - runJavaScriptCodeInCurrentTab("navigate()"); + mPermissionRule.runJavaScriptCodeInCurrentTab("navigate()"); - Tab tab = getActivity().getActivityTab(); + Tab tab = mPermissionRule.getActivity().getActivityTab(); final CallbackHelper callbackHelper = new CallbackHelper(); EmptyTabObserver navigationWaiter = new EmptyTabObserver() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestCaseBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java similarity index 78% rename from chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestCaseBase.java rename to chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java index 18070ad1..f93b8e2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestCaseBase.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/PermissionTestRule.java
@@ -1,13 +1,18 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// 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.permissions; import android.content.DialogInterface; +import android.support.test.InstrumentationRegistry; import android.support.v7.app.AlertDialog; import android.support.v7.widget.SwitchCompat; +import org.junit.Assert; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.chrome.R; @@ -17,18 +22,19 @@ import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestCaseBase; +import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; +import org.chromium.content.browser.test.util.TouchCommon; import org.chromium.net.test.EmbeddedTestServer; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; /** - * Test case base for permissions UI testing on Android. + * TestRule for permissions UI testing on Android. * * This class allows for easy testing of permissions infobar and dialog prompts. Writing a test * simply requires a HTML file containing JavaScript methods which trigger a permission prompt. The @@ -44,11 +50,11 @@ * a persistence toggle is expected, whether it should be explicitly toggled, whether to trigger the * JS call with a gesture, and whether an infobar or a dialog is expected. */ -public class PermissionTestCaseBase extends ChromeActivityTestCaseBase<ChromeActivity> { - protected static final String MODAL_FLAG = ChromeFeatureList.MODAL_PERMISSION_PROMPTS; - protected static final String TOGGLE_FLAG = "DisplayPersistenceToggleInPermissionPrompts"; - protected static final String MODAL_TOGGLE_FLAG = MODAL_FLAG + "," + TOGGLE_FLAG; - protected static final String PERMISSION_REQUEST_MANAGER_FLAG = "UseGroupedPermissionInfobars"; +public class PermissionTestRule extends ChromeActivityTestRule<ChromeActivity> { + public static final String MODAL_FLAG = ChromeFeatureList.MODAL_PERMISSION_PROMPTS; + public static final String TOGGLE_FLAG = "DisplayPersistenceToggleInPermissionPrompts"; + public static final String MODAL_TOGGLE_FLAG = MODAL_FLAG + "," + TOGGLE_FLAG; + public static final String PERMISSION_REQUEST_MANAGER_FLAG = "UseGroupedPermissionInfobars"; private InfoBarTestAnimationListener mListener; private EmbeddedTestServer mTestServer; @@ -57,20 +63,22 @@ * Waits till a JavaScript callback which updates the page title is called the specified number * of times. The page title is expected to be of the form <prefix>: <count>. */ - protected class PermissionUpdateWaiter extends EmptyTabObserver { + protected static class PermissionUpdateWaiter extends EmptyTabObserver { private CallbackHelper mCallbackHelper; private String mPrefix; private int mExpectedCount; + private final ChromeActivity mActivity; - public PermissionUpdateWaiter(String prefix) { + public PermissionUpdateWaiter(String prefix, ChromeActivity activity) { mCallbackHelper = new CallbackHelper(); mPrefix = prefix; + mActivity = activity; } @Override public void onTitleUpdated(Tab tab) { String expectedTitle = mPrefix + mExpectedCount; - if (getActivity().getActivityTab().getTitle().equals(expectedTitle)) { + if (mActivity.getActivityTab().getTitle().equals(expectedTitle)) { mCallbackHelper.notifyCalled(); } } @@ -81,6 +89,18 @@ } } + @Override + public Statement apply(final Statement base, Description desc) { + return super.apply(new Statement() { + @Override + public void evaluate() throws Throwable { + ruleSetUp(); + base.evaluate(); + ruleTearDown(); + } + }, desc); + } + /** * Criteria class to detect whether the permission dialog is shown. */ @@ -114,24 +134,23 @@ } } - public PermissionTestCaseBase() { + public PermissionTestRule() { super(ChromeActivity.class); } - @Override - protected void setUp() throws Exception { - super.setUp(); + private void ruleSetUp() throws Throwable { + startMainActivityOnBlankPage(); InfoBarContainer container = getActivity().getTabModelSelector().getCurrentTab().getInfoBarContainer(); mListener = new InfoBarTestAnimationListener(); container.addAnimationListener(mListener); - mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext()); + // TODO(yolandyan): refactor to use EmbeddedTestServerRule + mTestServer = EmbeddedTestServer.createAndStartServer( + InstrumentationRegistry.getInstrumentation().getContext()); } - @Override - protected void tearDown() throws Exception { + private void ruleTearDown() throws Exception { mTestServer.stopAndDestroyServer(); - super.tearDown(); } protected void setUpUrl(final String url) throws InterruptedException { @@ -164,14 +183,14 @@ * @param toggleSwitch True if we should toggle the switch off, false otherwise. * @throws Exception */ - protected void runAllowTest(PermissionUpdateWaiter updateWaiter, final String url, + public void runAllowTest(PermissionUpdateWaiter updateWaiter, final String url, String javascript, int nUpdates, boolean withGesture, boolean isDialog, boolean hasSwitch, boolean toggleSwitch) throws Exception { setUpUrl(url); if (withGesture) { runJavaScriptCodeInCurrentTab("functionToRun = '" + javascript + "'"); - singleClickView(getActivity().getActivityTab().getView()); + TouchCommon.singleClickView(getActivity().getActivityTab().getView()); } else { runJavaScriptCodeInCurrentTab(javascript); } @@ -195,7 +214,7 @@ boolean allow, boolean hasSwitch, boolean toggleSwitch) throws Exception { mListener.addInfoBarAnimationFinished("InfoBar not added."); InfoBar infobar = getInfoBars().get(0); - assertNotNull(infobar); + Assert.assertNotNull(infobar); if (hasSwitch) { SwitchCompat persistSwitch = (SwitchCompat) infobar.getView().findViewById( @@ -204,9 +223,10 @@ } if (allow) { - assertTrue("Allow button wasn't found", InfoBarUtil.clickPrimaryButton(infobar)); + Assert.assertTrue("Allow button wasn't found", InfoBarUtil.clickPrimaryButton(infobar)); } else { - assertTrue("Block button wasn't found", InfoBarUtil.clickSecondaryButton(infobar)); + Assert.assertTrue( + "Block button wasn't found", InfoBarUtil.clickSecondaryButton(infobar)); } updateWaiter.waitForNumUpdates(nUpdates); } @@ -234,8 +254,8 @@ } private void checkAndToggleSwitch(final SwitchCompat persistSwitch, boolean toggleSwitch) { - assertNotNull(persistSwitch); - assertTrue(persistSwitch.isChecked()); + Assert.assertNotNull(persistSwitch); + Assert.assertTrue(persistSwitch.isChecked()); if (toggleSwitch) { ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override @@ -245,9 +265,4 @@ }); } } - - @Override - public void startMainActivity() throws InterruptedException { - startMainActivityOnBlankPage(); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java index faf03392..bd174b3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java
@@ -6,27 +6,44 @@ import android.support.test.filters.MediumTest; +import org.junit.Rule; +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.RetryOnFailure; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.permissions.PermissionTestRule.PermissionUpdateWaiter; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; /** * Test suite for quota permissions requests. */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ + ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, +}) @RetryOnFailure -public class QuotaTest extends PermissionTestCaseBase { +public class QuotaTest { + @Rule + public PermissionTestRule mPermissionRule = new PermissionTestRule(); + private static final String TEST_FILE = "/content/test/data/android/quota_permissions.html"; public QuotaTest() {} private void testQuotaPermissionsPlumbing(String script, int numUpdates, boolean withGesture, boolean isDialog, boolean hasSwitch, boolean toggleSwitch) throws Exception { - Tab tab = getActivity().getActivityTab(); - PermissionUpdateWaiter updateWaiter = new PermissionUpdateWaiter("Count: "); + Tab tab = mPermissionRule.getActivity().getActivityTab(); + PermissionUpdateWaiter updateWaiter = + new PermissionUpdateWaiter("Count: ", mPermissionRule.getActivity()); tab.addObserver(updateWaiter); - runAllowTest(updateWaiter, TEST_FILE, script, numUpdates, withGesture, isDialog, hasSwitch, - toggleSwitch); + mPermissionRule.runAllowTest(updateWaiter, TEST_FILE, script, numUpdates, withGesture, + isDialog, hasSwitch, toggleSwitch); tab.removeObserver(updateWaiter); } @@ -34,9 +51,10 @@ * Verify asking for quota creates an InfoBar and accepting it resolves the call successfully. * @throws Exception */ + @Test @MediumTest @Feature({"QuotaPermissions"}) - @CommandLineFlags.Add("disable-features=" + MODAL_FLAG) + @CommandLineFlags.Add("disable-features=" + PermissionTestRule.MODAL_FLAG) public void testQuotaShowsInfobar() throws Exception { testQuotaPermissionsPlumbing("initiate_requestQuota(1024)", 1, false, false, false, false); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java index 138dec7..47e235ef 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java
@@ -11,6 +11,7 @@ import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_DON_ENABLED; import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_VIEWER_DAYDREAM; +import android.app.Activity; import android.os.Build; import android.support.test.filters.MediumTest; @@ -21,16 +22,17 @@ import org.junit.rules.RuleChain; import org.junit.runner.RunWith; +import org.chromium.base.ApplicationStatus; import org.chromium.base.test.params.ParameterAnnotations.ClassParameter; import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate; import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.vr_shell.mock.MockVrIntentHandler; import org.chromium.chrome.browser.vr_shell.rules.VrActivityRestriction; import org.chromium.chrome.browser.vr_shell.util.NfcSimUtils; @@ -42,8 +44,10 @@ import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.WebContents; +import java.lang.ref.WeakReference; import java.util.List; import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicReference; /** * End-to-end tests for transitioning between WebVR's magic window and @@ -149,24 +153,43 @@ @MediumTest @CommandLineFlags.Add("enable-features=WebVrAutopresent") @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) - @DisabledTest(message = "Doesn't work anymore until autopresent isn't forced into CCT") public void testTrustedIntentAllowsAutoPresent() throws InterruptedException { VrIntentUtils.setHandlerInstanceForTesting(new MockVrIntentHandler( true /* useMockImplementation */, true /* treatIntentsAsTrusted */)); + + // Send an autopresent intent, which will open the link in a CCT VrTransitionUtils.sendDaydreamAutopresentIntent( VrTestFramework.getHtmlTestFile("test_webvr_autopresent"), mVrTestRule.getActivity()); - // Wait until the link is opened in a new tab - final ChromeActivity act = mVrTestRule.getActivity(); + // Wait until a CCT is opened due to the intent + final AtomicReference<CustomTabActivity> cct = new AtomicReference<CustomTabActivity>(); CriteriaHelper.pollUiThread(new Criteria() { @Override public boolean isSatisfied() { - return act.getTabModelSelector().getTotalTabCount() == 2; + List<WeakReference<Activity>> list = ApplicationStatus.getRunningActivities(); + for (WeakReference<Activity> ref : list) { + Activity activity = ref.get(); + if (activity == null) continue; + if (activity instanceof CustomTabActivity) { + cct.set((CustomTabActivity) activity); + return true; + } + } + return false; } }, POLL_TIMEOUT_LONG_MS, POLL_CHECK_INTERVAL_SHORT_MS); - WebContents wc = mVrTestRule.getActivity().getActivityTab().getWebContents(); + // Wait until the tab is ready + CriteriaHelper.pollUiThread(new Criteria() { + @Override + public boolean isSatisfied() { + if (cct.get().getActivityTab() == null) return false; + return !cct.get().getActivityTab().isLoading(); + } + }, POLL_TIMEOUT_LONG_MS, POLL_CHECK_INTERVAL_SHORT_MS); + + WebContents wc = cct.get().getActivityTab().getWebContents(); mVrTestFramework.waitOnJavaScriptStep(wc); mVrTestFramework.endTest(wc); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/MediaSourceTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/MediaSourceTest.java index e429d08..3426a1d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/MediaSourceTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/MediaSourceTest.java
@@ -8,12 +8,13 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import org.chromium.base.test.util.Feature; -import org.chromium.testing.local.LocalRobolectricTestRunner; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.annotation.Config; +import org.chromium.base.test.util.Feature; +import org.chromium.testing.local.LocalRobolectricTestRunner; + /** * Robolectric tests for {@link MediaSource} class. */ @@ -99,6 +100,13 @@ @Test @Feature({"MediaRouter"}) + public void testInvalidAutoJoinPolicy() { + assertNull(MediaSource.from("https://example.com/path?query#__castAppId__=A" + + "/__castAutoJoinPolicy__=invalidPolicy")); + } + + @Test + @Feature({"MediaRouter"}) public void testOptionalParameters() { MediaSource source = MediaSource.from("https://example.com/path?query#__castAppId__=A"); assertNotNull(source); @@ -108,4 +116,45 @@ assertNull(source.getClientId()); assertEquals("tab_and_origin_scoped", source.getAutoJoinPolicy()); } + + @Test + @Feature({"MediaRouter"}) + public void testBasicCastPresentationUrl() { + MediaSource source = MediaSource.from("cast:ABCD1234"); + assertNotNull(source); + assertEquals("ABCD1234", source.getApplicationId()); + assertNull(source.getCapabilities()); + assertNull(source.getClientId()); + assertEquals("tab_and_origin_scoped", source.getAutoJoinPolicy()); + } + + @Test + @Feature({"MediaRouter"}) + public void testCastPresentationUrlWithParameters() { + MediaSource source = MediaSource.from("cast:ABCD1234?clientId=1234" + + "&capabilities=video_out,audio_out" + + "&autoJoinPolicy=tab_and_origin_scoped"); + assertNotNull(source); + assertEquals("ABCD1234", source.getApplicationId()); + assertNotNull(source.getCapabilities()); + assertEquals(2, source.getCapabilities().length); + assertEquals("video_out", source.getCapabilities()[0]); + assertEquals("audio_out", source.getCapabilities()[1]); + assertEquals("1234", source.getClientId()); + assertEquals("tab_and_origin_scoped", source.getAutoJoinPolicy()); + } + + @Test + @Feature({"MediaRouter"}) + public void testCastPresentationUrlInvalidCapability() { + assertNull(MediaSource.from("cast:ABCD1234?clientId=1234" + + "&capabilities=invalidCapability")); + } + + @Test + @Feature({"MediaRouter"}) + public void testCastPresentationUrlInvalidAutoJoinPolicy() { + assertNull(MediaSource.from("cast:ABCD1234?clientId=1234" + + "&autoJoinPolicy=invalidPolicy")); + } }
diff --git a/chrome/app/bookmarks_strings.grdp b/chrome/app/bookmarks_strings.grdp index ceae33fc..fc3276a 100644 --- a/chrome/app/bookmarks_strings.grdp +++ b/chrome/app/bookmarks_strings.grdp
@@ -397,6 +397,9 @@ =1 {1 item in bookmark list} other {# items in bookmark list}} </message> + <message name="IDS_MD_BOOKMARK_MANAGER_LIST_AX_LABEL" desc="Spoken feedback for focusing the bookmark list."> + Bookmark list + </message> <message name="IDS_MD_BOOKMARK_MANAGER_MENU_ADD_BOOKMARK" desc="Title of the bookmark toolbar dropdown menu item that adds a new bookmark."> Add new bookmark </message> @@ -442,6 +445,9 @@ <message name="IDS_MD_BOOKMARK_MANAGER_MORE_ACTIONS" desc="Tooltip of the button in the bookmark manager which shows an action menu for a bookmark, with actions like 'Edit' or 'Delete'"> More actions </message> + <message name="IDS_MD_BOOKMARK_MANAGER_MORE_ACTIONS_AX_LABEL" desc="Spoken text for the button in the bookmark manager which shows an action menu for a bookmark, with actions like 'Edit' or 'Delete'"> + More actions for <ph name="BOOKMARK_NAME">$1<ex>Bookmark X</ex></ph> + </message> <message name="IDS_MD_BOOKMARK_MANAGER_NO_SEARCH_RESULTS" desc="Text on the bookmarks list that indicates that no bookmarks or folders match the search."> No search results found </message> @@ -457,6 +463,15 @@ <message name="IDS_MD_BOOKMARK_MANAGER_SEARCH_RESULTS" desc="Message announced by screenreaders when search results are found."> Search results for '<ph name="SEARCH_STRING">$1<ex>reading</ex></ph>' </message> + <message name="IDS_MD_BOOKMARK_MANAGER_SIDEBAR_AX_LABEL" desc="Message announced by screenreaders for the bookmark manager sidebar."> + Bookmark folder tree + </message> + <message name="IDS_MD_BOOKMARK_MANAGER_SIDEBAR_NODE_COLLAPSE_AX_LABEL" desc="Message announced by screenreaders for button to collapse a folder in the bookmark manager sidebar."> + Collapse <ph name="FOLDER_NAME">$1<ex>Recipes</ex></ph> + </message> + <message name="IDS_MD_BOOKMARK_MANAGER_SIDEBAR_NODE_EXPAND_AX_LABEL" desc="Message announced by screenreaders for button to expand a folder in the bookmark manager sidebar."> + Expand <ph name="FOLDER_NAME">$1<ex>Recipes</ex></ph> + </message> <message name="IDS_MD_BOOKMARK_MANAGER_TITLE" desc="Title of the bookmark manager window."> Bookmarks </message>
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index e4c649b..38f3309 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -5275,4 +5275,33 @@ <ph name="PRINTER_MAKE_OR_MODEL">$1<ex>OfficeJet 8710</ex></ph> (USB) </message> + <!-- Screenshot notification --> + <message name="IDS_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS" desc="The title of the notification when a screenshot was taken."> + Screenshot taken + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_TITLE_DISABLED" desc="The title of the notification when taking a screenshot failed because screenshots are disabled."> + Screenshots disabled + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_TITLE_FAIL" desc="The title of the notification when taking a screenshot failed."> + An error occurred + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS" desc="The text of the notification when a screenshot was taken. If clicked, the screenshot file is displayed in the Files app."> + Show in folder + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_TEXT_DISABLED" desc="The text of the notification when taking a screenshot failed because screenshots are disabled by administrator policy."> + The ability to take screenshots has been disabled by your administrator. + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_TEXT_FAIL" desc="The text of the notification when taking a screenshot failed."> + Failed to save screenshot + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_NOTIFIER_NAME" desc="The name of screenshot notifier that is a system component"> + Screenshot + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_BUTTON_COPY_TO_CLIPBOARD" desc="The button label for the screenshot notification which copies the screenshot image to clipboard on click."> + Copy to clipboard + </message> + <message name="IDS_SCREENSHOT_NOTIFICATION_BUTTON_ANNOTATE" desc="The label for the screenshot notification button that opens the note-taking app to annotate the screenhsot."> + Annotate image + </message> + </grit-part>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index fea9db4..fc89293 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -11810,13 +11810,6 @@ Press App button to exit </message> </if> - - <!-- Experimental Fullscreen Exit Control strings --> - <if expr="toolkit_views"> - <message name="IDS_FULLSCREEN_EXIT_CONTROL_EXIT_FULLSCREEN" desc="Text displayed in a button that exits fullscreen mode."> - Exit Fullscreen - </message> - </if> </messages> </release> </grit>
diff --git a/chrome/app/helper-Info.plist b/chrome/app/helper-Info.plist index e2d8ebd..e210c35 100644 --- a/chrome/app/helper-Info.plist +++ b/chrome/app/helper-Info.plist
@@ -26,7 +26,5 @@ <string>1</string> <key>NSSupportsAutomaticGraphicsSwitching</key> <true/> - <key>NSSupportsAppNap</key> - <true/> </dict> </plist>
diff --git a/chrome/app/vector_icons/BUILD.gn b/chrome/app/vector_icons/BUILD.gn index ab4722f..704dd8d 100644 --- a/chrome/app/vector_icons/BUILD.gn +++ b/chrome/app/vector_icons/BUILD.gn
@@ -122,6 +122,8 @@ icons += [ "arc_migrate_encryption_notification.icon", "notification_captive_portal.icon", + "notification_google.icon", + "notification_warning.icon", "warning_badge_circle.1x.icon", "warning_badge_circle.icon", ]
diff --git a/chrome/app/vector_icons/notification_google.icon b/chrome/app/vector_icons/notification_google.icon new file mode 100644 index 0000000..fab0223 --- /dev/null +++ b/chrome/app/vector_icons/notification_google.icon
@@ -0,0 +1,27 @@ +// 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. + +CANVAS_DIMENSIONS, 18, +MOVE_TO, 9, 1, +CUBIC_TO, 4.58f, 1, 1, 4.58f, 1, 9, +R_CUBIC_TO, 0, 4.42f, 3.58f, 8, 8, 8, +R_CUBIC_TO, 4.42f, 0, 8, -3.58f, 8, -8, +R_CUBIC_TO, 0, -4.42f, -3.58f, -8, -8, -8, +CLOSE, +MOVE_TO, 9.11f, 14.5f, +CUBIC_TO, 6.01f, 14.5f, 3.5f, 12.04f, 3.5f, 9, +R_CUBIC_TO, 0, -3.04f, 2.51f, -5.5f, 5.61f, -5.5f, +R_CUBIC_TO, 1.51f, 0, 2.78f, 0.55f, 3.75f, 1.43f, +R_LINE_TO, -1.61f, 1.58f, +R_CUBIC_TO, -0.58f, -0.54f, -1.32f, -0.82f, -2.14f, -0.82f, +CUBIC_TO, 7.28f, 5.69f, 5.8f, 7.21f, 5.8f, 9, +R_CUBIC_TO, 0, 1.8f, 1.49f, 3.31f, 3.32f, 3.31f, +R_CUBIC_TO, 1.66f, 0, 2.79f, -0.93f, 3.02f, -2.21f, +H_LINE_TO, 9.11f, +V_LINE_TO, 7.99f, +R_H_LINE_TO, 5.29f, +R_CUBIC_TO, 0.07f, 0.36f, 0.1f, 0.74f, 0.1f, 1.13f, +R_CUBIC_TO, 0, 3.14f, -2.15f, 5.38f, -5.39f, 5.38f, +CLOSE, +END
diff --git a/chrome/app/vector_icons/notification_warning.icon b/chrome/app/vector_icons/notification_warning.icon new file mode 100644 index 0000000..865173c2 --- /dev/null +++ b/chrome/app/vector_icons/notification_warning.icon
@@ -0,0 +1,24 @@ +// 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. + +CANVAS_DIMENSIONS, 18, +MOVE_TO, 9, 1, +R_CUBIC_TO, 4.42f, 0, 8, 3.58f, 8, 8, +R_CUBIC_TO, 0, 4.42f, -3.58f, 8, -8, 8, +R_CUBIC_TO, -4.42f, 0, -8, -3.58f, -8, -8, +R_CUBIC_TO, 0, -4.42f, 3.58f, -8, 8, -8, +CLOSE, +MOVE_TO, 8, 4, +R_V_LINE_TO, 6, +R_H_LINE_TO, 2, +V_LINE_TO, 4, +H_LINE_TO, 8, +CLOSE, +R_MOVE_TO, 0, 8, +R_V_LINE_TO, 2, +R_H_LINE_TO, 2, +R_V_LINE_TO, -2, +H_LINE_TO, 8, +CLOSE, +END
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index d4c3270..abc26a63 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4592,8 +4592,8 @@ if (enable_library_cdms) { sources += [ - "media/pepper_cdm_test_helper.cc", - "media/pepper_cdm_test_helper.h", + "media/library_cdm_test_helper.cc", + "media/library_cdm_test_helper.h", ] deps += [ "//media/cdm:cdm_paths" ] }
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 4d81caa..66b5dad3 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -780,6 +780,10 @@ switches::kTLS13Variant, switches::kTLS13VariantRecordTypeExperiment}, {flag_descriptions::kTLS13VariantNoSessionIDExperiment, switches::kTLS13Variant, switches::kTLS13VariantNoSessionIDExperiment}, + {flag_descriptions::kTLS13VariantExperiment2, switches::kTLS13Variant, + switches::kTLS13VariantExperiment2}, + {flag_descriptions::kTLS13VariantExperiment3, switches::kTLS13Variant, + switches::kTLS13VariantExperiment3}, }; #if !defined(OS_ANDROID) @@ -2491,6 +2495,10 @@ ntp_snippets::kCategoryRanker, kContentSuggestionsCategoryRankerFeatureVariations, ntp_snippets::kCategoryRanker.name)}, + {"content-suggestions-debug-log", + flag_descriptions::kContentSuggestionsDebugLogName, + flag_descriptions::kContentSuggestionsDebugLogDescription, kOsAndroid, + FEATURE_VALUE_TYPE(ntp_snippets::kContentSuggestionsDebugLog)}, {"enable-breaking-news-push", flag_descriptions::kEnableBreakingNewsPushName, flag_descriptions::kEnableBreakingNewsPushDescription, kOsAndroid,
diff --git a/chrome/browser/android/ntp/content_suggestions_notifier_service_unittest.cc b/chrome/browser/android/ntp/content_suggestions_notifier_service_unittest.cc index 0c346e5..e2597e3 100644 --- a/chrome/browser/android/ntp/content_suggestions_notifier_service_unittest.cc +++ b/chrome/browser/android/ntp/content_suggestions_notifier_service_unittest.cc
@@ -16,6 +16,7 @@ #include "components/ntp_snippets/category_info.h" #include "components/ntp_snippets/category_rankers/fake_category_ranker.h" #include "components/ntp_snippets/content_suggestions_service.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/remote/remote_suggestion_builder.h" #include "components/ntp_snippets/user_classifier.h" #include "components/sync_preferences/testing_pref_service_syncable.h" @@ -71,7 +72,8 @@ base::MakeUnique<UserClassifier>( nullptr, base::MakeUnique<base::SimpleTestClock>()), - /*remote_suggestions_scheduler=*/nullptr) {} + /*remote_suggestions_scheduler=*/nullptr, + base::MakeUnique<ntp_snippets::Logger>()) {} }; class FakeArticleProvider : public ContentSuggestionsProvider {
diff --git a/chrome/browser/android/vr_shell/vr_controller.cc b/chrome/browser/android/vr_shell/vr_controller.cc index 57680af4..3a6fc86 100644 --- a/chrome/browser/android/vr_shell/vr_controller.cc +++ b/chrome/browser/android/vr_shell/vr_controller.cc
@@ -5,12 +5,12 @@ #include "chrome/browser/android/vr_shell/vr_controller.h" #include <algorithm> -#include <cmath> #include <utility> #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "cc/base/math_util.h" +#include "base/numerics/math_constants.h" +#include "base/numerics/ranges.h" #include "third_party/WebKit/public/platform/WebGestureEvent.h" #include "third_party/WebKit/public/platform/WebInputEvent.h" #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h" @@ -39,7 +39,7 @@ constexpr float kDelta = 1.0e-7f; constexpr float kCutoffHz = 10.0f; -constexpr float kRC = static_cast<float>(1.0 / (2.0 * M_PI * kCutoffHz)); +constexpr float kRC = 1.0f / (2.0f * base::kPiFloat * kCutoffHz); constexpr float kNanoSecondsPerSecond = 1.0e9f; constexpr int kMaxNumOfExtrapolations = 2; @@ -51,8 +51,8 @@ constexpr float kDeltaAlpha = 3.0f; void ClampTouchpadPosition(gfx::Vector2dF* position) { - position->set_x(cc::MathUtil::ClampToRange(position->x(), 0.0f, 1.0f)); - position->set_y(cc::MathUtil::ClampToRange(position->y(), 0.0f, 1.0f)); + position->set_x(base::ClampToRange(position->x(), 0.0f, 1.0f)); + position->set_y(base::ClampToRange(position->y(), 0.0f, 1.0f)); } float DeltaTimeSeconds(int64_t last_timestamp_nanos) { @@ -473,10 +473,10 @@ void VrController::UpdateAlpha() { float distance_to_face = (Position() - gfx::Point3F()).Length(); float alpha_change = kDeltaAlpha * DeltaTimeSeconds(last_timestamp_nanos_); - alpha_value_ = cc::MathUtil::ClampToRange( - distance_to_face < kFadeDistanceFromFace ? alpha_value_ - alpha_change - : alpha_value_ + alpha_change, - 0.0f, 1.0f); + alpha_value_ = base::ClampToRange(distance_to_face < kFadeDistanceFromFace + ? alpha_value_ - alpha_change + : alpha_value_ + alpha_change, + 0.0f, 1.0f); } } // namespace vr_shell
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index f5ba279b..29a6b85 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -3747,7 +3747,8 @@ embedder_scroll_location); content::SimulateMouseWheelEvent(embedder_contents, embedder_scroll_location, - gfx::Vector2d(0, -scroll_magnitude)); + gfx::Vector2d(0, -scroll_magnitude), + blink::WebMouseWheelEvent::kPhaseBegan); waiter.WaitForScrollChange(expected_offset); } @@ -3771,7 +3772,8 @@ blink::WebInputEvent::kMouseMove, guest_scroll_location); content::SimulateMouseWheelEvent(embedder_contents, guest_scroll_location, - gfx::Vector2d(0, scroll_magnitude)); + gfx::Vector2d(0, scroll_magnitude), + blink::WebMouseWheelEvent::kPhaseChanged); waiter.WaitForScrollChange(gfx::Vector2dF()); }
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index d5c51e7..980b547 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -359,6 +359,7 @@ <include name="IDR_INSTANT_CSS" file="resources\instant\instant.css" flattenhtml="true" type="BINDATA" /> <include name="IDR_INSTANT_HTML" file="resources\instant\instant.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_INSTANT_JS" file="resources\instant\instant.js" flattenhtml="true" type="BINDATA" /> + <include name="IDR_INTERVENTIONS_INTERNALS_INDEX_HTML" file="resources\interventions_internals\index.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" /> <include name="IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST" file="resources\network_speech_synthesis\manifest.json" type="BINDATA" /> <include name="IDR_PREDICTORS_HTML" file="resources\predictors\predictors.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> <include name="IDR_PREDICTORS_JS" file="resources\predictors\predictors.js" flattenhtml="true" type="BINDATA" compress="gzip" />
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 3af7f3e..39137ac 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <memory> #include <set> #include <string> #include <utility> @@ -26,6 +27,7 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/statistics_recorder.h" #include "base/path_service.h" #include "base/profiler/stack_sampling_profiler.h" #include "base/run_loop.h" @@ -69,6 +71,7 @@ #include "chrome/browser/gpu/three_d_api_observer.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" +#include "chrome/browser/metrics/expired_histograms_array.h" #include "chrome/browser/metrics/field_trial_synchronizer.h" #include "chrome/browser/metrics/renderer_uptime_tracker.h" #include "chrome/browser/metrics/thread_watcher.h" @@ -126,6 +129,7 @@ #include "components/google/core/browser/google_util.h" #include "components/language_usage_metrics/language_usage_metrics.h" #include "components/metrics/call_stack_profile_metrics_provider.h" +#include "components/metrics/expired_histograms_checker.h" #include "components/metrics/metrics_reporting_default_state.h" #include "components/metrics/metrics_service.h" #include "components/metrics_services_manager/metrics_services_manager.h" @@ -657,6 +661,11 @@ // cookies need to go through one of Chrome's URLRequestContexts which have // a ChromeNetworkDelegate attached that selectively allows cookies again. net::URLRequest::SetDefaultCookiePolicyToBlock(); + + base::StatisticsRecorder::SetRecordChecker( + std::make_unique<metrics::ExpiredHistogramsChecker>( + chrome_metrics::kExpiredHistogramsHashes, + chrome_metrics::kNumExpiredHistograms)); } ChromeBrowserMainParts::~ChromeBrowserMainParts() {
diff --git a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc index b55bd4d..e0011661 100644 --- a/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc +++ b/chrome/browser/chromeos/arc/arc_migration_guide_notification.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/arc/arc_migration_guide_notification.h" +#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" @@ -26,6 +27,7 @@ #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h" #include "ui/message_center/notification_delegate.h" +#include "ui/message_center/public/cpp/message_center_switches.h" namespace arc { @@ -91,19 +93,32 @@ : l10n_util::GetStringUTF16( IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_MESSAGE); - message_center::RichNotificationData data; - 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>( - message_center::NOTIFICATION_TYPE_SIMPLE, kSuggestNotificationId, - l10n_util::GetStringUTF16( - IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), - message, - gfx::Image(gfx::CreateVectorIcon( - kArcMigrateEncryptionNotificationIcon, gfx::kPlaceholderColor)), - base::string16(), GURL(), notifier_id, data, - new ArcMigrationGuideNotificationDelegate())); + if (message_center::IsNewStyleNotificationEnabled()) { + message_center::MessageCenter::Get()->AddNotification( + message_center::Notification::CreateSystemNotification( + message_center::NOTIFICATION_TYPE_SIMPLE, kSuggestNotificationId, + l10n_util::GetStringUTF16( + IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), + message, gfx::Image(), base::string16(), GURL(), notifier_id, + message_center::RichNotificationData(), + new ArcMigrationGuideNotificationDelegate(), + ash::kNotificationSettingsIcon, + message_center::SystemNotificationWarningLevel::NORMAL)); + } else { + message_center::RichNotificationData data; + 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>( + message_center::NOTIFICATION_TYPE_SIMPLE, kSuggestNotificationId, + l10n_util::GetStringUTF16( + IDS_ARC_MIGRATE_ENCRYPTION_NOTIFICATION_TITLE), + message, + gfx::Image(gfx::CreateVectorIcon( + kArcMigrateEncryptionNotificationIcon, gfx::kPlaceholderColor)), + base::string16(), GURL(), notifier_id, data, + new ArcMigrationGuideNotificationDelegate())); + } } void ShowArcMigrationSuccessNotificationIfNeeded(Profile* profile) {
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc index 0c3bec65..73447f1 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
@@ -26,7 +26,7 @@ namespace { -constexpr char kPlayGoogleCom[] = "play.google.com"; +constexpr char kGoogleCom[] = "google.com"; // Compares the host name of the referrer and target URL to decide whether // the navigation needs to be overriden. @@ -54,12 +54,18 @@ if (net::registry_controlled_domains::SameDomainOrHost( current_url, previous_url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { - // Special case so "https://play.google.com/app_name" links can trigger the - // intent picker even if the domain for both the |previous_url| and - // |current_url| is "google.com". All the other jumps within the same domain - // won't show the UI or jump directly to the app. - return current_url.host_piece() == kPlayGoogleCom && - previous_url.host_piece() != kPlayGoogleCom; + if (net::registry_controlled_domains::GetDomainAndRegistry( + current_url, + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) == + kGoogleCom) { + // Navigation within the google.com domain are good candidates for this + // throttle (and consecuently the picker UI) only if they have different + // hosts, this is because multiple services are hosted within the same + // domain e.g. play.google.com, mail.google.com and so on. + return current_url.host_piece() != previous_url.host_piece(); + } + + return false; } return true; }
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc index dd07720..768594d 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc
@@ -36,19 +36,36 @@ } // namespace TEST(ArcNavigationThrottleTest, TestShouldOverrideUrlLoading) { - // A navigation within the same domain shouldn't be overridden. + // A navigation within the same domain shouldn't be overridden except if the + // domain is google.com. EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://google.com"), GURL("http://google.com/"))); - EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://google.com"), GURL("http://a.google.com/"))); - EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://a.google.com"), GURL("http://google.com/"))); - EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://a.google.com"), GURL("http://b.google.com/"))); - EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://a.google.com"), GURL("http://b.c.google.com/"))); - EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( GURL("http://a.b.google.com"), GURL("http://c.google.com/"))); + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://a.b.google.com"), GURL("http://b.google.com"))); + EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://b.google.com"), GURL("http://a.b.google.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://notg.com"), GURL("http://notg.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://a.notg.com"), GURL("http://notg.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://notg.com"), GURL("http://a.notg.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://a.notg.com"), GURL("http://b.notg.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://a.notg.com"), GURL("http://a.b.notg.com"))); + EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( + GURL("http://a.b.notg.com"), GURL("http://c.notg.com"))); // Same as last tests, except for "play.google.com". EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
diff --git a/chrome/browser/chromeos/events/event_rewriter_unittest.cc b/chrome/browser/chromeos/events/event_rewriter_unittest.cc index 044a9e4..11b1d96 100644 --- a/chrome/browser/chromeos/events/event_rewriter_unittest.cc +++ b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
@@ -8,7 +8,6 @@ #include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/sticky_keys/sticky_keys_overlay.h" #include "ash/test/ash_test_base.h" -#include "ash/wm/window_state.h" #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -37,6 +36,7 @@ #include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/test/events_test_utils.h" #include "ui/events/test/test_event_processor.h" +#include "ui/wm/core/window_util.h" namespace { @@ -2086,8 +2086,7 @@ TEST_F(EventRewriterAshTest, TopRowKeysAreFunctionKeys) { std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(1)); - ash::wm::WindowState* window_state = ash::wm::GetWindowState(window.get()); - window_state->Activate(); + wm::ActivateWindow(window.get()); std::vector<std::unique_ptr<ui::Event>> events; // Create a simulated keypress of F1 targetted at the window.
diff --git a/chrome/browser/chromeos/file_manager/file_manager_jstest.cc b/chrome/browser/chromeos/file_manager/file_manager_jstest.cc index c60d80d..fb59225 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_jstest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_jstest.cc
@@ -203,3 +203,8 @@ RunTest(base::FilePath( FILE_PATH_LITERAL("foreground/js/ui/file_tap_handler_unittest.html"))); } + +IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileListSelectionModelTest) { + RunTest(base::FilePath(FILE_PATH_LITERAL( + "foreground/js/ui/file_list_selection_model_unittest.html"))); +}
diff --git a/chrome/browser/chromeos/hats/hats_notification_controller.cc b/chrome/browser/chromeos/hats/hats_notification_controller.cc index a7c1472..27bea183 100644 --- a/chrome/browser/chromeos/hats/hats_notification_controller.cc +++ b/chrome/browser/chromeos/hats/hats_notification_controller.cc
@@ -30,6 +30,7 @@ #include "ui/message_center/message_center.h" #include "ui/message_center/notification_types.h" #include "ui/message_center/public/cpp/message_center_constants.h" +#include "ui/message_center/public/cpp/message_center_switches.h" #include "ui/strings/grit/ui_strings.h" namespace { @@ -200,8 +201,11 @@ Notification* HatsNotificationController::CreateNotification() { message_center::RichNotificationData optional; - optional.buttons.push_back(message_center::ButtonInfo( - l10n_util::GetStringUTF16(IDS_ASH_HATS_NOTIFICATION_TAKE_SURVEY_BUTTON))); + if (!message_center::IsNewStyleNotificationEnabled()) { + optional.buttons.push_back( + message_center::ButtonInfo(l10n_util::GetStringUTF16( + IDS_ASH_HATS_NOTIFICATION_TAKE_SURVEY_BUTTON))); + } Notification* notification = new Notification( message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, @@ -213,8 +217,15 @@ ash::system_notifier::kNotifierHats), l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_NOTIFIER_HATS_NAME), GURL(kNotificationOriginUrl), kNotificationId, optional, this); - notification->set_accent_color( - message_center::kSystemNotificationColorNormal); + if (message_center::IsNewStyleNotificationEnabled()) { + notification->set_icon(gfx::Image()); + notification->set_accent_color( + message_center::kSystemNotificationColorNormal); + notification->set_small_image(gfx::Image(gfx::CreateVectorIcon( + kNotificationGoogleIcon, message_center::kSmallImageSizeMD, + message_center::kSystemNotificationColorNormal))); + notification->set_vector_small_image(kNotificationGoogleIcon); + } return notification; }
diff --git a/chrome/browser/chromeos/login/ui/login_feedback_browsertest.cc b/chrome/browser/chromeos/login/ui/login_feedback_browsertest.cc index 8ffa62f..a520635 100644 --- a/chrome/browser/chromeos/login/ui/login_feedback_browsertest.cc +++ b/chrome/browser/chromeos/login/ui/login_feedback_browsertest.cc
@@ -16,7 +16,7 @@ #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/native_app_window.h" #include "ui/aura/client/focus_client.h" -#include "ui/wm/core/window_util.h" +#include "ui/base/base_window.h" namespace chromeos { @@ -44,7 +44,7 @@ ASSERT_NE(nullptr, feedback_window); EXPECT_FALSE(feedback_window->is_hidden()); - EXPECT_TRUE(wm::IsActiveWindow(feedback_window->GetNativeWindow())); + EXPECT_TRUE(feedback_window->GetBaseWindow()->IsActive()); feedback_window->GetBaseWindow()->Close(); run_loop.Run();
diff --git a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc index 638c487..47b36c0 100644 --- a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc +++ b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc
@@ -6,6 +6,8 @@ #include <stddef.h> +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/files/file_util.h" @@ -85,8 +87,8 @@ // |cached_policy_key_path_|. cryptohome_client_->GetSanitizedUsername( cryptohome::Identification(account_id_), - base::Bind(&CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername, - weak_factory_.GetWeakPtr())); + base::BindOnce(&CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername, + weak_factory_.GetWeakPtr())); } bool CachedPolicyKeyLoaderChromeOS::LoadPolicyKeyImmediately() { @@ -124,8 +126,8 @@ // |cached_policy_key_path_|. cryptohome_client_->GetSanitizedUsername( cryptohome::Identification(account_id_), - base::Bind(&CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername, - weak_factory_.GetWeakPtr())); + base::BindOnce(&CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername, + weak_factory_.GetWeakPtr())); } else { TriggerLoadPolicyKey(); } @@ -185,12 +187,10 @@ } void CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername( - chromeos::DBusMethodCallStatus call_status, - const std::string& sanitized_username) { + base::Optional<std::string> sanitized_username) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS || - sanitized_username.empty()) { + if (!sanitized_username || sanitized_username->empty()) { SampleValidationFailure(ValidationFailure::DBUS); // Don't bother trying to load a key if we don't know where it is - just @@ -202,7 +202,7 @@ } cached_policy_key_path_ = user_policy_key_dir_.Append( - base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); + base::StringPrintf(kPolicyKeyFile, sanitized_username->c_str())); TriggerLoadPolicyKey(); }
diff --git a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h index a3eee4f..1b3fe70 100644 --- a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h +++ b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h
@@ -13,8 +13,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/optional.h" #include "base/sequence_checker.h" -#include "chromeos/dbus/dbus_method_call_status.h" #include "components/signin/core/account_id/account_id.h" namespace base { @@ -64,8 +64,7 @@ void OnPolicyKeyLoaded(const std::string& key); // Callback for getting the sanitized username from |cryptohome_client_|. - void OnGetSanitizedUsername(chromeos::DBusMethodCallStatus call_status, - const std::string& sanitized_username); + void OnGetSanitizedUsername(base::Optional<std::string> sanitized_username); void NotifyAndClearCallbacks();
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 9471739..1cadb70 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc
@@ -787,8 +787,6 @@ remap_pref, value); } } - - system::InputDeviceSettings::Get()->UpdateTouchDevicesStatusFromPrefs(); } void Preferences::OnIsSyncingChanged() {
diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc index 04667a6..36a7547 100644 --- a/chrome/browser/chromeos/system/input_device_settings.cc +++ b/chrome/browser/chromeos/system/input_device_settings.cc
@@ -4,26 +4,16 @@ #include "chrome/browser/chromeos/system/input_device_settings.h" -#include "ash/public/cpp/touchscreen_enabled_source.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/common/pref_names.h" #include "chromeos/system/statistics_provider.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" namespace chromeos { namespace system { namespace { -PrefService* GetActiveProfilePrefs() { - Profile* profile = ProfileManager::GetActiveUserProfile(); - return profile ? profile->GetPrefs() : nullptr; -} - // Sets |to_set| to |other| if |other| has a value and the value is not equal to // |to_set|. This differs from *to_set = other; in so far as nothing is changed // if |other| has no value. Returns true if |to_set| was updated. @@ -38,8 +28,7 @@ } // namespace -TouchpadSettings::TouchpadSettings() { -} +TouchpadSettings::TouchpadSettings() = default; TouchpadSettings::TouchpadSettings(const TouchpadSettings& other) = default; @@ -159,8 +148,7 @@ } } -MouseSettings::MouseSettings() { -} +MouseSettings::MouseSettings() = default; MouseSettings::MouseSettings(const MouseSettings& other) = default; @@ -268,73 +256,5 @@ return false; } -// static -void InputDeviceSettings::RegisterProfilePrefs(PrefRegistrySimple* registry) { - registry->RegisterBooleanPref(::prefs::kTouchscreenEnabled, true); - registry->RegisterBooleanPref(::prefs::kTouchpadEnabled, true); -} - -void InputDeviceSettings::UpdateTouchDevicesStatusFromPrefs() { - UpdateTouchscreenEnabled(); - - PrefService* pref_service = GetActiveProfilePrefs(); - if (!pref_service) - return; - - const bool touchpad_status = - pref_service->HasPrefPath(::prefs::kTouchpadEnabled) - ? pref_service->GetBoolean(::prefs::kTouchpadEnabled) - : true; - SetInternalTouchpadEnabled(touchpad_status); -} - -bool InputDeviceSettings::GetTouchscreenEnabled( - ash::TouchscreenEnabledSource source) const { - if (source == ash::TouchscreenEnabledSource::GLOBAL) - return global_touchscreen_enabled_; - - PrefService* pref_service = GetActiveProfilePrefs(); - if (!pref_service) - return true; - - return pref_service->HasPrefPath(::prefs::kTouchscreenEnabled) - ? pref_service->GetBoolean(::prefs::kTouchscreenEnabled) - : true; -} - -void InputDeviceSettings::SetTouchscreenEnabled( - bool enabled, - ash::TouchscreenEnabledSource source) { - if (source == ash::TouchscreenEnabledSource::GLOBAL) { - global_touchscreen_enabled_ = enabled; - } else { - PrefService* pref_service = GetActiveProfilePrefs(); - if (pref_service) - pref_service->SetBoolean(::prefs::kTouchscreenEnabled, enabled); - } - - UpdateTouchscreenEnabled(); -} - -void InputDeviceSettings::ToggleTouchpad() { - PrefService* pref_service = GetActiveProfilePrefs(); - if (!pref_service) - return; - - const bool touchpad_status = - pref_service->HasPrefPath(::prefs::kTouchpadEnabled) - ? pref_service->GetBoolean(::prefs::kTouchpadEnabled) - : true; - - pref_service->SetBoolean(::prefs::kTouchpadEnabled, !touchpad_status); - SetInternalTouchpadEnabled(!touchpad_status); -} - -void InputDeviceSettings::UpdateTouchscreenEnabled() { - SetTouchscreensEnabled( - GetTouchscreenEnabled(ash::TouchscreenEnabledSource::GLOBAL) && - GetTouchscreenEnabled(ash::TouchscreenEnabledSource::USER_PREF)); -} - } // namespace system } // namespace chromeos
diff --git a/chrome/browser/chromeos/system/input_device_settings.h b/chrome/browser/chromeos/system/input_device_settings.h index bedc1ef..cbc147b 100644 --- a/chrome/browser/chromeos/system/input_device_settings.h +++ b/chrome/browser/chromeos/system/input_device_settings.h
@@ -9,8 +9,6 @@ #include "base/optional.h" #include "chromeos/chromeos_export.h" -class PrefRegistrySimple; - namespace ash { enum class TouchscreenEnabledSource; } // namespace ash @@ -134,27 +132,6 @@ // where other input devices like mouse are absent. static bool ForceKeyboardDrivenUINavigation(); - // Registers profile pref names for touchpad and touchscreen statuses. - static void RegisterProfilePrefs(PrefRegistrySimple* registry); - - // Updates the enabled/disabled status of the touchscreen/touchpad from the - // preferences. - void UpdateTouchDevicesStatusFromPrefs(); - - // Returns the current touchscreen enabled status as specified by |source|. - // Note that the actual state of the touchscreen device is automatically - // determined based on the requests of multiple sources. - bool GetTouchscreenEnabled(ash::TouchscreenEnabledSource source) const; - - // Sets |source|'s requested touchscreen enabled status to |enabled|. Note - // that the actual state of the touchscreen device is automatically determined - // based on the requests of multiple sources. - void SetTouchscreenEnabled(bool enabled, - ash::TouchscreenEnabledSource source); - - // Toggles the status of touchpad between enabled and disabled. - void ToggleTouchpad(); - // Calls |callback|, possibly asynchronously, after determining if a touchpad // is connected. virtual void TouchpadExists(DeviceExistsCallback callback) = 0; @@ -211,14 +188,6 @@ private: virtual void SetInternalTouchpadEnabled(bool enabled) {} virtual void SetTouchscreensEnabled(bool enabled) {} - - // Updates the actual enabled/disabled status of the touchscreen. Touchscreen - // is enabled if all the touchscreen enabled sources are enabled. - void UpdateTouchscreenEnabled(); - - // The touchscreen state which is associated with the global touchscreen - // enabled source. - bool global_touchscreen_enabled_ = false; }; } // namespace system
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc index 42795a1..6699588 100644 --- a/chrome/browser/chromeos/tether/tether_service.cc +++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -345,6 +345,7 @@ case OTHER_OR_UNKNOWN: case BLE_NOT_PRESENT: case BLE_ADVERTISING_NOT_SUPPORTED: + case WIFI_NOT_PRESENT: case SCREEN_LOCKED: case NO_AVAILABLE_HOSTS: case CELLULAR_DISABLED: @@ -436,6 +437,11 @@ return IsBluetoothPresent() && adapter_->IsPowered(); } +bool TetherService::IsWifiPresent() const { + return network_state_handler_->IsTechnologyAvailable( + chromeos::NetworkTypePattern::WiFi()); +} + bool TetherService::IsCellularAvailableButNotEnabled() const { return (network_state_handler_->IsTechnologyAvailable( chromeos::NetworkTypePattern::Cellular()) && @@ -458,6 +464,9 @@ if (!IsBluetoothPresent()) return BLE_NOT_PRESENT; + if (!IsWifiPresent()) + return WIFI_NOT_PRESENT; + if (!GetIsBleAdvertisingSupportedPref()) return BLE_ADVERTISING_NOT_SUPPORTED;
diff --git a/chrome/browser/chromeos/tether/tether_service.h b/chrome/browser/chromeos/tether/tether_service.h index 57a9150..251d6f2b 100644 --- a/chrome/browser/chromeos/tether/tether_service.h +++ b/chrome/browser/chromeos/tether/tether_service.h
@@ -130,6 +130,7 @@ FRIEND_TEST_ALL_PREFIXES(TetherServiceTest, TestEnabled); FRIEND_TEST_ALL_PREFIXES(TetherServiceTest, TestBluetoothNotification); FRIEND_TEST_ALL_PREFIXES(TetherServiceTest, TestBluetoothNotPresent); + FRIEND_TEST_ALL_PREFIXES(TetherServiceTest, TestWifiNotPresent); // Reflects InstantTethering_TechnologyStateAndReason enum in enums.xml. Do // not rearrange. @@ -144,6 +145,7 @@ USER_PREFERENCE_DISABLED = 7, ENABLED = 8, BLE_NOT_PRESENT = 9, + WIFI_NOT_PRESENT = 10, TETHER_FEATURE_STATE_MAX }; @@ -168,6 +170,8 @@ bool IsBluetoothPresent() const; bool IsBluetoothPowered() const; + bool IsWifiPresent() const; + bool IsCellularAvailableButNotEnabled() const; // Whether Tether is allowed to be used. If the controlling preference
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/chromeos/tether/tether_service_unittest.cc index 47ab232..51423d6 100644 --- a/chrome/browser/chromeos/tether/tether_service_unittest.cc +++ b/chrome/browser/chromeos/tether/tether_service_unittest.cc
@@ -28,6 +28,7 @@ #include "chromeos/dbus/fake_shill_manager_client.h" #include "chromeos/dbus/power_manager_client.h" #include "chromeos/dbus/session_manager_client.h" +#include "chromeos/dbus/shill_device_client.h" #include "chromeos/network/network_connect.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_state_handler.h" @@ -42,6 +43,7 @@ #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" #include "ui/message_center/message_center.h" using testing::Invoke; @@ -298,6 +300,14 @@ bool IsBluetoothPresent() { return is_adapter_present_; } bool IsBluetoothPowered() { return is_adapter_powered_; } + void RemoveWifiFromSystem() { + chromeos::DBusThreadManager::Get() + ->GetShillManagerClient() + ->GetTestInterface() + ->RemoveTechnology(shill::kTypeWifi); + base::RunLoop().RunUntilIdle(); + } + void DisconnectDefaultShillNetworks() { const chromeos::NetworkState* default_state; while ((default_state = network_state_handler()->DefaultNetwork())) { @@ -603,6 +613,20 @@ TetherService::TetherFeatureState::BLE_NOT_PRESENT); } +TEST_F(TetherServiceTest, TestWifiNotPresent) { + RemoveWifiFromSystem(); + + CreateTetherService(); + + EXPECT_EQ( + chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_UNAVAILABLE, + network_state_handler()->GetTechnologyState( + chromeos::NetworkTypePattern::Tether())); + + ShutdownAndVerifyFinalTetherFeatureState( + TetherService::TetherFeatureState::WIFI_NOT_PRESENT); +} + TEST_F(TetherServiceTest, TestIsBluetoothPowered) { SetIsBluetoothPowered(false);
diff --git a/chrome/browser/component_updater/cros_component_installer.cc b/chrome/browser/component_updater/cros_component_installer.cc index 0c72420b..240143d 100644 --- a/chrome/browser/component_updater/cros_component_installer.cc +++ b/chrome/browser/component_updater/cros_component_installer.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/files/file_util.h" +#include "base/optional.h" #include "base/path_service.h" #include "base/task_scheduler/post_task.h" #include "chrome/browser/browser_process.h" @@ -170,13 +171,9 @@ // point. static void LoadResult( const base::Callback<void(const std::string&)>& load_callback, - chromeos::DBusMethodCallStatus call_status, - const std::string& result) { - PostTask( - FROM_HERE, - base::BindOnce( - load_callback, - call_status != chromeos::DBUS_METHOD_CALL_SUCCESS ? "" : result)); + base::Optional<std::string> result) { + PostTask(FROM_HERE, + base::BindOnce(load_callback, result.value_or(std::string()))); } // Internal function to load a component.
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 68630810..31eecc32 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -240,8 +240,9 @@ const std::vector<std::string> supported_codecs = base::SplitString( codecs, std::string(1, kCdmSupportedCodecsValueDelimiter), base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - CdmRegistry::GetInstance()->RegisterCdm(content::CdmInfo( - kWidevineCdmType, cdm_version, cdm_path, supported_codecs)); + CdmRegistry::GetInstance()->RegisterCdm( + content::CdmInfo(kWidevineCdmType, cdm_version, cdm_path, + supported_codecs, kWidevineKeySystem, false)); } } // namespace
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index b13385f..45d28836 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -56,7 +56,7 @@ #endif #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#include "chrome/browser/media/pepper_cdm_test_helper.h" +#include "chrome/browser/media/library_cdm_test_helper.h" #endif using content::BrowserThread; @@ -497,6 +497,7 @@ // The following tests verify that Pepper plugins that use JavaScript settings // instead of Plugins settings still work when Plugins are blocked. +// TODO(crbug.com/403462): Remove after pepper CDM is deprecated. #if BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) && \ !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, @@ -527,6 +528,7 @@ RunJavaScriptBlockedTest("/load_flash_no_js.html", false); } +// TODO(crbug.com/403462): Remove after pepper CDM is deprecated. #if BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, WidevineCdm) {
diff --git a/chrome/browser/content_settings/web_site_settings_uma_util.cc b/chrome/browser/content_settings/web_site_settings_uma_util.cc index 2a54150..d47e6f1 100644 --- a/chrome/browser/content_settings/web_site_settings_uma_util.cc +++ b/chrome/browser/content_settings/web_site_settings_uma_util.cc
@@ -24,6 +24,11 @@ } else if (setting == ContentSetting::CONTENT_SETTING_DEFAULT) { UMA_HISTOGRAM_EXACT_LINEAR("WebsiteSettings.Menu.PermissionChanged.Reset", histogram_value, num_values); + } else if (setting == ContentSetting::CONTENT_SETTING_SESSION_ONLY) { + DCHECK_EQ(CONTENT_SETTINGS_TYPE_COOKIES, type); + UMA_HISTOGRAM_EXACT_LINEAR( + "WebsiteSettings.Menu.PermissionChanged.SessionOnly", histogram_value, + num_values); } else { NOTREACHED() << "Requested to log permission change " << type << " to " << setting;
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 683d2056..588a445 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -2020,7 +2020,8 @@ DispatchInPageAndWait("waitForEvent", "click"); SimulateMouseWheelEvent(web_contents, gfx::Point(300, 100), - gfx::Vector2d(0, 120)); + gfx::Vector2d(0, 120), + blink::WebMouseWheelEvent::kPhaseBegan); DispatchInPageAndWait("waitForEvent", "wheel"); SimulateTapAt(web_contents, gfx::Point(30, 60));
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index ab76d179..4eac371 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -103,6 +103,7 @@ #include "content/public/common/quarantine.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/download_test_observer.h" +#include "content/public/test/test_download_request_handler.h" #include "content/public/test/test_file_error_injector.h" #include "content/public/test/test_navigation_observer.h" #include "extensions/browser/extension_dialog_auto_confirm.h" @@ -2933,7 +2934,6 @@ PermissionRequestManager* permission_request_manager = PermissionRequestManager::FromWebContents( browser()->tab_strip_model()->GetActiveWebContents()); - permission_request_manager->DisplayPendingRequests(); permission_request_manager->set_auto_response_for_test( PermissionRequestManager::ACCEPT_ALL); @@ -3109,45 +3109,37 @@ #define MAYBE_DownloadTest_PercentComplete DownloadTest_PercentComplete #endif IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) { - // Write a huge file. - base::FilePath file_path( - GetDownloadDirectory(browser()).AppendASCII("source").AppendASCII( - "DownloadTest_BigZip.zip")); - int64_t size = 1 << 25; + // Write a huge file. Make sure the test harness can supply "Content-Length" + // header to indicate the file size, or the download will not have valid + // percentage progression. + GURL url = GURL("http://example.com/large_file"); + content::TestDownloadRequestHandler request_handler(url); + content::TestDownloadRequestHandler::Parameters parameters; + parameters.size = 1024 * 1024 * 32; /* 32MB file. */ + request_handler.StartServing(parameters); + + // Ensure that we have enough disk space to download the large file. { base::ThreadRestrictions::ScopedAllowIO allow_io; - ASSERT_TRUE(CreateDirectory(file_path.DirName())); - base::File file(file_path, - base::File::FLAG_CREATE | base::File::FLAG_WRITE); - ASSERT_TRUE(file.IsValid()); - EXPECT_EQ(1, file.Write(size, "a", 1)); - file.Close(); - -#if defined(OS_POSIX) - // Make it readable by chronos on chromeos - base::SetPosixFilePermissions(file_path, 0755); -#endif - - // Ensure that we have enough disk space. int64_t free_space = base::SysInfo::AmountOfFreeDiskSpace(GetDownloadDirectory(browser())); - ASSERT_LE(size, free_space) + ASSERT_LE(parameters.size, free_space) << "Not enough disk space to download. Got " << free_space; } - GURL file_url(net::FilePathToFileURL(file_path)); + std::unique_ptr<content::DownloadTestObserver> progress_waiter( CreateInProgressWaiter(browser(), 1)); // Start downloading a file, wait for it to be created. ui_test_utils::NavigateToURLWithDisposition( - browser(), file_url, WindowOpenDisposition::CURRENT_TAB, + browser(), url, WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); progress_waiter->WaitForFinished(); EXPECT_EQ(1u, progress_waiter->NumDownloadsSeenInState( DownloadItem::IN_PROGRESS)); std::vector<DownloadItem*> download_items; GetDownloads(browser(), &download_items); - ASSERT_EQ(1UL, download_items.size()); + ASSERT_EQ(1u, download_items.size()); // Wait for the download to complete, checking along the way that the // PercentComplete() never regresses. @@ -3157,13 +3149,11 @@ ASSERT_EQ(100, download_items[0]->PercentComplete()); // Check that the file downloaded correctly. + ASSERT_EQ(parameters.size, download_items[0]->GetReceivedBytes()); + ASSERT_EQ(parameters.size, download_items[0]->GetTotalBytes()); + + // Delete the file. base::ThreadRestrictions::ScopedAllowIO allow_io; - ASSERT_TRUE(base::PathExists(download_items[0]->GetTargetFilePath())); - int64_t downloaded_size = 0; - ASSERT_TRUE(base::GetFileSize( - download_items[0]->GetTargetFilePath(), &downloaded_size)); - ASSERT_EQ(size + 1, downloaded_size); - ASSERT_TRUE(base::DieFileDie(file_path, false)); ASSERT_TRUE(base::DieFileDie(download_items[0]->GetTargetFilePath(), false)); }
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc index 72be1110..5ddb447 100644 --- a/chrome/browser/download/download_request_limiter_unittest.cc +++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -48,7 +48,6 @@ PermissionRequestManager::FromWebContents(web_contents()); mock_permission_prompt_factory_.reset( new MockPermissionPromptFactory(manager)); - manager->DisplayPendingRequests(); UpdateExpectations(ACCEPT); cancel_count_ = continue_count_ = 0;
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf.cc index edceff4f..a589768c 100644 --- a/chrome/browser/download/download_shelf.cc +++ b/chrome/browser/download/download_shelf.cc
@@ -2,15 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. - #include "chrome/browser/download/download_shelf.h" -#include <cmath> - #include "base/bind.h" #include "base/callback.h" #include "base/location.h" +#include "base/numerics/math_constants.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/threading/thread_task_runner_handle.h" @@ -50,7 +47,8 @@ // How many times to cycle the complete animation. This should be an odd // number so that the animation ends faded out. static const int kCompleteAnimationCycles = 5; - double temp = animation_progress * kCompleteAnimationCycles * M_PI + M_PI_2; + double temp = + ((animation_progress * kCompleteAnimationCycles) + 0.5) * base::kPiDouble; temp = sin(temp) / 2 + 0.5; return static_cast<int>(255.0 * temp); }
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc index ebad0c2..455c5b9 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/optional.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "chrome/browser/browser_process.h" @@ -68,8 +69,6 @@ using testing::_; using chromeos::CryptohomeClient; -using chromeos::DBUS_METHOD_CALL_SUCCESS; -using chromeos::DBusMethodCallStatus; using chromeos::DBusThreadManager; using chromeos::NetworkPortalDetector; using chromeos::NetworkPortalDetectorTestImpl; @@ -213,13 +212,6 @@ ExtensionApiTest::SetUpInProcessBrowserTestFixture(); } - static void AssignString(std::string* out, - DBusMethodCallStatus call_status, - const std::string& result) { - CHECK_EQ(call_status, DBUS_METHOD_CALL_SUCCESS); - *out = result; - } - void SetUpCommandLine(base::CommandLine* command_line) override { ExtensionApiTest::SetUpCommandLine(command_line); // Whitelist the extension ID of the test extension. @@ -246,7 +238,12 @@ std::string userhash; DBusThreadManager::Get()->GetCryptohomeClient()->GetSanitizedUsername( cryptohome::Identification(user->GetAccountId()), - base::Bind(&AssignString, &userhash_)); + base::BindOnce( + [](std::string* out, base::Optional<std::string> result) { + CHECK(result.has_value()); + *out = std::move(result).value(); + }, + &userhash_)); content::RunAllPendingInMessageLoop(); CHECK(!userhash_.empty()); }
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index 433f61b..2cadfe4 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -393,6 +393,11 @@ settings_private::PrefType::PREF_TYPE_NUMBER; (*s_whitelist)[::prefs::kLanguageXkbAutoRepeatInterval] = settings_private::PrefType::PREF_TYPE_NUMBER; + + // Multidevice settings. + (*s_whitelist)[arc::prefs::kSmsConnectEnabled] = + settings_private::PrefType::PREF_TYPE_BOOLEAN; + #else (*s_whitelist)[::prefs::kAcceptLanguages] = settings_private::PrefType::PREF_TYPE_STRING;
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc index 506a8e59..8b4a846 100644 --- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" -#include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/extensions/api/storage/policy_value_store.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector_factory.h" @@ -27,6 +26,7 @@ #include "components/policy/core/common/schema_registry.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/api/storage/backend_task_runner.h" +#include "extensions/browser/extension_file_task_runner.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry_observer.h" @@ -55,9 +55,6 @@ namespace { -const char kLoadSchemasBackgroundTaskTokenName[] = - "load_managed_storage_schemas_token"; - // Only extension settings are stored in the managed namespace - not apps. const ValueStoreFactory::ModelType kManagedModelType = ValueStoreFactory::ModelType::EXTENSION; @@ -95,7 +92,7 @@ // Loads the schemas of the |extensions| and passes a ComponentMap to // Register(). - static void LoadSchemasOnBlockingPool( + static void LoadSchemasOnFileTaskRunner( std::unique_ptr<ExtensionSet> extensions, base::WeakPtr<ExtensionTracker> self); void Register(const policy::ComponentMap* components); @@ -175,10 +172,9 @@ added->Remove(to_remove); } - // Load the schema files in a background thread. - BrowserThread::PostBlockingPoolSequencedTask( - kLoadSchemasBackgroundTaskTokenName, FROM_HERE, - base::BindOnce(&ExtensionTracker::LoadSchemasOnBlockingPool, + GetExtensionFileTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce(&ExtensionTracker::LoadSchemasOnFileTaskRunner, base::Passed(&added), weak_factory_.GetWeakPtr())); } @@ -188,7 +184,7 @@ } // static -void ManagedValueStoreCache::ExtensionTracker::LoadSchemasOnBlockingPool( +void ManagedValueStoreCache::ExtensionTracker::LoadSchemasOnFileTaskRunner( std::unique_ptr<ExtensionSet> extensions, base::WeakPtr<ExtensionTracker> self) { base::ThreadRestrictions::AssertIOAllowed();
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc index 6da975d..aaf3441 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -70,7 +70,9 @@ void ChromeVirtualKeyboardDelegate::GetKeyboardConfig( OnKeyboardSettingsCallback on_settings_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - media::AudioSystem::Get()->HasInputDevices( + if (!audio_system_) + audio_system_ = media::AudioSystem::CreateInstance(); + audio_system_->HasInputDevices( base::BindOnce(&ChromeVirtualKeyboardDelegate::OnHasInputDevices, weak_this_, std::move(on_settings_callback))); }
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h index ac03deb..d29ca89 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h
@@ -12,6 +12,10 @@ #include "base/memory/weak_ptr.h" #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_delegate.h" +namespace media { +class AudioSystem; +} + namespace extensions { class ChromeVirtualKeyboardDelegate : public VirtualKeyboardDelegate { @@ -41,6 +45,7 @@ void OnHasInputDevices(OnKeyboardSettingsCallback on_settings_callback, bool has_input_devices); + std::unique_ptr<media::AudioSystem> audio_system_; base::WeakPtr<ChromeVirtualKeyboardDelegate> weak_this_; base::WeakPtrFactory<ChromeVirtualKeyboardDelegate> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ChromeVirtualKeyboardDelegate);
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc index c87e15d26..63ed6ecd 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
@@ -129,6 +129,13 @@ return device_id_salt_; } +media::AudioSystem* WebrtcAudioPrivateFunction::GetAudioSystem() { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (!audio_system_) + audio_system_ = media::AudioSystem::CreateInstance(); + return audio_system_.get(); +} + // TODO(hlundin): Stolen from WebrtcLoggingPrivateFunction. // Consolidate and improve. http://crbug.com/710371 content::RenderProcessHost* @@ -180,7 +187,7 @@ void WebrtcAudioPrivateGetSinksFunction:: GetOutputDeviceDescriptionsOnIOThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); - media::AudioSystem::Get()->GetDeviceDescriptions( + GetAudioSystem()->GetDeviceDescriptions( false, base::BindOnce(&WebrtcAudioPrivateGetSinksFunction:: ReceiveOutputDeviceDescriptionsOnIOThread, this)); @@ -235,7 +242,7 @@ void WebrtcAudioPrivateGetAssociatedSinkFunction:: GetInputDeviceDescriptionsOnIOThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); - media::AudioSystem::Get()->GetDeviceDescriptions( + GetAudioSystem()->GetDeviceDescriptions( true, base::BindOnce(&WebrtcAudioPrivateGetAssociatedSinkFunction:: ReceiveInputDeviceDescriptionsOnIOThread, this)); @@ -264,7 +271,7 @@ CalculateHMACOnIOThread(std::string()); return; } - media::AudioSystem::Get()->GetAssociatedOutputDeviceID( + GetAudioSystem()->GetAssociatedOutputDeviceID( raw_source_id, base::BindOnce( &WebrtcAudioPrivateGetAssociatedSinkFunction::CalculateHMACOnIOThread,
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h index 201f72a..4b6f481e 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
@@ -19,6 +19,10 @@ #include "extensions/browser/browser_context_keyed_api_factory.h" #include "media/audio/audio_device_description.h" +namespace media { +class AudioSystem; +} + namespace extensions { // Listens for device changes and forwards as an extension event. @@ -66,6 +70,8 @@ // |InitDeviceIDSalt()|. std::string device_id_salt() const; + media::AudioSystem* GetAudioSystem(); + // Returns the RenderProcessHost associated with the given |request| // authorized by the |security_origin|. Returns null if unauthorized or // the RPH does not exist. @@ -75,6 +81,7 @@ private: std::string device_id_salt_; + std::unique_ptr<media::AudioSystem> audio_system_; DISALLOW_COPY_AND_ASSIGN(WebrtcAudioPrivateFunction); };
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc index 596f5db..8eec628 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
@@ -62,7 +62,9 @@ void GetAudioDeviceDescriptions(bool for_input, AudioDeviceDescriptions* device_descriptions) { base::RunLoop run_loop; - media::AudioSystem::Get()->GetDeviceDescriptions( + std::unique_ptr<media::AudioSystem> audio_system = + media::AudioSystem::CreateInstance(); + audio_system->GetDeviceDescriptions( for_input, base::BindOnce( [](base::Closure finished_callback, AudioDeviceDescriptions* result,
diff --git a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc index 0de41d2..c81399a 100644 --- a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc +++ b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
@@ -15,10 +15,6 @@ #include "extensions/common/constants.h" #include "printing/features/features.h" -#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) -#include "chrome/browser/ui/app_list/google_now_extension.h" -#endif - #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.h" #include "components/chrome_apps/grit/chrome_apps_resources.h" @@ -49,14 +45,6 @@ return true; } -#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) - std::string google_now_extension_id; - if (GetGoogleNowExtensionId(&google_now_extension_id) && - google_now_extension_id == extension_id) { - return true; - } -#endif - #if defined(OS_CHROMEOS) if (chromeos::ComponentExtensionIMEManagerImpl::IsIMEExtensionID( extension_id)) {
diff --git a/chrome/browser/extensions/external_component_loader.cc b/chrome/browser/extensions/external_component_loader.cc index c3ad803..8768741 100644 --- a/chrome/browser/extensions/external_component_loader.cc +++ b/chrome/browser/extensions/external_component_loader.cc
@@ -24,10 +24,6 @@ #include "chromeos/chromeos_switches.h" #endif -#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) -#include "chrome/browser/ui/app_list/google_now_extension.h" -#endif - namespace extensions { ExternalComponentLoader::ExternalComponentLoader(Profile* profile) @@ -61,12 +57,6 @@ prefs.get()); } -#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) - std::string google_now_extension_id; - if (GetGoogleNowExtensionId(&google_now_extension_id)) - AddExternalExtension(google_now_extension_id, prefs.get()); -#endif - LoadFinished(std::move(prefs)); }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 8559a63..2935e64 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1305,6 +1305,8 @@ "Enabled (Record Type Experiment)"; const char kTLS13VariantNoSessionIDExperiment[] = "Enabled (No Session ID Experiment)"; +const char kTLS13VariantExperiment2[] = "Enabled (Experiment 2)"; +const char kTLS13VariantExperiment3[] = "Enabled (Experiment 3)"; const char kTopDocumentIsolationName[] = "Top document isolation"; const char kTopDocumentIsolationDescription[] = @@ -1580,6 +1582,11 @@ "Set category ranker to order categories of content suggestions (e.g. on " "the NTP)."; +const char kContentSuggestionsDebugLogName[] = "Content suggestions debug log"; +const char kContentSuggestionsDebugLogDescription[] = + "Enable content suggestions debug log accessible through " + "snippets-internals."; + const char kContextualSearchContextualCardsBarIntegration[] = "Contextual Search - Contextual Cards Integration"; const char kContextualSearchContextualCardsBarIntegrationDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 8a1e956..7caf059 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -773,6 +773,8 @@ extern const char kTLS13VariantExperiment[]; extern const char kTLS13VariantRecordTypeExperiment[]; extern const char kTLS13VariantNoSessionIDExperiment[]; +extern const char kTLS13VariantExperiment2[]; +extern const char kTLS13VariantExperiment3[]; extern const char kSuggestionsWithSubStringMatchName[]; extern const char kSuggestionsWithSubStringMatchDescription[]; @@ -978,6 +980,9 @@ extern const char kContentSuggestionsCategoryRankerName[]; extern const char kContentSuggestionsCategoryRankerDescription[]; +extern const char kContentSuggestionsDebugLogName[]; +extern const char kContentSuggestionsDebugLogDescription[]; + extern const char kContextualSearchContextualCardsBarIntegration[]; extern const char kContextualSearchContextualCardsBarIntegrationDescription[];
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index 6acd3cb..e07aaf5 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -289,9 +289,6 @@ mock_permission_prompt_factories_.push_back( base::MakeUnique<MockPermissionPromptFactory>( permission_request_manager)); - - // Prepare the PermissionRequestManager to display a mock bubble. - permission_request_manager->DisplayPendingRequests(); } #if defined(OS_ANDROID)
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index ce712f6..a81308330 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -38,7 +38,7 @@ #endif #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#include "chrome/browser/media/pepper_cdm_test_helper.h" +#include "chrome/browser/media/library_cdm_test_helper.h" #include "media/base/media_switches.h" #include "media/cdm/cdm_paths.h" #endif @@ -305,11 +305,14 @@ #if BUILDFLAG(ENABLE_LIBRARY_CDMS) if (IsExternalClearKey(key_system)) { + // TODO(crbug.com/764143): Only RegisterPepperCdm() when we use pepper CDM + // after we update key system support query to use CdmRegistry. RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, media::kClearKeyCdmAdapterFileName, media::kClearKeyCdmDisplayName, media::kClearKeyCdmPepperMimeType); if (cdm_host_type == CdmHostType::kMojo) { + RegisterExternalClearKey(command_line); scoped_feature_list_.InitWithFeatures( {media::kExternalClearKeyForTesting, media::kMojoCdm, media::kSupportExperimentalCdmInterface}, @@ -343,6 +346,11 @@ // e.g. kExternalClearKeyFileIOTestKeySystem is used to test file IO. void TestNonPlaybackCases(const std::string& key_system, const std::string& expected_title) { + // When mojo CDM is used, make sure the Clear Key CDM is properly registered + // in CdmRegistry. + if (IsUsingMojoCdm()) + EXPECT_TRUE(IsLibraryCdmRegistered(media::kClearKeyCdmType)); + // Since we do not test playback, arbitrarily choose a test file and source // type. RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc index cd2a90c..c0cb9f8 100644 --- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc +++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -31,7 +31,7 @@ #include "url/gurl.h" #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#include "chrome/browser/media/pepper_cdm_test_helper.h" +#include "chrome/browser/media/library_cdm_test_helper.h" #include "media/cdm/cdm_paths.h" #endif @@ -283,6 +283,9 @@ protected: void SetUpCommandLine(base::CommandLine* command_line) override { EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); + // TODO(crbug.com/764143): Replace RegisterPepperCdm() with + // RegisterExternalClearKey() after we migrate key system support query to + // use CdmRegistry. RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, media::kClearKeyCdmAdapterFileName, media::kClearKeyCdmDisplayName,
diff --git a/chrome/browser/media/pepper_cdm_test_helper.cc b/chrome/browser/media/library_cdm_test_helper.cc similarity index 67% rename from chrome/browser/media/pepper_cdm_test_helper.cc rename to chrome/browser/media/library_cdm_test_helper.cc index 06e6a332..4a4f809 100644 --- a/chrome/browser/media/pepper_cdm_test_helper.cc +++ b/chrome/browser/media/library_cdm_test_helper.cc
@@ -2,18 +2,52 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/media/pepper_cdm_test_helper.h" +#include "chrome/browser/media/library_cdm_test_helper.h" #include "base/command_line.h" #include "base/files/file_util.h" +#include "base/native_library.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "content/public/browser/cdm_registry.h" #include "content/public/browser/plugin_service.h" +#include "content/public/common/cdm_info.h" #include "content/public/common/content_switches.h" #include "content/public/common/webplugininfo.h" +#include "media/base/media_switches.h" #include "media/cdm/cdm_paths.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +void RegisterExternalClearKey(base::CommandLine* command_line, + bool expect_cdm_exists) { + base::FilePath cdm_path; + base::PathService::Get(base::DIR_MODULE, &cdm_path); + cdm_path = cdm_path + .Append(media::GetPlatformSpecificDirectory( + media::kClearKeyCdmBaseDirectory)) + .AppendASCII(base::GetNativeLibraryName( + media::kClearKeyCdmLibraryName)); + DCHECK_EQ(expect_cdm_exists, base::PathExists(cdm_path)) + << cdm_path.MaybeAsASCII(); + + // Append the switch to register the Clear Key CDM path. + command_line->AppendSwitchNative(switches::kClearKeyCdmPathForTesting, + cdm_path.value()); +} + +bool IsLibraryCdmRegistered(const std::string& cdm_type) { + std::vector<content::CdmInfo> cdm_info_vector = + content::CdmRegistry::GetInstance()->GetAllRegisteredCdms(); + for (const auto& cdm_info : cdm_info_vector) { + if (cdm_info.type == cdm_type) { + DVLOG(2) << "CDM registered for " << cdm_type << " with path " + << cdm_info.path.value(); + return true; + } + } + + return false; +} base::FilePath GetPepperCdmPath(const std::string& adapter_base_dir, const std::string& adapter_file_name) {
diff --git a/chrome/browser/media/pepper_cdm_test_helper.h b/chrome/browser/media/library_cdm_test_helper.h similarity index 74% rename from chrome/browser/media/pepper_cdm_test_helper.h rename to chrome/browser/media/library_cdm_test_helper.h index b4f69ad..9b77a91 100644 --- a/chrome/browser/media/pepper_cdm_test_helper.h +++ b/chrome/browser/media/library_cdm_test_helper.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_MEDIA_PEPPER_CDM_TEST_HELPER_H_ -#define CHROME_BROWSER_MEDIA_PEPPER_CDM_TEST_HELPER_H_ +#ifndef CHROME_BROWSER_MEDIA_LIBRARY_CDM_TEST_HELPER_H_ +#define CHROME_BROWSER_MEDIA_LIBRARY_CDM_TEST_HELPER_H_ #include <string> @@ -13,6 +13,14 @@ class CommandLine; } +// Registers external clear key CDM in |command_line|. +void RegisterExternalClearKey(base::CommandLine* command_line, + bool expect_cdm_exists = true); + +bool IsLibraryCdmRegistered(const std::string& cdm_type); + +// TODO(crbug.com/403462): Remove the following after pepper CDM is deprecated. + // Returns the path a pepper CDM adapter. base::FilePath GetPepperCdmPath(const std::string& adapter_base_dir, const std::string& adapter_file_name); @@ -39,4 +47,4 @@ // Returns whether a pepper CDM with |mime_type| is registered. bool IsPepperCdmRegistered(const std::string& mime_type); -#endif // CHROME_BROWSER_MEDIA_PEPPER_CDM_TEST_HELPER_H_ +#endif // CHROME_BROWSER_MEDIA_LIBRARY_CDM_TEST_HELPER_H_
diff --git a/chrome/browser/media/router/BUILD.gn b/chrome/browser/media/router/BUILD.gn index 650d762..9ffad96 100644 --- a/chrome/browser/media/router/BUILD.gn +++ b/chrome/browser/media/router/BUILD.gn
@@ -76,6 +76,8 @@ "media_router_ui_service.h", "media_router_ui_service_factory.cc", "media_router_ui_service_factory.h", + "mojo/extension_media_route_provider_proxy.cc", + "mojo/extension_media_route_provider_proxy.h", "mojo/media_route_controller.cc", "mojo/media_route_controller.h", "mojo/media_route_provider_util_win.cc",
diff --git a/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.cc b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.cc new file mode 100644 index 0000000..ce0fb1b --- /dev/null +++ b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.cc
@@ -0,0 +1,391 @@ +// 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/media/router/mojo/extension_media_route_provider_proxy.h" + +#include <string> +#include <utility> +#include <vector> + +#include "chrome/browser/media/router/event_page_request_manager.h" +#include "chrome/browser/media/router/event_page_request_manager_factory.h" +#include "chrome/browser/media/router/media_router_feature.h" + +namespace media_router { + +ExtensionMediaRouteProviderProxy::ExtensionMediaRouteProviderProxy( + content::BrowserContext* context, + mojom::MediaRouteProviderRequest request) + : binding_(this, std::move(request)), + request_manager_( + EventPageRequestManagerFactory::GetApiForBrowserContext(context)), + weak_factory_(this) {} + +ExtensionMediaRouteProviderProxy::~ExtensionMediaRouteProviderProxy() = default; + +void ExtensionMediaRouteProviderProxy::CreateRoute( + const std::string& media_source, + const std::string& sink_id, + const std::string& original_presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + CreateRouteCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoCreateRoute, + weak_factory_.GetWeakPtr(), media_source, sink_id, + original_presentation_id, origin, tab_id, timeout, + incognito, std::move(callback)), + MediaRouteProviderWakeReason::CREATE_ROUTE); +} + +void ExtensionMediaRouteProviderProxy::JoinRoute( + const std::string& media_source, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + JoinRouteCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoJoinRoute, + weak_factory_.GetWeakPtr(), media_source, presentation_id, + origin, tab_id, timeout, incognito, std::move(callback)), + MediaRouteProviderWakeReason::JOIN_ROUTE); +} + +void ExtensionMediaRouteProviderProxy::ConnectRouteByRouteId( + const std::string& media_source, + const std::string& route_id, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + ConnectRouteByRouteIdCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoConnectRouteByRouteId, + weak_factory_.GetWeakPtr(), media_source, route_id, + presentation_id, origin, tab_id, timeout, incognito, + std::move(callback)), + MediaRouteProviderWakeReason::CONNECT_ROUTE_BY_ROUTE_ID); +} + +void ExtensionMediaRouteProviderProxy::TerminateRoute( + const std::string& route_id, + TerminateRouteCallback callback) { + DVLOG(2) << "TerminateRoute " << route_id; + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoTerminateRoute, + weak_factory_.GetWeakPtr(), route_id, std::move(callback)), + MediaRouteProviderWakeReason::TERMINATE_ROUTE); +} + +void ExtensionMediaRouteProviderProxy::SendRouteMessage( + const std::string& media_route_id, + const std::string& message, + SendRouteMessageCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoSendRouteMessage, + weak_factory_.GetWeakPtr(), media_route_id, message, + std::move(callback)), + MediaRouteProviderWakeReason::SEND_SESSION_MESSAGE); +} + +void ExtensionMediaRouteProviderProxy::SendRouteBinaryMessage( + const std::string& media_route_id, + const std::vector<uint8_t>& data, + SendRouteBinaryMessageCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoSendRouteBinaryMessage, + weak_factory_.GetWeakPtr(), media_route_id, data, + std::move(callback)), + MediaRouteProviderWakeReason::SEND_SESSION_BINARY_MESSAGE); +} + +void ExtensionMediaRouteProviderProxy::StartObservingMediaSinks( + const std::string& media_source) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoStartObservingMediaSinks, + weak_factory_.GetWeakPtr(), media_source), + MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_SINKS); +} + +void ExtensionMediaRouteProviderProxy::StopObservingMediaSinks( + const std::string& media_source) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoStopObservingMediaSinks, + weak_factory_.GetWeakPtr(), media_source), + MediaRouteProviderWakeReason::STOP_OBSERVING_MEDIA_ROUTES); +} + +void ExtensionMediaRouteProviderProxy::StartObservingMediaRoutes( + const std::string& media_source) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoStartObservingMediaRoutes, + weak_factory_.GetWeakPtr(), media_source), + MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_ROUTES); +} + +void ExtensionMediaRouteProviderProxy::StopObservingMediaRoutes( + const std::string& media_source) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoStopObservingMediaRoutes, + weak_factory_.GetWeakPtr(), media_source), + MediaRouteProviderWakeReason::STOP_OBSERVING_MEDIA_ROUTES); +} + +void ExtensionMediaRouteProviderProxy::StartListeningForRouteMessages( + const std::string& route_id) { + request_manager_->RunOrDefer( + base::Bind( + &ExtensionMediaRouteProviderProxy::DoStartListeningForRouteMessages, + weak_factory_.GetWeakPtr(), route_id), + MediaRouteProviderWakeReason::START_LISTENING_FOR_ROUTE_MESSAGES); +} + +void ExtensionMediaRouteProviderProxy::StopListeningForRouteMessages( + const std::string& route_id) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoStopListeningForRouteMessages, + weak_factory_.GetWeakPtr(), route_id), + MediaRouteProviderWakeReason::STOP_LISTENING_FOR_ROUTE_MESSAGES); +} + +void ExtensionMediaRouteProviderProxy::DetachRoute( + const std::string& route_id) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoDetachRoute, + weak_factory_.GetWeakPtr(), route_id), + MediaRouteProviderWakeReason::DETACH_ROUTE); +} + +void ExtensionMediaRouteProviderProxy::EnableMdnsDiscovery() { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoEnableMdnsDiscovery, + weak_factory_.GetWeakPtr()), + MediaRouteProviderWakeReason::ENABLE_MDNS_DISCOVERY); +} + +void ExtensionMediaRouteProviderProxy::UpdateMediaSinks( + const std::string& media_source) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoUpdateMediaSinks, + weak_factory_.GetWeakPtr(), media_source), + MediaRouteProviderWakeReason::UPDATE_MEDIA_SINKS); +} + +void ExtensionMediaRouteProviderProxy::SearchSinks( + const std::string& sink_id, + const std::string& media_source, + mojom::SinkSearchCriteriaPtr search_criteria, + SearchSinksCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoSearchSinks, + weak_factory_.GetWeakPtr(), sink_id, media_source, + std::move(search_criteria), std::move(callback)), + MediaRouteProviderWakeReason::SEARCH_SINKS); +} + +void ExtensionMediaRouteProviderProxy::ProvideSinks( + const std::string& provider_name, + const std::vector<media_router::MediaSinkInternal>& sinks) { + DVLOG(1) << "ProvideSinks called with " << sinks.size() + << " sinks from provider: " << provider_name; + request_manager_->RunOrDefer( + base::BindOnce(&ExtensionMediaRouteProviderProxy::DoProvideSinks, + weak_factory_.GetWeakPtr(), provider_name, sinks), + MediaRouteProviderWakeReason::PROVIDE_SINKS); +} + +void ExtensionMediaRouteProviderProxy::CreateMediaRouteController( + const std::string& route_id, + mojom::MediaControllerRequest media_controller, + mojom::MediaStatusObserverPtr observer, + CreateMediaRouteControllerCallback callback) { + request_manager_->RunOrDefer( + base::BindOnce( + &ExtensionMediaRouteProviderProxy::DoCreateMediaRouteController, + weak_factory_.GetWeakPtr(), route_id, std::move(media_controller), + std::move(observer), std::move(callback)), + MediaRouteProviderWakeReason::CREATE_MEDIA_ROUTE_CONTROLLER); +} + +void ExtensionMediaRouteProviderProxy::RegisterMediaRouteProvider( + mojom::MediaRouteProviderPtr media_route_provider) { + media_route_provider_ = std::move(media_route_provider); + media_route_provider_.set_connection_error_handler( + base::BindOnce(&ExtensionMediaRouteProviderProxy::OnConnectionError, + base::Unretained(this))); +} + +void ExtensionMediaRouteProviderProxy::OnConnectionError() { + media_route_provider_.reset(); +} + +void ExtensionMediaRouteProviderProxy::DoCreateRoute( + const std::string& media_source, + const std::string& sink_id, + const std::string& original_presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + CreateRouteCallback callback) { + DVLOG(1) << "DoCreateRoute " << media_source << "=>" << sink_id + << ", presentation ID: " << original_presentation_id; + media_route_provider_->CreateRoute(media_source, sink_id, + original_presentation_id, origin, tab_id, + timeout, incognito, std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoJoinRoute( + const std::string& media_source, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + JoinRouteCallback callback) { + DVLOG(1) << "DoJoinRoute " << media_source + << ", presentation ID: " << presentation_id; + media_route_provider_->JoinRoute(media_source, presentation_id, origin, + tab_id, timeout, incognito, + std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoConnectRouteByRouteId( + const std::string& media_source, + const std::string& route_id, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + ConnectRouteByRouteIdCallback callback) { + DVLOG(1) << "DoConnectRouteByRouteId " << media_source + << ", route ID: " << route_id + << ", presentation ID: " << presentation_id; + media_route_provider_->ConnectRouteByRouteId( + media_source, route_id, presentation_id, origin, tab_id, timeout, + incognito, std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoTerminateRoute( + const std::string& route_id, + TerminateRouteCallback callback) { + DVLOG(1) << "DoTerminateRoute " << route_id; + media_route_provider_->TerminateRoute(route_id, std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoSendRouteMessage( + const std::string& media_route_id, + const std::string& message, + SendRouteMessageCallback callback) { + DVLOG(1) << "DoSendRouteMessage " << media_route_id; + media_route_provider_->SendRouteMessage(media_route_id, message, + std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoSendRouteBinaryMessage( + const std::string& media_route_id, + const std::vector<uint8_t>& data, + SendRouteBinaryMessageCallback callback) { + DVLOG(1) << "DoSendRouteBinaryMessage " << media_route_id; + media_route_provider_->SendRouteBinaryMessage(media_route_id, data, + std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoStartObservingMediaSinks( + const std::string& media_source) { + DVLOG(1) << "DoStartObservingMediaSinks: " << media_source; + media_route_provider_->StartObservingMediaSinks(media_source); +} + +void ExtensionMediaRouteProviderProxy::DoStopObservingMediaSinks( + const std::string& media_source) { + DVLOG(1) << "DoStopObservingMediaSinks: " << media_source; + media_route_provider_->StopObservingMediaSinks(media_source); +} + +void ExtensionMediaRouteProviderProxy::DoStartObservingMediaRoutes( + const std::string& media_source) { + DVLOG(1) << "DoStartObservingMediaRoutes: " << media_source; + media_route_provider_->StartObservingMediaRoutes(media_source); +} + +void ExtensionMediaRouteProviderProxy::DoStopObservingMediaRoutes( + const std::string& media_source) { + DVLOG(1) << "DoStopObservingMediaRoutes: " << media_source; + media_route_provider_->StopObservingMediaRoutes(media_source); +} + +void ExtensionMediaRouteProviderProxy::DoStartListeningForRouteMessages( + const std::string& route_id) { + DVLOG(1) << "DoStartListeningForRouteMessages"; + media_route_provider_->StartListeningForRouteMessages(route_id); +} + +void ExtensionMediaRouteProviderProxy::DoStopListeningForRouteMessages( + const std::string& route_id) { + DVLOG(1) << "StopListeningForRouteMessages"; + media_route_provider_->StopListeningForRouteMessages(route_id); +} + +void ExtensionMediaRouteProviderProxy::DoDetachRoute( + const std::string& route_id) { + DVLOG(1) << "DoDetachRoute " << route_id; + media_route_provider_->DetachRoute(route_id); +} + +void ExtensionMediaRouteProviderProxy::DoEnableMdnsDiscovery() { + DVLOG(1) << "DoEnsureMdnsDiscoveryEnabled"; + media_route_provider_->EnableMdnsDiscovery(); +} + +void ExtensionMediaRouteProviderProxy::DoUpdateMediaSinks( + const std::string& media_source) { + DVLOG(1) << "DoUpdateMediaSinks: " << media_source; + media_route_provider_->UpdateMediaSinks(media_source); +} + +void ExtensionMediaRouteProviderProxy::DoSearchSinks( + const std::string& sink_id, + const std::string& media_source, + mojom::SinkSearchCriteriaPtr search_criteria, + SearchSinksCallback callback) { + DVLOG(1) << "SearchSinks"; + media_route_provider_->SearchSinks( + sink_id, media_source, std::move(search_criteria), std::move(callback)); +} + +void ExtensionMediaRouteProviderProxy::DoProvideSinks( + const std::string& provider_name, + const std::vector<media_router::MediaSinkInternal>& sinks) { + DVLOG(1) << "DoProvideSinks"; + media_route_provider_->ProvideSinks(provider_name, sinks); +} + +void ExtensionMediaRouteProviderProxy::DoCreateMediaRouteController( + const std::string& route_id, + mojom::MediaControllerRequest media_controller, + mojom::MediaStatusObserverPtr observer, + CreateMediaRouteControllerCallback callback) { + DVLOG(1) << "DoCreateMediaRouteController"; + if (!media_controller.is_pending() || !observer.is_bound()) + return; + + media_route_provider_->CreateMediaRouteController( + route_id, std::move(media_controller), std::move(observer), + std::move(callback)); +} + +} // namespace media_router
diff --git a/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.h b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.h new file mode 100644 index 0000000..84ddfdd6 --- /dev/null +++ b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy.h
@@ -0,0 +1,175 @@ +// 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_MEDIA_ROUTER_MOJO_EXTENSION_MEDIA_ROUTE_PROVIDER_PROXY_H_ +#define CHROME_BROWSER_MEDIA_ROUTER_MOJO_EXTENSION_MEDIA_ROUTE_PROVIDER_PROXY_H_ + +#include "base/memory/weak_ptr.h" +#include "chrome/common/media_router/mojo/media_router.mojom.h" +#include "mojo/public/cpp/bindings/binding.h" + +namespace content { +class BrowserContext; +} + +namespace media_router { + +class EventPageRequestManager; + +// A class that forwards MediaRouteProvider calls to the implementation in the +// component extension via EventPageRequestManager. +// +// The MediaRouter implementation holds a Mojo pointer bound to this object via +// the request passed into the ctor. +// +// Calls from this object to the component extension MRP are queued with +// EventPageRequestManager. When the extension is awake, the Mojo pointer to the +// MRP is valid, so the request is executed immediately. Otherwise, when the +// extension is awakened, this object obtains a valid Mojo pointer to the MRP +// from MediaRouter, and MediaRouter makes EventPageRequestManager execute all +// the requests. +class ExtensionMediaRouteProviderProxy : public mojom::MediaRouteProvider { + public: + ExtensionMediaRouteProviderProxy(content::BrowserContext* context, + mojom::MediaRouteProviderRequest request); + ~ExtensionMediaRouteProviderProxy() override; + + // mojom::MediaRouteProvider implementation. Forwards the calls to + // |media_route_provider_| through |request_manager_|. + void CreateRoute(const std::string& media_source, + const std::string& sink_id, + const std::string& original_presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + CreateRouteCallback callback) override; + void JoinRoute(const std::string& media_source, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + JoinRouteCallback callback) override; + void ConnectRouteByRouteId(const std::string& media_source, + const std::string& route_id, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + ConnectRouteByRouteIdCallback callback) override; + void TerminateRoute(const std::string& route_id, + TerminateRouteCallback callback) override; + void SendRouteMessage(const std::string& media_route_id, + const std::string& message, + SendRouteMessageCallback callback) override; + void SendRouteBinaryMessage(const std::string& media_route_id, + const std::vector<uint8_t>& data, + SendRouteBinaryMessageCallback callback) override; + void StartObservingMediaSinks(const std::string& media_source) override; + void StopObservingMediaSinks(const std::string& media_source) override; + void StartObservingMediaRoutes(const std::string& media_source) override; + void StopObservingMediaRoutes(const std::string& media_source) override; + void StartListeningForRouteMessages(const std::string& route_id) override; + void StopListeningForRouteMessages(const std::string& route_id) override; + void DetachRoute(const std::string& route_id) override; + void EnableMdnsDiscovery() override; + void UpdateMediaSinks(const std::string& media_source) override; + void SearchSinks(const std::string& sink_id, + const std::string& media_source, + mojom::SinkSearchCriteriaPtr search_criteria, + SearchSinksCallback callback) override; + void ProvideSinks( + const std::string& provider_name, + const std::vector<media_router::MediaSinkInternal>& sinks) override; + void CreateMediaRouteController( + const std::string& route_id, + mojom::MediaControllerRequest media_controller, + mojom::MediaStatusObserverPtr observer, + CreateMediaRouteControllerCallback callback) override; + + // Sets the MediaRouteProvider to forward calls to. + void RegisterMediaRouteProvider( + mojom::MediaRouteProviderPtr media_route_provider); + + private: + // Called when the connection to |media_route_provider_| is disconnected. + void OnConnectionError(); + + // These methods call the corresponding |media_route_provider_| methods. + // Passed to |request_manager_| as requests to be run when the Mojo connection + // to the provider is established. + void DoCreateRoute(const std::string& media_source, + const std::string& sink_id, + const std::string& original_presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + CreateRouteCallback callback); + void DoJoinRoute(const std::string& media_source, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + JoinRouteCallback callback); + void DoConnectRouteByRouteId(const std::string& media_source, + const std::string& route_id, + const std::string& presentation_id, + const url::Origin& origin, + int32_t tab_id, + base::TimeDelta timeout, + bool incognito, + ConnectRouteByRouteIdCallback callback); + void DoTerminateRoute(const std::string& route_id, + TerminateRouteCallback callback); + void DoSendRouteMessage(const std::string& media_route_id, + const std::string& message, + SendRouteMessageCallback callback); + void DoSendRouteBinaryMessage(const std::string& media_route_id, + const std::vector<uint8_t>& data, + SendRouteBinaryMessageCallback callback); + void DoStartObservingMediaSinks(const std::string& media_source); + void DoStopObservingMediaSinks(const std::string& media_source); + void DoStartObservingMediaRoutes(const std::string& media_source); + void DoStopObservingMediaRoutes(const std::string& media_source); + void DoStartListeningForRouteMessages(const std::string& route_id); + void DoStopListeningForRouteMessages(const std::string& route_id); + void DoDetachRoute(const std::string& route_id); + void DoEnableMdnsDiscovery(); + void DoUpdateMediaSinks(const std::string& media_source); + void DoSearchSinks(const std::string& sink_id, + const std::string& media_source, + mojom::SinkSearchCriteriaPtr search_criteria, + SearchSinksCallback callback); + void DoProvideSinks( + const std::string& provider_name, + const std::vector<media_router::MediaSinkInternal>& sinks); + void DoCreateMediaRouteController( + const std::string& route_id, + mojom::MediaControllerRequest media_controller, + mojom::MediaStatusObserverPtr observer, + CreateMediaRouteControllerCallback callback); + + // Mojo pointer to the MediaRouteProvider in the component extension. + // Set to null initially, and later set to the Mojo pointer passed in via + // RegisterMediaRouteProvider(). This is set to null again when the component + // extension is suspended or a Mojo channel error occurs. + mojom::MediaRouteProviderPtr media_route_provider_; + + // Binds |this| to the Mojo request passed into the ctor. + mojo::Binding<mojom::MediaRouteProvider> binding_; + + // Request manager responsible for waking the component extension and calling + // the requests to it. + EventPageRequestManager* const request_manager_; + + base::WeakPtrFactory<ExtensionMediaRouteProviderProxy> weak_factory_; +}; + +} // namespace media_router + +#endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_EXTENSION_MEDIA_ROUTE_PROVIDER_PROXY_H_
diff --git a/chrome/browser/media/router/mojo/extension_media_route_provider_proxy_unittest.cc b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy_unittest.cc new file mode 100644 index 0000000..912c20fc --- /dev/null +++ b/chrome/browser/media/router/mojo/extension_media_route_provider_proxy_unittest.cc
@@ -0,0 +1,280 @@ +// 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/media/router/mojo/extension_media_route_provider_proxy.h" + +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/test/mock_callback.h" +#include "chrome/browser/media/router/event_page_request_manager.h" +#include "chrome/browser/media/router/event_page_request_manager_factory.h" +#include "chrome/browser/media/router/mojo/media_router_mojo_test.h" +#include "chrome/test/base/testing_profile.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::_; +using testing::ElementsAre; +using testing::Invoke; +using testing::Mock; +using testing::StrictMock; +using testing::WithArg; + +namespace media_router { + +namespace { + +using MockRouteCallback = + base::MockCallback<MockMediaRouteProvider::RouteCallback>; +using MockTerminateRouteCallback = + base::MockCallback<mojom::MediaRouteProvider::TerminateRouteCallback>; +using MockBoolCallback = base::MockCallback<base::OnceCallback<void(bool)>>; +using MockSearchSinksCallback = + base::MockCallback<base::OnceCallback<void(const std::string&)>>; + +const char kDescription[] = "description"; +const bool kIsIncognito = false; +const char kSource[] = "source1"; +const char kRouteId[] = "routeId"; +const char kSinkId[] = "sink"; +const int kTabId = 1; +const char kPresentationId[] = "presentationId"; +const char kOrigin[] = "http://origin/"; +const int kTimeoutMillis = 5 * 1000; + +} // namespace + +class ExtensionMediaRouteProviderProxyTest : public testing::Test { + public: + ExtensionMediaRouteProviderProxyTest() = default; + ~ExtensionMediaRouteProviderProxyTest() override = default; + + protected: + void SetUp() override { + request_manager_ = static_cast<MockEventPageRequestManager*>( + EventPageRequestManagerFactory::GetInstance()->SetTestingFactoryAndUse( + &profile_, &MockEventPageRequestManager::Create)); + ON_CALL(*request_manager_, RunOrDeferInternal(_, _)) + .WillByDefault(Invoke([](base::OnceClosure& request, + MediaRouteProviderWakeReason wake_reason) { + std::move(request).Run(); + })); + + provider_proxy_ = base::MakeUnique<ExtensionMediaRouteProviderProxy>( + &profile_, mojo::MakeRequest(&provider_proxy_ptr_)); + RegisterMockMediaRouteProvider(); + } + + const MediaSource media_source_ = MediaSource(kSource); + const MediaRoute route_ = MediaRoute(kRouteId, + media_source_, + kSinkId, + kDescription, + false, + "", + false); + std::unique_ptr<ExtensionMediaRouteProviderProxy> provider_proxy_; + mojom::MediaRouteProviderPtr provider_proxy_ptr_; + StrictMock<MockMediaRouteProvider> mock_provider_; + + private: + void RegisterMockMediaRouteProvider() { + mock_provider_.SetRouteToReturn(route_); + + mojom::MediaRouteProviderPtr mock_provider_ptr; + binding_ = base::MakeUnique<mojo::Binding<mojom::MediaRouteProvider>>( + &mock_provider_, mojo::MakeRequest(&mock_provider_ptr)); + provider_proxy_->RegisterMediaRouteProvider(std::move(mock_provider_ptr)); + } + + content::TestBrowserThreadBundle thread_bundle_; + MockEventPageRequestManager* request_manager_ = nullptr; + std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; + TestingProfile profile_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionMediaRouteProviderProxyTest); +}; + +TEST_F(ExtensionMediaRouteProviderProxyTest, CreateRoute) { + EXPECT_CALL( + mock_provider_, + CreateRouteInternal( + kSource, kSinkId, kPresentationId, url::Origin(GURL(kOrigin)), kTabId, + base::TimeDelta::FromMilliseconds(kTimeoutMillis), kIsIncognito, _)) + .WillOnce(WithArg<7>(Invoke( + &mock_provider_, &MockMediaRouteProvider::RouteRequestSuccess))); + + MockRouteCallback callback; + provider_proxy_->CreateRoute( + kSource, kSinkId, kPresentationId, url::Origin(GURL(kOrigin)), kTabId, + base::TimeDelta::FromMilliseconds(kTimeoutMillis), kIsIncognito, + base::BindOnce(&MockRouteCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, JoinRoute) { + EXPECT_CALL( + mock_provider_, + JoinRouteInternal( + kSource, kPresentationId, url::Origin(GURL(kOrigin)), kTabId, + base::TimeDelta::FromMilliseconds(kTimeoutMillis), kIsIncognito, _)) + .WillOnce(WithArg<6>(Invoke( + &mock_provider_, &MockMediaRouteProvider::RouteRequestSuccess))); + + MockRouteCallback callback; + provider_proxy_->JoinRoute( + kSource, kPresentationId, url::Origin(GURL(kOrigin)), kTabId, + base::TimeDelta::FromMilliseconds(kTimeoutMillis), kIsIncognito, + base::BindOnce(&MockRouteCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, ConnectRouteByRouteId) { + EXPECT_CALL( + mock_provider_, + ConnectRouteByRouteIdInternal( + kSource, kRouteId, kPresentationId, url::Origin(GURL(kOrigin)), + kTabId, base::TimeDelta::FromMilliseconds(kTimeoutMillis), + kIsIncognito, _)) + .WillOnce(WithArg<7>(Invoke( + &mock_provider_, &MockMediaRouteProvider::RouteRequestSuccess))); + + MockRouteCallback callback; + provider_proxy_->ConnectRouteByRouteId( + kSource, kRouteId, kPresentationId, url::Origin(GURL(kOrigin)), kTabId, + base::TimeDelta::FromMilliseconds(kTimeoutMillis), kIsIncognito, + base::BindOnce(&MockRouteCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, TerminateRoute) { + EXPECT_CALL(mock_provider_, TerminateRouteInternal(kRouteId, _)) + .WillOnce(WithArg<1>(Invoke( + &mock_provider_, &MockMediaRouteProvider::TerminateRouteSuccess))); + + MockTerminateRouteCallback callback; + provider_proxy_->TerminateRoute( + kRouteId, base::BindOnce(&MockTerminateRouteCallback::Run, + base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, SendRouteMessage) { + const std::string message = "message"; + EXPECT_CALL(mock_provider_, SendRouteMessageInternal(kRouteId, message, _)) + .WillOnce(WithArg<2>(Invoke( + &mock_provider_, &MockMediaRouteProvider::SendRouteMessageSuccess))); + + MockBoolCallback callback; + provider_proxy_->SendRouteMessage( + kRouteId, message, + base::BindOnce(&MockBoolCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, SendRouteBinaryMessage) { + std::vector<uint8_t> data = {42}; + EXPECT_CALL(mock_provider_, + SendRouteBinaryMessageInternal(kRouteId, ElementsAre(42), _)) + .WillOnce(WithArg<2>( + Invoke(&mock_provider_, + &MockMediaRouteProvider::SendRouteBinaryMessageSuccess))); + + MockBoolCallback callback; + provider_proxy_->SendRouteBinaryMessage( + kRouteId, data, + base::BindOnce(&MockBoolCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, StartAndStopObservingMediaSinks) { + EXPECT_CALL(mock_provider_, StopObservingMediaSinks(kSource)); + provider_proxy_->StopObservingMediaSinks(kSource); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, StartAndStopObservingMediaRoutes) { + EXPECT_CALL(mock_provider_, StopObservingMediaRoutes(kSource)); + provider_proxy_->StopObservingMediaRoutes(kSource); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, StartListeningForRouteMessages) { + EXPECT_CALL(mock_provider_, StartListeningForRouteMessages(kSource)); + provider_proxy_->StartListeningForRouteMessages(kSource); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, StopListeningForRouteMessages) { + EXPECT_CALL(mock_provider_, StopListeningForRouteMessages(kSource)); + provider_proxy_->StopListeningForRouteMessages(kSource); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, DetachRoute) { + EXPECT_CALL(mock_provider_, DetachRoute(kRouteId)); + provider_proxy_->DetachRoute(kRouteId); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, EnableMdnsDiscovery) { + EXPECT_CALL(mock_provider_, EnableMdnsDiscovery()); + provider_proxy_->EnableMdnsDiscovery(); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, UpdateMediaSinks) { + EXPECT_CALL(mock_provider_, UpdateMediaSinks(kSource)); + provider_proxy_->UpdateMediaSinks(kSource); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, SearchSinks) { + EXPECT_CALL(mock_provider_, SearchSinksInternal(kSinkId, kSource, _, _)) + .WillOnce(WithArg<3>(Invoke( + &mock_provider_, &MockMediaRouteProvider::SearchSinksSuccess))); + + auto sink_search_criteria = mojom::SinkSearchCriteria::New(); + MockSearchSinksCallback callback; + provider_proxy_->SearchSinks(kSinkId, kSource, + std::move(sink_search_criteria), + base::BindOnce(&MockSearchSinksCallback::Run, + base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, ProvideSinks) { + const std::string provider_name = "provider name"; + MediaSinkInternal sink; + sink.set_sink_id(kSinkId); + const std::vector<media_router::MediaSinkInternal> sinks = {sink}; + + EXPECT_CALL(mock_provider_, ProvideSinks(provider_name, ElementsAre(sink))); + provider_proxy_->ProvideSinks(provider_name, sinks); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(ExtensionMediaRouteProviderProxyTest, CreateMediaRouteController) { + EXPECT_CALL(mock_provider_, + CreateMediaRouteControllerInternal(kRouteId, _, _, _)) + .WillOnce(WithArg<3>( + Invoke(&mock_provider_, + &MockMediaRouteProvider::CreateMediaRouteControllerSuccess))); + + mojom::MediaControllerPtr controller_ptr; + mojom::MediaControllerRequest controller_request = + mojo::MakeRequest(&controller_ptr); + mojom::MediaStatusObserverPtr observer_ptr; + mojom::MediaStatusObserverRequest observer_request = + mojo::MakeRequest(&observer_ptr); + + MockBoolCallback callback; + provider_proxy_->CreateMediaRouteController( + kRouteId, std::move(controller_request), std::move(observer_ptr), + base::BindOnce(&MockBoolCallback::Run, base::Unretained(&callback))); + base::RunLoop().RunUntilIdle(); +} + +} // namespace media_router
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.cc b/chrome/browser/media/router/mojo/media_router_desktop.cc index 4072c7f9..40baa606 100644 --- a/chrome/browser/media/router/mojo/media_router_desktop.cc +++ b/chrome/browser/media/router/mojo/media_router_desktop.cc
@@ -7,6 +7,7 @@ #include "chrome/browser/media/router/event_page_request_manager.h" #include "chrome/browser/media/router/event_page_request_manager_factory.h" #include "chrome/browser/media/router/media_router_factory.h" +#include "chrome/browser/media/router/media_router_feature.h" #include "chrome/browser/media/router/mojo/media_route_controller.h" #include "chrome/common/media_router/media_source_helper.h" #include "extensions/common/extension.h" @@ -41,276 +42,6 @@ #endif } -void MediaRouterDesktop::DoCreateRoute( - const MediaSource::Id& source_id, - const MediaSink::Id& sink_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoCreateRoute(source_id, sink_id, origin, tab_id, - std::move(callbacks), timeout, - incognito); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoCreateRoute, - weak_factory_.GetWeakPtr(), source_id, sink_id, origin, - tab_id, std::move(callbacks), timeout, incognito), - MediaRouteProviderWakeReason::CREATE_ROUTE); -} - -void MediaRouterDesktop::DoJoinRoute( - const MediaSource::Id& source_id, - const std::string& presentation_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoJoinRoute(source_id, presentation_id, origin, tab_id, - std::move(callbacks), timeout, incognito); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoJoinRoute, - weak_factory_.GetWeakPtr(), source_id, presentation_id, - origin, tab_id, std::move(callbacks), timeout, incognito), - MediaRouteProviderWakeReason::JOIN_ROUTE); -} - -void MediaRouterDesktop::DoConnectRouteByRouteId( - const MediaSource::Id& source_id, - const MediaRoute::Id& route_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoConnectRouteByRouteId(source_id, route_id, origin, - tab_id, std::move(callbacks), - timeout, incognito); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoConnectRouteByRouteId, - weak_factory_.GetWeakPtr(), source_id, route_id, origin, - tab_id, std::move(callbacks), timeout, incognito), - MediaRouteProviderWakeReason::CONNECT_ROUTE_BY_ROUTE_ID); -} - -void MediaRouterDesktop::DoTerminateRoute(const MediaRoute::Id& route_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoTerminateRoute(route_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoTerminateRoute, - weak_factory_.GetWeakPtr(), route_id), - MediaRouteProviderWakeReason::TERMINATE_ROUTE); -} - -void MediaRouterDesktop::DoDetachRoute(const MediaRoute::Id& route_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoDetachRoute(route_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoDetachRoute, - weak_factory_.GetWeakPtr(), route_id), - MediaRouteProviderWakeReason::DETACH_ROUTE); -} - -void MediaRouterDesktop::DoSendRouteMessage(const MediaRoute::Id& route_id, - const std::string& message, - SendRouteMessageCallback callback) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoSendRouteMessage(route_id, message, - std::move(callback)); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoSendRouteMessage, - weak_factory_.GetWeakPtr(), route_id, message, - std::move(callback)), - MediaRouteProviderWakeReason::SEND_SESSION_MESSAGE); -} - -void MediaRouterDesktop::DoSendRouteBinaryMessage( - const MediaRoute::Id& route_id, - std::unique_ptr<std::vector<uint8_t>> data, - SendRouteMessageCallback callback) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoSendRouteBinaryMessage(route_id, std::move(data), - std::move(callback)); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoSendRouteBinaryMessage, - weak_factory_.GetWeakPtr(), route_id, - base::Passed(std::move(data)), std::move(callback)), - MediaRouteProviderWakeReason::SEND_SESSION_BINARY_MESSAGE); -} - -void MediaRouterDesktop::DoStartListeningForRouteMessages( - const MediaRoute::Id& route_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStartListeningForRouteMessages(route_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStartListeningForRouteMessages, - weak_factory_.GetWeakPtr(), route_id), - MediaRouteProviderWakeReason::START_LISTENING_FOR_ROUTE_MESSAGES); -} - -void MediaRouterDesktop::DoStopListeningForRouteMessages( - const MediaRoute::Id& route_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStopListeningForRouteMessages(route_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStopListeningForRouteMessages, - weak_factory_.GetWeakPtr(), route_id), - MediaRouteProviderWakeReason::STOP_LISTENING_FOR_ROUTE_MESSAGES); -} - -void MediaRouterDesktop::DoStartObservingMediaSinks( - const MediaSource::Id& source_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStartObservingMediaSinks(source_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStartObservingMediaSinks, - weak_factory_.GetWeakPtr(), source_id), - MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_SINKS); -} - -void MediaRouterDesktop::DoStopObservingMediaSinks( - const MediaSource::Id& source_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStopObservingMediaSinks(source_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStopObservingMediaSinks, - weak_factory_.GetWeakPtr(), source_id), - MediaRouteProviderWakeReason::STOP_OBSERVING_MEDIA_SINKS); -} - -void MediaRouterDesktop::DoStartObservingMediaRoutes( - const MediaSource::Id& source_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStartObservingMediaRoutes(source_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStartObservingMediaRoutes, - weak_factory_.GetWeakPtr(), source_id), - MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_ROUTES); -} - -void MediaRouterDesktop::DoStopObservingMediaRoutes( - const MediaSource::Id& source_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoStopObservingMediaRoutes(source_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoStopObservingMediaRoutes, - weak_factory_.GetWeakPtr(), source_id), - MediaRouteProviderWakeReason::STOP_OBSERVING_MEDIA_ROUTES); -} - -void MediaRouterDesktop::DoSearchSinks( - const MediaSink::Id& sink_id, - const MediaSource::Id& source_id, - const std::string& search_input, - const std::string& domain, - MediaSinkSearchResponseCallback sink_callback) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoSearchSinks(sink_id, source_id, search_input, domain, - std::move(sink_callback)); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoSearchSinks, - weak_factory_.GetWeakPtr(), sink_id, source_id, - search_input, domain, std::move(sink_callback)), - MediaRouteProviderWakeReason::SEARCH_SINKS); -} - -void MediaRouterDesktop::CreateMediaRouteControllerDeferred( - const MediaRoute::Id& route_id) { - auto controller_it = route_controllers_.find(route_id); - if (controller_it == route_controllers_.end()) { - DVLOG(1) << __func__ << ": route controller no longer exists: " << route_id; - return; - } - DoCreateMediaRouteController(controller_it->second); -} - -void MediaRouterDesktop::DoCreateMediaRouteController( - MediaRouteController* controller) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoCreateMediaRouteController(controller); - return; - } - // We bind the route ID here since the controller may be deleted by the time - // the callback is executed. - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::CreateMediaRouteControllerDeferred, - weak_factory_.GetWeakPtr(), controller->route_id()), - MediaRouteProviderWakeReason::CREATE_MEDIA_ROUTE_CONTROLLER); -} - -void MediaRouterDesktop::DoProvideSinks(const std::string& provider_name, - std::vector<MediaSinkInternal> sinks) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoProvideSinks(provider_name, std::move(sinks)); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoProvideSinks, - weak_factory_.GetWeakPtr(), provider_name, - std::move(sinks)), - MediaRouteProviderWakeReason::PROVIDE_SINKS); -} - -void MediaRouterDesktop::DoUpdateMediaSinks(const MediaSource::Id& source_id) { - if (request_manager_->mojo_connections_ready()) { - MediaRouterMojoImpl::DoUpdateMediaSinks(source_id); - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoUpdateMediaSinks, - weak_factory_.GetWeakPtr(), source_id), - MediaRouteProviderWakeReason::UPDATE_MEDIA_SINKS); -} - -#if defined(OS_WIN) -void MediaRouterDesktop::DoEnsureMdnsDiscoveryEnabled() { - if (request_manager_->mojo_connections_ready()) { - DVLOG(1) << "DoEnsureMdnsDiscoveryEnabled"; - if (!is_mdns_enabled_) { - media_route_provider_->EnableMdnsDiscovery(); - is_mdns_enabled_ = true; - } - return; - } - request_manager_->RunOrDefer( - base::BindOnce(&MediaRouterDesktop::DoEnsureMdnsDiscoveryEnabled, - weak_factory_.GetWeakPtr()), - MediaRouteProviderWakeReason::ENABLE_MDNS_DISCOVERY); -} -#endif - void MediaRouterDesktop::OnConnectionError() { request_manager_->OnMojoConnectionError(); binding_.Close(); @@ -324,9 +55,8 @@ // triggering a firewall prompt out of the context of MR from the user's // perspective. This particular call reminds the extension to enable mDNS // discovery when it wakes up, has been upgraded, etc. - if (should_enable_mdns_discovery_) { - DoEnsureMdnsDiscoveryEnabled(); - } + if (should_enable_mdns_discovery_) + media_route_provider_->EnableMdnsDiscovery(); #endif MediaRouterMojoImpl::SyncStateToMediaRouteProvider(); } @@ -336,6 +66,7 @@ : MediaRouterMojoImpl(context), request_manager_( EventPageRequestManagerFactory::GetApiForBrowserContext(context)), + extension_provider_(context, mojo::MakeRequest(&media_route_provider_)), binding_(this), weak_factory_(this) { DCHECK(request_manager_); @@ -351,8 +82,19 @@ void MediaRouterDesktop::RegisterMediaRouteProvider( mojom::MediaRouteProviderPtr media_route_provider_ptr, mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) { - MediaRouterMojoImpl::RegisterMediaRouteProvider( - std::move(media_route_provider_ptr), std::move(callback)); + extension_provider_.RegisterMediaRouteProvider( + std::move(media_route_provider_ptr)); + + auto config = mojom::MediaRouteProviderConfig::New(); + // Enabling browser side discovery means disabling extension side discovery. + // We are migrating discovery from the external Media Route Provider to the + // Media Router (crbug.com/687383), so we need to disable it in the provider. + config->enable_dial_discovery = !media_router::DialLocalDiscoveryEnabled(); + config->enable_cast_discovery = !media_router::CastDiscoveryEnabled(); + std::move(callback).Run(instance_id(), std::move(config)); + + SyncStateToMediaRouteProvider(); + #if defined(OS_WIN) // The MRPM may have been upgraded or otherwise reload such that we could be // seeing an MRPM that doesn't know mDNS is enabled, even if we've told a @@ -364,9 +106,16 @@ // Now that we have a Mojo pointer to the MRP, we request MRP-side route // controllers to be created again. This must happen before |request_manager_| // executes requests to the MRP and its route controllers. - for (const auto& pair : route_controllers_) - MediaRouterMojoImpl::DoCreateMediaRouteController(pair.second); - + for (const auto& pair : route_controllers_) { + const MediaRoute::Id& route_id = pair.first; + MediaRouteController* route_controller = pair.second; + auto callback = + base::BindOnce(&MediaRouterDesktop::OnMediaControllerCreated, + weak_factory_.GetWeakPtr(), route_id); + media_route_provider_->CreateMediaRouteController( + route_id, route_controller->CreateControllerRequest(), + route_controller->BindObserverPtr(), std::move(callback)); + } request_manager_->OnMojoConnectionsReady(); } @@ -391,7 +140,7 @@ if (is_mdns_enabled_) return; - DoEnsureMdnsDiscoveryEnabled(); + media_route_provider_->EnableMdnsDiscovery(); should_enable_mdns_discovery_ = true; }
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.h b/chrome/browser/media/router/mojo/media_router_desktop.h index ff50c0a5..9640288 100644 --- a/chrome/browser/media/router/mojo/media_router_desktop.h +++ b/chrome/browser/media/router/mojo/media_router_desktop.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_DESKTOP_H_ #include "build/build_config.h" +#include "chrome/browser/media/router/mojo/extension_media_route_provider_proxy.h" #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" namespace content { @@ -43,71 +44,7 @@ void OnUserGesture() override; protected: - // These methods override MediaRouterMojoImpl methods. They call the base - // methods if the connection to the MediaRouteProvider is valid. Otherwise, - // they queue themselves to be called again later by |request_manager_| when - // the connection is valid. - void DoCreateRoute(const MediaSource::Id& source_id, - const MediaSink::Id& sink_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) override; - void DoJoinRoute(const MediaSource::Id& source_id, - const std::string& presentation_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) override; - void DoConnectRouteByRouteId( - const MediaSource::Id& source_id, - const MediaRoute::Id& route_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) override; - void DoTerminateRoute(const MediaRoute::Id& route_id) override; - void DoDetachRoute(const MediaRoute::Id& route_id) override; - void DoSendRouteMessage(const MediaRoute::Id& route_id, - const std::string& message, - SendRouteMessageCallback callback) override; - void DoSendRouteBinaryMessage(const MediaRoute::Id& route_id, - std::unique_ptr<std::vector<uint8_t>> data, - SendRouteMessageCallback callback) override; - void DoStartListeningForRouteMessages( - const MediaRoute::Id& route_id) override; - void DoStopListeningForRouteMessages(const MediaRoute::Id& route_id) override; - void DoStartObservingMediaSinks(const MediaSource::Id& source_id) override; - void DoStopObservingMediaSinks(const MediaSource::Id& source_id) override; - void DoStartObservingMediaRoutes(const MediaSource::Id& source_id) override; - void DoStopObservingMediaRoutes(const MediaSource::Id& source_id) override; - void DoSearchSinks(const MediaSink::Id& sink_id, - const MediaSource::Id& source_id, - const std::string& search_input, - const std::string& domain, - MediaSinkSearchResponseCallback sink_callback) override; - void DoCreateMediaRouteController(MediaRouteController* controller) override; - void DoProvideSinks(const std::string& provider_name, - std::vector<MediaSinkInternal> sinks) override; - void DoUpdateMediaSinks(const MediaSource::Id& source_id) override; -#if defined(OS_WIN) - void DoEnsureMdnsDiscoveryEnabled(); -#endif - - // This is the version that gets queued (instead of - // DoCreateMediaRouteController) if CreateMediaRouteController is deferred. - // This is because the MediaRouteController may be deleted by the time the - // callback is executed, so we need to perform a check that the controller - // exists. Note that it is possible that the original controller has been - // deleted and replaced with another instance. The base class - // DoCreateMediaRouteController should be handling this case correctly - // already. - void CreateMediaRouteControllerDeferred(const MediaRoute::Id& route_id); - - // Error handler callback for |binding_| and |media_route_provider_|. + // Error handler callback for |binding_|. void OnConnectionError() override; // Issues 0+ calls to |media_route_provider_| to ensure its state is in sync @@ -165,7 +102,12 @@ // the requests to it. EventPageRequestManager* const request_manager_; + // MediaRouteProvider proxy that forwards calls to the MRPM in the component + // extension. + ExtensionMediaRouteProviderProxy extension_provider_; + // Binds |this| to a Mojo connection stub for mojom::MediaRouter. + // TODO(takumif): Move this to MediaRouterMojoImpl. mojo::Binding<mojom::MediaRouter> binding_; // A flag to ensure that we record the provider version once, during the
diff --git a/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc b/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc index 5e9048a5..79930eb 100644 --- a/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc +++ b/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc
@@ -44,8 +44,6 @@ final {} }; - - } // namespace class MediaRouterDesktopTest : public MediaRouterMojoTest { @@ -67,46 +65,6 @@ } }; -TEST_F(MediaRouterDesktopTest, CreateRoute) { - TestCreateRoute(); -} - -TEST_F(MediaRouterDesktopTest, JoinRoute) { - TestJoinRoute(); -} - -TEST_F(MediaRouterDesktopTest, ConnectRouteByRouteId) { - TestConnectRouteByRouteId(); -} - -TEST_F(MediaRouterDesktopTest, TerminateRoute) { - TestTerminateRoute(); -} - -TEST_F(MediaRouterDesktopTest, SendRouteMessage) { - TestSendRouteMessage(); -} - -TEST_F(MediaRouterDesktopTest, SendRouteBinaryMessage) { - TestSendRouteBinaryMessage(); -} - -TEST_F(MediaRouterDesktopTest, DetachRoute) { - TestDetachRoute(); -} - -TEST_F(MediaRouterDesktopTest, SearchSinks) { - TestSearchSinks(); -} - -TEST_F(MediaRouterDesktopTest, ProvideSinks) { - TestProvideSinks(); -} - -TEST_F(MediaRouterDesktopTest, CreateMediaRouteController) { - TestCreateMediaRouteController(); -} - #if defined(OS_WIN) TEST_F(MediaRouterDesktopTest, EnableMdnsAfterEachRegister) { // EnableMdnsDiscovery() should not be called when no MRPM is registered yet. @@ -149,40 +107,25 @@ std::unique_ptr<MockMediaRoutesObserver> routes_observer; std::unique_ptr<NullMessageObserver> messages_observer; - { - router()->OnSinkAvailabilityUpdated( - mojom::MediaRouter::SinkAvailability::PER_SOURCE); - EXPECT_CALL(mock_media_route_provider_, - StartObservingMediaSinks(media_source.id())); - sinks_observer = base::MakeUnique<MockMediaSinksObserver>( - router(), media_source, url::Origin(GURL(kOrigin))); - EXPECT_TRUE(sinks_observer->Init()); + router()->OnSinkAvailabilityUpdated( + mojom::MediaRouter::SinkAvailability::PER_SOURCE); + EXPECT_CALL(mock_media_route_provider_, + StartObservingMediaSinks(media_source.id())); + sinks_observer = base::MakeUnique<MockMediaSinksObserver>( + router(), media_source, url::Origin(GURL(kOrigin))); + EXPECT_TRUE(sinks_observer->Init()); - EXPECT_CALL(mock_media_route_provider_, - StartObservingMediaRoutes(media_source.id())); - routes_observer = - base::MakeUnique<MockMediaRoutesObserver>(router(), media_source.id()); + EXPECT_CALL(mock_media_route_provider_, + StartObservingMediaRoutes(media_source.id())); + routes_observer = + base::MakeUnique<MockMediaRoutesObserver>(router(), media_source.id()); - EXPECT_CALL(mock_media_route_provider_, - StartListeningForRouteMessages(media_source.id())); - messages_observer = - base::MakeUnique<NullMessageObserver>(router(), media_source.id()); - base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_media_route_provider_)); - } - - { - EXPECT_CALL(mock_media_route_provider_, - StartObservingMediaSinks(media_source.id())); - EXPECT_CALL(mock_media_route_provider_, StartObservingMediaRoutes("")); - EXPECT_CALL(mock_media_route_provider_, - StartObservingMediaRoutes(media_source.id())); - EXPECT_CALL(mock_media_route_provider_, - StartListeningForRouteMessages(media_source.id())); - router()->OnConnectionError(); - ConnectProviderManagerService(); - base::RunLoop().RunUntilIdle(); - } + EXPECT_CALL(mock_media_route_provider_, + StartListeningForRouteMessages(media_source.id())); + messages_observer = + base::MakeUnique<NullMessageObserver>(router(), media_source.id()); + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_media_route_provider_)); } } // namespace media_router
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc index 206e36e2..dff4886 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -81,30 +81,11 @@ cast_media_sink_service_->Stop(); } -void MediaRouterMojoImpl::OnConnectionError() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - media_route_provider_.reset(); -} +void MediaRouterMojoImpl::OnConnectionError() {} void MediaRouterMojoImpl::RegisterMediaRouteProvider( mojom::MediaRouteProviderPtr media_route_provider_ptr, - mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - media_route_provider_ = std::move(media_route_provider_ptr); - media_route_provider_.set_connection_error_handler(base::BindOnce( - &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); - - auto config = mojom::MediaRouteProviderConfig::New(); - // Enabling browser side discovery means disabling extension side discovery. - // We are migrating discovery from the external Media Route Provider to the - // Media Router (crbug.com/687383), so we need to disable it in the provider. - config->enable_dial_discovery = !media_router::DialLocalDiscoveryEnabled(); - config->enable_cast_discovery = !media_router::CastDiscoveryEnabled(); - std::move(callback).Run(instance_id_, std::move(config)); - SyncStateToMediaRouteProvider(); -} + mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) {} void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -218,8 +199,13 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); int tab_id = SessionTabHelper::IdForTab(web_contents); - DoCreateRoute(source_id, sink_id, origin, tab_id, std::move(callbacks), - timeout, incognito); + std::string presentation_id = MediaRouterBase::CreatePresentationId(); + auto callback = base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + weak_factory_.GetWeakPtr(), presentation_id, + incognito, base::Passed(&callbacks), false); + media_route_provider_->CreateRoute(source_id, sink_id, presentation_id, + origin, tab_id, timeout, incognito, + std::move(callback)); } void MediaRouterMojoImpl::JoinRoute( @@ -231,7 +217,6 @@ base::TimeDelta timeout, bool incognito) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!HasJoinableRoute()) { DVLOG_WITH_INSTANCE(1) << "No joinable routes"; std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( @@ -242,8 +227,11 @@ } int tab_id = SessionTabHelper::IdForTab(web_contents); - DoJoinRoute(source_id, presentation_id, origin, tab_id, std::move(callbacks), - timeout, incognito); + auto callback = base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + weak_factory_.GetWeakPtr(), presentation_id, + incognito, base::Passed(&callbacks), true); + media_route_provider_->JoinRoute(source_id, presentation_id, origin, tab_id, + timeout, incognito, std::move(callback)); } void MediaRouterMojoImpl::ConnectRouteByRouteId( @@ -257,26 +245,34 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); int tab_id = SessionTabHelper::IdForTab(web_contents); - DoConnectRouteByRouteId(source_id, route_id, origin, tab_id, - std::move(callbacks), timeout, incognito); + std::string presentation_id = MediaRouterBase::CreatePresentationId(); + auto callback = base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, + weak_factory_.GetWeakPtr(), presentation_id, + incognito, base::Passed(&callbacks), true); + media_route_provider_->ConnectRouteByRouteId( + source_id, route_id, presentation_id, origin, tab_id, timeout, incognito, + std::move(callback)); } void MediaRouterMojoImpl::TerminateRoute(const MediaRoute::Id& route_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DVLOG(2) << "TerminateRoute " << route_id; - DoTerminateRoute(route_id); + auto callback = base::BindOnce(&MediaRouterMojoImpl::OnTerminateRouteResult, + weak_factory_.GetWeakPtr(), route_id); + media_route_provider_->TerminateRoute(route_id, std::move(callback)); } void MediaRouterMojoImpl::DetachRoute(const MediaRoute::Id& route_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DoDetachRoute(route_id); + media_route_provider_->DetachRoute(route_id); } void MediaRouterMojoImpl::SendRouteMessage(const MediaRoute::Id& route_id, const std::string& message, SendRouteMessageCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DoSendRouteMessage(route_id, message, std::move(callback)); + media_route_provider_->SendRouteMessage(route_id, message, + std::move(callback)); } void MediaRouterMojoImpl::SendRouteBinaryMessage( @@ -284,7 +280,8 @@ std::unique_ptr<std::vector<uint8_t>> data, SendRouteMessageCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DoSendRouteBinaryMessage(route_id, std::move(data), std::move(callback)); + media_route_provider_->SendRouteBinaryMessage(route_id, *data, + std::move(callback)); } void MediaRouterMojoImpl::AddIssue(const IssueInfo& issue_info) { @@ -310,8 +307,12 @@ const std::string& domain, MediaSinkSearchResponseCallback sink_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DoSearchSinks(sink_id, source_id, search_input, domain, - std::move(sink_callback)); + auto sink_search_criteria = mojom::SinkSearchCriteria::New(); + sink_search_criteria->input = search_input; + sink_search_criteria->domain = domain; + media_route_provider_->SearchSinks(sink_id, source_id, + std::move(sink_search_criteria), + std::move(sink_callback)); } scoped_refptr<MediaRouteController> MediaRouterMojoImpl::GetRouteController( @@ -340,9 +341,14 @@ break; } DCHECK(route_controller); - route_controllers_.emplace(route_id, route_controller.get()); - DoCreateMediaRouteController(route_controller.get()); + auto callback = base::BindOnce(&MediaRouterMojoImpl::OnMediaControllerCreated, + weak_factory_.GetWeakPtr(), route_id); + media_route_provider_->CreateMediaRouteController( + route_id, route_controller->CreateControllerRequest(), + route_controller->BindObserverPtr(), std::move(callback)); + + route_controllers_.emplace(route_id, route_controller.get()); return route_controller; } @@ -351,7 +357,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DVLOG_WITH_INSTANCE(1) << "Provider [" << provider_name << "] found " << sinks.size() << " devices..."; - DoProvideSinks(provider_name, std::move(sinks)); + media_route_provider_->ProvideSinks(provider_name, std::move(sinks)); } bool MediaRouterMojoImpl::RegisterMediaSinksObserver( @@ -379,7 +385,8 @@ } else { // Need to call MRPM to start observing sinks if the query is new. if (is_new_query) { - DoStartObservingMediaSinks(source_id); + media_route_provider_->StartObservingMediaSinks(source_id); + sinks_query->is_active = true; } else if (sinks_query->cached_sink_list) { observer->OnSinksUpdated(*sinks_query->cached_sink_list, sinks_query->origins); @@ -410,12 +417,9 @@ // Otherwise, the MRPM would have discarded the queries already. if (availability_ != mojom::MediaRouter::SinkAvailability::UNAVAILABLE) { - // The |sinks_queries_| entry will be removed in the immediate or deferred - // |DoStopObservingMediaSinks| call. - DoStopObservingMediaSinks(source_id); - } else { - sinks_queries_.erase(source_id); + media_route_provider_->StopObservingMediaSinks(source_id); } + sinks_queries_.erase(source_id); } } @@ -434,7 +438,7 @@ routes_query->observers.AddObserver(observer); if (is_new_query) { - DoStartObservingMediaRoutes(source_id); + media_route_provider_->StartObservingMediaRoutes(source_id); // The MRPM will call MediaRouterMojoImpl::OnRoutesUpdated() soon, if there // are any existing routes the new observer should be aware of. } else if (routes_query->cached_route_list) { @@ -480,8 +484,10 @@ // might_have_observers() is reliable here on the assumption that this call // is not inside the ObserverList iteration. it->second->observers.RemoveObserver(observer); - if (!it->second->observers.might_have_observers()) - DoStopObservingMediaRoutes(source_id); + if (!it->second->observers.might_have_observers()) { + media_route_provider_->StopObservingMediaRoutes(source_id); + routes_queries_.erase(source_id); + } } void MediaRouterMojoImpl::RegisterIssuesObserver(IssuesObserver* observer) { @@ -510,7 +516,7 @@ bool should_listen = !observer_list->might_have_observers(); observer_list->AddObserver(observer); if (should_listen) - DoStartListeningForRouteMessages(route_id); + media_route_provider_->StartListeningForRouteMessages(route_id); } void MediaRouterMojoImpl::UnregisterRouteMessageObserver( @@ -526,7 +532,7 @@ it->second->RemoveObserver(observer); if (!it->second->might_have_observers()) { message_observers_.erase(route_id); - DoStopListeningForRouteMessages(route_id); + media_route_provider_->StopListeningForRouteMessages(route_id); } } @@ -538,144 +544,6 @@ route_controllers_.erase(it); } -void MediaRouterMojoImpl::DoCreateRoute( - const MediaSource::Id& source_id, - const MediaSink::Id& sink_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - std::string presentation_id = MediaRouterBase::CreatePresentationId(); - DVLOG_WITH_INSTANCE(1) << "DoCreateRoute " << source_id << "=>" << sink_id - << ", presentation ID: " << presentation_id; - media_route_provider_->CreateRoute( - source_id, sink_id, presentation_id, origin, tab_id, timeout, incognito, - base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), false)); -} - -void MediaRouterMojoImpl::DoJoinRoute( - const MediaSource::Id& source_id, - const std::string& presentation_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - DVLOG_WITH_INSTANCE(1) << "DoJoinRoute " << source_id - << ", presentation ID: " << presentation_id; - - media_route_provider_->JoinRoute( - source_id, presentation_id, origin, tab_id, timeout, incognito, - base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), true)); -} - -void MediaRouterMojoImpl::DoConnectRouteByRouteId( - const MediaSource::Id& source_id, - const MediaRoute::Id& route_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito) { - std::string presentation_id = MediaRouterBase::CreatePresentationId(); - DVLOG_WITH_INSTANCE(1) << "DoConnectRouteByRouteId " << source_id - << ", route ID: " << route_id - << ", presentation ID: " << presentation_id; - - media_route_provider_->ConnectRouteByRouteId( - source_id, route_id, presentation_id, origin, tab_id, timeout, incognito, - base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, - base::Unretained(this), presentation_id, incognito, - base::Passed(&callbacks), true)); -} - -void MediaRouterMojoImpl::DoTerminateRoute(const MediaRoute::Id& route_id) { - DVLOG_WITH_INSTANCE(1) << "DoTerminateRoute " << route_id; - media_route_provider_->TerminateRoute( - route_id, base::BindOnce(&MediaRouterMojoImpl::OnTerminateRouteResult, - base::Unretained(this), route_id)); -} - -void MediaRouterMojoImpl::DoDetachRoute(const MediaRoute::Id& route_id) { - DVLOG_WITH_INSTANCE(1) << "DoDetachRoute " << route_id; - media_route_provider_->DetachRoute(route_id); -} - -void MediaRouterMojoImpl::DoSendRouteMessage( - const MediaRoute::Id& route_id, - const std::string& message, - SendRouteMessageCallback callback) { - DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id; - media_route_provider_->SendRouteMessage(route_id, message, - std::move(callback)); -} - -void MediaRouterMojoImpl::DoSendRouteBinaryMessage( - const MediaRoute::Id& route_id, - std::unique_ptr<std::vector<uint8_t>> data, - SendRouteMessageCallback callback) { - DVLOG_WITH_INSTANCE(1) << "SendRouteBinaryMessage " << route_id; - media_route_provider_->SendRouteBinaryMessage(route_id, *data, - std::move(callback)); -} - -void MediaRouterMojoImpl::DoStartListeningForRouteMessages( - const MediaRoute::Id& route_id) { - DVLOG_WITH_INSTANCE(1) << "DoStartListeningForRouteMessages"; - media_route_provider_->StartListeningForRouteMessages(route_id); -} - -void MediaRouterMojoImpl::DoStopListeningForRouteMessages( - const MediaRoute::Id& route_id) { - DVLOG_WITH_INSTANCE(1) << "StopListeningForRouteMessages"; - media_route_provider_->StopListeningForRouteMessages(route_id); -} - -void MediaRouterMojoImpl::DoSearchSinks( - const MediaSink::Id& sink_id, - const MediaSource::Id& source_id, - const std::string& search_input, - const std::string& domain, - MediaSinkSearchResponseCallback sink_callback) { - DVLOG_WITH_INSTANCE(1) << "SearchSinks"; - auto sink_search_criteria = mojom::SinkSearchCriteria::New(); - sink_search_criteria->input = search_input; - sink_search_criteria->domain = domain; - media_route_provider_->SearchSinks(sink_id, source_id, - std::move(sink_search_criteria), - std::move(sink_callback)); -} - -void MediaRouterMojoImpl::DoProvideSinks(const std::string& provider_name, - std::vector<MediaSinkInternal> sinks) { - DVLOG_WITH_INSTANCE(1) << "DoProvideSinks"; - media_route_provider_->ProvideSinks(provider_name, sinks); -} - -void MediaRouterMojoImpl::DoCreateMediaRouteController( - MediaRouteController* controller) { - DVLOG_WITH_INSTANCE(1) << "DoCreateMediaRouteController"; - auto controller_request = controller->CreateControllerRequest(); - auto observer_ptr = controller->BindObserverPtr(); - const MediaRoute::Id& route_id = controller->route_id(); - if (!controller_request.is_pending() || !observer_ptr.is_bound()) { - DVLOG_WITH_INSTANCE(1) << __func__ - << ": invalid Mojo request/ptr: " << route_id; - return; - } - - media_route_provider_->CreateMediaRouteController( - route_id, std::move(controller_request), std::move(observer_ptr), - base::BindOnce(&MediaRouterMojoImpl::OnMediaControllerCreated, - base::Unretained(this), route_id)); - controller->InitAdditionalMojoConnnections(); -} - void MediaRouterMojoImpl::OnRouteMessagesReceived( const std::string& route_id, const std::vector<content::PresentationConnectionMessage>& messages) { @@ -708,8 +576,10 @@ } } else { // Sinks are now available. Tell MRPM to start all sink queries again. - for (const auto& source_and_query : sinks_queries_) - DoStartObservingMediaSinks(source_and_query.first); + for (const auto& source_and_query : sinks_queries_) { + media_route_provider_->StartObservingMediaSinks(source_and_query.first); + source_and_query.second->is_active = true; + } } } @@ -738,88 +608,24 @@ MediaRouterMojoMetrics::RecordMediaRouteProviderTerminateRoute(result_code); } -void MediaRouterMojoImpl::DoStartObservingMediaSinks( - const MediaSource::Id& source_id) { - DVLOG_WITH_INSTANCE(1) << "DoStartObservingMediaSinks: " << source_id; - // No need to call MRPM if there are no sinks available. - if (availability_ == mojom::MediaRouter::SinkAvailability::UNAVAILABLE) - return; - - // No need to call MRPM if all observers have been removed in the meantime. - auto it = sinks_queries_.find(source_id); - if (it == sinks_queries_.end() || - !it->second->observers.might_have_observers()) - return; - - DVLOG_WITH_INSTANCE(1) << "MRPM.StartObservingMediaSinks: " << source_id; - media_route_provider_->StartObservingMediaSinks(source_id); - it->second->is_active = true; -} - -void MediaRouterMojoImpl::DoStopObservingMediaSinks( - const MediaSource::Id& source_id) { - DVLOG_WITH_INSTANCE(1) << "DoStopObservingMediaSinks: " << source_id; - - auto it = sinks_queries_.find(source_id); - // No need to call MRPM if observers have been added in the meantime, - // or StopObservingMediaSinks has already been called. - if (it == sinks_queries_.end() || !it->second->is_active || - it->second->observers.might_have_observers()) { - return; - } - - DVLOG_WITH_INSTANCE(1) << "MRPM.StopObservingMediaSinks: " << source_id; - media_route_provider_->StopObservingMediaSinks(source_id); - sinks_queries_.erase(source_id); -} - -void MediaRouterMojoImpl::DoStartObservingMediaRoutes( - const MediaSource::Id& source_id) { - DVLOG_WITH_INSTANCE(1) << "DoStartObservingMediaRoutes"; - - // No need to call MRPM if all observers have been removed in the meantime. - auto it = routes_queries_.find(source_id); - if (it == routes_queries_.end() || - !it->second->observers.might_have_observers()) - return; - - DVLOG_WITH_INSTANCE(1) << "MRPM.StartObservingMediaRoutes: " << source_id; - media_route_provider_->StartObservingMediaRoutes(source_id); -} - -void MediaRouterMojoImpl::DoStopObservingMediaRoutes( - const MediaSource::Id& source_id) { - DVLOG_WITH_INSTANCE(1) << "DoStopObservingMediaRoutes"; - - // No need to call MRPM if observers have been added in the meantime, - // or StopObservingMediaRoutes has already been called. - auto it = routes_queries_.find(source_id); - if (it == routes_queries_.end() || - it->second->observers.might_have_observers()) { - return; - } - - DVLOG_WITH_INSTANCE(1) << "MRPM.StopObservingMediaRoutes: " << source_id; - media_route_provider_->StopObservingMediaRoutes(source_id); - routes_queries_.erase(source_id); -} - void MediaRouterMojoImpl::SyncStateToMediaRouteProvider() { DCHECK(media_route_provider_); // Sink queries. if (availability_ != mojom::MediaRouter::SinkAvailability::UNAVAILABLE) { - for (const auto& it : sinks_queries_) - DoStartObservingMediaSinks(it.first); + for (const auto& it : sinks_queries_) { + media_route_provider_->StartObservingMediaSinks(it.first); + it.second->is_active = true; + } } // Route queries. for (const auto& it : routes_queries_) - DoStartObservingMediaRoutes(it.first); + media_route_provider_->StartObservingMediaRoutes(it.first); // Route messages. for (const auto& it : message_observers_) - DoStartListeningForRouteMessages(it.first); + media_route_provider_->StartListeningForRouteMessages(it.first); StartDiscovery(); } @@ -855,12 +661,6 @@ void MediaRouterMojoImpl::UpdateMediaSinks( const MediaSource::Id& source_id) { - DoUpdateMediaSinks(source_id); -} - -void MediaRouterMojoImpl::DoUpdateMediaSinks( - const MediaSource::Id& source_id) { - DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks: " << source_id; media_route_provider_->UpdateMediaSinks(source_id); }
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.h b/chrome/browser/media/router/mojo/media_router_mojo_impl.h index 715ebb75..48f49cf 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.h +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
@@ -47,9 +47,6 @@ ~MediaRouterMojoImpl() override; // MediaRouter implementation. - // Execution of calls to MediaRouteProvider is delegated to the Do* methods, - // which can be overridden in subclasses for additional logic such as request - // queueing. Methods with Do* methods are marked final. void CreateRoute(const MediaSource::Id& source_id, const MediaSink::Id& sink_id, const url::Origin& origin, @@ -95,75 +92,37 @@ mojom::MediaRouteProviderPtr media_route_provider_ptr, mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) override; + // Issues 0+ calls to |media_route_provider_| to ensure its state is in sync + // with MediaRouter on a best-effort basis. + virtual void SyncStateToMediaRouteProvider(); + + const std::string& instance_id() const { return instance_id_; } + void set_instance_id_for_test(const std::string& instance_id) { instance_id_ = instance_id; } + void set_media_route_provider_for_test( + mojom::MediaRouteProviderPtr media_route_provider) { + media_route_provider_ = std::move(media_route_provider); + } + protected: // Standard constructor, used by // MediaRouterMojoImplFactory::GetApiForBrowserContext. explicit MediaRouterMojoImpl(content::BrowserContext* context); - // These calls invoke methods in the MediaRouteProvider via Mojo. - virtual void DoCreateRoute(const MediaSource::Id& source_id, - const MediaSink::Id& sink_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito); - virtual void DoJoinRoute(const MediaSource::Id& source_id, - const std::string& presentation_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito); - virtual void DoConnectRouteByRouteId( - const MediaSource::Id& source_id, - const MediaRoute::Id& route_id, - const url::Origin& origin, - int tab_id, - std::vector<MediaRouteResponseCallback> callbacks, - base::TimeDelta timeout, - bool incognito); - virtual void DoTerminateRoute(const MediaRoute::Id& route_id); - virtual void DoDetachRoute(const MediaRoute::Id& route_id); - virtual void DoSendRouteMessage(const MediaRoute::Id& route_id, - const std::string& message, - SendRouteMessageCallback callback); - virtual void DoSendRouteBinaryMessage( - const MediaRoute::Id& route_id, - std::unique_ptr<std::vector<uint8_t>> data, - SendRouteMessageCallback callback); - virtual void DoStartListeningForRouteMessages(const MediaRoute::Id& route_id); - virtual void DoStopListeningForRouteMessages(const MediaRoute::Id& route_id); - virtual void DoStartObservingMediaSinks(const MediaSource::Id& source_id); - virtual void DoStopObservingMediaSinks(const MediaSource::Id& source_id); - virtual void DoStartObservingMediaRoutes(const MediaSource::Id& source_id); - virtual void DoStopObservingMediaRoutes(const MediaSource::Id& source_id); - virtual void DoSearchSinks(const MediaSink::Id& sink_id, - const MediaSource::Id& source_id, - const std::string& search_input, - const std::string& domain, - MediaSinkSearchResponseCallback sink_callback); - virtual void DoCreateMediaRouteController(MediaRouteController* controller); - virtual void DoProvideSinks(const std::string& provider_name, - std::vector<MediaSinkInternal> sinks); - virtual void DoUpdateMediaSinks(const MediaSource::Id& source_id); - // Error handler callback for |media_route_provider_|. virtual void OnConnectionError(); - // Issues 0+ calls to |media_route_provider_| to ensure its state is in sync - // with MediaRouter on a best-effort basis. - virtual void SyncStateToMediaRouteProvider(); - // Requests MRPM to update media sinks. This allows MRPs that only do // discovery on sink queries an opportunity to update discovery results // even if the MRP SinkAvailability is marked UNAVAILABLE. void UpdateMediaSinks(const MediaSource::Id& source_id); + // Callback called by MRP's CreateMediaRouteController(). + void OnMediaControllerCreated(const MediaRoute::Id& route_id, bool success); + // Mojo proxy object for the Media Route Provider Manager. // Set to null initially, and later set to the Provider Manager proxy object // passed in via |RegisterMediaRouteProvider()|. @@ -215,6 +174,8 @@ PresentationConnectionStateChangedCallbackRemoved); FRIEND_TEST_ALL_PREFIXES(MediaRouterDesktopTest, SyncStateToMediaRouteProvider); + FRIEND_TEST_ALL_PREFIXES(ExtensionMediaRouteProviderProxyTest, + StartAndStopObservingMediaSinks); // Represents a query to the MRPM for media sinks and holds observers for the // query. @@ -318,9 +279,6 @@ // routes do not appear in |routes|. void RemoveInvalidRouteControllers(const std::vector<MediaRoute>& routes); - // Callback called by MRP's CreateMediaRouteController(). - void OnMediaControllerCreated(const MediaRoute::Id& route_id, bool success); - std::unordered_map<MediaSource::Id, std::unique_ptr<MediaSinksQuery>> sinks_queries_; @@ -342,9 +300,11 @@ mojom::MediaRouter::SinkAvailability availability_; // Media sink service for DIAL devices. + // TODO(takumif): Move this to MediaRouterDesktop. scoped_refptr<DialMediaSinkServiceProxy> dial_media_sink_service_proxy_; // Media sink service for CAST devices. + // TODO(takumif): Move this to MediaRouterDesktop. scoped_refptr<CastMediaSinkService> cast_media_sink_service_; content::BrowserContext* const context_;
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc index 99727d7..c894fa49 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -18,8 +18,6 @@ #include "base/test/histogram_tester.h" #include "base/test/mock_callback.h" #include "base/threading/thread_task_runner_handle.h" -#include "chrome/browser/media/router/event_page_request_manager.h" -#include "chrome/browser/media/router/event_page_request_manager_factory.h" #include "chrome/browser/media/router/media_router_factory.h" #include "chrome/browser/media/router/mock_media_router.h" #include "chrome/browser/media/router/mojo/media_router_mojo_metrics.h"
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_test.cc b/chrome/browser/media/router/mojo/media_router_mojo_test.cc index 6479cc0..6438a6a 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_test.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_test.cc
@@ -70,6 +70,44 @@ MockMediaRouteProvider::~MockMediaRouteProvider() {} +void MockMediaRouteProvider::RouteRequestSuccess(RouteCallback& cb) const { + DCHECK(route_); + std::move(cb).Run(route_, std::string(), RouteRequestResult::OK); +} + +void MockMediaRouteProvider::RouteRequestTimeout(RouteCallback& cb) const { + std::move(cb).Run(base::nullopt, std::string("error"), + RouteRequestResult::TIMED_OUT); +} + +void MockMediaRouteProvider::TerminateRouteSuccess( + TerminateRouteCallback& cb) const { + std::move(cb).Run(std::string(), RouteRequestResult::OK); +} + +void MockMediaRouteProvider::SendRouteMessageSuccess( + SendRouteMessageCallback& cb) const { + std::move(cb).Run(true); +} +void MockMediaRouteProvider::SendRouteBinaryMessageSuccess( + SendRouteBinaryMessageCallback& cb) const { + std::move(cb).Run(true); +} + +void MockMediaRouteProvider::SearchSinksSuccess(SearchSinksCallback& cb) const { + std::string sink_id = route_ ? route_->media_sink_id() : std::string(); + std::move(cb).Run(sink_id); +} + +void MockMediaRouteProvider::CreateMediaRouteControllerSuccess( + CreateMediaRouteControllerCallback& cb) const { + std::move(cb).Run(true); +} + +void MockMediaRouteProvider::SetRouteToReturn(const MediaRoute& route) { + route_ = route; +} + MockEventPageTracker::MockEventPageTracker() {} MockEventPageTracker::~MockEventPageTracker() {} @@ -97,10 +135,6 @@ MockMediaController::~MockMediaController() {} -RegisterMediaRouteProviderHandler::RegisterMediaRouteProviderHandler() {} - -RegisterMediaRouteProviderHandler::~RegisterMediaRouteProviderHandler() {} - void MockMediaController::Bind(mojom::MediaControllerRequest request) { binding_.Bind(std::move(request)); } @@ -146,11 +180,7 @@ mojom::MediaRouteProviderPtr mojo_provider; binding_ = base::MakeUnique<mojo::Binding<mojom::MediaRouteProvider>>( &mock_media_route_provider_, mojo::MakeRequest(&mojo_provider)); - EXPECT_CALL(provide_handler_, InvokeInternal(kInstanceId, testing::_)); - media_router_->RegisterMediaRouteProvider( - std::move(mojo_provider), - base::BindOnce(&RegisterMediaRouteProviderHandler::Invoke, - base::Unretained(&provide_handler_))); + media_router_->set_media_route_provider_for_test(std::move(mojo_provider)); } void MediaRouterMojoTest::SetUp() {
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_test.h b/chrome/browser/media/router/mojo/media_router_mojo_test.h index 14ea2a3..0f5f367 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_test.h +++ b/chrome/browser/media/router/mojo/media_router_mojo_test.h
@@ -26,8 +26,14 @@ class MediaRouterMojoImpl; +// TODO(takumif): Move MockMediaRouteProvider into its own files. class MockMediaRouteProvider : public mojom::MediaRouteProvider { public: + using RouteCallback = + base::OnceCallback<void(const base::Optional<MediaRoute>&, + const base::Optional<std::string>&, + RouteRequestResult::ResultCode)>; + MockMediaRouteProvider(); ~MockMediaRouteProvider() override; @@ -154,7 +160,25 @@ mojom::MediaStatusObserverPtr& observer, CreateMediaRouteControllerCallback& callback)); + // These methods execute the callbacks with the success or timeout result + // code. If the callback takes a route, the route set in SetRouteToReturn() is + // used. + void RouteRequestSuccess(RouteCallback& cb) const; + void RouteRequestTimeout(RouteCallback& cb) const; + void TerminateRouteSuccess(TerminateRouteCallback& cb) const; + void SendRouteMessageSuccess(SendRouteMessageCallback& cb) const; + void SendRouteBinaryMessageSuccess(SendRouteBinaryMessageCallback& cb) const; + void SearchSinksSuccess(SearchSinksCallback& cb) const; + void CreateMediaRouteControllerSuccess( + CreateMediaRouteControllerCallback& cb) const; + + // Sets the route to pass into callbacks. + void SetRouteToReturn(const MediaRoute& route); + private: + // The route that is passed into callbacks. + base::Optional<MediaRoute> route_; + DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); }; @@ -242,23 +266,6 @@ MOCK_METHOD0(OnControllerInvalidated, void()); }; -// Mockable class for awaiting RegisterMediaRouteProvider callbacks. -class RegisterMediaRouteProviderHandler { - public: - RegisterMediaRouteProviderHandler(); - ~RegisterMediaRouteProviderHandler(); - - // A wrapper function to deal with move only parameter |config|. - void Invoke(const std::string& instance_id, - mojom::MediaRouteProviderConfigPtr config) { - InvokeInternal(instance_id, config.get()); - } - - MOCK_METHOD2(InvokeInternal, - void(const std::string& instance_id, - mojom::MediaRouteProviderConfig* config)); -}; - // Tests the API call flow between the MediaRouterMojoImpl and the Media Router // Mojo service in both directions. class MediaRouterMojoTest : public ::testing::Test { @@ -301,8 +308,6 @@ MockMediaRouteProvider mock_media_route_provider_; MockEventPageRequestManager* request_manager_ = nullptr; - RegisterMediaRouteProviderHandler provide_handler_; - private: content::TestBrowserThreadBundle test_thread_bundle_; scoped_refptr<extensions::Extension> extension_;
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc index 71c2a04..d69551a 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc +++ b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc
@@ -171,7 +171,6 @@ PermissionRequestManager::FromWebContents( browser()->tab_strip_model()->GetActiveWebContents()); prompt_factory_.reset(new MockPermissionPromptFactory(manager)); - manager->DisplayPendingRequests(); // Cleanup. media_stream_devices_.clear();
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter.cc b/chrome/browser/metrics/process_memory_metrics_emitter.cc index 1dced234..d868a537 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter.cc
@@ -142,7 +142,7 @@ service_manager::Connector* connector = content::ServiceManagerConnection::GetForProcess()->GetConnector(); - connector->BindInterface(content::mojom::kBrowserServiceName, + connector->BindInterface(resource_coordinator::mojom::kServiceName, mojo::MakeRequest(&coordinator_)); // The callback keeps this object alive until the callback is invoked..
diff --git a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc index aaa8b51..971a7046 100644 --- a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc +++ b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
@@ -43,6 +43,7 @@ #include "components/ntp_snippets/category_rankers/category_ranker.h" #include "components/ntp_snippets/content_suggestions_service.h" #include "components/ntp_snippets/features.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/ntp_snippets_constants.h" #include "components/ntp_snippets/remote/persistent_scheduler.h" #include "components/ntp_snippets/remote/prefetched_pages_tracker.h" @@ -354,7 +355,8 @@ Profile* profile, SigninManagerBase* signin_manager, UserClassifier* user_classifier, - OfflinePageModel* offline_page_model) { + OfflinePageModel* offline_page_model, + ntp_snippets::Logger* debug_logger) { if (!IsArticleProviderEnabled()) { return; } @@ -418,7 +420,7 @@ base::MakeUnique<RemoteSuggestionsStatusServiceImpl>( signin_manager, pref_service, additional_toggle_pref), std::move(prefetched_pages_tracker), - std::move(breaking_news_raw_data_provider)); + std::move(breaking_news_raw_data_provider), debug_logger); service->remote_suggestions_scheduler()->SetProvider(provider.get()); service->set_remote_suggestions_provider(provider.get()); @@ -512,6 +514,9 @@ OfflinePageModel* offline_page_model = nullptr; #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) + auto debug_logger = base::MakeUnique<ntp_snippets::Logger>(); + ntp_snippets::Logger* raw_debug_logger = debug_logger.get(); + // Create the RemoteSuggestionsScheduler. PersistentScheduler* persistent_scheduler = nullptr; #if defined(OS_ANDROID) @@ -519,7 +524,8 @@ #endif // OS_ANDROID auto scheduler = base::MakeUnique<RemoteSuggestionsSchedulerImpl>( persistent_scheduler, user_classifier_raw, pref_service, - g_browser_process->local_state(), base::MakeUnique<base::DefaultClock>()); + g_browser_process->local_state(), base::MakeUnique<base::DefaultClock>(), + raw_debug_logger); // Create the ContentSuggestionsService. SigninManagerBase* signin_manager = @@ -535,10 +541,11 @@ auto* service = new ContentSuggestionsService( State::ENABLED, signin_manager, history_service, large_icon_service, pref_service, std::move(category_ranker), std::move(user_classifier), - std::move(scheduler)); + std::move(scheduler), std::move(debug_logger)); RegisterArticleProviderIfEnabled(service, profile, signin_manager, - user_classifier_raw, offline_page_model); + user_classifier_raw, offline_page_model, + raw_debug_logger); RegisterBookmarkProviderIfEnabled(service, profile); RegisterForeignSessionsProviderIfEnabled(service, profile);
diff --git a/chrome/browser/permissions/permission_context_base_unittest.cc b/chrome/browser/permissions/permission_context_base_unittest.cc index a3fc0f0..382ff687 100644 --- a/chrome/browser/permissions/permission_context_base_unittest.cc +++ b/chrome/browser/permissions/permission_context_base_unittest.cc
@@ -722,7 +722,6 @@ PermissionRequestManager* manager = PermissionRequestManager::FromWebContents(web_contents()); prompt_factory_.reset(new MockPermissionPromptFactory(manager)); - manager->DisplayPendingRequests(); } void TearDown() override {
diff --git a/chrome/browser/permissions/permission_decision_auto_blocker.cc b/chrome/browser/permissions/permission_decision_auto_blocker.cc index 62e1df7..71ef6f8 100644 --- a/chrome/browser/permissions/permission_decision_auto_blocker.cc +++ b/chrome/browser/permissions/permission_decision_auto_blocker.cc
@@ -26,25 +26,29 @@ namespace { +constexpr int kDefaultDismissalsBeforeBlock = 3; +constexpr int kDefaultIgnoresBeforeBlock = 4; +constexpr int kDefaultEmbargoDays = 7; + // The number of times that users may explicitly dismiss a permission prompt // from an origin before it is automatically blocked. -int g_dismissals_before_block = 3; +int g_dismissals_before_block = kDefaultDismissalsBeforeBlock; // The number of times that users may ignore a permission prompt from an origin // before it is automatically blocked. -int g_ignores_before_block = 4; +int g_ignores_before_block = kDefaultIgnoresBeforeBlock; // The number of days that an origin will stay under embargo for a requested // permission due to repeated dismissals. -int g_dismissal_embargo_days = 7; +int g_dismissal_embargo_days = kDefaultEmbargoDays; // The number of days that an origin will stay under embargo for a requested // permission due to repeated ignores. -int g_ignore_embargo_days = 7; +int g_ignore_embargo_days = kDefaultEmbargoDays; // The number of days that an origin will stay under embargo for a requested // permission due to blacklisting. -int g_blacklist_embargo_days = 7; +int g_blacklist_embargo_days = kDefaultEmbargoDays; // Maximum time in milliseconds to wait for safe browsing service to check a // url for blacklisting. After this amount of time, the check will be aborted @@ -131,6 +135,16 @@ return false; } +void UpdateValueFromVariation(const std::string& variation_value, + int* value_store, + const int default_value) { + int tmp_value = -1; + if (base::StringToInt(variation_value, &tmp_value) && tmp_value > 0) + *value_store = tmp_value; + else + *value_store = default_value; +} + } // namespace // PermissionDecisionAutoBlocker::Factory -------------------------------------- @@ -234,12 +248,6 @@ // static void PermissionDecisionAutoBlocker::UpdateFromVariations() { - int dismissals_before_block = -1; - int ignores_before_block = -1; - int dismissal_embargo_days = -1; - int ignore_embargo_days = -1; - int blacklist_embargo_days = -1; - std::string dismissals_before_block_value = variations::GetVariationParamValueByFeature( features::kBlockPromptsIfDismissedOften, kPromptDismissCountKey); @@ -257,30 +265,18 @@ variations::GetVariationParamValueByFeature( features::kPermissionsBlacklist, kPermissionBlacklistEmbargoKey); - // If converting the value fails, stick with the current value. - if (base::StringToInt(dismissals_before_block_value, - &dismissals_before_block) && - dismissals_before_block > 0) { - g_dismissals_before_block = dismissals_before_block; - } - if (base::StringToInt(ignores_before_block_value, &ignores_before_block) && - ignores_before_block > 0) { - g_ignores_before_block = ignores_before_block; - } - if (base::StringToInt(dismissal_embargo_days_value, - &dismissal_embargo_days) && - dismissal_embargo_days > 0) { - g_dismissal_embargo_days = dismissal_embargo_days; - } - if (base::StringToInt(ignore_embargo_days_value, &ignore_embargo_days) && - ignore_embargo_days > 0) { - g_ignore_embargo_days = ignore_embargo_days; - } - if (base::StringToInt(blacklist_embargo_days_value, - &blacklist_embargo_days) && - blacklist_embargo_days > 0) { - g_blacklist_embargo_days = blacklist_embargo_days; - } + // If converting the value fails, revert to the original value. + UpdateValueFromVariation(dismissals_before_block_value, + &g_dismissals_before_block, + kDefaultDismissalsBeforeBlock); + UpdateValueFromVariation(ignores_before_block_value, &g_ignores_before_block, + kDefaultIgnoresBeforeBlock); + UpdateValueFromVariation(dismissal_embargo_days_value, + &g_dismissal_embargo_days, kDefaultEmbargoDays); + UpdateValueFromVariation(ignore_embargo_days_value, &g_ignore_embargo_days, + kDefaultEmbargoDays); + UpdateValueFromVariation(blacklist_embargo_days_value, + &g_blacklist_embargo_days, kDefaultEmbargoDays); } void PermissionDecisionAutoBlocker::CheckSafeBrowsingBlacklist(
diff --git a/chrome/browser/permissions/permission_manager_unittest.cc b/chrome/browser/permissions/permission_manager_unittest.cc index c6422566..06d7010 100644 --- a/chrome/browser/permissions/permission_manager_unittest.cc +++ b/chrome/browser/permissions/permission_manager_unittest.cc
@@ -456,7 +456,6 @@ PermissionRequestManager* manager = PermissionRequestManager::FromWebContents(contents); auto prompt_factory = base::MakeUnique<MockPermissionPromptFactory>(manager); - manager->DisplayPendingRequests(); NavigateAndCommit(url());
diff --git a/chrome/browser/permissions/permission_request_manager.cc b/chrome/browser/permissions/permission_request_manager.cc index 45116a5b..e0f10f10 100644 --- a/chrome/browser/permissions/permission_request_manager.cc +++ b/chrome/browser/permissions/permission_request_manager.cc
@@ -117,7 +117,7 @@ view_factory_(base::Bind(&PermissionPrompt::Create)), view_(nullptr), main_frame_has_fully_loaded_(false), - tab_can_show_prompts_(web_contents->IsVisible()), + tab_is_visible_(web_contents->IsVisible()), persist_(true), auto_response_for_test_(NONE), weak_factory_(this) {} @@ -225,24 +225,6 @@ NOTREACHED(); // Callers should not cancel requests that are not pending. } -void PermissionRequestManager::DisplayPendingRequests() { - tab_can_show_prompts_ = true; - - if (!main_frame_has_fully_loaded_) - return; - - if (requests_.empty()) { - DequeueRequestsAndShowBubble(); - } else { - // We switched tabs away and back while a prompt was active. -#if defined(OS_ANDROID) - DCHECK(view_); -#else - ShowBubble(); -#endif - } -} - void PermissionRequestManager::UpdateAnchorPosition() { if (view_) view_->UpdateAnchorPosition(); @@ -298,11 +280,33 @@ } void PermissionRequestManager::WasShown() { - DisplayPendingRequests(); + // This function can be called when the tab is already showing. + if (tab_is_visible_) + return; + + tab_is_visible_ = true; + + if (!main_frame_has_fully_loaded_) + return; + + if (requests_.empty()) { + DequeueRequestsAndShowBubble(); + } else { + // We switched tabs away and back while a prompt was active. +#if defined(OS_ANDROID) + DCHECK(view_); +#else + ShowBubble(); +#endif + } } void PermissionRequestManager::WasHidden() { - tab_can_show_prompts_ = false; + // This function can be called when the tab is not showing. + if (!tab_is_visible_) + return; + + tab_is_visible_ = false; #if !defined(OS_ANDROID) if (view_) @@ -371,7 +375,7 @@ void PermissionRequestManager::DequeueRequestsAndShowBubble() { if (view_) return; - if (!main_frame_has_fully_loaded_ || !tab_can_show_prompts_) + if (!main_frame_has_fully_loaded_ || !tab_is_visible_) return; if (queued_requests_.empty()) return; @@ -393,7 +397,7 @@ DCHECK(!view_); DCHECK(!requests_.empty()); DCHECK(main_frame_has_fully_loaded_); - DCHECK(tab_can_show_prompts_); + DCHECK(tab_is_visible_); view_ = view_factory_.Run(web_contents(), this); PermissionUmaUtil::PermissionPromptShown(requests_);
diff --git a/chrome/browser/permissions/permission_request_manager.h b/chrome/browser/permissions/permission_request_manager.h index a6b8cbc..4b66d478 100644 --- a/chrome/browser/permissions/permission_request_manager.h +++ b/chrome/browser/permissions/permission_request_manager.h
@@ -75,11 +75,6 @@ // at which time the caller is free to delete the request. void CancelRequest(PermissionRequest* request); - // Will show a permission bubble if there is a pending permission request on - // the web contents that the PermissionRequestManager belongs to. - // TODO(timloh): Remove this from the public API. - void DisplayPendingRequests(); - // Will reposition the bubble (may change parent if necessary). void UpdateAnchorPosition(); @@ -187,7 +182,7 @@ std::unique_ptr<PermissionPrompt> view_; // We only show new prompts when both of these are true. bool main_frame_has_fully_loaded_; - bool tab_can_show_prompts_; + bool tab_is_visible_; std::vector<PermissionRequest*> requests_; base::circular_deque<PermissionRequest*> queued_requests_;
diff --git a/chrome/browser/permissions/permission_request_manager_browsertest.cc b/chrome/browser/permissions/permission_request_manager_browsertest.cc index 701eabe..ca75d66 100644 --- a/chrome/browser/permissions/permission_request_manager_browsertest.cc +++ b/chrome/browser/permissions/permission_request_manager_browsertest.cc
@@ -51,7 +51,6 @@ PermissionRequestManager* manager = GetPermissionRequestManager(); mock_permission_prompt_factory_.reset( new MockPermissionPromptFactory(manager)); - manager->DisplayPendingRequests(); } void TearDownOnMainThread() override { @@ -203,7 +202,7 @@ ADD_FAILURE() << "Not a permission type, or one that doesn't prompt."; return; } - manager->DisplayPendingRequests(); + base::RunLoop().RunUntilIdle(); } // Requests before the load event should be bundled into one bubble.
diff --git a/chrome/browser/permissions/permission_request_manager_test_api.h b/chrome/browser/permissions/permission_request_manager_test_api.h index c651605..26787fa9 100644 --- a/chrome/browser/permissions/permission_request_manager_test_api.h +++ b/chrome/browser/permissions/permission_request_manager_test_api.h
@@ -25,8 +25,7 @@ // Add a "simple" permission request. One that uses PermissionRequestImpl, // such as for ContentSettingsType including MIDI_SYSEX, PUSH_MESSAGING, - // NOTIFICATIONS, GEOLOCATON, or PLUGINS. This can be called multiple times - // before a call to manager()->DisplayPendingRequests(). + // NOTIFICATIONS, GEOLOCATON, or PLUGINS. void AddSimpleRequest(Profile* profile, ContentSettingsType type); // Return the bubble window for the permission prompt or null if there is no
diff --git a/chrome/browser/permissions/permission_request_manager_unittest.cc b/chrome/browser/permissions/permission_request_manager_unittest.cc index 76d96e4b..830d056 100644 --- a/chrome/browser/permissions/permission_request_manager_unittest.cc +++ b/chrome/browser/permissions/permission_request_manager_unittest.cc
@@ -119,7 +119,6 @@ TEST_F(PermissionRequestManagerTest, SingleRequest) { manager_->AddRequest(&request1_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -130,7 +129,6 @@ } TEST_F(PermissionRequestManagerTest, SingleRequestViewFirst) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); @@ -145,7 +143,6 @@ TEST_F(PermissionRequestManagerTest, TwoRequestsUngrouped) { manager_->AddRequest(&request1_); manager_->AddRequest(&request2_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -164,7 +161,6 @@ TEST_F(PermissionRequestManagerTest, MicCameraGrouped) { manager_->AddRequest(&request_mic_); manager_->AddRequest(&request_camera_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -186,7 +182,6 @@ TEST_F(PermissionRequestManagerTest, TwoRequestsTabSwitch) { manager_->AddRequest(&request_mic_); manager_->AddRequest(&request_camera_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -211,7 +206,6 @@ TEST_F(PermissionRequestManagerTest, CancelAfterTabSwitch) { manager_->AddRequest(&request1_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); MockTabSwitchAway(); @@ -225,7 +219,6 @@ } TEST_F(PermissionRequestManagerTest, NoRequests) { - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); EXPECT_FALSE(prompt_factory_->is_visible()); } @@ -242,7 +235,6 @@ } TEST_F(PermissionRequestManagerTest, TwoRequestsDoNotCoalesce) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); manager_->AddRequest(&request2_); @@ -252,7 +244,6 @@ } TEST_F(PermissionRequestManagerTest, TwoRequestsShownInTwoBubbles) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); manager_->AddRequest(&request2_); @@ -269,7 +260,6 @@ } TEST_F(PermissionRequestManagerTest, TestAddDuplicateRequest) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); manager_->AddRequest(&request1_); @@ -279,7 +269,6 @@ } TEST_F(PermissionRequestManagerTest, SequentialRequests) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -298,7 +287,6 @@ } TEST_F(PermissionRequestManagerTest, SameRequestRejected) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); manager_->AddRequest(&request1_); EXPECT_FALSE(request1_.finished()); @@ -309,7 +297,6 @@ } TEST_F(PermissionRequestManagerTest, DuplicateRequestCancelled) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); MockPermissionRequest dupe_request("test1"); manager_->AddRequest(&dupe_request); @@ -321,7 +308,6 @@ } TEST_F(PermissionRequestManagerTest, DuplicateQueuedRequest) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); manager_->AddRequest(&request2_); @@ -346,7 +332,6 @@ } TEST_F(PermissionRequestManagerTest, ForgetRequestsOnPageNavigation) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); manager_->AddRequest(&request2_); @@ -365,13 +350,16 @@ } TEST_F(PermissionRequestManagerTest, TestCancelQueued) { + MockTabSwitchAway(); + manager_->AddRequest(&request1_); EXPECT_FALSE(prompt_factory_->is_visible()); manager_->CancelRequest(&request1_); EXPECT_TRUE(request1_.finished()); EXPECT_FALSE(prompt_factory_->is_visible()); - manager_->DisplayPendingRequests(); + + MockTabSwitchBack(); EXPECT_FALSE(prompt_factory_->is_visible()); manager_->AddRequest(&request2_); @@ -381,7 +369,6 @@ } TEST_F(PermissionRequestManagerTest, TestCancelWhileDialogShown) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); @@ -395,7 +382,6 @@ } TEST_F(PermissionRequestManagerTest, TestCancelWhileDialogShownNoUpdate) { - manager_->DisplayPendingRequests(); prompt_factory_->SetCanUpdateUi(false); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); @@ -410,7 +396,6 @@ } TEST_F(PermissionRequestManagerTest, TestCancelPendingRequest) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); manager_->AddRequest(&request2_); @@ -425,7 +410,6 @@ } TEST_F(PermissionRequestManagerTest, MainFrameNoRequestIFrameRequest) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&iframe_request_same_domain_); WaitForBubbleToBeShown(); WaitForFrameLoad(); @@ -436,7 +420,6 @@ } TEST_F(PermissionRequestManagerTest, MainFrameAndIFrameRequestSameDomain) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); manager_->AddRequest(&iframe_request_same_domain_); WaitForFrameLoad(); @@ -456,7 +439,6 @@ } TEST_F(PermissionRequestManagerTest, MainFrameAndIFrameRequestOtherDomain) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); manager_->AddRequest(&iframe_request_other_domain_); WaitForFrameLoad(); @@ -472,7 +454,6 @@ } TEST_F(PermissionRequestManagerTest, IFrameRequestWhenMainRequestVisible) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -491,7 +472,6 @@ TEST_F(PermissionRequestManagerTest, IFrameRequestOtherDomainWhenMainRequestVisible) { - manager_->DisplayPendingRequests(); manager_->AddRequest(&request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); @@ -507,7 +487,6 @@ } TEST_F(PermissionRequestManagerTest, RequestsDontNeedUserGesture) { - manager_->DisplayPendingRequests(); WaitForFrameLoad(); WaitForBubbleToBeShown(); manager_->AddRequest(&request1_); @@ -522,7 +501,6 @@ base::HistogramTester histograms; manager_->AddRequest(&request1_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); histograms.ExpectUniqueSample( PermissionUmaUtil::kPermissionsPromptShown, @@ -560,7 +538,6 @@ base::HistogramTester histograms; manager_->AddRequest(&request2_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); histograms.ExpectTotalCount( @@ -600,7 +577,6 @@ base::HistogramTester histograms; manager_->AddRequest(&request1_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); // No need to test UMA for showing prompts again, they were tested in // UMAForSimpleAcceptedBubble. @@ -617,7 +593,6 @@ manager_->AddRequest(&request_mic_); manager_->AddRequest(&request_camera_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); histograms.ExpectUniqueSample( @@ -669,7 +644,6 @@ manager_->AddRequest(&request_mic_); manager_->AddRequest(&request_camera_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); histograms.ExpectTotalCount( "Permissions.Engagement.Denied.AudioAndVideoCapture", 0); @@ -701,7 +675,6 @@ base::HistogramTester histograms; manager_->AddRequest(&request1_); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); histograms.ExpectTotalCount("Permissions.Engagement.Ignored.Quota", 0); @@ -713,7 +686,6 @@ MockPermissionRequest youtube_request( "request2", PermissionRequestType::PERMISSION_GEOLOCATION, youtube); manager_->AddRequest(&youtube_request); - manager_->DisplayPendingRequests(); WaitForBubbleToBeShown(); NavigateAndCommit(GURL("http://www.google.com/"));
diff --git a/chrome/browser/permissions/permissions_browsertest.cc b/chrome/browser/permissions/permissions_browsertest.cc index b9e609a..2747182c 100644 --- a/chrome/browser/permissions/permissions_browsertest.cc +++ b/chrome/browser/permissions/permissions_browsertest.cc
@@ -24,7 +24,6 @@ PermissionRequestManager* manager = PermissionRequestManager::FromWebContents( browser()->tab_strip_model()->GetActiveWebContents()); prompt_factory_.reset(new MockPermissionPromptFactory(manager)); - manager->DisplayPendingRequests(); ASSERT_TRUE(embedded_test_server()->Start());
diff --git a/chrome/browser/plugins/flash_permission_browsertest.cc b/chrome/browser/plugins/flash_permission_browsertest.cc index bdfcf10..7476bae 100644 --- a/chrome/browser/plugins/flash_permission_browsertest.cc +++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -128,7 +128,6 @@ GetWebContents()); auto popup_prompt_factory = base::MakeUnique<MockPermissionPromptFactory>(manager); - manager->DisplayPendingRequests(); EXPECT_EQ(0, popup_prompt_factory->TotalRequestCount()); popup_prompt_factory->set_response_type(PermissionRequestManager::ACCEPT_ALL);
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 989e8f6f..1b142ae 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -3198,7 +3198,6 @@ browser()->tab_strip_model()->GetActiveWebContents()); prompt_factory_.reset(new MockPermissionPromptFactory(manager)); prompt_factory_->set_response_type(PermissionRequestManager::ACCEPT_ALL); - manager->DisplayPendingRequests(); } void TearDownOnMainThread() override { prompt_factory_.reset(); }
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index e4fb413..7deef89 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -432,10 +432,6 @@ policy::DMTokenStorage::RegisterPrefs(registry); policy::PolicyCertServiceFactory::RegisterPrefs(registry); quirks::QuirksManager::RegisterPrefs(registry); - - // Moved to profile prefs, but we still need to register the prefs in local - // state until migration is complete (See MigrateObsoleteBrowserPrefs()). - chromeos::system::InputDeviceSettings::RegisterProfilePrefs(registry); #endif #if defined(OS_MACOSX) @@ -607,7 +603,6 @@ chromeos::quick_unlock::RegisterProfilePrefs(registry); chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry); chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry); - chromeos::system::InputDeviceSettings::RegisterProfilePrefs(registry); chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry); extensions::EPKPChallengeUserKey::RegisterProfilePrefs(registry); flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry); @@ -692,12 +687,6 @@ // This method should be periodically pruned of year+ old migrations. void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { -#if defined(OS_CHROMEOS) - // Added 11/2016 - local_state->ClearPref(prefs::kTouchscreenEnabled); - local_state->ClearPref(prefs::kTouchpadEnabled); -#endif // defined(OS_CHROMEOS) - #if defined(OS_ANDROID) // Added 8/2017. local_state->ClearPref(kStabilityForegroundActivityType);
diff --git a/chrome/browser/previews/previews_infobar_delegate.cc b/chrome/browser/previews/previews_infobar_delegate.cc index b2accfd..4d7ef7e 100644 --- a/chrome/browser/previews/previews_infobar_delegate.cc +++ b/chrome/browser/previews/previews_infobar_delegate.cc
@@ -74,11 +74,9 @@ case previews::PreviewsType::LITE_PAGE: case previews::PreviewsType::OFFLINE: case previews::PreviewsType::AMP_REDIRECTION: - // Prevent LoFi and lite page modes from showing after reload. - // TODO(ryansturm): rename DISABLE_LOFI_MODE to DISABLE_PREVIEWS. - // crbug.com/707272 + // Prevent previews and lite page modes from showing after reload. web_contents->GetController().Reload( - content::ReloadType::DISABLE_LOFI_MODE, true); + content::ReloadType::DISABLE_PREVIEWS, true); break; case previews::PreviewsType::LOFI: web_contents->ReloadLoFiImages();
diff --git a/chrome/browser/previews/previews_infobar_delegate_unittest.cc b/chrome/browser/previews/previews_infobar_delegate_unittest.cc index 3df9443..4008ddf 100644 --- a/chrome/browser/previews/previews_infobar_delegate_unittest.cc +++ b/chrome/browser/previews/previews_infobar_delegate_unittest.cc
@@ -395,7 +395,7 @@ content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); - EXPECT_EQ(content::ReloadType::DISABLE_LOFI_MODE, + EXPECT_EQ(content::ReloadType::DISABLE_PREVIEWS, TestPreviewsWebContentsObserver::FromWebContents(web_contents()) ->last_navigation_reload_type()); @@ -538,7 +538,7 @@ content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); - EXPECT_EQ(content::ReloadType::DISABLE_LOFI_MODE, + EXPECT_EQ(content::ReloadType::DISABLE_PREVIEWS, TestPreviewsWebContentsObserver::FromWebContents(web_contents()) ->last_navigation_reload_type());
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 8f49cc4..5dcf7222 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc
@@ -78,6 +78,7 @@ #include "components/sync/base/pref_names.h" #include "components/url_formatter/url_fixer.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/ignore_errors_cert_verifier.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_context.h" #include "content/public/common/content_switches.h" @@ -1115,6 +1116,10 @@ cert_verifier_ = base::MakeUnique<net::CachingCertVerifier>( base::MakeUnique<net::MultiThreadedCertVerifier>(verify_proc.get())); } + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + cert_verifier_ = content::IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( + command_line, switches::kUserDataDir, std::move(cert_verifier_)); builder->set_shared_cert_verifier(cert_verifier_.get()); #else builder->set_shared_cert_verifier(
diff --git a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc index 425f822..54988aaa 100644 --- a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc +++ b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc
@@ -36,13 +36,13 @@ service_manager::Connector* connector = content::ServiceManagerConnection::GetForProcess()->GetConnector(); - tab_resource_coordinator_ = + page_resource_coordinator_ = base::MakeUnique<resource_coordinator::ResourceCoordinatorInterface>( - connector, resource_coordinator::CoordinationUnitType::kWebContents); + connector, resource_coordinator::CoordinationUnitType::kPage); // Make sure to set the visibility property when we create - // |tab_resource_coordinator_|. - tab_resource_coordinator_->SetProperty( + // |page_resource_coordinator_|. + page_resource_coordinator_->SetProperty( resource_coordinator::mojom::PropertyType::kVisible, web_contents->IsVisible()); @@ -59,7 +59,7 @@ // Gets CoordinationUnitID for this WebContents and adds it to // GRCTabSignalObserver. grc_tab_signal_observer->AssociateCoordinationUnitIDWithWebContents( - tab_resource_coordinator_->id(), web_contents); + page_resource_coordinator_->id(), web_contents); } #endif } @@ -114,12 +114,12 @@ } void ResourceCoordinatorWebContentsObserver::WasShown() { - tab_resource_coordinator_->SetProperty( + page_resource_coordinator_->SetProperty( resource_coordinator::mojom::PropertyType::kVisible, true); } void ResourceCoordinatorWebContentsObserver::WasHidden() { - tab_resource_coordinator_->SetProperty( + page_resource_coordinator_->SetProperty( resource_coordinator::mojom::PropertyType::kVisible, false); } @@ -130,7 +130,7 @@ // Gets CoordinationUnitID for this WebContents and removes it from // GRCTabSignalObserver. grc_tab_signal_observer->RemoveCoordinationUnitID( - tab_resource_coordinator_->id()); + page_resource_coordinator_->id()); } #endif } @@ -145,7 +145,7 @@ if (navigation_handle->IsInMainFrame()) { UpdateUkmRecorder(navigation_handle->GetNavigationId()); ResetFlag(); - tab_resource_coordinator_->SendEvent( + page_resource_coordinator_->SendEvent( resource_coordinator::mojom::Event::kNavigationCommitted); } @@ -154,7 +154,7 @@ auto* frame_resource_coordinator = render_frame_host->GetFrameResourceCoordinator(); - tab_resource_coordinator_->AddChild(*frame_resource_coordinator); + page_resource_coordinator_->AddChild(*frame_resource_coordinator); auto* process_resource_coordinator = render_frame_host->GetProcess()->GetProcessResourceCoordinator(); @@ -168,7 +168,7 @@ first_time_title_set_ = true; return; } - tab_resource_coordinator_->SendEvent( + page_resource_coordinator_->SendEvent( resource_coordinator::mojom::Event::kTitleUpdated); } @@ -178,7 +178,7 @@ first_time_favicon_set_ = true; return; } - tab_resource_coordinator_->SendEvent( + page_resource_coordinator_->SendEvent( resource_coordinator::mojom::Event::kFaviconUpdated); } @@ -190,7 +190,7 @@ ukm_source_id_ = ukm::ConvertToSourceId(navigation_id, ukm::SourceIdType::NAVIGATION_ID); - tab_resource_coordinator_->SetProperty( + page_resource_coordinator_->SetProperty( resource_coordinator::mojom::PropertyType::kUKMSourceId, ukm_source_id_); }
diff --git a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h index fc02cae..14802c9 100644 --- a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h +++ b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h
@@ -28,8 +28,8 @@ static bool IsEnabled(); resource_coordinator::ResourceCoordinatorInterface* - tab_resource_coordinator() { - return tab_resource_coordinator_.get(); + page_resource_coordinator() { + return page_resource_coordinator_.get(); } // WebContentsObserver implementation. @@ -58,7 +58,7 @@ ResourceCoordinatorWebContentsObserver>; std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> - tab_resource_coordinator_; + page_resource_coordinator_; ukm::SourceId ukm_source_id_; // Favicon and title are set when a page is loaded, we only want to send
diff --git a/chrome/browser/resources/PRESUBMIT.py b/chrome/browser/resources/PRESUBMIT.py index b8a8396..e7a3e43 100644 --- a/chrome/browser/resources/PRESUBMIT.py +++ b/chrome/browser/resources/PRESUBMIT.py
@@ -96,9 +96,9 @@ input_api, output_api, 80, lambda x: x.LocalPath().endswith('.html')) -def RunVulcanizeTests(input_api, output_api): +def RunOptimizeWebUiTests(input_api, output_api): presubmit_path = input_api.PresubmitLocalPath() - tests = [input_api.os_path.join(presubmit_path, 'vulcanize_gn_test.py')] + tests = [input_api.os_path.join(presubmit_path, 'optimize_webui_test.py')] return input_api.canned_checks.RunUnitTests(input_api, output_api, tests) @@ -123,8 +123,8 @@ affected = input_api.AffectedFiles() if any(f for f in affected if f.LocalPath().endswith('.html')): results += CheckHtml(input_api, output_api) - if any(f for f in affected if f.LocalPath().endswith('vulcanize_gn.py')): - results += RunVulcanizeTests(input_api, output_api) + if any(f for f in affected if f.LocalPath().endswith('optimize_webui.py')): + results += RunOptimizeWebUiTests(input_api, output_api) results += _CheckWebDevStyle(input_api, output_api) results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api, check_js=True)
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js index db72fa8..415e524 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
@@ -175,6 +175,23 @@ }; /** + * @param {!AutomationNode} node + * @return {boolean} + */ +AutomationPredicate.leafWithWordStop = function(node) { + function hasWordStop(node) { + if (node.role == Role.INLINE_TEXT_BOX) + return node.wordStarts && node.wordStarts.length; + + // Non-text objects are treated as having a single word stop. + return true; + } + // Do not include static text leaves, which occur for an en end-of-line. + return AutomationPredicate.leaf(node) && !node.state[State.INVISIBLE] && + node.role != Role.STATIC_TEXT && hasWordStop(node); +}; + +/** * Matches against leaves or static text nodes. Useful when restricting * traversal to non-inline textboxes while still allowing them if navigation * already entered into an inline textbox.
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs index c370884..b748438 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs
@@ -64,6 +64,14 @@ <p>end<span>of test</span></p> */}, + buttonDoc: function() {/*! + <p>start</p> + <button>hello button one</button> + cats + <button>hello button two</button> + <p>end</p> + */}, + formsDoc: function() {/*! <select id="fruitSelect"> <option>apple</option> @@ -188,6 +196,10 @@ .expectSpeech('alpha', 'Link'); mockFeedback.call(doCmd('nextWord')) .expectSpeech('beta', 'Link'); + mockFeedback.call(doCmd('previousWord')) + .expectSpeech('alpha', 'Link'); + mockFeedback.call(doCmd('nextWord')) + .expectSpeech('beta', 'Link'); mockFeedback.call(doCmd('nextWord')) .expectSpeech('charlie', 'Heading 1'); mockFeedback.call(doCmd('nextLine')) @@ -218,6 +230,29 @@ }); }); +/** Tests that individual buttons are stops for move-by-word functionality. */ +TEST_F('BackgroundTest', 'CaretNavigationTreatsButtonAsWord', function() { + var mockFeedback = this.createMockFeedback(); + this.runWithLoadedTree(this.buttonDoc, function() { + mockFeedback.expectSpeech('start'); + mockFeedback.call(doCmd('nextWord')) + .expectSpeech('hello button one', 'Button'); + mockFeedback.call(doCmd('nextWord')) + .expectSpeech('cats'); + mockFeedback.call(doCmd('nextWord')) + .expectSpeech('hello button two', 'Button'); + mockFeedback.call(doCmd('nextWord')) + .expectSpeech('end'); + mockFeedback.call(doCmd('previousWord')) + .expectSpeech('hello button two', 'Button'); + mockFeedback.call(doCmd('previousWord')) + .expectSpeech('cats'); + mockFeedback.call(doCmd('previousWord')) + .expectSpeech('hello button one', 'Button'); + mockFeedback.replay(); + }); +}); + TEST_F('BackgroundTest', 'SelectSingleBasic', function() { var mockFeedback = this.createMockFeedback(); this.runWithLoadedTree(this.formsDoc, function() {
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js index 0ff8b5fb..962b47881 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
@@ -552,18 +552,18 @@ case 'readCurrentTitle': var target = ChromeVoxState.instance.currentRange_.start.node; var output = new Output(); + target = AutomationUtil.getTopLevelRoot(target) || target.parent; - if (target.root.role == RoleType.ROOT_WEB_AREA) { - // Web. - target = target.root; + // Search for a container (e.g. rootWebArea, window) with a title-like + // string. + while (target && !target.name && !target.docUrl) + target = target.parent; + + if (!target) + output.format('@no_title'); + else output.withString(target.name || target.docUrl); - } else { - // Views. - while (target.role != RoleType.WINDOW) - target = target.parent; - if (target) - output.withString(target.name || ''); - } + output.go(); return false; case 'readCurrentURL':
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js index d544e6a..1c8b628 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -292,11 +292,10 @@ var newNode = originalNode; var newIndex = this.index_; - if (unit != Unit.NODE && newIndex === cursors.NODE_INDEX) - newIndex = 0; - switch (unit) { case Unit.CHARACTER: + if (newIndex === cursors.NODE_INDEX) + newIndex = 0; // BOUND and DIRECTIONAL are the same for characters. var text = this.getText(); newIndex = dir == Dir.FORWARD ? @@ -317,12 +316,22 @@ } break; case Unit.WORD: - if (newNode.role != RoleType.INLINE_TEXT_BOX) { - newNode = AutomationUtil.findNextNode( - newNode, Dir.FORWARD, AutomationPredicate.inlineTextBox, - {skipInitialSubtree: false}) || + // If we're not already on a node with word stops, find the next one. + if (!AutomationPredicate.leafWithWordStop(newNode)) { + newNode = + AutomationUtil.findNextNode( + newNode, Dir.FORWARD, AutomationPredicate.leafWithWordStop, + {skipInitialSubtree: false}) || newNode; } + + // Ensure start position is on or after first word. + var firstWordStart = (newNode.wordStarts && newNode.wordStarts.length) ? + newNode.wordStarts[0] : + 0; + if (newIndex < firstWordStart) // Also catches cursors.NODE_INDEX case. + newIndex = firstWordStart; + switch (movement) { case Movement.BOUND: if (newNode.role == RoleType.INLINE_TEXT_BOX) { @@ -338,44 +347,47 @@ if (goog.isDef(start) && goog.isDef(end)) newIndex = dir == Dir.FORWARD ? end : start; } else { - // TODO(dtseng): Figure out what to do in this case. + newIndex = cursors.NODE_INDEX; } break; case Movement.DIRECTIONAL: + var start; if (newNode.role == RoleType.INLINE_TEXT_BOX) { - var start, end; + // Go to the next word stop in the same piece of text. for (var i = 0; i < newNode.wordStarts.length; i++) { if (newIndex >= newNode.wordStarts[i] && newIndex <= newNode.wordEnds[i]) { var nextIndex = dir == Dir.FORWARD ? i + 1 : i - 1; start = newNode.wordStarts[nextIndex]; - end = newNode.wordEnds[nextIndex]; break; } } - if (goog.isDef(start)) { - newIndex = start; - } else { + } + if (goog.isDef(start)) { + // Succesfully found the next word stop within the same text node. + newIndex = start; + } else { + // Use adjacent word in adjacent next node in direction |dir|. + if (dir == Dir.BACKWARD && newIndex > firstWordStart) { // The backward case is special at the beginning of nodes. - if (dir == Dir.BACKWARD && newIndex != 0) { - newIndex = 0; - } else { - newNode = AutomationUtil.findNextNode( - newNode, dir, AutomationPredicate.leaf); - if (newNode) { - newIndex = 0; - if (dir == Dir.BACKWARD && - newNode.role == RoleType.INLINE_TEXT_BOX) { - var starts = newNode.wordStarts; - newIndex = starts[starts.length - 1] || 0; - } else { - // TODO(dtseng): Figure out what to do for general nodes. + newIndex = firstWordStart; + } else { + newNode = AutomationUtil.findNextNode( + newNode, dir, AutomationPredicate.leafWithWordStop); + if (newNode) { + if (newNode.role == RoleType.INLINE_TEXT_BOX) { + var starts = newNode.wordStarts; + if (starts.length) { + newIndex = dir == Dir.BACKWARD ? + starts[starts.length - 1] : + starts[0]; } + } else { + // For non-text nodes, move by word = by object. + newIndex = cursors.NODE_INDEX; } } } - } else { - // TODO(dtseng): Figure out what to do in this case. } } break;
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs index 5aaef28..21437a6 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs
@@ -278,11 +278,12 @@ '||Edit text, email entry', '||Password edit text', '||Edit text numeric only', - ['0|Min 0|Max 0||Spin button', - [{value: 'valueForRange', start: 0, end: 1}, - {value: 'name', start: 14, end: 14}, - {value: new Output.EarconAction('LISTBOX'), start: 14, end: 14}, - {value: 'role', start: 15, end: 26}] + ['||Spin button', + [{value: new Output.SelectionSpan(0, 0), start: 0, end: 0}, + {value: 'value', start: 0, end: 0}, + {value: 'name', start: 1, end: 1}, + {value: new Output.EarconAction('LISTBOX'), start: 1, end: 1}, + {value: 'role', start: 2, end: 13}] ], ['Time control', [{value: 'role', start: 0, end: 12}] @@ -306,7 +307,7 @@ ' @ed 8dot', ' pwded', ' #ed', - {string_: '0 min:0 max:0 spnbtn'}, + ' spnbtn', {string_: 'time'}, {string_: 'date'}, {string_: 'Choose File No file chosen btn'},
diff --git a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd index 7a76f8b..91ecc61 100644 --- a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd +++ b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -2790,6 +2790,9 @@ <message desc="Shown to a user when they press a braille keyboard command that requires on screen keyboard to be enabled." name="IDS_CHROMEVOX_ENABLE_VIRTUAL_KEYBOARD"> Please enable the on screen keyboard under status tray, accessibility to use extended braille commands. </message> + <message desc="Shown to a user when they invoke the read current title command in a context without a title." name="IDS_CHROMEVOX_NO_TITLE"> + No title + </message> </messages> </release> </grit>
diff --git a/chrome/browser/resources/interventions_internals/index.html b/chrome/browser/resources/interventions_internals/index.html new file mode 100644 index 0000000..8aa4e2b --- /dev/null +++ b/chrome/browser/resources/interventions_internals/index.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>Interventions-Internals</title> + </head> + + <body> + <p>Interventions-Internals -- Comming soon!</p> + </body> +</html>
diff --git a/chrome/browser/resources/local_ntp/voice.js b/chrome/browser/resources/local_ntp/voice.js index 2e0592c3..38adc6316a 100644 --- a/chrome/browser/resources/local_ntp/voice.js +++ b/chrome/browser/resources/local_ntp/voice.js
@@ -581,7 +581,7 @@ * @param {KeyboardEvent} event The keydown event. */ speech.onKeyDown = function(event) { - if (!speech.isRecognizing_()) { + if (!speech.isRecognizing()) { const ctrlKeyPressed = event.ctrlKey || (speech.isUserAgentMac_() && event.metaKey); if (speech.currentState_ == speech.State_.READY && @@ -766,11 +766,21 @@ /** + * Check to see if the speech recognition interface is running, and has + * received any results. + * @return {boolean} True, if the speech recognition interface is running, + * and has received any results. + */ +speech.hasReceivedResults = function() { + return speech.currentState_ == speech.State_.RESULT_RECEIVED; +}; + + +/** * Check to see if the speech recognition interface is running. * @return {boolean} True, if the speech recognition interface is running. - * @private */ -speech.isRecognizing_ = function() { +speech.isRecognizing = function() { switch (speech.currentState_) { case speech.State_.STARTED: case speech.State_.AUDIO_RECEIVED: @@ -785,7 +795,7 @@ /** * Check if the controller is in a state where the UI is definitely hidden. * Since we show the UI for a few seconds after we receive an error from the - * API, we need a separate definition to |speech.isRecognizing_()| to indicate + * API, we need a separate definition to |speech.isRecognizing()| to indicate * when the UI is hidden. <strong>Note:</strong> that if this function * returns false, it might not necessarily mean that the UI is visible. * @return {boolean} True if the UI is hidden. @@ -1140,9 +1150,8 @@ */ text.startListeningMessageAnimation_ = function() { const animateListeningText = function() { - // TODO(oskopek): Substitute the fragile string comparison with a correct - // state condition. - if (text.interim_.textContent == speech.messages.ready) { + // If speech is active with no results yet, show the message and animation. + if (speech.isRecognizing() && !speech.hasReceivedResults()) { text.updateTextArea(speech.messages.listening); text.interim_.classList.add(text.LISTENING_ANIMATION_CLASS_); }
diff --git a/chrome/browser/resources/md_bookmarks/BUILD.gn b/chrome/browser/resources/md_bookmarks/BUILD.gn index 16e7498..d1d84aa 100644 --- a/chrome/browser/resources/md_bookmarks/BUILD.gn +++ b/chrome/browser/resources/md_bookmarks/BUILD.gn
@@ -1,6 +1,6 @@ -import("../vulcanize.gni") +import("../optimize_webui.gni") -vulcanize("build") { +optimize_webui("build") { host = "bookmarks" html_in_files = [ "bookmarks.html" ] html_out_files = [ "vulcanized.html" ]
diff --git a/chrome/browser/resources/md_bookmarks/app.html b/chrome/browser/resources/md_bookmarks/app.html index b047f36..68474352 100644 --- a/chrome/browser/resources/md_bookmarks/app.html +++ b/chrome/browser/resources/md_bookmarks/app.html
@@ -71,8 +71,8 @@ <bookmarks-toolbar sidebar-width="[[sidebarWidth_]]" role="banner"> </bookmarks-toolbar> <div id="main-container"> - <div id="sidebar" role="navigation"> - <bookmarks-folder-node item-id="0" depth="-1"></bookmarks-folder-node> + <div id="sidebar" role="navigation" aria-label="$i18n{sidebarAxLabel}"> + <bookmarks-folder-node item-id="0" depth="-1"></bookmarks-folder-node> </div> <div id="splitter"></div> <bookmarks-list></bookmarks-list>
diff --git a/chrome/browser/resources/md_bookmarks/compiled_resources2.gyp b/chrome/browser/resources/md_bookmarks/compiled_resources2.gyp index 0ce298c..f5f4138 100644 --- a/chrome/browser/resources/md_bookmarks/compiled_resources2.gyp +++ b/chrome/browser/resources/md_bookmarks/compiled_resources2.gyp
@@ -112,6 +112,7 @@ 'target_name': 'folder_node', 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], 'dependencies': [ + '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data', '<(EXTERNS_GYP):chrome_extensions', 'actions', 'command_manager',
diff --git a/chrome/browser/resources/md_bookmarks/folder_node.html b/chrome/browser/resources/md_bookmarks/folder_node.html index 57a4100..182b0226 100644 --- a/chrome/browser/resources/md_bookmarks/folder_node.html +++ b/chrome/browser/resources/md_bookmarks/folder_node.html
@@ -83,7 +83,7 @@ on-tap="selectFolder_" on-dblclick="toggleFolder_" on-contextmenu="onContextMenu_" - tabindex$="[[getTabIndex_(isSelectedFolder_)]]" + tabindex$="[[getTabIndex_(selectedFolder_, itemId)]]" hidden="[[isRootFolder_(depth)]]" role="treeitem"> <template is="dom-if" if="[[hasChildFolder_]]"> @@ -92,7 +92,7 @@ on-tap="toggleFolder_" on-mousedown="preventDefault_" tabindex="-1" - aria-hidden="true"> + aria-label$="[[getButtonAriaLabel_(isOpen, item_)]]"> <iron-icon icon="cr:arrow-drop-down" is-open$="[[isOpen]]"> </iron-icon> </button>
diff --git a/chrome/browser/resources/md_bookmarks/folder_node.js b/chrome/browser/resources/md_bookmarks/folder_node.js index 7657c4a..ba8e361 100644 --- a/chrome/browser/resources/md_bookmarks/folder_node.js +++ b/chrome/browser/resources/md_bookmarks/folder_node.js
@@ -113,6 +113,8 @@ xDirection = -1; } else if (e.key == 'ArrowRight') { xDirection = 1; + } else if (e.key == ' ') { + this.selectFolder_(); } else { handled = false; } @@ -364,7 +366,10 @@ * @return {string} */ getTabIndex_: function() { - return this.isSelectedFolder_ ? '0' : '-1'; + // This returns a tab index of 0 for the cached selected folder when the + // search is active, even though this node is not technically selected. This + // allows the sidebar to be focusable during a search. + return this.selectedFolder_ == this.itemId ? '0' : '-1'; }, /** @@ -390,4 +395,14 @@ return openState != null ? openState : depth <= FOLDER_OPEN_BY_DEFAULT_DEPTH; }, + + /** + * @private + * @return {string} + */ + getButtonAriaLabel_: function() { + return loadTimeData.getStringF( + this.isOpen ? 'sidebarNodeCollapseAxLabel' : 'sidebarNodeExpandAxLabel', + this.item_.title); + }, });
diff --git a/chrome/browser/resources/md_bookmarks/item.html b/chrome/browser/resources/md_bookmarks/item.html index 30c219c6..da6943d36 100644 --- a/chrome/browser/resources/md_bookmarks/item.html +++ b/chrome/browser/resources/md_bookmarks/item.html
@@ -51,6 +51,7 @@ class="more-vert-button" tabindex$="[[ironListTabIndex]]" title="$i18n{moreActionsButtonTitle}" + aria-label$="[[getButtonAriaLabel_(item_)]]" on-click="onMenuButtonClick_" on-dblclick="onMenuButtonDblClick_" aria-haspopup="menu">
diff --git a/chrome/browser/resources/md_bookmarks/item.js b/chrome/browser/resources/md_bookmarks/item.js index fb5ee7e1..c3c12c3 100644 --- a/chrome/browser/resources/md_bookmarks/item.js +++ b/chrome/browser/resources/md_bookmarks/item.js
@@ -212,4 +212,10 @@ this.$.icon.className = url ? 'website-icon' : 'folder-icon'; this.$.icon.style.backgroundImage = url ? cr.icon.getFavicon(url) : null; }, + + /** @private */ + getButtonAriaLabel_: function() { + return loadTimeData.getStringF( + 'moreActionsButtonAxLabel', this.item_.title); + } });
diff --git a/chrome/browser/resources/md_bookmarks/list.html b/chrome/browser/resources/md_bookmarks/list.html index 0d5eb45..2f5ed7aa 100644 --- a/chrome/browser/resources/md_bookmarks/list.html +++ b/chrome/browser/resources/md_bookmarks/list.html
@@ -39,8 +39,11 @@ user-select: none; } </style> - <iron-list id="list" items="[[displayedList_]]" - hidden$="[[isEmptyList_(displayedList_.length)]]" role="list"> + <iron-list id="list" + items="[[displayedList_]]" + hidden$="[[isEmptyList_(displayedList_.length)]]" + role="group" + aria-label="$i18n{listAxLabel}"> <template> <bookmarks-item item-id="[[item.id]]" draggable="true" tabindex$="[[tabIndex]]" iron-list-tab-index="[[tabIndex]]">
diff --git a/chrome/browser/resources/md_downloads/BUILD.gn b/chrome/browser/resources/md_downloads/BUILD.gn index 1b340e3..f741fce8 100644 --- a/chrome/browser/resources/md_downloads/BUILD.gn +++ b/chrome/browser/resources/md_downloads/BUILD.gn
@@ -1,6 +1,6 @@ -import("../vulcanize.gni") +import("../optimize_webui.gni") -vulcanize("build") { +optimize_webui("build") { deps = [] host = "downloads" html_in_files = [ "downloads.html" ]
diff --git a/chrome/browser/resources/md_history/BUILD.gn b/chrome/browser/resources/md_history/BUILD.gn index 2625f11..4930d08 100644 --- a/chrome/browser/resources/md_history/BUILD.gn +++ b/chrome/browser/resources/md_history/BUILD.gn
@@ -1,6 +1,6 @@ -import("../vulcanize.gni") +import("../optimize_webui.gni") -vulcanize("build") { +optimize_webui("build") { host = "history" html_in_files = [ "app.html",
diff --git a/chrome/browser/resources/vulcanize.gni b/chrome/browser/resources/optimize_webui.gni similarity index 95% rename from chrome/browser/resources/vulcanize.gni rename to chrome/browser/resources/optimize_webui.gni index 5555d35..58858dd 100644 --- a/chrome/browser/resources/vulcanize.gni +++ b/chrome/browser/resources/optimize_webui.gni
@@ -25,15 +25,15 @@ } } -template("vulcanize") { +template("optimize_webui") { node(target_name) { - script = "//chrome/browser/resources/vulcanize_gn.py" + script = "//chrome/browser/resources/optimize_webui.py" inputs = [ "//chrome/browser/resources/unpack_pak.py", ] - # This depfile is generated by vulcanize_gn.py + # This depfile is generated by optimize_webui.py depfile = "${target_gen_dir}/${target_name}.d" outputs = []
diff --git a/chrome/browser/resources/vulcanize_gn.py b/chrome/browser/resources/optimize_webui.py similarity index 97% rename from chrome/browser/resources/vulcanize_gn.py rename to chrome/browser/resources/optimize_webui.py index f5c48c88d..b06fe52 100755 --- a/chrome/browser/resources/vulcanize_gn.py +++ b/chrome/browser/resources/optimize_webui.py
@@ -127,7 +127,7 @@ f.write(deps_file_header + ': ' + ' '.join(deps)) -def _vulcanize(in_folder, args): +def _optimize(in_folder, args): in_path = os.path.normpath(os.path.join(_CWD, in_folder)) out_path = os.path.join(_CWD, args.out_folder) manifest_out_path = _request_list_path(out_path, args.host) @@ -232,9 +232,9 @@ args.input = os.path.normpath(args.input) args.out_folder = os.path.normpath(args.out_folder) - manifest_out_path = _vulcanize(args.input, args) + manifest_out_path = _optimize(args.input, args) - # Prior call to _vulcanize() generated an output manifest file, containing + # Prior call to _optimize() generated an output manifest file, containing # information about all files that were bundled. Grab it from there. manifest = json.loads(open(manifest_out_path, 'r').read())
diff --git a/chrome/browser/resources/vulcanize_gn_test.py b/chrome/browser/resources/optimize_webui_test.py similarity index 82% rename from chrome/browser/resources/vulcanize_gn_test.py rename to chrome/browser/resources/optimize_webui_test.py index 9af9495..d8d819b 100755 --- a/chrome/browser/resources/vulcanize_gn_test.py +++ b/chrome/browser/resources/optimize_webui_test.py
@@ -3,17 +3,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import optimize_webui import os import shutil import tempfile import unittest -import vulcanize_gn _HERE_DIR = os.path.dirname(__file__) -class VulcanizeGnTest(unittest.TestCase): +class OptimizeWebUiTest(unittest.TestCase): def setUp(self): self._out_folder = None self._tmp_dirs = [] @@ -39,11 +39,11 @@ assert self._out_folder return open(os.path.join(self._out_folder, file_name), 'r').read() - def _run_vulcanize(self, depfile, html_in_file, html_out_file, js_out_file): - # TODO(dbeam): make it possible to _run_vulcanize twice? Is that useful? + def _run_optimize(self, depfile, html_in_file, html_out_file, js_out_file): + # TODO(dbeam): make it possible to _run_optimize twice? Is that useful? assert not self._out_folder self._out_folder = self._create_tmp_dir() - vulcanize_gn.main([ + optimize_webui.main([ '--depfile', os.path.join(self._out_folder,'depfile.d'), '--html_in_file', html_in_file, '--html_out_file', html_out_file, @@ -54,7 +54,7 @@ ]) - def testSimpleVulcanize(self): + def testSimpleOptimize(self): self._write_file_to_src_dir('element.html', '<div>got here!</div>') self._write_file_to_src_dir('element.js', "alert('yay');") self._write_file_to_src_dir('ui.html', ''' @@ -62,10 +62,10 @@ <script src="element.js"></script> ''') - self._run_vulcanize(depfile='depfile.d', - html_in_file='ui.html', - html_out_file='fast.html', - js_out_file='fast.js') + self._run_optimize(depfile='depfile.d', + html_in_file='ui.html', + html_out_file='fast.html', + js_out_file='fast.js') fast_html = self._read_out_file('fast.html') self.assertFalse('element.html' in fast_html)
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js index 05072dc..fed5c02 100644 --- a/chrome/browser/resources/print_preview/native_layer.js +++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -85,6 +85,7 @@ print_preview.PrinterType = { PRIVET_PRINTER: 0, EXTENSION_PRINTER: 1, + PDF_PRINTER: 2, }; cr.define('print_preview', function() {
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index af4bf1d..4b0ab3d 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -1,11 +1,11 @@ -import("../vulcanize.gni") +import("../optimize_webui.gni") import("//tools/grit/grit_rule.gni") import("//chrome/common/features.gni") settings_pak_file = "settings_resources.pak" unpak_folder = "settings_resources.unpak" -vulcanize("build") { +optimize_webui("build") { host = "settings" html_in_files = [ "settings.html",
diff --git a/chrome/browser/resources/settings/multidevice_page/multidevice_page.html b/chrome/browser/resources/settings/multidevice_page/multidevice_page.html index 8ea02e67..b7a407d 100644 --- a/chrome/browser/resources/settings/multidevice_page/multidevice_page.html +++ b/chrome/browser/resources/settings/multidevice_page/multidevice_page.html
@@ -1,23 +1,26 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="../prefs/prefs.html"> +<link rel="import" href="../controls/settings_toggle_button.html"> <link rel="import" href="../settings_shared_css.html"> <dom-module id="settings-multidevice-page"> <template> - <style include="settings-shared"></style> + <style include="settings-shared"> + settings-toggle-button { + -webkit-padding-end: 0; + flex: 1; + } + </style> <div class="settings-box two-line"> <div class="icon-container"> <iron-icon icon="cr:sms-connect"></iron-icon> </div> - <div id="smsConnectToggleLabel" class="middle"> - $i18n{smsConnect} - <div class="secondary">$i18n{smsConnectSummary}</div> - </div> - <paper-toggle-button checked="{{smsConnectToggleState_}}" - aria-labelledby="smsConnectToggleLabel"> - </paper-toggle-button> + <settings-toggle-button + pref="{{prefs.multidevice.sms_connect_enabled}}" + label="$i18n{smsConnect}" + sub-label="$i18n{smsConnectSummary}"> + </settings-toggle-button> </div> </template> <script src="multidevice_page.js"></script>
diff --git a/chrome/browser/resources/settings/multidevice_page/multidevice_page.js b/chrome/browser/resources/settings/multidevice_page/multidevice_page.js index e402512..0e1d722 100644 --- a/chrome/browser/resources/settings/multidevice_page/multidevice_page.js +++ b/chrome/browser/resources/settings/multidevice_page/multidevice_page.js
@@ -16,22 +16,5 @@ type: Object, notify: true, }, - - /** - * Reflects the current state of the toggle buttons (in this page and the - * subpage). This will be set when the user changes the toggle. - * @private - */ - smsConnectToggleState_: { - type: Boolean, - observer: 'smsConnectToggleStateChanged_', - }, - }, - - /** @private */ - smsConnectToggleStateChanged_: function() { - // TODO(orenb): Switch from paper-toggle-button to settings-toggle-button, - // which will manage the underlying pref state, once the new pref has been - // implemented. Propagate here the pref value to the SMS connect component. }, });
diff --git a/chrome/browser/resources/settings/settings_shared_css.html b/chrome/browser/resources/settings/settings_shared_css.html index 50b5dea..ad043584 100644 --- a/chrome/browser/resources/settings/settings_shared_css.html +++ b/chrome/browser/resources/settings/settings_shared_css.html
@@ -1,5 +1,6 @@ <link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/paper_checkbox_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/paper_input_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/paper_toggle_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> @@ -10,7 +11,7 @@ <!-- Common styles for Material Design settings. --> <dom-module id="settings-shared"> <template> - <style include="settings-icons paper-button-style paper-checkbox-style paper-toggle-style cr-shared-style"> + <style include="settings-icons paper-button-style paper-checkbox-style paper-input-style paper-toggle-style cr-shared-style"> /* Prevent action-links from being selected to avoid accidental * selection when trying to click it. */ a[is=action-link] { @@ -136,11 +137,6 @@ color: var(--google-blue-500); } - paper-input { - /* Fix issue with focus animation making labels wiggle. */ - transform: translate3d(0, 0, 0); - } - controlled-radio-button, paper-radio-button { --paper-radio-button-checked-color: var(--google-blue-500);
diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chrome/browser/resources/settings/settings_ui/settings_ui.js index cb96a4f..6190e525 100644 --- a/chrome/browser/resources/settings/settings_ui/settings_ui.js +++ b/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -133,7 +133,7 @@ this.showAndroidApps_ = loadTimeData.valueExists('androidAppsVisible') && loadTimeData.getBoolean('androidAppsVisible'); - this.showMultidevice_ = + this.showMultidevice_ = this.showAndroidApps_ && loadTimeData.valueExists('enableMultideviceSettings') && loadTimeData.getBoolean('enableMultideviceSettings'); this.havePlayStoreApp_ = loadTimeData.valueExists('havePlayStoreApp') &&
diff --git a/chrome/browser/resources/settings/settings_vars_css.html b/chrome/browser/resources/settings/settings_vars_css.html index 2f5e47c..595e689 100644 --- a/chrome/browser/resources/settings/settings_vars_css.html +++ b/chrome/browser/resources/settings/settings_vars_css.html
@@ -59,40 +59,11 @@ --iron-icon-height: var(--cr-icon-size); --iron-icon-width: var(--cr-icon-size); - --paper-input-container-focus-color: var(--google-blue-500); - --paper-input-container-input: { - color: inherit; - font-size: inherit; - font-weight: inherit; - line-height: 1.54; - vertical-align: baseline; - }; - --paper-input-container-label: { - font-size: inherit; - line-height: 1.54; - }; - --paper-input-container-label-floating: { - /* Using "rem" to make it easier to equalize with other labels. */ - font-size: 1rem; - line-height: 1.65rem; - }; - --paper-input-error: { - font-size: 92.31%; /* Should be 12px when 100% is 13px. */ - line-height: 1.54; - overflow: visible; /* Half-visible error message is not useful at all. */ - }; - --paper-input-max-width: 264px; --paper-radio-button-ink-size: 40px; --paper-radio-button-label-color: inherit; --paper-radio-button-size: 16px; --paper-radio-group-item-padding: 0; - --settings-input-underline: { - border-color: var(--paper-grey-300); - }; - - --paper-input-container-underline: var(--settings-input-underline); - --paper-tabs-selection-bar-color: var(--paper-blue-500); } </style>
diff --git a/chrome/browser/resources/snippets_internals.html b/chrome/browser/resources/snippets_internals.html index 9519cf97..c1e3628 100644 --- a/chrome/browser/resources/snippets_internals.html +++ b/chrome/browser/resources/snippets_internals.html
@@ -92,8 +92,13 @@ <div id="snippets"> <h2>NTPSnippetsService</h2> <div class="forms"> - <button id="submit-download" type="button">Add snippets</button> - <span id="remote-status" class="detail"></span> + <div> + <button id="submit-download" type="button">Add snippets</button> + <span id="remote-status" class="detail"></span> + </div> + <div> + <button id="debug-log-dump" type="button">Dump the debug log</button> + </div> </div> </div>
diff --git a/chrome/browser/resources/snippets_internals.js b/chrome/browser/resources/snippets_internals.js index 69a4cb5a..fc4af6bd 100644 --- a/chrome/browser/resources/snippets_internals.js +++ b/chrome/browser/resources/snippets_internals.js
@@ -7,6 +7,7 @@ // Stores the list of suggestions we received in receiveContentSuggestions. var lastSuggestions = []; + var lastDebugLog = ''; function initialize() { $('submit-download').addEventListener('click', function(event) { @@ -19,6 +20,11 @@ event.preventDefault(); }); + $('debug-log-dump').addEventListener('click', function(event) { + downloadDebugLog(lastDebugLog); + event.preventDefault(); + }); + $('last-json-button').addEventListener('click', function(event) { $('last-json-container').classList.toggle('hidden'); }); @@ -66,6 +72,7 @@ window.addEventListener('focus', refreshContent); window.setInterval(refreshContent, 1000); + chrome.send('initializationCompleted'); refreshContent(); } @@ -136,6 +143,14 @@ } } + function receiveDebugLog(debugLog) { + if (!debugLog) { + lastDebugLog = 'empty'; + } else { + lastDebugLog = debugLog; + } + } + function receiveClassification( userClass, timeToOpenNTP, timeToShow, timeToUse) { receiveProperty('user-class', userClass); @@ -165,6 +180,17 @@ link.click(); } + function downloadDebugLog(debugLog) { + // Redirect the browser to download data in |debugLog| as a file + // "debug_log.txt" (Setting Content-Disposition: attachment via a data: URL + // is not possible; create a link with download attribute and simulate a + // click, instead.) + var link = document.createElement('a'); + link.download = 'debug_log.txt'; + link.href = 'data:text/plain,' + encodeURI(debugLog); + link.click(); + } + function refreshContent() { chrome.send('refreshContent'); } @@ -205,6 +231,7 @@ receiveProperty: receiveProperty, receiveContentSuggestions: receiveContentSuggestions, receiveJson: receiveJson, + receiveDebugLog: receiveDebugLog, receiveClassification: receiveClassification, receiveRankerDebugData: receiveRankerDebugData, receiveLastRemoteSuggestionsBackgroundFetchTime:
diff --git a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc b/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc index 9ed4269..1bb0978 100644 --- a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc +++ b/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
@@ -115,9 +115,7 @@ hit_report.referrer_url = referrer_url_; hit_report.is_subresource = true; hit_report.threat_type = threat_type; - // TODO(nparker) Replace this with database_manager_->GetThreatSource(); - hit_report.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; - // TODO(nparker) Populate hit_report.population_id once Pver4 is used here. + hit_report.threat_source = database_manager_->GetThreatSource(); hit_report.post_data = post_data; hit_report.extended_reporting_level = extended_reporting_level_; hit_report.is_metrics_reporting_active =
diff --git a/chrome/browser/safe_browsing/permission_reporter_browsertest.cc b/chrome/browser/safe_browsing/permission_reporter_browsertest.cc index b4799c67..0dfd9a7 100644 --- a/chrome/browser/safe_browsing/permission_reporter_browsertest.cc +++ b/chrome/browser/safe_browsing/permission_reporter_browsertest.cc
@@ -94,7 +94,6 @@ PermissionRequestManager* manager = GetPermissionRequestManager(browser); std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = base::MakeUnique<MockPermissionPromptFactory>(manager); - manager->DisplayPendingRequests(); ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( @@ -138,7 +137,6 @@ PermissionRequestManager* manager = GetPermissionRequestManager(browser); std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = base::MakeUnique<MockPermissionPromptFactory>(manager); - manager->DisplayPendingRequests(); ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
diff --git a/chrome/browser/signin/dice_browsertest.cc b/chrome/browser/signin/dice_browsertest.cc index b587446..796d088 100644 --- a/chrome/browser/signin/dice_browsertest.cc +++ b/chrome/browser/signin/dice_browsertest.cc
@@ -451,8 +451,14 @@ WaitForReconcilorBlockedCount(1); } +// This test is flaky on Mac, see https://crbug.com/765093 +#if defined(OS_MACOSX) +#define MAYBE_Reauth DISABLED_Reauth +#else +#define MAYBE_Reauth Reauth +#endif // Checks that re-auth on Gaia triggers the fetch for a refresh token. -IN_PROC_BROWSER_TEST_F(DiceBrowserTest, Reauth) { +IN_PROC_BROWSER_TEST_F(DiceBrowserTest, MAYBE_Reauth) { // Start from a signed-in state. SetupSignedInAccounts();
diff --git a/chrome/browser/signin/signin_error_notifier_ash.cc b/chrome/browser/signin/signin_error_notifier_ash.cc index 9f87e40..cdb86ea1 100644 --- a/chrome/browser/signin/signin_error_notifier_ash.cc +++ b/chrome/browser/signin/signin_error_notifier_ash.cc
@@ -9,6 +9,7 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/login/user_flow.h" #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" @@ -32,6 +33,7 @@ #include "ui/message_center/notification.h" #include "ui/message_center/notification_delegate.h" #include "ui/message_center/public/cpp/message_center_constants.h" +#include "ui/message_center/public/cpp/message_center_switches.h" namespace { @@ -144,12 +146,20 @@ message_center::NOTIFICATION_TYPE_SIMPLE, l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE), GetMessageBody(), - ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_NOTIFICATION_ALERT), + message_center::IsNewStyleNotificationEnabled() + ? gfx::Image() + : ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_NOTIFICATION_ALERT), notifier_id, l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_DISPLAY_SOURCE), GURL(notification_id_), notification_id_, data, delegate); - notification.set_accent_color( - message_center::kSystemNotificationColorCriticalWarning); + if (message_center::IsNewStyleNotificationEnabled()) { + notification.set_accent_color( + message_center::kSystemNotificationColorWarning); + notification.set_small_image(gfx::Image(gfx::CreateVectorIcon( + kNotificationWarningIcon, message_center::kSmallImageSizeMD, + message_center::kSystemNotificationColorWarning))); + notification.set_vector_small_image(kNotificationWarningIcon); + } notification.SetSystemPriority(); // Update or add the notification.
diff --git a/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc index a6dd60a..88da147f 100644 --- a/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc +++ b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
@@ -492,10 +492,10 @@ const content::SecurityStyleExplanations& interstitial_explanation = observer.latest_explanations(); - ASSERT_EQ(1u, interstitial_explanation.insecure_explanations.size()); - ASSERT_EQ(1u, interstitial_explanation.neutral_explanations.size()); + ASSERT_EQ(2u, interstitial_explanation.insecure_explanations.size()); + ASSERT_EQ(0u, interstitial_explanation.neutral_explanations.size()); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SHA1), - interstitial_explanation.neutral_explanations[0].summary); + interstitial_explanation.insecure_explanations[0].summary); ProceedThroughInterstitial( browser()->tab_strip_model()->GetActiveWebContents()); @@ -507,10 +507,10 @@ const content::SecurityStyleExplanations& page_explanation = observer.latest_explanations(); - ASSERT_EQ(1u, page_explanation.insecure_explanations.size()); - ASSERT_EQ(1u, page_explanation.neutral_explanations.size()); + ASSERT_EQ(2u, page_explanation.insecure_explanations.size()); + ASSERT_EQ(0u, page_explanation.neutral_explanations.size()); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SHA1), - page_explanation.neutral_explanations[0].summary); + page_explanation.insecure_explanations[0].summary); } // Test security state for a SHA-1 certificate that is allowed by policy. @@ -531,10 +531,10 @@ const content::SecurityStyleExplanations& explanation = observer.latest_explanations(); - ASSERT_EQ(0u, explanation.insecure_explanations.size()); - ASSERT_EQ(1u, explanation.neutral_explanations.size()); + ASSERT_EQ(1u, explanation.insecure_explanations.size()); + ASSERT_EQ(0u, explanation.neutral_explanations.size()); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SHA1), - explanation.neutral_explanations[0].summary); + explanation.insecure_explanations[0].summary); } IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, MixedContent) {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 0c10ba47..a73153ba 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -363,6 +363,8 @@ "webui/instant_ui.h", "webui/interstitials/interstitial_ui.cc", "webui/interstitials/interstitial_ui.h", + "webui/interventions_internals/interventions_internals_ui.cc", + "webui/interventions_internals/interventions_internals_ui.h", "webui/invalidations_message_handler.cc", "webui/invalidations_message_handler.h", "webui/invalidations_ui.cc", @@ -553,6 +555,7 @@ "//components/safe_browsing/common:safe_browsing_prefs", "//components/safe_browsing/password_protection", "//components/safe_browsing/web_ui", + "//components/safe_browsing_db:database_manager", "//components/safe_json", "//components/search", "//components/search_engines", @@ -2175,6 +2178,8 @@ sources += [ "webui/print_preview/extension_printer_handler.cc", "webui/print_preview/extension_printer_handler.h", + "webui/print_preview/pdf_printer_handler.cc", + "webui/print_preview/pdf_printer_handler.h", "webui/print_preview/print_preview_handler.cc", "webui/print_preview/print_preview_handler.h", "webui/print_preview/print_preview_ui.cc", @@ -3290,8 +3295,6 @@ "app_list/extension_app_model_builder.h", "app_list/extension_uninstaller.cc", "app_list/extension_uninstaller.h", - "app_list/google_now_extension.cc", - "app_list/google_now_extension.h", "app_list/launcher_page_event_dispatcher.cc", "app_list/launcher_page_event_dispatcher.h", "app_list/profile_loader.cc",
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc index 64b8caa..af09339 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -15,8 +15,6 @@ #include "build/build_config.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/search/hotword_service.h" -#include "chrome/browser/search/hotword_service_factory.h" #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_syncable_service.h" @@ -287,25 +285,6 @@ observer.OnWallpaperColorsChanged(); } -void AppListViewDelegate::OnHotwordStateChanged(bool started) { - if (started) { - if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_READY) { - OnSpeechRecognitionStateChanged( - app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING); - } - } else { - if (speech_ui_->state() == app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING) - OnSpeechRecognitionStateChanged(app_list::SPEECH_RECOGNITION_READY); - } -} - -void AppListViewDelegate::OnHotwordRecognized( - const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) { - DCHECK_EQ(app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING, - speech_ui_->state()); - StartSpeechRecognitionForHotword(preamble); -} - app_list::AppListModel* AppListViewDelegate::GetModel() { return model_; } @@ -355,13 +334,6 @@ app_list::StartPageService::Get(profile_); if (service) { service->AppListShown(); - if (service->HotwordEnabled()) { - HotwordService* hotword_service = - HotwordServiceFactory::GetForProfile(profile_); - if (hotword_service) - hotword_service->RequestHotwordSession(this); - } - OnHotwordStateChanged(service->HotwordEnabled()); } } @@ -377,29 +349,8 @@ app_list::StartPageService* service = app_list::StartPageService::Get(profile_); - if (service) { + if (service) service->AppListHidden(); - if (service->HotwordEnabled()) { - HotwordService* hotword_service = - HotwordServiceFactory::GetForProfile(profile_); - if (hotword_service) { - hotword_service->StopHotwordSession(this); - - // If we're in always-on mode, we always want to restart hotwording - // after closing the launcher window. So, in always-on mode, hotwording - // is stopped, and then started again right away. Note that hotwording - // may already be stopped. The call to StopHotwordSession() above both - // explicitly stops hotwording, if it's running, and clears the - // association between the hotword service and |this|. When starting up - // hotwording, pass nullptr as the client so that hotword triggers cause - // the launcher to open. - // TODO(amistry): This only works on ChromeOS since Chrome hides the - // launcher instead of destroying it. Make this work on Chrome. - if (hotword_service->IsAlwaysOnEnabled()) - hotword_service->RequestHotwordSession(nullptr); - } - } - } } void AppListViewDelegate::StartSpeechRecognition() { @@ -428,22 +379,6 @@ } service->StartSpeechRecognition(preamble); } - - // With the new hotword extension, stop the hotword session. With the launcher - // and NTP, this is unnecessary since the hotwording is implicitly stopped. - // However, for always on, hotword triggering launches the launcher which - // starts a session and hence starts the hotword detector. This results in the - // hotword detector and the speech-to-text engine running in parallel, which - // will conflict with each other (i.e. saying 'Ok Google' twice in a row - // should cause a search to happen for 'Ok Google', not two hotword triggers). - // To get around this, always stop the session when switching to speech - // recognition. - if (service && service->HotwordEnabled()) { - HotwordService* hotword_service = - HotwordServiceFactory::GetForProfile(profile_); - if (hotword_service) - hotword_service->StopHotwordSession(this); - } } void AppListViewDelegate::OnSpeechResult(const base::string16& result, @@ -463,20 +398,6 @@ void AppListViewDelegate::OnSpeechRecognitionStateChanged( app_list::SpeechRecognitionState new_state) { speech_ui_->SetSpeechRecognitionState(new_state, false); - - app_list::StartPageService* service = - app_list::StartPageService::Get(profile_); - // With the new hotword extension, we need to re-request hotwording after - // speech recognition has stopped. Do not request hotwording after the app - // list has already closed. - if (new_state == app_list::SPEECH_RECOGNITION_READY && service && - service->HotwordEnabled() && controller_->GetAppListWindow()) { - HotwordService* hotword_service = - HotwordServiceFactory::GetForProfile(profile_); - if (hotword_service) { - hotword_service->RequestHotwordSession(this); - } - } } views::View* AppListViewDelegate::CreateStartPageWebView(
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 3dd489b1..9af0b0a 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h
@@ -17,7 +17,6 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" -#include "chrome/browser/search/hotword_client.h" #include "chrome/browser/ui/app_list/start_page_observer.h" #include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service_observer.h" @@ -48,7 +47,6 @@ class AppListViewDelegate : public app_list::AppListViewDelegate, public app_list::StartPageObserver, public ash::mojom::WallpaperObserver, - public HotwordClient, public content::NotificationObserver, public TemplateURLServiceObserver { public: @@ -115,12 +113,6 @@ void OnWallpaperColorsChanged( const std::vector<SkColor>& prominent_colors) override; - // Overridden from HotwordClient: - void OnHotwordStateChanged(bool started) override; - void OnHotwordRecognized( - const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) - override; - // Overridden from content::NotificationObserver: void Observe(int type, const content::NotificationSource& source,
diff --git a/chrome/browser/ui/app_list/google_now_extension.cc b/chrome/browser/ui/app_list/google_now_extension.cc deleted file mode 100644 index 303eb30..0000000 --- a/chrome/browser/ui/app_list/google_now_extension.cc +++ /dev/null
@@ -1,17 +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/ui/app_list/google_now_extension.h" - -#include "components/variations/variations_associated_data.h" - -namespace { -const char kGoogleNowExtensionFieldTrialName[] = "GoogleNowExtension"; -}; // namespace - -bool GetGoogleNowExtensionId(std::string* extension_id) { - *extension_id = variations::GetVariationParamValue( - kGoogleNowExtensionFieldTrialName, "id"); - return !extension_id->empty(); -}
diff --git a/chrome/browser/ui/app_list/google_now_extension.h b/chrome/browser/ui/app_list/google_now_extension.h deleted file mode 100644 index 9b2732b7..0000000 --- a/chrome/browser/ui/app_list/google_now_extension.h +++ /dev/null
@@ -1,14 +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_UI_APP_LIST_GOOGLE_NOW_EXTENSION_H_ -#define CHROME_BROWSER_UI_APP_LIST_GOOGLE_NOW_EXTENSION_H_ - -#include <string> - -// Returns true and sets |extension_id| if extension experiment enabled -// false if no experiment or |extension_id| is empty. -bool GetGoogleNowExtensionId(std::string* extension_id); - -#endif // CHROME_BROWSER_UI_APP_LIST_GOOGLE_NOW_EXTENSION_H_
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc index 134352c..9633564 100644 --- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc +++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
@@ -10,7 +10,6 @@ #include <vector> #include "ash/shell.h" -#include "ash/strings/grit/ash_strings.h" #include "ash/system/system_notifier.h" #include "base/base64.h" #include "base/bind.h" @@ -37,6 +36,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" +#include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" #include "chromeos/login/login_state.h" #include "components/drive/chromeos/file_system_interface.h" @@ -52,7 +52,6 @@ #include "ui/gfx/paint_vector_icon.h" #include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_switches.h" -#include "ui/strings/grit/ui_strings.h" namespace { @@ -186,11 +185,11 @@ ui::ScreenshotGrabberObserver::Result screenshot_result) { switch (screenshot_result) { case ui::ScreenshotGrabberObserver::SCREENSHOTS_DISABLED: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_DISABLED; + return IDS_SCREENSHOT_NOTIFICATION_TITLE_DISABLED; case ui::ScreenshotGrabberObserver::SCREENSHOT_SUCCESS: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS; + return IDS_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS; default: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_FAIL; + return IDS_SCREENSHOT_NOTIFICATION_TITLE_FAIL; } } @@ -198,11 +197,11 @@ ui::ScreenshotGrabberObserver::Result screenshot_result) { switch (screenshot_result) { case ui::ScreenshotGrabberObserver::SCREENSHOTS_DISABLED: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_DISABLED; + return IDS_SCREENSHOT_NOTIFICATION_TEXT_DISABLED; case ui::ScreenshotGrabberObserver::SCREENSHOT_SUCCESS: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS; + return IDS_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS; default: - return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_FAIL; + return IDS_SCREENSHOT_NOTIFICATION_TEXT_FAIL; } } @@ -575,14 +574,14 @@ // The order in which these buttons are added must be reflected by // ScreenshotGrabberNotificationDelegate::ButtonIndex. message_center::ButtonInfo copy_button(l10n_util::GetStringUTF16( - IDS_MESSAGE_CENTER_NOTIFICATION_BUTTON_COPY_SCREENSHOT_TO_CLIPBOARD)); + IDS_SCREENSHOT_NOTIFICATION_BUTTON_COPY_TO_CLIPBOARD)); copy_button.icon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_NOTIFICATION_SCREENSHOT_COPY_TO_CLIPBOARD); optional_field.buttons.push_back(copy_button); if (chromeos::NoteTakingHelper::Get()->IsAppAvailable(GetProfile())) { message_center::ButtonInfo annotate_button(l10n_util::GetStringUTF16( - IDS_MESSAGE_CENTER_NOTIFICATION_BUTTON_ANNOTATE_SCREENSHOT)); + IDS_SCREENSHOT_NOTIFICATION_BUTTON_ANNOTATE)); annotate_button.icon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_NOTIFICATION_SCREENSHOT_ANNOTATE); @@ -608,7 +607,7 @@ IDR_SCREENSHOT_NOTIFICATION_ICON), message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, ash::system_notifier::kNotifierScreenshot), - l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_NOTIFIER_SCREENSHOT_NAME), + l10n_util::GetStringUTF16(IDS_SCREENSHOT_NOTIFICATION_NOTIFIER_NAME), GURL(kNotificationOriginUrl), notification_id, optional_field, new ScreenshotGrabberNotificationDelegate(success, GetProfile(), screenshot_path));
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 07a5e89b..40877d09 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -35,7 +35,6 @@ #include "chrome/browser/chromeos/display/display_preferences.h" #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/chromeos/system/input_device_settings.h" #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile.h" @@ -499,23 +498,6 @@ IDR_BLUETOOTH_KEYBOARD); } -bool ChromeShellDelegate::GetTouchscreenEnabled( - ash::TouchscreenEnabledSource source) const { - return chromeos::system::InputDeviceSettings::Get()->GetTouchscreenEnabled( - source); -} - -void ChromeShellDelegate::SetTouchscreenEnabled( - bool enabled, - ash::TouchscreenEnabledSource source) { - chromeos::system::InputDeviceSettings::Get()->SetTouchscreenEnabled(enabled, - source); -} - -void ChromeShellDelegate::ToggleTouchpad() { - chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad(); -} - std::unique_ptr<keyboard::KeyboardUI> ChromeShellDelegate::CreateKeyboardUI() { return base::MakeUnique<ChromeKeyboardUI>( ProfileManager::GetActiveUserProfile());
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index 51362261..2521e51 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -52,11 +52,6 @@ base::string16 GetProductName() const override; void OpenKeyboardShortcutHelpPage() const override; gfx::Image GetDeprecatedAcceleratorImage() const override; - bool GetTouchscreenEnabled( - ash::TouchscreenEnabledSource source) const override; - void SetTouchscreenEnabled(bool enabled, - ash::TouchscreenEnabledSource source) override; - void ToggleTouchpad() override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; // content::NotificationObserver override:
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index ad217b6..a553bf67 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -17,7 +17,6 @@ #include "ash/shelf/shelf_view_test_api.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/wm/window_state.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" @@ -75,6 +74,7 @@ #include "ui/app_list/views/tile_item_view.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" +#include "ui/base/base_window.h" #include "ui/base/window_open_disposition.h" #include "ui/display/manager/display_manager.h" #include "ui/display/test/display_manager_test_api.h" @@ -82,7 +82,6 @@ #include "ui/events/event.h" #include "ui/events/event_constants.h" #include "ui/events/test/event_generator.h" -#include "ui/wm/core/window_util.h" using ash::Shelf; using extensions::AppWindow; @@ -414,7 +413,7 @@ // Open a window. Confirm the item is now running. AppWindow* window = CreateAppWindow(browser()->profile(), extension); - wm::ActivateWindow(window->GetNativeWindow()); + window->GetBaseWindow()->Activate(); ASSERT_EQ(item_count, shelf_model()->item_count()); item = *shelf_model()->ItemByID(shortcut_id); EXPECT_EQ(ash::TYPE_PINNED_APP, item.type); @@ -495,7 +494,7 @@ // Open a window. Confirm the item is now running. AppWindow* window = CreateAppWindow(browser()->profile(), extension); - wm::ActivateWindow(window->GetNativeWindow()); + window->GetBaseWindow()->Activate(); ASSERT_EQ(item_count, shelf_model()->item_count()); item = *shelf_model()->ItemByID(shortcut_id); EXPECT_EQ(ash::TYPE_PINNED_APP, item.type); @@ -623,41 +622,41 @@ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status); EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status); - EXPECT_TRUE(wm::IsActiveWindow(window1->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window2->GetNativeWindow())); + EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window2->GetBaseWindow()->IsActive()); // Activate second one. Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status); - EXPECT_FALSE(wm::IsActiveWindow(window1->GetNativeWindow())); - EXPECT_TRUE(wm::IsActiveWindow(window2->GetNativeWindow())); + EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); + EXPECT_TRUE(window2->GetBaseWindow()->IsActive()); // Add window for app1. This will activate it. AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1); - wm::ActivateWindow(window1b->GetNativeWindow()); - EXPECT_FALSE(wm::IsActiveWindow(window1->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window2->GetNativeWindow())); - EXPECT_TRUE(wm::IsActiveWindow(window1b->GetNativeWindow())); + window1b->GetBaseWindow()->Activate(); + EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window2->GetBaseWindow()->IsActive()); + EXPECT_TRUE(window1b->GetBaseWindow()->IsActive()); // Activate launcher item for app1, this will activate the first app window. Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); - EXPECT_TRUE(wm::IsActiveWindow(window1->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window1b->GetNativeWindow())); + EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window1b->GetBaseWindow()->IsActive()); Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); - EXPECT_TRUE(wm::IsActiveWindow(window1b->GetNativeWindow())); + EXPECT_TRUE(window1b->GetBaseWindow()->IsActive()); // Activate the second app again Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2)); - EXPECT_FALSE(wm::IsActiveWindow(window1->GetNativeWindow())); - EXPECT_TRUE(wm::IsActiveWindow(window2->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window1b->GetNativeWindow())); + EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); + EXPECT_TRUE(window2->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window1b->GetBaseWindow()->IsActive()); // Activate the first app again Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1)); - EXPECT_TRUE(wm::IsActiveWindow(window1b->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window2->GetNativeWindow())); - EXPECT_FALSE(wm::IsActiveWindow(window1->GetNativeWindow())); + EXPECT_TRUE(window1b->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window2->GetBaseWindow()->IsActive()); + EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); // Close second app. CloseAppWindow(window2); @@ -824,7 +823,7 @@ EXPECT_EQ(ash::TYPE_APP, item1.type); EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); - wm::ActivateWindow(browser()->window()->GetNativeWindow()); + browser()->window()->Activate(); EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status); } @@ -1065,27 +1064,23 @@ // Confirm that clicking a icon for an app running in one of 2 maxmized windows // activates the right window. IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) { - aura::Window* window1 = browser()->window()->GetNativeWindow(); - ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1); - window1_state->Maximize(); + browser()->window()->Maximize(); content::WindowedNotificationObserver open_observer( chrome::NOTIFICATION_BROWSER_WINDOW_READY, content::NotificationService::AllSources()); chrome::NewEmptyWindow(browser()->profile()); open_observer.Wait(); Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); - aura::Window* window2 = browser2->window()->GetNativeWindow(); TabStripModel* tab_strip = browser2->tab_strip_model(); int tab_count = tab_strip->count(); - ash::wm::GetWindowState(window2)->Maximize(); + browser2->window()->Maximize(); ash::ShelfID shortcut_id = CreateShortcut("app1"); Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); EXPECT_EQ(++tab_count, tab_strip->count()); EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); - window1->Show(); - window1_state->Activate(); + browser()->window()->Activate(); EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status); Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id)); @@ -1362,7 +1357,7 @@ EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status); - wm::DeactivateWindow(browser()->window()->GetNativeWindow()); + browser()->window()->Deactivate(); EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(shortcut_id)->status); EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status); } @@ -1406,10 +1401,10 @@ WindowOpenDisposition::NEW_WINDOW); Browser* app_browser = FindBrowserForApp(extension->id()); ASSERT_TRUE(app_browser); - aura::Window* window = app_browser->window()->GetNativeWindow(); - EXPECT_FALSE(ash::wm::GetWindowState(window)->IsMaximized()); - ash::wm::GetWindowState(window)->Maximize(); - EXPECT_TRUE(ash::wm::GetWindowState(window)->IsMaximized()); + BrowserWindow* window = app_browser->window(); + EXPECT_FALSE(window->IsMaximized()); + window->Maximize(); + EXPECT_TRUE(window->IsMaximized()); CloseAppBrowserWindow(app_browser); // Reopen the App. It should start maximized. Un-maximize it and close it. @@ -1418,11 +1413,11 @@ WindowOpenDisposition::NEW_WINDOW); app_browser = FindBrowserForApp(extension->id()); ASSERT_TRUE(app_browser); - window = app_browser->window()->GetNativeWindow(); - EXPECT_TRUE(ash::wm::GetWindowState(window)->IsMaximized()); + window = app_browser->window(); + EXPECT_TRUE(window->IsMaximized()); - ash::wm::GetWindowState(window)->Restore(); - EXPECT_FALSE(ash::wm::GetWindowState(window)->IsMaximized()); + window->Restore(); + EXPECT_FALSE(window->IsMaximized()); app_browser->window()->Close(); CloseAppBrowserWindow(app_browser); @@ -1432,8 +1427,8 @@ WindowOpenDisposition::NEW_WINDOW); app_browser = FindBrowserForApp(extension->id()); ASSERT_TRUE(app_browser); - window = app_browser->window()->GetNativeWindow(); - EXPECT_FALSE(ash::wm::GetWindowState(window)->IsMaximized()); + window = app_browser->window(); + EXPECT_FALSE(window->IsMaximized()); } // Checks that a windowed application does not add an item to the browser list. @@ -1786,48 +1781,45 @@ Shelf::ActivateShelfItem(1); Browser* browser1 = chrome::FindLastActive(); EXPECT_TRUE(browser1); - aura::Window* window1 = browser1->window()->GetNativeWindow(); Browser* browser2 = CreateBrowser(profile()); - aura::Window* window2 = browser2->window()->GetNativeWindow(); EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); - EXPECT_NE(window1, window2); - EXPECT_TRUE(wm::IsActiveWindow(window2)); + EXPECT_NE(browser1->window(), browser2->window()); + EXPECT_TRUE(browser2->window()->IsActive()); // Activate multiple times the switcher to see that the windows get activated. Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window1)); + EXPECT_TRUE(browser1->window()->IsActive()); Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window2)); + EXPECT_TRUE(browser2->window()->IsActive()); // Create a third browser - make sure that we do not toggle simply between // two windows. Browser* browser3 = CreateBrowser(profile()); - aura::Window* window3 = browser3->window()->GetNativeWindow(); EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); - EXPECT_NE(window1, window3); - EXPECT_NE(window2, window3); - EXPECT_TRUE(wm::IsActiveWindow(window3)); + EXPECT_NE(browser1->window(), browser3->window()); + EXPECT_NE(browser2->window(), browser3->window()); + EXPECT_TRUE(browser3->window()->IsActive()); Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window1)); + EXPECT_TRUE(browser1->window()->IsActive()); Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window2)); + EXPECT_TRUE(browser2->window()->IsActive()); Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window3)); + EXPECT_TRUE(browser3->window()->IsActive()); Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window1)); + EXPECT_TRUE(browser1->window()->IsActive()); // Create another app and make sure that none of our browsers is active. LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, WindowOpenDisposition::NEW_WINDOW); - EXPECT_FALSE(wm::IsActiveWindow(window1)); - EXPECT_FALSE(wm::IsActiveWindow(window2)); + EXPECT_FALSE(browser1->window()->IsActive()); + EXPECT_FALSE(browser2->window()->IsActive()); // After activation our browser should be active again. Shelf::ActivateShelfItem(1); - EXPECT_TRUE(wm::IsActiveWindow(window1)); + EXPECT_TRUE(browser1->window()->IsActive()); } // Checks that after a session restore, we do not start applications on an @@ -2296,16 +2288,17 @@ EXPECT_TRUE(controller_->IsOpen(id)); // Minimize Window. - ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); - window_state->Minimize(); - EXPECT_TRUE(window_state->IsMinimized()); + Browser* browser = chrome::FindLastActive(); + ASSERT_TRUE(browser); + browser->window()->Minimize(); + EXPECT_TRUE(browser->window()->IsMinimized()); // Activate again. This doesn't create new browser, it activates the window. SelectItem(item_controller, ui::ET_UNKNOWN); running_browser = chrome::GetTotalBrowserCount(); EXPECT_EQ(1u, running_browser); EXPECT_TRUE(controller_->IsOpen(id)); - EXPECT_FALSE(window_state->IsMinimized()); + EXPECT_FALSE(browser->window()->IsMinimized()); } // Check that the window's ShelfID property matches that of the active tab.
diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc index 45ab62bf..954d11ce 100644 --- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
@@ -19,7 +19,7 @@ #include "extensions/common/extension.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" -#include "ui/wm/core/window_util.h" +#include "ui/base/base_window.h" using extensions::AppWindow; using extensions::AppWindowRegistry; @@ -122,8 +122,9 @@ window->AddObserver(this); // Find or create an item controller and launcher item. - ash::ShelfItemStatus status = - wm::IsActiveWindow(window) ? ash::STATUS_ACTIVE : ash::STATUS_RUNNING; + ash::ShelfItemStatus status = app_window->GetBaseWindow()->IsActive() + ? ash::STATUS_ACTIVE + : ash::STATUS_RUNNING; AppControllerMap::iterator app_controller_iter = app_controller_map_.find(shelf_id);
diff --git a/chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa_interactive_uitest.mm b/chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa_interactive_uitest.mm index 8907e4c8..dd2d037 100644 --- a/chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa_interactive_uitest.mm +++ b/chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa_interactive_uitest.mm
@@ -112,7 +112,9 @@ EXPECT_TRUE([browser()->window()->GetNativeWindow() isKeyWindow]); EXPECT_FALSE(decoration_test_api_->active()); - test_api_->manager()->DisplayPendingRequests(); + + // The PermissionRequestManager displays prompts asynchronously. + base::RunLoop().RunUntilIdle(); // The bubble should steal key focus when shown. EnsureWindowActive(test_api_->GetPromptWindow(), "show permission bubble");
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc index 8f7aaf9..d9f714d 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc +++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc
@@ -7,8 +7,11 @@ #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/intranet_redirect_detector.h" +#include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" #include "components/omnibox/browser/shortcuts_backend.h" +#include "components/search_engines/template_url.h" +#include "components/search_engines/template_url_service.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_details.h" @@ -61,6 +64,7 @@ : text_(text), match_(match), alternate_nav_match_(alternate_nav_match), + template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)), shortcuts_backend_(ShortcutsBackendFactory::GetForProfile(profile)), load_state_(LOAD_NOT_SEEN), fetch_state_(FETCH_NOT_COMPLETE) { @@ -114,6 +118,23 @@ shortcuts_backend_->AddOrUpdateShortcut(text_, match_); } +void ChromeOmniboxNavigationObserver::On404() { + TemplateURL* template_url = match_.GetTemplateURL( + template_url_service_, false /* allow_fallback_to_destination_host */); + // If the omnibox navigation was to a URL (and hence did not involve a + // TemplateURL / search at all) or the invoked search engine has been deleted + // or otherwise modified, doing nothing is the right thing. + if (template_url == nullptr) + return; + // If there's any hint that we should keep this search engine around, don't + // mess with it. + if (template_url_service_->ShowInDefaultList(template_url) || + !template_url->safe_for_autoreplace()) + return; + // This custom search engine is safe to delete. + template_url_service_->Remove(template_url); +} + bool ChromeOmniboxNavigationObserver::HasSeenPendingLoad() const { return load_state_ != LOAD_NOT_SEEN; } @@ -185,6 +206,8 @@ IsValidNavigation(match_.destination_url, load_details.entry->GetVirtualURL())) OnSuccessfulNavigation(); + if (load_details.http_status_code == 404) + On404(); if (!fetcher_ || (fetch_state_ != FETCH_NOT_COMPLETE)) OnAllLoadingFinished(); // deletes |this|! }
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h index f4b6c8a6..c08e812 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h +++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h
@@ -8,6 +8,7 @@ #include <memory> #include <string> +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "components/omnibox/browser/autocomplete_match.h" @@ -20,6 +21,7 @@ class Profile; class ShortcutsBackend; +class TemplateURLService; namespace net { class URLFetcher; @@ -28,7 +30,7 @@ // Monitors omnibox navigations in order to trigger behaviors that depend on // successful navigations. // -// Currently two such behaviors exist: +// Currently three such behaviors exist: // (1) For single-word queries where we can't tell if the entry was a search or // an intranet hostname, the omnibox opens as a search by default, but this // class attempts to open as a URL via an HTTP HEAD request. If successful, @@ -36,6 +38,8 @@ // AlternateNavInfoBarDelegate. // (2) Omnibox navigations that complete successfully are added to the // Shortcuts backend. +// (3) Omnibox searches that result in a 404 for an auto-generated custom +// search engine cause the custom search engine to be deleted. // // Please see the class comment on the base class for important information // about the memory management of this object. @@ -63,7 +67,16 @@ // must be handled separately. void OnSuccessfulNavigation(); + // Called when a navigation that yields a 404 ("Not Found") occurs. If this + // navigation was an omnibox search that invoked an auto-generated custom + // search engine, delete the engine. This will prevent the user from using + // the broken engine again. + void On404(); + private: + FRIEND_TEST_ALL_PREFIXES(ChromeOmniboxNavigationObserverTest, + DeleteBrokenCustomSearchEngines); + enum FetchState { FETCH_NOT_COMPLETE, FETCH_SUCCEEDED, @@ -95,6 +108,7 @@ const base::string16 text_; const AutocompleteMatch match_; const AutocompleteMatch alternate_nav_match_; + TemplateURLService* template_url_service_; scoped_refptr<ShortcutsBackend> shortcuts_backend_; // NULL in incognito. std::unique_ptr<net::URLFetcher> fetcher_; LoadState load_state_;
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc index 5f379ad..4ce7b787 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc +++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc
@@ -4,11 +4,20 @@ #include "chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h" +#include <vector> + #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/infobars/infobar_service.h" +#include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/browser/search_engines/template_url_service_factory_test_util.h" #include "chrome/test/base/testing_profile.h" +#include "components/search_engines/template_url.h" +#include "components/search_engines/template_url_data.h" +#include "components/search_engines/template_url_service.h" +#include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" @@ -29,34 +38,81 @@ } TestingProfile* profile() { return &profile_; } - const ChromeOmniboxNavigationObserver* observer() const { - return observer_.get(); + TemplateURLService* model() { + return TemplateURLServiceFactory::GetForProfile(&profile_); + } + + // Functions that return the name of certain search keywords that are part + // of the TemplateURLService attached to this profile. + static base::string16 auto_generated_search_keyword() { + return base::ASCIIToUTF16("auto_generated_search_keyword"); + } + static base::string16 non_auto_generated_search_keyword() { + return base::ASCIIToUTF16("non_auto_generated_search_keyword"); + } + static base::string16 default_search_keyword() { + return base::ASCIIToUTF16("default_search_keyword"); + } + static base::string16 prepopulated_search_keyword() { + return base::ASCIIToUTF16("prepopulated_search_keyword"); + } + static base::string16 policy_search_keyword() { + return base::ASCIIToUTF16("policy_search_keyword"); } private: // testing::Test: - void SetUp() override { - web_contents_.reset(content::WebContentsTester::CreateTestWebContents( - profile(), content::SiteInstance::Create(profile()))); - - InfoBarService::CreateForWebContents(web_contents_.get()); - - observer_ = base::MakeUnique<ChromeOmniboxNavigationObserver>( - &profile_, base::ASCIIToUTF16("test text"), AutocompleteMatch(), - AutocompleteMatch()); - } + void SetUp() override; content::TestBrowserThreadBundle test_browser_thread_bundle_; TestingProfile profile_; std::unique_ptr<content::WebContents> web_contents_; - std::unique_ptr<ChromeOmniboxNavigationObserver> observer_; DISALLOW_COPY_AND_ASSIGN(ChromeOmniboxNavigationObserverTest); }; +void ChromeOmniboxNavigationObserverTest::SetUp() { + web_contents_.reset(content::WebContentsTester::CreateTestWebContents( + profile(), content::SiteInstance::Create(profile()))); + + InfoBarService::CreateForWebContents(web_contents_.get()); + + // Set up a series of search engines for later testing. + TemplateURLServiceFactoryTestUtil factory_util(profile()); + factory_util.VerifyLoad(); + + TemplateURLData auto_gen_turl; + auto_gen_turl.SetKeyword(auto_generated_search_keyword()); + auto_gen_turl.safe_for_autoreplace = true; + factory_util.model()->Add(base::MakeUnique<TemplateURL>(auto_gen_turl)); + + TemplateURLData non_auto_gen_turl; + non_auto_gen_turl.SetKeyword(non_auto_generated_search_keyword()); + factory_util.model()->Add(base::MakeUnique<TemplateURL>(non_auto_gen_turl)); + + TemplateURLData default_turl; + default_turl.SetKeyword(default_search_keyword()); + factory_util.model()->SetUserSelectedDefaultSearchProvider( + factory_util.model()->Add(base::MakeUnique<TemplateURL>(default_turl))); + + TemplateURLData prepopulated_turl; + prepopulated_turl.SetKeyword(prepopulated_search_keyword()); + prepopulated_turl.prepopulate_id = 1; + factory_util.model()->Add(base::MakeUnique<TemplateURL>(prepopulated_turl)); + + TemplateURLData policy_turl; + policy_turl.SetKeyword(policy_search_keyword()); + policy_turl.created_by_policy = true; + factory_util.model()->Add(base::MakeUnique<TemplateURL>(policy_turl)); +} + TEST_F(ChromeOmniboxNavigationObserverTest, LoadStateAfterPendingNavigation) { + std::unique_ptr<ChromeOmniboxNavigationObserver> observer = + base::MakeUnique<ChromeOmniboxNavigationObserver>( + profile(), base::ASCIIToUTF16("test text"), AutocompleteMatch(), + AutocompleteMatch()); EXPECT_EQ(ChromeOmniboxNavigationObserver::LOAD_NOT_SEEN, - observer()->load_state()); + observer->load_state()); std::unique_ptr<content::NavigationEntry> entry( content::NavigationController::CreateNavigationEntry( @@ -71,5 +127,58 @@ // A pending navigation notification should synchronously update the load // state to pending. EXPECT_EQ(ChromeOmniboxNavigationObserver::LOAD_PENDING, - observer()->load_state()); + observer->load_state()); +} + +TEST_F(ChromeOmniboxNavigationObserverTest, DeleteBrokenCustomSearchEngines) { + struct TestData { + base::string16 keyword; + int status_code; + bool expect_exists; + }; + std::vector<TestData> cases = { + {auto_generated_search_keyword(), 200, true}, + {auto_generated_search_keyword(), 404, false}, + {non_auto_generated_search_keyword(), 404, true}, + {default_search_keyword(), 404, true}, + {prepopulated_search_keyword(), 404, true}, + {policy_search_keyword(), 404, true}}; + + base::string16 query = base::ASCIIToUTF16(" text"); + for (size_t i = 0; i < cases.size(); ++i) { + SCOPED_TRACE("case #" + base::IntToString(i)); + // The keyword should always exist at the beginning. + EXPECT_TRUE(model()->GetTemplateURLForKeyword(cases[i].keyword) != nullptr); + + AutocompleteMatch match; + match.keyword = cases[i].keyword; + // |observer| gets deleted by observer->NavigationEntryCommitted(). + ChromeOmniboxNavigationObserver* observer = + new ChromeOmniboxNavigationObserver(profile(), cases[i].keyword + query, + match, AutocompleteMatch()); + auto navigation_entry(content::NavigationController::CreateNavigationEntry( + GURL(), content::Referrer(), ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, + false, std::string(), profile())); + content::LoadCommittedDetails details; + details.http_status_code = cases[i].status_code; + details.entry = navigation_entry.get(); + observer->NavigationEntryCommitted(details); + EXPECT_EQ(cases[i].expect_exists, + model()->GetTemplateURLForKeyword(cases[i].keyword) != nullptr); + } + + // Also run a URL navigation that results in a 404 through the system to make + // sure nothing crashes for regular URL navigations. + // |observer| gets deleted by observer->NavigationEntryCommitted(). + ChromeOmniboxNavigationObserver* observer = + new ChromeOmniboxNavigationObserver( + profile(), base::ASCIIToUTF16("url navigation"), AutocompleteMatch(), + AutocompleteMatch()); + auto navigation_entry(content::NavigationController::CreateNavigationEntry( + GURL(), content::Referrer(), ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, false, + std::string(), profile())); + content::LoadCommittedDetails details; + details.http_status_code = 404; + details.entry = navigation_entry.get(); + observer->NavigationEntryCommitted(details); }
diff --git a/chrome/browser/ui/translate/translate_bubble_test_utils.h b/chrome/browser/ui/translate/translate_bubble_test_utils.h index ba7a01e..7b06c51 100644 --- a/chrome/browser/ui/translate/translate_bubble_test_utils.h +++ b/chrome/browser/ui/translate/translate_bubble_test_utils.h
@@ -20,6 +20,9 @@ // Presses 'Translate' on the currently open translate bubble. void PressTranslate(Browser* browser); +// Presses 'Revert' on the currently opened translate bubble. +void PressRevert(Browser* browser); + } // namespace test_utils } // namespace translate
diff --git a/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc b/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc index 55f5c25..46f789f1 100644 --- a/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc +++ b/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc
@@ -62,6 +62,9 @@ AddChildView(new views::Label(l10n_util::GetStringUTF16(string_specifier))); views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(this); + if (!anchor_view) + SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); + UseCompactMargins(); widget->Show(); StartAutoCloseTimer(kDelayDefault); }
diff --git a/chrome/browser/ui/views/feature_promos/new_tab_promo_bubble_view.cc b/chrome/browser/ui/views/feature_promos/new_tab_promo_bubble_view.cc index 0bcff792..a47e2784 100644 --- a/chrome/browser/ui/views/feature_promos/new_tab_promo_bubble_view.cc +++ b/chrome/browser/ui/views/feature_promos/new_tab_promo_bubble_view.cc
@@ -16,7 +16,7 @@ NewTabPromoBubbleView::NewTabPromoBubbleView(const gfx::Rect& anchor_rect) : FeaturePromoBubbleView(anchor_rect, - views::BubbleBorder::LEFT_TOP, + views::BubbleBorder::LEFT_CENTER, GetStringSpecifier()) {} NewTabPromoBubbleView::~NewTabPromoBubbleView() = default;
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc index f55aab7..c1967d1 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc
@@ -15,9 +15,9 @@ namespace { // +----------------------------+ -// | | Control | -// | | | -// | +-----------+ <-- Height +// | | Control | | +// | | | | +// | +-----------+ | <-- Height // | | <-- Height * kExitHeightScaleFactor // | Screen | Buffer for mouse moves or pointer events // | | before closing the fullscreen exit @@ -59,46 +59,45 @@ gfx::Rect FullscreenControlHost::GetDialogPosition( gfx::Rect avoid_overlapping_rect) { - gfx::Rect widget_bounds; - GetWidgetBounds(&widget_bounds); - if (widget_bounds.IsEmpty()) + gfx::Rect bounds; + GetWidgetBounds(&bounds); + if (bounds.IsEmpty()) return gfx::Rect(); - // Ask the view how large an area it needs to draw on. - gfx::Size preferred_size = view()->GetPreferredSize(); - - preferred_size.SetToMin(widget_bounds.size()); - - // Place the view in the top right corner of the widget boundaries (top left - // for RTL languages). - gfx::Rect view_location; - gfx::Point origin = widget_bounds.origin(); - if (!base::i18n::IsRTL()) - origin.set_x(widget_bounds.right() - preferred_size.width()); - return gfx::Rect(origin, preferred_size); + // Place the view horizontally centered at the top of the widget. + int original_y = bounds.y(); + bounds.ClampToCenteredSize(view()->GetPreferredSize()); + bounds.set_y(original_y); + return bounds; } void FullscreenControlHost::OnMouseEvent(ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_MOVED) - HandleFullScreenControlVisibility(event); + HandleFullScreenControlVisibility(event, InputEntryMethod::MOUSE); } void FullscreenControlHost::OnTouchEvent(ui::TouchEvent* event) { if (event->type() == ui::ET_TOUCH_MOVED) - HandleFullScreenControlVisibility(event); + HandleFullScreenControlVisibility(event, InputEntryMethod::TOUCH); } void FullscreenControlHost::OnGestureEvent(ui::GestureEvent* event) { - if (event->type() == ui::ET_GESTURE_LONG_PRESS && !IsAnimating() && - browser_view_->IsFullscreen() && !IsVisible()) { - Show(true); - } + if (event->type() == ui::ET_GESTURE_LONG_TAP) + HandleFullScreenControlVisibility(event, InputEntryMethod::TOUCH); +} + +void FullscreenControlHost::OnVisibilityChanged() { + if (!IsVisible()) + input_entry_method_ = InputEntryMethod::NOT_ACTIVE; } void FullscreenControlHost::HandleFullScreenControlVisibility( - const ui::LocatedEvent* event) { - if (IsAnimating()) + const ui::LocatedEvent* event, + InputEntryMethod input_entry_method) { + if (IsAnimating() || (input_entry_method_ != InputEntryMethod::NOT_ACTIVE && + input_entry_method_ != input_entry_method)) { return; + } if (browser_view_->IsFullscreen()) { if (IsVisible()) { @@ -107,10 +106,18 @@ if (event->y() >= y_limit) Hide(true); } else { - if (event->y() <= kShowFullscreenExitControlHeight) - Show(true); + if (event->y() <= kShowFullscreenExitControlHeight || + event->type() == ui::ET_GESTURE_LONG_TAP) { + ShowForInputEntryMethod(input_entry_method); + } } } else if (IsVisible()) { Hide(true); } } + +void FullscreenControlHost::ShowForInputEntryMethod( + InputEntryMethod input_entry_method) { + input_entry_method_ = input_entry_method; + Show(true); +}
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h index 0047377..472913c 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h
@@ -45,7 +45,22 @@ } private: - void HandleFullScreenControlVisibility(const ui::LocatedEvent* event); + // Ensures symmetric input show and hide (e.g. a touch show is hidden by + // touch). + enum class InputEntryMethod { + NOT_ACTIVE, // The view is hidden. + MOUSE, // A mouse event caused the view to show. + TOUCH, // A touch event caused the view to show. + }; + + // DropdownBarHost: + void OnVisibilityChanged() override; + + void HandleFullScreenControlVisibility(const ui::LocatedEvent* event, + InputEntryMethod input_entry_method); + void ShowForInputEntryMethod(InputEntryMethod input_entry_method); + + InputEntryMethod input_entry_method_ = InputEntryMethod::NOT_ACTIVE; BrowserView* const browser_view_;
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc index 144c8188..f8bd1093 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc
@@ -6,37 +6,52 @@ #include <memory> -#include "base/memory/ptr_util.h" -#include "chrome/grit/generated_resources.h" +#include "cc/paint/paint_flags.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" +#include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/size.h" #include "ui/views/background.h" -#include "ui/views/controls/button/label_button.h" +#include "ui/views/controls/button/button.h" #include "ui/views/layout/box_layout.h" namespace { -// Spacing applied to all sides of the border of the control. -constexpr int kSpacingInsetsAllSides = 10; +constexpr int kCircleButtonDiameter = 48; -// Spacing applied between controls of FullscreenControlView. -constexpr int kBetweenChildSpacing = 10; +// Spacing applied to all sides of the border of the control. +constexpr int kSpacingInsetsAllSides = 45; + +class CloseFullscreenButton : public views::Button { + public: + explicit CloseFullscreenButton(views::ButtonListener* listener) + : views::Button(listener) {} + + private: + void PaintButtonContents(gfx::Canvas* canvas) override { + // TODO(robliao): If we decide to move forward with this, use themes. + cc::PaintFlags flags; + flags.setAntiAlias(true); + flags.setColor(SK_ColorDKGRAY); + flags.setStyle(cc::PaintFlags::kFill_Style); + float radius = kCircleButtonDiameter / 2.0f; + canvas->DrawCircle(gfx::PointF(radius, radius), radius, flags); + } + + DISALLOW_COPY_AND_ASSIGN(CloseFullscreenButton); +}; } // namespace FullscreenControlView::FullscreenControlView(BrowserView* browser_view) : browser_view_(browser_view), - exit_fullscreen_button_(new views::LabelButton( - this, - l10n_util::GetStringUTF16( - IDS_FULLSCREEN_EXIT_CONTROL_EXIT_FULLSCREEN))) { + exit_fullscreen_button_(new CloseFullscreenButton(this)) { AddChildView(exit_fullscreen_button_); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, - gfx::Insets(kSpacingInsetsAllSides), - kBetweenChildSpacing)); - // TODO(robliao): If we decide to move forward with this, use themes. - SetBackground(views::CreateSolidBackground(SK_ColorWHITE)); + SetLayoutManager(new views::BoxLayout( + views::BoxLayout::kHorizontal, gfx::Insets(kSpacingInsetsAllSides), 0)); + exit_fullscreen_button_->SetPreferredSize( + gfx::Size(kCircleButtonDiameter, kCircleButtonDiameter)); } FullscreenControlView::~FullscreenControlView() = default;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc index 48fecd21..67f0341 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -60,18 +60,6 @@ //////////////////////////////////////////////////////////////////////////////// // OmniboxPopupContentsView, public: -OmniboxPopupView* OmniboxPopupContentsView::Create( - const gfx::FontList& font_list, - OmniboxView* omnibox_view, - OmniboxEditModel* edit_model, - LocationBarView* location_bar_view) { - OmniboxPopupContentsView* view = nullptr; - view = new OmniboxPopupContentsView( - font_list, omnibox_view, edit_model, location_bar_view); - view->Init(); - return view; -} - OmniboxPopupContentsView::OmniboxPopupContentsView( const gfx::FontList& font_list, OmniboxView* omnibox_view, @@ -114,14 +102,9 @@ g_bottom_shadow.Get() = gfx::ImageSkiaOperations::CreateHorizontalShadow(shadows, true); } -} -void OmniboxPopupContentsView::Init() { - // This can't be done in the constructor as at that point we aren't - // necessarily our final class yet, and we may have subclasses - // overriding CreateResultView. for (size_t i = 0; i < AutocompleteResult::GetMaxMatches(); ++i) { - OmniboxResultView* result_view = CreateResultView(i, font_list_); + OmniboxResultView* result_view = new OmniboxResultView(this, i, font_list_); result_view->SetVisible(false); AddChildViewAt(result_view, static_cast<int>(i)); } @@ -149,21 +132,18 @@ return current_frame_bounds; } -void OmniboxPopupContentsView::LayoutChildren() { - gfx::Rect contents_rect = GetContentsBounds(); - contents_rect.Inset(gfx::Insets(kPopupVerticalPadding, 0)); - contents_rect.Inset(start_margin_, g_top_shadow.Get().height(), end_margin_, - 0); +void OmniboxPopupContentsView::OpenMatch(size_t index, + WindowOpenDisposition disposition) { + DCHECK(HasMatchAt(index)); - int top = contents_rect.y(); - for (size_t i = 0; i < AutocompleteResult::GetMaxMatches(); ++i) { - View* v = child_at(i); - if (v->visible()) { - v->SetBounds(contents_rect.x(), top, contents_rect.width(), - v->GetPreferredSize().height()); - top = v->bounds().bottom(); - } - } + omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, + GURL(), base::string16(), index); +} + +gfx::Image OmniboxPopupContentsView::GetMatchIcon( + const AutocompleteMatch& match, + SkColor vector_icon_color) const { + return model_->GetMatchIcon(match, vector_icon_color); } void OmniboxPopupContentsView::SetSelectedLine(size_t index) { @@ -172,12 +152,8 @@ model_->SetSelectedLine(index, false, false); } -void OmniboxPopupContentsView::OpenMatch(size_t index, - WindowOpenDisposition disposition) { - DCHECK(HasMatchAt(index)); - - omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, - GURL(), base::string16(), index); +bool OmniboxPopupContentsView::IsSelectedIndex(size_t index) const { + return index == model_->selected_line(); } //////////////////////////////////////////////////////////////////////////////// @@ -349,19 +325,6 @@ } //////////////////////////////////////////////////////////////////////////////// -// OmniboxPopupContentsView, OmniboxResultViewModel implementation: - -bool OmniboxPopupContentsView::IsSelectedIndex(size_t index) const { - return index == model_->selected_line(); -} - -gfx::Image OmniboxPopupContentsView::GetMatchIcon( - const AutocompleteMatch& match, - SkColor vector_icon_color) const { - return model_->GetMatchIcon(match, vector_icon_color); -} - -//////////////////////////////////////////////////////////////////////////////// // OmniboxPopupContentsView, AnimationDelegate implementation: void OmniboxPopupContentsView::AnimationProgressed( @@ -427,7 +390,7 @@ } //////////////////////////////////////////////////////////////////////////////// -// OmniboxPopupContentsView, protected: +// OmniboxPopupContentsView, private: int OmniboxPopupContentsView::CalculatePopupHeight() { DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); @@ -442,10 +405,50 @@ g_top_shadow.Get().height() + g_bottom_shadow.Get().height(); } -OmniboxResultView* OmniboxPopupContentsView::CreateResultView( - int model_index, - const gfx::FontList& font_list) { - return new OmniboxResultView(this, model_index, font_list); +void OmniboxPopupContentsView::LayoutChildren() { + gfx::Rect contents_rect = GetContentsBounds(); + contents_rect.Inset(gfx::Insets(kPopupVerticalPadding, 0)); + contents_rect.Inset(start_margin_, g_top_shadow.Get().height(), end_margin_, + 0); + + int top = contents_rect.y(); + for (size_t i = 0; i < AutocompleteResult::GetMaxMatches(); ++i) { + View* v = child_at(i); + if (v->visible()) { + v->SetBounds(contents_rect.x(), top, contents_rect.width(), + v->GetPreferredSize().height()); + top = v->bounds().bottom(); + } + } +} + +bool OmniboxPopupContentsView::HasMatchAt(size_t index) const { + return index < model_->result().size(); +} + +const AutocompleteMatch& OmniboxPopupContentsView::GetMatchAtIndex( + size_t index) const { + return model_->result().match_at(index); +} + +size_t OmniboxPopupContentsView::GetIndexForPoint(const gfx::Point& point) { + if (!HitTestPoint(point)) + return OmniboxPopupModel::kNoMatch; + + int nb_match = model_->result().size(); + DCHECK(nb_match <= child_count()); + for (int i = 0; i < nb_match; ++i) { + views::View* child = child_at(i); + gfx::Point point_in_child_coords(point); + View::ConvertPointToTarget(this, child, &point_in_child_coords); + if (child->visible() && child->HitTestPoint(point_in_child_coords)) + return i; + } + return OmniboxPopupModel::kNoMatch; +} + +OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { + return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); } //////////////////////////////////////////////////////////////////////////////// @@ -491,36 +494,3 @@ } View::PaintChildren(paint_info); } - -//////////////////////////////////////////////////////////////////////////////// -// OmniboxPopupContentsView, private: - -bool OmniboxPopupContentsView::HasMatchAt(size_t index) const { - return index < model_->result().size(); -} - -const AutocompleteMatch& OmniboxPopupContentsView::GetMatchAtIndex( - size_t index) const { - return model_->result().match_at(index); -} - -size_t OmniboxPopupContentsView::GetIndexForPoint( - const gfx::Point& point) { - if (!HitTestPoint(point)) - return OmniboxPopupModel::kNoMatch; - - int nb_match = model_->result().size(); - DCHECK(nb_match <= child_count()); - for (int i = 0; i < nb_match; ++i) { - views::View* child = child_at(i); - gfx::Point point_in_child_coords(point); - View::ConvertPointToTarget(this, child, &point_in_child_coords); - if (child->visible() && child->HitTestPoint(point_in_child_coords)) - return i; - } - return OmniboxPopupModel::kNoMatch; -} - -OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { - return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); -}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h index 4f7b628..ec72bcc 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h
@@ -29,24 +29,30 @@ public OmniboxPopupView, public gfx::AnimationDelegate { public: - // Factory method for creating the AutocompletePopupView. - static OmniboxPopupView* Create(const gfx::FontList& font_list, - OmniboxView* omnibox_view, - OmniboxEditModel* edit_model, - LocationBarView* location_bar_view); + OmniboxPopupContentsView(const gfx::FontList& font_list, + OmniboxView* omnibox_view, + OmniboxEditModel* edit_model, + LocationBarView* location_bar_view); + ~OmniboxPopupContentsView() override; // Returns the bounds the popup should be shown at. This is the display bounds // and includes offsets for the dropshadow which this view's border renders. gfx::Rect GetPopupBounds() const; - virtual void LayoutChildren(); + // Opens a match from the list specified by |index| with the type of tab or + // window specified by |disposition|. + void OpenMatch(size_t index, WindowOpenDisposition disposition); + + // Returns the icon that should be displayed next to |match|. If the icon is + // available as a vector icon, it will be |vector_icon_color|. + gfx::Image GetMatchIcon(const AutocompleteMatch& match, + SkColor vector_icon_color) const; // Sets the line specified by |index| as selected. virtual void SetSelectedLine(size_t index); - // Opens a match from the list specified by |index| with the type of tab or - // window specified by |disposition|. - void OpenMatch(size_t index, WindowOpenDisposition disposition); + // Returns true if the line specified by |index| is selected. + virtual bool IsSelectedIndex(size_t index) const; // OmniboxPopupView: bool IsOpen() const override; @@ -67,34 +73,14 @@ bool OnMouseDragged(const ui::MouseEvent& event) override; void OnGestureEvent(ui::GestureEvent* event) override; - virtual bool IsSelectedIndex(size_t index) const; - gfx::Image GetMatchIcon(const AutocompleteMatch& match, - SkColor vector_icon_color) const; - - protected: - OmniboxPopupContentsView(const gfx::FontList& font_list, - OmniboxView* omnibox_view, - OmniboxEditModel* edit_model, - LocationBarView* location_bar_view); - ~OmniboxPopupContentsView() override; - - LocationBarView* location_bar_view() { return location_bar_view_; } - - // Calculates the height needed to show all the results in the model. - virtual int CalculatePopupHeight(); - virtual OmniboxResultView* CreateResultView(int model_index, - const gfx::FontList& font_list); - private: class AutocompletePopupWidget; - // views::View: - const char* GetClassName() const override; - void OnPaint(gfx::Canvas* canvas) override; - void PaintChildren(const views::PaintInfo& paint_info) override; + // Calculates the height needed to show all the results in the model. + int CalculatePopupHeight(); - // Call immediately after construction. - void Init(); + // Size our children to the available content area. + void LayoutChildren(); // Returns true if the model has a match at the specified index. bool HasMatchAt(size_t index) const; @@ -109,6 +95,13 @@ OmniboxResultView* result_view_at(size_t i); + LocationBarView* location_bar_view() { return location_bar_view_; } + + // views::View: + const char* GetClassName() const override; + void OnPaint(gfx::Canvas* canvas) override; + void PaintChildren(const views::PaintInfo& paint_info) override; + std::unique_ptr<OmniboxPopupModel> model_; // The popup that contains this view. We create this, but it deletes itself
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 7ed200c..3b5f8df2 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -153,8 +153,8 @@ if (location_bar_view_) { // Initialize the popup view using the same font. - popup_view_.reset(OmniboxPopupContentsView::Create( - GetFontList(), this, model(), location_bar_view_)); + popup_view_.reset(new OmniboxPopupContentsView(GetFontList(), this, model(), + location_bar_view_)); } // Override the default FocusableBorder from Textfield, since the
diff --git a/chrome/browser/ui/views/translate/translate_bubble_test_utils_views.cc b/chrome/browser/ui/views/translate/translate_bubble_test_utils_views.cc index 5681592c0..1cae685b 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_test_utils_views.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_test_utils_views.cc
@@ -25,6 +25,13 @@ bubble->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_TRANSLATE); } +void PressRevert(Browser* browser) { + DCHECK(browser); + TranslateBubbleView* bubble = TranslateBubbleView::GetCurrentBubble(); + DCHECK(bubble); + bubble->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_SHOW_ORIGINAL); +} + } // namespace test_utils } // namespace translate
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.h b/chrome/browser/ui/views/translate/translate_bubble_view.h index d4921bc..5548996 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.h +++ b/chrome/browser/ui/views/translate/translate_bubble_view.h
@@ -154,6 +154,7 @@ friend class TranslateBubbleViewTest; friend void ::translate::test_utils::PressTranslate(::Browser*); + friend void ::translate::test_utils::PressRevert(::Browser*); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, TranslateButton); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, TranslateButtonIn2016Q2UI); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CloseButtonIn2016Q2UI); @@ -173,6 +174,7 @@ FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningAfterTranslate); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); + FRIEND_TEST_ALL_PREFIXES(TranslateLanguageBrowserTest, TranslateAndRevert); TranslateBubbleView(views::View* anchor_view, const gfx::Point& anchor_point,
diff --git a/chrome/browser/ui/views/translate/translate_language_browsertest.cc b/chrome/browser/ui/views/translate/translate_language_browsertest.cc index 175eed84..d586dee 100644 --- a/chrome/browser/ui/views/translate/translate_language_browsertest.cc +++ b/chrome/browser/ui/views/translate/translate_language_browsertest.cc
@@ -19,6 +19,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/translate/translate_bubble_model.h" +#include "chrome/browser/ui/translate/translate_bubble_test_utils.h" #include "chrome/browser/ui/views/translate/translate_bubble_view.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/in_process_browser_test.h" @@ -31,6 +33,8 @@ #include "components/translate/core/common/translate_switches.h" #include "content/public/browser/notification_service.h" #include "content/public/test/browser_test_utils.h" +#include "net/url_request/test_url_fetcher_factory.h" +#include "net/url_request/url_fetcher_delegate.h" #include "url/gurl.h" namespace { @@ -40,6 +44,33 @@ const base::FilePath::CharType kFrenchTestPath[] = FILE_PATH_LITERAL("french_page.html"); +static const char kTestValidScript[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"fr\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " onTranslateProgress(100, true, false);" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +using translate::test_utils::GetCurrentModel; + using LanguageInfo = language::UrlLanguageHistogram::LanguageInfo; }; // namespace @@ -90,8 +121,31 @@ return UrlLanguageHistogramFactory::GetForBrowserContext(browser_context); } + void Translate() { + EXPECT_EQ(expected_lang_, GetLanguageState().current_language()); + content::WindowedNotificationObserver page_translated_signal( + chrome::NOTIFICATION_PAGE_TRANSLATED, + content::NotificationService::AllSources()); + EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE, + GetCurrentModel(browser_)->GetViewState()); + translate::test_utils::PressTranslate(browser_); + SimulateURLFetch(); + page_translated_signal.Wait(); + EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE, + GetCurrentModel(browser_)->GetViewState()); + EXPECT_EQ("en", GetLanguageState().current_language()); + } + + void Revert() { + EXPECT_EQ("en", GetLanguageState().current_language()); + // Make page |expected_lang_| again! + translate::test_utils::PressRevert(browser_); + EXPECT_EQ(expected_lang_, GetLanguageState().current_language()); + } + private: Browser* browser_; + net::TestURLFetcherFactory url_fetcher_factory_; std::string expected_lang_; bool OnLanguageDetermined(const content::NotificationSource& source, @@ -102,6 +156,23 @@ return language == expected_lang_; } + translate::LanguageState& GetLanguageState() { + auto* const client = ChromeTranslateClient::FromWebContents( + browser_->tab_strip_model()->GetActiveWebContents()); + return client->GetLanguageState(); + } + + void SimulateURLFetch() { + net::TestURLFetcher* const fetcher = url_fetcher_factory_.GetFetcherByID(0); + ASSERT_TRUE(fetcher); + + fetcher->set_url(fetcher->GetOriginalURL()); + fetcher->set_status(net::URLRequestStatus::FromError(net::OK)); + fetcher->set_response_code(200); + fetcher->SetResponseString(kTestValidScript); + fetcher->delegate()->OnURLFetchComplete(fetcher); + } + DISALLOW_COPY_AND_ASSIGN(TranslateLanguageBrowserTest); }; @@ -142,4 +213,14 @@ EXPECT_FALSE(histograms); } +IN_PROC_BROWSER_TEST_F(TranslateLanguageBrowserTest, TranslateAndRevert) { + // Visit the french page. + ASSERT_NO_FATAL_FAILURE( + CheckForTranslateUI(base::FilePath(kFrenchTestPath), true, "fr")); + // Translate the page. + ASSERT_NO_FATAL_FAILURE(Translate()); + // Revert the page. + ASSERT_NO_FATAL_FAILURE(Revert()); +} + #endif // defined(USE_AURA)
diff --git a/chrome/browser/ui/views/try_chrome_dialog.cc b/chrome/browser/ui/views/try_chrome_dialog.cc index 0230748..dc93d25 100644 --- a/chrome/browser/ui/views/try_chrome_dialog.cc +++ b/chrome/browser/ui/views/try_chrome_dialog.cc
@@ -8,17 +8,25 @@ #include <utility> +#include "base/bind.h" #include "base/logging.h" +#include "base/run_loop.h" #include "base/strings/string16.h" +#include "base/time/time.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" #include "chrome/browser/ui/views/harmony/chrome_typography.h" +#include "chrome/browser/win/taskbar_icon_finder.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" #include "chrome/installer/util/experiment.h" +#include "chrome/installer/util/experiment_storage.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/display/display.h" +#include "ui/display/screen.h" +#include "ui/display/win/screen_win.h" #include "ui/gfx/image/image.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/resources/grit/ui_resources.h" @@ -117,35 +125,125 @@ } // namespace +// TryChromeDialog::ModalShowDelegate ------------------------------------------ + +// A delegate for use by the modal Show() function to update the experiment +// state in the Windows registry and break out of the modal run loop upon +// completion. +class TryChromeDialog::ModalShowDelegate : public TryChromeDialog::Delegate { + public: + // Constructs the updater with a closure to be run after the dialog is closed + // to break out of the modal run loop. + explicit ModalShowDelegate(base::Closure quit_closure) + : quit_closure_(std::move(quit_closure)) {} + ~ModalShowDelegate() override = default; + + protected: + // TryChromeDialog::Delegate: + void SetToastLocation( + installer::ExperimentMetrics::ToastLocation toast_location) override; + void SetExperimentState(installer::ExperimentMetrics::State state) override; + void InteractionComplete() override; + + private: + base::Closure quit_closure_; + installer::ExperimentStorage storage_; + + // The time at which the toast was shown; used for computing the action delay. + base::TimeTicks time_shown_; + + DISALLOW_COPY_AND_ASSIGN(ModalShowDelegate); +}; + +void TryChromeDialog::ModalShowDelegate::SetToastLocation( + installer::ExperimentMetrics::ToastLocation toast_location) { + time_shown_ = base::TimeTicks::Now(); + + auto lock = storage_.AcquireLock(); + installer::Experiment experiment; + if (lock->LoadExperiment(&experiment)) { + experiment.SetDisplayTime(base::Time::Now()); + experiment.SetToastCount(experiment.toast_count() + 1); + experiment.SetToastLocation(toast_location); + // TODO(skare): SetUserSessionUptime + lock->StoreExperiment(experiment); + } +} + +void TryChromeDialog::ModalShowDelegate::SetExperimentState( + installer::ExperimentMetrics::State state) { + auto lock = storage_.AcquireLock(); + installer::Experiment experiment; + if (lock->LoadExperiment(&experiment)) { + experiment.SetActionDelay(base::TimeTicks::Now() - time_shown_); + experiment.SetState(state); + lock->StoreExperiment(experiment); + } +} + +void TryChromeDialog::ModalShowDelegate::InteractionComplete() { + quit_closure_.Run(); +} + +// TryChromeDialog ------------------------------------------------------------- + // static TryChromeDialog::Result TryChromeDialog::Show( size_t group, ActiveModalDialogListener listener) { if (group >= arraysize(kExperiments)) { - // This is a test value. We want to make sure we exercise - // returning this early. See TryChromeDialogBrowserTest test. + // Exit immediately given bogus values; see TryChromeDialogBrowserTest test. return NOT_NOW; } - TryChromeDialog dialog(group); - return dialog.ShowDialog(std::move(listener), DialogType::MODAL, - UsageType::FOR_CHROME); + base::RunLoop run_loop; + ModalShowDelegate delegate(run_loop.QuitWhenIdleClosure()); + TryChromeDialog dialog(group, &delegate); + + dialog.ShowDialogAsync(); + + if (listener) { + listener.Run(base::Bind(&TryChromeDialog::OnProcessNotification, + base::Unretained(&dialog))); + } + run_loop.Run(); + if (listener) + listener.Run(base::Closure()); + + return dialog.result(); } -TryChromeDialog::TryChromeDialog(size_t group) - : usage_type_(UsageType::FOR_CHROME), - group_(group), - popup_(nullptr), - result_(NOT_NOW) {} +TryChromeDialog::TryChromeDialog(size_t group, Delegate* delegate) + : group_(group), delegate_(delegate) { + DCHECK_LT(group, arraysize(kExperiments)); + DCHECK(delegate); +} -TryChromeDialog::~TryChromeDialog() {} +TryChromeDialog::~TryChromeDialog() { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); +} -TryChromeDialog::Result TryChromeDialog::ShowDialog( - ActiveModalDialogListener listener, - DialogType dialog_type, - UsageType usage_type) { - usage_type_ = usage_type; +void TryChromeDialog::ShowDialogAsync() { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); + // Get the bounding rectangle of Chrome's taskbar icon on the primary monitor. + FindTaskbarIcon(base::BindOnce(&TryChromeDialog::OnTaskbarIconRect, + base::Unretained(this))); +} + +void TryChromeDialog::OnTaskbarIconRect(const gfx::Rect& icon_rect) { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); + + // It's possible that a rendezvous from another browser process arrived while + // searching for the taskbar icon (see OnProcessNotification). In this case, + // report the DEFER result and bail out immediately. + if (result_ == OPEN_CHROME_DEFER) { + DCHECK_EQ(state_, installer::ExperimentMetrics::kOtherLaunch); + CompleteInteraction(); + return; + } + + // Create the popup. auto icon = base::MakeUnique<views::ImageView>(); icon->SetImage(gfx::CreateVectorIcon(kInactiveToastLogoIcon, kHeaderColor)); gfx::Size icon_size = icon->GetPreferredSize(); @@ -156,6 +254,7 @@ params.bounds = gfx::Rect(kToastWidth, 120); popup_ = new views::Widget; popup_->Init(params); + popup_->AddObserver(this); views::View* root_view = popup_->GetRootView(); root_view->SetBackground(views::CreateSolidBackground(kBackgroundColor)); @@ -256,105 +355,154 @@ // Padding between buttons and the edge of the view is via the border. gfx::Size preferred = layout->GetPreferredSize(root_view); - gfx::Rect pos = ComputePopupBounds(preferred, base::i18n::IsRTL()); - popup_->SetBounds(pos); + + installer::ExperimentMetrics::ToastLocation location = + installer::ExperimentMetrics::kOverTaskbarPin; + gfx::Rect bounds = ComputePopupBoundsOverTaskbarIcon(preferred, icon_rect); + if (bounds.IsEmpty()) { + location = installer::ExperimentMetrics::kOverNotificationArea; + bounds = ComputePopupBoundsOverNoficationArea(preferred); + } + + popup_->SetBounds(bounds); layout->Layout(root_view); - // Update pre-show stats. - time_shown_ = base::TimeTicks::Now(); - - if (usage_type_ == UsageType::FOR_CHROME) { - auto lock = storage_.AcquireLock(); - installer::Experiment experiment; - if (lock->LoadExperiment(&experiment)) { - experiment.SetDisplayTime(base::Time::Now()); - experiment.SetToastCount(experiment.toast_count() + 1); - // TODO(skare): SetToastLocation via checking pinned state. - // TODO(skare): SetUserSessionUptime - lock->StoreExperiment(experiment); - } - } - popup_->Show(); - - if (dialog_type == DialogType::MODAL) { - if (listener) { - listener.Run(base::Bind(&TryChromeDialog::OnProcessNotification, - base::Unretained(this))); - } - run_loop_.reset(new base::RunLoop); - run_loop_->Run(); - if (listener) - listener.Run(base::Closure()); - } - - return result_; + delegate_->SetToastLocation(location); } -void TryChromeDialog::CloseDialog(Result result, - installer::ExperimentMetrics::State state) { - // Exit early if somehow a second notification arrives. - if (!popup_) - return; +gfx::Rect TryChromeDialog::ComputePopupBoundsOverTaskbarIcon( + const gfx::Size& size, + const gfx::Rect& icon_rect) { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); - // Record the result of the toast. - result_ = result; + // Was no taskbar icon found? + if (icon_rect.IsEmpty()) + return icon_rect; - // Update post-action stats. - if (usage_type_ == UsageType::FOR_CHROME) { - auto lock = storage_.AcquireLock(); - installer::Experiment experiment; - if (lock->LoadExperiment(&experiment)) { - base::TimeDelta action_delay = (base::TimeTicks::Now() - time_shown_); - experiment.SetActionDelay(action_delay); - experiment.SetState(state); - lock->StoreExperiment(experiment); + // Get the taskbar and its bounding rectangle (in DIP). + RECT temp_rect = {}; + HWND taskbar = ::FindWindow(L"Shell_TrayWnd", nullptr); + if (!taskbar || !::GetWindowRect(taskbar, &temp_rect)) + return gfx::Rect(); + gfx::Rect taskbar_rect = + display::win::ScreenWin::ScreenToDIPRect(taskbar, gfx::Rect(temp_rect)); + + // The taskbar is always on the primary display. + display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); + const gfx::Rect& monitor_rect = display.bounds(); + + // Is the taskbar not on the primary display (e.g., is it hidden)? + if (!monitor_rect.Contains(taskbar_rect)) + return gfx::Rect(); + + // Center the window over/under/next to the taskbar icon, offset by a bit. + static constexpr int kOffset = 11; + gfx::Rect result(size); + + // Where is the taskbar? Assume that it's "wider" than it is "tall". + if (taskbar_rect.width() > taskbar_rect.height()) { + // Horizonal. + result.set_x(icon_rect.x() + icon_rect.width() / 2 - size.width() / 2); + if (taskbar_rect.y() < monitor_rect.y() + monitor_rect.height() / 2) { + // Top. + result.set_y(icon_rect.y() + icon_rect.height() + kOffset); + } else { + // Bottom. + result.set_y(icon_rect.y() - size.height() - kOffset); + } + } else { + // Vertical. + result.set_y(icon_rect.y() + icon_rect.height() / 2 - size.height() / 2); + if (taskbar_rect.x() < monitor_rect.x() + monitor_rect.width() / 2) { + // Left. + result.set_x(icon_rect.x() + icon_rect.width() + kOffset); + } else { + // Right. + result.set_x(icon_rect.x() - size.width() - kOffset); } } - // Close the dialog and quit the loop. - popup_->Close(); - popup_ = nullptr; - if (run_loop_) - run_loop_->QuitWhenIdle(); + // Make sure it doesn't spill out of the display's work area. + // TODO: If Chrome's icon is near the edge of the display, this could move + // the dialog off center. In this case, the arrow should stick to |icon_rect| + // rather than stay centered in |result|. + result.AdjustToFit(display.work_area()); + return result; +} + +gfx::Rect TryChromeDialog::ComputePopupBoundsOverNoficationArea( + const gfx::Size& size) { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); + + const bool is_RTL = base::i18n::IsRTL(); + const gfx::Rect work_area = popup_->GetWorkAreaBoundsInScreen(); + return gfx::Rect( + is_RTL ? work_area.x() : work_area.right() - size.width(), + work_area.bottom() - size.height() - kHoverAboveTaskbarHeight, + size.width(), size.height()); +} + +void TryChromeDialog::CompleteInteraction() { + delegate_->SetExperimentState(state_); + delegate_->InteractionComplete(); } void TryChromeDialog::OnProcessNotification() { - CloseDialog(OPEN_CHROME_DEFER, installer::ExperimentMetrics::kOtherLaunch); -} + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); -gfx::Rect TryChromeDialog::ComputePopupBounds(const gfx::Size& size, - bool is_RTL) { - gfx::Point origin; - - gfx::Rect work_area = popup_->GetWorkAreaBoundsInScreen(); - origin.set_x(is_RTL ? work_area.x() : work_area.right() - size.width()); - origin.set_y(work_area.bottom() - size.height() - kHoverAboveTaskbarHeight); - - return gfx::Rect(origin, size); + // Another browser process is trying to rendezvous with this one, which is + // either waiting on FindTaskbarIcon to complete or waiting on the user to + // interact with the dialog. In the former case, no attempt is made to stop + // the search, as it is expected to complete "quickly". When it does complete + // (in OnTaskbarIconRect), processing will complete tout de suite. In the + // latter case, the dialog is closed so that processing will continue in + // OnWidgetDestroyed. OPEN_CHROME_DEFER conveys to this browser process that + // it should ignore its own command line and instead handle that provided by + // the other browser process. + result_ = OPEN_CHROME_DEFER; + state_ = installer::ExperimentMetrics::kOtherLaunch; + if (popup_) + popup_->Close(); } void TryChromeDialog::ButtonPressed(views::Button* sender, const ui::Event& event) { - Result result = NOT_NOW; - installer::ExperimentMetrics::State state = - installer::ExperimentMetrics::kUninitialized; + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); + DCHECK_EQ(result_, NOT_NOW); + // Ignore this press if another press or a rendezvous has already been + // registered. + if (state_ != installer::ExperimentMetrics::kOtherClose) + return; + + // Figure out what the subsequent action and experiment state should be based + // on which button was pressed. switch (sender->tag()) { case static_cast<int>(ButtonTag::CLOSE_BUTTON): - state = installer::ExperimentMetrics::kSelectedClose; + state_ = installer::ExperimentMetrics::kSelectedClose; break; case static_cast<int>(ButtonTag::OK_BUTTON): - result = kExperiments[group_].result; - state = installer::ExperimentMetrics::kSelectedOpenChromeAndNoCrash; + result_ = kExperiments[group_].result; + state_ = installer::ExperimentMetrics::kSelectedOpenChromeAndNoCrash; break; case static_cast<int>(ButtonTag::NO_THANKS_BUTTON): - state = installer::ExperimentMetrics::kSelectedNoThanks; + state_ = installer::ExperimentMetrics::kSelectedNoThanks; break; default: NOTREACHED(); break; } - CloseDialog(result, state); + popup_->Close(); +} + +void TryChromeDialog::OnWidgetDestroyed(views::Widget* widget) { + DCHECK_CALLED_ON_VALID_SEQUENCE(my_sequence_checker_); + DCHECK_EQ(widget, popup_); + + popup_->RemoveObserver(this); + popup_ = nullptr; + + CompleteInteraction(); }
diff --git a/chrome/browser/ui/views/try_chrome_dialog.h b/chrome/browser/ui/views/try_chrome_dialog.h index 0f65b05c..bc75b72e 100644 --- a/chrome/browser/ui/views/try_chrome_dialog.h +++ b/chrome/browser/ui/views/try_chrome_dialog.h
@@ -8,16 +8,13 @@ #include <stddef.h> #include "base/callback.h" -#include "base/compiler_specific.h" #include "base/macros.h" -#include "base/run_loop.h" -#include "base/time/time.h" -#include "chrome/browser/ui/startup/startup_browser_creator.h" +#include "base/sequence_checker.h" #include "chrome/installer/util/experiment_metrics.h" -#include "chrome/installer/util/experiment_storage.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/views/controls/button/button.h" +#include "ui/views/widget/widget_observer.h" namespace views { class Widget; @@ -37,12 +34,13 @@ // +-----------------------------------------------+ // // Some variants do not have body text, or only have one button. -class TryChromeDialog : public views::ButtonListener { +class TryChromeDialog : public views::ButtonListener, + public views::WidgetObserver { public: // Receives a closure to run upon process singleton notification when the // modal dialog is open, or a null closure when the active dialog is // dismissed. - typedef base::Callback<void(base::Closure)> ActiveModalDialogListener; + using ActiveModalDialogListener = base::Callback<void(base::Closure)>; enum Result { NOT_NOW, // Don't launch chrome. Exit now. @@ -56,84 +54,102 @@ // Shows a modal dialog asking the user to give Chrome another try. See // above for the possible outcomes of the function. // |group| selects what strings to present and what controls are shown. - // |listener| will be provided with a closure when the dialog becomes active - // and when it is dismissed. + // |listener| will be provided with a closure when the modal event loop is + // started and when it completes. // Note that the dialog has no parent and it will position itself in a lower // corner of the screen or near the Chrome taskbar button. // The dialog does not steal focus and does not have an entry in the taskbar. static Result Show(size_t group, ActiveModalDialogListener listener); private: - // Indicates whether the dialog is modal - enum class DialogType { - MODAL, // Modal dialog. - MODELESS_FOR_TEST, // Modeless dialog. + class Delegate { + public: + // Called to tell the delegate that the dialog was shown at + // |toast_location|. + virtual void SetToastLocation( + installer::ExperimentMetrics::ToastLocation toast_location) {} + + // Called to tell the delegate that the experiment has entered |state|. + virtual void SetExperimentState(installer::ExperimentMetrics::State state) { + } + + // Called to tell the delegate that the interaction with the toast has + // completed. + virtual void InteractionComplete() {} + + protected: + virtual ~Delegate() {} }; - // Indicates the usage type. Chrome or tests. - enum class UsageType { - FOR_CHROME, - FOR_TESTING, - }; + class ModalShowDelegate; friend class TryChromeDialogTest; // Creates a Try Chrome toast dialog. |group| signifies an experiment group - // which dictactes messaging text and presence of ui elements. - explicit TryChromeDialog(size_t group); + // which dictactes messaging text and presence of ui elements. |delegate|, + // which must outlive the instance, is notified of relevant details throughout + // the interaction. + TryChromeDialog(size_t group, Delegate* delegate); ~TryChromeDialog() override; - // Helper function to show the dialog. - // The |dialog_type| parameter indicates whether the dialog is modal. - // Note that modeless invocation returns before the user has made a - // selection, and is used in testing. This case will always return NOT_NOW. - // The |usage_type| parameter indicates whether this is being invoked by - // Chrome or a test. - Result ShowDialog(ActiveModalDialogListener listener, - DialogType dialog_type, - UsageType usage_type); + // Starts the process of presenting the dialog by initiating an asychronous + // search for Chrome's taskbar icon. + void ShowDialogAsync(); - // Concludes the modal interaction by recording |result| and |state|, then - // closing the dialog. - void CloseDialog(Result result, installer::ExperimentMetrics::State state); + // Receives the bounds of Chrome's taskbar icon in |icon_rect|. The + // interaction is completed immediately in case of rendezvous to allow + // browser startup to continue. Otherwise, the dialog is shown to the user. + // The delegate's SetToastLocation method is called with the location. + void OnTaskbarIconRect(const gfx::Rect& icon_rect); + + // Returns the bounding rectangle of a popup of size |size| centered "over" + // |icon_rect|, taking into account the orientation of the taskbar. Returns an + // empty rect if |icon_rect| is empty or in case of error. + gfx::Rect ComputePopupBoundsOverTaskbarIcon(const gfx::Size& size, + const gfx::Rect& icon_rect); + + // Returns the bounding rectangle of a popup of size |size| to be positioned + // over the notification area of the screen, taking into account LTR vs RTL + // text orientation. + gfx::Rect ComputePopupBoundsOverNoficationArea(const gfx::Size& size); + + // Notifies the delegate of the final experiment state and that the + // interaction has completed. + void CompleteInteraction(); // Invoked upon notification from another process by way of the process - // singleton. Closes the dialog, allowing Chrome startup to resume. + // singleton. Triggers completion of the interaction by closing the dialog. void OnProcessNotification(); - // Returns a screen rectangle that is fit to show the window. In particular - // it has the following properties: a) is visible and b) is attached to the - // bottom of the working area. For LTR machines it returns a left side - // rectangle and for RTL it returns a right side rectangle so that the dialog - // does not compete with the standard place of the start menu. - gfx::Rect ComputePopupBounds(const gfx::Size& size, bool is_RTL); - // views::ButtonListener: - // We have two buttons and according to what the user clicked we set |result_| - // and we should always close and end the modal loop. + // Updates the result_ and state_ based on which button was pressed and + // closes the dialog. void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // Controls whether we're running in testing config. - // Experiment metrics setting is disabled in tests. - UsageType usage_type_; + // views::WidgetObserver: + // Completes the interaction. + void OnWidgetDestroyed(views::Widget* widget) override; + Result result() const { return result_; } // Controls which experiment group to use for varying the layout and controls. const size_t group_; + Delegate* const delegate_; - // Time when the toast was displayed. - base::TimeTicks time_shown_; + // A closure to run when the interaction has completed. + base::Closure on_complete_; + + // The pessimistic result that will prevent launching Chrome. + Result result_ = NOT_NOW; + + // The pessimistic state indicating that the dialog was closed via some means + // other than its intended UX. + installer::ExperimentMetrics::State state_ = + installer::ExperimentMetrics::kOtherClose; // Unowned; |popup_| owns itself. - views::Widget* popup_; + views::Widget* popup_ = nullptr; - // RunLoop to run the dialog before the main message loop. - std::unique_ptr<base::RunLoop> run_loop_; - - // Experiment feedback interface. - installer::ExperimentStorage storage_; - - // Result of displaying the dialog: accepted, dismissed, etc. - Result result_; + SEQUENCE_CHECKER(my_sequence_checker_); DISALLOW_COPY_AND_ASSIGN(TryChromeDialog); };
diff --git a/chrome/browser/first_run/try_chrome_dialog_browsertest.cc b/chrome/browser/ui/views/try_chrome_dialog_browsertest.cc similarity index 67% rename from chrome/browser/first_run/try_chrome_dialog_browsertest.cc rename to chrome/browser/ui/views/try_chrome_dialog_browsertest.cc index 8434f4486..ba3e787 100644 --- a/chrome/browser/first_run/try_chrome_dialog_browsertest.cc +++ b/chrome/browser/ui/views/try_chrome_dialog_browsertest.cc
@@ -59,22 +59,24 @@ // only makes the problem worse. IN_PROC_BROWSER_TEST_F(TryChromeDialogBrowserTest, ToastCrasher) {} -// Helper class to display the TryChromeDialog for testing. -class TryChromeDialogTest : public DialogBrowserTest { - public: - // TODO(ananta) - // Provide a way to test flavors other than 0. - TryChromeDialogTest() : dialog_(0) {} - - // A noop listener for process singleton notifications. - static void SetProcessNotificationHandler(base::Closure handler) {} +// Test harness to display the TryChromeDialog for testing. Template parameter 0 +// is the group number to be evaluated. +class TryChromeDialogTest : public DialogBrowserTest, + public ::testing::WithParamInterface<int>, + public TryChromeDialog::Delegate { + protected: + TryChromeDialogTest() : dialog_(GetParam(), this) {} // DialogBrowserTest: void ShowDialog(const std::string& name) override { - dialog_.ShowDialog( - base::Bind(&TryChromeDialogTest::SetProcessNotificationHandler), - TryChromeDialog::DialogType::MODELESS_FOR_TEST, - TryChromeDialog::UsageType::FOR_TESTING); + base::RunLoop run_loop; + + // Fire off the task(s) to show the dialog, breaking out of the message loop + // once the dialog has been shown. + quit_closure_ = run_loop.QuitClosure(); + dialog_.ShowDialogAsync(); + run_loop.Run(); + quit_closure_ = base::Closure(); } // content::BrowserTestBase: @@ -82,14 +84,41 @@ command_line->AppendSwitch(switches::kExtendMdToSecondaryUi); } + TryChromeDialog::Result result() const { return dialog_.result(); } + installer::ExperimentMetrics::State state() const { return state_; } + private: + // TryChromeDialog::Delegate: + void SetToastLocation( + installer::ExperimentMetrics::ToastLocation toast_location) override { + quit_closure_.Run(); + } + void SetExperimentState(installer::ExperimentMetrics::State state) override { + state_ = state; + } + void InteractionComplete() override {} + TryChromeDialog dialog_; + installer::ExperimentMetrics::State state_ = + installer::ExperimentMetrics::kUninitialized; + base::Closure quit_closure_; DISALLOW_COPY_AND_ASSIGN(TryChromeDialogTest); }; -IN_PROC_BROWSER_TEST_F(TryChromeDialogTest, InvokeDialog_default) { +IN_PROC_BROWSER_TEST_P(TryChromeDialogTest, InvokeDialog_default) { RunDialog(); + EXPECT_EQ(result(), TryChromeDialog::NOT_NOW); + EXPECT_EQ(state(), installer::ExperimentMetrics::kOtherClose); } +// TODO(skare): Remove " - 1" hack when +// https://chromium-review.googlesource.com/c/chromium/src/+/645840 lands. +INSTANTIATE_TEST_CASE_P( + Variations, + TryChromeDialogTest, + ::testing::Range( + 0, + static_cast<int>(installer::ExperimentMetrics::kHoldbackGroup) - 1)); + #endif // defined(OS_WIN)
diff --git a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc index ab283306..de5e8cea 100644 --- a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc +++ b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc
@@ -62,7 +62,7 @@ html_source->AddResourcePath("device/bluetooth/public/interfaces/uuid.mojom", IDR_BLUETOOTH_UUID_MOJO_JS); html_source->SetDefaultResource(IDR_BLUETOOTH_INTERNALS_HTML); - html_source->UseGzip(std::unordered_set<std::string>()); + html_source->UseGzip(); Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource::Add(profile, html_source);
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 c7a3308..9e89d67 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -36,6 +36,7 @@ #include "chrome/browser/ui/webui/identity_internals_ui.h" #include "chrome/browser/ui/webui/instant_ui.h" #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" +#include "chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h" #include "chrome/browser/ui/webui/invalidations_ui.h" #include "chrome/browser/ui/webui/local_state/local_state_ui.h" #include "chrome/browser/ui/webui/log_web_ui_url.h" @@ -337,6 +338,8 @@ return &NewWebUI<InstantUI>; if (url.host_piece() == chrome::kChromeUIInterstitialHost) return &NewWebUI<InterstitialUI>; + if (url.host_piece() == chrome::kChromeUIInterventionsInternalsHost) + return &NewWebUI<InterventionsInternalsUI>; if (url.host_piece() == chrome::kChromeUIInvalidationsHost) return &NewWebUI<InvalidationsUI>; if (url.host_piece() == chrome::kChromeUILocalStateHost)
diff --git a/chrome/browser/ui/webui/domain_reliability_internals_ui.cc b/chrome/browser/ui/webui/domain_reliability_internals_ui.cc index 4415eb97..ba3525b 100644 --- a/chrome/browser/ui/webui/domain_reliability_internals_ui.cc +++ b/chrome/browser/ui/webui/domain_reliability_internals_ui.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" #include <string> -#include <unordered_set> #include "chrome/browser/domain_reliability/service_factory.h" #include "chrome/browser/profiles/profile.h" @@ -28,7 +27,7 @@ html_source->AddResourcePath("domain_reliability_internals.js", IDR_DOMAIN_RELIABILITY_INTERNALS_JS); html_source->SetDefaultResource(IDR_DOMAIN_RELIABILITY_INTERNALS_HTML); - html_source->UseGzip(std::unordered_set<std::string>()); + html_source->UseGzip(); web_ui->RegisterMessageCallback("updateData", base::Bind(&DomainReliabilityInternalsUI::UpdateData,
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc index e45841f1..aa84e9e 100644 --- a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc +++ b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
@@ -86,7 +86,7 @@ IDR_SITE_ENGAGEMENT_MOJO_JS); source->AddResourcePath("url/mojo/url.mojom.js", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); }
diff --git a/chrome/browser/ui/webui/gcm_internals_ui.cc b/chrome/browser/ui/webui/gcm_internals_ui.cc index 310e5c8..5c537dd1 100644 --- a/chrome/browser/ui/webui/gcm_internals_ui.cc +++ b/chrome/browser/ui/webui/gcm_internals_ui.cc
@@ -169,7 +169,7 @@ html_source->AddResourcePath(gcm_driver::kGcmInternalsJS, IDR_GCM_DRIVER_GCM_INTERNALS_JS); html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML); - html_source->UseGzip(std::unordered_set<std::string>()); + html_source->UseGzip(); Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource::Add(profile, html_source);
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index f3d2a61..cc4e9fb9 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -21,6 +21,7 @@ #include "chrome/common/features.h" #include "chrome/common/url_constants.h" #include "components/grit/components_resources.h" +#include "components/safe_browsing_db/database_manager.h" #include "components/security_interstitials/core/ssl_error_ui.h" #include "components/supervised_user_error_page/supervised_user_error_page.h" #include "content/public/browser/interstitial_page_delegate.h" @@ -285,7 +286,9 @@ security_interstitials::UnsafeResource:: GetWebContentsGetter(web_contents->GetRenderProcessHost()->GetID(), web_contents->GetMainFrame()->GetRoutingID()); - resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; + resource.threat_source = g_browser_process->safe_browsing_service() + ->database_manager() + ->GetThreatSource(); // Normally safebrowsing interstitial types which block the main page load // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and @@ -331,7 +334,9 @@ security_interstitials::UnsafeResource::GetWebContentsGetter( web_contents->GetRenderProcessHost()->GetID(), web_contents->GetMainFrame()->GetRoutingID()); - resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; + resource.threat_source = g_browser_process->safe_browsing_service() + ->database_manager() + ->GetThreatSource(); // Normally safebrowsing interstitial types which block the main page load // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and @@ -450,12 +455,12 @@ interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents)); } else if (path_without_query == "/clock") { interstitial_delegate.reset(CreateBadClockBlockingPage(web_contents)); - } #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) - else if (path_without_query == "/captiveportal") { + } else if (path_without_query == "/captiveportal") { interstitial_delegate.reset(CreateCaptivePortalBlockingPage(web_contents)); - } #endif + } + if (path_without_query == "/supervised_user") { html = GetSupervisedUserInterstitialHTML(path); } else if (path_without_query == "/quietsafebrowsing") {
diff --git a/chrome/browser/ui/webui/interventions_internals/OWNERS b/chrome/browser/ui/webui/interventions_internals/OWNERS new file mode 100644 index 0000000..3b0e522 --- /dev/null +++ b/chrome/browser/ui/webui/interventions_internals/OWNERS
@@ -0,0 +1,4 @@ +ryansturm@chromium.org +tbansal@chromium.org + +# COMPONENT: UI>Browser>Previews
diff --git a/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc b/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc new file mode 100644 index 0000000..3132d63 --- /dev/null +++ b/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc
@@ -0,0 +1,36 @@ +// 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/ui/webui/interventions_internals/interventions_internals_ui.h" + +#include <string> + +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/url_constants.h" +#include "chrome/grit/browser_resources.h" +#include "content/public/browser/web_ui_data_source.h" + +namespace { + +content::WebUIDataSource* CreateInterventionsInternalsHTMLSource() { + content::WebUIDataSource* source = content::WebUIDataSource::Create( + chrome::kChromeUIInterventionsInternalsHost); + + source->SetDefaultResource(IDR_INTERVENTIONS_INTERNALS_INDEX_HTML); + source->UseGzip(std::vector<std::string>()); + return source; +} + +} // namespace + +InterventionsInternalsUI::InterventionsInternalsUI(content::WebUI* web_ui) + : WebUIController(web_ui) { + // Set up the chrome://interventions-internals/ source. + Profile* profile = Profile::FromWebUI(web_ui); + content::WebUIDataSource::Add(profile, + CreateInterventionsInternalsHTMLSource()); + + // TODO(thanhdle): Add a previews message handler. + // crbug.com/764409 +}
diff --git a/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h b/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h new file mode 100644 index 0000000..250250d --- /dev/null +++ b/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h
@@ -0,0 +1,19 @@ +// 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_UI_WEBUI_INTERVENTIONS_INTERNALS_INTERVENTIONS_INTERNALS_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_INTERVENTIONS_INTERNALS_INTERVENTIONS_INTERNALS_UI_H_ + +#include "base/macros.h" +#include "content/public/browser/web_ui_controller.h" + +class InterventionsInternalsUI : public content::WebUIController { + public: + explicit InterventionsInternalsUI(content::WebUI* web_ui); + + private: + DISALLOW_COPY_AND_ASSIGN(InterventionsInternalsUI); +}; + +#endif // CHROME_BROWSER_UI_WEBUI_INTERVENTIONS_INTERNALS_INTERVENTIONS_INTERNALS_UI_H_
diff --git a/chrome/browser/ui/webui/invalidations_ui.cc b/chrome/browser/ui/webui/invalidations_ui.cc index ce3a01f..253d8eb 100644 --- a/chrome/browser/ui/webui/invalidations_ui.cc +++ b/chrome/browser/ui/webui/invalidations_ui.cc
@@ -20,7 +20,7 @@ content::WebUIDataSource::Create(chrome::kChromeUIInvalidationsHost); source->AddResourcePath("about_invalidations.js", IDR_ABOUT_INVALIDATIONS_JS); source->SetDefaultResource(IDR_ABOUT_INVALIDATIONS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc b/chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc index 29e51550..96d37977 100644 --- a/chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc +++ b/chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc
@@ -6,7 +6,6 @@ #include <algorithm> #include <string> -#include <unordered_set> #include <utility> #include "base/strings/string16.h" @@ -52,13 +51,14 @@ AddLocalizedString(source, "editDialogNameInput", IDS_BOOKMARK_MANAGER_NAME_INPUT_PLACE_HOLDER); AddLocalizedString(source, "editDialogUrlInput", - IDS_BOOKMARK_MANAGER_URL_INPUT_PLACE_HOLDER); - AddLocalizedString(source, "emptyList", - IDS_MD_BOOKMARK_MANAGER_EMPTY_LIST); + IDS_BOOKMARK_MANAGER_URL_INPUT_PLACE_HOLDER); + AddLocalizedString(source, "emptyList", IDS_MD_BOOKMARK_MANAGER_EMPTY_LIST); AddLocalizedString(source, "folderLabel", IDS_MD_BOOKMARK_MANAGER_FOLDER_LABEL); AddLocalizedString(source, "itemsSelected", IDS_MD_BOOKMARK_MANAGER_ITEMS_SELECTED); + AddLocalizedString(source, "listAxLabel", + IDS_MD_BOOKMARK_MANAGER_LIST_AX_LABEL); AddLocalizedString(source, "menuAddBookmark", IDS_MD_BOOKMARK_MANAGER_MENU_ADD_BOOKMARK); AddLocalizedString(source, "menuAddFolder", @@ -87,6 +87,8 @@ AddLocalizedString(source, "menuSort", IDS_MD_BOOKMARK_MANAGER_MENU_SORT); AddLocalizedString(source, "moreActionsButtonTitle", IDS_MD_BOOKMARK_MANAGER_MORE_ACTIONS); + AddLocalizedString(source, "moreActionsButtonAxLabel", + IDS_MD_BOOKMARK_MANAGER_MORE_ACTIONS_AX_LABEL); AddLocalizedString(source, "noSearchResults", IDS_MD_BOOKMARK_MANAGER_NO_SEARCH_RESULTS); AddLocalizedString(source, "openDialogBody", @@ -101,6 +103,12 @@ IDS_MD_BOOKMARK_MANAGER_FOLDER_RENAME_TITLE); AddLocalizedString(source, "searchPrompt", IDS_BOOKMARK_MANAGER_SEARCH_BUTTON); + AddLocalizedString(source, "sidebarAxLabel", + IDS_MD_BOOKMARK_MANAGER_SIDEBAR_AX_LABEL); + AddLocalizedString(source, "sidebarNodeCollapseAxLabel", + IDS_MD_BOOKMARK_MANAGER_SIDEBAR_NODE_COLLAPSE_AX_LABEL); + AddLocalizedString(source, "sidebarNodeExpandAxLabel", + IDS_MD_BOOKMARK_MANAGER_SIDEBAR_NODE_EXPAND_AX_LABEL); AddLocalizedString(source, "searchResults", IDS_MD_BOOKMARK_MANAGER_SEARCH_RESULTS); AddLocalizedString(source, "saveEdit", IDS_SAVE); @@ -123,10 +131,7 @@ #if BUILDFLAG(USE_VULCANIZE) source->AddResourcePath("crisper.js", IDR_MD_BOOKMARKS_CRISPER_JS); source->SetDefaultResource(IDR_MD_BOOKMARKS_VULCANIZED_HTML); - std::unordered_set<std::string> exclusions; - exclusions.insert("images/folder_open.svg"); - exclusions.insert("images/folder.svg"); - source->UseGzip(exclusions); + source->UseGzip({"images/folder_open.svg", "images/folder.svg"}); #else source->AddResourcePath("actions.html", IDR_MD_BOOKMARKS_ACTIONS_HTML); source->AddResourcePath("actions.js", IDR_MD_BOOKMARKS_ACTIONS_JS); @@ -155,8 +160,7 @@ source->AddResourcePath("edit_dialog.js", IDR_MD_BOOKMARKS_EDIT_DIALOG_JS); source->AddResourcePath("folder_node.html", IDR_MD_BOOKMARKS_FOLDER_NODE_HTML); - source->AddResourcePath("folder_node.js", - IDR_MD_BOOKMARKS_FOLDER_NODE_JS); + source->AddResourcePath("folder_node.js", IDR_MD_BOOKMARKS_FOLDER_NODE_JS); source->AddResourcePath("item.html", IDR_MD_BOOKMARKS_ITEM_HTML); source->AddResourcePath("item.js", IDR_MD_BOOKMARKS_ITEM_JS); source->AddResourcePath("list.html", IDR_MD_BOOKMARKS_LIST_HTML);
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc index 7346aea9..147cfc4 100644 --- a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc +++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
@@ -104,12 +104,8 @@ IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG); #if BUILDFLAG(USE_VULCANIZE) - std::unordered_set<std::string> exclude_from_gzip; - exclude_from_gzip.insert("1x/incognito_marker.png"); - exclude_from_gzip.insert("2x/incognito_marker.png"); - exclude_from_gzip.insert("1x/no_downloads.png"); - exclude_from_gzip.insert("2x/no_downloads.png"); - source->UseGzip(exclude_from_gzip); + source->UseGzip({"1x/incognito_marker.png", "1x/no_downloads.png", + "2x/incognito_marker.png", "2x/no_downloads.png"}); source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS); source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
diff --git a/chrome/browser/ui/webui/md_history_ui.cc b/chrome/browser/ui/webui/md_history_ui.cc index 1f55adc..ea821d3 100644 --- a/chrome/browser/ui/webui/md_history_ui.cc +++ b/chrome/browser/ui/webui/md_history_ui.cc
@@ -167,11 +167,10 @@ #endif }; - std::unordered_set<std::string> exclude_from_gzip; - for (size_t i = 0; i < arraysize(uncompressed_resources); ++i) { - const UncompressedResource& resource = uncompressed_resources[i]; + std::vector<std::string> exclude_from_gzip; + for (const auto& resource : uncompressed_resources) { source->AddResourcePath(resource.path, resource.idr); - exclude_from_gzip.insert(resource.path); + exclude_from_gzip.push_back(resource.path); } source->UseGzip(exclude_from_gzip);
diff --git a/chrome/browser/ui/webui/media/media_engagement_ui.cc b/chrome/browser/ui/webui/media/media_engagement_ui.cc index dfc83dc..01be62c 100644 --- a/chrome/browser/ui/webui/media/media_engagement_ui.cc +++ b/chrome/browser/ui/webui/media/media_engagement_ui.cc
@@ -63,7 +63,7 @@ IDR_MEDIA_ENGAGEMENT_MOJO_JS); source->AddResourcePath("url/mojo/url.mojom.js", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_MEDIA_ENGAGEMENT_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); }
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 291f153..442ee5b 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -156,7 +156,7 @@ source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); source->SetJsonPath("strings.js"); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/offline/offline_internals_ui.cc b/chrome/browser/ui/webui/offline/offline_internals_ui.cc index 073519e..14d26b79 100644 --- a/chrome/browser/ui/webui/offline/offline_internals_ui.cc +++ b/chrome/browser/ui/webui/offline/offline_internals_ui.cc
@@ -29,7 +29,7 @@ html_source->AddResourcePath("offline_internals_browser_proxy.js", IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS); html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML); - html_source->UseGzip(std::unordered_set<std::string>()); + html_source->UseGzip(); Profile* profile = Profile::FromWebUI(web_ui); html_source->AddBoolean("isIncognito", profile->IsOffTheRecord());
diff --git a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc index 976f10af..a231a73 100644 --- a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc +++ b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
@@ -39,7 +39,7 @@ IDR_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_CSS); source->SetDefaultResource( IDR_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/predictors/predictors_ui.cc b/chrome/browser/ui/webui/predictors/predictors_ui.cc index e8cd38a13..fe00e1d2 100644 --- a/chrome/browser/ui/webui/predictors/predictors_ui.cc +++ b/chrome/browser/ui/webui/predictors/predictors_ui.cc
@@ -20,7 +20,7 @@ content::WebUIDataSource::Create(chrome::kChromeUIPredictorsHost); source->AddResourcePath("predictors.js", IDR_PREDICTORS_JS); source->SetDefaultResource(IDR_PREDICTORS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc new file mode 100644 index 0000000..a5ec831 --- /dev/null +++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
@@ -0,0 +1,313 @@ +// 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/ui/webui/print_preview/pdf_printer_handler.h" + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/i18n/file_util_icu.h" +#include "base/memory/ref_counted.h" +#include "base/strings/string16.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/post_task.h" +#include "base/values.h" +#include "build/build_config.h" +#include "chrome/browser/app_mode/app_mode_utils.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/download/download_prefs.h" +#include "chrome/browser/platform_util.h" +#include "chrome/browser/printing/print_preview_dialog_controller.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/chrome_select_file_policy.h" +#include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" +#include "chrome/browser/ui/webui/print_preview/sticky_settings.h" +#include "chrome/common/chrome_switches.h" +#include "components/cloud_devices/common/printer_description.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/web_contents.h" +#include "printing/printing_context.h" +#include "printing/units.h" +#include "ui/gfx/geometry/size.h" + +namespace { + +class PrintingContextDelegate : public printing::PrintingContext::Delegate { + public: + // PrintingContext::Delegate methods. + gfx::NativeView GetParentView() override { return NULL; } + std::string GetAppLocale() override { + return g_browser_process->GetApplicationLocale(); + } +}; + +gfx::Size GetDefaultPdfMediaSizeMicrons() { + PrintingContextDelegate delegate; + std::unique_ptr<printing::PrintingContext> printing_context( + printing::PrintingContext::Create(&delegate)); + if (printing::PrintingContext::OK != printing_context->UsePdfSettings() || + printing_context->settings().device_units_per_inch() <= 0) { + return gfx::Size(); + } + gfx::Size pdf_media_size = printing_context->GetPdfPaperSizeDeviceUnits(); + float deviceMicronsPerDeviceUnit = + (printing::kHundrethsMMPerInch * 10.0f) / + printing_context->settings().device_units_per_inch(); + return gfx::Size(pdf_media_size.width() * deviceMicronsPerDeviceUnit, + pdf_media_size.height() * deviceMicronsPerDeviceUnit); +} + +std::unique_ptr<base::DictionaryValue> GetPdfCapabilities( + const std::string& locale) { + cloud_devices::CloudDeviceDescription description; + using namespace cloud_devices::printer; + + OrientationCapability orientation; + orientation.AddOption(cloud_devices::printer::PORTRAIT); + orientation.AddOption(cloud_devices::printer::LANDSCAPE); + orientation.AddDefaultOption(AUTO_ORIENTATION, true); + orientation.SaveTo(&description); + + ColorCapability color; + { + Color standard_color(STANDARD_COLOR); + standard_color.vendor_id = base::IntToString(printing::COLOR); + color.AddDefaultOption(standard_color, true); + } + color.SaveTo(&description); + + static const cloud_devices::printer::MediaType kPdfMedia[] = { + ISO_A0, ISO_A1, ISO_A2, ISO_A3, ISO_A4, + ISO_A5, NA_LEGAL, NA_LETTER, NA_LEDGER}; + const gfx::Size default_media_size = GetDefaultPdfMediaSizeMicrons(); + Media default_media("", "", default_media_size.width(), + default_media_size.height()); + if (!default_media.MatchBySize() || + std::find(kPdfMedia, kPdfMedia + arraysize(kPdfMedia), + default_media.type) == kPdfMedia + arraysize(kPdfMedia)) { + default_media = Media(locale == "en-US" ? NA_LETTER : ISO_A4); + } + MediaCapability media; + for (size_t i = 0; i < arraysize(kPdfMedia); ++i) { + Media media_option(kPdfMedia[i]); + media.AddDefaultOption(media_option, + default_media.type == media_option.type); + } + media.SaveTo(&description); + + return std::unique_ptr<base::DictionaryValue>(description.root().DeepCopy()); +} + +// Callback that stores a PDF file on disk. +void PrintToPdfCallback(const scoped_refptr<base::RefCountedBytes>& data, + const base::FilePath& path, + const base::Closure& pdf_file_saved_closure) { + base::File file(path, + base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); + file.WriteAtCurrentPos(reinterpret_cast<const char*>(data->front()), + base::checked_cast<int>(data->size())); + if (!pdf_file_saved_closure.is_null()) + pdf_file_saved_closure.Run(); +} + +// Returns a unique path for |path|, just like with downloads. +base::FilePath GetUniquePath(const base::FilePath& path) { + base::FilePath unique_path = path; + int uniquifier = + base::GetUniquePathNumber(path, base::FilePath::StringType()); + if (uniquifier > 0) { + unique_path = unique_path.InsertBeforeExtensionASCII( + base::StringPrintf(" (%d)", uniquifier)); + } + return unique_path; +} + +void CreateDirectoryIfNeeded(const base::FilePath& path) { + if (!base::DirectoryExists(path)) + base::CreateDirectory(path); +} + +} // namespace + +PdfPrinterHandler::PdfPrinterHandler(Profile* profile, + content::WebContents* preview_web_contents, + printing::StickySettings* sticky_settings) + : preview_web_contents_(preview_web_contents), + profile_(profile), + sticky_settings_(sticky_settings), + print_data_(nullptr), + weak_ptr_factory_(this) {} + +PdfPrinterHandler::~PdfPrinterHandler() { + if (select_file_dialog_.get()) + select_file_dialog_->ListenerDestroyed(); +} + +void PdfPrinterHandler::Reset() { + weak_ptr_factory_.InvalidateWeakPtrs(); +} + +void PdfPrinterHandler::StartGetPrinters(const GetPrintersCallback& callback) { + NOTREACHED(); +} + +void PdfPrinterHandler::StartGetCapability( + const std::string& destination_id, + const GetCapabilityCallback& callback) { + auto printer_info = base::MakeUnique<base::DictionaryValue>(); + printer_info->SetString(printing::kPrinterId, destination_id); + printer_info->Set( + printing::kPrinterCapabilities, + GetPdfCapabilities(g_browser_process->GetApplicationLocale())); + callback.Run(std::move(printer_info)); +} + +void PdfPrinterHandler::StartGrantPrinterAccess( + const std::string& printer_id, + const GetPrinterInfoCallback& callback) { + NOTREACHED(); +} + +void PdfPrinterHandler::StartPrint( + const std::string& destination_id, + const std::string& capability, + const base::string16& job_title, + const std::string& ticket_json, + const gfx::Size& page_size, + const scoped_refptr<base::RefCountedBytes>& print_data, + const PrintCallback& callback) { + print_data_ = print_data; + if (!print_to_pdf_path_.empty()) { + // User has already selected a path, no need to show the dialog again. + PostPrintToPdfTask(); + } else if (!select_file_dialog_.get() || + !select_file_dialog_->IsRunning(platform_util::GetTopLevel( + preview_web_contents_->GetNativeView()))) { + DCHECK(!print_callback_); + print_callback_ = callback; +#if defined(OS_WIN) + base::FilePath::StringType print_job_title(job_title); +#elif defined(OS_POSIX) + base::FilePath::StringType print_job_title = base::UTF16ToUTF8(job_title); +#endif + + base::i18n::ReplaceIllegalCharactersInPath(&print_job_title, '_'); + base::FilePath default_filename(print_job_title); + default_filename = + default_filename.ReplaceExtension(FILE_PATH_LITERAL("pdf")); + + base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); + bool prompt_user = !cmdline->HasSwitch(switches::kKioskModePrinting); + SelectFile(default_filename, prompt_user); + } +} + +void PdfPrinterHandler::FileSelected(const base::FilePath& path, + int /* index */, + void* /* params */) { + // Update downloads location and save sticky settings. + DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(profile_); + download_prefs->SetSaveFilePath(path.DirName()); + sticky_settings_->SaveInPrefs(profile_->GetPrefs()); + print_to_pdf_path_ = path; + PostPrintToPdfTask(); +} + +void PdfPrinterHandler::FileSelectionCanceled(void* params) { + print_callback_.Run(false, base::Value()); + print_callback_.Reset(); +} + +void PdfPrinterHandler::SetPdfSavedClosureForTesting( + const base::Closure& closure) { + pdf_file_saved_closure_ = closure; +} + +void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, + bool prompt_user) { + printing::PrintPreviewDialogController* dialog_controller = + printing::PrintPreviewDialogController::GetInstance(); + content::WebContents* initiator = + dialog_controller ? dialog_controller->GetInitiator(preview_web_contents_) + : nullptr; + if (prompt_user) { + ChromeSelectFilePolicy policy(initiator); + if (!policy.CanOpenSelectFileDialog()) { + policy.SelectFileDenied(); + print_callback_.Run(false, base::Value()); + print_callback_.Reset(); + return; + } + } + + // Get save location from Download Preferences. + DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(profile_); + base::FilePath path = download_prefs->SaveFilePath(); + sticky_settings_->SaveInPrefs(profile_->GetPrefs()); + + // Handle the no prompting case. Like the dialog prompt, this function + // returns and eventually FileSelected() gets called. + if (!prompt_user) { + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, + base::Bind(&GetUniquePath, path.Append(default_filename)), + base::Bind(&PdfPrinterHandler::OnGotUniqueFileName, + weak_ptr_factory_.GetWeakPtr())); + return; + } + + // If the directory is empty there is no reason to create it. + if (path.empty()) { + OnDirectoryCreated(default_filename); + return; + } + + // Create the directory to save in if it does not exist. + base::PostTaskWithTraitsAndReply( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, + base::Bind(&CreateDirectoryIfNeeded, path), + base::Bind(&PdfPrinterHandler::OnDirectoryCreated, + weak_ptr_factory_.GetWeakPtr(), + path.Append(default_filename))); +} + +void PdfPrinterHandler::PostPrintToPdfTask() { + base::PostTaskWithTraits( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, + base::BindOnce(&PrintToPdfCallback, print_data_, print_to_pdf_path_, + pdf_file_saved_closure_)); + print_to_pdf_path_.clear(); + print_callback_.Run(true, base::Value()); + print_callback_.Reset(); +} + +void PdfPrinterHandler::OnGotUniqueFileName(const base::FilePath& path) { + FileSelected(path, 0, nullptr); +} + +void PdfPrinterHandler::OnDirectoryCreated(const base::FilePath& path) { + // Prompts the user to select the file. + ui::SelectFileDialog::FileTypeInfo file_type_info; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("pdf")); + file_type_info.include_all_files = true; + // Print Preview requires native paths to write PDF files. + // Note that Chrome OS save-as dialog has Google Drive as a saving location + // even when a client requires native paths. In this case, Chrome OS save-as + // dialog returns native paths to write files and uploads the saved files to + // Google Drive later. + file_type_info.allowed_paths = + ui::SelectFileDialog::FileTypeInfo::NATIVE_PATH; + + select_file_dialog_ = + ui::SelectFileDialog::Create(this, nullptr /*policy already checked*/); + select_file_dialog_->SelectFile( + ui::SelectFileDialog::SELECT_SAVEAS_FILE, base::string16(), path, + &file_type_info, 0, base::FilePath::StringType(), + platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), NULL); +}
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h new file mode 100644 index 0000000..d811f5b --- /dev/null +++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
@@ -0,0 +1,108 @@ +// 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_UI_WEBUI_PRINT_PREVIEW_PDF_PRINTER_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PDF_PRINTER_HANDLER_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" +#include "base/strings/string16.h" +#include "chrome/browser/ui/webui/print_preview/printer_handler.h" +#include "ui/shell_dialogs/select_file_dialog.h" + +namespace base { +class RefCountedBytes; +} + +namespace content { +class WebContents; +} + +namespace gfx { +class Size; +} + +namespace printing { +class StickySettings; +} + +class Profile; + +class PdfPrinterHandler : public PrinterHandler, + public ui::SelectFileDialog::Listener { + public: + PdfPrinterHandler(Profile* profile, + content::WebContents* preview_web_contents, + printing::StickySettings* sticky_settings); + + ~PdfPrinterHandler() override; + + // PrinterHandler implementation + void Reset() override; + // Required by PrinterHandler implementation but should never be called. + void StartGetPrinters(const GetPrintersCallback& callback) override; + void StartGetCapability(const std::string& destination_id, + const GetCapabilityCallback& callback) override; + // Required by PrinterHandler implementation but should never be called. + void StartGrantPrinterAccess(const std::string& printer_id, + const GetPrinterInfoCallback& callback) override; + void StartPrint(const std::string& destination_id, + const std::string& capability, + const base::string16& job_title, + const std::string& ticket_json, + const gfx::Size& page_size, + const scoped_refptr<base::RefCountedBytes>& print_data, + const PrintCallback& callback) override; + + // SelectFileDialog::Listener implementation. + void FileSelected(const base::FilePath& path, + int index, + void* params) override; + void FileSelectionCanceled(void* params) override; + + // Sets |pdf_file_saved_closure_| to |closure|. + void SetPdfSavedClosureForTesting(const base::Closure& closure); + + protected: + virtual void SelectFile(const base::FilePath& default_filename, + bool prompt_user); + + // The print preview web contents. Protected so unit tests can access it. + content::WebContents* preview_web_contents_; + + // The underlying dialog object. Protected so unit tests can access it. + scoped_refptr<ui::SelectFileDialog> select_file_dialog_; + + private: + void PostPrintToPdfTask(); + void OnGotUniqueFileName(const base::FilePath& path); + void OnDirectoryCreated(const base::FilePath& path); + + Profile* profile_; + printing::StickySettings* sticky_settings_; + + // Holds the path to the print to pdf request. It is empty if no such request + // exists. + base::FilePath print_to_pdf_path_; + + // Notifies tests that want to know if the PDF has been saved. This doesn't + // notify the test if it was a successful save, only that it was attempted. + base::Closure pdf_file_saved_closure_; + + // The data to print + scoped_refptr<base::RefCountedBytes> print_data_; + + // The callback to call when complete. + PrintCallback print_callback_; + + base::WeakPtrFactory<PdfPrinterHandler> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(PdfPrinterHandler); +}; + +#endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PDF_PRINTER_HANDLER_H_
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc new file mode 100644 index 0000000..7c79ff68 --- /dev/null +++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc
@@ -0,0 +1,155 @@ +// 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/ui/webui/print_preview/pdf_printer_handler.h" + +#include <commdlg.h> +#include <windows.h> + +#include "base/memory/ref_counted.h" +#include "base/memory/ref_counted_memory.h" +#include "base/run_loop.h" +#include "chrome/browser/platform_util.h" +#include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/test/base/browser_with_test_window_test.h" +#include "ui/shell_dialogs/select_file_dialog_win.h" +#include "ui/shell_dialogs/select_file_policy.h" + +using content::WebContents; + +namespace { + +class FakePdfPrinterHandler; +bool GetOpenFileNameImpl(OPENFILENAME* ofn); +bool GetSaveFileNameImpl(FakePdfPrinterHandler* handler, OPENFILENAME* ofn); + +void EmptyPrintCallback(bool success, const base::Value& error) {} + +class FakePdfPrinterHandler : public PdfPrinterHandler { + public: + FakePdfPrinterHandler(Profile* profile, + content::WebContents* contents, + printing::StickySettings* sticky_settings) + : PdfPrinterHandler(profile, contents, sticky_settings), + init_called_(false), + save_failed_(false) {} + + void FileSelected(const base::FilePath& path, + int index, + void* params) override { + // Since we always cancel the dialog as soon as it is initialized, this + // should never be called. + NOTREACHED(); + } + + void FileSelectionCanceled(void* params) override { + save_failed_ = true; + run_loop_.Quit(); + } + + void StartPrintToPdf(const base::string16& job_title) { + StartPrint("", "", job_title, "", gfx::Size(), nullptr, + base::Bind(&EmptyPrintCallback)); + run_loop_.Run(); + } + + bool save_failed() const { return save_failed_; } + + bool init_called() const { return init_called_; } + + void set_init_called() { init_called_ = true; } + + private: + // Simplified version of select file to avoid checking preferences and sticky + // settings in the test + void SelectFile(const base::FilePath& default_filename, + bool prompt_user) override { + ui::SelectFileDialog::FileTypeInfo file_type_info; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("pdf")); + select_file_dialog_ = ui::CreateWinSelectFileDialog( + this, nullptr /*policy already checked*/, + base::Bind(GetOpenFileNameImpl), base::Bind(GetSaveFileNameImpl, this)); + select_file_dialog_->SelectFile( + ui::SelectFileDialog::SELECT_SAVEAS_FILE, base::string16(), + default_filename, &file_type_info, 0, base::FilePath::StringType(), + platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), + nullptr); + } + + bool init_called_; + bool save_failed_; + base::RunLoop run_loop_; +}; + +// Hook function to cancel the dialog when it is successfully initialized. +UINT_PTR CALLBACK PdfPrinterHandlerTestHookFunction(HWND hdlg, + UINT message, + WPARAM wparam, + LPARAM lparam) { + if (message != WM_INITDIALOG) + return 0; + OPENFILENAME* ofn = reinterpret_cast<OPENFILENAME*>(lparam); + FakePdfPrinterHandler* handler = + reinterpret_cast<FakePdfPrinterHandler*>(ofn->lCustData); + handler->set_init_called(); + PostMessage(GetParent(hdlg), WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); + return 1; +} + +bool GetOpenFileNameImpl(OPENFILENAME* ofn) { + return ::GetOpenFileName(ofn); +} + +bool GetSaveFileNameImpl(FakePdfPrinterHandler* handler, OPENFILENAME* ofn) { + // Modify ofn so that the hook function will be called. + ofn->Flags |= OFN_ENABLEHOOK; + ofn->lpfnHook = PdfPrinterHandlerTestHookFunction; + ofn->lCustData = reinterpret_cast<LPARAM>(handler); + return ::GetSaveFileName(ofn); +} + +} // namespace + +class PdfPrinterHandlerTest : public BrowserWithTestWindowTest { + public: + PdfPrinterHandlerTest() {} + ~PdfPrinterHandlerTest() override {} + + void SetUp() override { + BrowserWithTestWindowTest::SetUp(); + + // Create a new tab + chrome::NewTab(browser()); + AddTab(browser(), GURL("chrome://print")); + + // Create the PDF printer + pdf_printer_ = base::MakeUnique<FakePdfPrinterHandler>( + profile(), browser()->tab_strip_model()->GetWebContentsAt(0), nullptr); + } + + protected: + std::unique_ptr<FakePdfPrinterHandler> pdf_printer_; + + private: + DISALLOW_COPY_AND_ASSIGN(PdfPrinterHandlerTest); +}; + +TEST_F(PdfPrinterHandlerTest, TestSaveAsPdf) { + pdf_printer_->StartPrintToPdf(L"111111111111111111111.html"); + EXPECT_TRUE(pdf_printer_->init_called()); + EXPECT_TRUE(pdf_printer_->save_failed()); +} + +TEST_F(PdfPrinterHandlerTest, TestSaveAsPdfLongFileName) { + pdf_printer_->StartPrintToPdf( + L"11111111111111111111111111111111111111111111111111111111111111111111111" + L"11111111111111111111111111111111111111111111111111111111111111111111111" + L"11111111111111111111111111111111111111111111111111111111111111111111111" + L"11111111111111111111111111111111111111111111111111111111111111111111111" + L"1111111111111111111111111111111111111111111111111.html"); + EXPECT_TRUE(pdf_printer_->init_called()); + EXPECT_TRUE(pdf_printer_->save_failed()); +}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 7dcbfc2..aa69e865 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -16,8 +16,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" -#include "base/files/file_util.h" -#include "base/i18n/file_util_icu.h" #include "base/i18n/number_formatting.h" #include "base/json/json_reader.h" #include "base/lazy_instance.h" @@ -25,18 +23,12 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted_memory.h" #include "base/metrics/histogram_macros.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread.h" #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/bad_message.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/download/download_prefs.h" -#include "chrome/browser/platform_util.h" #include "chrome/browser/printing/print_dialog_cloud.h" #include "chrome/browser/printing/print_error_dialog.h" #include "chrome/browser/printing/print_job_manager.h" @@ -49,8 +41,8 @@ #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" +#include "chrome/browser/ui/webui/print_preview/pdf_printer_handler.h" #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" #include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h" #include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" @@ -85,8 +77,6 @@ #include "printing/backend/print_backend_consts.h" #include "printing/features/features.h" #include "printing/print_settings.h" -#include "printing/printing_context.h" -#include "printing/units.h" #include "third_party/icu/source/i18n/unicode/ulocdata.h" #if defined(OS_CHROMEOS) @@ -305,95 +295,6 @@ } } -// Callback that stores a PDF file on disk. -void PrintToPdfCallback(const scoped_refptr<base::RefCountedBytes>& data, - const base::FilePath& path, - const base::Closure& pdf_file_saved_closure) { - base::File file(path, - base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); - file.WriteAtCurrentPos(reinterpret_cast<const char*>(data->front()), - base::checked_cast<int>(data->size())); - if (!pdf_file_saved_closure.is_null()) - pdf_file_saved_closure.Run(); -} - -class PrintingContextDelegate : public printing::PrintingContext::Delegate { - public: - // PrintingContext::Delegate methods. - gfx::NativeView GetParentView() override { return NULL; } - std::string GetAppLocale() override { - return g_browser_process->GetApplicationLocale(); - } -}; - -gfx::Size GetDefaultPdfMediaSizeMicrons() { - PrintingContextDelegate delegate; - std::unique_ptr<printing::PrintingContext> printing_context( - printing::PrintingContext::Create(&delegate)); - if (printing::PrintingContext::OK != printing_context->UsePdfSettings() || - printing_context->settings().device_units_per_inch() <= 0) { - return gfx::Size(); - } - gfx::Size pdf_media_size = printing_context->GetPdfPaperSizeDeviceUnits(); - float deviceMicronsPerDeviceUnit = - (printing::kHundrethsMMPerInch * 10.0f) / - printing_context->settings().device_units_per_inch(); - return gfx::Size(pdf_media_size.width() * deviceMicronsPerDeviceUnit, - pdf_media_size.height() * deviceMicronsPerDeviceUnit); -} - -std::unique_ptr<base::DictionaryValue> GetPdfCapabilities( - const std::string& locale) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - cloud_devices::CloudDeviceDescription description; - using namespace cloud_devices::printer; - - OrientationCapability orientation; - orientation.AddOption(cloud_devices::printer::PORTRAIT); - orientation.AddOption(cloud_devices::printer::LANDSCAPE); - orientation.AddDefaultOption(AUTO_ORIENTATION, true); - orientation.SaveTo(&description); - - ColorCapability color; - { - Color standard_color(STANDARD_COLOR); - standard_color.vendor_id = base::IntToString(printing::COLOR); - color.AddDefaultOption(standard_color, true); - } - color.SaveTo(&description); - - static const cloud_devices::printer::MediaType kPdfMedia[] = { - ISO_A0, - ISO_A1, - ISO_A2, - ISO_A3, - ISO_A4, - ISO_A5, - NA_LEGAL, - NA_LETTER, - NA_LEDGER - }; - const gfx::Size default_media_size = GetDefaultPdfMediaSizeMicrons(); - Media default_media( - "", "", default_media_size.width(), default_media_size.height()); - if (!default_media.MatchBySize() || - std::find(kPdfMedia, - kPdfMedia + arraysize(kPdfMedia), - default_media.type) == kPdfMedia + arraysize(kPdfMedia)) { - default_media = Media(locale == "en-US" ? NA_LETTER : ISO_A4); - } - MediaCapability media; - for (size_t i = 0; i < arraysize(kPdfMedia); ++i) { - Media media_option(kPdfMedia[i]); - media.AddDefaultOption(media_option, - default_media.type == media_option.type); - } - media.SaveTo(&description); - - return std::unique_ptr<base::DictionaryValue>(description.root().DeepCopy()); -} - void PrintersToValues(const printing::PrinterList& printer_list, base::ListValue* printers) { for (const printing::PrinterBasicInfo& printer : printer_list) { @@ -433,23 +334,6 @@ return g_sticky_settings.Pointer(); } -// Returns a unique path for |path|, just like with downloads. -base::FilePath GetUniquePath(const base::FilePath& path) { - base::FilePath unique_path = path; - int uniquifier = - base::GetUniquePathNumber(path, base::FilePath::StringType()); - if (uniquifier > 0) { - unique_path = unique_path.InsertBeforeExtensionASCII( - base::StringPrintf(" (%d)", uniquifier)); - } - return unique_path; -} - -void CreateDirectoryIfNeeded(const base::FilePath& path) { - if (!base::DirectoryExists(path)) - base::CreateDirectory(path); -} - } // namespace class PrintPreviewHandler::AccessTokenService @@ -546,9 +430,6 @@ } PrintPreviewHandler::~PrintPreviewHandler() { - if (select_file_dialog_.get()) - select_file_dialog_->ListenerDestroyed(); - UnregisterForGaiaCookieChanges(); } @@ -864,15 +745,6 @@ int page_count = 0; settings->GetInteger(printing::kSettingPreviewPageCount, &page_count); - if (print_to_pdf) { - UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", page_count); - ReportUserActionHistogram(PRINT_TO_PDF); - DCHECK(pdf_callback_id_.empty()); - pdf_callback_id_ = callback_id; - PrintToPdf(); - return; - } - #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) if (print_with_privet) { UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintWithPrivet", page_count); @@ -884,6 +756,10 @@ page_count); ReportUserActionHistogram(PRINT_WITH_EXTENSION); } + if (print_to_pdf) { + UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", page_count); + ReportUserActionHistogram(PRINT_TO_PDF); + } scoped_refptr<base::RefCountedBytes> data; base::string16 title; @@ -895,18 +771,19 @@ return; } - if (print_with_privet || print_with_extension) { + if (print_with_privet || print_with_extension || print_to_pdf) { std::string destination_id; std::string print_ticket; std::string capabilities; int width = 0; int height = 0; - if (!settings->GetString(printing::kSettingDeviceName, &destination_id) || - !settings->GetString(printing::kSettingTicket, &print_ticket) || - !settings->GetString(printing::kSettingCapabilities, &capabilities) || - !settings->GetInteger(printing::kSettingPageWidth, &width) || - !settings->GetInteger(printing::kSettingPageHeight, &height) || - width <= 0 || height <= 0) { + if (!print_to_pdf && + (!settings->GetString(printing::kSettingDeviceName, &destination_id) || + !settings->GetString(printing::kSettingTicket, &print_ticket) || + !settings->GetString(printing::kSettingCapabilities, &capabilities) || + !settings->GetInteger(printing::kSettingPageWidth, &width) || + !settings->GetInteger(printing::kSettingPageHeight, &height) || + width <= 0 || height <= 0)) { NOTREACHED(); RejectJavascriptCallback( base::Value(callback_id), @@ -914,9 +791,12 @@ return; } - PrinterHandler* handler = - GetPrinterHandler(print_with_privet ? PrinterType::kPrivetPrinter - : PrinterType::kExtensionPrinter); + PrinterType type = PrinterType::kPdfPrinter; + if (print_with_extension) + type = PrinterType::kPrivetPrinter; + else if (print_with_privet) + type = PrinterType::kExtensionPrinter; + PrinterHandler* handler = GetPrinterHandler(type); handler->StartPrint(destination_id, capabilities, title, print_ticket, gfx::Size(width, height), data, base::Bind(&PrintPreviewHandler::OnPrintResult, @@ -970,37 +850,6 @@ #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) } -void PrintPreviewHandler::PrintToPdf() { - if (!print_to_pdf_path_.empty()) { - // User has already selected a path, no need to show the dialog again. - ResolveJavascriptCallback(base::Value(pdf_callback_id_), base::Value()); - pdf_callback_id_.clear(); - PostPrintToPdfTask(); - } else if (!select_file_dialog_.get() || - !select_file_dialog_->IsRunning(platform_util::GetTopLevel( - preview_web_contents()->GetNativeView()))) { - // Pre-populating select file dialog with print job title. - const base::string16& print_job_title_utf16 = - print_preview_ui()->initiator_title(); - -#if defined(OS_WIN) - base::FilePath::StringType print_job_title(print_job_title_utf16); -#elif defined(OS_POSIX) - base::FilePath::StringType print_job_title = - base::UTF16ToUTF8(print_job_title_utf16); -#endif - - base::i18n::ReplaceIllegalCharactersInPath(&print_job_title, '_'); - base::FilePath default_filename(print_job_title); - default_filename = - default_filename.ReplaceExtension(FILE_PATH_LITERAL("pdf")); - - base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); - bool prompt_user = !cmdline->HasSwitch(switches::kKioskModePrinting); - SelectFile(default_filename, prompt_user); - } -} - void PrintPreviewHandler::HandleHidePreview(const base::ListValue* /*args*/) { print_preview_ui()->OnHidePreviewDialog(); if (settings_) { @@ -1052,22 +901,16 @@ return; } - if (printer_name == kLocalPdfPrinterId) { - auto printer_info = base::MakeUnique<base::DictionaryValue>(); - printer_info->SetString(printing::kPrinterId, printer_name); - printer_info->Set( - printing::kPrinterCapabilities, - GetPdfCapabilities(g_browser_process->GetApplicationLocale())); - SendPrinterCapabilities(callback_id, std::move(printer_info)); - return; - } - printing::PrinterSetupCallback cb = base::Bind(&PrintPreviewHandler::SendPrinterCapabilities, weak_factory_.GetWeakPtr(), callback_id); - printer_backend_proxy()->ConfigurePrinterAndFetchCapabilities(printer_name, - cb); + if (printer_name == kLocalPdfPrinterId) { + GetPdfPrinterHandler()->StartGetCapability(printer_name, cb); + } else { + printer_backend_proxy()->ConfigurePrinterAndFetchCapabilities(printer_name, + cb); + } } // |args| is expected to contain a string with representing the callback id @@ -1378,78 +1221,6 @@ FireWebUIListener("reload-printer-list"); } -void PrintPreviewHandler::SelectFile(const base::FilePath& default_filename, - bool prompt_user) { - if (prompt_user) { - ChromeSelectFilePolicy policy(GetInitiator()); - if (!policy.CanOpenSelectFileDialog()) { - policy.SelectFileDenied(); - RejectJavascriptCallback(base::Value(pdf_callback_id_), base::Value()); - pdf_callback_id_.clear(); - return; - } - } - - // Get save location from Download Preferences. - DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( - preview_web_contents()->GetBrowserContext()); - base::FilePath path = download_prefs->SaveFilePath(); - printing::StickySettings* sticky_settings = GetStickySettings(); - sticky_settings->SaveInPrefs(Profile::FromBrowserContext( - preview_web_contents()->GetBrowserContext())->GetPrefs()); - - // Handle the no prompting case. Like the dialog prompt, this function - // returns and eventually FileSelected() gets called. - if (!prompt_user) { - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, - base::Bind(&GetUniquePath, path.Append(default_filename)), - base::Bind(&PrintPreviewHandler::OnGotUniqueFileName, - weak_factory_.GetWeakPtr())); - return; - } - - // If the directory is empty there is no reason to create it. - if (path.empty()) { - OnDirectoryCreated(default_filename); - return; - } - - // Create the directory to save in if it does not exist. - base::PostTaskWithTraitsAndReply( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, - base::Bind(&CreateDirectoryIfNeeded, path), - base::Bind(&PrintPreviewHandler::OnDirectoryCreated, - weak_factory_.GetWeakPtr(), path.Append(default_filename))); -} - -void PrintPreviewHandler::OnDirectoryCreated(const base::FilePath& path) { - // Prompts the user to select the file. - ui::SelectFileDialog::FileTypeInfo file_type_info; - file_type_info.extensions.resize(1); - file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("pdf")); - file_type_info.include_all_files = true; - // Print Preview requires native paths to write PDF files. - // Note that Chrome OS save-as dialog has Google Drive as a saving location - // even when a client requires native paths. In this case, Chrome OS save-as - // dialog returns native paths to write files and uploads the saved files to - // Google Drive later. - file_type_info.allowed_paths = - ui::SelectFileDialog::FileTypeInfo::NATIVE_PATH; - - select_file_dialog_ = - ui::SelectFileDialog::Create(this, nullptr /*policy already checked*/); - select_file_dialog_->SelectFile( - ui::SelectFileDialog::SELECT_SAVEAS_FILE, base::string16(), path, - &file_type_info, 0, base::FilePath::StringType(), - platform_util::GetTopLevel(preview_web_contents()->GetNativeView()), - NULL); -} - -void PrintPreviewHandler::OnGotUniqueFileName(const base::FilePath& path) { - FileSelected(path, 0, nullptr); -} - void PrintPreviewHandler::OnPrintPreviewReady(int preview_uid, int request_id) { if (request_id < 0 || preview_callbacks_.empty() || !IsJavascriptAllowed()) { // invalid ID or extra message @@ -1557,43 +1328,6 @@ } #endif -void PrintPreviewHandler::FileSelected(const base::FilePath& path, - int /* index */, - void* /* params */) { - // Update downloads location and save sticky settings. - DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( - preview_web_contents()->GetBrowserContext()); - download_prefs->SetSaveFilePath(path.DirName()); - printing::StickySettings* sticky_settings = GetStickySettings(); - sticky_settings->SaveInPrefs( - Profile::FromBrowserContext(preview_web_contents()->GetBrowserContext()) - ->GetPrefs()); - ResolveJavascriptCallback(base::Value(pdf_callback_id_), base::Value()); - pdf_callback_id_.clear(); - print_to_pdf_path_ = path; - PostPrintToPdfTask(); -} - -void PrintPreviewHandler::PostPrintToPdfTask() { - scoped_refptr<base::RefCountedBytes> data; - base::string16 title; - if (!GetPreviewDataAndTitle(&data, &title)) { - NOTREACHED() << "Preview data was checked before file dialog."; - return; - } - - base::PostTaskWithTraits( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, - base::BindOnce(&PrintToPdfCallback, data, print_to_pdf_path_, - pdf_file_saved_closure_)); - print_to_pdf_path_.clear(); -} - -void PrintPreviewHandler::FileSelectionCanceled(void* params) { - RejectJavascriptCallback(base::Value(pdf_callback_id_), base::Value()); - pdf_callback_id_.clear(); -} - void PrintPreviewHandler::ClearInitiatorDetails() { WebContents* initiator = GetInitiator(); if (!initiator) @@ -1645,9 +1379,23 @@ return privet_printer_handler_.get(); } #endif + if (printer_type == PrinterType::kPdfPrinter) { + if (!pdf_printer_handler_) { + pdf_printer_handler_ = PrinterHandler::CreateForPdfPrinter( + Profile::FromWebUI(web_ui()), preview_web_contents(), + GetStickySettings()); + } + return pdf_printer_handler_.get(); + } + NOTREACHED(); return nullptr; } +PdfPrinterHandler* PrintPreviewHandler::GetPdfPrinterHandler() { + return static_cast<PdfPrinterHandler*>( + GetPrinterHandler(PrinterType::kPdfPrinter)); +} + void PrintPreviewHandler::OnGotPrintersForExtensionOrPrivet( const std::string& callback_id, printing::PrinterType printer_type, @@ -1712,9 +1460,15 @@ bad_message::BadMessageReason::PPH_EXTRA_PREVIEW_MESSAGE); } +void PrintPreviewHandler::FileSelectedForTesting(const base::FilePath& path, + int index, + void* params) { + GetPdfPrinterHandler()->FileSelected(path, index, params); +} + void PrintPreviewHandler::SetPdfSavedClosureForTesting( const base::Closure& closure) { - pdf_file_saved_closure_ = closure; + GetPdfPrinterHandler()->SetPdfSavedClosureForTesting(closure); } void PrintPreviewHandler::SendEnableManipulateSettingsForTest() {
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h index 44acfb70..80163fd 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -20,8 +20,8 @@ #include "content/public/browser/web_ui_message_handler.h" #include "printing/backend/print_backend.h" #include "printing/features/features.h" -#include "ui/shell_dialogs/select_file_dialog.h" +class PdfPrinterHandler; class PrinterHandler; class PrintPreviewUI; @@ -38,7 +38,7 @@ // Must match print_preview.PrinterType in // chrome/browser/resources/print_preview/native_layer.js -enum PrinterType { kPrivetPrinter, kExtensionPrinter }; +enum PrinterType { kPrivetPrinter, kExtensionPrinter, kPdfPrinter }; class PrinterBackendProxy; } @@ -46,7 +46,6 @@ // The handler for Javascript messages related to the print preview dialog. class PrintPreviewHandler : public content::WebUIMessageHandler, - public ui::SelectFileDialog::Listener, public GaiaCookieManagerService::Observer { public: PrintPreviewHandler(); @@ -57,12 +56,6 @@ void OnJavascriptAllowed() override; void OnJavascriptDisallowed() override; - // SelectFileDialog::Listener implementation. - void FileSelected(const base::FilePath& path, - int index, - void* params) override; - void FileSelectionCanceled(void* params) override; - // GaiaCookieManagerService::Observer implementation. void OnAddAccountToCookieCompleted( const std::string& account_id, @@ -114,6 +107,11 @@ // received. void BadMessageReceived(); + // Notifies PDF Printer Handler that |path| was selected. Used for tests. + void FileSelectedForTesting(const base::FilePath& path, + int index, + void* params); + // Sets |pdf_file_saved_closure_| to |closure|. void SetPdfSavedClosureForTesting(const base::Closure& closure); @@ -123,20 +121,6 @@ // Fires the 'manipulate-settings-for-test' WebUI event with |settings|. void SendManipulateSettingsForTest(const base::DictionaryValue& settings); - protected: - // If |prompt_user| is true, starts a task to create the default Save As PDF - // directory if needed. OnDirectoryCreated() will be called when it - // finishes to open the modal dialog and prompt the user. Otherwise, just - // accept |default_path| and uniquify it. - // Protected so unit tests can access. - virtual void SelectFile(const base::FilePath& default_path, bool prompt_user); - - // Handles printing to PDF. Protected to expose to unit tests. - void PrintToPdf(); - - // The underlying dialog object. Protected to expose to unit tests. - scoped_refptr<ui::SelectFileDialog> select_file_dialog_; - private: friend class PrintPreviewPdfGeneratedBrowserTest; FRIEND_TEST_ALL_PREFIXES(PrintPreviewPdfGeneratedBrowserTest, @@ -308,6 +292,8 @@ PrinterHandler* GetPrinterHandler(printing::PrinterType printer_type); + PdfPrinterHandler* GetPdfPrinterHandler(); + // Called when a privet printer or extension printers are detected. // |callback_id|: The javascript callback to call if all printers have been // loaded (when |done| = true). @@ -356,10 +342,6 @@ // Whether we have already logged the number of printers this session. bool has_logged_printers_count_; - // Holds the path to the print to pdf request. It is empty if no such request - // exists. - base::FilePath print_to_pdf_path_; - // Holds token service to get OAuth2 access tokens. std::unique_ptr<AccessTokenService> token_service_; @@ -368,22 +350,19 @@ GaiaCookieManagerService* gaia_cookie_manager_service_; // Handles requests for extension printers. Created lazily by calling - // |GetPrinterHandler|. + // GetPrinterHandler(). std::unique_ptr<PrinterHandler> extension_printer_handler_; // Handles requests for privet printers. Created lazily by calling - // |GetPrinterHandler|. + // GetPrinterHandler(). std::unique_ptr<PrinterHandler> privet_printer_handler_; - // Notifies tests that want to know if the PDF has been saved. This doesn't - // notify the test if it was a successful save, only that it was attempted. - base::Closure pdf_file_saved_closure_; + // Handles requests for printing to PDF. Created lazily by calling + // GetPrinterHandler(). + std::unique_ptr<PrinterHandler> pdf_printer_handler_; std::queue<std::string> preview_callbacks_; - // Callback ID to be used to notify UI that PDF file selection has finished. - std::string pdf_callback_id_; - // Print settings to use in the local print request to send when // HandleHidePreview() is called. std::unique_ptr<base::DictionaryValue> settings_;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler_win_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler_win_unittest.cc deleted file mode 100644 index 61a1d1ae..0000000 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler_win_unittest.cc +++ /dev/null
@@ -1,178 +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 "chrome/browser/ui/webui/print_preview/print_preview_handler.h" - -#include <commdlg.h> -#include <windows.h> - -#include "base/run_loop.h" -#include "chrome/browser/platform_util.h" -#include "chrome/browser/printing/print_preview_dialog_controller.h" -#include "chrome/browser/printing/print_preview_test.h" -#include "chrome/browser/printing/print_view_manager.h" -#include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" -#include "chrome/test/base/browser_with_test_window_test.h" -#include "components/web_modal/web_contents_modal_dialog_manager.h" -#include "content/public/browser/web_contents.h" -#include "ui/shell_dialogs/select_file_dialog_win.h" -#include "ui/shell_dialogs/select_file_policy.h" - -using content::WebContents; - -namespace { - -class FakePrintPreviewHandler; -bool GetOpenFileNameImpl(OPENFILENAME* ofn); -bool GetSaveFileNameImpl(FakePrintPreviewHandler* handler, OPENFILENAME* ofn); - -class FakePrintPreviewHandler : public PrintPreviewHandler { - public: - explicit FakePrintPreviewHandler(content::WebUI* web_ui) - : init_called_(false), save_failed_(false) { - set_web_ui(web_ui); - } - - void FileSelected(const base::FilePath& path, - int index, - void* params) override { - // Since we always cancel the dialog as soon as it is initialized, this - // should never be called. - NOTREACHED(); - } - - void FileSelectionCanceled(void* params) override { - save_failed_ = true; - run_loop_.Quit(); - } - - void StartPrintToPdf() { - PrintToPdf(); - run_loop_.Run(); - } - - bool save_failed() const { return save_failed_; } - - bool init_called() const { return init_called_; } - - void set_init_called() { init_called_ = true; } - - private: - // Simplified version of select file to avoid checking preferences and sticky - // settings in the test - void SelectFile(const base::FilePath& default_filename, - bool prompt_user) override { - ui::SelectFileDialog::FileTypeInfo file_type_info; - file_type_info.extensions.resize(1); - file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("pdf")); - select_file_dialog_ = ui::CreateWinSelectFileDialog( - this, nullptr /*policy already checked*/, - base::Bind(GetOpenFileNameImpl), base::Bind(GetSaveFileNameImpl, this)); - select_file_dialog_->SelectFile( - ui::SelectFileDialog::SELECT_SAVEAS_FILE, base::string16(), - default_filename, &file_type_info, 0, base::FilePath::StringType(), - platform_util::GetTopLevel(web_ui()->GetWebContents()->GetNativeView()), - nullptr); - } - - bool init_called_; - bool save_failed_; - base::RunLoop run_loop_; -}; - -// Hook function to cancel the dialog when it is successfully initialized. -UINT_PTR CALLBACK PrintPreviewHandlerTestHookFunction(HWND hdlg, - UINT message, - WPARAM wparam, - LPARAM lparam) { - if (message != WM_INITDIALOG) - return 0; - OPENFILENAME* ofn = reinterpret_cast<OPENFILENAME*>(lparam); - FakePrintPreviewHandler* handler = - reinterpret_cast<FakePrintPreviewHandler*>(ofn->lCustData); - handler->set_init_called(); - PostMessage(GetParent(hdlg), WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); - return 1; -} - -bool GetOpenFileNameImpl(OPENFILENAME* ofn) { - return ::GetOpenFileName(ofn); -} - -bool GetSaveFileNameImpl(FakePrintPreviewHandler* handler, OPENFILENAME* ofn) { - // Modify ofn so that the hook function will be called. - ofn->Flags |= OFN_ENABLEHOOK; - ofn->lpfnHook = PrintPreviewHandlerTestHookFunction; - ofn->lCustData = reinterpret_cast<LPARAM>(handler); - return ::GetSaveFileName(ofn); -} - -} // namespace - -class PrintPreviewHandlerTest : public PrintPreviewTest { - public: - PrintPreviewHandlerTest() : preview_ui_(nullptr) {} - ~PrintPreviewHandlerTest() override {} - - void SetUp() override { - PrintPreviewTest::SetUp(); - - // Create a new tab - chrome::NewTab(browser()); - } - - protected: - void CreateUIAndHandler() { - WebContents* initiator = - browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(initiator); - - // Get print preview UI - printing::PrintPreviewDialogController* controller = - printing::PrintPreviewDialogController::GetInstance(); - ASSERT_TRUE(controller); - printing::PrintViewManager* print_view_manager = - printing::PrintViewManager::FromWebContents(initiator); - print_view_manager->PrintPreviewNow(initiator->GetMainFrame(), false); - WebContents* preview_dialog = - controller->GetOrCreatePreviewDialog(initiator); - ASSERT_TRUE(preview_dialog); - preview_ui_ = static_cast<PrintPreviewUI*>( - preview_dialog->GetWebUI()->GetController()); - ASSERT_TRUE(preview_ui_); - - preview_handler_ = - base::MakeUnique<FakePrintPreviewHandler>(preview_dialog->GetWebUI()); - } - - std::unique_ptr<FakePrintPreviewHandler> preview_handler_; - PrintPreviewUI* preview_ui_; - - private: - DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandlerTest); -}; - -TEST_F(PrintPreviewHandlerTest, TestSaveAsPdf) { - CreateUIAndHandler(); - preview_ui_->SetInitiatorTitle(L"111111111111111111111.html"); - preview_handler_->StartPrintToPdf(); - EXPECT_TRUE(preview_handler_->init_called()); - EXPECT_TRUE(preview_handler_->save_failed()); -} - -TEST_F(PrintPreviewHandlerTest, TestSaveAsPdfLongFileName) { - CreateUIAndHandler(); - preview_ui_->SetInitiatorTitle( - L"11111111111111111111111111111111111111111111111111111111111111111111111" - L"11111111111111111111111111111111111111111111111111111111111111111111111" - L"11111111111111111111111111111111111111111111111111111111111111111111111" - L"11111111111111111111111111111111111111111111111111111111111111111111111" - L"1111111111111111111111111111111111111111111111111.html"); - preview_handler_->StartPrintToPdf(); - EXPECT_TRUE(preview_handler_->init_called()); - EXPECT_TRUE(preview_handler_->save_failed()); -}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index bc70bb1ef..481ce61 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -657,7 +657,7 @@ } void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { - handler_->FileSelected(path, 0, NULL); + handler_->FileSelectedForTesting(path, 0, NULL); } void PrintPreviewUI::SetPdfSavedClosureForTesting(
diff --git a/chrome/browser/ui/webui/print_preview/printer_handler.cc b/chrome/browser/ui/webui/print_preview/printer_handler.cc index f949ac8..cd6843f 100644 --- a/chrome/browser/ui/webui/print_preview/printer_handler.cc +++ b/chrome/browser/ui/webui/print_preview/printer_handler.cc
@@ -6,6 +6,7 @@ #include "build/buildflag.h" #include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h" +#include "chrome/browser/ui/webui/print_preview/pdf_printer_handler.h" #include "chrome/common/features.h" #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) @@ -18,6 +19,15 @@ return base::MakeUnique<ExtensionPrinterHandler>(profile); } +// static +std::unique_ptr<PrinterHandler> PrinterHandler::CreateForPdfPrinter( + Profile* profile, + content::WebContents* preview_web_contents, + printing::StickySettings* sticky_settings) { + return base::MakeUnique<PdfPrinterHandler>(profile, preview_web_contents, + sticky_settings); +} + #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) // static std::unique_ptr<PrinterHandler> PrinterHandler::CreateForPrivetPrinters(
diff --git a/chrome/browser/ui/webui/print_preview/printer_handler.h b/chrome/browser/ui/webui/print_preview/printer_handler.h index c8f69e09..29dc7b1 100644 --- a/chrome/browser/ui/webui/print_preview/printer_handler.h +++ b/chrome/browser/ui/webui/print_preview/printer_handler.h
@@ -20,12 +20,20 @@ class Value; } -class Profile; +namespace content { +class WebContents; +} namespace gfx { class Size; } +namespace printing { +class StickySettings; +} + +class Profile; + // Wrapper around PrinterProviderAPI to be used by print preview. // It makes request lifetime management easier, and hides details of more // complex operations like printing from the print preview handler. @@ -45,6 +53,12 @@ static std::unique_ptr<PrinterHandler> CreateForExtensionPrinters( Profile* profile); + // Creates an instance of a PrinterHandler for PDF printer. + static std::unique_ptr<PrinterHandler> CreateForPdfPrinter( + Profile* profile, + content::WebContents* preview_web_contents, + printing::StickySettings* sticky_settings); + #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) // Creates an instance of a PrinterHandler for privet printers. static std::unique_ptr<PrinterHandler> CreateForPrivetPrinters(
diff --git a/chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc b/chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc index d4d06d661..cd06011 100644 --- a/chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc +++ b/chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc
@@ -29,7 +29,7 @@ source->AddResourcePath( "message_dispatcher.js", IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS); source->SetDefaultResource(IDR_QUOTA_INTERNALS_MAIN_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/sandbox_internals_ui.cc b/chrome/browser/ui/webui/sandbox_internals_ui.cc index 63a62253..5c1991d 100644 --- a/chrome/browser/ui/webui/sandbox_internals_ui.cc +++ b/chrome/browser/ui/webui/sandbox_internals_ui.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/ui/webui/sandbox_internals_ui.h" #include <string> -#include <unordered_set> #include "chrome/browser/profiles/profile.h" #include "chrome/common/render_messages.h" @@ -54,7 +53,7 @@ content::WebUIDataSource::Create(chrome::kChromeUISandboxHost); source->SetDefaultResource(IDR_SANDBOX_INTERNALS_HTML); source->AddResourcePath("sandbox_internals.js", IDR_SANDBOX_INTERNALS_JS); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); #if defined(OS_LINUX) SetSandboxStatusData(source);
diff --git a/chrome/browser/ui/webui/settings/md_settings_ui.cc b/chrome/browser/ui/webui/settings/md_settings_ui.cc index 2da8861c..1595abf 100644 --- a/chrome/browser/ui/webui/settings/md_settings_ui.cc +++ b/chrome/browser/ui/webui/settings/md_settings_ui.cc
@@ -115,7 +115,7 @@ : content::WebUIController(web_ui), WebContentsObserver(web_ui->GetWebContents()) { #if BUILDFLAG(USE_VULCANIZE) - std::unordered_set<std::string> exclude_from_gzip; + std::vector<std::string> exclude_from_gzip; #endif Profile* profile = Profile::FromWebUI(web_ui); @@ -208,7 +208,7 @@ html_source->AddResourcePath("partner-logo.svg", IDR_CHROME_CLEANUP_PARTNER); #if BUILDFLAG(USE_VULCANIZE) - exclude_from_gzip.insert("partner-logo.svg"); + exclude_from_gzip.push_back("partner-logo.svg"); #endif #endif // defined(GOOGLE_CHROME_BUILD) }
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.h b/chrome/browser/ui/webui/settings/site_settings_handler.h index dfeac30..17e71446 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler.h +++ b/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -72,6 +72,7 @@ FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomLevels); FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerInfobarTest, SettingPermissionsTriggersInfobar); + FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, SessionOnlyException); // Asynchronously fetches the usage for a given origin. Replies back with // OnGetUsageInfo above.
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc index ac904b3c..190db58 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -88,6 +88,8 @@ SiteSettingsHandlerTest() : kNotifications(site_settings::ContentSettingsTypeToGroupName( CONTENT_SETTINGS_TYPE_NOTIFICATIONS)), + kCookies(site_settings::ContentSettingsTypeToGroupName( + CONTENT_SETTINGS_TYPE_COOKIES)), handler_(&profile_) { #if defined(OS_CHROMEOS) mock_user_manager_ = new chromeos::MockUserManager; @@ -273,8 +275,9 @@ incognito_profile_ = nullptr; } - // Content setting group name for |CONTENT_SETTINGS_TYPE_NOTIFICATIONS|. + // Content setting group name for the relevant ContentSettingsType. const std::string kNotifications; + const std::string kCookies; private: content::TestBrowserThreadBundle thread_bundle_; @@ -314,7 +317,7 @@ TEST_F(SiteSettingsHandlerTest, Origins) { const std::string google("https://www.google.com:443"); - const std::string kUmaBase("WebsiteSettings.Menu.PermissionChanged"); + const std::string uma_base("WebsiteSettings.Menu.PermissionChanged"); { // Test the JS -> C++ -> JS callback path for configuring origins, by // setting Google.com to blocked. @@ -328,10 +331,11 @@ base::HistogramTester histograms; handler()->HandleSetCategoryPermissionForPattern(&set_args); EXPECT_EQ(1U, web_ui()->call_data().size()); - histograms.ExpectTotalCount(kUmaBase, 1); - histograms.ExpectTotalCount(kUmaBase + ".Allowed", 0); - histograms.ExpectTotalCount(kUmaBase + ".Blocked", 1); - histograms.ExpectTotalCount(kUmaBase + ".Reset", 0); + histograms.ExpectTotalCount(uma_base, 1); + histograms.ExpectTotalCount(uma_base + ".Allowed", 0); + histograms.ExpectTotalCount(uma_base + ".Blocked", 1); + histograms.ExpectTotalCount(uma_base + ".Reset", 0); + histograms.ExpectTotalCount(uma_base + ".SessionOnly", 0); } base::ListValue get_exception_list_args; @@ -351,10 +355,10 @@ base::HistogramTester histograms; handler()->HandleResetCategoryPermissionForPattern(&reset_args); EXPECT_EQ(3U, web_ui()->call_data().size()); - histograms.ExpectTotalCount(kUmaBase, 1); - histograms.ExpectTotalCount(kUmaBase + ".Allowed", 0); - histograms.ExpectTotalCount(kUmaBase + ".Blocked", 0); - histograms.ExpectTotalCount(kUmaBase + ".Reset", 1); + histograms.ExpectTotalCount(uma_base, 1); + histograms.ExpectTotalCount(uma_base + ".Allowed", 0); + histograms.ExpectTotalCount(uma_base + ".Blocked", 0); + histograms.ExpectTotalCount(uma_base + ".Reset", 1); } // Verify the reset was successful. @@ -870,4 +874,21 @@ EXPECT_TRUE(url::IsSameOriginWith(origin, tab_url)); } +TEST_F(SiteSettingsHandlerTest, SessionOnlyException) { + const std::string google_with_port("https://www.google.com:443"); + const std::string uma_base("WebsiteSettings.Menu.PermissionChanged"); + base::ListValue set_args; + set_args.AppendString(google_with_port); // Primary pattern. + set_args.AppendString(google_with_port); // Secondary pattern. + set_args.AppendString(kCookies); + set_args.AppendString( + content_settings::ContentSettingToString(CONTENT_SETTING_SESSION_ONLY)); + set_args.AppendBoolean(false); // Incognito. + base::HistogramTester histograms; + handler()->HandleSetCategoryPermissionForPattern(&set_args); + EXPECT_EQ(1U, web_ui()->call_data().size()); + histograms.ExpectTotalCount(uma_base, 1); + histograms.ExpectTotalCount(uma_base + ".SessionOnly", 1); +} + } // namespace settings
diff --git a/chrome/browser/ui/webui/signin_internals_ui.cc b/chrome/browser/ui/webui/signin_internals_ui.cc index f1748a38..0cf13bc 100644 --- a/chrome/browser/ui/webui/signin_internals_ui.cc +++ b/chrome/browser/ui/webui/signin_internals_ui.cc
@@ -29,7 +29,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("signin_internals.js", IDR_SIGNIN_INTERNALS_INDEX_JS); source->SetDefaultResource(IDR_SIGNIN_INTERNALS_INDEX_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc index bf378f2..7578a13 100644 --- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc +++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
@@ -242,6 +242,12 @@ &SnippetsInternalsMessageHandler::HandleToggleDismissedSuggestions, base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "initializationCompleted", + base::Bind( + &SnippetsInternalsMessageHandler::HandleInitializationCompleted, + base::Unretained(this))); + content_suggestions_service_observer_.Add(content_suggestions_service_); } @@ -278,6 +284,12 @@ void SnippetsInternalsMessageHandler::ContentSuggestionsServiceShutdown() {} +void SnippetsInternalsMessageHandler::HandleInitializationCompleted( + const base::ListValue* args) { + DCHECK_EQ(0u, args->GetSize()); + AllowJavascript(); +} + void SnippetsInternalsMessageHandler::HandleRefreshContent( const base::ListValue* args) { DCHECK_EQ(0u, args->GetSize()); @@ -440,6 +452,10 @@ } void SnippetsInternalsMessageHandler::SendAllContent() { + if (!IsJavascriptAllowed()) { + return; + } + SendBoolean( "flag-article-suggestions", base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)); @@ -479,6 +495,10 @@ base::Value(fetcher->GetLastJsonForDebugging())); } + CallJavascriptFunction( + "chrome.SnippetsInternals.receiveDebugLog", + base::Value(content_suggestions_service_->GetDebugLog())); + std::set<variations::VariationID> ids = SnippetsExperiments(); std::vector<std::string> string_ids; for (auto id : ids) {
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.h b/chrome/browser/ui/webui/snippets_internals_message_handler.h index c86459a..1a64e31 100644 --- a/chrome/browser/ui/webui/snippets_internals_message_handler.h +++ b/chrome/browser/ui/webui/snippets_internals_message_handler.h
@@ -60,6 +60,7 @@ void OnFullRefreshRequired() override; void ContentSuggestionsServiceShutdown() override; + void HandleInitializationCompleted(const base::ListValue* args); void HandleRefreshContent(const base::ListValue* args); void HandleDownload(const base::ListValue* args); void HandleClearCachedSuggestions(const base::ListValue* args);
diff --git a/chrome/browser/ui/webui/snippets_internals_ui.cc b/chrome/browser/ui/webui/snippets_internals_ui.cc index 35e79554..7a914a6b 100644 --- a/chrome/browser/ui/webui/snippets_internals_ui.cc +++ b/chrome/browser/ui/webui/snippets_internals_ui.cc
@@ -36,7 +36,7 @@ source->AddResourcePath("snippets_internals.js", IDR_SNIPPETS_INTERNALS_JS); source->AddResourcePath("snippets_internals.css", IDR_SNIPPETS_INTERNALS_CSS); source->SetDefaultResource(IDR_SNIPPETS_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/supervised_user_internals_ui.cc b/chrome/browser/ui/webui/supervised_user_internals_ui.cc index d644116..b69ac356 100644 --- a/chrome/browser/ui/webui/supervised_user_internals_ui.cc +++ b/chrome/browser/ui/webui/supervised_user_internals_ui.cc
@@ -23,7 +23,7 @@ source->AddResourcePath("supervised_user_internals.css", IDR_SUPERVISED_USER_INTERNALS_CSS); source->SetDefaultResource(IDR_SUPERVISED_USER_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc index 1c4bf06b..bda9a6df 100644 --- a/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc +++ b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc
@@ -51,7 +51,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("translate_internals.js", IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); base::DictionaryValue langs; GetLanguages(&langs);
diff --git a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc index ebe1ce2..0de8441ea 100644 --- a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc +++ b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
@@ -23,7 +23,7 @@ source->AddResourcePath("url/mojo/origin.mojom.js", IDR_ORIGIN_MOJO_JS); source->AddResourcePath("url/mojo/url.mojom.js", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_USB_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); }
diff --git a/chrome/browser/ui/webui/webapks_ui.cc b/chrome/browser/ui/webui/webapks_ui.cc index bb6b6176..16aa2d51 100644 --- a/chrome/browser/ui/webui/webapks_ui.cc +++ b/chrome/browser/ui/webui/webapks_ui.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/ui/webui/webapks_ui.h" #include <string> -#include <unordered_set> #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/webapks_handler.h" @@ -25,7 +24,7 @@ html_source->AddResourcePath("webapks.js", IDR_WEBAPKS_UI_JS); html_source->AddResourcePath("about_webapks.css", IDR_WEBAPKS_UI_CSS); html_source->SetDefaultResource(IDR_WEBAPKS_UI_HTML); - html_source->UseGzip(std::unordered_set<std::string>()); + html_source->UseGzip(); return html_source; }
diff --git a/chrome/browser/vr/BUILD.gn b/chrome/browser/vr/BUILD.gn index 4a1387f..a29500b 100644 --- a/chrome/browser/vr/BUILD.gn +++ b/chrome/browser/vr/BUILD.gn
@@ -82,6 +82,8 @@ "elements/url_bar.h", "elements/url_bar_texture.cc", "elements/url_bar_texture.h", + "elements/vector_icon.cc", + "elements/vector_icon.h", "elements/viewport_aware_root.cc", "elements/viewport_aware_root.h", "elements/webvr_url_toast.cc",
diff --git a/chrome/browser/vr/elements/close_button_texture.cc b/chrome/browser/vr/elements/close_button_texture.cc index e7bbd1f..5a1851f 100644 --- a/chrome/browser/vr/elements/close_button_texture.cc +++ b/chrome/browser/vr/elements/close_button_texture.cc
@@ -7,13 +7,11 @@ #include "cc/paint/skia_paint_canvas.h" #include "chrome/browser/vr/color_scheme.h" #include "chrome/browser/vr/elements/button.h" +#include "chrome/browser/vr/elements/vector_icon.h" #include "components/vector_icons/vector_icons.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/vector2d.h" -#include "ui/gfx/paint_vector_icon.h" -#include "ui/gfx/vector_icon_types.h" namespace vr { @@ -45,13 +43,11 @@ canvas->DrawCircle(gfx::PointF(size_.width() / 2, size_.height() / 2), size_.width() / 2, flags); - canvas->Save(); - canvas->Translate(gfx::Vector2d(size_.height() * (1 - kIconScaleFactor) / 2, - size_.height() * (1 - kIconScaleFactor) / 2)); - PaintVectorIcon(canvas, vector_icons::kCloseIcon, - size_.height() * kIconScaleFactor, - color_scheme().close_button_foreground); - canvas->Restore(); + float icon_size = size_.height() * kIconScaleFactor; + float icon_corner_offset = (size_.height() - icon_size) / 2; + DrawVectorIcon(canvas, vector_icons::kCloseIcon, icon_size, + gfx::PointF(icon_corner_offset, icon_corner_offset), + color_scheme().close_button_foreground); } gfx::Size CloseButtonTexture::GetPreferredTextureSize(int maximum_width) const {
diff --git a/chrome/browser/vr/elements/insecure_content_permanent_texture.cc b/chrome/browser/vr/elements/insecure_content_permanent_texture.cc index 255a1f4..2fbb2fb 100644 --- a/chrome/browser/vr/elements/insecure_content_permanent_texture.cc +++ b/chrome/browser/vr/elements/insecure_content_permanent_texture.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/vr/elements/insecure_content_permanent_texture.h" #include "cc/paint/skia_paint_canvas.h" +#include "chrome/browser/vr/elements/vector_icon.h" #include "components/strings/grit/components_strings.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" @@ -12,9 +13,7 @@ #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/vector2d.h" -#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/render_text.h" -#include "ui/gfx/vector_icon_types.h" namespace vr { @@ -60,15 +59,13 @@ sk_canvas->drawRoundRect(SkRect::MakeWH(size_.width(), size_.height()), radius, radius, paint); - canvas->Save(); - canvas->Translate(gfx::Vector2d( + gfx::PointF icon_location( IsRTL() ? 4 * kBorderFactor * size_.height() + text_size.width() : size_.height() * kBorderFactor, - size_.height() * (1.0 - kIconSizeFactor) / 2.0)); - PaintVectorIcon(canvas, vector_icons::kInfoOutlineIcon, - size_.height() * kIconSizeFactor, - color_scheme().permanent_warning_foreground); - canvas->Restore(); + size_.height() * (1.0 - kIconSizeFactor) / 2.0); + DrawVectorIcon(canvas, vector_icons::kInfoOutlineIcon, + size_.height() * kIconSizeFactor, icon_location, + color_scheme().permanent_warning_foreground); canvas->Save(); canvas->Translate(gfx::Vector2d(
diff --git a/chrome/browser/vr/elements/system_indicator_texture.cc b/chrome/browser/vr/elements/system_indicator_texture.cc index b92622a..3ecb0d4 100644 --- a/chrome/browser/vr/elements/system_indicator_texture.cc +++ b/chrome/browser/vr/elements/system_indicator_texture.cc
@@ -6,14 +6,12 @@ #include "base/strings/utf_string_conversions.h" #include "cc/paint/skia_paint_canvas.h" +#include "chrome/browser/vr/elements/vector_icon.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/vector2d.h" -#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/render_text.h" -#include "ui/gfx/vector_icon_types.h" namespace vr { @@ -23,9 +21,6 @@ constexpr float kBorderFactor = 0.1; constexpr float kIconSizeFactor = 0.7; constexpr float kFontSizeFactor = 0.40; -constexpr float kTextHeightFactor = 1.0 - 2 * kBorderFactor; -constexpr float kTextWidthFactor = - kHeightWidthRatio - 3 * kBorderFactor - kIconSizeFactor; } // namespace @@ -46,55 +41,48 @@ size_.set_height(texture_size.height()); + float border_pixels = size_.height() * kBorderFactor; + float icon_pixels = size_.height() * kIconSizeFactor; + size_.set_width(icon_pixels + 2 * border_pixels); + SkPaint paint; paint.setColor(color_scheme().system_indicator_background); - gfx::Rect text_size(0, 0); - std::vector<std::unique_ptr<gfx::RenderText>> lines; + std::unique_ptr<gfx::RenderText> rendered_text; if (has_text_) { base::string16 text = l10n_util::GetStringUTF16(message_id_); gfx::FontList fonts; GetFontList(size_.height() * kFontSizeFactor, text, &fonts); - text_size.set_height(kTextHeightFactor * size_.height()); - + gfx::Rect text_size(0, size_.height()); + std::vector<std::unique_ptr<gfx::RenderText>> lines; lines = PrepareDrawStringRect( text, fonts, color_scheme().system_indicator_foreground, &text_size, kTextAlignmentNone, kWrappingBehaviorNoWrap); + DCHECK_EQ(lines.size(), 1u); + rendered_text = std::move(lines.front()); - DCHECK_LE(text_size.width(), kTextWidthFactor * size_.height()); - - // Setting background size giving some extra lateral padding to the text. - size_.set_width((kHeightWidthRatio * kBorderFactor + kIconSizeFactor) * - size_.height() + - text_size.width()); - } else { - size_.set_width((2 * kBorderFactor + kIconSizeFactor) * size_.height() + - text_size.width()); + // Adust texture width according to text size. + size_.set_width(size_.width() + text_size.width() + 2 * border_pixels); } - float radius = size_.height() * kBorderFactor; sk_canvas->drawRoundRect(SkRect::MakeWH(size_.width(), size_.height()), - radius, radius, paint); + border_pixels, border_pixels, paint); - canvas->Save(); - canvas->Translate(gfx::Vector2d( - IsRTL() ? 4 * kBorderFactor * size_.height() + text_size.width() - : size_.height() * kBorderFactor, - size_.height() * (1.0 - kIconSizeFactor) / 2.0)); - PaintVectorIcon(canvas, icon_, size_.height() * kIconSizeFactor, - color_scheme().system_indicator_foreground); - canvas->Restore(); + gfx::PointF icon_location( + (IsRTL() ? size_.width() - border_pixels - icon_pixels : border_pixels), + (size_.height() - icon_pixels) / 2.0); + DrawVectorIcon(canvas, icon_, size_.height() * kIconSizeFactor, icon_location, + color_scheme().system_indicator_foreground); - canvas->Save(); - canvas->Translate(gfx::Vector2d( - size_.height() * - (IsRTL() ? 2 * kBorderFactor : 3 * kBorderFactor + kIconSizeFactor), - size_.height() * kBorderFactor)); - for (auto& render_text : lines) - render_text->Draw(canvas); - canvas->Restore(); + if (rendered_text) { + canvas->Save(); + canvas->Translate(gfx::Vector2d( + (IsRTL() ? border_pixels : 3 * border_pixels + icon_pixels), 0)); + rendered_text->Draw(canvas); + canvas->Restore(); + } } gfx::Size SystemIndicatorTexture::GetPreferredTextureSize(
diff --git a/chrome/browser/vr/elements/ui_element.cc b/chrome/browser/vr/elements/ui_element.cc index 08010c2..f17a072 100644 --- a/chrome/browser/vr/elements/ui_element.cc +++ b/chrome/browser/vr/elements/ui_element.cc
@@ -7,6 +7,7 @@ #include <limits> #include "base/logging.h" +#include "base/numerics/ranges.h" #include "base/stl_util.h" #include "base/time/time.h" #include "cc/base/math_util.h" @@ -229,7 +230,7 @@ void UiElement::NotifyClientFloatAnimated(float opacity, int target_property_id, cc::Animation* animation) { - opacity_ = cc::MathUtil::ClampToRange(opacity, 0.0f, 1.0f); + opacity_ = base::ClampToRange(opacity, 0.0f, 1.0f); } void UiElement::NotifyClientTransformOperationsAnimated(
diff --git a/chrome/browser/vr/elements/url_bar_texture.cc b/chrome/browser/vr/elements/url_bar_texture.cc index bff7309e..35c817f 100644 --- a/chrome/browser/vr/elements/url_bar_texture.cc +++ b/chrome/browser/vr/elements/url_bar_texture.cc
@@ -10,6 +10,7 @@ #include "cc/paint/skia_paint_canvas.h" #include "chrome/browser/vr/color_scheme.h" #include "chrome/browser/vr/elements/render_text_wrapper.h" +#include "chrome/browser/vr/elements/vector_icon.h" #include "components/url_formatter/url_formatter.h" #include "components/vector_icons/vector_icons.h" #include "ui/gfx/canvas.h" @@ -193,15 +194,12 @@ canvas->drawRRect(round_rect, paint); // Back button icon. - canvas->save(); - canvas->translate( - ToPixels((kBackButtonWidth - kBackIconSize) / 2 + kBackIconOffset), - ToPixels((kHeight - kBackIconSize) / 2)); - PaintVectorIcon(&gfx_canvas, vector_icons::kBackArrowIcon, - ToPixels(kBackIconSize), - can_go_back_ ? color_scheme().element_foreground - : color_scheme().disabled); - canvas->restore(); + DrawVectorIcon( + &gfx_canvas, vector_icons::kBackArrowIcon, ToPixels(kBackIconSize), + {ToPixels(kBackButtonWidth / 2 + kBackIconOffset - kBackIconSize / 2), + ToPixels(kHeight - kBackIconSize) / 2}, + can_go_back_ ? color_scheme().element_foreground + : color_scheme().disabled); // Security indicator and URL area. paint.setColor(color_scheme().element_background); @@ -223,13 +221,11 @@ state_.vector_icon != nullptr && state_.should_display_url) { gfx::RectF icon_region(left_edge, kHeight / 2 - kSecurityIconSize / 2, kSecurityIconSize, kSecurityIconSize); - canvas->save(); - canvas->translate(ToPixels(icon_region.x()), ToPixels(icon_region.y())); - PaintVectorIcon(&gfx_canvas, *state_.vector_icon, - ToPixels(kSecurityIconSize), - GetSecurityChipColor(state_.security_level, - state_.offline_page, color_scheme())); - canvas->restore(); + DrawVectorIcon(&gfx_canvas, *state_.vector_icon, + ToPixels(kSecurityIconSize), + {ToPixels(icon_region.x()), ToPixels(icon_region.y())}, + GetSecurityChipColor(state_.security_level, + state_.offline_page, color_scheme())); security_hit_region_ = icon_region; left_edge += kSecurityIconSize + kFieldSpacing; }
diff --git a/chrome/browser/vr/elements/vector_icon.cc b/chrome/browser/vr/elements/vector_icon.cc new file mode 100644 index 0000000..24a679135 --- /dev/null +++ b/chrome/browser/vr/elements/vector_icon.cc
@@ -0,0 +1,34 @@ +// 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/vr/elements/vector_icon.h" + +#include "components/vector_icons/vector_icons.h" +#include "ui/gfx/canvas.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/paint_vector_icon.h" + +namespace vr { + +void DrawVectorIcon(gfx::Canvas* canvas, + const gfx::VectorIcon& icon, + float size_px, + const gfx::PointF& corner, + SkColor color) { + gfx::ImageSkia image = CreateVectorIcon( + gfx::IconDescription(icon, 0, color, base::TimeDelta(), gfx::kNoneIcon)); + + // Determine how much we need to scale the icon to fit the target region. + float scale = size_px / image.width(); + const gfx::ImageSkiaRep& image_rep = image.GetRepresentation(scale); + + // Blit the icon based on its desired position on the canvas. + cc::PaintFlags flags; + gfx::Point point(corner.x(), corner.y()); + canvas->DrawImageIntInPixel(image_rep, point.x(), point.y(), + image_rep.pixel_width(), image_rep.pixel_height(), + false, flags); +} + +} // namespace vr
diff --git a/chrome/browser/vr/elements/vector_icon.h b/chrome/browser/vr/elements/vector_icon.h new file mode 100644 index 0000000..6d22cc4 --- /dev/null +++ b/chrome/browser/vr/elements/vector_icon.h
@@ -0,0 +1,26 @@ +// 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_VR_ELEMENTS_VECTOR_ICON_H_ +#define CHROME_BROWSER_VR_ELEMENTS_VECTOR_ICON_H_ + +#include "third_party/skia/include/core/SkColor.h" + +namespace gfx { +class Canvas; +class PointF; +struct VectorIcon; +} // namespace gfx + +namespace vr { + +void DrawVectorIcon(gfx::Canvas* canvas, + const gfx::VectorIcon& icon, + float size_px, + const gfx::PointF& corner, + SkColor color); + +} // namespace vr + +#endif // CHROME_BROWSER_VR_ELEMENTS_VECTOR_ICON_H_
diff --git a/chrome/browser/vr/elements/webvr_url_toast_texture.cc b/chrome/browser/vr/elements/webvr_url_toast_texture.cc index 8201e488..6fd7b15 100644 --- a/chrome/browser/vr/elements/webvr_url_toast_texture.cc +++ b/chrome/browser/vr/elements/webvr_url_toast_texture.cc
@@ -6,10 +6,10 @@ #include "cc/paint/skia_paint_canvas.h" #include "chrome/browser/vr/color_scheme.h" +#include "chrome/browser/vr/elements/vector_icon.h" #include "components/url_formatter/url_formatter.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/rect_f.h" -#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/render_text.h" #include "ui/gfx/text_constants.h" #include "ui/gfx/text_elider.h" @@ -73,16 +73,11 @@ // Site security state icon. if ((state_.security_level != security_state::NONE || state_.offline_page) && state_.vector_icon != nullptr && state_.should_display_url) { - canvas->save(); - canvas->scale(size_.width() / kWidth, size_.width() / kWidth); - canvas->translate(kSecurityIconOffsetLeft, - kHeight / 2 - kSecurityIconSize / 2); - const gfx::VectorIcon& icon = *state_.vector_icon; - float icon_scale = kSecurityIconSize / GetDefaultSizeOfVectorIcon(icon); - canvas->scale(icon_scale, icon_scale); - PaintVectorIcon(&gfx_canvas, icon, - color_scheme().transient_warning_foreground); - canvas->restore(); + DrawVectorIcon(&gfx_canvas, *state_.vector_icon, + ToPixels(kSecurityIconSize), + {ToPixels(kSecurityIconOffsetLeft), + ToPixels((kHeight - kSecurityIconSize) / 2)}, + color_scheme().transient_warning_foreground); } if (state_.should_display_url) {
diff --git a/chrome/browser/win/taskbar_icon_finder.cc b/chrome/browser/win/taskbar_icon_finder.cc index a181ecf..f2c4b152 100644 --- a/chrome/browser/win/taskbar_icon_finder.cc +++ b/chrome/browser/win/taskbar_icon_finder.cc
@@ -14,19 +14,18 @@ #include <vector> #include "base/bind.h" -#include "base/callback.h" #include "base/location.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/run_loop.h" #include "base/sequenced_task_runner.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/thread.h" #include "base/win/scoped_comptr.h" #include "base/win/scoped_variant.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/shell_util.h" +#include "ui/display/win/screen_win.h" +#include "ui/gfx/geometry/rect.h" namespace { @@ -37,19 +36,11 @@ // monitor. class TaskbarIconFinder { public: - // The result of a search for Chrome's taskbar icon. An empty rect is provided - // case of error or if no icon can be found. - using ResultCallback = base::OnceCallback<void(const gfx::Rect&)>; - - // Finds the bounding rectangle of Chrome's taskbar icon on the primary - // monitor, running |result_callback| with the result when done. - static void FindAsync(ResultCallback result_callback); - - private: // Constructs a new finder and immediately starts running it on a dedicated // automation thread in a multi-threaded COM apartment. - explicit TaskbarIconFinder(ResultCallback result_callback); + explicit TaskbarIconFinder(TaskbarIconFinderResultCallback result_callback); + private: // Receives the result computed on the automation thread, stops the automation // thread, passes the results to the caller, then self-destructs. void OnComplete(const gfx::Rect& rect); @@ -84,19 +75,13 @@ base::Thread automation_thread_; // The caller's callback. - ResultCallback result_callback_; + TaskbarIconFinderResultCallback result_callback_; DISALLOW_COPY_AND_ASSIGN(TaskbarIconFinder); }; -// static -void TaskbarIconFinder::FindAsync(ResultCallback result_callback) { - DCHECK(result_callback); - // The instance self-destructs in OnComplete. - new TaskbarIconFinder(std::move(result_callback)); -} - -TaskbarIconFinder::TaskbarIconFinder(ResultCallback result_callback) +TaskbarIconFinder::TaskbarIconFinder( + TaskbarIconFinderResultCallback result_callback) : automation_thread_("TaskbarIconFinder"), result_callback_(std::move(result_callback)) { DCHECK(result_callback_); @@ -184,8 +169,8 @@ cache_request->AddProperty(UIA_NativeWindowHandlePropertyId); base::win::ScopedComPtr<IUIAutomationElement> icon; + HWND hwnd = 0; for (int i = 0; i < length; ++i) { - HWND hwnd = 0; icons->GetElement(i, icon.GetAddressOf()); // Walk up the tree to find the icon's first parent with an HWND. @@ -229,8 +214,9 @@ std::vector<double> bounding_rect = GetCachedDoubleArrayValue(icon.Get(), UIA_BoundingRectanglePropertyId); if (!bounding_rect.empty()) { - *rect = gfx::Rect(bounding_rect[0], bounding_rect[1], bounding_rect[2], - bounding_rect[3]); + gfx::Rect screen_rect(bounding_rect[0], bounding_rect[1], bounding_rect[2], + bounding_rect[3]); + *rect = display::win::ScreenWin::ScreenToDIPRect(hwnd, screen_rect); } } @@ -289,27 +275,10 @@ return S_OK; } -// Utilities ------------------------------------------------------------------- - -// Sets |result_storage| with the value provided through invocation of the -// callback in |result|, then runs |quit_closure|. -void SetResultAndContinue(base::Closure quit_closure, - gfx::Rect* result_storage, - const gfx::Rect& result) { - *result_storage = result; - quit_closure.Run(); -} - } // namespace -gfx::Rect FindTaskbarIconModal() { - gfx::Rect result; - - base::RunLoop run_loop; - TaskbarIconFinder::FindAsync(base::BindOnce(&SetResultAndContinue, - run_loop.QuitClosure(), - base::Unretained(&result))); - run_loop.Run(); - - return result; +void FindTaskbarIcon(TaskbarIconFinderResultCallback result_callback) { + DCHECK(result_callback); + // The instance self-destructs in OnComplete. + new TaskbarIconFinder(std::move(result_callback)); }
diff --git a/chrome/browser/win/taskbar_icon_finder.h b/chrome/browser/win/taskbar_icon_finder.h index eccba4d..27757180 100644 --- a/chrome/browser/win/taskbar_icon_finder.h +++ b/chrome/browser/win/taskbar_icon_finder.h
@@ -5,11 +5,20 @@ #ifndef CHROME_BROWSER_WIN_TASKBAR_ICON_FINDER_H_ #define CHROME_BROWSER_WIN_TASKBAR_ICON_FINDER_H_ -#include "ui/gfx/geometry/rect.h" +#include "base/callback.h" -// Finds the bounding rectangle of Chrome's taskbar icon on the primary monitor. -// Returns an empty rect in case of error or if no icon can be found. This is a -// blocking call. -gfx::Rect FindTaskbarIconModal(); +namespace gfx { +class Rect; +} + +// The result of a search for Chrome's taskbar icon. An empty rect is provided +// in case of error or if no icon can be found. +using TaskbarIconFinderResultCallback = + base::OnceCallback<void(const gfx::Rect&)>; + +// Asynchronosuly finds the bounding rectangle of Chrome's taskbar icon on the +// primary monitor, running |result_callback| with the result (in DIP) when +// done. +void FindTaskbarIcon(TaskbarIconFinderResultCallback result_callback); #endif // CHROME_BROWSER_WIN_TASKBAR_ICON_FINDER_H_
diff --git a/chrome/browser/win/taskbar_icon_finder_unittest.cc b/chrome/browser/win/taskbar_icon_finder_unittest.cc index f02d4e61..950cfd84 100644 --- a/chrome/browser/win/taskbar_icon_finder_unittest.cc +++ b/chrome/browser/win/taskbar_icon_finder_unittest.cc
@@ -4,6 +4,9 @@ #include "chrome/browser/win/taskbar_icon_finder.h" +#include "base/bind.h" +#include "base/callback.h" +#include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,5 +14,10 @@ // cause crashes. TEST(TaskbarIconFinder, Simple) { base::test::ScopedTaskEnvironment task_environment; - FindTaskbarIconModal(); + base::RunLoop run_loop; + + FindTaskbarIcon(base::Bind([](base::Closure quit_closure, + const gfx::Rect& rect) { quit_closure.Run(); }, + run_loop.QuitWhenIdleClosure())); + run_loop.Run(); }
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 3c06d22..356e9cac 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -108,6 +108,8 @@ "chrome_content_client_constants.cc", "chrome_isolated_world_ids.h", "chrome_result_codes.h", + "client_hints/client_hints.cc", + "client_hints/client_hints.h", "common_message_generator.cc", "common_message_generator.h", "common_param_traits.cc", @@ -473,6 +475,7 @@ "widevine_cdm_constants.cc", "widevine_cdm_constants.h", ] + public_deps += [ "//media/cdm:cdm_paths" ] } if (!enable_webrtc) { sources -= [ "media/webrtc_logging_messages.h" ]
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index e554009..75242d3 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -25,6 +25,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/version.h" #include "build/build_config.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" @@ -47,6 +48,7 @@ #include "extensions/features/features.h" #include "gpu/config/gpu_info.h" #include "gpu/config/gpu_util.h" +#include "media/base/media_switches.h" #include "media/media_features.h" #include "net/http/http_util.h" #include "pdf/features.h" @@ -83,11 +85,13 @@ #include "ppapi/shared_impl/ppapi_permissions.h" // nogncheck #endif -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && \ - !defined(WIDEVINE_CDM_IS_COMPONENT) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) +#include "media/cdm/cdm_paths.h" // nogncheck +#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT) #define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT #include "chrome/common/widevine_cdm_constants.h" #endif +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) #include "chrome/common/media/cdm_host_file_path.h" @@ -548,12 +552,27 @@ const base::Version version(WIDEVINE_CDM_VERSION_STRING); DCHECK(version.IsValid()); cdms->push_back(content::CdmInfo(kWidevineCdmType, version, cdm_path, - codecs_supported)); + codecs_supported, kWidevineKeySystem, + false)); } #endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) - // TODO(jrummell): Add External Clear Key CDM for testing, if it's - // available. +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) + // Register Clear Key CDM if specified in command line. + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + std::string clear_key_cdm_path = + command_line->GetSwitchValueASCII(switches::kClearKeyCdmPathForTesting); + if (!clear_key_cdm_path.empty()) { + // TODO(crbug.com/764480): Remove this after we have a central place for + // External Clear Key (ECK) related information. + const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; + // Supported codecs are hard-coded in ExternalClearKeyProperties. + cdms->push_back( + content::CdmInfo(media::kClearKeyCdmType, base::Version("0.1.0.0"), + base::FilePath::FromUTF8Unsafe(clear_key_cdm_path), + {}, kExternalClearKeyKeySystem, true)); + } +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 7a14966..55bad33 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -280,7 +280,7 @@ // Enables or disables modal permission prompts. const base::Feature kModalPermissionPrompts{"ModalPermissionPrompts", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; #if defined(OS_WIN) // Enables or disables the ModuleDatabase backend for the conflicts UI.
diff --git a/chrome/common/client_hints/OWNERS b/chrome/common/client_hints/OWNERS new file mode 100644 index 0000000..6ebcbe0 --- /dev/null +++ b/chrome/common/client_hints/OWNERS
@@ -0,0 +1,6 @@ +tbansal@chromium.org +ryansturm@chromium.org + +# For IPC security review +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS \ No newline at end of file
diff --git a/chrome/common/client_hints/client_hints.cc b/chrome/common/client_hints/client_hints.cc new file mode 100644 index 0000000..8d08ec6 --- /dev/null +++ b/chrome/common/client_hints/client_hints.cc
@@ -0,0 +1,57 @@ +// 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/common/client_hints/client_hints.h" + +#include "content/public/common/origin_util.h" +#include "third_party/WebKit/public/platform/WebClientHintsType.h" +#include "url/gurl.h" + +namespace client_hints { + +void GetAllowedClientHintsFromSource( + const GURL& url, + const ContentSettingsForOneType& client_hints_rules, + blink::WebEnabledClientHints* client_hints) { + if (!content::IsOriginSecure(url)) + return; + + const GURL origin = GURL(url).GetOrigin(); + + for (const auto& rule : client_hints_rules) { + // Look for an exact match since persisted client hints are disabled by + // default, and enabled only on per-host basis. + if (rule.primary_pattern == ContentSettingsPattern::Wildcard() || + !rule.primary_pattern.Matches(origin)) { + continue; + } + + // Found an exact match. + DCHECK(ContentSettingsPattern::Wildcard() == rule.secondary_pattern); + DCHECK(rule.setting_value->is_dict()); + const base::Value* expiration_time = + rule.setting_value->FindPath({"expiration_time"}); + DCHECK(expiration_time->is_double()); + + if (base::Time::Now().ToDoubleT() > expiration_time->GetDouble()) { + // The client hint is expired. + return; + } + + const base::Value* list_value = + rule.setting_value->FindPath({"client_hints"}); + DCHECK(list_value->is_list()); + const base::Value::ListStorage& client_hints_list = list_value->GetList(); + for (const auto& client_hint : client_hints_list) { + DCHECK(client_hint.is_int()); + client_hints->SetIsEnabled( + static_cast<blink::mojom::WebClientHintsType>(client_hint.GetInt()), + true); + } + // Match found for |url| and client hints have been set. + return; + } +} + +} // namespace client_hints
diff --git a/chrome/common/client_hints/client_hints.h b/chrome/common/client_hints/client_hints.h new file mode 100644 index 0000000..50328396 --- /dev/null +++ b/chrome/common/client_hints/client_hints.h
@@ -0,0 +1,28 @@ +// 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_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_ +#define CHROME_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_ + +#include "components/content_settings/core/common/content_settings.h" + +class GURL; + +namespace blink { +struct WebEnabledClientHints; +} + +namespace client_hints { + +// Retrieves the persistent client hints that should be set when fetching a +// resource from |url|, and updates |client_hints| with the result. +// |client_hints_rules| contains the content settings for the client hints. +void GetAllowedClientHintsFromSource( + const GURL& url, + const ContentSettingsForOneType& client_hints_rules, + blink::WebEnabledClientHints* client_hints); + +} // namespace client_hints + +#endif // CHROME_COMMON_CLIENT_HINTS_CLIENT_HINTS_H_
diff --git a/chrome/common/extensions/docs/server2/README b/chrome/common/extensions/docs/server2/README index f437535..cce86bf 100644 --- a/chrome/common/extensions/docs/server2/README +++ b/chrome/common/extensions/docs/server2/README
@@ -150,16 +150,32 @@ This will safely do the push for you, ensuring that the automated job does not collide with your own. +---------------------- +Server architecture + +The server is composed of two parts: + +1) A compute engine VM instance which runs a cron job to periodicially pull the + chromium repo and uses the update_cache.py script to push the new data to the + cloud datastore. All the keys in the cloud datastore are indexed by the app + version specified in app.yaml. + +2) A python app engine app which reads the data in the cloud datastore and + serves the website. + +Hence, even if we were to stop the compute engine VM instance, the website +should still keep running. But it won't update, since the cloud datastore won't +get updated. + --------------------------------------- VM: Some notes and troubleshooting tips Q1: How is the datastore populated in the VM? A: /home/git-processor/update-docs-full.sh - This script is run frequently (TODO(lazyboy): How frequently?) through cron - to sync the chromium git repo in this machine. Once it has done so, it will - populate docserver data store and write that in - /home/git-processor/.docserver_cache. Docserver uses this file as data - sources to populate its documentation. + This script is run every 2 hours through cron to sync the chromium git repo + in this machine. Once it has done so, it will populate docserver data store + and write that in /home/git-processor/.docserver_cache. Docserver uses this + file as data sources to populate its documentation. Q2: Is chromium repo in the VM in sync? A: Check the git logs on the repo. @@ -174,6 +190,11 @@ Q3: Did the last run to populate .docserver_cache succeed? A: Check the logs. + Logs can be checked from the Cloud dashboard. Go to the project homepage and + select Logging > Logs. Choose the VM instance and "syslog" from the filter + options. + + Alternatively, run $ sudo -s # You need to be root. $ vi /var/log/user.log @@ -212,3 +233,38 @@ while, you'd want to kill them, which should be "safe" (endorsed by rockot@) in most of the cases. If that doesn't work, then delete the lock file. This will let subsequent cron runs to update docserver. + +Q5: How to migrate to a new VM instance? (Say to update the operating system). + ROUGH steps: + 1) Stop the old VM. + 2) Backup the cloud datastore to a cloud storage bucket (optional). + 3) Clone the persistent disk (not the boot disk) from the old VM. Else just + create a new disk and copy necessary data (in /home/git-processor) later. + 4) Create a new VM instance (Use configuration from the old VM) and attach + the new persistent disk to the new VM. Make sure that new VM has the same + API access scopes as the old one (for e.g. it can write to the cloud + datastore). + 5) Mount the persistent disk at /home/git-processor (Modify /etc/fstab so + that the disk is automatically mounted on restarts). + 6) Ensure the data in /home/git-processor is the same as the old VM (if you + had not cloned the disk, use some other tool to copy the data). + 7) Increment the app engine version in the chromium repo and commit the + change (so that we don't somehow affect the currently serving production + version). + 8) On the VM, fetch chrome in /home/git-processor with all the branch heads. + 9) Ensure app.yaml in the chrome repo has the new app version. + 10) Install any necessary dependencies. For e.g. /home/git-processor/gcd is + a python virtual environment used by update-docs-full.sh (which is run + as part of the cron job). Hence pip, virtualenv need to be installed and + it needs to be ensured that the virtualenv at /home/git-processor/gcd is + correctly configured. Requirements file generated by pip can be used for + this purpose. + 11) Run update-docs-full.sh and ensure it works fine. (After it runs, the + new app engine version should work fine and have the latest changes). + 12) If it does, add a cronjob for the git-processor user to regularly run + update-docs-full.sh. + 13) Ensure the cron job is running fine and serve all the traffic from the + new app engine version. + 14) Delete the old VM, persistent disk after some time. + 15) (Optional) Install logging agent on the VM so that the syslog from the + VM can be seen from the cloud dashboard.
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 37e9515..effe002 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -787,10 +787,6 @@ // A boolean pref set to true if the virtual keyboard should be enabled. const char kTouchVirtualKeyboardEnabled[] = "ui.touch_virtual_keyboard_enabled"; -// Boolean prefs for the status of the touchscreen and the touchpad. -const char kTouchscreenEnabled[] = "events.touch_screen.enabled"; -const char kTouchpadEnabled[] = "events.touch_pad.enabled"; - // A boolean pref that controls whether the dark connect feature is enabled. // The dark connect feature allows a Chrome OS device to periodically wake // from suspend in a low-power state to maintain WiFi connectivity.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index f954c97..95acc6b 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -269,8 +269,6 @@ extern const char kCurrentWallpaperAppName[]; extern const char kFileSystemProviderMounted[]; extern const char kTouchVirtualKeyboardEnabled[]; -extern const char kTouchscreenEnabled[]; -extern const char kTouchpadEnabled[]; extern const char kWakeOnWifiDarkConnect[]; extern const char kCaptivePortalAuthenticationIgnoresProxy[]; extern const char kForceMaximizeOnFirstRun[];
diff --git a/chrome/common/profiling/memlog_allocator_shim.cc b/chrome/common/profiling/memlog_allocator_shim.cc index 0bd0b4f..ac3d16a 100644 --- a/chrome/common/profiling/memlog_allocator_shim.cc +++ b/chrome/common/profiling/memlog_allocator_shim.cc
@@ -185,8 +185,10 @@ } // namespace void InitAllocatorShim(MemlogSenderPipe* sender_pipe) { - g_send_buffers = new SendBuffer[kNumSendBuffers]; + // Must be done before hooking any functions that make stack traces. + base::debug::EnableInProcessStackDumping(); + g_send_buffers = new SendBuffer[kNumSendBuffers]; g_sender_pipe = sender_pipe; #if BUILDFLAG(USE_ALLOCATOR_SHIM)
diff --git a/chrome/common/profiling/memlog_stream.h b/chrome/common/profiling/memlog_stream.h index 3bdab3a2..2ec6dd1 100644 --- a/chrome/common/profiling/memlog_stream.h +++ b/chrome/common/profiling/memlog_stream.h
@@ -19,10 +19,12 @@ constexpr uint32_t kMaxStackEntries = 256; constexpr uint32_t kMaxContextLen = 256; +// This should count up from 0 so it can be used to index into an array. enum class AllocatorType : uint32_t { kMalloc = 0, kPartitionAlloc = 1, - kOilpan = 2 + kOilpan = 2, + kCount // Number of allocator types. }; #pragma pack(push, 1)
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index ee7ec947..61bf0d70 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -67,6 +67,8 @@ const char kChromeUIInspectURL[] = "chrome://inspect/"; const char kChromeUIInstantURL[] = "chrome://instant/"; const char kChromeUIInterstitialURL[] = "chrome://interstitials/"; +const char kChromeUIInterventionsInternalsURL[] = + "chrome://interventions-internals/"; const char kChromeUIInvalidationsURL[] = "chrome://invalidations/"; const char kChromeUIMemoryInternalsURL[] = "chrome://memory-internals/"; const char kChromeUINaClURL[] = "chrome://nacl/"; @@ -213,6 +215,7 @@ const char kChromeUIInspectHost[] = "inspect"; const char kChromeUIInstantHost[] = "instant"; const char kChromeUIInterstitialHost[] = "interstitials"; +const char kChromeUIInterventionsInternalsHost[] = "interventions-internals"; const char kChromeUIInvalidationsHost[] = "invalidations"; const char kChromeUIKillHost[] = "kill"; const char kChromeUILargeIconHost[] = "large-icon"; @@ -654,6 +657,7 @@ kChromeUIFlagsHost, kChromeUIGCMInternalsHost, kChromeUIHistoryHost, + kChromeUIInterventionsInternalsHost, kChromeUIInvalidationsHost, kChromeUILocalStateHost, kChromeUIMediaEngagementHost,
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 3404a231..2b4ed79 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -60,6 +60,7 @@ extern const char kChromeUIInspectURL[]; extern const char kChromeUIInstantURL[]; extern const char kChromeUIInterstitialURL[]; +extern const char kChromeUIInterventionsInternalsURL[]; extern const char kChromeUIInvalidationsURL[]; extern const char kChromeUIMediaEngagementHost[]; extern const char kChromeUIMemoryInternalsURL[]; @@ -201,6 +202,7 @@ extern const char kChromeUIInspectHost[]; extern const char kChromeUIInstantHost[]; extern const char kChromeUIInterstitialHost[]; +extern const char kChromeUIInterventionsInternalsHost[]; extern const char kChromeUIInvalidationsHost[]; extern const char kChromeUIKillHost[]; extern const char kChromeUILargeIconHost[];
diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh index 8bea7e6..a224d39 100755 --- a/chrome/installer/linux/debian/build.sh +++ b/chrome/installer/linux/debian/build.sh
@@ -87,12 +87,14 @@ verify_package() { local DEPENDS="$1" - echo ${DEPENDS} | sed 's/, /\n/g' | LANG=C sort > expected_deb_depends + local EXPECTED_DEPENDS="${TMPFILEDIR}/expected_deb_depends" + local ACTUAL_DEPENDS="${TMPFILEDIR}/actual_deb_depends" + echo ${DEPENDS} | sed 's/, /\n/g' | LANG=C sort > "${EXPECTED_DEPENDS}" dpkg -I "${PACKAGE}-${CHANNEL}_${VERSIONFULL}_${ARCHITECTURE}.deb" | \ grep '^ Depends: ' | sed 's/^ Depends: //' | sed 's/, /\n/g' | \ - LANG=C sort > actual_deb_depends + LANG=C sort > "${ACTUAL_DEPENDS}" BAD_DIFF=0 - diff -u expected_deb_depends actual_deb_depends || BAD_DIFF=1 + diff -u "${EXPECTED_DEPENDS}" "${ACTUAL_DEPENDS}" || BAD_DIFF=1 if [ $BAD_DIFF -ne 0 ]; then echo echo "ERROR: bad dpkg dependencies!"
diff --git a/chrome/installer/linux/rpm/build.sh b/chrome/installer/linux/rpm/build.sh index de683c6..3286227 100755 --- a/chrome/installer/linux/rpm/build.sh +++ b/chrome/installer/linux/rpm/build.sh
@@ -53,6 +53,8 @@ verify_package() { local DEPENDS="$1" + local EXPECTED_DEPENDS="${TMPFILEDIR}/expected_rpm_depends" + local ACTUAL_DEPENDS="${TMPFILEDIR}/actual_rpm_depends" local ADDITIONAL_RPM_DEPENDS="/bin/sh, \ rpmlib(CompressedFileNames) <= 3.0.4-1, \ rpmlib(PayloadFilesHavePrefix) <= 4.0-1, \ @@ -62,11 +64,11 @@ rpmlib(PayloadIsXz) <= 5.2-1" fi echo "${DEPENDS}" "${ADDITIONAL_RPM_DEPENDS}" | sed 's/,/\n/g' | \ - sed 's/^ *//' | LANG=C sort > expected_rpm_depends + sed 's/^ *//' | LANG=C sort > "${EXPECTED_DEPENDS}" rpm -qpR "${OUTPUTDIR}/${PKGNAME}.${ARCHITECTURE}.rpm" | LANG=C sort | uniq \ - > actual_rpm_depends + > "${ACTUAL_DEPENDS}" BAD_DIFF=0 - diff -u expected_rpm_depends actual_rpm_depends || BAD_DIFF=1 + diff -u "${EXPECTED_DEPENDS}" "${ACTUAL_DEPENDS}" || BAD_DIFF=1 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then echo echo "ERROR: bad rpm dependencies!"
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 0624e0f4..ac097ecb 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc
@@ -77,7 +77,6 @@ #include "chrome/installer/util/master_preferences_constants.h" #include "chrome/installer/util/self_cleaning_temp_dir.h" #include "chrome/installer/util/shell_util.h" -#include "chrome/installer/util/user_experiment.h" #include "chrome/installer/util/util_constants.h" #include "components/crash/content/app/crash_switches.h" #include "components/crash/content/app/run_as_crashpad_handler_win.h" @@ -983,37 +982,6 @@ MasterPreferences::ForCurrentProcess(), original_state, installer_state); exit_code = 0; - } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) { - // Launch the inactive user toast experiment. - int flavor = -1; - base::StringToInt(cmd_line.GetSwitchValueNative( - installer::switches::kInactiveUserToast), &flavor); - std::string experiment_group = - cmd_line.GetSwitchValueASCII(installer::switches::kExperimentGroup); - DCHECK_NE(-1, flavor); - if (flavor == -1) { - *exit_code = installer::UNKNOWN_STATUS; - } else { - // This code is called (via setup.exe relaunch) only if a product is known - // to run user experiments, so no check is required. - installer::InactiveUserToastExperiment( - flavor, base::ASCIIToUTF16(experiment_group), - installer_state->product(), installer_state->target_path()); - } - } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { - const Product& product = installer_state->product(); - BrowserDistribution* browser_dist = product.distribution(); - // We started as system-level and have been re-launched as user level - // to continue with the toast experiment. - base::Version installed_version; - InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); - if (!installed_version.IsValid()) { - LOG(ERROR) << "No installation of " << browser_dist->GetDisplayName() - << " found for system-level toast."; - } else { - product.LaunchUserExperiment(setup_exe, installer::REENTRY_SYS_UPDATE, - true); - } } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { const std::string patch_type_str( cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); @@ -1249,25 +1217,6 @@ } } - // There might be an experiment (for upgrade usually) that needs to happen. - // An experiment's outcome can include chrome's uninstallation. If that is - // the case we would not do that directly at this point but in another - // instance of setup.exe - // - // There is another way to reach this same function if this is a system - // level install. See HandleNonInstallCmdLineOptions(). - { - // If installation failed, use the path to the currently running setup. - // If installation succeeded, use the path to setup in the installer dir. - base::FilePath setup_path(setup_exe); - if (InstallUtil::GetInstallReturnCode(install_status) == 0) { - setup_path = installer_state.GetInstallerDirectory(*installer_version) - .Append(setup_path.BaseName()); - } - installer_state.product().LaunchUserExperiment(setup_path, install_status, - system_install); - } - // If the installation completed successfully... if (InstallUtil::GetInstallReturnCode(install_status) == 0) { // Update the DisplayVersion created by an MSI-based install. @@ -1416,8 +1365,7 @@ } // Some switches only apply for modes that support retention experiments. if (!install_static::SupportsRetentionExperiments() && - (cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || - cmd_line.HasSwitch(installer::switches::kSystemLevelToast))) { + cmd_line.HasSwitch(installer::switches::kUserExperiment)) { return installer::SXS_OPTION_NOT_SUPPORTED; }
diff --git a/chrome/installer/util/BUILD.gn b/chrome/installer/util/BUILD.gn index c2e26d1a..2cf4027 100644 --- a/chrome/installer/util/BUILD.gn +++ b/chrome/installer/util/BUILD.gn
@@ -92,8 +92,6 @@ "shell_util.h", "uninstall_metrics.cc", "uninstall_metrics.h", - "user_experiment.cc", - "user_experiment.h", ] deps += [
diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 36671db..02336c8 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc
@@ -4,13 +4,11 @@ #include "chrome/installer/util/chrome_browser_operations.h" -#include "base/command_line.h" #include "base/logging.h" #include "chrome/install_static/install_util.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/shell_util.h" -#include "chrome/installer/util/user_experiment.h" #include "chrome/installer/util/util_constants.h" namespace installer { @@ -50,13 +48,4 @@ properties->set_description(dist->GetAppDescription()); } -void ChromeBrowserOperations::LaunchUserExperiment( - const base::FilePath& setup_path, - InstallStatus status, - bool system_level) const { - base::CommandLine base_command(setup_path); - InstallUtil::AppendModeSwitch(&base_command); - LaunchBrowserUserExperiment(base_command, status, system_level); -} - } // namespace installer
diff --git a/chrome/installer/util/chrome_browser_operations.h b/chrome/installer/util/chrome_browser_operations.h index af6c6413..39f2d8d 100644 --- a/chrome/installer/util/chrome_browser_operations.h +++ b/chrome/installer/util/chrome_browser_operations.h
@@ -22,10 +22,6 @@ const base::FilePath& target_exe, ShellUtil::ShortcutProperties* properties) const override; - void LaunchUserExperiment(const base::FilePath& setup_path, - InstallStatus status, - bool system_level) const override; - private: DISALLOW_COPY_AND_ASSIGN(ChromeBrowserOperations); };
diff --git a/chrome/installer/util/experiment_metrics.h b/chrome/installer/util/experiment_metrics.h index f1652fc..4a6fbc6 100644 --- a/chrome/installer/util/experiment_metrics.h +++ b/chrome/installer/util/experiment_metrics.h
@@ -76,6 +76,9 @@ // Another Chrome launch closed the toast. kOtherLaunch = 16, + // The toast was closed via external means. + kOtherClose = 17, + NUM_STATES };
diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index 78b803e..62c2a7c 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc
@@ -11,7 +11,6 @@ #include "base/memory/ptr_util.h" #include "base/process/launch.h" #include "base/win/registry.h" -#include "chrome/install_static/install_util.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/chrome_browser_operations.h" #include "chrome/installer/util/google_update_constants.h" @@ -109,18 +108,4 @@ distribution_, target_exe, properties); } -void Product::LaunchUserExperiment(const base::FilePath& setup_path, - InstallStatus status, - bool system_level) const { - // Assert that this is only called with the one relevant distribution. - // TODO(grt): Remove this when BrowserDistribution goes away. - DCHECK_EQ(BrowserDistribution::GetDistribution(), distribution_); - if (install_static::SupportsRetentionExperiments()) { - VLOG(1) << "LaunchUserExperiment status: " << status << " product: " - << distribution_->GetDisplayName() - << " system_level: " << system_level; - operations_->LaunchUserExperiment(setup_path, status, system_level); - } -} - } // namespace installer
diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h index bed2fc1..20ad4eda 100644 --- a/chrome/installer/util/product.h +++ b/chrome/installer/util/product.h
@@ -12,7 +12,6 @@ #include "base/macros.h" #include "chrome/installer/util/shell_util.h" -#include "chrome/installer/util/util_constants.h" class BrowserDistribution; @@ -70,10 +69,6 @@ const base::FilePath& target_exe, ShellUtil::ShortcutProperties* properties) const; - void LaunchUserExperiment(const base::FilePath& setup_path, - InstallStatus status, - bool system_level) const; - protected: enum CacheStateFlags { MSI_STATE = 0x01
diff --git a/chrome/installer/util/product_operations.h b/chrome/installer/util/product_operations.h index c3616e9..6a3897f 100644 --- a/chrome/installer/util/product_operations.h +++ b/chrome/installer/util/product_operations.h
@@ -9,13 +9,11 @@ #include "base/files/file_path.h" #include "chrome/installer/util/shell_util.h" -#include "chrome/installer/util/util_constants.h" class BrowserDistribution; namespace installer { - // An interface to product-specific operations that depend on product // configuration. Implementations are expected to be stateless. class ProductOperations { @@ -39,12 +37,6 @@ const base::FilePath& target_exe, ShellUtil::ShortcutProperties* properties) const = 0; - // After an install or upgrade the user might qualify to participate in an - // experiment. This function determines if the user qualifies and if so it - // sets the wheels in motion or in simple cases does the experiment itself. - virtual void LaunchUserExperiment(const base::FilePath& setup_path, - InstallStatus status, - bool system_level) const = 0; }; } // namespace installer
diff --git a/chrome/installer/util/user_experiment.cc b/chrome/installer/util/user_experiment.cc deleted file mode 100644 index 3c17b7a..0000000 --- a/chrome/installer/util/user_experiment.cc +++ /dev/null
@@ -1,536 +0,0 @@ -// Copyright 2013 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/installer/util/user_experiment.h" - -#include <windows.h> -#include <sddl.h> -#include <stddef.h> -#include <stdint.h> -#include <wtsapi32.h> - -#include <string> - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/path_service.h" -#include "base/process/launch.h" -#include "base/rand_util.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/scoped_handle.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_result_codes.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/grit/chromium_strings.h" -#include "chrome/installer/util/browser_distribution.h" -#include "chrome/installer/util/google_update_constants.h" -#include "chrome/installer/util/google_update_settings.h" -#include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/product.h" -#include "content/public/common/result_codes.h" - -namespace installer { - -namespace { - -// The following strings are the possible outcomes of the toast experiment -// as recorded in the |client| field. -const wchar_t kToastExpControlGroup[] = L"01"; -const wchar_t kToastExpCancelGroup[] = L"02"; -const wchar_t kToastExpUninstallGroup[] = L"04"; -const wchar_t kToastExpTriesOkGroup[] = L"18"; -const wchar_t kToastExpTriesErrorGroup[] = L"28"; -const wchar_t kToastActiveGroup[] = L"40"; -const wchar_t kToastUDDirFailure[] = L"40"; -const wchar_t kToastExpBaseGroup[] = L"80"; - -// Substitute the locale parameter in uninstall URL with whatever -// Google Update tells us is the locale. In case we fail to find -// the locale, we use US English. -base::string16 LocalizeUrl(const wchar_t* url) { - base::string16 language; - if (!GoogleUpdateSettings::GetLanguage(&language)) - language = L"en-US"; // Default to US English. - return base::ReplaceStringPlaceholders(url, language, NULL); -} - -base::string16 GetWelcomeBackUrl() { - const wchar_t kWelcomeUrl[] = L"http://www.google.com/chrome/intl/$1/" - L"welcomeback-new.html"; - return LocalizeUrl(kWelcomeUrl); -} - -// Converts FILETIME to hours. FILETIME times are absolute times in -// 100 nanosecond units. For example 5:30 pm of June 15, 2009 is 3580464. -int FileTimeToHours(const FILETIME& time) { - const ULONGLONG k100sNanoSecsToHours = 10000000LL * 60 * 60; - ULARGE_INTEGER uli = {{time.dwLowDateTime, time.dwHighDateTime}}; - return static_cast<int>(uli.QuadPart / k100sNanoSecsToHours); -} - -// Returns the directory last write time in hours since January 1, 1601. -// Returns -1 if there was an error retrieving the directory time. -int GetDirectoryWriteTimeInHours(const wchar_t* path) { - // To open a directory you need to pass FILE_FLAG_BACKUP_SEMANTICS. - DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - base::win::ScopedHandle file(::CreateFileW(path, 0, share, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL)); - if (!file.IsValid()) - return -1; - - FILETIME time; - return ::GetFileTime(file.Get(), NULL, NULL, &time) ? - FileTimeToHours(time) : -1; -} - -// Returns the time in hours since the last write to the user data directory. -// A return value of 14 means that the directory was last written 14 hours ago. -// Returns -1 if there was an error retrieving the directory. -int GetUserDataDirectoryWriteAgeInHours() { - base::FilePath user_data_dir; - if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) - return -1; - int dir_time = GetDirectoryWriteTimeInHours(user_data_dir.value().c_str()); - if (dir_time < 0) - return dir_time; - FILETIME time; - GetSystemTimeAsFileTime(&time); - int now_time = FileTimeToHours(time); - if (dir_time >= now_time) - return 0; - return (now_time - dir_time); -} - -// Launches setup.exe (located at |setup_path|) with |cmd_line|. -// If system_level_toast is true, appends --system-level-toast. -// If handle to experiment result key was given at startup, re-add it. -// Does not wait for the process to terminate. -// |cmd_line| may be modified as a result of this call. -bool LaunchSetup(base::CommandLine* cmd_line, bool system_level_toast) { - const base::CommandLine& current_cmd_line = - *base::CommandLine::ForCurrentProcess(); - - // Propagate --verbose-logging to the invoked setup.exe. - if (current_cmd_line.HasSwitch(switches::kVerboseLogging)) - cmd_line->AppendSwitch(switches::kVerboseLogging); - - // Re-add the system level toast flag. - if (system_level_toast) { - cmd_line->AppendSwitch(switches::kSystemLevel); - cmd_line->AppendSwitch(switches::kSystemLevelToast); - - // Re-add the toast result key. We need to do this because Setup running as - // system passes the key to Setup running as user, but that child process - // does not perform the actual toasting, it launches another Setup (as user) - // to do so. That is the process that needs the key. - std::string key(switches::kToastResultsKey); - std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); - if (!toast_key.empty()) { - cmd_line->AppendSwitchASCII(key, toast_key); - - // Use handle inheritance to make sure the duplicated toast results key - // gets inherited by the child process. - base::LaunchOptions options; - // TODO(brettw) bug 748258: Share only explicit handles. - options.inherit_mode = base::LaunchOptions::Inherit::kAll; - base::Process process = base::LaunchProcess(*cmd_line, options); - return process.IsValid(); - } - } - - base::Process process = base::LaunchProcess(*cmd_line, base::LaunchOptions()); - return process.IsValid(); -} - -// For System level installs, setup.exe lives in the system temp, which -// is normally c:\windows\temp. In many cases files inside this folder -// are not accessible for execution by regular user accounts. -// This function changes the permissions so that any authenticated user -// can launch |exe| later on. This function should only be called if the -// code is running at the system level. -bool FixDACLsForExecute(const base::FilePath& exe) { - // The general strategy to is to add an ACE to the exe DACL the quick - // and dirty way: a) read the DACL b) convert it to sddl string c) add the - // new ACE to the string d) convert sddl string back to DACL and finally - // e) write new dacl. - char buff[1024]; - DWORD len = sizeof(buff); - PSECURITY_DESCRIPTOR sd = reinterpret_cast<PSECURITY_DESCRIPTOR>(buff); - if (!::GetFileSecurityW(exe.value().c_str(), DACL_SECURITY_INFORMATION, - sd, len, &len)) { - return false; - } - wchar_t* sddl = 0; - if (!::ConvertSecurityDescriptorToStringSecurityDescriptorW(sd, - SDDL_REVISION_1, DACL_SECURITY_INFORMATION, &sddl, NULL)) - return false; - base::string16 new_sddl(sddl); - ::LocalFree(sddl); - sd = NULL; - // See MSDN for the security descriptor definition language (SDDL) syntax, - // in our case we add "A;" generic read 'GR' and generic execute 'GX' for - // the nt\authenticated_users 'AU' group, that becomes: - const wchar_t kAllowACE[] = L"(A;;GRGX;;;AU)"; - // We should check that there are no special ACES for the group we - // are interested, which is nt\authenticated_users. - if (base::string16::npos != new_sddl.find(L";AU)")) - return false; - // Specific ACEs (not inherited) need to go to the front. It is ok if we - // are the very first one. - size_t pos_insert = new_sddl.find(L"("); - if (base::string16::npos == pos_insert) - return false; - // All good, time to change the dacl. - new_sddl.insert(pos_insert, kAllowACE); - if (!::ConvertStringSecurityDescriptorToSecurityDescriptorW(new_sddl.c_str(), - SDDL_REVISION_1, &sd, NULL)) - return false; - bool rv = ::SetFileSecurityW(exe.value().c_str(), DACL_SECURITY_INFORMATION, - sd) == TRUE; - ::LocalFree(sd); - return rv; -} - -// This function launches setup as the currently logged-in interactive -// user that is the user whose logon session is attached to winsta0\default. -// It assumes that currently we are running as SYSTEM in a non-interactive -// windowstation. -// The function fails if there is no interactive session active, basically -// the computer is on but nobody has logged in locally. -// Remote Desktop sessions do not count as interactive sessions; running this -// method as a user logged in via remote desktop will do nothing. -bool LaunchSetupAsConsoleUser(base::CommandLine* cmd_line) { - // Convey to the invoked setup.exe that it's operating on a system-level - // installation. - cmd_line->AppendSwitch(switches::kSystemLevel); - - // Propagate --verbose-logging to the invoked setup.exe. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kVerboseLogging)) - cmd_line->AppendSwitch(switches::kVerboseLogging); - - // Get the Google Update results key, and pass it on the command line to - // the child process. - int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey(); - cmd_line->AppendSwitchASCII(switches::kToastResultsKey, - base::IntToString(key)); - - // Make sure that in Vista and Above we have the proper DACLs so the - // interactive user can launch it. - if (!FixDACLsForExecute(cmd_line->GetProgram())) - NOTREACHED(); - - DWORD console_id = ::WTSGetActiveConsoleSessionId(); - if (console_id == 0xFFFFFFFF) { - PLOG(ERROR) << __func__ << " failed to get active session id"; - return false; - } - HANDLE user_token; - if (!::WTSQueryUserToken(console_id, &user_token)) { - PLOG(ERROR) << __func__ << " failed to get user token for console_id " - << console_id; - return false; - } - // Note: Handle inheritance must be true in order for the child process to be - // able to use the duplicated handle above (Google Update results). - base::LaunchOptions options; - options.as_user = user_token; - // TODO(brettw) bug 748258: Share only explicit handles. - options.inherit_mode = base::LaunchOptions::Inherit::kAll; - options.empty_desktop_name = true; - VLOG(1) << __func__ << " launching " << cmd_line->GetCommandLineString(); - base::Process process = base::LaunchProcess(*cmd_line, options); - ::CloseHandle(user_token); - VLOG(1) << __func__ << " result: " << process.IsValid(); - return process.IsValid(); -} - -// A helper function that writes to HKLM if the handle was passed through the -// command line, but HKCU otherwise. |experiment_group| is the value to write -// and |last_write| is used when writing to HKLM to determine whether to close -// the handle when done. -void SetClient(const base::string16& experiment_group, bool last_write) { - static int reg_key_handle = -1; - if (reg_key_handle == -1) { - // If a specific Toast Results key handle (presumably to our HKLM key) was - // passed in to the command line (such as for system level installs), we use - // it. Otherwise, we write to the key under HKCU. - const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); - if (cmd_line.HasSwitch(switches::kToastResultsKey)) { - // Get the handle to the key under HKLM. - base::StringToInt( - cmd_line.GetSwitchValueNative(switches::kToastResultsKey), - ®_key_handle); - } else { - reg_key_handle = 0; - } - } - - if (reg_key_handle) { - // Use it to write the experiment results. - GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( - reg_key_handle, google_update::kRegClientField, experiment_group); - if (last_write) { - CloseHandle( - reinterpret_cast<HANDLE>(static_cast<uintptr_t>(reg_key_handle))); - } - } else { - // Write to HKCU. - GoogleUpdateSettings::SetClient(experiment_group); - } -} - -} // namespace - -bool CreateExperimentDetails(int flavor, ExperimentDetails* experiment) { - struct FlavorDetails { - int heading_id; - int flags; - }; - // Maximum number of experiment flavors we support. - static const int kMax = 4; - // This struct determines which experiment flavors we show for each locale and - // brand. - // - // Plugin infobar experiment: - // The experiment in 2011 used PIxx codes. - // - // Inactive user toast experiment: - // The experiment in Dec 2009 used TGxx and THxx. - // The experiment in Feb 2010 used TKxx and TLxx. - // The experiment in Apr 2010 used TMxx and TNxx. - // The experiment in Oct 2010 used TVxx TWxx TXxx TYxx. - // The experiment in Feb 2011 used SJxx SKxx SLxx SMxx. - // The experiment in Mar 2012 used ZAxx ZBxx ZCxx. - // The experiment in Jan 2013 uses DAxx. - - static const struct UserExperimentSpecs { - const wchar_t* locale; // Locale to show this experiment for (* for all). - const wchar_t* brands; // Brand codes show this experiment for (* for all). - int control_group; // Size of the control group, in percentages. - const wchar_t* prefix; // The two letter experiment code. The second letter - // will be incremented with the flavor. - FlavorDetails flavors[kMax]; - } kExperiments[] = { - // The first match from top to bottom is used so this list should be ordered - // most-specific rule first. - { L"*", L"GGRV", // All locales, GGRV is enterprise. - 0, // 0 percent control group. - L"EA", // Experiment is EAxx, EBxx, etc. - // No flavors means no experiment. - { { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } - } - }, - { L"*", L"*", // All locales, all brands. - 5, // 5 percent control group. - L"DA", // Experiment is DAxx. - // One single flavor. - { { IDS_TRY_TOAST_HEADING3, kToastUiMakeDefault }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } - } - } - }; - - base::string16 locale; - GoogleUpdateSettings::GetLanguage(&locale); - if (locale.empty() || (locale == L"en")) - locale = L"en-US"; - - base::string16 brand; - if (!GoogleUpdateSettings::GetBrand(&brand)) - brand.clear(); // Could still be viable for catch-all rules - - for (size_t i = 0; i < arraysize(kExperiments); ++i) { - base::string16 experiment_locale = kExperiments[i].locale; - if (experiment_locale != locale && experiment_locale != L"*") - continue; - - for (const base::string16& cur : base::SplitString( - kExperiments[i].brands, L",", - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - if (cur != brand && cur != L"*") - continue; - // We have found our match. - const UserExperimentSpecs& match = kExperiments[i]; - // Find out how many flavors we have. Zero means no experiment. - int num_flavors = 0; - while (match.flavors[num_flavors].heading_id) { ++num_flavors; } - if (!num_flavors) - return false; - - if (flavor < 0) - flavor = base::RandInt(0, num_flavors - 1); - experiment->flavor = flavor; - experiment->heading = match.flavors[flavor].heading_id; - experiment->control_group = match.control_group; - const wchar_t prefix[] = { - match.prefix[0], static_cast<wchar_t>(match.prefix[1] + flavor), 0}; - experiment->prefix = prefix; - experiment->flags = match.flavors[flavor].flags; - return true; - } - } - - return false; -} - -// Currently we only have one experiment: the inactive user toast. Which only -// applies for users doing upgrades. - -// There are three scenarios when this function is called: -// 1- Is a per-user-install and it updated: perform the experiment -// 2- Is a system-install and it updated : relaunch as the interactive user -// 3- It has been re-launched from the #2 case. In this case we enter -// this function with |system_install| true and a REENTRY_SYS_UPDATE status. -void LaunchBrowserUserExperiment(const base::CommandLine& base_cmd_line, - InstallStatus status, - bool system_level) { - if (system_level) { - if (NEW_VERSION_UPDATED == status) { - base::CommandLine cmd_line(base_cmd_line); - cmd_line.AppendSwitch(switches::kSystemLevelToast); - // We need to relaunch as the interactive user. - LaunchSetupAsConsoleUser(&cmd_line); - return; - } - } else { - if (status != NEW_VERSION_UPDATED && status != REENTRY_SYS_UPDATE) { - // We are not updating or in re-launch. Exit. - return; - } - } - - // The |flavor| value ends up being processed by TryChromeDialogView to show - // different experiments. - ExperimentDetails experiment; - if (!CreateExperimentDetails(-1, &experiment)) { - VLOG(1) << "Failed to get experiment details."; - return; - } - int flavor = experiment.flavor; - base::string16 base_group = experiment.prefix; - - base::string16 brand; - if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { - // Testing only: the user automatically qualifies for the experiment. - VLOG(1) << "Experiment qualification bypass"; - } else { - // Check that the user was not already drafted in this experiment. - base::string16 client; - GoogleUpdateSettings::GetClient(&client); - if (client.size() > 2) { - if (base_group == client.substr(0, 2)) { - VLOG(1) << "User already participated in this experiment"; - return; - } - } - const bool experiment_enabled = false; - if (!experiment_enabled) { - VLOG(1) << "Toast experiment is disabled."; - return; - } - - // Check browser usage inactivity by the age of the last-write time of the - // relevant chrome user data directory. - const int kThirtyDays = 30 * 24; - const int dir_age_hours = GetUserDataDirectoryWriteAgeInHours(); - if (dir_age_hours < 0) { - // This means that we failed to find the user data dir. The most likely - // cause is that this user has not ever used chrome at all which can - // happen in a system-level install. - SetClient(base_group + kToastUDDirFailure, true); - return; - } else if (dir_age_hours < kThirtyDays) { - // An active user, so it does not qualify. - VLOG(1) << "Chrome used in last " << dir_age_hours << " hours"; - SetClient(base_group + kToastActiveGroup, true); - return; - } - // Check to see if this user belongs to the control group. - double control_group = 1.0 * (100 - experiment.control_group) / 100; - if (base::RandDouble() > control_group) { - SetClient(base_group + kToastExpControlGroup, true); - VLOG(1) << "User is control group"; - return; - } - } - - VLOG(1) << "User drafted for toast experiment " << flavor; - SetClient(base_group + kToastExpBaseGroup, false); - // User level: The experiment needs to be performed in a different process - // because google_update expects the upgrade process to be quick and nimble. - // System level: We have already been relaunched, so we don't need to be - // quick, but we relaunch to follow the exact same codepath. - base::CommandLine cmd_line(base_cmd_line); - cmd_line.AppendSwitchASCII(switches::kInactiveUserToast, - base::IntToString(flavor)); - cmd_line.AppendSwitchASCII(switches::kExperimentGroup, - base::UTF16ToASCII(base_group)); - LaunchSetup(&cmd_line, system_level); -} - -// User qualifies for the experiment. To test, use --try-chrome-again=|flavor| -// as a parameter to chrome.exe. -void InactiveUserToastExperiment(int flavor, - const base::string16& experiment_group, - const Product& product, - const base::FilePath& application_path) { - // Add the 'welcome back' url for chrome to show. - base::CommandLine options(base::CommandLine::NO_PROGRAM); - options.AppendSwitchNative(::switches::kTryChromeAgain, - base::IntToString16(flavor)); - // Prepend the url with a space. - base::string16 url(GetWelcomeBackUrl()); - options.AppendArg("--"); - options.AppendArgNative(url); - // The command line should now have the url added as: - // "chrome.exe -- <url>" - DCHECK_NE(base::string16::npos, - options.GetCommandLineString().find(L" -- " + url)); - - // Launch chrome now. It will show the toast UI. - int32_t exit_code = 0; - if (!product.LaunchChromeAndWait(application_path, options, &exit_code)) - return; - - // The chrome process has exited, figure out what happened. - const wchar_t* outcome = NULL; - switch (exit_code) { - case content::RESULT_CODE_NORMAL_EXIT: - outcome = kToastExpTriesOkGroup; - break; - case chrome::RESULT_CODE_NORMAL_EXIT_CANCEL: - outcome = kToastExpCancelGroup; - break; - case chrome::RESULT_CODE_NORMAL_EXIT_EXP2: - outcome = kToastExpUninstallGroup; - break; - default: - outcome = kToastExpTriesErrorGroup; - } - // Write to the |client| key for the last time. - SetClient(experiment_group + outcome, true); - - if (outcome != kToastExpUninstallGroup) - return; - // The user wants to uninstall. This is a best effort operation. Note that - // we waited for chrome to exit so the uninstall would not detect chrome - // running. - bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kSystemLevelToast); - - base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast)); - base::LaunchProcess(cmd, base::LaunchOptions()); -} - -} // namespace installer
diff --git a/chrome/installer/util/user_experiment.h b/chrome/installer/util/user_experiment.h deleted file mode 100644 index 7856f774..0000000 --- a/chrome/installer/util/user_experiment.h +++ /dev/null
@@ -1,67 +0,0 @@ -// Copyright 2013 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. -// -// This files declares a class that contains methods and data to conduct -// for user expeirments. - -#ifndef CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_ -#define CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_ - -#include "base/strings/string16.h" -#include "chrome/installer/util/util_constants.h" - -namespace base { -class CommandLine; -class FilePath; -} - -namespace installer { - -class Product; - -// Flags to control what to show in the UserExperiment dialog. -enum ToastUiFlags { - kToastUiUninstall = 1 << 0, // Uninstall radio button. - kToastUiDontBugMeAsButton = 1 << 1, // This is a button, not a radio button. - kToastUiWhyLink = 1 << 2, // Has the 'why I am seeing this' link. - kToastUiMakeDefault = 1 << 3, // Has the 'make it default' checkbox. -}; - -// A struct for communicating what a UserExperiment contains. In these -// experiments we show toasts to the user if they are inactive for a certain -// amount of time. -struct ExperimentDetails { - base::string16 prefix; // The experiment code prefix for this experiment, - // also known as the 'TV' part in 'TV80'. - int flavor; // The flavor index for this experiment. - int heading; // The heading resource ID to use for this experiment. - int flags; // See ToastUIFlags above. - int control_group; // Size of the control group (in percentages). Control - // group is the group that qualifies for the - // experiment but does not participate. -}; - -// Creates the experiment details for a given language-brand combo. -// If |flavor| is -1, then a flavor will be selected at random. |experiment| -// is the struct you want to write the experiment information to. -// Returns false if no experiment details could be gathered. -bool CreateExperimentDetails(int flavor, ExperimentDetails* experiment); - -// After an install or upgrade the user might qualify to participate in an -// experiment. This function determines if the user qualifies and if so it -// sets the wheels in motion or in simple cases does the experiment itself. -void LaunchBrowserUserExperiment(const base::CommandLine& base_command, - InstallStatus status, - bool system_level); - -// The user has qualified for the inactive user toast experiment and this -// function just performs it. -void InactiveUserToastExperiment(int flavor, - const base::string16& experiment_group, - const Product& product, - const base::FilePath& application_path); - -} // namespace installer - -#endif // CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index bd60716a..e8913e3 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc
@@ -152,19 +152,6 @@ // Show the embedded EULA dialog. const char kShowEula[] = "show-eula"; -// Perform the inactive user toast experiment. -const char kInactiveUserToast[] = "inactive-user-toast"; - -// User toast experiment switch from system context to user context. -const char kSystemLevelToast[] = "system-level-toast"; - -// The group this experiment belongs to. -const char kExperimentGroup[] = "experiment-group"; - -// A handle value of the key to write the results of the toast experiment -// to. See DuplicateGoogleUpdateSystemClientKey for details. -const char kToastResultsKey[] = "toast-results-key"; - // Applies a binary patch to a file. The input, patch, and the output file are // specified as command line arguments following the --patch switch. // Ex: --patch=courgette --input_file='input' --patch_file='patch'
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 64746c6..f2777d4 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h
@@ -180,10 +180,6 @@ extern const char kUncompressedArchive[]; extern const char kVerboseLogging[]; extern const char kShowEula[]; -extern const char kInactiveUserToast[]; -extern const char kSystemLevelToast[]; -extern const char kExperimentGroup[]; -extern const char kToastResultsKey[]; extern const char kPatch[]; extern const char kInputFile[]; extern const char kPatchFile[];
diff --git a/chrome/profiling/allocation_event.cc b/chrome/profiling/allocation_event.cc index 73a3147..d8d3c95 100644 --- a/chrome/profiling/allocation_event.cc +++ b/chrome/profiling/allocation_event.cc
@@ -19,4 +19,11 @@ AllocationEvent::AllocationEvent(Address addr) : address_(addr) {} +AllocationCountMap AllocationEventSetToCountMap(const AllocationEventSet& set) { + AllocationCountMap map; + for (const auto& alloc : set) + map[alloc]++; + return map; +} + } // namespace profiling
diff --git a/chrome/profiling/allocation_event.h b/chrome/profiling/allocation_event.h index 7bce90d..c5e23e4 100644 --- a/chrome/profiling/allocation_event.h +++ b/chrome/profiling/allocation_event.h
@@ -6,6 +6,7 @@ #define CHROME_PROFILING_ALLOCATION_EVENT_H_ #include <functional> +#include <map> #include <set> #include "chrome/common/profiling/memlog_stream.h" @@ -50,6 +51,19 @@ } }; + // Implements < for AllocationEvent using everything but the address. + struct MetadataPartialLess { + bool operator()(const AllocationEvent& lhs, + const AllocationEvent& rhs) const { + // Note that we're using pointer compiarisons on the backtrace objects + // since they're atoms and the actual ordering is not important. + return std::tie(lhs.size_, lhs.backtrace_, lhs.context_id_, + lhs.allocator_) < std::tie(rhs.size_, rhs.backtrace_, + rhs.context_id_, + rhs.allocator_); + } + }; + // Implements == for AllocationEvents using address only. This is not a raw // operator because it only implements a comparison on the one field. struct AddressPartialEqual { @@ -59,6 +73,19 @@ } }; + // Implements < for AllocationEvent using everything but the address. + struct MetadataPartialEqual { + bool operator()(const AllocationEvent& lhs, + const AllocationEvent& rhs) const { + // Note that we're using pointer compiarisons on the backtrace objects + // since they're atoms. + return std::tie(lhs.size_, lhs.backtrace_, lhs.context_id_, + lhs.allocator_) == std::tie(rhs.size_, rhs.backtrace_, + rhs.context_id_, + rhs.allocator_); + } + }; + private: AllocatorType allocator_ = AllocatorType::kMalloc; Address address_; @@ -67,9 +94,20 @@ int context_id_ = 0; }; +// Unique set based on addresses of allocations. using AllocationEventSet = std::set<AllocationEvent, AllocationEvent::AddressPartialLess>; +// Maps allocation metadata to allocation counts of that type. In this case, +// the address of the AllocationEvent is unused. +using AllocationCountMap = + std::map<AllocationEvent, int, AllocationEvent::MetadataPartialLess>; + +// Aggregates the allocation events to a count map. The address of the +// allocation event in the returned map will be the address of the first item +// in the set with that metadata. +AllocationCountMap AllocationEventSetToCountMap(const AllocationEventSet& set); + } // namespace profiling #endif // CHROME_PROFILING_ALLOCATION_EVENT_H_
diff --git a/chrome/profiling/allocation_tracker.cc b/chrome/profiling/allocation_tracker.cc index ea527007..7c386aa 100644 --- a/chrome/profiling/allocation_tracker.cc +++ b/chrome/profiling/allocation_tracker.cc
@@ -58,4 +58,8 @@ std::move(complete_callback_)); } +AllocationCountMap AllocationTracker::GetCounts() const { + return AllocationEventSetToCountMap(live_allocs_); +} + } // namespace profiling
diff --git a/chrome/profiling/allocation_tracker.h b/chrome/profiling/allocation_tracker.h index 2078103..cfc61ceb 100644 --- a/chrome/profiling/allocation_tracker.h +++ b/chrome/profiling/allocation_tracker.h
@@ -36,11 +36,22 @@ const AllocationEventSet& live_allocs() const { return live_allocs_; } const ContextMap& context() const { return context_; } + // Returns the aggregated allocation counts currently live. + AllocationCountMap GetCounts() const; + private: CompleteCallback complete_callback_; BacktraceStorage* backtrace_storage_; + // Need to track all live objects. Since the free information doesn't have + // the metadata, we can't keep a map of counts indexed by just the metadata + // (which is all the trace JSON needs), but need to keep an index by address. + // + // This could be a two-level index, where one set of metadata is kept and + // addresses index into that. But a full copy of the metadata is about the + // same size as the internal map node required for this second index, with + // additional complexity. AllocationEventSet live_allocs_; // The context strings are atoms. Since there are O(100's) of these, we do
diff --git a/chrome/profiling/json_exporter.cc b/chrome/profiling/json_exporter.cc index 4395f82f..301abc0 100644 --- a/chrome/profiling/json_exporter.cc +++ b/chrome/profiling/json_exporter.cc
@@ -22,6 +22,9 @@ // Maps strings to integers for the JSON string table. using StringTable = std::map<std::string, size_t>; +constexpr uint32_t kAllocatorCount = + static_cast<uint32_t>(AllocatorType::kCount); + struct BacktraceNode { BacktraceNode(size_t sid, size_t p) : string_id(sid), parent(p) {} @@ -39,31 +42,23 @@ using BacktraceTable = std::map<BacktraceNode, size_t>; -// Used as a map key to uniquify an allocation with a given size and stack. -// Since backtraces are uniquified, this does pointer comparisons on the -// backtrace to give a stable ordering, even if that ordering has no -// intrinsic meaning. -struct UniqueAlloc { - UniqueAlloc(AllocatorType alloc, const Backtrace* bt, size_t sz, int ctx_id) - : allocator(alloc), backtrace(bt), size(sz), context_id(ctx_id) {} - - bool operator<(const UniqueAlloc& other) const { - return std::tie(allocator, backtrace, size, context_id) < - std::tie(other.allocator, other.backtrace, other.size, - other.context_id); - } - - AllocatorType allocator; - const Backtrace* backtrace; - size_t size; - int context_id; -}; - -using UniqueAllocCount = std::map<UniqueAlloc, int>; - // The hardcoded ID for having no context for an allocation. constexpr int kUnknownTypeId = 0; +const char* StringForAllocatorType(uint32_t type) { + switch (static_cast<AllocatorType>(type)) { + case AllocatorType::kMalloc: + return "malloc"; + case AllocatorType::kPartitionAlloc: + return "partition_alloc"; + case AllocatorType::kOilpan: + return "blink_gc"; + default: + NOTREACHED(); + return "unknown"; + } +} + // Writes a dummy process name entry given a PID. When we have more information // on a process it can be filled in here. But for now the tracing tools expect // this entry since everything is associated with a PID. @@ -82,6 +77,64 @@ << "\"tid\": 1, \"args\": {}}"; } +// Writes the top-level allocators section. This section is used by the tracing +// UI to show a small summary for each allocator. It's necessary as a +// placeholder to allow the stack-viewing UI to be shown. +// +// Each array should be the number of allocators long. +void WriteAllocatorsSummary(size_t total_size[], + size_t total_count[], + std::ostream& out) { + out << "\"allocators\":{\n"; + for (uint32_t i = 0; i < kAllocatorCount; i++) { + const char* alloc_type = StringForAllocatorType(i); + + // Overall sizes. + const char kAttrsSizeBody[] = R"( + "%s": { + "attrs": { + "virtual_size": { + "type": "scalar", + "units": "bytes", + "value": "%zx" + }, + "size": { + "type": "scalar", + "units": "bytes", + "value": "%zx" + } + } + },)"; + out << base::StringPrintf(kAttrsSizeBody, alloc_type, total_size[i], + total_size[i]); + + // Allocated objects. + const char kAttrsObjectsBody[] = R"( + "%s/allocated_objects": { + "attrs": { + "shim_allocated_objects_count": { + "type": "scalar", + "units": "objects", + "value": "%zx" + }, + "shim_allocated_objects_size": { + "type": "scalar", + "units": "bytes", + "value": "%zx" + } + } + })"; + out << base::StringPrintf(kAttrsObjectsBody, alloc_type, total_count[i], + total_size[i]); + + // Comma except for the last time. + if (i < kAllocatorCount - 1) + out << ','; + out << "\n"; + } + out << "},\n"; +} + // Writes the dictionary keys to preceed a "dumps" trace argument. void WriteDumpsHeader(int pid, std::ostream& out) { out << "{ \"pid\":" << pid << ","; @@ -127,13 +180,13 @@ // Processes the context information needed for the give set of allocations. // Strings are added for each referenced context and a mapping between // context IDs and string IDs is filled in for each. -void FillContextStrings(UniqueAllocCount alloc_counts, +void FillContextStrings(AllocationCountMap alloc_counts, const std::map<std::string, int>& context_map, StringTable* string_table, std::map<int, size_t>* context_to_string_map) { std::set<int> used_context; for (const auto& alloc : alloc_counts) - used_context.insert(alloc.first.context_id); + used_context.insert(alloc.first.context_id()); if (used_context.find(kUnknownTypeId) != used_context.end()) { // Hard code a string for the unknown context type. @@ -253,12 +306,12 @@ // Writes the number of matching allocations array which looks like: // "counts":[1, 1, 2] -void WriteCounts(const UniqueAllocCount& alloc_counts, std::ostream& out) { +void WriteCounts(const AllocationCountMap& alloc_counts, std::ostream& out) { out << "\"counts\":["; bool first_time = true; for (const auto& cur : alloc_counts) { if (!first_time) - out << ",\n"; + out << ","; else first_time = false; out << cur.second; @@ -268,31 +321,31 @@ // Writes the sizes of each allocation which looks like: // "sizes":[32, 64, 12] -void WriteSizes(const UniqueAllocCount& alloc_counts, std::ostream& out) { +void WriteSizes(const AllocationCountMap& alloc_counts, std::ostream& out) { out << "\"sizes\":["; bool first_time = true; for (const auto& cur : alloc_counts) { if (!first_time) - out << ",\n"; + out << ","; else first_time = false; // Output the total size, which is size * count. - out << cur.first.size * cur.second; + out << cur.first.size() * cur.second; } out << "]"; } // Writes the types array of integers which looks like: // "types":[0, 0, 1] -void WriteTypes(const UniqueAllocCount& alloc_counts, std::ostream& out) { +void WriteTypes(const AllocationCountMap& alloc_counts, std::ostream& out) { out << "\"types\":["; bool first_time = true; for (const auto& cur : alloc_counts) { if (!first_time) - out << ",\n"; + out << ","; else first_time = false; - out << cur.first.context_id; + out << cur.first.context_id(); } out << "]"; } @@ -300,17 +353,17 @@ // Writes the nodes array which indexes for each allocation into the maps nodes // array written above. It looks like: // "nodes":[1, 5, 10] -void WriteAllocatorNodes(const UniqueAllocCount& alloc_counts, +void WriteAllocatorNodes(const AllocationCountMap& alloc_counts, const std::map<const Backtrace*, size_t>& backtraces, std::ostream& out) { out << "\"nodes\":["; bool first_time = true; for (const auto& cur : alloc_counts) { if (!first_time) - out << ",\n"; + out << ","; else first_time = false; - auto found = backtraces.find(cur.first.backtrace); + auto found = backtraces.find(cur.first.backtrace()); out << found->second; } out << "]"; @@ -318,6 +371,9 @@ } // namespace +ExportParams::ExportParams() = default; +ExportParams::~ExportParams() = default; + void ExportAllocationEventSetToJSON( int pid, const ExportParams& params, @@ -353,73 +409,26 @@ out << R"("level_of_detail": "detailed")" << ",\n"; - // Aggregate allocations. Allocations with the same metadata (we don't use - // addresses) get grouped. - UniqueAllocCount alloc_counts; - for (const auto& alloc : *params.set) { - UniqueAlloc unique_alloc(alloc.allocator(), alloc.backtrace(), alloc.size(), - alloc.context_id()); - alloc_counts[unique_alloc]++; - } + // Aggregate stats for each allocator type and filter irrelevant allocations. + size_t total_size[kAllocatorCount] = {0}; + size_t total_count[kAllocatorCount] = {0}; + AllocationCountMap filtered_counts[kAllocatorCount]; + for (const auto& alloc_pair : params.allocs) { + uint32_t allocator_index = + static_cast<uint32_t>(alloc_pair.first.allocator()); + size_t alloc_count = alloc_pair.second; + size_t alloc_size = alloc_pair.first.size(); - size_t total_size = 0; - size_t total_count = 0; - // Filter irrelevant allocations. - for (auto alloc = alloc_counts.begin(); alloc != alloc_counts.end();) { - size_t alloc_count = alloc->second; - size_t alloc_size = alloc->first.size; size_t alloc_total_size = alloc_size * alloc_count; - total_size += alloc_total_size; - total_count += alloc_count; - if (alloc_total_size < params.min_size_threshold && - alloc_count < params.min_count_threshold) { - alloc = alloc_counts.erase(alloc); - } else { - ++alloc; + total_size[allocator_index] += alloc_total_size; + total_count[allocator_index] += alloc_count; + if (alloc_total_size >= params.min_size_threshold || + alloc_count >= params.min_count_threshold) { + filtered_counts[allocator_index].insert(alloc_pair); } } - // Write the top-level allocators section. This section is used by the tracing - // UI to show a small summary for each allocator. It's necessary as a - // placeholder to allow the stack-viewing UI to be shown. - // TODO: Fill in placeholders for "value". https://crbug.com/758434. - const char* allocators_raw = R"( - "allocators": { - "malloc": { - "attrs": { - "virtual_size": { - "type": "scalar", - "units": "bytes", - "value": "%zx" - }, - "size": { - "type": "scalar", - "units": "bytes", - "value": "%zx" - } - } - }, - "malloc/allocated_objects": { - "attrs": { - "shim_allocated_objects_count": { - "type": "scalar", - "units": "objects", - "value": "%zx" - }, - "shim_allocated_objects_size": { - "type": "scalar", - "units": "bytes", - "value": "%zx" - } - } - } - }, - )"; - - std::string allocators = base::StringPrintf( - allocators_raw, total_size, total_size, total_count, total_size); - out << allocators; - + WriteAllocatorsSummary(total_size, total_count, out); WriteHeapsV2Header(out); // Output Heaps_V2 format version. Currently "1" is the only valid value. @@ -430,8 +439,10 @@ // Put all required context strings in the string table and generate a // mapping from allocation context_id to string ID. std::map<int, size_t> context_to_string_map; - FillContextStrings(alloc_counts, *params.context_map, &string_table, - &context_to_string_map); + for (uint32_t i = 0; i < kAllocatorCount; i++) { + FillContextStrings(filtered_counts[i], *params.context_map, &string_table, + &context_to_string_map); + } // Find all backtraces referenced by the set and not filtered. The backtrace // storage will contain more stacks than we want to write out (it will refer @@ -440,8 +451,10 @@ // // The map maps backtrace keys to node IDs (computed below). std::map<const Backtrace*, size_t> backtraces; - for (const auto& alloc : alloc_counts) - backtraces.emplace(alloc.first.backtrace, 0); + for (size_t i = 0; i < kAllocatorCount; i++) { + for (const auto& alloc : filtered_counts[i]) + backtraces.emplace(alloc.first.backtrace(), 0); + } // Write each backtrace, converting the string for the stack entry to string // IDs. The backtrace -> node ID will be filled in at this time. @@ -460,15 +473,25 @@ out << "},\n"; // End of maps section. // Allocators section. - out << "\"allocators\":{\"malloc\":{\n"; - WriteCounts(alloc_counts, out); - out << ",\n"; - WriteSizes(alloc_counts, out); - out << ",\n"; - WriteTypes(alloc_counts, out); - out << ",\n"; - WriteAllocatorNodes(alloc_counts, backtraces, out); - out << "}}\n"; // End of allocators section. + out << "\"allocators\":{\n"; + for (uint32_t i = 0; i < kAllocatorCount; i++) { + out << " \"" << StringForAllocatorType(i) << "\":{\n "; + + WriteCounts(filtered_counts[i], out); + out << ",\n "; + WriteSizes(filtered_counts[i], out); + out << ",\n "; + WriteTypes(filtered_counts[i], out); + out << ",\n "; + WriteAllocatorNodes(filtered_counts[i], backtraces, out); + out << "\n }"; + + // Comma evry time but the last. + if (i < kAllocatorCount - 1) + out << ','; + out << "\n"; + } + out << "}\n"; // End of allocators section. WriteHeapsV2Footer(out);
diff --git a/chrome/profiling/json_exporter.h b/chrome/profiling/json_exporter.h index 737026b0..7e18bbe 100644 --- a/chrome/profiling/json_exporter.h +++ b/chrome/profiling/json_exporter.h
@@ -18,9 +18,15 @@ // Configuration passed to the export functions because they take many // arguments. All parameters must be set. The pointers are not managed by this // class and must outlive it. +// +// Whether something is a pointer or a value is determined by what makes the +// call site nicer without introducing unnecessary copies. struct ExportParams { + ExportParams(); + ~ExportParams(); + // Allocation events to export. - const AllocationEventSet* set = nullptr; + AllocationCountMap allocs; // VM map of all regions in the process. const std::vector<memory_instrumentation::mojom::VmRegionPtr>* maps = nullptr;
diff --git a/chrome/profiling/json_exporter_unittest.cc b/chrome/profiling/json_exporter_unittest.cc index 66a66c3..2ae16dc 100644 --- a/chrome/profiling/json_exporter_unittest.cc +++ b/chrome/profiling/json_exporter_unittest.cc
@@ -10,6 +10,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/process/process.h" +#include "base/strings/string_number_conversions.h" #include "base/values.h" #include "build/build_config.h" #include "chrome/profiling/backtrace_storage.h" @@ -87,7 +88,8 @@ return nullptr; } -int GetStringFromStringTable(const base::Value* strings, const char* text) { +// Looks up a given string id from the string table. Returns -1 if not found. +int GetIdFromStringTable(const base::Value* strings, const char* text) { for (const auto& string : strings->GetList()) { const base::Value* string_id = string.FindKeyOfType("id", base::Value::Type::INTEGER); @@ -100,6 +102,23 @@ return -1; } +// Looks up a given string from the string table. Returns empty string if not +// found. +std::string GetStringFromStringTable(const base::Value* strings, int sid) { + for (const auto& string : strings->GetList()) { + const base::Value* string_id = + string.FindKeyOfType("id", base::Value::Type::INTEGER); + if (string_id->GetInt() == sid) { + const base::Value* string_text = + string.FindKeyOfType("string", base::Value::Type::STRING); + if (!string_text) + return std::string(); + return string_text->GetString(); + } + } + return std::string(); +} + int GetNodeWithNameID(const base::Value* nodes, int sid) { for (const auto& node : nodes->GetList()) { const base::Value* node_id = @@ -146,13 +165,11 @@ TEST(ProfilingJsonExporterTest, TraceHeader) { BacktraceStorage backtrace_storage; - AllocationEventSet events; MemoryMap memory_map; std::map<std::string, int> context_map; std::ostringstream stream; ExportParams params; - params.set = &events; params.context_map = &context_map; params.maps = &memory_map; params.min_size_threshold = kNoSizeThreshold; @@ -164,7 +181,8 @@ base::JSONReader reader(base::JSON_PARSE_RFC); std::unique_ptr<base::Value> root = reader.ReadToValue(stream.str()); ASSERT_EQ(base::JSONReader::JSON_NO_ERROR, reader.error_code()) - << reader.GetErrorMessage(); + << reader.GetErrorMessage() << "\n" + << stream.str(); ASSERT_TRUE(root); const base::Value* process_name = FindEventWithName(*root, "process_name"); @@ -215,7 +233,7 @@ std::ostringstream stream; ExportParams params; - params.set = &events; + params.allocs = AllocationEventSetToCountMap(events); params.context_map = &context_map; params.maps = &memory_map; params.min_size_threshold = kNoSizeThreshold; @@ -277,13 +295,15 @@ AllocationEvent(AllocatorType::kMalloc, Address(0x2), 32, bt2, 0)); events.insert( AllocationEvent(AllocatorType::kMalloc, Address(0x3), 20, bt1, 0)); + events.insert(AllocationEvent(AllocatorType::kPartitionAlloc, Address(0x4), + 20, bt1, 0)); std::ostringstream stream; std::map<std::string, int> context_map; MemoryMap memory_map; ExportParams params; - params.set = &events; + params.allocs = AllocationEventSetToCountMap(events); params.context_map = &context_map; params.maps = &memory_map; params.min_size_threshold = kNoSizeThreshold; @@ -315,11 +335,11 @@ // Validate the strings table. EXPECT_EQ(5u, strings->GetList().size()); - int sid_unknown = GetStringFromStringTable(strings, "[unknown]"); - int sid_1234 = GetStringFromStringTable(strings, "pc:1234"); - int sid_5678 = GetStringFromStringTable(strings, "pc:5678"); - int sid_9012 = GetStringFromStringTable(strings, "pc:9012"); - int sid_9013 = GetStringFromStringTable(strings, "pc:9013"); + int sid_unknown = GetIdFromStringTable(strings, "[unknown]"); + int sid_1234 = GetIdFromStringTable(strings, "pc:1234"); + int sid_5678 = GetIdFromStringTable(strings, "pc:5678"); + int sid_9012 = GetIdFromStringTable(strings, "pc:9012"); + int sid_9013 = GetIdFromStringTable(strings, "pc:9013"); EXPECT_NE(-1, sid_unknown); EXPECT_NE(-1, sid_1234); EXPECT_NE(-1, sid_5678); @@ -346,7 +366,7 @@ EXPECT_TRUE(IsBacktraceInList(nodes, id2, id0)); EXPECT_TRUE(IsBacktraceInList(nodes, id3, id2)); - // Retrieve the allocations and valid their structure. + // Retrieve the allocations and validate their structure. const base::Value* counts = heaps_v2->FindPath({"allocators", "malloc", "counts"}); const base::Value* types = @@ -383,6 +403,22 @@ EXPECT_EQ(0, types->GetList()[node3].GetInt()); EXPECT_EQ(32, sizes->GetList()[node3].GetInt()); EXPECT_EQ(id3, backtraces->GetList()[node3].GetInt()); + + // Validate that the partition alloc one got through. + counts = heaps_v2->FindPath({"allocators", "partition_alloc", "counts"}); + types = heaps_v2->FindPath({"allocators", "partition_alloc", "types"}); + sizes = heaps_v2->FindPath({"allocators", "partition_alloc", "sizes"}); + backtraces = heaps_v2->FindPath({"allocators", "partition_alloc", "nodes"}); + + ASSERT_TRUE(counts); + ASSERT_TRUE(types); + ASSERT_TRUE(sizes); + ASSERT_TRUE(backtraces); + + // There should just be one entry for the partition_alloc allocation. + EXPECT_EQ(1u, counts->GetList().size()); + EXPECT_EQ(1u, types->GetList().size()); + EXPECT_EQ(1u, sizes->GetList().size()); } TEST(ProfilingJsonExporterTest, SimpleWithFilteredAllocations) { @@ -409,9 +445,10 @@ AllocationEvent(AllocatorType::kMalloc, Address(0x3), 1000, bt2, 0)); events.insert( AllocationEvent(AllocatorType::kMalloc, Address(0x4), 1000, bt2, 0)); - for (size_t i = 0; i < kCountThreshold + 1; ++i) + for (size_t i = 0; i < kCountThreshold + 1; ++i) { events.insert( AllocationEvent(AllocatorType::kMalloc, Address(0x5 + i), 1, bt3, 0)); + } // Validate filtering by size and count. std::ostringstream stream; @@ -419,7 +456,7 @@ MemoryMap memory_map; ExportParams params; - params.set = &events; + params.allocs = AllocationEventSetToCountMap(events); params.context_map = &context_map; params.maps = &memory_map; params.min_size_threshold = kSizeThreshold; @@ -448,10 +485,10 @@ // Validate the strings table. EXPECT_EQ(3u, strings->GetList().size()); - int sid_unknown = GetStringFromStringTable(strings, "[unknown]"); - int sid_1234 = GetStringFromStringTable(strings, "pc:1234"); - int sid_5678 = GetStringFromStringTable(strings, "pc:5678"); - int sid_9999 = GetStringFromStringTable(strings, "pc:9999"); + int sid_unknown = GetIdFromStringTable(strings, "[unknown]"); + int sid_1234 = GetIdFromStringTable(strings, "pc:1234"); + int sid_5678 = GetIdFromStringTable(strings, "pc:5678"); + int sid_9999 = GetIdFromStringTable(strings, "pc:9999"); EXPECT_NE(-1, sid_unknown); EXPECT_EQ(-1, sid_1234); // Must be filtered. EXPECT_NE(-1, sid_5678); @@ -495,7 +532,7 @@ std::map<std::string, int> context_map; ExportParams params; - params.set = &events; + params.allocs = AllocationEventSetToCountMap(events); params.context_map = &context_map; params.maps = &memory_maps; params.min_size_threshold = kNoSizeThreshold; @@ -551,7 +588,7 @@ MemoryMap memory_map; ExportParams params; - params.set = &events; + params.allocs = AllocationEventSetToCountMap(events); params.context_map = &context_map; params.maps = &memory_map; params.min_size_threshold = kNoSizeThreshold; @@ -574,4 +611,124 @@ EXPECT_EQ(metadata_dict_copy, *found_metadatas); } +TEST(ProfilingJsonExporterTest, Context) { + BacktraceStorage backtrace_storage; + std::map<std::string, int> context_map; + + std::vector<Address> stack; + stack.push_back(Address(0x1234)); + const Backtrace* bt = backtrace_storage.Insert(std::move(stack)); + + std::string context_str1("Context 1"); + int context_id1 = 1; + context_map[context_str1] = context_id1; + std::string context_str2("Context 2"); + int context_id2 = 2; + context_map[context_str2] = context_id2; + + // Make 4 events, all with identical metadata except context. Two share the + // same context so should get folded, one has unique context, and one has no + // context. + AllocationEventSet events; + events.insert(AllocationEvent(AllocatorType::kPartitionAlloc, Address(0x1), + 16, bt, context_id1)); + events.insert(AllocationEvent(AllocatorType::kPartitionAlloc, Address(0x2), + 16, bt, context_id2)); + events.insert( + AllocationEvent(AllocatorType::kPartitionAlloc, Address(0x3), 16, bt, 0)); + events.insert(AllocationEvent(AllocatorType::kPartitionAlloc, Address(0x4), + 16, bt, context_id1)); + + std::ostringstream stream; + MemoryMap memory_map; + + ExportParams params; + params.allocs = AllocationEventSetToCountMap(events); + params.context_map = &context_map; + params.maps = &memory_map; + params.min_size_threshold = kNoSizeThreshold; + params.min_count_threshold = kNoCountThreshold; + ExportAllocationEventSetToJSON(1234, params, nullptr, stream); + std::string json = stream.str(); + + // JSON should parse. + base::JSONReader reader(base::JSON_PARSE_RFC); + std::unique_ptr<base::Value> root = reader.ReadToValue(stream.str()); + ASSERT_EQ(base::JSONReader::JSON_NO_ERROR, reader.error_code()) + << reader.GetErrorMessage(); + ASSERT_TRUE(root); + + // Retrieve the allocations. + const base::Value* periodic_interval = FindFirstPeriodicInterval(*root); + ASSERT_TRUE(periodic_interval); + const base::Value* heaps_v2 = + periodic_interval->FindPath({"args", "dumps", "heaps_v2"}); + ASSERT_TRUE(heaps_v2); + + const base::Value* counts = + heaps_v2->FindPath({"allocators", "partition_alloc", "counts"}); + ASSERT_TRUE(counts); + const base::Value* types = + heaps_v2->FindPath({"allocators", "partition_alloc", "types"}); + ASSERT_TRUE(types); + + const auto& counts_list = counts->GetList(); + const auto& types_list = types->GetList(); + + // There should be three allocations, two coalesced ones, one with unique + // context, and one with no context. + EXPECT_EQ(3u, counts_list.size()); + EXPECT_EQ(3u, types_list.size()); + + const base::Value* types_map = heaps_v2->FindPath({"maps", "types"}); + ASSERT_TRUE(types_map); + const base::Value* strings = heaps_v2->FindPath({"maps", "strings"}); + ASSERT_TRUE(strings); + + // Reconstruct the map from type id to string. + std::map<int, std::string> type_to_string; + for (const auto& type : types_map->GetList()) { + const base::Value* id = + type.FindKeyOfType("id", base::Value::Type::INTEGER); + ASSERT_TRUE(id); + const base::Value* name_sid = + type.FindKeyOfType("name_sid", base::Value::Type::INTEGER); + ASSERT_TRUE(name_sid); + + type_to_string[id->GetInt()] = + GetStringFromStringTable(strings, name_sid->GetInt()); + } + + // Track the three entries we have down to what we expect. The order is not + // defined so this is relatively complex to do. + bool found_double_context = false; // Allocations sharing the same context. + bool found_single_context = false; // Allocation with unique context. + bool found_no_context = false; // Allocation with no context. + for (size_t i = 0; i < types_list.size(); i++) { + const auto& found = type_to_string.find(types_list[i].GetInt()); + ASSERT_NE(type_to_string.end(), found); + if (found->second == context_str1) { + // Context string matches the one with two allocations. + ASSERT_FALSE(found_double_context); + found_double_context = true; + ASSERT_EQ(2, counts_list[i].GetInt()); + } else if (found->second == context_str2) { + // Context string matches the one with one allocation. + ASSERT_FALSE(found_single_context); + found_single_context = true; + ASSERT_EQ(1, counts_list[i].GetInt()); + } else if (found->second == "[unknown]") { + // Context string for the one with no context. + ASSERT_FALSE(found_no_context); + found_no_context = true; + ASSERT_EQ(1, counts_list[i].GetInt()); + } + } + + // All three types of things should have been found in the loop. + ASSERT_TRUE(found_double_context); + ASSERT_TRUE(found_single_context); + ASSERT_TRUE(found_no_context); +} + } // namespace profiling
diff --git a/chrome/profiling/memlog_connection_manager.cc b/chrome/profiling/memlog_connection_manager.cc index e05b217..161dad4 100644 --- a/chrome/profiling/memlog_connection_manager.cc +++ b/chrome/profiling/memlog_connection_manager.cc
@@ -125,7 +125,7 @@ std::ostringstream oss; ExportParams params; - params.set = &connection->tracker.live_allocs(); + params.allocs = connection->tracker.GetCounts(); params.context_map = &connection->tracker.context(); params.maps = &maps; params.min_size_threshold = kMinSizeThreshold; @@ -179,7 +179,7 @@ Connection* connection = it->second.get(); std::ostringstream oss; ExportParams params; - params.set = &connection->tracker.live_allocs(); + params.allocs = connection->tracker.GetCounts(); params.maps = &maps; params.context_map = &connection->tracker.context(); params.min_size_threshold = kMinSizeThreshold;
diff --git a/chrome/profiling/memlog_stream_parser.cc b/chrome/profiling/memlog_stream_parser.cc index 9e4d466..914846b 100644 --- a/chrome/profiling/memlog_stream_parser.cc +++ b/chrome/profiling/memlog_stream_parser.cc
@@ -161,10 +161,13 @@ if (!PeekBytes(sizeof(AllocPacket), &alloc_packet)) return READ_NO_DATA; - std::vector<Address> stack; + // Validate data. if (alloc_packet.stack_len > kMaxStackEntries || - alloc_packet.context_byte_len > kMaxContextLen) - return READ_ERROR; // Prevent overflow on corrupted or malicious data. + alloc_packet.context_byte_len > kMaxContextLen || + alloc_packet.allocator >= AllocatorType::kCount) + return READ_ERROR; + + std::vector<Address> stack; stack.resize(alloc_packet.stack_len); size_t stack_byte_size = sizeof(Address) * alloc_packet.stack_len;
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index e15627f7..81ddff0 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -244,6 +244,8 @@ PasswordFormInPageNavigation, }; +enum class FieldChangeSource { USER, AUTOFILL, USER_AUTOFILL }; + } // namespace namespace autofill { @@ -428,14 +430,37 @@ autofill_agent_->FillPasswordSuggestion(username, password); } - void SimulateUsernameChange(const std::string& username) { + void SimulateUsernameTyping(const std::string& username) { SimulateUserInputChangeForElement(&username_element_, username); } - void SimulatePasswordChange(const std::string& password) { + void SimulatePasswordTyping(const std::string& password) { SimulateUserInputChangeForElement(&password_element_, password); } + void SimulateUsernameFieldAutofill(const std::string& text) { + // Simulate set |username_element_| in focus. + static_cast<content::RenderFrameObserver*>(autofill_agent_) + ->FocusedNodeChanged(username_element_); + // Fill focused element (i.e. |username_element_|). + autofill_agent_->FillFieldWithValue(ASCIIToUTF16(text)); + } + + void SimulateUsernameFieldChange(FieldChangeSource change_source) { + switch (change_source) { + case FieldChangeSource::USER: + SimulateUsernameTyping("Alice"); + break; + case FieldChangeSource::AUTOFILL: + SimulateUsernameFieldAutofill("Alice"); + break; + case FieldChangeSource::USER_AUTOFILL: + SimulateUsernameTyping("A"); + SimulateUsernameFieldAutofill("Alice"); + break; + } + } + void CheckTextFieldsStateForElements(const WebInputElement& username_element, const std::string& username, bool username_autofilled, @@ -878,7 +903,7 @@ SimulateOnFillPasswordForm(fill_data_); // Simulate the user changing the username to some unknown username. - SimulateUsernameChange("alicia"); + SimulateUsernameTyping("alicia"); // The password should not have been cleared. CheckTextFieldsDOMState("alicia", false, kAlicePassword, true); @@ -894,7 +919,7 @@ // No auto-fill should have taken place. CheckTextFieldsState(std::string(), false, std::string(), false); - SimulateUsernameChange(kAliceUsername); + SimulateUsernameTyping(kAliceUsername); // Change focus in between to make sure blur events don't trigger filling. SetFocused(password_element_); SetFocused(username_element_); @@ -1167,7 +1192,7 @@ // Simulate the user entering the first letter of their username and selecting // the matching autofill from the dropdown. - SimulateUsernameChange("a"); + SimulateUsernameTyping("a"); // Since the username element has focus, blur event will be not triggered. base::Erase(event_checkers, base::ASCIIToUTF16("username_blur_event")); SimulateSuggestionChoice(username_element_); @@ -1586,7 +1611,7 @@ // Now simulate a user typing in an unrecognized username and then // clicking on the username element. This should also produce a message with // all the usernames. - SimulateUsernameChange("baz"); + SimulateUsernameTyping("baz"); static_cast<PageClickListener*>(autofill_agent_) ->FormControlElementClicked(username_element_, true); CheckSuggestions("baz", true); @@ -1677,8 +1702,8 @@ // typed by the user. TEST_F(PasswordAutofillAgentTest, RememberLastNonEmptyUsernameAndPasswordOnSubmit_ScriptCleared) { - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the username and the password value was cleared by the // site's JavaScript before submit. @@ -1698,12 +1723,12 @@ // remembered. TEST_F(PasswordAutofillAgentTest, RememberLastNonEmptyUsernameAndPasswordOnSubmit_UserCleared) { - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the user actually cleared the username and password again. - SimulateUsernameChange(""); - SimulatePasswordChange(""); + SimulateUsernameTyping(""); + SimulatePasswordTyping(""); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) ->WillSubmitForm(username_element_.Form()); @@ -1725,8 +1750,8 @@ LoadHTML(kNewPasswordFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the username and the password value was cleared by // the site's JavaScript before submit. @@ -1745,7 +1770,7 @@ TEST_F(PasswordAutofillAgentTest, NoopEditingDoesNotOverwriteManuallyEditedPassword) { fill_data_.wait_for_username = true; - SimulateUsernameChange(kAliceUsername); + SimulateUsernameTyping(kAliceUsername); SimulateOnFillPasswordForm(fill_data_); SimulateSuggestionChoice(username_element_); const std::string old_username(username_element_.Value().Utf8()); @@ -1753,7 +1778,7 @@ const std::string new_password(old_password + "modify"); // The user changes the password. - SimulatePasswordChange(new_password); + SimulatePasswordTyping(new_password); // Change focus in between to make sure blur events don't trigger filling. SetFocused(password_element_); @@ -1771,8 +1796,8 @@ // typed by the user. TEST_F(PasswordAutofillAgentTest, RememberLastTypedUsernameAndPasswordOnSubmit_ScriptChanged) { - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the username and the password value was changed by the // site's JavaScript before submit. @@ -1789,8 +1814,8 @@ } TEST_F(PasswordAutofillAgentTest, RememberFieldPropertiesOnSubmit) { - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the username and the password value was changed by the // site's JavaScript before submit. @@ -1816,8 +1841,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); std::string hide_elements = "var password = document.getElementById('password');" @@ -1842,8 +1867,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); @@ -1897,8 +1922,8 @@ RememberLastTypedAfterAutofilledUsernameAndPasswordOnSubmit_ScriptChanged) { SimulateOnFillPasswordForm(fill_data_); - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that the username and the password value was changed by the // site's JavaScript before submit. @@ -1918,10 +1943,10 @@ // PasswordAutofillAgent should remember the username that was autofilled, // not last typed. TEST_F(PasswordAutofillAgentTest, RememberAutofilledUsername) { - SimulateUsernameChange("Te"); + SimulateUsernameTyping("Te"); // Simulate that the username was changed by autofilling. username_element_.SetValue(WebString("temp")); - SimulatePasswordChange("random"); + SimulatePasswordTyping("random"); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) ->WillSendSubmitEvent(username_element_.Form()); @@ -2105,9 +2130,9 @@ LoadHTML(kFormHTMLWithTwoTextFields); UpdateUsernameAndPasswordElements(); WebInputElement email_element = GetInputElementByID(kEmailName); - SimulateUsernameChange("temp"); + SimulateUsernameTyping("temp"); SimulateUserInputChangeForElement(&email_element, "temp@google.com"); - SimulatePasswordChange("random"); + SimulatePasswordTyping("random"); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) ->WillSendSubmitEvent(username_element_.Form()); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) @@ -2124,9 +2149,9 @@ LoadHTML(kFormHTMLWithTwoTextFields); UpdateUsernameAndPasswordElements(); WebInputElement email_element = GetInputElementByID(kEmailName); - SimulateUsernameChange("temp"); + SimulateUsernameTyping("temp"); SimulateUserInputChangeForElement(&email_element, "temp@google.com"); - SimulatePasswordChange("random"); + SimulatePasswordTyping("random"); // Find FormData for visible password form. WebFormElement form_element = username_element_.Form(); FormData form_data; @@ -2168,8 +2193,8 @@ // field to readonly state before submit. PasswordAutofillAgent can correctly // process readonly password field. This test models behaviour of gmail.com. TEST_F(PasswordAutofillAgentTest, ReadonlyPasswordFieldOnSubmit) { - SimulateUsernameChange("temp"); - SimulatePasswordChange("random"); + SimulateUsernameTyping("temp"); + SimulatePasswordTyping("random"); // Simulate that JavaScript makes password field readonly. SetElementReadOnly(password_element_, true); @@ -2190,8 +2215,8 @@ SetAccountCreationFormsDetectedMessage(password_generation_, GetMainFrame()->GetDocument(), 0, 2); - SimulateUsernameChange("NewGuy"); - SimulatePasswordChange("NewPassword"); + SimulateUsernameTyping("NewGuy"); + SimulatePasswordTyping("NewPassword"); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) ->WillSendSubmitEvent(username_element_.Form()); static_cast<content::RenderFrameObserver*>(password_autofill_agent_) @@ -2381,8 +2406,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); std::string hide_elements = "var password = document.getElementById('password');" @@ -2403,8 +2428,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); @@ -2427,8 +2452,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); @@ -2451,8 +2476,8 @@ WebString::FromUTF8("captcha")); ASSERT_FALSE(captcha_element.IsNull()); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); // Simulate captcha element show up right before AJAX completed. std::string show_captcha = @@ -2479,8 +2504,8 @@ WebString::FromUTF8("captcha")); ASSERT_FALSE(captcha_element.IsNull()); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); @@ -2515,8 +2540,8 @@ WebString::FromUTF8("captcha")); ASSERT_FALSE(captcha_element.IsNull()); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); // Simulate captcha element show up right before AJAX completed. captcha_element.SetAttribute("style", "display:inline;"); @@ -2545,8 +2570,8 @@ WebString::FromUTF8("captcha")); ASSERT_FALSE(captcha_element.IsNull()); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); @@ -2758,38 +2783,44 @@ CheckSuggestions(std::string(), false); } +// Tests that password manager sees both autofill assisted and user entered +// data on saving that is triggered by AJAX succeeded. TEST_F(PasswordAutofillAgentTest, - UsernameChangedAfterPasswordInput_InPageNavigation) { - LoadHTML(kNoFormHTML); - UpdateUsernameAndPasswordElements(); + UsernameChangedAfterPasswordInput_AJAXSucceeded) { + for (auto change_source : + {FieldChangeSource::USER, FieldChangeSource::AUTOFILL, + FieldChangeSource::USER_AUTOFILL}) { + LoadHTML(kNoFormHTML); + UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); - SimulateUsernameChange("Alice"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); + SimulateUsernameFieldChange(change_source); - // Hide form elements to simulate successful login. - std::string hide_elements = - "var password = document.getElementById('password');" - "password.style = 'display:none';" - "var username = document.getElementById('username');" - "username.style = 'display:none';"; - ExecuteJavaScriptForTests(hide_elements.c_str()); + // Hide form elements to simulate successful login. + std::string hide_elements = + "var password = document.getElementById('password');" + "password.style = 'display:none';" + "var username = document.getElementById('username');" + "username.style = 'display:none';"; + ExecuteJavaScriptForTests(hide_elements.c_str()); - password_autofill_agent_->AJAXSucceeded(); + password_autofill_agent_->AJAXSucceeded(); - ExpectInPageNavigationWithUsernameAndPasswords( - "Alice", "mypassword", "", - PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED); + ExpectInPageNavigationWithUsernameAndPasswords( + "Alice", "mypassword", "", + PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED); + } } TEST_F(PasswordAutofillAgentTest, - UsernameChangedAfterPasswordInput_InPageNavigation_2) { + UsernameChangedAfterPasswordInput_AJAXSucceeded_2) { LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); - SimulateUsernameChange("Alice"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); + SimulateUsernameTyping("Alice"); password_autofill_agent_->AJAXSucceeded(); @@ -2807,18 +2838,26 @@ PasswordForm::SubmissionIndicatorEvent::DOM_MUTATION_AFTER_XHR); } +// Tests that password manager sees both autofill assisted and user entered +// data on saving that is triggered by form submission. TEST_F(PasswordAutofillAgentTest, UsernameChangedAfterPasswordInput_FormSubmitted) { - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); - SimulateUsernameChange("Alice"); + for (auto change_source : + {FieldChangeSource::USER, FieldChangeSource::AUTOFILL, + FieldChangeSource::USER_AUTOFILL}) { + LoadHTML(kFormHTML); + UpdateUsernameAndPasswordElements(); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); + SimulateUsernameFieldChange(change_source); - static_cast<content::RenderFrameObserver*>(password_autofill_agent_) - ->WillSendSubmitEvent(username_element_.Form()); - static_cast<content::RenderFrameObserver*>(password_autofill_agent_) - ->WillSubmitForm(username_element_.Form()); + static_cast<content::RenderFrameObserver*>(password_autofill_agent_) + ->WillSendSubmitEvent(username_element_.Form()); + static_cast<content::RenderFrameObserver*>(password_autofill_agent_) + ->WillSubmitForm(username_element_.Form()); - ExpectFormSubmittedWithUsernameAndPasswords("Alice", "mypassword", ""); + ExpectFormSubmittedWithUsernameAndPasswords("Alice", "mypassword", ""); + } } // Tests that a suggestion dropdown is shown on a password field even if a @@ -2955,7 +2994,7 @@ // username. TEST_F(PasswordAutofillAgentTest, InPageNavigationSubmissionUsernameIsEmpty) { username_element_.SetValue(WebString()); - SimulatePasswordChange("random"); + SimulatePasswordTyping("random"); // Simulate that JavaScript removes the submitted form from DOM. That means // that a submission was successful. @@ -2984,7 +3023,7 @@ EXPECT_EQ(1, fake_driver_.called_check_safe_browsing_reputation_cnt()); // Subsequent editing will not trigger CheckSafeBrowsingReputation. - SimulatePasswordChange("modify"); + SimulatePasswordTyping("modify"); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, fake_driver_.called_check_safe_browsing_reputation_cnt()); SimulateElementClick(kUsernameName); @@ -3017,8 +3056,8 @@ LoadHTML(kNoFormHTML); UpdateUsernameAndPasswordElements(); - SimulateUsernameChange("Bob"); - SimulatePasswordChange("mypassword"); + SimulateUsernameTyping("Bob"); + SimulatePasswordTyping("mypassword"); password_autofill_agent_->AJAXSucceeded(); base::RunLoop().RunUntilIdle(); @@ -3034,12 +3073,12 @@ TEST_F(PasswordAutofillAgentTest, ManualFallbackForSaving) { // The users enters a username. No password - no fallback. - SimulateUsernameChange(kUsernameName); + SimulateUsernameTyping(kUsernameName); EXPECT_EQ(0, fake_driver_.called_show_manual_fallback_for_saving_count()); // The user enters a password. - SimulatePasswordChange(kPasswordName); - // SimulateUsernameChange/SimulatePasswordChange calls + SimulatePasswordTyping(kPasswordName); + // SimulateUsernameTyping/SimulatePasswordTyping calls // PasswordAutofillAgent::UpdateStateForTextChange only once. EXPECT_EQ(1, fake_driver_.called_show_manual_fallback_for_saving_count()); @@ -3053,7 +3092,7 @@ EXPECT_EQ(3, fake_driver_.called_show_manual_fallback_for_saving_count()); // Remove username value. - SimulateUsernameChange(""); + SimulateUsernameTyping(""); EXPECT_EQ(4, fake_driver_.called_show_manual_fallback_for_saving_count()); // Change the password. Despite of empty username the fallback is still @@ -3063,7 +3102,7 @@ EXPECT_EQ(5, fake_driver_.called_show_manual_fallback_for_saving_count()); // Remove password value. The fallback should be disabled. - SimulatePasswordChange(""); + SimulatePasswordTyping(""); EXPECT_EQ(0, fake_driver_.called_show_manual_fallback_for_saving_count()); // The user enters new password. Show the fallback again. @@ -3077,13 +3116,13 @@ UpdateUsernameAndPasswordElements(); // No password to save yet - no fallback. - SimulateUsernameChange(kUsernameName); + SimulateUsernameTyping(kUsernameName); EXPECT_EQ(0, fake_driver_.called_show_manual_fallback_for_saving_count()); // The user enters in the current password field. The fallback should be // available to save the entered value. - SimulatePasswordChange(kPasswordName); - // SimulateUsernameChange/SimulatePasswordChange calls + SimulatePasswordTyping(kPasswordName); + // SimulateUsernameTyping/SimulatePasswordTyping calls // PasswordAutofillAgent::UpdateStateForTextChange only once. EXPECT_EQ(1, fake_driver_.called_show_manual_fallback_for_saving_count()); @@ -3103,7 +3142,7 @@ EXPECT_EQ(3, fake_driver_.called_show_manual_fallback_for_saving_count()); // Clear all password fields. The fallback should be disabled. - SimulatePasswordChange(""); + SimulatePasswordTyping(""); SimulateUserInputChangeForElement(&new_password, ""); SimulateUserInputChangeForElement(&confirmation_password, ""); EXPECT_EQ(0, fake_driver_.called_show_manual_fallback_for_saving_count());
diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 3bfaf973..983a097 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc
@@ -7,6 +7,7 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "chrome/common/client_hints.mojom.h" +#include "chrome/common/client_hints/client_hints.h" #include "chrome/common/render_messages.h" #include "chrome/common/ssl_insecure_content.h" #include "components/content_settings/core/common/content_settings.h" @@ -493,44 +494,8 @@ if (!content_setting_rules_) return; - if (!content::IsOriginSecure(url)) - return; - - const GURL origin = GURL(url).GetOrigin(); - - for (const auto& rule : content_setting_rules_->client_hints_rules) { - // Look for an exact match since persisted client hints are disabled by - // default, and enabled only on per-host basis. - if (rule.primary_pattern == ContentSettingsPattern::Wildcard() || - !rule.primary_pattern.Matches(origin)) { - continue; - } - - // Found an exact match. - DCHECK(ContentSettingsPattern::Wildcard() == rule.secondary_pattern); - DCHECK(rule.setting_value->is_dict()); - const base::Value* expiration_time = - rule.setting_value->FindPath({"expiration_time"}); - DCHECK(expiration_time->is_double()); - - if (base::Time::Now().ToDoubleT() > expiration_time->GetDouble()) { - // The client hint is expired. - return; - } - - const base::Value* list_value = - rule.setting_value->FindPath({"client_hints"}); - DCHECK(list_value->is_list()); - const base::Value::ListStorage& client_hints_list = list_value->GetList(); - for (const auto& client_hint : client_hints_list) { - DCHECK(client_hint.is_int()); - client_hints->SetIsEnabled( - static_cast<blink::mojom::WebClientHintsType>(client_hint.GetInt()), - true); - } - // Match found for |url| and client hints have been set. - return; - } + client_hints::GetAllowedClientHintsFromSource( + url, content_setting_rules_->client_hints_rules, client_hints); } void ContentSettingsObserver::DidNotAllowPlugins() {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index a012e8b..a7f8160e 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1276,7 +1276,6 @@ "../browser/fast_shutdown_browsertest.cc", "../browser/favicon/content_favicon_driver_browsertest.cc", "../browser/first_run/first_run_browsertest.cc", - "../browser/first_run/try_chrome_dialog_browsertest.cc", "../browser/gcm/fake_gcm_profile_service.cc", "../browser/gcm/fake_gcm_profile_service.h", "../browser/geolocation/access_token_store_browsertest.cc", @@ -1556,6 +1555,7 @@ "../browser/ui/views/chrome_cleaner_dialog_browsertest_win.cc", "../browser/ui/views/extensions/chooser_dialog_view_browsertest.cc", "../browser/ui/views/hung_renderer_view_browsertest.cc", + "../browser/ui/views/try_chrome_dialog_browsertest.cc", "../browser/ui/webui/bookmarks_ui_browsertest.cc", "../browser/ui/webui/chrome_url_data_manager_browsertest.cc", "../browser/ui/webui/chromeos/bluetooth_pairing_ui_browsertest-inl.h", @@ -2165,6 +2165,7 @@ "../browser/ui/views/session_crashed_bubble_view_browsertest.cc", "../browser/ui/views/task_manager_view_browsertest.cc", "../browser/ui/views/toolbar/browser_actions_container_browsertest.cc", + "../browser/ui/views/translate/translate_bubble_test_utils_views.cc", "../browser/ui/views/translate/translate_bubble_view_browsertest.cc", "../browser/ui/views/translate/translate_language_browsertest.cc", "../browser/ui/views/web_dialog_view_browsertest.cc", @@ -3851,6 +3852,7 @@ # TODO(crbug.com/646627): # Move media_router_ui_service_factory_unittest.cc to chrome/browser/ui. "../browser/media/router/media_router_ui_service_factory_unittest.cc", + "../browser/media/router/mojo/extension_media_route_provider_proxy_unittest.cc", "../browser/media/router/mojo/media_route_controller_unittest.cc", "../browser/media/router/mojo/media_router_desktop_unittest.cc", "../browser/media/router/mojo/media_router_mojo_impl_unittest.cc", @@ -4489,7 +4491,7 @@ "../browser/printing/print_preview_test.h", "../browser/printing/print_view_manager_unittest.cc", "../browser/ui/webui/print_preview/extension_printer_handler_unittest.cc", - "../browser/ui/webui/print_preview/print_preview_handler_win_unittest.cc", + "../browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc", "../browser/ui/webui/print_preview/print_preview_ui_unittest.cc", "../browser/ui/webui/print_preview/printer_capabilities_unittest.cc", "../common/cloud_print/cloud_print_helpers_unittest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java index 4184339..57d3c62b 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java
@@ -12,8 +12,7 @@ import android.os.Build; import android.os.PowerManager; -import junit.framework.Assert; -import junit.framework.AssertionFailedError; +import org.junit.Assert; import org.chromium.base.ActivityState; import org.chromium.base.ApplicationState; @@ -65,7 +64,7 @@ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { try { finishAllChromeTasks(context); - } catch (AssertionFailedError exception) { + } catch (AssertionError exception) { } } }
diff --git a/chrome/test/data/local_ntp/voice_speech_browsertest.js b/chrome/test/data/local_ntp/voice_speech_browsertest.js index 509c447..59c4d164 100644 --- a/chrome/test/data/local_ntp/voice_speech_browsertest.js +++ b/chrome/test/data/local_ntp/voice_speech_browsertest.js
@@ -222,7 +222,7 @@ assertEquals(speech.State_.STARTED, speech.currentState_); assertEquals(1, test.speech.recognitionActiveCount); assertEquals(1, test.speech.viewActiveCount); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertTrue(test.speech.clock.isTimeoutSet(speech.idleTimer_)); assertFalse(test.speech.clock.isTimeoutSet(speech.errorTimer_)); }; @@ -238,7 +238,7 @@ assertEquals(speech.State_.STARTED, speech.currentState_); assertEquals(1, test.speech.recognitionActiveCount); assertEquals(1, test.speech.viewActiveCount); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertTrue(test.speech.clock.isTimeoutSet(speech.idleTimer_)); assertFalse(test.speech.clock.isTimeoutSet(speech.errorTimer_)); @@ -275,7 +275,7 @@ speech.recognition_.onaudiostart(null); assertTrue('ready' in test.speech.viewState); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertEquals(1, test.speech.recognitionActiveCount); assertFalse(elementIsVisible($(test.speech.FAKEBOX_MICROPHONE_ID))); }; @@ -292,7 +292,7 @@ speech.recognition_.onspeechstart(null); assertTrue('receiving' in test.speech.viewState); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertEquals(1, test.speech.recognitionActiveCount); assertFalse(elementIsVisible($(test.speech.FAKEBOX_MICROPHONE_ID))); }; @@ -315,7 +315,7 @@ speech.recognition_.onspeechstart(null); speech.recognition_.onresult(responseEvent); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertEquals(highConfidenceText, test.speech.viewState.final); assertEquals(viewText, test.speech.viewState.interim); assertEquals(highConfidenceText, speech.finalResult_); @@ -374,7 +374,7 @@ // The user interrupts speech. speech.stop(); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals('', speech.interimResult_); assertEquals('', speech.finalResult_); assertEquals(0, test.speech.recognitionActiveCount); @@ -383,7 +383,7 @@ test.speech.createInterimResponse('result should', 'be ignored'); speech.recognition_.onresult(responseEvent); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals('', speech.interimResult_); assertEquals('', speech.finalResult_); assertEquals(0, test.speech.recognitionActiveCount); @@ -414,7 +414,7 @@ speech.start(); speech.recognition_.onerror({error: 'some-error'}); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals(1, test.speech.recognitionActiveCount); assertEquals(1, test.speech.viewActiveCount); assertEquals(RecognitionError.OTHER, test.speech.viewState.error); @@ -438,7 +438,7 @@ speech.recognition_.onaudiostart(null); speech.recognition_.onend(null); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals(RecognitionError.NO_SPEECH, test.speech.viewState.error); test.speech.clock.advanceTime(7999); @@ -490,7 +490,7 @@ // Stop. speech.recognition_.onend(null); assertRecognitionHandlers(true); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals(RecognitionError.NO_SPEECH, test.speech.viewState.error); test.speech.clock.advanceTime(7999); @@ -519,11 +519,11 @@ test.speech.initSpeech(); speech.start(); assertEquals(speech.State_.STARTED, speech.currentState_); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.recognition_.onaudiostart(null); assertEquals(speech.State_.AUDIO_RECEIVED, speech.currentState_); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.stop(); assertEquals(speech.State_.READY, speech.currentState_); @@ -531,7 +531,7 @@ speech.start(); assertEquals(speech.State_.STARTED, speech.currentState_); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.stop(); assertEquals(speech.State_.READY, speech.currentState_); @@ -554,14 +554,14 @@ assertEquals(speech.State_.STARTED, speech.currentState_); speech.recognition_.onaudiostart(null); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.onKeyDown(stopShortcut); assertEquals(speech.State_.READY, speech.currentState_); test.speech.validateInactive(); speech.onKeyDown(startShortcut); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertEquals(speech.State_.STARTED, speech.currentState_); speech.onKeyDown(stopShortcut); @@ -635,10 +635,10 @@ const ctrlShiftPeriod = new KeyboardEvent( 'test', {ctrlKey: true, code: 'Period', shiftKey: true}); speech.onKeyDown(ctrlShiftPeriod); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.onKeyDown(ctrlShiftPeriod); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); }; @@ -671,10 +671,10 @@ // Set a Mac user agent. isUserAgentMac = true; speech.onKeyDown(cmdShiftPeriod); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); speech.onKeyDown(cmdShiftPeriod); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); }; @@ -707,7 +707,7 @@ speech.onClick_( /*submitQuery=*/false, /*shouldRetry=*/true, /*navigatingAway=*/false); - assertTrue(speech.isRecognizing_()); + assertTrue(speech.isRecognizing()); assertEquals(speech.State_.STARTED, speech.currentState_); }; @@ -739,7 +739,7 @@ speech.recognition_.onspeechstart(null); speech.recognition_.onnomatch(null); - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals(1, test.speech.recognitionActiveCount); assertEquals(1, test.speech.viewActiveCount); assertEquals(RecognitionError.NO_MATCH, test.speech.viewState.error); @@ -880,7 +880,7 @@ * Validates that speech is currently inactive and ready to start recognition. */ test.speech.validateInactive = function() { - assertFalse(speech.isRecognizing_()); + assertFalse(speech.isRecognizing()); assertEquals(0, test.speech.recognitionActiveCount); assertEquals(0, test.speech.viewActiveCount); assertEquals('', speech.interimResult_);
diff --git a/chrome/test/data/local_ntp/voice_text_browsertest.js b/chrome/test/data/local_ntp/voice_text_browsertest.js index 71c9b15..a4cd8fc 100644 --- a/chrome/test/data/local_ntp/voice_text_browsertest.js +++ b/chrome/test/data/local_ntp/voice_text_browsertest.js
@@ -176,10 +176,13 @@ /** - * Test showing the listening message when the ready message is shown. + * Test showing the listening message when the ready message is shown, + * and results have not yet been received. */ test.text.testListeningMessageWhenReady = function() { text.interim_.textContent = 'Ready'; + test.text.stubs.replace(speech, 'isRecognizing', () => true); + test.text.stubs.replace(speech, 'hasReceivedResults', () => false); test.text.clock.setTime(1); text.startListeningMessageAnimation_(); @@ -197,10 +200,13 @@ /** - * Test not showing the listening message when the ready message is not shown. + * Test not showing the listening message when the ready message is shown, + * but results were already received. */ -test.text.testListeningMessageWhenNotReady = function() { - text.interim_.textContent = 'some text'; +test.text.testListeningMessageWhenReadyButResultsAlreadyReceived = function() { + text.interim_.textContent = 'Ready'; + test.text.stubs.replace(speech, 'isRecognizing', () => true); + test.text.stubs.replace(speech, 'hasReceivedResults', () => true); test.text.clock.setTime(1); text.startListeningMessageAnimation_(); @@ -211,7 +217,32 @@ test.text.clock.advanceTime(2000); test.text.clock.pendingTimeouts.shift().callback(); - assertEquals('some text', text.interim_.textContent); + // The message was *not* changed to "Listening". + assertEquals('Ready', text.interim_.textContent); + assertEquals('', text.final_.textContent); + assertEquals(0, test.text.clock.pendingTimeouts.length); +}; + + +/** + * Test showing the listening message when the ready message is not shown, + * and results have not yet been received. + */ +test.text.testListeningMessageWhenNotReady = function() { + text.interim_.textContent = 'some text'; + test.text.stubs.replace(speech, 'isRecognizing', () => true); + test.text.stubs.replace(speech, 'hasReceivedResults', () => false); + + test.text.clock.setTime(1); + text.startListeningMessageAnimation_(); + + assertEquals(1, test.text.clock.pendingTimeouts.length); + assertEquals(2001, test.text.clock.pendingTimeouts[0].activationTime); + + test.text.clock.advanceTime(2000); + test.text.clock.pendingTimeouts.shift().callback(); + + assertEquals('Listening', text.interim_.textContent); assertEquals('', text.final_.textContent); assertEquals(0, test.text.clock.pendingTimeouts.length); }; @@ -219,7 +250,7 @@ /** * Test not showing the listening message when the ready message is spoken. */ -test.text.testListeningMessageWhenNotReady = function() { +test.text.testListeningMessageWhenReadySpoken = function() { // Show the "Ready" message. text.interim_.textContent = 'Ready'; assertEquals('', text.final_.textContent);
diff --git a/chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js b/chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js index bffdea1..0166228 100644 --- a/chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js +++ b/chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js
@@ -94,6 +94,14 @@ assertEquals( '-1', getFolderNode('2').$.container.getAttribute('tabindex')); + store.data.search.term = 'asdf'; + + // The selected folder is focus enabled even with a search term. + assertEquals( + '0', getFolderNode('1').$.container.getAttribute('tabindex')); + + store.data.search.term = ''; + // Give keyboard focus to the first item. getFolderNode('1').$.container.focus();
diff --git a/chromecast/base/BUILD.gn b/chromecast/base/BUILD.gn index 20a21739..81b26a6 100644 --- a/chromecast/base/BUILD.gn +++ b/chromecast/base/BUILD.gn
@@ -146,10 +146,12 @@ "process_utils_unittest.cc", "serializers_unittest.cc", "system_time_change_notifier_unittest.cc", + "thread_health_checker_unittest.cc", ] deps = [ ":test_support", + ":thread_health_checker", "//base/test:run_all_unittests", "//base/test:test_support", "//testing/gmock", @@ -211,6 +213,17 @@ } } +source_set("thread_health_checker") { + sources = [ + "thread_health_checker.cc", + "thread_health_checker.h", + ] + deps = [ + ":base", + "//base", + ] +} + process_version("cast_version") { template_file = "version.h.in" output = "$target_gen_dir/version.h"
diff --git a/chromecast/base/thread_health_checker.cc b/chromecast/base/thread_health_checker.cc new file mode 100644 index 0000000..b5f0259 --- /dev/null +++ b/chromecast/base/thread_health_checker.cc
@@ -0,0 +1,112 @@ +// 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 "chromecast/base/thread_health_checker.h" + +#include <memory> +#include <string> + +#include "base/memory/ptr_util.h" +#include "base/memory/ref_counted.h" +#include "base/single_thread_task_runner.h" +#include "base/task_runner.h" +#include "base/threading/thread_checker.h" +#include "base/timer/timer.h" +#include "chromecast/base/bind_to_task_runner.h" + +namespace chromecast { + +ThreadHealthChecker::Internal::Internal( + scoped_refptr<base::TaskRunner> patient_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner, + base::TimeDelta interval, + base::TimeDelta timeout, + base::RepeatingClosure on_failure) + : patient_task_runner_(std::move(patient_task_runner)), + doctor_task_runner_(std::move(doctor_task_runner)), + interval_(interval), + timeout_(timeout), + on_failure_(std::move(on_failure)) { + DCHECK(patient_task_runner_); + DCHECK(doctor_task_runner_); +} + +ThreadHealthChecker::Internal::~Internal() {} + +void ThreadHealthChecker::Internal::StartHealthCheck() { + DCHECK(doctor_task_runner_->BelongsToCurrentThread()); + DETACH_FROM_THREAD(thread_checker_); + ok_timer_ = base::MakeUnique<base::OneShotTimer>(); + failure_timer_ = base::MakeUnique<base::OneShotTimer>(); + ScheduleHealthCheck(); +} + +void ThreadHealthChecker::Internal::StopHealthCheck() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK(ok_timer_); + DCHECK(failure_timer_); + ok_timer_->Stop(); + failure_timer_->Stop(); +} + +void ThreadHealthChecker::Internal::ScheduleHealthCheck() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + ok_timer_->Start(FROM_HERE, interval_, this, + &ThreadHealthChecker::Internal::CheckThreadHealth); +} + +void ThreadHealthChecker::Internal::CheckThreadHealth() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK(!failure_timer_->IsRunning()); + patient_task_runner_->PostTask( + FROM_HERE, BindToCurrentThread(base::BindOnce( + &ThreadHealthChecker::Internal::ThreadOk, this))); + failure_timer_->Start(FROM_HERE, timeout_, this, + &ThreadHealthChecker::Internal::ThreadTimeout); +} + +void ThreadHealthChecker::Internal::ThreadOk() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + failure_timer_->Stop(); + ScheduleHealthCheck(); +} + +void ThreadHealthChecker::Internal::ThreadTimeout() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + on_failure_.Run(); + ScheduleHealthCheck(); +} + +// The public ThreadHealthChecker owns a ref-counted reference to an Internal +// object which does the heavy lifting. +ThreadHealthChecker::ThreadHealthChecker( + scoped_refptr<base::TaskRunner> patient_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner, + base::TimeDelta interval, + base::TimeDelta timeout, + base::RepeatingClosure on_failure) + : doctor_task_runner_(doctor_task_runner), + internal_(base::MakeRefCounted<ThreadHealthChecker::Internal>( + patient_task_runner, + doctor_task_runner, + interval, + timeout, + std::move(on_failure))) { + doctor_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&ThreadHealthChecker::Internal::StartHealthCheck, + internal_)); +} + +// When the public ThreadHealthChecker is destroyed, the reference to the +// Internal representation is freed, but if there are any pending tasks on the +// doctor thread that partially own Internal, they will be run asynchronously +// before the Internal object is destroyed and the health check stops. +ThreadHealthChecker::~ThreadHealthChecker() { + doctor_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&ThreadHealthChecker::Internal::StopHealthCheck, + internal_)); +} + +} // namespace chromecast
diff --git a/chromecast/base/thread_health_checker.h b/chromecast/base/thread_health_checker.h new file mode 100644 index 0000000..0b8c74f --- /dev/null +++ b/chromecast/base/thread_health_checker.h
@@ -0,0 +1,82 @@ +// 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 CHROMECAST_INTERNAL_SERVICE_THREAD_HEALTH_CHECKER_H_ +#define CHROMECAST_INTERNAL_SERVICE_THREAD_HEALTH_CHECKER_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/threading/thread_checker.h" +#include "base/time/time.h" + +namespace base { +class OneShotTimer; +class SingleThreadTaskRunner; +class TaskRunner; +} // namespace base + +namespace chromecast { +// A class used to periodically check the responsiveness of a thread. +// +// The class takes two task runners, a "patient", and a "doctor". The doctor +// task runner will post a "sentinel" task to the patient and verify that it +// gets run within a certain response time, determined by |timeout|. +// If the task is not run in time, then the patient fails the health checkup and +// |on_failure| is invoked. +// +// The thread health is checked periodically, with the length between one check +// and the next determined by |interval|, and the amount of time allowed for the +// sentinel task to complete determined by |timeout|. +class ThreadHealthChecker { + public: + ThreadHealthChecker( + scoped_refptr<base::TaskRunner> patient_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner, + base::TimeDelta interval, + base::TimeDelta timeout, + base::RepeatingClosure on_failure); + ~ThreadHealthChecker(); + + private: + class Internal : public base::RefCountedThreadSafe<Internal> { + public: + Internal(scoped_refptr<base::TaskRunner> patient_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner, + base::TimeDelta interval, + base::TimeDelta timeout, + base::RepeatingClosure on_failure); + void StartHealthCheck(); + void StopHealthCheck(); + + private: + friend class base::RefCountedThreadSafe<Internal>; + ~Internal(); + void ScheduleHealthCheck(); + void CheckThreadHealth(); + void ThreadOk(); + void ThreadTimeout(); + + scoped_refptr<base::TaskRunner> patient_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner_; + base::TimeDelta interval_; + base::TimeDelta timeout_; + std::unique_ptr<base::OneShotTimer> ok_timer_; + std::unique_ptr<base::OneShotTimer> failure_timer_; + base::RepeatingClosure on_failure_; + THREAD_CHECKER(thread_checker_); + }; + + scoped_refptr<base::SingleThreadTaskRunner> doctor_task_runner_; + scoped_refptr<Internal> internal_; + + DISALLOW_COPY_AND_ASSIGN(ThreadHealthChecker); +}; + +} // namespace chromecast + +#endif // CHROMECAST_INTERNAL_SERVICE_THREAD_HEALTH_CHECKER_H_
diff --git a/chromecast/base/thread_health_checker_unittest.cc b/chromecast/base/thread_health_checker_unittest.cc new file mode 100644 index 0000000..36c36b60 --- /dev/null +++ b/chromecast/base/thread_health_checker_unittest.cc
@@ -0,0 +1,105 @@ +// 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 "chromecast/base/thread_health_checker.h" + +#include "base/memory/ref_counted.h" +#include "base/synchronization/waitable_event.h" +#include "base/test/test_mock_time_task_runner.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromecast { + +namespace { +const base::TimeDelta kInterval = base::TimeDelta::FromSeconds(3); +const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(2); +} // namespace + +class ThreadHealthCheckerTest : public ::testing::Test { + protected: + ThreadHealthCheckerTest() + : patient_(base::MakeRefCounted<base::TestMockTimeTaskRunner>()), + doctor_(base::MakeRefCounted<base::TestMockTimeTaskRunner>()), + event_(base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED) {} + + ~ThreadHealthCheckerTest() override{}; + + scoped_refptr<base::TestMockTimeTaskRunner> patient_; + scoped_refptr<base::TestMockTimeTaskRunner> doctor_; + base::WaitableEvent event_; +}; + +#define CREATE_THREAD_HEALTH_CHECKER(name) \ + ThreadHealthChecker name(patient_, doctor_, kInterval, kTimeout, \ + base::BindRepeating(&base::WaitableEvent::Signal, \ + base::Unretained(&event_))) + +TEST_F(ThreadHealthCheckerTest, FiresTimeoutWhenTaskRunnerDoesNotFlush) { + CREATE_THREAD_HEALTH_CHECKER(thc); + // Do not flush the patient, so that the health check sentinel task won't run. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(6)); + EXPECT_TRUE(event_.IsSignaled()); +} + +TEST_F(ThreadHealthCheckerTest, DoesNotFireTimeoutWhenTaskRunnerFlushesInTime) { + CREATE_THREAD_HEALTH_CHECKER(thc); + // Advance the doctor by enough time to post the health check, but not to time + // out. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + // Advance the patient to let the sentinel task run. + patient_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + // Advance the doctor by enough time such that the sentinel not running would + // cause the failure callback to run. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(2)); + EXPECT_FALSE(event_.IsSignaled()); +} + +TEST_F(ThreadHealthCheckerTest, FiresTimeoutWhenTaskRunnerFlushesTooLate) { + CREATE_THREAD_HEALTH_CHECKER(thc); + // Advance the doctor before the patient, to simulate a task in the patient + // that takes too long. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(6)); + patient_->FastForwardBy(base::TimeDelta::FromSeconds(6)); + // Flush the task runner so the health check sentinel task is run. + EXPECT_TRUE(event_.IsSignaled()); +} + +TEST_F(ThreadHealthCheckerTest, FiresTimeoutOnLaterIteration) { + CREATE_THREAD_HEALTH_CHECKER(thc); + // Advance the doctor enough to start the check. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + // Advance the patient enough to run the task. + patient_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + // Advance the doctor enough to start the check again. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + EXPECT_FALSE(event_.IsSignaled()); + // Advance the doctor enough for the timeout from the second check to fire. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(2)); + EXPECT_TRUE(event_.IsSignaled()); +} + +TEST_F(ThreadHealthCheckerTest, NoCrashWhenDestroyed) { + { + CREATE_THREAD_HEALTH_CHECKER(thc); + doctor_->RunUntilIdle(); + } + doctor_->RunUntilIdle(); +} + +TEST_F(ThreadHealthCheckerTest, DropPendingEventsAfterDestruction) { + { + CREATE_THREAD_HEALTH_CHECKER(thc); + // Fast forward by enough time to have scheduled a health check. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(4)); + EXPECT_FALSE(event_.IsSignaled()); + } + // Fast forward by enough time for the health check to have executed. + // However, we want all pending events to be dropped after the destructor is + // called, so the event should not be signalled. + doctor_->FastForwardBy(base::TimeDelta::FromSeconds(2)); + EXPECT_FALSE(event_.IsSignaled()); +} + +} // namespace chromecast
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index 0336928c..73163d3 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn
@@ -132,6 +132,8 @@ sources += [ "cast_content_window_linux.cc", "cast_content_window_linux.h", + "cast_display_configurator.cc", + "cast_display_configurator.h", "cast_memory_pressure_monitor.cc", "cast_memory_pressure_monitor.h", "memory_pressure_controller_impl.cc",
diff --git a/chromecast/browser/DEPS b/chromecast/browser/DEPS index b4689ebb..92d7a76 100644 --- a/chromecast/browser/DEPS +++ b/chromecast/browser/DEPS
@@ -33,7 +33,7 @@ "+ui/gfx", "+ui/gl", "+ui/display", - "+ui/ozone/platform/cast/overlay_manager_cast.h", + "+ui/ozone", # TODO(sanfin): Remove this by fixing the crash handler on android. "!chromecast/app",
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc index 8d1b447..086679d 100644 --- a/chromecast/browser/cast_browser_main_parts.cc +++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -90,6 +90,7 @@ // gn check ignored on OverlayManagerCast as it's not a public ozone // header, but is exported to allow injecting the overlay-composited // callback. +#include "chromecast/browser/cast_display_configurator.h" #include "chromecast/graphics/cast_screen.h" #include "ui/display/screen.h" #include "ui/ozone/platform/cast/overlay_manager_cast.h" // nogncheck @@ -462,6 +463,8 @@ cast_browser_process_->SetCastScreen(base::WrapUnique(new CastScreen())); DCHECK(!display::Screen::GetScreen()); display::Screen::SetScreenInstance(cast_browser_process_->cast_screen()); + display_configurator_ = base::MakeUnique<CastDisplayConfigurator>( + cast_browser_process_->cast_screen()); #endif content::ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h index d4d19e8..df504306 100644 --- a/chromecast/browser/cast_browser_main_parts.h +++ b/chromecast/browser/cast_browser_main_parts.h
@@ -37,6 +37,7 @@ namespace shell { class CastBrowserProcess; +class CastDisplayConfigurator; class URLRequestContextFactory; class CastBrowserMainParts : public content::BrowserMainParts { @@ -73,6 +74,9 @@ std::unique_ptr<media::VideoPlaneController> video_plane_controller_; std::unique_ptr<media::MediaCapsImpl> media_caps_; std::unique_ptr<CastWindowManager> window_manager_; +#if defined(USE_AURA) + std::unique_ptr<CastDisplayConfigurator> display_configurator_; +#endif #if BUILDFLAG(IS_CAST_USING_CMA_BACKEND) // CMA thread used by AudioManager, MojoRenderer, and MediaPipelineBackend.
diff --git a/chromecast/browser/cast_display_configurator.cc b/chromecast/browser/cast_display_configurator.cc new file mode 100644 index 0000000..e9ab953 --- /dev/null +++ b/chromecast/browser/cast_display_configurator.cc
@@ -0,0 +1,75 @@ +// 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 "chromecast/browser/cast_display_configurator.h" + +#include "base/bind.h" +#include "base/memory/ptr_util.h" +#include "chromecast/graphics/cast_screen.h" +#include "ui/display/types/display_snapshot.h" +#include "ui/display/types/native_display_delegate.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/ozone/public/ozone_platform.h" + +namespace chromecast { +namespace shell { + +CastDisplayConfigurator::CastDisplayConfigurator(CastScreen* screen) + : delegate_( + ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate()), + cast_screen_(screen), + weak_factory_(this) { + DCHECK(delegate_); + DCHECK(cast_screen_); + delegate_->AddObserver(this); + delegate_->Initialize(); + OnConfigurationChanged(); +} + +CastDisplayConfigurator::~CastDisplayConfigurator() { + delegate_->RemoveObserver(this); +} + +// display::NativeDisplayObserver interface +void CastDisplayConfigurator::OnConfigurationChanged() { + delegate_->GetDisplays( + base::Bind(&CastDisplayConfigurator::OnDisplaysAcquired, + weak_factory_.GetWeakPtr())); +} + +void CastDisplayConfigurator::OnDisplaysAcquired( + const std::vector<display::DisplaySnapshot*>& displays) { + if (displays.empty()) { + LOG(WARNING) << "No displays detected, skipping display init."; + return; + } + + if (displays.size() > 1) { + LOG(WARNING) << "Multiple display detected, using the first one."; + } + + auto* display = displays[0]; + if (!display->native_mode()) { + LOG(WARNING) << "Display " << display->display_id() + << " doesn't have a native mode."; + return; + } + + gfx::Point origin; + delegate_->Configure( + *display, display->native_mode(), origin, + base::Bind(&CastDisplayConfigurator::OnDisplayConfigured, + weak_factory_.GetWeakPtr(), + gfx::Rect(origin, display->native_mode()->size()))); +} + +void CastDisplayConfigurator::OnDisplayConfigured(const gfx::Rect& bounds, + bool success) { + VLOG(1) << __func__ << " success=" << success + << " bounds=" << bounds.ToString(); + cast_screen_->OnDisplayChanged(1.0f, bounds); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_display_configurator.h b/chromecast/browser/cast_display_configurator.h new file mode 100644 index 0000000..2e4dc23 --- /dev/null +++ b/chromecast/browser/cast_display_configurator.h
@@ -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. + +#ifndef CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_ +#define CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_ + +#include <memory> +#include <vector> + +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "ui/display/types/native_display_observer.h" + +namespace display { +class DisplaySnapshot; +class NativeDisplayDelegate; +} // namespace display + +namespace gfx { +class Rect; +} // namespace gfx + +namespace chromecast { +class CastScreen; + +namespace shell { + +// The CastDisplayConfigurator class ensures native displays are initialized and +// configured properly on platforms that need that (e.g. GBM/DRM graphics via +// OzonePlatformGbm on odroid). But OzonePlatformCast, used by most Cast +// devices, relies on the platform code (outside of cast_shell) to initialize +// displays and exposes only a FakeDisplayDelegate. So CastDisplayConfigurator +// doesn't really do anything when using OzonePlatformCast. +class CastDisplayConfigurator : public display::NativeDisplayObserver { + public: + explicit CastDisplayConfigurator(CastScreen* screen); + ~CastDisplayConfigurator() override; + + // display::NativeDisplayObserver implementation + void OnConfigurationChanged() override; + void OnDisplaySnapshotsInvalidated() override {} + + private: + void OnDisplaysAcquired( + const std::vector<display::DisplaySnapshot*>& displays); + void OnDisplayConfigured(const gfx::Rect& bounds, bool success); + + std::unique_ptr<display::NativeDisplayDelegate> delegate_; + CastScreen* const cast_screen_; + + base::WeakPtrFactory<CastDisplayConfigurator> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(CastDisplayConfigurator); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_
diff --git a/chromecast/browser/cast_web_view.cc b/chromecast/browser/cast_web_view.cc index 2ccffd8..4d7135c 100644 --- a/chromecast/browser/cast_web_view.cc +++ b/chromecast/browser/cast_web_view.cc
@@ -12,6 +12,7 @@ #include "chromecast/base/cast_features.h" #include "chromecast/base/metrics/cast_metrics_helper.h" #include "chromecast/browser/cast_web_contents_manager.h" +#include "chromecast/public/cast_media_shlib.h" #include "content/public/browser/media_capture_devices.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" @@ -109,6 +110,10 @@ } void CastWebView::Show(CastWindowManager* window_manager) { + if (media::CastMediaShlib::ClearVideoPlaneImage) { + media::CastMediaShlib::ClearVideoPlaneImage(); + } + DCHECK(window_manager); window_->ShowWebContents(web_contents_.get(), window_manager); web_contents_->Focus();
diff --git a/chromecast/graphics/cast_screen.cc b/chromecast/graphics/cast_screen.cc index 88e00f05..917afa8f 100644 --- a/chromecast/graphics/cast_screen.cc +++ b/chromecast/graphics/cast_screen.cc
@@ -61,10 +61,16 @@ CastScreen::CastScreen() { // Device scale factor computed relative to 720p display - display::Display display(kDisplayId); const gfx::Size size = GetScreenResolution(); const float device_scale_factor = size.height() / 720.0f; - display.SetScaleAndBounds(device_scale_factor, gfx::Rect(size)); + OnDisplayChanged(device_scale_factor, gfx::Rect(size)); +} + +void CastScreen::OnDisplayChanged(float device_scale_factor, gfx::Rect bounds) { + VLOG(1) << __func__ << " device_scale_factor=" << device_scale_factor + << " bounds=" << bounds.ToString(); + display::Display display(kDisplayId); + display.SetScaleAndBounds(device_scale_factor, bounds); ProcessDisplayChanged(display, true /* is_primary */); }
diff --git a/chromecast/graphics/cast_screen.h b/chromecast/graphics/cast_screen.h index 0bdae09..326cc94 100644 --- a/chromecast/graphics/cast_screen.h +++ b/chromecast/graphics/cast_screen.h
@@ -31,6 +31,8 @@ display::Display GetDisplayNearestWindow( gfx::NativeWindow window) const override; + void OnDisplayChanged(float scale_factor, gfx::Rect bounds); + private: CastScreen();
diff --git a/chromeos/components/tether/initializer_impl.cc b/chromeos/components/tether/initializer_impl.cc index cd2d35e..1c6f0d4e 100644 --- a/chromeos/components/tether/initializer_impl.cc +++ b/chromeos/components/tether/initializer_impl.cc
@@ -179,6 +179,8 @@ // Shutdown has completed. It is now safe to delete the objects that were // shutting down asynchronously. + wifi_hotspot_disconnector_.reset(); + network_configuration_remover_.reset(); disconnect_tethering_request_sender_.reset(); ble_connection_manager_.reset(); remote_beacon_seed_fetcher_.reset(); @@ -302,7 +304,6 @@ crash_recovery_manager_.reset(); network_connection_handler_tether_delegate_.reset(); tether_network_disconnection_handler_.reset(); - network_configuration_remover_.reset(); tether_connector_.reset(); host_connection_metrics_logger_.reset(); host_scan_scheduler_.reset();
diff --git a/chromeos/cryptohome/async_method_caller.cc b/chromeos/cryptohome/async_method_caller.cc index 16170eb..42481d4 100644 --- a/chromeos/cryptohome/async_method_caller.cc +++ b/chromeos/cryptohome/async_method_caller.cc
@@ -8,6 +8,7 @@ #include "base/containers/hash_tables.h" #include "base/location.h" #include "base/macros.h" +#include "base/optional.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/cryptohome/cryptohome_parameters.h" @@ -213,15 +214,13 @@ const DataCallback& callback) override { DBusThreadManager::Get()->GetCryptohomeClient()->GetSanitizedUsername( cryptohome_id, - base::Bind(&AsyncMethodCallerImpl::GetSanitizedUsernameCallback, - weak_ptr_factory_.GetWeakPtr(), callback)); + base::BindOnce(&AsyncMethodCallerImpl::GetSanitizedUsernameCallback, + weak_ptr_factory_.GetWeakPtr(), callback)); } - virtual void GetSanitizedUsernameCallback( - const DataCallback& callback, - const chromeos::DBusMethodCallStatus call_status, - const std::string& result) { - callback.Run(true, result); + void GetSanitizedUsernameCallback(const DataCallback& callback, + base::Optional<std::string> result) { + callback.Run(true, result.value_or(std::string())); } private:
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc index ac4236d..7cb29cce 100644 --- a/chromeos/dbus/cryptohome_client.cc +++ b/chromeos/dbus/cryptohome_client.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <memory> #include <utility> #include "base/bind.h" @@ -15,6 +16,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" +#include "base/optional.h" #include "chromeos/cryptohome/async_method_caller.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/blocking_method_caller.h" @@ -190,7 +192,7 @@ // CryptohomeClient override, void GetSanitizedUsername(const cryptohome::Identification& cryptohome_id, - StringDBusMethodCallback callback) override { + DBusMethodCallback<std::string> callback) override { dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, cryptohome::kCryptohomeGetSanitizedUsername); dbus::MessageWriter writer(&method_call); @@ -307,7 +309,7 @@ } // CryptohomeClient override. - void TpmGetPassword(StringDBusMethodCallback callback) override { + void TpmGetPassword(DBusMethodCallback<std::string> callback) override { dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, cryptohome::kCryptohomeTpmGetPassword); proxy_->CallMethod( @@ -756,7 +758,7 @@ } // CryptohomeClient override. - void TpmGetVersion(StringDBusMethodCallback callback) override { + void TpmGetVersion(DBusMethodCallback<std::string> callback) override { dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, cryptohome::kCryptohomeTpmGetVersion); proxy_->CallMethod( @@ -1093,19 +1095,19 @@ } // Handles responses for methods with a string value result. - void OnStringMethod(StringDBusMethodCallback callback, + void OnStringMethod(DBusMethodCallback<std::string> callback, dbus::Response* response) { if (!response) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, std::string()); + std::move(callback).Run(base::nullopt); return; } dbus::MessageReader reader(response); std::string result; if (!reader.PopString(&result)) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, std::string()); + std::move(callback).Run(base::nullopt); return; } - std::move(callback).Run(DBUS_METHOD_CALL_SUCCESS, result); + std::move(callback).Run(std::move(result)); } // Handles responses for methods with a bool result and data.
diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h index f821854..87547f5 100644 --- a/chromeos/dbus/cryptohome_client.h +++ b/chromeos/dbus/cryptohome_client.h
@@ -37,7 +37,7 @@ class Identification; -} // namespace cryptohome +} // namespace cryptohome namespace chromeos { @@ -180,7 +180,7 @@ // call succeeds. virtual void GetSanitizedUsername( const cryptohome::Identification& cryptohome_id, - StringDBusMethodCallback callback) = 0; + DBusMethodCallback<std::string> callback) = 0; // Same as GetSanitizedUsername() but blocks until a reply is received, and // returns the sanitized username synchronously. Returns an empty string if @@ -233,7 +233,7 @@ virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0; // Calls TpmGetPassword method. - virtual void TpmGetPassword(StringDBusMethodCallback callback) = 0; + virtual void TpmGetPassword(DBusMethodCallback<std::string> callback) = 0; // Calls TpmIsOwned method. virtual void TpmIsOwned(const BoolDBusMethodCallback& callback) = 0; @@ -492,7 +492,7 @@ // Asynchronously gets the underlying TPM version information and passes it to // the given callback as a string. - virtual void TpmGetVersion(StringDBusMethodCallback callback) = 0; + virtual void TpmGetVersion(DBusMethodCallback<std::string> callback) = 0; // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked // with the reply protobuf.
diff --git a/chromeos/dbus/dbus_method_call_status.h b/chromeos/dbus/dbus_method_call_status.h index 0e24f6c..9a40acf5 100644 --- a/chromeos/dbus/dbus_method_call_status.h +++ b/chromeos/dbus/dbus_method_call_status.h
@@ -8,6 +8,7 @@ #include <string> #include "base/callback.h" +#include "base/optional.h" #include "chromeos/chromeos_export.h" namespace dbus { @@ -24,6 +25,12 @@ DBUS_METHOD_CALL_SUCCESS, }; +// Callback to handle response of methods with result. +// In case of error, nullopt should be passed. +template <typename ResultType> +using DBusMethodCallback = + base::OnceCallback<void(base::Optional<ResultType> result)>; + // A callback to handle responses of methods without results. using VoidDBusMethodCallback = base::OnceCallback<void(DBusMethodCallStatus call_status)>; @@ -34,11 +41,6 @@ typedef base::Callback<void(DBusMethodCallStatus call_status, bool result)> BoolDBusMethodCallback; -// A callback to handle responses of methods returning a string value. -using StringDBusMethodCallback = - base::OnceCallback<void(DBusMethodCallStatus call_status, - const std::string& result)>; - // A callback to handle responses of methods returning a boolean value. typedef base::Callback<void( DBusMethodCallStatus call_status,
diff --git a/chromeos/dbus/fake_cryptohome_client.cc b/chromeos/dbus/fake_cryptohome_client.cc index 82e278c..70f387a 100644 --- a/chromeos/dbus/fake_cryptohome_client.cc +++ b/chromeos/dbus/fake_cryptohome_client.cc
@@ -7,10 +7,13 @@ #include <stddef.h> #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/optional.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" @@ -145,16 +148,14 @@ void FakeCryptohomeClient::GetSanitizedUsername( const cryptohome::Identification& cryptohome_id, - StringDBusMethodCallback callback) { + DBusMethodCallback<std::string> callback) { // Even for stub implementation we have to return different values so that // multi-profiles would work. - auto task = - service_is_available_ - ? base::BindOnce(std::move(callback), DBUS_METHOD_CALL_SUCCESS, - GetStubSanitizedUsername(cryptohome_id)) - : base::BindOnce(std::move(callback), DBUS_METHOD_CALL_FAILURE, - std::string()); - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, std::move(task)); + auto id = service_is_available_ + ? base::make_optional(GetStubSanitizedUsername(cryptohome_id)) + : base::nullopt; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), id)); } std::string FakeCryptohomeClient::BlockingGetSanitizedUsername( @@ -208,11 +209,12 @@ return true; } -void FakeCryptohomeClient::TpmGetPassword(StringDBusMethodCallback callback) { - const char kStubTpmPassword[] = "Stub-TPM-password"; +void FakeCryptohomeClient::TpmGetPassword( + DBusMethodCallback<std::string> callback) { + constexpr char kStubTpmPassword[] = "Stub-TPM-password"; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), DBUS_METHOD_CALL_SUCCESS, - std::string(kStubTpmPassword))); + FROM_HERE, + base::BindOnce(std::move(callback), std::string(kStubTpmPassword))); } void FakeCryptohomeClient::TpmIsOwned( @@ -570,10 +572,10 @@ FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true)); } -void FakeCryptohomeClient::TpmGetVersion(StringDBusMethodCallback callback) { +void FakeCryptohomeClient::TpmGetVersion( + DBusMethodCallback<std::string> callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), DBUS_METHOD_CALL_SUCCESS, - std::string())); + FROM_HERE, base::BindOnce(std::move(callback), std::string())); } void FakeCryptohomeClient::GetKeyDataEx(
diff --git a/chromeos/dbus/fake_cryptohome_client.h b/chromeos/dbus/fake_cryptohome_client.h index 4635016..549c1c3 100644 --- a/chromeos/dbus/fake_cryptohome_client.h +++ b/chromeos/dbus/fake_cryptohome_client.h
@@ -53,7 +53,7 @@ const ProtobufMethodCallback& callback) override; void GetSystemSalt(const GetSystemSaltCallback& callback) override; void GetSanitizedUsername(const cryptohome::Identification& cryptohome_id, - StringDBusMethodCallback callback) override; + DBusMethodCallback<std::string> callback) override; std::string BlockingGetSanitizedUsername( const cryptohome::Identification& cryptohome_id) override; void AsyncMount(const cryptohome::Identification& cryptohome_id, @@ -71,7 +71,7 @@ void TpmIsReady(const BoolDBusMethodCallback& callback) override; void TpmIsEnabled(const BoolDBusMethodCallback& callback) override; bool CallTpmIsEnabledAndBlock(bool* enabled) override; - void TpmGetPassword(StringDBusMethodCallback callback) override; + void TpmGetPassword(DBusMethodCallback<std::string> callback) override; void TpmIsOwned(const BoolDBusMethodCallback& callback) override; bool CallTpmIsOwnedAndBlock(bool* owned) override; void TpmIsBeingOwned(const BoolDBusMethodCallback& callback) override; @@ -169,7 +169,7 @@ const cryptohome::Identification& cryptohome_id, const std::string& key_prefix, const BoolDBusMethodCallback& callback) override; - void TpmGetVersion(StringDBusMethodCallback callback) override; + void TpmGetVersion(DBusMethodCallback<std::string> callback) override; void GetKeyDataEx(const cryptohome::Identification& cryptohome_id, const cryptohome::AuthorizationRequest& auth, const cryptohome::GetKeyDataRequest& request,
diff --git a/chromeos/dbus/fake_image_loader_client.cc b/chromeos/dbus/fake_image_loader_client.cc index cd60fcd4..037f9e4e 100644 --- a/chromeos/dbus/fake_image_loader_client.cc +++ b/chromeos/dbus/fake_image_loader_client.cc
@@ -4,6 +4,10 @@ #include "chromeos/dbus/fake_image_loader_client.h" +#include <utility> + +#include "base/optional.h" + namespace chromeos { // ImageLoaderClient override: @@ -14,14 +18,15 @@ const BoolDBusMethodCallback& callback) { callback.Run(DBUS_METHOD_CALL_FAILURE, false); } -void FakeImageLoaderClient::LoadComponent(const std::string& name, - StringDBusMethodCallback callback) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, ""); +void FakeImageLoaderClient::LoadComponent( + const std::string& name, + DBusMethodCallback<std::string> callback) { + std::move(callback).Run(base::nullopt); } void FakeImageLoaderClient::RequestComponentVersion( const std::string& name, - StringDBusMethodCallback callback) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, ""); + DBusMethodCallback<std::string> callback) { + std::move(callback).Run(base::nullopt); } } // namespace chromeos
diff --git a/chromeos/dbus/fake_image_loader_client.h b/chromeos/dbus/fake_image_loader_client.h index 0636ce2..8672735c 100644 --- a/chromeos/dbus/fake_image_loader_client.h +++ b/chromeos/dbus/fake_image_loader_client.h
@@ -27,9 +27,10 @@ const std::string& component_folder_abs_path, const BoolDBusMethodCallback& callback) override; void LoadComponent(const std::string& name, - StringDBusMethodCallback callback) override; - void RequestComponentVersion(const std::string& name, - StringDBusMethodCallback callback) override; + DBusMethodCallback<std::string> callback) override; + void RequestComponentVersion( + const std::string& name, + DBusMethodCallback<std::string> callback) override; private: DISALLOW_COPY_AND_ASSIGN(FakeImageLoaderClient);
diff --git a/chromeos/dbus/image_loader_client.cc b/chromeos/dbus/image_loader_client.cc index d172abb..27e15062 100644 --- a/chromeos/dbus/image_loader_client.cc +++ b/chromeos/dbus/image_loader_client.cc
@@ -4,8 +4,11 @@ #include "chromeos/dbus/image_loader_client.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" +#include "base/optional.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -38,7 +41,7 @@ } void LoadComponent(const std::string& name, - StringDBusMethodCallback callback) override { + DBusMethodCallback<std::string> callback) override { dbus::MethodCall method_call(imageloader::kImageLoaderServiceInterface, imageloader::kLoadComponent); dbus::MessageWriter writer(&method_call); @@ -48,8 +51,9 @@ std::move(callback))); } - void RequestComponentVersion(const std::string& name, - StringDBusMethodCallback callback) override { + void RequestComponentVersion( + const std::string& name, + DBusMethodCallback<std::string> callback) override { dbus::MethodCall method_call(imageloader::kImageLoaderServiceInterface, imageloader::kGetComponentVersion); dbus::MessageWriter writer(&method_call); @@ -84,20 +88,20 @@ callback.Run(DBUS_METHOD_CALL_SUCCESS, result); } - static void OnStringMethod(StringDBusMethodCallback callback, + static void OnStringMethod(DBusMethodCallback<std::string> callback, dbus::Response* response) { if (!response) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, std::string()); + std::move(callback).Run(base::nullopt); return; } dbus::MessageReader reader(response); std::string result; if (!reader.PopString(&result)) { - std::move(callback).Run(DBUS_METHOD_CALL_FAILURE, std::string()); + std::move(callback).Run(base::nullopt); LOG(ERROR) << "Invalid response: " << response->ToString(); return; } - std::move(callback).Run(DBUS_METHOD_CALL_SUCCESS, result); + std::move(callback).Run(std::move(result)); } dbus::ObjectProxy* proxy_ = nullptr;
diff --git a/chromeos/dbus/image_loader_client.h b/chromeos/dbus/image_loader_client.h index ee9cf7b..45573a74 100644 --- a/chromeos/dbus/image_loader_client.h +++ b/chromeos/dbus/image_loader_client.h
@@ -31,11 +31,12 @@ // Mounts a component given the |name| and return the mount point (if call is // successful). virtual void LoadComponent(const std::string& name, - StringDBusMethodCallback callback) = 0; + DBusMethodCallback<std::string> callback) = 0; // Requests the currently registered version of the given component |name|. - virtual void RequestComponentVersion(const std::string& name, - StringDBusMethodCallback callback) = 0; + virtual void RequestComponentVersion( + const std::string& name, + DBusMethodCallback<std::string> callback) = 0; // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get().
diff --git a/chromeos/system/version_loader.cc b/chromeos/system/version_loader.cc index fb26d8e..39f19fb0b 100644 --- a/chromeos/system/version_loader.cc +++ b/chromeos/system/version_loader.cc
@@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/optional.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -66,12 +67,11 @@ void GetTpmVersion(StringCallback callback) { chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->TpmGetVersion( - base::Bind([](StringCallback callback, - chromeos::DBusMethodCallStatus call_status, - const std::string& tpm_version) { - callback.Run(tpm_version); - }, - callback)); + base::BindOnce( + [](StringCallback callback, base::Optional<std::string> version) { + callback.Run(version.value_or(std::string())); + }, + callback)); } std::string GetARCVersion() {
diff --git a/chromeos/tpm/tpm_password_fetcher.cc b/chromeos/tpm/tpm_password_fetcher.cc index a9845662..84af5e83 100644 --- a/chromeos/tpm/tpm_password_fetcher.cc +++ b/chromeos/tpm/tpm_password_fetcher.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 "tpm_password_fetcher.h" +#include "chromeos/tpm/tpm_password_fetcher.h" #include "base/bind.h" #include "base/compiler_specific.h" @@ -40,24 +40,25 @@ void TpmPasswordFetcher::OnTpmIsReady(DBusMethodCallStatus call_status, bool tpm_is_ready) { if (call_status == DBUS_METHOD_CALL_SUCCESS && tpm_is_ready) { - DBusThreadManager::Get()->GetCryptohomeClient()->TpmGetPassword(base::Bind( - &TpmPasswordFetcher::OnTpmGetPassword, weak_factory_.GetWeakPtr())); + DBusThreadManager::Get()->GetCryptohomeClient()->TpmGetPassword( + base::BindOnce(&TpmPasswordFetcher::OnTpmGetPassword, + weak_factory_.GetWeakPtr())); } else { // Password hasn't been acquired, reschedule fetch. RescheduleFetch(); } } -void TpmPasswordFetcher::OnTpmGetPassword(DBusMethodCallStatus call_status, - const std::string& password) { - if (call_status == DBUS_METHOD_CALL_SUCCESS) { - if (password.empty()) { +void TpmPasswordFetcher::OnTpmGetPassword( + base::Optional<std::string> password) { + if (password) { + if (password->empty()) { // For a fresh OOBE flow TPM is uninitialized, // ownership process is started at the EULA screen, // password is cleared after EULA is accepted. LOG(ERROR) << "TPM returned an empty password."; } - delegate_->OnPasswordFetched(password); + delegate_->OnPasswordFetched(*password); } else { // Password hasn't been acquired, reschedule fetch. RescheduleFetch();
diff --git a/chromeos/tpm/tpm_password_fetcher.h b/chromeos/tpm/tpm_password_fetcher.h index bc1f2a6..3b5f34c 100644 --- a/chromeos/tpm/tpm_password_fetcher.h +++ b/chromeos/tpm/tpm_password_fetcher.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/optional.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_method_call_status.h" @@ -39,8 +40,7 @@ void OnTpmIsReady(DBusMethodCallStatus call_status, bool tpm_is_ready); // Used to implement Fetch(). - void OnTpmGetPassword(DBusMethodCallStatus call_status, - const std::string& password); + void OnTpmGetPassword(base::Optional<std::string> password); // Posts a task to call Fetch() later. void RescheduleFetch();
diff --git a/components/arc/arc_prefs.cc b/components/arc/arc_prefs.cc index 34db454..5dd43e7e 100644 --- a/components/arc/arc_prefs.cc +++ b/components/arc/arc_prefs.cc
@@ -55,6 +55,8 @@ // Integer pref indicating the ecryptfs to ext4 migration strategy. One of // options: forbidden = 0, migrate = 1, wipe = 2 or ask the user = 3. const char kEcryptfsMigrationStrategy[] = "ecryptfs_migration_strategy"; +// A preference that indicates whether the SMS Connect feature is enabled. +const char kSmsConnectEnabled[] = "multidevice.sms_connect_enabled"; // A preference that indicates the user has enabled voice interaction services. const char kVoiceInteractionEnabled[] = "settings.voice_interaction.enabled"; // A preference that indicates the user has allowed voice interaction services @@ -94,6 +96,7 @@ registry->RegisterBooleanPref(kArcSignedIn, false); registry->RegisterBooleanPref(kArcTermsAccepted, false); registry->RegisterBooleanPref(kArcVoiceInteractionValuePropAccepted, false); + registry->RegisterBooleanPref(kSmsConnectEnabled, true); registry->RegisterBooleanPref(kVoiceInteractionContextEnabled, false); registry->RegisterBooleanPref(kVoiceInteractionEnabled, false); registry->RegisterBooleanPref(kVoiceInteractionPrefSynced, false);
diff --git a/components/arc/arc_prefs.h b/components/arc/arc_prefs.h index 6e82dfa..2ce313d6 100644 --- a/components/arc/arc_prefs.h +++ b/components/arc/arc_prefs.h
@@ -30,6 +30,7 @@ ARC_EXPORT extern const char kArcCompatibleFilesystemChosen[]; ARC_EXPORT extern const char kArcVoiceInteractionValuePropAccepted[]; ARC_EXPORT extern const char kEcryptfsMigrationStrategy[]; +ARC_EXPORT extern const char kSmsConnectEnabled[]; ARC_EXPORT extern const char kVoiceInteractionEnabled[]; ARC_EXPORT extern const char kVoiceInteractionContextEnabled[]; ARC_EXPORT extern const char kVoiceInteractionPrefSynced[];
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index b59591e1..ebc46f36 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -599,6 +599,7 @@ last_interacted_form_.Reset(); formless_elements_user_edited_.clear(); + submitted_forms_.clear(); } bool AutofillAgent::CollectFormlessElements(FormData* output) { @@ -740,6 +741,7 @@ base::AutoReset<bool> auto_reset(&ignore_text_changes_, true); node->SetEditingValue( blink::WebString::FromUTF16(value.substr(0, node->MaxLength()))); + password_autofill_agent_->UpdateStateForTextChange(*node); } void AutofillAgent::DoPreviewFieldWithValue(const base::string16& value,
diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc index b9af03a..81556bc 100644 --- a/components/autofill/core/browser/autofill_profile.cc +++ b/components/autofill/core/browser/autofill_profile.cc
@@ -752,7 +752,7 @@ void AutofillProfile::SetValidityFromBitfieldValue(int bitfield_value) { // Compute the bitmask based on the number a bits per type. For example, this // could be the two least significant bits (0b11). - const int kBitmask = 2 ^ validity_bits_per_type - 1; + const int kBitmask = (1 << validity_bits_per_type) - 1; for (ServerFieldType supported_type : supported_types_for_validation) { // Apply the bitmask to the bitfield value to get the validity value of the
diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc index 0287c956..d0f0466 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc
@@ -86,15 +86,15 @@ SubStatus sub_status) { switch (sub_status) { case SubStatus::WAITING_CONNECTION_RESPONSE: - return base::TimeDelta::FromSeconds(kConnectionLatencyTimeoutSeconds); - case SubStatus::WAITING_CONNECTION_LATENCY: - return base::TimeDelta::FromSeconds(kGattConnectionTimeoutSeconds); - case SubStatus::WAITING_GATT_CONNECTION: - return base::TimeDelta::FromSeconds(kGattCharacteristicsTimeoutSeconds); - case SubStatus::WAITING_CHARACTERISTICS: - return base::TimeDelta::FromSeconds(kNotifySessionTimeoutSeconds); - case SubStatus::WAITING_NOTIFY_SESSION: return base::TimeDelta::FromSeconds(kConnectionResponseTimeoutSeconds); + case SubStatus::WAITING_CONNECTION_LATENCY: + return base::TimeDelta::FromSeconds(kConnectionLatencyTimeoutSeconds); + case SubStatus::WAITING_GATT_CONNECTION: + return base::TimeDelta::FromSeconds(kGattConnectionTimeoutSeconds); + case SubStatus::WAITING_CHARACTERISTICS: + return base::TimeDelta::FromSeconds(kGattCharacteristicsTimeoutSeconds); + case SubStatus::WAITING_NOTIFY_SESSION: + return base::TimeDelta::FromSeconds(kNotifySessionTimeoutSeconds); default: // Max signifies that there should be no timeout. return base::TimeDelta::Max();
diff --git a/components/exo/keyboard_unittest.cc b/components/exo/keyboard_unittest.cc index 5707df5d..abbc379 100644 --- a/components/exo/keyboard_unittest.cc +++ b/components/exo/keyboard_unittest.cc
@@ -216,13 +216,7 @@ keyboard.reset(); } -// Test fails consistently on CrOS: crbug.com/764338 -#if defined(OS_CHROMEOS) -#define MAYBE_OnKeyboardTypeChanged DISABLED_OnKeyboardTypeChanged -#else -#define MAYBE_OnKeyboardTypeChanged OnKeyboardTypeChanged -#endif -TEST_F(KeyboardTest, MAYBE_OnKeyboardTypeChanged) { +TEST_F(KeyboardTest, OnKeyboardTypeChanged) { std::unique_ptr<Surface> surface(new Surface); std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); gfx::Size buffer_size(10, 10); @@ -235,11 +229,13 @@ aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); focus_client->FocusWindow(nullptr); - ui::DeviceDataManager* device_data_manager = + ui::DeviceHotplugEventObserver* device_data_manager = ui::DeviceDataManager::GetInstance(); ASSERT_TRUE(device_data_manager != nullptr); - const std::vector<ui::InputDevice> keyboards = - device_data_manager->GetKeyboardDevices(); + // Make sure that DeviceDataManager has one external keyboard. + const std::vector<ui::InputDevice> keyboards{ui::InputDevice( + 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")}; + device_data_manager->OnKeyboardDevicesUpdated(keyboards); ash::TabletModeController* tablet_mode_controller = ash::Shell::Get()->tablet_mode_controller(); @@ -256,13 +252,12 @@ // Removing all keyboard devices in tablet mode calls // OnKeyboardTypeChanged() with false. EXPECT_CALL(configuration_delegate, OnKeyboardTypeChanged(false)); - static_cast<ui::DeviceHotplugEventObserver*>(device_data_manager) - ->OnKeyboardDevicesUpdated(std::vector<ui::InputDevice>({})); + device_data_manager->OnKeyboardDevicesUpdated( + std::vector<ui::InputDevice>({})); // Re-adding keyboards calls OnKeyboardTypeChanged() with true; EXPECT_CALL(configuration_delegate, OnKeyboardTypeChanged(true)); - static_cast<ui::DeviceHotplugEventObserver*>(device_data_manager) - ->OnKeyboardDevicesUpdated(keyboards); + device_data_manager->OnKeyboardDevicesUpdated(keyboards); keyboard.reset();
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index 6d3c580..358b8c0f 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -238,6 +238,19 @@ bool SurfaceTreeHost::OnBeginFrameDerivedImpl(const viz::BeginFrameArgs& args) { current_begin_frame_ack_ = viz::BeginFrameAck(args.source_id, args.sequence_number, false); + + if (!frame_callbacks_.empty()) { + // In this case, the begin frame arrives just before + // |DidReceivedCompositorFrameAck()|, we need more begin frames to run + // |frame_callbacks_| which will be moved to |active_frame_callbacks_| by + // |DidReceivedCompositorFrameAck()| shortly. + layer_tree_frame_sink_holder_->frame_sink()->DidNotProduceFrame( + current_begin_frame_ack_); + current_begin_frame_ack_.sequence_number = + viz::BeginFrameArgs::kInvalidFrameNumber; + begin_frame_source_->DidFinishFrame(this); + } + while (!active_frame_callbacks_.empty()) { active_frame_callbacks_.front().Run(args.frame_time); active_frame_callbacks_.pop_front();
diff --git a/components/favicon/OWNERS b/components/favicon/OWNERS index a5ad75c0..6581507 100644 --- a/components/favicon/OWNERS +++ b/components/favicon/OWNERS
@@ -1,3 +1,3 @@ +mastiz@chromium.org pkotwicz@chromium.org sky@chromium.org -stevenjb@chromium.org
diff --git a/components/language/core/browser/BUILD.gn b/components/language/core/browser/BUILD.gn index 54b103a5..e177866fb 100644 --- a/components/language/core/browser/BUILD.gn +++ b/components/language/core/browser/BUILD.gn
@@ -4,6 +4,10 @@ static_library("browser") { sources = [ + "baseline_language_model.cc", + "baseline_language_model.h", + "language_model.cc", + "language_model.h", "url_language_histogram.cc", "url_language_histogram.h", ] @@ -19,6 +23,7 @@ source_set("unit_tests") { testonly = true sources = [ + "baseline_language_model_unittest.cc", "url_language_histogram_unittest.cc", ] deps = [ @@ -28,6 +33,7 @@ "//components/prefs", "//components/prefs:test_support", "//net:test_support", + "//testing/gmock", "//testing/gtest", ] }
diff --git a/components/language/core/browser/baseline_language_model.cc b/components/language/core/browser/baseline_language_model.cc new file mode 100644 index 0000000..63ef56a --- /dev/null +++ b/components/language/core/browser/baseline_language_model.cc
@@ -0,0 +1,67 @@ +// 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/language/core/browser/baseline_language_model.h" + +#include "base/strings/string_split.h" +#include "components/prefs/pref_service.h" + +namespace language { + +namespace { +constexpr float kUrlLanguageFreqCutoff = 0.3f; +} // namespace + +BaselineLanguageModel::BaselineLanguageModel( + PrefService* const pref_service, + const std::string& ui_lang, + const std::string& accept_langs_pref) + : pref_service_(pref_service), + ui_lang_(ui_lang), + accept_langs_pref_(accept_langs_pref), + lang_histogram_(pref_service) { + DCHECK(pref_service); + DCHECK(!ui_lang.empty()); + DCHECK(!accept_langs_pref.empty()); + DCHECK(pref_service->FindPreference(accept_langs_pref)); +} + +std::vector<LanguageModel::LanguageDetails> +BaselineLanguageModel::GetLanguages() { + // Start with UI language. + std::vector<LanguageDetails> lang_details = {LanguageDetails(ui_lang_, 1.0f)}; + std::unordered_set<std::string> seen = {ui_lang_}; + + // Then add sufficiently-frequent URL languages. + const std::vector<UrlLanguageHistogram::LanguageInfo> hist_langs = + lang_histogram_.GetTopLanguages(); + for (const UrlLanguageHistogram::LanguageInfo& lang_info : hist_langs) { + if (lang_info.frequency < kUrlLanguageFreqCutoff) + break; + + if (seen.find(lang_info.language_code) != seen.end()) + continue; + + lang_details.push_back(LanguageDetails(lang_info.language_code, + 1.0f / (lang_details.size() + 1))); + seen.insert(lang_info.language_code); + } + + // Then add accept languages. + const std::vector<std::string> accept_langs = + base::SplitString(pref_service_->GetString(accept_langs_pref_), ",", + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + for (const std::string& lang_code : accept_langs) { + if (seen.find(lang_code) != seen.end()) + continue; + + lang_details.push_back( + LanguageDetails(lang_code, 1.0f / (lang_details.size() + 1))); + seen.insert(lang_code); + } + + return lang_details; +} + +} // namespace language
diff --git a/components/language/core/browser/baseline_language_model.h b/components/language/core/browser/baseline_language_model.h new file mode 100644 index 0000000..40dbca3 --- /dev/null +++ b/components/language/core/browser/baseline_language_model.h
@@ -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. + +#ifndef COMPONENTS_LANGUAGE_CORE_BROWSER_BASELINE_LANGUAGE_MODEL_H_ +#define COMPONENTS_LANGUAGE_CORE_BROWSER_BASELINE_LANGUAGE_MODEL_H_ + +#include <string> +#include <vector> + +#include "components/language/core/browser/language_model.h" +#include "components/language/core/browser/url_language_histogram.h" + +class PrefService; + +namespace language { + +// A language model that attempts to approximate Chrome's legacy behaviour as +// much as possible. +// +// Produces a list of languages in the following order: +// 1) Chrome's UI language, +// 2) The most frequently occuring languages in visited URLs (if they surpass a +// given frequency threshold), +// 3) The user's accept languages. +// +// No code appears twice in the list. Codes with region subtags may appear in +// the list and are not backed-off. Entries are scored by inverse rank (i.e. 1, +// 1/2, 1/3, ...). +// +// NOTE: This model reads URL language histogram and accept language information +// from user preferences. Hence, both sources must be registered on the +// PrefService passed in at construction time. +class BaselineLanguageModel : public LanguageModel { + public: + BaselineLanguageModel(PrefService* pref_service, + const std::string& ui_lang, + const std::string& accept_langs_pref); + + // LanguageModel implementation. + std::vector<LanguageDetails> GetLanguages() override; + + private: + const PrefService* const pref_service_; + const std::string ui_lang_; + const std::string accept_langs_pref_; + const UrlLanguageHistogram lang_histogram_; +}; + +} // namespace language + +#endif // COMPONENTS_LANGUAGE_CORE_BROWSER_BASELINE_LANGUAGE_MODEL_H_
diff --git a/components/language/core/browser/baseline_language_model_unittest.cc b/components/language/core/browser/baseline_language_model_unittest.cc new file mode 100644 index 0000000..7d306cd --- /dev/null +++ b/components/language/core/browser/baseline_language_model_unittest.cc
@@ -0,0 +1,135 @@ +// 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/language/core/browser/baseline_language_model.h" + +#include <cmath> + +#include "components/language/core/browser/url_language_histogram.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/testing_pref_service.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace language { + +using testing::ElementsAre; +using Ld = BaselineLanguageModel::LanguageDetails; + +constexpr static float kFloatEps = 0.00001f; +constexpr static char kAcceptPref[] = "intl.accept_languages"; + +class BaselineLanguageModelTest : public testing::Test { + protected: + void SetUp() override { + // The URL language histogram and accept language list are inputs to the + // baseline model. + UrlLanguageHistogram::RegisterProfilePrefs(prefs_.registry()); + prefs_.registry()->RegisterStringPref(kAcceptPref, std::string()); + } + + TestingPrefServiceSimple prefs_; +}; + +// Compares LanguageDetails. +MATCHER_P(EqualsLd, lang_details, "") { + return arg.lang_code == lang_details.lang_code && + std::abs(arg.score - lang_details.score) < kFloatEps; +} + +// Check the minimum model: just a UI language. +TEST_F(BaselineLanguageModelTest, UiOnly) { + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT(model.GetLanguages(), ElementsAre(EqualsLd(Ld("en", 1.0f)))); +} + +// Check with UI language and language browsing history. +TEST_F(BaselineLanguageModelTest, UiAndHist) { + // Simulate many website visits, as there is a minimum frequency threshold for + // histogram languages. + UrlLanguageHistogram hist(&prefs_); + for (int i = 0; i < 100; ++i) { + hist.OnPageVisited("it"); + hist.OnPageVisited("it"); + hist.OnPageVisited("de"); + } + + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT(model.GetLanguages(), ElementsAre(EqualsLd(Ld("en", 1.0f)), + EqualsLd(Ld("it", 1.0f / 2)), + EqualsLd(Ld("de", 1.0f / 3)))); +} + +// Check with UI language and accept languages. +TEST_F(BaselineLanguageModelTest, UiAndAccept) { + prefs_.SetString(kAcceptPref, "ja,fr"); + + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT(model.GetLanguages(), ElementsAre(EqualsLd(Ld("en", 1.0f)), + EqualsLd(Ld("ja", 1.0f / 2)), + EqualsLd(Ld("fr", 1.0f / 3)))); +} + +// Check with all three sources. +TEST_F(BaselineLanguageModelTest, UiAndHistAndAccept) { + // Simulate many website visits, as there is a minimum frequency threshold for + // histogram languages. + UrlLanguageHistogram hist(&prefs_); + for (int i = 0; i < 100; ++i) { + hist.OnPageVisited("it"); + hist.OnPageVisited("it"); + hist.OnPageVisited("de"); + } + + prefs_.SetString(kAcceptPref, "ja,fr"); + + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT( + model.GetLanguages(), + ElementsAre(EqualsLd(Ld("en", 1.0f)), EqualsLd(Ld("it", 1.0f / 2)), + EqualsLd(Ld("de", 1.0f / 3)), EqualsLd(Ld("ja", 1.0f / 4)), + EqualsLd(Ld("fr", 1.0f / 5)))); +} + +// Check that repeats among sources are ignored. +TEST_F(BaselineLanguageModelTest, Repeats) { + // Simulate many website visits, as there is a minimum frequency threshold for + // histogram languages. + UrlLanguageHistogram hist(&prefs_); + for (int i = 0; i < 100; ++i) { + hist.OnPageVisited("en"); + hist.OnPageVisited("en"); + hist.OnPageVisited("it"); + } + + prefs_.SetString(kAcceptPref, "en,ja,it"); + + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT(model.GetLanguages(), ElementsAre(EqualsLd(Ld("en", 1.0f)), + EqualsLd(Ld("it", 1.0f / 2)), + EqualsLd(Ld("ja", 1.0f / 3)))); +} + +// Check that regions are not backed off. +TEST_F(BaselineLanguageModelTest, Regions) { + // Simulate many website visits, as there is a minimum frequency threshold for + // histogram languages. + UrlLanguageHistogram hist(&prefs_); + for (int i = 0; i < 100; ++i) { + hist.OnPageVisited("en-AU"); + hist.OnPageVisited("en-AU"); + hist.OnPageVisited("en-CA"); + } + + prefs_.SetString(kAcceptPref, "en-GB"); + + BaselineLanguageModel model(&prefs_, "en", kAcceptPref); + EXPECT_THAT( + model.GetLanguages(), + ElementsAre(EqualsLd(Ld("en", 1.0f)), EqualsLd(Ld("en-AU", 1.0f / 2)), + EqualsLd(Ld("en-CA", 1.0f / 3)), + EqualsLd(Ld("en-GB", 1.0f / 4)))); +} + +} // namespace language
diff --git a/components/language/core/browser/language_model.cc b/components/language/core/browser/language_model.cc new file mode 100644 index 0000000..efb366b5 --- /dev/null +++ b/components/language/core/browser/language_model.cc
@@ -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. + +#include "components/language/core/browser/language_model.h" + +namespace language { + +LanguageModel::LanguageDetails::LanguageDetails() : LanguageDetails("", 0.0f) {} + +LanguageModel::LanguageDetails::LanguageDetails(const std::string& in_lang_code, + const float in_score) + : lang_code(in_lang_code), score(in_score) {} + +} // namespace language
diff --git a/components/language/core/browser/language_model.h b/components/language/core/browser/language_model.h new file mode 100644 index 0000000..65346414 --- /dev/null +++ b/components/language/core/browser/language_model.h
@@ -0,0 +1,39 @@ +// 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 COMPONENTS_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_ +#define COMPONENTS_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_ + +#include <string> +#include <vector> + +#include "components/keyed_service/core/keyed_service.h" + +namespace language { + +// Defines a user language model represented by a ranked list of languages and +// associated scores. +class LanguageModel : public KeyedService { + public: + // Information about one language that a user understands. + struct LanguageDetails { + LanguageDetails(); + LanguageDetails(const std::string& in_lang_code, float in_score); + + // The language code. + std::string lang_code; + + // A score representing the importance of the language to the user. Higher + // scores mean that the language is of more importance to the user. + float score; + }; + + // The set of languages that the user understands. The languages are ranked + // from most important to least. + virtual std::vector<LanguageDetails> GetLanguages() = 0; +}; + +} // namespace language + +#endif // COMPONENTS_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_
diff --git a/components/language/core/browser/url_language_histogram.h b/components/language/core/browser/url_language_histogram.h index 11226ce..fa5f2be 100644 --- a/components/language/core/browser/url_language_histogram.h +++ b/components/language/core/browser/url_language_histogram.h
@@ -22,6 +22,12 @@ // discounted so that the histogram reflects changes in browsing habits. This // histogram does not have to contain all languages that ever appeared in user's // browsing, languages with insignificant frequency are removed, eventually. +// +// Operates as a "wrapper" around profile preferences: the state of the +// histogram is read from/written to the PrefService in each method call. This +// allows multiple instances of the histogram to be used in a (non-overlapping) +// sequence without any instance-specific state going "out of sync". This +// behaviour is relied on by clients of the histogram. class UrlLanguageHistogram : public KeyedService { public: struct LanguageInfo {
diff --git a/components/leveldb/leveldb_mojo_unittest.cc b/components/leveldb/leveldb_mojo_unittest.cc index 48e08f2..490fd92 100644 --- a/components/leveldb/leveldb_mojo_unittest.cc +++ b/components/leveldb/leveldb_mojo_unittest.cc
@@ -5,6 +5,7 @@ #include "components/leveldb/leveldb_struct_traits.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/leveldatabase/leveldb_chrome.h" namespace { @@ -20,7 +21,7 @@ input.paranoid_checks = !input.paranoid_checks; input.write_buffer_size += 1; input.max_open_files += 1; - input.block_cache = leveldb_env::SharedWebBlockCache(); + input.block_cache = leveldb_chrome::GetSharedWebBlockCache(); leveldb_env::Options output; ASSERT_TRUE(leveldb::mojom::OpenOptions::Deserialize( @@ -31,5 +32,5 @@ EXPECT_EQ(output.paranoid_checks, output.paranoid_checks); EXPECT_EQ(output.write_buffer_size, output.write_buffer_size); EXPECT_EQ(output.max_open_files, output.max_open_files); - EXPECT_EQ(leveldb_env::SharedWebBlockCache(), output.block_cache); + EXPECT_EQ(leveldb_chrome::GetSharedWebBlockCache(), output.block_cache); }
diff --git a/components/leveldb/leveldb_service_impl.cc b/components/leveldb/leveldb_service_impl.cc index 8a12e355..01295b2 100644 --- a/components/leveldb/leveldb_service_impl.cc +++ b/components/leveldb/leveldb_service_impl.cc
@@ -12,7 +12,6 @@ #include "components/leveldb/leveldb_database_impl.h" #include "components/leveldb/public/cpp/util.h" #include "mojo/public/cpp/bindings/strong_associated_binding.h" -#include "third_party/leveldatabase/env_chromium.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/env.h"
diff --git a/components/leveldb/leveldb_struct_traits.cc b/components/leveldb/leveldb_struct_traits.cc index 69c500b..866f4d6d 100644 --- a/components/leveldb/leveldb_struct_traits.cc +++ b/components/leveldb/leveldb_struct_traits.cc
@@ -5,6 +5,7 @@ #include "components/leveldb/leveldb_struct_traits.h" #include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" namespace mojo { @@ -46,7 +47,7 @@ NOTREACHED(); return leveldb::mojom::SharedReadCache::Default; } - if (options.block_cache == leveldb_env::SharedWebBlockCache()) + if (options.block_cache == leveldb_chrome::GetSharedWebBlockCache()) return leveldb::mojom::SharedReadCache::Web; leveldb_env::Options default_options; @@ -69,7 +70,7 @@ out->block_cache = options.block_cache; } break; case leveldb::mojom::SharedReadCache::Web: - out->block_cache = leveldb_env::SharedWebBlockCache(); + out->block_cache = leveldb_chrome::GetSharedWebBlockCache(); break; }
diff --git a/components/leveldb_proto/leveldb_database.cc b/components/leveldb_proto/leveldb_database.cc index c5f89a5..08d0197 100644 --- a/components/leveldb_proto/leveldb_database.cc +++ b/components/leveldb_proto/leveldb_database.cc
@@ -12,7 +12,7 @@ #include "base/metrics/histogram.h" #include "base/strings/string_split.h" #include "base/threading/thread_checker.h" -#include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" #include "third_party/leveldatabase/src/include/leveldb/cache.h" #include "third_party/leveldatabase/src/include/leveldb/db.h"
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn index 5aa6c479..98cc357b5 100644 --- a/components/metrics/BUILD.gn +++ b/components/metrics/BUILD.gn
@@ -33,6 +33,8 @@ "environment_recorder.h", "execution_phase.cc", "execution_phase.h", + "expired_histograms_checker.cc", + "expired_histograms_checker.h", "field_trials_provider.cc", "field_trials_provider.h", "file_metrics_provider.cc",
diff --git a/components/metrics/expired_histograms_checker.cc b/components/metrics/expired_histograms_checker.cc new file mode 100644 index 0000000..2eb14e7 --- /dev/null +++ b/components/metrics/expired_histograms_checker.cc
@@ -0,0 +1,21 @@ +// 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/metrics/expired_histograms_checker.h" + +#include <algorithm> + +namespace metrics { + +ExpiredHistogramsChecker::ExpiredHistogramsChecker(const uint64_t* array, + size_t size) + : array_(array), size_(size) {} + +ExpiredHistogramsChecker::~ExpiredHistogramsChecker() {} + +bool ExpiredHistogramsChecker::ShouldRecord(uint64_t histogram_hash) const { + return !std::binary_search(array_, array_ + size_, histogram_hash); +} + +} // namespace metrics
diff --git a/components/metrics/expired_histograms_checker.h b/components/metrics/expired_histograms_checker.h new file mode 100644 index 0000000..66834c83 --- /dev/null +++ b/components/metrics/expired_histograms_checker.h
@@ -0,0 +1,35 @@ +// 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 COMPONENTS_METRICS_EXPIRED_HISTOGRAMS_CHECKER_H_ +#define COMPONENTS_METRICS_EXPIRED_HISTOGRAMS_CHECKER_H_ + +#include <stdint.h> + +#include "base/macros.h" +#include "base/metrics/record_histogram_checker.h" + +namespace metrics { + +// ExpiredHistogramsChecker implements RecordHistogramChecker interface +// to avoid recording expired metrics. +class ExpiredHistogramsChecker final : public base::RecordHistogramChecker { + public: + // Takes sorted in nondecreasing order array of histogram hashes and its size. + ExpiredHistogramsChecker(const uint64_t* array, size_t size); + ~ExpiredHistogramsChecker() override; + + // Checks if the given |histogram_hash| corresponds to an expired histogram. + bool ShouldRecord(uint64_t histogram_hash) const override; + + private: + const uint64_t* const array_; + const size_t size_; + + DISALLOW_COPY_AND_ASSIGN(ExpiredHistogramsChecker); +}; + +} // namespace metrics + +#endif // COMPONENTS_METRICS_EXPIRED_HISTOGRAMS_CHECKER_H_
diff --git a/components/metrics/leak_detector/leak_detector_impl_unittest.cc b/components/metrics/leak_detector/leak_detector_impl_unittest.cc index 28874f0b..5a0c12ad 100644 --- a/components/metrics/leak_detector/leak_detector_impl_unittest.cc +++ b/components/metrics/leak_detector/leak_detector_impl_unittest.cc
@@ -4,7 +4,6 @@ #include "components/metrics/leak_detector/leak_detector_impl.h" -#include <math.h> #include <stddef.h> #include <stdint.h> @@ -15,6 +14,7 @@ #include <vector> #include "base/macros.h" +#include "base/numerics/math_constants.h" #include "components/metrics/leak_detector/custom_allocator.h" #include "testing/gtest/include/gtest/gtest.h" @@ -407,7 +407,7 @@ double angle = arg(root); // To generate other roots, rotate the principal root by increments of // 1/N of a full circle. - const double kAngleIncrement = M_PI * 2 / 5; + const double kAngleIncrement = base::kPiDouble * 2 / 5; // Second root. root = std::polar(magnitude, angle + kAngleIncrement);
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc index ccafb43..a9b0ae9 100644 --- a/components/nacl/browser/nacl_browser.cc +++ b/components/nacl/browser/nacl_browser.cc
@@ -31,7 +31,6 @@ // An arbitrary delay to coalesce multiple writes to the cache. const int kValidationCacheCoalescingTimeMS = 6000; -const char kValidationCacheSequenceName[] = "NaClValidationCache"; const base::FilePath::CharType kValidationCacheFileName[] = FILE_PATH_LITERAL("nacl_validation_cache.bin"); @@ -537,8 +536,7 @@ // the user interface for cache clearing is likely waiting for the callback. // In addition, we need to make sure the cache is actually cleared before // invoking the callback to meet the implicit guarantees of the UI. - content::BrowserThread::PostBlockingPoolSequencedTask( - kValidationCacheSequenceName, + file_task_runner_->PostTask( FROM_HERE, base::Bind(RemoveCache, validation_cache_file_path_, callback)); } @@ -582,11 +580,9 @@ // not allowed on the IO thread (which is the thread this method runs on) // because it can degrade the responsiveness of the browser. // The task is sequenced so that multiple writes happen in order. - content::BrowserThread::PostBlockingPoolSequencedTask( - kValidationCacheSequenceName, - FROM_HERE, - base::Bind(WriteCache, validation_cache_file_path_, - base::Owned(pickle))); + file_task_runner_->PostTask( + FROM_HERE, base::Bind(WriteCache, validation_cache_file_path_, + base::Owned(pickle))); } validation_cache_is_modified_ = false; }
diff --git a/components/nacl/browser/nacl_browser.h b/components/nacl/browser/nacl_browser.h index fc05e53..43f688b 100644 --- a/components/nacl/browser/nacl_browser.h +++ b/components/nacl/browser/nacl_browser.h
@@ -14,6 +14,7 @@ #include "base/containers/mru_cache.h" #include "base/files/file.h" #include "base/macros.h" +#include "base/task_scheduler/post_task.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/nacl/browser/nacl_browser_delegate.h" @@ -204,6 +205,10 @@ base::circular_deque<base::Time> crash_times_; + scoped_refptr<base::SequencedTaskRunner> file_task_runner_ = + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); + DISALLOW_COPY_AND_ASSIGN(NaClBrowser); };
diff --git a/components/nacl/browser/pnacl_host.cc b/components/nacl/browser/pnacl_host.cc index a3dafd7..9bcd9d8 100644 --- a/components/nacl/browser/pnacl_host.cc +++ b/components/nacl/browser/pnacl_host.cc
@@ -14,7 +14,6 @@ #include "base/logging.h" #include "base/numerics/safe_math.h" #include "base/task_scheduler/post_task.h" -#include "base/threading/sequenced_worker_pool.h" #include "components/nacl/browser/nacl_browser.h" #include "components/nacl/browser/pnacl_translation_cache.h" #include "content/public/browser/browser_thread.h" @@ -178,7 +177,7 @@ ///////////////////////////////////////// Temp files -// Create a temporary file on the blocking pool +// Create a temporary file on |file_task_runner_|. // static void PnaclHost::DoCreateTemporaryFile(base::FilePath temp_dir, TempFileCallback cb) { @@ -204,10 +203,9 @@ } void PnaclHost::CreateTemporaryFile(TempFileCallback cb) { - if (!BrowserThread::PostBlockingPoolSequencedTask( - "PnaclHostCreateTempFile", - FROM_HERE, - base::Bind(&PnaclHost::DoCreateTemporaryFile, temp_dir_, cb))) { + if (!file_task_runner_->PostTask( + FROM_HERE, + base::Bind(&PnaclHost::DoCreateTemporaryFile, temp_dir_, cb))) { DCHECK(thread_checker_.CalledOnValidThread()); cb.Run(base::File()); }
diff --git a/components/nacl/browser/pnacl_host.h b/components/nacl/browser/pnacl_host.h index ff3f04eb..04741e1 100644 --- a/components/nacl/browser/pnacl_host.h +++ b/components/nacl/browser/pnacl_host.h
@@ -13,6 +13,7 @@ #include "base/callback.h" #include "base/files/file.h" #include "base/macros.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/thread_checker.h" #include "components/nacl/browser/nacl_file_host.h" #include "components/nacl/common/pnacl_types.h" @@ -177,6 +178,10 @@ void DeInitIfSafe(); + scoped_refptr<base::SequencedTaskRunner> file_task_runner_ = + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); + // Operations which are pending with the cache backend, which we should // wait for before destroying it (see comment on DeInitIfSafe). int pending_backend_operations_ = 0;
diff --git a/components/ntp_snippets/BUILD.gn b/components/ntp_snippets/BUILD.gn index b99c3ac0..a865411 100644 --- a/components/ntp_snippets/BUILD.gn +++ b/components/ntp_snippets/BUILD.gn
@@ -53,6 +53,8 @@ "contextual/contextual_suggestions_fetcher_impl.h", "features.cc", "features.h", + "logger.cc", + "logger.h", "ntp_snippets_constants.cc", "ntp_snippets_constants.h", "offline_pages/recent_tab_suggestions_provider.cc", @@ -188,6 +190,7 @@ "contextual/contextual_content_suggestions_service_unittest.cc", "contextual/contextual_json_request_unittest.cc", "contextual/contextual_suggestions_fetcher_impl_unittest.cc", + "logger_unittest.cc", "offline_pages/recent_tab_suggestions_provider_unittest.cc", "physical_web_pages/physical_web_page_suggestions_provider_unittest.cc", "reading_list/reading_list_suggestions_provider_unittest.cc",
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc index 2814514..7e1b5ea 100644 --- a/components/ntp_snippets/content_suggestions_service.cc +++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -59,7 +59,8 @@ PrefService* pref_service, std::unique_ptr<CategoryRanker> category_ranker, std::unique_ptr<UserClassifier> user_classifier, - std::unique_ptr<RemoteSuggestionsScheduler> remote_suggestions_scheduler) + std::unique_ptr<RemoteSuggestionsScheduler> remote_suggestions_scheduler, + std::unique_ptr<Logger> debug_logger) : state_(state), signin_observer_(this), history_service_observer_(this), @@ -68,7 +69,8 @@ pref_service_(pref_service), remote_suggestions_scheduler_(std::move(remote_suggestions_scheduler)), user_classifier_(std::move(user_classifier)), - category_ranker_(std::move(category_ranker)) { + category_ranker_(std::move(category_ranker)), + debug_logger_(std::move(debug_logger)) { // Can be null in tests. if (signin_manager) { signin_observer_.Add(signin_manager); @@ -78,6 +80,8 @@ history_service_observer_.Add(history_service); } + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); + RestoreDismissedCategoriesFromPrefs(); }
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h index e9d49918..e95d0415 100644 --- a/components/ntp_snippets/content_suggestions_service.h +++ b/components/ntp_snippets/content_suggestions_service.h
@@ -26,6 +26,7 @@ #include "components/ntp_snippets/category_rankers/category_ranker.h" #include "components/ntp_snippets/category_status.h" #include "components/ntp_snippets/content_suggestions_provider.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" #include "components/ntp_snippets/user_classifier.h" #include "components/signin/core/browser/signin_manager.h" @@ -106,8 +107,8 @@ std::unique_ptr<CategoryRanker> category_ranker, std::unique_ptr<UserClassifier> user_classifier, std::unique_ptr<RemoteSuggestionsScheduler> - remote_suggestions_scheduler // Can be nullptr in unittests. - ); + remote_suggestions_scheduler, // Can be nullptr in unittests. + std::unique_ptr<Logger> debug_logger); ~ContentSuggestionsService() override; // Inherited from KeyedService. @@ -232,6 +233,10 @@ // supports it). void ClearDismissedSuggestionsForDebugging(Category category); + std::string GetDebugLog() const { + return debug_logger_->GetHumanReadableLog(); + } + // Returns true if the remote suggestions provider is enabled. bool AreRemoteSuggestionsEnabled() const; @@ -264,6 +269,8 @@ CategoryRanker* category_ranker() { return category_ranker_.get(); } + Logger* debug_logger() { return debug_logger_.get(); } + private: friend class ContentSuggestionsServiceTest; @@ -409,6 +416,8 @@ // Provides order for categories. std::unique_ptr<CategoryRanker> category_ranker_; + std::unique_ptr<Logger> debug_logger_; + DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); };
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc index aa5f66a..8f26cfb7 100644 --- a/components/ntp_snippets/content_suggestions_service_unittest.cc +++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -22,6 +22,7 @@ #include "components/ntp_snippets/category_status.h" #include "components/ntp_snippets/content_suggestion.h" #include "components/ntp_snippets/content_suggestions_provider.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/mock_content_suggestions_provider.h" #include "components/ntp_snippets/remote/remote_suggestions_provider_impl.h" #include "components/ntp_snippets/user_classifier.h" @@ -159,7 +160,7 @@ enabled, /*signin_manager=*/nullptr, /*history_service=*/nullptr, /*large_icon_service=*/nullptr, pref_service_.get(), std::move(category_ranker_), std::move(user_classifier), - /*scheduler=*/nullptr); + /*scheduler=*/nullptr, /*debug_logger=*/base::MakeUnique<Logger>()); } void ResetService() {
diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc index 4470c596..2895c481 100644 --- a/components/ntp_snippets/features.cc +++ b/components/ntp_snippets/features.cc
@@ -26,6 +26,7 @@ &kBreakingNewsPushFeature, &kCategoryOrder, &kCategoryRanker, + &kContentSuggestionsDebugLog, &kForeignSessionsSuggestionsFeature, &kIncreasedVisibility, &kKeepPrefetchedContentSuggestions, @@ -160,4 +161,7 @@ const base::Feature kKeepPrefetchedContentSuggestions{ "KeepPrefetchedContentSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kContentSuggestionsDebugLog{ + "ContentSuggestionsDebugLog", base::FEATURE_DISABLED_BY_DEFAULT}; + } // namespace ntp_snippets
diff --git a/components/ntp_snippets/features.h b/components/ntp_snippets/features.h index 130e97d..af47b62 100644 --- a/components/ntp_snippets/features.h +++ b/components/ntp_snippets/features.h
@@ -123,6 +123,9 @@ // have been fetched. extern const base::Feature kKeepPrefetchedContentSuggestions; +// Enables debug logging accessible through snippets-internals. +extern const base::Feature kContentSuggestionsDebugLog; + } // namespace ntp_snippets #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_
diff --git a/components/ntp_snippets/logger.cc b/components/ntp_snippets/logger.cc new file mode 100644 index 0000000..86ebed19 --- /dev/null +++ b/components/ntp_snippets/logger.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 "components/ntp_snippets/logger.h" + +#include <vector> + +#include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "components/ntp_snippets/features.h" + +namespace ntp_snippets { + +namespace { + +// Variation parameter for maximal number of the most recent log items for the +// logger to store. +const char kMaxItemsCountParamName[] = "max_items_count"; +const int kMaxItemsCountDefault = 1000; + +int GetMaxItemsCount() { + return base::GetFieldTrialParamByFeatureAsInt(kContentSuggestionsDebugLog, + kMaxItemsCountParamName, + kMaxItemsCountDefault); +} + +} // namespace + +Logger::Logger() = default; +Logger::~Logger() = default; + +void Logger::Log(const base::Location& from_here, const std::string& message) { + if (!IsLoggingEnabled()) { + return; + } + + logged_items_.emplace_back(message, base::Time::Now(), from_here); + if (static_cast<int>(logged_items_.size()) > GetMaxItemsCount()) { + logged_items_.pop_front(); + } +} + +std::string Logger::GetHumanReadableLog() const { + std::vector<std::string> message_strings; + for (const LogItem& item : logged_items_) { + message_strings.push_back(item.ToString()); + } + return base::JoinString(message_strings, /*separator=*/"\n"); +} + +// static +bool Logger::IsLoggingEnabled() { + return base::FeatureList::IsEnabled(kContentSuggestionsDebugLog); +} +// static +std::string Logger::TimeToString(const base::Time& time) { + base::Time::Exploded exploded; + time.UTCExplode(&exploded); + return base::StringPrintf( + "%04d-%02d-%02d %02d:%02d:%02d.%03d UTC", exploded.year, exploded.month, + exploded.day_of_month, exploded.hour, exploded.minute, exploded.second, + exploded.millisecond); +} + +Logger::LogItem::LogItem(const std::string& message, + const base::Time time, + const base::Location& from_where) + : message(message), time(time), from_where(from_where) {} + +std::string Logger::LogItem::ToString() const { + return base::StringPrintf("%s %s %s", TimeToString(time).c_str(), + from_where.ToString().c_str(), message.c_str()); +} + +} // namespace ntp_snippets
diff --git a/components/ntp_snippets/logger.h b/components/ntp_snippets/logger.h new file mode 100644 index 0000000..ad8d727f --- /dev/null +++ b/components/ntp_snippets/logger.h
@@ -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. + +#ifndef COMPONENTS_NTP_SNIPPETS_LOGGER_H_ +#define COMPONENTS_NTP_SNIPPETS_LOGGER_H_ + +#include <string> + +#include "base/containers/circular_deque.h" +#include "base/location.h" +#include "base/time/time.h" + +namespace ntp_snippets { + +class Logger { + public: + Logger(); + ~Logger(); + + // The call is ignored if the logging is disabled. However, if constructing a + // message is not cheap, do it only if |IsLoggingEnabled| returns true. + void Log(const base::Location& from_here, const std::string& message); + std::string GetHumanReadableLog() const; + + static bool IsLoggingEnabled(); + static std::string TimeToString(const base::Time& time); + + private: + struct LogItem { + std::string message; + base::Time time; + base::Location from_where; + + LogItem(const std::string& message, + const base::Time time, + const base::Location& from_where); + + std::string ToString() const; + }; + + // New items should be pushed back. + base::circular_deque<LogItem> logged_items_; +}; + +} // namespace ntp_snippets + +#endif // COMPONENTS_NTP_SNIPPETS_LOGGER_H_
diff --git a/components/ntp_snippets/logger_unittest.cc b/components/ntp_snippets/logger_unittest.cc new file mode 100644 index 0000000..595415a --- /dev/null +++ b/components/ntp_snippets/logger_unittest.cc
@@ -0,0 +1,87 @@ +// 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/ntp_snippets/logger.h" + +#include "base/location.h" +#include "base/strings/string_number_conversions.h" +#include "components/ntp_snippets/features.h" +#include "components/variations/variations_params_manager.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ntp_snippets { + +namespace { + +const int kMaxItemsCount = 1000; + +} // namespace + +class LoggerTest : public ::testing::Test { + public: + LoggerTest() = default; + ~LoggerTest() override = default; + + void EnableFeature() { + params_manager_.SetVariationParamsWithFeatureAssociations( + kContentSuggestionsDebugLog.name, + {{"max_items_count", base::IntToString(kMaxItemsCount)}}, + {kContentSuggestionsDebugLog.name}); + } + + private: + variations::testing::VariationParamsManager params_manager_; +}; + +TEST_F(LoggerTest, ShouldNotLogWhenNotEnabled) { + Logger logger; + logger.Log(FROM_HERE, /*message=*/"test"); + EXPECT_EQ("", logger.GetHumanReadableLog()); +} + +TEST_F(LoggerTest, ShouldLogInRightOrder) { + EnableFeature(); + Logger logger; + + logger.Log(FROM_HERE, /*message=*/"first"); + logger.Log(FROM_HERE, /*message=*/"second"); + + const std::string log = logger.GetHumanReadableLog(); + ASSERT_NE(std::string::npos, log.find("first")); + ASSERT_NE(std::string::npos, log.find("second")); + EXPECT_LT(log.find("first"), log.find("second")); +} + +TEST_F(LoggerTest, ShouldNotResetLogWhenDumping) { + EnableFeature(); + Logger logger; + + logger.Log(FROM_HERE, /*message=*/"first"); + logger.Log(FROM_HERE, /*message=*/"second"); + + const std::string first_call = logger.GetHumanReadableLog(); + const std::string second_call = logger.GetHumanReadableLog(); + EXPECT_EQ(first_call, second_call); +} + +TEST_F(LoggerTest, ShouldLimitLogItems) { + EnableFeature(); + Logger logger; + + logger.Log(FROM_HERE, /*message=*/"first_event"); + for (int i = 0; i < kMaxItemsCount - 1; ++i) { + logger.Log(FROM_HERE, /*message=*/"other_event"); + } + // The first event still should be in the log. + ASSERT_NE(std::string::npos, + logger.GetHumanReadableLog().find("first_event")); + + logger.Log(FROM_HERE, /*message=*/"other_event"); + // The first event should not be in the log anymore. + EXPECT_EQ(std::string::npos, + logger.GetHumanReadableLog().find("first_event")); +} + +} // namespace ntp_snippets
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc index c6550993..ced2e4f 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
@@ -17,6 +17,7 @@ #include "base/metrics/sparse_histogram.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/default_clock.h" #include "base/time/time.h" @@ -337,7 +338,8 @@ std::unique_ptr<RemoteSuggestionsDatabase> database, std::unique_ptr<RemoteSuggestionsStatusService> status_service, std::unique_ptr<PrefetchedPagesTracker> prefetched_pages_tracker, - std::unique_ptr<BreakingNewsListener> breaking_news_raw_data_provider) + std::unique_ptr<BreakingNewsListener> breaking_news_raw_data_provider, + Logger* debug_logger) : RemoteSuggestionsProvider(observer), state_(State::NOT_INITED), pref_service_(pref_service), @@ -356,7 +358,9 @@ clock_(base::MakeUnique<base::DefaultClock>()), prefetched_pages_tracker_(std::move(prefetched_pages_tracker)), breaking_news_raw_data_provider_( - std::move(breaking_news_raw_data_provider)) { + std::move(breaking_news_raw_data_provider)), + debug_logger_(debug_logger) { + DCHECK(debug_logger_); RestoreCategoriesFromPrefs(); // The articles category always exists. Add it if we didn't get it from prefs. // TODO(treib): Rethink this. @@ -445,6 +449,7 @@ void RemoteSuggestionsProviderImpl::FetchSuggestions( bool interactive_request, FetchStatusCallback callback) { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); if (!ready()) { fetch_when_ready_ = true; fetch_when_ready_interactive_ = interactive_request; @@ -466,6 +471,8 @@ const Category& category, const std::set<std::string>& known_suggestion_ids, FetchDoneCallback callback) { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); + if (!ready()) { CallWithEmptyResults(std::move(callback), Status(StatusCode::TEMPORARY_ERROR, @@ -763,6 +770,8 @@ bool interactive_request, Status status, RemoteSuggestionsFetcher::OptionalFetchedCategories fetched_categories) { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); + if (!ready()) { // TODO(tschumann): What happens if this was a user-triggered, interactive // request? Is the UI waiting indefinitely now? @@ -824,6 +833,13 @@ // If suggestions were fetched successfully, update our |category_contents_| // from each category provided by the server. if (fetched_categories) { + if (Logger::IsLoggingEnabled()) { + debug_logger_->Log( + FROM_HERE, + base::StringPrintf("fetched categories count = %d", + static_cast<int>(fetched_categories->size()))); + } + // TODO(treib): Reorder |category_contents_| to match the order we received // from the server. crbug.com/653816 bool response_includes_article_category = false; @@ -834,6 +850,14 @@ std::min(fetched_category.suggestions.size(), static_cast<size_t>(kMaxSuggestionCount + 1))); response_includes_article_category = true; + + if (Logger::IsLoggingEnabled()) { + debug_logger_->Log( + FROM_HERE, + base::StringPrintf( + "articles category size = %d", + static_cast<int>(fetched_category.suggestions.size()))); + } } CategoryContent* content =
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h index f450c3c1..9824c2d 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
@@ -24,6 +24,7 @@ #include "components/ntp_snippets/category_status.h" #include "components/ntp_snippets/content_suggestion.h" #include "components/ntp_snippets/content_suggestions_provider.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/remote/cached_image_fetcher.h" #include "components/ntp_snippets/remote/json_to_categories.h" #include "components/ntp_snippets/remote/prefetched_pages_tracker.h" @@ -70,7 +71,8 @@ std::unique_ptr<RemoteSuggestionsDatabase> database, std::unique_ptr<RemoteSuggestionsStatusService> status_service, std::unique_ptr<PrefetchedPagesTracker> prefetched_pages_tracker, - std::unique_ptr<BreakingNewsListener> breaking_news_raw_data_provider); + std::unique_ptr<BreakingNewsListener> breaking_news_raw_data_provider, + Logger* debug_logger); ~RemoteSuggestionsProviderImpl() override; @@ -443,6 +445,9 @@ // provider. std::unique_ptr<BreakingNewsListener> breaking_news_raw_data_provider_; + // Additional logging, accesible through snippets-internals. + Logger* debug_logger_; + DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProviderImpl); };
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc index 7799f92..1ad9939f 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -39,6 +39,7 @@ #include "components/ntp_snippets/category_rankers/mock_category_ranker.h" #include "components/ntp_snippets/fake_content_suggestions_provider_observer.h" #include "components/ntp_snippets/features.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/ntp_snippets_constants.h" #include "components/ntp_snippets/pref_names.h" #include "components/ntp_snippets/remote/json_to_categories.h" @@ -411,7 +412,7 @@ std::move(image_fetcher), std::move(database), std::move(remote_suggestions_status_service), std::move(mock_prefetched_pages_tracker), - std::move(fake_breaking_news_listener)); + std::move(fake_breaking_news_listener), &debug_logger_); } std::unique_ptr<RemoteSuggestionsProviderImpl> @@ -625,6 +626,8 @@ base::ScopedTempDir database_dir_; RemoteSuggestionsDatabase* database_; + Logger debug_logger_; + DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProviderImplTest); };
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc index 3837597b..4aa48c6 100644 --- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc
@@ -11,10 +11,12 @@ #include "base/bind.h" #include "base/feature_list.h" +#include "base/location.h" #include "base/memory/ptr_util.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_split.h" +#include "base/strings/stringprintf.h" #include "base/time/clock.h" #include "components/ntp_snippets/features.h" #include "components/ntp_snippets/pref_names.h" @@ -427,7 +429,8 @@ const UserClassifier* user_classifier, PrefService* profile_prefs, PrefService* local_state_prefs, - std::unique_ptr<base::Clock> clock) + std::unique_ptr<base::Clock> clock, + Logger* debug_logger) : persistent_scheduler_(persistent_scheduler), provider_(nullptr), background_fetch_in_progress_(false), @@ -452,9 +455,11 @@ base::Unretained(this)))), profile_prefs_(profile_prefs), clock_(std::move(clock)), - enabled_triggers_(GetEnabledTriggerTypes()) { + enabled_triggers_(GetEnabledTriggerTypes()), + debug_logger_(debug_logger) { DCHECK(user_classifier); DCHECK(profile_prefs); + DCHECK(debug_logger_); LoadLastFetchingSchedule(); } @@ -502,6 +507,7 @@ } void RemoteSuggestionsSchedulerImpl::OnSuggestionsCleared() { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); // This should be called by |provider_| so it should exist. DCHECK(provider_); // Some user action causes suggestions to be cleared, fetch now (as an @@ -537,23 +543,27 @@ } void RemoteSuggestionsSchedulerImpl::OnPersistentSchedulerWakeUp() { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); RefetchInTheBackgroundIfAppropriate( TriggerType::PERSISTENT_SCHEDULER_WAKE_UP); } void RemoteSuggestionsSchedulerImpl::OnBrowserForegrounded() { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); // TODO(jkrcal): Consider that this is called whenever we open or return to an // Activity. Therefore, keep work light for fast start up calls. RefetchInTheBackgroundIfAppropriate(TriggerType::BROWSER_FOREGROUNDED); } void RemoteSuggestionsSchedulerImpl::OnBrowserColdStart() { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); // TODO(jkrcal): Consider that work here must be kept light for fast // cold start ups. RefetchInTheBackgroundIfAppropriate(TriggerType::BROWSER_COLD_START); } void RemoteSuggestionsSchedulerImpl::OnSuggestionsSurfaceOpened() { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); // TODO(jkrcal): Consider that this is called whenever we open an NTP. // Therefore, keep work light for fast start up calls. RefetchInTheBackgroundIfAppropriate(TriggerType::SURFACE_OPENED); @@ -652,11 +662,15 @@ void RemoteSuggestionsSchedulerImpl::RefetchInTheBackgroundIfAppropriate( TriggerType trigger) { + debug_logger_->Log(FROM_HERE, /*message=*/std::string()); + if (background_fetch_in_progress_) { + debug_logger_->Log(FROM_HERE, "stop due to ongoing fetch"); return; } if (enabled_triggers_.count(trigger) == 0) { + debug_logger_->Log(FROM_HERE, "stop due to disabled trigger"); return; } @@ -664,10 +678,12 @@ // Do not let a request fail due to lack of internet connection. Then, such // a failure would get logged and further requests would be blocked for a // while (even after becoming online). + debug_logger_->Log(FROM_HERE, "stop due to being offline"); return; } if (!IsReadyForBackgroundFetches()) { + debug_logger_->Log(FROM_HERE, "delay until ready"); queued_triggers_.insert(trigger); return; } @@ -692,10 +708,12 @@ if (trigger != TriggerType::PERSISTENT_SCHEDULER_WAKE_UP && !ShouldRefetchInTheBackgroundNow(last_fetch_attempt_time, trigger)) { + debug_logger_->Log(FROM_HERE, "stop, because too soon"); return; } if (!AcquireQuota(/*interactive_request=*/false)) { + debug_logger_->Log(FROM_HERE, "stop due to quota"); return; } @@ -719,6 +737,7 @@ "NewTabPage.ContentSuggestions.BackgroundFetchTrigger", static_cast<int>(trigger), static_cast<int>(TriggerType::COUNT)); + debug_logger_->Log(FROM_HERE, "issuing a fetch"); background_fetch_in_progress_ = true; provider_->RefetchInTheBackground(base::Bind( &RemoteSuggestionsSchedulerImpl::RefetchInTheBackgroundFinished, @@ -744,6 +763,25 @@ } base::Time now = clock_->Now(); + if (Logger::IsLoggingEnabled()) { + if (background_fetches_allowed_after_ > now) { + debug_logger_->Log( + FROM_HERE, + base::StringPrintf( + "due to privacy, next fetch is allowed after %s", + Logger::TimeToString(background_fetches_allowed_after_).c_str())); + } + if (first_allowed_fetch_time > now) { + debug_logger_->Log( + FROM_HERE, + base::StringPrintf( + "next fetch is scheduled after %s (as last fetch " + "attempt occured at %s)", + Logger::TimeToString(first_allowed_fetch_time).c_str(), + Logger::TimeToString(last_fetch_attempt_time).c_str())); + } + } + return background_fetches_allowed_after_ <= now && first_allowed_fetch_time <= now; }
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h index 99bc7a2..41a0765 100644 --- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h
@@ -15,6 +15,7 @@ #include "base/time/clock.h" #include "base/time/time.h" #include "components/ntp_snippets/content_suggestions_provider.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/remote/persistent_scheduler.h" #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" #include "components/ntp_snippets/remote/request_throttler.h" @@ -40,7 +41,8 @@ const UserClassifier* user_classifier, PrefService* profile_prefs, PrefService* local_state_prefs, - std::unique_ptr<base::Clock> clock); + std::unique_ptr<base::Clock> clock, + Logger* debug_logger); ~RemoteSuggestionsSchedulerImpl() override; @@ -164,6 +166,9 @@ base::Time background_fetches_allowed_after_; + // Additional logging, accesible through snippets-internals. + Logger* debug_logger_; + DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsSchedulerImpl); };
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc index 07a9c3c..c1fc6756 100644 --- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
@@ -22,6 +22,7 @@ #include "base/time/default_clock.h" #include "base/time/time.h" #include "components/ntp_snippets/features.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/ntp_snippets_constants.h" #include "components/ntp_snippets/pref_names.h" #include "components/ntp_snippets/remote/persistent_scheduler.h" @@ -179,7 +180,7 @@ scheduler_ = base::MakeUnique<RemoteSuggestionsSchedulerImpl>( &persistent_scheduler_, &user_classifier_, utils_.pref_service(), - &local_state_, std::move(test_clock)); + &local_state_, std::move(test_clock), &debug_logger_); scheduler_->SetProvider(provider_.get()); } @@ -253,6 +254,7 @@ base::SimpleTestClock* test_clock_; std::unique_ptr<MockRemoteSuggestionsProvider> provider_; std::unique_ptr<RemoteSuggestionsSchedulerImpl> scheduler_; + Logger debug_logger_; DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsSchedulerImplTest); };
diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc index aac8de5..9d467009 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc
@@ -478,8 +478,8 @@ if (!match.destination_url.is_valid()) return; - if (ui::PageTransitionTypeIncludingQualifiersIs(match.transition, - ui::PAGE_TRANSITION_TYPED) && + if (ui::PageTransitionCoreTypeIs(match.transition, + ui::PAGE_TRANSITION_TYPED) && (match.destination_url == PermanentURL())) { // When the user hit enter on the existing permanent URL, treat it like a // reload for scoring purposes. We could detect this by just checking
diff --git a/components/omnibox/browser/scored_history_match.cc b/components/omnibox/browser/scored_history_match.cc index 32672e00..afcf569b 100644 --- a/components/omnibox/browser/scored_history_match.cc +++ b/components/omnibox/browser/scored_history_match.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/bookmarks/browser/bookmark_utils.h" +#include "components/omnibox/browser/autocomplete_match.h" #include "components/omnibox/browser/history_url_provider.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/url_prefix.h" @@ -102,17 +103,6 @@ } } -size_t GetAdjustedOffsetForComponent( - const GURL& url, - const base::OffsetAdjuster::Adjustments& adjustments, - const url::Parsed::ComponentType& component) { - const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); - - size_t result = parsed.CountCharactersBefore(component, true); - base::OffsetAdjuster::AdjustOffset(adjustments, &result); - return result; -} - } // namespace // static @@ -154,6 +144,9 @@ // Initialize HistoryMatch fields. TODO(tommycli): Merge these two classes. url_info = row; input_location = 0; + match_in_scheme = false; + match_in_subdomain = false; + match_after_host = false; innermost_match = false; // NOTE: Call Init() before doing any validity checking to ensure that the @@ -166,12 +159,13 @@ // so that we can score as well as provide autocomplete highlighting. base::OffsetAdjuster::Adjustments adjustments; GURL gurl = row.url(); - base::string16 url = + base::string16 cleaned_up_url_for_matching = bookmarks::CleanUpUrlForMatching(gurl, &adjustments); base::string16 title = bookmarks::CleanUpTitleForMatching(row.title()); int term_num = 0; for (const auto& term : terms_vector) { - TermMatches url_term_matches = MatchTermInString(term, url, term_num); + TermMatches url_term_matches = + MatchTermInString(term, cleaned_up_url_for_matching, term_num); TermMatches title_term_matches = MatchTermInString(term, title, term_num); if (url_term_matches.empty() && title_term_matches.empty()) { // A term was not found in either URL or title - reject. @@ -331,6 +325,16 @@ std::vector<size_t> offsets = OffsetsFromTermMatches(url_matches); base::OffsetAdjuster::UnadjustOffsets(adjustments, &offsets); url_matches = ReplaceOffsetsInTermMatches(url_matches, offsets); + + // Now that url_matches contains the unadjusted offsets referring to the + // original URL, we can calculate which components the matches are for. + std::vector<AutocompleteMatch::MatchPosition> match_positions; + for (auto& url_match : url_matches) { + match_positions.push_back( + std::make_pair(url_match.offset, url_match.offset + url_match.length)); + } + AutocompleteMatch::GetMatchComponents(gurl, match_positions, &match_in_scheme, + &match_in_subdomain, &match_after_host); } ScoredHistoryMatch::ScoredHistoryMatch(const ScoredHistoryMatch& other) = @@ -454,27 +458,19 @@ WordStarts::const_iterator end_word_starts = word_starts.url_word_starts_.end(); - const size_t query_pos = - GetAdjustedOffsetForComponent(url, adjustments, url::Parsed::QUERY); - const size_t host_pos = - GetAdjustedOffsetForComponent(url, adjustments, url::Parsed::HOST); - const size_t path_pos = - GetAdjustedOffsetForComponent(url, adjustments, url::Parsed::PATH); - - // Get the position of the last period in the hostname. const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); - size_t last_part_of_host_pos = url.possibly_invalid_spec().rfind( - '.', parsed.CountCharactersBefore(url::Parsed::PATH, true)); - base::OffsetAdjuster::AdjustOffset(adjustments, &last_part_of_host_pos); + size_t host_pos = parsed.CountCharactersBefore(url::Parsed::HOST, true); + size_t path_pos = parsed.CountCharactersBefore(url::Parsed::PATH, true); + size_t query_pos = parsed.CountCharactersBefore(url::Parsed::QUERY, true); + size_t last_part_of_host_pos = + url.possibly_invalid_spec().rfind('.', path_pos); - // Get the position of the domain and registry portion of the hostname. - size_t domain_and_registry_pos = - parsed.CountCharactersBefore(url::Parsed::PATH, true) - - net::registry_controlled_domains::GetDomainAndRegistry( - url.host_piece(), - net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) - .size(); - base::OffsetAdjuster::AdjustOffset(adjustments, &domain_and_registry_pos); + // |word_starts| and |url_matches| both contain offsets for the cleaned up + // URL used for matching, so we have to follow those adjustments. + base::OffsetAdjuster::AdjustOffset(adjustments, &host_pos); + base::OffsetAdjuster::AdjustOffset(adjustments, &path_pos); + base::OffsetAdjuster::AdjustOffset(adjustments, &query_pos); + base::OffsetAdjuster::AdjustOffset(adjustments, &last_part_of_host_pos); // Loop through all URL matches and score them appropriately. // First, filter all matches not at a word boundary and in the path (or @@ -506,18 +502,11 @@ // The match is in the query or ref component. DCHECK(at_word_boundary); term_scores[url_match.term_num] += 5; - match_after_host = true; } else if (term_word_offset >= path_pos) { // The match is in the path component. DCHECK(at_word_boundary); term_scores[url_match.term_num] += 8; - match_after_host = true; } else if (term_word_offset >= host_pos) { - if (term_word_offset < domain_and_registry_pos) - match_in_subdomain = true; - if (url_match.offset + url_match.length > path_pos) - match_after_host = true; - if (term_word_offset < last_part_of_host_pos) { // Either there are no dots in the hostname or this match isn't // the last dotted component. @@ -532,12 +521,6 @@ // The match is in the protocol (a.k.a. scheme). // Matches not at a word boundary should have been filtered already. DCHECK(at_word_boundary); - match_in_scheme = true; - if (url_match.offset + url_match.length > host_pos) - match_in_subdomain = true; - if (url_match.offset + url_match.length > path_pos) - match_after_host = true; - if (allow_scheme_matches_) term_scores[url_match.term_num] += 10; }
diff --git a/components/resources/default_100_percent/autofill/cc-generic.png b/components/resources/default_100_percent/autofill/cc-generic.png index 1ee634be..43d77c2 100644 --- a/components/resources/default_100_percent/autofill/cc-generic.png +++ b/components/resources/default_100_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/resources/default_200_percent/autofill/cc-generic.png b/components/resources/default_200_percent/autofill/cc-generic.png index 5eadeec..559aa286 100644 --- a/components/resources/default_200_percent/autofill/cc-generic.png +++ b/components/resources/default_200_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/amex.png b/components/resources/default_300_percent/autofill/amex.png index 99584118..48a5a579 100644 --- a/components/resources/default_300_percent/autofill/amex.png +++ b/components/resources/default_300_percent/autofill/amex.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/cc-generic.png b/components/resources/default_300_percent/autofill/cc-generic.png index 1a556d0..5827ec26 100644 --- a/components/resources/default_300_percent/autofill/cc-generic.png +++ b/components/resources/default_300_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/diners.png b/components/resources/default_300_percent/autofill/diners.png index b3eaa4e..ed5aae44 100644 --- a/components/resources/default_300_percent/autofill/diners.png +++ b/components/resources/default_300_percent/autofill/diners.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/discover.png b/components/resources/default_300_percent/autofill/discover.png index 9ba9a63f..ac4b02b 100644 --- a/components/resources/default_300_percent/autofill/discover.png +++ b/components/resources/default_300_percent/autofill/discover.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/jcb.png b/components/resources/default_300_percent/autofill/jcb.png index 5a924a2..628ca00 100644 --- a/components/resources/default_300_percent/autofill/jcb.png +++ b/components/resources/default_300_percent/autofill/jcb.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/mastercard.png b/components/resources/default_300_percent/autofill/mastercard.png index 4769517..d13be55 100644 --- a/components/resources/default_300_percent/autofill/mastercard.png +++ b/components/resources/default_300_percent/autofill/mastercard.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/mir.png b/components/resources/default_300_percent/autofill/mir.png index 41b8cc5..cb8a805d 100644 --- a/components/resources/default_300_percent/autofill/mir.png +++ b/components/resources/default_300_percent/autofill/mir.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/unionpay.png b/components/resources/default_300_percent/autofill/unionpay.png index 98cc3a7..0ac0b38 100644 --- a/components/resources/default_300_percent/autofill/unionpay.png +++ b/components/resources/default_300_percent/autofill/unionpay.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/visa.png b/components/resources/default_300_percent/autofill/visa.png index 189d94e..fc8ac65 100644 --- a/components/resources/default_300_percent/autofill/visa.png +++ b/components/resources/default_300_percent/autofill/visa.png Binary files differ
diff --git a/components/safe_browsing_db/hit_report.h b/components/safe_browsing_db/hit_report.h index 9df6a90..134a9f9 100644 --- a/components/safe_browsing_db/hit_report.h +++ b/components/safe_browsing_db/hit_report.h
@@ -40,7 +40,8 @@ SBThreatType threat_type; ThreatSource threat_source; - // Opaque string used for tracking Pver4-based experiments + // Opaque string used for tracking Pver4-based experiments. + // NOTE(vakh): Unused at the moment, but may be used later. std::string population_id; ExtendedReportingLevel extended_reporting_level;
diff --git a/components/safe_browsing_db/v4_update_protocol_manager.cc b/components/safe_browsing_db/v4_update_protocol_manager.cc index d1ed6fd..768e0f0 100644 --- a/components/safe_browsing_db/v4_update_protocol_manager.cc +++ b/components/safe_browsing_db/v4_update_protocol_manager.cc
@@ -364,7 +364,7 @@ void V4UpdateProtocolManager::HandleTimeout() { UMA_HISTOGRAM_BOOLEAN("SafeBrowsing.V4Update.TimedOut", true); request_.reset(); - ScheduleNextUpdateWithBackoff(false); + ScheduleNextUpdateWithBackoff(true); } // net::URLFetcherDelegate implementation ----------------------------------
diff --git a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc b/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc index e76e249..170880f 100644 --- a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc +++ b/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
@@ -5,6 +5,7 @@ #include "components/safe_browsing_db/v4_update_protocol_manager.h" #include <memory> +#include <utility> #include <vector> #include "base/base64.h" @@ -113,7 +114,7 @@ } std::string GetExpectedV4UpdateResponse( - std::vector<ListUpdateResponse>& expected_lurs) const { + const std::vector<ListUpdateResponse>& expected_lurs) const { FetchThreatListUpdatesResponse response; for (const auto& expected_lur : expected_lurs) { @@ -352,6 +353,10 @@ // Now wait for the next request to be scheduled. runner->RunPendingTasks(); + // Should have recorded one error, but back off multiplier is unchanged. + EXPECT_EQ(1ul, pm->update_error_count_); + EXPECT_EQ(1ul, pm->update_back_off_mult_); + // There should be another fetcher now. fetcher = factory.GetFetcherByID(1); DCHECK(fetcher);
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json index 212a816..8f277a7779 100644 --- a/components/search_engines/prepopulated_engines.json +++ b/components/search_engines/prepopulated_engines.json
@@ -32,7 +32,7 @@ // Increment this if you change the data in ways that mean users with // existing data should get a new version. - "kCurrentDataVersion": 98 + "kCurrentDataVersion": 99 }, // The following engines are included in country lists and are added to the @@ -43,7 +43,7 @@ "keyword": "aol.com", "favicon_url": "https://search.aol.com/favicon.ico", "search_url": "https://search.aol.com/aol/search?q={searchTerms}", - "suggest_url": "http://autocomplete.search.aol.com/autocomplete/get?output=json&it=&q={searchTerms}", + "suggest_url": "https://autosuggest.search.aol.com/autocomplete/get?output=json&it=&q={searchTerms}", "type": "SEARCH_ENGINE_AOL", "id": 35 },
diff --git a/components/security_state/content/content_utils.cc b/components/security_state/content/content_utils.cc index d7608b4a..dac337b 100644 --- a/components/security_state/content/content_utils.cc +++ b/components/security_state/content/content_utils.cc
@@ -93,7 +93,7 @@ const security_state::SecurityInfo& security_info, content::SecurityStyleExplanations* security_style_explanations) { if (security_info.sha1_in_chain) { - security_style_explanations->neutral_explanations.push_back( + security_style_explanations->insecure_explanations.push_back( content::SecurityStyleExplanation( l10n_util::GetStringUTF8(IDS_SHA1), l10n_util::GetStringUTF8(IDS_SHA1_DESCRIPTION),
diff --git a/components/ssl_config/ssl_config_service_manager_pref.cc b/components/ssl_config/ssl_config_service_manager_pref.cc index 41925a9..d10ce15 100644 --- a/components/ssl_config/ssl_config_service_manager_pref.cc +++ b/components/ssl_config/ssl_config_service_manager_pref.cc
@@ -227,6 +227,20 @@ local_state->SetDefaultPrefValue( ssl_config::prefs::kSSLVersionMax, new base::Value(switches::kSSLVersionTLSv13)); + } else if (tls13_variant == "experiment2") { + local_state->SetDefaultPrefValue( + ssl_config::prefs::kTLS13Variant, + new base::Value(switches::kTLS13VariantExperiment2)); + local_state->SetDefaultPrefValue( + ssl_config::prefs::kSSLVersionMax, + new base::Value(switches::kSSLVersionTLSv13)); + } else if (tls13_variant == "experiment3") { + local_state->SetDefaultPrefValue( + ssl_config::prefs::kTLS13Variant, + new base::Value(switches::kTLS13VariantExperiment3)); + local_state->SetDefaultPrefValue( + ssl_config::prefs::kSSLVersionMax, + new base::Value(switches::kSSLVersionTLSv13)); } PrefChangeRegistrar::NamedChangeCallback local_state_callback = @@ -343,6 +357,10 @@ } else if (tls13_variant_str == switches::kTLS13VariantNoSessionIDExperiment) { config->tls13_variant = net::kTLS13VariantNoSessionIDExperiment; + } else if (tls13_variant_str == switches::kTLS13VariantExperiment2) { + config->tls13_variant = net::kTLS13VariantExperiment2; + } else if (tls13_variant_str == switches::kTLS13VariantExperiment3) { + config->tls13_variant = net::kTLS13VariantExperiment3; } config->disabled_cipher_suites = disabled_cipher_suites_;
diff --git a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc index 6e8f454..56bc249 100644 --- a/components/ssl_config/ssl_config_service_manager_pref_unittest.cc +++ b/components/ssl_config/ssl_config_service_manager_pref_unittest.cc
@@ -336,6 +336,48 @@ EXPECT_EQ(net::kTLS13VariantNoSessionIDExperiment, ssl_config.tls13_variant); } +// Tests that Experiment2 TLS 1.3 can be enabled via field trials. +TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureExperiment2) { + // Toggle the field trial. + variations::testing::VariationParamsManager variation_params( + "TLS13Variant", {{"variant", "experiment2"}}); + + TestingPrefServiceSimple local_state; + SSLConfigServiceManager::RegisterPrefs(local_state.registry()); + + std::unique_ptr<SSLConfigServiceManager> config_manager( + SSLConfigServiceManager::CreateDefaultManager( + &local_state, base::ThreadTaskRunnerHandle::Get())); + scoped_refptr<SSLConfigService> config_service(config_manager->Get()); + ASSERT_TRUE(config_service.get()); + + SSLConfig ssl_config; + config_service->GetSSLConfig(&ssl_config); + EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); + EXPECT_EQ(net::kTLS13VariantExperiment2, ssl_config.tls13_variant); +} + +// Tests that Experiment3 TLS 1.3 can be enabled via field trials. +TEST_F(SSLConfigServiceManagerPrefTest, TLS13VariantFeatureExperiment3) { + // Toggle the field trial. + variations::testing::VariationParamsManager variation_params( + "TLS13Variant", {{"variant", "experiment3"}}); + + TestingPrefServiceSimple local_state; + SSLConfigServiceManager::RegisterPrefs(local_state.registry()); + + std::unique_ptr<SSLConfigServiceManager> config_manager( + SSLConfigServiceManager::CreateDefaultManager( + &local_state, base::ThreadTaskRunnerHandle::Get())); + scoped_refptr<SSLConfigService> config_service(config_manager->Get()); + ASSERT_TRUE(config_service.get()); + + SSLConfig ssl_config; + config_service->GetSSLConfig(&ssl_config); + EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); + EXPECT_EQ(net::kTLS13VariantExperiment3, ssl_config.tls13_variant); +} + // Tests that the SSLVersionMax preference overwites the TLS 1.3 variant // field trial. TEST_F(SSLConfigServiceManagerPrefTest, TLS13SSLVersionMax) {
diff --git a/components/ssl_config/ssl_config_switches.cc b/components/ssl_config/ssl_config_switches.cc index b4e6456..c1fa6b9 100644 --- a/components/ssl_config/ssl_config_switches.cc +++ b/components/ssl_config/ssl_config_switches.cc
@@ -29,5 +29,7 @@ const char kTLS13VariantExperiment[] = "experiment"; const char kTLS13VariantRecordTypeExperiment[] = "record-type"; const char kTLS13VariantNoSessionIDExperiment[] = "no-session-id"; +const char kTLS13VariantExperiment2[] = "experiment2"; +const char kTLS13VariantExperiment3[] = "experiment3"; } // namespace switches
diff --git a/components/ssl_config/ssl_config_switches.h b/components/ssl_config/ssl_config_switches.h index 6ea39034..3335985 100644 --- a/components/ssl_config/ssl_config_switches.h +++ b/components/ssl_config/ssl_config_switches.h
@@ -19,6 +19,8 @@ extern const char kTLS13VariantExperiment[]; extern const char kTLS13VariantRecordTypeExperiment[]; extern const char kTLS13VariantNoSessionIDExperiment[]; +extern const char kTLS13VariantExperiment2[]; +extern const char kTLS13VariantExperiment3[]; } // namespace switches
diff --git a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java index e5bdffd..d575660 100644 --- a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java +++ b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
@@ -20,6 +20,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.CallbackHelper; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.ChromeSigninController; @@ -318,10 +319,10 @@ "null account should not be synced", AndroidSyncSettings.isSyncEnabled(mContext)); } - // TODO(crbug/737862): This test is flaky. When it fails, append report to the bug. @Test @SmallTest @Feature({"Sync"}) + @DisabledTest(message = "crbug.com/737862") public void testSyncSettingsCaching() throws InterruptedException { // Turn on syncability. mSyncContentResolverDelegate.setMasterSyncAutomatically(true);
diff --git a/components/tracing/common/trace_startup.cc b/components/tracing/common/trace_startup.cc index 551564c6..7a04869 100644 --- a/components/tracing/common/trace_startup.cc +++ b/components/tracing/common/trace_startup.cc
@@ -18,6 +18,10 @@ const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); + // Ensure TraceLog is initialized first. + // https://crbug.com/764357 + base::trace_event::TraceLog::GetInstance(); + // Enables heap profiling if "--enable-heap-profiling" flag is passed. base::trace_event::MemoryDumpManager::GetInstance() ->EnableHeapProfilingIfNeeded();
diff --git a/components/translate/core/browser/translate_ranker_impl.cc b/components/translate/core/browser/translate_ranker_impl.cc index 6e70ab0..d2267b0 100644 --- a/components/translate/core/browser/translate_ranker_impl.cc +++ b/components/translate/core/browser/translate_ranker_impl.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_util.h" #include "base/task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/build_config.h" #include "components/machine_intelligence/proto/ranker_model.pb.h" #include "components/machine_intelligence/proto/translate_ranker_model.pb.h" #include "components/machine_intelligence/ranker_model.h" @@ -73,11 +74,19 @@ } // namespace +const char kDefaultTranslateRankerModelURL[] = + "https://www.gstatic.com/chrome/intelligence/assist/ranker/models/" + "translate/2017/03/translate_ranker_model_20170329.pb.bin"; const base::Feature kTranslateRankerQuery{"TranslateRankerQuery", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; +#if defined(OS_ANDROID) const base::Feature kTranslateRankerEnforcement{ "TranslateRankerEnforcement", base::FEATURE_DISABLED_BY_DEFAULT}; +#else +const base::Feature kTranslateRankerEnforcement{ + "TranslateRankerEnforcement", base::FEATURE_ENABLED_BY_DEFAULT}; +#endif const base::Feature kTranslateRankerDecisionOverride{ "TranslateRankerDecisionOverride", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -167,6 +176,10 @@ // static GURL TranslateRankerImpl::GetModelURL() { + if (!base::FeatureList::IsEnabled(kTranslateRankerQuery) && + !base::FeatureList::IsEnabled(kTranslateRankerEnforcement)) { + return GURL(); + } // Allow override of the ranker model URL from the command line. std::string raw_url; base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -178,6 +191,9 @@ raw_url = variations::GetVariationParamValueByFeature( kTranslateRankerQuery, switches::kTranslateRankerModelURL); } + // If the ranker URL is still not defined, use the default. + if (raw_url.empty()) + raw_url = kDefaultTranslateRankerModelURL; DVLOG(3) << switches::kTranslateRankerModelURL << " = " << raw_url;
diff --git a/components/translate/core/browser/translate_ranker_impl.h b/components/translate/core/browser/translate_ranker_impl.h index c1e4991..1e25b0af50 100644 --- a/components/translate/core/browser/translate_ranker_impl.h +++ b/components/translate/core/browser/translate_ranker_impl.h
@@ -34,6 +34,8 @@ namespace translate { +extern const char kDefaultTranslateRankerModelURL[]; + // Features used to enable ranker query, enforcement and logging. Note that // enabling enforcement implies (forces) enabling queries. extern const base::Feature kTranslateRankerQuery;
diff --git a/components/translate/core/browser/translate_ranker_impl_unittest.cc b/components/translate/core/browser/translate_ranker_impl_unittest.cc index 02416e17..934aa8d 100644 --- a/components/translate/core/browser/translate_ranker_impl_unittest.cc +++ b/components/translate/core/browser/translate_ranker_impl_unittest.cc
@@ -169,11 +169,17 @@ TEST_F(TranslateRankerImplTest, ModelLoaderQueryNotEnabled) { // If Query is not enabled, the ranker should not try to load the model. - InitFeatures({}, {kTranslateRankerQuery}); + InitFeatures({}, {kTranslateRankerQuery, kTranslateRankerEnforcement}); auto ranker = GetRankerForTest(0.01f); EXPECT_FALSE(ranker->CheckModelLoaderForTesting()); } +TEST_F(TranslateRankerImplTest, ModelLoaderQueryEnabledByDefault) { + InitFeatures({}, {kTranslateRankerEnforcement}); + auto ranker = GetRankerForTest(0.01f); + EXPECT_TRUE(ranker->CheckModelLoaderForTesting()); +} + TEST_F(TranslateRankerImplTest, GetModelDecision) { InitFeatures({kTranslateRankerEnforcement}, {}); // Calculate the score using: a 50:50 accept/decline ratio; the one-hot
diff --git a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc index ac7d8104..3fc1fc9 100644 --- a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc +++ b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc
@@ -993,6 +993,7 @@ // Child submits another frame to the same local surface id that is marked // destroyed. + surface_observer().Reset(); child_support1().SubmitCompositorFrame(child_id.local_surface_id(), MakeCompositorFrame()); @@ -1001,6 +1002,7 @@ Surface* surface2 = GetSurfaceForId(child_id); EXPECT_EQ(surface, surface2); EXPECT_FALSE(IsMarkedForDestruction(child_id)); + EXPECT_EQ(child_id, surface_observer().last_created_surface_id()); } // Verifies that if a LocalSurfaceId belonged to a surface that doesn't
diff --git a/components/viz/service/gl/gpu_service_impl.cc b/components/viz/service/gl/gpu_service_impl.cc index e3df58b4..2f2da0a 100644 --- a/components/viz/service/gl/gpu_service_impl.cc +++ b/components/viz/service/gl/gpu_service_impl.cc
@@ -48,7 +48,7 @@ #if defined(OS_ANDROID) #include "base/android/throw_uncaught_exception.h" -#include "media/gpu/content_video_view_overlay_allocator.h" +#include "media/gpu/android/content_video_view_overlay_allocator.h" #endif namespace viz {
diff --git a/components/viz/service/hit_test/hit_test_aggregator.cc b/components/viz/service/hit_test/hit_test_aggregator.cc index 30390725..fce4996 100644 --- a/components/viz/service/hit_test/hit_test_aggregator.cc +++ b/components/viz/service/hit_test/hit_test_aggregator.cc
@@ -6,6 +6,7 @@ #include "components/viz/common/hit_test/aggregated_hit_test_region.h" #include "components/viz/service/hit_test/hit_test_aggregator_delegate.h" +#include "third_party/skia/include/core/SkMatrix44.h" namespace viz { @@ -38,6 +39,17 @@ return true; } +void PrepareTransformForReadOnlySharedMemory(gfx::Transform* transform) { + // |transform| is going to be shared in read-only memory to HitTestQuery. + // However, if HitTestQuery tries to operate on it, then it is possible that + // it will attempt to perform write on the underlying SkMatrix44 [1], causing + // invalid memory write in read-only memory. + // [1] + // https://cs.chromium.org/chromium/src/third_party/skia/include/core/SkMatrix44.h?l=133 + // Explicitly calling getType() to compute the type-mask in SkMatrix44. + transform->matrix().getType(); +} + } // namespace HitTestAggregator::HitTestAggregator(HitTestAggregatorDelegate* delegate) @@ -176,6 +188,7 @@ regions[0].flags = hit_test_region_list->flags; regions[0].rect = hit_test_region_list->bounds; regions[0].transform = hit_test_region_list->transform; + PrepareTransformForReadOnlySharedMemory(®ions[0].transform); size_t region_index = 1; for (const auto& region : hit_test_region_list->regions) { @@ -230,6 +243,7 @@ break; } } + PrepareTransformForReadOnlySharedMemory(&element->transform); DCHECK_GE(region_index - parent_index - 1, 0u); element->child_count = region_index - parent_index - 1; return region_index;
diff --git a/components/viz/service/surfaces/surface.cc b/components/viz/service/surfaces/surface.cc index 04d3bd8..71aff339 100644 --- a/components/viz/service/surfaces/surface.cc +++ b/components/viz/service/surfaces/surface.cc
@@ -44,6 +44,10 @@ deadline_.RemoveObserver(this); } +void Surface::ResetSeenFirstFrameActivation() { + seen_first_frame_activation_ = false; +} + void Surface::SetPreviousFrameSurface(Surface* surface) { DCHECK(surface && (HasActiveFrame() || HasPendingFrame())); previous_frame_surface_id_ = surface->surface_id();
diff --git a/components/viz/service/surfaces/surface.h b/components/viz/service/surfaces/surface.h index 84534fc8..3ab5b890 100644 --- a/components/viz/service/surfaces/surface.h +++ b/components/viz/service/surfaces/surface.h
@@ -80,6 +80,11 @@ bool needs_sync_tokens); ~Surface(); + // Clears the |seen_first_frame_activation_| bit causing a + // FirstSurfaceActivation to be triggered on the next CompositorFrame + // activation. + void ResetSeenFirstFrameActivation(); + const SurfaceId& surface_id() const { return surface_info_.id(); } const SurfaceId& previous_frame_surface_id() const { return previous_frame_surface_id_;
diff --git a/components/viz/service/surfaces/surface_manager.cc b/components/viz/service/surfaces/surface_manager.cc index 19504fa..38ef52b 100644 --- a/components/viz/service/surfaces/surface_manager.cc +++ b/components/viz/service/surfaces/surface_manager.cc
@@ -119,8 +119,10 @@ // SurfaceId. Remove the surface out of the garbage collector's queue and // reuse it. Surface* surface = it->second.get(); + DCHECK(IsMarkedForDestruction(surface_info.id())); surfaces_to_destroy_.erase(surface_info.id()); + surface->ResetSeenFirstFrameActivation(); return surface; }
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 2d9bb52..7af2978 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1952,7 +1952,6 @@ "android/composited_touch_handle_drawable.h", "android/content_view_core.cc", "android/content_view_core.h", - "android/content_view_core_observer.h", "android/content_view_render_view.cc", "android/content_view_render_view.h", "android/content_view_statics.cc",
diff --git a/content/browser/accessibility/accessibility_ui.cc b/content/browser/accessibility/accessibility_ui.cc index 79d5cd8c..8dd4a99 100644 --- a/content/browser/accessibility/accessibility_ui.cc +++ b/content/browser/accessibility/accessibility_ui.cc
@@ -204,9 +204,7 @@ base::Bind(&HandleRequestCallback, web_ui->GetWebContents()->GetBrowserContext())); - std::unordered_set<std::string> exclude_from_gzip; - exclude_from_gzip.insert(kDataFile); - html_source->UseGzip(exclude_from_gzip); + html_source->UseGzip({kDataFile}); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/accessibility/browser_accessibility_com_win.cc b/content/browser/accessibility/browser_accessibility_com_win.cc index d573079..81836a6b 100644 --- a/content/browser/accessibility/browser_accessibility_com_win.cc +++ b/content/browser/accessibility/browser_accessibility_com_win.cc
@@ -1971,8 +1971,10 @@ // Do not fire EVENT_OBJECT_STATECHANGE if the change was due to a focus // change. if ((MSAAState() & ~STATE_SYSTEM_FOCUSED) != - (old_win_attributes_->ia_state & ~STATE_SYSTEM_FOCUSED)) + (old_win_attributes_->ia_state & ~STATE_SYSTEM_FOCUSED) || + ComputeIA2State() != old_win_attributes_->ia2_state) { FireNativeEvent(EVENT_OBJECT_STATECHANGE); + } // Handle selection being added or removed. bool is_selected_now = (MSAAState() & STATE_SYSTEM_SELECTED) != 0;
diff --git a/content/browser/accessibility/dump_accessibility_events_browsertest.cc b/content/browser/accessibility/dump_accessibility_events_browsertest.cc index 4f90267e..2eeb5ea 100644 --- a/content/browser/accessibility/dump_accessibility_events_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_events_browsertest.cc
@@ -222,6 +222,16 @@ } IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, + AccessibilityEventsAriaDisabledChanged) { + RunEventTest(FILE_PATH_LITERAL("aria-disabled-changed.html")); +} + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, + AccessibilityEventsAriaRequiredChanged) { + RunEventTest(FILE_PATH_LITERAL("aria-required-changed.html")); +} + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, AccessibilityEventsCheckedStateChanged) { RunEventTest(FILE_PATH_LITERAL("checked-state-changed.html")); } @@ -247,6 +257,16 @@ } IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, + AccessibilityEventsFormDisabledChanged) { + RunEventTest(FILE_PATH_LITERAL("form-disabled-changed.html")); +} + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, + AccessibilityEventsFormRequiredChanged) { + RunEventTest(FILE_PATH_LITERAL("form-required-changed.html")); +} + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, AccessibilityEventsInnerHtmlChange) { RunEventTest(FILE_PATH_LITERAL("inner-html-change.html")); }
diff --git a/content/browser/android/content_view_core.cc b/content/browser/android/content_view_core.cc index 1a27ea57..a52c7b1 100644 --- a/content/browser/android/content_view_core.cc +++ b/content/browser/android/content_view_core.cc
@@ -208,19 +208,11 @@ InitWebContents(); } -void ContentViewCore::AddObserver(ContentViewCoreObserver* observer) { - observer_list_.AddObserver(observer); -} - -void ContentViewCore::RemoveObserver(ContentViewCoreObserver* observer) { - observer_list_.RemoveObserver(observer); -} - ContentViewCore::~ContentViewCore() { - for (auto& observer : observer_list_) - observer.OnContentViewCoreDestroyed(); - observer_list_.Clear(); - + for (auto* host : web_contents_->GetAllRenderWidgetHosts()) { + static_cast<RenderWidgetHostViewAndroid*>(host->GetView()) + ->OnContentViewCoreDestroyed(); + } JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); java_ref_.reset(); @@ -542,16 +534,6 @@ Java_ContentViewCore_onNativeFlingStopped(env, obj); } -ScopedJavaLocalRef<jobject> ContentViewCore::GetContext() const { - JNIEnv* env = AttachCurrentThread(); - - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (obj.is_null()) - return ScopedJavaLocalRef<jobject>(); - - return Java_ContentViewCore_getContext(env, obj); -} - gfx::Size ContentViewCore::GetViewSize() const { gfx::Size size = GetViewportSizeDip(); if (DoBrowserControlsShrinkBlinkSize()) @@ -613,26 +595,6 @@ } } -void ContentViewCore::MoveRangeSelectionExtent(const gfx::PointF& extent) { - if (!web_contents_) - return; - - web_contents_->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent)); -} - -void ContentViewCore::SelectBetweenCoordinates(const gfx::PointF& base, - const gfx::PointF& extent) { - if (!web_contents_) - return; - - gfx::Point base_point = gfx::ToRoundedPoint(base); - gfx::Point extent_point = gfx::ToRoundedPoint(extent); - if (base_point == extent_point) - return; - - web_contents_->SelectRange(base_point, extent_point); -} - ui::WindowAndroid* ContentViewCore::GetWindowAndroid() const { return GetViewAndroid()->GetWindowAndroid(); }
diff --git a/content/browser/android/content_view_core.h b/content/browser/android/content_view_core.h index 28a28b7..a7a442d 100644 --- a/content/browser/android/content_view_core.h +++ b/content/browser/android/content_view_core.h
@@ -17,7 +17,6 @@ #include "base/i18n/rtl.h" #include "base/macros.h" #include "base/process/process.h" -#include "content/browser/android/content_view_core_observer.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/web_contents_observer.h" @@ -53,9 +52,6 @@ WebContents* GetWebContents() const; ui::WindowAndroid* GetWindowAndroid() const; - void AddObserver(ContentViewCoreObserver* observer); - void RemoveObserver(ContentViewCoreObserver* observer); - // -------------------------------------------------------------------------- // Methods called from Java via JNI // -------------------------------------------------------------------------- @@ -267,11 +263,6 @@ float GetTopControlsHeightDip() const; float GetBottomControlsHeightDip() const; - void MoveRangeSelectionExtent(const gfx::PointF& extent); - - void SelectBetweenCoordinates(const gfx::PointF& base, - const gfx::PointF& extent); - void UpdateCursor(const content::CursorInfo& info); void OnTouchDown(const base::android::ScopedJavaLocalRef<jobject>& event); @@ -330,9 +321,6 @@ // Device scale factor. float dpi_scale_; - // Observer to notify of lifecyle changes. - base::ObserverList<ContentViewCoreObserver> observer_list_; - // The cache of device's current orientation set from Java side, this value // will be sent to Renderer once it is ready. int device_orientation_;
diff --git a/content/browser/android/content_view_core_observer.h b/content/browser/android/content_view_core_observer.h deleted file mode 100644 index aa444aca..0000000 --- a/content/browser/android/content_view_core_observer.h +++ /dev/null
@@ -1,21 +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 CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_OBSERVER_H -#define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_OBSERVER_H - -namespace content { - -// TODO(jinsukkim): Remove this interface. -class ContentViewCoreObserver { - public: - virtual void OnContentViewCoreDestroyed() = 0; - - protected: - virtual ~ContentViewCoreObserver() {} -}; - -} // namespace content - -#endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_OBSERVER_H
diff --git a/content/browser/android/render_widget_host_connector.cc b/content/browser/android/render_widget_host_connector.cc index b0cd4de..d8373e9d 100644 --- a/content/browser/android/render_widget_host_connector.cc +++ b/content/browser/android/render_widget_host_connector.cc
@@ -138,4 +138,8 @@ return render_widget_observer_->active_rwhva(); } +WebContents* RenderWidgetHostConnector::web_contents() const { + return render_widget_observer_->web_contents(); +} + } // namespace content
diff --git a/content/browser/android/render_widget_host_connector.h b/content/browser/android/render_widget_host_connector.h index a7be988..7c4f94ce 100644 --- a/content/browser/android/render_widget_host_connector.h +++ b/content/browser/android/render_widget_host_connector.h
@@ -38,6 +38,9 @@ RenderWidgetHostViewAndroid* GetRWHVAForTesting() const; + protected: + WebContents* web_contents() const; + private: class Observer; std::unique_ptr<Observer> render_widget_observer_;
diff --git a/content/browser/android/selection_popup_controller.cc b/content/browser/android/selection_popup_controller.cc index 550dc3dc..a932b3d 100644 --- a/content/browser/android/selection_popup_controller.cc +++ b/content/browser/android/selection_popup_controller.cc
@@ -7,11 +7,13 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" +#include "content/browser/android/composited_touch_handle_drawable.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" -#include "content/public/browser/web_contents.h" +#include "content/browser/web_contents/web_contents_impl.h" #include "content/public/common/context_menu_params.h" #include "jni/SelectionPopupController_jni.h" #include "third_party/WebKit/public/web/WebContextMenuData.h" +#include "ui/gfx/geometry/point_conversions.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF16ToJavaString; @@ -40,6 +42,51 @@ java_obj_ = JavaObjectWeakGlobalRef(env, obj); } +ScopedJavaLocalRef<jobject> SelectionPopupController::GetContext() const { + JNIEnv* env = AttachCurrentThread(); + + ScopedJavaLocalRef<jobject> obj = java_obj_.get(env); + if (obj.is_null()) + return nullptr; + + return Java_SelectionPopupController_getContext(env, obj); +} + +std::unique_ptr<ui::TouchHandleDrawable> +SelectionPopupController::CreateTouchHandleDrawable() { + ScopedJavaLocalRef<jobject> activityContext = GetContext(); + // If activityContext is null then Application context is used instead on + // the java side in CompositedTouchHandleDrawable. + auto* view = web_contents()->GetNativeView(); + return std::unique_ptr<ui::TouchHandleDrawable>( + new CompositedTouchHandleDrawable(view->GetLayer(), view->GetDipScale(), + activityContext)); +} + +void SelectionPopupController::MoveRangeSelectionExtent( + const gfx::PointF& extent) { + auto* web_contents_impl = static_cast<WebContentsImpl*>(web_contents()); + if (!web_contents_impl) + return; + + web_contents_impl->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent)); +} + +void SelectionPopupController::SelectBetweenCoordinates( + const gfx::PointF& base, + const gfx::PointF& extent) { + auto* web_contents_impl = static_cast<WebContentsImpl*>(web_contents()); + if (!web_contents_impl) + return; + + gfx::Point base_point = gfx::ToRoundedPoint(base); + gfx::Point extent_point = gfx::ToRoundedPoint(extent); + if (base_point == extent_point) + return; + + web_contents_impl->SelectRange(base_point, extent_point); +} + void SelectionPopupController::UpdateRenderProcessConnection( RenderWidgetHostViewAndroid* old_rwhva, RenderWidgetHostViewAndroid* new_rwhva) {
diff --git a/content/browser/android/selection_popup_controller.h b/content/browser/android/selection_popup_controller.h index 676b89a..f8211f8 100644 --- a/content/browser/android/selection_popup_controller.h +++ b/content/browser/android/selection_popup_controller.h
@@ -12,6 +12,10 @@ #include "ui/gfx/geometry/rect_f.h" #include "ui/touch_selection/selection_event_type.h" +namespace gfx { +class PointF; +} + namespace content { class RenderWidgetHostViewAndroid; @@ -37,9 +41,16 @@ void OnSelectWordAroundCaretAck(bool did_select, int start_adjust, int end_adjust); + std::unique_ptr<ui::TouchHandleDrawable> CreateTouchHandleDrawable(); + void MoveRangeSelectionExtent(const gfx::PointF& extent); + + void SelectBetweenCoordinates(const gfx::PointF& base, + const gfx::PointF& extent); private: ~SelectionPopupController() override {} + base::android::ScopedJavaLocalRef<jobject> GetContext() const; + JavaObjectWeakGlobalRef java_obj_; };
diff --git a/content/browser/appcache/appcache_internals_ui.cc b/content/browser/appcache/appcache_internals_ui.cc index f7c812a2..7a08210 100644 --- a/content/browser/appcache/appcache_internals_ui.cc +++ b/content/browser/appcache/appcache_internals_ui.cc
@@ -354,7 +354,7 @@ source->AddResourcePath("appcache_internals.js", IDR_APPCACHE_INTERNALS_JS); source->AddResourcePath("appcache_internals.css", IDR_APPCACHE_INTERNALS_CSS); source->SetDefaultResource(IDR_APPCACHE_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); WebUIDataSource::Add(browser_context(), source);
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index c703bd5b..d684d68 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -102,7 +102,7 @@ #include "device/gamepad/gamepad_service.h" #include "gpu/vulkan/features.h" #include "media/audio/audio_manager.h" -#include "media/audio/audio_system_impl.h" +#include "media/audio/audio_system.h" #include "media/audio/audio_thread_impl.h" #include "media/base/media.h" #include "media/base/user_input_monitor.h" @@ -115,8 +115,9 @@ #include "net/socket/client_socket_factory.h" #include "net/ssl/ssl_config_service.h" #include "ppapi/features/features.h" -#include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h" +#include "services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom.h" +#include "services/resource_coordinator/public/interfaces/service_constants.mojom.h" #include "services/service_manager/runner/common/client_util.h" #include "skia/ext/event_tracer_impl.h" #include "skia/ext/skia_memory_dump_provider.h" @@ -1430,19 +1431,12 @@ // so this cannot happen any earlier than now. InitializeMojo(); - // Create the memory instrumentation service. It will initialize the memory - // dump manager, too. It makes sense that BrowserMainLoop owns the service; - // this way, the service is alive for the lifetime of Mojo. Mojo is shutdown - // in BrowserMainLoop::ShutdownThreadsAndCleanupIO. - service_manager::Connector* connector = - content::ServiceManagerConnection::GetForProcess()->GetConnector(); - memory_instrumentation_coordinator_ = - base::MakeUnique<memory_instrumentation::CoordinatorImpl>(connector); - // Registers the browser process as a memory-instrumentation client, so // that data for the browser process will be available in memory dumps. + service_manager::Connector* connector = + content::ServiceManagerConnection::GetForProcess()->GetConnector(); memory_instrumentation::ClientProcessImpl::Config config( - connector, mojom::kBrowserServiceName, + connector, resource_coordinator::mojom::kServiceName, memory_instrumentation::mojom::ProcessType::BROWSER); memory_instrumentation::ClientProcessImpl::CreateInstance(config); @@ -1841,8 +1835,7 @@ MediaInternals::GetInstance()); } CHECK(audio_manager_); - - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_system_ = media::AudioSystem::CreateInstance(); CHECK(audio_system_); }
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index d341e72d..2ab109575 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h
@@ -58,10 +58,6 @@ #endif } // namespace media -namespace memory_instrumentation { -class CoordinatorImpl; -} // memory_instrumentation - namespace midi { class MidiService; } // namespace midi @@ -332,8 +328,6 @@ // |user_input_monitor_| has to outlive |audio_manager_|, so declared first. std::unique_ptr<media::UserInputMonitor> user_input_monitor_; std::unique_ptr<media::AudioManager> audio_manager_; - // Calls to |audio_system_| must not be posted to the audio thread if it - // differs from the UI one. See http://crbug.com/705455. std::unique_ptr<media::AudioSystem> audio_system_; std::unique_ptr<midi::MidiService> midi_service_; @@ -358,8 +352,6 @@ std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> discardable_shared_memory_manager_; scoped_refptr<SaveFileManager> save_file_manager_; - std::unique_ptr<memory_instrumentation::CoordinatorImpl> - memory_instrumentation_coordinator_; #if !defined(OS_ANDROID) std::unique_ptr<viz::HostFrameSinkManager> host_frame_sink_manager_; // This is owned here so that SurfaceManager will be accessible in process
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 625a42a..8d822a4d 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -36,6 +36,7 @@ #include "content/common/browser_plugin/browser_plugin_messages.h" #include "content/common/content_constants_internal.h" #include "content/common/drag_messages.h" +#include "content/common/input/ime_text_span_conversions.h" #include "content/common/input_messages.h" #include "content/common/site_isolation_policy.h" #include "content/common/text_input_state.h" @@ -62,26 +63,15 @@ namespace { -ui::ImeTextSpan::Type ConvertWebTypeToUiType(blink::WebImeTextSpan::Type type) { - switch (type) { - case blink::WebImeTextSpan::Type::kComposition: - return ui::ImeTextSpan::Type::kComposition; - case blink::WebImeTextSpan::Type::kSuggestion: - return ui::ImeTextSpan::Type::kSuggestion; - } - - NOTREACHED(); - return ui::ImeTextSpan::Type::kComposition; -} - std::vector<ui::ImeTextSpan> ConvertToUiImeTextSpan( const std::vector<blink::WebImeTextSpan>& ime_text_spans) { std::vector<ui::ImeTextSpan> ui_ime_text_spans; for (const auto& ime_text_span : ime_text_spans) { ui_ime_text_spans.emplace_back(ui::ImeTextSpan( - ConvertWebTypeToUiType(ime_text_span.type), ime_text_span.start_offset, - ime_text_span.end_offset, ime_text_span.underline_color, - ime_text_span.thick, ime_text_span.background_color, + ConvertWebImeTextSpanTypeToUiType(ime_text_span.type), + ime_text_span.start_offset, ime_text_span.end_offset, + ime_text_span.underline_color, ime_text_span.thick, + ime_text_span.background_color, ime_text_span.suggestion_highlight_color, ime_text_span.suggestions)); } return ui_ime_text_spans;
diff --git a/content/browser/browsing_data/storage_partition_http_cache_data_remover.cc b/content/browser/browsing_data/storage_partition_http_cache_data_remover.cc index 0b71b09..a405c158 100644 --- a/content/browser/browsing_data/storage_partition_http_cache_data_remover.cc +++ b/content/browser/browsing_data/storage_partition_http_cache_data_remover.cc
@@ -11,7 +11,6 @@ #include "content/browser/browsing_data/conditional_cache_deletion_helper.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" -#include "net/base/sdch_manager.h" #include "net/disk_cache/blockfile/backend_impl.h" #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/memory/mem_backend_impl.h" @@ -129,15 +128,6 @@ ->quic_stream_factory() ->ClearCachedStatesInCryptoConfig(url_predicate_); - // Clear SDCH dictionary state. - net::SdchManager* sdch_manager = - getter->GetURLRequestContext()->sdch_manager(); - // The test is probably overkill, since chrome should always have an - // SdchManager. But in general the URLRequestContext is *not* - // guaranteed to have an SdchManager, so checking is wise. - if (sdch_manager) - sdch_manager->ClearData(); - rv = http_cache->GetBackend( &cache_, base::Bind(&StoragePartitionHttpCacheDataRemover::DoClearCache,
diff --git a/content/browser/compositor/vulkan_browser_compositor_output_surface.cc b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc index f7e1ae25..bfb93a4c 100644 --- a/content/browser/compositor/vulkan_browser_compositor_output_surface.cc +++ b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
@@ -12,7 +12,7 @@ namespace content { VulkanBrowserCompositorOutputSurface::VulkanBrowserCompositorOutputSurface( - scoped_refptr<cc::VulkanContextProvider> context, + scoped_refptr<viz::VulkanContextProvider> context, const UpdateVSyncParametersCallback& update_vsync_parameters_callback) : BrowserCompositorOutputSurface(std::move(context), update_vsync_parameters_callback), @@ -87,10 +87,16 @@ const gfx::Size& size, float device_scale_factor, const gfx::ColorSpace& color_space, - bool has_alpha) { + bool has_alpha, + bool use_stencil) { NOTIMPLEMENTED(); } +void VulkanBrowserCompositorOutputSurface::SetDrawRectangle( + const gfx::Rect& rect) { + NOTREACHED(); +} + uint32_t VulkanBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { NOTIMPLEMENTED();
diff --git a/content/browser/compositor/vulkan_browser_compositor_output_surface.h b/content/browser/compositor/vulkan_browser_compositor_output_surface.h index e72493da..f9cea0e 100644 --- a/content/browser/compositor/vulkan_browser_compositor_output_surface.h +++ b/content/browser/compositor/vulkan_browser_compositor_output_surface.h
@@ -23,7 +23,7 @@ : public BrowserCompositorOutputSurface { public: VulkanBrowserCompositorOutputSurface( - scoped_refptr<cc::VulkanContextProvider> context, + scoped_refptr<viz::VulkanContextProvider> context, const UpdateVSyncParametersCallback& update_vsync_parameters_callback); ~VulkanBrowserCompositorOutputSurface() override; @@ -43,9 +43,11 @@ void Reshape(const gfx::Size& size, float device_scale_factor, const gfx::ColorSpace& color_space, - bool has_alpha) override; + bool has_alpha, + bool use_stencil) override; uint32_t GetFramebufferCopyTextureFormat() override; void SwapBuffers(cc::OutputSurfaceFrame frame) override; + void SetDrawRectangle(const gfx::Rect& rect) override; private: void SwapBuffersAck();
diff --git a/content/browser/devtools/protocol/tracing_handler.cc b/content/browser/devtools/protocol/tracing_handler.cc index cff02198..87b1345 100644 --- a/content/browser/devtools/protocol/tracing_handler.cc +++ b/content/browser/devtools/protocol/tracing_handler.cc
@@ -4,7 +4,13 @@ #include "content/browser/devtools/protocol/tracing_handler.h" +#include <algorithm> #include <cmath> +#include <memory> +#include <set> +#include <string> +#include <utility> +#include <vector> #include "base/bind.h" #include "base/format_macros.h" @@ -161,8 +167,9 @@ "{ \"method\": \"Tracing.dataCollected\", \"params\": { \"value\": ["); const size_t messageSuffixSize = 10; message.reserve(message.size() + valid_trace_fragment.size() + - messageSuffixSize); - message += valid_trace_fragment; + messageSuffixSize - trace_data_buffer_state_.offset); + message.append(valid_trace_fragment.c_str() + + trace_data_buffer_state_.offset); message += "] } }"; frontend_->sendRawNotification(message); } @@ -183,13 +190,24 @@ std::string TracingHandler::UpdateTraceDataBuffer( const std::string& trace_fragment) { size_t end = 0; + size_t last_open = 0; TraceDataBufferState& state = trace_data_buffer_state_; + state.offset = 0; + bool update_offset = state.open_braces == 0; for (; state.pos < trace_fragment.size(); ++state.pos) { char c = trace_fragment[state.pos]; switch (c) { case '{': - if (!state.in_string && !state.slashed) + if (!state.in_string && !state.slashed) { state.open_braces++; + if (state.open_braces == 1) { + last_open = state.data.size() + state.pos; + if (update_offset) { + state.offset = last_open; + update_offset = false; + } + } + } break; case '}': if (!state.in_string && !state.slashed) { @@ -219,13 +237,9 @@ // Next starting position is usually 0 except when we are in the middle of // processing a unicode character, i.e. \uxxxx. state.pos -= trace_fragment.size(); - std::string complete_str = state.data + trace_fragment; - // Skip over commas between objects so that the next valid prefix does not - // start with a comma. - size_t next_start = complete_str.find('{', end); - state.data = - next_start == std::string::npos ? "" : complete_str.substr(next_start); + std::string complete_str = state.data + trace_fragment; + state.data = complete_str.substr(std::max(end, last_open)); complete_str.resize(end); return complete_str;
diff --git a/content/browser/devtools/protocol/tracing_handler.h b/content/browser/devtools/protocol/tracing_handler.h index cb7c8a6..a0ca9de 100644 --- a/content/browser/devtools/protocol/tracing_handler.h +++ b/content/browser/devtools/protocol/tracing_handler.h
@@ -8,8 +8,10 @@ #include <stddef.h> #include <stdint.h> +#include <memory> #include <set> #include <string> +#include <vector> #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -73,6 +75,7 @@ int open_braces = 0; bool in_string = false; bool slashed = false; + size_t offset = 0; }; void OnRecordingEnabled(std::unique_ptr<StartCallback> callback);
diff --git a/content/browser/devtools/protocol/tracing_handler_unittest.cc b/content/browser/devtools/protocol/tracing_handler_unittest.cc index 352c7ca..5af1a8d 100644 --- a/content/browser/devtools/protocol/tracing_handler_unittest.cc +++ b/content/browser/devtools/protocol/tracing_handler_unittest.cc
@@ -78,8 +78,11 @@ void TearDown() override { tracing_handler_.reset(); } - std::string UpdateTraceDataBuffer(const std::string& trace_fragment) { - return tracing_handler_->UpdateTraceDataBuffer(trace_fragment); + std::string GetValidTraceFragment(const std::string& trace_fragment) { + const std::string valid_trace_fragment = + tracing_handler_->UpdateTraceDataBuffer(trace_fragment); + return valid_trace_fragment.substr( + tracing_handler_->trace_data_buffer_state_.offset); } private: @@ -98,29 +101,35 @@ EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); } -TEST_F(TracingHandlerTest, SimpleUpdateTraceDataBuffer) { +TEST_F(TracingHandlerTest, SimpleGetValidTraceFragment) { // No prefix is valid. - EXPECT_EQ("", UpdateTraceDataBuffer("{pid: 1, ")); + EXPECT_EQ("", GetValidTraceFragment("{pid: 1, ")); // The longest valid prefix of "{pid: 1, args: {}}, {pid: 2" is // "{pid: 1, args: {}}". - EXPECT_EQ("{pid: 1, args: {}}", UpdateTraceDataBuffer("args: {}}, {pid: 2")); + EXPECT_EQ("{pid: 1, args: {}}", GetValidTraceFragment("args: {}}, {pid: 2")); - EXPECT_EQ("{pid: 2}, {pid: 3}", UpdateTraceDataBuffer("}, {pid: 3}")); + EXPECT_EQ("{pid: 2}, {pid: 3}", GetValidTraceFragment("}, {pid: 3}")); } -TEST_F(TracingHandlerTest, ComplexUpdateTraceDataBuffer) { +TEST_F(TracingHandlerTest, GetValidTraceFragmentBreakBeforeComma) { + EXPECT_EQ("{pid: 1}", GetValidTraceFragment("{pid: 1}")); + // The comma should be ignored. + EXPECT_EQ("{pid: 2}", GetValidTraceFragment(",{pid: 2}")); +} + +TEST_F(TracingHandlerTest, ComplexGetValidTraceFragment) { const std::string chunk1 = "{\"pid\":1,\"args\":{\"key\":\"}\"},\"tid\":1}"; const std::string chunk2 = "{\"pid\":2,\"args\":{\"key\":{\"key\":\"\\\"t}\"},\"key2\":2},\"tid\":" "2}"; const std::string trace_data = chunk1 + "," + chunk2; - EXPECT_EQ("", UpdateTraceDataBuffer(trace_data.substr(0, chunk1.size() - 1))); - EXPECT_EQ(chunk1, UpdateTraceDataBuffer(trace_data.substr( + EXPECT_EQ("", GetValidTraceFragment(trace_data.substr(0, chunk1.size() - 1))); + EXPECT_EQ(chunk1, GetValidTraceFragment(trace_data.substr( chunk1.size() - 1, trace_data.size() - chunk1.size()))); EXPECT_EQ(chunk2, - UpdateTraceDataBuffer(trace_data.substr(trace_data.size() - 1, 1))); + GetValidTraceFragment(trace_data.substr(trace_data.size() - 1, 1))); } } // namespace protocol
diff --git a/content/browser/dom_storage/local_storage_context_mojo.cc b/content/browser/dom_storage/local_storage_context_mojo.cc index 00d03e2..c04db59 100644 --- a/content/browser/dom_storage/local_storage_context_mojo.cc +++ b/content/browser/dom_storage/local_storage_context_mojo.cc
@@ -28,6 +28,7 @@ #include "sql/connection.h" #include "storage/browser/quota/special_storage_policy.h" #include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" namespace content { @@ -611,7 +612,7 @@ // Default write_buffer_size is 4 MB but that might leave a 3.999 // memory allocation in RAM from a log file recovery. options.write_buffer_size = 64 * 1024; - options.block_cache = leveldb_env::SharedWebBlockCache(); + options.block_cache = leveldb_chrome::GetSharedWebBlockCache(); leveldb_service_->OpenWithOptions( std::move(options), std::move(directory_clone), "leveldb", memory_dump_id_, MakeRequest(&database_),
diff --git a/content/browser/dom_storage/session_storage_database.cc b/content/browser/dom_storage/session_storage_database.cc index 03463d93..0d8944c 100644 --- a/content/browser/dom_storage/session_storage_database.cc +++ b/content/browser/dom_storage/session_storage_database.cc
@@ -18,6 +18,7 @@ #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/process_memory_dump.h" #include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/iterator.h" #include "third_party/leveldatabase/src/include/leveldb/options.h" @@ -142,7 +143,7 @@ // If the area does not exist, |namespace_id| might refer to a clone that // is not yet created. Reading from the original database is expected to be // consistent because tasks posted on commit sequence after clone did not - // before capturing the snapshot. + // run before capturing the snapshot. for (const auto& original_db_id : original_permanent_namespace_ids) { map_id.clear(); if (GetMapForArea(original_db_id, origin.spec(), options, &exists, @@ -466,7 +467,7 @@ // Default write_buffer_size is 4 MB but that might leave a 3.999 // memory allocation in RAM from a log file recovery. options.write_buffer_size = 64 * 1024; - options.block_cache = leveldb_env::SharedWebBlockCache(); + options.block_cache = leveldb_chrome::GetSharedWebBlockCache(); return leveldb_env::OpenDB(options, file_path_.AsUTF8Unsafe(), db); }
diff --git a/content/browser/download/download_request_core.cc b/content/browser/download/download_request_core.cc index 8eb85dc..7a49194 100644 --- a/content/browser/download/download_request_core.cc +++ b/content/browser/download/download_request_core.cc
@@ -236,14 +236,6 @@ // with main frames. request()->SetPriority(net::IDLE); - // If the content-length header is not present (or contains something other - // than numbers), the incoming content_length is -1 (unknown size). - // Set the content length to 0 to indicate unknown size to DownloadManager. - int64_t content_length = request()->GetExpectedContentSize() > 0 - ? request()->GetExpectedContentSize() - : 0; - create_info->total_bytes = content_length; - // Create the ByteStream for sending data to the download sink. std::unique_ptr<ByteStreamReader> stream_reader; CreateByteStream(base::ThreadTaskRunnerHandle::Get(), GetDownloadTaskRunner(), @@ -258,35 +250,7 @@ // Get the last modified time and etag. const net::HttpResponseHeaders* headers = request()->response_headers(); - if (headers) { - if (headers->HasStrongValidators()) { - // If we don't have strong validators as per RFC 7232 section 2, then - // we neither store nor use them for range requests. - if (!headers->EnumerateHeader(nullptr, "Last-Modified", - &create_info->last_modified)) - create_info->last_modified.clear(); - if (!headers->EnumerateHeader(nullptr, "ETag", &create_info->etag)) - create_info->etag.clear(); - } - - // Grab the first content-disposition header. There may be more than one, - // though as of this writing, the network stack ensures if there are, they - // are all duplicates. - headers->EnumerateHeader(nullptr, "Content-Disposition", - &create_info->content_disposition); - - if (!headers->GetMimeType(&create_info->original_mime_type)) - create_info->original_mime_type.clear(); - - // Content-Range is validated in HandleSuccessfulServerResponse. - // In RFC 7233, a single part 206 partial response must generate - // Content-Range. Accept-Range may be sent in 200 response to indicate the - // server can handle range request, but optional in 206 response. - create_info->accept_range = - headers->HasHeaderValue("Accept-Ranges", "bytes") || - (headers->HasHeader("Content-Range") && - headers->response_code() == net::HTTP_PARTIAL_CONTENT); - } + HandleResponseHeaders(headers, create_info.get()); // GURL::GetOrigin() doesn't support getting the inner origin of a blob URL. // However, requesting a cross origin blob URL would have resulted in a
diff --git a/content/browser/download/download_response_handler.cc b/content/browser/download/download_response_handler.cc index 6b16a02d7..5decc704 100644 --- a/content/browser/download/download_response_handler.cc +++ b/content/browser/download/download_response_handler.cc
@@ -7,6 +7,7 @@ #include "content/browser/download/download_stats.h" #include "content/browser/download/download_utils.h" #include "content/public/browser/download_url_parameters.h" +#include "net/http/http_status_code.h" #include "net/log/net_log_with_source.h" namespace content { @@ -66,16 +67,19 @@ const ResourceResponseHead& head, const base::Optional<net::SSLInfo>& ssl_info, mojom::DownloadedTempFilePtr downloaded_file) { - if (head.headers) - RecordDownloadHttpResponseCode(head.headers->response_code()); - create_info_ = CreateDownloadCreateInfo(head); if (ssl_info) cert_status_ = ssl_info->cert_status; - if (head.headers) + // TODO(xingliu): Do not use http cache. + // Sets page transition type correctly and call + // |RecordDownloadSourcePageTransitionType| here. + if (head.headers) { has_strong_validators_ = head.headers->HasStrongValidators(); + RecordDownloadHttpResponseCode(head.headers->response_code()); + RecordDownloadContentDisposition(create_info_->content_disposition); + } if (create_info_->result != DOWNLOAD_INTERRUPT_REASON_NONE) OnResponseStarted(mojom::DownloadStreamHandlePtr()); @@ -106,10 +110,8 @@ create_info->response_headers = head.headers; create_info->offset = create_info->save_info->offset; create_info->mime_type = head.mime_type; - if (head.headers && - !head.headers->GetMimeType(&create_info->original_mime_type)) { - create_info->original_mime_type.clear(); - } + + HandleResponseHeaders(head.headers.get(), create_info.get()); return create_info; }
diff --git a/content/browser/download/download_utils.cc b/content/browser/download/download_utils.cc index bb824e7..3891418d 100644 --- a/content/browser/download/download_utils.cc +++ b/content/browser/download/download_utils.cc
@@ -8,6 +8,7 @@ #include "base/memory/ptr_util.h" #include "base/process/process_handle.h" #include "base/strings/stringprintf.h" +#include "content/browser/download/download_create_info.h" #include "content/browser/download/download_interrupt_reasons_impl.h" #include "content/browser/download/download_stats.h" #include "content/public/browser/browser_thread.h" @@ -372,4 +373,45 @@ return DOWNLOAD_INTERRUPT_REASON_NONE; } +void HandleResponseHeaders(const net::HttpResponseHeaders* headers, + DownloadCreateInfo* create_info) { + if (!headers) + return; + + // Parse the "Content-Length" header. Adjust to 0 if no valid content_length + // presents. + int64_t content_length = headers->GetContentLength(); + create_info->total_bytes = (content_length == -1) ? 0 : content_length; + + if (headers->HasStrongValidators()) { + // If we don't have strong validators as per RFC 7232 section 2, then + // we neither store nor use them for range requests. + if (!headers->EnumerateHeader(nullptr, "Last-Modified", + &create_info->last_modified)) + create_info->last_modified.clear(); + if (!headers->EnumerateHeader(nullptr, "ETag", &create_info->etag)) + create_info->etag.clear(); + } + + // Grab the first content-disposition header. There may be more than one, + // though as of this writing, the network stack ensures if there are, they + // are all duplicates. + headers->EnumerateHeader(nullptr, "Content-Disposition", + &create_info->content_disposition); + + // Parse the original mime type from the header, notice that actual mime type + // might be different due to mime type sniffing. + if (!headers->GetMimeType(&create_info->original_mime_type)) + create_info->original_mime_type.clear(); + + // Content-Range is validated in HandleSuccessfulServerResponse. + // In RFC 7233, a single part 206 partial response must generate + // Content-Range. Accept-Range may be sent in 200 response to indicate the + // server can handle range request, but optional in 206 response. + create_info->accept_range = + headers->HasHeaderValue("Accept-Ranges", "bytes") || + (headers->HasHeader("Content-Range") && + headers->response_code() == net::HTTP_PARTIAL_CONTENT); +} + } // namespace content
diff --git a/content/browser/download/download_utils.h b/content/browser/download/download_utils.h index 4b8c2ef..a9f85bc 100644 --- a/content/browser/download/download_utils.h +++ b/content/browser/download/download_utils.h
@@ -18,6 +18,7 @@ class DownloadUrlParameters; struct ResourceRequest; +struct DownloadCreateInfo; struct DownloadSaveInfo; // Handle the url request completion status and return the interrupt reasons. @@ -38,6 +39,11 @@ HandleSuccessfulServerResponse(const net::HttpResponseHeaders& http_headers, DownloadSaveInfo* save_info); +// Parse response headers and update |create_info| accordingly. +CONTENT_EXPORT void HandleResponseHeaders( + const net::HttpResponseHeaders* headers, + DownloadCreateInfo* create_info); + } // namespace content #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_UTILS_H_
diff --git a/content/browser/download/resource_downloader.cc b/content/browser/download/resource_downloader.cc index 1d5c81f..55d4cf7ea6 100644 --- a/content/browser/download/resource_downloader.cc +++ b/content/browser/download/resource_downloader.cc
@@ -88,6 +88,8 @@ mojom::kURLLoadOptionSendSSLInfo | mojom::kURLLoadOptionSniffMimeType, *(request.get()), &response_handler_, download_url_parameters_->GetNetworkTrafficAnnotation()); + url_loader_->SetPriority(net::RequestPriority::IDLE, + 0 /* intra_priority_value */); } void ResourceDownloader::OnResponseStarted(
diff --git a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc index f6325a9..cfcaca7 100644 --- a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc +++ b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
@@ -7,27 +7,11 @@ #include "base/strings/utf_string_conversions.h" #include "content/browser/renderer_host/input/legacy_input_router_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" +#include "content/common/input/ime_text_span_conversions.h" #include "content/common/input_messages.h" namespace content { -namespace { - -blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType( - ui::ImeTextSpan::Type type) { - switch (type) { - case ui::ImeTextSpan::Type::kComposition: - return blink::WebImeTextSpan::Type::kComposition; - case ui::ImeTextSpan::Type::kSuggestion: - return blink::WebImeTextSpan::Type::kSuggestion; - } - - NOTREACHED(); - return blink::WebImeTextSpan::Type::kComposition; -} - -} // namespace - LegacyIPCFrameInputHandler::LegacyIPCFrameInputHandler( RenderFrameHostImpl* frame_host) : frame_host_(frame_host), routing_id_(frame_host->GetRoutingID()) {} @@ -41,7 +25,7 @@ std::vector<blink::WebImeTextSpan> ime_text_spans; for (const auto& ime_text_span : ui_ime_text_spans) { blink::WebImeTextSpan blink_ime_text_span( - ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), + ConvertUiImeTextSpanTypeToWebType(ime_text_span.type), ime_text_span.start_offset, ime_text_span.end_offset, ime_text_span.underline_color, ime_text_span.thick, ime_text_span.background_color,
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index 2226e12..eb61ca0 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -19,6 +19,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "base/threading/sequenced_task_runner_handle.h" +#include "build/build_config.h" #include "content/browser/frame_host/frame_navigation_entry.h" #include "content/browser/frame_host/frame_tree.h" #include "content/browser/frame_host/navigation_entry_impl.h" @@ -5950,13 +5951,22 @@ } } +// This test is flaky on Windows, see https://crbug.com/765107 +#if defined(OS_WIN) +#define MAYBE_EnsureFrameNavigationEntriesClearedOnMismatchNoSrc \ + DISABLED_EnsureFrameNavigationEntriesClearedOnMismatchNoSrc +#else +#define MAYBE_EnsureFrameNavigationEntriesClearedOnMismatchNoSrc \ + EnsureFrameNavigationEntriesClearedOnMismatchNoSrc +#endif // Tests that sending a PageState update from a named subframe does not get // incorrectly set on previously existing FrameNavigationEntry for the same // name. It is similar to EnsureFrameNavigationEntriesClearedOnMismatch, but // doesn't navigate the iframes to real URLs when added to the DOM. // See https://crbug.com/628677. -IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, - EnsureFrameNavigationEntriesClearedOnMismatchNoSrc) { +IN_PROC_BROWSER_TEST_F( + NavigationControllerBrowserTest, + MAYBE_EnsureFrameNavigationEntriesClearedOnMismatchNoSrc) { WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); FrameTreeNode* root = web_contents->GetFrameTree()->root();
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index 3ba6abbf..b4e1ca4 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc
@@ -65,7 +65,7 @@ case ReloadType::NORMAL: return FrameMsg_Navigate_Type::RELOAD; case ReloadType::BYPASSING_CACHE: - case ReloadType::DISABLE_LOFI_MODE: + case ReloadType::DISABLE_PREVIEWS: return FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; case ReloadType::ORIGINAL_REQUEST_URL: return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; @@ -129,12 +129,9 @@ base::TimeDelta before_unload_delay_; }; -NavigatorImpl::NavigatorImpl( - NavigationControllerImpl* navigation_controller, - NavigatorDelegate* delegate) - : controller_(navigation_controller), - delegate_(delegate) { -} +NavigatorImpl::NavigatorImpl(NavigationControllerImpl* navigation_controller, + NavigatorDelegate* delegate) + : controller_(navigation_controller), delegate_(delegate) {} NavigatorImpl::~NavigatorImpl() {} @@ -242,8 +239,8 @@ VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() << ", error_code: " << params.error_code << ", error_description: " << params.error_description - << ", showing_repost_interstitial: " << - params.showing_repost_interstitial + << ", showing_repost_interstitial: " + << params.showing_repost_interstitial << ", frame_id: " << render_frame_host->GetRoutingID(); GURL validated_url(params.url); RenderProcessHost* render_process_host = render_frame_host->GetProcess(); @@ -359,10 +356,10 @@ if (!frame_tree_node->IsMainFrame()) { // For subframes, use the state of the top-level frame. previews_state = frame_tree_node->frame_tree() - ->root() - ->current_frame_host() - ->last_navigation_previews_state(); - } else if (reload_type == ReloadType::DISABLE_LOFI_MODE) { + ->root() + ->current_frame_host() + ->last_navigation_previews_state(); + } else if (reload_type == ReloadType::DISABLE_PREVIEWS) { // Disable LoFi when asked for it explicitly. previews_state = PREVIEWS_NO_TRANSFORM; } @@ -391,8 +388,8 @@ TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( "navigation", "Navigation timeToNetworkStack", frame_tree_node->navigation_request()->navigation_handle(), - navigation_start, - "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); + navigation_start, "FrameTreeNode id", + frame_tree_node->frame_tree_node_id()); } } else { @@ -434,9 +431,8 @@ // which began in the chosen RenderFrameHost, since the request has already // been issued. In that case, simply resume the response. bool is_transfer_to_same = - is_transfer && - entry.transferred_global_request_id().child_id == - dest_render_frame_host->GetProcess()->GetID(); + is_transfer && entry.transferred_global_request_id().child_id == + dest_render_frame_host->GetProcess()->GetID(); if (!is_transfer_to_same) { navigation_data_.reset(new NavigationMetricsData( navigation_start, dest_url, entry.restore_type())); @@ -675,10 +671,9 @@ if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { DCHECK_EQ(!render_frame_host->GetParent(), did_navigate ? details.is_main_frame : false); - navigation_handle->DidCommitNavigation(params, did_navigate, - details.did_replace_entry, - details.previous_url, details.type, - render_frame_host); + navigation_handle->DidCommitNavigation( + params, did_navigate, details.did_replace_entry, details.previous_url, + details.type, render_frame_host); navigation_handle.reset(); } @@ -697,12 +692,12 @@ // Run post-commit tasks. if (delegate_) { if (details.is_main_frame) { - delegate_->DidNavigateMainFramePostCommit(render_frame_host, - details, params); + delegate_->DidNavigateMainFramePostCommit(render_frame_host, details, + params); } - delegate_->DidNavigateAnyFramePostCommit( - render_frame_host, details, params); + delegate_->DidNavigateAnyFramePostCommit(render_frame_host, details, + params); } } @@ -750,8 +745,8 @@ // RenderFrameHost's current SiteInstance, as that's where this navigation // originated. GURL dest_url(url); - if (!GetContentClient()->browser()->ShouldAllowOpenURL( - current_site_instance, url)) { + if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, + url)) { dest_url = GURL(url::kAboutBlankURL); } @@ -896,9 +891,8 @@ } entry->AddOrUpdateFrameEntry( node, -1, -1, nullptr, - static_cast<SiteInstanceImpl*>(source_site_instance), - dest_url, referrer_to_use, redirect_chain, PageState(), method, - -1); + static_cast<SiteInstanceImpl*>(source_site_instance), dest_url, + referrer_to_use, redirect_chain, PageState(), method, -1); } else { // Main frame case. entry = NavigationEntryImpl::FromNavigationEntry( @@ -982,9 +976,8 @@ // Client redirects during the initial history navigation of a child frame // should take precedence over the history navigation (despite being renderer- // initiated). See https://crbug.com/348447 and https://crbug.com/691168. - if (ongoing_navigation_request && - ongoing_navigation_request->request_params() - .is_history_navigation_in_new_child) { + if (ongoing_navigation_request && ongoing_navigation_request->request_params() + .is_history_navigation_in_new_child) { // Preemptively clear this local pointer before deleting the request. ongoing_navigation_request = nullptr; frame_tree_node->ResetNavigationRequest(false, true); @@ -1062,8 +1055,8 @@ navigation_data_.reset(); } -void NavigatorImpl::LogResourceRequestTime( - base::TimeTicks timestamp, const GURL& url) { +void NavigatorImpl::LogResourceRequestTime(base::TimeTicks timestamp, + const GURL& url) { if (navigation_data_ && navigation_data_->url_ == url) { navigation_data_->url_job_start_time_ = timestamp; UMA_HISTOGRAM_TIMES( @@ -1146,8 +1139,7 @@ // is_history_navigation_in_new_child is true. This indicates a newly created // child frame which does not have a beforunload handler. bool should_dispatch_beforeunload = - !is_same_document_history_load && - !is_history_navigation_in_new_child && + !is_same_document_history_load && !is_history_navigation_in_new_child && frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload(); FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType( frame_tree_node->current_url(), // old_url
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index c63c24f..b5ddf2e 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -14,10 +14,10 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" +#include "base/numerics/ranges.h" #include "base/strings/string_number_conversions.h" #include "base/sys_info.h" #include "build/build_config.h" -#include "cc/base/math_util.h" #include "cc/base/switches.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/public/browser/gpu_utils.h" @@ -187,8 +187,8 @@ } } - return cc::MathUtil::ClampToRange(num_raster_threads, kMinRasterThreads, - kMaxRasterThreads); + return base::ClampToRange(num_raster_threads, kMinRasterThreads, + kMaxRasterThreads); } bool IsZeroCopyUploadEnabled() {
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc index 2d46fc8d..d606f16 100644 --- a/content/browser/gpu/gpu_internals_ui.cc +++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -66,7 +66,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("gpu_internals.js", IDR_GPU_INTERNALS_JS); source->SetDefaultResource(IDR_GPU_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index ec343c3..6b5bb1e 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -69,7 +69,7 @@ source->AddResourcePath("indexeddb_internals.css", IDR_INDEXED_DB_INTERNALS_CSS); source->SetDefaultResource(IDR_INDEXED_DB_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/indexed_db/leveldb/leveldb_database.cc b/content/browser/indexed_db/leveldb/leveldb_database.cc index c6d1f40..a1cfdac6 100644 --- a/content/browser/indexed_db/leveldb/leveldb_database.cc +++ b/content/browser/indexed_db/leveldb/leveldb_database.cc
@@ -32,7 +32,7 @@ #include "content/browser/indexed_db/leveldb/leveldb_env.h" #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" #include "content/browser/indexed_db/leveldb/leveldb_write_batch.h" -#include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/env.h" @@ -123,7 +123,7 @@ // https://code.google.com/p/chromium/issues/detail?id=227313#c11 options.max_open_files = 80; options.env = env; - options.block_cache = leveldb_env::SharedWebBlockCache(); + options.block_cache = leveldb_chrome::GetSharedWebBlockCache(); // ChromiumEnv assumes UTF8, converts back to FilePath before using. return leveldb_env::OpenDB(options, path.AsUTF8Unsafe(), db);
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc index eb96d04..f3db0e42 100644 --- a/content/browser/loader/navigation_url_loader_network_service.cc +++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -39,9 +39,11 @@ #include "content/public/common/url_constants.h" #include "content/public/common/url_loader_factory.mojom.h" #include "net/base/load_flags.h" +#include "net/http/http_content_disposition.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/url_request_context.h" #include "services/service_manager/public/cpp/connector.h" +#include "third_party/WebKit/common/mime_util/mime_util.h" namespace content { @@ -481,7 +483,9 @@ ServiceWorkerNavigationHandle* service_worker_navigation_handle, AppCacheNavigationHandle* appcache_handle, NavigationURLLoaderDelegate* delegate) - : delegate_(delegate), weak_factory_(this) { + : delegate_(delegate), + allow_download_(request_info->common_params.allow_download), + weak_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( @@ -519,6 +523,7 @@ new_request->request_body = request_info->common_params.post_data.get(); new_request->report_raw_headers = request_info->report_raw_headers; + new_request->allow_download = allow_download_; int frame_tree_node_id = request_info->frame_tree_node_id; @@ -605,7 +610,7 @@ delegate_->OnResponseStarted( response_, nullptr, std::move(body), ssl_status_, std::unique_ptr<NavigationData>(), GlobalRequestID(-1, g_next_request_id), - false /* is_download? */, false /* is_stream */, + IsDownload(), false /* is_stream */, request_controller_->GetSubresourceURLLoaderFactory()); } @@ -627,4 +632,32 @@ should_ssl_errors_be_fatal); } +bool NavigationURLLoaderNetworkService::IsDownload() const { + DCHECK(response_); + + if (!allow_download_) + return false; + + if (response_->head.headers) { + std::string disposition; + if (response_->head.headers->GetNormalizedHeader("content-disposition", + &disposition) && + !disposition.empty() && + net::HttpContentDisposition(disposition, std::string()) + .is_attachment()) { + return true; + } + // TODO(qinmin): Check whether this is special-case user script that needs + // to be downloaded. + } + + if (blink::IsSupportedMimeType(response_->head.mime_type)) + return false; + + // TODO(qinmin): Check whether there is a plugin handler. + + return (!response_->head.headers || + response_->head.headers->response_code() / 100 == 2); +} + } // namespace content
diff --git a/content/browser/loader/navigation_url_loader_network_service.h b/content/browser/loader/navigation_url_loader_network_service.h index 79db21b..9e7f5b9 100644 --- a/content/browser/loader/navigation_url_loader_network_service.h +++ b/content/browser/loader/navigation_url_loader_network_service.h
@@ -50,6 +50,8 @@ private: class URLLoaderRequestController; + bool IsDownload() const; + NavigationURLLoaderDelegate* delegate_; scoped_refptr<ResourceResponse> response_; @@ -59,6 +61,8 @@ // Lives on the IO thread. std::unique_ptr<URLLoaderRequestController> request_controller_; + bool allow_download_; + base::WeakPtrFactory<NavigationURLLoaderNetworkService> weak_factory_; DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService);
diff --git a/content/browser/loader/navigation_url_loader_unittest.cc b/content/browser/loader/navigation_url_loader_unittest.cc index 8c5c860..6138cb1 100644 --- a/content/browser/loader/navigation_url_loader_unittest.cc +++ b/content/browser/loader/navigation_url_loader_unittest.cc
@@ -5,6 +5,7 @@ #include <memory> #include <utility> +#include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -13,6 +14,7 @@ #include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" +#include "content/browser/loader/test_resource_handler.h" #include "content/browser/loader_delegate_impl.h" #include "content/browser/streams/stream.h" #include "content/browser/streams/stream_context.h" @@ -69,6 +71,27 @@ DISALLOW_COPY_AND_ASSIGN(StreamProtocolHandler); }; +class DownloadProtocolHandler + : public net::URLRequestJobFactory::ProtocolHandler { + public: + DownloadProtocolHandler() {} + + // net::URLRequestJobFactory::ProtocolHandler implementation. + net::URLRequestJob* MaybeCreateJob( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const override { + static const char kHeaders[] = + "HTTP/1.1 200 OK\n" + "Content-type: text/html\n" + "Content-disposition: attachment\n" + "\n"; + return new net::URLRequestTestJob(request, network_delegate, kHeaders, + "test", false); + } + + DISALLOW_COPY_AND_ASSIGN(DownloadProtocolHandler); +}; + class RequestBlockingResourceDispatcherHostDelegate : public ResourceDispatcherHostDelegate { public: @@ -81,13 +104,20 @@ } }; +std::unique_ptr<ResourceHandler> CreateDownloadResourceHandler( + net::URLRequest* request) { + return base::MakeUnique<TestResourceHandler>(); +} + } // namespace class NavigationURLLoaderTest : public testing::Test { public: NavigationURLLoaderTest() : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), - browser_context_(new TestBrowserContext) { + browser_context_(new TestBrowserContext), + host_(base::Bind(&CreateDownloadResourceHandler), + base::ThreadTaskRunnerHandle::Get()) { host_.SetLoaderDelegate(&loader_delegate_); BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); base::RunLoop().RunUntilIdle(); @@ -99,6 +129,8 @@ job_factory_.SetProtocolHandler( "blob", base::MakeUnique<StreamProtocolHandler>( StreamContext::GetFor(browser_context_.get())->registry())); + job_factory_.SetProtocolHandler( + "download", base::MakeUnique<DownloadProtocolHandler>()); request_context->set_job_factory(&job_factory_); // NavigationURLLoader is only used for browser-side navigations. @@ -109,6 +141,13 @@ std::unique_ptr<NavigationURLLoader> MakeTestLoader( const GURL& url, NavigationURLLoaderDelegate* delegate) { + return CreateTestLoader(url, delegate, false); + } + + std::unique_ptr<NavigationURLLoader> CreateTestLoader( + const GURL& url, + NavigationURLLoaderDelegate* delegate, + bool allow_download) { BeginNavigationParams begin_params( std::string(), net::LOAD_NORMAL, false, false, REQUEST_CONTEXT_TYPE_LOCATION, @@ -117,6 +156,7 @@ url::Origin(url)); CommonNavigationParams common_params; common_params.url = url; + common_params.allow_download = allow_download; std::unique_ptr<NavigationRequestInfo> request_info( new NavigationRequestInfo(common_params, begin_params, url, true, false, @@ -406,4 +446,30 @@ EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); } +// Tests that download is allowed for the request. +TEST_F(NavigationURLLoaderTest, DownloadAllowed) { + // Fake a top-level request to a URL whose body does not load immediately. + TestNavigationURLLoaderDelegate delegate; + std::unique_ptr<NavigationURLLoader> loader = + CreateTestLoader(GURL("download:test"), &delegate, true); + + delegate.WaitForResponseStarted(); + EXPECT_TRUE(delegate.is_download()); + loader.reset(); + base::RunLoop().RunUntilIdle(); +} + +// Tests that download is not allowed for the request. +TEST_F(NavigationURLLoaderTest, DownloadDisallowed) { + // Fake a top-level request to a URL whose body does not load immediately. + TestNavigationURLLoaderDelegate delegate; + std::unique_ptr<NavigationURLLoader> loader = + CreateTestLoader(GURL("download:test"), &delegate, false); + + delegate.WaitForResponseStarted(); + EXPECT_FALSE(delegate.is_download()); + loader.reset(); + base::RunLoop().RunUntilIdle(); +} + } // namespace content
diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc index cf9923d..71add9e 100644 --- a/content/browser/loader/resource_dispatcher_host_browsertest.cc +++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc
@@ -74,8 +74,7 @@ got_downloads_ = !!manager->InProgressCount(); } - void CheckTitleTest(const GURL& url, - const std::string& expected_title) { + void CheckTitleTest(const GURL& url, const std::string& expected_title) { base::string16 expected_title16(ASCIIToUTF16(expected_title)); TitleWatcher title_watcher(shell()->web_contents(), expected_title16); NavigateToURL(shell(), url); @@ -97,8 +96,8 @@ } std::string GetCookies(const GURL& url) { - return content::GetCookies( - shell()->web_contents()->GetBrowserContext(), url); + return content::GetCookies(shell()->web_contents()->GetBrowserContext(), + url); } bool got_downloads() const { return got_downloads_; } @@ -116,7 +115,7 @@ base::string16 title; ASSERT_TRUE(GetPopupTitle(url, &title)); EXPECT_TRUE(base::StartsWith(title, ASCIIToUTF16("My Popup Title"), - base::CompareCase::SENSITIVE)) + base::CompareCase::SENSITIVE)) << "Actual title: " << title; } @@ -164,7 +163,8 @@ SniffNoContentTypeNoData) { // Make sure no downloads start. BrowserContext::GetDownloadManager( - shell()->web_contents()->GetBrowserContext())->AddObserver(this); + shell()->web_contents()->GetBrowserContext()) + ->AddObserver(this); CheckTitleTest( net::URLRequestMockHTTPJob::GetMockUrl("content-sniffer-test3.html"), "Content Sniffer Test 3"); @@ -189,8 +189,8 @@ // Test for bug #1091358. IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, SyncXMLHttpRequest) { ASSERT_TRUE(embedded_test_server()->Start()); - NavigateToURL( - shell(), embedded_test_server()->GetURL("/sync_xmlhttprequest.html")); + NavigateToURL(shell(), + embedded_test_server()->GetURL("/sync_xmlhttprequest.html")); // Let's check the XMLHttpRequest ran successfully. bool success = false; @@ -204,9 +204,8 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, SyncXMLHttpRequest_Disallowed) { ASSERT_TRUE(embedded_test_server()->Start()); - NavigateToURL( - shell(), - embedded_test_server()->GetURL("/sync_xmlhttprequest_disallowed.html")); + NavigateToURL(shell(), embedded_test_server()->GetURL( + "/sync_xmlhttprequest_disallowed.html")); // Let's check the XMLHttpRequest ran successfully. bool success = false; @@ -229,7 +228,8 @@ MAYBE_SyncXMLHttpRequest_DuringUnload) { ASSERT_TRUE(embedded_test_server()->Start()); BrowserContext::GetDownloadManager( - shell()->web_contents()->GetBrowserContext())->AddObserver(this); + shell()->web_contents()->GetBrowserContext()) + ->AddObserver(this); CheckTitleTest( embedded_test_server()->GetURL("/sync_xmlhttprequest_during_unload.html"), @@ -237,8 +237,8 @@ // Navigate to a new page, to dispatch unload event and trigger xhr. // (the bug would make this step hang the renderer). - CheckTitleTest( - embedded_test_server()->GetURL("/title2.html"), "Title Of Awesomeness"); + CheckTitleTest(embedded_test_server()->GetURL("/title2.html"), + "Title Of Awesomeness"); ASSERT_FALSE(got_downloads()); } @@ -428,8 +428,8 @@ // TODO(creis): If this causes crashes or hangs, it might be for the same // reason as ErrorPageTest::DNSError. See bug 1199491 and // http://crbug.com/22877. - GURL failed_url = net::URLRequestFailedJob::GetMockHttpUrl( - net::ERR_NAME_NOT_RESOLVED); + GURL failed_url = + net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); NavigateToURL(shell(), failed_url); EXPECT_NE(ASCIIToUTF16("set cookie on unload"), @@ -453,8 +453,8 @@ bool success; GURL test_url(embedded_test_server()->GetURL("/title2.html")); std::string redirect_script = "window.location='" + - test_url.possibly_invalid_spec() + "';" + - "window.domAutomationController.send(true);"; + test_url.possibly_invalid_spec() + "';" + + "window.domAutomationController.send(true);"; EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), redirect_script, &success)); EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); } @@ -470,8 +470,8 @@ // TODO(creis): If this causes crashes or hangs, it might be for the same // reason as ErrorPageTest::DNSError. See bug 1199491 and // http://crbug.com/22877. - GURL failed_url = net::URLRequestFailedJob::GetMockHttpUrl( - net::ERR_NAME_NOT_RESOLVED); + GURL failed_url = + net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); NavigateToURL(shell(), failed_url); EXPECT_NE(ASCIIToUTF16("Title Of Awesomeness"), @@ -584,12 +584,9 @@ ResourceDispatcherHost::Get()->SetDelegate(&delegate); NavigateToURLBlockUntilNavigationsComplete( - shell(), - embedded_test_server()->GetURL("/client_redirect.html"), - 2); + shell(), embedded_test_server()->GetURL("/client_redirect.html"), 2); - EXPECT_TRUE( - delegate.page_transition() & ui::PAGE_TRANSITION_CLIENT_REDIRECT); + EXPECT_TRUE(delegate.page_transition() & ui::PAGE_TRANSITION_CLIENT_REDIRECT); } namespace { @@ -622,8 +619,8 @@ std::vector<std::unique_ptr<ResourceThrottle>>* throttles) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); - if (request->url() != main_frame_url_ && request->url() != subresource_url_ - && request->url() != iframe_url_) + if (request->url() != main_frame_url_ && + request->url() != subresource_url_ && request->url() != iframe_url_) return; if (request->url() == main_frame_url_) { EXPECT_FALSE(main_frame_url_seen_); @@ -720,8 +717,7 @@ base::Unretained(delegate_.get()), previews_state)); } - void CheckResourcesRequested( - bool should_get_previews_state_called) { + void CheckResourcesRequested(bool should_get_previews_state_called) { content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::BindOnce(&PreviewsStateResourceDispatcherHostDelegate:: @@ -801,7 +797,7 @@ // Reload with Lo-Fi disabled. Reset(PREVIEWS_NO_TRANSFORM); TestNavigationObserver tab_observer(shell()->web_contents(), 1); - shell()->web_contents()->GetController().Reload(ReloadType::DISABLE_LOFI_MODE, + shell()->web_contents()->GetController().Reload(ReloadType::DISABLE_PREVIEWS, true); tab_observer.Wait(); CheckResourcesRequested(false);
diff --git a/content/browser/media/cdm_registry_impl_unittest.cc b/content/browser/media/cdm_registry_impl_unittest.cc index 91cac24..260a9678 100644 --- a/content/browser/media/cdm_registry_impl_unittest.cc +++ b/content/browser/media/cdm_registry_impl_unittest.cc
@@ -19,12 +19,13 @@ namespace content { -const char kTestKeySystemType[] = "test"; +const char kTestCdmType[] = "test"; const char kTestPath[] = "/aa/bb"; const char kVersion1[] = "1.1.1.1"; const char kVersion2[] = "1.1.1.2"; -const char kTestCodecs[] = "vp9,mp4"; +const char kTestCodecs[] = "vp9,avc1"; const char kCodecDelimiter[] = ","; +const char kTestKeySystem[] = "com.example.somesystem"; // For simplicity and to make failures easier to diagnose, this test uses // std::string instead of base::FilePath and std::vector<std::string>. @@ -37,13 +38,15 @@ void Register(const std::string& type, const std::string& version, const std::string& path, - const std::string& supported_codecs) { + const std::string& supported_codecs, + std::string supported_key_system, + bool supports_sub_key_systems = false) { const std::vector<std::string> codecs = base::SplitString(supported_codecs, kCodecDelimiter, base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - cdm_registry_.RegisterCdm(CdmInfo(type, base::Version(version), - base::FilePath::FromUTF8Unsafe(path), - codecs)); + 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) { @@ -63,40 +66,47 @@ return versions; } - private: + protected: CdmRegistryImpl cdm_registry_; }; -// Note that KeySystemService is a singleton, and thus the actions of -// one test impact other tests. So each test defines a different key system -// name to avoid conflicts. - TEST_F(CdmRegistryImplTest, Register) { - Register(kTestKeySystemType, kVersion1, kTestPath, kTestCodecs); - EXPECT_TRUE(IsRegistered(kTestKeySystemType, kVersion1)); + Register(kTestCdmType, kVersion1, kTestPath, kTestCodecs, kTestKeySystem, + true); + std::vector<CdmInfo> cdms = cdm_registry_.GetAllRegisteredCdms(); + ASSERT_EQ(1u, cdms.size()); + CdmInfo cdm = cdms[0]; + EXPECT_EQ(kTestCdmType, cdm.type); + EXPECT_EQ(kVersion1, cdm.version.GetString()); + EXPECT_EQ(kTestPath, cdm.path.MaybeAsASCII()); + EXPECT_EQ(2u, cdm.supported_codecs.size()); + EXPECT_EQ("vp9", cdm.supported_codecs[0]); + EXPECT_EQ("avc1", cdm.supported_codecs[1]); + EXPECT_EQ(kTestKeySystem, cdm.supported_key_system); + EXPECT_TRUE(cdm.supports_sub_key_systems); } TEST_F(CdmRegistryImplTest, ReRegister) { - Register(kTestKeySystemType, kVersion1, "/bb/cc", "unknown"); - EXPECT_TRUE(IsRegistered(kTestKeySystemType, kVersion1)); + Register(kTestCdmType, kVersion1, "/bb/cc", "unknown", kTestKeySystem); + EXPECT_TRUE(IsRegistered(kTestCdmType, kVersion1)); // Now register same key system with different values. - Register(kTestKeySystemType, kVersion1, kTestPath, kTestCodecs); - EXPECT_TRUE(IsRegistered(kTestKeySystemType, kVersion1)); + Register(kTestCdmType, kVersion1, kTestPath, kTestCodecs, kTestKeySystem); + EXPECT_TRUE(IsRegistered(kTestCdmType, kVersion1)); } TEST_F(CdmRegistryImplTest, MultipleVersions) { - Register(kTestKeySystemType, kVersion1, kTestPath, kTestCodecs); - Register(kTestKeySystemType, kVersion2, "/bb/cc", "unknown"); - EXPECT_TRUE(IsRegistered(kTestKeySystemType, kVersion1)); - EXPECT_TRUE(IsRegistered(kTestKeySystemType, kVersion2)); + Register(kTestCdmType, kVersion1, kTestPath, kTestCodecs, kTestKeySystem); + Register(kTestCdmType, kVersion2, "/bb/cc", "unknown", kTestKeySystem); + EXPECT_TRUE(IsRegistered(kTestCdmType, kVersion1)); + EXPECT_TRUE(IsRegistered(kTestCdmType, kVersion2)); } TEST_F(CdmRegistryImplTest, NewVersionInsertedFirst) { - Register(kTestKeySystemType, kVersion1, kTestPath, kTestCodecs); - Register(kTestKeySystemType, kVersion2, "/bb/cc", "unknown"); + Register(kTestCdmType, kVersion1, kTestPath, kTestCodecs, kTestKeySystem); + Register(kTestCdmType, kVersion2, "/bb/cc", "unknown", kTestKeySystem); - const std::vector<std::string> versions = GetVersions(kTestKeySystemType); + const std::vector<std::string> versions = GetVersions(kTestCdmType); EXPECT_EQ(2u, versions.size()); EXPECT_EQ(kVersion2, versions[0]); EXPECT_EQ(kVersion1, versions[1]);
diff --git a/content/browser/media/media_internals_ui.cc b/content/browser/media/media_internals_ui.cc index c1e5438..6e9665a0 100644 --- a/content/browser/media/media_internals_ui.cc +++ b/content/browser/media/media_internals_ui.cc
@@ -25,7 +25,7 @@ source->AddResourcePath("media_internals.js", IDR_MEDIA_INTERNALS_JS); source->SetDefaultResource(IDR_MEDIA_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/content/browser/notifications/notification_database.cc b/content/browser/notifications/notification_database.cc index cfe4d27e..f2a1f0759 100644 --- a/content/browser/notifications/notification_database.cc +++ b/content/browser/notifications/notification_database.cc
@@ -16,6 +16,7 @@ #include "storage/common/database/database_identifier.h" #include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "third_party/leveldatabase/env_chromium.h" +#include "third_party/leveldatabase/leveldb_chrome.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/env.h" @@ -127,7 +128,7 @@ options.create_if_missing = create_if_missing; options.paranoid_checks = true; options.filter_policy = filter_policy_.get(); - options.block_cache = leveldb_env::SharedWebBlockCache(); + options.block_cache = leveldb_chrome::GetSharedWebBlockCache(); if (IsInMemoryDatabase()) { env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); options.env = env_.get();
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 67204fb..bae36db 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -102,11 +102,12 @@ struct CompositorDependencies { CompositorDependencies() : frame_sink_id_allocator(kDefaultClientId) { + // TODO(kylechar): Switch this back to kDisableSurfaceReferences. auto surface_lifetime_type = base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableSurfaceReferences) - ? viz::SurfaceManager::LifetimeType::SEQUENCES - : viz::SurfaceManager::LifetimeType::REFERENCES; + "enable-surface-references") + ? viz::SurfaceManager::LifetimeType::REFERENCES + : viz::SurfaceManager::LifetimeType::SEQUENCES; // TODO(danakj): Don't make a FrameSinkManagerImpl when display is in the // Gpu process, instead get the mojo pointer from the Gpu process.
diff --git a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc index 270c3a6..e68cd6c 100644 --- a/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc +++ b/content/browser/renderer_host/input/legacy_ipc_widget_input_handler.cc
@@ -8,31 +8,19 @@ #include "build/build_config.h" #include "content/browser/renderer_host/input/legacy_input_router_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" +#include "content/common/input/ime_text_span_conversions.h" #include "content/common/input_messages.h" namespace content { namespace { -blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType( - ui::ImeTextSpan::Type type) { - switch (type) { - case ui::ImeTextSpan::Type::kComposition: - return blink::WebImeTextSpan::Type::kComposition; - case ui::ImeTextSpan::Type::kSuggestion: - return blink::WebImeTextSpan::Type::kSuggestion; - } - - NOTREACHED(); - return blink::WebImeTextSpan::Type::kComposition; -} - std::vector<blink::WebImeTextSpan> ConvertToBlinkImeTextSpan( const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) { std::vector<blink::WebImeTextSpan> ime_text_spans; for (const auto& ime_text_span : ui_ime_text_spans) { ime_text_spans.emplace_back(blink::WebImeTextSpan( - ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), + ConvertUiImeTextSpanTypeToWebType(ime_text_span.type), ime_text_span.start_offset, ime_text_span.end_offset, ime_text_span.underline_color, ime_text_span.thick, ime_text_span.background_color,
diff --git a/content/browser/renderer_host/input/motion_event_web.cc b/content/browser/renderer_host/input/motion_event_web.cc index 20931c2..fed02d4a 100644 --- a/content/browser/renderer_host/input/motion_event_web.cc +++ b/content/browser/renderer_host/input/motion_event_web.cc
@@ -2,14 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "content/browser/renderer_host/input/motion_event_web.h" -#include <cmath> - #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "content/common/input/web_touch_event_traits.h" #include "ui/events/blink/blink_event_util.h" @@ -133,8 +129,8 @@ DCHECK_LT(pointer_index, GetPointerCount()); float orientation_rad = - event_.touches[pointer_index].rotation_angle * M_PI / 180.f; - DCHECK(0 <= orientation_rad && orientation_rad <= M_PI_2) + event_.touches[pointer_index].rotation_angle * base::kPiFloat / 180.f; + DCHECK(0 <= orientation_rad && orientation_rad <= base::kPiFloat / 2) << "Unexpected touch rotation angle"; if (GetToolType(pointer_index) == TOOL_TYPE_STYLUS) { @@ -143,22 +139,22 @@ if (pointer.tilt_y <= 0 && pointer.tilt_x < 0) { // Stylus is tilted to the left away from the user or straight // to the left thus the orientation should be within [pi/2,pi). - orientation_rad += static_cast<float>(M_PI_2); + orientation_rad += base::kPiFloat / 2; } else if (pointer.tilt_y < 0 && pointer.tilt_x >= 0) { // Stylus is tilted to the right away from the user or straight away // from the user thus the orientation should be within [-pi,-pi/2). - orientation_rad -= static_cast<float>(M_PI); + orientation_rad -= base::kPiFloat; } else if (pointer.tilt_y >= 0 && pointer.tilt_x > 0) { // Stylus is tilted to the right towards the user or straight // to the right thus the orientation should be within [-pi/2,0). - orientation_rad -= static_cast<float>(M_PI_2); + orientation_rad -= base::kPiFloat / 2; } } else if (event_.touches[pointer_index].radius_x > event_.touches[pointer_index].radius_y) { // The case radiusX == radiusY is omitted from here on purpose: for circles, // we want to pass the angle (which could be any value in such cases but // always seems to be set to zero) unchanged. - orientation_rad -= static_cast<float>(M_PI_2); + orientation_rad -= base::kPiFloat / 2; } return orientation_rad;
diff --git a/content/browser/renderer_host/input/motion_event_web_unittest.cc b/content/browser/renderer_host/input/motion_event_web_unittest.cc index a6facad..d877b53a 100644 --- a/content/browser/renderer_host/input/motion_event_web_unittest.cc +++ b/content/browser/renderer_host/input/motion_event_web_unittest.cc
@@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include <stddef.h> -#include <cmath> - +#include "base/numerics/math_constants.h" #include "content/browser/renderer_host/input/motion_event_web.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/blink/blink_event_util.h" @@ -22,7 +18,7 @@ namespace content { TEST(MotionEventWebTest, Constructor) { - const float pi = static_cast<float>(M_PI); + const float pi = base::kPiFloat; const float orientations[] = {-pi, -2.f * pi / 3, -pi / 2}; const float tilts_x[] = {0.f, -180 / 4, -180 / 3}; const float tilts_y[] = {0.5f, 180 / 2, 180 / 3}; @@ -72,8 +68,10 @@ } else { // For non-stylus pointers and for styluses with a zero tilt angle, // orientation quadrant information is lost. - EXPECT_NEAR(fmod(orientation + M_PI + 1e-4, M_PI_2) - 1e-4, - event.GetOrientation(pointer_index), 1e-4); + EXPECT_NEAR( + fmod(orientation + base::kPiFloat + 1e-4, base::kPiFloat / 2) - + 1e-4, + event.GetOrientation(pointer_index), 1e-4); } generic_event.RemovePointerAt(pointer_index);
diff --git a/content/browser/renderer_host/input/web_input_event_util_unittest.cc b/content/browser/renderer_host/input/web_input_event_util_unittest.cc index 4f8f418..af0934a 100644 --- a/content/browser/renderer_host/input/web_input_event_util_unittest.cc +++ b/content/browser/renderer_host/input/web_input_event_util_unittest.cc
@@ -2,15 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Needed on Windows to get |M_PI| from <cmath>. -#ifdef _WIN32 -#define _USE_MATH_DEFINES -#endif - #include <stddef.h> -#include <cmath> - +#include "base/numerics/math_constants.h" #include "content/common/input/synthetic_web_input_event_builders.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/blink/blink_event_util.h" @@ -40,7 +34,7 @@ pointer.raw_y = 25; pointer.pressure = 30; pointer.touch_minor = 35; - pointer.orientation = static_cast<float>(-M_PI / 2); + pointer.orientation = -base::kPiFloat / 2; pointer.tilt_x = 60; pointer.tilt_y = 70; for (MotionEvent::ToolType tool_type : tool_types) {
diff --git a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc index 441aa8d..0d5a5cf8 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
@@ -80,9 +80,11 @@ void SetUp() override { Initialize(); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); manager_ = new AudioInputDeviceManager(audio_system_.get()); - audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); + audio_input_listener_ = + std::make_unique<MockAudioInputDeviceManagerListener>(); manager_->RegisterListener(audio_input_listener_.get()); // Wait until we get the list. @@ -304,8 +306,8 @@ protected: void Initialize() override { // MockAudioManager has no input and no output audio devices. - audio_manager_ = base::MakeUnique<media::MockAudioManager>( - base::MakeUnique<media::AudioThreadImpl>()); + audio_manager_ = std::make_unique<media::MockAudioManager>( + std::make_unique<media::AudioThreadImpl>()); // Devices to request from AudioInputDeviceManager. devices_.emplace_back(MEDIA_TAB_AUDIO_CAPTURE, "tab_capture",
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc index af879d9..d10f2b29 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc
@@ -263,10 +263,11 @@ flags->AppendSwitch(switches::kUseFakeDeviceForMediaStream); flags->AppendSwitch(switches::kUseFakeUIForMediaStream); - audio_manager_.reset(new media::FakeAudioManager( - base::MakeUnique<media::TestAudioThread>(), &log_factory_)); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + audio_manager_ = std::make_unique<media::FakeAudioManager>( + std::make_unique<media::TestAudioThread>(), &log_factory_); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner()); airh_ = new AudioInputRendererHostWithInterception( kRenderProcessId, kRendererPid, media::AudioManager::Get(),
diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc b/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc index 684afb7c..a71893f 100644 --- a/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc +++ b/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc
@@ -99,10 +99,11 @@ // Starts thread bundle: RenderViewHostTestHarness::SetUp(); - audio_manager_ = base::MakeUnique<media::FakeAudioManager>( - base::MakeUnique<media::AudioThreadImpl>(), &log_factory_); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + audio_manager_ = std::make_unique<media::FakeAudioManager>( + std::make_unique<media::AudioThreadImpl>(), &log_factory_); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner()); // Make sure everything is done initializing: @@ -193,7 +194,7 @@ std::string())) .Times(1); std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); BrowserThread::PostTask( @@ -215,7 +216,7 @@ std::string())) .Times(1); std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); BrowserThread::PostTask( @@ -238,7 +239,7 @@ MockAuthorizationCallback listener; std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, @@ -270,7 +271,7 @@ kSalt, SecurityOrigin(), raw_nondefault_id); MockAuthorizationCallback listener; std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, @@ -297,7 +298,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest, AuthorizeInvalidDeviceId_NotFound) { MockAuthorizationCallback listener; std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); EXPECT_CALL(listener, Run(media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, _, @@ -331,7 +332,7 @@ kSalt, origin, raw_nondefault_id); MockAuthorizationCallback listener; std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); NavigateAndCommit(url); @@ -356,7 +357,7 @@ AuthorizeWithSessionIdWithoutDevice_GivesDefault) { MockAuthorizationCallback listener; std::unique_ptr<AudioOutputAuthorizationHandler> handler = - base::MakeUnique<AudioOutputAuthorizationHandler>( + std::make_unique<AudioOutputAuthorizationHandler>( GetAudioSystem(), GetMediaStreamManager(), process()->GetID(), kSalt); EXPECT_CALL(listener, Run(media::OUTPUT_DEVICE_STATUS_OK, _, kDefaultDeviceId,
diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc index c1d45126..9e2f1fb 100644 --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc
@@ -212,7 +212,8 @@ RenderViewHostTestHarness::SetUp(); audio_manager_ = base::MakeUnique<FakeAudioManagerWithAssociations>(&log_factory_); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); media_stream_manager_ = base::MakeUnique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner()); auth_run_loop_ = base::MakeUnique<base::RunLoop>();
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc index f0daa8a..6b53458 100644 --- a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
@@ -93,24 +93,25 @@ base::StringPrintf("video-input-default-id=%s, " "audio-input-default-id=%s", kDefaultVideoDeviceID, kDefaultAudioDeviceID)); - audio_manager_.reset(new media::MockAudioManager( - base::MakeUnique<media::TestAudioThread>())); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_manager_ = std::make_unique<media::MockAudioManager>( + std::make_unique<media::TestAudioThread>()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); auto video_capture_device_factory = - base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(); + std::make_unique<media::FakeVideoCaptureDeviceFactory>(); video_capture_device_factory_ = video_capture_device_factory.get(); - auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>( + auto video_capture_system = std::make_unique<media::VideoCaptureSystemImpl>( std::move(video_capture_device_factory)); auto video_capture_provider = - base::MakeUnique<InProcessVideoCaptureProvider>( + std::make_unique<InProcessVideoCaptureProvider>( std::move(video_capture_system), base::ThreadTaskRunnerHandle::Get(), kIgnoreLogMessageCB); - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner(), std::move(video_capture_provider)); - host_ = base::MakeUnique<MediaDevicesDispatcherHost>( + host_ = std::make_unique<MediaDevicesDispatcherHost>( kProcessId, kRenderId, browser_context_.GetMediaDeviceIDSalt(), media_stream_manager_.get()); host_->SetSecurityOriginForTesting(origin_); @@ -314,7 +315,7 @@ void SubscribeAndWaitForResult(bool has_permission) { host_->SetPermissionChecker( - base::MakeUnique<MediaDevicesPermissionChecker>(has_permission)); + std::make_unique<MediaDevicesPermissionChecker>(has_permission)); uint32_t subscription_id = 0u; for (size_t i = 0; i < NUM_MEDIA_DEVICE_TYPES; ++i) { MediaDeviceType type = static_cast<MediaDeviceType>(i);
diff --git a/content/browser/renderer_host/media/media_devices_manager_unittest.cc b/content/browser/renderer_host/media/media_devices_manager_unittest.cc index 8e81ce4..7cb7e30 100644 --- a/content/browser/renderer_host/media/media_devices_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_devices_manager_unittest.cc
@@ -143,8 +143,9 @@ protected: void SetUp() override { - audio_manager_.reset(new MockAudioManager()); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_manager_ = std::make_unique<MockAudioManager>(); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); auto video_capture_device_factory = base::MakeUnique<MockVideoCaptureDeviceFactory>(); video_capture_device_factory_ = video_capture_device_factory.get();
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index 99dbf601..d620618 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -238,21 +238,22 @@ MediaStreamDispatcherHostTest() : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), origin_(GURL("https://test.com")) { - audio_manager_.reset(new media::MockAudioManager( - base::MakeUnique<media::TestAudioThread>())); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_manager_ = std::make_unique<media::MockAudioManager>( + std::make_unique<media::TestAudioThread>()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); // Make sure we use fake devices to avoid long delays. base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kUseFakeDeviceForMediaStream); auto mock_video_capture_provider = - base::MakeUnique<MockVideoCaptureProvider>(); + std::make_unique<MockVideoCaptureProvider>(); mock_video_capture_provider_ = mock_video_capture_provider.get(); // Create our own MediaStreamManager. - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner(), std::move(mock_video_capture_provider)); - host_ = base::MakeUnique<MockMediaStreamDispatcherHost>( + host_ = std::make_unique<MockMediaStreamDispatcherHost>( browser_context_.GetMediaDeviceIDSalt(), base::ThreadTaskRunnerHandle::Get(), media_stream_manager_.get()); mojom::MediaStreamDispatcherPtr dispatcher = @@ -791,7 +792,7 @@ StreamControls controls(false, true); base::Closure close_callback; - auto stream_ui = base::MakeUnique<MockMediaStreamUIProxy>(); + auto stream_ui = std::make_unique<MockMediaStreamUIProxy>(); EXPECT_CALL(*stream_ui, MockOnStarted(_)) .WillOnce(SaveArg<0>(&close_callback)); media_stream_manager_->UseFakeUIForTests(std::move(stream_ui));
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc index 097df8a..9e95110 100644 --- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -67,7 +67,7 @@ class MockAudioManager : public AudioManagerPlatform { public: MockAudioManager() - : AudioManagerPlatform(base::MakeUnique<media::TestAudioThread>(), + : AudioManagerPlatform(std::make_unique<media::TestAudioThread>(), &fake_audio_log_factory_), num_output_devices_(2), num_input_devices_(2) {} @@ -135,9 +135,10 @@ public: MediaStreamManagerTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { - audio_manager_.reset(new MockAudioManager()); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + audio_manager_ = std::make_unique<MockAudioManager>(); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner()); base::RunLoop().RunUntilIdle(); }
diff --git a/content/browser/renderer_host/media/video_capture_unittest.cc b/content/browser/renderer_host/media/video_capture_unittest.cc index a730d19..9b3345d 100644 --- a/content/browser/renderer_host/media/video_capture_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_unittest.cc
@@ -112,9 +112,10 @@ public: VideoCaptureTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), - audio_manager_(new media::MockAudioManager( - base::MakeUnique<media::TestAudioThread>())), - audio_system_(media::AudioSystemImpl::Create(audio_manager_.get())), + audio_manager_(std::make_unique<media::MockAudioManager>( + std::make_unique<media::TestAudioThread>())), + audio_system_( + std::make_unique<media::AudioSystemImpl>(audio_manager_.get())), task_runner_(base::ThreadTaskRunnerHandle::Get()), opened_session_id_(kInvalidMediaCaptureSessionId), observer_binding_(this) {}
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 8406645..fa61df5 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -37,7 +37,6 @@ #include "components/viz/service/surfaces/surface_hittest.h" #include "content/browser/accessibility/browser_accessibility_manager_android.h" #include "content/browser/accessibility/web_contents_accessibility_android.h" -#include "content/browser/android/composited_touch_handle_drawable.h" #include "content/browser/android/content_view_core.h" #include "content/browser/android/ime_adapter_android.h" #include "content/browser/android/overscroll_controller_android.h" @@ -504,8 +503,6 @@ } RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { - if (content_view_core_) - content_view_core_->RemoveObserver(this); SetContentViewCore(NULL); DCHECK(!ime_adapter_android_); DCHECK(ack_callbacks_.empty()); @@ -1382,15 +1379,15 @@ void RenderWidgetHostViewAndroid::MoveRangeSelectionExtent( const gfx::PointF& extent) { - DCHECK(content_view_core_); - content_view_core_->MoveRangeSelectionExtent(extent); + DCHECK(selection_popup_controller_); + selection_popup_controller_->MoveRangeSelectionExtent(extent); } void RenderWidgetHostViewAndroid::SelectBetweenCoordinates( const gfx::PointF& base, const gfx::PointF& extent) { - DCHECK(content_view_core_); - content_view_core_->SelectBetweenCoordinates(base, extent); + DCHECK(selection_popup_controller_); + selection_popup_controller_->SelectBetweenCoordinates(base, extent); } void RenderWidgetHostViewAndroid::OnSelectionEvent( @@ -1423,21 +1420,14 @@ std::unique_ptr<ui::TouchHandleDrawable> RenderWidgetHostViewAndroid::CreateDrawable() { - DCHECK(content_view_core_); if (!using_browser_compositor_) { if (!sync_compositor_) return nullptr; return std::unique_ptr<ui::TouchHandleDrawable>( sync_compositor_->client()->CreateDrawable()); } - base::android::ScopedJavaLocalRef<jobject> activityContext = - content_view_core_->GetContext(); - // If activityContext is null then Application context is used instead on - // the java side in CompositedTouchHandleDrawable. - return std::unique_ptr<ui::TouchHandleDrawable>( - new CompositedTouchHandleDrawable( - content_view_core_->GetViewAndroid()->GetLayer(), view_.GetDipScale(), - activityContext)); + DCHECK(selection_popup_controller_); + return selection_popup_controller_->CreateTouchHandleDrawable(); } void RenderWidgetHostViewAndroid::SynchronousCopyContents( @@ -2104,13 +2094,11 @@ if (content_view_core_ || is_size_initialized) resize = true; if (content_view_core_) { - content_view_core_->RemoveObserver(this); view_.RemoveObserver(this); view_.RemoveFromParent(); view_.GetLayer()->RemoveFromParent(); } if (content_view_core) { - content_view_core->AddObserver(this); view_.AddObserver(this); ui::ViewAndroid* parent_view = content_view_core->GetViewAndroid(); parent_view->AddChild(&view_);
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index 539f91e..09679af 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -22,7 +22,6 @@ #include "components/viz/common/frame_sinks/begin_frame_args.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/service/frame_sinks/frame_evictor.h" -#include "content/browser/android/content_view_core_observer.h" #include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h" #include "content/browser/renderer_host/input/stylus_text_selector.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" @@ -76,7 +75,6 @@ public viz::FrameEvictorClient, public StylusTextSelectorClient, public ui::TouchSelectionControllerClient, - public content::ContentViewCoreObserver, public content::TextInputManager::Observer, public ui::DelegatedFrameHostAndroid::Client, public viz::BeginFrameObserver { @@ -215,9 +213,6 @@ void OnActivityStopped() override; void OnActivityStarted() override; - // content::ContentViewCoreObserver implementation. - void OnContentViewCoreDestroyed() override; - // viz::FrameEvictor implementation void EvictDelegatedFrame() override; @@ -250,6 +245,7 @@ // Non-virtual methods void SetContentViewCore(ContentViewCore* content_view_core); + void OnContentViewCoreDestroyed(); SkColor GetCachedBackgroundColor() const; void SendKeyEvent(const NativeWebKeyboardEvent& event); void SendMouseEvent(const ui::MotionEventAndroid&, int action_button);
diff --git a/content/browser/service_manager/common_browser_interfaces.cc b/content/browser/service_manager/common_browser_interfaces.cc index dbe8696e..6956634 100644 --- a/content/browser/service_manager/common_browser_interfaces.cc +++ b/content/browser/service_manager/common_browser_interfaces.cc
@@ -17,27 +17,17 @@ #include "content/public/common/service_manager_connection.h" #include "device/geolocation/geolocation_config.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h" #include "services/service_manager/public/cpp/binder_registry.h" namespace content { namespace { -void BindMemoryCoordinatorRequest( - memory_instrumentation::mojom::CoordinatorRequest request, - const service_manager::BindSourceInfo& source_info) { - auto* coordinator = memory_instrumentation::CoordinatorImpl::GetInstance(); - if (coordinator) - coordinator->BindCoordinatorRequest(std::move(request), source_info); -} - class ConnectionFilterImpl : public ConnectionFilter { public: ConnectionFilterImpl() : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) { RegisterMainThreadInterface(base::Bind(&device::GeolocationConfig::Create)); - RegisterMainThreadInterface(base::Bind(&BindMemoryCoordinatorRequest)); auto* browser_main_loop = BrowserMainLoop::GetInstance(); if (browser_main_loop) {
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index 6014680..1990cfa 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -352,7 +352,7 @@ IDR_SERVICE_WORKER_INTERNALS_CSS); source->SetDefaultResource(IDR_SERVICE_WORKER_INTERNALS_HTML); source->DisableDenyXFrameOptions(); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/service_worker/service_worker_metrics.cc b/content/browser/service_worker/service_worker_metrics.cc index 7a1abc1..66a7137 100644 --- a/content/browser/service_worker/service_worker_metrics.cc +++ b/content/browser/service_worker/service_worker_metrics.cc
@@ -1081,4 +1081,8 @@ StartServiceWorkerForNavigationHintResult::NUM_TYPES); } +void ServiceWorkerMetrics::RecordRegisteredOriginCount(size_t origin_count) { + UMA_HISTOGRAM_COUNTS_1M("ServiceWorker.RegisteredOriginCount", origin_count); +} + } // namespace content
diff --git a/content/browser/service_worker/service_worker_metrics.h b/content/browser/service_worker/service_worker_metrics.h index f733146..e4ab5bd 100644 --- a/content/browser/service_worker/service_worker_metrics.h +++ b/content/browser/service_worker/service_worker_metrics.h
@@ -408,6 +408,9 @@ static void RecordStartServiceWorkerForNavigationHintResult( StartServiceWorkerForNavigationHintResult result); + // Records the number of origins with a registered service worker. + static void RecordRegisteredOriginCount(size_t origin_count); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); };
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index 5cbb30b0..bf25534 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc
@@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_storage.h" #include <stddef.h> +#include <memory> #include <utility> #include "base/bind_helpers.h" @@ -1024,6 +1025,8 @@ registered_origins_.swap(data->origins); foreign_fetch_origins_.swap(data->foreign_fetch_origins); state_ = INITIALIZED; + ServiceWorkerMetrics::RecordRegisteredOriginCount( + registered_origins_.size()); } else { DVLOG(2) << "Failed to initialize: " << ServiceWorkerDatabase::StatusToString(status);
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index af234da..0d134d4 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_storage.h" #include <stdint.h> +#include <memory> #include <string> #include <utility> @@ -13,6 +14,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/histogram_tester.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "content/browser/browser_thread_impl.h" @@ -48,8 +50,8 @@ namespace { -typedef ServiceWorkerDatabase::RegistrationData RegistrationData; -typedef ServiceWorkerDatabase::ResourceRecord ResourceRecord; +using RegistrationData = ServiceWorkerDatabase::RegistrationData; +using ResourceRecord = ServiceWorkerDatabase::ResourceRecord; // This is a sample public key for testing the API. The corresponding private // key (use this to generate new samples for this test file) is: @@ -348,11 +350,35 @@ } protected: + const std::set<GURL>& registered_origins() { + return storage()->registered_origins_; + } + void LazyInitialize() { storage()->LazyInitialize(base::BindOnce(&base::DoNothing)); base::RunLoop().RunUntilIdle(); } + // Creates a registration with a waiting version in INSTALLED state. + scoped_refptr<ServiceWorkerRegistration> CreateLiveRegistrationAndVersion( + const GURL& scope, + const GURL& script) { + auto registration = base::MakeRefCounted<ServiceWorkerRegistration>( + blink::mojom::ServiceWorkerRegistrationOptions(scope), + storage()->NewRegistrationId(), context()->AsWeakPtr()); + auto version = base::MakeRefCounted<ServiceWorkerVersion>( + registration.get(), script, storage()->NewVersionId(), + context()->AsWeakPtr()); + std::vector<ResourceRecord> records = { + ResourceRecord(storage()->NewResourceId(), script, 100)}; + version->script_cache_map()->SetResources(records); + version->set_fetch_handler_existence( + ServiceWorkerVersion::FetchHandlerExistence::EXISTS); + version->SetStatus(ServiceWorkerVersion::INSTALLED); + registration->SetWaitingVersion(version); + return registration; + } + ServiceWorkerStatusCode StoreRegistration( scoped_refptr<ServiceWorkerRegistration> registration, scoped_refptr<ServiceWorkerVersion> version) { @@ -563,7 +589,7 @@ // registration written by an earlier version of Chrome. void WriteRegistration(const RegistrationData& registration, const std::vector<ResourceRecord>& resources) { - ServiceWorkerDatabase::RegistrationData deleted_version; + RegistrationData deleted_version; std::vector<int64_t> newly_purgeable_resources; ASSERT_EQ( @@ -693,11 +719,9 @@ kRegistrationId, kScope.GetOrigin(), &found_registration)); EXPECT_FALSE(found_registration.get()); - std::vector<ServiceWorkerDatabase::ResourceRecord> resources; - resources.push_back( - ServiceWorkerDatabase::ResourceRecord(1, kResource1, kResource1Size)); - resources.push_back( - ServiceWorkerDatabase::ResourceRecord(2, kResource2, kResource2Size)); + std::vector<ResourceRecord> resources; + resources.push_back(ResourceRecord(1, kResource1, kResource1Size)); + resources.push_back(ResourceRecord(2, kResource2, kResource2Size)); // Store something. scoped_refptr<ServiceWorkerRegistration> live_registration = @@ -1003,28 +1027,15 @@ TEST_F(ServiceWorkerStorageTest, StoreUserData) { const GURL kScope("http://www.test.not/scope/"); const GURL kScript("http://www.test.not/script.js"); - const int64_t kRegistrationId = 0; - const int64_t kVersionId = 0; - LazyInitialize(); // Store a registration. scoped_refptr<ServiceWorkerRegistration> live_registration = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( - live_registration.get(), kScript, kVersionId, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records; - records.push_back(ServiceWorkerDatabase::ResourceRecord( - 1, live_version->script_url(), 100)); - live_version->script_cache_map()->SetResources(records); - live_version->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version->SetStatus(ServiceWorkerVersion::INSTALLED); - live_registration->SetWaitingVersion(live_version); + CreateLiveRegistrationAndVersion(kScope, kScript); EXPECT_EQ(SERVICE_WORKER_OK, - StoreRegistration(live_registration, live_version)); + StoreRegistration(live_registration, + live_registration->waiting_version())); + const int64_t kRegistrationId = live_registration->id(); // Store user data associated with the registration. std::vector<std::string> data_out; @@ -1287,7 +1298,6 @@ ASSERT_TRUE(InitUserDataDirectory()); ServiceWorkerResourceStorageTest::SetUp(); } - }; TEST_F(ServiceWorkerResourceStorageTest, @@ -1641,9 +1651,8 @@ context()->AsWeakPtr()); live_version->SetStatus(ServiceWorkerVersion::NEW); registration_->SetWaitingVersion(live_version); - std::vector<ServiceWorkerDatabase::ResourceRecord> records; - records.push_back(ServiceWorkerDatabase::ResourceRecord( - 10, live_version->script_url(), 100)); + std::vector<ResourceRecord> records; + records.push_back(ResourceRecord(10, live_version->script_url(), 100)); live_version->script_cache_map()->SetResources(records); live_version->set_fetch_handler_existence( ServiceWorkerVersion::FetchHandlerExistence::EXISTS); @@ -1682,70 +1691,29 @@ } TEST_F(ServiceWorkerStorageTest, FindRegistration_LongestScopeMatch) { + LazyInitialize(); const GURL kDocumentUrl("http://www.example.com/scope/foo"); scoped_refptr<ServiceWorkerRegistration> found_registration; // Registration for "/scope/". const GURL kScope1("http://www.example.com/scope/"); const GURL kScript1("http://www.example.com/script1.js"); - const int64_t kRegistrationId1 = 1; - const int64_t kVersionId1 = 1; scoped_refptr<ServiceWorkerRegistration> live_registration1 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope1), - kRegistrationId1, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version1 = new ServiceWorkerVersion( - live_registration1.get(), kScript1, kVersionId1, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records1; - records1.push_back(ServiceWorkerDatabase::ResourceRecord( - 1, live_version1->script_url(), 100)); - live_version1->script_cache_map()->SetResources(records1); - live_version1->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version1->SetStatus(ServiceWorkerVersion::INSTALLED); - live_registration1->SetWaitingVersion(live_version1); + CreateLiveRegistrationAndVersion(kScope1, kScript1); // Registration for "/scope/foo". const GURL kScope2("http://www.example.com/scope/foo"); const GURL kScript2("http://www.example.com/script2.js"); - const int64_t kRegistrationId2 = 2; - const int64_t kVersionId2 = 2; scoped_refptr<ServiceWorkerRegistration> live_registration2 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope2), - kRegistrationId2, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version2 = new ServiceWorkerVersion( - live_registration2.get(), kScript2, kVersionId2, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records2; - records2.push_back(ServiceWorkerDatabase::ResourceRecord( - 2, live_version2->script_url(), 100)); - live_version2->script_cache_map()->SetResources(records2); - live_version2->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version2->SetStatus(ServiceWorkerVersion::INSTALLED); - live_registration2->SetWaitingVersion(live_version2); + CreateLiveRegistrationAndVersion(kScope2, kScript2); // Registration for "/scope/foobar". const GURL kScope3("http://www.example.com/scope/foobar"); const GURL kScript3("http://www.example.com/script3.js"); - const int64_t kRegistrationId3 = 3; - const int64_t kVersionId3 = 3; scoped_refptr<ServiceWorkerRegistration> live_registration3 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope3), - kRegistrationId3, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version3 = new ServiceWorkerVersion( - live_registration3.get(), kScript3, kVersionId3, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records3; - records3.push_back(ServiceWorkerDatabase::ResourceRecord( - 3, live_version3->script_url(), 100)); - live_version3->script_cache_map()->SetResources(records3); - live_version3->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version3->SetStatus(ServiceWorkerVersion::INSTALLED); - live_registration3->SetWaitingVersion(live_version3); + CreateLiveRegistrationAndVersion(kScope3, kScript3); - // Notify storage of they being installed. + // Notify storage of them being installed. storage()->NotifyInstallingRegistration(live_registration1.get()); storage()->NotifyInstallingRegistration(live_registration2.get()); storage()->NotifyInstallingRegistration(live_registration3.get()); @@ -1758,11 +1726,14 @@ // Store registrations. EXPECT_EQ(SERVICE_WORKER_OK, - StoreRegistration(live_registration1, live_version1)); + StoreRegistration(live_registration1, + live_registration1->waiting_version())); EXPECT_EQ(SERVICE_WORKER_OK, - StoreRegistration(live_registration2, live_version2)); + StoreRegistration(live_registration2, + live_registration2->waiting_version())); EXPECT_EQ(SERVICE_WORKER_OK, - StoreRegistration(live_registration3, live_version3)); + StoreRegistration(live_registration3, + live_registration3->waiting_version())); // Notify storage of installations no longer happening. storage()->NotifyDoneInstallingRegistration( @@ -1794,64 +1765,27 @@ // Registration 1 for http://www.example.com const GURL kScope1("http://www.example.com/scope/"); const GURL kScript1("http://www.example.com/script1.js"); - const int64_t kRegistrationId1 = 1; - const int64_t kVersionId1 = 1; scoped_refptr<ServiceWorkerRegistration> live_registration1 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope1), - kRegistrationId1, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version1 = new ServiceWorkerVersion( - live_registration1.get(), kScript1, kVersionId1, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records1; - records1.push_back(ServiceWorkerDatabase::ResourceRecord( - 1, live_version1->script_url(), 100)); - live_version1->script_cache_map()->SetResources(records1); - live_version1->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version1->SetStatus(ServiceWorkerVersion::INSTALLED); + CreateLiveRegistrationAndVersion(kScope1, kScript1); + const int64_t kRegistrationId1 = live_registration1->id(); + ServiceWorkerVersion* live_version1 = live_registration1->waiting_version(); live_version1->set_foreign_fetch_scopes(std::vector<GURL>(1, kScope1)); - live_registration1->SetWaitingVersion(live_version1); // Registration 2 for http://www.example.com const GURL kScope2("http://www.example.com/scope/foo"); const GURL kScript2("http://www.example.com/script2.js"); - const int64_t kRegistrationId2 = 2; - const int64_t kVersionId2 = 2; scoped_refptr<ServiceWorkerRegistration> live_registration2 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope2), - kRegistrationId2, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version2 = new ServiceWorkerVersion( - live_registration2.get(), kScript2, kVersionId2, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records2; - records2.push_back(ServiceWorkerDatabase::ResourceRecord( - 2, live_version2->script_url(), 100)); - live_version2->script_cache_map()->SetResources(records2); - live_version2->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version2->SetStatus(ServiceWorkerVersion::INSTALLED); + CreateLiveRegistrationAndVersion(kScope2, kScript2); + const int64_t kRegistrationId2 = live_registration2->id(); + ServiceWorkerVersion* live_version2 = live_registration2->waiting_version(); live_version2->set_foreign_fetch_scopes(std::vector<GURL>(1, kScope2)); - live_registration2->SetWaitingVersion(live_version2); // Registration for http://www.test.com const GURL kScope3("http://www.test.com/scope/foobar"); const GURL kScript3("http://www.test.com/script3.js"); - const int64_t kRegistrationId3 = 3; - const int64_t kVersionId3 = 3; scoped_refptr<ServiceWorkerRegistration> live_registration3 = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope3), - kRegistrationId3, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> live_version3 = new ServiceWorkerVersion( - live_registration3.get(), kScript3, kVersionId3, context()->AsWeakPtr()); - std::vector<ServiceWorkerDatabase::ResourceRecord> records3; - records3.push_back(ServiceWorkerDatabase::ResourceRecord( - 3, live_version3->script_url(), 100)); - live_version3->script_cache_map()->SetResources(records3); - live_version3->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); - live_version3->SetStatus(ServiceWorkerVersion::INSTALLED); - live_registration3->SetWaitingVersion(live_version3); + CreateLiveRegistrationAndVersion(kScope3, kScript3); + ServiceWorkerVersion* live_version3 = live_registration3->waiting_version(); // Neither origin should have registrations before they are stored. const GURL kOrigin1 = kScope1.GetOrigin(); @@ -1913,9 +1847,8 @@ data1.is_active = true; data1.resources_total_size_bytes = 100; // Don't set origin_trial_tokens to simulate old database entry. - std::vector<ServiceWorkerDatabase::ResourceRecord> resources1; - resources1.push_back( - ServiceWorkerDatabase::ResourceRecord(1, data1.script, 100)); + std::vector<ResourceRecord> resources1; + resources1.push_back(ResourceRecord(1, data1.script, 100)); WriteRegistration(data1, resources1); const GURL origin2("http://www2.example.com"); @@ -1929,9 +1862,8 @@ data2.resources_total_size_bytes = 200; // Set empty origin_trial_tokens. data2.origin_trial_tokens = TrialTokenValidator::FeatureToTokensMap(); - std::vector<ServiceWorkerDatabase::ResourceRecord> resources2; - resources2.push_back( - ServiceWorkerDatabase::ResourceRecord(2, data2.script, 200)); + std::vector<ResourceRecord> resources2; + resources2.push_back(ResourceRecord(2, data2.script, 200)); WriteRegistration(data2, resources2); scoped_refptr<ServiceWorkerRegistration> found_registration; @@ -2052,8 +1984,8 @@ EXPECT_EQ(kFeature2Token1, tokens.at("Feature2")[0]); EXPECT_EQ(kFeature2Token2, tokens.at("Feature2")[1]); - std::vector<ServiceWorkerDatabase::ResourceRecord> record; - record.push_back(ServiceWorkerDatabase::ResourceRecord(1, kScript, 100)); + std::vector<ResourceRecord> record; + record.push_back(ResourceRecord(1, kScript, 100)); version->script_cache_map()->SetResources(record); version->set_fetch_handler_existence( ServiceWorkerVersion::FetchHandlerExistence::EXISTS); @@ -2094,9 +2026,8 @@ data1.is_active = true; data1.resources_total_size_bytes = 100; // Don't set navigation preload state to simulate old database entry. - std::vector<ServiceWorkerDatabase::ResourceRecord> resources1; - resources1.push_back( - ServiceWorkerDatabase::ResourceRecord(1, data1.script, 100)); + std::vector<ResourceRecord> resources1; + resources1.push_back(ResourceRecord(1, data1.script, 100)); WriteRegistration(data1, resources1); scoped_refptr<ServiceWorkerRegistration> found_registration; @@ -2113,26 +2044,66 @@ EXPECT_EQ("true", state.header); } +TEST_F(ServiceWorkerStorageDiskTest, RegisteredOriginCount) { + { + base::HistogramTester histogram_tester; + LazyInitialize(); + EXPECT_TRUE(registered_origins().empty()); + histogram_tester.ExpectUniqueSample("ServiceWorker.RegisteredOriginCount", + 0, 1); + } + + std::pair<GURL, GURL> scope_and_script_pairs[] = { + {GURL("https://www.example.com/scope/"), + GURL("https://www.example.com/script.js")}, + {GURL("https://www.example.com/scope/foo"), + GURL("https://www.example.com/script.js")}, + {GURL("https://www.test.com/scope/foobar"), + GURL("https://www.test.com/script.js")}, + {GURL("https://example.com/scope/"), + GURL("https://example.com/script.js")}, + }; + std::vector<scoped_refptr<ServiceWorkerRegistration>> registrations; + for (const auto& pair : scope_and_script_pairs) { + registrations.emplace_back( + CreateLiveRegistrationAndVersion(pair.first, pair.second)); + } + + // Store all registrations. + for (const auto& registration : registrations) { + EXPECT_EQ(SERVICE_WORKER_OK, + StoreRegistration(registration, registration->waiting_version())); + } + + // Simulate browser shutdown and restart. + registrations.clear(); + InitializeTestHelper(); + { + base::HistogramTester histogram_tester; + LazyInitialize(); + EXPECT_EQ(3UL, registered_origins().size()); + histogram_tester.ExpectUniqueSample("ServiceWorker.RegisteredOriginCount", + 3, 1); + } + + // Re-initializing shouldn't re-record the histogram. + { + base::HistogramTester histogram_tester; + LazyInitialize(); + EXPECT_EQ(3UL, registered_origins().size()); + histogram_tester.ExpectTotalCount("ServiceWorker.RegisteredOriginCount", 0); + } +} + // Tests loading a registration with a disabled navigation preload // state. TEST_F(ServiceWorkerStorageDiskTest, DisabledNavigationPreloadState) { LazyInitialize(); const GURL kScope("https://valid.example.com/scope"); const GURL kScript("https://valid.example.com/script.js"); - const int64_t kRegistrationId = 1; - const int64_t kVersionId = 1; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( - registration.get(), kScript, kVersionId, context()->AsWeakPtr()); - - std::vector<ServiceWorkerDatabase::ResourceRecord> record; - record.push_back(ServiceWorkerDatabase::ResourceRecord(1, kScript, 100)); - version->script_cache_map()->SetResources(record); - version->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); + CreateLiveRegistrationAndVersion(kScope, kScript); + ServiceWorkerVersion* version = registration->waiting_version(); version->SetStatus(ServiceWorkerVersion::ACTIVATED); registration->SetActiveVersion(version); registration->EnableNavigationPreload(false); @@ -2166,20 +2137,9 @@ const GURL kScope("https://valid.example.com/scope"); const GURL kScript("https://valid.example.com/script.js"); const std::string kHeaderValue("custom header value"); - const int64_t kRegistrationId = 1; - const int64_t kVersionId = 1; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration( - blink::mojom::ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); - scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( - registration.get(), kScript, kVersionId, context()->AsWeakPtr()); - - std::vector<ServiceWorkerDatabase::ResourceRecord> record; - record.push_back(ServiceWorkerDatabase::ResourceRecord(1, kScript, 100)); - version->script_cache_map()->SetResources(record); - version->set_fetch_handler_existence( - ServiceWorkerVersion::FetchHandlerExistence::EXISTS); + CreateLiveRegistrationAndVersion(kScope, kScript); + ServiceWorkerVersion* version = registration->waiting_version(); version->SetStatus(ServiceWorkerVersion::ACTIVATED); registration->SetActiveVersion(version); registration->EnableNavigationPreload(true);
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index a8c447f4..7cd2634 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -78,7 +78,7 @@ #include "content/shell/browser/shell.h" #include "content/test/content_browser_test_utils_internal.h" #include "content/test/mock_overscroll_observer.h" -#include "ipc/ipc.mojom.h" +#include "ipc/constants.mojom.h" #include "ipc/ipc_security_test_util.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "net/dns/mock_host_resolver.h"
diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc index 2d9d0ce6..3f6bfbc 100644 --- a/content/browser/speech/speech_recognition_browsertest.cc +++ b/content/browser/speech/speech_recognition_browsertest.cc
@@ -122,11 +122,12 @@ ASSERT_TRUE(SpeechRecognitionManagerImpl::GetInstance()); media::AudioManager::StartHangMonitorIfNeeded( BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); - audio_manager_.reset(new media::MockAudioManager( - base::MakeUnique<media::AudioThreadImpl>())); + audio_manager_ = std::make_unique<media::MockAudioManager>( + std::make_unique<media::AudioThreadImpl>()); audio_manager_->SetInputStreamParameters( media::AudioParameters::UnavailableDeviceParams()); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); SpeechRecognizerImpl::SetAudioEnvironmentForTesting(audio_system_.get(), audio_manager_.get()); }
diff --git a/content/browser/speech/speech_recognizer_impl_unittest.cc b/content/browser/speech/speech_recognizer_impl_unittest.cc index 7ad27928..3dd2fb2 100644 --- a/content/browser/speech/speech_recognizer_impl_unittest.cc +++ b/content/browser/speech/speech_recognizer_impl_unittest.cc
@@ -69,7 +69,8 @@ base::MakeUnique<media::TestAudioThread>(true))); audio_manager_->SetInputStreamParameters( media::AudioParameters::UnavailableDeviceParams()); - audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); + audio_system_ = + std::make_unique<media::AudioSystemImpl>(audio_manager_.get()); recognizer_ = new SpeechRecognizerImpl( this, audio_system_.get(), audio_manager_.get(), kTestingSessionId, false, false, sr_engine);
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index 3b889d0..a59ee05 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc
@@ -176,13 +176,9 @@ web_ui->GetWebContents()->GetBrowserContext(); WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); - std::unordered_set<std::string> exclusions; - exclusions.insert("json/begin_recording"); - exclusions.insert("json/categories"); - exclusions.insert("json/end_recording_compressed"); - exclusions.insert("json/get_buffer_percent_full"); - exclusions.insert("json/get_buffer_status"); - source->UseGzip(exclusions); + source->UseGzip({"json/begin_recording", "json/categories", + "json/end_recording_compressed", + "json/get_buffer_percent_full", "json/get_buffer_status"}); source->SetJsonPath("strings.js"); source->SetDefaultResource(IDR_TRACING_HTML); source->AddResourcePath("tracing.js", IDR_TRACING_JS);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 06ac1764..8ba9af8 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1545,21 +1545,29 @@ } #if defined(OS_ANDROID) -void WebContentsImpl::SetImportance(ChildProcessImportance importance) { - // Not calling GetRenderWidgetHostView since importance should be set on both - // the interstitial and underlying page. +std::set<RenderWidgetHostImpl*> WebContentsImpl::GetAllRenderWidgetHosts() { std::set<RenderWidgetHostImpl*> set; if (ShowingInterstitialPage()) { - set.insert( + auto* host = static_cast<RenderFrameHostImpl*>(interstitial_page_->GetMainFrame()) - ->GetRenderWidgetHost()); - } - for (RenderFrameHost* rfh : GetAllFrames()) - set.insert(static_cast<RenderFrameHostImpl*>(rfh)->GetRenderWidgetHost()); - for (RenderWidgetHostImpl* host : set) { + ->GetRenderWidgetHost(); DCHECK(host); - host->SetImportance(importance); + set.insert(host); } + for (RenderFrameHost* rfh : GetAllFrames()) { + auto* host = static_cast<RenderFrameHostImpl*>(rfh)->GetRenderWidgetHost(); + DCHECK(host); + set.insert(host); + } + return set; +} + +void WebContentsImpl::SetImportance(ChildProcessImportance importance) { + // Importance should be set on interstitial page as well, which is included + // the set returned by |GetAllRenderWidgetHosts()|. + for (auto* host : GetAllRenderWidgetHosts()) + host->SetImportance(importance); + // TODO(boliu): If this is ever used on platforms other than Android, make // sure to also update inner WebContents. }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 7078470..02dbddce 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -291,6 +291,7 @@ void NotifyManifestUrlChanged(const base::Optional<GURL>& manifest_url); #if defined(OS_ANDROID) + std::set<RenderWidgetHostImpl*> GetAllRenderWidgetHosts(); void SetImportance(ChildProcessImportance importance); #endif
diff --git a/content/browser/webrtc/webrtc_content_browsertest_base.cc b/content/browser/webrtc/webrtc_content_browsertest_base.cc index 4e7c6307..d6b66ba8 100644 --- a/content/browser/webrtc/webrtc_content_browsertest_base.cc +++ b/content/browser/webrtc/webrtc_content_browsertest_base.cc
@@ -113,7 +113,8 @@ bool WebRtcContentBrowserTestBase::HasAudioOutputDevices() { bool has_devices = false; base::RunLoop run_loop; - media::AudioSystem::Get()->HasOutputDevices(base::BindOnce( + auto audio_system = media::AudioSystem::CreateInstance(); + audio_system->HasOutputDevices(base::BindOnce( [](base::Closure finished_callback, bool* result, bool received) { *result = received; finished_callback.Run();
diff --git a/content/browser/webrtc/webrtc_internals_ui.cc b/content/browser/webrtc/webrtc_internals_ui.cc index e15cbef..027ab873 100644 --- a/content/browser/webrtc/webrtc_internals_ui.cc +++ b/content/browser/webrtc/webrtc_internals_ui.cc
@@ -22,7 +22,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("webrtc_internals.js", IDR_WEBRTC_INTERNALS_JS); source->SetDefaultResource(IDR_WEBRTC_INTERNALS_HTML); - source->UseGzip(std::unordered_set<std::string>()); + source->UseGzip(); return source; }
diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc index ea209cf..3800726 100644 --- a/content/browser/webui/web_ui_data_source_impl.cc +++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -210,7 +210,7 @@ } void WebUIDataSourceImpl::UseGzip( - const std::unordered_set<std::string>& excluded_paths) { + const std::vector<std::string>& excluded_paths) { use_gzip_ = true; for (const auto& path : excluded_paths) excluded_paths_.insert(path);
diff --git a/content/browser/webui/web_ui_data_source_impl.h b/content/browser/webui/web_ui_data_source_impl.h index 93bdfe9..a230f31 100644 --- a/content/browser/webui/web_ui_data_source_impl.h +++ b/content/browser/webui/web_ui_data_source_impl.h
@@ -9,6 +9,7 @@ #include <map> #include <string> +#include <unordered_set> #include "base/callback.h" #include "base/compiler_specific.h" @@ -47,7 +48,7 @@ void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; void DisableDenyXFrameOptions() override; - void UseGzip(const std::unordered_set<std::string>& excluded_paths) override; + void UseGzip(const std::vector<std::string>& excluded_paths) override; const ui::TemplateReplacements* GetReplacements() const override; // Add the locale to the load time data defaults. May be called repeatedly.
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 034e50c..916ac53 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -72,6 +72,7 @@ #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_source.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h" #include "services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom.h" +#include "services/resource_coordinator/public/interfaces/service_constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/runner/common/client_util.h" @@ -83,8 +84,6 @@ #if defined(OS_MACOSX) #include "base/allocator/allocator_interception_mac.h" -#include "base/process/process.h" -#include "content/common/mac/app_nap_activity.h" #endif #if defined(OS_WIN) @@ -525,7 +524,8 @@ process_type = memory_instrumentation::mojom::ProcessType::PLUGIN; memory_instrumentation::ClientProcessImpl::Config config( - GetConnector(), mojom::kBrowserServiceName, process_type); + GetConnector(), resource_coordinator::mojom::kServiceName, + process_type); memory_instrumentation::ClientProcessImpl::CreateInstance(config); } } @@ -578,10 +578,6 @@ switches::kEnableHeapProfiling)) { base::allocator::PeriodicallyShimNewMallocZones(); } - if (base::Process::IsAppNapEnabled()) { - app_nap_activity_.reset(new AppNapActivity()); - app_nap_activity_->Begin(); - }; #endif message_loop_->task_runner()->PostDelayedTask( @@ -789,15 +785,6 @@ if (backgrounded) timer_slack = base::TIMER_SLACK_MAXIMUM; base::MessageLoop::current()->SetTimerSlack(timer_slack); -#if defined(OS_MACOSX) - if (base::Process::IsAppNapEnabled()) { - if (backgrounded) { - app_nap_activity_->End(); - } else { - app_nap_activity_->Begin(); - } - } -#endif // defined(OS_MACOSX) } void ChildThreadImpl::OnProcessPurgeAndSuspend() {
diff --git a/content/child/child_thread_impl.h b/content/child/child_thread_impl.h index 6c7d641..27b3b171 100644 --- a/content/child/child_thread_impl.h +++ b/content/child/child_thread_impl.h
@@ -60,10 +60,6 @@ class ResourceDispatcher; class ThreadSafeSender; -#if defined(OS_MACOSX) -class AppNapActivity; -#endif - // The main thread of a child process derives from this class. class CONTENT_EXPORT ChildThreadImpl : public IPC::Listener, @@ -290,10 +286,6 @@ scoped_refptr<base::SingleThreadTaskRunner> browser_process_io_runner_; -#if defined(OS_MACOSX) - std::unique_ptr<AppNapActivity> app_nap_activity_; -#endif // defined(OS_MACOSX) - std::unique_ptr<variations::ChildProcessFieldTrialSyncer> field_trial_syncer_; std::unique_ptr<base::WeakPtrFactory<ChildThreadImpl>>
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index b61879a..ec5554b 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -164,6 +164,8 @@ "input/event_with_latency_info.h", "input/gesture_event_stream_validator.cc", "input/gesture_event_stream_validator.h", + "input/ime_text_span_conversions.cc", + "input/ime_text_span_conversions.h", "input/input_event.cc", "input/input_event.h", "input/input_event_ack.cc", @@ -206,8 +208,6 @@ "layer_tree_settings_factory.h", "loader_util.cc", "loader_util.h", - "mac/app_nap_activity.h", - "mac/app_nap_activity.mm", "mac/attributed_string_coder.h", "mac/attributed_string_coder.mm", "mac/font_descriptor.h", @@ -651,7 +651,7 @@ public_deps = [ "//components/leveldb/public/interfaces", "//content/public/common:interfaces", - "//ipc:mojom", + "//ipc:mojom_constants", "//media/capture/mojo:capture_types", "//media/mojo/interfaces", "//mojo/common:common_custom_types",
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h index 85612b9..afb9838e 100644 --- a/content/common/content_param_traits_macros.h +++ b/content/common/content_param_traits_macros.h
@@ -49,7 +49,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPageVisibilityState, blink::kWebPageVisibilityStateLast) IPC_ENUM_TRAITS_MAX_VALUE(blink::WebImeTextSpan::Type, - blink::WebImeTextSpan::Type::kSuggestion) + blink::WebImeTextSpan::Type::kMisspellingSuggestion) IPC_STRUCT_TRAITS_BEGIN(blink::WebImeTextSpan) IPC_STRUCT_TRAITS_MEMBER(type)
diff --git a/content/common/input/ime_text_span_conversions.cc b/content/common/input/ime_text_span_conversions.cc new file mode 100644 index 0000000..59ef7f35 --- /dev/null +++ b/content/common/input/ime_text_span_conversions.cc
@@ -0,0 +1,41 @@ +// 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 "content/common/input/ime_text_span_conversions.h" + +#include "base/logging.h" + +namespace content { + +blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToWebType( + ui::ImeTextSpan::Type type) { + switch (type) { + case ui::ImeTextSpan::Type::kComposition: + return blink::WebImeTextSpan::Type::kComposition; + case ui::ImeTextSpan::Type::kSuggestion: + return blink::WebImeTextSpan::Type::kSuggestion; + case ui::ImeTextSpan::Type::kMisspellingSuggestion: + return blink::WebImeTextSpan::Type::kMisspellingSuggestion; + } + + NOTREACHED(); + return blink::WebImeTextSpan::Type::kComposition; +} + +ui::ImeTextSpan::Type ConvertWebImeTextSpanTypeToUiType( + blink::WebImeTextSpan::Type type) { + switch (type) { + case blink::WebImeTextSpan::Type::kComposition: + return ui::ImeTextSpan::Type::kComposition; + case blink::WebImeTextSpan::Type::kSuggestion: + return ui::ImeTextSpan::Type::kSuggestion; + case blink::WebImeTextSpan::Type::kMisspellingSuggestion: + return ui::ImeTextSpan::Type::kMisspellingSuggestion; + } + + NOTREACHED(); + return ui::ImeTextSpan::Type::kComposition; +} + +} // namespace content
diff --git a/content/common/input/ime_text_span_conversions.h b/content/common/input/ime_text_span_conversions.h new file mode 100644 index 0000000..50d78de2 --- /dev/null +++ b/content/common/input/ime_text_span_conversions.h
@@ -0,0 +1,20 @@ +// 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 CONTENT_COMMON_INPUT_IME_TEXT_SPAN_CONVERSIONS_H_ +#define CONTENT_COMMON_INPUT_IME_TEXT_SPAN_CONVERSIONS_H_ + +#include "third_party/WebKit/public/web/WebImeTextSpan.h" +#include "ui/base/ime/ime_text_span.h" + +namespace content { + +blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToWebType( + ui::ImeTextSpan::Type type); +ui::ImeTextSpan::Type ConvertWebImeTextSpanTypeToUiType( + blink::WebImeTextSpan::Type type); + +} // namespace content + +#endif // CONTENT_COMMON_INPUT_IME_TEXT_SPAN_CONVERSIONS_H_
diff --git a/content/common/mac/app_nap_activity.h b/content/common/mac/app_nap_activity.h deleted file mode 100644 index c2896e8..0000000 --- a/content/common/mac/app_nap_activity.h +++ /dev/null
@@ -1,49 +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 CONTENT_COMMON_MAC_APP_NAP_ACTIVITY_H -#define CONTENT_COMMON_MAC_APP_NAP_ACTIVITY_H - -#include <memory> - -#include "base/macros.h" -#include "content/common/content_export.h" - -namespace content { - -// Can't import scoped_nsobject here, so wrap it. -struct AssertionWrapper; - -// A wrapper around the macOS "activity" system, which is required to -// make renderers eligible for AppNap. -// -// When doing work, processes are expected to begin an activity, receiving -// an opaque token called an "assertion". On finishing, they end the activity. -// When a process has no outstanding assertions, it becomes eligible for -// AppNap. -class CONTENT_EXPORT AppNapActivity { - public: - AppNapActivity(); - ~AppNapActivity(); - - // Because there's no NSApplication in renderers, do some housekeeping - // to become eligible for App Nap. - static void InitializeAppNapSupport(); - - // Begin an activity and store the provided token. - void Begin(); - - // End the activity represented by |assertion_|. - void End(); - - private: - // An opaque token provided by the OS on beginning an activity. - std::unique_ptr<AssertionWrapper> assertion_; - - DISALLOW_COPY_AND_ASSIGN(AppNapActivity); -}; - -} // namespace content - -#endif // CONTENT_COMMON_MAC_APP_NAP_ACTIVITY_H
diff --git a/content/common/mac/app_nap_activity.mm b/content/common/mac/app_nap_activity.mm deleted file mode 100644 index 5187444..0000000 --- a/content/common/mac/app_nap_activity.mm +++ /dev/null
@@ -1,72 +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 "content/common/mac/app_nap_activity.h" - -#import <Foundation/Foundation.h> - -#include "base/mac/scoped_nsobject.h" - -extern "C" { -void __CFRunLoopSetOptionsReason(uint64_t options, - NSString* reason, - int unused); -} - -namespace content { - -namespace { - -NSString* const kActivityReason = @"Process foregrounded"; -const NSActivityOptions kActivityOptions = - (NSActivityUserInitiatedAllowingIdleSystemSleep | - NSActivityLatencyCritical) & - ~(NSActivitySuddenTerminationDisabled | - NSActivityAutomaticTerminationDisabled); - -} // namespace - -struct AssertionWrapper { - base::scoped_nsobject<id> obj; -}; - -AppNapActivity::AppNapActivity() { - assertion_.reset(new AssertionWrapper()); -}; - -AppNapActivity::~AppNapActivity() { - if (assertion_->obj.get()) - End(); -}; - -void AppNapActivity::InitializeAppNapSupport() { - // Reason strings are the same as - // what macOS sends in the corresponding call. - // |options| (argument 1) are magic numbers as found in the - // callsites mentioned above. - // - // Normally happens during launch services check-in. (HIToolbox) - __CFRunLoopSetOptionsReason( - 1, @"Finished checking in as application - waiting for events", 0); - // Normally happens in a dispatch_once in the NSApplication event loop. - // (CoreFoundation). - __CFRunLoopSetOptionsReason( - 0x3b000000, @"Finished delay after app launch and bundle check", 0); -} - -void AppNapActivity::Begin() { - DCHECK(!assertion_->obj.get()); - id assertion = - [[NSProcessInfo processInfo] beginActivityWithOptions:kActivityOptions - reason:kActivityReason]; - assertion_->obj.reset([assertion retain]); -} - -void AppNapActivity::End() { - id assertion = assertion_->obj.autorelease(); - DCHECK(assertion); - [[NSProcessInfo processInfo] endActivity:assertion]; -} - -} // namespace content
diff --git a/content/common/mac/app_nap_activity_unittest.mm b/content/common/mac/app_nap_activity_unittest.mm deleted file mode 100644 index 44d2ee3..0000000 --- a/content/common/mac/app_nap_activity_unittest.mm +++ /dev/null
@@ -1,56 +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 "content/common/mac/app_nap_activity.h" - -#include "testing/gtest_mac.h" -#include "testing/platform_test.h" -#import "third_party/ocmock/OCMock/OCMock.h" -#include "third_party/ocmock/gtest_support.h" - -class AppNapActivityTest : public PlatformTest {}; - -TEST_F(AppNapActivityTest, StoresAssertion) { - const NSActivityOptions expectedOptions = - (NSActivityUserInitiatedAllowingIdleSystemSleep | - NSActivityLatencyCritical) & - ~(NSActivitySuddenTerminationDisabled | - NSActivityAutomaticTerminationDisabled); - id processInfoMock = - [OCMockObject partialMockForObject:[NSProcessInfo processInfo]]; - id assertion = @"An activity assertion"; - [[[processInfoMock expect] andReturn:assertion] - beginActivityWithOptions:expectedOptions - reason:OCMOCK_ANY]; - - content::AppNapActivity activity; - activity.Begin(); - - EXPECT_OCMOCK_VERIFY(processInfoMock); - - [[processInfoMock expect] endActivity:assertion]; - - activity.End(); - - EXPECT_OCMOCK_VERIFY(processInfoMock); - [processInfoMock stopMocking]; -} - -TEST_F(AppNapActivityTest, EndsActivityOnDestruct) { - id processInfoMock = - [OCMockObject partialMockForObject:[NSProcessInfo processInfo]]; - id assertion = @"An activity assertion"; - [[[[processInfoMock stub] ignoringNonObjectArgs] andReturn:assertion] - beginActivityWithOptions:0 - reason:OCMOCK_ANY]; - - [[processInfoMock expect] endActivity:assertion]; - { - content::AppNapActivity activity; - activity.Begin(); - } - - EXPECT_OCMOCK_VERIFY(processInfoMock); - [processInfoMock stopMocking]; -}
diff --git a/content/common/media/cdm_info.cc b/content/common/media/cdm_info.cc index 3dbdcdab..fb03e84 100644 --- a/content/common/media/cdm_info.cc +++ b/content/common/media/cdm_info.cc
@@ -9,11 +9,15 @@ CdmInfo::CdmInfo(const std::string& type, const base::Version& version, const base::FilePath& path, - const std::vector<std::string>& supported_codecs) + const std::vector<std::string>& supported_codecs, + const std::string& supported_key_system, + bool supports_sub_key_systems) : type(type), version(version), path(path), - supported_codecs(supported_codecs) {} + supported_codecs(supported_codecs), + supported_key_system(supported_key_system), + supports_sub_key_systems(supports_sub_key_systems) {} CdmInfo::CdmInfo(const CdmInfo& other) = default;
diff --git a/content/common/renderer.mojom b/content/common/renderer.mojom index 642090b..62ad23e 100644 --- a/content/common/renderer.mojom +++ b/content/common/renderer.mojom
@@ -6,7 +6,7 @@ import "content/common/native_types.mojom"; import "content/common/service_worker/embedded_worker.mojom"; -import "ipc/ipc.mojom"; +import "ipc/constants.mojom"; import "mojo/common/time.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; import "ui/gfx/mojo/icc_profile.mojom"; @@ -171,7 +171,7 @@ // EffectiveConnectionType is the connection type whose typical performance is // most similar to the measured performance of the network in use. // The downstream throughput is computed in kilobits per second. If an - // estimate of the HTTP or transport RTT is unavailable, it will be set to + // estimate of the HTTP or transport RTT is unavailable, it will be set to // net::nqe::internal::InvalidRTT(). If the throughput estimate is // unavailable, it will be set to net::nqe::internal::kInvalidThroughput. OnNetworkQualityChanged(EffectiveConnectionType effective_connection_type,
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 2b85ee29..0eb5d448 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -332,7 +332,6 @@ /** * @return The context used for creating this ContentViewCore. */ - @CalledByNative public Context getContext() { return mContext; }
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java index b57ba91..273f604 100644 --- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java +++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -1057,6 +1057,14 @@ mClassificationResult = null; } + /** + * @return The context used for SelectionPopupController. + */ + @CalledByNative + private Context getContext() { + return mContext; + } + @CalledByNative private void onSelectionChanged(String text) { mLastSelectedText = text;
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java index 93f42e3d..51910ac 100644 --- a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java +++ b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java
@@ -326,14 +326,18 @@ ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { - cancelCombiningAccentOnUiThread(); - mImeAdapter.sendCompositionToNative(text, newCursorPosition, true, 0); + commitTextOnUiThread(text, newCursorPosition); } }); notifyUserAction(); return true; } + private void commitTextOnUiThread(final CharSequence text, final int newCursorPosition) { + cancelCombiningAccentOnUiThread(); + mImeAdapter.sendCompositionToNative(text, newCursorPosition, true, 0); + } + /** * @see InputConnection#performEditorAction(int) */ @@ -496,7 +500,7 @@ StringBuilder builder = new StringBuilder(); builder.appendCodePoint(combined); String text = builder.toString(); - mImeAdapter.sendCompositionToNative(text, 1, text.length() > 0, 0); + commitTextOnUiThread(text, 1); return true; } // Noncombinable character; commit the accent character and fall through to sending
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java index 89b2898..cc687765 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -1104,43 +1104,50 @@ Assert.assertEquals("hô", mRule.getTextBeforeCursor(9, 0)); mRule.waitAndVerifyUpdateSelection(2, 2, 2, -1, -1); + // o again. Should not have accent mark this time. + mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_O)); + Assert.assertEquals("hôo", mRule.getTextBeforeCursor(9, 0)); + mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_O)); + Assert.assertEquals("hôo", mRule.getTextBeforeCursor(9, 0)); + mRule.waitAndVerifyUpdateSelection(3, 3, 3, -1, -1); + // ALT-i mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); - Assert.assertEquals("hôˆ", mRule.getTextBeforeCursor(9, 0)); - mRule.waitAndVerifyUpdateSelection(3, 3, 3, 2, 3); + Assert.assertEquals("hôoˆ", mRule.getTextBeforeCursor(9, 0)); + mRule.waitAndVerifyUpdateSelection(4, 4, 4, 3, 4); // ALT-i again should have no effect mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); - Assert.assertEquals("hôˆ", mRule.getTextBeforeCursor(9, 0)); + Assert.assertEquals("hôoˆ", mRule.getTextBeforeCursor(9, 0)); // b (cannot be accented, should just appear after) mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_B)); - Assert.assertEquals("hôˆb", mRule.getTextBeforeCursor(9, 0)); + Assert.assertEquals("hôoˆb", mRule.getTextBeforeCursor(9, 0)); mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_B)); - Assert.assertEquals("hôˆb", mRule.getTextBeforeCursor(9, 0)); - int index = 4; - mRule.waitAndVerifyUpdateSelection(index++, 4, 4, -1, -1); + Assert.assertEquals("hôoˆb", mRule.getTextBeforeCursor(9, 0)); + int index = 5; + mRule.waitAndVerifyUpdateSelection(index++, 5, 5, -1, -1); // ALT-i mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); mRule.dispatchKeyEvent(new KeyEvent( 0, 0, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_I, 0, KeyEvent.META_ALT_ON)); - Assert.assertEquals("hôˆbˆ", mRule.getTextBeforeCursor(9, 0)); - mRule.waitAndVerifyUpdateSelection(index++, 5, 5, 4, 5); + Assert.assertEquals("hôoˆbˆ", mRule.getTextBeforeCursor(9, 0)); + mRule.waitAndVerifyUpdateSelection(index++, 6, 6, 5, 6); // Backspace mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); - Assert.assertEquals("hôˆb", mRule.getTextBeforeCursor(9, 0)); + Assert.assertEquals("hôoˆb", mRule.getTextBeforeCursor(9, 0)); mRule.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); - Assert.assertEquals("hôˆb", mRule.getTextBeforeCursor(9, 0)); - mRule.waitAndVerifyUpdateSelection(index++, 4, 4, -1, -1); + Assert.assertEquals("hôoˆb", mRule.getTextBeforeCursor(9, 0)); + mRule.waitAndVerifyUpdateSelection(index++, 5, 5, -1, -1); } @Test
diff --git a/content/public/app/mojo/content_packaged_services_manifest.json b/content/public/app/mojo/content_packaged_services_manifest.json index eb06fe0..c3c69f8 100644 --- a/content/public/app/mojo/content_packaged_services_manifest.json +++ b/content/public/app/mojo/content_packaged_services_manifest.json
@@ -16,6 +16,7 @@ ] }, "requires": { + "*": [ "app" ], "content_browser": [], "service_manager": [ "service_manager:all_users",
diff --git a/content/public/app/mojo/content_renderer_manifest.json b/content/public/app/mojo/content_renderer_manifest.json index 7d77959..b297ec2 100644 --- a/content/public/app/mojo/content_renderer_manifest.json +++ b/content/public/app/mojo/content_renderer_manifest.json
@@ -50,7 +50,7 @@ ] }, "requires": { - "content_browser": [ "memory_instrumentation", "renderer" ] + "content_browser": [ "renderer" ] } } },
diff --git a/content/public/browser/reload_type.h b/content/public/browser/reload_type.h index 74f33c18..77c6e9b 100644 --- a/content/public/browser/reload_type.h +++ b/content/public/browser/reload_type.h
@@ -21,8 +21,8 @@ // is used for cases where the user wants to refresh a page using a different // user agent after following a redirect. ORIGINAL_REQUEST_URL, - // Reloads the current entry with Lo-Fi mode disabled. - DISABLE_LOFI_MODE + // Reloads the current entry with previews disabled. + DISABLE_PREVIEWS }; } // namespace content
diff --git a/content/public/browser/web_ui_data_source.h b/content/public/browser/web_ui_data_source.h index 228245ac..a1a6c97 100644 --- a/content/public/browser/web_ui_data_source.h +++ b/content/public/browser/web_ui_data_source.h
@@ -9,7 +9,7 @@ #include <memory> #include <string> -#include <unordered_set> +#include <vector> #include "base/callback.h" #include "base/strings/string16.h" @@ -109,8 +109,7 @@ // Tells the loading code that resources are gzipped on disk. |excluded_paths| // are uncompressed paths, and therefore should not be decompressed. - virtual void UseGzip(const std::unordered_set<std::string>& excluded_paths) - = 0; + virtual void UseGzip(const std::vector<std::string>& excluded_paths = {}) = 0; }; } // namespace content
diff --git a/content/public/common/cdm_info.h b/content/public/common/cdm_info.h index ca66734..ba61eeb 100644 --- a/content/public/common/cdm_info.h +++ b/content/public/common/cdm_info.h
@@ -19,7 +19,9 @@ CdmInfo(const std::string& type, const base::Version& version, const base::FilePath& path, - const std::vector<std::string>& supported_codecs); + const std::vector<std::string>& supported_codecs, + const std::string& supported_key_system, + bool supports_sub_key_systems); CdmInfo(const CdmInfo& other); ~CdmInfo(); @@ -37,6 +39,15 @@ // TODO(jrummell): use the enums from media::AudioCodec and media::VideoCodec // instead of strings. std::vector<std::string> supported_codecs; + + // The key system supported by this CDM. + std::string supported_key_system; + + // Whether we also support sub key systems of the |supported_key_system|. + // A sub key system to a key system is like a sub domain to a domain. + // For example, com.example.somekeysystem.a and com.example.somekeysystem.b + // are both sub key systems of com.example.somekeysystem. + bool supports_sub_key_systems = false; }; struct CONTENT_EXPORT CdmHostFilePath {
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 7deff3ab..66dc4a4 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -162,15 +162,8 @@ base::FEATURE_DISABLED_BY_DEFAULT}; // Enables/disables hardware video encode acceleration using Mojo (falls back). -// TODO(mcasas): remove after https://crbug.com/736517 is closed. -const base::Feature kMojoVideoEncodeAccelerator { - "MojoVideoEncodeAccelerator", -#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) - base::FEATURE_ENABLED_BY_DEFAULT -#else - base::FEATURE_DISABLED_BY_DEFAULT -#endif -}; +const base::Feature kMojoVideoEncodeAccelerator{ + "MojoVideoEncodeAccelerator", base::FEATURE_ENABLED_BY_DEFAULT}; // ES6 Modules. const base::Feature kModuleScripts{"ModuleScripts",
diff --git a/content/public/common/resource_type.typemap b/content/public/common/resource_type.typemap index 5a890062..799c9fc 100644 --- a/content/public/common/resource_type.typemap +++ b/content/public/common/resource_type.typemap
@@ -4,9 +4,9 @@ mojom = "//content/public/common/resource_type.mojom" public_headers = [ "//content/public/common/resource_type.h" ] -traits_headers = [ "//content/public/common/resource_type_enum_traits.h" ] +traits_headers = [ "//content/public/common/resource_type_struct_traits.h" ] sources = [ - "//content/public/common/resource_type_enum_traits.cc", + "//content/public/common/resource_type_struct_traits.cc", ] deps = [ "//content:export",
diff --git a/content/public/common/resource_type_enum_traits.cc b/content/public/common/resource_type_struct_traits.cc similarity index 98% rename from content/public/common/resource_type_enum_traits.cc rename to content/public/common/resource_type_struct_traits.cc index cb3fc2cc..5bc012f 100644 --- a/content/public/common/resource_type_enum_traits.cc +++ b/content/public/common/resource_type_struct_traits.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 "content/public/common/resource_type_enum_traits.h" +#include "content/public/common/resource_type_struct_traits.h" namespace mojo {
diff --git a/content/public/common/resource_type_enum_traits.h b/content/public/common/resource_type_struct_traits.h similarity index 97% rename from content/public/common/resource_type_enum_traits.h rename to content/public/common/resource_type_struct_traits.h index e458c65..89dfef3 100644 --- a/content/public/common/resource_type_enum_traits.h +++ b/content/public/common/resource_type_struct_traits.h
@@ -17,6 +17,6 @@ static bool FromMojom(content::mojom::ResourceType input, content::ResourceType* output); }; -} +} // namespace mojo #endif // CONTENT_PUBLIC_COMMON_RESOURCE_TYPE_ENUM_TRAITS_H_
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index dadd8fc9..d76493bc 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -722,7 +722,8 @@ void SimulateMouseWheelEvent(WebContents* web_contents, const gfx::Point& point, - const gfx::Vector2d& delta) { + const gfx::Vector2d& delta, + const blink::WebMouseWheelEvent::Phase phase) { blink::WebMouseWheelEvent wheel_event( blink::WebInputEvent::kMouseWheel, blink::WebInputEvent::kNoModifiers, ui::EventTimeStampToSeconds(ui::EventTimeForNow())); @@ -730,6 +731,7 @@ wheel_event.SetPositionInWidget(point.x(), point.y()); wheel_event.delta_x = delta.x(); wheel_event.delta_y = delta.y(); + wheel_event.phase = phase; RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( web_contents->GetRenderViewHost()->GetWidget()); widget_host->ForwardWheelEvent(wheel_event);
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index d523861..68cf1a9 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h
@@ -31,6 +31,7 @@ #include "storage/common/fileapi/file_system_types.h" #include "third_party/WebKit/public/platform/WebInputEvent.h" #include "third_party/WebKit/public/platform/WebMouseEvent.h" +#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_tree_update.h" #include "ui/events/keycodes/dom/dom_code.h" @@ -143,7 +144,8 @@ // Simulate a mouse wheel event. void SimulateMouseWheelEvent(WebContents* web_contents, const gfx::Point& point, - const gfx::Vector2d& delta); + const gfx::Vector2d& delta, + const blink::WebMouseWheelEvent::Phase phase); // Sends a simple, three-event (Begin/Update/End) gesture scroll. void SimulateGestureScrollSequence(WebContents* web_contents,
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc index b53793d..7eb04af 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -704,11 +704,19 @@ dst->role == ui::AX_ROLE_SLIDER || dst->role == ui::AX_ROLE_SPIN_BUTTON || (dst->role == ui::AX_ROLE_SPLITTER && src.CanSetFocusAttribute())) { - dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, src.ValueForRange()); - dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, - src.MaxValueForRange()); - dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, - src.MinValueForRange()); + float value; + if (src.ValueForRange(&value)) + dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, value); + + float max_value; + if (src.MaxValueForRange(&max_value)) { + dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, max_value); + } + + float min_value; + if (src.MinValueForRange(&min_value)) { + dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, min_value); + } } if (dst->role == ui::AX_ROLE_DIALOG ||
diff --git a/content/renderer/input/frame_input_handler_impl.cc b/content/renderer/input/frame_input_handler_impl.cc index 645c45c..53d5a43 100644 --- a/content/renderer/input/frame_input_handler_impl.cc +++ b/content/renderer/input/frame_input_handler_impl.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/debug/stack_trace.h" #include "base/logging.h" +#include "content/common/input/ime_text_span_conversions.h" #include "content/renderer/gpu/render_widget_compositor.h" #include "content/renderer/ime_event_guard.h" #include "content/renderer/input/widget_input_handler_manager.h" @@ -20,23 +21,6 @@ namespace content { -namespace { - -blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType( - ui::ImeTextSpan::Type type) { - switch (type) { - case ui::ImeTextSpan::Type::kComposition: - return blink::WebImeTextSpan::Type::kComposition; - case ui::ImeTextSpan::Type::kSuggestion: - return blink::WebImeTextSpan::Type::kSuggestion; - } - - NOTREACHED(); - return blink::WebImeTextSpan::Type::kComposition; -} - -} // namespace - FrameInputHandlerImpl::FrameInputHandlerImpl( base::WeakPtr<RenderFrameImpl> render_frame, mojom::FrameInputHandlerRequest request) @@ -99,7 +83,7 @@ std::vector<blink::WebImeTextSpan> ime_text_spans; for (const auto& ime_text_span : ui_ime_text_spans) { blink::WebImeTextSpan blink_ime_text_span( - ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), + ConvertUiImeTextSpanTypeToWebType(ime_text_span.type), ime_text_span.start_offset, ime_text_span.end_offset, ime_text_span.underline_color, ime_text_span.thick, ime_text_span.background_color,
diff --git a/content/renderer/input/widget_input_handler_impl.cc b/content/renderer/input/widget_input_handler_impl.cc index 916799e2..c32c751 100644 --- a/content/renderer/input/widget_input_handler_impl.cc +++ b/content/renderer/input/widget_input_handler_impl.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "content/common/input/ime_text_span_conversions.h" #include "content/common/input_messages.h" #include "content/renderer/gpu/render_widget_compositor.h" #include "content/renderer/ime_event_guard.h" @@ -24,25 +25,12 @@ namespace { -blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType( - ui::ImeTextSpan::Type type) { - switch (type) { - case ui::ImeTextSpan::Type::kComposition: - return blink::WebImeTextSpan::Type::kComposition; - case ui::ImeTextSpan::Type::kSuggestion: - return blink::WebImeTextSpan::Type::kSuggestion; - } - - NOTREACHED(); - return blink::WebImeTextSpan::Type::kComposition; -} - std::vector<blink::WebImeTextSpan> ConvertUIImeTextSpansToBlinkImeTextSpans( const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) { std::vector<blink::WebImeTextSpan> ime_text_spans; for (const auto& ime_text_span : ui_ime_text_spans) { blink::WebImeTextSpan blink_ime_text_span( - ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), + ConvertUiImeTextSpanTypeToWebType(ime_text_span.type), ime_text_span.start_offset, ime_text_span.end_offset, ime_text_span.underline_color, ime_text_span.thick, ime_text_span.background_color,
diff --git a/content/renderer/media/media_stream_audio_processor.h b/content/renderer/media/media_stream_audio_processor.h index d8fb6c0..71b8254 100644 --- a/content/renderer/media/media_stream_audio_processor.h +++ b/content/renderer/media/media_stream_audio_processor.h
@@ -26,7 +26,7 @@ #include "media/base/audio_converter.h" #include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" -#include "third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h" +#include "third_party/webrtc/rtc_base/task_queue.h" // The audio repetition detector is by default only used on non-official // ChromeOS builds for debugging purposes. http://crbug.com/658719.
diff --git a/content/renderer/media/media_stream_audio_processor_options.h b/content/renderer/media/media_stream_audio_processor_options.h index 94adc96..9972921 100644 --- a/content/renderer/media/media_stream_audio_processor_options.h +++ b/content/renderer/media/media_stream_audio_processor_options.h
@@ -18,7 +18,7 @@ #include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/media/base/mediachannel.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" -#include "third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h" +#include "third_party/webrtc/rtc_base/task_queue.h" namespace webrtc {
diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc index 983bdc4..7306f1d 100644 --- a/content/renderer/mus/renderer_window_tree_client.cc +++ b/content/renderer/mus/renderer_window_tree_client.cc
@@ -209,6 +209,7 @@ uint32_t event_id, ui::Id window_id, int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, std::unique_ptr<ui::Event> event, bool matches_pointer_watcher) { NOTREACHED();
diff --git a/content/renderer/mus/renderer_window_tree_client.h b/content/renderer/mus/renderer_window_tree_client.h index 0734088..43bf54b 100644 --- a/content/renderer/mus/renderer_window_tree_client.h +++ b/content/renderer/mus/renderer_window_tree_client.h
@@ -119,11 +119,13 @@ ui::Id window_id, const std::string& name, const base::Optional<std::vector<uint8_t>>& new_data) override; - void OnWindowInputEvent(uint32_t event_id, - ui::Id window_id, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) override; + void OnWindowInputEvent( + uint32_t event_id, + ui::Id window_id, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) override; void OnPointerEventObserved(std::unique_ptr<ui::Event> event, uint32_t window_id, int64_t display_id) override;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 9378f31..99a7af7 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -195,8 +195,6 @@ #if defined(OS_MACOSX) #include "base/mac/mac_util.h" -#include "base/process/process.h" -#include "content/common/mac/app_nap_activity.h" #include "content/renderer/theme_helper_mac.h" #include "content/renderer/webscrollbarbehavior_impl_mac.h" #endif @@ -810,12 +808,6 @@ is_gpu_memory_buffer_compositor_resources_enabled_ = command_line.HasSwitch( switches::kEnableGpuMemoryBufferCompositorResources); -#if defined(OS_MACOSX) - if (base::Process::IsAppNapEnabled()) { - AppNapActivity::InitializeAppNapSupport(); - } -#endif - // On macOS this value is adjusted in `UpdateScrollbarTheme()`, // but the system default is true. #if defined(OS_MACOSX)
diff --git a/content/shell/test_runner/web_ax_object_proxy.cc b/content/shell/test_runner/web_ax_object_proxy.cc index 92da2d0..5651fb7 100644 --- a/content/shell/test_runner/web_ax_object_proxy.cc +++ b/content/shell/test_runner/web_ax_object_proxy.cc
@@ -796,22 +796,30 @@ int WebAXObjectProxy::IntValue() { accessibility_object_.UpdateLayoutAndCheckValidity(); - if (accessibility_object_.SupportsRangeValue()) - return accessibility_object_.ValueForRange(); - else if (accessibility_object_.Role() == blink::kWebAXRoleHeading) + + if (accessibility_object_.SupportsRangeValue()) { + float value = 0.0f; + accessibility_object_.ValueForRange(&value); + return static_cast<int>(value); + } else if (accessibility_object_.Role() == blink::kWebAXRoleHeading) { return accessibility_object_.HeadingLevel(); - else + } else { return atoi(accessibility_object_.StringValue().Utf8().data()); + } } int WebAXObjectProxy::MinValue() { accessibility_object_.UpdateLayoutAndCheckValidity(); - return accessibility_object_.MinValueForRange(); + float min_value = 0.0f; + accessibility_object_.MinValueForRange(&min_value); + return min_value; } int WebAXObjectProxy::MaxValue() { accessibility_object_.UpdateLayoutAndCheckValidity(); - return accessibility_object_.MaxValueForRange(); + float max_value = 0.0f; + accessibility_object_.MaxValueForRange(&max_value); + return max_value; } std::string WebAXObjectProxy::ValueDescription() {
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 2f661c7..555466c 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1443,7 +1443,6 @@ "../common/input/input_param_traits_unittest.cc", "../common/input/touch_event_stream_validator_unittest.cc", "../common/inter_process_time_ticks_converter_unittest.cc", - "../common/mac/app_nap_activity_unittest.mm", "../common/mac/attributed_string_coder_unittest.mm", "../common/mac/font_descriptor_unittest.mm", "../common/manifest_util_unittest.cc",
diff --git a/content/test/data/accessibility/aria/aria-current-expected-blink.txt b/content/test/data/accessibility/aria/aria-current-expected-blink.txt index c3d25b1..8a8e474 100644 --- a/content/test/data/accessibility/aria/aria-current-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-current-expected-blink.txt
@@ -2,9 +2,13 @@ ++link name='Section one' ++++staticText name='Section one' ++++++inlineTextBox name='Section one' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Section two' ++++staticText name='Section two' ++++++inlineTextBox name='Section two' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Section three' ariaCurrentState=location ++++staticText name='Section three' ++++++inlineTextBox name='Section three' @@ -31,4 +35,4 @@ ++++staticText name=' ' ++++++inlineTextBox name=' ' ++++staticText name='Span 3' -++++++inlineTextBox name='Span 3' +++++++inlineTextBox name='Span 3' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-current-expected-win.txt b/content/test/data/accessibility/aria/aria-current-expected-win.txt index e795993..710cfc0 100644 --- a/content/test/data/accessibility/aria/aria-current-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-current-expected-win.txt
@@ -1,8 +1,10 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ++ROLE_SYSTEM_LINK name='Section one' FOCUSABLE ++++ROLE_SYSTEM_STATICTEXT name='Section one' +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Section two' FOCUSABLE ++++ROLE_SYSTEM_STATICTEXT name='Section two' +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Section three' FOCUSABLE current:location ++++ROLE_SYSTEM_STATICTEXT name='Section three' ++ROLE_SYSTEM_WHITESPACE name='<newline>' @@ -19,4 +21,4 @@ ++++IA2_ROLE_SECTION current:true ++++++ROLE_SYSTEM_STATICTEXT name='Span 2' ++++ROLE_SYSTEM_STATICTEXT name=' ' -++++ROLE_SYSTEM_STATICTEXT name='Span 3' +++++ROLE_SYSTEM_STATICTEXT name='Span 3' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-orientation-expected-blink.txt b/content/test/data/accessibility/aria/aria-orientation-expected-blink.txt index af0402f9..7596c05 100644 --- a/content/test/data/accessibility/aria/aria-orientation-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-orientation-expected-blink.txt
@@ -14,12 +14,12 @@ ++radioGroup ++radioGroup horizontal ++radioGroup vertical -++scrollBar vertical valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 -++scrollBar horizontal valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 -++scrollBar vertical valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 -++slider horizontal valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 -++slider horizontal valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 -++slider vertical valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 +++scrollBar vertical +++scrollBar horizontal +++scrollBar vertical +++slider horizontal +++slider horizontal +++slider vertical ++splitter horizontal ++splitter horizontal ++splitter vertical
diff --git a/content/test/data/accessibility/aria/aria-orientation-expected-mac.txt b/content/test/data/accessibility/aria/aria-orientation-expected-mac.txt index 94bf407..5aedaa2d 100644 --- a/content/test/data/accessibility/aria/aria-orientation-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-orientation-expected-mac.txt
@@ -14,12 +14,12 @@ ++AXRadioGroup ++AXRadioGroup AXOrientation='AXHorizontalOrientation' ++AXRadioGroup AXOrientation='AXVerticalOrientation' -++AXScrollBar AXValue='0' AXOrientation='AXVerticalOrientation' -++AXScrollBar AXValue='0' AXOrientation='AXHorizontalOrientation' -++AXScrollBar AXValue='0' AXOrientation='AXVerticalOrientation' -++AXSlider AXValue='0' AXOrientation='AXHorizontalOrientation' -++AXSlider AXValue='0' AXOrientation='AXHorizontalOrientation' -++AXSlider AXValue='0' AXOrientation='AXVerticalOrientation' +++AXScrollBar AXOrientation='AXVerticalOrientation' +++AXScrollBar AXOrientation='AXHorizontalOrientation' +++AXScrollBar AXOrientation='AXVerticalOrientation' +++AXSlider AXOrientation='AXHorizontalOrientation' +++AXSlider AXOrientation='AXHorizontalOrientation' +++AXSlider AXOrientation='AXVerticalOrientation' ++AXSplitter AXOrientation='AXHorizontalOrientation' ++AXSplitter AXOrientation='AXHorizontalOrientation' ++AXSplitter AXOrientation='AXVerticalOrientation' @@ -37,4 +37,4 @@ ++AXTable AXOrientation='AXHorizontalOrientation' ++++AXGroup ++AXTable AXOrientation='AXVerticalOrientation' -++++AXGroup +++++AXGroup \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-progressbar-expected-blink.txt b/content/test/data/accessibility/aria/aria-progressbar-expected-blink.txt index 12cd448..acd7ae1 100644 --- a/content/test/data/accessibility/aria/aria-progressbar-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-progressbar-expected-blink.txt
@@ -1,3 +1,3 @@ rootWebArea ++progressIndicator valueForRange=3.00 minValueForRange=1.00 maxValueForRange=37.00 -++progressIndicator value='three' valueForRange=0.00 minValueForRange=1.00 maxValueForRange=96.00 \ No newline at end of file +++progressIndicator value='three' minValueForRange=1.00 maxValueForRange=96.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-progressbar-expected-mac.txt b/content/test/data/accessibility/aria/aria-progressbar-expected-mac.txt index af639597..7f990824 100644 --- a/content/test/data/accessibility/aria/aria-progressbar-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-progressbar-expected-mac.txt
@@ -1,3 +1,3 @@ AXWebArea AXRoleDescription='HTML content' ++AXProgressIndicator AXRoleDescription='progress indicator' AXValue='3' AXMinValue='1' AXMaxValue='37' -++AXProgressIndicator AXRoleDescription='progress indicator' AXValue='0' AXMinValue='1' AXMaxValue='96' AXValueDescription='three' +++AXProgressIndicator AXRoleDescription='progress indicator' AXValue='three' AXMinValue='1' AXMaxValue='96' AXValueDescription='three' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-progressbar-expected-win.txt b/content/test/data/accessibility/aria/aria-progressbar-expected-win.txt index 3285084..ba428388 100644 --- a/content/test/data/accessibility/aria/aria-progressbar-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-progressbar-expected-win.txt
@@ -1,3 +1,3 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ++ROLE_SYSTEM_PROGRESSBAR value='3' READONLY xml-roles:progressbar valuetext:3 currentValue=3.00 minimumValue=1.00 maximumValue=37.00 -++ROLE_SYSTEM_PROGRESSBAR value='three' READONLY xml-roles:progressbar valuetext:three currentValue=0.00 minimumValue=1.00 maximumValue=96.00 +++ROLE_SYSTEM_PROGRESSBAR value='three' READONLY xml-roles:progressbar valuetext:three minimumValue=1.00 maximumValue=96.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-readonly-expected-mac.txt b/content/test/data/accessibility/aria/aria-readonly-expected-mac.txt index 4935239..501c9b7f 100644 --- a/content/test/data/accessibility/aria/aria-readonly-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-readonly-expected-mac.txt
@@ -15,8 +15,8 @@ ++AXComboBox AXDescription='Readonly combobox' ++AXList AXDescription='Readonly listbox' ++AXRadioGroup AXDescription='Readonly radiogroup' -++AXSlider AXValue='0' AXDescription='Readonly slider' -++AXIncrementor AXValue='0' AXDescription='Readonly spinbutton' +++AXSlider AXDescription='Readonly slider' +++AXIncrementor AXDescription='Readonly spinbutton' ++AXMenuItem AXValue='0' AXDescription='Readonly menuitemcheckbox' ++AXMenuItem AXValue='0' AXDescription='Readonly menuitemradio' ++AXTextField AXDescription='Readonly searchbox'
diff --git a/content/test/data/accessibility/aria/aria-scrollbar-expected-blink.txt b/content/test/data/accessibility/aria/aria-scrollbar-expected-blink.txt index 674742a..f30ca591 100644 --- a/content/test/data/accessibility/aria/aria-scrollbar-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-scrollbar-expected-blink.txt
@@ -1,3 +1,3 @@ rootWebArea -++scrollBar vertical valueForRange=55.00 minValueForRange=0.00 maxValueForRange=0.00 -++scrollBar horizontal valueForRange=55.00 minValueForRange=0.00 maxValueForRange=0.00 \ No newline at end of file +++scrollBar vertical valueForRange=55.00 +++scrollBar horizontal valueForRange=55.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-valuenow-expected-blink.txt b/content/test/data/accessibility/aria/aria-valuenow-expected-blink.txt index f234f02..8c9f1d4 100644 --- a/content/test/data/accessibility/aria/aria-valuenow-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-valuenow-expected-blink.txt
@@ -1,2 +1,2 @@ rootWebArea -++progressIndicator valueForRange=3.00 minValueForRange=0.00 maxValueForRange=0.00 \ No newline at end of file +++progressIndicator valueForRange=3.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-valuetext-expected-blink.txt b/content/test/data/accessibility/aria/aria-valuetext-expected-blink.txt index 74a3b40..3283349 100644 --- a/content/test/data/accessibility/aria/aria-valuetext-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-valuetext-expected-blink.txt
@@ -1,2 +1,2 @@ rootWebArea -++progressIndicator valueForRange=0.00 minValueForRange=1.00 maxValueForRange=96.00 \ No newline at end of file +++progressIndicator minValueForRange=1.00 maxValueForRange=96.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-valuetext-expected-mac.txt b/content/test/data/accessibility/aria/aria-valuetext-expected-mac.txt index 0b422ae..856fd3d 100644 --- a/content/test/data/accessibility/aria/aria-valuetext-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-valuetext-expected-mac.txt
@@ -1,2 +1,2 @@ AXWebArea AXRoleDescription='HTML content' -++AXProgressIndicator AXRoleDescription='progress indicator' AXValue='0' AXMinValue='1' AXMaxValue='96' AXValueDescription='three' +++AXProgressIndicator AXRoleDescription='progress indicator' AXValue='three' AXMinValue='1' AXMaxValue='96' AXValueDescription='three' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-valuetext-expected-win.txt b/content/test/data/accessibility/aria/aria-valuetext-expected-win.txt index cf62a3b5..ac00f51 100644 --- a/content/test/data/accessibility/aria/aria-valuetext-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-valuetext-expected-win.txt
@@ -1,2 +1,2 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++ROLE_SYSTEM_PROGRESSBAR READONLY xml-roles:progressbar valuetext:three currentValue=0.00 minimumValue=1.00 maximumValue=96.00 +++ROLE_SYSTEM_PROGRESSBAR READONLY xml-roles:progressbar valuetext:three minimumValue=1.00 maximumValue=96.00 \ No newline at end of file
diff --git a/content/test/data/accessibility/event/aria-disabled-changed-expected-mac.txt b/content/test/data/accessibility/event/aria-disabled-changed-expected-mac.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/test/data/accessibility/event/aria-disabled-changed-expected-mac.txt
diff --git a/content/test/data/accessibility/event/aria-disabled-changed-expected-win.txt b/content/test/data/accessibility/event/aria-disabled-changed-expected-win.txt new file mode 100644 index 0000000..88f48223 --- /dev/null +++ b/content/test/data/accessibility/event/aria-disabled-changed-expected-win.txt
@@ -0,0 +1,3 @@ +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_CHECKBUTTON UNAVAILABLE IA2_STATE_CHECKABLE +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_RADIOBUTTON IA2_STATE_CHECKABLE +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_GROUPING \ No newline at end of file
diff --git a/content/test/data/accessibility/event/aria-disabled-changed.html b/content/test/data/accessibility/event/aria-disabled-changed.html new file mode 100644 index 0000000..6c2e443 --- /dev/null +++ b/content/test/data/accessibility/event/aria-disabled-changed.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<!-- +@MAC-ALLOW:AXEnabled* +@WIN-ALLOW:UNAVAILABLE +--> +<form> + <div role="checkbox"></div> + <fieldset aria-disabled="true"> + <div role="radio" aria-disabled="true"></div> + </fieldset> +</form> +<script> + function go() { + document.querySelector('div[role=checkbox]').setAttribute('aria-disabled', true); + document.querySelector('div[role=radio]').setAttribute('aria-disabled', false); + document.querySelector('fieldset').setAttribute('aria-disabled', false); + } +</script>
diff --git a/content/test/data/accessibility/event/aria-required-changed-expected-mac.txt b/content/test/data/accessibility/event/aria-required-changed-expected-mac.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/test/data/accessibility/event/aria-required-changed-expected-mac.txt
diff --git a/content/test/data/accessibility/event/aria-required-changed-expected-win.txt b/content/test/data/accessibility/event/aria-required-changed-expected-win.txt new file mode 100644 index 0000000..444de8e4 --- /dev/null +++ b/content/test/data/accessibility/event/aria-required-changed-expected-win.txt
@@ -0,0 +1,2 @@ +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_CHECKBUTTON IA2_STATE_CHECKABLE,IA2_STATE_REQUIRED +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_RADIOBUTTON IA2_STATE_CHECKABLE \ No newline at end of file
diff --git a/content/test/data/accessibility/event/aria-required-changed.html b/content/test/data/accessibility/event/aria-required-changed.html new file mode 100644 index 0000000..7a890df --- /dev/null +++ b/content/test/data/accessibility/event/aria-required-changed.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<!-- +@MAC-ALLOW:AXRequired* +@WIN-ALLOW:IA2_STATE_REQUIRED +--> +<form> + <div role="checkbox"></div> + <div role="radio" aria-required="true"></div> +</form> +<script> + function go() { + document.querySelector('div[role=checkbox]').setAttribute('aria-required', true); + document.querySelector('div[role=radio]').setAttribute('aria-required', false); + } +</script>
diff --git a/content/test/data/accessibility/event/form-disabled-changed-expected-mac.txt b/content/test/data/accessibility/event/form-disabled-changed-expected-mac.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/test/data/accessibility/event/form-disabled-changed-expected-mac.txt
diff --git a/content/test/data/accessibility/event/form-disabled-changed-expected-win.txt b/content/test/data/accessibility/event/form-disabled-changed-expected-win.txt new file mode 100644 index 0000000..b928ce0 --- /dev/null +++ b/content/test/data/accessibility/event/form-disabled-changed-expected-win.txt
@@ -0,0 +1,3 @@ +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_CHECKBUTTON UNAVAILABLE IA2_STATE_CHECKABLE +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_GROUPING \ No newline at end of file
diff --git a/content/test/data/accessibility/event/form-disabled-changed.html b/content/test/data/accessibility/event/form-disabled-changed.html new file mode 100644 index 0000000..ffdbed8 --- /dev/null +++ b/content/test/data/accessibility/event/form-disabled-changed.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<!-- +@MAC-ALLOW:AXEnabled* +@WIN-ALLOW:UNAVAILABLE +--> +<form> + <input type="checkbox"> + <fieldset disabled> + <input type="radio" disabled> + </fieldset> +</form> +<script> + function go() { + document.querySelector('input[type=checkbox]').disabled = true; + document.querySelector('input[type=radio]').disabled = false; + document.querySelector('fieldset').disabled = false; + } +</script>
diff --git a/content/test/data/accessibility/event/form-required-changed-expected-mac.txt b/content/test/data/accessibility/event/form-required-changed-expected-mac.txt new file mode 100644 index 0000000..9311208 --- /dev/null +++ b/content/test/data/accessibility/event/form-required-changed-expected-mac.txt
@@ -0,0 +1 @@ +AXInvalidStatusChanged on AXCheckBox \ No newline at end of file
diff --git a/content/test/data/accessibility/event/form-required-changed-expected-win.txt b/content/test/data/accessibility/event/form-required-changed-expected-win.txt new file mode 100644 index 0000000..4676dfc --- /dev/null +++ b/content/test/data/accessibility/event/form-required-changed-expected-win.txt
@@ -0,0 +1,2 @@ +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE,IA2_STATE_INVALID_ENTRY,IA2_STATE_REQUIRED +EVENT_OBJECT_STATECHANGE on role=ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE \ No newline at end of file
diff --git a/content/test/data/accessibility/event/form-required-changed.html b/content/test/data/accessibility/event/form-required-changed.html new file mode 100644 index 0000000..3b9b322 --- /dev/null +++ b/content/test/data/accessibility/event/form-required-changed.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<!-- +@MAC-ALLOW:AXRequired* +@WIN-ALLOW:IA2_STATE_REQUIRED +--> +<form> + <input type="checkbox"> + <input type="radio" required> +</form> +<script> + function go() { + document.querySelector('input[type=checkbox]').required = true; + document.querySelector('input[type=radio]').required = false; + } +</script>
diff --git a/content/test/data/accessibility/html/a-name-calc-expected-android.txt b/content/test/data/accessibility/html/a-name-calc-expected-android.txt index 6667beb..9358676 100644 --- a/content/test/data/accessibility/html/a-name-calc-expected-android.txt +++ b/content/test/data/accessibility/html/a-name-calc-expected-android.txt
@@ -1,7 +1,10 @@ android.webkit.WebView focusable focused scrollable ++android.view.View role_description='link' clickable focusable link name='InnerText0' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='InnerText1' hint='Title1' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Title2' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='LabelledBy3' ++android.view.View role_description='link' clickable focusable link name='Title4' ++android.view.View role_description='link' clickable focusable link name='Label5'
diff --git a/content/test/data/accessibility/html/a-name-calc-expected-blink.txt b/content/test/data/accessibility/html/a-name-calc-expected-blink.txt index a388995..57e73a22 100644 --- a/content/test/data/accessibility/html/a-name-calc-expected-blink.txt +++ b/content/test/data/accessibility/html/a-name-calc-expected-blink.txt
@@ -2,12 +2,18 @@ ++link name='InnerText0' nameFrom=contents ++++staticText name='InnerText0' nameFrom=contents ++++++inlineTextBox name='InnerText0' nameFrom=contents +++staticText name=' ' nameFrom=contents +++++inlineTextBox name=' ' nameFrom=contents ++link description='Title1' name='InnerText1' nameFrom=contents descriptionFrom=attribute ++++staticText name='InnerText1' nameFrom=contents ++++++inlineTextBox name='InnerText1' nameFrom=contents +++staticText name=' ' nameFrom=contents +++++inlineTextBox name=' ' nameFrom=contents ++link name='Title2' nameFrom=attribute ++++staticText name='InnerText2' nameFrom=contents ++++++inlineTextBox name='InnerText2' nameFrom=contents +++staticText name=' ' nameFrom=contents +++++inlineTextBox name=' ' nameFrom=contents ++link name='LabelledBy3' nameFrom=relatedElement ++++staticText name='InnerText3' nameFrom=contents ++++++inlineTextBox name='InnerText3' nameFrom=contents
diff --git a/content/test/data/accessibility/html/a-no-text-expected-android.txt b/content/test/data/accessibility/html/a-no-text-expected-android.txt index e9962ac..225baf2e 100644 --- a/content/test/data/accessibility/html/a-no-text-expected-android.txt +++ b/content/test/data/accessibility/html/a-no-text-expected-android.txt
@@ -9,4 +9,5 @@ ++++android.view.View role_description='link' clickable focusable link name=' ' ++++android.view.View role_description='link' clickable focusable link name=' ' ++++android.view.View role_description='link' clickable focusable link name='greenbox' -++++android.view.View role_description='link' clickable focusable link name='greenbox' +++++android.view.View name=' ' +++++android.view.View role_description='link' clickable focusable link name='greenbox' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/a-no-text-expected-blink.txt b/content/test/data/accessibility/html/a-no-text-expected-blink.txt index 41fde89..3fa3bff 100644 --- a/content/test/data/accessibility/html/a-no-text-expected-blink.txt +++ b/content/test/data/accessibility/html/a-no-text-expected-blink.txt
@@ -18,5 +18,7 @@ ++++++image ++++link ++++++image +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link -++++++image +++++++image \ No newline at end of file
diff --git a/content/test/data/accessibility/html/a-with-img-expected-android.txt b/content/test/data/accessibility/html/a-with-img-expected-android.txt index 6cfea459..550f153 100644 --- a/content/test/data/accessibility/html/a-with-img-expected-android.txt +++ b/content/test/data/accessibility/html/a-with-img-expected-android.txt
@@ -1,6 +1,9 @@ android.webkit.WebView focusable focused scrollable ++android.view.View ++++android.view.View role_description='link' clickable focusable link name='Link with image at start.' +++++android.view.View name=' ' ++++android.view.View role_description='link' clickable focusable link name='Link with image in the middle.' +++++android.view.View name=' ' ++++android.view.View role_description='link' clickable focusable link name='Link with broken in the middle.' +++++android.view.View name=' ' ++++android.view.View role_description='link' clickable focusable link name='Link with image at the end' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/a-with-img-expected-blink.txt b/content/test/data/accessibility/html/a-with-img-expected-blink.txt index 6b67b04..2c1a6b15 100644 --- a/content/test/data/accessibility/html/a-with-img-expected-blink.txt +++ b/content/test/data/accessibility/html/a-with-img-expected-blink.txt
@@ -4,18 +4,24 @@ ++++++image linked name='Link' ++++++staticText linked name=' with image at start.' ++++++++inlineTextBox name=' with image at start.' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link linked name='Link with image in the middle.' ++++++staticText linked name='Link with ' ++++++++inlineTextBox name='Link with ' ++++++image linked name='image' ++++++staticText linked name=' in the middle.' ++++++++inlineTextBox name=' in the middle.' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link linked name='Link with broken in the middle.' ++++++staticText linked name='Link with ' ++++++++inlineTextBox name='Link with ' ++++++image linked name='broken' ++++++staticText linked name=' in the middle.' ++++++++inlineTextBox name=' in the middle.' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link linked name='Link with image at the end' ++++++staticText linked name='Link with image at the ' ++++++++inlineTextBox name='Link with image at the '
diff --git a/content/test/data/accessibility/html/a-with-img-expected-mac.txt b/content/test/data/accessibility/html/a-with-img-expected-mac.txt index 3e289222..ff34dda 100644 --- a/content/test/data/accessibility/html/a-with-img-expected-mac.txt +++ b/content/test/data/accessibility/html/a-with-img-expected-mac.txt
@@ -3,14 +3,17 @@ ++++AXLink AXTitle='Link with image at start.' ++++++AXImage AXDescription='Link' ++++++AXStaticText AXValue=' with image at start.' +++++AXStaticText AXValue=' ' ++++AXLink AXTitle='Link with image in the middle.' ++++++AXStaticText AXValue='Link with ' ++++++AXImage AXDescription='image' ++++++AXStaticText AXValue=' in the middle.' +++++AXStaticText AXValue=' ' ++++AXLink AXTitle='Link with broken in the middle.' ++++++AXStaticText AXValue='Link with ' ++++++AXImage AXDescription='broken' ++++++AXStaticText AXValue=' in the middle.' +++++AXStaticText AXValue=' ' ++++AXLink AXTitle='Link with image at the end' ++++++AXStaticText AXValue='Link with image at the ' -++++++AXImage AXDescription='end' +++++++AXImage AXDescription='end' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/a-with-img-expected-win.txt b/content/test/data/accessibility/html/a-with-img-expected-win.txt index 3cd7878..7bdf632 100644 --- a/content/test/data/accessibility/html/a-with-img-expected-win.txt +++ b/content/test/data/accessibility/html/a-with-img-expected-win.txt
@@ -3,14 +3,17 @@ ++++ROLE_SYSTEM_LINK name='Link with image at start.' FOCUSABLE ++++++ROLE_SYSTEM_GRAPHIC name='Link' READONLY ++++++ROLE_SYSTEM_STATICTEXT name=' with image at start.' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='Link with image in the middle.' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='Link with ' ++++++ROLE_SYSTEM_GRAPHIC name='image' READONLY ++++++ROLE_SYSTEM_STATICTEXT name=' in the middle.' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='Link with broken in the middle.' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='Link with ' ++++++ROLE_SYSTEM_GRAPHIC name='broken' READONLY ++++++ROLE_SYSTEM_STATICTEXT name=' in the middle.' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='Link with image at the end' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='Link with image at the ' -++++++ROLE_SYSTEM_GRAPHIC name='end' READONLY +++++++ROLE_SYSTEM_GRAPHIC name='end' READONLY \ No newline at end of file
diff --git a/content/test/data/accessibility/html/in-page-links-expected-android.txt b/content/test/data/accessibility/html/in-page-links-expected-android.txt index adfa06a..2b0a3aa8 100644 --- a/content/test/data/accessibility/html/in-page-links-expected-android.txt +++ b/content/test/data/accessibility/html/in-page-links-expected-android.txt
@@ -1,9 +1,14 @@ android.webkit.WebView focusable focused scrollable ++android.view.View role_description='link' clickable focusable link name='Empty anchor' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Anchor with content' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Anchor with ID' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Empty span' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Span with content' +++android.view.View name=' ' ++android.view.View role_description='link' clickable focusable link name='Paragraph with content' ++android.view.View ++++android.view.View clickable @@ -17,4 +22,4 @@ ++++android.view.View name='After empty span' ++android.view.View ++++android.view.View name='Span with content' -++android.view.View name='Paragraph with content' +++android.view.View name='Paragraph with content' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/in-page-links-expected-blink.txt b/content/test/data/accessibility/html/in-page-links-expected-blink.txt index afe05d68..1f71bc3 100644 --- a/content/test/data/accessibility/html/in-page-links-expected-blink.txt +++ b/content/test/data/accessibility/html/in-page-links-expected-blink.txt
@@ -2,18 +2,28 @@ ++link name='Empty anchor' inPageLinkTargetId=anchor ++++staticText name='Empty anchor' ++++++inlineTextBox name='Empty anchor' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Anchor with content' inPageLinkTargetId=anchor ++++staticText name='Anchor with content' ++++++inlineTextBox name='Anchor with content' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Anchor with ID' inPageLinkTargetId=anchor ++++staticText name='Anchor with ID' ++++++inlineTextBox name='Anchor with ID' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Empty span' inPageLinkTargetId=genericContainer ++++staticText name='Empty span' ++++++inlineTextBox name='Empty span' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Span with content' inPageLinkTargetId=genericContainer ++++staticText name='Span with content' ++++++inlineTextBox name='Span with content' +++staticText name=' ' +++++inlineTextBox name=' ' ++link name='Paragraph with content' inPageLinkTargetId=paragraph ++++staticText name='Paragraph with content' ++++++inlineTextBox name='Paragraph with content' @@ -39,4 +49,4 @@ ++++++++inlineTextBox name='Span with content' ++paragraph ++++staticText name='Paragraph with content' -++++++inlineTextBox name='Paragraph with content' +++++++inlineTextBox name='Paragraph with content' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/in-page-links-expected-mac.txt b/content/test/data/accessibility/html/in-page-links-expected-mac.txt index 8099aa6..b4ebc23 100644 --- a/content/test/data/accessibility/html/in-page-links-expected-mac.txt +++ b/content/test/data/accessibility/html/in-page-links-expected-mac.txt
@@ -1,14 +1,19 @@ AXWebArea ++AXLink AXTitle='Empty anchor' AXLinkedUIElements=["AXGroup"] ++++AXStaticText AXValue='Empty anchor' +++AXStaticText AXValue=' ' ++AXLink AXTitle='Anchor with content' AXLinkedUIElements=["AXGroup Anchor with content"] ++++AXStaticText AXValue='Anchor with content' +++AXStaticText AXValue=' ' ++AXLink AXTitle='Anchor with ID' AXLinkedUIElements=["AXGroup Anchor with ID"] ++++AXStaticText AXValue='Anchor with ID' +++AXStaticText AXValue=' ' ++AXLink AXTitle='Empty span' AXLinkedUIElements=["AXGroup"] ++++AXStaticText AXValue='Empty span' +++AXStaticText AXValue=' ' ++AXLink AXTitle='Span with content' AXLinkedUIElements=["AXGroup"] ++++AXStaticText AXValue='Span with content' +++AXStaticText AXValue=' ' ++AXLink AXTitle='Paragraph with content' AXLinkedUIElements=["AXGroup"] ++++AXStaticText AXValue='Paragraph with content' ++AXGroup @@ -27,4 +32,4 @@ ++++AXGroup ++++++AXStaticText AXValue='Span with content' ++AXGroup -++++AXStaticText AXValue='Paragraph with content' +++++AXStaticText AXValue='Paragraph with content' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/in-page-links-expected-win.txt b/content/test/data/accessibility/html/in-page-links-expected-win.txt index 22faf556..e91e432b 100644 --- a/content/test/data/accessibility/html/in-page-links-expected-win.txt +++ b/content/test/data/accessibility/html/in-page-links-expected-win.txt
@@ -1,14 +1,19 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ++ROLE_SYSTEM_LINK name='Empty anchor' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Empty anchor' LINKED +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Anchor with content' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Anchor with content' LINKED +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Anchor with ID' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Anchor with ID' LINKED +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Empty span' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Empty span' LINKED +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Span with content' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Span with content' LINKED +++ROLE_SYSTEM_STATICTEXT name=' ' ++ROLE_SYSTEM_LINK name='Paragraph with content' FOCUSABLE LINKED ++++ROLE_SYSTEM_STATICTEXT name='Paragraph with content' LINKED ++IA2_ROLE_PARAGRAPH @@ -27,4 +32,4 @@ ++++IA2_ROLE_SECTION ++++++ROLE_SYSTEM_STATICTEXT name='Span with content' ++IA2_ROLE_PARAGRAPH -++++ROLE_SYSTEM_STATICTEXT name='Paragraph with content' +++++ROLE_SYSTEM_STATICTEXT name='Paragraph with content' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-month-expected-blink.txt b/content/test/data/accessibility/html/input-month-expected-blink.txt index 5608d93..6fecd5d 100644 --- a/content/test/data/accessibility/html/input-month-expected-blink.txt +++ b/content/test/data/accessibility/html/input-month-expected-blink.txt
@@ -3,15 +3,15 @@ ++++dateTime ++++++genericContainer ++++++++genericContainer -++++++++++spinButton description='Month' descriptionFrom=attribute valueForRange=0.00 minValueForRange=1.00 maxValueForRange=12.00 +++++++++++spinButton description='Month' descriptionFrom=attribute minValueForRange=1.00 maxValueForRange=12.00 ++++++++++++staticText name='---------' ++++++++++++++inlineTextBox name='---------' ++++++++++staticText name=' ' ++++++++++++inlineTextBox name=' ' -++++++++++spinButton description='Year' descriptionFrom=attribute valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00 +++++++++++spinButton description='Year' descriptionFrom=attribute minValueForRange=1.00 maxValueForRange=275760.00 ++++++++++++staticText name='----' ++++++++++++++inlineTextBox name='----' ++++++popUpButton haspopup -++++++spinButton valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 +++++++spinButton ++++++++button ++++++++button \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-month-expected-mac.txt b/content/test/data/accessibility/html/input-month-expected-mac.txt index 8944d3d5..acadfad 100644 --- a/content/test/data/accessibility/html/input-month-expected-mac.txt +++ b/content/test/data/accessibility/html/input-month-expected-mac.txt
@@ -3,12 +3,12 @@ ++++AXDateField AXRoleDescription='date field' ++++++AXGroup AXRoleDescription='group' ++++++++AXGroup AXRoleDescription='group' -++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXHelp='Month' +++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='---------' AXHelp='Month' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='---------' ++++++++++AXStaticText AXRoleDescription='text' AXValue=' ' -++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXHelp='Year' +++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='----' AXHelp='Year' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='----' ++++++AXPopUpButton AXRoleDescription='pop up button' -++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' +++++++AXIncrementor AXRoleDescription='stepper' ++++++++AXButton AXRoleDescription='button' ++++++++AXButton AXRoleDescription='button' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-time-expected-blink.txt b/content/test/data/accessibility/html/input-time-expected-blink.txt index 745a6d5..70b515e 100644 --- a/content/test/data/accessibility/html/input-time-expected-blink.txt +++ b/content/test/data/accessibility/html/input-time-expected-blink.txt
@@ -16,6 +16,6 @@ ++++++++++spinButton description='AM/PM' descriptionFrom=attribute valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00 ++++++++++++staticText name='AM' ++++++++++++++inlineTextBox name='AM' -++++++spinButton valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 +++++++spinButton ++++++++button ++++++++button \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-time-expected-mac.txt b/content/test/data/accessibility/html/input-time-expected-mac.txt index f0fdf18..65481be 100644 --- a/content/test/data/accessibility/html/input-time-expected-mac.txt +++ b/content/test/data/accessibility/html/input-time-expected-mac.txt
@@ -11,6 +11,6 @@ ++++++++++AXStaticText AXRoleDescription='text' AXValue=' ' ++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='1' AXHelp='AM/PM' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='AM' -++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' +++++++AXIncrementor AXRoleDescription='stepper' ++++++++AXButton AXRoleDescription='button' ++++++++AXButton AXRoleDescription='button' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-week-expected-blink.txt b/content/test/data/accessibility/html/input-week-expected-blink.txt index 19fd80f..3f6225ac4 100644 --- a/content/test/data/accessibility/html/input-week-expected-blink.txt +++ b/content/test/data/accessibility/html/input-week-expected-blink.txt
@@ -5,15 +5,15 @@ ++++++++genericContainer ++++++++++staticText name='Week ' ++++++++++++inlineTextBox name='Week ' -++++++++++spinButton description='Week' descriptionFrom=attribute valueForRange=0.00 minValueForRange=1.00 maxValueForRange=53.00 +++++++++++spinButton description='Week' descriptionFrom=attribute minValueForRange=1.00 maxValueForRange=53.00 ++++++++++++staticText name='--' ++++++++++++++inlineTextBox name='--' ++++++++++staticText name=', ' ++++++++++++inlineTextBox name=', ' -++++++++++spinButton description='Year' descriptionFrom=attribute valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00 +++++++++++spinButton description='Year' descriptionFrom=attribute minValueForRange=1.00 maxValueForRange=275760.00 ++++++++++++staticText name='----' ++++++++++++++inlineTextBox name='----' ++++++popUpButton haspopup -++++++spinButton valueForRange=0.00 minValueForRange=0.00 maxValueForRange=0.00 +++++++spinButton ++++++++button ++++++++button \ No newline at end of file
diff --git a/content/test/data/accessibility/html/input-week-expected-mac.txt b/content/test/data/accessibility/html/input-week-expected-mac.txt index 0f4fa88..b09b040 100644 --- a/content/test/data/accessibility/html/input-week-expected-mac.txt +++ b/content/test/data/accessibility/html/input-week-expected-mac.txt
@@ -4,12 +4,12 @@ ++++++AXGroup AXRoleDescription='group' ++++++++AXGroup AXRoleDescription='group' ++++++++++AXStaticText AXRoleDescription='text' AXValue='Week ' -++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXHelp='Week' +++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='--' AXHelp='Week' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='--' ++++++++++AXStaticText AXRoleDescription='text' AXValue=', ' -++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXHelp='Year' +++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='----' AXHelp='Year' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='----' ++++++AXPopUpButton AXRoleDescription='pop up button' -++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' +++++++AXIncrementor AXRoleDescription='stepper' ++++++++AXButton AXRoleDescription='button' ++++++++AXButton AXRoleDescription='button' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/span-expected-blink.txt b/content/test/data/accessibility/html/span-expected-blink.txt index acc26015..ab500c4 100644 --- a/content/test/data/accessibility/html/span-expected-blink.txt +++ b/content/test/data/accessibility/html/span-expected-blink.txt
@@ -21,18 +21,24 @@ ++paragraph ++++staticText name='E1. Eat' ++++++inlineTextBox name='E1. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link name='space' ++++++staticText name='space' ++++++++inlineTextBox name='space' ++paragraph ++++staticText name='E2. Eat' ++++++inlineTextBox name='E2. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link name='space' ++++++staticText name='space' ++++++++inlineTextBox name='space' ++paragraph ++++staticText name='E3. Eat' ++++++inlineTextBox name='E3. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++link name='space' ++++++staticText name='space' ++++++++inlineTextBox name='space' @@ -40,18 +46,24 @@ ++++link name='E4. Eat' ++++++staticText name='E4. Eat' ++++++++inlineTextBox name='E4. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++staticText name='space' ++++++inlineTextBox name='space' ++paragraph ++++link name='E5. Eat' ++++++staticText name='E5. Eat' ++++++++inlineTextBox name='E5. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++staticText name='space' ++++++inlineTextBox name='space' ++paragraph ++++link name='E6. Eat' ++++++staticText name='E6. Eat' ++++++++inlineTextBox name='E6. Eat' +++++staticText name=' ' +++++++inlineTextBox name=' ' ++++staticText name='space' ++++++inlineTextBox name='space' ++paragraph @@ -74,4 +86,4 @@ ++++staticText name=' ' ++++++inlineTextBox name=' ' ++++staticText name='space' -++++++inlineTextBox name='space' +++++++inlineTextBox name='space' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/span-expected-mac.txt b/content/test/data/accessibility/html/span-expected-mac.txt index ff17a366..18f567f8 100644 --- a/content/test/data/accessibility/html/span-expected-mac.txt +++ b/content/test/data/accessibility/html/span-expected-mac.txt
@@ -11,27 +11,33 @@ ++++AXStaticText AXValue='.' ++AXGroup ++++AXStaticText AXValue='E1. Eat' +++++AXStaticText AXValue=' ' ++++AXLink ++++++AXStaticText AXValue='space' ++AXGroup ++++AXStaticText AXValue='E2. Eat' +++++AXStaticText AXValue=' ' ++++AXLink ++++++AXStaticText AXValue='space' ++AXGroup ++++AXStaticText AXValue='E3. Eat' +++++AXStaticText AXValue=' ' ++++AXLink ++++++AXStaticText AXValue='space' ++AXGroup ++++AXLink ++++++AXStaticText AXValue='E4. Eat' +++++AXStaticText AXValue=' ' ++++AXStaticText AXValue='space' ++AXGroup ++++AXLink ++++++AXStaticText AXValue='E5. Eat' +++++AXStaticText AXValue=' ' ++++AXStaticText AXValue='space' ++AXGroup ++++AXLink ++++++AXStaticText AXValue='E6. Eat' +++++AXStaticText AXValue=' ' ++++AXStaticText AXValue='space' ++AXGroup ++++AXStaticText AXValue='K1. Keep'
diff --git a/content/test/data/accessibility/html/span-expected-win.txt b/content/test/data/accessibility/html/span-expected-win.txt index d10010f2..690cd13 100644 --- a/content/test/data/accessibility/html/span-expected-win.txt +++ b/content/test/data/accessibility/html/span-expected-win.txt
@@ -11,27 +11,33 @@ ++++ROLE_SYSTEM_STATICTEXT name='.' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_STATICTEXT name='E1. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='space' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_STATICTEXT name='E2. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='space' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_STATICTEXT name='E3. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_LINK name='space' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_LINK name='E4. Eat' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='E4. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_LINK name='E5. Eat' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='E5. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_LINK name='E6. Eat' FOCUSABLE ++++++ROLE_SYSTEM_STATICTEXT name='E6. Eat' +++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_STATICTEXT name='space' ++IA2_ROLE_PARAGRAPH ++++ROLE_SYSTEM_STATICTEXT name='K1. Keep'
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index 7e3119d..99ceccba 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -650,11 +650,6 @@ self.Fail('WebglExtension_WEBGL_compressed_texture_atc', ['android', ('nvidia', 'NVIDIA Tegra')]) - # Pixel C - self.Fail('conformance/glsl/bugs/constant-precision-qualifier.html', - ['android', 'android-chromium', - ('nvidia', 'NVIDIA Tegra')], bug=624621) - # Nexus 9 and Shield TV (NVIDIA GPUs currently on the waterfall) self.Fail('conformance/ogles/GL/array/array_001_to_006.html', ['android', 'nvidia'], bug=740769)
diff --git a/content/test/renderer_audio_output_stream_factory_context_impl_unittest.cc b/content/test/renderer_audio_output_stream_factory_context_impl_unittest.cc index 2052326..17a4f84 100644 --- a/content/test/renderer_audio_output_stream_factory_context_impl_unittest.cc +++ b/content/test/renderer_audio_output_stream_factory_context_impl_unittest.cc
@@ -58,7 +58,7 @@ std::unique_ptr<media::AudioOutputStream::AudioSourceCallback> GetTestAudioSource() { - return base::MakeUnique<media::SineWaveAudioSource>(kChannels, kWaveFrequency, + return std::make_unique<media::SineWaveAudioSource>(kChannels, kWaveFrequency, kSampleFrequency); } @@ -222,11 +222,12 @@ : media_stream_manager_(), thread_bundle_(TestBrowserThreadBundle::Options::REAL_IO_THREAD), log_factory_(), - audio_manager_( - new MockAudioManager(base::MakeUnique<media::AudioThreadImpl>(), - &log_factory_)), - audio_system_(media::AudioSystemImpl::Create(audio_manager_.get())) { - media_stream_manager_ = base::MakeUnique<MediaStreamManager>( + audio_manager_(std::make_unique<MockAudioManager>( + std::make_unique<media::AudioThreadImpl>(), + &log_factory_)), + audio_system_( + std::make_unique<media::AudioSystemImpl>(audio_manager_.get())) { + media_stream_manager_ = std::make_unique<MediaStreamManager>( audio_system_.get(), audio_manager_->GetTaskRunner()); } @@ -290,7 +291,7 @@ SyncWith(renderer_ipc_task_runner); auto renderer_side_ipc = - base::MakeUnique<MojoAudioOutputIPC>(base::BindRepeating( + std::make_unique<MojoAudioOutputIPC>(base::BindRepeating( [](mojom::RendererAudioOutputStreamFactory* factory_ptr) { return factory_ptr; },
diff --git a/content/test/test_navigation_url_loader_delegate.cc b/content/test/test_navigation_url_loader_delegate.cc index 7097a81..5b8a47f2 100644 --- a/content/test/test_navigation_url_loader_delegate.cc +++ b/content/test/test_navigation_url_loader_delegate.cc
@@ -69,6 +69,7 @@ response_ = response; body_ = std::move(body); handle_ = std::move(consumer_handle); + is_download_ = is_download; if (response_started_) response_started_->Quit(); }
diff --git a/content/test/test_navigation_url_loader_delegate.h b/content/test/test_navigation_url_loader_delegate.h index b3723960..d26bf0a 100644 --- a/content/test/test_navigation_url_loader_delegate.h +++ b/content/test/test_navigation_url_loader_delegate.h
@@ -44,6 +44,7 @@ return should_ssl_errors_be_fatal_; } int on_request_handled_counter() const { return on_request_handled_counter_; } + bool is_download() const { return is_download_; } // Waits for various navigation events. // Note: if the event already happened, the functions will hang. @@ -86,6 +87,7 @@ base::Optional<net::SSLInfo> ssl_info_; bool should_ssl_errors_be_fatal_; int on_request_handled_counter_; + bool is_download_; std::unique_ptr<base::RunLoop> request_redirected_; std::unique_ptr<base::RunLoop> response_started_;
diff --git a/device/bluetooth/bluetooth_adapter_mac_metrics.h b/device/bluetooth/bluetooth_adapter_mac_metrics.h index d4ac2fe1..348a02af 100644 --- a/device/bluetooth/bluetooth_adapter_mac_metrics.h +++ b/device/bluetooth/bluetooth_adapter_mac_metrics.h
@@ -39,7 +39,9 @@ CBERROR_PERIPHERAL_DISCONNECTED = 1007, CBERROR_UUID_NOT_ALLOWED = 1008, CBERROR_ALREADY_ADVERTISING = 1009, - CBERROR_MAX_CONNECTION = 1010, + CBERROR_CONNECTION_FAILED = 1010, + CBERROR_CONNECTION_LIMIT_REACHED = 1011, + CBERROR_UNKNOWN_DEVICE = 1012, CBERROR_UNKNOWN_ERROR_CODE = 1999, MAX, };
diff --git a/device/bluetooth/bluetooth_adapter_mac_metrics.mm b/device/bluetooth/bluetooth_adapter_mac_metrics.mm index dd63b84..6a9014ef 100644 --- a/device/bluetooth/bluetooth_adapter_mac_metrics.mm +++ b/device/bluetooth/bluetooth_adapter_mac_metrics.mm
@@ -11,10 +11,16 @@ namespace { -#if !defined(MAC_OS_X_VERSION_10_11) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11 -const NSInteger CBErrorMaxConnection = 10; -#endif // MAC_OS_X_VERSION_10_11 +#if !defined(MAC_OS_X_VERSION_10_13) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 + +const NSInteger CBErrorConnectionFailed = 10; +const NSInteger CBErrorConnectionLimitReached = 11; + +// Match the SDK, which now has a typo. https://openradar.appspot.com/34413811 +const NSInteger CBErrorUnkownDevice = 12; + +#endif // MAC_OS_X_VERSION_10_13 MacOSBluetoothOperationsResult GetMacOSOperationResultFromNSError( NSError* error) { @@ -23,8 +29,7 @@ NSString* error_domain = [error domain]; NSInteger error_code = [error code]; if ([error_domain isEqualToString:CBErrorDomain]) { - CBError cb_error_code = static_cast<CBError>(error_code); - switch (cb_error_code) { + switch (error_code) { case CBErrorUnknown: return MacOSBluetoothOperationsResult::CBERROR_UNKNOWN; case CBErrorInvalidParameters: @@ -45,11 +50,13 @@ return MacOSBluetoothOperationsResult::CBERROR_UUID_NOT_ALLOWED; case CBErrorAlreadyAdvertising: return MacOSBluetoothOperationsResult::CBERROR_ALREADY_ADVERTISING; + case CBErrorConnectionFailed: + return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_FAILED; + case CBErrorConnectionLimitReached: + return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_LIMIT_REACHED; + case CBErrorUnkownDevice: + return MacOSBluetoothOperationsResult::CBERROR_UNKNOWN_DEVICE; default: - if (@available(macOS 10.11, *)) { - if (CBErrorMaxConnection == cb_error_code) - return MacOSBluetoothOperationsResult::CBERROR_MAX_CONNECTION; - } NOTREACHED(); } return MacOSBluetoothOperationsResult::CBATT_ERROR_UNKNOWN_ERROR_CODE;
diff --git a/device/gamepad/android/java/src/org/chromium/device/gamepad/GamepadMappings.java b/device/gamepad/android/java/src/org/chromium/device/gamepad/GamepadMappings.java index 7068cca..debc6bd 100644 --- a/device/gamepad/android/java/src/org/chromium/device/gamepad/GamepadMappings.java +++ b/device/gamepad/android/java/src/org/chromium/device/gamepad/GamepadMappings.java
@@ -35,6 +35,8 @@ static final int PS_DUALSHOCK_4_PRODUCT_ID = 1476; @VisibleForTesting static final int PS_DUALSHOCK_4_SLIM_PRODUCT_ID = 2508; + @VisibleForTesting + static final int PS_DUALSHOCK_4_USB_RECEIVER_PRODUCT_ID = 2976; @VisibleForTesting static final int XBOX_ONE_S_2016_FIRMWARE_VENDOR_ID = 0x045e; @@ -58,7 +60,8 @@ // so we better go by the product and vendor ids. if (vendorId == PS_DUALSHOCK_4_VENDOR_ID && (productId == PS_DUALSHOCK_4_PRODUCT_ID - || productId == PS_DUALSHOCK_4_SLIM_PRODUCT_ID)) { + || productId == PS_DUALSHOCK_4_SLIM_PRODUCT_ID + || productId == PS_DUALSHOCK_4_USB_RECEIVER_PRODUCT_ID)) { return new PS4GamepadMappings(); } // Microsoft released a firmware update for the Xbox One S gamepad that modified the button @@ -390,9 +393,20 @@ mappedButtons[CanonicalButtonIndex.LEFT_TRIGGER] = scaleRxRy(rx); mappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER] = scaleRxRy(ry); - mapHatAxisToDpadButtons(mappedButtons, rawAxes); - mapCommonStartSelectMetaButtons(mappedButtons, rawButtons); + float share = rawButtons[KeyEvent.KEYCODE_BUTTON_L2]; + float options = rawButtons[KeyEvent.KEYCODE_BUTTON_R2]; + mappedButtons[CanonicalButtonIndex.BACK_SELECT] = share; + mappedButtons[CanonicalButtonIndex.START] = options; + float thumbL = rawButtons[KeyEvent.KEYCODE_BUTTON_SELECT]; + float thumbR = rawButtons[KeyEvent.KEYCODE_BUTTON_START]; + mappedButtons[CanonicalButtonIndex.LEFT_THUMBSTICK] = thumbL; + mappedButtons[CanonicalButtonIndex.RIGHT_THUMBSTICK] = thumbR; + + float mode = rawButtons[KeyEvent.KEYCODE_BUTTON_MODE]; + mappedButtons[CanonicalButtonIndex.META] = mode; + + mapHatAxisToDpadButtons(mappedButtons, rawAxes); mapXYAxes(mappedAxes, rawAxes); mapZAndRZAxesToRightStick(mappedAxes, rawAxes); }
diff --git a/device/gamepad/gamepad_standard_mappings_linux.cc b/device/gamepad/gamepad_standard_mappings_linux.cc index ea41db97..ee75068a 100644 --- a/device/gamepad/gamepad_standard_mappings_linux.cc +++ b/device/gamepad/gamepad_standard_mappings_linux.cc
@@ -412,6 +412,7 @@ {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim) + {"054c", "0ba0", MapperDualshock4}, // Dualshock 4 USB receiver {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866
diff --git a/device/gamepad/gamepad_standard_mappings_mac.mm b/device/gamepad/gamepad_standard_mappings_mac.mm index 8d358df..067e3e4 100644 --- a/device/gamepad/gamepad_standard_mappings_mac.mm +++ b/device/gamepad/gamepad_standard_mappings_mac.mm
@@ -407,6 +407,7 @@ {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim) + {"054c", "0ba0", MapperDualshock4}, // Dualshock 4 USB receiver {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad
diff --git a/device/gamepad/gamepad_standard_mappings_win.cc b/device/gamepad/gamepad_standard_mappings_win.cc index b73f119..837642d 100644 --- a/device/gamepad/gamepad_standard_mappings_win.cc +++ b/device/gamepad/gamepad_standard_mappings_win.cc
@@ -238,6 +238,7 @@ {"046d", "c216", MapperLogitechDualAction}, // Logitech DualAction {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim) + {"054c", "0ba0", MapperDualshock4}, // Dualshock 4 USB receiver {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad {"0b05", "4500", MapperADT1}, // Nexus Player Controller
diff --git a/docs/android_studio.md b/docs/android_studio.md index 19ae229b..bfc014d 100644 --- a/docs/android_studio.md +++ b/docs/android_studio.md
@@ -88,10 +88,13 @@ * Launch it with more RAM: `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-stable/bin/studio-launcher.sh` * If you ever need to reset it: `rm -r ~/.AndroidStudio*/` -* Import Android style settings: +* Import Chromium-specific style and inspections settings: * Help -> Find Action -> "Code Style" (settings) -> Java -> - Manage -> Import -> select "Intellij IDEA code style XML" -> OK - * Select `tools/android/android_studio/ChromiumStyle.xml` + Scheme -> Import Scheme + * Select `tools/android/android_studio/ChromiumStyle.xml` -> OK + * Help -> Find Action -> "Inspections" (settings) -> + Profile -> Import profile + * Select `tools/android/android_studio/ChromiumInspections.xml` -> OK * Turn on automatic import: * Help -> Find Action -> "Auto Import" * Tick all the boxes under "Java" and change the dropdown to "All".
diff --git a/docs/chromedriver_status.md b/docs/chromedriver_status.md index dac7b1aa..81d51d0 100644 --- a/docs/chromedriver_status.md +++ b/docs/chromedriver_status.md
@@ -1,9 +1,9 @@ # WebDriver Status -Below is a list of all WebDriver commands and their current support in Chromedriver based on what is in the [WebDriver Specification](https://w3c.github.io/webdriver/webdriver-spec.html). +Below is a list of all WebDriver commands and their current support in ChromeDriver based on what is in the [WebDriver Specification](https://w3c.github.io/webdriver/webdriver-spec.html). Notes: - - Currently discussing missing some beginning error checks on almost all commands which are not counted in completion currently [1989](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1989) + - Currently discussing missing some beginning error checks on almost all commands which are not counted in completion currently. This is tracked in bug [1989](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1989) | Method | URL | Command | Status | Bug
diff --git a/docs/ios/build_instructions.md b/docs/ios/build_instructions.md index 1f447583..60e943f 100644 --- a/docs/ios/build_instructions.md +++ b/docs/ios/build_instructions.md
@@ -13,7 +13,7 @@ ## System requirements * A 64-bit Mac running 10.11+. -* [Xcode](https://developer.apple.com/xcode) 8.0+. +* [Xcode](https://developer.apple.com/xcode) 9.0+. * The current version of the JDK (required for the Closure compiler). ## Install `depot_tools`
diff --git a/docs/optimizing_web_uis.md b/docs/optimizing_web_uis.md index 686ff98..8a669fb 100644 --- a/docs/optimizing_web_uis.md +++ b/docs/optimizing_web_uis.md
@@ -120,7 +120,5 @@ ```c++ WebUIDataSource* data_source = WebUIDataSource::Create(...); data_source->SetDefaultResource(IDR_MY_PAGE); -std::unordered_set<std::string> exclusions; -exclusions.insert("strings.js"); // if required -data_source->UseGzip(exclusions); +data_source->UseGzip({"strings.js", ...}); // Omit arg to compress everything ```
diff --git a/docs/optional.md b/docs/optional.md index 70c9efb..14b3ed8 100644 --- a/docs/optional.md +++ b/docs/optional.md
@@ -22,13 +22,20 @@ When initialized without a value, `base::Optional<T>` will be empty. When empty, the `operator bool` will return `false` and `value()` should not be called. An -empty `base::Optional<T>` is equal to `base::nullopt_t`. +empty `base::Optional<T>` is equal to `base::nullopt`. ```C++ base::Optional<int> opt; opt == true; // false opt.value(); // illegal, will DCHECK -opt == base::nullopt_t; // true +opt == base::nullopt; // true +``` + +To pass an empty optional argument to another function, use `base::nullopt` +where you would otherwise have used a `nullptr`: + +``` C++ +OtherFunction(42, base::nullopt); // Supply an empty optional argument ``` To avoid calling `value()` when an `base::Optional<T>` is empty, instead of @@ -49,7 +56,7 @@ All basic operators should be available on `base::Optional<T>`: it is possible to compare a `base::Optional<T>` with another or with a `T` or -`base::nullopt_t`. +`base::nullopt`. ```C++ base::Optional<int> opt_1; @@ -60,7 +67,7 @@ opt_1 <= opt_2; // true opt_1 == 1; // true -opt_1 == base::nullopt_t; // false +opt_1 == base::nullopt; // false ``` `base::Optional<T>` has a helper function `base::make_optional<T&&>`:
diff --git a/docs/windows_build_instructions.md b/docs/windows_build_instructions.md index 5ee3fb4..0a8fb7bb 100644 --- a/docs/windows_build_instructions.md +++ b/docs/windows_build_instructions.md
@@ -33,9 +33,14 @@ - Visual C++, which will select three sub-categories including MFC - Universal Windows Apps Development Tools > Tools (1.4.1) and Windows 10 SDK -You can also install Visual Studio 2017 Update 3 or later - set -GYP_MSVS_VERSION=2017 to tell the Chrome build system to use this toolchain. -This generally works but is not yet officially supported. +You can also install Visual Studio 2017 Update 3 or later. You must install the +VC++ toolchain and MFC. This can be done from the command line like this: +```shell +vs_professional.exe --add Microsoft.VisualStudio.Workload.NativeDesktop + --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended +``` +You must also set GYP_MSVS_VERSION=2017 to tell the Chrome build system to use +this toolchain. This generally works but is not yet officially supported. You must have the Windows 10 SDK installed, version 10.0.14393 or 10.0.15063. The 10.0.15063 SDK initially had errors but the 10.0.15063.468 @@ -48,7 +53,8 @@ If the Windows 10 SDK was installed via the Visual Studio installer, the Debugging Tools can be installed by going to: Control Panel → Programs → Programs and Features → Select the "Windows Software Development Kit" → -Change → Change → Check "Debugging Tools For Windows" → Change. +Change → Change → Check "Debugging Tools For Windows" → Change. Or, you can +download the standalone installer and use it to install the Debugging Tools. ## Install `depot_tools`
diff --git a/extensions/browser/content_hash_fetcher.cc b/extensions/browser/content_hash_fetcher.cc index 4e3cc078..6c041a0 100644 --- a/extensions/browser/content_hash_fetcher.cc +++ b/extensions/browser/content_hash_fetcher.cc
@@ -26,6 +26,7 @@ #include "extensions/browser/computed_hashes.h" #include "extensions/browser/content_hash_tree.h" #include "extensions/browser/content_verifier_delegate.h" +#include "extensions/browser/extension_file_task_runner.h" #include "extensions/browser/verified_contents.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -350,10 +351,8 @@ return; } - content::BrowserThread::PostBlockingPoolSequencedTask( - "ContentHashFetcher", - FROM_HERE, - base::Bind(&ContentHashFetcherJob::MaybeCreateHashes, this)); + GetExtensionFileTaskRunner()->PostTask( + FROM_HERE, base::Bind(&ContentHashFetcherJob::MaybeCreateHashes, this)); } void ContentHashFetcherJob::MaybeCreateHashes() {
diff --git a/extensions/shell/browser/default_shell_browser_main_delegate.cc b/extensions/shell/browser/default_shell_browser_main_delegate.cc index c81eb702..f3e1fcf3 100644 --- a/extensions/shell/browser/default_shell_browser_main_delegate.cc +++ b/extensions/shell/browser/default_shell_browser_main_delegate.cc
@@ -72,9 +72,9 @@ if (launch_app) { base::FilePath current_directory; base::PathService::Get(base::DIR_CURRENT, ¤t_directory); - apps::LaunchPlatformAppWithCommandLineAndLaunchId( - browser_context, launch_app, launch_app->id(), *command_line, - current_directory, SOURCE_COMMAND_LINE); + apps::LaunchPlatformAppWithCommandLine(browser_context, launch_app, + *command_line, current_directory, + SOURCE_COMMAND_LINE); } else { LOG(ERROR) << "Could not load any apps."; }
diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc index a4b76f5..490956c6 100644 --- a/gpu/command_buffer/client/query_tracker.cc +++ b/gpu/command_buffer/client/query_tracker.cc
@@ -112,7 +112,6 @@ void QuerySyncManager::Shrink(CommandBufferHelper* helper) { std::deque<std::unique_ptr<Bucket>> new_buckets; - bool has_token = false; uint32_t token = 0; while (!buckets_.empty()) { std::unique_ptr<Bucket>& bucket = buckets_.front(); @@ -124,7 +123,6 @@ // access the shared memory after current commands, so we can // free-pending-token. token = helper->InsertToken(); - has_token = true; mapped_memory_->FreePendingToken(bucket->syncs, token); } else { new_buckets.push_back(std::move(bucket));
diff --git a/gpu/command_buffer/service/sampler_manager.cc b/gpu/command_buffer/service/sampler_manager.cc index 9b8ec3c4..1f9ca3e 100644 --- a/gpu/command_buffer/service/sampler_manager.cc +++ b/gpu/command_buffer/service/sampler_manager.cc
@@ -112,7 +112,7 @@ case GL_TEXTURE_WRAP_T: case GL_TEXTURE_COMPARE_FUNC: case GL_TEXTURE_COMPARE_MODE: { - GLint iparam = static_cast<GLint>(param); + GLint iparam = static_cast<GLint>(std::round(param)); return SetParameteri(feature_info, pname, iparam); } case GL_TEXTURE_MIN_LOD:
diff --git a/headless/public/headless_web_contents.h b/headless/public/headless_web_contents.h index 96259c3a..bf7a74fd 100644 --- a/headless/public/headless_web_contents.h +++ b/headless/public/headless_web_contents.h
@@ -99,8 +99,7 @@ virtual int GetMainFrameTreeNodeId() const = 0; - private: - friend class HeadlessWebContentsImpl; + protected: HeadlessWebContents() {} DISALLOW_COPY_AND_ASSIGN(HeadlessWebContents);
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 7705683..886ccdd 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1570,6 +1570,9 @@ <message name="IDS_IOS_CHOOSE_DEFAULT_EMAIL_CLIENT_APP" desc="Title for action sheet to select an email client app when user taps on an URL that has a mailto: URL scheme. [Length: 50em]"> Choose Default Email App </message> + <message name="IDS_IOS_CHOOSE_EMAIL_APP" desc="Title for bottom sheet to choose an email client app when user taps on an URL that has a mailto: URL scheme. [Length 40em]"> + Choose Email App + </message> <message name="IDS_IOS_CHOOSE_EMAIL_APP_HOW_TO_CHANGE" desc="Subtitle for action sheet to choose mailto:// handler with instructions on how to change the preference in the future. [Length: 80]"> You can change this preference any time in Chrome settings </message>
diff --git a/ios/chrome/browser/autofill/form_suggestion_label.mm b/ios/chrome/browser/autofill/form_suggestion_label.mm index aae0c37..033232a 100644 --- a/ios/chrome/browser/autofill/form_suggestion_label.mm +++ b/ios/chrome/browser/autofill/form_suggestion_label.mm
@@ -92,17 +92,19 @@ const CGFloat frameHeight = CGRectGetHeight(proposedFrame); CGFloat currentX = kBorderWidth; - const int iconImageID = autofill::data_util::GetPaymentRequestData( - base::SysNSStringToUTF8(suggestion.icon)) - .icon_resource_id; - UIImage* iconImage = NativeImage(iconImageID); - UIImageView* iconView = [[UIImageView alloc] initWithImage:iconImage]; - const CGFloat iconY = - std::floor((frameHeight - iconImage.size.height) / 2.0f); - iconView.frame = CGRectMake(currentX, iconY, iconImage.size.width, - iconImage.size.height); - [self addSubview:iconView]; - currentX += CGRectGetWidth(iconView.frame) + kSpacing; + if (suggestion.icon.length > 0) { + const int iconImageID = autofill::data_util::GetPaymentRequestData( + base::SysNSStringToUTF8(suggestion.icon)) + .icon_resource_id; + UIImage* iconImage = NativeImage(iconImageID); + UIImageView* iconView = [[UIImageView alloc] initWithImage:iconImage]; + const CGFloat iconY = + std::floor((frameHeight - iconImage.size.height) / 2.0f); + iconView.frame = CGRectMake(currentX, iconY, iconImage.size.width, + iconImage.size.height); + [self addSubview:iconView]; + currentX += CGRectGetWidth(iconView.frame) + kSpacing; + } UILabel* label = TextLabel(suggestion.value, kMainLabelAlpha, YES); const CGFloat labelY =
diff --git a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm index f7133e6b4..451be9a 100644 --- a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm +++ b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm
@@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/mac/bind_objc_block.h" #include "base/stl_util.h" +#include "base/task_scheduler/post_task.h" #include "components/net_log/chrome_net_log.h" #include "components/prefs/pref_service.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" @@ -23,7 +24,6 @@ #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" #include "ios/chrome/browser/pref_names.h" #include "ios/web/public/web_thread.h" -#include "net/base/sdch_manager.h" #include "net/cookies/cookie_store.h" #include "net/disk_cache/disk_cache.h" #include "net/extras/sqlite/sqlite_channel_id_store.h" @@ -31,7 +31,6 @@ #include "net/http/http_cache.h" #include "net/http/http_network_session.h" #include "net/http/http_server_properties_impl.h" -#include "net/sdch/sdch_owner.h" #include "net/ssl/channel_id_service.h" #include "net/ssl/default_channel_id_store.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -187,7 +186,8 @@ DCHECK(!channel_id_path_.empty()); channel_id_store = new net::SQLiteChannelIDStore( channel_id_path_, - web::WebThread::GetTaskRunnerForThread(web::WebThread::DB)); + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::BACKGROUND})); net::ChannelIDService* channel_id_service = new net::ChannelIDService( new net::DefaultChannelIDStore(channel_id_store.get()));
diff --git a/ios/chrome/browser/content_suggestions/BUILD.gn b/ios/chrome/browser/content_suggestions/BUILD.gn index 0bc68fc9..0876efb 100644 --- a/ios/chrome/browser/content_suggestions/BUILD.gn +++ b/ios/chrome/browser/content_suggestions/BUILD.gn
@@ -23,6 +23,8 @@ "content_suggestions_service_bridge_observer.mm", "mediator_util.h", "mediator_util.mm", + "ntp_home_mediator.h", + "ntp_home_mediator.mm", "ntp_home_metrics.h", "ntp_home_metrics.mm", ]
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm index 60837643..6ac6b39 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
@@ -5,91 +5,44 @@ #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_nsobject.h" -#include "base/metrics/histogram_macros.h" -#include "base/metrics/user_metrics.h" -#include "base/metrics/user_metrics_action.h" -#include "base/strings/sys_string_conversions.h" #include "components/ntp_snippets/content_suggestions_service.h" #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" -#include "components/ntp_tiles/metrics.h" #include "components/ntp_tiles/most_visited_sites.h" -#include "components/reading_list/core/reading_list_model.h" -#include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" -#import "ios/chrome/browser/content_suggestions/content_suggestions_alert_factory.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_metrics_recorder.h" +#import "ios/chrome/browser/content_suggestions/ntp_home_mediator.h" #import "ios/chrome/browser/content_suggestions/ntp_home_metrics.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" #include "ios/chrome/browser/favicon/large_icon_cache.h" -#import "ios/chrome/browser/metrics/new_tab_page_uma.h" #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h" #include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h" #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" -#include "ios/chrome/browser/tabs/tab_constants.h" -#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" #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/content_suggestions/cells/content_suggestions_gesture_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_collection_utils.h" -#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_synchronizer.h" -#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller_delegate.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller_audience.h" -#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h" #import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" -#include "ios/chrome/grit/ios_strings.h" -#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" -#import "ios/web/public/navigation_item.h" -#import "ios/web/public/navigation_manager.h" -#include "ios/web/public/referrer.h" -#import "ios/web/public/web_state/web_state.h" -#import "ios/web/public/web_state/web_state_observer_bridge.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/strings/grit/ui_strings.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -namespace { - -const char kNTPHelpURL[] = "https://support.google.com/chrome/?p=ios_new_tab"; - -// The What's New promo command that shows the Bookmarks Manager. -const char kBookmarkCommand[] = "bookmark"; - -// The What's New promo command that launches Rate This App. -const char kRateThisAppCommand[] = "ratethisapp"; - -} // namespace - @interface ContentSuggestionsCoordinator ()< - ContentSuggestionsCommands, - ContentSuggestionsGestureCommands, - ContentSuggestionsHeaderViewControllerCommandHandler, - ContentSuggestionsHeaderViewControllerDelegate, ContentSuggestionsViewControllerAudience, - CRWWebStateObserver, OverscrollActionsControllerDelegate> -@property(nonatomic, strong) AlertCoordinator* alertCoordinator; @property(nonatomic, strong) ContentSuggestionsViewController* suggestionsViewController; @property(nonatomic, strong) @@ -98,6 +51,7 @@ @property(nonatomic, strong) ContentSuggestionsHeaderSynchronizer* headerCollectionInteractionHandler; @property(nonatomic, strong) ContentSuggestionsMetricsRecorder* metricsRecorder; +@property(nonatomic, strong) NTPHomeMediator* NTPMediator; // Redefined as readwrite. @property(nonatomic, strong, readwrite) @@ -105,11 +59,8 @@ @end -@implementation ContentSuggestionsCoordinator { - std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; -} +@implementation ContentSuggestionsCoordinator -@synthesize alertCoordinator = _alertCoordinator; @synthesize browserState = _browserState; @synthesize suggestionsViewController = _suggestionsViewController; @synthesize URLLoader = _URLLoader; @@ -123,6 +74,7 @@ @synthesize dispatcher = _dispatcher; @synthesize delegate = _delegate; @synthesize metricsRecorder = _metricsRecorder; +@synthesize NTPMediator = _NTPMediator; - (void)start { if (self.visible || !self.browserState) { @@ -133,10 +85,6 @@ _visible = YES; - web::WebState* webState = self.webStateList->GetActiveWebState(); - _webStateObserver = - base::MakeUnique<web::WebStateObserverBridge>(webState, self); - ntp_snippets::ContentSuggestionsService* contentSuggestionsService = IOSChromeContentSuggestionsServiceFactory::GetForBrowserState( self.browserState); @@ -156,12 +104,15 @@ ntp_home::RecordNTPImpression(ntp_home::LOCAL_SUGGESTIONS); } + self.NTPMediator = [[NTPHomeMediator alloc] init]; + self.headerController = [[ContentSuggestionsHeaderViewController alloc] init]; self.headerController.dispatcher = self.dispatcher; - self.headerController.commandHandler = self; - self.headerController.delegate = self; + self.headerController.commandHandler = self.NTPMediator; + self.headerController.delegate = self.NTPMediator; self.headerController.readingListModel = ReadingListModelFactory::GetForBrowserState(self.browserState); + self.googleLandingMediator = [[GoogleLandingMediator alloc] initWithBrowserState:self.browserState webStateList:self.webStateList]; @@ -180,8 +131,9 @@ largeIconService:largeIconService largeIconCache:cache mostVisitedSite:std::move(mostVisitedFactory)]; - self.contentSuggestionsMediator.commandHandler = self; + self.contentSuggestionsMediator.commandHandler = self.NTPMediator; self.contentSuggestionsMediator.headerProvider = self.headerController; + self.metricsRecorder = [[ContentSuggestionsMetricsRecorder alloc] init]; self.metricsRecorder.delegate = self.contentSuggestionsMediator; @@ -189,12 +141,22 @@ initWithStyle:CollectionViewControllerStyleDefault]; [self.suggestionsViewController setDataSource:self.contentSuggestionsMediator]; - self.suggestionsViewController.suggestionCommandHandler = self; + self.suggestionsViewController.suggestionCommandHandler = self.NTPMediator; self.suggestionsViewController.audience = self; self.suggestionsViewController.overscrollDelegate = self; self.suggestionsViewController.metricsRecorder = self.metricsRecorder; self.suggestionsViewController.containsToolbar = YES; + self.NTPMediator.webState = self.webStateList->GetActiveWebState(); + self.NTPMediator.dispatcher = self.dispatcher; + self.NTPMediator.NTPMetrics = + [[NTPHomeMetrics alloc] initWithBrowserState:self.browserState]; + self.NTPMediator.metricsRecorder = self.metricsRecorder; + self.NTPMediator.suggestionsViewController = self.suggestionsViewController; + self.NTPMediator.suggestionsMediator = self.contentSuggestionsMediator; + self.NTPMediator.suggestionsService = contentSuggestionsService; + [self.NTPMediator setUp]; + [self.suggestionsViewController addChildViewController:self.headerController]; [self.headerController didMoveToParentViewController:self.suggestionsViewController]; @@ -206,266 +168,19 @@ } - (void)stop { + [self.NTPMediator shutdown]; + self.NTPMediator = nil; self.contentSuggestionsMediator = nil; - self.alertCoordinator = nil; self.headerController = nil; [self.googleLandingMediator shutdown]; self.googleLandingMediator = nil; _visible = NO; - _webStateObserver.reset(); } - (UIViewController*)viewController { return self.suggestionsViewController; } -- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { - if (!success) - return; - - web::NavigationManager* navigationManager = webState->GetNavigationManager(); - web::NavigationItem* item = navigationManager->GetVisibleItem(); - if (item && item->GetPageDisplayState().scroll_state().offset_y() > 0) { - CGFloat offset = item->GetPageDisplayState().scroll_state().offset_y(); - UICollectionView* collection = - self.suggestionsViewController.collectionView; - // Don't set the offset such as the content of the collection is smaller - // than the part of the collection which should be displayed with that - // offset, taking into account the size of the toolbar. - offset = MAX(0, MIN(offset, collection.contentSize.height - - collection.bounds.size.height - - ntp_header::kToolbarHeight)); - collection.contentOffset = CGPointMake(0, offset); - // Update the constraints in case the omnibox needs to be moved. - [self.suggestionsViewController updateConstraints]; - } -} - -#pragma mark - ContentSuggestionsCommands - -- (void)openReadingList { - [self.dispatcher showReadingList]; -} - -- (void)openPageForItemAtIndexPath:(NSIndexPath*)indexPath { - CollectionViewItem* item = [self.suggestionsViewController.collectionViewModel - itemAtIndexPath:indexPath]; - ContentSuggestionsItem* suggestionItem = - base::mac::ObjCCastStrict<ContentSuggestionsItem>(item); - - [self.metricsRecorder - onSuggestionOpened:suggestionItem - atIndexPath:indexPath - sectionsShownAbove:[self.suggestionsViewController - numberOfSectionsAbove:indexPath.section] - suggestionsShownAbove:[self.suggestionsViewController - numberOfSuggestionsAbove:indexPath.section] - withAction:WindowOpenDisposition::CURRENT_TAB]; - IOSChromeContentSuggestionsServiceFactory::GetForBrowserState( - self.browserState) - ->user_classifier() - ->OnEvent(ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); - - // Use a referrer with a specific URL to mark this entry as coming from - // ContentSuggestions. - web::Referrer referrer; - referrer.url = GURL(tab_constants::kDoNotConsiderForMostVisited); - - [self.URLLoader loadURL:suggestionItem.URL - referrer:referrer - transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK - rendererInitiated:NO]; - new_tab_page_uma::RecordAction(self.browserState, - new_tab_page_uma::ACTION_OPENED_SUGGESTION); -} - -- (void)openMostVisitedItem:(CollectionViewItem*)item - atIndex:(NSInteger)mostVisitedIndex { - ContentSuggestionsMostVisitedItem* mostVisitedItem = - base::mac::ObjCCastStrict<ContentSuggestionsMostVisitedItem>(item); - - [self logMostVisitedOpening:mostVisitedItem atIndex:mostVisitedIndex]; - - [self.URLLoader loadURL:mostVisitedItem.URL - referrer:web::Referrer() - transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK - rendererInitiated:NO]; -} - -- (void)displayContextMenuForSuggestion:(CollectionViewItem*)item - atPoint:(CGPoint)touchLocation - atIndexPath:(NSIndexPath*)indexPath - readLaterAction:(BOOL)readLaterAction { - ContentSuggestionsItem* suggestionsItem = - base::mac::ObjCCastStrict<ContentSuggestionsItem>(item); - - [self.metricsRecorder - onMenuOpenedForSuggestion:suggestionsItem - atIndexPath:indexPath - suggestionsShownAbove:[self.suggestionsViewController - numberOfSuggestionsAbove:indexPath - .section]]; - - self.alertCoordinator = [ContentSuggestionsAlertFactory - alertCoordinatorForSuggestionItem:suggestionsItem - onViewController:self.suggestionsViewController - atPoint:touchLocation - atIndexPath:indexPath - readLaterAction:readLaterAction - commandHandler:self]; - - [self.alertCoordinator start]; -} - -- (void)displayContextMenuForMostVisitedItem:(CollectionViewItem*)item - atPoint:(CGPoint)touchLocation - atIndexPath:(NSIndexPath*)indexPath { - ContentSuggestionsMostVisitedItem* mostVisitedItem = - base::mac::ObjCCastStrict<ContentSuggestionsMostVisitedItem>(item); - self.alertCoordinator = [ContentSuggestionsAlertFactory - alertCoordinatorForMostVisitedItem:mostVisitedItem - onViewController:self.suggestionsViewController - atPoint:touchLocation - atIndexPath:indexPath - commandHandler:self]; - - [self.alertCoordinator start]; -} - -// TODO(crbug.com/761096) : Promo handling should be DRY and tested. -- (void)handlePromoTapped { - NotificationPromoWhatsNew* notificationPromo = - [self.contentSuggestionsMediator notificationPromo]; - DCHECK(notificationPromo); - notificationPromo->HandleClosed(); - new_tab_page_uma::RecordAction(self.browserState, - new_tab_page_uma::ACTION_OPENED_PROMO); - - if (notificationPromo->IsURLPromo()) { - [self.URLLoader webPageOrderedOpen:notificationPromo->url() - referrer:web::Referrer() - inBackground:NO - appendTo:kCurrentTab]; - return; - } - - if (notificationPromo->IsChromeCommandPromo()) { - std::string command = notificationPromo->command(); - if (command == kBookmarkCommand) { - [self.dispatcher showBookmarksManager]; - } else if (command == kRateThisAppCommand) { - [self.dispatcher showRateThisAppDialog]; - } else { - NOTREACHED() << "Promo command is not valid."; - } - return; - } - NOTREACHED() << "Promo type is neither URL or command."; -} - -- (void)handleLearnMoreTapped { - [self.URLLoader loadURL:GURL(kNTPHelpURL) - referrer:web::Referrer() - transition:ui::PAGE_TRANSITION_LINK - rendererInitiated:NO]; - new_tab_page_uma::RecordAction(self.browserState, - new_tab_page_uma::ACTION_OPENED_LEARN_MORE); -} - -#pragma mark - ContentSuggestionsGestureCommands - -- (void)openNewTabWithSuggestionsItem:(ContentSuggestionsItem*)item - incognito:(BOOL)incognito { - new_tab_page_uma::RecordAction(self.browserState, - new_tab_page_uma::ACTION_OPENED_SUGGESTION); - IOSChromeContentSuggestionsServiceFactory::GetForBrowserState( - self.browserState) - ->user_classifier() - ->OnEvent(ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); - - NSIndexPath* indexPath = [self.suggestionsViewController.collectionViewModel - indexPathForItem:item]; - if (indexPath) { - WindowOpenDisposition disposition = - incognito ? WindowOpenDisposition::OFF_THE_RECORD - : WindowOpenDisposition::NEW_BACKGROUND_TAB; - [self.metricsRecorder - onSuggestionOpened:item - atIndexPath:indexPath - sectionsShownAbove:[self.suggestionsViewController - numberOfSectionsAbove:indexPath.section] - suggestionsShownAbove:[self.suggestionsViewController - numberOfSuggestionsAbove:indexPath.section] - withAction:disposition]; - } - - [self openNewTabWithURL:item.URL incognito:incognito]; -} - -- (void)addItemToReadingList:(ContentSuggestionsItem*)item { - NSIndexPath* indexPath = [self.suggestionsViewController.collectionViewModel - indexPathForItem:item]; - if (indexPath) { - [self.metricsRecorder - onSuggestionOpened:item - atIndexPath:indexPath - sectionsShownAbove:[self.suggestionsViewController - numberOfSectionsAbove:indexPath.section] - suggestionsShownAbove:[self.suggestionsViewController - numberOfSuggestionsAbove:indexPath.section] - withAction:WindowOpenDisposition::SAVE_TO_DISK]; - } - - self.contentSuggestionsMediator.readingListNeedsReload = YES; - ReadingListAddCommand* command = - [[ReadingListAddCommand alloc] initWithURL:item.URL title:item.title]; - [self.dispatcher addToReadingList:command]; -} - -- (void)dismissSuggestion:(ContentSuggestionsItem*)item - atIndexPath:(NSIndexPath*)indexPath { - NSIndexPath* itemIndexPath = indexPath; - if (!itemIndexPath) { - // If the caller uses a nil |indexPath|, find it from the model. - itemIndexPath = [self.suggestionsViewController.collectionViewModel - indexPathForItem:item]; - } - - [self.contentSuggestionsMediator dismissSuggestion:item.suggestionIdentifier]; - [self.suggestionsViewController dismissEntryAtIndexPath:itemIndexPath]; -} - -- (void)openNewTabWithMostVisitedItem:(ContentSuggestionsMostVisitedItem*)item - incognito:(BOOL)incognito - atIndex:(NSInteger)index { - [self logMostVisitedOpening:item atIndex:index]; - [self openNewTabWithURL:item.URL incognito:incognito]; -} - -- (void)openNewTabWithMostVisitedItem:(ContentSuggestionsMostVisitedItem*)item - incognito:(BOOL)incognito { - NSInteger index = - [self.suggestionsViewController.collectionViewModel indexPathForItem:item] - .item; - [self openNewTabWithMostVisitedItem:item incognito:incognito atIndex:index]; -} - -- (void)removeMostVisited:(ContentSuggestionsMostVisitedItem*)item { - base::RecordAction(base::UserMetricsAction("MostVisited_UrlBlacklisted")); - [self.contentSuggestionsMediator blacklistMostVisitedURL:item.URL]; - [self showMostVisitedUndoForURL:item.URL]; -} - -#pragma mark - ContentSuggestionsHeaderViewControllerDelegate - -- (BOOL)isContextMenuVisible { - return self.alertCoordinator.isVisible; -} - -- (BOOL)isScrolledToTop { - return self.suggestionsViewController.scrolledToTop; -} - #pragma mark - ContentSuggestionsViewControllerAudience - (void)contentOffsetDidChange { @@ -575,8 +290,7 @@ } - (void)dismissModals { - [self.alertCoordinator stop]; - self.alertCoordinator = nil; + [self.NTPMediator dismissModals]; } - (void)dismissKeyboard { @@ -585,52 +299,4 @@ - (void)setScrollsToTop:(BOOL)enable { } -#pragma mark - Private - -// Opens the |URL| in a new tab |incognito| or not. -- (void)openNewTabWithURL:(const GURL&)URL incognito:(BOOL)incognito { - // Open the tab in background if it is non-incognito only. - [self.URLLoader webPageOrderedOpen:URL - referrer:web::Referrer() - inIncognito:incognito - inBackground:!incognito - appendTo:kCurrentTab]; -} - -// Logs a histogram due to a Most Visited item being opened. -- (void)logMostVisitedOpening:(ContentSuggestionsMostVisitedItem*)item - atIndex:(NSInteger)mostVisitedIndex { - new_tab_page_uma::RecordAction( - self.browserState, new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY); - base::RecordAction(base::UserMetricsAction("MobileNTPMostVisited")); - - ntp_tiles::metrics::RecordTileClick(mostVisitedIndex, item.source, - [item tileType]); -} - -// Shows a snackbar with an action to undo the removal of the most visited item -// with a |URL|. -- (void)showMostVisitedUndoForURL:(GURL)URL { - GURL copiedURL = URL; - - MDCSnackbarMessageAction* action = [[MDCSnackbarMessageAction alloc] init]; - __weak ContentSuggestionsCoordinator* weakSelf = self; - action.handler = ^{ - ContentSuggestionsCoordinator* strongSelf = weakSelf; - if (!strongSelf) - return; - [strongSelf.contentSuggestionsMediator whitelistMostVisitedURL:copiedURL]; - }; - action.title = l10n_util::GetNSString(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE); - action.accessibilityIdentifier = @"Undo"; - - TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); - MDCSnackbarMessage* message = [MDCSnackbarMessage - messageWithText:l10n_util::GetNSString( - IDS_IOS_NEW_TAB_MOST_VISITED_ITEM_REMOVED)]; - message.action = action; - message.category = @"MostVisitedUndo"; - [MDCSnackbarManager showMessage:message]; -} - @end
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.h b/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.h index 5b6ce09..1f8f557 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.h +++ b/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.h
@@ -16,8 +16,8 @@ @protocol ApplicationCommands; @protocol BrowserCommands; @protocol ContentSuggestionsCollectionSynchronizing; +@protocol ContentSuggestionsCommands; @protocol ContentSuggestionsHeaderViewControllerDelegate; -@protocol ContentSuggestionsHeaderViewControllerCommandHandler; @protocol OmniboxFocuser; @protocol UrlLoader; class ReadingListModel; @@ -37,9 +37,7 @@ dispatcher; @property(nonatomic, weak) id<ContentSuggestionsHeaderViewControllerDelegate> delegate; -@property(nonatomic, weak) - id<ContentSuggestionsHeaderViewControllerCommandHandler> - commandHandler; +@property(nonatomic, weak) id<ContentSuggestionsCommands> commandHandler; @property(nonatomic, assign) ReadingListModel* readingListModel; // Whether the Google logo or doodle is being shown.
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.mm b/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.mm index cd683ac..e82fed2a 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_header_view_controller.mm
@@ -13,6 +13,7 @@ #include "ios/chrome/browser/ui/commands/start_voice_search_command.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_synchronizing.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller_delegate.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h"
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_mediator.h b/ios/chrome/browser/content_suggestions/ntp_home_mediator.h new file mode 100644 index 0000000..5359d4d8 --- /dev/null +++ b/ios/chrome/browser/content_suggestions/ntp_home_mediator.h
@@ -0,0 +1,66 @@ +// 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 IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_NTP_HOME_MEDIATOR_H_ +#define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_NTP_HOME_MEDIATOR_H_ + +#import <UIKit/UIKit.h> + +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_gesture_commands.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller_delegate.h" + +namespace ntp_snippets { +class ContentSuggestionsService; +} + +namespace web { +class WebState; +} + +@protocol ApplicationCommands; +@protocol BrowserCommands; +@class ContentSuggestionsHeaderViewController; +@class ContentSuggestionsMediator; +@class ContentSuggestionsMetricsRecorder; +@class ContentSuggestionsViewController; +@protocol OmniboxFocuser; +@class NTPHomeMetrics; +@protocol UrlLoader; + +// Mediator for the NTP Home panel, handling the interactions with the +// suggestions. +@interface NTPHomeMediator + : NSObject<ContentSuggestionsCommands, + ContentSuggestionsGestureCommands, + ContentSuggestionsHeaderViewControllerDelegate> + +// The web state associated with this NTP. +@property(nonatomic, assign) web::WebState* webState; +// Dispatcher. +@property(nonatomic, weak) + id<ApplicationCommands, BrowserCommands, OmniboxFocuser, UrlLoader> + dispatcher; +// Suggestions service used to get the suggestions. +@property(nonatomic, assign) + ntp_snippets::ContentSuggestionsService* suggestionsService; +// Recorder for the metrics related to ContentSuggestions. +@property(nonatomic, strong) ContentSuggestionsMetricsRecorder* metricsRecorder; +// Recorder for the metrics related to the NTP. +@property(nonatomic, strong) NTPHomeMetrics* NTPMetrics; +// View Controller displaying the suggestions. +@property(nonatomic, weak) + ContentSuggestionsViewController* suggestionsViewController; +// Mediator for the ContentSuggestions. +@property(nonatomic, weak) ContentSuggestionsMediator* suggestionsMediator; + +// Inits the mediator. +- (void)setUp; + +// Cleans the mediator. +- (void)shutdown; + +@end + +#endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_NTP_HOME_MEDIATOR_H_
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm b/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm new file mode 100644 index 0000000..47556caf --- /dev/null +++ b/ios/chrome/browser/content_suggestions/ntp_home_mediator.mm
@@ -0,0 +1,379 @@ +// 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. + +#import "ios/chrome/browser/content_suggestions/ntp_home_mediator.h" + +#include "base/mac/foundation_util.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" +#include "components/ntp_snippets/content_suggestions_service.h" +#include "components/ntp_tiles/metrics.h" +#include "components/strings/grit/components_strings.h" +#import "ios/chrome/browser/content_suggestions/content_suggestions_alert_factory.h" +#import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" +#import "ios/chrome/browser/content_suggestions/content_suggestions_metrics_recorder.h" +#import "ios/chrome/browser/content_suggestions/ntp_home_metrics.h" +#import "ios/chrome/browser/metrics/new_tab_page_uma.h" +#include "ios/chrome/browser/tabs/tab_constants.h" +#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" +#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/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" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller_audience.h" +#import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h" +#import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" +#import "ios/chrome/browser/ui/uikit_ui_util.h" +#import "ios/chrome/browser/ui/url_loader.h" +#include "ios/chrome/grit/ios_strings.h" +#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" +#import "ios/web/public/navigation_item.h" +#import "ios/web/public/navigation_manager.h" +#include "ios/web/public/referrer.h" +#import "ios/web/public/web_state/web_state.h" +#import "ios/web/public/web_state/web_state_observer_bridge.h" +#include "ui/base/l10n/l10n_util.h" +#include "url/gurl.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +// URL for the page displaying help for the NTP. +const char kNTPHelpURL[] = "https://support.google.com/chrome/?p=ios_new_tab"; + +// The What's New promo command that shows the Bookmarks Manager. +const char kBookmarkCommand[] = "bookmark"; + +// The What's New promo command that launches Rate This App. +const char kRateThisAppCommand[] = "ratethisapp"; +} // namespace + +@interface NTPHomeMediator ()<CRWWebStateObserver> { + std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; +} + +@property(nonatomic, strong) AlertCoordinator* alertCoordinator; + +@end + +@implementation NTPHomeMediator + +@synthesize webState = _webState; +@synthesize dispatcher = _dispatcher; +@synthesize suggestionsService = _suggestionsService; +@synthesize NTPMetrics = _NTPMetrics; +@synthesize suggestionsViewController = _suggestionsViewController; +@synthesize suggestionsMediator = _suggestionsMediator; +@synthesize alertCoordinator = _alertCoordinator; +@synthesize metricsRecorder = _metricsRecorder; + +- (void)setUp { + DCHECK(self.suggestionsService); + _webStateObserver = + base::MakeUnique<web::WebStateObserverBridge>(self.webState, self); +} + +- (void)shutdown { + _webStateObserver.reset(); +} + +#pragma mark - CRWWebStateObserver + +- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { + if (!success) + return; + + web::NavigationManager* navigationManager = webState->GetNavigationManager(); + web::NavigationItem* item = navigationManager->GetVisibleItem(); + if (item && item->GetPageDisplayState().scroll_state().offset_y() > 0) { + CGFloat offset = item->GetPageDisplayState().scroll_state().offset_y(); + UICollectionView* collection = + self.suggestionsViewController.collectionView; + // Don't set the offset such as the content of the collection is smaller + // than the part of the collection which should be displayed with that + // offset, taking into account the size of the toolbar. + offset = MAX(0, MIN(offset, collection.contentSize.height - + collection.bounds.size.height - + ntp_header::kToolbarHeight)); + collection.contentOffset = CGPointMake(0, offset); + // Update the constraints in case the omnibox needs to be moved. + [self.suggestionsViewController updateConstraints]; + } +} + +#pragma mark - ContentSuggestionsCommands + +- (void)openReadingList { + [self.dispatcher showReadingList]; +} + +- (void)openPageForItemAtIndexPath:(NSIndexPath*)indexPath { + CollectionViewItem* item = [self.suggestionsViewController.collectionViewModel + itemAtIndexPath:indexPath]; + ContentSuggestionsItem* suggestionItem = + base::mac::ObjCCastStrict<ContentSuggestionsItem>(item); + + [self.metricsRecorder + onSuggestionOpened:suggestionItem + atIndexPath:indexPath + sectionsShownAbove:[self.suggestionsViewController + numberOfSectionsAbove:indexPath.section] + suggestionsShownAbove:[self.suggestionsViewController + numberOfSuggestionsAbove:indexPath.section] + withAction:WindowOpenDisposition::CURRENT_TAB]; + self.suggestionsService->user_classifier()->OnEvent( + ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); + + // Use a referrer with a specific URL to mark this entry as coming from + // ContentSuggestions. + web::Referrer referrer; + referrer.url = GURL(tab_constants::kDoNotConsiderForMostVisited); + + [self.dispatcher loadURL:suggestionItem.URL + referrer:referrer + transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK + rendererInitiated:NO]; + [self.NTPMetrics recordAction:new_tab_page_uma::ACTION_OPENED_SUGGESTION]; +} + +- (void)openMostVisitedItem:(CollectionViewItem*)item + atIndex:(NSInteger)mostVisitedIndex { + ContentSuggestionsMostVisitedItem* mostVisitedItem = + base::mac::ObjCCastStrict<ContentSuggestionsMostVisitedItem>(item); + + [self logMostVisitedOpening:mostVisitedItem atIndex:mostVisitedIndex]; + + [self.dispatcher loadURL:mostVisitedItem.URL + referrer:web::Referrer() + transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK + rendererInitiated:NO]; +} + +- (void)displayContextMenuForSuggestion:(CollectionViewItem*)item + atPoint:(CGPoint)touchLocation + atIndexPath:(NSIndexPath*)indexPath + readLaterAction:(BOOL)readLaterAction { + ContentSuggestionsItem* suggestionsItem = + base::mac::ObjCCastStrict<ContentSuggestionsItem>(item); + + [self.metricsRecorder + onMenuOpenedForSuggestion:suggestionsItem + atIndexPath:indexPath + suggestionsShownAbove:[self.suggestionsViewController + numberOfSuggestionsAbove:indexPath + .section]]; + + self.alertCoordinator = [ContentSuggestionsAlertFactory + alertCoordinatorForSuggestionItem:suggestionsItem + onViewController:self.suggestionsViewController + atPoint:touchLocation + atIndexPath:indexPath + readLaterAction:readLaterAction + commandHandler:self]; + + [self.alertCoordinator start]; +} + +- (void)displayContextMenuForMostVisitedItem:(CollectionViewItem*)item + atPoint:(CGPoint)touchLocation + atIndexPath:(NSIndexPath*)indexPath { + ContentSuggestionsMostVisitedItem* mostVisitedItem = + base::mac::ObjCCastStrict<ContentSuggestionsMostVisitedItem>(item); + self.alertCoordinator = [ContentSuggestionsAlertFactory + alertCoordinatorForMostVisitedItem:mostVisitedItem + onViewController:self.suggestionsViewController + atPoint:touchLocation + atIndexPath:indexPath + commandHandler:self]; + + [self.alertCoordinator start]; +} + +- (void)dismissModals { + [self.alertCoordinator stop]; + self.alertCoordinator = nil; +} + +// TODO(crbug.com/761096) : Promo handling should be DRY and tested. +- (void)handlePromoTapped { + NotificationPromoWhatsNew* notificationPromo = + [self.suggestionsMediator notificationPromo]; + DCHECK(notificationPromo); + notificationPromo->HandleClosed(); + [self.NTPMetrics recordAction:new_tab_page_uma::ACTION_OPENED_PROMO]; + + if (notificationPromo->IsURLPromo()) { + [self.dispatcher webPageOrderedOpen:notificationPromo->url() + referrer:web::Referrer() + inBackground:NO + appendTo:kCurrentTab]; + return; + } + + if (notificationPromo->IsChromeCommandPromo()) { + std::string command = notificationPromo->command(); + if (command == kBookmarkCommand) { + [self.dispatcher showBookmarksManager]; + } else if (command == kRateThisAppCommand) { + [self.dispatcher showRateThisAppDialog]; + } else { + NOTREACHED() << "Promo command is not valid."; + } + return; + } + NOTREACHED() << "Promo type is neither URL or command."; +} + +- (void)handleLearnMoreTapped { + [self.dispatcher loadURL:GURL(kNTPHelpURL) + referrer:web::Referrer() + transition:ui::PAGE_TRANSITION_LINK + rendererInitiated:NO]; + [self.NTPMetrics recordAction:new_tab_page_uma::ACTION_OPENED_LEARN_MORE]; +} + +#pragma mark - ContentSuggestionsGestureCommands + +- (void)openNewTabWithSuggestionsItem:(ContentSuggestionsItem*)item + incognito:(BOOL)incognito { + [self.NTPMetrics recordAction:new_tab_page_uma::ACTION_OPENED_SUGGESTION]; + self.suggestionsService->user_classifier()->OnEvent( + ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); + + NSIndexPath* indexPath = [self.suggestionsViewController.collectionViewModel + indexPathForItem:item]; + if (indexPath) { + WindowOpenDisposition disposition = + incognito ? WindowOpenDisposition::OFF_THE_RECORD + : WindowOpenDisposition::NEW_BACKGROUND_TAB; + [self.metricsRecorder + onSuggestionOpened:item + atIndexPath:indexPath + sectionsShownAbove:[self.suggestionsViewController + numberOfSectionsAbove:indexPath.section] + suggestionsShownAbove:[self.suggestionsViewController + numberOfSuggestionsAbove:indexPath.section] + withAction:disposition]; + } + + [self openNewTabWithURL:item.URL incognito:incognito]; +} + +- (void)addItemToReadingList:(ContentSuggestionsItem*)item { + NSIndexPath* indexPath = [self.suggestionsViewController.collectionViewModel + indexPathForItem:item]; + if (indexPath) { + [self.metricsRecorder + onSuggestionOpened:item + atIndexPath:indexPath + sectionsShownAbove:[self.suggestionsViewController + numberOfSectionsAbove:indexPath.section] + suggestionsShownAbove:[self.suggestionsViewController + numberOfSuggestionsAbove:indexPath.section] + withAction:WindowOpenDisposition::SAVE_TO_DISK]; + } + + self.suggestionsMediator.readingListNeedsReload = YES; + ReadingListAddCommand* command = + [[ReadingListAddCommand alloc] initWithURL:item.URL title:item.title]; + [self.dispatcher addToReadingList:command]; +} + +- (void)dismissSuggestion:(ContentSuggestionsItem*)item + atIndexPath:(NSIndexPath*)indexPath { + NSIndexPath* itemIndexPath = indexPath; + if (!itemIndexPath) { + // If the caller uses a nil |indexPath|, find it from the model. + itemIndexPath = [self.suggestionsViewController.collectionViewModel + indexPathForItem:item]; + } + + [self.suggestionsMediator dismissSuggestion:item.suggestionIdentifier]; + [self.suggestionsViewController dismissEntryAtIndexPath:itemIndexPath]; +} + +- (void)openNewTabWithMostVisitedItem:(ContentSuggestionsMostVisitedItem*)item + incognito:(BOOL)incognito + atIndex:(NSInteger)index { + [self logMostVisitedOpening:item atIndex:index]; + [self openNewTabWithURL:item.URL incognito:incognito]; +} + +- (void)openNewTabWithMostVisitedItem:(ContentSuggestionsMostVisitedItem*)item + incognito:(BOOL)incognito { + NSInteger index = + [self.suggestionsViewController.collectionViewModel indexPathForItem:item] + .item; + [self openNewTabWithMostVisitedItem:item incognito:incognito atIndex:index]; +} + +- (void)removeMostVisited:(ContentSuggestionsMostVisitedItem*)item { + base::RecordAction(base::UserMetricsAction("MostVisited_UrlBlacklisted")); + [self.suggestionsMediator blacklistMostVisitedURL:item.URL]; + [self showMostVisitedUndoForURL:item.URL]; +} + +#pragma mark - ContentSuggestionsHeaderViewControllerDelegate + +- (BOOL)isContextMenuVisible { + return self.alertCoordinator.isVisible; +} + +- (BOOL)isScrolledToTop { + return self.suggestionsViewController.scrolledToTop; +} + +#pragma mark - Private + +// Opens the |URL| in a new tab |incognito| or not. +- (void)openNewTabWithURL:(const GURL&)URL incognito:(BOOL)incognito { + // Open the tab in background if it is non-incognito only. + [self.dispatcher webPageOrderedOpen:URL + referrer:web::Referrer() + inIncognito:incognito + inBackground:!incognito + appendTo:kCurrentTab]; +} + +// Logs a histogram due to a Most Visited item being opened. +- (void)logMostVisitedOpening:(ContentSuggestionsMostVisitedItem*)item + atIndex:(NSInteger)mostVisitedIndex { + [self.NTPMetrics + recordAction:new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY]; + base::RecordAction(base::UserMetricsAction("MobileNTPMostVisited")); + + ntp_tiles::metrics::RecordTileClick(mostVisitedIndex, item.source, + [item tileType]); +} + +// Shows a snackbar with an action to undo the removal of the most visited item +// with a |URL|. +- (void)showMostVisitedUndoForURL:(GURL)URL { + GURL copiedURL = URL; + + MDCSnackbarMessageAction* action = [[MDCSnackbarMessageAction alloc] init]; + __weak NTPHomeMediator* weakSelf = self; + action.handler = ^{ + NTPHomeMediator* strongSelf = weakSelf; + if (!strongSelf) + return; + [strongSelf.suggestionsMediator whitelistMostVisitedURL:copiedURL]; + }; + action.title = l10n_util::GetNSString(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE); + action.accessibilityIdentifier = @"Undo"; + + TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); + MDCSnackbarMessage* message = [MDCSnackbarMessage + messageWithText:l10n_util::GetNSString( + IDS_IOS_NEW_TAB_MOST_VISITED_ITEM_REMOVED)]; + message.action = action; + message.category = @"MostVisitedUndo"; + [MDCSnackbarManager showMessage:message]; +} + +@end
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_metrics.h b/ios/chrome/browser/content_suggestions/ntp_home_metrics.h index df1b913..0cd7b4bd 100644 --- a/ios/chrome/browser/content_suggestions/ntp_home_metrics.h +++ b/ios/chrome/browser/content_suggestions/ntp_home_metrics.h
@@ -7,6 +7,12 @@ #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" +#import "ios/chrome/browser/metrics/new_tab_page_uma.h" + +namespace ios { +class ChromeBrowserState; +} + namespace ntp_home { // Records an NTP impression of type |impression_type|. @@ -14,4 +20,15 @@ } // namespace ntp_home +// Metrics recorder for the action used to potentially leave the NTP. +@interface NTPHomeMetrics : NSObject + +- (nonnull instancetype)initWithBrowserState: + (ios::ChromeBrowserState* _Nonnull)browserState NS_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init NS_UNAVAILABLE; + +- (void)recordAction:(new_tab_page_uma::ActionType)action; + +@end + #endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_NTP_HOME_METRICS_H_
diff --git a/ios/chrome/browser/content_suggestions/ntp_home_metrics.mm b/ios/chrome/browser/content_suggestions/ntp_home_metrics.mm index 958c09c..964250f 100644 --- a/ios/chrome/browser/content_suggestions/ntp_home_metrics.mm +++ b/ios/chrome/browser/content_suggestions/ntp_home_metrics.mm
@@ -17,3 +17,25 @@ } } // namespace ntp_home + +@interface NTPHomeMetrics () +@property(nonatomic, assign) ios::ChromeBrowserState* browserState; +@end + +@implementation NTPHomeMetrics + +@synthesize browserState = _browserState; + +- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { + self = [super init]; + if (self) { + _browserState = browserState; + } + return self; +} + +- (void)recordAction:(new_tab_page_uma::ActionType)action { + new_tab_page_uma::RecordAction(self.browserState, action); +} + +@end
diff --git a/ios/chrome/browser/context_menu/context_menu_egtest.mm b/ios/chrome/browser/context_menu/context_menu_egtest.mm index 243d1b5..a40d0d916 100644 --- a/ios/chrome/browser/context_menu/context_menu_egtest.mm +++ b/ios/chrome/browser/context_menu/context_menu_egtest.mm
@@ -6,6 +6,7 @@ #import <UIKit/UIKit.h> #import <XCTest/XCTest.h> +#include "base/ios/ios_util.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/chrome/test/app/chrome_test_util.h" @@ -161,6 +162,13 @@ // Tests "Open in New Tab" on context menu. - (void)testContextMenuOpenInNewTab { + // TODO(crbug.com/764691): This test is flaky on iOS 11. The bots retry + // failures, so this test sometimes appears green because it passes on the + // retry. + if (base::ios::IsRunningOnIOS11OrLater()) { + EARL_GREY_TEST_DISABLED(@"Test disabled on iOS 11."); + } + // Set up test simple http server. std::map<GURL, std::string> responses; GURL initialURL = web::test::HttpServer::MakeUrl(kUrlInitialPage);
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc index d769bc2..e51732c6 100644 --- a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc +++ b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
@@ -26,6 +26,7 @@ #include "components/ntp_snippets/category_rankers/constant_category_ranker.h" #include "components/ntp_snippets/content_suggestions_service.h" #include "components/ntp_snippets/features.h" +#include "components/ntp_snippets/logger.h" #include "components/ntp_snippets/ntp_snippets_constants.h" #include "components/ntp_snippets/reading_list/reading_list_suggestions_provider.h" #include "components/ntp_snippets/remote/persistent_scheduler.h" @@ -56,6 +57,7 @@ using image_fetcher::ImageFetcherImpl; using ntp_snippets::ContentSuggestionsService; using ntp_snippets::GetFetchEndpoint; +using ntp_snippets::Logger; using ntp_snippets::PersistentScheduler; using ntp_snippets::RemoteSuggestionsDatabase; using ntp_snippets::RemoteSuggestionsFetcherImpl; @@ -112,11 +114,13 @@ auto user_classifier = base::MakeUnique<UserClassifier>( prefs, base::MakeUnique<base::DefaultClock>()); + auto debug_logger = base::MakeUnique<Logger>(); + // TODO(crbug.com/676249): Implement a persistent scheduler for iOS. auto scheduler = base::MakeUnique<RemoteSuggestionsSchedulerImpl>( /*persistent_scheduler=*/nullptr, user_classifier.get(), prefs, GetApplicationContext()->GetLocalState(), - base::MakeUnique<base::DefaultClock>()); + base::MakeUnique<base::DefaultClock>(), debug_logger.get()); // Create the ContentSuggestionsService. SigninManager* signin_manager = @@ -134,7 +138,7 @@ base::MakeUnique<ContentSuggestionsService>( State::ENABLED, signin_manager, history_service, large_icon_service, prefs, std::move(category_ranker), std::move(user_classifier), - std::move(scheduler)); + std::move(scheduler), std::move(debug_logger)); // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. return std::move(service); @@ -195,7 +199,7 @@ base::MakeUnique<RemoteSuggestionsStatusServiceImpl>(signin_manager, prefs, pref_name), /*prefetched_pages_tracker=*/nullptr, - /*breaking_news_raw_data_provider*/ nullptr); + /*breaking_news_raw_data_provider*/ nullptr, service->debug_logger()); service->remote_suggestions_scheduler()->SetProvider(provider.get()); service->set_remote_suggestions_provider(provider.get());
diff --git a/ios/chrome/browser/passwords/credential_manager.mm b/ios/chrome/browser/passwords/credential_manager.mm index dd17df7..79863a0 100644 --- a/ios/chrome/browser/passwords/credential_manager.mm +++ b/ios/chrome/browser/passwords/credential_manager.mm
@@ -101,12 +101,10 @@ } if (command == "credentials.store") { CredentialInfo credential; - if (!ParseCredentialDictionary(json, &credential)) { - // TODO(crbug.com/435047): Refactor ParseCredentialDictionary method to - // provide more meaningful error message. - RejectCredentialPromiseWithTypeError( - web_state_, promise_id, - base::ASCIIToUTF16("Invalid Credential object.")); + std::string parse_message; + if (!ParseCredentialDictionary(json, &credential, &parse_message)) { + RejectCredentialPromiseWithTypeError(web_state_, promise_id, + base::UTF8ToUTF16(parse_message)); return false; } impl_.Store(credential,
diff --git a/ios/chrome/browser/passwords/credential_manager_util.h b/ios/chrome/browser/passwords/credential_manager_util.h index c0b36241..2ba6b79 100644 --- a/ios/chrome/browser/passwords/credential_manager_util.h +++ b/ios/chrome/browser/passwords/credential_manager_util.h
@@ -59,9 +59,6 @@ extern const char kCredentialTypePassword[]; extern const char kCredentialTypeFederated[]; -// TODO(crbug.com/435048): For ParseCredentialDictionary method, add ability to -// pass an error message back to the caller. - // Returns value of Parse* methods below is false if |json| is invalid, which // means it is missing required fields, contains fields of wrong type or // unexpected values. Otherwise return value is true. @@ -80,9 +77,11 @@ bool ParseCredentialType(const base::DictionaryValue& json, password_manager::CredentialType* credential_type); // Parses dictionary representing JavaScript Credential object into -// CredentialInfo. +// CredentialInfo. If parsing fails, reason message is stored in |reason|. +// |reason| can be null, then it is ignored. bool ParseCredentialDictionary(const base::DictionaryValue& json, - password_manager::CredentialInfo* credential); + password_manager::CredentialInfo* credential, + std::string* reason); // Checks if |web_state|'s content is a secure HTML. This is done in order to // ignore API calls from insecure context.
diff --git a/ios/chrome/browser/passwords/credential_manager_util.mm b/ios/chrome/browser/passwords/credential_manager_util.mm index 8d3d527..6a0c1fc 100644 --- a/ios/chrome/browser/passwords/credential_manager_util.mm +++ b/ios/chrome/browser/passwords/credential_manager_util.mm
@@ -138,9 +138,13 @@ } bool ParseCredentialDictionary(const base::DictionaryValue& json, - CredentialInfo* credential) { + CredentialInfo* credential, + std::string* reason) { if (!json.GetString(kCredentialIdKey, &credential->id)) { // |id| is required. + if (reason) { + *reason = "no valid 'id' field"; + } return false; } json.GetString(kCredentialNameKey, &credential->name); @@ -150,11 +154,17 @@ if (!credential->icon.is_valid() || !web::IsOriginSecure(credential->icon)) { // |iconUrl| is either not a valid URL or not a secure URL. + if (reason) { + *reason = "iconURL is either invalid or insecure URL"; + } return false; } } if (!ParseCredentialType(json, &credential->type)) { // Credential has invalid |type| + if (reason) { + *reason = "Credential has invalid type"; + } return false; } if (credential->type == CredentialType::CREDENTIAL_TYPE_PASSWORD) { @@ -162,6 +172,9 @@ &credential->password) || credential->password.empty()) { // |password| field is required for PasswordCredential. + if (reason) { + *reason = "no valid 'password' field"; + } return false; } } @@ -171,6 +184,9 @@ if (!GURL(federation).is_valid()) { // |provider| field must be a valid URL. See // https://w3c.github.io/webappsec-credential-management/#provider-identification + if (reason) { + *reason = "no valid 'provider' field"; + } return false; } credential->federation = url::Origin(GURL(federation));
diff --git a/ios/chrome/browser/passwords/credential_manager_util_unittest.cc b/ios/chrome/browser/passwords/credential_manager_util_unittest.cc index 99bc9e11..872d5090 100644 --- a/ios/chrome/browser/passwords/credential_manager_util_unittest.cc +++ b/ios/chrome/browser/passwords/credential_manager_util_unittest.cc
@@ -133,34 +133,39 @@ // Credential containing only common fields would return false. base::DictionaryValue json = BuildExampleValidPasswordCredential(); CredentialInfo credential; + std::string reason; // Valid dictionary should be parsed correctly and ParseCredentialDictionary // should return true. - EXPECT_TRUE(ParseCredentialDictionary(json, &credential)); + EXPECT_TRUE(ParseCredentialDictionary(json, &credential, &reason)); EXPECT_EQ(base::ASCIIToUTF16("john@doe.com"), credential.id); EXPECT_EQ(base::ASCIIToUTF16("John Doe"), credential.name); EXPECT_EQ(GURL(kTestIconUrl), credential.icon); // |id| field is required. json.Remove(kCredentialIdKey, nullptr); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'id' field"); // |iconURL| field is not required. json = BuildExampleValidPasswordCredential(); json.Remove(kCredentialIconKey, nullptr); - EXPECT_TRUE(ParseCredentialDictionary(json, &credential)); + EXPECT_TRUE(ParseCredentialDictionary(json, &credential, &reason)); // If Credential has |iconURL| field, it must be a valid URL. json.SetString(kCredentialIconKey, "not a valid url"); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "iconURL is either invalid or insecure URL"); // If Credential has |iconURL| field, it must be a secure URL. + reason = std::string(); json.SetString(kCredentialIconKey, "http://example.com"); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "iconURL is either invalid or insecure URL"); // Check that empty |iconURL| field is treated as no |iconURL| field. json.SetString(kCredentialIconKey, ""); - EXPECT_TRUE(ParseCredentialDictionary(json, &credential)); + EXPECT_TRUE(ParseCredentialDictionary(json, &credential, &reason)); } // Checks that |password| and |type| fields of PasswordCredential are parsed @@ -168,20 +173,23 @@ TEST(CredentialManagerUtilTest, ParsePasswordCredential) { base::DictionaryValue json = BuildExampleValidPasswordCredential(); CredentialInfo credential; + std::string reason; // Valid dictionary should be parsed correctly and ParseCredentialDictionary // should return true. - EXPECT_TRUE(ParseCredentialDictionary(json, &credential)); + EXPECT_TRUE(ParseCredentialDictionary(json, &credential, &reason)); EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_PASSWORD, credential.type); EXPECT_EQ(base::ASCIIToUTF16("admin123"), credential.password); // |password| field is required. json.Remove(kPasswordCredentialPasswordKey, nullptr); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'password' field"); // |password| field is cannot be an empty string. json.SetString(kPasswordCredentialPasswordKey, ""); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'password' field"); } // Checks that |provider| and |type| fields of FederatedCredential are parsed @@ -189,24 +197,28 @@ TEST(CredentialManagerUtilTest, ParseFederatedCredential) { base::DictionaryValue json = BuildExampleValidFederatedCredential(); CredentialInfo credential; + std::string reason; // Valid dictionary should be parsed correctly and ParseCredentialDictionary // should return true. - EXPECT_TRUE(ParseCredentialDictionary(json, &credential)); + EXPECT_TRUE(ParseCredentialDictionary(json, &credential, &reason)); EXPECT_EQ(CredentialType::CREDENTIAL_TYPE_FEDERATED, credential.type); EXPECT_EQ(GURL(kTestWebOrigin), credential.federation.GetURL()); // |provider| field is required. json.Remove(kFederatedCredentialProviderKey, nullptr); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'provider' field"); // |provider| field cannot be an empty string. json.SetString(kFederatedCredentialProviderKey, ""); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'provider' field"); // |provider| field must be a valid URL. json.SetString(kFederatedCredentialProviderKey, "not a valid URL"); - EXPECT_FALSE(ParseCredentialDictionary(json, &credential)); + EXPECT_FALSE(ParseCredentialDictionary(json, &credential, &reason)); + EXPECT_EQ(reason, "no valid 'provider' field"); } // Checks that |providers| field of FederatedCredentialRequestOptions is
diff --git a/ios/chrome/browser/sync/BUILD.gn b/ios/chrome/browser/sync/BUILD.gn index 6891c204..71c46c0 100644 --- a/ios/chrome/browser/sync/BUILD.gn +++ b/ios/chrome/browser/sync/BUILD.gn
@@ -19,6 +19,8 @@ "sync_setup_service.h", "sync_setup_service_factory.cc", "sync_setup_service_factory.h", + "synced_sessions_bridge.h", + "synced_sessions_bridge.mm", ] deps = [ "//base",
diff --git a/ios/chrome/browser/ui/sync/synced_sessions_bridge.h b/ios/chrome/browser/sync/synced_sessions_bridge.h similarity index 89% rename from ios/chrome/browser/ui/sync/synced_sessions_bridge.h rename to ios/chrome/browser/sync/synced_sessions_bridge.h index 6d1888e2..8777d03 100644 --- a/ios/chrome/browser/ui/sync/synced_sessions_bridge.h +++ b/ios/chrome/browser/sync/synced_sessions_bridge.h
@@ -2,16 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_SYNC_SYNCED_SESSIONS_BRIDGE_H_ -#define IOS_CHROME_BROWSER_UI_SYNC_SYNCED_SESSIONS_BRIDGE_H_ +#ifndef IOS_CHROME_BROWSER_SYNC_SYNCED_SESSIONS_BRIDGE_H_ +#define IOS_CHROME_BROWSER_SYNC_SYNCED_SESSIONS_BRIDGE_H_ -#import <UIKit/UIKit.h> +#import <Foundation/Foundation.h> #import "base/ios/weak_nsobject.h" #include "components/signin/core/browser/signin_manager_base.h" #include "components/sync/driver/sync_service_observer.h" #import "ios/chrome/browser/sync/sync_observer_bridge.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" namespace ios { class ChromeBrowserState; @@ -66,4 +65,4 @@ } // namespace synced_sessions -#endif // IOS_CHROME_BROWSER_UI_SYNC_SYNCED_SESSIONS_BRIDGE_H_ +#endif // IOS_CHROME_BROWSER_SYNC_SYNCED_SESSIONS_BRIDGE_H_
diff --git a/ios/chrome/browser/ui/sync/synced_sessions_bridge.mm b/ios/chrome/browser/sync/synced_sessions_bridge.mm similarity index 97% rename from ios/chrome/browser/ui/sync/synced_sessions_bridge.mm rename to ios/chrome/browser/sync/synced_sessions_bridge.mm index 1847d7d..84c83fd 100644 --- a/ios/chrome/browser/ui/sync/synced_sessions_bridge.mm +++ b/ios/chrome/browser/sync/synced_sessions_bridge.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #include "components/browser_sync/profile_sync_service.h" #include "components/signin/core/browser/signin_manager.h"
diff --git a/ios/chrome/browser/tabs/tab_helper_util.mm b/ios/chrome/browser/tabs/tab_helper_util.mm index 0ab06e3..88d911b9 100644 --- a/ios/chrome/browser/tabs/tab_helper_util.mm +++ b/ios/chrome/browser/tabs/tab_helper_util.mm
@@ -63,7 +63,6 @@ IOSChromeSyncedTabDelegate::CreateForWebState(web_state); InfoBarManagerImpl::CreateForWebState(web_state); IOSSecurityStateTabHelper::CreateForWebState(web_state); - RepostFormTabHelper::CreateForWebState(web_state); BlockedPopupTabHelper::CreateForWebState(web_state); FindTabHelper::CreateForWebState(web_state, tab.findInPageControllerDelegate); StoreKitTabHelper::CreateForWebState(web_state);
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index a324cf0..ff9d2f9 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -322,9 +322,9 @@ "//ios/chrome/browser/ui/qr_scanner/requirements", "//ios/chrome/browser/ui/reading_list", "//ios/chrome/browser/ui/sad_tab:coordinator", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/ui/stack_view", "//ios/chrome/browser/ui/static_content", - "//ios/chrome/browser/ui/sync", "//ios/chrome/browser/ui/tab_switcher", "//ios/chrome/browser/ui/tabs", "//ios/chrome/browser/ui/tools_menu", @@ -333,6 +333,7 @@ "//ios/chrome/browser/ui/voice", "//ios/chrome/browser/upgrade", "//ios/chrome/browser/web", + "//ios/chrome/browser/web:tab_helper_delegates", "//ios/chrome/browser/web:web_internal", "//ios/chrome/browser/web_state_list", "//ios/chrome/common",
diff --git a/ios/chrome/browser/ui/bookmarks/BUILD.gn b/ios/chrome/browser/ui/bookmarks/BUILD.gn index bfafeec..b41148be 100644 --- a/ios/chrome/browser/ui/bookmarks/BUILD.gn +++ b/ios/chrome/browser/ui/bookmarks/BUILD.gn
@@ -111,6 +111,7 @@ "//ios/chrome/browser/favicon", "//ios/chrome/browser/metrics:metrics_internal", "//ios/chrome/browser/signin", + "//ios/chrome/browser/sync", "//ios/chrome/browser/tabs", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/alert_coordinator", @@ -126,7 +127,6 @@ "//ios/chrome/browser/ui/keyboard", "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/ntp", - "//ios/chrome/browser/ui/sync", "//ios/chrome/browser/undo", "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/ui",
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_collection_view.mm b/ios/chrome/browser/ui/bookmarks/bookmark_collection_view.mm index f1e2a3f..860b4026 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_collection_view.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_collection_view.mm
@@ -27,6 +27,7 @@ #include "ios/chrome/browser/experimental_flags.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" #include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_consumer.h" @@ -37,7 +38,6 @@ #import "ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h" #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h" #import "ios/chrome/browser/ui/commands/application_commands.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h"
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.mm b/ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.mm index 32fb365..6db783b 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_collection_view_background.mm
@@ -37,6 +37,7 @@ _emptyBookmarksImageView = [self newBookmarkImageView]; [self addSubview:_emptyBookmarksImageView]; _emptyBookmarksLabel = [self newEmptyBookmarkLabel]; + _emptyBookmarksLabel.accessibilityIdentifier = @"empty_background_label"; [self addSubview:_emptyBookmarksLabel]; } return self;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm index a89ff8a..6b019516 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -439,6 +439,11 @@ } if (nodes.size() == 0) { + // if nothing to select, exit edit mode. + if (![self.bookmarksTableView hasBookmarksOrFolders]) { + [self setContextBarState:BookmarksContextBarDefault]; + return; + } [self setContextBarState:BookmarksContextBarBeginSelection]; return; } @@ -511,6 +516,14 @@ node, _rootNode, position, self.bookmarks, self.browserState); } +- (void)bookmarkTableViewRefreshContextBar:(BookmarkTableView*)view { + // At default state, the enable state of context bar buttons could change + // during refresh. + if (self.contextBarState == BookmarksContextBarDefault) { + [self setBookmarksContextBarButtonsDefaultState]; + } +} + #pragma mark - BookmarkFolderViewControllerDelegate - (void)folderPicker:(BookmarkFolderViewController*)folderPicker @@ -1245,7 +1258,8 @@ IDS_IOS_BOOKMARK_CONTEXT_BAR_NEW_FOLDER) forButton:ContextBarLeadingButton]; [self.contextBar setButtonVisibility:YES forButton:ContextBarLeadingButton]; - [self.contextBar setButtonEnabled:YES forButton:ContextBarLeadingButton]; + [self.contextBar setButtonEnabled:[self.bookmarksTableView allowsNewFolder] + forButton:ContextBarLeadingButton]; [self.contextBar setButtonStyle:ContextBarButtonStyleDefault forButton:ContextBarLeadingButton]; @@ -1257,7 +1271,9 @@ setButtonTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_BAR_SELECT) forButton:ContextBarTrailingButton]; [self.contextBar setButtonVisibility:YES forButton:ContextBarTrailingButton]; - [self.contextBar setButtonEnabled:YES forButton:ContextBarTrailingButton]; + [self.contextBar + setButtonEnabled:[self.bookmarksTableView hasBookmarksOrFolders] + forButton:ContextBarTrailingButton]; } - (void)setBookmarksContextBarSelectionStartState {
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_table_view.h b/ios/chrome/browser/ui/bookmarks/bookmark_table_view.h index 20113c4..7dad5a0b 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_table_view.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_table_view.h
@@ -59,6 +59,10 @@ - (void)bookmarkTableView:(BookmarkTableView*)view didMoveNode:(const bookmarks::BookmarkNode*)node toPosition:(int)position; + +// Tells the delegate to refresh the context bar. +- (void)bookmarkTableViewRefreshContextBar:(BookmarkTableView*)view; + @end @interface BookmarkTableView : UIView @@ -98,6 +102,12 @@ // Returns a vector of edit nodes. - (std::vector<const bookmarks::BookmarkNode*>)getEditNodesInVector; +// Returns if current root node has bookmarks or folders. +- (BOOL)hasBookmarksOrFolders; + +// Returns if current root node allows new folder to be created on it. +- (BOOL)allowsNewFolder; + @end #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TABLE_VIEW_H_
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_table_view.mm b/ios/chrome/browser/ui/bookmarks/bookmark_table_view.mm index 961d8ff..7cc29bc 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_table_view.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_table_view.mm
@@ -17,6 +17,7 @@ #include "ios/chrome/browser/experimental_flags.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" #include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_consumer.h" @@ -28,7 +29,6 @@ #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell.h" #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_table_signin_promo_cell.h" #import "ios/chrome/browser/ui/commands/application_commands.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" #include "ios/chrome/grit/ios_strings.h" #include "skia/ext/skia_utils_ios.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -267,6 +267,16 @@ return nodes; } +- (BOOL)hasBookmarksOrFolders { + return _currentRootNode && !_currentRootNode->empty(); +} + +- (BOOL)allowsNewFolder { + // When the current root node has been removed remotely (becomes NULL), + // creating new folder is forbidden. + return _currentRootNode != NULL; +} + #pragma mark - UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView { @@ -592,6 +602,7 @@ [self showEmptyOrLoadingSpinnerBackgroundIfNeeded]; [self cancelAllFaviconLoads]; [self resetEditNodes]; + [self.delegate bookmarkTableViewRefreshContextBar:self]; [self.tableView reloadData]; } @@ -664,7 +675,7 @@ return; } - if (!_currentRootNode || _currentRootNode->empty()) { + if (![self hasBookmarksOrFolders]) { [self showEmptyBackground]; } else { // Hides the empty bookmarks background if it is showing.
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm index ff86a5e..a269838 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm
@@ -153,7 +153,7 @@ performAction:grey_swipeFastInDirection(kGREYDirectionLeft)]; // Verify context bar does not change when "Delete" shows up. - [self verifyContextBarInDefaultState]; + [self verifyContextBarInDefaultStateWithSelectEnabled:YES]; // Delete it. [[EarlGrey selectElementWithMatcher:BookmarksDeleteSwipeButton()] @@ -171,7 +171,7 @@ assertWithMatcher:grey_notNil()]; // Verify context bar remains in default state. - [self verifyContextBarInDefaultState]; + [self verifyContextBarInDefaultStateWithSelectEnabled:YES]; } // Tests that the bookmark context bar is shown in MobileBookmarks. @@ -414,7 +414,7 @@ // Cancel edit mode [BookmarksNewGenTestCase closeContextBarEditMode]; - [self verifyContextBarInDefaultState]; + [self verifyContextBarInDefaultStateWithSelectEnabled:YES]; } - (void)testContextMenuForSingleURLSelection { @@ -1631,7 +1631,63 @@ assertWithMatcher:grey_notNil()]; // Verify context bar does not change after editing folder name. - [self verifyContextBarInDefaultState]; + [self verifyContextBarInDefaultStateWithSelectEnabled:YES]; +} + +- (void)testEmptyBackgroundAndSelectButton { + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Test disabled on iPad."); + } + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration); + + [BookmarksNewGenTestCase setupStandardBookmarks]; + [BookmarksNewGenTestCase openBookmarks]; + [BookmarksNewGenTestCase openMobileBookmarks]; + + // Enter Folder 1.1 (which is empty) + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1.1")] + performAction:grey_tap()]; + + // Verify the empty background appears. + [self verifyEmptyBackgroundAppears]; + + // Come back to Mobile Bookmarks. + [[EarlGrey selectElementWithMatcher:BookmarksBackButton()] + performAction:grey_tap()]; + + // Change to edit mode, using context menu. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID( + @"context_bar_trailing_button")] + performAction:grey_tap()]; + + // Select every URL and folder. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Second URL")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"First URL")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"French URL")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1.1")] + performAction:grey_tap()]; + + // Tap delete on context menu. + [[EarlGrey selectElementWithMatcher:ContextBarLeadingButtonWithLabel( + [BookmarksNewGenTestCase + contextBarDeleteString])] + performAction:grey_tap()]; + + // Wait for Undo toast to go away from screen. + [BookmarksNewGenTestCase waitForUndoToastToGoAway]; + + // Verify edit mode is close automatically (context bar switched back to + // default state) and select button is disabled. + [self verifyContextBarInDefaultStateWithSelectEnabled:NO]; + + // Verify the empty background appears. + [self verifyEmptyBackgroundAppears]; } #pragma mark - Helpers @@ -1861,7 +1917,7 @@ assertWithMatcher:grey_sufficientlyVisible()]; } -- (void)verifyContextBarInDefaultState { +- (void)verifyContextBarInDefaultStateWithSelectEnabled:(BOOL)selectEnabled { // Verify the context bar is shown. [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"context_bar")] assertWithMatcher:grey_notNil()]; @@ -1878,7 +1934,12 @@ [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( [BookmarksNewGenTestCase contextBarSelectString])] - assertWithMatcher:grey_allOf(grey_notNil(), grey_enabled(), nil)]; + assertWithMatcher:grey_allOf(grey_notNil(), + selectEnabled + ? grey_enabled() + : grey_accessibilityTrait( + UIAccessibilityTraitNotEnabled), + nil)]; } - (void)verifyFolderFlowIsClosed { @@ -1890,6 +1951,12 @@ assertWithMatcher:grey_notVisible()]; } +- (void)verifyEmptyBackgroundAppears { + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(@"empty_background_label")] + assertWithMatcher:grey_sufficientlyVisible()]; +} + // Context bar strings. + (NSString*)contextBarNewFolderString { return l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_BAR_NEW_FOLDER); @@ -1932,7 +1999,11 @@ } // TODO(crbug.com/695749): Add egtests for: -// 1. Spinner and empty background. +// 1. Spinner background. // 2. Reorder bookmarks. +// 3. Current root node removed: Verify that the New Folder, Select button are +// disabled and empty background appears when _currentRootNode becomes NULL +// (maybe programmatically remove the current root node from model, and trigger +// a sync). @end
diff --git a/ios/chrome/browser/ui/browser_list/browser_web_state_list_delegate.mm b/ios/chrome/browser/ui/browser_list/browser_web_state_list_delegate.mm index 06ca27d..dac18c2 100644 --- a/ios/chrome/browser/ui/browser_list/browser_web_state_list_delegate.mm +++ b/ios/chrome/browser/ui/browser_list/browser_web_state_list_delegate.mm
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/find_in_page/find_tab_helper.h" #import "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" #import "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" +#import "ios/chrome/browser/web/sad_tab_tab_helper.h" #import "ios/chrome/browser/web/tab_id_tab_helper.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -20,6 +21,7 @@ void BrowserWebStateListDelegate::WillAddWebState(web::WebState* web_state) { FindTabHelper::CreateForWebState(web_state, nil); + SadTabTabHelper::CreateForWebState(web_state, nil); IOSChromeSessionTabHelper::CreateForWebState(web_state); IOSSecurityStateTabHelper::CreateForWebState(web_state); TabIdTabHelper::CreateForWebState(web_state);
diff --git a/ios/chrome/browser/ui/browser_view_controller.h b/ios/chrome/browser/ui/browser_view_controller.h index d66e4eb4..a8c7a6dc 100644 --- a/ios/chrome/browser/ui/browser_view_controller.h +++ b/ios/chrome/browser/ui/browser_view_controller.h
@@ -142,10 +142,6 @@ // Dismisses all presented views then calls |completion|. - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion; -// Returns a set with the names of the files received from other applications -// that are bookmarked or referenced by an open or recently closed tab. -- (NSSet*)referencedExternalFiles; - // Removes files received from other applications. If |immediately| is YES, // initiates the removal of files immediately. |completionHandler| is called // when files have been removed.
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 4223e0f..f27dba8 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -102,6 +102,7 @@ #import "ios/chrome/browser/ui/activity_services/requirements/activity_service_presentation.h" #import "ios/chrome/browser/ui/activity_services/requirements/activity_service_snackbar.h" #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" +#import "ios/chrome/browser/ui/alert_coordinator/repost_form_coordinator.h" #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" #import "ios/chrome/browser/ui/background_generator.h" #import "ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h" @@ -150,11 +151,11 @@ #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h" #include "ios/chrome/browser/ui/rtl_geometry.h" #import "ios/chrome/browser/ui/sad_tab/sad_tab_legacy_coordinator.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/side_swipe/side_swipe_controller.h" #import "ios/chrome/browser/ui/stack_view/card_view.h" #import "ios/chrome/browser/ui/stack_view/page_animation_util.h" #import "ios/chrome/browser/ui/static_content/static_html_native_content.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.h" #import "ios/chrome/browser/ui/tabs/tab_strip_controller.h" #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" @@ -173,6 +174,7 @@ #import "ios/chrome/browser/web/passkit_dialog_provider.h" #include "ios/chrome/browser/web/print_tab_helper.h" #import "ios/chrome/browser/web/repost_form_tab_helper.h" +#import "ios/chrome/browser/web/repost_form_tab_helper_delegate.h" #import "ios/chrome/browser/web/sad_tab_tab_helper.h" #include "ios/chrome/browser/web/web_state_printer.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -366,6 +368,7 @@ PassKitDialogProvider, PreloadControllerDelegate, QRScannerPresenting, + RepostFormTabHelperDelegate, SKStoreProductViewControllerDelegate, SnapshotOverlayProvider, StoreKitLauncher, @@ -496,9 +499,6 @@ // The image fetcher used to save images and perform image-based searches. std::unique_ptr<image_fetcher::IOSImageDataFetcherWrapper> _imageFetcher; - // Card side swipe view. - CardSideSwipeView* _sideSwipeView; - // Dominant color cache. Key: (NSString*)url, val: (UIColor*)dominantColor. NSMutableDictionary* _dominantColorCache; @@ -544,6 +544,9 @@ // Coordinator for Page Info UI. PageInfoLegacyCoordinator* _pageInfoCoordinator; + + // Coordinator for displaying Repost Form dialog. + RepostFormCoordinator* _repostFormCoordinator; } // The browser's side swipe controller. Lazily instantiated on the first call. @@ -2372,6 +2375,7 @@ if (!SadTabTabHelper::FromWebState(tab.webState)) SadTabTabHelper::CreateForWebState(tab.webState, _sadTabCoordinator); PrintTabHelper::CreateForWebState(tab.webState, self); + RepostFormTabHelper::CreateForWebState(tab.webState, self); } - (void)uninstallDelegatesForTab:(Tab*)tab { @@ -2419,32 +2423,12 @@ #pragma mark - External files -- (NSSet*)referencedExternalFiles { - NSSet* filesReferencedByTabs = [_model currentlyReferencedExternalFiles]; - - // TODO(noyau): this is incorrect, the caller should know that the model is - // not loaded yet. - if (!_bookmarkModel || !_bookmarkModel->loaded()) - return filesReferencedByTabs; - - std::vector<bookmarks::BookmarkModel::URLAndTitle> bookmarks; - _bookmarkModel->GetBookmarks(&bookmarks); - NSMutableSet* bookmarkedFiles = [NSMutableSet set]; - for (const auto& bookmark : bookmarks) { - GURL bookmarkUrl = bookmark.url; - if (UrlIsExternalFileReference(bookmarkUrl)) { - [bookmarkedFiles - addObject:base::SysUTF8ToNSString(bookmarkUrl.ExtractFileName())]; - } - } - return [filesReferencedByTabs setByAddingObjectsFromSet:bookmarkedFiles]; -} - - (void)removeExternalFilesImmediately:(BOOL)immediately completionHandler:(ProceduralBlock)completionHandler { DCHECK_CURRENTLY_ON(web::WebThread::UI); DCHECK(!_isOffTheRecord); - _externalFileRemover.reset(new ExternalFileRemover(self)); + _externalFileRemover = + std::make_unique<ExternalFileRemover>(self.browserState); // Delay the cleanup of the unreferenced files received from other apps // to not impact startup performance. int delay = immediately ? 0 : kExternalFilesCleanupDelaySeconds; @@ -5122,4 +5106,22 @@ [self printTab]; } +#pragma mark - RepostFormTabHelperDelegate + +- (void)repostFormTabHelper:(RepostFormTabHelper*)helper + presentRepostFromDialogAtPoint:(CGPoint)location + completionHandler:(void (^)(BOOL))completion { + _repostFormCoordinator = [[RepostFormCoordinator alloc] + initWithBaseViewController:self + dialogLocation:location + webState:helper->web_state() + completionHandler:completion]; + [_repostFormCoordinator start]; +} + +- (void)repostFormTabHelperDismissRepostFormDialog: + (RepostFormTabHelper*)helper { + _repostFormCoordinator = nil; +} + @end
diff --git a/ios/chrome/browser/ui/coordinators/BUILD.gn b/ios/chrome/browser/ui/coordinators/BUILD.gn index c8a4c74..72e0868 100644 --- a/ios/chrome/browser/ui/coordinators/BUILD.gn +++ b/ios/chrome/browser/ui/coordinators/BUILD.gn
@@ -24,6 +24,8 @@ sources = [ "browser_coordinator_test.h", "browser_coordinator_test.mm", + "browser_coordinator_test_util.h", + "browser_coordinator_test_util.mm", ] configs += [ "//build/config/compiler:enable_arc" ] @@ -35,6 +37,7 @@ "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/ui/browser_list", "//ios/chrome/browser/web_state_list:test_support", + "//ios/testing:ios_test_support", "//testing/gtest", ] }
diff --git a/ios/chrome/browser/ui/coordinators/OWNERS b/ios/chrome/browser/ui/coordinators/OWNERS new file mode 100644 index 0000000..1f7a7b8 --- /dev/null +++ b/ios/chrome/browser/ui/coordinators/OWNERS
@@ -0,0 +1,2 @@ +kkhorimoto@chromium.org +marq@chromium.org
diff --git a/ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h b/ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h index b6e0c2b6..3dea2c3 100644 --- a/ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h +++ b/ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h
@@ -35,7 +35,7 @@ // YES if the receiver has been started; NO (the default) otherwise. Stopping // the receiver resets this property to NO. -@property(nonatomic, readonly) BOOL started; +@property(nonatomic, readonly, getter=isStarted) BOOL started; // YES if the receiver is acting as an overlay coordinator; NO (the default) // otherwise. @@ -62,6 +62,12 @@ // coordinator. - (void)willBeRemovedFromParentCoordinator; +// Called when this coordinator's UIViewController has finished being presented. +- (void)viewControllerWasActivated; + +// Called when this coordinator's UIViewController has finished being dismissed. +- (void)viewControllerWasDeactivated; + // Called when a child coordinator did start. This is a blank template method. // Subclasses can override this method when they need to know when their // children start.
diff --git a/ios/chrome/browser/ui/coordinators/browser_coordinator.mm b/ios/chrome/browser/ui/coordinators/browser_coordinator.mm index cde65dd..61a61eb 100644 --- a/ios/chrome/browser/ui/coordinators/browser_coordinator.mm +++ b/ios/chrome/browser/ui/coordinators/browser_coordinator.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/ui/coordinators/browser_coordinator.h" +#import "base/ios/block_types.h" #import "base/logging.h" #import "ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h" @@ -11,32 +12,93 @@ #error "This file requires ARC support." #endif +namespace { +// Enum class describing the current coordinator and consumer state. +enum class ActivationState { + DEACTIVATED, // The coordinator has been stopped or has never been started. + // its UIViewController has been fully dismissed. + ACTIVATING, // The coordinator has been started, but its UIViewController + // hasn't finished being presented. + ACTIVATED, // The coordinator has been started and its UIViewController has + // finished being presented. + DEACTIVATING, // The coordinator has been stopped, but its UIViewController + // hasn't finished being dismissed. +}; +// Returns the presentation state to use after |current_state|. +ActivationState GetNextActivationState(ActivationState current_state) { + switch (current_state) { + case ActivationState::DEACTIVATED: + return ActivationState::ACTIVATING; + case ActivationState::ACTIVATING: + return ActivationState::ACTIVATED; + case ActivationState::ACTIVATED: + return ActivationState::DEACTIVATING; + case ActivationState::DEACTIVATING: + return ActivationState::DEACTIVATED; + } +} +} + @interface BrowserCoordinator () +// The coordinator's presentation state. +@property(nonatomic, assign) ActivationState activationState; // Child coordinators owned by this object. @property(nonatomic, strong) NSMutableSet<BrowserCoordinator*>* childCoordinators; // Parent coordinator of this object, if any. @property(nonatomic, readwrite, weak) BrowserCoordinator* parentCoordinator; -@property(nonatomic, readwrite) BOOL started; @property(nonatomic, readwrite) BOOL overlaying; + +// Updates |activationState| to the next appropriate value after the in- +// progress transition animation finishes. If there is no animation occurring, +// the state is updated immediately. +- (void)updateActivationStateAfterTransition; + @end @implementation BrowserCoordinator - @synthesize browser = _browser; @synthesize dispatcher = _dispatcher; +@synthesize activationState = _activationState; @synthesize childCoordinators = _childCoordinators; @synthesize parentCoordinator = _parentCoordinator; -@synthesize started = _started; @synthesize overlaying = _overlaying; - (instancetype)init { if (self = [super init]) { + _activationState = ActivationState::DEACTIVATED; _childCoordinators = [NSMutableSet set]; } return self; } +- (void)dealloc { + for (BrowserCoordinator* child in self.children) { + [self removeChildCoordinator:child]; + } +} + +#pragma mark - Accessors + +- (BOOL)isStarted { + return self.activationState == ActivationState::ACTIVATING || + self.activationState == ActivationState::ACTIVATED; +} + +- (void)setActivationState:(ActivationState)state { + if (_activationState == state) + return; + DCHECK_EQ(state, GetNextActivationState(_activationState)) + << "Unexpected activation state. Probably from calling |-stop| while" + << "ACTIVATING or |-start| while DEACTIVATING."; + _activationState = state; + if (_activationState == ActivationState::DEACTIVATED) { + [self viewControllerWasDeactivated]; + } else if (_activationState == ActivationState::ACTIVATED) { + [self viewControllerWasActivated]; + } +} + #pragma mark - Public API - (id)callableDispatcher { @@ -44,27 +106,39 @@ } - (void)start { - if (self.started) { + if (self.started) return; - } - self.started = YES; + self.activationState = ActivationState::ACTIVATING; [self.parentCoordinator childCoordinatorDidStart:self]; + [self updateActivationStateAfterTransition]; } - (void)stop { - if (!self.started) { + if (!self.started) return; - } [self.parentCoordinator childCoordinatorWillStop:self]; - self.started = NO; + self.activationState = ActivationState::DEACTIVATING; for (BrowserCoordinator* child in self.children) { [child stop]; } + [self updateActivationStateAfterTransition]; } -- (void)dealloc { - for (BrowserCoordinator* child in self.children) { - [self removeChildCoordinator:child]; +#pragma mark - Private + +- (void)updateActivationStateAfterTransition { + DCHECK(self.activationState == ActivationState::ACTIVATING || + self.activationState == ActivationState::DEACTIVATING); + ActivationState nextState = GetNextActivationState(self.activationState); + id<UIViewControllerTransitionCoordinator> transitionCoordinator = + self.viewController.transitionCoordinator; + if (transitionCoordinator) { + [transitionCoordinator animateAlongsideTransition:nil + completion:^(id context) { + self.activationState = nextState; + }]; + } else { + self.activationState = nextState; } } @@ -164,4 +238,12 @@ // Default implementation is a no-op. } +- (void)viewControllerWasActivated { + // Default implementation is a no-op. +} + +- (void)viewControllerWasDeactivated { + // Default implementation is a no-op. +} + @end
diff --git a/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h b/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h new file mode 100644 index 0000000..a7c1bff --- /dev/null +++ b/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h
@@ -0,0 +1,13 @@ +// 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 IOS_CHROME_BROWSER_UI_COORDINATORS_BROWSER_COORDINATOR_TEST_UTIL_H_ +#define IOS_CHROME_BROWSER_UI_COORDINATORS_BROWSER_COORDINATOR_TEST_UTIL_H_ + +@class BrowserCoordinator; + +// Waits for |coordinator|'s UI to finish being presented. +void WaitForBrowserCoordinatorActivation(BrowserCoordinator* coordinator); + +#endif // IOS_CHROME_BROWSER_UI_COORDINATORS_BROWSER_COORDINATOR_TEST_UTIL_H_
diff --git a/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.mm b/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.mm new file mode 100644 index 0000000..b440a8e --- /dev/null +++ b/ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.mm
@@ -0,0 +1,24 @@ +// 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. + +#import "ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h" + +#import "ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h" +#import "ios/testing/wait_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +void WaitForBrowserCoordinatorActivation(BrowserCoordinator* overlay) { + ASSERT_TRUE(overlay); + UIViewController* view_controller = overlay.viewController; + ASSERT_TRUE(view_controller); + EXPECT_TRUE(testing::WaitUntilConditionOrTimeout( + testing::kWaitForUIElementTimeout, ^bool { + return view_controller.presentingViewController && + !view_controller.beingPresented; + })); +}
diff --git a/ios/chrome/browser/ui/external_app/BUILD.gn b/ios/chrome/browser/ui/external_app/BUILD.gn new file mode 100644 index 0000000..9a6c36e --- /dev/null +++ b/ios/chrome/browser/ui/external_app/BUILD.gn
@@ -0,0 +1,40 @@ +# 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. + +import("//build/config/ios/rules.gni") + +source_set("external_app") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "open_mail_handler_view_controller.h", + "open_mail_handler_view_controller.mm", + ] + deps = [ + "//base", + "//ios/chrome/app/strings:ios_strings_grit", + "//ios/chrome/browser/ui/collection_view:collection_view", + "//ios/chrome/browser/web", + "//ui/base:base", + "//url:url", + ] +} + +source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ + "open_mail_handler_view_controller_unittest.mm", + ] + deps = [ + ":external_app", + "//base", + "//ios/chrome/app/strings:ios_strings_grit", + "//ios/chrome/browser/ui/collection_view:test_support", + "//ios/chrome/browser/ui/collection_view/cells:cells", + "//ios/chrome/browser/web", + "//ios/third_party/material_components_ios:material_components_ios", + "//testing/gtest", + "//third_party/ocmock", + ] +}
diff --git a/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.h b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.h new file mode 100644 index 0000000..9b30541 --- /dev/null +++ b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.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 IOS_CHROME_BROWSER_UI_EXTERNAL_APP_OPEN_MAIL_HANDLER_VIEW_CONTROLLER_H_ +#define IOS_CHROME_BROWSER_UI_EXTERNAL_APP_OPEN_MAIL_HANDLER_VIEW_CONTROLLER_H_ + +#include "ios/chrome/browser/ui/collection_view/collection_view_controller.h" + +@class MailtoHandler; +@class MailtoURLRewriter; + +// Type of callback block when user selects a mailto:// handler. +typedef void (^OpenMailtoHandlerSelectedHandler)( + MailtoHandler* _Nonnull handler); + +// A view controller object to prompt user to make a selection for which app +// to use to handle a tap on mailto:// URL. +@interface OpenMailHandlerViewController : CollectionViewController + +// Initializes the view controller with the |rewriter| object which supplies +// the list of supported apps that can handle a mailto:// URL. When the user +// selects a mail client app, the |selectedCallback| block is called. +- (nonnull instancetype) +initWithRewriter:(nullable MailtoURLRewriter*)rewriter + selectedHandler:(nullable OpenMailtoHandlerSelectedHandler)selectedHandler + NS_DESIGNATED_INITIALIZER; + +- (nonnull instancetype)init NS_UNAVAILABLE; + +- (nonnull instancetype)initWithLayout:(nullable UICollectionViewLayout*)layout + style:(CollectionViewControllerStyle)style + NS_UNAVAILABLE; + +@end + +#endif // IOS_CHROME_BROWSER_UI_EXTERNAL_APP_OPEN_MAIL_HANDLER_VIEW_CONTROLLER_H_
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 new file mode 100644 index 0000000..72fdfabd --- /dev/null +++ b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.mm
@@ -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. + +#import "ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.h" + +#import <UIKit/UIKit.h> + +#include "base/ios/block_types.h" +#include "base/logging.h" +#include "base/mac/foundation_util.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" +#import "ios/chrome/browser/web/mailto_handler.h" +#import "ios/chrome/browser/web/mailto_url_rewriter.h" +#include "ios/chrome/grit/ios_strings.h" +#import "ios/third_party/material_components_ios/src/components/Palettes/src/MDCPalettes.h" +#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" +#include "ui/base/l10n/l10n_util.h" +#include "url/gurl.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +// Section IDs +typedef NS_ENUM(NSInteger, SectionIdentifier) { + SectionIdentifierHeader = kSectionIdentifierEnumZero, + SectionIdentifierApps, + SectionIdentifierSwitch, +}; + +// Item IDs. +typedef NS_ENUM(NSInteger, ItemType) { + ItemTypeTitle = kItemTypeEnumZero, + ItemTypeApp, // repeated item + ItemTypeAlwaysAsk, +}; + +// Font size constants for text in the Bottom Sheet. +const CGFloat kBottomSheetTitleFontSize = 18.0f; +const CGFloat kAppNameFontSize = 16.0f; +const CGFloat kSwitchLabelFontSize = 12.0f; + +} // namespace + +@interface OpenMailHandlerViewController () { + // A rewriter object that can rewrite a mailto:// URL to one that can + // launch a different mail client app. + MailtoURLRewriter* _rewriter; + // Item with the UISwitch toggle for user to choose whether a mailto:// + // app selection should be remembered for future use. + CollectionViewSwitchItem* _alwaysAskItem; + // An array of apps that can handle mailto:// URLs. The |rewriter| object + // lists all supported mailto:// handlers, but not all of them would be + // installed. + NSMutableArray<MailtoHandler*>* _availableHandlers; + // Optional callback block that will be called after user has selected a + // mailto:// handler. + OpenMailtoHandlerSelectedHandler _selectedHandler; +} + +// Callback function when the value of UISwitch |sender| in ItemTypeAlwaysAsk +// item is changed by the user. +- (void)didToggleAlwaysAskSwitch:(id)sender; +@end + +@implementation OpenMailHandlerViewController + +- (instancetype)initWithRewriter:(nullable MailtoURLRewriter*)rewriter + selectedHandler:(nullable OpenMailtoHandlerSelectedHandler) + selectedHandler { + self = [super initWithLayout:[[MDCCollectionViewFlowLayout alloc] init] + style:CollectionViewControllerStyleDefault]; + if (self) { + _rewriter = rewriter; + // This will be copied automatically by ARC. + _selectedHandler = selectedHandler; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self loadModel]; +} + +- (void)loadModel { + [super loadModel]; + CollectionViewModel* model = self.collectionViewModel; + + // Header + [model addSectionWithIdentifier:SectionIdentifierHeader]; + CollectionViewTextItem* titleItem = + [[CollectionViewTextItem alloc] initWithType:ItemTypeTitle]; + titleItem.text = l10n_util::GetNSString(IDS_IOS_CHOOSE_EMAIL_CLIENT_APP); + titleItem.textFont = + [[MDCTypography fontLoader] mediumFontOfSize:kBottomSheetTitleFontSize]; + [model addItem:titleItem toSectionWithIdentifier:SectionIdentifierHeader]; + + // Adds list of available mailto:// handler apps. + [model addSectionWithIdentifier:SectionIdentifierApps]; + _availableHandlers = [NSMutableArray array]; + for (MailtoHandler* handler in [_rewriter defaultHandlers]) { + if ([handler isAvailable]) { + [_availableHandlers addObject:handler]; + CollectionViewTextItem* item = + [[CollectionViewTextItem alloc] initWithType:ItemTypeApp]; + item.text = handler.appName; + item.textFont = + [[MDCTypography fontLoader] mediumFontOfSize:kAppNameFontSize]; + [model addItem:item toSectionWithIdentifier:SectionIdentifierApps]; + } + } + + // The footer is a row with a toggle switch. The default should be always ask + // for which app to choose, i.e. ON. + [model addSectionWithIdentifier:SectionIdentifierSwitch]; + _alwaysAskItem = + [[CollectionViewSwitchItem alloc] initWithType:ItemTypeAlwaysAsk]; + _alwaysAskItem.text = l10n_util::GetNSString(IDS_IOS_CHOOSE_EMAIL_ASK_TOGGLE); + _alwaysAskItem.on = YES; + [model addItem:_alwaysAskItem + toSectionWithIdentifier:SectionIdentifierSwitch]; +} + +#pragma mark - UICollectionViewDataSource + +- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView + cellForItemAtIndexPath:(NSIndexPath*)indexPath { + UICollectionViewCell* cell = + [super collectionView:collectionView cellForItemAtIndexPath:indexPath]; + + NSInteger itemType = + [self.collectionViewModel itemTypeForIndexPath:indexPath]; + switch (itemType) { + case ItemTypeTitle: { + CollectionViewTextCell* textCell = + base::mac::ObjCCastStrict<CollectionViewTextCell>(cell); + // TODO(crbug.com/764325): Although text alignment for title is set to + // centered, it is still appearing as left aligned. + textCell.textLabel.textAlignment = NSTextAlignmentCenter; + break; + } + case ItemTypeApp: + break; + case ItemTypeAlwaysAsk: { + CollectionViewSwitchCell* switchCell = + base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); + [switchCell.switchView addTarget:self + action:@selector(didToggleAlwaysAskSwitch:) + forControlEvents:UIControlEventValueChanged]; + switchCell.textLabel.font = + [[MDCTypography fontLoader] mediumFontOfSize:kSwitchLabelFontSize]; + switchCell.textLabel.textColor = [[MDCPalette greyPalette] tint700]; + break; + } + } + return cell; +} + +#pragma mark - UICollectionViewDelegate + +- (void)collectionView:(UICollectionView*)collectionView + didSelectItemAtIndexPath:(NSIndexPath*)indexPath { + [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; + + NSInteger itemType = + [self.collectionViewModel itemTypeForIndexPath:indexPath]; + switch (itemType) { + case ItemTypeApp: { + NSUInteger row = indexPath.row; + DCHECK_LT(row, [_availableHandlers count]); + MailtoHandler* handler = _availableHandlers[row]; + if (![_alwaysAskItem isOn]) + [_rewriter setDefaultHandlerID:[handler appStoreID]]; + if (_selectedHandler) + _selectedHandler(handler); + [self.presentingViewController dismissViewControllerAnimated:YES + completion:nil]; + break; + } + case ItemTypeTitle: + case ItemTypeAlwaysAsk: + break; + } +} + +#pragma mark - MDCCollectionViewStylingDelegate + +- (BOOL)collectionView:(UICollectionView*)collectionView + hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { + // Disallow highlight (ripple effect) if the tapped row is not a mailto:// + // handler. + return + [self.collectionViewModel itemTypeForIndexPath:indexPath] != ItemTypeApp; +} + +#pragma mark - Private + +- (void)didToggleAlwaysAskSwitch:(UISwitch*)sender { + BOOL isOn = [sender isOn]; + [_alwaysAskItem setOn:isOn]; +} + +@end
diff --git a/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller_unittest.mm b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller_unittest.mm new file mode 100644 index 0000000..c985f0d --- /dev/null +++ b/ios/chrome/browser/ui/external_app/open_mail_handler_view_controller_unittest.mm
@@ -0,0 +1,131 @@ +// 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. + +#import "ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.h" + +#include "base/mac/foundation_util.h" +#import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h" +#import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h" +#import "ios/chrome/browser/web/mailto_handler.h" +#import "ios/chrome/browser/web/mailto_url_rewriter.h" +#include "ios/chrome/grit/ios_strings.h" +#include "testing/gtest_mac.h" +#import "third_party/ocmock/OCMock/OCMock.h" +#include "third_party/ocmock/gtest_support.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +class OpenMailHandlerViewControllerTest : public CollectionViewControllerTest { + protected: + CollectionViewController* InstantiateController() override { + return [[OpenMailHandlerViewController alloc] + initWithRewriter:rewriter_ + selectedHandler:selected_handler_]; + } + + // Returns an OCMock object representing a MailtoHandler object with name + // |app_name| and ID of |app_id|. The app will be listed with availability of + // |available|. Returns as id so further expect/stub can be done. Caller + // should cast it to the proper type if necessary. + id CreateMockApp(NSString* app_name, NSString* app_id, BOOL available) { + id mail_app = OCMClassMock([MailtoHandler class]); + OCMStub([mail_app appName]).andReturn(app_name); + OCMStub([mail_app appStoreID]).andReturn(app_id); + OCMStub([mail_app isAvailable]).andReturn(available); + return mail_app; + } + + MailtoURLRewriter* rewriter_; + OpenMailtoHandlerSelectedHandler selected_handler_; +}; + +// Verifies the basic structure of the model. +TEST_F(OpenMailHandlerViewControllerTest, TestModel) { + // Mock rewriter_ must be created before the controller. + id rewriter_mock = OCMClassMock([MailtoURLRewriter class]); + NSArray* mail_apps = @[ + CreateMockApp(@"app1", @"111", YES), CreateMockApp(@"app2", @"222", NO), + CreateMockApp(@"app3", @"333", YES) + ]; + OCMStub([rewriter_mock defaultHandlers]).andReturn(mail_apps); + rewriter_ = base::mac::ObjCCastStrict<MailtoURLRewriter>(rewriter_mock); + CreateController(); + CheckController(); + + // Verifies the number of sections and items within each section. + EXPECT_EQ(3, NumberOfSections()); + // Title + EXPECT_EQ(1, NumberOfItemsInSection(0)); + // Apps. Only 2 out of 3 mailto:// handlers are actually availabel. + EXPECT_EQ(2, NumberOfItemsInSection(1)); + // Footer with toggle option. + EXPECT_EQ(1, NumberOfItemsInSection(2)); + CheckSwitchCellStateAndTitleWithId(YES, IDS_IOS_CHOOSE_EMAIL_ASK_TOGGLE, 2, + 0); +} + +// Verifies that when the second row is selected, the callback is called with +// the second mailto:// handler. +TEST_F(OpenMailHandlerViewControllerTest, TestSelectionCallback) { + // Mock rewriter_ and callback block must be created before the controller. + id rewriter_mock = OCMClassMock([MailtoURLRewriter class]); + NSArray* mailApps = @[ + CreateMockApp(@"app1", @"111", YES), CreateMockApp(@"app2", @"222", YES) + ]; + OCMStub([rewriter_mock defaultHandlers]).andReturn(mailApps); + rewriter_ = base::mac::ObjCCastStrict<MailtoURLRewriter>(rewriter_mock); + __block BOOL handler_called = NO; + selected_handler_ = ^(MailtoHandler* handler) { + EXPECT_NSEQ(@"222", [handler appStoreID]); + handler_called = YES; + }; + CreateController(); + OpenMailHandlerViewController* test_view_controller = + base::mac::ObjCCastStrict<OpenMailHandlerViewController>(controller()); + + // Tests that when the second app which has an ID of @"222" is selected, the + // callback block is called with the correct |handler|. + NSIndexPath* selected_index_path = + [NSIndexPath indexPathForRow:1 inSection:1]; + [test_view_controller collectionView:[test_view_controller collectionView] + didSelectItemAtIndexPath:selected_index_path]; + EXPECT_TRUE(handler_called); +} + +// Verifies that if the "always ask" toggle is turned OFF and a certain row +// in the view controller is selected, the corresponding mailto:// handler +// app is set as the default in |rewriter_|. +TEST_F(OpenMailHandlerViewControllerTest, TestAlwaysAskToggle) { + // Mock rewriter_ must be created before the controller. + id rewriter_mock = OCMClassMock([MailtoURLRewriter class]); + NSArray* mail_apps = @[ + CreateMockApp(@"app1", @"111", YES), CreateMockApp(@"app2", @"222", YES) + ]; + OCMStub([rewriter_mock defaultHandlers]).andReturn(mail_apps); + // The second app will be selected for this test. + OCMExpect([rewriter_mock setDefaultHandlerID:@"222"]); + rewriter_ = base::mac::ObjCCastStrict<MailtoURLRewriter>(rewriter_mock); + CreateController(); + + // Finds the UISwitch cell and toggle the switch to OFF. + OpenMailHandlerViewController* test_view_controller = + base::mac::ObjCCastStrict<OpenMailHandlerViewController>(controller()); + NSIndexPath* switch_index_path = [NSIndexPath indexPathForRow:0 inSection:2]; + CollectionViewSwitchCell* switch_cell = + base::mac::ObjCCastStrict<CollectionViewSwitchCell>([test_view_controller + collectionView:[test_view_controller collectionView] + cellForItemAtIndexPath:switch_index_path]); + switch_cell.switchView.on = NO; + [switch_cell.switchView + sendActionsForControlEvents:UIControlEventValueChanged]; + + // Then selects the second app in the list of apps. + NSIndexPath* selected_index_path = + [NSIndexPath indexPathForRow:1 inSection:1]; + [test_view_controller collectionView:[test_view_controller collectionView] + didSelectItemAtIndexPath:selected_index_path]; + EXPECT_OCMOCK_VERIFY(rewriter_mock); +}
diff --git a/ios/chrome/browser/ui/external_file_remover.h b/ios/chrome/browser/ui/external_file_remover.h index 37a96f75..bea1f78 100644 --- a/ios/chrome/browser/ui/external_file_remover.h +++ b/ios/chrome/browser/ui/external_file_remover.h
@@ -10,7 +10,9 @@ #include "base/time/time.h" #include "components/sessions/core/tab_restore_service_observer.h" -@class BrowserViewController; +namespace ios { +class ChromeBrowserState; +} namespace sessions { class TabRestoreService; } @@ -22,7 +24,7 @@ public: // Creates an ExternalFileRemover to remove external documents not referenced // by the specified BrowserViewController. Use Remove to initiate the removal. - explicit ExternalFileRemover(BrowserViewController* bvc); + explicit ExternalFileRemover(ios::ChromeBrowserState* browser_state); ~ExternalFileRemover() override; // sessions::TabRestoreServiceObserver methods @@ -36,23 +38,27 @@ const base::Closure& callback); private: + // Loads the |tabRestoreService_| if necessary. Removes all files received + // from other apps if |all_files| is true. Otherwise, removes the unreferenced + // files only. |callback| is called when the removal finishes. + void Remove(bool all_files, const base::Closure& callback); // Removes files received from other apps. If |all_files| is true, then // all files including files that may be referenced by tabs through restore // service or history. Otherwise, only the unreferenced files are removed. // |callback| is called when the removal finishes. void RemoveFiles(bool all_files, const base::Closure& callback); + // Returns all Referenced External files. + NSSet* GetReferencedExternalFiles(); // Pointer to the tab restore service in the browser state associated with // |bvc_|. - sessions::TabRestoreService* tabRestoreService_; - // BrowserViewController used to get the referenced files. Must outlive this + sessions::TabRestoreService* tab_restore_service_ = nullptr; + // ChromeBrowserState used to get the referenced files. Must outlive this // object. - __unsafe_unretained BrowserViewController* bvc_; + ios::ChromeBrowserState* browser_state_ = nullptr; // Used to ensure |Remove()| is not run when this object is destroyed. base::WeakPtrFactory<ExternalFileRemover> weak_ptr_factory_; - // Loads the |tabRestoreService_| if necessary. Removes all files received - // from other apps if |all_files| is true. Otherwise, removes the unreferenced - // files only. |callback| is called when the removal finishes. - void Remove(bool all_files, const base::Closure& callback); + + DISALLOW_COPY_AND_ASSIGN(ExternalFileRemover); }; #endif // IOS_CHROME_BROWSER_UI_EXTERNAL_FILE_REMOVER_H_
diff --git a/ios/chrome/browser/ui/external_file_remover.mm b/ios/chrome/browser/ui/external_file_remover.mm index ac9a27c..5a913bb7 100644 --- a/ios/chrome/browser/ui/external_file_remover.mm +++ b/ios/chrome/browser/ui/external_file_remover.mm
@@ -6,11 +6,16 @@ #include "base/logging.h" #import "base/mac/bind_objc_block.h" +#include "base/strings/sys_string_conversions.h" #include "base/task_scheduler/post_task.h" +#include "components/bookmarks/browser/bookmark_model.h" #include "components/sessions/core/tab_restore_service.h" +#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/chrome_url_util.h" #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" -#import "ios/chrome/browser/ui/browser_view_controller.h" +#import "ios/chrome/browser/tabs/tab_model.h" +#import "ios/chrome/browser/tabs/tab_model_list.h" #import "ios/chrome/browser/ui/external_file_controller.h" #include "ios/web/public/web_thread.h" @@ -18,18 +23,18 @@ #error "This file requires ARC support." #endif -ExternalFileRemover::ExternalFileRemover(BrowserViewController* bvc) - : tabRestoreService_(NULL), bvc_(bvc), weak_ptr_factory_(this) {} +ExternalFileRemover::ExternalFileRemover(ios::ChromeBrowserState* browser_state) + : browser_state_(browser_state), weak_ptr_factory_(this) {} ExternalFileRemover::~ExternalFileRemover() { - if (tabRestoreService_) - tabRestoreService_->RemoveObserver(this); + if (tab_restore_service_) + tab_restore_service_->RemoveObserver(this); } void ExternalFileRemover::TabRestoreServiceChanged( sessions::TabRestoreService* service) { if (service->IsLoaded()) { - tabRestoreService_->RemoveObserver(this); + tab_restore_service_->RemoveObserver(this); RemoveFiles(false, base::Closure()); } } @@ -45,15 +50,15 @@ // |IOSChromeTabRestoreServiceFactory::GetForBrowserState| has to be called on // the UI thread. DCHECK_CURRENTLY_ON(web::WebThread::UI); - tabRestoreService_ = - IOSChromeTabRestoreServiceFactory::GetForBrowserState(bvc_.browserState); - DCHECK(tabRestoreService_); - if (!tabRestoreService_->IsLoaded()) { + tab_restore_service_ = + IOSChromeTabRestoreServiceFactory::GetForBrowserState(browser_state_); + DCHECK(tab_restore_service_); + if (!tab_restore_service_->IsLoaded()) { // TODO(crbug.com/430902): In the case of the presence of tab restore // service, only unreferenced files are removed. This can be addressed with // the larger problem of Clear All browsing data not clearing Tab Restore. - tabRestoreService_->AddObserver(this); - tabRestoreService_->LoadTabsFromLastSession(); + tab_restore_service_->AddObserver(this); + tab_restore_service_->LoadTabsFromLastSession(); if (!callback.is_null()) { web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, callback); } @@ -64,9 +69,13 @@ void ExternalFileRemover::RemoveFiles(bool all_files, const base::Closure& callback) { - NSSet* referencedFiles = all_files ? nil : [bvc_ referencedExternalFiles]; + NSSet* referenced_files = nil; + if (all_files) { + referenced_files = GetReferencedExternalFiles(); + } + const NSInteger kMinimumAgeInDays = 30; - NSInteger ageInDays = all_files ? 0 : kMinimumAgeInDays; + NSInteger age_in_days = all_files ? 0 : kMinimumAgeInDays; base::Closure callback_wrapper = callback; if (callback_wrapper.is_null()) { @@ -75,8 +84,8 @@ base::PostTaskWithTraitsAndReply( FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, base::BindBlockArc(^{ - [ExternalFileController removeFilesExcluding:referencedFiles - olderThan:ageInDays]; + [ExternalFileController removeFilesExcluding:referenced_files + olderThan:age_in_days]; }), callback_wrapper); } @@ -99,3 +108,33 @@ }), delay); } + +NSSet* ExternalFileRemover::GetReferencedExternalFiles() { + // Add files from all TabModels. + NSMutableSet* referenced_external_files = [NSMutableSet set]; + for (TabModel* tab_model in GetTabModelsForChromeBrowserState( + browser_state_)) { + NSSet* tab_model_files = [tab_model currentlyReferencedExternalFiles]; + if (tab_model_files) { + [referenced_external_files unionSet:tab_model_files]; + } + } + + bookmarks::BookmarkModel* bookmark_model = + ios::BookmarkModelFactory::GetForBrowserState(browser_state_); + // Check if the bookmark model is loaded. + if (!bookmark_model || !bookmark_model->loaded()) + return referenced_external_files; + + // Add files from Bookmarks. + std::vector<bookmarks::BookmarkModel::URLAndTitle> bookmarks; + bookmark_model->GetBookmarks(&bookmarks); + for (const auto& bookmark : bookmarks) { + GURL bookmark_url = bookmark.url; + if (UrlIsExternalFileReference(bookmark_url)) { + [referenced_external_files + addObject:base::SysUTF8ToNSString(bookmark_url.ExtractFileName())]; + } + } + return referenced_external_files; +}
diff --git a/ios/chrome/browser/ui/first_run/BUILD.gn b/ios/chrome/browser/ui/first_run/BUILD.gn index 40039ebe..da1b3bc 100644 --- a/ios/chrome/browser/ui/first_run/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/BUILD.gn
@@ -42,7 +42,7 @@ "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/promos", "//ios/chrome/browser/ui/settings", - "//ios/chrome/browser/ui/sync", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/ui/util", "//ios/chrome/common", "//ios/public/provider/chrome/browser",
diff --git a/ios/chrome/browser/ui/first_run/first_run_util.mm b/ios/chrome/browser/ui/first_run/first_run_util.mm index bbb68b5..25a2d51 100644 --- a/ios/chrome/browser/ui/first_run/first_run_util.mm +++ b/ios/chrome/browser/ui/first_run/first_run_util.mm
@@ -21,7 +21,7 @@ #include "ios/chrome/browser/tabs/tab.h" #include "ios/chrome/browser/ui/first_run/first_run_histograms.h" #import "ios/chrome/browser/ui/settings/settings_utils.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/web/public/web_thread.h" #import "ui/gfx/ios/NSString+CrStringDrawing.h"
diff --git a/ios/chrome/browser/ui/main/main_view_controller_unittest.mm b/ios/chrome/browser/ui/main/main_view_controller_unittest.mm index c8e25191..1efca18 100644 --- a/ios/chrome/browser/ui/main/main_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/main/main_view_controller_unittest.mm
@@ -6,7 +6,6 @@ #import <UIKit/UIKit.h> -#include "base/ios/ios_util.h" #include "testing/gtest_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -114,9 +113,6 @@ } TEST(MainViewControllerTest, StatusBar) { - // TODO(crbug.com/748738) This is broken with iOS11/Xcode 9 beta 4. - if (base::ios::IsRunningOnIOS11OrLater()) - return; MainViewController* main_view_controller = [[MainViewController alloc] init]; // MVC needs to be the root view controller for this to work, so save the // current one and restore it at the end of the test.
diff --git a/ios/chrome/browser/ui/metrics/BUILD.gn b/ios/chrome/browser/ui/metrics/BUILD.gn index ec8a781e..2e1cdbc 100644 --- a/ios/chrome/browser/ui/metrics/BUILD.gn +++ b/ios/chrome/browser/ui/metrics/BUILD.gn
@@ -6,6 +6,17 @@ sources = [ "metrics_recorder.h", ] + configs += [ "//build/config/compiler:enable_arc" ] +} +source_set("test_support") { + testonly = true + sources = [ + "metrics_test_util.h", + "metrics_test_util.mm", + ] + deps = [ + "//base", + ] configs += [ "//build/config/compiler:enable_arc" ] }
diff --git a/ios/chrome/browser/ui/metrics/metrics_test_util.h b/ios/chrome/browser/ui/metrics/metrics_test_util.h new file mode 100644 index 0000000..851f644 --- /dev/null +++ b/ios/chrome/browser/ui/metrics/metrics_test_util.h
@@ -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. + +#ifndef IOS_CHROME_BROWSER_UI_METRICS_METRICS_TEST_UTIL_H_ +#define IOS_CHROME_BROWSER_UI_METRICS_METRICS_TEST_UTIL_H_ + +#import <Foundation/Foundation.h> + +// Constructs an NSInvocation for an instance method defined by +// |selector| in |protocol|. |isRequiredMethod| indicates whether |selector| +// is a required method for |protocol|. +NSInvocation* GetInvocationForProtocolInstanceMethod(Protocol* protocol, + SEL selector, + BOOL isRequiredMethod); + +#endif // IOS_CHROME_BROWSER_UI_METRICS_METRICS_TEST_UTIL_H_
diff --git a/ios/chrome/browser/ui/metrics/metrics_test_util.mm b/ios/chrome/browser/ui/metrics/metrics_test_util.mm new file mode 100644 index 0000000..56e3eb59 --- /dev/null +++ b/ios/chrome/browser/ui/metrics/metrics_test_util.mm
@@ -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. + +#import "ios/chrome/browser/ui/metrics/metrics_test_util.h" + +#import <Foundation/Foundation.h> +#import <objc/runtime.h> + +#include "base/logging.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +NSInvocation* GetInvocationForProtocolInstanceMethod(Protocol* protocol, + SEL selector, + BOOL isRequiredMethod) { + // Get the NSMethodSignature required to create NSInvocation. + struct objc_method_description methodDesc = protocol_getMethodDescription( + protocol, selector, isRequiredMethod, YES /* an instance method */); + DCHECK(methodDesc.types); + NSMethodSignature* method = + [NSMethodSignature signatureWithObjCTypes:methodDesc.types]; + DCHECK(method); + + NSInvocation* invocation = + [NSInvocation invocationWithMethodSignature:method]; + invocation.selector = selector; + return invocation; +}
diff --git a/ios/chrome/browser/ui/ntp/ntp_tile_saver.mm b/ios/chrome/browser/ui/ntp/ntp_tile_saver.mm index c7f0c711..c5ee44f12 100644 --- a/ios/chrome/browser/ui/ntp/ntp_tile_saver.mm +++ b/ios/chrome/browser/ui/ntp/ntp_tile_saver.mm
@@ -72,6 +72,8 @@ if (!tile.faviconFetched) { return; } + // Any fetched tile must have a file name or a fallback monogram. + DCHECK(tile.faviconFileName || tile.fallbackMonogram); } ReplaceSavedFavicons(faviconsURL); @@ -123,19 +125,21 @@ [tiles setObject:tile forKey:tile.URL]; } - for (__block NTPTile* tile : [tiles objectEnumerator]) { + for (NTPTile* tile : [tiles objectEnumerator]) { const GURL& gurl = net::GURLWithNSURL(tile.URL); NSString* faviconFileName = GetFaviconFileName(gurl); NSURL* fileURL = [tmpFaviconURL URLByAppendingPathComponent:faviconFileName]; void (^faviconImageBlock)(UIImage*) = ^(UIImage* favicon) { - tile.faviconFetched = YES; NSData* imageData = UIImagePNGRepresentation(favicon); if ([imageData writeToURL:fileURL atomically:YES]) { + // If saving the image is not possible, the best thing to do is to keep + // the previous tile. + tile.faviconFetched = YES; tile.faviconFileName = faviconFileName; + WriteToDiskIfComplete(tiles, faviconsURL); } - WriteToDiskIfComplete(tiles, faviconsURL); }; void (^fallbackBlock)(UIColor*, UIColor*, BOOL) = @@ -146,6 +150,8 @@ tile.fallbackIsDefaultColor = isDefaultColor; tile.fallbackMonogram = base::SysUTF16ToNSString( favicon::GetFallbackIconText(net::GURLWithNSURL(tile.URL))); + DCHECK(tile.fallbackMonogram && tile.fallbackTextColor && + tile.fallbackBackgroundColor); WriteToDiskIfComplete(tiles, faviconsURL); };
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/BUILD.gn b/ios/chrome/browser/ui/ntp/recent_tabs/BUILD.gn index 00079e0..58971c2 100644 --- a/ios/chrome/browser/ui/ntp/recent_tabs/BUILD.gn +++ b/ios/chrome/browser/ui/ntp/recent_tabs/BUILD.gn
@@ -38,7 +38,6 @@ "//ios/chrome/browser/ui/context_menu", "//ios/chrome/browser/ui/ntp", "//ios/chrome/browser/ui/ntp/recent_tabs/views", - "//ios/chrome/browser/ui/sync/", "//ios/web", "//ui/base", "//url",
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_coordinator.mm b/ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_coordinator.mm index 0ba2ad9..9b8cd3f 100644 --- a/ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_coordinator.mm +++ b/ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_coordinator.mm
@@ -15,9 +15,9 @@ #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/closed_tabs_observer_bridge.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_view_controller.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/views/BUILD.gn b/ios/chrome/browser/ui/ntp/recent_tabs/views/BUILD.gn index 88a21643..b93c20b 100644 --- a/ios/chrome/browser/ui/ntp/recent_tabs/views/BUILD.gn +++ b/ios/chrome/browser/ui/ntp/recent_tabs/views/BUILD.gn
@@ -40,7 +40,7 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/fancy_ui", "//ios/chrome/browser/ui/material_components", - "//ios/chrome/browser/ui/sync", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/ui/tab_switcher:utils", "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios",
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/views/disclosure_view.mm b/ios/chrome/browser/ui/ntp/recent_tabs/views/disclosure_view.mm index aebf2324..0607d92 100644 --- a/ios/chrome/browser/ui/ntp/recent_tabs/views/disclosure_view.mm +++ b/ios/chrome/browser/ui/ntp/recent_tabs/views/disclosure_view.mm
@@ -4,6 +4,8 @@ #include "ios/chrome/browser/ui/ntp/recent_tabs/views/disclosure_view.h" +#include "base/numerics/math_constants.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -18,7 +20,7 @@ // |kCollapsedIconAngle| to a value slightly less then 0 forces the animation to // always happen in the same half-plane. const CGFloat kCollapsedIconAngle = -0.00001; -const CGFloat kExpandedIconAngle = M_PI; +const CGFloat kExpandedIconAngle = base::kPiFloat; } // anonymous namespace
diff --git a/ios/chrome/browser/ui/ntp/recent_tabs/views/signed_in_sync_off_view.mm b/ios/chrome/browser/ui/ntp/recent_tabs/views/signed_in_sync_off_view.mm index 47323116..a67c7ed78 100644 --- a/ios/chrome/browser/ui/ntp/recent_tabs/views/signed_in_sync_off_view.mm +++ b/ios/chrome/browser/ui/ntp/recent_tabs/views/signed_in_sync_off_view.mm
@@ -10,7 +10,7 @@ #import "ios/chrome/browser/ui/fancy_ui/primary_action_button.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h" #include "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" #include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h"
diff --git a/ios/chrome/browser/ui/omnibox/BUILD.gn b/ios/chrome/browser/ui/omnibox/BUILD.gn index 9565206..6fdfe3b1 100644 --- a/ios/chrome/browser/ui/omnibox/BUILD.gn +++ b/ios/chrome/browser/ui/omnibox/BUILD.gn
@@ -1,9 +1,24 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# 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. source_set("omnibox") { sources = [ + "location_bar_controller.cc", + "location_bar_controller.h", + "location_bar_delegate.h", + "web_omnibox_edit_controller.cc", + "web_omnibox_edit_controller.h", + ] + deps = [ + "//base", + "//components/omnibox/browser", + "//ui/base", + ] +} + +source_set("omnibox_util") { + sources = [ "omnibox_util.cc", "omnibox_util.h", ] @@ -51,6 +66,7 @@ ] deps = [ ":omnibox", + ":omnibox_util", "resources:omnibox_background", "resources:omnibox_transparent_background", "//base", @@ -78,7 +94,6 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/common", "//ios/public/provider/chrome/browser", - "//ios/shared/chrome/browser/ui/omnibox", "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios", "//ios/web",
diff --git a/ios/chrome/browser/ui/omnibox/chrome_omnibox_client_ios.mm b/ios/chrome/browser/ui/omnibox/chrome_omnibox_client_ios.mm index e77c890..6a716b4 100644 --- a/ios/chrome/browser/ui/omnibox/chrome_omnibox_client_ios.mm +++ b/ios/chrome/browser/ui/omnibox/chrome_omnibox_client_ios.mm
@@ -22,8 +22,8 @@ #include "ios/chrome/browser/prerender/prerender_service_factory.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h" #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" +#include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" -#include "ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" #import "ios/web/public/navigation_manager.h" #include "ios/web/public/web_state/web_state.h" #include "url/gurl.h"
diff --git a/ios/shared/chrome/browser/ui/omnibox/location_bar_controller.cc b/ios/chrome/browser/ui/omnibox/location_bar_controller.cc similarity index 78% rename from ios/shared/chrome/browser/ui/omnibox/location_bar_controller.cc rename to ios/chrome/browser/ui/omnibox/location_bar_controller.cc index 2b90e9ca..8827e2d 100644 --- a/ios/shared/chrome/browser/ui/omnibox/location_bar_controller.cc +++ b/ios/chrome/browser/ui/omnibox/location_bar_controller.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 "ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_controller.h" LocationBarController::LocationBarController() {}
diff --git a/ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h b/ios/chrome/browser/ui/omnibox/location_bar_controller.h similarity index 94% rename from ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h rename to ios/chrome/browser/ui/omnibox/location_bar_controller.h index a96fbce..bdb66e74 100644 --- a/ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h +++ b/ios/chrome/browser/ui/omnibox/location_bar_controller.h
@@ -5,7 +5,7 @@ #ifndef IOS_SHARED_CHROME_BROWSER_UI_OMNIBOX_LOCATION_BAR_CONTROLLER_H_ #define IOS_SHARED_CHROME_BROWSER_UI_OMNIBOX_LOCATION_BAR_CONTROLLER_H_ -#include "ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" +#include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" class OmniboxView;
diff --git a/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h b/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h index ce7e087..63b2e64f 100644 --- a/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h +++ b/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h
@@ -11,7 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/omnibox/browser/omnibox_view.h" -#include "ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_controller.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h"
diff --git a/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.mm b/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.mm index 7bad6d5..1151f08 100644 --- a/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.mm +++ b/ios/chrome/browser/ui/omnibox/location_bar_controller_impl.mm
@@ -20,13 +20,13 @@ #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/experimental_flags.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_delegate.h" #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_theme_resources.h" -#include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #include "ios/web/public/navigation_item.h" #include "ios/web/public/navigation_manager.h"
diff --git a/ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h b/ios/chrome/browser/ui/omnibox/location_bar_delegate.h similarity index 100% rename from ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h rename to ios/chrome/browser/ui/omnibox/location_bar_delegate.h
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm index bb274616..4c1df435 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm
@@ -28,9 +28,9 @@ #include "ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.h" #include "ios/chrome/browser/ui/omnibox/omnibox_text_field_paste_delegate.h" #include "ios/chrome/browser/ui/omnibox/omnibox_util.h" +#include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_theme_resources.h" -#include "ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" #include "ios/web/public/referrer.h" #import "net/base/mac/url_conversions.h" #include "skia/ext/skia_utils_ios.h"
diff --git a/ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.cc b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.cc similarity index 78% rename from ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.cc rename to ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.cc index 30611d9..76a3dc56 100644 --- a/ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.cc +++ b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.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 "ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" +#include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h" WebOmniboxEditController::WebOmniboxEditController() {}
diff --git a/ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h b/ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h similarity index 100% rename from ios/shared/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h rename to ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h
diff --git a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm index 37a8f9ca..9465324 100644 --- a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm +++ b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm
@@ -7,6 +7,7 @@ #import <QuartzCore/QuartzCore.h> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "ios/chrome/browser/ui/rtl_geometry.h" #include "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_theme_resources.h" @@ -496,7 +497,8 @@ [UIView beginAnimations:@"transform" context:NULL]; [UIView setAnimationDuration:0.1]; CATransform3D rotation = CATransform3DMakeRotation( - MapValueToRange({kFullThreshold / 2.0, kFullThreshold}, {-M_PI_2, M_PI_4}, + MapValueToRange({kFullThreshold / 2.0, kFullThreshold}, + {-base::kPiFloat / 2, base::kPiFloat / 4}, self.verticalOffset), 0, 0, 1); self.refreshActionImageView.layer.transform = rotation; @@ -806,7 +808,7 @@ CGFloat deformationDirection = dx > 0 ? 1 : -1; for (int i = 0; i < kBezierPathPointCount; i++) { CGPoint p; - float angle = i * 2 * M_PI / kBezierPathPointCount; + float angle = i * 2 * base::kPiFloat / kBezierPathPointCount; // Circle centered on 0. p.x = cos(angle) * radius;
diff --git a/ios/chrome/browser/ui/payments/cells/payments_text_item.h b/ios/chrome/browser/ui/payments/cells/payments_text_item.h index 9e211451..b421104 100644 --- a/ios/chrome/browser/ui/payments/cells/payments_text_item.h +++ b/ios/chrome/browser/ui/payments/cells/payments_text_item.h
@@ -15,13 +15,21 @@ @interface PaymentsTextItem : CollectionViewItem<PaymentsIsSelectable> // The main text to display. -@property(nonatomic, copy) NSString* text; +@property(nonatomic, nullable, copy) NSString* text; // The secondary text to display. -@property(nonatomic, copy) NSString* detailText; +@property(nonatomic, nullable, copy) NSString* detailText; + +// The color of the main text. Default is the 900 tint color of the grey +// palette. +@property(nonatomic, null_resettable, copy) UIColor* textColor; + +// The color of the secondary text. Default is the 900 tint color of the grey +// palette. +@property(nonatomic, null_resettable, copy) UIColor* detailTextColor; // The image to display. -@property(nonatomic, strong) UIImage* image; +@property(nonatomic, nullable, strong) UIImage* image; // The accessory type for the represented cell. @property(nonatomic) MDCCollectionViewCellAccessoryType accessoryType; @@ -38,13 +46,13 @@ @interface PaymentsTextCell : MDCCollectionViewCell // UILabel corresponding to |text| from the item. -@property(nonatomic, readonly, strong) UILabel* textLabel; +@property(nonatomic, readonly, nullable, strong) UILabel* textLabel; // UILabel corresponding to |detailText| from the item. -@property(nonatomic, readonly, strong) UILabel* detailTextLabel; +@property(nonatomic, readonly, nullable, strong) UILabel* detailTextLabel; // UIImageView corresponding to |image| from the item. -@property(nonatomic, readonly, strong) UIImageView* imageView; +@property(nonatomic, readonly, nullable, strong) UIImageView* imageView; @end
diff --git a/ios/chrome/browser/ui/payments/cells/payments_text_item.mm b/ios/chrome/browser/ui/payments/cells/payments_text_item.mm index e6239a9..652fee6c 100644 --- a/ios/chrome/browser/ui/payments/cells/payments_text_item.mm +++ b/ios/chrome/browser/ui/payments/cells/payments_text_item.mm
@@ -30,6 +30,8 @@ @synthesize text = _text; @synthesize detailText = _detailText; +@synthesize textColor = _textColor; +@synthesize detailTextColor = _detailTextColor; @synthesize image = _image; @synthesize accessoryType = _accessoryType; @synthesize complete = _complete; @@ -44,11 +46,27 @@ return self; } +- (UIColor*)textColor { + if (!_textColor) { + _textColor = [[MDCPalette greyPalette] tint900]; + } + return _textColor; +} + +- (UIColor*)detailTextColor { + if (!_detailTextColor) { + _detailTextColor = [[MDCPalette greyPalette] tint900]; + } + return _detailTextColor; +} + - (void)configureCell:(PaymentsTextCell*)cell { [super configureCell:cell]; cell.accessoryType = self.accessoryType; cell.textLabel.text = self.text; + cell.textLabel.textColor = self.textColor; cell.detailTextLabel.text = self.detailText; + cell.detailTextLabel.textColor = self.detailTextColor; cell.imageView.image = self.image; } @@ -107,12 +125,10 @@ // Set default font and text colors for labels. - (void)setDefaultViewStyling { _textLabel.font = [MDCTypography body2Font]; - _textLabel.textColor = [[MDCPalette greyPalette] tint900]; _textLabel.numberOfLines = 0; _textLabel.lineBreakMode = NSLineBreakByWordWrapping; _detailTextLabel.font = [MDCTypography body1Font]; - _detailTextLabel.textColor = [[MDCPalette greyPalette] tint900]; _detailTextLabel.numberOfLines = 0; _detailTextLabel.lineBreakMode = NSLineBreakByWordWrapping; }
diff --git a/ios/chrome/browser/ui/payments/payment_request_mediator.mm b/ios/chrome/browser/ui/payments/payment_request_mediator.mm index 50eb606..d56e3fe 100644 --- a/ios/chrome/browser/ui/payments/payment_request_mediator.mm +++ b/ios/chrome/browser/ui/payments/payment_request_mediator.mm
@@ -126,7 +126,7 @@ return item; } -- (CollectionViewItem*)shippingSectionHeaderItem { +- (PaymentsTextItem*)shippingSectionHeaderItem { PaymentsTextItem* item = [[PaymentsTextItem alloc] init]; item.text = GetShippingSectionTitle(self.paymentRequest->shipping_type()); return item; @@ -177,7 +177,7 @@ return item; } -- (CollectionViewItem*)paymentMethodSectionHeaderItem { +- (PaymentsTextItem*)paymentMethodSectionHeaderItem { if (!self.paymentRequest->selected_payment_method()) return nil; PaymentsTextItem* item = [[PaymentsTextItem alloc] init]; @@ -221,7 +221,7 @@ return item; } -- (CollectionViewItem*)contactInfoSectionHeaderItem { +- (PaymentsTextItem*)contactInfoSectionHeaderItem { if (!self.paymentRequest->selected_contact_profile()) return nil; PaymentsTextItem* item = [[PaymentsTextItem alloc] init];
diff --git a/ios/chrome/browser/ui/payments/payment_request_view_controller.mm b/ios/chrome/browser/ui/payments/payment_request_view_controller.mm index c9150a0..9700f9ef 100644 --- a/ios/chrome/browser/ui/payments/payment_request_view_controller.mm +++ b/ios/chrome/browser/ui/payments/payment_request_view_controller.mm
@@ -16,6 +16,7 @@ #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/payments/cells/page_info_item.h" +#import "ios/chrome/browser/ui/payments/cells/payments_text_item.h" #import "ios/chrome/browser/ui/payments/cells/price_item.h" #import "ios/chrome/browser/ui/payments/payment_request_view_controller_actions.h" #include "ios/chrome/browser/ui/rtl_geometry.h" @@ -50,7 +51,7 @@ ItemTypeSummaryPageInfo = kItemTypeEnumZero, ItemTypeSpinner, ItemTypeSummaryTotal, - ItemTypeShippingTitle, + ItemTypeShippingHeader, ItemTypeShippingAddress, ItemTypeShippingOption, ItemTypePaymentHeader, @@ -193,9 +194,10 @@ if ([_dataSource requestShipping]) { [model addSectionWithIdentifier:SectionIdentifierShipping]; - CollectionViewItem* shippingSectionHeaderItem = + PaymentsTextItem* shippingSectionHeaderItem = [_dataSource shippingSectionHeaderItem]; - [shippingSectionHeaderItem setType:ItemTypeShippingTitle]; + [shippingSectionHeaderItem setTextColor:[[MDCPalette greyPalette] tint500]]; + [shippingSectionHeaderItem setType:ItemTypeShippingHeader]; [model setHeader:shippingSectionHeaderItem forSectionWithIdentifier:SectionIdentifierShipping]; @@ -459,10 +461,12 @@ - (void)populatePaymentMethodSection { CollectionViewModel* model = self.collectionViewModel; - CollectionViewItem* paymentMethodSectionHeaderItem = + PaymentsTextItem* paymentMethodSectionHeaderItem = [_dataSource paymentMethodSectionHeaderItem]; if (paymentMethodSectionHeaderItem) { [paymentMethodSectionHeaderItem setType:ItemTypePaymentHeader]; + [paymentMethodSectionHeaderItem + setTextColor:[[MDCPalette greyPalette] tint500]]; [model setHeader:paymentMethodSectionHeaderItem forSectionWithIdentifier:SectionIdentifierPayment]; } @@ -477,10 +481,12 @@ - (void)populateContactInfoSection { CollectionViewModel* model = self.collectionViewModel; - CollectionViewItem* contactInfoSectionHeaderItem = + PaymentsTextItem* contactInfoSectionHeaderItem = [_dataSource contactInfoSectionHeaderItem]; if (contactInfoSectionHeaderItem) { [contactInfoSectionHeaderItem setType:ItemTypeContactInfoHeader]; + [contactInfoSectionHeaderItem + setTextColor:[[MDCPalette greyPalette] tint500]]; [model setHeader:contactInfoSectionHeaderItem forSectionWithIdentifier:SectionIdentifierContactInfo]; }
diff --git a/ios/chrome/browser/ui/payments/payment_request_view_controller_data_source.h b/ios/chrome/browser/ui/payments/payment_request_view_controller_data_source.h index 1f130b3..aa87cf6 100644 --- a/ios/chrome/browser/ui/payments/payment_request_view_controller_data_source.h +++ b/ios/chrome/browser/ui/payments/payment_request_view_controller_data_source.h
@@ -9,6 +9,7 @@ @class CollectionViewFooterItem; @class CollectionViewItem; +@class PaymentsTextItem; // Data source protocol for PaymentRequestViewController. @protocol PaymentRequestViewControllerDataSource @@ -36,7 +37,7 @@ - (CollectionViewItem*)paymentSummaryItem; // Returns the header item for the Shipping section. -- (CollectionViewItem*)shippingSectionHeaderItem; +- (PaymentsTextItem*)shippingSectionHeaderItem; // Returns the Shipping Address item displayed in the Shipping section. - (CollectionViewItem*)shippingAddressItem; @@ -45,13 +46,13 @@ - (CollectionViewItem*)shippingOptionItem; // Returns the header item for the Payment Method section. -- (CollectionViewItem*)paymentMethodSectionHeaderItem; +- (PaymentsTextItem*)paymentMethodSectionHeaderItem; // Returns the item displayed in the Payment Method section. - (CollectionViewItem*)paymentMethodItem; // Returns the header item for the Contact Info section. -- (CollectionViewItem*)contactInfoSectionHeaderItem; +- (PaymentsTextItem*)contactInfoSectionHeaderItem; // Returns the item displayed in the Contact Info section. - (CollectionViewItem*)contactInfoItem;
diff --git a/ios/chrome/browser/ui/qr_scanner/BUILD.gn b/ios/chrome/browser/ui/qr_scanner/BUILD.gn index dea9f2f..c6f1699 100644 --- a/ios/chrome/browser/ui/qr_scanner/BUILD.gn +++ b/ios/chrome/browser/ui/qr_scanner/BUILD.gn
@@ -73,11 +73,11 @@ "//ios/chrome/browser/ui:ui_internal", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/icons", + "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/test/app:test_support", "//ios/chrome/test/base", "//ios/chrome/test/earl_grey:test_support", - "//ios/shared/chrome/browser/ui/omnibox", "//ios/testing/earl_grey:earl_grey_support", "//ios/third_party/earl_grey", "//ios/web/public/test/http_server",
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm index 41515a2..f4f469b 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" +#include "base/numerics/math_constants.h" #include "ios/chrome/browser/ui/icons/chrome_icon.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_strings.h" @@ -361,8 +362,9 @@ // Check that the current transform is either an identity or a 90, -90, or 180 // degree rotation. DCHECK(fabs(atan2f(rotation.b, rotation.a)) < 0.001 || - fabs(fabs(atan2f(rotation.b, rotation.a)) - M_PI) < 0.001 || - fabs(fabs(atan2f(rotation.b, rotation.a)) - M_PI / 2) < 0.001); + fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat) < 0.001 || + fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat / 2) < + 0.001); rotation.a = round(rotation.a); rotation.b = round(rotation.b); rotation.c = round(rotation.c);
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 5e1549623..bcbb69f 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
@@ -14,6 +14,7 @@ #import "ios/chrome/app/main_controller.h" #import "ios/chrome/browser/ui/browser_view_controller.h" #include "ios/chrome/browser/ui/icons/chrome_icon.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_delegate.h" #include "ios/chrome/browser/ui/qr_scanner/camera_controller.h" #include "ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h" #include "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h" @@ -26,7 +27,6 @@ #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h" -#include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" #import "ios/web/public/test/http_server/http_server.h" #include "ios/web/public/test/http_server/http_server_util.h" #import "third_party/ocmock/OCMock/OCMock.h"
diff --git a/ios/chrome/browser/ui/settings/BUILD.gn b/ios/chrome/browser/ui/settings/BUILD.gn index 2fac80bc..5ae6ec71 100644 --- a/ios/chrome/browser/ui/settings/BUILD.gn +++ b/ios/chrome/browser/ui/settings/BUILD.gn
@@ -149,8 +149,8 @@ "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/payments/cells", "//ios/chrome/browser/ui/settings/cells", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/ui/settings/utils", - "//ios/chrome/browser/ui/sync", "//ios/chrome/browser/voice", "//ios/chrome/browser/web:features", "//ios/chrome/browser/web:web", @@ -289,7 +289,7 @@ "//ios/chrome/browser/ui/collection_view/cells", "//ios/chrome/browser/ui/icons", "//ios/chrome/browser/ui/settings/cells", - "//ios/chrome/browser/ui/sync", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/voice", "//ios/chrome/browser/web", "//ios/chrome/browser/web:features",
diff --git a/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm b/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm index 958feff..e5ed62a 100644 --- a/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm
@@ -39,7 +39,7 @@ #import "ios/chrome/browser/ui/icons/chrome_icon.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
diff --git a/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.mm b/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.mm index 809e89b..1b337e1 100644 --- a/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.mm
@@ -5,7 +5,9 @@ #import "ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.h" #include "base/mac/foundation_util.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_item.h" +#import "ios/chrome/browser/web/features.h" #import "ios/chrome/browser/web/mailto_handler.h" #import "ios/chrome/browser/web/mailto_url_rewriter.h" #include "ios/chrome/grit/ios_strings.h" @@ -21,20 +23,32 @@ typedef NS_ENUM(NSInteger, SectionIdentifier) { SectionIdentifierMailtoHandlers = kSectionIdentifierEnumZero, + SectionIdentifierAlwaysAsk, }; typedef NS_ENUM(NSInteger, ItemType) { ItemTypeMailtoHandlers = kItemTypeEnumZero, + ItemTypeAlwaysAskSwitch, }; } // namespace @interface ComposeEmailHandlerCollectionViewController () { MailtoURLRewriter* _rewriter; + BOOL _selectionDisabled; + CollectionViewSwitchItem* _alwaysAskItem; } -// Returns the MailtoHandler at |indexPath|. +// Returns the MailtoHandler at |indexPath|. Returns nil if |indexPath| falls +// in a different section or outside of the range of available mail client apps. - (MailtoHandler*)handlerAtIndexPath:(NSIndexPath*)indexPath; + +// Callback function when the value of UISwitch |sender| in +// ItemTypeAlwaysAskSwitch item is changed by the user. +- (void)didToggleAlwaysAskSwitch:(id)sender; + +// Clears all selected state checkmarks from the list of mail handlers. +- (void)clearAllSelections; @end @implementation ComposeEmailHandlerCollectionViewController @@ -44,15 +58,20 @@ self = [super initWithLayout:layout style:CollectionViewControllerStyleAppBar]; if (self) { - self.title = l10n_util::GetNSString(IDS_IOS_COMPOSE_EMAIL_SETTING); - self.collectionViewAccessibilityIdentifier = - @"compose_email_handler_view_controller"; _rewriter = rewriter; - [self loadModel]; } return self; } +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = l10n_util::GetNSString(IDS_IOS_COMPOSE_EMAIL_SETTING); + self.collectionViewAccessibilityIdentifier = + @"compose_email_handler_view_controller"; + [self loadModel]; +} + - (void)loadModel { [super loadModel]; CollectionViewModel* model = self.collectionViewModel; @@ -67,6 +86,10 @@ CollectionViewTextItem* item = [[CollectionViewTextItem alloc] initWithType:ItemTypeMailtoHandlers]; [item setText:[handler appName]]; + // Sets the text color based on whether the mail app is available only. + // TODO(crbug.com/764622): The state of _selectionDisabled should be taken + // into account and show all selection as light gray if selection is + // disabled. if ([handler isAvailable]) { [item setTextColor:[[MDCPalette greyPalette] tint900]]; [item setAccessibilityTraits:UIAccessibilityTraitButton]; @@ -79,6 +102,18 @@ [model addItem:item toSectionWithIdentifier:SectionIdentifierMailtoHandlers]; } + + if (base::FeatureList::IsEnabled(kMailtoPromptInMdcStyle)) { + [model addSectionWithIdentifier:SectionIdentifierAlwaysAsk]; + _alwaysAskItem = + [[CollectionViewSwitchItem alloc] initWithType:ItemTypeAlwaysAskSwitch]; + _alwaysAskItem.text = + l10n_util::GetNSString(IDS_IOS_CHOOSE_EMAIL_ASK_TOGGLE); + _alwaysAskItem.on = currentHandlerID == nil; + _selectionDisabled = currentHandlerID == nil; + [model addItem:_alwaysAskItem + toSectionWithIdentifier:SectionIdentifierAlwaysAsk]; + } } #pragma mark - UICollectionViewDelegate @@ -86,29 +121,22 @@ - (BOOL)collectionView:(UICollectionView*)collectionView shouldSelectItemAtIndexPath:(NSIndexPath*)indexPath { // Disallow selection if the handler for the tapped row is not available. - return [[self handlerAtIndexPath:indexPath] isAvailable] && + return !_selectionDisabled && + [[self handlerAtIndexPath:indexPath] isAvailable] && [super collectionView:collectionView shouldSelectItemAtIndexPath:indexPath]; } -- (BOOL)collectionView:(UICollectionView*)collectionView - shouldHighlightItemAtIndexPath:(NSIndexPath*)indexPath { - // Disallow highlight (ripple effect) if the handler for the tapped row is not - // available. - return [[self handlerAtIndexPath:indexPath] isAvailable] && - [super collectionView:collectionView - shouldHighlightItemAtIndexPath:indexPath]; -} - - (void)collectionView:(UICollectionView*)collectionView didSelectItemAtIndexPath:(NSIndexPath*)indexPath { [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; CollectionViewModel* model = self.collectionViewModel; - // The items created in -loadModel are all MailtoHandlers type. CollectionViewTextItem* selectedItem = base::mac::ObjCCastStrict<CollectionViewTextItem>( [model itemAtIndexPath:indexPath]); + // Selection in rows other than mailto handlers should be prevented, so + // DCHECK here is correct. DCHECK_EQ(ItemTypeMailtoHandlers, selectedItem.type); // Do nothing if the tapped row is already chosen as the default. @@ -142,10 +170,66 @@ [self reconfigureCellsForItems:modifiedItems]; } +- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView + cellForItemAtIndexPath:(NSIndexPath*)indexPath { + UICollectionViewCell* cell = + [super collectionView:collectionView cellForItemAtIndexPath:indexPath]; + + NSInteger itemType = + [self.collectionViewModel itemTypeForIndexPath:indexPath]; + if (itemType == ItemTypeAlwaysAskSwitch) { + CollectionViewSwitchCell* switchCell = + base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); + [switchCell.switchView addTarget:self + action:@selector(didToggleAlwaysAskSwitch:) + forControlEvents:UIControlEventValueChanged]; + } + + return cell; +} + +#pragma mark - MDCCollectionViewStylingDelegate + +- (BOOL)collectionView:(UICollectionView*)collectionView + hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { + // Disallow highlight (ripple effect) if the handler for the tapped row is not + // an available mailto:// handler. + return _selectionDisabled || + ![[self handlerAtIndexPath:indexPath] isAvailable]; +} + #pragma mark - Private +- (void)didToggleAlwaysAskSwitch:(id)sender { + BOOL isOn = [sender isOn]; + [_alwaysAskItem setOn:isOn]; + if (!isOn) + [_rewriter setDefaultHandlerID:nil]; + _selectionDisabled = isOn; + [self clearAllSelections]; +} + +- (void)clearAllSelections { + // Iterates through the rows and remove the checkmark from any that has it. + NSMutableArray* modifiedItems = [NSMutableArray array]; + NSArray<CollectionViewItem*>* itemsInSection = [self.collectionViewModel + itemsInSectionWithIdentifier:SectionIdentifierMailtoHandlers]; + for (CollectionViewTextItem* textItem in itemsInSection) { + DCHECK_EQ(ItemTypeMailtoHandlers, textItem.type); + if (textItem.accessoryType == MDCCollectionViewCellAccessoryCheckmark) { + // Unchecks any currently checked selection. + textItem.accessoryType = MDCCollectionViewCellAccessoryNone; + [modifiedItems addObject:textItem]; + } + } + [self reconfigureCellsForItems:modifiedItems]; +} + - (MailtoHandler*)handlerAtIndexPath:(NSIndexPath*)indexPath { CollectionViewModel* model = self.collectionViewModel; + NSInteger itemType = [model itemTypeForIndexPath:indexPath]; + if (itemType != ItemTypeMailtoHandlers) + return nil; NSUInteger handlerIndex = [model indexInItemTypeForIndexPath:indexPath]; return [[_rewriter defaultHandlers] objectAtIndex:handlerIndex]; }
diff --git a/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller_unittest.mm index 991c4583..ac4db77 100644 --- a/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller_unittest.mm
@@ -4,6 +4,8 @@ #import "ios/chrome/browser/ui/settings/compose_email_handler_collection_view_controller.h" +#include "base/mac/foundation_util.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_item.h" #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h" #import "ios/chrome/browser/web/fake_mailto_handler_helpers.h" @@ -27,7 +29,7 @@ : public CollectionViewControllerTest { protected: // Before CreateController() is called, set |handers_| and optionally - // |defaultHandlerID_| ivars. They will be used to seed the construction of + // |default_handler_id_| ivars. They will be used to seed the construction of // a MailtoURLRewriter which in turn used for the construction of the // CollectionViewController. CollectionViewController* InstantiateController() override { @@ -35,21 +37,25 @@ base::FeatureList::IsEnabled(kMailtoPromptForUserChoice) ? [NullableMailtoURLRewriter mailtoURLRewriterWithStandardHandlers] : [[LegacyMailtoURLRewriter alloc] init]; + // Clears the state so unit tests start from a known state. + [[NSUserDefaults standardUserDefaults] + removeObjectForKey:[[rewriter_ class] userDefaultsKey]]; [rewriter_ setDefaultHandlers:handlers_]; - if (defaultHandlerID_) - [rewriter_ setDefaultHandlerID:defaultHandlerID_]; + if (default_handler_id_) + [rewriter_ setDefaultHandlerID:default_handler_id_]; return [[ComposeEmailHandlerCollectionViewController alloc] initWithRewriter:rewriter_]; } - // |handlers_| and |defaultHandlerID_| must be set before first call to + // |handlers_| and |default_handler_id_| must be set before first call to // CreateController(). NSArray<MailtoHandler*>* handlers_; - NSString* defaultHandlerID_; + NSString* default_handler_id_; MailtoURLRewriter* rewriter_; }; TEST_F(ComposeEmailHandlerCollectionViewControllerTest, TestConstructor) { + bool use_mdc_style = base::FeatureList::IsEnabled(kMailtoPromptInMdcStyle); handlers_ = @[ [[MailtoHandlerSystemMail alloc] init], [[FakeMailtoHandlerGmailInstalled alloc] init], @@ -61,7 +67,8 @@ // Checks that there is one section with all the available MailtoHandler // objects listed. - ASSERT_EQ(1, NumberOfSections()); + NSInteger expected_sections = use_mdc_style ? 2 : 1; + ASSERT_EQ(expected_sections, NumberOfSections()); // Array returned by -defaultHandlers is sorted by the name of the Mail app // and may not be in the same order as |handlers_|. NSArray<MailtoHandler*>* handlers = [rewriter_ defaultHandlers]; @@ -75,15 +82,20 @@ EXPECT_FALSE(item.detailText); // Checks that text cells are displayed differently depending on the // availability of the handlers. - UIColor* darkestTint = [[MDCPalette greyPalette] tint900]; + UIColor* darkest_tint = [[MDCPalette greyPalette] tint900]; if ([handler isAvailable]) { - EXPECT_EQ(darkestTint, item.textColor); + EXPECT_EQ(darkest_tint, item.textColor); EXPECT_NE(UIAccessibilityTraitNotEnabled, item.accessibilityTraits); } else { - EXPECT_NE(darkestTint, item.textColor); + EXPECT_NE(darkest_tint, item.textColor); EXPECT_EQ(UIAccessibilityTraitNotEnabled, item.accessibilityTraits); } } + if (use_mdc_style) { + bool is_on = [rewriter_ defaultHandlerID] == nil; + CheckSwitchCellStateAndTitleWithId(is_on, IDS_IOS_CHOOSE_EMAIL_ASK_TOGGLE, + 1, 0); + } } TEST_F(ComposeEmailHandlerCollectionViewControllerTest, TestSelection) { @@ -93,7 +105,7 @@ ]; // The UI will come up with the first handler listed in |handlers_| // in the selected state. - defaultHandlerID_ = [handlers_[0] appStoreID]; + default_handler_id_ = [handlers_[0] appStoreID]; CreateController(); CheckController(); @@ -112,7 +124,7 @@ int selection = -1; int number_of_handlers = [handlers count]; for (int index = 0; index < number_of_handlers; ++index) { - if (![defaultHandlerID_ isEqualToString:[handlers[index] appStoreID]]) { + if (![default_handler_id_ isEqualToString:[handlers[index] appStoreID]]) { selection = index; break; } @@ -126,3 +138,53 @@ EXPECT_EQ(1, [observer changeCount]); EXPECT_NSEQ([handlers[selection] appStoreID], [rewriter_ defaultHandlerID]); } + +// Tests the state of the mailto:// handler apps and as the "Always ask" +// switch is toggled. +TEST_F(ComposeEmailHandlerCollectionViewControllerTest, TestSwitchChanged) { + handlers_ = @[ + [[MailtoHandlerSystemMail alloc] init], + [[FakeMailtoHandlerGmailInstalled alloc] init] + ]; + // No default handler. + default_handler_id_ = nil; + CreateController(); + CheckController(); + + ComposeEmailHandlerCollectionViewController* test_view_controller = + base::mac::ObjCCastStrict<ComposeEmailHandlerCollectionViewController>( + controller()); + NSIndexPath* switch_index_path = [NSIndexPath indexPathForRow:0 inSection:1]; + CollectionViewSwitchCell* switch_cell = + base::mac::ObjCCastStrict<CollectionViewSwitchCell>([test_view_controller + collectionView:[test_view_controller collectionView] + cellForItemAtIndexPath:switch_index_path]); + // Default state of the switch is ON so user is always prompted to make + // a choice of which mailto:// handler app to use when tapping on a mailto:// + // URL. + EXPECT_TRUE(switch_cell.switchView.on); + + // Toggling the switch to OFF and verify. Then check that none of the + // mailto:// handler apps is checked. + switch_cell.switchView.on = NO; + [switch_cell.switchView + sendActionsForControlEvents:UIControlEventValueChanged]; + EXPECT_FALSE(switch_cell.switchView.on); + NSArray<MailtoHandler*>* handlers = [rewriter_ defaultHandlers]; + for (NSUInteger index = 0U; index < [handlers count]; ++index) { + CollectionViewTextItem* item = GetCollectionViewItem(0, index); + EXPECT_EQ(MDCCollectionViewCellAccessoryNone, item.accessoryType); + } + + // Toggling the switch back ON and verify. The list of mailto:// handler apps + // remain unchecked. + switch_cell.switchView.on = YES; + [switch_cell.switchView + sendActionsForControlEvents:UIControlEventValueChanged]; + EXPECT_TRUE(switch_cell.switchView.on); + handlers = [rewriter_ defaultHandlers]; + for (NSUInteger index = 0U; index < [handlers count]; ++index) { + CollectionViewTextItem* item = GetCollectionViewItem(0, index); + EXPECT_EQ(MDCCollectionViewCellAccessoryNone, item.accessoryType); + } +}
diff --git a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm index b055787..6dc6dd66 100644 --- a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm
@@ -65,9 +65,9 @@ #import "ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/settings_utils.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" #import "ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/browser/voice/speech_input_locale_config.h" #include "ios/chrome/grit/ios_chromium_strings.h"
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm index d6d5abb2..6f36e82 100644 --- a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm
@@ -34,7 +34,7 @@ #import "ios/chrome/browser/ui/settings/cells/passphrase_error_item.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/settings_utils.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm index 13c0d24..6396c3d 100644 --- a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm
@@ -23,7 +23,7 @@ #import "ios/chrome/browser/ui/settings/cells/byo_textfield_item.h" #import "ios/chrome/browser/ui/settings/cells/card_multiline_item.h" #import "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "testing/gtest_mac.h" #include "testing/platform_test.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm index 3da9c40..99307ab 100644 --- a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm
@@ -42,7 +42,7 @@ #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
diff --git a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm index efbddf8..62d95c36 100644 --- a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm
@@ -24,7 +24,7 @@ #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/web/public/test/test_web_thread_bundle.h" #import "testing/gtest_mac.h"
diff --git a/ios/chrome/browser/ui/sync/BUILD.gn b/ios/chrome/browser/ui/settings/sync_utils/BUILD.gn similarity index 95% rename from ios/chrome/browser/ui/sync/BUILD.gn rename to ios/chrome/browser/ui/settings/sync_utils/BUILD.gn index c7cc369..e31229a 100644 --- a/ios/chrome/browser/ui/sync/BUILD.gn +++ b/ios/chrome/browser/ui/settings/sync_utils/BUILD.gn
@@ -4,15 +4,13 @@ import("//ios/public/provider/chrome/browser/build_config.gni") -source_set("sync") { +source_set("sync_utils") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ "sync_error_infobar_delegate.h", "sync_error_infobar_delegate.mm", "sync_util.h", "sync_util.mm", - "synced_sessions_bridge.h", - "synced_sessions_bridge.mm", ] deps = [ "//base",
diff --git a/ios/chrome/browser/ui/sync/OWNERS b/ios/chrome/browser/ui/settings/sync_utils/OWNERS similarity index 100% rename from ios/chrome/browser/ui/sync/OWNERS rename to ios/chrome/browser/ui/settings/sync_utils/OWNERS
diff --git a/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h b/ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h similarity index 89% rename from ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h rename to ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h index 36d1f27..57cdd97 100644 --- a/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h +++ b/ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ -#define IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ +#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_ +#define IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_ #include <memory> @@ -68,4 +68,4 @@ DISALLOW_COPY_AND_ASSIGN(SyncErrorInfoBarDelegate); }; -#endif // IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ +#endif // IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_
diff --git a/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.mm b/ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.mm similarity index 96% rename from ios/chrome/browser/ui/sync/sync_error_infobar_delegate.mm rename to ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.mm index b43ebf76..46cfad3 100644 --- a/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.mm +++ b/ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.mm
@@ -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 "ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h" +#include "ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h" #import <UIKit/UIKit.h> @@ -22,8 +22,7 @@ #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/show_signin_command.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" -#include "ui/base/l10n/l10n_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/sync/sync_fake_server_egtest.mm b/ios/chrome/browser/ui/settings/sync_utils/sync_fake_server_egtest.mm similarity index 100% rename from ios/chrome/browser/ui/sync/sync_fake_server_egtest.mm rename to ios/chrome/browser/ui/settings/sync_utils/sync_fake_server_egtest.mm
diff --git a/ios/chrome/browser/ui/sync/sync_util.h b/ios/chrome/browser/ui/settings/sync_utils/sync_util.h similarity index 91% rename from ios/chrome/browser/ui/sync/sync_util.h rename to ios/chrome/browser/ui/settings/sync_utils/sync_util.h index 242eda5..50b1038 100644 --- a/ios/chrome/browser/ui/sync/sync_util.h +++ b/ios/chrome/browser/ui/settings/sync_utils/sync_util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_SYNC_SYNC_UTIL_H_ -#define IOS_CHROME_BROWSER_UI_SYNC_SYNC_UTIL_H_ +#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_UTIL_H_ +#define IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_UTIL_H_ #import <Foundation/Foundation.h> @@ -58,4 +58,4 @@ // Returns true if |errorState| corresponds to a transient sync error. bool IsTransientSyncError(SyncSetupService::SyncServiceState errorState); -#endif // IOS_CHROME_BROWSER_UI_SYNC_SYNC_UTIL_H_ +#endif // IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_UTIL_H_
diff --git a/ios/chrome/browser/ui/sync/sync_util.mm b/ios/chrome/browser/ui/settings/sync_utils/sync_util.mm similarity index 97% rename from ios/chrome/browser/ui/sync/sync_util.mm rename to ios/chrome/browser/ui/settings/sync_utils/sync_util.mm index fddf577..2d78511 100644 --- a/ios/chrome/browser/ui/sync/sync_util.mm +++ b/ios/chrome/browser/ui/settings/sync_utils/sync_util.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #include "base/metrics/histogram_macros.h" #include "components/infobars/core/infobar_manager.h" @@ -15,7 +15,7 @@ #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" #include "ios/chrome/browser/ui/commands/ios_command_ids.h" #import "ios/chrome/browser/ui/commands/show_signin_command.h" -#include "ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h" +#include "ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h" #include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -188,4 +188,3 @@ return false; } } -
diff --git a/ios/chrome/browser/ui/tab_switcher/BUILD.gn b/ios/chrome/browser/ui/tab_switcher/BUILD.gn index a074ded..c026466 100644 --- a/ios/chrome/browser/ui/tab_switcher/BUILD.gn +++ b/ios/chrome/browser/ui/tab_switcher/BUILD.gn
@@ -83,7 +83,7 @@ "//ios/chrome/browser/ui/keyboard", "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/ntp/recent_tabs/views", - "//ios/chrome/browser/ui/sync", + "//ios/chrome/browser/ui/settings/sync_utils", "//ios/chrome/browser/ui/tabs", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/web_state_list",
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h b/ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h index 0c52037..ced60da8 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h
@@ -5,14 +5,14 @@ #ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_MODEL_H_ #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_MODEL_H_ -#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> #include <string> #include "base/ios/block_types.h" #include "base/mac/scoped_nsobject.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/tabs/tab_model_observer.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/synced_sessions.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h" class ChromeBrowserState;
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm index ff59313..fa100eb 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm
@@ -19,7 +19,7 @@ #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/show_signin_command.h" #import "ios/chrome/browser/ui/material_components/activity_indicator.h" -#import "ios/chrome/browser/ui/sync/sync_util.h" +#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h" #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" #include "ios/chrome/grit/ios_chromium_strings.h"
diff --git a/ios/chrome/browser/ui/toolbar/BUILD.gn b/ios/chrome/browser/ui/toolbar/BUILD.gn index e4c5d56..f650ebb5 100644 --- a/ios/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/BUILD.gn
@@ -67,6 +67,7 @@ "//ios/chrome/browser/ui/history", "//ios/chrome/browser/ui/history_popup/requirements", "//ios/chrome/browser/ui/keyboard", + "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/popup_menu", "//ios/chrome/browser/ui/qr_scanner/requirements", "//ios/chrome/browser/ui/toolbar/keyboard_assist", @@ -79,7 +80,6 @@ "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/images", "//ios/public/provider/chrome/browser/voice", - "//ios/shared/chrome/browser/ui/omnibox", "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios", "//ios/web",
diff --git a/ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_keyboard_accessory_view.mm b/ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_keyboard_accessory_view.mm index b2ca394..fe0764e 100644 --- a/ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_keyboard_accessory_view.mm +++ b/ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_keyboard_accessory_view.mm
@@ -88,18 +88,32 @@ [self addSubview:searchStackView]; // Position the stack views. - NSArray* constraints = @[ - @"H:|-horizontalMargin-[searchStackView]-(>=0)-[shortcutStackView]", - @"[shortcutStackView]-horizontalMargin-|", - ]; - NSDictionary* viewsDictionary = @{ - @"searchStackView" : searchStackView, - @"shortcutStackView" : shortcutStackView, - }; - NSDictionary* metrics = @{ - @"horizontalMargin" : @(kHorizontalMargin), - }; - ApplyVisualConstraintsWithMetrics(constraints, viewsDictionary, metrics); + if (@available(iOS 11, *)) { + UILayoutGuide* layoutGuide = self.safeAreaLayoutGuide; + [NSLayoutConstraint activateConstraints:@[ + [searchStackView.leadingAnchor + constraintEqualToAnchor:layoutGuide.leadingAnchor + constant:kHorizontalMargin], + [shortcutStackView.trailingAnchor + constraintEqualToAnchor:layoutGuide.trailingAnchor + constant:-kHorizontalMargin], + [searchStackView.trailingAnchor + constraintLessThanOrEqualToAnchor:shortcutStackView.leadingAnchor] + ]]; + } else { + NSArray* constraints = @[ + @"H:|-horizontalMargin-[searchStackView]-(>=0)-[shortcutStackView]", + @"[shortcutStackView]-horizontalMargin-|", + ]; + NSDictionary* viewsDictionary = @{ + @"searchStackView" : searchStackView, + @"shortcutStackView" : shortcutStackView, + }; + NSDictionary* metrics = @{ + @"horizontalMargin" : @(kHorizontalMargin), + }; + ApplyVisualConstraintsWithMetrics(constraints, viewsDictionary, metrics); + } AddSameCenterYConstraint(searchStackView, self); AddSameCenterYConstraint(shortcutStackView, self); }
diff --git a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm index 98fefc0..daf3303 100644 --- a/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm +++ b/ios/chrome/browser/ui/toolbar/web_toolbar_controller.mm
@@ -44,7 +44,9 @@ #import "ios/chrome/browser/ui/commands/browser_commands.h" #include "ios/chrome/browser/ui/commands/start_voice_search_command.h" #import "ios/chrome/browser/ui/image_util.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_controller.h" #include "ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h" +#include "ios/chrome/browser/ui/omnibox/location_bar_delegate.h" #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_view.h" #import "ios/chrome/browser/ui/reversed_animation.h" @@ -65,8 +67,6 @@ #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #import "ios/public/provider/chrome/browser/images/branded_image_provider.h" #import "ios/public/provider/chrome/browser/voice/voice_search_provider.h" -#include "ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h" -#include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h" #import "ios/third_party/material_components_ios/src/components/ProgressView/src/MaterialProgressView.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
diff --git a/ios/chrome/browser/ui/uikit_ui_util.mm b/ios/chrome/browser/ui/uikit_ui_util.mm index 4048a89..72717c59 100644 --- a/ios/chrome/browser/ui/uikit_ui_util.mm +++ b/ios/chrome/browser/ui/uikit_ui_util.mm
@@ -15,6 +15,7 @@ #include "base/ios/ios_util.h" #include "base/logging.h" #include "base/mac/foundation_util.h" +#include "base/numerics/math_constants.h" #include "ios/chrome/browser/experimental_flags.h" #include "ios/chrome/browser/ui/rtl_geometry.h" #include "ios/chrome/browser/ui/ui_util.h" @@ -338,7 +339,8 @@ // output pixel. // CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale]; - NSUInteger radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5); + NSUInteger radius = + floor(inputRadius * 3. * sqrt(2 * base::kPiDouble) / 4 + 0.5); if (radius % 2 != 1) { // force radius to be odd so that the three box-blur methodology works. radius += 1;
diff --git a/ios/chrome/browser/web/BUILD.gn b/ios/chrome/browser/web/BUILD.gn index 05c2c86..cb6caa47 100644 --- a/ios/chrome/browser/web/BUILD.gn +++ b/ios/chrome/browser/web/BUILD.gn
@@ -44,7 +44,6 @@ "//ios/chrome/app/strings:ios_strings_grit", "//ios/chrome/browser", "//ios/chrome/browser/ui", - "//ios/chrome/browser/ui/alert_coordinator:alert_coordinator", "//ios/chrome/browser/ui/commands:commands", "//ios/chrome/browser/ui/util:util", "//ios/web", @@ -67,6 +66,7 @@ configs += [ "//build/config/compiler:enable_arc" ] sources = [ "page_placeholder_tab_helper_delegate.h", + "repost_form_tab_helper_delegate.h", "sad_tab_tab_helper_delegate.h", ] } @@ -94,9 +94,7 @@ ":web", "//base:base", "//base/test:test_support", - "//components/strings:components_strings_grit", "//ios/chrome/browser/browser_state:test_support", - "//ios/chrome/browser/ui:ui", "//ios/chrome/test:test_support", "//ios/web:web", "//ios/web/public/test", @@ -176,6 +174,7 @@ "//ios/chrome/browser/tabs", "//ios/chrome/browser/ui:ui_util", "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/external_app", "//ios/chrome/browser/ui/static_content", "//ios/chrome/browser/web", "//ios/public/provider/chrome/browser",
diff --git a/ios/chrome/browser/web/external_app_launcher.mm b/ios/chrome/browser/web/external_app_launcher.mm index 04d4944..6007bba4 100644 --- a/ios/chrome/browser/web/external_app_launcher.mm +++ b/ios/chrome/browser/web/external_app_launcher.mm
@@ -12,6 +12,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/open_url_util.h" +#import "ios/chrome/browser/ui/external_app/open_mail_handler_view_controller.h" #import "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/web/features.h" #import "ios/chrome/browser/web/legacy_mailto_url_rewriter.h" @@ -19,6 +20,7 @@ #import "ios/chrome/browser/web/mailto_url_rewriter.h" #import "ios/chrome/browser/web/nullable_mailto_url_rewriter.h" #include "ios/chrome/grit/ios_strings.h" +#include "ios/third_party/material_components_ios/src/components/BottomSheet/src/MDCBottomSheetController.h" #import "net/base/mac/url_conversions.h" #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" @@ -74,9 +76,9 @@ return @""; } -// Launches the mail client app chosen by |rewriter| and records metrics. -void LaunchMailClientApp(const GURL& URL, MailtoURLRewriter* rewriter) { - NSString* launchURL = [rewriter rewriteMailtoURL:URL]; +// Launches the mail client app represented by |handler| and records metrics. +void LaunchMailClientApp(const GURL& URL, MailtoHandler* handler) { + NSString* launchURL = [handler rewriteMailtoURL:URL]; UMA_HISTOGRAM_BOOLEAN("IOS.MailtoURLRewritten", launchURL != nil); NSURL* URLToOpen = [launchURL length] ? [NSURL URLWithString:launchURL] : net::NSURLWithGURL(URL); @@ -90,8 +92,12 @@ + (NSString*)formatCallArgument:(NSURL*)URL; // Shows a prompt for the user to choose which mail client app to use to // handle a mailto:// URL. -- (void)promptForMailClientWithURL:(const GURL)URL +- (void)promptForMailClientWithURL:(const GURL&)URL URLRewriter:(MailtoURLRewriter*)rewriter; +// Shows a prompt in Material Design for the user to choose which mail client +// app to use to handle a mailto:// URL. +- (void)promptMDCStyleForMailClientWithURL:(const GURL&)URL + URLRewriter:(MailtoURLRewriter*)rewriter; // Presents an alert controller with |prompt| and |openLabel| as button label // on the root view controller before launching an external app identified by // |URL|. @@ -118,7 +124,7 @@ return prompt; } -- (void)promptForMailClientWithURL:(const GURL)URL +- (void)promptForMailClientWithURL:(const GURL&)URL URLRewriter:(MailtoURLRewriter*)rewriter { // No user chosen default. Prompt user now. NSString* title = @@ -135,6 +141,7 @@ preferredStyle:style]; // There must be more than one available handlers to present a prompt to user. DCHECK([[rewriter defaultHandlers] count] > 1U); + GURL copiedURLToOpen = URL; for (MailtoHandler* handler in [rewriter defaultHandlers]) { if (![handler isAvailable]) continue; @@ -144,7 +151,7 @@ handler:^(UIAlertAction* _Nonnull action) { DCHECK(handler); [rewriter setDefaultHandlerID:[handler appStoreID]]; - LaunchMailClientApp(URL, rewriter); + LaunchMailClientApp(copiedURLToOpen, handler); }]; [alertController addAction:action]; } @@ -161,6 +168,23 @@ completion:nil]; } +- (void)promptMDCStyleForMailClientWithURL:(const GURL&)URL + URLRewriter:(MailtoURLRewriter*)rewriter { + GURL copiedURLToOpen = URL; + OpenMailHandlerViewController* mailHandlerChooser = + [[OpenMailHandlerViewController alloc] + initWithRewriter:rewriter + selectedHandler:^(MailtoHandler* _Nonnull handler) { + LaunchMailClientApp(copiedURLToOpen, handler); + }]; + MDCBottomSheetController* bottomSheet = [[MDCBottomSheetController alloc] + initWithContentViewController:mailHandlerChooser]; + [[[[UIApplication sharedApplication] keyWindow] rootViewController] + presentViewController:bottomSheet + animated:YES + completion:nil]; +} + - (void)openExternalAppWithURL:(NSURL*)URL prompt:(NSString*)prompt openLabel:(NSString*)openLabel { @@ -238,11 +262,16 @@ base::FeatureList::IsEnabled(kMailtoPromptForUserChoice) ? [NullableMailtoURLRewriter mailtoURLRewriterWithStandardHandlers] : [LegacyMailtoURLRewriter mailtoURLRewriterWithStandardHandlers]; - if (![rewriter defaultHandlerID]) { - [self promptForMailClientWithURL:gURL URLRewriter:rewriter]; + NSString* handlerID = [rewriter defaultHandlerID]; + if (!handlerID) { + if (base::FeatureList::IsEnabled(kMailtoPromptInMdcStyle)) + [self promptMDCStyleForMailClientWithURL:gURL URLRewriter:rewriter]; + else + [self promptForMailClientWithURL:gURL URLRewriter:rewriter]; return YES; } - LaunchMailClientApp(gURL, rewriter); + MailtoHandler* handler = [rewriter defaultHandlerByID:handlerID]; + LaunchMailClientApp(gURL, handler); return YES; }
diff --git a/ios/chrome/browser/web/features.h b/ios/chrome/browser/web/features.h index 0ba4a39..f749643 100644 --- a/ios/chrome/browser/web/features.h +++ b/ios/chrome/browser/web/features.h
@@ -16,4 +16,9 @@ // enabled only when kMailtoUrlRewriting is also enabled. extern const base::Feature kMailtoPromptForUserChoice; +// Feature flag to choose whether to use Material Design style bottom sheet +// to present choices to the user. With MDC, it is possible to show a custom +// row with a toggle switch to remember the setting for future use. +extern const base::Feature kMailtoPromptInMdcStyle; + #endif // IOS_CHROME_BROWSER_WEB_FEATURES_H_
diff --git a/ios/chrome/browser/web/features.mm b/ios/chrome/browser/web/features.mm index 80a2047..395aece 100644 --- a/ios/chrome/browser/web/features.mm +++ b/ios/chrome/browser/web/features.mm
@@ -13,3 +13,9 @@ // value here to enable or disable this feature. const base::Feature kMailtoPromptForUserChoice{ "MailtoPromptForUserChoice", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Feature flag to choose whether to use Material Design style bottom sheet +// to present choices to the user. Change the default value here to enable +// to disable this feature. +const base::Feature kMailtoPromptInMdcStyle{"MailtoPromptInMdcStyle", + base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/web/legacy_mailto_url_rewriter.mm b/ios/chrome/browser/web/legacy_mailto_url_rewriter.mm index b26e6c5..309317a 100644 --- a/ios/chrome/browser/web/legacy_mailto_url_rewriter.mm +++ b/ios/chrome/browser/web/legacy_mailto_url_rewriter.mm
@@ -107,6 +107,10 @@ return [handler appName]; } +- (MailtoHandler*)defaultHandlerByID:(NSString*)handlerID { + return _handlers[handlerID]; +} + - (NSString*)rewriteMailtoURL:(const GURL&)URL { NSString* value = [self defaultHandlerID]; if ([value length]) {
diff --git a/ios/chrome/browser/web/legacy_mailto_url_rewriter_unittest.mm b/ios/chrome/browser/web/legacy_mailto_url_rewriter_unittest.mm index f25a571d..2d8c260 100644 --- a/ios/chrome/browser/web/legacy_mailto_url_rewriter_unittest.mm +++ b/ios/chrome/browser/web/legacy_mailto_url_rewriter_unittest.mm
@@ -56,6 +56,8 @@ : [LegacyMailtoURLRewriter systemMailApp]; [rewriter setDefaultHandlerID:appStoreID]; EXPECT_NSEQ(expectedDefaultAppID, [rewriter defaultHandlerID]); + MailtoHandler* foundHandler = [rewriter defaultHandlerByID:appStoreID]; + EXPECT_NSEQ(handler, foundHandler); } }
diff --git a/ios/chrome/browser/web/mailto_url_rewriter.h b/ios/chrome/browser/web/mailto_url_rewriter.h index 16e1b94e56..df2e903 100644 --- a/ios/chrome/browser/web/mailto_url_rewriter.h +++ b/ios/chrome/browser/web/mailto_url_rewriter.h
@@ -48,6 +48,10 @@ // if a default has not been set. - (NSString*)defaultHandlerName; +// Returns the mailto:// handler app corresponding to |handlerID|. Returns nil +// if there is no handler corresponding to |handlerID|. +- (MailtoHandler*)defaultHandlerByID:(NSString*)handlerID; + // Rewrites |URL| into a new URL that can be "opened" to launch the Mail // client app. May return nil if |URL| is not a mailto: URL, a mail client // app has not been selected, or there are no Mail client app available.
diff --git a/ios/chrome/browser/web/mailto_url_rewriter.mm b/ios/chrome/browser/web/mailto_url_rewriter.mm index 060ba2ea..523ab53 100644 --- a/ios/chrome/browser/web/mailto_url_rewriter.mm +++ b/ios/chrome/browser/web/mailto_url_rewriter.mm
@@ -57,6 +57,11 @@ return nil; } +- (MailtoHandler*)defaultHandlerByID:(NSString*)handlerID { + NOTREACHED(); + return nil; +} + - (NSString*)rewriteMailtoURL:(const GURL&)gURL { NOTREACHED(); return nil;
diff --git a/ios/chrome/browser/web/nullable_mailto_url_rewriter.mm b/ios/chrome/browser/web/nullable_mailto_url_rewriter.mm index d968c51..a12bb6b 100644 --- a/ios/chrome/browser/web/nullable_mailto_url_rewriter.mm +++ b/ios/chrome/browser/web/nullable_mailto_url_rewriter.mm
@@ -84,12 +84,15 @@ } - (void)setDefaultHandlerID:(NSString*)appStoreID { - DCHECK([appStoreID length]); NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; NSString* defaultsKey = [[self class] userDefaultsKey]; - if ([appStoreID isEqual:[defaults objectForKey:defaultsKey]]) - return; - [defaults setObject:appStoreID forKey:defaultsKey]; + if (appStoreID) { + if ([appStoreID isEqual:[defaults objectForKey:defaultsKey]]) + return; + [defaults setObject:appStoreID forKey:defaultsKey]; + } else { + [defaults removeObjectForKey:defaultsKey]; + } [self.observer rewriterDidChange:self]; } @@ -101,6 +104,10 @@ return [handler appName]; } +- (MailtoHandler*)defaultHandlerByID:(NSString*)handlerID { + return _handlers[handlerID]; +} + - (NSString*)rewriteMailtoURL:(const GURL&)gURL { NSString* value = [self defaultHandlerID]; if ([value length]) {
diff --git a/ios/chrome/browser/web/nullable_mailto_url_rewriter_unittest.mm b/ios/chrome/browser/web/nullable_mailto_url_rewriter_unittest.mm index 80a1464..5ac83a3 100644 --- a/ios/chrome/browser/web/nullable_mailto_url_rewriter_unittest.mm +++ b/ios/chrome/browser/web/nullable_mailto_url_rewriter_unittest.mm
@@ -37,6 +37,8 @@ [handler isAvailable] ? appStoreID : [MailtoURLRewriter systemMailApp]; [rewriter setDefaultHandlerID:appStoreID]; EXPECT_NSEQ(expectedDefaultAppID, [rewriter defaultHandlerID]); + MailtoHandler* foundHandler = [rewriter defaultHandlerByID:appStoreID]; + EXPECT_NSEQ(handler, foundHandler); } } @@ -63,6 +65,20 @@ EXPECT_FALSE([rewriter defaultHandlerID]); } +// Tests that it is possible to unset the default handler. +TEST_F(NullableMailtoURLRewriterTest, TestUnsetDefaultHandler) { + NullableMailtoURLRewriter* rewriter = + [[NullableMailtoURLRewriter alloc] init]; + MailtoHandler* gmailInstalled = + [[FakeMailtoHandlerGmailInstalled alloc] init]; + MailtoHandler* systemMail = [[MailtoHandlerSystemMail alloc] init]; + [rewriter setDefaultHandlers:@[ systemMail, gmailInstalled ]]; + [rewriter setDefaultHandlerID:[systemMail appStoreID]]; + EXPECT_NSEQ([systemMail appStoreID], [rewriter defaultHandlerID]); + [rewriter setDefaultHandlerID:nil]; + EXPECT_FALSE([rewriter defaultHandlerID]); +} + // If Gmail was installed and user has made a choice, then Gmail is uninstalled. // The default returns to system Mail app. TEST_F(NullableMailtoURLRewriterTest, TestWithGmailUninstalled) {
diff --git a/ios/chrome/browser/web/repost_form_tab_helper.h b/ios/chrome/browser/web/repost_form_tab_helper.h index 5d68de4..2c91fbf 100644 --- a/ios/chrome/browser/web/repost_form_tab_helper.h +++ b/ios/chrome/browser/web/repost_form_tab_helper.h
@@ -9,32 +9,40 @@ #include "base/callback.h" #include "base/macros.h" -#import "base/mac/scoped_nsobject.h" #include "ios/web/public/web_state/web_state_observer.h" #import "ios/web/public/web_state/web_state_user_data.h" -@class RepostFormCoordinator; +@protocol RepostFormTabHelperDelegate; // Allows presenting a repost form dialog. Listens to web::WebState activity // and dismisses the dialog when necessary. class RepostFormTabHelper : public web::WebStateUserData<RepostFormTabHelper>, public web::WebStateObserver { public: - explicit RepostFormTabHelper(web::WebState* web_state); ~RepostFormTabHelper() override; + // Creates TabHelper. |delegate| is not retained by TabHelper and must not be + // null. + static void CreateForWebState(web::WebState* web_state, + id<RepostFormTabHelperDelegate> delegate); + // Presents a repost form dialog at the given |location|. |callback| is called // with true if the repost was confirmed and with false if it was cancelled. void PresentDialog(CGPoint location, const base::Callback<void(bool)>& callback); private: + RepostFormTabHelper(web::WebState* web_state, + id<RepostFormTabHelperDelegate> delegate); + // web::WebStateObserver overrides: void DidStartNavigation(web::NavigationContext* navigation_context) override; void WebStateDestroyed() override; - // Coordinates repost form dialog presentation. - base::scoped_nsobject<RepostFormCoordinator> coordinator_; + __weak id<RepostFormTabHelperDelegate> delegate_ = nil; + + // true if form repost dialog is currently being presented. + bool is_presenting_dialog_ = false; DISALLOW_COPY_AND_ASSIGN(RepostFormTabHelper); };
diff --git a/ios/chrome/browser/web/repost_form_tab_helper.mm b/ios/chrome/browser/web/repost_form_tab_helper.mm index ea4e198e..2cab22a2 100644 --- a/ios/chrome/browser/web/repost_form_tab_helper.mm +++ b/ios/chrome/browser/web/repost_form_tab_helper.mm
@@ -4,39 +4,55 @@ #import "ios/chrome/browser/web/repost_form_tab_helper.h" -#import "ios/chrome/browser/ui/alert_coordinator/repost_form_coordinator.h" -#import "ios/chrome/browser/ui/util/top_view_controller.h" +#import "ios/chrome/browser/web/repost_form_tab_helper_delegate.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif DEFINE_WEB_STATE_USER_DATA_KEY(RepostFormTabHelper); -RepostFormTabHelper::RepostFormTabHelper(web::WebState* web_state) - : web::WebStateObserver(web_state) {} +RepostFormTabHelper::RepostFormTabHelper( + web::WebState* web_state, + id<RepostFormTabHelperDelegate> delegate) + : web::WebStateObserver(web_state), delegate_(delegate) {} RepostFormTabHelper::~RepostFormTabHelper() = default; +void RepostFormTabHelper::CreateForWebState( + web::WebState* web_state, + id<RepostFormTabHelperDelegate> delegate) { + DCHECK(web_state); + DCHECK(delegate); + if (!FromWebState(web_state)) { + web_state->SetUserData( + UserDataKey(), + base::WrapUnique(new RepostFormTabHelper(web_state, delegate))); + } +} + void RepostFormTabHelper::PresentDialog( CGPoint location, const base::Callback<void(bool)>& callback) { - // TODO(crbug.com/754642): Stop using TopPresentedViewControllerFrom(). - UIViewController* top_controller = - top_view_controller::TopPresentedViewControllerFrom( - [UIApplication sharedApplication].keyWindow.rootViewController); - + DCHECK(!is_presenting_dialog_); + is_presenting_dialog_ = true; base::Callback<void(bool)> local_callback(callback); - coordinator_.reset([[RepostFormCoordinator alloc] - initWithBaseViewController:top_controller - dialogLocation:location - webState:web_state() - completionHandler:^(BOOL should_continue) { - local_callback.Run(should_continue); - }]); - [coordinator_ start]; + [delegate_ repostFormTabHelper:this + presentRepostFromDialogAtPoint:location + completionHandler:^(BOOL should_continue) { + is_presenting_dialog_ = false; + local_callback.Run(should_continue); + }]; } void RepostFormTabHelper::DidStartNavigation(web::NavigationContext*) { - coordinator_.reset(); + if (is_presenting_dialog_) + [delegate_ repostFormTabHelperDismissRepostFormDialog:this]; + is_presenting_dialog_ = false; } void RepostFormTabHelper::WebStateDestroyed() { - coordinator_.reset(); + if (is_presenting_dialog_) + [delegate_ repostFormTabHelperDismissRepostFormDialog:this]; + is_presenting_dialog_ = false; }
diff --git a/ios/chrome/browser/web/repost_form_tab_helper_delegate.h b/ios/chrome/browser/web/repost_form_tab_helper_delegate.h new file mode 100644 index 0000000..6987e6f --- /dev/null +++ b/ios/chrome/browser/web/repost_form_tab_helper_delegate.h
@@ -0,0 +1,28 @@ +// 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 IOS_CHROME_BROWSER_WEB_REPOST_FORM_TAB_HELPER_DELEGATE_H_ +#define IOS_CHROME_BROWSER_WEB_REPOST_FORM_TAB_HELPER_DELEGATE_H_ + +#import <Foundation/Foundation.h> + +class RepostFormTabHelper; + +// Delegate for RepostFormTabHelper. +@protocol RepostFormTabHelperDelegate<NSObject> + +// Asks the delegate to present repost form dialog at the given |location|. +// Delegate must call |completionHandler| with YES if form data should be +// reposted and with NO otherwise. +- (void)repostFormTabHelper:(RepostFormTabHelper*)tabHelper + presentRepostFromDialogAtPoint:(CGPoint)location + completionHandler:(void (^)(BOOL))completionHandler; + +// Asks the delegate to dismiss repost form dialog. +- (void)repostFormTabHelperDismissRepostFormDialog: + (RepostFormTabHelper*)tabHelper; + +@end + +#endif // IOS_CHROME_BROWSER_WEB_REPOST_FORM_TAB_HELPER_DELEGATE_H_
diff --git a/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm b/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm index eb64250..564c6640 100644 --- a/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm
@@ -7,20 +7,68 @@ #import <UIKit/UIKit.h> #include "base/bind.h" -#include "base/mac/foundation_util.h" -#include "base/test/ios/wait_util.h" -#include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/ui/ui_util.h" -#import "ios/chrome/test/scoped_key_window.h" +#include "base/mac/bind_objc_block.h" +#import "ios/chrome/browser/web/repost_form_tab_helper_delegate.h" #import "ios/web/public/test/fakes/test_web_state.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -#include "ui/base/l10n/l10n_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +// A configurable TabHelper delegate for testing. +@interface RepostFormTabHelperTestDelegate + : NSObject<RepostFormTabHelperDelegate> + +// YES if repost form dialog is currently presented. +@property(nonatomic, readonly, getter=isPresentingDialog) BOOL presentingDialog; + +// Location where the dialog was presented last time. +@property(nonatomic, assign) CGPoint location; + +// Tab helper which delegates to this class. +@property(nonatomic, assign) RepostFormTabHelper* tabHelper; + +// Calls |repostFormTabHelper:presentRepostFromDialogAtPoint:completionHandler:| +// completion handler. +- (void)allowRepost:(BOOL)shouldContinue; + +@end + +@implementation RepostFormTabHelperTestDelegate { + void (^_completionHandler)(BOOL); +} + +@synthesize presentingDialog = _presentingDialog; +@synthesize location = _location; +@synthesize tabHelper = _tabHelper; + +- (void)allowRepost:(BOOL)allow { + _completionHandler(allow); + _presentingDialog = NO; +} + +- (void)repostFormTabHelper:(RepostFormTabHelper*)helper + presentRepostFromDialogAtPoint:(CGPoint)location + completionHandler:(void (^)(BOOL))completionHandler { + EXPECT_EQ(_tabHelper, helper); + EXPECT_FALSE(_presentingDialog); + _presentingDialog = YES; + _location = location; + _completionHandler = [completionHandler copy]; +} + +- (void)repostFormTabHelperDismissRepostFormDialog: + (RepostFormTabHelper*)helper { + EXPECT_EQ(_tabHelper, helper); + EXPECT_TRUE(_presentingDialog); + _presentingDialog = NO; + _completionHandler = nil; +} + +@end + namespace { // Test location passed to RepostFormTabHelper. const CGFloat kDialogHLocation = 10; @@ -35,72 +83,73 @@ protected: RepostFormTabHelperTest() : web_state_(new web::TestWebState()), - location_(CGPointMake(kDialogHLocation, kDialogVLocation)), - view_controller_([[UIViewController alloc] init]) { - UIView* view = [[UIView alloc] initWithFrame:view_controller_.view.bounds]; - [view_controller_.view addSubview:view]; - [scoped_key_window_.Get() setRootViewController:view_controller_]; - - web_state_->SetView(view); - web_state_->SetWebUsageEnabled(true); - - RepostFormTabHelper::CreateForWebState(web_state_.get()); + delegate_([[RepostFormTabHelperTestDelegate alloc] init]), + location_(CGPointMake(kDialogHLocation, kDialogVLocation)) { + RepostFormTabHelper::CreateForWebState(web_state_.get(), delegate_); + delegate_.tabHelper = tab_helper(); } - // Presents a repost form dialog using RepostFormTabHelperTest. - void PresentDialog() { - ASSERT_FALSE(GetAlertController()); - auto* helper = RepostFormTabHelper::FromWebState(web_state_.get()); - helper->PresentDialog(location_, base::Bind(&IgnoreBool)); - ASSERT_TRUE(GetAlertController()); - } - - // Return presented view controller as UIAlertController. - UIAlertController* GetAlertController() const { - return base::mac::ObjCCastStrict<UIAlertController>( - view_controller_.presentedViewController); + RepostFormTabHelper* tab_helper() { + return RepostFormTabHelper::FromWebState(web_state_.get()); } protected: std::unique_ptr<web::TestWebState> web_state_; - - private: + RepostFormTabHelperTestDelegate* delegate_; CGPoint location_; - ScopedKeyWindow scoped_key_window_; - UIViewController* view_controller_; }; -// Tests presented repost form dialog. -TEST_F(RepostFormTabHelperTest, Preseting) { - PresentDialog(); - EXPECT_FALSE(GetAlertController().title); - EXPECT_TRUE([GetAlertController().message - containsString:l10n_util::GetNSString(IDS_HTTP_POST_WARNING_TITLE)]); - EXPECT_TRUE([GetAlertController().message - containsString:l10n_util::GetNSString(IDS_HTTP_POST_WARNING)]); - if (IsIPadIdiom()) { - UIPopoverPresentationController* popover_presentation_controller = - GetAlertController().popoverPresentationController; - CGRect source_rect = popover_presentation_controller.sourceRect; - EXPECT_EQ(kDialogHLocation, CGRectGetMinX(source_rect)); - EXPECT_EQ(kDialogVLocation, CGRectGetMinY(source_rect)); - } +// Tests presentation location. +TEST_F(RepostFormTabHelperTest, Location) { + EXPECT_FALSE(CGPointEqualToPoint(delegate_.location, location_)); + tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool)); + EXPECT_TRUE(CGPointEqualToPoint(delegate_.location, location_)); +} + +// Tests cancelling repost. +TEST_F(RepostFormTabHelperTest, CancelRepost) { + ASSERT_FALSE(delegate_.presentingDialog); + __block bool callback_called = false; + tab_helper()->PresentDialog(location_, base::BindBlockArc(^(bool repost) { + EXPECT_FALSE(repost); + callback_called = true; + })); + EXPECT_TRUE(delegate_.presentingDialog); + + ASSERT_FALSE(callback_called); + [delegate_ allowRepost:NO]; + EXPECT_TRUE(callback_called); +} + +// Tests allowing repost. +TEST_F(RepostFormTabHelperTest, AllowRepost) { + ASSERT_FALSE(delegate_.presentingDialog); + __block bool callback_called = false; + tab_helper()->PresentDialog(location_, base::BindBlockArc(^(bool repost) { + EXPECT_TRUE(repost); + callback_called = true; + })); + EXPECT_TRUE(delegate_.presentingDialog); + + ASSERT_FALSE(callback_called); + [delegate_ allowRepost:YES]; + EXPECT_TRUE(callback_called); } // Tests that dialog is dismissed when WebState is destroyed. -TEST_F(RepostFormTabHelperTest, DismissingOnWebViewDestruction) { - PresentDialog(); +TEST_F(RepostFormTabHelperTest, DismissingOnWebStateDestruction) { + ASSERT_FALSE(delegate_.presentingDialog); + tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool)); + EXPECT_TRUE(delegate_.presentingDialog); web_state_.reset(); - base::test::ios::WaitUntilCondition(^{ - return GetAlertController() != nil; - }); + EXPECT_FALSE(delegate_.presentingDialog); } // Tests that dialog is dismissed after provisional navigation has started. TEST_F(RepostFormTabHelperTest, DismissingOnNavigationStart) { - PresentDialog(); + ASSERT_FALSE(delegate_.presentingDialog); + tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool)); + EXPECT_TRUE(delegate_.presentingDialog); web_state_->OnNavigationStarted(nullptr /* navigation_context */); - base::test::ios::WaitUntilCondition(^{ - return GetAlertController() != nil; - }); + EXPECT_FALSE(delegate_.presentingDialog); }
diff --git a/ios/chrome/browser/web/sad_tab_tab_helper.h b/ios/chrome/browser/web/sad_tab_tab_helper.h index 93a12db3..4aa9ed4 100644 --- a/ios/chrome/browser/web/sad_tab_tab_helper.h +++ b/ios/chrome/browser/web/sad_tab_tab_helper.h
@@ -30,6 +30,9 @@ double repeat_failure_interval, id<SadTabTabHelperDelegate> delegate); + // Sets the SadTabHelper delegate. + void SetDelegate(id<SadTabTabHelperDelegate> delegate); + ~SadTabTabHelper() override; private:
diff --git a/ios/chrome/browser/web/sad_tab_tab_helper.mm b/ios/chrome/browser/web/sad_tab_tab_helper.mm index d575077..8b47e71 100644 --- a/ios/chrome/browser/web/sad_tab_tab_helper.mm +++ b/ios/chrome/browser/web/sad_tab_tab_helper.mm
@@ -68,6 +68,10 @@ } } +void SadTabTabHelper::SetDelegate(id<SadTabTabHelperDelegate> delegate) { + delegate_ = delegate; +} + void SadTabTabHelper::WasShown() { is_visible_ = true;
diff --git a/ios/chrome/content_widget_extension/content_widget_view.mm b/ios/chrome/content_widget_extension/content_widget_view.mm index 65f2100..195fc163 100644 --- a/ios/chrome/content_widget_extension/content_widget_view.mm +++ b/ios/chrome/content_widget_extension/content_widget_view.mm
@@ -23,7 +23,7 @@ // Number of rows in the widget. Note that modifying this value will not add // extra rows and will break functionality unless additional changes are made. const int kRows = 2; -} +} // namespace @interface ContentWidgetView () @@ -184,7 +184,25 @@ if (faviconImage) { attributes = [FaviconAttributes attributesWithImage:faviconImage]; } - } else { + } + if (!attributes) { + if ([site.fallbackMonogram length] == 0) { + // Something bad happened when saving the icon. Switch to best effort to + // show something to the user. + site.fallbackMonogram = @""; + } + if (!site.fallbackTextColor || !site.fallbackBackgroundColor) { + // Something bad happened when saving the icon. Switch to best effort to + // show something to the user. + // kDefaultTextColor = SK_ColorWHITE; + site.fallbackTextColor = [UIColor whiteColor]; + // kDefaultBackgroundColor = SkColorSetRGB(0x78, 0x78, 0x78); + site.fallbackBackgroundColor = [UIColor colorWithRed:0x78 / 255.0f + green:0x78 / 255.0f + blue:0x78 / 255.0f + alpha:1]; + site.fallbackIsDefaultColor = YES; + } attributes = [FaviconAttributes attributesWithMonogram:site.fallbackMonogram textColor:site.fallbackTextColor
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index 70f1af9..2cd8c84c4 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -185,6 +185,7 @@ "//ios/chrome/browser/ui/dialogs:unit_tests_internal", "//ios/chrome/browser/ui/downloads:unit_tests", "//ios/chrome/browser/ui/elements:unit_tests", + "//ios/chrome/browser/ui/external_app:unit_tests", "//ios/chrome/browser/ui/fancy_ui:unit_tests", "//ios/chrome/browser/ui/first_run:unit_tests", "//ios/chrome/browser/ui/history:unit_tests",
diff --git a/ios/chrome/test/earl_grey/BUILD.gn b/ios/chrome/test/earl_grey/BUILD.gn index eee03882..aa53f14 100644 --- a/ios/chrome/test/earl_grey/BUILD.gn +++ b/ios/chrome/test/earl_grey/BUILD.gn
@@ -73,8 +73,8 @@ "//ios/chrome/browser/ui/qr_scanner:eg_tests", "//ios/chrome/browser/ui/sad_tab:eg_tests", "//ios/chrome/browser/ui/safe_mode:eg_tests", + "//ios/chrome/browser/ui/settings/sync_utils:eg_tests", "//ios/chrome/browser/ui/stack_view:eg_tests", - "//ios/chrome/browser/ui/sync:eg_tests", "//ios/chrome/browser/ui/tab_switcher:eg_tests", "//ios/chrome/browser/ui/tabs:eg_tests", "//ios/chrome/browser/ui/toolbar:eg_tests",
diff --git a/ios/clean/chrome/browser/DEPS b/ios/clean/chrome/browser/DEPS index 284a02e..8e9bc2b3 100644 --- a/ios/clean/chrome/browser/DEPS +++ b/ios/clean/chrome/browser/DEPS
@@ -3,6 +3,7 @@ "+components/browser_sync", "+components/ntp_snippets", "+components/ntp_tiles", + "+components/prefs", "+components/reading_list", "+components/sessions", "+components/sync_sessions",
diff --git a/ios/clean/chrome/browser/ui/ntp/BUILD.gn b/ios/clean/chrome/browser/ui/ntp/BUILD.gn index 7cecfeb..95200664e 100644 --- a/ios/clean/chrome/browser/ui/ntp/BUILD.gn +++ b/ios/clean/chrome/browser/ui/ntp/BUILD.gn
@@ -14,14 +14,18 @@ "ntp_incognito_coordinator.mm", "ntp_mediator.h", "ntp_mediator.mm", + "ntp_metrics_recorder.h", + "ntp_metrics_recorder.mm", ] configs += [ "//build/config/compiler:enable_arc" ] deps = [ ":ntp_ui", + "//base", "//components/ntp_snippets", "//components/ntp_tiles", + "//components/prefs", "//components/reading_list/core", "//components/strings", "//ios/chrome/app/strings:ios_strings_grit", @@ -42,6 +46,7 @@ "//ios/chrome/browser/ui/content_suggestions:content_suggestions_util", "//ios/chrome/browser/ui/content_suggestions/cells", "//ios/chrome/browser/ui/coordinators", + "//ios/chrome/browser/ui/metrics", "//ios/chrome/browser/ui/ntp", "//ios/chrome/browser/ui/ntp:ntp_controller", "//ios/chrome/browser/ui/ntp:ntp_internal", @@ -98,12 +103,21 @@ "ntp_home_header_view_controller_unittest.mm", "ntp_incognito_coordinator_unittest.mm", "ntp_mediator_unittest.mm", + "ntp_metrics_recorder_unittest.mm", "ntp_view_controller_unittest.mm", ] deps = [ ":ntp", ":ntp_ui", + "//base", + "//base/test:test_support", + "//components/prefs", + "//components/prefs:test_support", + "//ios/chrome/browser", + "//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant", + "//ios/chrome/browser/ui/metrics:test_support", + "//ios/clean/chrome/browser/ui/commands", "//testing/gtest", ] configs += [ "//build/config/compiler:enable_arc" ]
diff --git a/ios/clean/chrome/browser/ui/ntp/ntp_coordinator.mm b/ios/clean/chrome/browser/ui/ntp/ntp_coordinator.mm index 6d8a5a2..8028e9ef 100644 --- a/ios/clean/chrome/browser/ui/ntp/ntp_coordinator.mm +++ b/ios/clean/chrome/browser/ui/ntp/ntp_coordinator.mm
@@ -17,9 +17,12 @@ #import "ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.h" #import "ios/clean/chrome/browser/ui/ntp/ntp_incognito_coordinator.h" #import "ios/clean/chrome/browser/ui/ntp/ntp_mediator.h" +#import "ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h" #import "ios/clean/chrome/browser/ui/ntp/ntp_view_controller.h" #import "ios/clean/chrome/browser/ui/recent_tabs/recent_tabs_coordinator.h" +class PrefService; + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -31,6 +34,7 @@ @property(nonatomic, strong) BookmarksCoordinator* bookmarksCoordinator; @property(nonatomic, strong) RecentTabsCoordinator* recentTabsCoordinator; @property(nonatomic, strong) NTPIncognitoCoordinator* incognitoCoordinator; +@property(nonatomic, strong) NTPMetricsRecorder* metricsRecorder; @end @implementation NTPCoordinator @@ -40,6 +44,7 @@ @synthesize bookmarksCoordinator = _bookmarksCoordinator; @synthesize recentTabsCoordinator = _recentTabsCoordinator; @synthesize incognitoCoordinator = _incognitoCoordinator; +@synthesize metricsRecorder = _metricsRecorder; - (void)start { if (self.started) @@ -58,6 +63,13 @@ broadcastValue:@"selectedNTPPanel" ofObject:self.viewController selector:@selector(broadcastSelectedNTPPanel:)]; + + PrefService* prefs = + ios::ChromeBrowserState::FromBrowserState(self.browser->browser_state()) + ->GetPrefs(); + self.metricsRecorder = [[NTPMetricsRecorder alloc] initWithPrefService:prefs]; + [self.dispatcher registerMetricsRecorder:self.metricsRecorder + forSelector:@selector(showNTPHomePanel)]; [super start]; }
diff --git a/ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.mm b/ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.mm index c9ce556..7dae92a 100644 --- a/ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.mm +++ b/ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.mm
@@ -16,12 +16,10 @@ #import "ios/chrome/browser/content_suggestions/content_suggestions_alert_factory.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_metrics_recorder.h" -#import "ios/chrome/browser/content_suggestions/ntp_home_metrics.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h" #include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h" -#include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" #import "ios/chrome/browser/ui/browser_list/browser.h" @@ -100,16 +98,6 @@ self.browser->browser_state()); contentSuggestionsService->remote_suggestions_scheduler() ->OnSuggestionsSurfaceOpened(); - PrefService* prefs = - ios::ChromeBrowserState::FromBrowserState(self.browser->browser_state()) - ->GetPrefs(); - bool contentSuggestionsEnabled = - prefs->GetBoolean(prefs::kSearchSuggestEnabled); - if (contentSuggestionsEnabled) { - ntp_home::RecordNTPImpression(ntp_home::REMOTE_SUGGESTIONS); - } else { - ntp_home::RecordNTPImpression(ntp_home::LOCAL_SUGGESTIONS); - } self.viewController = [[ContentSuggestionsViewController alloc] initWithStyle:CollectionViewControllerStyleDefault];
diff --git a/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h new file mode 100644 index 0000000..fb281cb --- /dev/null +++ b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h
@@ -0,0 +1,26 @@ +// 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 IOS_CLEAN_CHROME_BROWSER_UI_NTP_NTP_METRICS_RECORDER_H_ +#define IOS_CLEAN_CHROME_BROWSER_UI_NTP_NTP_METRICS_RECORDER_H_ + +#import <Foundation/Foundation.h> + +#import "ios/chrome/browser/ui/metrics/metrics_recorder.h" + +class PrefService; + +// Metrics Recorder for the NTP. +@interface NTPMetricsRecorder : NSObject<MetricsRecorder> + +// Initializes this MetricsRecorder. |prefs| should be the PrefService used +// to store NTP-relevant prefs and must live for the lifetime of this object. +- (instancetype)initWithPrefService:(PrefService*)prefs + NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +#endif // IOS_CLEAN_CHROME_BROWSER_UI_NTP_NTP_METRICS_RECORDER_H_
diff --git a/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.mm b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.mm new file mode 100644 index 0000000..fb523a42 --- /dev/null +++ b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.mm
@@ -0,0 +1,50 @@ +// 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. + +#import "ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h" + +#include "base/logging.h" +#include "components/prefs/pref_service.h" +#import "ios/chrome/browser/content_suggestions/ntp_home_metrics.h" +#include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" +#import "ios/clean/chrome/browser/ui/commands/ntp_commands.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface NTPMetricsRecorder () + +// The PrefService in which relevant NTP preferences are stored. +@property(nonatomic, assign, readonly) PrefService* prefService; + +@end + +@implementation NTPMetricsRecorder + +@synthesize prefService = _prefService; + +- (instancetype)initWithPrefService:(PrefService*)prefs { + self = [super init]; + if (self) { + _prefService = prefs; + } + return self; +} + +- (void)recordMetricForInvocation:(NSInvocation*)anInvocation { + // As of now, this recorder supports recording for only |showNTPHomePanel|. + // So, DCHECK to ensure that other selectors do not trigger this recorder. + DCHECK(anInvocation.selector == @selector(showNTPHomePanel)); + bool contentSuggestionsEnabled = + self.prefService->GetBoolean(prefs::kSearchSuggestEnabled); + if (contentSuggestionsEnabled) { + ntp_home::RecordNTPImpression(ntp_home::REMOTE_SUGGESTIONS); + } else { + ntp_home::RecordNTPImpression(ntp_home::LOCAL_SUGGESTIONS); + } +} + +@end
diff --git a/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder_unittest.mm b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder_unittest.mm new file mode 100644 index 0000000..ec12195 --- /dev/null +++ b/ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder_unittest.mm
@@ -0,0 +1,74 @@ +// 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. + +#import "ios/clean/chrome/browser/ui/ntp/ntp_metrics_recorder.h" + +#import <Foundation/Foundation.h> +#include <memory> + +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/test/histogram_tester.h" +#include "base/values.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/testing_pref_service.h" +#include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" +#import "ios/chrome/browser/ui/metrics/metrics_test_util.h" +#import "ios/clean/chrome/browser/ui/commands/ntp_commands.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// Test fixture for the NTPMetricsRecorder unit tests. +class NtpMetricsRecorderTest : public PlatformTest { + protected: + NtpMetricsRecorderTest() + : recorder_([[NTPMetricsRecorder alloc] initWithPrefService:&prefs_]) {} + + void SetUp() override { + prefs_.registry()->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); + } + + // Reports logging of histogram information. + base::HistogramTester histogram_tester_; + // Test PrefService. + TestingPrefServiceSimple prefs_; + // NTPMetricsRecorder under test. + __strong NTPMetricsRecorder* recorder_; + + private: + DISALLOW_COPY_AND_ASSIGN(NtpMetricsRecorderTest); +}; + +// Tests that NTPMetricsRecorder logs the correct histogram bucket when +// Search Suggest is enabled and |recordMetricForInvocation:| is called. +TEST_F(NtpMetricsRecorderTest, ShowNtpHomePanelSuggestEnabled) { + prefs_.SetUserPref(prefs::kSearchSuggestEnabled, + std::make_unique<base::Value>(true)); + + NSInvocation* invocation = GetInvocationForProtocolInstanceMethod( + @protocol(NTPCommands), @selector(showNTPHomePanel), YES); + [recorder_ recordMetricForInvocation:invocation]; + + histogram_tester_.ExpectUniqueSample("IOS.NTP.Impression", + ntp_home::REMOTE_SUGGESTIONS, 1); +} + +// Tests that NTPMetricsRecorder logs the correct histogram bucket when +// Search Suggest is disabled and |recordMetricForInvocation:| is called. +TEST_F(NtpMetricsRecorderTest, ShowNtpHomePanelSuggestDisabled) { + prefs_.SetUserPref(prefs::kSearchSuggestEnabled, + std::make_unique<base::Value>(false)); + + NSInvocation* invocation = GetInvocationForProtocolInstanceMethod( + @protocol(NTPCommands), @selector(showNTPHomePanel), YES); + [recorder_ recordMetricForInvocation:invocation]; + + histogram_tester_.ExpectUniqueSample("IOS.NTP.Impression", + ntp_home::LOCAL_SUGGESTIONS, 1); +}
diff --git a/ios/clean/chrome/browser/ui/omnibox/BUILD.gn b/ios/clean/chrome/browser/ui/omnibox/BUILD.gn index 7b8474b..3e04ad5 100644 --- a/ios/clean/chrome/browser/ui/omnibox/BUILD.gn +++ b/ios/clean/chrome/browser/ui/omnibox/BUILD.gn
@@ -16,11 +16,11 @@ "//ios/chrome/browser/ssl", "//ios/chrome/browser/ui/browser_list", "//ios/chrome/browser/ui/coordinators", + "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/omnibox:omnibox_internal", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/web_state_list", "//ios/clean/chrome/browser", - "//ios/shared/chrome/browser/ui/omnibox", "//ios/web", ] configs += [ "//build/config/compiler:enable_arc" ]
diff --git a/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.h b/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.h index 69f6b42..5ae3afb 100644 --- a/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.h +++ b/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.h
@@ -8,7 +8,7 @@ #import <Foundation/Foundation.h> #include <memory> -#import "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" +#import "ios/chrome/browser/ui/omnibox/location_bar_delegate.h" class LocationBarController; class WebStateList;
diff --git a/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.mm b/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.mm index 28ed49e..200a181a 100644 --- a/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.mm +++ b/ios/clean/chrome/browser/ui/omnibox/location_bar_mediator.mm
@@ -7,11 +7,11 @@ #include "base/memory/ptr_util.h" #include "base/scoped_observer.h" #include "base/strings/utf_string_conversions.h" +#import "ios/chrome/browser/ui/omnibox/location_bar_controller.h" #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" #include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" -#import "ios/shared/chrome/browser/ui/omnibox/location_bar_controller.h" #import "ios/web/public/navigation_manager.h" #import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state_observer_bridge.h"
diff --git a/ios/clean/chrome/browser/ui/overlays/overlay_scheduler_unittest.mm b/ios/clean/chrome/browser/ui/overlays/overlay_scheduler_unittest.mm index 5c50e81..1a694f8 100644 --- a/ios/clean/chrome/browser/ui/overlays/overlay_scheduler_unittest.mm +++ b/ios/clean/chrome/browser/ui/overlays/overlay_scheduler_unittest.mm
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #import "ios/chrome/browser/ui/coordinators/browser_coordinator_test.h" +#import "ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_opener.h" #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h" @@ -90,6 +91,7 @@ TestOverlayCoordinator* overlay = [[TestOverlayCoordinator alloc] init]; queue->AddBrowserOverlay(overlay, parent); EXPECT_EQ(parent.presentedOverlay, overlay); + WaitForBrowserCoordinatorActivation(overlay); EXPECT_TRUE(scheduler()->IsShowingOverlay()); [overlay stop]; EXPECT_EQ(parent.presentedOverlay, nil); @@ -112,6 +114,7 @@ TestOverlayCoordinator* overlay = [[TestOverlayCoordinator alloc] init]; queue->AddWebStateOverlay(overlay); EXPECT_EQ(parent.presentedOverlay, overlay); + WaitForBrowserCoordinatorActivation(overlay); EXPECT_TRUE(scheduler()->IsShowingOverlay()); [overlay stop]; EXPECT_EQ(parent.presentedOverlay, nil); @@ -142,6 +145,7 @@ // Verify that the overlay is presented and the active WebState index is // updated. EXPECT_EQ(parent.presentedOverlay, overlay); + WaitForBrowserCoordinatorActivation(overlay); EXPECT_TRUE(scheduler()->IsShowingOverlay()); EXPECT_EQ(observer()->active_index(), 0); [overlay stop]; @@ -171,6 +175,7 @@ TestOverlayCoordinator* overlay_0 = [[TestOverlayCoordinator alloc] init]; queue_0->AddWebStateOverlay(overlay_0); EXPECT_EQ(parent_0.presentedOverlay, overlay_0); + WaitForBrowserCoordinatorActivation(overlay_0); EXPECT_TRUE(scheduler()->IsShowingOverlay()); EXPECT_EQ(observer()->active_index(), 0); // Add an overlay to the queue corresponding with the second WebState. @@ -186,6 +191,7 @@ // presented and the active index updated. [overlay_0 stop]; EXPECT_EQ(parent_1.presentedOverlay, overlay_1); + WaitForBrowserCoordinatorActivation(overlay_1); EXPECT_TRUE(scheduler()->IsShowingOverlay()); EXPECT_EQ(observer()->active_index(), 1); EXPECT_EQ(parent_0.presentedOverlay, nil);
diff --git a/ios/clean/chrome/browser/ui/overlays/test_helpers/BUILD.gn b/ios/clean/chrome/browser/ui/overlays/test_helpers/BUILD.gn index d41e748..ce7ed7d 100644 --- a/ios/clean/chrome/browser/ui/overlays/test_helpers/BUILD.gn +++ b/ios/clean/chrome/browser/ui/overlays/test_helpers/BUILD.gn
@@ -30,6 +30,7 @@ "//ios/clean/chrome/browser/ui/commands", "//ios/clean/chrome/browser/ui/overlays", "//ios/clean/chrome/browser/ui/overlays:overlays_internal", + "//ios/testing:ios_test_support", "//ios/web", "//testing/gtest", ]
diff --git a/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.h b/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.h index 1b3a263..fe9d832 100644 --- a/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.h +++ b/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.h
@@ -16,9 +16,15 @@ class TestOverlayQueue : public OverlayQueue { public: TestOverlayQueue(); - void StartNextOverlay() override; + + // Adds |overlay| to queue to be started over |parent_|. void AddOverlay(OverlayCoordinator* overlay); + // Starts the first overlay in the queue using |parent_| as the parent + // coordinator. Waits until the overlay's view controller has finished being + // presented before returning. + void StartNextOverlay() override; + // Seting the Browser also sets the Browser of |parent_|, which will be passed // along to OverlayCoordinators presented by this queue when they are started. Browser* browser() const { return browser_; }
diff --git a/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.mm b/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.mm index 80797a1..5f1148d20 100644 --- a/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.mm +++ b/ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.mm
@@ -4,9 +4,13 @@ #import "ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_queue.h" +#import "ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h" +#import "ios/chrome/browser/ui/coordinators/browser_coordinator_test_util.h" #import "ios/clean/chrome/browser/ui/overlays/overlay_coordinator+internal.h" #import "ios/clean/chrome/browser/ui/overlays/overlay_coordinator.h" #import "ios/clean/chrome/browser/ui/overlays/test_helpers/test_overlay_parent_coordinator.h" +#import "ios/testing/wait_util.h" +#include "testing/gtest/include/gtest/gtest.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,15 +19,18 @@ TestOverlayQueue::TestOverlayQueue() : OverlayQueue(), parent_([[TestOverlayParentCoordinator alloc] init]) {} -void TestOverlayQueue::StartNextOverlay() { - [GetFirstOverlay() startOverlayingCoordinator:parent_]; - OverlayWasStarted(); -} - void TestOverlayQueue::AddOverlay(OverlayCoordinator* overlay) { OverlayQueue::AddOverlay(overlay); } +void TestOverlayQueue::StartNextOverlay() { + OverlayCoordinator* overlay = GetFirstOverlay(); + EXPECT_TRUE(overlay); + [overlay startOverlayingCoordinator:parent_]; + OverlayWasStarted(); + WaitForBrowserCoordinatorActivation(overlay); +} + void TestOverlayQueue::SetBrowser(Browser* browser) { browser_ = browser; parent_.browser = browser;
diff --git a/ios/clean/chrome/browser/ui/recent_tabs/BUILD.gn b/ios/clean/chrome/browser/ui/recent_tabs/BUILD.gn index 0032b04..e4360e2 100644 --- a/ios/clean/chrome/browser/ui/recent_tabs/BUILD.gn +++ b/ios/clean/chrome/browser/ui/recent_tabs/BUILD.gn
@@ -20,7 +20,6 @@ "//ios/chrome/browser/ui/browser_list", "//ios/chrome/browser/ui/coordinators", "//ios/chrome/browser/ui/ntp/recent_tabs", - "//ios/chrome/browser/ui/sync", "//ios/clean/chrome/browser/ui", "//ios/clean/chrome/browser/ui/adaptor", "//ios/clean/chrome/browser/ui/commands",
diff --git a/ios/clean/chrome/browser/ui/recent_tabs/recent_tabs_coordinator.mm b/ios/clean/chrome/browser/ui/recent_tabs/recent_tabs_coordinator.mm index 106aa94..40d2d0df 100644 --- a/ios/clean/chrome/browser/ui/recent_tabs/recent_tabs_coordinator.mm +++ b/ios/clean/chrome/browser/ui/recent_tabs/recent_tabs_coordinator.mm
@@ -14,13 +14,13 @@ #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" +#import "ios/chrome/browser/sync/synced_sessions_bridge.h" #import "ios/chrome/browser/ui/browser_list/browser.h" #import "ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/closed_tabs_observer_bridge.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_handset_view_controller.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_coordinator.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_table_view_controller.h" -#import "ios/chrome/browser/ui/sync/synced_sessions_bridge.h" #import "ios/clean/chrome/browser/ui/adaptor/application_commands_adaptor.h" #import "ios/clean/chrome/browser/ui/adaptor/url_loader_adaptor.h"
diff --git a/ios/clean/chrome/browser/ui/web_contents/BUILD.gn b/ios/clean/chrome/browser/ui/web_contents/BUILD.gn index 76cc38b..96e55dc7 100644 --- a/ios/clean/chrome/browser/ui/web_contents/BUILD.gn +++ b/ios/clean/chrome/browser/ui/web_contents/BUILD.gn
@@ -18,6 +18,9 @@ "//ios/chrome/browser/ui/browser_list", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/coordinators", + "//ios/chrome/browser/ui/sad_tab", + "//ios/chrome/browser/web", + "//ios/chrome/browser/web:tab_helper_delegates", "//ios/clean/chrome/browser/ui/commands", "//ios/clean/chrome/browser/ui/dialogs/context_menu", "//ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs",
diff --git a/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h b/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h index 0be926e7..98192f9 100644 --- a/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h +++ b/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h
@@ -7,6 +7,9 @@ #import <Foundation/Foundation.h> +#import "ios/chrome/browser/web/sad_tab_tab_helper_delegate.h" + +@protocol ApplicationCommands; namespace web { class WebState; } @@ -14,7 +17,7 @@ // A mediator object that provides the relevant properties of a web state // to a consumer. -@interface WebContentsMediator : NSObject +@interface WebContentsMediator : NSObject<SadTabTabHelperDelegate> // Updates to this webState are mediated to the consumer. This can change // during the lifetime of this object and may be nil. @@ -24,6 +27,9 @@ // object and may be nil. @property(nonatomic, weak) id<WebContentsConsumer> consumer; +// The dispatcher for this mediator. +@property(nonatomic, weak) id<ApplicationCommands> dispatcher; + @end #endif // IOS_CLEAN_CHROME_BROWSER_UI_WEB_CONTENTS_WEB_CONTENTS_MEDIATOR_H_
diff --git a/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.mm b/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.mm index cfd238a..ade7a3b 100644 --- a/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.mm +++ b/ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.mm
@@ -7,8 +7,10 @@ #include "base/memory/ptr_util.h" #include "base/scoped_observer.h" #include "ios/chrome/browser/chrome_url_constants.h" +#import "ios/chrome/browser/ui/sad_tab/sad_tab_view.h" #import "ios/clean/chrome/browser/ui/web_contents/web_contents_consumer.h" #import "ios/web/public/navigation_manager.h" +#import "ios/web/public/web_state/ui/crw_generic_content_view.h" #include "ios/web/public/web_state/web_state.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h" @@ -20,6 +22,7 @@ @implementation WebContentsMediator @synthesize webState = _webState; @synthesize consumer = _consumer; +@synthesize dispatcher = _dispatcher; #pragma mark - Properties @@ -60,4 +63,18 @@ } } +#pragma mark - SadTabTabHelperDelegate + +- (void)presentSadTabForRepeatedFailure:(BOOL)repeatedFailure { + // Create a SadTabView so |webstate| presents it. + SadTabView* sadTabview = [[SadTabView alloc] + initWithMode:repeatedFailure ? SadTabViewMode::FEEDBACK + : SadTabViewMode::RELOAD + navigationManager:self.webState->GetNavigationManager()]; + sadTabview.dispatcher = self.dispatcher; + CRWContentView* contentView = + [[CRWGenericContentView alloc] initWithView:sadTabview]; + self.webState->ShowTransientContentView(contentView); +} + @end
diff --git a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm index 532f342..bf7baf01 100644 --- a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm +++ b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm
@@ -9,6 +9,7 @@ #import "ios/chrome/browser/ui/browser_list/browser.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/coordinators/browser_coordinator+internal.h" +#import "ios/chrome/browser/web/sad_tab_tab_helper.h" #import "ios/clean/chrome/browser/ui/commands/context_menu_commands.h" #import "ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_coordinator.h" #import "ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_request.h" @@ -60,6 +61,13 @@ self.webState->SetDelegate(_webStateDelegate.get()); self.mediator.webState = self.webState; [self setWebStateOverlayParent]; + SadTabTabHelper* sadTabHelper = SadTabTabHelper::FromWebState(self.webState); + // Set the mediator as a SadTabHelper delegate, and set the mediator's + // dispatcher. + if (sadTabHelper) { + sadTabHelper->SetDelegate(self.mediator); + self.mediator.dispatcher = static_cast<id>(self.dispatcher); + } } - (void)start { @@ -73,6 +81,9 @@ - (void)stop { [self resetWebStateOverlayParent]; + SadTabTabHelper* sadTabHelper = SadTabTabHelper::FromWebState(self.webState); + if (sadTabHelper) + sadTabHelper->SetDelegate(nil); [super stop]; }
diff --git a/ios/third_party/material_components_ios/BUILD.gn b/ios/third_party/material_components_ios/BUILD.gn index de1155d..86cdf06 100644 --- a/ios/third_party/material_components_ios/BUILD.gn +++ b/ios/third_party/material_components_ios/BUILD.gn
@@ -54,6 +54,20 @@ "src/components/AppBar/src/MDCAppBarContainerViewController.h", "src/components/AppBar/src/MDCAppBarContainerViewController.m", "src/components/AppBar/src/MaterialAppBar.h", + "src/components/BottomSheet/src/MDCBottomSheetController.h", + "src/components/BottomSheet/src/MDCBottomSheetController.m", + "src/components/BottomSheet/src/MDCBottomSheetPresentationController.h", + "src/components/BottomSheet/src/MDCBottomSheetPresentationController.m", + "src/components/BottomSheet/src/MDCBottomSheetTransitionController.h", + "src/components/BottomSheet/src/MDCBottomSheetTransitionController.m", + "src/components/BottomSheet/src/UIViewController+MaterialBottomSheet.h", + "src/components/BottomSheet/src/UIViewController+MaterialBottomSheet.m", + "src/components/BottomSheet/src/private/MDCDraggableView.h", + "src/components/BottomSheet/src/private/MDCDraggableView.m", + "src/components/BottomSheet/src/private/MDCSheetBehavior.h", + "src/components/BottomSheet/src/private/MDCSheetBehavior.m", + "src/components/BottomSheet/src/private/MDCSheetContainerView.h", + "src/components/BottomSheet/src/private/MDCSheetContainerView.m", "src/components/ButtonBar/src/MDCButtonBar.h", "src/components/ButtonBar/src/MDCButtonBar.m", "src/components/ButtonBar/src/MaterialButtonBar.h",
diff --git a/ios/tools/coverage/coverage.py b/ios/tools/coverage/coverage.py index 88f6388..707c1e40 100755 --- a/ios/tools/coverage/coverage.py +++ b/ios/tools/coverage/coverage.py
@@ -10,12 +10,13 @@ such as ios_chrome_unittests. To simply play with this tool, you are suggested to start with 'url_unittests'. - ios/tools/coverage/coverage.py target - Generate code coverage report for |target| and restrict the results to ios/. + ios/tools/coverage/coverage.py -p path1 -p path2 target + Generate code coverage report for |target| for |path1| and |path2|. - ios/tools/coverage/coverage.py -f path1 -f path2 target - Generate code coverage report for |target| and restrict the results to - |path1| and |path2|. + ios/tools/coverage/coverage.py target -p path --reuse-profdata + out/Coverage-iphonesimulator/coverage.profdata + Skip running tests and reuse the specified profile data file to generate + code coverage report. For more options, please refer to ios/tools/coverage/coverage.py -h @@ -42,13 +43,6 @@ # be identified with the following identifier. PROFRAW_LOG_IDENTIFIER = 'Coverage data at ' -# By default, code coverage results are restricted to 'ios/' directory. -# If the filter arguments are defined, they will override the default values. -# Having default values are important because otherwise the code coverage data -# returned by "llvm-cove" will include completely unrelated directories such as -# 'base/' and 'url/'. -DEFAULT_FILTER_PATHS = ['ios/'] - # Only test targets with the following postfixes are considered to be valid. VALID_TEST_TARGET_POSTFIXES = ['unittests', 'inttests', 'egtests'] @@ -75,7 +69,7 @@ return profdata_path -def _DisplayLineCoverageReport(target, profdata_path, filter_paths): +def _DisplayLineCoverageReport(target, profdata_path, paths): """Generates and displays line coverage report. The output has the following format: @@ -90,39 +84,38 @@ Args: target: A string representing the name of the target to be tested. profdata_path: A string representing the path to the profdata file. - filter_paths: A list of directories used to restrict code coverage results. + paths: A list of directories to generate code coverage for. """ print 'Generating line code coverge report' raw_line_coverage_report = _GenerateLineCoverageReport(target, profdata_path) line_coverage_report = _FilterLineCoverageReport(raw_line_coverage_report, - filter_paths) + paths) - coverage_by_filter = collections.defaultdict( + coverage_by_path = collections.defaultdict( lambda: collections.defaultdict(lambda: 0)) for file_name in line_coverage_report: total_lines = line_coverage_report[file_name]['total_lines'] executed_lines = line_coverage_report[file_name]['executed_lines'] - matched_filter_paths = _MatchFilePathWithDirectories(file_name, - filter_paths) - for matched_filter in matched_filter_paths: - coverage_by_filter[matched_filter]['total_lines'] += total_lines - coverage_by_filter[matched_filter]['executed_lines'] += executed_lines + matched_paths = _MatchFilePathWithDirectories(file_name, paths) + for matched_path in matched_paths: + coverage_by_path[matched_path]['total_lines'] += total_lines + coverage_by_path[matched_path]['executed_lines'] += executed_lines - if matched_filter_paths: - coverage_by_filter['aggregate']['total_lines'] += total_lines - coverage_by_filter['aggregate']['executed_lines'] += executed_lines + if matched_paths: + coverage_by_path['aggregate']['total_lines'] += total_lines + coverage_by_path['aggregate']['executed_lines'] += executed_lines - print '\nLine Coverage Report for Following Directories: ' + str(filter_paths) - for filter_path in filter_paths: - print filter_path + ':' - _PrintLineCoverageStats(coverage_by_filter[filter_path]['total_lines'], - coverage_by_filter[filter_path]['executed_lines']) + print '\nLine Coverage Report for Following Directories: ' + str(paths) + for path in paths: + print path + ':' + _PrintLineCoverageStats(coverage_by_path[path]['total_lines'], + coverage_by_path[path]['executed_lines']) - if len(filter_paths) > 1: + if len(paths) > 1: print 'In Aggregate:' - _PrintLineCoverageStats(coverage_by_filter['aggregate']['total_lines'], - coverage_by_filter['aggregate']['executed_lines']) + _PrintLineCoverageStats(coverage_by_path['aggregate']['total_lines'], + coverage_by_path['aggregate']['executed_lines']) def _GenerateLineCoverageReport(target, profdata_path): @@ -194,8 +187,8 @@ return line_coverage_report -def _FilterLineCoverageReport(raw_report, filter_paths): - """Filter line coverage report to only include directories in |filter_paths|. +def _FilterLineCoverageReport(raw_report, paths): + """Filter line coverage report to only include directories in |paths|. Args: raw_report: A json object with the following format: @@ -203,7 +196,7 @@ -- file_name: dict => Line coverage summary. ---- total_lines: int => Number of total lines. ---- executed_lines: int => Number of executed lines. - filter_paths: A list of directories used to restrict code coverage results. + paths: A list of directories to generate code coverage for. Returns: A json object with the following format: @@ -215,7 +208,7 @@ """ filtered_report = {} for file_name in raw_report: - if _MatchFilePathWithDirectories(file_name, filter_paths): + if _MatchFilePathWithDirectories(file_name, paths): filtered_report[file_name] = raw_report[file_name] return filtered_report @@ -459,12 +452,8 @@ arg_parser = argparse.ArgumentParser() arg_parser.usage = __doc__ - arg_parser.add_argument('-f', '--filter', type=str, action='append', - help='Paths used to restrict code coverage results ' - 'to specific directories, and the default value ' - 'is \'ios/\'. \n' - 'NOTE: if this value is defined, it will ' - 'override instead of appeding to the defaults.') + arg_parser.add_argument('-p', '--path', action='append', required=True, + help='Directories to get code coverage for.') arg_parser.add_argument('-j', '--jobs', type=int, default=None, help='Run N jobs to build in parallel. If not ' @@ -472,7 +461,7 @@ 'based on CPUs availability. Please refer to ' '\'ninja -h\' for more details.') - arg_parser.add_argument('-r', '--reuse-profdata', type=str, + arg_parser.add_argument('-r', '--reuse-profdata', help='Skip building test target and running tests ' 'and re-use the specified profile data file.') @@ -492,22 +481,20 @@ 'ios/build/tools/setup-gn.py.') -def _AssertFilterPathsExist(filter_paths): - """Asserts that paths specified in |filter_paths| exist. +def _AssertPathsExist(paths): + """Asserts that paths specified in |paths| exist. Args: - filter_paths: A list of directories. + paths: A list of directories. """ src_root = _GetSrcRootPath() - for filter_path in filter_paths: - filter_abspath = os.path.join(src_root, filter_path) - assert os.path.exists(filter_abspath), ('Filter path: {} doesn\'t exist.\n ' - 'A valid filter path must exist ' - 'and be relative to the root of ' - 'source, which is {} \nFor ' - 'example, \'ios/\' is a valid ' - 'filter.').format(filter_abspath, - src_root) + for path in paths: + abspath = os.path.join(src_root, path) + assert os.path.exists(abspath), (('Path: {} doesn\'t exist.\n A valid ' + 'path must exist and be relative to the ' + 'root of source, which is {} \nFor ' + 'example, \'ios/\' is a valid path.'). + format(abspath, src_root)) def Main(): @@ -528,9 +515,7 @@ jobs = DEFAULT_GOMA_JOBS _AssertCoverageBuildDirectoryExists() - - if args.filter: - _AssertFilterPathsExist(args.filter) + _AssertPathsExist(args.path) profdata_path = args.reuse_profdata if profdata_path: @@ -540,8 +525,7 @@ else: profdata_path = _CreateCoverageProfileDataForTarget(target, jobs) - _DisplayLineCoverageReport(target, profdata_path, - args.filter or DEFAULT_FILTER_PATHS) + _DisplayLineCoverageReport(target, profdata_path, args.path) if __name__ == '__main__': sys.exit(Main())
diff --git a/ios/web/web_state/js/context_menu_js_unittest.mm b/ios/web/web_state/js/context_menu_js_unittest.mm index 70ef870..0c5b3c4 100644 --- a/ios/web/web_state/js/context_menu_js_unittest.mm +++ b/ios/web/web_state/js/context_menu_js_unittest.mm
@@ -157,14 +157,15 @@ } // Tests the javascript of the url of the an image present in the DOM. -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfImage) { +TEST_F(ContextMenuJsTest, LinkOfImage) { // A page with a large image surrounded by a link. static const char image[] = "<a href='%s'><img width=400 height=400 src='foo'></img></a>"; // A page with a link to a destination URL. LoadHtml(base::StringPrintf(image, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('img')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(20, 20); NSDictionary* expected_result = @{ kContextMenuElementSource : @@ -208,8 +209,7 @@ // Tests context menu invoked on an image with "-webkit-touch-callout:none" // style and parent link. -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfImageWithCalloutNone) { +TEST_F(ContextMenuJsTest, LinkOfImageWithCalloutNone) { // A page with an image surrounded by a link. static const char image_html[] = "<a href='%s'>" @@ -218,6 +218,7 @@ // A page with a link to a destination URL. LoadHtml(base::StringPrintf(image_html, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('img')"); // Force layout. id result = ExecuteGetElementFromPointJavaScript(5, 5); NSDictionary* expected_result = @{ kContextMenuElementInnerText : @"", @@ -245,11 +246,12 @@ // Tests that a callout information about a link is displayed when // -webkit-touch-callout property is not specified. Please see: // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfTextWithoutCalloutProperty) { - const char kLink_html[] = "<a href='%s'>link</a>"; +TEST_F(ContextMenuJsTest, LinkOfTextWithoutCalloutProperty) { + const char kLinkHtml[] = "<a href='%s'>link</a>"; - LoadHtml(base::StringPrintf(kLink_html, "http://destination")); + LoadHtml(base::StringPrintf(kLinkHtml, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('a')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(1, 1); NSDictionary* expected_result = @{ kContextMenuElementInnerText : @"link", @@ -262,12 +264,13 @@ // Tests that a callout information about a link is displayed when // -webkit-touch-callout property is set to default. Please see: // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout -// TODO(crbug.com/758735): enable this test -TEST_F(ContextMenuJsTest, FLAKY_LinkOfTextWithCalloutDefault) { - const char kLink_html[] = +TEST_F(ContextMenuJsTest, LinkOfTextWithCalloutDefault) { + const char kLinkHtml[] = "<a href='%s' style='-webkit-touch-callout:default;'>link</a>"; - LoadHtml(base::StringPrintf(kLink_html, "http://destination")); + LoadHtml(base::StringPrintf(kLinkHtml, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('a')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(1, 1); NSDictionary* expected_result = @{ kContextMenuElementInnerText : @"link", @@ -280,12 +283,13 @@ // Tests that no callout information about a link is displayed when // -webkit-touch-callout property is set to none. Please see: // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfTextWithCalloutNone) { - const char kLink_html[] = +TEST_F(ContextMenuJsTest, LinkOfTextWithCalloutNone) { + const char kLinkHtml[] = "<a href='%s' style='-webkit-touch-callout:none;'>link</a>"; - LoadHtml(base::StringPrintf(kLink_html, "http://destination")); + LoadHtml(base::StringPrintf(kLinkHtml, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('a')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(1, 1); EXPECT_NSEQ(@{}, result); } @@ -293,14 +297,15 @@ // Tests that -webkit-touch-callout property can be inherited from ancester if // it's not specified. Please see: // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfTextWithCalloutFromAncester) { - const char kLink_html[] = +TEST_F(ContextMenuJsTest, LinkOfTextWithCalloutFromAncester) { + const char kLinkHtml[] = "<body style='-webkit-touch-callout: none'>" " <a href='%s'>link</a>" "</body>"; - LoadHtml(base::StringPrintf(kLink_html, "http://destination")); + LoadHtml(base::StringPrintf(kLinkHtml, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('a')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(1, 1); EXPECT_NSEQ(@{}, result); } @@ -308,14 +313,15 @@ // Tests that setting -webkit-touch-callout property can override the value // inherited from ancester. Please see: // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout -// TODO(crbug.com/758735): enable this test. -TEST_F(ContextMenuJsTest, FLAKY_LinkOfTextWithCalloutOverride) { - const char kLink_html[] = +TEST_F(ContextMenuJsTest, LinkOfTextWithCalloutOverride) { + const char kLinkHtml[] = "<body style='-webkit-touch-callout: none'>" " <a href='%s' style='-webkit-touch-callout: default'>link</a>" "</body>"; - LoadHtml(base::StringPrintf(kLink_html, "http://destination")); + LoadHtml(base::StringPrintf(kLinkHtml, "http://destination")); + ExecuteJavaScript(@"document.getElementsByTagName('a')"); // Force layout. + id result = ExecuteGetElementFromPointJavaScript(1, 1); NSDictionary* expected_result = @{ kContextMenuElementInnerText : @"link",
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 03b4a8f..30f5856c 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -3319,7 +3319,9 @@ } - (web::NavigationItemImpl*)currentNavItem { - return self.navigationManagerImpl->GetCurrentItemImpl(); + return self.navigationManagerImpl + ? self.navigationManagerImpl->GetCurrentItemImpl() + : nullptr; } - (ui::PageTransition)currentTransition {
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm index bdcc4bee..c0ceb33d 100644 --- a/ios/web/web_state/web_state_impl.mm +++ b/ios/web/web_state/web_state_impl.mm
@@ -657,10 +657,10 @@ GURL WebStateImpl::GetCurrentURL(URLVerificationTrustLevel* trust_level) const { GURL URL = [web_controller_ currentURLWithTrustLevel:trust_level]; - bool equalURLs = web::GURLByRemovingRefFromGURL(URL) == - web::GURLByRemovingRefFromGURL(GetLastCommittedURL()); - DCHECK(equalURLs); - UMA_HISTOGRAM_BOOLEAN("Web.CurrentURLEqualsLastCommittedURL", equalURLs); + bool equalOrigins = URL.GetOrigin() == GetLastCommittedURL().GetOrigin(); + DCHECK(equalOrigins); + UMA_HISTOGRAM_BOOLEAN("Web.CurrentOriginEqualsLastCommittedOrigin", + equalOrigins); return URL; }
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn index 5753bd5..a6390702 100644 --- a/ipc/BUILD.gn +++ b/ipc/BUILD.gn
@@ -23,10 +23,6 @@ component("ipc") { sources = [ "export_template.h", - "handle_attachment_win.cc", - "handle_attachment_win.h", - "handle_win.cc", - "handle_win.h", "ipc_channel.cc", "ipc_channel.h", "ipc_channel_common.cc", @@ -45,12 +41,6 @@ "ipc_listener.h", "ipc_logging.cc", "ipc_logging.h", - "ipc_message.cc", - "ipc_message.h", - "ipc_message_attachment.cc", - "ipc_message_attachment.h", - "ipc_message_attachment_set.cc", - "ipc_message_attachment_set.h", "ipc_message_macros.h", "ipc_message_pipe_reader.cc", "ipc_message_pipe_reader.h", @@ -61,27 +51,13 @@ "ipc_message_utils.h", "ipc_mojo_bootstrap.cc", "ipc_mojo_bootstrap.h", - "ipc_mojo_handle_attachment.cc", - "ipc_mojo_handle_attachment.h", - "ipc_mojo_message_helper.cc", - "ipc_mojo_message_helper.h", "ipc_mojo_param_traits.cc", "ipc_mojo_param_traits.h", - "ipc_platform_file.cc", - "ipc_platform_file.h", - "ipc_platform_file_attachment_posix.cc", - "ipc_platform_file_attachment_posix.h", "ipc_sender.h", "ipc_sync_channel.cc", "ipc_sync_channel.h", - "ipc_sync_message.cc", - "ipc_sync_message.h", "ipc_sync_message_filter.cc", "ipc_sync_message_filter.h", - "mach_port_attachment_mac.cc", - "mach_port_attachment_mac.h", - "mach_port_mac.cc", - "mach_port_mac.h", "message_filter.cc", "message_filter.h", "message_filter_router.cc", @@ -105,20 +81,13 @@ ] } - if (is_fuchsia) { - sources += [ - "handle_attachment_fuchsia.cc", - "handle_attachment_fuchsia.h", - "handle_fuchsia.cc", - "handle_fuchsia.h", - ] - } - defines = [ "IPC_IMPLEMENTATION" ] public_deps = [ ":ipc_features", + ":message_support", ":mojom", + ":native_handle_type_converters", ":param_traits", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", @@ -134,17 +103,78 @@ "//base", ] - if (is_win || is_mac) { - # On Windows HandleAttachmentWin needs to generate random IDs. - # On Mac MachPortAttachmentMac needs to generate random IDs. - deps += [ "//crypto" ] - } - if (enable_ipc_fuzzer) { public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] } } +component("message_support") { + sources = [ + "handle_attachment_win.cc", + "handle_attachment_win.h", + "handle_win.cc", + "handle_win.h", + "ipc_message.cc", + "ipc_message.h", + "ipc_message_attachment.cc", + "ipc_message_attachment.h", + "ipc_message_attachment_set.cc", + "ipc_message_attachment_set.h", + "ipc_message_support_export.h", + "ipc_mojo_handle_attachment.cc", + "ipc_mojo_handle_attachment.h", + "ipc_mojo_message_helper.cc", + "ipc_mojo_message_helper.h", + "ipc_platform_file.cc", + "ipc_platform_file.h", + "ipc_platform_file_attachment_posix.cc", + "ipc_platform_file_attachment_posix.h", + "ipc_sync_message.cc", + "ipc_sync_message.h", + "mach_port_attachment_mac.cc", + "mach_port_attachment_mac.h", + "mach_port_mac.cc", + "mach_port_mac.h", + ] + + if (is_fuchsia) { + sources += [ + "handle_attachment_fuchsia.cc", + "handle_attachment_fuchsia.h", + "handle_fuchsia.cc", + "handle_fuchsia.h", + ] + } + + defines = [ "IPC_MESSAGE_SUPPORT_IMPL" ] + + public_deps = [ + ":ipc_features", + ":param_traits", + "//base", + "//mojo/public/cpp/system", + ] + + if (is_win || is_mac) { + # On Windows HandleAttachmentWin needs to generate random IDs. + # On Mac MachPortAttachmentMac needs to generate random IDs. + deps = [ + "//crypto", + ] + } +} + +source_set("native_handle_type_converters") { + sources = [ + "native_handle_type_converters.cc", + "native_handle_type_converters.h", + ] + public_deps = [ + ":message_support", + "//mojo/public/interfaces/bindings:bindings_shared__generator", + ] +} + mojom_component("mojom") { output_prefix = "ipc_mojom" macro_prefix = "IPC_MOJOM" @@ -154,6 +184,16 @@ public_deps = [ "//mojo/common:read_only_buffer", ] + + # Don't generate a variant sources since we depend on generated internal + # bindings types and we don't generate or build variants of those. + disable_variants = true +} + +mojom("mojom_constants") { + sources = [ + "constants.mojom", + ] } mojom("test_interfaces") {
diff --git a/ipc/OWNERS b/ipc/OWNERS index 22545c9..6c813f2 100644 --- a/ipc/OWNERS +++ b/ipc/OWNERS
@@ -16,6 +16,8 @@ per-file *.mojom=file://ipc/SECURITY_OWNERS per-file *_param_traits*.*=set noparent per-file *_param_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_type_converter*.*=set noparent +per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS per-file SECURITY_OWNERS=file://ipc/SECURITY_OWNERS
diff --git a/ipc/constants.mojom b/ipc/constants.mojom new file mode 100644 index 0000000..502187f --- /dev/null +++ b/ipc/constants.mojom
@@ -0,0 +1,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. + +module IPC.mojom; + +// NOTE: This MUST match the value of MSG_ROUTING_NONE in src/ipc/ipc_message.h. +const int32 kRoutingIdNone = -2;
diff --git a/ipc/handle_attachment_fuchsia.h b/ipc/handle_attachment_fuchsia.h index 915e4166..d1fa545 100644 --- a/ipc/handle_attachment_fuchsia.h +++ b/ipc/handle_attachment_fuchsia.h
@@ -9,14 +9,15 @@ #include "base/fuchsia/scoped_mx_handle.h" #include "ipc/handle_fuchsia.h" -#include "ipc/ipc_export.h" #include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_support_export.h" namespace IPC { namespace internal { // This class represents a Fuchsia mx_handle_t attached to a Chrome IPC message. -class IPC_EXPORT HandleAttachmentFuchsia : public MessageAttachment { +class IPC_MESSAGE_SUPPORT_EXPORT HandleAttachmentFuchsia + : public MessageAttachment { public: // This constructor makes a copy of |handle| and takes ownership of the // result. Should only be called by the sender of a Chrome IPC message.
diff --git a/ipc/handle_attachment_win.h b/ipc/handle_attachment_win.h index 3ee9f43..730afc8 100644 --- a/ipc/handle_attachment_win.h +++ b/ipc/handle_attachment_win.h
@@ -9,14 +9,15 @@ #include "base/win/scoped_handle.h" #include "ipc/handle_win.h" -#include "ipc/ipc_export.h" #include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_support_export.h" namespace IPC { namespace internal { // This class represents a Windows HANDLE attached to a Chrome IPC message. -class IPC_EXPORT HandleAttachmentWin : public MessageAttachment { +class IPC_MESSAGE_SUPPORT_EXPORT HandleAttachmentWin + : public MessageAttachment { public: // This constructor makes a copy of |handle| and takes ownership of the // result. Should only be called by the sender of a Chrome IPC message.
diff --git a/ipc/handle_fuchsia.h b/ipc/handle_fuchsia.h index babfe14..83c6512 100644 --- a/ipc/handle_fuchsia.h +++ b/ipc/handle_fuchsia.h
@@ -9,7 +9,7 @@ #include <string> -#include "ipc/ipc_export.h" +#include "ipc/ipc_message_support_export.h" #include "ipc/ipc_param_traits.h" namespace base { @@ -19,7 +19,7 @@ namespace IPC { -class IPC_EXPORT HandleFuchsia { +class IPC_MESSAGE_SUPPORT_EXPORT HandleFuchsia { public: // Default constructor makes an invalid mx_handle_t. HandleFuchsia(); @@ -33,7 +33,7 @@ }; template <> -struct IPC_EXPORT ParamTraits<HandleFuchsia> { +struct IPC_MESSAGE_SUPPORT_EXPORT ParamTraits<HandleFuchsia> { typedef HandleFuchsia param_type; static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m,
diff --git a/ipc/handle_win.h b/ipc/handle_win.h index 0120597c..68afc67 100644 --- a/ipc/handle_win.h +++ b/ipc/handle_win.h
@@ -9,7 +9,7 @@ #include <string> -#include "ipc/ipc_export.h" +#include "ipc/ipc_message_support_export.h" #include "ipc/ipc_param_traits.h" namespace base { @@ -26,7 +26,7 @@ // The ownership semantics for the underlying |handle_| are complex. See // ipc/mach_port_mac.h (the OSX analog of this class) for an extensive // discussion. -class IPC_EXPORT HandleWin { +class IPC_MESSAGE_SUPPORT_EXPORT HandleWin { public: // Default constructor makes an invalid HANDLE. HandleWin(); @@ -40,7 +40,7 @@ }; template <> -struct IPC_EXPORT ParamTraits<HandleWin> { +struct IPC_MESSAGE_SUPPORT_EXPORT ParamTraits<HandleWin> { typedef HandleWin param_type; static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m,
diff --git a/ipc/ipc.mojom b/ipc/ipc.mojom index 3ab4d4ef..2332111 100644 --- a/ipc/ipc.mojom +++ b/ipc/ipc.mojom
@@ -5,23 +5,7 @@ module IPC.mojom; import "mojo/common/read_only_buffer.mojom"; - -// NOTE: This MUST match the value of MSG_ROUTING_NONE in src/ipc/ipc_message.h. -const int32 kRoutingIdNone = -2; - -struct SerializedHandle { - handle the_handle; - - enum Type { - MOJO_HANDLE, - PLATFORM_FILE, - WIN_HANDLE, - MACH_PORT, - FUCHSIA_HANDLE, - }; - - Type type; -}; +import "mojo/public/interfaces/bindings/native_struct.mojom"; // A placeholder interface type since we don't yet support generic associated // message pipe handles. @@ -34,7 +18,7 @@ // Transmits a classical Chrome IPC message. Receive(mojo.common.mojom.ReadOnlyBuffer data, - array<SerializedHandle>? handles); + array<mojo.native.SerializedHandle>? handles); // Requests a Channel-associated interface. GetAssociatedInterface(string name, associated GenericInterface& request);
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc index 29451c6..6471d83 100644 --- a/ipc/ipc_channel_mojo.cc +++ b/ipc/ipc_channel_mojo.cc
@@ -25,26 +25,10 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_mojo_bootstrap.h" #include "ipc/ipc_mojo_handle_attachment.h" +#include "ipc/native_handle_type_converters.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/system/platform_handle.h" -#if defined(OS_POSIX) -#include "base/posix/eintr_wrapper.h" -#include "ipc/ipc_platform_file_attachment_posix.h" -#endif - -#if defined(OS_MACOSX) -#include "ipc/mach_port_attachment_mac.h" -#endif - -#if defined(OS_WIN) -#include "ipc/handle_attachment_win.h" -#endif - -#if defined(OS_FUCHSIA) -#include "ipc/handle_attachment_fuchsia.h" -#endif - namespace IPC { namespace { @@ -76,188 +60,6 @@ DISALLOW_COPY_AND_ASSIGN(MojoChannelFactory); }; -mojom::SerializedHandlePtr CreateSerializedHandle( - mojo::ScopedHandle handle, - mojom::SerializedHandle::Type type) { - mojom::SerializedHandlePtr serialized_handle = mojom::SerializedHandle::New(); - serialized_handle->the_handle = std::move(handle); - serialized_handle->type = type; - return serialized_handle; -} - -MojoResult WrapPlatformHandle(base::PlatformFile handle, - mojom::SerializedHandle::Type type, - mojom::SerializedHandlePtr* serialized) { - mojo::ScopedHandle wrapped_handle = mojo::WrapPlatformFile(handle); - if (!wrapped_handle.is_valid()) - return MOJO_RESULT_UNKNOWN; - - *serialized = CreateSerializedHandle(std::move(wrapped_handle), type); - return MOJO_RESULT_OK; -} - -#if defined(OS_MACOSX) -MojoResult WrapMachPort(mach_port_t mach_port, - mojom::SerializedHandlePtr* serialized) { - MojoPlatformHandle platform_handle = { - sizeof(MojoPlatformHandle), MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT, - static_cast<uint64_t>(mach_port) - }; - - MojoHandle wrapped_handle; - MojoResult result = MojoWrapPlatformHandle(&platform_handle, &wrapped_handle); - if (result != MOJO_RESULT_OK) - return result; - - *serialized = CreateSerializedHandle( - mojo::MakeScopedHandle(mojo::Handle(wrapped_handle)), - mojom::SerializedHandle::Type::MACH_PORT); - return MOJO_RESULT_OK; -} -#elif defined(OS_FUCHSIA) -MojoResult WrapMxHandle(mx_handle_t handle, - mojom::SerializedHandlePtr* serialized) { - MojoPlatformHandle platform_handle = { - sizeof(MojoPlatformHandle), MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE, - static_cast<uint64_t>(handle)}; - - MojoHandle wrapped_handle; - MojoResult result = MojoWrapPlatformHandle(&platform_handle, &wrapped_handle); - if (result != MOJO_RESULT_OK) - return result; - - *serialized = CreateSerializedHandle( - mojo::MakeScopedHandle(mojo::Handle(wrapped_handle)), - mojom::SerializedHandle::Type::FUCHSIA_HANDLE); - return MOJO_RESULT_OK; -} -#endif // defined(OS_FUCHSIA) - -#if defined(OS_POSIX) -base::ScopedFD TakeOrDupFile(internal::PlatformFileAttachment* attachment) { - return attachment->Owns() - ? base::ScopedFD(attachment->TakePlatformFile()) - : base::ScopedFD(HANDLE_EINTR(dup(attachment->file()))); -} -#endif // defined(OS_POSIX) - -MojoResult WrapAttachmentImpl(MessageAttachment* attachment, - mojom::SerializedHandlePtr* serialized) { - if (attachment->GetType() == MessageAttachment::Type::MOJO_HANDLE) { - *serialized = CreateSerializedHandle( - static_cast<internal::MojoHandleAttachment&>(*attachment).TakeHandle(), - mojom::SerializedHandle::Type::MOJO_HANDLE); - return MOJO_RESULT_OK; - } -#if defined(OS_POSIX) - if (attachment->GetType() == MessageAttachment::Type::PLATFORM_FILE) { - // We dup() the handles in IPC::Message to transmit. - // IPC::MessageAttachmentSet has intricate lifecycle semantics - // of FDs, so just to dup()-and-own them is the safest option. - base::ScopedFD file = TakeOrDupFile( - static_cast<IPC::internal::PlatformFileAttachment*>(attachment)); - if (!file.is_valid()) { - DPLOG(WARNING) << "Failed to dup FD to transmit."; - return MOJO_RESULT_UNKNOWN; - } - - return WrapPlatformHandle(file.release(), - mojom::SerializedHandle::Type::PLATFORM_FILE, - serialized); - } -#endif // defined(OS_POSIX) -#if defined(OS_MACOSX) - DCHECK_EQ(attachment->GetType(), MessageAttachment::Type::MACH_PORT); - internal::MachPortAttachmentMac& mach_port_attachment = - static_cast<internal::MachPortAttachmentMac&>(*attachment); - MojoResult result = WrapMachPort(mach_port_attachment.get_mach_port(), - serialized); - mach_port_attachment.reset_mach_port_ownership(); - return result; -#elif defined(OS_FUCHSIA) - DCHECK_EQ(attachment->GetType(), MessageAttachment::Type::FUCHSIA_HANDLE); - internal::HandleAttachmentFuchsia& handle_attachment = - static_cast<internal::HandleAttachmentFuchsia&>(*attachment); - MojoResult result = WrapMxHandle(handle_attachment.Take(), serialized); - return result; -#elif defined(OS_WIN) - DCHECK_EQ(attachment->GetType(), MessageAttachment::Type::WIN_HANDLE); - internal::HandleAttachmentWin& handle_attachment = - static_cast<internal::HandleAttachmentWin&>(*attachment); - MojoResult result = - WrapPlatformHandle(handle_attachment.Take(), - mojom::SerializedHandle::Type::WIN_HANDLE, serialized); - return result; -#else - NOTREACHED(); - return MOJO_RESULT_UNKNOWN; -#endif // defined(OS_MACOSX) -} - -MojoResult WrapAttachment(MessageAttachment* attachment, - std::vector<mojom::SerializedHandlePtr>* handles) { - mojom::SerializedHandlePtr serialized_handle; - MojoResult wrap_result = WrapAttachmentImpl(attachment, &serialized_handle); - if (wrap_result != MOJO_RESULT_OK) { - LOG(WARNING) << "Pipe failed to wrap handles. Closing: " << wrap_result; - return wrap_result; - } - handles->push_back(std::move(serialized_handle)); - return MOJO_RESULT_OK; -} - -MojoResult UnwrapAttachment(mojom::SerializedHandlePtr handle, - scoped_refptr<MessageAttachment>* attachment) { - if (handle->type == mojom::SerializedHandle::Type::MOJO_HANDLE) { - *attachment = - new IPC::internal::MojoHandleAttachment(std::move(handle->the_handle)); - return MOJO_RESULT_OK; - } - MojoPlatformHandle platform_handle = { sizeof(MojoPlatformHandle), 0, 0 }; - MojoResult unwrap_result = MojoUnwrapPlatformHandle( - handle->the_handle.release().value(), &platform_handle); - if (unwrap_result != MOJO_RESULT_OK) - return unwrap_result; -#if defined(OS_POSIX) - if (handle->type == mojom::SerializedHandle::Type::PLATFORM_FILE) { - base::PlatformFile file = base::kInvalidPlatformFile; - if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR) - file = static_cast<base::PlatformFile>(platform_handle.value); - *attachment = new internal::PlatformFileAttachment(file); - return MOJO_RESULT_OK; - } -#endif // defined(OS_POSIX) -#if defined(OS_MACOSX) - if (handle->type == mojom::SerializedHandle::Type::MACH_PORT) { - mach_port_t mach_port = MACH_PORT_NULL; - if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT) - mach_port = static_cast<mach_port_t>(platform_handle.value); - *attachment = new internal::MachPortAttachmentMac( - mach_port, internal::MachPortAttachmentMac::FROM_WIRE); - return MOJO_RESULT_OK; - } -#elif defined(OS_FUCHSIA) - if (handle->type == mojom::SerializedHandle::Type::FUCHSIA_HANDLE) { - base::ScopedMxHandle handle; - if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE) - handle.reset(static_cast<mx_handle_t>(platform_handle.value)); - *attachment = new internal::HandleAttachmentFuchsia(std::move(handle)); - return MOJO_RESULT_OK; - } -#elif defined(OS_WIN) - if (handle->type == mojom::SerializedHandle::Type::WIN_HANDLE) { - base::PlatformFile handle = base::kInvalidPlatformFile; - if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE) - handle = reinterpret_cast<base::PlatformFile>(platform_handle.value); - *attachment = new internal::HandleAttachmentWin( - handle, internal::HandleAttachmentWin::FROM_WIRE); - return MOJO_RESULT_OK; - } -#endif // defined(OS_WIN) - NOTREACHED(); - return MOJO_RESULT_UNKNOWN; -} - base::ProcessId GetSelfPID() { #if defined(OS_LINUX) if (int global_pid = Channel::GetGlobalPid()) @@ -451,18 +253,24 @@ // static MojoResult ChannelMojo::ReadFromMessageAttachmentSet( Message* message, - base::Optional<std::vector<mojom::SerializedHandlePtr>>* handles) { + base::Optional<std::vector<mojo::native::SerializedHandlePtr>>* handles) { DCHECK(!*handles); MojoResult result = MOJO_RESULT_OK; if (!message->HasAttachments()) return result; - std::vector<mojom::SerializedHandlePtr> output_handles; + std::vector<mojo::native::SerializedHandlePtr> output_handles; MessageAttachmentSet* set = message->attachment_set(); for (unsigned i = 0; result == MOJO_RESULT_OK && i < set->size(); ++i) { - result = WrapAttachment(set->GetAttachmentAt(i).get(), &output_handles); + auto attachment = set->GetAttachmentAt(i); + auto serialized_handle = mojo::native::SerializedHandle::New(); + serialized_handle->the_handle = attachment->TakeMojoHandle(); + serialized_handle->type = + mojo::ConvertTo<mojo::native::SerializedHandle::Type>( + attachment->GetType()); + output_handles.emplace_back(std::move(serialized_handle)); } set->CommitAllDescriptors(); @@ -474,20 +282,20 @@ // static MojoResult ChannelMojo::WriteToMessageAttachmentSet( - base::Optional<std::vector<mojom::SerializedHandlePtr>> handle_buffer, + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles, Message* message) { - if (!handle_buffer) + if (!handles) return MOJO_RESULT_OK; - for (size_t i = 0; i < handle_buffer->size(); ++i) { - scoped_refptr<MessageAttachment> unwrapped_attachment; - MojoResult unwrap_result = - UnwrapAttachment(std::move((*handle_buffer)[i]), &unwrapped_attachment); - if (unwrap_result != MOJO_RESULT_OK) { - LOG(WARNING) << "Pipe failed to unwrap handles. Closing: " - << unwrap_result; - return unwrap_result; + for (size_t i = 0; i < handles->size(); ++i) { + auto& handle = handles->at(i); + scoped_refptr<MessageAttachment> unwrapped_attachment = + MessageAttachment::CreateFromMojoHandle( + std::move(handle->the_handle), + mojo::ConvertTo<MessageAttachment::Type>(handle->type)); + if (!unwrapped_attachment) { + DLOG(WARNING) << "Pipe failed to unwrap handles."; + return MOJO_RESULT_UNKNOWN; } - DCHECK(unwrapped_attachment); bool ok = message->attachment_set()->AddAttachment( std::move(unwrapped_attachment));
diff --git a/ipc/ipc_channel_mojo.h b/ipc/ipc_channel_mojo.h index e8b7b92..61bc0db 100644 --- a/ipc/ipc_channel_mojo.h +++ b/ipc/ipc_channel_mojo.h
@@ -28,6 +28,7 @@ #include "ipc/ipc_mojo_bootstrap.h" #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" #include "mojo/public/cpp/system/core.h" +#include "mojo/public/interfaces/bindings/native_struct.mojom.h" namespace IPC { @@ -77,11 +78,11 @@ // These access protected API of IPC::Message, which has ChannelMojo // as a friend class. static MojoResult WriteToMessageAttachmentSet( - base::Optional<std::vector<mojom::SerializedHandlePtr>> handle_buffer, + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles, Message* message); static MojoResult ReadFromMessageAttachmentSet( Message* message, - base::Optional<std::vector<mojom::SerializedHandlePtr>>* handles); + base::Optional<std::vector<mojo::native::SerializedHandlePtr>>* handles); // MessagePipeReader::Delegate void OnPeerPidReceived(int32_t peer_pid) override;
diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h index 3ca7548..8a924e21 100644 --- a/ipc/ipc_message.h +++ b/ipc/ipc_message.h
@@ -15,8 +15,14 @@ #include "base/pickle.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" -#include "ipc/ipc_export.h" #include "ipc/ipc_features.h" +#include "ipc/ipc_message_support_export.h" + +namespace mojo { +namespace internal { +struct UnmappedNativeStructSerializerImpl; +} +} // namespace mojo namespace IPC { @@ -29,7 +35,7 @@ struct LogData; class MessageAttachmentSet; -class IPC_EXPORT Message : public base::Pickle { +class IPC_MESSAGE_SUPPORT_EXPORT Message : public base::Pickle { public: enum PriorityValue { PRIORITY_LOW = 1, @@ -166,7 +172,7 @@ // The static method FindNext() returns several pieces of information, which // are aggregated into an instance of this struct. - struct IPC_EXPORT NextMessageInfo { + struct IPC_MESSAGE_SUPPORT_EXPORT NextMessageInfo { NextMessageInfo(); ~NextMessageInfo(); @@ -234,6 +240,8 @@ friend class MessageReplyDeserializer; friend class SyncMessage; + friend struct mojo::internal::UnmappedNativeStructSerializerImpl; + #pragma pack(push, 4) struct Header : base::Pickle::Header { int32_t routing; // ID of the view that this message is destined for
diff --git a/ipc/ipc_message_attachment.cc b/ipc/ipc_message_attachment.cc index 83440ae..63f7e1c3 100644 --- a/ipc/ipc_message_attachment.cc +++ b/ipc/ipc_message_attachment.cc
@@ -4,12 +4,153 @@ #include "ipc/ipc_message_attachment.h" +#include "base/files/scoped_file.h" +#include "base/logging.h" +#include "ipc/ipc_mojo_handle_attachment.h" +#include "mojo/public/cpp/system/platform_handle.h" + +#if defined(OS_POSIX) +#include "base/posix/eintr_wrapper.h" +#include "ipc/ipc_platform_file_attachment_posix.h" +#endif + +#if defined(OS_MACOSX) && !defined(OS_IOS) +#include "ipc/mach_port_attachment_mac.h" +#endif + +#if defined(OS_WIN) +#include "ipc/handle_attachment_win.h" +#endif + +#if defined(OS_FUCHSIA) +#include "ipc/handle_attachment_fuchsia.h" +#endif + namespace IPC { -MessageAttachment::MessageAttachment() { +namespace { + +#if defined(OS_POSIX) +base::ScopedFD TakeOrDupFile(internal::PlatformFileAttachment* attachment) { + return attachment->Owns() + ? base::ScopedFD(attachment->TakePlatformFile()) + : base::ScopedFD(HANDLE_EINTR(dup(attachment->file()))); +} +#endif // defined(OS_POSIX) + +} // namespace + +MessageAttachment::MessageAttachment() = default; + +MessageAttachment::~MessageAttachment() = default; + +mojo::ScopedHandle MessageAttachment::TakeMojoHandle() { + switch (GetType()) { + case Type::MOJO_HANDLE: + return static_cast<internal::MojoHandleAttachment*>(this)->TakeHandle(); + +#if defined(OS_POSIX) + case Type::PLATFORM_FILE: { + // We dup() the handles in IPC::Message to transmit. + // IPC::MessageAttachmentSet has intricate lifetime semantics for FDs, so + // just to dup()-and-own them is the safest option. + base::ScopedFD file = + TakeOrDupFile(static_cast<internal::PlatformFileAttachment*>(this)); + if (!file.is_valid()) { + DPLOG(WARNING) << "Failed to dup FD to transmit."; + return mojo::ScopedHandle(); + } + return mojo::WrapPlatformFile(file.release()); + } +#endif // defined(OS_POSIX) + +#if defined(OS_MACOSX) && !defined(OS_IOS) + case Type::MACH_PORT: { + auto* attachment = static_cast<internal::MachPortAttachmentMac*>(this); + MojoPlatformHandle platform_handle = { + sizeof(platform_handle), MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT, + static_cast<uint64_t>(attachment->get_mach_port())}; + MojoHandle wrapped_handle; + if (MojoWrapPlatformHandle(&platform_handle, &wrapped_handle) != + MOJO_RESULT_OK) { + return mojo::ScopedHandle(); + } + attachment->reset_mach_port_ownership(); + return mojo::MakeScopedHandle(mojo::Handle(wrapped_handle)); + } +#elif defined(OS_FUCHSIA) + case Type::FUCHSIA_HANDLE: { + auto* attachment = static_cast<internal::HandleAttachmentFuchsia*>(this); + MojoPlatformHandle platform_handle = { + sizeof(platform_handle), MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE, + static_cast<uint64_t>(attachment->Take())}; + MojoHandle wrapped_handle; + if (MojoWrapPlatformHandle(&platform_handle, &wrapped_handle) != + MOJO_RESULT_OK) { + return mojo::ScopedHandle(); + } + return mojo::MakeScopedHandle(mojo::Handle(wrapped_handle)); + } +#elif defined(OS_WIN) + case Type::WIN_HANDLE: + return mojo::WrapPlatformFile( + static_cast<internal::HandleAttachmentWin*>(this)->Take()); +#endif + default: + break; + } + NOTREACHED(); + return mojo::ScopedHandle(); } -MessageAttachment::~MessageAttachment() { +// static +scoped_refptr<MessageAttachment> MessageAttachment::CreateFromMojoHandle( + mojo::ScopedHandle handle, + Type type) { + if (type == Type::MOJO_HANDLE) + return new internal::MojoHandleAttachment(std::move(handle)); + + MojoPlatformHandle platform_handle = {sizeof(platform_handle), 0, 0}; + MojoResult unwrap_result = + MojoUnwrapPlatformHandle(handle.release().value(), &platform_handle); + if (unwrap_result != MOJO_RESULT_OK) + return nullptr; + +#if defined(OS_POSIX) + if (type == Type::PLATFORM_FILE) { + base::PlatformFile file = base::kInvalidPlatformFile; + if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR) + file = static_cast<base::PlatformFile>(platform_handle.value); + return new internal::PlatformFileAttachment(file); + } +#endif // defined(OS_POSIX) + +#if defined(OS_MACOSX) && !defined(OS_IOS) + if (type == Type::MACH_PORT) { + mach_port_t mach_port = MACH_PORT_NULL; + if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT) + mach_port = static_cast<mach_port_t>(platform_handle.value); + return new internal::MachPortAttachmentMac( + mach_port, internal::MachPortAttachmentMac::FROM_WIRE); + } +#elif defined(OS_FUCHSIA) + if (type == Type::FUCHSIA_HANDLE) { + base::ScopedMxHandle handle; + if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE) + handle.reset(static_cast<mx_handle_t>(platform_handle.value)); + return new internal::HandleAttachmentFuchsia(std::move(handle)); + } +#elif defined(OS_WIN) + if (type == Type::WIN_HANDLE) { + base::PlatformFile handle = base::kInvalidPlatformFile; + if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE) + handle = reinterpret_cast<base::PlatformFile>(platform_handle.value); + return new internal::HandleAttachmentWin( + handle, internal::HandleAttachmentWin::FROM_WIRE); + } +#endif + NOTREACHED(); + return nullptr; } } // namespace IPC
diff --git a/ipc/ipc_message_attachment.h b/ipc/ipc_message_attachment.h index 9ff1de8c..9c92f37 100644 --- a/ipc/ipc_message_attachment.h +++ b/ipc/ipc_message_attachment.h
@@ -10,19 +10,32 @@ #include "base/memory/ref_counted.h" #include "base/pickle.h" #include "build/build_config.h" -#include "ipc/ipc.mojom.h" -#include "ipc/ipc_export.h" +#include "ipc/ipc_message_support_export.h" +#include "mojo/public/cpp/system/handle.h" namespace IPC { // Auxiliary data sent with |Message|. This can be a platform file descriptor // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. -class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment { +class IPC_MESSAGE_SUPPORT_EXPORT MessageAttachment + : public base::Pickle::Attachment { public: - using Type = mojom::SerializedHandle::Type; + enum class Type { + MOJO_HANDLE, + PLATFORM_FILE, + WIN_HANDLE, + MACH_PORT, + FUCHSIA_HANDLE, + }; + + static scoped_refptr<MessageAttachment> CreateFromMojoHandle( + mojo::ScopedHandle handle, + Type type); virtual Type GetType() const = 0; + mojo::ScopedHandle TakeMojoHandle(); + protected: friend class base::RefCountedThreadSafe<MessageAttachment>; MessageAttachment();
diff --git a/ipc/ipc_message_attachment_set.h b/ipc/ipc_message_attachment_set.h index de37211..78bdcb2 100644 --- a/ipc/ipc_message_attachment_set.h +++ b/ipc/ipc_message_attachment_set.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" -#include "ipc/ipc_export.h" +#include "ipc/ipc_message_support_export.h" namespace IPC { @@ -26,7 +26,7 @@ // For ChannelNacl under SFI NaCl, only Type::PLATFORM_FILE is supported. In // that case, the FD is sent over socket. // ----------------------------------------------------------------------------- -class IPC_EXPORT MessageAttachmentSet +class IPC_MESSAGE_SUPPORT_EXPORT MessageAttachmentSet : public base::RefCountedThreadSafe<MessageAttachmentSet> { public: MessageAttachmentSet();
diff --git a/ipc/ipc_message_pipe_reader.cc b/ipc/ipc_message_pipe_reader.cc index 8b22681..ebc18a3 100644 --- a/ipc/ipc_message_pipe_reader.cc +++ b/ipc/ipc_message_pipe_reader.cc
@@ -54,7 +54,7 @@ "MessagePipeReader::Send", message->flags(), TRACE_EVENT_FLAG_FLOW_OUT); - base::Optional<std::vector<mojom::SerializedHandlePtr>> handles; + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles; MojoResult result = MOJO_RESULT_OK; result = ChannelMojo::ReadFromMessageAttachmentSet(message.get(), &handles); if (result != MOJO_RESULT_OK) @@ -86,7 +86,7 @@ void MessagePipeReader::Receive( base::span<const uint8_t> data, - base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) { + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles) { Message message( data.empty() ? "" : reinterpret_cast<const char*>(data.data()), static_cast<uint32_t>(data.size()));
diff --git a/ipc/ipc_message_pipe_reader.h b/ipc/ipc_message_pipe_reader.h index b2f5044..a155dcf 100644 --- a/ipc/ipc_message_pipe_reader.h +++ b/ipc/ipc_message_pipe_reader.h
@@ -22,6 +22,7 @@ #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/message_pipe.h" +#include "mojo/public/interfaces/bindings/native_struct.mojom.h" namespace IPC { namespace internal { @@ -93,9 +94,9 @@ private: // mojom::Channel: void SetPeerPid(int32_t peer_pid) override; - void Receive( - base::span<const uint8_t> data, - base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) override; + void Receive(base::span<const uint8_t> data, + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> + handles) override; void GetAssociatedInterface( const std::string& name, mojom::GenericInterfaceAssociatedRequest request) override;
diff --git a/ipc/ipc_message_support_export.h b/ipc/ipc_message_support_export.h new file mode 100644 index 0000000..abfa67a --- /dev/null +++ b/ipc/ipc_message_support_export.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 IPC_IPC_MESSAGE_SUPPORT_EXPORT_H_ +#define IPC_IPC_MESSAGE_SUPPORT_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(IPC_MESSAGE_SUPPORT_IMPL) +#define IPC_MESSAGE_SUPPORT_EXPORT __declspec(dllexport) +#else +#define IPC_MESSAGE_SUPPORT_EXPORT __declspec(dllimport) +#endif // defined(IPC_MESSAGE_SUPPORT_IMPL) + +#else // defined(WIN32) + +#if defined(IPC_MESSAGE_SUPPORT_IMPL) +#define IPC_MESSAGE_SUPPORT_EXPORT __attribute__((visibility("default"))) +#else +#define IPC_MESSAGE_SUPPORT_EXPORT +#endif + +#endif + +#else // defined(COMPONENT_BUILD) +#define IPC_MESSAGE_SUPPORT_EXPORT +#endif + +#endif // IPC_IPC_MESSAGE_SUPPORT_EXPORT_H_
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 1beac85..120ad50 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h
@@ -28,6 +28,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" +#include "ipc/ipc_export.h" #include "ipc/ipc_message_start.h" #include "ipc/ipc_param_traits.h" #include "ipc/ipc_sync_message.h"
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc index 506c9f8..3ec5efbe 100644 --- a/ipc/ipc_mojo_bootstrap.cc +++ b/ipc/ipc_mojo_bootstrap.cc
@@ -32,6 +32,7 @@ #include "mojo/public/cpp/bindings/pipe_control_message_handler_delegate.h" #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" #include "mojo/public/cpp/bindings/sync_event_watcher.h" +#include "mojo/public/cpp/bindings/tracked_scoped_refptr.h" namespace IPC { @@ -204,7 +205,11 @@ return; { base::AutoLock locker(lock_); - DCHECK(ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after + // bug investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); + Endpoint* endpoint = endpoints_[id].get(); DCHECK(!endpoint->client()); DCHECK(!endpoint->closed()); @@ -225,7 +230,10 @@ DCHECK(client); base::AutoLock locker(lock_); - DCHECK(ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after bug + // investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); Endpoint* endpoint = endpoints_[id].get(); endpoint->AttachClient(client, std::move(runner)); @@ -243,7 +251,10 @@ DCHECK(mojo::IsValidInterfaceId(id)); base::AutoLock locker(lock_); - DCHECK(ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after bug + // investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); Endpoint* endpoint = endpoints_[id].get(); endpoint->DetachClient(); @@ -872,7 +883,7 @@ // ID #1 is reserved for the mojom::Channel interface. uint32_t next_interface_id_ = 2; - std::map<uint32_t, scoped_refptr<Endpoint>> endpoints_; + std::map<uint32_t, mojo::TrackedScopedRefPtr<Endpoint>> endpoints_; DISALLOW_COPY_AND_ASSIGN(ChannelAssociatedGroupController); };
diff --git a/ipc/ipc_mojo_bootstrap_unittest.cc b/ipc/ipc_mojo_bootstrap_unittest.cc index 52e261f..d74903c 100644 --- a/ipc/ipc_mojo_bootstrap_unittest.cc +++ b/ipc/ipc_mojo_bootstrap_unittest.cc
@@ -43,7 +43,7 @@ } void Receive(base::span<const uint8_t> data, - base::Optional<std::vector<IPC::mojom::SerializedHandlePtr>> + base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles) override {} void GetAssociatedInterface(
diff --git a/ipc/ipc_mojo_handle_attachment.h b/ipc/ipc_mojo_handle_attachment.h index d615276..94e4059 100644 --- a/ipc/ipc_mojo_handle_attachment.h +++ b/ipc/ipc_mojo_handle_attachment.h
@@ -8,8 +8,8 @@ #include "base/files/file.h" #include "base/macros.h" #include "build/build_config.h" -#include "ipc/ipc_export.h" #include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_support_export.h" #include "mojo/public/cpp/system/handle.h" namespace IPC { @@ -20,7 +20,8 @@ // This can hold any type of transferrable Mojo handle (i.e. message pipe, data // pipe, etc), but the receiver is expected to know what type of handle to // expect. -class IPC_EXPORT MojoHandleAttachment : public MessageAttachment { +class IPC_MESSAGE_SUPPORT_EXPORT MojoHandleAttachment + : public MessageAttachment { public: explicit MojoHandleAttachment(mojo::ScopedHandle handle);
diff --git a/ipc/ipc_mojo_message_helper.cc b/ipc/ipc_mojo_message_helper.cc index a87a2d69..41ac70f 100644 --- a/ipc/ipc_mojo_message_helper.cc +++ b/ipc/ipc_mojo_message_helper.cc
@@ -33,7 +33,7 @@ MessageAttachment::Type type = static_cast<MessageAttachment*>(attachment.get())->GetType(); if (type != MessageAttachment::Type::MOJO_HANDLE) { - LOG(ERROR) << "Unxpected attachment type:" << type; + LOG(ERROR) << "Unxpected attachment type:" << static_cast<int>(type); return false; }
diff --git a/ipc/ipc_mojo_message_helper.h b/ipc/ipc_mojo_message_helper.h index 4a71b5c..156c667 100644 --- a/ipc/ipc_mojo_message_helper.h +++ b/ipc/ipc_mojo_message_helper.h
@@ -5,14 +5,14 @@ #ifndef IPC_IPC_MOJO_MESSAGE_HELPER_H_ #define IPC_IPC_MOJO_MESSAGE_HELPER_H_ -#include "ipc/ipc_export.h" #include "ipc/ipc_message.h" +#include "ipc/ipc_message_support_export.h" #include "mojo/public/cpp/system/message_pipe.h" namespace IPC { // Reads and writes |mojo::MessagePipe| from/to |Message|. -class IPC_EXPORT MojoMessageHelper { +class IPC_MESSAGE_SUPPORT_EXPORT MojoMessageHelper { public: static bool WriteMessagePipeTo(base::Pickle* message, mojo::ScopedMessagePipeHandle handle);
diff --git a/ipc/ipc_mojo_param_traits.cc b/ipc/ipc_mojo_param_traits.cc index d814bd9..5eeb9f0f 100644 --- a/ipc/ipc_mojo_param_traits.cc +++ b/ipc/ipc_mojo_param_traits.cc
@@ -69,7 +69,7 @@ MessageAttachment::Type type = static_cast<MessageAttachment*>(attachment.get())->GetType(); if (type != MessageAttachment::Type::MOJO_HANDLE) { - DLOG(ERROR) << "Unexpected attachment type:" << type; + DLOG(ERROR) << "Unexpected attachment type:" << static_cast<int>(type); return false; }
diff --git a/ipc/ipc_platform_file.h b/ipc/ipc_platform_file.h index ea295af8..1704b943 100644 --- a/ipc/ipc_platform_file.h +++ b/ipc/ipc_platform_file.h
@@ -8,7 +8,7 @@ #include "base/files/file.h" #include "base/process/process.h" #include "build/build_config.h" -#include "ipc/ipc_export.h" +#include "ipc/ipc_message_support_export.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" @@ -17,7 +17,7 @@ namespace IPC { #if defined(OS_WIN) -class IPC_EXPORT PlatformFileForTransit { +class IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit { public: // Creates an invalid platform file. PlatformFileForTransit(); @@ -72,14 +72,14 @@ // Creates a new handle that can be passed through IPC. The result must be // passed to the IPC layer as part of a message, or else it will leak. -IPC_EXPORT PlatformFileForTransit GetPlatformFileForTransit( - base::PlatformFile file, - bool close_source_handle); +IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit +GetPlatformFileForTransit(base::PlatformFile file, bool close_source_handle); // Creates a new handle that can be passed through IPC. The result must be // passed to the IPC layer as part of a message, or else it will leak. // Note that this function takes ownership of |file|. -IPC_EXPORT PlatformFileForTransit TakePlatformFileForTransit(base::File file); +IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit +TakePlatformFileForTransit(base::File file); } // namespace IPC
diff --git a/ipc/ipc_platform_file_attachment_posix.h b/ipc/ipc_platform_file_attachment_posix.h index 9b079009..945c345 100644 --- a/ipc/ipc_platform_file_attachment_posix.h +++ b/ipc/ipc_platform_file_attachment_posix.h
@@ -5,8 +5,8 @@ #ifndef IPC_IPC_PLATFORM_FILE_ATTACHMENT_H_ #define IPC_IPC_PLATFORM_FILE_ATTACHMENT_H_ -#include "ipc/ipc_export.h" #include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_support_export.h" namespace IPC { namespace internal { @@ -15,7 +15,8 @@ // PlatformFileAttachment optionally owns the file and |owning_| is set in that // case. Also, |file_| is not cleared even after the ownership is taken. // Some old clients require this strange behavior. -class IPC_EXPORT PlatformFileAttachment : public MessageAttachment { +class IPC_MESSAGE_SUPPORT_EXPORT PlatformFileAttachment + : public MessageAttachment { public: // Non-owning constructor explicit PlatformFileAttachment(base::PlatformFile file);
diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h index 7f05551..c9a1287a 100644 --- a/ipc/ipc_sync_message.h +++ b/ipc/ipc_sync_message.h
@@ -16,6 +16,7 @@ #include "build/build_config.h" #include "ipc/ipc_message.h" +#include "ipc/ipc_message_support_export.h" namespace base { class WaitableEvent; @@ -25,7 +26,7 @@ class MessageReplyDeserializer; -class IPC_EXPORT SyncMessage : public Message { +class IPC_MESSAGE_SUPPORT_EXPORT SyncMessage : public Message { public: SyncMessage(int32_t routing_id, uint32_t type, @@ -79,7 +80,7 @@ }; // Used to deserialize parameters from a reply to a synchronous message -class IPC_EXPORT MessageReplyDeserializer { +class IPC_MESSAGE_SUPPORT_EXPORT MessageReplyDeserializer { public: virtual ~MessageReplyDeserializer() {} bool SerializeOutputParameters(const Message& msg);
diff --git a/ipc/mach_port_attachment_mac.h b/ipc/mach_port_attachment_mac.h index 861c4e3..ae41cd0 100644 --- a/ipc/mach_port_attachment_mac.h +++ b/ipc/mach_port_attachment_mac.h
@@ -10,15 +10,16 @@ #include "base/macros.h" #include "base/process/process_handle.h" -#include "ipc/ipc_export.h" #include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_support_export.h" #include "ipc/mach_port_mac.h" namespace IPC { namespace internal { // This class represents an OSX mach_port_t attached to a Chrome IPC message. -class IPC_EXPORT MachPortAttachmentMac : public MessageAttachment { +class IPC_MESSAGE_SUPPORT_EXPORT MachPortAttachmentMac + : public MessageAttachment { public: // This constructor increments the ref count of |mach_port_| and takes // ownership of the result. Should only be called by the sender of a Chrome
diff --git a/ipc/mach_port_mac.cc b/ipc/mach_port_mac.cc index 67043f2..9166364 100644 --- a/ipc/mach_port_mac.cc +++ b/ipc/mach_port_mac.cc
@@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" #include "ipc/mach_port_attachment_mac.h" namespace IPC {
diff --git a/ipc/mach_port_mac.h b/ipc/mach_port_mac.h index b95a37b..49ca1c3 100644 --- a/ipc/mach_port_mac.h +++ b/ipc/mach_port_mac.h
@@ -8,8 +8,9 @@ #include <mach/mach.h> #include "base/macros.h" -#include "ipc/ipc_export.h" -#include "ipc/ipc_message_macros.h" +#include "base/pickle.h" +#include "ipc/ipc_message_support_export.h" +#include "ipc/ipc_param_traits.h" namespace IPC { @@ -18,7 +19,7 @@ // to the Mach port will be duplicated into the destination process by the // attachment broker. If needed, attachment brokering can be trivially extended // to support duplication of other types of rights. -class IPC_EXPORT MachPortMac { +class IPC_MESSAGE_SUPPORT_EXPORT MachPortMac { public: MachPortMac() : mach_port_(MACH_PORT_NULL) {} @@ -69,7 +70,7 @@ }; template <> -struct IPC_EXPORT ParamTraits<MachPortMac> { +struct IPC_MESSAGE_SUPPORT_EXPORT ParamTraits<MachPortMac> { typedef MachPortMac param_type; static void Write(base::Pickle* m, const param_type& p); static bool Read(const base::Pickle* m,
diff --git a/ipc/native_handle_type_converters.cc b/ipc/native_handle_type_converters.cc new file mode 100644 index 0000000..a0391b6 --- /dev/null +++ b/ipc/native_handle_type_converters.cc
@@ -0,0 +1,49 @@ +// 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 "ipc/native_handle_type_converters.h" + +namespace mojo { + +// static +IPC::MessageAttachment::Type +TypeConverter<IPC::MessageAttachment::Type, native::SerializedHandle_Type>:: + Convert(native::SerializedHandle_Type type) { + switch (type) { + case native::SerializedHandle_Type::MOJO_HANDLE: + return IPC::MessageAttachment::Type::MOJO_HANDLE; + case native::SerializedHandle_Type::PLATFORM_FILE: + return IPC::MessageAttachment::Type::PLATFORM_FILE; + case native::SerializedHandle_Type::WIN_HANDLE: + return IPC::MessageAttachment::Type::WIN_HANDLE; + case native::SerializedHandle_Type::MACH_PORT: + return IPC::MessageAttachment::Type::MACH_PORT; + case native::SerializedHandle_Type::FUCHSIA_HANDLE: + return IPC::MessageAttachment::Type::FUCHSIA_HANDLE; + } + NOTREACHED(); + return IPC::MessageAttachment::Type::MOJO_HANDLE; +} + +// static +native::SerializedHandle_Type TypeConverter< + native::SerializedHandle_Type, + IPC::MessageAttachment::Type>::Convert(IPC::MessageAttachment::Type type) { + switch (type) { + case IPC::MessageAttachment::Type::MOJO_HANDLE: + return native::SerializedHandle_Type::MOJO_HANDLE; + case IPC::MessageAttachment::Type::PLATFORM_FILE: + return native::SerializedHandle_Type::PLATFORM_FILE; + case IPC::MessageAttachment::Type::WIN_HANDLE: + return native::SerializedHandle_Type::WIN_HANDLE; + case IPC::MessageAttachment::Type::MACH_PORT: + return native::SerializedHandle_Type::MACH_PORT; + case IPC::MessageAttachment::Type::FUCHSIA_HANDLE: + return native::SerializedHandle_Type::FUCHSIA_HANDLE; + } + NOTREACHED(); + return native::SerializedHandle_Type::MOJO_HANDLE; +} + +} // namespace mojo
diff --git a/ipc/native_handle_type_converters.h b/ipc/native_handle_type_converters.h new file mode 100644 index 0000000..81d26c5 --- /dev/null +++ b/ipc/native_handle_type_converters.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 IPC_NATIVE_HANDLE_CONVERTER_H_ +#define IPC_NATIVE_HANDLE_CONVERTER_H_ + +#include "ipc/ipc_message_attachment.h" +#include "mojo/public/cpp/bindings/type_converter.h" // nogncheck +#include "mojo/public/interfaces/bindings/native_struct.mojom-shared.h" + +namespace mojo { + +template <> +struct TypeConverter<IPC::MessageAttachment::Type, + native::SerializedHandle_Type> { + static IPC::MessageAttachment::Type Convert( + native::SerializedHandle_Type type); +}; + +template <> +struct TypeConverter<native::SerializedHandle_Type, + IPC::MessageAttachment::Type> { + static native::SerializedHandle_Type Convert( + IPC::MessageAttachment::Type type); +}; + +} // namespace mojo + +#endif // IPC_NATIVE_HANDLE_CONVERTER_H_
diff --git a/media/audio/audio_system.cc b/media/audio/audio_system.cc index 953be40..dfcd7bdc 100644 --- a/media/audio/audio_system.cc +++ b/media/audio/audio_system.cc
@@ -4,35 +4,18 @@ #include "media/audio/audio_system.h" -namespace media { +#include "base/memory/ptr_util.h" +#include "media/audio/audio_manager.h" +#include "media/audio/audio_system_impl.h" -static AudioSystem* g_last_created = nullptr; +namespace media { AudioSystem::~AudioSystem() {} -AudioSystem* AudioSystem::Get() { - return g_last_created; -} - -void AudioSystem::SetInstance(AudioSystem* audio_system) { - DCHECK(audio_system); - if (g_last_created && audio_system) { - // We create multiple instances of AudioSystem only when testing. - // We should not encounter this case in production. - LOG(WARNING) << "Multiple instances of AudioSystem detected"; - } - g_last_created = audio_system; -} - -void AudioSystem::ClearInstance(const AudioSystem* audio_system) { - DCHECK(audio_system); - if (g_last_created != audio_system) { - // We create multiple instances of AudioSystem only when testing. - // We should not encounter this case in production. - LOG(WARNING) << "Multiple instances of AudioSystem detected"; - } else { - g_last_created = nullptr; - } +// static +std::unique_ptr<AudioSystem> AudioSystem::CreateInstance() { + DCHECK(AudioManager::Get()) << "AudioManager instance is not created"; + return std::make_unique<AudioSystemImpl>(AudioManager::Get()); } } // namespace media
diff --git a/media/audio/audio_system.h b/media/audio/audio_system.h index e2de5009..406b23c7 100644 --- a/media/audio/audio_system.h +++ b/media/audio/audio_system.h
@@ -18,8 +18,9 @@ // Provides asynchronous interface to access audio device information class MEDIA_EXPORT AudioSystem { public: - // Replies are asynchronously sent from audio system thread to the thread the - // call is issued on. Attention! Audio system thread may outlive the client + // Replies are sent asynchronously to the thread the calls are issued on. + // Instance is bound to the thread it's called on the first time. + // Attention! Audio system thread may outlive the client // objects; bind callbacks with care. // Non-empty optional AudioParameters are guaranteed to be valid. @@ -40,7 +41,8 @@ base::OnceCallback<void(AudioDeviceDescriptions)>; using OnDeviceIdCallback = base::OnceCallback<void(const std::string&)>; - static AudioSystem* Get(); + // The global AudioManager instance must be created prior to that. + static std::unique_ptr<AudioSystem> CreateInstance(); virtual ~AudioSystem(); @@ -72,15 +74,8 @@ virtual void GetInputDeviceInfo( const std::string& input_device_id, OnInputDeviceInfoCallback on_input_device_info_cb) = 0; - - protected: - // Sets the global AudioSystem pointer to the specified non-null value. - static void SetInstance(AudioSystem* audio_system); - - // Sets the global AudioSystem pointer to null if it equals the specified one. - static void ClearInstance(const AudioSystem* audio_system); }; } // namespace media -#endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_ +#endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_s
diff --git a/media/audio/audio_system_helper.cc b/media/audio/audio_system_helper.cc index e43bedf2..511a7ce 100644 --- a/media/audio/audio_system_helper.cc +++ b/media/audio/audio_system_helper.cc
@@ -41,33 +41,33 @@ void AudioSystemHelper::GetInputStreamParameters( const std::string& device_id, AudioSystem::OnAudioParamsCallback on_params_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); std::move(on_params_cb).Run(ComputeInputParameters(device_id)); } void AudioSystemHelper::GetOutputStreamParameters( const std::string& device_id, AudioSystem::OnAudioParamsCallback on_params_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); std::move(on_params_cb).Run(ComputeOutputParameters(device_id)); } void AudioSystemHelper::HasInputDevices( AudioSystem::OnBoolCallback on_has_devices_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); std::move(on_has_devices_cb).Run(audio_manager_->HasAudioInputDevices()); } void AudioSystemHelper::HasOutputDevices( AudioSystem::OnBoolCallback on_has_devices_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); std::move(on_has_devices_cb).Run(audio_manager_->HasAudioOutputDevices()); } void AudioSystemHelper::GetDeviceDescriptions( bool for_input, AudioSystem::OnDeviceDescriptionsCallback on_descriptions_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); AudioDeviceDescriptions descriptions; if (for_input) audio_manager_->GetAudioInputDeviceDescriptions(&descriptions); @@ -79,7 +79,7 @@ void AudioSystemHelper::GetAssociatedOutputDeviceID( const std::string& input_device_id, AudioSystem::OnDeviceIdCallback on_device_id_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); std::move(on_device_id_cb) .Run(audio_manager_->GetAssociatedOutputDeviceID(input_device_id)); } @@ -87,7 +87,7 @@ void AudioSystemHelper::GetInputDeviceInfo( const std::string& input_device_id, AudioSystem::OnInputDeviceInfoCallback on_input_device_info_cb) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); const std::string associated_output_device_id = audio_manager_->GetAssociatedOutputDeviceID(input_device_id); @@ -99,13 +99,9 @@ associated_output_device_id); } -base::SingleThreadTaskRunner* AudioSystemHelper::GetTaskRunner() { - return audio_manager_->GetTaskRunner(); -} - base::Optional<AudioParameters> AudioSystemHelper::ComputeInputParameters( const std::string& device_id) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); // TODO(olka): remove this when AudioManager::GetInputStreamParameters() // returns invalid parameters if the device is not found. @@ -127,7 +123,7 @@ base::Optional<AudioParameters> AudioSystemHelper::ComputeOutputParameters( const std::string& device_id) { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); + DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); // TODO(olka): remove this when // AudioManager::Get[Default]OutputStreamParameters() returns invalid
diff --git a/media/audio/audio_system_helper.h b/media/audio/audio_system_helper.h index 1ae6a86e..e3e1642 100644 --- a/media/audio/audio_system_helper.h +++ b/media/audio/audio_system_helper.h
@@ -8,10 +8,6 @@ #include "media/audio/audio_system.h" #include "media/base/media_export.h" -namespace base { -class SingleThreadTaskRunner; -} - namespace media { class AudioManager; @@ -47,8 +43,6 @@ const std::string& input_device_id, AudioSystem::OnInputDeviceInfoCallback on_input_device_info_cb); - base::SingleThreadTaskRunner* GetTaskRunner(); - private: base::Optional<AudioParameters> ComputeInputParameters( const std::string& device_id);
diff --git a/media/audio/audio_system_impl.cc b/media/audio/audio_system_impl.cc index 2a31254a..12a5eab 100644 --- a/media/audio/audio_system_impl.cc +++ b/media/audio/audio_system_impl.cc
@@ -7,10 +7,11 @@ #include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" +#include "media/audio/audio_manager.h" #include "media/base/bind_to_current_loop.h" -// Using base::Unretained for |&helper_| is safe since AudioSystem is deleted -// after audio thread is stopped. +// Using base::Unretained for |audio_manager_| is safe since AudioManager is +// deleted after audio thread is stopped. // No need to bind the callback to the current loop if we are on the audio // thread. However, the client still expects to receive the reply @@ -20,94 +21,150 @@ namespace media { +namespace { + +void GetInputStreamParametersOnAudioThread( + AudioManager* audio_manager, + const std::string& device_id, + AudioSystem::OnAudioParamsCallback on_params_cb) { + AudioSystemHelper(audio_manager) + .GetInputStreamParameters(device_id, std::move(on_params_cb)); +} + +void GetOutputStreamParametersOnAudioThread( + AudioManager* audio_manager, + const std::string& device_id, + AudioSystem::OnAudioParamsCallback on_params_cb) { + AudioSystemHelper(audio_manager) + .GetOutputStreamParameters(device_id, std::move(on_params_cb)); +} + +void HasInputDevicesOnAudioThread( + AudioManager* audio_manager, + AudioSystem::OnBoolCallback on_has_devices_cb) { + AudioSystemHelper(audio_manager) + .HasInputDevices(std::move(on_has_devices_cb)); +} + +void HasOutputDevicesOnAudioThread( + AudioManager* audio_manager, + AudioSystem::OnBoolCallback on_has_devices_cb) { + AudioSystemHelper(audio_manager) + .HasOutputDevices(std::move(on_has_devices_cb)); +} + +void GetDeviceDescriptionsOnAudioThread( + AudioManager* audio_manager, + bool for_input, + AudioSystem::OnDeviceDescriptionsCallback on_descriptions_cb) { + AudioSystemHelper(audio_manager) + .GetDeviceDescriptions(for_input, std::move(on_descriptions_cb)); +} + +void GetAssociatedOutputDeviceIDOnAudioThread( + AudioManager* audio_manager, + const std::string& input_device_id, + AudioSystem::OnDeviceIdCallback on_device_id_cb) { + AudioSystemHelper(audio_manager) + .GetAssociatedOutputDeviceID(input_device_id, std::move(on_device_id_cb)); +} + +void GetInputDeviceInfoOnAudioThread( + AudioManager* audio_manager, + const std::string& input_device_id, + AudioSystem::OnInputDeviceInfoCallback on_input_device_info_cb) { + AudioSystemHelper(audio_manager) + .GetInputDeviceInfo(input_device_id, std::move(on_input_device_info_cb)); +} + +} // namespace + template <typename... Args> inline base::OnceCallback<void(Args...)> AudioSystemImpl::MaybeBindToCurrentLoop( base::OnceCallback<void(Args...)> callback) { - return helper_.GetTaskRunner()->BelongsToCurrentThread() + return audio_manager_->GetTaskRunner()->BelongsToCurrentThread() ? std::move(callback) : media::BindToCurrentLoop(std::move(callback)); } AudioSystemImpl::AudioSystemImpl(AudioManager* audio_manager) - : helper_(audio_manager) { - AudioSystem::SetInstance(this); -} - -AudioSystemImpl::~AudioSystemImpl() { - AudioSystem::ClearInstance(this); -} - -// static -std::unique_ptr<AudioSystem> AudioSystemImpl::Create( - AudioManager* audio_manager) { - return base::WrapUnique(new AudioSystemImpl(audio_manager)); + : audio_manager_(audio_manager) { + DETACH_FROM_THREAD(thread_checker_); } void AudioSystemImpl::GetInputStreamParameters( const std::string& device_id, OnAudioParamsCallback on_params_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::GetInputStreamParameters, - base::Unretained(&helper_), device_id, + base::BindOnce(&GetInputStreamParametersOnAudioThread, + base::Unretained(audio_manager_), device_id, MaybeBindToCurrentLoop(std::move(on_params_cb)))); } void AudioSystemImpl::GetOutputStreamParameters( const std::string& device_id, OnAudioParamsCallback on_params_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::GetOutputStreamParameters, - base::Unretained(&helper_), device_id, + base::BindOnce(&GetOutputStreamParametersOnAudioThread, + base::Unretained(audio_manager_), device_id, MaybeBindToCurrentLoop(std::move(on_params_cb)))); } void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::HasInputDevices, - base::Unretained(&helper_), + base::BindOnce(&HasInputDevicesOnAudioThread, + base::Unretained(audio_manager_), MaybeBindToCurrentLoop(std::move(on_has_devices_cb)))); } void AudioSystemImpl::HasOutputDevices(OnBoolCallback on_has_devices_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::HasOutputDevices, - base::Unretained(&helper_), + base::BindOnce(&HasOutputDevicesOnAudioThread, + base::Unretained(audio_manager_), MaybeBindToCurrentLoop(std::move(on_has_devices_cb)))); } void AudioSystemImpl::GetDeviceDescriptions( bool for_input, OnDeviceDescriptionsCallback on_descriptions_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::GetDeviceDescriptions, - base::Unretained(&helper_), for_input, + base::BindOnce(&GetDeviceDescriptionsOnAudioThread, + base::Unretained(audio_manager_), for_input, MaybeBindToCurrentLoop(std::move(on_descriptions_cb)))); } void AudioSystemImpl::GetAssociatedOutputDeviceID( const std::string& input_device_id, OnDeviceIdCallback on_device_id_cb) { - helper_.GetTaskRunner()->PostTask( + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&AudioSystemHelper::GetAssociatedOutputDeviceID, - base::Unretained(&helper_), input_device_id, + base::BindOnce(&GetAssociatedOutputDeviceIDOnAudioThread, + base::Unretained(audio_manager_), input_device_id, MaybeBindToCurrentLoop(std::move(on_device_id_cb)))); } void AudioSystemImpl::GetInputDeviceInfo( const std::string& input_device_id, OnInputDeviceInfoCallback on_input_device_info_cb) { - helper_.GetTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&AudioSystemHelper::GetInputDeviceInfo, - base::Unretained(&helper_), input_device_id, - MaybeBindToCurrentLoop( - std::move(on_input_device_info_cb)))); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + audio_manager_->GetTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce( + &GetInputDeviceInfoOnAudioThread, base::Unretained(audio_manager_), + input_device_id, + MaybeBindToCurrentLoop(std::move(on_input_device_info_cb)))); } } // namespace media
diff --git a/media/audio/audio_system_impl.h b/media/audio/audio_system_impl.h index 8ff9e003..e5be75d 100644 --- a/media/audio/audio_system_impl.h +++ b/media/audio/audio_system_impl.h
@@ -5,6 +5,7 @@ #ifndef MEDIA_AUDIO_AUDIO_SYSTEM_IMPL_H_ #define MEDIA_AUDIO_AUDIO_SYSTEM_IMPL_H_ +#include "base/threading/thread_checker.h" #include "media/audio/audio_system.h" #include "media/audio/audio_system_helper.h" @@ -13,9 +14,7 @@ class MEDIA_EXPORT AudioSystemImpl : public AudioSystem { public: - static std::unique_ptr<AudioSystem> Create(AudioManager* audio_manager); - - ~AudioSystemImpl() override; + explicit AudioSystemImpl(AudioManager* audio_manager); // AudioSystem implementation. void GetInputStreamParameters(const std::string& device_id, @@ -40,15 +39,14 @@ OnInputDeviceInfoCallback on_input_device_info_cb) override; private: - AudioSystemImpl(AudioManager* audio_manager); - // No-op if called on helper_.GetTaskRunner() thread, otherwise binds // |callback| to the current loop. template <typename... Args> base::OnceCallback<void(Args...)> MaybeBindToCurrentLoop( base::OnceCallback<void(Args...)> callback); - AudioSystemHelper helper_; + THREAD_CHECKER(thread_checker_); + AudioManager* const audio_manager_; DISALLOW_COPY_AND_ASSIGN(AudioSystemImpl); };
diff --git a/media/audio/audio_system_impl_unittest.cc b/media/audio/audio_system_impl_unittest.cc index 3e72a43..43e0783 100644 --- a/media/audio/audio_system_impl_unittest.cc +++ b/media/audio/audio_system_impl_unittest.cc
@@ -70,8 +70,7 @@ base::Bind(get_device_descriptions, base::Unretained(&output_device_descriptions_))); - audio_system_ = AudioSystemImpl::Create(audio_manager_.get()); - EXPECT_EQ(AudioSystem::Get(), audio_system_.get()); + audio_system_ = std::make_unique<AudioSystemImpl>(audio_manager_.get()); } ~AudioSystemImplTest() override { audio_manager_->Shutdown(); }
diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index 8039a1e..a2f181ca 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc
@@ -1,18 +1,16 @@ // 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. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES #include "media/audio/simple_sources.h" #include <stddef.h> #include <algorithm> -#include <cmath> #include "base/files/file.h" #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "base/time/time.h" #include "media/audio/sounds/wav_audio_handler.h" #include "media/base/audio_bus.h" @@ -132,7 +130,7 @@ int max_frames = cap_ > 0 ? std::min(dest->frames(), cap_ - time_state_) : dest->frames(); for (int i = 0; i < max_frames; ++i) - dest->channel(0)[i] = sin(2.0 * M_PI * f_ * time_state_++); + dest->channel(0)[i] = sin(2.0 * base::kPiDouble * f_ * time_state_++); for (int i = 1; i < dest->channels(); ++i) { memcpy(dest->channel(i), dest->channel(0), max_frames * sizeof(*dest->channel(i)));
diff --git a/media/base/audio_hash.cc b/media/base/audio_hash.cc index 7f133dd..6d8eee8 100644 --- a/media/base/audio_hash.cc +++ b/media/base/audio_hash.cc
@@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES #include <cmath> #include <sstream> #include "media/base/audio_hash.h" #include "base/macros.h" +#include "base/numerics/math_constants.h" #include "base/strings/stringprintf.h" #include "media/base/audio_bus.h" @@ -36,7 +35,8 @@ // buffers don't result in an empty hash. if (ch == 0) { audio_hash_[kHashIndex] += - channel[i] + sin(2.0 * M_PI * M_PI * kSampleIndex); + channel[i] + + std::sin(2.0 * base::kPiDouble * base::kPiDouble * kSampleIndex); } else { audio_hash_[kHashIndex] += channel[i]; } @@ -60,7 +60,7 @@ std::stringstream is(other); for (size_t i = 0; i < arraysize(audio_hash_); ++i) { is >> other_hash >> comma; - if (fabs(audio_hash_[i] - other_hash) > tolerance) + if (std::fabs(audio_hash_[i] - other_hash) > tolerance) return false; } return true;
diff --git a/media/base/channel_mixer.h b/media/base/channel_mixer.h index ef11a2ed..a629b681 100644 --- a/media/base/channel_mixer.h +++ b/media/base/channel_mixer.h
@@ -24,6 +24,10 @@ // input channels as defined in the matrix. class MEDIA_EXPORT ChannelMixer { public: + // To mix two channels into one and preserve loudness, we must apply + // (1 / sqrt(2)) gain to each. + static constexpr float kHalfPower = 0.707106781186547524401f; + ChannelMixer(ChannelLayout input_layout, ChannelLayout output_layout); ChannelMixer(const AudioParameters& input, const AudioParameters& output); ~ChannelMixer();
diff --git a/media/base/channel_mixer_unittest.cc b/media/base/channel_mixer_unittest.cc index 3de5e14d..250f9995 100644 --- a/media/base/channel_mixer_unittest.cc +++ b/media/base/channel_mixer_unittest.cc
@@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_SQRT1_2. -#define _USE_MATH_DEFINES - -#include <cmath> #include <memory> #include "base/macros.h" @@ -158,7 +154,7 @@ static float kStereoToMonoValues[] = { 0.5f, 0.75f }; static float kMonoToStereoValues[] = { 0.5f }; -// Zero the center channel since it will be mixed at scale 1 vs M_SQRT1_2. +// Zero the center channel since it will be mixed at scale 1 vs 1/sqrt(2). static float kFiveOneToMonoValues[] = { 0.1f, 0.2f, 0.0f, 0.4f, 0.5f, 0.6f }; static float kFiveDiscreteValues[] = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f }; @@ -180,7 +176,7 @@ CHANNEL_LAYOUT_MONO, kFiveOneToMonoValues, arraysize(kFiveOneToMonoValues), - static_cast<float>(M_SQRT1_2)), + ChannelMixer::kHalfPower), ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 2, CHANNEL_LAYOUT_DISCRETE,
diff --git a/media/base/channel_mixing_matrix.cc b/media/base/channel_mixing_matrix.cc index a508b67..db0c029e 100644 --- a/media/base/channel_mixing_matrix.cc +++ b/media/base/channel_mixing_matrix.cc
@@ -2,24 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_SQRT1_2. -#define _USE_MATH_DEFINES - #include "media/base/channel_mixing_matrix.h" #include <stddef.h> #include <algorithm> -#include <cmath> #include "base/logging.h" +#include "media/base/channel_mixer.h" namespace media { -// Default scale factor for mixing two channels together. We use a different -// value for stereo -> mono and mono -> stereo mixes. -static const float kEqualPowerScale = static_cast<float>(M_SQRT1_2); - static void ValidateLayout(ChannelLayout layout) { CHECK_NE(layout, CHANNEL_LAYOUT_NONE); CHECK_LE(layout, CHANNEL_LAYOUT_MAX); @@ -136,8 +129,9 @@ // stereo mixes. Scaling by 1 / sqrt(2) here will likely lead to clipping // so we use 1 / 2 instead. float scale = - (output_layout_ == CHANNEL_LAYOUT_MONO && input_channels_ == 2) ? - 0.5 : kEqualPowerScale; + (output_layout_ == CHANNEL_LAYOUT_MONO && input_channels_ == 2) + ? 0.5 + : ChannelMixer::kHalfPower; Mix(LEFT, CENTER, scale); Mix(RIGHT, CENTER, scale); } @@ -146,7 +140,7 @@ if (IsUnaccounted(CENTER)) { // When up mixing from mono, just do a copy to front LR. float scale = - (input_layout_ == CHANNEL_LAYOUT_MONO) ? 1 : kEqualPowerScale; + (input_layout_ == CHANNEL_LAYOUT_MONO) ? 1 : ChannelMixer::kHalfPower; MixWithoutAccounting(CENTER, LEFT, scale); Mix(CENTER, RIGHT, scale); } @@ -156,21 +150,21 @@ if (HasOutputChannel(SIDE_LEFT)) { // If the input has side LR, mix back LR into side LR, but instead if the // input doesn't have side LR (but output does) copy back LR to side LR. - float scale = HasInputChannel(SIDE_LEFT) ? kEqualPowerScale : 1; + float scale = HasInputChannel(SIDE_LEFT) ? ChannelMixer::kHalfPower : 1; Mix(BACK_LEFT, SIDE_LEFT, scale); Mix(BACK_RIGHT, SIDE_RIGHT, scale); } else if (HasOutputChannel(BACK_CENTER)) { // Mix back LR into back center. - Mix(BACK_LEFT, BACK_CENTER, kEqualPowerScale); - Mix(BACK_RIGHT, BACK_CENTER, kEqualPowerScale); + Mix(BACK_LEFT, BACK_CENTER, ChannelMixer::kHalfPower); + Mix(BACK_RIGHT, BACK_CENTER, ChannelMixer::kHalfPower); } else if (output_layout_ > CHANNEL_LAYOUT_MONO) { // Mix back LR into front LR. - Mix(BACK_LEFT, LEFT, kEqualPowerScale); - Mix(BACK_RIGHT, RIGHT, kEqualPowerScale); + Mix(BACK_LEFT, LEFT, ChannelMixer::kHalfPower); + Mix(BACK_RIGHT, RIGHT, ChannelMixer::kHalfPower); } else { // Mix back LR into front center. - Mix(BACK_LEFT, CENTER, kEqualPowerScale); - Mix(BACK_RIGHT, CENTER, kEqualPowerScale); + Mix(BACK_LEFT, CENTER, ChannelMixer::kHalfPower); + Mix(BACK_RIGHT, CENTER, ChannelMixer::kHalfPower); } } @@ -179,21 +173,21 @@ if (HasOutputChannel(BACK_LEFT)) { // If the input has back LR, mix side LR into back LR, but instead if the // input doesn't have back LR (but output does) copy side LR to back LR. - float scale = HasInputChannel(BACK_LEFT) ? kEqualPowerScale : 1; + float scale = HasInputChannel(BACK_LEFT) ? ChannelMixer::kHalfPower : 1; Mix(SIDE_LEFT, BACK_LEFT, scale); Mix(SIDE_RIGHT, BACK_RIGHT, scale); } else if (HasOutputChannel(BACK_CENTER)) { // Mix side LR into back center. - Mix(SIDE_LEFT, BACK_CENTER, kEqualPowerScale); - Mix(SIDE_RIGHT, BACK_CENTER, kEqualPowerScale); + Mix(SIDE_LEFT, BACK_CENTER, ChannelMixer::kHalfPower); + Mix(SIDE_RIGHT, BACK_CENTER, ChannelMixer::kHalfPower); } else if (output_layout_ > CHANNEL_LAYOUT_MONO) { // Mix side LR into front LR. - Mix(SIDE_LEFT, LEFT, kEqualPowerScale); - Mix(SIDE_RIGHT, RIGHT, kEqualPowerScale); + Mix(SIDE_LEFT, LEFT, ChannelMixer::kHalfPower); + Mix(SIDE_RIGHT, RIGHT, ChannelMixer::kHalfPower); } else { // Mix side LR into front center. - Mix(SIDE_LEFT, CENTER, kEqualPowerScale); - Mix(SIDE_RIGHT, CENTER, kEqualPowerScale); + Mix(SIDE_LEFT, CENTER, ChannelMixer::kHalfPower); + Mix(SIDE_RIGHT, CENTER, ChannelMixer::kHalfPower); } } @@ -201,21 +195,21 @@ if (IsUnaccounted(BACK_CENTER)) { if (HasOutputChannel(BACK_LEFT)) { // Mix back center into back LR. - MixWithoutAccounting(BACK_CENTER, BACK_LEFT, kEqualPowerScale); - Mix(BACK_CENTER, BACK_RIGHT, kEqualPowerScale); + MixWithoutAccounting(BACK_CENTER, BACK_LEFT, ChannelMixer::kHalfPower); + Mix(BACK_CENTER, BACK_RIGHT, ChannelMixer::kHalfPower); } else if (HasOutputChannel(SIDE_LEFT)) { // Mix back center into side LR. - MixWithoutAccounting(BACK_CENTER, SIDE_LEFT, kEqualPowerScale); - Mix(BACK_CENTER, SIDE_RIGHT, kEqualPowerScale); + MixWithoutAccounting(BACK_CENTER, SIDE_LEFT, ChannelMixer::kHalfPower); + Mix(BACK_CENTER, SIDE_RIGHT, ChannelMixer::kHalfPower); } else if (output_layout_ > CHANNEL_LAYOUT_MONO) { // Mix back center into front LR. // TODO(dalecurtis): Not sure about these values? - MixWithoutAccounting(BACK_CENTER, LEFT, kEqualPowerScale); - Mix(BACK_CENTER, RIGHT, kEqualPowerScale); + MixWithoutAccounting(BACK_CENTER, LEFT, ChannelMixer::kHalfPower); + Mix(BACK_CENTER, RIGHT, ChannelMixer::kHalfPower); } else { // Mix back center into front center. // TODO(dalecurtis): Not sure about these values? - Mix(BACK_CENTER, CENTER, kEqualPowerScale); + Mix(BACK_CENTER, CENTER, ChannelMixer::kHalfPower); } } @@ -223,12 +217,12 @@ if (IsUnaccounted(LEFT_OF_CENTER)) { if (HasOutputChannel(LEFT)) { // Mix LR of center into front LR. - Mix(LEFT_OF_CENTER, LEFT, kEqualPowerScale); - Mix(RIGHT_OF_CENTER, RIGHT, kEqualPowerScale); + Mix(LEFT_OF_CENTER, LEFT, ChannelMixer::kHalfPower); + Mix(RIGHT_OF_CENTER, RIGHT, ChannelMixer::kHalfPower); } else { // Mix LR of center into front center. - Mix(LEFT_OF_CENTER, CENTER, kEqualPowerScale); - Mix(RIGHT_OF_CENTER, CENTER, kEqualPowerScale); + Mix(LEFT_OF_CENTER, CENTER, ChannelMixer::kHalfPower); + Mix(RIGHT_OF_CENTER, CENTER, ChannelMixer::kHalfPower); } } @@ -236,11 +230,11 @@ if (IsUnaccounted(LFE)) { if (!HasOutputChannel(CENTER)) { // Mix LFE into front LR. - MixWithoutAccounting(LFE, LEFT, kEqualPowerScale); - Mix(LFE, RIGHT, kEqualPowerScale); + MixWithoutAccounting(LFE, LEFT, ChannelMixer::kHalfPower); + Mix(LFE, RIGHT, ChannelMixer::kHalfPower); } else { // Mix LFE into front center. - Mix(LFE, CENTER, kEqualPowerScale); + Mix(LFE, CENTER, ChannelMixer::kHalfPower); } }
diff --git a/media/base/channel_mixing_matrix_unittest.cc b/media/base/channel_mixing_matrix_unittest.cc index 16dc53b..92df75c 100644 --- a/media/base/channel_mixing_matrix_unittest.cc +++ b/media/base/channel_mixing_matrix_unittest.cc
@@ -2,17 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_SQRT1_2. -#define _USE_MATH_DEFINES - #include "media/base/channel_mixing_matrix.h" #include <stddef.h> -#include <cmath> - #include "base/macros.h" #include "base/strings/stringprintf.h" +#include "media/base/channel_mixer.h" #include "testing/gtest/include/gtest/gtest.h" namespace media { @@ -116,13 +112,13 @@ EXPECT_FALSE(remapping); EXPECT_EQ(1u, matrix.size()); EXPECT_EQ(6u, matrix[0].size()); - EXPECT_FLOAT_EQ(static_cast<float>(M_SQRT1_2), matrix[0][0]); - EXPECT_FLOAT_EQ(static_cast<float>(M_SQRT1_2), matrix[0][1]); + EXPECT_FLOAT_EQ(ChannelMixer::kHalfPower, matrix[0][0]); + EXPECT_FLOAT_EQ(ChannelMixer::kHalfPower, matrix[0][1]); // The center channel will be mixed at scale 1. EXPECT_EQ(1.0f, matrix[0][2]); - EXPECT_FLOAT_EQ(static_cast<float>(M_SQRT1_2), matrix[0][3]); - EXPECT_FLOAT_EQ(static_cast<float>(M_SQRT1_2), matrix[0][4]); - EXPECT_FLOAT_EQ(static_cast<float>(M_SQRT1_2), matrix[0][5]); + EXPECT_FLOAT_EQ(ChannelMixer::kHalfPower, matrix[0][3]); + EXPECT_FLOAT_EQ(ChannelMixer::kHalfPower, matrix[0][4]); + EXPECT_FLOAT_EQ(ChannelMixer::kHalfPower, matrix[0][5]); } TEST(ChannelMixingMatrixTest, DiscreteToDiscrete) {
diff --git a/media/base/fake_audio_render_callback.cc b/media/base/fake_audio_render_callback.cc index bfb3c4d..6163bd8 100644 --- a/media/base/fake_audio_render_callback.cc +++ b/media/base/fake_audio_render_callback.cc
@@ -2,14 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - -#include <cmath> - -#include "media/base/audio_timestamp_helper.h" #include "media/base/fake_audio_render_callback.h" +#include "base/numerics/math_constants.h" +#include "media/base/audio_timestamp_helper.h" + namespace media { FakeAudioRenderCallback::FakeAudioRenderCallback(double step, int sample_rate) @@ -53,7 +50,8 @@ // Fill first channel with a sine wave. for (int i = 0; i < number_of_frames; ++i) - audio_bus->channel(0)[i] = sin(2 * M_PI * (x_ + step_ * i)) * volume; + audio_bus->channel(0)[i] = + sin(2 * base::kPiDouble * (x_ + step_ * i)) * volume; x_ += number_of_frames * step_; // Copy first channel into the rest of the channels.
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 9d33fd8..0d357ee 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -148,6 +148,12 @@ const char kIgnoreAutoplayRestrictionsForTests[] = "ignore-autoplay-restrictions"; +// Specifies the path to the Clear Key CDM for testing, which is necessary to +// support External Clear Key key system when library CDM is enabled. Note that +// External Clear Key key system support is also controlled by feature +// kExternalClearKeyForTesting. +const char kClearKeyCdmPathForTesting[] = "clear-key-cdm-path-for-testing"; + #if !defined(OS_ANDROID) // Turns on the internal media session backend. This should be used by embedders // that want to control the media playback with the media session interfaces. @@ -166,7 +172,7 @@ // Autoplay policy to require a user gesture in order to play. const char kUserGestureRequiredPolicy[] = "user-gesture-required"; -// Autoplay policy to require a user gesture in ordor to play for cross origin +// Autoplay policy to require a user gesture in order to play for cross origin // iframes. const char kUserGestureRequiredForCrossOriginPolicy[] = "user-gesture-required-for-cross-origin";
diff --git a/media/base/media_switches.h b/media/base/media_switches.h index eca03920..b33963e 100644 --- a/media/base/media_switches.h +++ b/media/base/media_switches.h
@@ -82,6 +82,8 @@ MEDIA_EXPORT extern const char kIgnoreAutoplayRestrictionsForTests[]; +MEDIA_EXPORT extern const char kClearKeyCdmPathForTesting[]; + #if !defined(OS_ANDROID) MEDIA_EXPORT extern const char kEnableInternalMediaSession[]; #endif // !defined(OS_ANDROID)
diff --git a/media/base/sinc_resampler.cc b/media/base/sinc_resampler.cc index cffb0c9d..4c8de801 100644 --- a/media/base/sinc_resampler.cc +++ b/media/base/sinc_resampler.cc
@@ -73,15 +73,12 @@ // Note: we're glossing over how the sub-sample handling works with // |virtual_source_idx_|, etc. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "media/base/sinc_resampler.h" -#include <cmath> #include <limits> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "build/build_config.h" #if defined(ARCH_CPU_X86_FAMILY) @@ -185,13 +182,14 @@ for (int i = 0; i < kKernelSize; ++i) { const int idx = i + offset_idx * kKernelSize; const float pre_sinc = - static_cast<float>(M_PI * (i - kKernelSize / 2 - subsample_offset)); + base::kPiFloat * (i - kKernelSize / 2 - subsample_offset); kernel_pre_sinc_storage_[idx] = pre_sinc; // Compute Blackman window, matching the offset of the sinc(). const float x = (i - subsample_offset) / kKernelSize; - const float window = static_cast<float>(kA0 - kA1 * cos(2.0 * M_PI * x) + - kA2 * cos(4.0 * M_PI * x)); + const float window = + static_cast<float>(kA0 - kA1 * cos(2.0 * base::kPiDouble * x) + + kA2 * cos(4.0 * base::kPiDouble * x)); kernel_window_storage_[idx] = window; // Compute the sinc with offset, then window the sinc() function and store
diff --git a/media/base/sinc_resampler_unittest.cc b/media/base/sinc_resampler_unittest.cc index 8dd346e..5ff5415 100644 --- a/media/base/sinc_resampler_unittest.cc +++ b/media/base/sinc_resampler_unittest.cc
@@ -2,15 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - -#include <cmath> #include <memory> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" +#include "base/numerics/math_constants.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" #include "build/build_config.h" @@ -226,7 +223,8 @@ double t = static_cast<double>(current_index_) / sample_rate_; // Sinusoidal linear chirp. - destination[i] = sin(2 * M_PI * (kMinFrequency * t + (k_ / 2) * t * t)); + destination[i] = + sin(2 * base::kPiDouble * (kMinFrequency * t + (k_ / 2) * t * t)); } } } @@ -295,7 +293,7 @@ std::unique_ptr<float[]> kernel(new float[SincResampler::kKernelStorageSize]); memcpy(kernel.get(), resampler.get_kernel_for_testing(), SincResampler::kKernelStorageSize); - resampler.SetRatio(M_PI); + resampler.SetRatio(base::kPiDouble); ASSERT_NE(0, memcmp(kernel.get(), resampler.get_kernel_for_testing(), SincResampler::kKernelStorageSize)); resampler.SetRatio(io_ratio);
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 7803d334..e8a8254 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -344,6 +344,8 @@ // Destruct compositor resources in the proper order. client_->SetWebLayer(nullptr); + client_->MediaRemotingStopped(); + if (!surface_layer_for_video_enabled_ && video_weblayer_) { static_cast<cc::VideoLayer*>(video_weblayer_->layer())->StopUsingProvider(); } @@ -374,9 +376,7 @@ void WebMediaPlayerImpl::OnWebLayerReplaced() { DCHECK(bridge_); bridge_->GetWebLayer()->CcLayer()->SetContentsOpaque(opaque_); - // TODO(lethalantidote): Figure out how to persist opaque setting - // without calling WebLayerImpl's SetContentsOpaueIsFixed; - // https://crbug/739859. + bridge_->GetWebLayer()->SetContentsOpaqueIsFixed(true); // TODO(lethalantidote): Figure out how to pass along rotation information. // https://crbug/750313. client_->SetWebLayer(bridge_->GetWebLayer());
diff --git a/media/cdm/cdm_paths.cc b/media/cdm/cdm_paths.cc index d8eeb7f..0c1bdb9 100644 --- a/media/cdm/cdm_paths.cc +++ b/media/cdm/cdm_paths.cc
@@ -26,6 +26,8 @@ const char kClearKeyCdmDisplayName[] = "Clear Key CDM"; +const char kClearKeyCdmType[] = "Clear Key CDM"; + 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 75500603..0e6b9be5c 100644 --- a/media/cdm/cdm_paths.h +++ b/media/cdm/cdm_paths.h
@@ -22,6 +22,9 @@ // Display name for Clear Key CDM. extern const char kClearKeyCdmDisplayName[]; +// The CDM type used to register Clear Key CDM. +extern const char kClearKeyCdmType[]; + // Pepper type for Clear Key CDM. // TODO(xhwang): Remove after switching to mojo CDM. extern const char kClearKeyCdmPepperMimeType[];
diff --git a/media/filters/wsola_internals.cc b/media/filters/wsola_internals.cc index 9e12f03..3862260 100644 --- a/media/filters/wsola_internals.cc +++ b/media/filters/wsola_internals.cc
@@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "media/filters/wsola_internals.h" #include <algorithm> @@ -13,6 +10,7 @@ #include <memory> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "media/base/audio_bus.h" #if defined(ARCH_CPU_X86_FAMILY) @@ -38,8 +36,8 @@ const float kEpsilon = 1e-12f; float similarity_measure = 0.0f; for (int n = 0; n < channels; ++n) { - similarity_measure += dot_prod_a_b[n] / sqrt(energy_a[n] * energy_b[n] + - kEpsilon); + similarity_measure += + dot_prod_a_b[n] / std::sqrt(energy_a[n] * energy_b[n] + kEpsilon); } return similarity_measure; } @@ -309,9 +307,9 @@ } void GetSymmetricHanningWindow(int window_length, float* window) { - const float scale = 2.0f * M_PI / window_length; + const float scale = 2.0f * base::kPiFloat / window_length; for (int n = 0; n < window_length; ++n) - window[n] = 0.5f * (1.0f - cosf(n * scale)); + window[n] = 0.5f * (1.0f - std::cos(n * scale)); } } // namespace internal
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn index 613e830..e634a90 100644 --- a/media/gpu/BUILD.gn +++ b/media/gpu/BUILD.gn
@@ -184,33 +184,33 @@ if (is_android) { sources += [ + "android/android_video_decode_accelerator.cc", + "android/android_video_decode_accelerator.h", + "android/android_video_surface_chooser.h", + "android/android_video_surface_chooser_impl.cc", + "android/android_video_surface_chooser_impl.h", + "android/avda_codec_allocator.cc", + "android/avda_codec_allocator.h", + "android/avda_codec_image.cc", + "android/avda_codec_image.h", + "android/avda_picture_buffer_manager.cc", + "android/avda_picture_buffer_manager.h", + "android/avda_shared_state.cc", + "android/avda_shared_state.h", + "android/avda_state_provider.h", + "android/avda_surface_bundle.cc", + "android/avda_surface_bundle.h", + "android/content_video_view_overlay.cc", + "android/content_video_view_overlay.h", + "android/content_video_view_overlay_allocator.cc", + "android/content_video_view_overlay_allocator.h", "android/device_info.cc", "android/device_info.h", "android/promotion_hint_aggregator.h", "android/promotion_hint_aggregator_impl.cc", "android/promotion_hint_aggregator_impl.h", - "android_video_decode_accelerator.cc", - "android_video_decode_accelerator.h", - "android_video_surface_chooser.h", - "android_video_surface_chooser_impl.cc", - "android_video_surface_chooser_impl.h", - "avda_codec_allocator.cc", - "avda_codec_allocator.h", - "avda_codec_image.cc", - "avda_codec_image.h", - "avda_picture_buffer_manager.cc", - "avda_picture_buffer_manager.h", - "avda_shared_state.cc", - "avda_shared_state.h", - "avda_state_provider.h", - "avda_surface_bundle.cc", - "avda_surface_bundle.h", - "content_video_view_overlay.cc", - "content_video_view_overlay.h", - "content_video_view_overlay_allocator.cc", - "content_video_view_overlay_allocator.h", - "surface_texture_gl_owner.cc", - "surface_texture_gl_owner.h", + "android/surface_texture_gl_owner.cc", + "android/surface_texture_gl_owner.h", ] deps += [ "//media/mojo:features", @@ -219,8 +219,8 @@ if (enable_webrtc) { deps += [ "//third_party/libyuv" ] sources += [ - "android_video_encode_accelerator.cc", - "android_video_encode_accelerator.h", + "android/android_video_encode_accelerator.cc", + "android/android_video_encode_accelerator.h", ] } if (enable_media_codec_video_decoder) { @@ -454,20 +454,20 @@ if (is_android) { testonly = true sources = [ + "android/android_video_decode_accelerator_unittest.cc", + "android/android_video_surface_chooser_impl_unittest.cc", + "android/avda_codec_allocator_unittest.cc", + "android/content_video_view_overlay_allocator_unittest.cc", + "android/fake_android_video_surface_chooser.cc", + "android/fake_android_video_surface_chooser.h", "android/fake_codec_allocator.cc", "android/fake_codec_allocator.h", "android/mock_device_info.cc", "android/mock_device_info.h", + "android/mock_surface_texture_gl_owner.cc", + "android/mock_surface_texture_gl_owner.h", "android/promotion_hint_aggregator_impl_unittest.cc", - "android_video_decode_accelerator_unittest.cc", - "android_video_surface_chooser_impl_unittest.cc", - "avda_codec_allocator_unittest.cc", - "content_video_view_overlay_allocator_unittest.cc", - "fake_android_video_surface_chooser.cc", - "fake_android_video_surface_chooser.h", - "mock_surface_texture_gl_owner.cc", - "mock_surface_texture_gl_owner.h", - "surface_texture_gl_owner_unittest.cc", + "android/surface_texture_gl_owner_unittest.cc", ] if (enable_media_codec_video_decoder) { sources += [
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android/android_video_decode_accelerator.cc similarity index 99% rename from media/gpu/android_video_decode_accelerator.cc rename to media/gpu/android/android_video_decode_accelerator.cc index 8a5151d..07462f4 100644 --- a/media/gpu/android_video_decode_accelerator.cc +++ b/media/gpu/android/android_video_decode_accelerator.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 "media/gpu/android_video_decode_accelerator.h" +#include "media/gpu/android/android_video_decode_accelerator.h" #include <stddef.h> @@ -35,11 +35,11 @@ #include "media/base/media_switches.h" #include "media/base/timestamp_constants.h" #include "media/base/video_decoder_config.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" +#include "media/gpu/android/avda_picture_buffer_manager.h" +#include "media/gpu/android/content_video_view_overlay.h" #include "media/gpu/android/device_info.h" #include "media/gpu/android/promotion_hint_aggregator_impl.h" -#include "media/gpu/android_video_surface_chooser_impl.h" -#include "media/gpu/avda_picture_buffer_manager.h" -#include "media/gpu/content_video_view_overlay.h" #include "media/gpu/shared_memory_region.h" #include "media/mojo/features.h" #include "media/video/picture.h" @@ -1078,11 +1078,12 @@ std::unique_ptr<MediaCodecBridge> media_codec = codec_allocator_->CreateMediaCodecSync(codec_config_); - OnCodecConfigured(std::move(media_codec)); + OnCodecConfigured(std::move(media_codec), codec_config_->surface_bundle); } void AndroidVideoDecodeAccelerator::OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) { + std::unique_ptr<MediaCodecBridge> media_codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(state_ == WAITING_FOR_CODEC || state_ == SURFACE_DESTROYED); // If we are supposed to notify that initialization is complete, then do so
diff --git a/media/gpu/android_video_decode_accelerator.h b/media/gpu/android/android_video_decode_accelerator.h similarity index 96% rename from media/gpu/android_video_decode_accelerator.h rename to media/gpu/android/android_video_decode_accelerator.h index 391fdcf..4014df1c 100644 --- a/media/gpu/android_video_decode_accelerator.h +++ b/media/gpu/android/android_video_decode_accelerator.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ -#define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ +#ifndef MEDIA_GPU_ANDROID_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ +#define MEDIA_GPU_ANDROID_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ #include <stdint.h> @@ -22,11 +22,11 @@ #include "media/base/android/media_drm_bridge_cdm_context.h" #include "media/base/android_overlay_mojo_factory.h" #include "media/base/content_decryption_module.h" +#include "media/gpu/android/android_video_surface_chooser.h" +#include "media/gpu/android/avda_codec_allocator.h" +#include "media/gpu/android/avda_picture_buffer_manager.h" +#include "media/gpu/android/avda_state_provider.h" #include "media/gpu/android/device_info.h" -#include "media/gpu/android_video_surface_chooser.h" -#include "media/gpu/avda_codec_allocator.h" -#include "media/gpu/avda_picture_buffer_manager.h" -#include "media/gpu/avda_state_provider.h" #include "media/gpu/gpu_video_decode_accelerator_helpers.h" #include "media/gpu/media_gpu_export.h" #include "media/video/video_decode_accelerator.h" @@ -85,7 +85,8 @@ // AVDACodecAllocatorClient implementation: void OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) override; + std::unique_ptr<MediaCodecBridge> media_codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) override; private: friend class AVDAManager; @@ -439,4 +440,4 @@ } // namespace media -#endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ +#endif // MEDIA_GPU_ANDROID_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
diff --git a/media/gpu/android_video_decode_accelerator_unittest.cc b/media/gpu/android/android_video_decode_accelerator_unittest.cc similarity index 98% rename from media/gpu/android_video_decode_accelerator_unittest.cc rename to media/gpu/android/android_video_decode_accelerator_unittest.cc index c13aa997..a0120c5 100644 --- a/media/gpu/android_video_decode_accelerator_unittest.cc +++ b/media/gpu/android/android_video_decode_accelerator_unittest.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 "media/gpu/android_video_decode_accelerator.h" +#include "media/gpu/android/android_video_decode_accelerator.h" #include <stdint.h> @@ -21,12 +21,12 @@ #include "media/base/android/media_codec_util.h" #include "media/base/android/mock_android_overlay.h" #include "media/base/android/mock_media_codec_bridge.h" +#include "media/gpu/android/android_video_decode_accelerator.h" +#include "media/gpu/android/android_video_surface_chooser.h" +#include "media/gpu/android/avda_codec_allocator.h" +#include "media/gpu/android/fake_android_video_surface_chooser.h" #include "media/gpu/android/fake_codec_allocator.h" #include "media/gpu/android/mock_device_info.h" -#include "media/gpu/android_video_decode_accelerator.h" -#include "media/gpu/android_video_surface_chooser.h" -#include "media/gpu/avda_codec_allocator.h" -#include "media/gpu/fake_android_video_surface_chooser.h" #include "media/video/picture.h" #include "media/video/video_decode_accelerator.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/media/gpu/android_video_encode_accelerator.cc b/media/gpu/android/android_video_encode_accelerator.cc similarity index 98% rename from media/gpu/android_video_encode_accelerator.cc rename to media/gpu/android/android_video_encode_accelerator.cc index 95c542c0..a334169 100644 --- a/media/gpu/android_video_encode_accelerator.cc +++ b/media/gpu/android/android_video_encode_accelerator.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 "media/gpu/android_video_encode_accelerator.h" +#include "media/gpu/android/android_video_encode_accelerator.h" #include <memory> #include <set> @@ -343,9 +343,8 @@ uint8_t* dst_y = buffer; int dst_stride_y = frame->stride(VideoFrame::kYPlane); - uint8_t* dst_uv = - buffer + - frame->stride(VideoFrame::kYPlane) * frame->rows(VideoFrame::kYPlane); + uint8_t* dst_uv = buffer + frame->stride(VideoFrame::kYPlane) * + frame->rows(VideoFrame::kYPlane); int dst_stride_uv = frame->stride(VideoFrame::kUPlane) * 2; // Why NV12? Because COLOR_FORMAT_YUV420_SEMIPLANAR. See comment at other // mention of that constant.
diff --git a/media/gpu/android_video_encode_accelerator.h b/media/gpu/android/android_video_encode_accelerator.h similarity index 94% rename from media/gpu/android_video_encode_accelerator.h rename to media/gpu/android/android_video_encode_accelerator.h index 8b3db102..6667bed 100644 --- a/media/gpu/android_video_encode_accelerator.h +++ b/media/gpu/android/android_video_encode_accelerator.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ -#define MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ +#ifndef MEDIA_GPU_ANDROID_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ +#define MEDIA_GPU_ANDROID_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ #include <stddef.h> #include <stdint.h> @@ -112,4 +112,4 @@ } // namespace media -#endif // MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ +#endif // MEDIA_GPU_ANDROID_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_
diff --git a/media/gpu/android_video_surface_chooser.h b/media/gpu/android/android_video_surface_chooser.h similarity index 93% rename from media/gpu/android_video_surface_chooser.h rename to media/gpu/android/android_video_surface_chooser.h index b444846..acd2103 100644 --- a/media/gpu/android_video_surface_chooser.h +++ b/media/gpu/android/android_video_surface_chooser.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ -#define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#ifndef MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#define MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_H_ #include "base/bind.h" #include "base/macros.h" @@ -77,4 +77,4 @@ } // namespace media -#endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#endif // MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_H_
diff --git a/media/gpu/android_video_surface_chooser_impl.cc b/media/gpu/android/android_video_surface_chooser_impl.cc similarity index 98% rename from media/gpu/android_video_surface_chooser_impl.cc rename to media/gpu/android/android_video_surface_chooser_impl.cc index 66ff4d93..56a9b993 100644 --- a/media/gpu/android_video_surface_chooser_impl.cc +++ b/media/gpu/android/android_video_surface_chooser_impl.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 "media/gpu/android_video_surface_chooser_impl.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" #include "base/memory/ptr_util.h" #include "base/time/default_tick_clock.h"
diff --git a/media/gpu/android_video_surface_chooser_impl.h b/media/gpu/android/android_video_surface_chooser_impl.h similarity index 92% rename from media/gpu/android_video_surface_chooser_impl.h rename to media/gpu/android/android_video_surface_chooser_impl.h index d993473..cc5a628 100644 --- a/media/gpu/android_video_surface_chooser_impl.h +++ b/media/gpu/android/android_video_surface_chooser_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ -#define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ +#ifndef MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ +#define MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ #include "base/bind.h" #include "base/macros.h" @@ -11,7 +11,7 @@ #include "base/time/tick_clock.h" #include "base/time/time.h" #include "media/base/android/android_overlay.h" -#include "media/gpu/android_video_surface_chooser.h" +#include "media/gpu/android/android_video_surface_chooser.h" #include "media/gpu/media_gpu_export.h" namespace media { @@ -96,4 +96,4 @@ } // namespace media -#endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ +#endif // MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_
diff --git a/media/gpu/android_video_surface_chooser_impl_unittest.cc b/media/gpu/android/android_video_surface_chooser_impl_unittest.cc similarity index 99% rename from media/gpu/android_video_surface_chooser_impl_unittest.cc rename to media/gpu/android/android_video_surface_chooser_impl_unittest.cc index c5c4541a..555af3c 100644 --- a/media/gpu/android_video_surface_chooser_impl_unittest.cc +++ b/media/gpu/android/android_video_surface_chooser_impl_unittest.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 "media/gpu/android_video_surface_chooser_impl.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" #include <stdint.h>
diff --git a/media/gpu/avda_codec_allocator.cc b/media/gpu/android/avda_codec_allocator.cc similarity index 87% rename from media/gpu/avda_codec_allocator.cc rename to media/gpu/android/avda_codec_allocator.cc index be84754d..f0660f80 100644 --- a/media/gpu/avda_codec_allocator.cc +++ b/media/gpu/android/avda_codec_allocator.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 "media/gpu/avda_codec_allocator.h" +#include "media/gpu/android/avda_codec_allocator.h" #include <stddef.h> @@ -21,7 +21,7 @@ #include "media/base/limits.h" #include "media/base/media.h" #include "media/base/timestamp_constants.h" -#include "media/gpu/android_video_decode_accelerator.h" +#include "media/gpu/android/android_video_decode_accelerator.h" namespace media { @@ -74,11 +74,6 @@ done_event->Signal(); } -void DropReferenceToSurfaceBundle( - scoped_refptr<AVDASurfaceBundle> surface_bundle) { - // Do nothing. Let |surface_bundle| go out of scope. -} - } // namespace CodecConfig::CodecConfig() {} @@ -200,7 +195,7 @@ if (!task_type) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&AVDACodecAllocatorClient::OnCodecConfigured, - client, nullptr)); + client, nullptr, codec_config->surface_bundle)); return; } @@ -248,7 +243,7 @@ if (!StartThread(nullptr)) return; - ReleaseMediaCodec(std::move(media_codec), surface_bundle); + ReleaseMediaCodec(std::move(media_codec), std::move(surface_bundle)); // We can stop the threads immediately. If other clients are around, then // this will do nothing. Otherwise, this will order the join after the @@ -257,7 +252,7 @@ return; } - client->OnCodecConfigured(std::move(media_codec)); + client->OnCodecConfigured(std::move(media_codec), std::move(surface_bundle)); } void AVDACodecAllocator::ReleaseMediaCodec( @@ -270,46 +265,35 @@ int erased = codec_task_types_.erase(media_codec.get()); DCHECK(erased); - // No need to track the release if it's a SurfaceTexture. We still forward - // the reference to |surface_bundle|, though, so that the SurfaceTexture - // lasts at least as long as the codec. - if (!surface_bundle->overlay) { - TaskRunnerFor(task_type)->PostTaskAndReply( - FROM_HERE, - base::Bind(&DeleteMediaCodecAndSignal, - base::Passed(std::move(media_codec)), nullptr), - base::Bind(&DropReferenceToSurfaceBundle, surface_bundle)); - return; + // Save a waitable event for the release if the codec is attached to an + // overlay so we can block on it in WaitForPendingRelease(). + base::WaitableEvent* released_event = nullptr; + if (surface_bundle->overlay) { + pending_codec_releases_.emplace( + std::piecewise_construct, + std::forward_as_tuple(surface_bundle->overlay.get()), + std::forward_as_tuple(base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED)); + released_event = + &pending_codec_releases_.find(surface_bundle->overlay.get())->second; } - DCHECK(!surface_bundle->surface_texture); - pending_codec_releases_.emplace( - std::piecewise_construct, - std::forward_as_tuple(surface_bundle->overlay.get()), - std::forward_as_tuple(base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED)); - base::WaitableEvent* released = - &pending_codec_releases_.find(surface_bundle->overlay.get())->second; - // Note that we forward |surface_bundle|, too, so that the surface outlasts - // the codec. This doesn't matter so much for CVV surfaces, since they don't - // auto-release when they're dropped. However, for surface owners, this will - // become important, so we still handle it. Plus, it makes sense. + // the codec. TaskRunnerFor(task_type)->PostTaskAndReply( FROM_HERE, base::Bind(&DeleteMediaCodecAndSignal, - base::Passed(std::move(media_codec)), released), + base::Passed(std::move(media_codec)), released_event), base::Bind(&AVDACodecAllocator::OnMediaCodecReleased, - base::Unretained(this), surface_bundle)); + base::Unretained(this), std::move(surface_bundle))); } void AVDACodecAllocator::OnMediaCodecReleased( scoped_refptr<AVDASurfaceBundle> surface_bundle) { DCHECK(thread_checker_.CalledOnValidThread()); + // This is a no-op if it's a non overlay bundle. pending_codec_releases_.erase(surface_bundle->overlay.get()); - - // Also note that |surface_bundle| lasted at least as long as the codec. } bool AVDACodecAllocator::IsAnyRegisteredAVDA() {
diff --git a/media/gpu/avda_codec_allocator.h b/media/gpu/android/avda_codec_allocator.h similarity index 94% rename from media/gpu/avda_codec_allocator.h rename to media/gpu/android/avda_codec_allocator.h index d90d294..35e080f 100644 --- a/media/gpu/avda_codec_allocator.h +++ b/media/gpu/android/avda_codec_allocator.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ -#define MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_ +#define MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_ #include <stddef.h> @@ -26,7 +26,7 @@ #include "media/base/media.h" #include "media/base/surface_manager.h" #include "media/base/video_codecs.h" -#include "media/gpu/avda_surface_bundle.h" +#include "media/gpu/android/avda_surface_bundle.h" #include "media/gpu/media_gpu_export.h" #include "ui/gfx/geometry/size.h" #include "ui/gl/android/scoped_java_surface.h" @@ -101,7 +101,8 @@ // Called on the main thread when a new MediaCodec is configured. // |media_codec| will be null if configuration failed. virtual void OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) = 0; + std::unique_ptr<MediaCodecBridge> media_codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) = 0; protected: ~AVDACodecAllocatorClient() {} @@ -136,8 +137,6 @@ // other action on it (e.g., calling ReleaseSurfaceTexture if it has one), // since some other codec might be going to use it. We just want to be sure // that it outlives |media_codec|. - // TODO(watk): Bundle the MediaCodec and surface together so you can't get - // this pairing wrong. virtual void ReleaseMediaCodec( std::unique_ptr<MediaCodecBridge> media_codec, scoped_refptr<AVDASurfaceBundle> surface_bundle); @@ -209,7 +208,9 @@ scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerFor(TaskType task_type); // Called on the gpu main thread when a codec is freed on a codec thread. - // |surface_bundle| is the surface bundle that the codec was using. + // |surface_bundle| is the surface bundle that the codec was using. It's + // important to pass this through to ensure a) it outlives the codec, and b) + // it's deleted on the right thread. void OnMediaCodecReleased(scoped_refptr<AVDASurfaceBundle> surface_bundle); // Stop the thread indicated by |index|. This signals stop_event_for_testing_ @@ -245,4 +246,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_
diff --git a/media/gpu/avda_codec_allocator_unittest.cc b/media/gpu/android/avda_codec_allocator_unittest.cc similarity index 97% rename from media/gpu/avda_codec_allocator_unittest.cc rename to media/gpu/android/avda_codec_allocator_unittest.cc index 237af58..ed27df7 100644 --- a/media/gpu/avda_codec_allocator_unittest.cc +++ b/media/gpu/android/avda_codec_allocator_unittest.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 "media/gpu/avda_codec_allocator.h" +#include "media/gpu/android/avda_codec_allocator.h" #include <stdint.h> @@ -48,7 +48,8 @@ // Gmock doesn't let us mock methods taking move-only types. MOCK_METHOD1(OnCodecConfiguredMock, void(MediaCodecBridge* media_codec)); void OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) override { + std::unique_ptr<MediaCodecBridge> media_codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) override { OnCodecConfiguredMock(media_codec.get()); } };
diff --git a/media/gpu/avda_codec_image.cc b/media/gpu/android/avda_codec_image.cc similarity index 98% rename from media/gpu/avda_codec_image.cc rename to media/gpu/android/avda_codec_image.cc index 6ba5e0f..f6561c93 100644 --- a/media/gpu/avda_codec_image.cc +++ b/media/gpu/android/avda_codec_image.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 "media/gpu/avda_codec_image.h" +#include "media/gpu/android/avda_codec_image.h" #include <string.h> @@ -10,7 +10,7 @@ #include "gpu/command_buffer/service/texture_manager.h" #include "media/base/android/media_codec_bridge_impl.h" -#include "media/gpu/avda_shared_state.h" +#include "media/gpu/android/avda_shared_state.h" #include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_context.h" #include "ui/gl/scoped_make_current.h"
diff --git a/media/gpu/avda_codec_image.h b/media/gpu/android/avda_codec_image.h similarity index 96% rename from media/gpu/avda_codec_image.h rename to media/gpu/android/avda_codec_image.h index 3ee9822..cff49ad 100644 --- a/media/gpu/avda_codec_image.h +++ b/media/gpu/android/avda_codec_image.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_CODEC_IMAGE_H_ -#define MEDIA_GPU_AVDA_CODEC_IMAGE_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_CODEC_IMAGE_H_ +#define MEDIA_GPU_ANDROID_AVDA_CODEC_IMAGE_H_ #include <stdint.h> @@ -11,7 +11,7 @@ #include "base/macros.h" #include "gpu/command_buffer/service/gl_stream_texture_image.h" -#include "media/gpu/avda_shared_state.h" +#include "media/gpu/android/avda_shared_state.h" namespace ui { class ScopedMakeCurrent; @@ -161,4 +161,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_CODEC_IMAGE_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_CODEC_IMAGE_H_
diff --git a/media/gpu/avda_picture_buffer_manager.cc b/media/gpu/android/avda_picture_buffer_manager.cc similarity index 98% rename from media/gpu/avda_picture_buffer_manager.cc rename to media/gpu/android/avda_picture_buffer_manager.cc index 1442d3e..a452cfac 100644 --- a/media/gpu/avda_picture_buffer_manager.cc +++ b/media/gpu/android/avda_picture_buffer_manager.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 "media/gpu/avda_picture_buffer_manager.h" +#include "media/gpu/android/avda_picture_buffer_manager.h" #include <EGL/egl.h> #include <EGL/eglext.h> @@ -18,8 +18,8 @@ #include "gpu/command_buffer/service/texture_manager.h" #include "gpu/ipc/service/gpu_channel.h" #include "media/base/android/media_codec_bridge_impl.h" -#include "media/gpu/avda_codec_image.h" -#include "media/gpu/avda_shared_state.h" +#include "media/gpu/android/avda_codec_image.h" +#include "media/gpu/android/avda_shared_state.h" #include "ui/gl/android/scoped_java_surface.h" #include "ui/gl/android/surface_texture.h" #include "ui/gl/egl_util.h"
diff --git a/media/gpu/avda_picture_buffer_manager.h b/media/gpu/android/avda_picture_buffer_manager.h similarity index 93% rename from media/gpu/avda_picture_buffer_manager.h rename to media/gpu/android/avda_picture_buffer_manager.h index d4c2814..8d71af1e 100644 --- a/media/gpu/avda_picture_buffer_manager.h +++ b/media/gpu/android/avda_picture_buffer_manager.h
@@ -2,23 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ -#define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_PICTURE_BUFFER_MANAGER_H_ +#define MEDIA_GPU_ANDROID_AVDA_PICTURE_BUFFER_MANAGER_H_ #include <stdint.h> #include <vector> #include "base/macros.h" -#include "media/gpu/avda_state_provider.h" -#include "media/gpu/avda_surface_bundle.h" +#include "media/gpu/android/avda_state_provider.h" +#include "media/gpu/android/avda_surface_bundle.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "media/gpu/media_gpu_export.h" -#include "media/gpu/surface_texture_gl_owner.h" namespace gpu { namespace gles2 { class GLStreamTextureImage; } -} +} // namespace gpu namespace media { class AVDACodecImage; @@ -134,4 +134,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_PICTURE_BUFFER_MANAGER_H_
diff --git a/media/gpu/avda_shared_state.cc b/media/gpu/android/avda_shared_state.cc similarity index 95% rename from media/gpu/avda_shared_state.cc rename to media/gpu/android/avda_shared_state.cc index 57330b1..dbb035370 100644 --- a/media/gpu/avda_shared_state.cc +++ b/media/gpu/android/avda_shared_state.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/gpu/avda_shared_state.h" +#include "media/gpu/android/avda_shared_state.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" -#include "media/gpu/avda_codec_image.h" +#include "media/gpu/android/avda_codec_image.h" #include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/scoped_make_current.h"
diff --git a/media/gpu/avda_shared_state.h b/media/gpu/android/avda_shared_state.h similarity index 93% rename from media/gpu/avda_shared_state.h rename to media/gpu/android/avda_shared_state.h index e41d40a4..3110eb0 100644 --- a/media/gpu/avda_shared_state.h +++ b/media/gpu/android/avda_shared_state.h
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_SHARED_STATE_H_ -#define MEDIA_GPU_AVDA_SHARED_STATE_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_SHARED_STATE_H_ +#define MEDIA_GPU_ANDROID_AVDA_SHARED_STATE_H_ #include "base/memory/weak_ptr.h" #include "base/synchronization/waitable_event.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "media/base/android/android_overlay.h" #include "media/base/android/media_codec_bridge.h" +#include "media/gpu/android/avda_shared_state.h" +#include "media/gpu/android/avda_surface_bundle.h" #include "media/gpu/android/promotion_hint_aggregator.h" -#include "media/gpu/avda_shared_state.h" -#include "media/gpu/avda_surface_bundle.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_image.h" @@ -110,4 +110,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_SHARED_STATE_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_SHARED_STATE_H_
diff --git a/media/gpu/avda_state_provider.h b/media/gpu/android/avda_state_provider.h similarity index 87% rename from media/gpu/avda_state_provider.h rename to media/gpu/android/avda_state_provider.h index c1c0161..86af2c41 100644 --- a/media/gpu/avda_state_provider.h +++ b/media/gpu/android/avda_state_provider.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_STATE_PROVIDER_H_ -#define MEDIA_GPU_AVDA_STATE_PROVIDER_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_STATE_PROVIDER_H_ +#define MEDIA_GPU_ANDROID_AVDA_STATE_PROVIDER_H_ #include "base/compiler_specific.h" #include "base/threading/thread_checker.h" @@ -15,7 +15,7 @@ namespace gles2 { class GLES2Decoder; } -} +} // namespace gpu namespace media { @@ -41,4 +41,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_STATE_PROVIDER_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_STATE_PROVIDER_H_
diff --git a/media/gpu/avda_surface_bundle.cc b/media/gpu/android/avda_surface_bundle.cc similarity index 96% rename from media/gpu/avda_surface_bundle.cc rename to media/gpu/android/avda_surface_bundle.cc index 315827e..d8db0cf 100644 --- a/media/gpu/avda_surface_bundle.cc +++ b/media/gpu/android/avda_surface_bundle.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 "media/gpu/avda_surface_bundle.h" +#include "media/gpu/android/avda_surface_bundle.h" #include "media/base/android/android_overlay.h"
diff --git a/media/gpu/avda_surface_bundle.h b/media/gpu/android/avda_surface_bundle.h similarity index 88% rename from media/gpu/avda_surface_bundle.h rename to media/gpu/android/avda_surface_bundle.h index 5285a8a..b2236726 100644 --- a/media/gpu/avda_surface_bundle.h +++ b/media/gpu/android/avda_surface_bundle.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ -#define MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ +#ifndef MEDIA_GPU_ANDROID_AVDA_SURFACE_BUNDLE_H_ +#define MEDIA_GPU_ANDROID_AVDA_SURFACE_BUNDLE_H_ #include "base/memory/ref_counted.h" #include "media/base/android/android_overlay.h" #include "media/base/surface_manager.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "media/gpu/media_gpu_export.h" -#include "media/gpu/surface_texture_gl_owner.h" #include "ui/gl/android/scoped_java_surface.h" namespace media { @@ -48,4 +48,4 @@ } // namespace media -#endif // MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ +#endif // MEDIA_GPU_ANDROID_AVDA_SURFACE_BUNDLE_H_
diff --git a/media/gpu/android/codec_image.cc b/media/gpu/android/codec_image.cc index 8227161..9c8b4ec 100644 --- a/media/gpu/android/codec_image.cc +++ b/media/gpu/android/codec_image.cc
@@ -10,7 +10,7 @@ #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/texture_manager.h" -#include "media/gpu/surface_texture_gl_owner.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "ui/gl/gl_context.h" #include "ui/gl/scoped_make_current.h"
diff --git a/media/gpu/android/codec_image.h b/media/gpu/android/codec_image.h index a4da8a3..34f9651c 100644 --- a/media/gpu/android/codec_image.h +++ b/media/gpu/android/codec_image.h
@@ -13,8 +13,8 @@ #include "base/macros.h" #include "gpu/command_buffer/service/gl_stream_texture_image.h" #include "media/gpu/android/codec_wrapper.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "media/gpu/media_gpu_export.h" -#include "media/gpu/surface_texture_gl_owner.h" namespace media {
diff --git a/media/gpu/android/codec_image_unittest.cc b/media/gpu/android/codec_image_unittest.cc index ebaa9eb..1cdc41d 100644 --- a/media/gpu/android/codec_image_unittest.cc +++ b/media/gpu/android/codec_image_unittest.cc
@@ -11,7 +11,7 @@ #include "gpu/command_buffer/service/texture_manager.h" #include "media/base/android/media_codec_bridge.h" #include "media/base/android/mock_media_codec_bridge.h" -#include "media/gpu/mock_surface_texture_gl_owner.h" +#include "media/gpu/android/mock_surface_texture_gl_owner.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/rect.h" @@ -40,8 +40,9 @@ void SetUp() override { auto codec = base::MakeUnique<NiceMock<MockMediaCodecBridge>>(); codec_ = codec.get(); - wrapper_ = base::MakeUnique<CodecWrapper>(std::move(codec), - base::Bind(&base::DoNothing)); + wrapper_ = base::MakeUnique<CodecWrapper>( + CodecSurfacePair(std::move(codec), new AVDASurfaceBundle()), + base::Bind(&base::DoNothing)); ON_CALL(*codec_, DequeueOutputBuffer(_, _, _, _, _, _, _)) .WillByDefault(Return(MEDIA_CODEC_OK)); @@ -67,7 +68,7 @@ share_group_ = nullptr; surface_ = nullptr; gl::init::ShutdownGL(); - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); } enum ImageKind { kOverlay, kSurfaceTexture }; @@ -182,7 +183,7 @@ TEST_F(CodecImageTest, CodecBufferInvalidationResultsInRenderingFailure) { auto i = NewImage(kSurfaceTexture); // Invalidate the backing codec buffer. - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); ASSERT_FALSE(i->RenderToSurfaceTextureBackBuffer()); } @@ -208,13 +209,13 @@ i->RenderToSurfaceTextureBackBuffer(); // Invalidating the codec buffer doesn't matter after it's rendered to the // back buffer. - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); ASSERT_TRUE(i->RenderToFrontBuffer()); } TEST_F(CodecImageTest, FrontBufferRenderingFailsIfBackBufferRenderingFailed) { auto i = NewImage(kSurfaceTexture); - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); i->RenderToSurfaceTextureBackBuffer(); ASSERT_FALSE(i->RenderToFrontBuffer()); }
diff --git a/media/gpu/android/codec_wrapper.cc b/media/gpu/android/codec_wrapper.cc index a04bc19..2e0b41bb 100644 --- a/media/gpu/android/codec_wrapper.cc +++ b/media/gpu/android/codec_wrapper.cc
@@ -23,13 +23,13 @@ // CodecOutputBuffer are the only two things that hold references to it. class CodecWrapperImpl : public base::RefCountedThreadSafe<CodecWrapperImpl> { public: - CodecWrapperImpl(std::unique_ptr<MediaCodecBridge> codec, + CodecWrapperImpl(CodecSurfacePair codec_surface_pair, base::Closure output_buffer_release_cb); using DequeueStatus = CodecWrapper::DequeueStatus; using QueueStatus = CodecWrapper::QueueStatus; - std::unique_ptr<MediaCodecBridge> TakeCodec(); + CodecSurfacePair TakeCodecSurfacePair(); bool HasUnreleasedOutputBuffers() const; void DiscardOutputBuffers(); bool IsFlushed() const; @@ -37,13 +37,14 @@ bool IsDrained() const; bool SupportsFlush(DeviceInfo* device_info) const; bool Flush(); + bool SetSurface(scoped_refptr<AVDASurfaceBundle> surface_bundle); + AVDASurfaceBundle* SurfaceBundle(); QueueStatus QueueInputBuffer(const DecoderBuffer& buffer, const EncryptionScheme& encryption_scheme); DequeueStatus DequeueOutputBuffer( base::TimeDelta* presentation_time, bool* end_of_stream, std::unique_ptr<CodecOutputBuffer>* codec_buffer); - bool SetSurface(const base::android::JavaRef<jobject>& surface); // Releases the codec buffer and optionally renders it. This is a noop if // the codec buffer is not valid. Can be called on any thread. Returns true if @@ -66,8 +67,11 @@ // |lock_| protects access to all member variables. mutable base::Lock lock_; - std::unique_ptr<MediaCodecBridge> codec_; State state_; + std::unique_ptr<MediaCodecBridge> codec_; + + // The currently configured surface. + scoped_refptr<AVDASurfaceBundle> surface_bundle_; // Buffer ids are unique for a given CodecWrapper and map to MediaCodec buffer // indices. @@ -103,10 +107,11 @@ return codec_->ReleaseCodecOutputBuffer(id_, true); } -CodecWrapperImpl::CodecWrapperImpl(std::unique_ptr<MediaCodecBridge> codec, +CodecWrapperImpl::CodecWrapperImpl(CodecSurfacePair codec_surface_pair, base::Closure output_buffer_release_cb) - : codec_(std::move(codec)), - state_(State::kFlushed), + : state_(State::kFlushed), + codec_(std::move(codec_surface_pair.first)), + surface_bundle_(std::move(codec_surface_pair.second)), next_buffer_id_(0), output_buffer_release_cb_(std::move(output_buffer_release_cb)) { DVLOG(2) << __func__; @@ -114,13 +119,13 @@ CodecWrapperImpl::~CodecWrapperImpl() = default; -std::unique_ptr<MediaCodecBridge> CodecWrapperImpl::TakeCodec() { +CodecSurfacePair CodecWrapperImpl::TakeCodecSurfacePair() { DVLOG(2) << __func__; base::AutoLock l(lock_); if (!codec_) - return nullptr; + return {nullptr, nullptr}; DiscardOutputBuffers_Locked(); - return std::move(codec_); + return {std::move(codec_), std::move(surface_bundle_)}; } bool CodecWrapperImpl::IsFlushed() const { @@ -319,18 +324,25 @@ } bool CodecWrapperImpl::SetSurface( - const base::android::JavaRef<jobject>& surface) { + scoped_refptr<AVDASurfaceBundle> surface_bundle) { DVLOG(2) << __func__; base::AutoLock l(lock_); + DCHECK(surface_bundle); DCHECK(codec_ && state_ != State::kError); - if (!codec_->SetSurface(surface)) { + if (!codec_->SetSurface(surface_bundle->GetJavaSurface())) { state_ = State::kError; return false; } + surface_bundle_ = std::move(surface_bundle); return true; } +AVDASurfaceBundle* CodecWrapperImpl::SurfaceBundle() { + base::AutoLock l(lock_); + return surface_bundle_.get(); +} + bool CodecWrapperImpl::ReleaseCodecOutputBuffer(int64_t id, bool render) { base::AutoLock l(lock_); if (!codec_ || state_ == State::kError) @@ -359,18 +371,18 @@ return true; } -CodecWrapper::CodecWrapper(std::unique_ptr<MediaCodecBridge> codec, +CodecWrapper::CodecWrapper(CodecSurfacePair codec_surface_pair, base::Closure output_buffer_release_cb) - : impl_(new CodecWrapperImpl(std::move(codec), + : impl_(new CodecWrapperImpl(std::move(codec_surface_pair), std::move(output_buffer_release_cb))) {} CodecWrapper::~CodecWrapper() { // The codec must have already been taken. - DCHECK(!impl_->TakeCodec()); + DCHECK(!impl_->TakeCodecSurfacePair().first); } -std::unique_ptr<MediaCodecBridge> CodecWrapper::TakeCodec() { - return impl_->TakeCodec(); +CodecSurfacePair CodecWrapper::TakeCodecSurfacePair() { + return impl_->TakeCodecSurfacePair(); } bool CodecWrapper::HasUnreleasedOutputBuffers() const { @@ -415,8 +427,12 @@ codec_buffer); } -bool CodecWrapper::SetSurface(const base::android::JavaRef<jobject>& surface) { - return impl_->SetSurface(surface); +bool CodecWrapper::SetSurface(scoped_refptr<AVDASurfaceBundle> surface_bundle) { + return impl_->SetSurface(std::move(surface_bundle)); +} + +AVDASurfaceBundle* CodecWrapper::SurfaceBundle() { + return impl_->SurfaceBundle(); } } // namespace media
diff --git a/media/gpu/android/codec_wrapper.h b/media/gpu/android/codec_wrapper.h index 45ab64d7..177ce50 100644 --- a/media/gpu/android/codec_wrapper.h +++ b/media/gpu/android/codec_wrapper.h
@@ -17,13 +17,16 @@ #include "base/synchronization/lock.h" #include "media/base/android/media_codec_bridge.h" #include "media/base/decoder_buffer.h" +#include "media/gpu/android/avda_surface_bundle.h" #include "media/gpu/android/device_info.h" #include "media/gpu/media_gpu_export.h" -#include "media/gpu/surface_texture_gl_owner.h" namespace media { class CodecWrapperImpl; +using CodecSurfacePair = std::pair<std::unique_ptr<MediaCodecBridge>, + scoped_refptr<AVDASurfaceBundle>>; + // A MediaCodec output buffer that can be released on any thread. Releasing a // CodecOutputBuffer implicitly discards all CodecOutputBuffers that // precede it in presentation order; i.e., the only supported use case is to @@ -53,30 +56,26 @@ DISALLOW_COPY_AND_ASSIGN(CodecOutputBuffer); }; -// This wraps a MediaCodecBridge and provides a pared down version of its -// interface. It also adds the following features: -// * It outputs CodecOutputBuffers from DequeueOutputBuffer() which can be -// safely rendered on any thread, and that will release their buffers on -// destruction. This lets us decode on one thread while rendering on another. -// * It maintains codec specific state like whether an error has occurred. -// +// This wraps a MediaCodecBridge and provides higher level features and tracks +// more state that is useful for video decoding. // CodecWrapper is not threadsafe, but the CodecOutputBuffers it outputs // can be released on any thread. class MEDIA_GPU_EXPORT CodecWrapper { public: - // |codec| should be in the flushed state, i.e., freshly configured or after a - // Flush(). |output_buffer_release_cb| will be run whenever an output buffer - // is released back to the codec (whether it's rendered or not). This is a - // signal that the codec might be ready to accept more input. It may be run on - // any thread. - CodecWrapper(std::unique_ptr<MediaCodecBridge> codec, + // The given codec should be in the flushed state, i.e., freshly configured or + // after a Flush(). The surface must be the one that the codec was configured + // with. |output_buffer_release_cb| will be run whenever an output buffer is + // released back to the codec (whether it's rendered or not). This is a signal + // that the codec might be ready to accept more input. It may be run on any + // thread. + CodecWrapper(CodecSurfacePair codec_surface_pair, base::Closure output_buffer_release_cb); ~CodecWrapper(); - // Takes the backing codec and discards all outstanding codec buffers. This - // lets you tear down the codec while there are still CodecOutputBuffers - // referencing |this|. - std::unique_ptr<MediaCodecBridge> TakeCodec(); + // Takes the backing codec and surface, implicitly discarding all outstanding + // codec buffers. It's safe to use CodecOutputBuffers after this is called, + // but they can no longer be rendered. + CodecSurfacePair TakeCodecSurfacePair(); // Whether the codec is in the flushed state. bool IsFlushed() const; @@ -99,6 +98,13 @@ // Flushes the codec and discards all output buffers. bool Flush(); + // Sets the given surface and returns true on success. + bool SetSurface(scoped_refptr<AVDASurfaceBundle> surface_bundle); + + // Returns the surface bundle that the codec is currently configured with. + // Returns null after TakeCodecSurfacePair() is called. + AVDASurfaceBundle* SurfaceBundle(); + // Queues |buffer| if the codec has an available input buffer. enum class QueueStatus { kOk, kError, kTryAgainLater, kNoKey }; QueueStatus QueueInputBuffer(const DecoderBuffer& buffer, @@ -117,9 +123,6 @@ bool* end_of_stream, std::unique_ptr<CodecOutputBuffer>* codec_buffer); - // Sets the given surface and returns true on success. - bool SetSurface(const base::android::JavaRef<jobject>& surface); - private: scoped_refptr<CodecWrapperImpl> impl_; DISALLOW_COPY_AND_ASSIGN(CodecWrapper);
diff --git a/media/gpu/android/codec_wrapper_unittest.cc b/media/gpu/android/codec_wrapper_unittest.cc index 72ef906..e37bd5fe 100644 --- a/media/gpu/android/codec_wrapper_unittest.cc +++ b/media/gpu/android/codec_wrapper_unittest.cc
@@ -30,8 +30,10 @@ CodecWrapperTest() { auto codec = base::MakeUnique<NiceMock<MockMediaCodecBridge>>(); codec_ = codec.get(); - wrapper_ = base::MakeUnique<CodecWrapper>(std::move(codec), - output_buffer_release_cb_.Get()); + surface_bundle_ = make_scoped_refptr(new AVDASurfaceBundle()); + wrapper_ = base::MakeUnique<CodecWrapper>( + CodecSurfacePair(std::move(codec), surface_bundle_), + output_buffer_release_cb_.Get()); ON_CALL(*codec_, DequeueOutputBuffer(_, _, _, _, _, _, _)) .WillByDefault(Return(MEDIA_CODEC_OK)); ON_CALL(*codec_, DequeueInputBuffer(_, _)) @@ -45,7 +47,7 @@ ~CodecWrapperTest() override { // ~CodecWrapper asserts that the codec was taken. - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); } std::unique_ptr<CodecOutputBuffer> DequeueCodecOutputBuffer() { @@ -56,13 +58,14 @@ NiceMock<MockMediaCodecBridge>* codec_; std::unique_ptr<CodecWrapper> wrapper_; + scoped_refptr<AVDASurfaceBundle> surface_bundle_; NiceMock<base::MockCallback<base::Closure>> output_buffer_release_cb_; scoped_refptr<DecoderBuffer> fake_decoder_buffer_; }; TEST_F(CodecWrapperTest, TakeCodecReturnsTheCodecFirstAndNullLater) { - ASSERT_EQ(wrapper_->TakeCodec().get(), codec_); - ASSERT_EQ(wrapper_->TakeCodec(), nullptr); + ASSERT_EQ(wrapper_->TakeCodecSurfacePair().first.get(), codec_); + ASSERT_EQ(wrapper_->TakeCodecSurfacePair().first, nullptr); } TEST_F(CodecWrapperTest, NoCodecOutputBufferReturnedIfDequeueFails) { @@ -84,13 +87,13 @@ TEST_F(CodecWrapperTest, TakingTheCodecInvalidatesCodecOutputBuffers) { auto codec_buffer = DequeueCodecOutputBuffer(); - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); ASSERT_FALSE(codec_buffer->ReleaseToSurface()); } TEST_F(CodecWrapperTest, SetSurfaceInvalidatesCodecOutputBuffers) { auto codec_buffer = DequeueCodecOutputBuffer(); - wrapper_->SetSurface(0); + wrapper_->SetSurface(make_scoped_refptr(new AVDASurfaceBundle())); ASSERT_FALSE(codec_buffer->ReleaseToSurface()); } @@ -140,13 +143,13 @@ TEST_F(CodecWrapperTest, ReleasingCodecOutputBuffersAfterTheCodecIsSafe) { auto codec_buffer = DequeueCodecOutputBuffer(); - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); codec_buffer->ReleaseToSurface(); } TEST_F(CodecWrapperTest, DeletingCodecOutputBuffersAfterTheCodecIsSafe) { auto codec_buffer = DequeueCodecOutputBuffer(); - wrapper_->TakeCodec(); + wrapper_->TakeCodecSurfacePair(); // This test ensures the destructor doesn't crash. codec_buffer = nullptr; } @@ -249,7 +252,7 @@ ASSERT_FALSE(wrapper_->IsDrained()); } -TEST_F(CodecWrapperTest, RejectedInputBuffersAreReusedAfter) { +TEST_F(CodecWrapperTest, RejectedInputBuffersAreReused) { // If we get a MEDIA_CODEC_NO_KEY status, the next time we try to queue a // buffer the previous input buffer should be reused. EXPECT_CALL(*codec_, DequeueInputBuffer(_, _)) @@ -263,4 +266,20 @@ wrapper_->QueueInputBuffer(*fake_decoder_buffer_, EncryptionScheme()); } +TEST_F(CodecWrapperTest, SurfaceBundleIsInitializedByConstructor) { + ASSERT_EQ(surface_bundle_.get(), wrapper_->SurfaceBundle()); +} + +TEST_F(CodecWrapperTest, SurfaceBundleIsUpdatedBySetSurface) { + auto new_bundle = make_scoped_refptr(new AVDASurfaceBundle()); + EXPECT_CALL(*codec_, SetSurface(_)).WillOnce(Return(true)); + wrapper_->SetSurface(new_bundle); + ASSERT_EQ(new_bundle.get(), wrapper_->SurfaceBundle()); +} + +TEST_F(CodecWrapperTest, SurfaceBundleIsTaken) { + ASSERT_EQ(wrapper_->TakeCodecSurfacePair().second, surface_bundle_); + ASSERT_EQ(wrapper_->SurfaceBundle(), nullptr); +} + } // namespace media
diff --git a/media/gpu/content_video_view_overlay.cc b/media/gpu/android/content_video_view_overlay.cc similarity index 97% rename from media/gpu/content_video_view_overlay.cc rename to media/gpu/android/content_video_view_overlay.cc index 9a4702f..76d0a16 100644 --- a/media/gpu/content_video_view_overlay.cc +++ b/media/gpu/android/content_video_view_overlay.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 "media/gpu/content_video_view_overlay.h" +#include "media/gpu/android/content_video_view_overlay.h" #include "base/bind.h" #include "base/logging.h"
diff --git a/media/gpu/content_video_view_overlay.h b/media/gpu/android/content_video_view_overlay.h similarity index 89% rename from media/gpu/content_video_view_overlay.h rename to media/gpu/android/content_video_view_overlay.h index 24daa17..07f4032 100644 --- a/media/gpu/content_video_view_overlay.h +++ b/media/gpu/android/content_video_view_overlay.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_CONTENT_VIDEO_VIEW_OVERLAY_H_ -#define MEDIA_GPU_CONTENT_VIDEO_VIEW_OVERLAY_H_ +#ifndef MEDIA_GPU_ANDROID_CONTENT_VIDEO_VIEW_OVERLAY_H_ +#define MEDIA_GPU_ANDROID_CONTENT_VIDEO_VIEW_OVERLAY_H_ #include <memory> #include "base/memory/weak_ptr.h" #include "media/base/android/android_overlay.h" -#include "media/gpu/content_video_view_overlay_allocator.h" +#include "media/gpu/android/content_video_view_overlay_allocator.h" #include "ui/gl/android/scoped_java_surface.h" namespace media {
diff --git a/media/gpu/content_video_view_overlay_allocator.cc b/media/gpu/android/content_video_view_overlay_allocator.cc similarity index 97% rename from media/gpu/content_video_view_overlay_allocator.cc rename to media/gpu/android/content_video_view_overlay_allocator.cc index e9fb1610..6c6696f 100644 --- a/media/gpu/content_video_view_overlay_allocator.cc +++ b/media/gpu/android/content_video_view_overlay_allocator.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/gpu/content_video_view_overlay_allocator.h" +#include "media/gpu/android/content_video_view_overlay_allocator.h" -#include "media/gpu/avda_codec_allocator.h" +#include "media/gpu/android/avda_codec_allocator.h" namespace media {
diff --git a/media/gpu/content_video_view_overlay_allocator.h b/media/gpu/android/content_video_view_overlay_allocator.h similarity index 92% rename from media/gpu/content_video_view_overlay_allocator.h rename to media/gpu/android/content_video_view_overlay_allocator.h index 4725547..51a4600 100644 --- a/media/gpu/content_video_view_overlay_allocator.h +++ b/media/gpu/android/content_video_view_overlay_allocator.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_ -#define MEDIA_GPU_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_ +#ifndef MEDIA_GPU_ANDROID_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_ +#define MEDIA_GPU_ANDROID_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_ #include <stddef.h> @@ -83,4 +83,4 @@ } // namespace media -#endif // MEDIA_GPU_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_ +#endif // MEDIA_GPU_ANDROID_CONTENT_VIDEO_VIEW_OVERLAY_ALLOCATOR_H_
diff --git a/media/gpu/content_video_view_overlay_allocator_unittest.cc b/media/gpu/android/content_video_view_overlay_allocator_unittest.cc similarity index 98% rename from media/gpu/content_video_view_overlay_allocator_unittest.cc rename to media/gpu/android/content_video_view_overlay_allocator_unittest.cc index 99cd9e60..5dfa401d0 100644 --- a/media/gpu/content_video_view_overlay_allocator_unittest.cc +++ b/media/gpu/android/content_video_view_overlay_allocator_unittest.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 "media/gpu/content_video_view_overlay_allocator.h" +#include "media/gpu/android/content_video_view_overlay_allocator.h" #include <stdint.h>
diff --git a/media/gpu/fake_android_video_surface_chooser.cc b/media/gpu/android/fake_android_video_surface_chooser.cc similarity index 94% rename from media/gpu/fake_android_video_surface_chooser.cc rename to media/gpu/android/fake_android_video_surface_chooser.cc index 1cf9d7b..9f0168b 100644 --- a/media/gpu/fake_android_video_surface_chooser.cc +++ b/media/gpu/android/fake_android_video_surface_chooser.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 "media/gpu/fake_android_video_surface_chooser.h" +#include "media/gpu/android/fake_android_video_surface_chooser.h" namespace media {
diff --git a/media/gpu/fake_android_video_surface_chooser.h b/media/gpu/android/fake_android_video_surface_chooser.h similarity index 85% rename from media/gpu/fake_android_video_surface_chooser.h rename to media/gpu/android/fake_android_video_surface_chooser.h index f88b9ffa..7363012 100644 --- a/media/gpu/fake_android_video_surface_chooser.h +++ b/media/gpu/android/fake_android_video_surface_chooser.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_MOCK_ANDROID_VIDEO_SURFACE_CHOOSER_H_ -#define MEDIA_GPU_MOCK_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#ifndef MEDIA_GPU_ANDROID_FAKE_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#define MEDIA_GPU_ANDROID_FAKE_ANDROID_VIDEO_SURFACE_CHOOSER_H_ -#include "media/gpu/android_video_surface_chooser.h" +#include "media/gpu/android/android_video_surface_chooser.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -48,4 +48,4 @@ } // namespace media -#endif // MEDIA_GPU_MOCK_ANDROID_VIDEO_SURFACE_CHOOSER_H_ +#endif // MEDIA_GPU_ANDROID_FAKE_ANDROID_VIDEO_SURFACE_CHOOSER_H_
diff --git a/media/gpu/android/fake_codec_allocator.cc b/media/gpu/android/fake_codec_allocator.cc index 8bb6d0a0..e92d7356 100644 --- a/media/gpu/android/fake_codec_allocator.cc +++ b/media/gpu/android/fake_codec_allocator.cc
@@ -8,7 +8,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" -#include "media/gpu/avda_codec_allocator.h" +#include "media/gpu/android/avda_codec_allocator.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -66,19 +66,22 @@ surface_bundle->surface_texture.get()); } -MockMediaCodecBridge* FakeCodecAllocator::ProvideMockCodecAsync() { +MockMediaCodecBridge* FakeCodecAllocator::ProvideMockCodecAsync( + std::unique_ptr<MockMediaCodecBridge> codec) { DCHECK(codec_creation_pending_); codec_creation_pending_ = false; if (!client_) return nullptr; - auto codec = base::MakeUnique<NiceMock<MockMediaCodecBridge>>(); - auto* raw_codec = codec.get(); + auto mock_codec = codec ? std::move(codec) + : base::MakeUnique<NiceMock<MockMediaCodecBridge>>(); + auto* raw_codec = mock_codec.get(); most_recent_codec = raw_codec; - most_recent_codec_destruction_observer = codec->CreateDestructionObserver(); - pending_surface_bundle_ = nullptr; - client_->OnCodecConfigured(std::move(codec)); + most_recent_codec_destruction_observer = + mock_codec->CreateDestructionObserver(); + client_->OnCodecConfigured(std::move(mock_codec), + std::move(pending_surface_bundle_)); return raw_codec; } @@ -87,7 +90,7 @@ codec_creation_pending_ = false; most_recent_codec = nullptr; if (client_) - client_->OnCodecConfigured(nullptr); + client_->OnCodecConfigured(nullptr, std::move(pending_surface_bundle_)); } } // namespace media
diff --git a/media/gpu/android/fake_codec_allocator.h b/media/gpu/android/fake_codec_allocator.h index 1ed9b746..20040db 100644 --- a/media/gpu/android/fake_codec_allocator.h +++ b/media/gpu/android/fake_codec_allocator.h
@@ -5,8 +5,8 @@ #include <memory> #include "media/base/android/mock_media_codec_bridge.h" -#include "media/gpu/avda_codec_allocator.h" -#include "media/gpu/avda_surface_bundle.h" +#include "media/gpu/android/avda_codec_allocator.h" +#include "media/gpu/android/avda_surface_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/android/surface_texture.h" @@ -47,9 +47,11 @@ std::unique_ptr<MediaCodecBridge> media_codec, scoped_refptr<AVDASurfaceBundle> surface_bundle) override; - // Satisfies the pending codec creation with a mock codec and returns a raw - // pointer to it. Returns nullptr if the client WeakPtr was invalidated. - MockMediaCodecBridge* ProvideMockCodecAsync(); + // Satisfies the pending codec creation with |codec| if given, or a new + // MockMediaCodecBridge if not. Returns a raw pointer to the codec, or nullptr + // if the client WeakPtr was invalidated. + MockMediaCodecBridge* ProvideMockCodecAsync( + std::unique_ptr<MockMediaCodecBridge> codec = nullptr); // Satisfies the pending codec creation with a null codec. void ProvideNullCodecAsync();
diff --git a/media/gpu/android/media_codec_video_decoder.cc b/media/gpu/android/media_codec_video_decoder.cc index ec2ed2835..a97f0ca 100644 --- a/media/gpu/android/media_codec_video_decoder.cc +++ b/media/gpu/android/media_codec_video_decoder.cc
@@ -15,9 +15,9 @@ #include "media/base/decoder_buffer.h" #include "media/base/video_codecs.h" #include "media/base/video_decoder_config.h" -#include "media/gpu/android_video_surface_chooser.h" -#include "media/gpu/avda_codec_allocator.h" -#include "media/gpu/content_video_view_overlay.h" +#include "media/gpu/android/android_video_surface_chooser.h" +#include "media/gpu/android/avda_codec_allocator.h" +#include "media/gpu/android/content_video_view_overlay.h" #if BUILDFLAG(USE_PROPRIETARY_CODECS) #include "media/base/android/extract_sps_and_pps.h" @@ -82,14 +82,6 @@ } // namespace -CodecAllocatorAdapter::CodecAllocatorAdapter() : weak_factory(this) {} -CodecAllocatorAdapter::~CodecAllocatorAdapter() = default; - -void CodecAllocatorAdapter::OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) { - codec_created_cb.Run(std::move(media_codec)); -} - // static PendingDecode PendingDecode::CreateEos() { auto nop = [](DecodeStatus s) {}; @@ -111,7 +103,7 @@ std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser, std::unique_ptr<VideoFrameFactory> video_frame_factory, std::unique_ptr<service_manager::ServiceContextRef> context_ref) - : state_(State::kBeforeSurfaceInit), + : state_(State::kInitializing), lazy_init_pending_(true), waiting_for_key_(false), reset_generation_(0), @@ -123,14 +115,15 @@ video_frame_factory_(std::move(video_frame_factory)), device_info_(device_info), context_ref_(std::move(context_ref)), - weak_factory_(this) { + weak_factory_(this), + codec_allocator_weak_factory_(this) { DVLOG(2) << __func__; } MediaCodecVideoDecoder::~MediaCodecVideoDecoder() { DVLOG(2) << __func__; ReleaseCodec(); - codec_allocator_->StopThread(&codec_allocator_adapter_); + codec_allocator_->StopThread(this); } void MediaCodecVideoDecoder::Destroy() { @@ -138,6 +131,8 @@ // Mojo callbacks require that they're run before destruction. if (reset_cb_) reset_cb_.Run(); + // Cancel codec creation and release callbacks. + codec_allocator_weak_factory_.InvalidateWeakPtrs(); ClearPendingDecodes(DecodeStatus::ABORTED); StartDrainingCodec(DrainType::kForDestroy); } @@ -167,27 +162,16 @@ decoder_config_ = config; if (first_init) { - if (!codec_allocator_->StartThread(&codec_allocator_adapter_)) { + if (!codec_allocator_->StartThread(this)) { LOG(ERROR) << "Unable to start thread"; bound_init_cb.Run(false); return; } - - codec_config_ = new CodecConfig(); - codec_config_->codec = config.codec(); - // TODO(watk): Set |requires_secure_codec| correctly using - // MediaDrmBridgeCdmContext::MediaCryptoReadyCB. - codec_config_->requires_secure_codec = config.is_encrypted(); } - codec_config_->initial_expected_coded_size = config.coded_size(); #if BUILDFLAG(USE_PROPRIETARY_CODECS) - // We pass the SPS and PPS because it makes MediaCodec initialization - // more reliable (http://crbug.com/649185). - if (config.codec() == kCodecH264) { - ExtractSpsAndPps(config.extra_data(), &codec_config_->csd0, - &codec_config_->csd1); - } + if (config.codec() == kCodecH264) + ExtractSpsAndPps(config.extra_data(), &csd0_, &csd1_); #endif // We defer initialization of the Surface and MediaCodec until we @@ -228,13 +212,13 @@ bool overlay_changed = !overlay_info_.RefersToSameOverlayAs(overlay_info); overlay_info_ = overlay_info; // Only update surface chooser if it's initialized and the overlay changed. - if (state_ != State::kBeforeSurfaceInit && overlay_changed) + if (state_ != State::kInitializing && overlay_changed) surface_chooser_->UpdateState(CreateOverlayFactoryCb(), chooser_state_); } void MediaCodecVideoDecoder::InitializeSurfaceChooser() { DVLOG(2) << __func__; - DCHECK_EQ(state_, State::kBeforeSurfaceInit); + DCHECK_EQ(state_, State::kInitializing); // Initialize |surface_chooser_| and wait for its decision. Note: the // callback may be reentrant. surface_chooser_->Initialize( @@ -248,107 +232,99 @@ void MediaCodecVideoDecoder::OnSurfaceChosen( std::unique_ptr<AndroidOverlay> overlay) { DVLOG(2) << __func__; + DCHECK(state_ == State::kInitializing || + device_info_->IsSetOutputSurfaceSupported()); + if (overlay) { overlay->AddSurfaceDestroyedCallback( base::Bind(&MediaCodecVideoDecoder::OnSurfaceDestroyed, weak_factory_.GetWeakPtr())); + target_surface_bundle_ = new AVDASurfaceBundle(std::move(overlay)); + } else { + target_surface_bundle_ = surface_texture_bundle_; } // If we were waiting for our first surface during initialization, then - // proceed to create a codec with the chosen surface. - if (state_ == State::kBeforeSurfaceInit) { - codec_config_->surface_bundle = - overlay ? new AVDASurfaceBundle(std::move(overlay)) - : surface_texture_bundle_; + // proceed to create a codec. + if (state_ == State::kInitializing) { + state_ = State::kRunning; CreateCodec(); - return; } - - // If setOutputSurface() is not supported we can't do the transition. - if (!device_info_->IsSetOutputSurfaceSupported()) - return; - - // If we're told to switch to a SurfaceTexture but we're already using a - // SurfaceTexture, we just cancel any pending transition. - // (It's not possible for this to choose the overlay we're already using.) - if (!overlay && codec_config_->surface_bundle && - !codec_config_->surface_bundle->overlay) { - incoming_surface_ = nullptr; - return; - } - - incoming_surface_ = overlay ? new AVDASurfaceBundle(std::move(overlay)) - : surface_texture_bundle_; } void MediaCodecVideoDecoder::OnSurfaceDestroyed(AndroidOverlay* overlay) { DVLOG(2) << __func__; + DCHECK_NE(state_, State::kInitializing); - // If there is a pending transition to the overlay, cancel it. - if (incoming_surface_ && incoming_surface_->overlay.get() == overlay) { - incoming_surface_ = nullptr; - return; - } - - // If we've already stopped using the overlay, ignore it. - if (!codec_config_->surface_bundle || - codec_config_->surface_bundle->overlay.get() != overlay) { - return; - } - - // If we can't do the transition, enter state kSurfaceDestroyed. - // TODO(watk): If setOutputSurface() is available we're supposed to - // transparently handle surface transitions, however we don't handle them - // while codec creation is in progress. It should be handled gracefully - // by allocating a new codec. - if (!device_info_->IsSetOutputSurfaceSupported() || - state_ == State::kWaitingForCodec) { + // If SetOutputSurface() is not supported we only ever observe destruction of + // a single overlay so this must be the one we're using. In this case it's + // the responsibility of our consumer to destroy us for surface transitions. + if (!device_info_->IsSetOutputSurfaceSupported()) { EnterTerminalState(State::kSurfaceDestroyed); return; } - // We're using the destroyed overlay so try to transition away from it - // (defaulting to a SurfaceTexture). - if (!incoming_surface_) - incoming_surface_ = surface_texture_bundle_; - TransitionToIncomingSurface(); + // Reset the target bundle if it is the one being destroyed. + if (target_surface_bundle_->overlay.get() == overlay) + target_surface_bundle_ = surface_texture_bundle_; + + // Transition the codec away from the overlay if necessary. + if (SurfaceTransitionPending()) + TransitionToTargetSurface(); } -void MediaCodecVideoDecoder::TransitionToIncomingSurface() { +bool MediaCodecVideoDecoder::SurfaceTransitionPending() { + return codec_ && codec_->SurfaceBundle() != target_surface_bundle_; +} + +void MediaCodecVideoDecoder::TransitionToTargetSurface() { DVLOG(2) << __func__; - DCHECK(incoming_surface_); - DCHECK(codec_); - auto surface_bundle = std::move(incoming_surface_); - if (codec_->SetSurface(surface_bundle->GetJavaSurface())) - codec_config_->surface_bundle = std::move(surface_bundle); - else + DCHECK(SurfaceTransitionPending()); + DCHECK(device_info_->IsSetOutputSurfaceSupported()); + + if (!codec_->SetSurface(target_surface_bundle_)) EnterTerminalState(State::kError); } void MediaCodecVideoDecoder::CreateCodec() { DCHECK(!codec_); - state_ = State::kWaitingForCodec; - codec_allocator_adapter_.codec_created_cb = base::Bind( - &MediaCodecVideoDecoder::OnCodecCreated, weak_factory_.GetWeakPtr()); + DCHECK(target_surface_bundle_); + DCHECK_EQ(state_, State::kRunning); + + scoped_refptr<CodecConfig> config = new CodecConfig(); + config->codec = decoder_config_.codec(); + // TODO(watk): Set |requires_secure_codec| correctly using + // MediaDrmBridgeCdmContext::MediaCryptoReadyCB. + config->requires_secure_codec = decoder_config_.is_encrypted(); + config->initial_expected_coded_size = decoder_config_.coded_size(); + config->surface_bundle = target_surface_bundle_; codec_allocator_->CreateMediaCodecAsync( - codec_allocator_adapter_.weak_factory.GetWeakPtr(), codec_config_); + codec_allocator_weak_factory_.GetWeakPtr(), std::move(config)); } -void MediaCodecVideoDecoder::OnCodecCreated( - std::unique_ptr<MediaCodecBridge> codec) { - DCHECK_EQ(state_, State::kWaitingForCodec); +void MediaCodecVideoDecoder::OnCodecConfigured( + std::unique_ptr<MediaCodecBridge> codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) { DCHECK(!codec_); + DCHECK_EQ(state_, State::kRunning); if (!codec) { EnterTerminalState(State::kError); return; } - - state_ = State::kOk; codec_ = base::MakeUnique<CodecWrapper>( - std::move(codec), + CodecSurfacePair(std::move(codec), std::move(surface_bundle)), BindToCurrentLoop(base::Bind(&MediaCodecVideoDecoder::ManageTimer, weak_factory_.GetWeakPtr(), true))); + + // If the target surface changed while codec creation was in progress, + // transition to it immediately. + // Note: this can only happen if we support SetOutputSurface() because if we + // don't OnSurfaceDestroyed() cancels codec creations, and + // |surface_chooser_| doesn't change the target surface. + if (SurfaceTransitionPending()) + TransitionToTargetSurface(); + ManageTimer(true); } @@ -372,24 +348,20 @@ void MediaCodecVideoDecoder::FlushCodec() { DVLOG(2) << __func__; - if (!codec_ || codec_->IsFlushed() || state_ == State::kSurfaceDestroyed || - state_ == State::kError) { + if (!codec_ || codec_->IsFlushed()) return; - } if (codec_->SupportsFlush(device_info_)) { DVLOG(2) << "Flushing codec"; - if (!codec_->Flush()) { + if (!codec_->Flush()) EnterTerminalState(State::kError); - return; - } } else { DVLOG(2) << "flush() workaround: creating a new codec"; - // Release the codec and create a new one with the same surface bundle. - // TODO(watk): We should guarantee that the new codec is created after the - // current one is released so they aren't attached to the same surface at - // the same time. This doesn't usually happen because the release and - // creation usually post to the same thread, but it's not guaranteed. + // Release the codec and create a new one. + // Note: we may end up with two codecs attached to the same surface if the + // release hangs on one thread and create proceeds on another. This will + // result in an error, letting the user retry the playback. The alternative + // of waiting for the release risks hanging the playback forever. ReleaseCodec(); CreateCodec(); } @@ -411,6 +383,8 @@ void MediaCodecVideoDecoder::ManageTimer(bool start_timer) { const base::TimeDelta kPollingPeriod = base::TimeDelta::FromMilliseconds(10); const base::TimeDelta kIdleTimeout = base::TimeDelta::FromSeconds(1); + if (state_ != State::kRunning) + return; if (!idle_timer_ || start_timer) idle_timer_ = base::ElapsedTimer(); @@ -432,11 +406,8 @@ bool MediaCodecVideoDecoder::QueueInput() { DVLOG(4) << __func__; - if (state_ == State::kError || state_ == State::kWaitingForCodec || - state_ == State::kBeforeSurfaceInit || - state_ == State::kSurfaceDestroyed || waiting_for_key_) { + if (!codec_ || waiting_for_key_) return false; - } // If the codec is drained, flush it when there is a pending decode and no // unreleased output buffers. This lets us avoid both unbacking frames when we @@ -488,20 +459,17 @@ bool MediaCodecVideoDecoder::DequeueOutput() { DVLOG(4) << __func__; - if (state_ == State::kError || state_ == State::kWaitingForCodec || - state_ == State::kBeforeSurfaceInit || - state_ == State::kSurfaceDestroyed || waiting_for_key_) { + if (!codec_ || waiting_for_key_) return false; - } // If a surface transition is pending, wait for all outstanding buffers to be // released before doing the transition. This is necessary because the // VideoFrames corresponding to these buffers have metadata flags specific to // the surface type, and changing the surface before they're rendered would // invalidate them. - if (incoming_surface_) { + if (SurfaceTransitionPending()) { if (!codec_->HasUnreleasedOutputBuffers()) { - TransitionToIncomingSurface(); + TransitionToTargetSurface(); return true; } return false; @@ -534,9 +502,8 @@ } if (drain_type_) OnCodecDrained(); - // We don't want to flush the drained codec immediately if !|drain_type_| - // because it might be backing unrendered frames near EOS. Instead we'll - // flush it after all outstanding buffers are released. + // We don't flush the drained codec immediately because it might be + // backing unrendered frames near EOS. It's flushed lazily in QueueInput(). return false; } @@ -620,14 +587,16 @@ } void MediaCodecVideoDecoder::EnterTerminalState(State state) { - DVLOG(2) << __func__ << static_cast<int>(state); + DVLOG(2) << __func__ << " " << static_cast<int>(state); DCHECK(state == State::kError || state == State::kSurfaceDestroyed); state_ = state; // Cancel pending codec creation. - codec_allocator_adapter_.weak_factory.InvalidateWeakPtrs(); + codec_allocator_weak_factory_.InvalidateWeakPtrs(); pump_codec_timer_.Stop(); - ReleaseCodecAndBundle(); + ReleaseCodec(); + target_surface_bundle_ = nullptr; + surface_texture_bundle_ = nullptr; if (state == State::kError) ClearPendingDecodes(DecodeStatus::DECODE_ERROR); if (drain_type_) @@ -645,15 +614,10 @@ void MediaCodecVideoDecoder::ReleaseCodec() { if (!codec_) return; - codec_allocator_->ReleaseMediaCodec(codec_->TakeCodec(), - codec_config_->surface_bundle); + auto pair = codec_->TakeCodecSurfacePair(); codec_ = nullptr; -} - -void MediaCodecVideoDecoder::ReleaseCodecAndBundle() { - DCHECK(codec_config_); - ReleaseCodec(); - codec_config_->surface_bundle = nullptr; + codec_allocator_->ReleaseMediaCodec(std::move(pair.first), + std::move(pair.second)); } AndroidOverlayFactoryCB MediaCodecVideoDecoder::CreateOverlayFactoryCb() {
diff --git a/media/gpu/android/media_codec_video_decoder.h b/media/gpu/android/media_codec_video_decoder.h index 1fd4bff..2bad51b 100644 --- a/media/gpu/android/media_codec_video_decoder.h +++ b/media/gpu/android/media_codec_video_decoder.h
@@ -13,11 +13,11 @@ #include "media/base/android_overlay_mojo_factory.h" #include "media/base/overlay_info.h" #include "media/base/video_decoder.h" +#include "media/gpu/android/android_video_surface_chooser.h" +#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_wrapper.h" #include "media/gpu/android/device_info.h" #include "media/gpu/android/video_frame_factory.h" -#include "media/gpu/android_video_surface_chooser.h" -#include "media/gpu/avda_codec_allocator.h" #include "media/gpu/media_gpu_export.h" #include "services/service_manager/public/cpp/service_context_ref.h" @@ -37,22 +37,10 @@ DISALLOW_COPY_AND_ASSIGN(PendingDecode); }; -// TODO(watk): Simplify the interface to AVDACodecAllocator. -struct CodecAllocatorAdapter : public AVDACodecAllocatorClient { - using CodecCreatedCb = - base::Callback<void(std::unique_ptr<MediaCodecBridge>)>; - - CodecAllocatorAdapter(); - ~CodecAllocatorAdapter(); - void OnCodecConfigured( - std::unique_ptr<MediaCodecBridge> media_codec) override; - - CodecCreatedCb codec_created_cb; - base::WeakPtrFactory<CodecAllocatorAdapter> weak_factory; -}; - // An Android VideoDecoder that delegates to MediaCodec. -class MEDIA_GPU_EXPORT MediaCodecVideoDecoder : public VideoDecoder { +class MEDIA_GPU_EXPORT MediaCodecVideoDecoder + : public VideoDecoder, + public AVDACodecAllocatorClient { public: MediaCodecVideoDecoder( scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner, @@ -92,15 +80,17 @@ friend class base::DeleteHelper<MediaCodecVideoDecoder>; enum class State { - kOk, + // We're initializing. + kInitializing, + // Initialization has completed and we're running. This is the only state + // in which |codec_| might be non-null. If |codec_| is null, a codec + // creation is pending. + kRunning, + // A fatal error occurred. A terminal state. kError, - // We haven't initialized |surface_chooser_| yet, so we don't have a surface - // or a codec. - kBeforeSurfaceInit, - // Set when we are waiting for a codec to be created. - kWaitingForCodec, - // The output surface was destroyed. This is a terminal state like kError, - // but it isn't reported as a decode error. + // The output surface was destroyed, but SetOutputSurface() is not supported + // by the device. In this case the consumer is responsible for destroying us + // soon, so this is terminal state but not a decode error. kSurfaceDestroyed, }; @@ -126,11 +116,20 @@ void OnSurfaceChosen(std::unique_ptr<AndroidOverlay> overlay); void OnSurfaceDestroyed(AndroidOverlay* overlay); - // Sets |codecs_|'s output surface to |incoming_surface_|. Releases the codec - // and both the current and incoming bundles on failure. - void TransitionToIncomingSurface(); + // Whether we have a codec and its surface is not equal to + // |target_surface_bundle_|. + bool SurfaceTransitionPending(); + + // Sets |codecs_|'s output surface to |target_surface_bundle_|. + void TransitionToTargetSurface(); + + // Creates a codec asynchronously. void CreateCodec(); - void OnCodecCreated(std::unique_ptr<MediaCodecBridge> codec); + + // AVDACodecAllocatorClient implementation. + void OnCodecConfigured( + std::unique_ptr<MediaCodecBridge> media_codec, + scoped_refptr<AVDASurfaceBundle> surface_bundle) override; // Flushes the codec, or if flush() is not supported, releases it and creates // a new one. @@ -163,9 +162,6 @@ // Releases |codec_| if it's not null. void ReleaseCodec(); - // Calls ReleaseCodec() and drops the ref to its surface bundle. - void ReleaseCodecAndBundle(); - // Creates an overlay factory cb based on the value of overlay_info_. AndroidOverlayFactoryCB CreateOverlayFactoryCb(); @@ -196,29 +192,29 @@ VideoFrameFactory::OutputWithReleaseMailboxCB output_cb_; VideoDecoderConfig decoder_config_; + // Codec specific data (SPS and PPS for H264). Some MediaCodecs initialize + // more reliably if we explicitly pass these (http://crbug.com/649185). + std::vector<uint8_t> csd0_; + std::vector<uint8_t> csd1_; + // The surface bundle that we should transition to if a transition is pending. scoped_refptr<AVDASurfaceBundle> incoming_surface_; - // |codec_config_| must not be modified while |state_| is kWaitingForCodec. - scoped_refptr<CodecConfig> codec_config_; std::unique_ptr<CodecWrapper> codec_; base::Optional<base::ElapsedTimer> idle_timer_; base::RepeatingTimer pump_codec_timer_; - scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; base::Callback<gpu::GpuCommandBufferStub*()> get_stub_cb_; - - // An adapter to let us use AVDACodecAllocator. - CodecAllocatorAdapter codec_allocator_adapter_; AVDACodecAllocator* codec_allocator_; + // The current target surface that |codec_| should be rendering to. It + // reflects the latest surface choice by |surface_chooser_|. If the codec is + // configured with some other surface, then a transition is pending. It's + // non-null from the first surface choice. + scoped_refptr<AVDASurfaceBundle> target_surface_bundle_; + // A SurfaceTexture bundle that is kept for the lifetime of MCVD so that if we // have to synchronously switch surfaces we always have one available. - // TODO: Remove this once onSurfaceDestroyed() callbacks are not delivered - // via the gpu thread. We can't post a task to the gpu thread to - // create a SurfaceTexture inside the onSurfaceDestroyed() handler without - // deadlocking currently, because the gpu thread might be blocked waiting - // for the SurfaceDestroyed to be handled. scoped_refptr<AVDASurfaceBundle> surface_texture_bundle_; // The current overlay info, which possibly specifies an overlay to render to. @@ -243,6 +239,7 @@ // thread alive until destruction. std::unique_ptr<service_manager::ServiceContextRef> context_ref_; base::WeakPtrFactory<MediaCodecVideoDecoder> weak_factory_; + base::WeakPtrFactory<MediaCodecVideoDecoder> codec_allocator_weak_factory_; DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); };
diff --git a/media/gpu/android/media_codec_video_decoder_unittest.cc b/media/gpu/android/media_codec_video_decoder_unittest.cc index 43edd1c..2cca3ee 100644 --- a/media/gpu/android/media_codec_video_decoder_unittest.cc +++ b/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -12,12 +12,12 @@ #include "media/base/decoder_buffer.h" #include "media/base/gmock_callback_support.h" #include "media/base/test_helpers.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" +#include "media/gpu/android/fake_android_video_surface_chooser.h" #include "media/gpu/android/fake_codec_allocator.h" #include "media/gpu/android/mock_device_info.h" +#include "media/gpu/android/mock_surface_texture_gl_owner.h" #include "media/gpu/android/video_frame_factory.h" -#include "media/gpu/android_video_surface_chooser_impl.h" -#include "media/gpu/fake_android_video_surface_chooser.h" -#include "media/gpu/mock_surface_texture_gl_owner.h" #include "testing/gtest/include/gtest/gtest.h" using testing::InvokeWithoutArgs; @@ -177,10 +177,6 @@ std::unique_ptr<MediaCodecVideoDecoder> mcvd_; }; -TEST_F(MediaCodecVideoDecoderTest, DestructBeforeInitWorks) { - // Do nothing. -} - TEST_F(MediaCodecVideoDecoderTest, UnknownCodecIsRejected) { ASSERT_FALSE(Initialize(TestVideoConfig::Invalid())); } @@ -317,6 +313,8 @@ TEST_F(MediaCodecVideoDecoderTest, CodecCreationWeakPtrIsInvalidatedBySurfaceDestroyed) { auto* overlay = InitializeWithOverlay_OneDecodePending(); + ON_CALL(*device_info_, IsSetOutputSurfaceSupported()) + .WillByDefault(Return(false)); overlay->OnSurfaceDestroyed(); // MCVD should invalidate its CodecAllocatorClient WeakPtr so that it doesn't @@ -325,6 +323,17 @@ ASSERT_FALSE(codec_allocator_->ProvideMockCodecAsync()); } +TEST_F(MediaCodecVideoDecoderTest, SurfaceChangedWhileCodecCreationPending) { + auto* overlay = InitializeWithOverlay_OneDecodePending(); + overlay->OnSurfaceDestroyed(); + auto codec = base::MakeUnique<NiceMock<MockMediaCodecBridge>>(); + + // SetSurface() is called as soon as the codec is created to switch away from + // the destroyed surface. + EXPECT_CALL(*codec, SetSurface(_)).WillOnce(Return(true)); + codec_allocator_->ProvideMockCodecAsync(std::move(codec)); +} + TEST_F(MediaCodecVideoDecoderTest, SurfaceDestroyedDoesSyncSurfaceTransition) { auto* overlay = InitializeWithOverlay_OneDecodePending(); auto* codec = codec_allocator_->ProvideMockCodecAsync(); @@ -405,18 +414,6 @@ } TEST_F(MediaCodecVideoDecoderTest, - SurfaceTransitionsAreIgnoredIfSetSurfaceIsNotSupported) { - InitializeWithSurfaceTexture_OneDecodePending(); - auto* codec = codec_allocator_->ProvideMockCodecAsync(); - - EXPECT_CALL(*device_info_, IsSetOutputSurfaceSupported()) - .WillRepeatedly(Return(false)); - EXPECT_CALL(*codec, SetSurface(_)).Times(0); - surface_chooser_->ProvideSurfaceTexture(); - mcvd_->Decode(fake_decoder_buffer_, decode_cb_.Get()); -} - -TEST_F(MediaCodecVideoDecoderTest, ResetBeforeCodecInitializedSucceedsImmediately) { InitializeWithSurfaceTexture_OneDecodePending(); base::MockCallback<base::Closure> reset_cb; @@ -560,6 +557,21 @@ base::RunLoop().RunUntilIdle(); } +TEST_F(MediaCodecVideoDecoderTest, TeardownBeforeInitWorks) { + // Since we assert that MCVD is destructed by default, this test verifies that + // MCVD is destructed safely before Initialize(). +} + +TEST_F(MediaCodecVideoDecoderTest, TeardownInvalidatesCodecCreationWeakPtr) { + InitializeWithSurfaceTexture_OneDecodePending(); + destruction_observer_->DoNotAllowDestruction(); + mcvd_.reset(); + // DeleteSoon() is now pending. Ensure it's safe if the codec creation + // completes before it runs. + ASSERT_FALSE(codec_allocator_->ProvideMockCodecAsync()); + destruction_observer_->ExpectDestruction(); +} + TEST_F(MediaCodecVideoDecoderTest, TeardownDoesNotDrainFlushedCodecs) { InitializeFully_OneDecodePending(); // Since we assert that MCVD is destructed by default, this test verifies that
diff --git a/media/gpu/mock_surface_texture_gl_owner.cc b/media/gpu/android/mock_surface_texture_gl_owner.cc similarity index 95% rename from media/gpu/mock_surface_texture_gl_owner.cc rename to media/gpu/android/mock_surface_texture_gl_owner.cc index 9e52690b..5411305 100644 --- a/media/gpu/mock_surface_texture_gl_owner.cc +++ b/media/gpu/android/mock_surface_texture_gl_owner.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 "media/gpu/mock_surface_texture_gl_owner.h" +#include "media/gpu/android/mock_surface_texture_gl_owner.h" namespace media {
diff --git a/media/gpu/mock_surface_texture_gl_owner.h b/media/gpu/android/mock_surface_texture_gl_owner.h similarity index 88% rename from media/gpu/mock_surface_texture_gl_owner.h rename to media/gpu/android/mock_surface_texture_gl_owner.h index 78ce708..f43efe73 100644 --- a/media/gpu/mock_surface_texture_gl_owner.h +++ b/media/gpu/android/mock_surface_texture_gl_owner.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_MOCK_SURFACE_TEXTURE_GL_OWNER_H_ -#define MEDIA_GPU_MOCK_SURFACE_TEXTURE_GL_OWNER_H_ +#ifndef MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_ +#define MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_ -#include "media/gpu/surface_texture_gl_owner.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/gl_bindings.h" @@ -50,4 +50,4 @@ } // namespace media -#endif // MEDIA_GPU_MOCK_SURFACE_TEXTURE_GL_OWNER_H_ +#endif // MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_
diff --git a/media/gpu/surface_texture_gl_owner.cc b/media/gpu/android/surface_texture_gl_owner.cc similarity index 98% rename from media/gpu/surface_texture_gl_owner.cc rename to media/gpu/android/surface_texture_gl_owner.cc index 1a40c60..f4b4d5b 100644 --- a/media/gpu/surface_texture_gl_owner.cc +++ b/media/gpu/android/surface_texture_gl_owner.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 "media/gpu/surface_texture_gl_owner.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "base/logging.h" #include "base/memory/ptr_util.h"
diff --git a/media/gpu/surface_texture_gl_owner.h b/media/gpu/android/surface_texture_gl_owner.h similarity index 96% rename from media/gpu/surface_texture_gl_owner.h rename to media/gpu/android/surface_texture_gl_owner.h index 475d353..904dc34d 100644 --- a/media/gpu/surface_texture_gl_owner.h +++ b/media/gpu/android/surface_texture_gl_owner.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_ -#define MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_ +#ifndef MEDIA_GPU_ANDROID_SURFACE_TEXTURE_GL_OWNER_H_ +#define MEDIA_GPU_ANDROID_SURFACE_TEXTURE_GL_OWNER_H_ #include "base/memory/ref_counted.h" #include "base/memory/ref_counted_delete_on_sequence.h" @@ -126,4 +126,4 @@ } // namespace media -#endif // MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_ +#endif // MEDIA_GPU_ANDROID_SURFACE_TEXTURE_GL_OWNER_H_
diff --git a/media/gpu/surface_texture_gl_owner_unittest.cc b/media/gpu/android/surface_texture_gl_owner_unittest.cc similarity index 98% rename from media/gpu/surface_texture_gl_owner_unittest.cc rename to media/gpu/android/surface_texture_gl_owner_unittest.cc index 4db4eea..b29941a 100644 --- a/media/gpu/surface_texture_gl_owner_unittest.cc +++ b/media/gpu/android/surface_texture_gl_owner_unittest.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 "media/gpu/surface_texture_gl_owner.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include <stdint.h>
diff --git a/media/gpu/android/video_frame_factory_impl.h b/media/gpu/android/video_frame_factory_impl.h index f8faebb..3ce714c 100644 --- a/media/gpu/android/video_frame_factory_impl.h +++ b/media/gpu/android/video_frame_factory_impl.h
@@ -12,10 +12,10 @@ #include "media/base/video_frame.h" #include "media/gpu/android/codec_image.h" #include "media/gpu/android/codec_wrapper.h" +#include "media/gpu/android/surface_texture_gl_owner.h" #include "media/gpu/android/video_frame_factory.h" #include "media/gpu/gles2_decoder_helper.h" #include "media/gpu/media_gpu_export.h" -#include "media/gpu/surface_texture_gl_owner.h" #include "ui/gl/gl_bindings.h" namespace media {
diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc index 22f8f4a..c0410e2c 100644 --- a/media/gpu/gpu_video_decode_accelerator_factory.cc +++ b/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -27,10 +27,10 @@ #include "ui/gl/gl_surface_egl.h" #endif #if defined(OS_ANDROID) +#include "media/gpu/android/android_video_decode_accelerator.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" +#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/device_info.h" -#include "media/gpu/android_video_decode_accelerator.h" -#include "media/gpu/android_video_surface_chooser_impl.h" -#include "media/gpu/avda_codec_allocator.h" #endif #if BUILDFLAG(USE_VAAPI) #include "media/gpu/vaapi_video_decode_accelerator.h"
diff --git a/media/gpu/gpu_video_encode_accelerator_factory.cc b/media/gpu/gpu_video_encode_accelerator_factory.cc index 2f8cd980..a2a2f8e 100644 --- a/media/gpu/gpu_video_encode_accelerator_factory.cc +++ b/media/gpu/gpu_video_encode_accelerator_factory.cc
@@ -13,7 +13,7 @@ #include "media/gpu/v4l2_video_encode_accelerator.h" #endif #if defined(OS_ANDROID) && BUILDFLAG(ENABLE_WEBRTC) -#include "media/gpu/android_video_encode_accelerator.h" +#include "media/gpu/android/android_video_encode_accelerator.h" #endif #if defined(OS_MACOSX) #include "media/gpu/vt_video_encode_accelerator_mac.h"
diff --git a/media/midi/midi_manager_usb.cc b/media/midi/midi_manager_usb.cc index a8754e1..353bb74b 100644 --- a/media/midi/midi_manager_usb.cc +++ b/media/midi/midi_manager_usb.cc
@@ -11,6 +11,8 @@ #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "media/midi/midi_scheduler.h" +#include "media/midi/midi_service.h" +#include "media/midi/task_service.h" #include "media/midi/usb_midi_descriptor_parser.h" namespace midi { @@ -23,30 +25,45 @@ : MidiManager(service), device_factory_(std::move(factory)) {} MidiManagerUsb::~MidiManagerUsb() { - base::AutoLock auto_lock(scheduler_lock_); - CHECK(!scheduler_); + // TODO(toyoshim): Remove following DCHECKs once the dynamic instantiation + // mode is enabled by default. + base::AutoLock lock(lock_); + DCHECK(initialize_callback_.is_null()); + DCHECK(device_factory_); + DCHECK(devices_.empty()); + DCHECK(output_streams_.empty()); + DCHECK(!input_stream_); + DCHECK(input_jack_dictionary_.empty()); } void MidiManagerUsb::StartInitialization() { + bool result = service()->task_service()->BindInstance(); + DCHECK(result); + Initialize(base::BindOnce(&MidiManager::CompleteInitialization, base::Unretained(this))); } void MidiManagerUsb::Finalize() { - // Destruct MidiScheduler on Chrome_IOThread. - base::AutoLock auto_lock(scheduler_lock_); - scheduler_.reset(); + bool result = service()->task_service()->UnbindInstance(); + DCHECK(result); + + // TODO(toyoshim): Remove following code once the dynamic instantiation mode + // is enabled by default. + base::AutoLock lock(lock_); + initialize_callback_ = Callback(); + devices_.clear(); + output_streams_.clear(); + input_stream_.reset(); + input_jack_dictionary_.clear(); + + // Do not reset |device_factory_| here because it is set on the thread on + // which the constructor runs. } -void MidiManagerUsb::Initialize( - base::OnceCallback<void(Result result)> callback) { +void MidiManagerUsb::Initialize(Callback callback) { initialize_callback_ = std::move(callback); - { - base::AutoLock auto_lock(scheduler_lock_); - scheduler_.reset(new MidiScheduler(this)); - } - // This is safe because EnumerateDevices cancels the operation on destruction. device_factory_->EnumerateDevices( this, base::BindOnce(&MidiManagerUsb::OnEnumerateDevicesDone, @@ -62,14 +79,19 @@ // in the valid range. return; } + base::TimeDelta delay = MidiService::TimestampToTimeDeltaDelay(timestamp); + // output_streams_[port_index] is alive unless MidiManagerUsb is deleted. - // The task posted to the MidiScheduler will be disposed safely on deleting - // the scheduler. - scheduler_->PostSendDataTask( - client, data.size(), timestamp, + service()->task_service()->PostBoundDelayedTask( + TaskService::kDefaultRunnerId, base::BindOnce(&UsbMidiOutputStream::Send, - base::Unretained(output_streams_[port_index].get()), - data)); + base::Unretained(output_streams_[port_index].get()), data), + delay); + service()->task_service()->PostBoundDelayedTask( + TaskService::kDefaultRunnerId, + base::BindOnce(&MidiManager::AccumulateMidiBytesSent, + base::Unretained(this), client, data.size()), + delay); } void MidiManagerUsb::ReceiveUsbMidiData(UsbMidiDevice* device,
diff --git a/media/midi/midi_manager_usb.h b/media/midi/midi_manager_usb.h index 3f5a641..368b50a 100644 --- a/media/midi/midi_manager_usb.h +++ b/media/midi/midi_manager_usb.h
@@ -28,7 +28,6 @@ namespace midi { -class MidiScheduler; class MidiService; // MidiManager for USB-MIDI. @@ -69,6 +68,9 @@ } const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } + private: + using Callback = base::OnceCallback<void(mojom::Result)>; + // Initializes this object. // When the initialization finishes, |callback| will be called with the // result. @@ -76,27 +78,26 @@ // will be canceled silently (i.e. |callback| will not be called). // The function is public just for unit tests. Do not call this function // outside code for testing. - void Initialize(base::OnceCallback<void(mojom::Result result)> callback); + void Initialize(Callback callback); - private: void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); bool AddPorts(UsbMidiDevice* device, int device_id); + // TODO(toyoshim): Remove |lock_| once dynamic instantiation mode is enabled + // by default. This protects objects allocated on the I/O thread from doubly + // released on the main thread. + base::Lock lock_; + std::unique_ptr<UsbMidiDevice::Factory> device_factory_; std::vector<std::unique_ptr<UsbMidiDevice>> devices_; std::vector<std::unique_ptr<UsbMidiOutputStream>> output_streams_; std::unique_ptr<UsbMidiInputStream> input_stream_; - base::OnceCallback<void(mojom::Result result)> initialize_callback_; + Callback initialize_callback_; // A map from <endpoint_number, cable_number> to the index of input jacks. base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; - // Lock to ensure the MidiScheduler is being destructed only once in - // Finalize() on Chrome_IOThread. - base::Lock scheduler_lock_; - std::unique_ptr<MidiScheduler> scheduler_; - DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); };
diff --git a/media/mojo/clients/mojo_android_overlay.cc b/media/mojo/clients/mojo_android_overlay.cc index 41f8e6e..a5f643f7 100644 --- a/media/mojo/clients/mojo_android_overlay.cc +++ b/media/mojo/clients/mojo_android_overlay.cc
@@ -13,7 +13,7 @@ mojom::AndroidOverlayProviderPtr provider_ptr, AndroidOverlayConfig config, const base::UnguessableToken& routing_token) - : config_(std::move(config)) { + : config_(std::move(config)), binding_(this) { // Fill in details of |config| into |mojo_config|. Our caller could do this // too, but since we want to retain |config_| anyway, we do it here. mojom::AndroidOverlayConfigPtr mojo_config = @@ -23,9 +23,7 @@ mojo_config->secure = config_.secure; mojom::AndroidOverlayClientPtr ptr; - binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( - this, mojo::MakeRequest(&ptr)); - + binding_.Bind(mojo::MakeRequest(&ptr)); provider_ptr->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), std::move(mojo_config)); }
diff --git a/media/mojo/clients/mojo_android_overlay.h b/media/mojo/clients/mojo_android_overlay.h index 311862d..e97a2ef5 100644 --- a/media/mojo/clients/mojo_android_overlay.h +++ b/media/mojo/clients/mojo_android_overlay.h
@@ -34,7 +34,7 @@ private: AndroidOverlayConfig config_; mojom::AndroidOverlayPtr overlay_ptr_; - std::unique_ptr<mojo::Binding<mojom::AndroidOverlayClient>> binding_; + mojo::Binding<mojom::AndroidOverlayClient> binding_; gl::ScopedJavaSurface surface_; // Have we received OnSurfaceReady yet?
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc index cec248e..aa0c4c6 100644 --- a/media/mojo/services/gpu_mojo_media_client.cc +++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -18,10 +18,10 @@ #include "base/memory/ptr_util.h" #include "media/base/android/android_cdm_factory.h" #include "media/filters/android/media_codec_audio_decoder.h" +#include "media/gpu/android/android_video_surface_chooser_impl.h" +#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/media_codec_video_decoder.h" #include "media/gpu/android/video_frame_factory_impl.h" -#include "media/gpu/android_video_surface_chooser_impl.h" -#include "media/gpu/avda_codec_allocator.h" #include "media/mojo/interfaces/media_drm_storage.mojom.h" #include "media/mojo/interfaces/provision_fetcher.mojom.h" #include "media/mojo/services/mojo_media_drm_storage.h"
diff --git a/media/remoting/renderer_controller.cc b/media/remoting/renderer_controller.cc index 94381f0..257dc38 100644 --- a/media/remoting/renderer_controller.cc +++ b/media/remoting/renderer_controller.cc
@@ -44,10 +44,6 @@ RendererController::~RendererController() { DCHECK(thread_checker_.CalledOnValidThread()); - if (remote_rendering_started_) { - DCHECK(client_); - client_->SwitchToLocalRenderer(); - } metrics_recorder_.WillStopSession(MEDIA_ELEMENT_DESTROYED); session_->RemoveClient(this); }
diff --git a/mojo/edk/system/node_channel.cc b/mojo/edk/system/node_channel.cc index 7508d3a54..963fa338 100644 --- a/mojo/edk/system/node_channel.cc +++ b/mojo/edk/system/node_channel.cc
@@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "mojo/edk/system/channel.h" +#include "mojo/edk/system/configuration.h" #include "mojo/edk/system/request_context.h" #if defined(OS_MACOSX) && !defined(OS_IOS) @@ -907,6 +908,12 @@ } #endif + // Force a crash if this process attempts to send a message larger than the + // maximum allowed size. This is more useful than killing a Channel when we + // *receive* an oversized message, as we should consider oversized message + // transmission to be a bug and this helps easily identify offending code. + CHECK(message->data_num_bytes() < GetConfiguration().max_message_num_bytes); + base::AutoLock lock(channel_lock_); if (!channel_) DLOG(ERROR) << "Dropping message on closed channel.";
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn index b732b54c..8f990023 100644 --- a/mojo/public/cpp/bindings/BUILD.gn +++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -16,6 +16,11 @@ "$interfaces_bindings_gen_dir/interface_control_messages.mojom-shared.h", "$interfaces_bindings_gen_dir/interface_control_messages.mojom.cc", "$interfaces_bindings_gen_dir/interface_control_messages.mojom.h", + "$interfaces_bindings_gen_dir/native_struct.mojom-shared-internal.h", + "$interfaces_bindings_gen_dir/native_struct.mojom-shared.cc", + "$interfaces_bindings_gen_dir/native_struct.mojom-shared.h", + "$interfaces_bindings_gen_dir/native_struct.mojom.cc", + "$interfaces_bindings_gen_dir/native_struct.mojom.h", "$interfaces_bindings_gen_dir/pipe_control_messages.mojom-shared-internal.h", "$interfaces_bindings_gen_dir/pipe_control_messages.mojom-shared.cc", "$interfaces_bindings_gen_dir/pipe_control_messages.mojom-shared.h", @@ -86,9 +91,6 @@ "lib/multiplex_router.h", "lib/native_enum_data.h", "lib/native_enum_serialization.h", - "lib/native_struct.cc", - "lib/native_struct_data.cc", - "lib/native_struct_data.h", "lib/native_struct_serialization.cc", "lib/native_struct_serialization.h", "lib/pipe_control_message_handler.cc", @@ -122,8 +124,6 @@ "message.h", "message_header_validator.h", "native_enum.h", - "native_struct.h", - "native_struct_data_view.h", "pipe_control_message_handler.h", "pipe_control_message_handler_delegate.h", "pipe_control_message_proxy.h", @@ -142,6 +142,7 @@ "sync_handle_registry.h", "sync_handle_watcher.h", "thread_safe_interface_ptr.h", + "tracked_scoped_refptr.h", "type_converter.h", "unique_ptr_impl_ref_traits.h", ] @@ -149,12 +150,14 @@ public_deps = [ ":struct_traits", "//base", + "//ipc:message_support", "//ipc:param_traits", "//mojo/public/cpp/system", ] deps = [ "//base", + "//ipc:native_handle_type_converters", "//mojo/public/interfaces/bindings:bindings__generator", "//mojo/public/interfaces/bindings:bindings_shared__generator", ]
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h index f761145..8bdb9c7 100644 --- a/mojo/public/cpp/bindings/lib/bindings_internal.h +++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -35,8 +35,6 @@ template <typename K, typename V> class MapDataView; -class NativeStructDataView; - class StringDataView; namespace internal { @@ -55,8 +53,6 @@ template <typename K, typename V> class Map_Data; -class NativeStruct_Data; - using String_Data = Array_Data<char>; inline size_t Align(size_t size) { @@ -300,14 +296,6 @@ }; template <> -struct MojomTypeTraits<NativeStructDataView, false> { - using Data = internal::NativeStruct_Data; - using DataAsArrayElement = Pointer<Data>; - - static const MojomTypeCategory category = MojomTypeCategory::STRUCT; -}; - -template <> struct MojomTypeTraits<StringDataView, false> { using Data = String_Data; using DataAsArrayElement = Pointer<Data>;
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc index faa2004..02b755a 100644 --- a/mojo/public/cpp/bindings/lib/multiplex_router.cc +++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -447,7 +447,11 @@ return; MayAutoLock locker(&lock_); - DCHECK(base::ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after bug + // investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); + InterfaceEndpoint* endpoint = endpoints_[id].get(); DCHECK(!endpoint->client()); DCHECK(!endpoint->closed()); @@ -471,7 +475,10 @@ DCHECK(client); MayAutoLock locker(&lock_); - DCHECK(base::ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after bug + // investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); InterfaceEndpoint* endpoint = endpoints_[id].get(); endpoint->AttachClient(client, std::move(runner)); @@ -490,7 +497,10 @@ DCHECK(IsValidInterfaceId(id)); MayAutoLock locker(&lock_); - DCHECK(base::ContainsKey(endpoints_, id)); + // TODO(crbug.com/750267, crbug.com/754946): Change this to DCHECK after bug + // investigation. + CHECK(base::ContainsKey(endpoints_, id)); + endpoints_[id].CheckObjectIsValid(); InterfaceEndpoint* endpoint = endpoints_[id].get(); endpoint->DetachClient(); @@ -659,16 +669,19 @@ encountered_error_ = true; - for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { - InterfaceEndpoint* endpoint = iter->second.get(); - // Increment the iterator before calling UpdateEndpointStateMayRemove() - // because it may remove the corresponding value from the map. - ++iter; + // Calling UpdateEndpointStateMayRemove() may remove the corresponding value + // from |endpoints_| and invalidate any interator of |endpoints_|. Therefore, + // copy the endpoint pointers to a vector and iterate over it instead. + std::vector<TrackedScopedRefPtr<InterfaceEndpoint>> endpoint_vector; + endpoint_vector.reserve(endpoints_.size()); + for (auto& pair : endpoints_) + endpoint_vector.push_back(pair.second); + for (auto& endpoint : endpoint_vector) { if (endpoint->client()) - tasks_.push_back(Task::CreateNotifyErrorTask(endpoint)); + tasks_.push_back(Task::CreateNotifyErrorTask(endpoint.get())); - UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED); + UpdateEndpointStateMayRemove(endpoint.get(), PEER_ENDPOINT_CLOSED); } ProcessTasks(connector_.during_sync_handle_watcher_callback()
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h index 1af0111..b66d455 100644 --- a/mojo/public/cpp/bindings/lib/multiplex_router.h +++ b/mojo/public/cpp/bindings/lib/multiplex_router.h
@@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/containers/queue.h" +#include "base/containers/small_map.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -31,6 +32,7 @@ #include "mojo/public/cpp/bindings/pipe_control_message_handler_delegate.h" #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" +#include "mojo/public/cpp/bindings/tracked_scoped_refptr.h" namespace base { class SequencedTaskRunner; @@ -258,7 +260,9 @@ // NOTE: It is unsafe to call into this object while holding |lock_|. PipeControlMessageProxy control_message_proxy_; - std::map<InterfaceId, scoped_refptr<InterfaceEndpoint>> endpoints_; + base::small_map<std::map<InterfaceId, TrackedScopedRefPtr<InterfaceEndpoint>>, + 1> + endpoints_; uint32_t next_interface_id_value_ = 1; base::circular_deque<std::unique_ptr<Task>> tasks_;
diff --git a/mojo/public/cpp/bindings/lib/native_struct.cc b/mojo/public/cpp/bindings/lib/native_struct.cc deleted file mode 100644 index 7b1a1a6..0000000 --- a/mojo/public/cpp/bindings/lib/native_struct.cc +++ /dev/null
@@ -1,34 +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. - -#include "mojo/public/cpp/bindings/native_struct.h" - -#include "mojo/public/cpp/bindings/lib/hash_util.h" - -namespace mojo { - -// static -NativeStructPtr NativeStruct::New() { - return NativeStructPtr(base::in_place); -} - -NativeStruct::NativeStruct() {} - -NativeStruct::~NativeStruct() {} - -NativeStructPtr NativeStruct::Clone() const { - NativeStructPtr rv(New()); - rv->data = data; - return rv; -} - -bool NativeStruct::Equals(const NativeStruct& other) const { - return data == other.data; -} - -size_t NativeStruct::Hash(size_t seed) const { - return internal::Hash(seed, data); -} - -} // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/native_struct_data.cc b/mojo/public/cpp/bindings/lib/native_struct_data.cc deleted file mode 100644 index 0e5d245..0000000 --- a/mojo/public/cpp/bindings/lib/native_struct_data.cc +++ /dev/null
@@ -1,22 +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. - -#include "mojo/public/cpp/bindings/lib/native_struct_data.h" - -#include "mojo/public/cpp/bindings/lib/buffer.h" -#include "mojo/public/cpp/bindings/lib/validation_context.h" - -namespace mojo { -namespace internal { - -// static -bool NativeStruct_Data::Validate(const void* data, - ValidationContext* validation_context) { - const ContainerValidateParams data_validate_params(0, false, nullptr); - return Array_Data<uint8_t>::Validate(data, validation_context, - &data_validate_params); -} - -} // namespace internal -} // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/native_struct_data.h b/mojo/public/cpp/bindings/lib/native_struct_data.h deleted file mode 100644 index bf3e8906..0000000 --- a/mojo/public/cpp/bindings/lib/native_struct_data.h +++ /dev/null
@@ -1,61 +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. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_ - -#include <vector> - -#include "base/macros.h" -#include "mojo/public/cpp/bindings/bindings_export.h" -#include "mojo/public/cpp/bindings/lib/array_internal.h" -#include "mojo/public/cpp/system/handle.h" - -namespace mojo { -namespace internal { - -class ValidationContext; - -class MOJO_CPP_BINDINGS_EXPORT NativeStruct_Data { - public: - class BufferWriter { - public: - BufferWriter() = default; - - void Allocate(size_t num_bytes, Buffer* buffer) { - array_writer_.Allocate(num_bytes, buffer); - } - - Array_Data<uint8_t>::BufferWriter& array_writer() { return array_writer_; } - - bool is_null() const { return array_writer_.is_null(); } - NativeStruct_Data* data() { - return reinterpret_cast<NativeStruct_Data*>(array_writer_.data()); - } - NativeStruct_Data* operator->() { return data(); } - - private: - Array_Data<uint8_t>::BufferWriter array_writer_; - - DISALLOW_COPY_AND_ASSIGN(BufferWriter); - }; - - static bool Validate(const void* data, ValidationContext* validation_context); - - // Unlike normal structs, the memory layout is exactly the same as an array - // of uint8_t. - Array_Data<uint8_t> data; - - private: - NativeStruct_Data() = delete; - ~NativeStruct_Data() = delete; -}; - -static_assert(sizeof(Array_Data<uint8_t>) == sizeof(NativeStruct_Data), - "Mismatched NativeStruct_Data and Array_Data<uint8_t> size"); - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_
diff --git a/mojo/public/cpp/bindings/lib/native_struct_serialization.cc b/mojo/public/cpp/bindings/lib/native_struct_serialization.cc index 5834be7c..a31f8e4 100644 --- a/mojo/public/cpp/bindings/lib/native_struct_serialization.cc +++ b/mojo/public/cpp/bindings/lib/native_struct_serialization.cc
@@ -4,42 +4,121 @@ #include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" +#include "ipc/ipc_message_attachment.h" +#include "ipc/ipc_message_attachment_set.h" +#include "ipc/native_handle_type_converters.h" +#include "mojo/public/cpp/bindings/lib/handle_interface_serialization.h" #include "mojo/public/cpp/bindings/lib/serialization.h" +#include "mojo/public/cpp/bindings/lib/serialization_forward.h" namespace mojo { namespace internal { // static void UnmappedNativeStructSerializerImpl::Serialize( - const NativeStructPtr& input, + const native::NativeStructPtr& input, Buffer* buffer, - NativeStruct_Data::BufferWriter* writer, + native::internal::NativeStruct_Data::BufferWriter* writer, SerializationContext* context) { if (!input) return; - const ContainerValidateParams params(0, false, nullptr); - internal::Serialize<ArrayDataView<uint8_t>>( - input->data, buffer, &writer->array_writer(), ¶ms, context); + writer->Allocate(buffer); + + Array_Data<uint8_t>::BufferWriter data_writer; + const mojo::internal::ContainerValidateParams data_validate_params(0, false, + nullptr); + mojo::internal::Serialize<ArrayDataView<uint8_t>>( + input->data, buffer, &data_writer, &data_validate_params, context); + writer->data()->data.Set(data_writer.data()); + + mojo::internal::Array_Data<mojo::internal::Pointer< + native::internal::SerializedHandle_Data>>::BufferWriter handles_writer; + const mojo::internal::ContainerValidateParams handles_validate_params( + 0, false, nullptr); + mojo::internal::Serialize< + mojo::ArrayDataView<::mojo::native::SerializedHandleDataView>>( + input->handles, buffer, &handles_writer, &handles_validate_params, + context); + writer->data()->handles.Set(handles_writer.is_null() ? nullptr + : handles_writer.data()); } // static bool UnmappedNativeStructSerializerImpl::Deserialize( - NativeStruct_Data* input, - NativeStructPtr* output, + native::internal::NativeStruct_Data* input, + native::NativeStructPtr* output, SerializationContext* context) { - Array_Data<uint8_t>* data = reinterpret_cast<Array_Data<uint8_t>*>(input); - - NativeStructPtr result(NativeStruct::New()); - if (!internal::Deserialize<ArrayDataView<uint8_t>>(data, &result->data, - context)) { - output = nullptr; - return false; + if (!input) { + output->reset(); + return true; } - if (!result->data) - *output = nullptr; - else - result.Swap(output); + + native::NativeStructDataView data_view(input, context); + return StructTraits<::mojo::native::NativeStructDataView, + native::NativeStructPtr>::Read(data_view, output); +} + +// static +void UnmappedNativeStructSerializerImpl::SerializeMessageContents( + IPC::Message* message, + Buffer* buffer, + native::internal::NativeStruct_Data::BufferWriter* writer, + SerializationContext* context) { + writer->Allocate(buffer); + + // Allocate a uint8 array, initialize its header, and copy the Pickle in. + Array_Data<uint8_t>::BufferWriter data_writer; + data_writer.Allocate(message->payload_size(), buffer); + memcpy(data_writer->storage(), message->payload(), message->payload_size()); + writer->data()->data.Set(data_writer.data()); + + if (message->attachment_set()->empty()) { + writer->data()->handles.Set(nullptr); + return; + } + + mojo::internal::Array_Data<mojo::internal::Pointer< + native::internal::SerializedHandle_Data>>::BufferWriter handles_writer; + auto* attachments = message->attachment_set(); + handles_writer.Allocate(attachments->size(), buffer); + for (unsigned i = 0; i < attachments->size(); ++i) { + native::internal::SerializedHandle_Data::BufferWriter handle_writer; + handle_writer.Allocate(buffer); + + auto attachment = attachments->GetAttachmentAt(i); + ScopedHandle handle = attachment->TakeMojoHandle(); + internal::Serializer<ScopedHandle, ScopedHandle>::Serialize( + handle, &handle_writer->the_handle, context); + handle_writer->type = static_cast<int32_t>( + mojo::ConvertTo<native::SerializedHandle::Type>(attachment->GetType())); + handles_writer.data()->at(i).Set(handle_writer.data()); + } + writer->data()->handles.Set(handles_writer.data()); +} + +// static +bool UnmappedNativeStructSerializerImpl::DeserializeMessageAttachments( + native::internal::NativeStruct_Data* data, + SerializationContext* context, + IPC::Message* message) { + if (data->handles.is_null()) + return true; + + auto* handles_data = data->handles.Get(); + for (size_t i = 0; i < handles_data->size(); ++i) { + auto* handle_data = handles_data->at(i).Get(); + if (!handle_data) + return false; + ScopedHandle handle; + internal::Serializer<ScopedHandle, ScopedHandle>::Deserialize( + &handle_data->the_handle, &handle, context); + auto attachment = IPC::MessageAttachment::CreateFromMojoHandle( + std::move(handle), + mojo::ConvertTo<IPC::MessageAttachment::Type>( + static_cast<native::SerializedHandle::Type>(handle_data->type))); + message->attachment_set()->AddAttachment(std::move(attachment)); + } return true; }
diff --git a/mojo/public/cpp/bindings/lib/native_struct_serialization.h b/mojo/public/cpp/bindings/lib/native_struct_serialization.h index 0983ec6..6aa4c3a4 100644 --- a/mojo/public/cpp/bindings/lib/native_struct_serialization.h +++ b/mojo/public/cpp/bindings/lib/native_struct_serialization.h
@@ -12,38 +12,63 @@ #include "base/logging.h" #include "base/pickle.h" +#include "ipc/ipc_message.h" #include "ipc/ipc_param_traits.h" #include "mojo/public/cpp/bindings/bindings_export.h" #include "mojo/public/cpp/bindings/lib/array_internal.h" #include "mojo/public/cpp/bindings/lib/bindings_internal.h" -#include "mojo/public/cpp/bindings/lib/native_struct_data.h" #include "mojo/public/cpp/bindings/lib/serialization_forward.h" #include "mojo/public/cpp/bindings/lib/serialization_util.h" -#include "mojo/public/cpp/bindings/native_struct.h" -#include "mojo/public/cpp/bindings/native_struct_data_view.h" +#include "mojo/public/interfaces/bindings/native_struct.mojom.h" namespace mojo { namespace internal { +// Base class for the templated native struct serialization interface below, +// used to consolidated some shared logic and provide a basic +// Serialize/Deserialize for [Native] mojom structs which do not have a +// registered typemap in the current configuration (i.e. structs that are +// represented by a raw native::NativeStruct mojom struct in C++ bindings.) +struct MOJO_CPP_BINDINGS_EXPORT UnmappedNativeStructSerializerImpl { + static void Serialize( + const native::NativeStructPtr& input, + Buffer* buffer, + native::internal::NativeStruct_Data::BufferWriter* writer, + SerializationContext* context); + + static bool Deserialize(native::internal::NativeStruct_Data* input, + native::NativeStructPtr* output, + SerializationContext* context); + + static void SerializeMessageContents( + IPC::Message* message, + Buffer* buffer, + native::internal::NativeStruct_Data::BufferWriter* writer, + SerializationContext* context); + + static bool DeserializeMessageAttachments( + native::internal::NativeStruct_Data* data, + SerializationContext* context, + IPC::Message* message); +}; + template <typename MaybeConstUserType> struct NativeStructSerializerImpl { using UserType = typename std::remove_const<MaybeConstUserType>::type; using Traits = IPC::ParamTraits<UserType>; - static void Serialize(MaybeConstUserType& value, - Buffer* buffer, - NativeStruct_Data::BufferWriter* writer, - SerializationContext* context) { - base::Pickle pickle; - Traits::Write(&pickle, value); - - // Allocate a uint8 array, initialize its header, and copy the Pickle in. - writer->Allocate(pickle.payload_size(), buffer); - memcpy(writer->array_writer()->storage(), pickle.payload(), - pickle.payload_size()); + static void Serialize( + MaybeConstUserType& value, + Buffer* buffer, + native::internal::NativeStruct_Data::BufferWriter* writer, + SerializationContext* context) { + IPC::Message message; + Traits::Write(&message, value); + UnmappedNativeStructSerializerImpl::SerializeMessageContents( + &message, buffer, writer, context); } - static bool Deserialize(NativeStruct_Data* data, + static bool Deserialize(native::internal::NativeStruct_Data* data, UserType* out, SerializationContext* context) { if (!data) @@ -61,7 +86,7 @@ // Because ArrayHeader's num_bytes includes the length of the header and // Pickle's payload_size does not, we need to adjust the stored value // momentarily so Pickle can view the data. - ArrayHeader* header = reinterpret_cast<ArrayHeader*>(data); + ArrayHeader* header = reinterpret_cast<ArrayHeader*>(data->data.Get()); DCHECK_GE(header->num_bytes, sizeof(ArrayHeader)); header->num_bytes -= sizeof(ArrayHeader); @@ -69,10 +94,15 @@ // Construct a view over the full Array_Data, including our hacked up // header. Pickle will infer from this that the header is 8 bytes long, // and the payload will contain all of the pickled bytes. - base::Pickle pickle_view(reinterpret_cast<const char*>(header), - header->num_bytes + sizeof(ArrayHeader)); - base::PickleIterator iter(pickle_view); - if (!Traits::Read(&pickle_view, &iter, out)) + IPC::Message message_view(reinterpret_cast<const char*>(header), + header->num_bytes + sizeof(ArrayHeader)); + base::PickleIterator iter(message_view); + if (!UnmappedNativeStructSerializerImpl::DeserializeMessageAttachments( + data, context, &message_view)) { + return false; + } + + if (!Traits::Read(&message_view, &iter, out)) return false; } @@ -83,26 +113,16 @@ } }; -struct MOJO_CPP_BINDINGS_EXPORT UnmappedNativeStructSerializerImpl { - static void Serialize(const NativeStructPtr& input, - Buffer* buffer, - NativeStruct_Data::BufferWriter* writer, - SerializationContext* context); - static bool Deserialize(NativeStruct_Data* input, - NativeStructPtr* output, - SerializationContext* context); -}; - template <> -struct NativeStructSerializerImpl<NativeStructPtr> +struct NativeStructSerializerImpl<native::NativeStructPtr> : public UnmappedNativeStructSerializerImpl {}; template <> -struct NativeStructSerializerImpl<const NativeStructPtr> +struct NativeStructSerializerImpl<const native::NativeStructPtr> : public UnmappedNativeStructSerializerImpl {}; template <typename MaybeConstUserType> -struct Serializer<NativeStructDataView, MaybeConstUserType> +struct Serializer<native::NativeStructDataView, MaybeConstUserType> : public NativeStructSerializerImpl<MaybeConstUserType> {}; } // namespace internal
diff --git a/mojo/public/cpp/bindings/lib/serialization.h b/mojo/public/cpp/bindings/lib/serialization.h index f5e89e2..90f64f3 100644 --- a/mojo/public/cpp/bindings/lib/serialization.h +++ b/mojo/public/cpp/bindings/lib/serialization.h
@@ -15,7 +15,6 @@ #include "mojo/public/cpp/bindings/lib/handle_interface_serialization.h" #include "mojo/public/cpp/bindings/lib/map_serialization.h" #include "mojo/public/cpp/bindings/lib/native_enum_serialization.h" -#include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" #include "mojo/public/cpp/bindings/lib/string_serialization.h" #include "mojo/public/cpp/bindings/lib/template_util.h" #include "mojo/public/cpp/bindings/map_traits_stl.h"
diff --git a/mojo/public/cpp/bindings/native_struct.h b/mojo/public/cpp/bindings/native_struct.h deleted file mode 100644 index ac27250bc..0000000 --- a/mojo/public/cpp/bindings/native_struct.h +++ /dev/null
@@ -1,51 +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. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_H_ - -#include <vector> - -#include "base/optional.h" -#include "mojo/public/cpp/bindings/bindings_export.h" -#include "mojo/public/cpp/bindings/lib/native_struct_data.h" -#include "mojo/public/cpp/bindings/struct_ptr.h" -#include "mojo/public/cpp/bindings/type_converter.h" - -namespace mojo { - -class NativeStruct; -using NativeStructPtr = StructPtr<NativeStruct>; - -// Native-only structs correspond to "[Native] struct Foo;" definitions in -// mojom. -class MOJO_CPP_BINDINGS_EXPORT NativeStruct { - public: - using Data_ = internal::NativeStruct_Data; - - static NativeStructPtr New(); - - template <typename U> - static NativeStructPtr From(const U& u) { - return TypeConverter<NativeStructPtr, U>::Convert(u); - } - - template <typename U> - U To() const { - return TypeConverter<U, NativeStruct>::Convert(*this); - } - - NativeStruct(); - ~NativeStruct(); - - NativeStructPtr Clone() const; - bool Equals(const NativeStruct& other) const; - size_t Hash(size_t seed) const; - - base::Optional<std::vector<uint8_t>> data; -}; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_H_
diff --git a/mojo/public/cpp/bindings/native_struct_data_view.h b/mojo/public/cpp/bindings/native_struct_data_view.h deleted file mode 100644 index 613bd7a..0000000 --- a/mojo/public/cpp/bindings/native_struct_data_view.h +++ /dev/null
@@ -1,36 +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. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_DATA_VIEW_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_DATA_VIEW_H_ - -#include "mojo/public/cpp/bindings/lib/native_struct_data.h" -#include "mojo/public/cpp/bindings/lib/serialization_context.h" - -namespace mojo { - -class NativeStructDataView { - public: - using Data_ = internal::NativeStruct_Data; - - NativeStructDataView() {} - - NativeStructDataView(Data_* data, internal::SerializationContext* context) - : data_(data) {} - - bool is_null() const { return !data_; } - - size_t size() const { return data_->data.size(); } - - uint8_t operator[](size_t index) const { return data_->data.at(index); } - - const uint8_t* data() const { return data_->data.storage(); } - - private: - Data_* data_ = nullptr; -}; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_NATIVE_STRUCT_DATA_VIEW_H_
diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn index 456da13..136e8e6 100644 --- a/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/mojo/public/cpp/bindings/tests/BUILD.gn
@@ -28,6 +28,7 @@ "message_queue.cc", "message_queue.h", "multiplex_router_unittest.cc", + "native_struct_unittest.cc", "report_bad_message_unittest.cc", "request_response_unittest.cc", "router_test_util.cc",
diff --git a/mojo/public/cpp/bindings/tests/data_view_unittest.cc b/mojo/public/cpp/bindings/tests/data_view_unittest.cc index e1bc83a4..cd88a6f 100644 --- a/mojo/public/cpp/bindings/tests/data_view_unittest.cc +++ b/mojo/public/cpp/bindings/tests/data_view_unittest.cc
@@ -90,21 +90,24 @@ TEST_F(DataViewTest, NativeStruct) { TestStructPtr obj(TestStruct::New()); - obj->f_native_struct = NativeStruct::New(); + obj->f_native_struct = native::NativeStruct::New(); obj->f_native_struct->data = std::vector<uint8_t>({3, 2, 1}); auto data_view_holder = SerializeTestStruct(std::move(obj)); auto& data_view = *data_view_holder->data_view; - NativeStructDataView struct_data_view; + native::NativeStructDataView struct_data_view; data_view.GetFNativeStructDataView(&struct_data_view); - ASSERT_FALSE(struct_data_view.is_null()); - ASSERT_EQ(3u, struct_data_view.size()); - EXPECT_EQ(3, struct_data_view[0]); - EXPECT_EQ(2, struct_data_view[1]); - EXPECT_EQ(1, struct_data_view[2]); - EXPECT_EQ(3, *struct_data_view.data()); + ArrayDataView<uint8_t> data_data_view; + struct_data_view.GetDataDataView(&data_data_view); + + ASSERT_FALSE(data_data_view.is_null()); + ASSERT_EQ(3u, data_data_view.size()); + EXPECT_EQ(3, data_data_view[0]); + EXPECT_EQ(2, data_data_view[1]); + EXPECT_EQ(1, data_data_view[2]); + EXPECT_EQ(3, *data_data_view.data()); } TEST_F(DataViewTest, BoolArray) {
diff --git a/mojo/public/cpp/bindings/tests/hash_unittest.cc b/mojo/public/cpp/bindings/tests/hash_unittest.cc index 9ce1f5b..3a5bf47 100644 --- a/mojo/public/cpp/bindings/tests/hash_unittest.cc +++ b/mojo/public/cpp/bindings/tests/hash_unittest.cc
@@ -22,14 +22,6 @@ SimpleNestedStruct::New(ContainsOther::New(1)))); } -TEST_F(HashTest, UnmappedNativeStruct) { - // Just check that this template instantiation compiles. - ASSERT_EQ(::mojo::internal::Hash(::mojo::internal::kHashSeed, - UnmappedNativeStruct::New()), - ::mojo::internal::Hash(::mojo::internal::kHashSeed, - UnmappedNativeStruct::New())); -} - } // namespace } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/native_struct_unittest.cc b/mojo/public/cpp/bindings/tests/native_struct_unittest.cc new file mode 100644 index 0000000..6e3cbcbe --- /dev/null +++ b/mojo/public/cpp/bindings/tests/native_struct_unittest.cc
@@ -0,0 +1,98 @@ +// 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 <vector> + +#include "base/bind.h" +#include "base/macros.h" +#include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" +#include "ipc/ipc_param_traits.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/tests/bindings_test_base.h" +#include "mojo/public/cpp/system/message_pipe.h" +#include "mojo/public/cpp/system/wait.h" +#include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { + +class NativeStructTest : public BindingsTestBase, + public test::NativeTypeTester { + public: + NativeStructTest() : binding_(this, mojo::MakeRequest(&proxy_)) {} + ~NativeStructTest() override = default; + + test::NativeTypeTester* proxy() { return proxy_.get(); } + + private: + // test::NativeTypeTester: + void PassNativeStruct(const test::TestNativeStruct& s, + const PassNativeStructCallback& callback) override { + callback.Run(s); + } + + void PassNativeStructWithAttachments( + test::TestNativeStructWithAttachments s, + const PassNativeStructWithAttachmentsCallback& callback) override { + callback.Run(std::move(s)); + } + + test::NativeTypeTesterPtr proxy_; + Binding<test::NativeTypeTester> binding_; + + DISALLOW_COPY_AND_ASSIGN(NativeStructTest); +}; + +TEST_P(NativeStructTest, NativeStruct) { + test::TestNativeStruct s("hello world", 5, 42); + base::RunLoop loop; + proxy()->PassNativeStruct( + s, base::Bind( + [](test::TestNativeStruct* expected_struct, base::RunLoop* loop, + const test::TestNativeStruct& passed) { + EXPECT_EQ(expected_struct->message(), passed.message()); + EXPECT_EQ(expected_struct->x(), passed.x()); + EXPECT_EQ(expected_struct->y(), passed.y()); + loop->Quit(); + }, + &s, &loop)); + loop.Run(); +} + +TEST_P(NativeStructTest, NativeStructWithAttachments) { + mojo::MessagePipe pipe; + const std::string kTestMessage = "hey hi"; + test::TestNativeStructWithAttachments s(kTestMessage, + std::move(pipe.handle0)); + base::RunLoop loop; + proxy()->PassNativeStructWithAttachments( + std::move(s), + base::Bind( + [](const std::string& expected_message, + mojo::ScopedMessagePipeHandle peer_pipe, base::RunLoop* loop, + test::TestNativeStructWithAttachments passed) { + // To ensure that the received pipe handle is functioning, we write + // to its peer and wait for the message to be received. + WriteMessageRaw(peer_pipe.get(), "ping", 4, nullptr, 0, + MOJO_WRITE_MESSAGE_FLAG_NONE); + auto pipe = passed.PassPipe(); + EXPECT_EQ(MOJO_RESULT_OK, + Wait(pipe.get(), MOJO_HANDLE_SIGNAL_READABLE)); + std::vector<uint8_t> bytes; + EXPECT_EQ(MOJO_RESULT_OK, + ReadMessageRaw(pipe.get(), &bytes, nullptr, + MOJO_READ_MESSAGE_FLAG_NONE)); + EXPECT_EQ("ping", std::string(bytes.begin(), bytes.end())); + loop->Quit(); + }, + kTestMessage, base::Passed(&pipe.handle1), &loop)); + loop.Run(); +} + +INSTANTIATE_MOJO_BINDINGS_TEST_CASE_P(NativeStructTest); + +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/struct_unittest.cc b/mojo/public/cpp/bindings/tests/struct_unittest.cc index 842b6ed..b9b16b2c 100644 --- a/mojo/public/cpp/bindings/tests/struct_unittest.cc +++ b/mojo/public/cpp/bindings/tests/struct_unittest.cc
@@ -34,8 +34,8 @@ }; template <> -struct SerializeStructHelperTraits<NativeStruct> { - using DataView = NativeStructDataView; +struct SerializeStructHelperTraits<native::NativeStruct> { + using DataView = native::NativeStructDataView; }; template <typename InputType, typename DataType> @@ -375,10 +375,10 @@ // Serialization test for native struct. TEST_F(StructTest, Serialization_NativeStruct) { - using Data = mojo::internal::NativeStruct_Data; + using Data = native::internal::NativeStruct_Data; { // Serialization of a null native struct. - NativeStructPtr native; + native::NativeStructPtr native; mojo::Message message; mojo::internal::SerializationContext context; @@ -386,46 +386,46 @@ EXPECT_EQ(0u, SerializeStruct(native, &message, &context, &data)); EXPECT_EQ(nullptr, data); - NativeStructPtr output_native; - mojo::internal::Deserialize<NativeStructDataView>(data, &output_native, - &context); + native::NativeStructPtr output_native; + mojo::internal::Deserialize<native::NativeStructDataView>( + data, &output_native, &context); EXPECT_TRUE(output_native.is_null()); } { // Serialization of a native struct with null data. - NativeStructPtr native(NativeStruct::New()); + native::NativeStructPtr native(native::NativeStruct::New()); mojo::Message message; mojo::internal::SerializationContext context; Data* data = nullptr; - EXPECT_EQ(0u, SerializeStruct(native, &message, &context, &data)); - EXPECT_EQ(nullptr, data); + EXPECT_EQ(32u, SerializeStruct(native, &message, &context, &data)); + EXPECT_EQ(0u, data->data.Get()->size()); - NativeStructPtr output_native; - mojo::internal::Deserialize<NativeStructDataView>(data, &output_native, - &context); - EXPECT_TRUE(output_native.is_null()); + native::NativeStructPtr output_native; + mojo::internal::Deserialize<native::NativeStructDataView>( + data, &output_native, &context); + EXPECT_TRUE(output_native->data.empty()); } { - NativeStructPtr native(NativeStruct::New()); + native::NativeStructPtr native(native::NativeStruct::New()); native->data = std::vector<uint8_t>{'X', 'Y'}; mojo::Message message; mojo::internal::SerializationContext context; Data* data = nullptr; - EXPECT_EQ(16u, SerializeStruct(native, &message, &context, &data)); - EXPECT_NE(nullptr, data); + EXPECT_EQ(40u, SerializeStruct(native, &message, &context, &data)); + EXPECT_EQ(2u, data->data.Get()->size()); - NativeStructPtr output_native; - mojo::internal::Deserialize<NativeStructDataView>(data, &output_native, - &context); + native::NativeStructPtr output_native; + mojo::internal::Deserialize<native::NativeStructDataView>( + data, &output_native, &context); ASSERT_TRUE(output_native); - ASSERT_FALSE(output_native->data->empty()); - EXPECT_EQ(2u, output_native->data->size()); - EXPECT_EQ('X', (*output_native->data)[0]); - EXPECT_EQ('Y', (*output_native->data)[1]); + ASSERT_FALSE(output_native->data.empty()); + EXPECT_EQ(2u, output_native->data.size()); + EXPECT_EQ('X', output_native->data[0]); + EXPECT_EQ('Y', output_native->data[1]); } }
diff --git a/mojo/public/cpp/bindings/tests/test_native_types.cc b/mojo/public/cpp/bindings/tests/test_native_types.cc new file mode 100644 index 0000000..b11cc23 --- /dev/null +++ b/mojo/public/cpp/bindings/tests/test_native_types.cc
@@ -0,0 +1,99 @@ +// 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 "mojo/public/cpp/bindings/tests/test_native_types.h" + +#include "base/macros.h" +#include "ipc/ipc_mojo_message_helper.h" + +namespace mojo { +namespace test { + +TestNativeStruct::TestNativeStruct() = default; + +TestNativeStruct::TestNativeStruct(const std::string& message, int x, int y) + : message_(message), x_(x), y_(y) {} + +TestNativeStruct::~TestNativeStruct() = default; + +TestNativeStructWithAttachments::TestNativeStructWithAttachments() = default; + +TestNativeStructWithAttachments::TestNativeStructWithAttachments( + TestNativeStructWithAttachments&& other) = default; + +TestNativeStructWithAttachments::TestNativeStructWithAttachments( + const std::string& message, + mojo::ScopedMessagePipeHandle pipe) + : message_(message), pipe_(std::move(pipe)) {} + +TestNativeStructWithAttachments::~TestNativeStructWithAttachments() = default; + +TestNativeStructWithAttachments& TestNativeStructWithAttachments::operator=( + TestNativeStructWithAttachments&& other) = default; + +} // namespace test +} // namespace mojo + +namespace IPC { + +// static +void ParamTraits<mojo::test::TestNativeStruct>::Write(base::Pickle* m, + const param_type& p) { + m->WriteString(p.message()); + m->WriteInt(p.x()); + m->WriteInt(p.y()); +} + +// static +bool ParamTraits<mojo::test::TestNativeStruct>::Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r) { + std::string message; + if (!iter->ReadString(&message)) + return false; + int x, y; + if (!iter->ReadInt(&x) || !iter->ReadInt(&y)) + return false; + r->set_message(message); + r->set_x(x); + r->set_y(y); + return true; +} + +// static +void ParamTraits<mojo::test::TestNativeStruct>::Log(const param_type& p, + std::string* l) {} + +// static +void ParamTraits<mojo::test::TestNativeStructWithAttachments>::Write( + Message* m, + const param_type& p) { + m->WriteString(p.message()); + IPC::MojoMessageHelper::WriteMessagePipeTo(m, p.PassPipe()); +} + +// static +bool ParamTraits<mojo::test::TestNativeStructWithAttachments>::Read( + const Message* m, + base::PickleIterator* iter, + param_type* r) { + std::string message; + if (!iter->ReadString(&message)) + return false; + r->set_message(message); + + mojo::ScopedMessagePipeHandle pipe; + if (!IPC::MojoMessageHelper::ReadMessagePipeFrom(m, iter, &pipe)) + return false; + + r->set_pipe(std::move(pipe)); + return true; +} + +// static +void ParamTraits<mojo::test::TestNativeStructWithAttachments>::Log( + const param_type& p, + std::string* l) {} + +} // namespace IPC
diff --git a/mojo/public/cpp/bindings/tests/test_native_types.h b/mojo/public/cpp/bindings/tests/test_native_types.h new file mode 100644 index 0000000..f16bf2b --- /dev/null +++ b/mojo/public/cpp/bindings/tests/test_native_types.h
@@ -0,0 +1,84 @@ +// 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/macros.h" +#include "ipc/ipc_message.h" +#include "ipc/ipc_param_traits.h" +#include "mojo/public/cpp/system/message_pipe.h" + +namespace mojo { +namespace test { + +class TestNativeStruct { + public: + TestNativeStruct(); + TestNativeStruct(const std::string& message, int x, int y); + ~TestNativeStruct(); + + const std::string& message() const { return message_; } + void set_message(const std::string& message) { message_ = message; } + + int x() const { return x_; } + void set_x(int x) { x_ = x; } + + int y() const { return y_; } + void set_y(int y) { y_ = y; } + + private: + std::string message_; + int x_, y_; +}; + +class TestNativeStructWithAttachments { + public: + TestNativeStructWithAttachments(); + TestNativeStructWithAttachments(TestNativeStructWithAttachments&& other); + TestNativeStructWithAttachments(const std::string& message, + ScopedMessagePipeHandle pipe); + ~TestNativeStructWithAttachments(); + + TestNativeStructWithAttachments& operator=( + TestNativeStructWithAttachments&& other); + + const std::string& message() const { return message_; } + void set_message(const std::string& message) { message_ = message; } + + void set_pipe(mojo::ScopedMessagePipeHandle pipe) { pipe_ = std::move(pipe); } + mojo::ScopedMessagePipeHandle PassPipe() const { return std::move(pipe_); } + + private: + std::string message_; + mutable mojo::ScopedMessagePipeHandle pipe_; + + DISALLOW_COPY_AND_ASSIGN(TestNativeStructWithAttachments); +}; + +} // namespace test +} // namespace mojo + +namespace IPC { + +template <> +struct ParamTraits<mojo::test::TestNativeStruct> { + using param_type = mojo::test::TestNativeStruct; + + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<mojo::test::TestNativeStructWithAttachments> { + using param_type = mojo::test::TestNativeStructWithAttachments; + + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC
diff --git a/mojo/public/cpp/bindings/tests/test_native_types_chromium.typemap b/mojo/public/cpp/bindings/tests/test_native_types_chromium.typemap index 50e8076..da99a1a 100644 --- a/mojo/public/cpp/bindings/tests/test_native_types_chromium.typemap +++ b/mojo/public/cpp/bindings/tests/test_native_types_chromium.typemap
@@ -3,9 +3,13 @@ # found in the LICENSE file. mojom = "//mojo/public/interfaces/bindings/tests/test_native_types.mojom" -public_headers = [ "//mojo/public/cpp/bindings/tests/pickled_types_chromium.h" ] +public_headers = [ + "//mojo/public/cpp/bindings/tests/pickled_types_chromium.h", + "//mojo/public/cpp/bindings/tests/test_native_types.h", +] sources = [ "//mojo/public/cpp/bindings/tests/pickled_types_chromium.cc", + "//mojo/public/cpp/bindings/tests/test_native_types.cc", ] deps = [ "//ipc", @@ -14,4 +18,6 @@ type_mappings = [ "mojo.test.PickledEnum=mojo::test::PickledEnumChromium", "mojo.test.PickledStruct=mojo::test::PickledStructChromium[move_only]", + "mojo.test.TestNativeStructMojom=mojo::test::TestNativeStruct", + "mojo.test.TestNativeStructWithAttachmentsMojom=mojo::test::TestNativeStructWithAttachments[move_only]", ]
diff --git a/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc index 9ee97c3..aaf1c1077 100644 --- a/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc +++ b/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
@@ -25,14 +25,6 @@ blink::SimpleNestedStruct::New(blink::ContainsOther::New(1)))); } -TEST_F(WTFHashTest, UnmappedNativeStruct) { - // Just check that this template instantiation compiles. - ASSERT_EQ(::mojo::internal::Hash(::mojo::internal::kHashSeed, - blink::UnmappedNativeStruct::New()), - ::mojo::internal::Hash(::mojo::internal::kHashSeed, - blink::UnmappedNativeStruct::New())); -} - TEST_F(WTFHashTest, Enum) { // Just check that this template instantiation compiles.
diff --git a/mojo/public/cpp/bindings/tracked_scoped_refptr.h b/mojo/public/cpp/bindings/tracked_scoped_refptr.h new file mode 100644 index 0000000..f95eec2f --- /dev/null +++ b/mojo/public/cpp/bindings/tracked_scoped_refptr.h
@@ -0,0 +1,113 @@ +// 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 MOJO_PUBLIC_CPP_BINDINGS_TRACKED_SCOPED_REFPTR_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_TRACKED_SCOPED_REFPTR_H_ + +#include "base/debug/alias.h" + +namespace mojo { + +// TODO(crbug.com/750267, crbug.com/754946): Remove this after bug +// investigation. +template <typename T> +class TrackedScopedRefPtr { + public: + TrackedScopedRefPtr() {} + + TrackedScopedRefPtr(T* ptr) : ptr_(ptr) { + null_reason_ = ptr_ ? NOT_NULL : INITIALIZED_BY_ASSIGN; + } + + TrackedScopedRefPtr(const TrackedScopedRefPtr<T>& other) : ptr_(other.ptr_) { + null_reason_ = ptr_ ? NOT_NULL : INITIALIZED_BY_ASSIGN; + } + + TrackedScopedRefPtr(TrackedScopedRefPtr<T>&& other) + : ptr_(std::move(other.ptr_)) { + null_reason_ = ptr_ ? NOT_NULL : INITIALIZED_BY_MOVE; + + if (ptr_) + other.null_reason_ = MOVED_OUT; + } + + ~TrackedScopedRefPtr() { state_ = DESTROYED; } + + T* get() const { return ptr_.get(); } + + T& operator*() const { return *ptr_; } + + T* operator->() const { return ptr_.get(); } + + TrackedScopedRefPtr<T>& operator=(T* ptr) { + ptr_ = ptr; + null_reason_ = ptr_ ? NOT_NULL : ASSIGNED; + return *this; + } + + TrackedScopedRefPtr<T>& operator=(const TrackedScopedRefPtr<T>& other) { + ptr_ = other.ptr_; + null_reason_ = ptr_ ? NOT_NULL : ASSIGNED; + return *this; + } + + TrackedScopedRefPtr<T>& operator=(TrackedScopedRefPtr<T>&& other) { + ptr_ = std::move(other.ptr_); + null_reason_ = ptr_ ? NOT_NULL : MOVED_IN; + if (ptr_) + other.null_reason_ = MOVED_OUT; + return *this; + } + + void CheckObjectIsValid() { + CHECK(this); + + LifeState state = state_; + base::debug::Alias(&state); + + NullReason null_reason = null_reason_; + base::debug::Alias(&null_reason); + + // This address has been used to construct a TrackedScopedRefPtr. + CHECK(state_ == ALIVE || state_ == DESTROYED); + + // If the previous check succeeds but this fails, it is likely to be + // use-after-free problem. + CHECK_EQ(ALIVE, state_); + + CHECK_NE(DEFAULT_INITIALIZED, null_reason_); + CHECK_NE(INITIALIZED_BY_ASSIGN, null_reason_); + CHECK_NE(INITIALIZED_BY_MOVE, null_reason_); + CHECK_NE(ASSIGNED, null_reason_); + CHECK_NE(MOVED_IN, null_reason_); + CHECK_NE(MOVED_OUT, null_reason_); + + CHECK_EQ(NOT_NULL, null_reason_); + CHECK(ptr_); + } + + private: + enum LifeState : uint64_t { + ALIVE = 0x1029384756afbecd, + DESTROYED = 0xdcebfa6574839201 + }; + + enum NullReason : uint64_t { + DEFAULT_INITIALIZED = 0x1234432112344321, + INITIALIZED_BY_ASSIGN = 0x3456654334566543, + INITIALIZED_BY_MOVE = 0x5678876556788765, + ASSIGNED = 0x789a9a87789a9a87, + MOVED_IN = 0x9abccba99abccba9, + MOVED_OUT = 0xbcdeedcbbcdeedcb, + NOT_NULL = 0xcdeffedccdeffedc + }; + + LifeState state_ = ALIVE; + scoped_refptr<T> ptr_; + NullReason null_reason_ = DEFAULT_INITIALIZED; +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_TRACKED_SCOPED_REFPTR_H_
diff --git a/mojo/public/interfaces/bindings/BUILD.gn b/mojo/public/interfaces/bindings/BUILD.gn index 3bd98de..4608db0 100644 --- a/mojo/public/interfaces/bindings/BUILD.gn +++ b/mojo/public/interfaces/bindings/BUILD.gn
@@ -8,9 +8,12 @@ visibility = [] sources = [ "interface_control_messages.mojom", + "native_struct.mojom", "pipe_control_messages.mojom", ] + allow_native_structs = false + component_output_prefix = "mojo_public_interfaces_bindings" export_class_attribute = "MOJO_CPP_BINDINGS_EXPORT" export_define = "MOJO_CPP_BINDINGS_IMPLEMENTATION"
diff --git a/mojo/public/interfaces/bindings/native_struct.mojom b/mojo/public/interfaces/bindings/native_struct.mojom new file mode 100644 index 0000000..f2e869cf --- /dev/null +++ b/mojo/public/interfaces/bindings/native_struct.mojom
@@ -0,0 +1,26 @@ +// 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. + +[JavaPackage="org.chromium.mojo.native_types"] +module mojo.native; + +struct SerializedHandle { + handle the_handle; + + enum Type { + MOJO_HANDLE, + PLATFORM_FILE, + WIN_HANDLE, + MACH_PORT, + FUCHSIA_HANDLE, + }; + + Type type; +}; + +[CustomSerializer] +struct NativeStruct { + array<uint8> data; + array<SerializedHandle>? handles; +};
diff --git a/mojo/public/interfaces/bindings/tests/test_native_types.mojom b/mojo/public/interfaces/bindings/tests/test_native_types.mojom index 3df4318..caa6a71 100644 --- a/mojo/public/interfaces/bindings/tests/test_native_types.mojom +++ b/mojo/public/interfaces/bindings/tests/test_native_types.mojom
@@ -36,3 +36,15 @@ GetLargestRect() => (TypemappedRect largest); PassSharedRect(SharedTypemappedRect r) => (SharedTypemappedRect passed); }; + +[Native] +struct TestNativeStructMojom; + +[Native] +struct TestNativeStructWithAttachmentsMojom; + +interface NativeTypeTester { + PassNativeStruct(TestNativeStructMojom s) => (TestNativeStructMojom passed); + PassNativeStructWithAttachments(TestNativeStructWithAttachmentsMojom s) + => (TestNativeStructWithAttachmentsMojom s); +};
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl index 3033a99..21e5025 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
@@ -15,13 +15,16 @@ #include "mojo/public/cpp/bindings/lib/bindings_internal.h" #include "mojo/public/cpp/bindings/lib/map_data_internal.h" #include "mojo/public/cpp/bindings/lib/native_enum_data.h" -#include "mojo/public/cpp/bindings/lib/native_struct_data.h" #include "mojo/public/cpp/bindings/lib/buffer.h" {%- for import in imports %} #include "{{import.path}}-shared-internal.h" {%- endfor %} +{%- if allow_native_structs %} +#include "mojo/public/interfaces/bindings/native_struct.mojom-shared-internal.h" +{%- endif %} + {%- if export_header %} #include "{{export_header}}" {%- endif %} @@ -40,7 +43,7 @@ {#--- Internal forward declarations #} {%- for struct in structs %} {%- if struct|is_native_only_kind %} -using {{struct.name}}_Data = mojo::internal::NativeStruct_Data; +using {{struct.name}}_Data = mojo::native::internal::NativeStruct_Data; {%- else %} class {{struct.name}}_Data; {%- endif %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl index 148dc7ae..58ced63 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl
@@ -50,13 +50,16 @@ #include "mojo/public/cpp/bindings/lib/serialization.h" #include "mojo/public/cpp/bindings/map_data_view.h" #include "mojo/public/cpp/bindings/native_enum.h" -#include "mojo/public/cpp/bindings/native_struct_data_view.h" #include "mojo/public/cpp/bindings/string_data_view.h" #include "{{module.path}}-shared-internal.h" {%- for import in imports %} #include "{{import.path}}-shared.h" {%- endfor %} +{% if allow_native_structs %} +#include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" +{%- endif %} + {%- if export_header %} #include "{{export_header}}" {%- endif %} @@ -66,7 +69,7 @@ {#--- Struct Forward Declarations -#} {%- for struct in structs %} {%- if struct|is_native_only_kind %} -using {{struct.name}}DataView = mojo::NativeStructDataView; +using {{struct.name}}DataView = mojo::native::NativeStructDataView; {%- else %} class {{struct.name}}DataView; {%- endif %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl index 6460ebac..a90f642 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -52,7 +52,6 @@ #include "mojo/public/cpp/bindings/lib/control_message_handler.h" #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" #include "mojo/public/cpp/bindings/lib/serialization.h" -#include "mojo/public/cpp/bindings/native_struct.h" #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" #include "mojo/public/cpp/bindings/struct_ptr.h" #include "mojo/public/cpp/bindings/struct_traits.h" @@ -78,6 +77,10 @@ #include "third_party/WebKit/Source/platform/wtf/text/WTFString.h" {%- endif %} +{% if allow_native_structs %} +#include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" +{%- endif %} + {%- for header in extra_public_headers %} #include "{{header}}" {%- endfor %} @@ -131,8 +134,8 @@ {#--- Struct Forward Declarations -#} {% for struct in structs %} {%- if struct|is_native_only_kind %} -using {{struct.name}} = mojo::NativeStruct; -using {{struct.name}}Ptr = mojo::NativeStructPtr; +using {{struct.name}} = mojo::native::NativeStruct; +using {{struct.name}}Ptr = mojo::native::NativeStructPtr; {%- else %} class {{struct.name}}; {%- if struct|should_inline %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl index 61799a8f..5571e84 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl
@@ -2,6 +2,8 @@ {%- set data_view = struct|get_qualified_name_for_kind ~ "DataView" %} {%- set data_type = struct|get_qualified_name_for_kind(internal=True) %} +{%- if not struct|use_custom_serializer %} + namespace internal { template <typename MaybeConstUserType> @@ -35,3 +37,5 @@ }; } // namespace internal + +{%- endif %}
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py index 08514cb7..c60e36d 100644 --- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -134,6 +134,10 @@ kind.native_only +def UseCustomSerializer(kind): + return mojom.IsStructKind(kind) and kind.custom_serializer + + def AllEnumValues(enum): """Return all enum values associated with an enum. @@ -286,6 +290,7 @@ return { "all_enums": all_enums, + "allow_native_structs": self.allow_native_structs, "enums": self.module.enums, "export_attribute": self.export_attribute, "export_header": self.export_header, @@ -359,6 +364,7 @@ "struct_constructors": self._GetStructConstructors, "under_to_camel": generator.ToCamel, "unmapped_type_for_serializer": self._GetUnmappedTypeForSerializer, + "use_custom_serializer": UseCustomSerializer, "wtf_hash_fn_name_for_enum": GetWtfHashFnNameForEnum, } return cpp_filters @@ -457,6 +463,8 @@ if mojom.IsNullableKind(kind): return False elif mojom.IsStructKind(kind): + if kind.native_only: + return False if (self._IsTypemappedKind(kind) and not self.typemap[self._GetFullMojomNameForKind(kind)]["hashable"]): return False
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 5018a7b..5fa42bf 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -174,6 +174,16 @@ # deserialization, and validation logic at the expensive of increased # code size. Defaults to |false|. # +# disable_variants (optional) +# If |true|, no variant sources will be generated for the target. Defaults +# to |false|. +# +# allow_native_structs (optional) +# If set to |true| (the default), mojoms in this target may apply the +# [Native] attribute to struct declarations, causing that mojom struct to +# be serialized and deserialized using a legacy IPC::ParamTraits +# specialization. +# # component_output_prefix (optional) # The prefix to use for the output_name of any component library emitted # for generated C++ bindings. If this is omitted, C++ bindings targets are @@ -313,6 +323,10 @@ rebase_path("$root_gen_dir/mojo/public/tools/bindings", root_build_dir), ] + if (!defined(invoker.allow_native_structs) || invoker.allow_native_structs) { + common_generator_args += [ "--allow_native_structs" ] + } + if (defined(invoker.import_dirs)) { foreach(import_dir, invoker.import_dirs) { common_generator_args += [ @@ -476,7 +490,14 @@ } # Generate code for variants. - foreach(bindings_configuration, _bindings_configurations) { + if (!defined(invoker.disable_variants) || !invoker.disable_variants) { + enabled_configurations = _bindings_configurations + } else { + first_config = _bindings_configurations[0] + assert(!defined(first_config.variant)) + enabled_configurations = [ first_config ] + } + foreach(bindings_configuration, enabled_configurations) { cpp_only = false if (defined(invoker.cpp_only)) { cpp_only = invoker.cpp_only
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.py b/mojo/public/tools/bindings/mojom_bindings_generator.py index cc81016..a12f891 100755 --- a/mojo/public/tools/bindings/mojom_bindings_generator.py +++ b/mojo/public/tools/bindings/mojom_bindings_generator.py
@@ -208,7 +208,8 @@ export_attribute=args.export_attribute, export_header=args.export_header, generate_non_variant_code=args.generate_non_variant_code, - support_lazy_serialization=args.support_lazy_serialization) + support_lazy_serialization=args.support_lazy_serialization, + allow_native_structs=args.allow_native_structs) filtered_args = [] if hasattr(generator_module, 'GENERATOR_PREFIX'): prefix = '--' + generator_module.GENERATOR_PREFIX + '_' @@ -367,6 +368,11 @@ "--support_lazy_serialization", help="If set, generated bindings will serialize lazily when possible.", action="store_true") + generate_parser.add_argument( + "--allow_native_structs", + help="Allows the [Native] attribute to be specified on structs within " + "the mojom file. Must not be specified on internal bindings mojom or " + "other dependencies thereof.", action="store_true") generate_parser.set_defaults(func=_Generate) precompile_parser = subparsers.add_parser("precompile",
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py index 4d81a13d..f59c33d 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
@@ -157,7 +157,7 @@ bytecode_path=None, for_blink=False, use_once_callback=False, js_bindings_mode="new", export_attribute=None, export_header=None, generate_non_variant_code=False, - support_lazy_serialization=False): + support_lazy_serialization=False, allow_native_structs=False): self.module = module self.output_dir = output_dir self.typemap = typemap or {} @@ -170,6 +170,7 @@ self.export_header = export_header self.generate_non_variant_code = generate_non_variant_code self.support_lazy_serialization = support_lazy_serialization + self.allow_native_structs = allow_native_structs def Write(self, contents, filename): if self.output_dir is None:
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py index 8208f7b..ebe5601 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -316,6 +316,8 @@ name: {str} The stylized name. native_only: {bool} Does the struct have a body (i.e. any fields) or is it purely a native struct. + custom_serializer: {bool} Should we generate a serializer for the struct or + will one be provided by non-generated code. fields: {List[StructField]} The members of the struct. enums: {List[Enum]} The enums defined in the struct scope. constants: {List[Constant]} The constants defined in the struct scope. @@ -326,6 +328,7 @@ ReferenceKind.AddSharedProperty('mojom_name') ReferenceKind.AddSharedProperty('name') ReferenceKind.AddSharedProperty('native_only') + ReferenceKind.AddSharedProperty('custom_serializer') ReferenceKind.AddSharedProperty('fields') ReferenceKind.AddSharedProperty('enums') ReferenceKind.AddSharedProperty('constants') @@ -339,6 +342,7 @@ ReferenceKind.__init__(self, spec, False, module) self.mojom_name = mojom_name self.native_only = False + self.custom_serializer = False self.fields = [] self.enums = [] self.constants = []
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/translate.py b/mojo/public/tools/bindings/pylib/mojom/generate/translate.py index f1d8f42..4153e745 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/translate.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/translate.py
@@ -273,6 +273,9 @@ raise Exception("Native-only struct declarations must include a " + "Native attribute.") + if struct.attributes and struct.attributes.get('CustomSerializer', False): + struct.custom_serializer = True + return struct def _Union(module, parsed_union):
diff --git a/net/BUILD.gn b/net/BUILD.gn index 15ba3e0..e9435574 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -1462,8 +1462,6 @@ "quic/quartc/quartc_stream.h", "quic/quartc/quartc_stream_interface.h", "quic/quartc/quartc_task_runner_interface.h", - "sdch/sdch_owner.cc", - "sdch/sdch_owner.h", "socket/client_socket_factory.cc", "socket/client_socket_factory.h", "socket/client_socket_pool.cc", @@ -1659,8 +1657,6 @@ "url_request/redirect_info.h", "url_request/report_sender.cc", "url_request/report_sender.h", - "url_request/sdch_dictionary_fetcher.cc", - "url_request/sdch_dictionary_fetcher.h", "url_request/static_http_user_agent_settings.cc", "url_request/static_http_user_agent_settings.h", "url_request/url_fetcher.cc", @@ -5072,7 +5068,6 @@ "quic/quartc/quartc_session_test.cc", "quic/quartc/quartc_stream_test.cc", "quic/test_tools/crypto_test_utils_test.cc", - "sdch/sdch_owner_unittest.cc", "socket/client_socket_pool_base_unittest.cc", "socket/mock_client_socket_pool_manager.cc", "socket/mock_client_socket_pool_manager.h", @@ -5176,7 +5171,6 @@ "tools/quic/quic_simple_client_test.cc", "tools/tld_cleanup/tld_cleanup_util_unittest.cc", "url_request/report_sender_unittest.cc", - "url_request/sdch_dictionary_fetcher_unittest.cc", "url_request/url_fetcher_impl_unittest.cc", "url_request/url_fetcher_response_writer_unittest.cc", "url_request/url_request_context_builder_mojo_unittest.cc",
diff --git a/net/sdch/OWNERS b/net/sdch/OWNERS deleted file mode 100644 index 748570f..0000000 --- a/net/sdch/OWNERS +++ /dev/null
@@ -1 +0,0 @@ -# COMPONENT: Internals>Network>SDCH
diff --git a/net/sdch/README.md b/net/sdch/README.md deleted file mode 100644 index 7735197..0000000 --- a/net/sdch/README.md +++ /dev/null
@@ -1,118 +0,0 @@ -# SDCH - -"SDCH" stands for "Shared Dictionary Compression over HTTP". It is a -protocol for compressing URL responses used when the server and -the client share a dictionary that can be referred to for -compression/encoding and decompression/decoding. The details of the -SDCH protocol are specified in -[the spec](https://docs.google.com/a/chromium.org/document/d/1REMkwjXY5yFOkJwtJPjCMwZ4Shx3D9vfdAytV_KQCUo/edit?pli=1) -(soon to be moved to github) but in brief: - -1. If the client supports SDCH decoding, it advertises "sdch" in the - "Accept-Encoding" header. -2. If the server could have encoded a response with a dictionary (but - didn't, because the client didn't have the dictionary), it includes - an advisory "Get-Dictionary: <url>" header in its response. -3. If the client has a dictionary that the server has previously - advertised as being usable for encoding a particular requests, it - advertises that dictionary as being available via an - "Avail-Dictionary: <hash>" header in the request. -4. If the server chooses to encode a response with a dictionary, it - includes "sdch" in a "Content-Encoding" header, in which case the - body will reference the dictionary to be used for decoding (which - must be one the client advertised in the original request). - Encodings may be chained; often responses are SDCH encoded, and then - gzip encoded. - -## SDCH in Chromium: Overview - -The SDCH implementation in Chromium is spread across several classes -in several different directories: - -* SdchManager (in net/base): This class contains all - dictionaries currently known to Chromium. Each URLRequestContext - points to an SdchManager; at the chrome/ level, there is one - SdchManager per profile. URLRequestHttpJob consults the SdchManager - for what dictionaries should be advertised with a URLRequest, and - notifies the SdchManager whenever it sees a "Get-Dictionary" - header. The SdchManager does *not* mediate fetching of - dictionaries; it is conceptually layered underneath URLRequest and - has no knowledge of URLRequests. There are several nested classes of - SdchManager (Dictionary, DictionarySet) used in the SDCH - implementation; see sdch_manager.h for details. -* SdchObserver (in net/base). This is an Abstract Base - Class which other classes may implement if those classes wish to - receive notifications about SDCH events. Such classes should also - register as observers with the SdchManager. -* SdchFilter (int net/filter). This class is derived from net::Filter - that is used for decoding the SDCH response; it cooperates with - SdchManager and the URLRequestJob to decode SDCH encoded responses. -* SdchDictionaryFetcher (int net/url_request): - This class implements the nuts&bolts of fetching an SDCH - dictionary. -* SdchOwner (in net/sdch): This class is an SdchObserver. - It contains policy for the SDCH implementation, including mediation - of fetching dictionaries, prioritization and eviction of - dictionaries in response to new fetches, and constraints on the - amount of memory that is usable by SDCH dictionaries. It initiates - dictionary fetches as appropriate when it receives notification of - a "Get-Dictionary" header from the SdchManager. - -A net/ embedder should instantiate an SdchManager and an SdchOwner, -and guarantee that the SdchManager outlive the SdchOwner. - -Note the layering of the above classes: - -1. The SdchManager class has no knowledge of URLRequests. URLRequest - is dependent on that class, not the reverse. -2. SdchDictionaryFetcher is dependent on URLRequest, but is still a - utility class exported by the net/ library for use by higher levels. -3. SdchOwner manages the entire system on behalf of the embedder. The - intent is that the embedder can change policies through methods on - SdchOwner, while letting the SdchOwner class take care of policy - implementation. - -## SDCH in Chromium: Debugging - -Data that is useful in debugging SDCH problems: - -* The SDCH UMA prefix is "Sdch3", and histograms that have been found - useful for debugging include - * ProblemCodes_* (though this requires trawling the source for each bucket). - * ResponseCorruptionDetection.{Cached,Uncached}: An attempt to make - sense of the twisted mess in SdchFilter::ReadFilteredData mentioned - above. - * BlacklistReason: Why requests avoid using SDCH when they could use - it. -* about:net-internals has an SDCH tab, showing loaded dictionaries and - other information. Searching in net-internals for "Get-Dictionary", - the URLRequest that actually fetches that dictionary, and then the - hash of that dictionary (often used as the file name) can also be - useful. - -## SDCH in Chromium: Gotchas and corner cases - -There are a couple of known issues in SDCH in Chromium that developers -in this space should be aware of: - -* As noted in the spec above, there have historically been problems - with middleboxes stripping or corrupting SDCH encoded responses. - For this reason, the protocol requires that if a server is not using - SDCH encoding when it has previously advertised the availability of - doing such, it includes an "X-SDCH-Encode: 0" header in the - response. Servers don't always do this (especially multi-servers), - and that can result in failed decodings and requests being dropped - on the floor. The code to handle this is a twisted mess (see - SdchFilter::ReadFilteredData()) and problems have often been seen - from or associated with it. -* If the decoding logic trips over a problem, it will often blacklist - the server in question, temporarily (if it can recover that request) - or permanently (if it can't). This can lead to a mysterious lack of - SDCH encoding when it's expected to be present. -* The network cache currently stores the response precisely as received from - the network. This means that requests that don't advertise SDCH - may get a cached value that is SDCH encoded, and requests that do - advertise SDCH may get a cached value that is not SDCH encoded. - The second case is handled transparently, but the first case may - lead to request failure. -
diff --git a/net/sdch/sdch_owner.cc b/net/sdch/sdch_owner.cc deleted file mode 100644 index 55cc92f..0000000 --- a/net/sdch/sdch_owner.cc +++ /dev/null
@@ -1,758 +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 "net/sdch/sdch_owner.h" - -#include <utility> - -#include "base/bind.h" -#include "base/debug/alias.h" -#include "base/logging.h" -#include "base/macros.h" -#include "base/memory/memory_coordinator_client_registry.h" -#include "base/memory/ptr_util.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/string_util.h" -#include "base/time/default_clock.h" -#include "base/values.h" -#include "net/base/sdch_manager.h" -#include "net/base/sdch_net_log_params.h" -#include "net/log/net_log_event_type.h" -#include "net/log/net_log_with_source.h" - -namespace net { - -namespace { - -// Dictionaries that haven't been touched in 24 hours may be evicted -// to make room for new dictionaries. -const int kFreshnessLifetimeHours = 24; - -// Dictionaries that have never been used only stay fresh for one hour. -const int kNeverUsedFreshnessLifetimeHours = 1; - -void RecordPersistenceFailure( - SdchOwner::PrefStorage::ReadError failure_reason) { - UMA_HISTOGRAM_ENUMERATION( - "Sdch3.PersistenceFailureReason", failure_reason, - SdchOwner::PrefStorage::PERSISTENCE_FAILURE_REASON_MAX); -} - -// Schema specifications and access routines. - -// The persistent prefs store is conceptually shared with any other network -// stack systems that want to persist data over browser restarts, and so -// use of it must be namespace restricted. -// Schema: -// pref_store_->GetValue() -> Dictionary { -// 'version' -> 2 [int] -// 'dictionaries' -> Dictionary { -// server_hash -> { -// 'url' -> URL [string] -// 'last_used' -> seconds since unix epoch [double] -// 'created_time' -> seconds since unix epoch [double] -// 'use_count' -> use count [int] -// 'size' -> size [int] -// } -// } -const char kVersionKey[] = "version"; -const char kDictionariesKey[] = "dictionaries"; -const char kDictionaryUrlKey[] = "url"; -const char kDictionaryLastUsedKey[] = "last_used"; -const char kDictionaryCreatedTimeKey[] = "created_time"; -const char kDictionaryUseCountKey[] = "use_count"; -const char kDictionarySizeKey[] = "size"; - -const int kVersion = 2; - -// A simple implementation of pref storage that just stores the value in -// memory. -class ValueMapPrefStorage : public SdchOwner::PrefStorage { - public: - ValueMapPrefStorage() {} - ~ValueMapPrefStorage() override {} - - ReadError GetReadError() const override { return PERSISTENCE_FAILURE_NONE; } - - bool GetValue(const base::DictionaryValue** result) const override { - *result = &storage_; - return true; - } - bool GetMutableValue(base::DictionaryValue** result) override { - *result = &storage_; - return true; - } - void SetValue(std::unique_ptr<base::DictionaryValue> value) override { - storage_.Clear(); - storage_.MergeDictionary(value.get()); - } - - void ReportValueChanged() override {} - - // This storage class requires no special initialization. - bool IsInitializationComplete() override { return true; } - void StartObservingInit(SdchOwner* observer) override {} - void StopObservingInit() override {} - - private: - base::DictionaryValue storage_; - - DISALLOW_COPY_AND_ASSIGN(ValueMapPrefStorage); -}; - -// This function returns store[kPreferenceName/kDictionariesKey]. The caller -// is responsible for making sure any needed calls to -// |store->ReportValueChanged()| occur. -base::DictionaryValue* GetPersistentStoreDictionaryMap( - SdchOwner::PrefStorage* store) { - base::DictionaryValue* preference_dictionary = nullptr; - bool success = store->GetMutableValue(&preference_dictionary); - DCHECK(success); - - base::DictionaryValue* dictionary_list_dictionary = nullptr; - success = preference_dictionary->GetDictionary(kDictionariesKey, - &dictionary_list_dictionary); - DCHECK(success); - DCHECK(dictionary_list_dictionary); - - return dictionary_list_dictionary; -} - -// This function initializes a pref store with an empty version of the -// above schema, removing anything previously in the store under -// kPreferenceName. -void InitializePrefStore(SdchOwner::PrefStorage* store) { - std::unique_ptr<base::DictionaryValue> empty_store(new base::DictionaryValue); - empty_store->SetInteger(kVersionKey, kVersion); - empty_store->Set(kDictionariesKey, std::make_unique<base::DictionaryValue>()); - store->SetValue(std::move(empty_store)); -} - -// A class to allow iteration over all dictionaries in the pref store, and -// easy lookup of the information associated with those dictionaries. -// Note that this is an "Iterator" in the same sense (and for the same -// reasons) that base::Dictionary::Iterator is an iterator--it allows -// iterating over all the dictionaries in the preference store, but it -// does not allow use as an STL iterator because the container it -// is iterating over does not export begin()/end() methods. This iterator can -// only be safely used on sanitized pref stores that are known to conform to the -// pref store schema. -class DictionaryPreferenceIterator { - public: - explicit DictionaryPreferenceIterator(SdchOwner::PrefStorage* pref_store); - - bool IsAtEnd() const; - void Advance(); - - const std::string& server_hash() const { return server_hash_; } - const GURL& url() const { return url_; } - base::Time last_used() const { return last_used_; } - base::Time created_time() const { return created_time_; } - int use_count() const { return use_count_; } - int size() const { return size_; } - - private: - // Load Dictionary silently skipping any that are malformed. - void LoadNextDictionary(); - // Try to load Dictionary from current iterator's position. Returns true if - // succeeded. - bool TryLoadDictionary(); - - std::string server_hash_; - GURL url_; - base::Time last_used_; - base::Time created_time_; - int use_count_; - int size_; - - base::DictionaryValue::Iterator dictionary_iterator_; -}; - -DictionaryPreferenceIterator::DictionaryPreferenceIterator( - SdchOwner::PrefStorage* pref_store) - : use_count_(0), - size_(0), - dictionary_iterator_(*GetPersistentStoreDictionaryMap(pref_store)) { - LoadNextDictionary(); -} - -bool DictionaryPreferenceIterator::IsAtEnd() const { - return dictionary_iterator_.IsAtEnd(); -} - -void DictionaryPreferenceIterator::Advance() { - dictionary_iterator_.Advance(); - LoadNextDictionary(); -} - -void DictionaryPreferenceIterator::LoadNextDictionary() { - while (!IsAtEnd()) { - if (TryLoadDictionary()) - return; - dictionary_iterator_.Advance(); - } -} - -bool DictionaryPreferenceIterator::TryLoadDictionary() { - const base::DictionaryValue* dict = nullptr; - - bool success = dictionary_iterator_.value().GetAsDictionary(&dict); - if (!success) - return false; - - server_hash_ = dictionary_iterator_.key(); - - std::string url_spec; - success = dict->GetString(kDictionaryUrlKey, &url_spec); - if (!success) - return false; - url_ = GURL(url_spec); - - double last_used_seconds_from_epoch = 0; - success = - dict->GetDouble(kDictionaryLastUsedKey, &last_used_seconds_from_epoch); - if (!success) - return false; - last_used_ = base::Time::FromDoubleT(last_used_seconds_from_epoch); - - success = dict->GetInteger(kDictionaryUseCountKey, &use_count_); - if (!success) - return false; - - success = dict->GetInteger(kDictionarySizeKey, &size_); - if (!success) - return false; - - double created_time_seconds = 0; - success = dict->GetDouble(kDictionaryCreatedTimeKey, &created_time_seconds); - if (!success) - return false; - created_time_ = base::Time::FromDoubleT(created_time_seconds); - - return true; -} - -// Triggers a ReportValueChanged() when the object goes out of scope. -class ScopedPrefNotifier { - public: - // Caller must guarantee lifetime of |*pref_store| exceeds the - // lifetime of this object. - ScopedPrefNotifier(SdchOwner::PrefStorage* pref_store) - : pref_store_(pref_store) { - DCHECK(pref_store); - } - ~ScopedPrefNotifier() { pref_store_->ReportValueChanged(); } - - private: - SdchOwner::PrefStorage* pref_store_; - - DISALLOW_COPY_AND_ASSIGN(ScopedPrefNotifier); -}; - -} // namespace - -// Adjust SDCH limits downwards for mobile. -#if defined(OS_ANDROID) || defined(OS_IOS) -// static -const size_t SdchOwner::kMaxTotalDictionarySize = 2 * 500 * 1000; -#else -// static -const size_t SdchOwner::kMaxTotalDictionarySize = 20 * 1000 * 1000; -#endif - -SdchOwner::PrefStorage::~PrefStorage() {} - -// Somewhat arbitrary, but we assume a dictionary smaller than -// 50K isn't going to do anyone any good. Note that this still doesn't -// prevent download and addition unless there is less than this -// amount of space available in storage. -const size_t SdchOwner::kMinSpaceForDictionaryFetch = 50 * 1000; - -void SdchOwner::RecordDictionaryFate(enum DictionaryFate fate) { - UMA_HISTOGRAM_ENUMERATION("Sdch3.DictionaryFate", fate, DICTIONARY_FATE_MAX); -} - -void SdchOwner::RecordDictionaryEvictionOrUnload(const std::string& server_hash, - size_t size, - int use_count, - DictionaryFate fate) { - DCHECK(fate == DICTIONARY_FATE_EVICT_FOR_DICT || - fate == DICTIONARY_FATE_EVICT_FOR_MEMORY || - fate == DICTIONARY_FATE_EVICT_FOR_DESTRUCTION || - fate == DICTIONARY_FATE_UNLOAD_FOR_DESTRUCTION); - - UMA_HISTOGRAM_COUNTS_100("Sdch3.DictionaryUseCount", use_count); - RecordDictionaryFate(fate); - - DCHECK(load_times_.count(server_hash) == 1); - base::Time now = clock_->Now(); - base::TimeDelta dict_lifetime = now - load_times_[server_hash]; - consumed_byte_seconds_.push_back(size * dict_lifetime.InMilliseconds()); - load_times_.erase(server_hash); -} - -SdchOwner::SdchOwner(SdchManager* sdch_manager, URLRequestContext* context) - : manager_(sdch_manager), - fetcher_(new SdchDictionaryFetcher(context)), - total_dictionary_bytes_(0), - clock_(new base::DefaultClock), - max_total_dictionary_size_(kMaxTotalDictionarySize), - min_space_for_dictionary_fetch_(kMinSpaceForDictionaryFetch), - memory_pressure_listener_( - base::Bind(&SdchOwner::OnMemoryPressure, - // Because |memory_pressure_listener_| is owned by - // SdchOwner, the SdchOwner object will be available - // for the lifetime of |memory_pressure_listener_|. - base::Unretained(this))), - in_memory_pref_store_(new ValueMapPrefStorage()), - external_pref_store_(nullptr), - pref_store_(in_memory_pref_store_.get()), - creation_time_(clock_->Now()) { - manager_->AddObserver(this); - InitializePrefStore(pref_store_); - base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); -} - -SdchOwner::~SdchOwner() { - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - int new_uses = it.use_count() - use_counts_at_load_[it.server_hash()]; - DictionaryFate fate = IsPersistingDictionaries() ? - DICTIONARY_FATE_UNLOAD_FOR_DESTRUCTION : - DICTIONARY_FATE_EVICT_FOR_DESTRUCTION; - RecordDictionaryEvictionOrUnload(it.server_hash(), it.size(), new_uses, - fate); - } - manager_->RemoveObserver(this); - - // This object only observes the external store during loading, - // i.e. before it's made the default preferences store. - if (external_pref_store_ && pref_store_ != external_pref_store_.get()) - external_pref_store_->StopObservingInit(); - - int64_t object_lifetime = (clock_->Now() - creation_time_).InMilliseconds(); - for (const auto& val : consumed_byte_seconds_) { - if (object_lifetime > 0) { - // Objects that are created and immediately destroyed don't add any memory - // pressure over time (and also cause a crash here). - UMA_HISTOGRAM_MEMORY_KB("Sdch3.TimeWeightedMemoryUse", - val / object_lifetime); - } - } - base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); -} - -void SdchOwner::EnablePersistentStorage( - std::unique_ptr<PrefStorage> pref_store) { - DCHECK(!external_pref_store_); - DCHECK(pref_store); - external_pref_store_ = std::move(pref_store); - external_pref_store_->StartObservingInit(this); - - if (external_pref_store_->IsInitializationComplete()) - OnPrefStorageInitializationComplete(true); -} - -void SdchOwner::SetMaxTotalDictionarySize(size_t max_total_dictionary_size) { - max_total_dictionary_size_ = max_total_dictionary_size; -} - -void SdchOwner::SetMinSpaceForDictionaryFetch( - size_t min_space_for_dictionary_fetch) { - min_space_for_dictionary_fetch_ = min_space_for_dictionary_fetch; -} - -void SdchOwner::OnDictionaryFetched(base::Time last_used, - base::Time created_time, - int use_count, - const std::string& dictionary_text, - const GURL& dictionary_url, - const NetLogWithSource& net_log, - bool was_from_cache) { - struct DictionaryItem { - base::Time last_used; - std::string server_hash; - int use_count; - size_t dictionary_size; - - DictionaryItem() : use_count(0), dictionary_size(0) {} - DictionaryItem(const base::Time& last_used, - const std::string& server_hash, - int use_count, - size_t dictionary_size) - : last_used(last_used), - server_hash(server_hash), - use_count(use_count), - dictionary_size(dictionary_size) {} - DictionaryItem(const DictionaryItem& rhs) = default; - DictionaryItem& operator=(const DictionaryItem& rhs) = default; - bool operator<(const DictionaryItem& rhs) const { - return last_used < rhs.last_used; - } - }; - - if (!was_from_cache) - UMA_HISTOGRAM_COUNTS_1M("Sdch3.NetworkBytesSpent", dictionary_text.size()); - - // Figure out if there is space for the incoming dictionary; evict - // stale dictionaries if needed to make space. - - std::vector<DictionaryItem> stale_dictionary_list; - size_t recoverable_bytes = 0; - base::Time now(clock_->Now()); - // Dictionaries whose last used time is before |stale_boundary| are candidates - // for eviction if necessary. - base::Time stale_boundary( - now - base::TimeDelta::FromHours(kFreshnessLifetimeHours)); - // Dictionaries that have never been used and are from before - // |never_used_stale_boundary| are candidates for eviction if necessary. - base::Time never_used_stale_boundary( - now - base::TimeDelta::FromHours(kNeverUsedFreshnessLifetimeHours)); - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - if (it.last_used() < stale_boundary || - (it.use_count() == 0 && it.last_used() < never_used_stale_boundary)) { - stale_dictionary_list.push_back(DictionaryItem( - it.last_used(), it.server_hash(), it.use_count(), it.size())); - recoverable_bytes += it.size(); - } - } - - if (total_dictionary_bytes_ + dictionary_text.size() - recoverable_bytes > - max_total_dictionary_size_) { - RecordDictionaryFate(DICTIONARY_FATE_FETCH_IGNORED_NO_SPACE); - SdchManager::SdchErrorRecovery(SDCH_DICTIONARY_NO_ROOM); - net_log.AddEvent(NetLogEventType::SDCH_DICTIONARY_ERROR, - base::Bind(&NetLogSdchDictionaryFetchProblemCallback, - SDCH_DICTIONARY_NO_ROOM, dictionary_url, true)); - return; - } - - // Add the new dictionary. This is done before removing the stale - // dictionaries so that no state change will occur if dictionary addition - // fails. - std::string server_hash; - SdchProblemCode rv = manager_->AddSdchDictionary( - dictionary_text, dictionary_url, &server_hash); - if (rv != SDCH_OK) { - RecordDictionaryFate(DICTIONARY_FATE_FETCH_MANAGER_REFUSED); - SdchManager::SdchErrorRecovery(rv); - net_log.AddEvent(NetLogEventType::SDCH_DICTIONARY_ERROR, - base::Bind(&NetLogSdchDictionaryFetchProblemCallback, rv, - dictionary_url, true)); - return; - } - - base::DictionaryValue* pref_dictionary_map = - GetPersistentStoreDictionaryMap(pref_store_); - ScopedPrefNotifier scoped_pref_notifier(pref_store_); - - // Remove the old dictionaries. - std::sort(stale_dictionary_list.begin(), stale_dictionary_list.end()); - size_t avail_bytes = max_total_dictionary_size_ - total_dictionary_bytes_; - auto stale_it = stale_dictionary_list.begin(); - while (avail_bytes < dictionary_text.size() && - stale_it != stale_dictionary_list.end()) { - manager_->RemoveSdchDictionary(stale_it->server_hash); - - DCHECK(pref_dictionary_map->HasKey(stale_it->server_hash)); - bool success = pref_dictionary_map->RemoveWithoutPathExpansion( - stale_it->server_hash, nullptr); - DCHECK(success); - - avail_bytes += stale_it->dictionary_size; - - int new_uses = stale_it->use_count - - use_counts_at_load_[stale_it->server_hash]; - RecordDictionaryEvictionOrUnload(stale_it->server_hash, - stale_it->dictionary_size, - new_uses, - DICTIONARY_FATE_EVICT_FOR_DICT); - - ++stale_it; - } - DCHECK_GE(avail_bytes, dictionary_text.size()); - - RecordDictionaryFate( - // Distinguish between loads triggered by network responses and - // loads triggered by persistence. - last_used.is_null() ? DICTIONARY_FATE_ADD_RESPONSE_TRIGGERED - : DICTIONARY_FATE_ADD_PERSISTENCE_TRIGGERED); - - // If a dictionary has never been used, its dictionary addition time - // is recorded as its last used time. Never used dictionaries are treated - // specially in the freshness logic. - if (last_used.is_null()) - last_used = clock_->Now(); - - total_dictionary_bytes_ += dictionary_text.size(); - - // Record the addition in the pref store. - std::unique_ptr<base::DictionaryValue> dictionary_description( - new base::DictionaryValue()); - dictionary_description->SetString(kDictionaryUrlKey, dictionary_url.spec()); - dictionary_description->SetDouble(kDictionaryLastUsedKey, - last_used.ToDoubleT()); - dictionary_description->SetDouble(kDictionaryCreatedTimeKey, - created_time.ToDoubleT()); - dictionary_description->SetInteger(kDictionaryUseCountKey, use_count); - dictionary_description->SetInteger(kDictionarySizeKey, - dictionary_text.size()); - pref_dictionary_map->Set(server_hash, std::move(dictionary_description)); - load_times_[server_hash] = clock_->Now(); -} - -void SdchOwner::OnDictionaryAdded(const GURL& dictionary_url, - const std::string& server_hash) { } - -void SdchOwner::OnDictionaryRemoved(const std::string& server_hash) { } - -void SdchOwner::OnDictionaryUsed(const std::string& server_hash) { - base::Time now(clock_->Now()); - base::DictionaryValue* pref_dictionary_map = - GetPersistentStoreDictionaryMap(pref_store_); - ScopedPrefNotifier scoped_pref_notifier(pref_store_); - - base::Value* value = nullptr; - bool success = pref_dictionary_map->Get(server_hash, &value); - if (!success) { - // SdchManager::GetDictionarySet() pins the referenced dictionaries in - // memory past a possible deletion. For this reason, OnDictionaryUsed() - // notifications may occur after SdchOwner thinks that dictionaries - // have been deleted. - SdchManager::SdchErrorRecovery(SDCH_DICTIONARY_USED_AFTER_DELETION); - return; - } - base::DictionaryValue* specific_dictionary_map = nullptr; - success = value->GetAsDictionary(&specific_dictionary_map); - DCHECK(success); - - double last_used_seconds_since_epoch = 0.0; - success = specific_dictionary_map->GetDouble(kDictionaryLastUsedKey, - &last_used_seconds_since_epoch); - DCHECK(success); - int use_count = 0; - success = - specific_dictionary_map->GetInteger(kDictionaryUseCountKey, &use_count); - DCHECK(success); - - if (use_counts_at_load_.count(server_hash) == 0) { - use_counts_at_load_[server_hash] = use_count; - } - - base::TimeDelta time_since_last_used(now - - base::Time::FromDoubleT(last_used_seconds_since_epoch)); - - if (use_count) { - UMA_HISTOGRAM_CUSTOM_TIMES("Sdch3.UsageInterval2", time_since_last_used, - base::TimeDelta(), base::TimeDelta::FromDays(7), - 50); - } else { - double created_time = 0; - success = specific_dictionary_map->GetDouble(kDictionaryCreatedTimeKey, - &created_time); - DCHECK(success); - base::TimeDelta time_since_created(now - - base::Time::FromDoubleT(created_time)); - UMA_HISTOGRAM_CUSTOM_TIMES("Sdch3.FirstUseInterval", time_since_created, - base::TimeDelta(), base::TimeDelta::FromDays(7), - 50); - } - - specific_dictionary_map->SetDouble(kDictionaryLastUsedKey, now.ToDoubleT()); - specific_dictionary_map->SetInteger(kDictionaryUseCountKey, use_count + 1); -} - -void SdchOwner::OnGetDictionary(const GURL& request_url, - const GURL& dictionary_url) { - base::Time stale_boundary(clock_->Now() - base::TimeDelta::FromDays(1)); - size_t avail_bytes = 0; - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - if (it.last_used() < stale_boundary) - avail_bytes += it.size(); - } - - // Don't initiate the fetch if we wouldn't be able to store any - // reasonable dictionary. - // TODO(rdsmith): Maybe do a HEAD request to figure out how much - // storage we'd actually need? - if (max_total_dictionary_size_ < (total_dictionary_bytes_ - avail_bytes + - min_space_for_dictionary_fetch_)) { - RecordDictionaryFate(DICTIONARY_FATE_GET_IGNORED); - // TODO(rdsmith): Log a net-internals error. This requires - // SdchManager to forward the URLRequest that detected the - // Get-Dictionary header to its observers, which is tricky - // because SdchManager is layered underneath URLRequest. - return; - } - - fetcher_->Schedule( - dictionary_url, - base::Bind(&SdchOwner::OnDictionaryFetched, - // SdchOwner will outlive its member variables. - base::Unretained(this), base::Time(), base::Time::Now(), 0)); -} - -void SdchOwner::OnClearDictionaries() { - total_dictionary_bytes_ = 0; - fetcher_->Cancel(); - - InitializePrefStore(pref_store_); -} - -void SdchOwner::OnPrefStorageInitializationComplete(bool succeeded) { - PrefStorage::ReadError error = external_pref_store_->GetReadError(); - // Errors on load are self-correcting; if dictionaries were not - // persisted from the last instance of the browser, they will be - // faulted in by user action over time. However, if a load error - // means that the dictionary information won't be able to be persisted, - // the in memory pref store is left in place. - if (!succeeded) { - // Failure means a write failed, since read failures are recoverable. - external_pref_store_->StopObservingInit(); - external_pref_store_ = nullptr; - RecordPersistenceFailure( - PrefStorage::PERSISTENCE_FAILURE_REASON_WRITE_FAILED); - return; - } - - if (error != PrefStorage::PERSISTENCE_FAILURE_NONE) - RecordPersistenceFailure(error); - - // Load in what was stored before chrome exited previously. - const base::DictionaryValue* sdch_persistence_dictionary = nullptr; - - // The GetPersistentStore() routine above assumes data formatted - // according to the schema described at the top of this file. Since - // this data comes from disk, to avoid disk corruption resulting in - // persistent chrome errors this code avoids those assupmtions. - if (external_pref_store_->GetValue(&sdch_persistence_dictionary)) - SchedulePersistedDictionaryLoads(*sdch_persistence_dictionary); - - // Reset the persistent store and update it with the accumulated - // information from the local store. - InitializePrefStore(external_pref_store_.get()); - - ScopedPrefNotifier scoped_pref_notifier(external_pref_store_.get()); - GetPersistentStoreDictionaryMap(external_pref_store_.get()) - ->Swap(GetPersistentStoreDictionaryMap(in_memory_pref_store_.get())); - - // This object can stop waiting on (i.e. observing) the external preference - // store and switch over to using it as the primary preference store. - pref_store_ = external_pref_store_.get(); - external_pref_store_->StopObservingInit(); - in_memory_pref_store_ = nullptr; -} - -void SdchOwner::SetClockForTesting(std::unique_ptr<base::Clock> clock) { - clock_ = std::move(clock); -} - -int SdchOwner::GetDictionaryCountForTesting() const { - int count = 0; - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - count++; - } - return count; -} - -bool SdchOwner::HasDictionaryFromURLForTesting(const GURL& url) const { - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - if (it.url() == url) - return true; - } - return false; -} - -void SdchOwner::SetFetcherForTesting( - std::unique_ptr<SdchDictionaryFetcher> fetcher) { - fetcher_ = std::move(fetcher); -} - -void SdchOwner::OnMemoryPressure( - base::MemoryPressureListener::MemoryPressureLevel level) { - DCHECK_NE(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE, level); - ClearData(); -} - -void SdchOwner::OnPurgeMemory() { - ClearData(); -} - -void SdchOwner::ClearData() { - for (DictionaryPreferenceIterator it(pref_store_); !it.IsAtEnd(); - it.Advance()) { - int new_uses = it.use_count() - use_counts_at_load_[it.server_hash()]; - RecordDictionaryEvictionOrUnload(it.server_hash(), - it.size(), - new_uses, - DICTIONARY_FATE_EVICT_FOR_MEMORY); - } - - // TODO(rdsmith): Make a distinction between moderate and critical - // memory pressure. - manager_->ClearData(); -} - -bool SdchOwner::SchedulePersistedDictionaryLoads( - const base::DictionaryValue& persisted_info) { - // Any schema error will result in dropping the persisted info. - int version = 0; - if (!persisted_info.GetInteger(kVersionKey, &version)) - return false; - - // Any version mismatch will result in dropping the persisted info; - // it will be faulted in at small performance cost as URLs using - // dictionaries for encoding are visited. - if (version != kVersion) - return false; - - const base::DictionaryValue* dictionary_set = nullptr; - if (!persisted_info.GetDictionary(kDictionariesKey, &dictionary_set)) - return false; - - // Any formatting error will result in skipping that particular - // dictionary. - for (base::DictionaryValue::Iterator dict_it(*dictionary_set); - !dict_it.IsAtEnd(); dict_it.Advance()) { - const base::DictionaryValue* dict_info = nullptr; - if (!dict_it.value().GetAsDictionary(&dict_info)) - continue; - - std::string url_string; - if (!dict_info->GetString(kDictionaryUrlKey, &url_string)) - continue; - GURL dict_url(url_string); - - double last_used = 0; - if (!dict_info->GetDouble(kDictionaryLastUsedKey, &last_used)) - continue; - - int use_count = 0; - if (!dict_info->GetInteger(kDictionaryUseCountKey, &use_count)) - continue; - - double created_time = 0; - if (!dict_info->GetDouble(kDictionaryCreatedTimeKey, &created_time)) - continue; - - fetcher_->ScheduleReload( - dict_url, - base::Bind(&SdchOwner::OnDictionaryFetched, - // SdchOwner will outlive its member variables. - base::Unretained(this), base::Time::FromDoubleT(last_used), - base::Time::FromDoubleT(created_time), use_count)); - } - - return true; -} - -bool SdchOwner::IsPersistingDictionaries() const { - return in_memory_pref_store_.get() != nullptr; -} - -} // namespace net
diff --git a/net/sdch/sdch_owner.h b/net/sdch/sdch_owner.h deleted file mode 100644 index 35260a7..0000000 --- a/net/sdch/sdch_owner.h +++ /dev/null
@@ -1,280 +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 NET_SDCH_SDCH_OWNER_H_ -#define NET_SDCH_SDCH_OWNER_H_ - -#include <stddef.h> -#include <stdint.h> - -#include <map> -#include <string> - -#include "base/macros.h" -#include "base/memory/memory_coordinator_client.h" -#include "base/memory/memory_pressure_listener.h" -#include "base/memory/ref_counted.h" -#include "net/base/net_export.h" -#include "net/base/sdch_observer.h" -#include "net/url_request/sdch_dictionary_fetcher.h" - -class GURL; - -namespace base { -class Clock; -} - -namespace net { -class NetLogWithSource; -class SdchManager; -class URLRequestContext; - -// This class owns the SDCH objects not owned as part of URLRequestContext, and -// exposes interface for setting SDCH policy. It should be instantiated by -// the net/ embedder. -// TODO(rdsmith): Implement dictionary prioritization. -class NET_EXPORT SdchOwner : public SdchObserver, - public base::MemoryCoordinatorClient { - public: - // Abstact storage interface for storing settings that allows the embedder - // to provide the appropriate storage backend. - class NET_EXPORT PrefStorage { - public: - // Possible values returned by GetReadError. This is a subset of the error - // values of Chromium's pref storage that we care about. - // - // DO NOT CHANGE VALUES. This is logged persistently in a histogram. - enum ReadError { - PERSISTENCE_FAILURE_NONE = 0, - - // File didn't exist; is being created. - PERSISTENCE_FAILURE_REASON_NO_FILE = 1, - - // Error reading in information, but should be able to write. - PERSISTENCE_FAILURE_REASON_READ_FAILED = 2, - - // Error leading to abort on attempted persistence. - PERSISTENCE_FAILURE_REASON_WRITE_FAILED = 3, - - // Anything else. - PERSISTENCE_FAILURE_REASON_OTHER = 4, - - PERSISTENCE_FAILURE_REASON_MAX = 5 - // See RecordPersistenceFailure for UMA logging of this value if - // adding a value here. - }; - - virtual ~PrefStorage(); - - // Returns the read error if any. Valid to be called after initialization - // is complete (see IsInitializationComplete). - virtual ReadError GetReadError() const = 0; - - // Gets or sets the value in the preferences store. - virtual bool GetValue(const base::DictionaryValue** result) const = 0; - virtual bool GetMutableValue(base::DictionaryValue** result) = 0; - virtual void SetValue(std::unique_ptr<base::DictionaryValue> value) = 0; - - // Notifies the storage system that a value was changed via mutating the - // result of GetMutableValue(). - virtual void ReportValueChanged() = 0; - - // Returns true if the store's init is complete. See the Start/Stop - // functions below for observing changes to this value. - virtual bool IsInitializationComplete() = 0; - - // Starts and stops observing preferences storage init. There will only - // be one observer active at a time. The store should call - // OnPrefStorageInitializationComplete() when it transitions to initialized - // and there is an observer active. See also IsInitializationComplete(). - virtual void StartObservingInit(SdchOwner* observer) = 0; - virtual void StopObservingInit() = 0; - }; - - static const size_t kMaxTotalDictionarySize; - static const size_t kMinSpaceForDictionaryFetch; - - // Consumer must guarantee that |sdch_manager| and |context| outlive - // this object. - SdchOwner(SdchManager* sdch_manager, URLRequestContext* context); - ~SdchOwner() override; - - // Enables use of pref persistence. Ownership of the storage will be passed. - // This routine may only be called once per SdchOwner instance. - void EnablePersistentStorage(std::unique_ptr<PrefStorage> pref_store); - - // Defaults to kMaxTotalDictionarySize. - void SetMaxTotalDictionarySize(size_t max_total_dictionary_size); - - // Defaults to kMinSpaceForDictionaryFetch. - void SetMinSpaceForDictionaryFetch(size_t min_space_for_dictionary_fetch); - - // SdchObserver implementation. - void OnDictionaryAdded(const GURL& dictionary_url, - const std::string& server_hash) override; - void OnDictionaryRemoved(const std::string& server_hash) override; - void OnDictionaryUsed(const std::string& server_hash) override; - void OnGetDictionary(const GURL& request_url, - const GURL& dictionary_url) override; - void OnClearDictionaries() override; - - // Called by the PrefStorage implementation when initialization is complete. - // See PrefStorage::StartObservingInit(). - void OnPrefStorageInitializationComplete(bool succeeded); - - // Implementation detail--this is the function callback by the callback passed - // to the fetcher through which the fetcher informs the SdchOwner that it's - // gotten the dictionary. The first two arguments are bound locally. - // Public for testing. - void OnDictionaryFetched(base::Time last_used, - base::Time created_time, - int use_count, - const std::string& dictionary_text, - const GURL& dictionary_url, - const NetLogWithSource& net_log, - bool was_from_cache); - - void SetClockForTesting(std::unique_ptr<base::Clock> clock); - - // Returns the total number of dictionaries loaded. - int GetDictionaryCountForTesting() const; - - // Returns whether this SdchOwner has dictionary from |url| loaded. - bool HasDictionaryFromURLForTesting(const GURL& url) const; - - void SetFetcherForTesting(std::unique_ptr<SdchDictionaryFetcher> fetcher); - - private: - // For each active dictionary, stores local info. - // Indexed by the server hash of the dictionary. - struct DictionaryInfo { - base::Time last_used; - int use_count; - size_t size; - - DictionaryInfo() : use_count(0), size(0) {} - DictionaryInfo(const base::Time& last_used, size_t size) - : last_used(last_used), use_count(0), size(size) {} - DictionaryInfo(const DictionaryInfo& rhs) = default; - DictionaryInfo& operator=(const DictionaryInfo& rhs) = default; - }; - - // base::MemoryCoordinatorClient implementation: - void OnPurgeMemory() override; - - void OnMemoryPressure( - base::MemoryPressureListener::MemoryPressureLevel level); - - // Clears data to save memory usage. - void ClearData(); - - // Schedule loading of all dictionaries described in |persisted_info|. - // Returns false and does not schedule a load if |persisted_info| has an - // unsupported version or no dictionaries key. Skips any dictionaries that are - // malformed in |persisted_info|. - bool SchedulePersistedDictionaryLoads( - const base::DictionaryValue& persisted_info); - - bool IsPersistingDictionaries() const; - - enum DictionaryFate { - // A Get-Dictionary header wasn't acted on. - DICTIONARY_FATE_GET_IGNORED = 1, - - // A fetch was attempted, but failed. - // TODO(rdsmith): Actually record this case. - DICTIONARY_FATE_FETCH_FAILED = 2, - - // A successful fetch was dropped on the floor, no space. - DICTIONARY_FATE_FETCH_IGNORED_NO_SPACE = 3, - - // A successful fetch was refused by the SdchManager. - DICTIONARY_FATE_FETCH_MANAGER_REFUSED = 4, - - // A dictionary was successfully added based on - // a Get-Dictionary header in a response. - DICTIONARY_FATE_ADD_RESPONSE_TRIGGERED = 5, - - // A dictionary was evicted by an incoming dict. - DICTIONARY_FATE_EVICT_FOR_DICT = 6, - - // A dictionary was evicted by memory pressure. - DICTIONARY_FATE_EVICT_FOR_MEMORY = 7, - - // A dictionary was evicted on destruction. - DICTIONARY_FATE_EVICT_FOR_DESTRUCTION = 8, - - // A dictionary was successfully added based on - // persistence from a previous browser revision. - DICTIONARY_FATE_ADD_PERSISTENCE_TRIGGERED = 9, - - // A dictionary was unloaded on destruction, but is still present on disk. - DICTIONARY_FATE_UNLOAD_FOR_DESTRUCTION = 10, - - DICTIONARY_FATE_MAX = 11 - }; - - void RecordDictionaryFate(DictionaryFate fate); - - // Record the lifetime memory use of a specified dictionary, identified by - // server hash. - void RecordDictionaryEvictionOrUnload( - const std::string& server_hash, - size_t size, - int use_count, DictionaryFate fate); - - net::SdchManager* manager_; - std::unique_ptr<net::SdchDictionaryFetcher> fetcher_; - - size_t total_dictionary_bytes_; - - std::unique_ptr<base::Clock> clock_; - - size_t max_total_dictionary_size_; - size_t min_space_for_dictionary_fetch_; - - base::MemoryPressureListener memory_pressure_listener_; - - // Dictionary persistence machinery. - // * |in_memory_pref_store_| is created on construction and used in the - // absence of any call to EnablePersistentStorage(). - // * |external_pref_store_| holds the preference store specified by - // EnablePersistentStorage() (if any). - // * The external pref store is initialized asynchronously. During this time, - // both pointers will be value, pref_store_ will point to the in-memory - // one, and this class will be observing the initialization of the external - // store. - // * When the external pref store is initialized, the in-memory version will - // be freed, and pref_store_ will point to the external one. - // * |pref_store_| holds an unowned pointer to the currently - // active pref store (one of the preceding two). - std::unique_ptr<PrefStorage> in_memory_pref_store_; - std::unique_ptr<PrefStorage> external_pref_store_; - PrefStorage* pref_store_; - - // The use counts of dictionaries when they were loaded from the persistent - // store, keyed by server hash. These are stored to avoid generating - // misleading ever-increasing use counts for dictionaries that are persisted, - // since the UMA histogram for use counts is only supposed to be since last - // load. - std::map<std::string, int> use_counts_at_load_; - - // Load times for loaded dictionaries, keyed by server hash. These are used to - // track the durations that dictionaries are in memory. - std::map<std::string, base::Time> load_times_; - - // Byte-seconds consumed by dictionaries that have been unloaded. These are - // stored for later uploading in the SdchOwner destructor. - std::vector<int64_t> consumed_byte_seconds_; - - // Creation time for this SdchOwner object, used for reporting temporal memory - // pressure. - base::Time creation_time_; - - DISALLOW_COPY_AND_ASSIGN(SdchOwner); -}; - -} // namespace net - -#endif // NET_SDCH_SDCH_OWNER_H_
diff --git a/net/sdch/sdch_owner_unittest.cc b/net/sdch/sdch_owner_unittest.cc deleted file mode 100644 index 846ad79b..0000000 --- a/net/sdch/sdch_owner_unittest.cc +++ /dev/null
@@ -1,1016 +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 "net/sdch/sdch_owner.h" - -#include <utility> - -#include "base/location.h" -#include "base/macros.h" -#include "base/memory/memory_pressure_listener.h" -#include "base/memory/ptr_util.h" -#include "base/run_loop.h" -#include "base/single_thread_task_runner.h" -#include "base/strings/stringprintf.h" -#include "base/test/histogram_tester.h" -#include "base/test/simple_test_clock.h" -#include "base/threading/thread_task_runner_handle.h" -#include "base/values.h" -#include "net/base/sdch_manager.h" -#include "net/log/net_log_with_source.h" -#include "net/url_request/url_request.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_error_job.h" -#include "net/url_request/url_request_job.h" -#include "net/url_request/url_request_job_factory.h" -#include "net/url_request/url_request_test_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace net { - -namespace { - -bool GetDictionaryForURL(SdchOwner::PrefStorage* store, - const GURL& url, - std::string* hash, - base::DictionaryValue** dict) { - base::DictionaryValue* sdch_dict = nullptr; - if (!store->GetMutableValue(&sdch_dict)) - return false; - - base::DictionaryValue* dicts_dict = nullptr; - if (!sdch_dict->GetDictionary("dictionaries", &dicts_dict)) - return false; - - base::DictionaryValue::Iterator it(*dicts_dict); - while (!it.IsAtEnd()) { - const base::DictionaryValue* d = nullptr; - if (!it.value().GetAsDictionary(&d)) - continue; - std::string dict_url; - if (d->GetString("url", &dict_url) && dict_url == url.spec()) { - if (hash) - *hash = it.key(); - if (dict) - dicts_dict->GetDictionary(it.key(), dict); - return true; - } - it.Advance(); - } - - return false; -} - -// This class supports copying so we can emulate persistent storage. -class TestPrefStorage : public SdchOwner::PrefStorage { - public: - explicit TestPrefStorage(bool initialized) - : initialized_(initialized), initialization_observer_(nullptr) {} - explicit TestPrefStorage(const TestPrefStorage& other) - : initialized_(other.initialized_), - initialization_observer_(nullptr) { // Don't copy observer. - storage_.MergeDictionary(&other.storage_); - } - - ~TestPrefStorage() override {} - - void SetInitialized() { - DCHECK(!initialized_); - initialized_ = true; - if (initialization_observer_) - initialization_observer_->OnPrefStorageInitializationComplete(true); - } - - ReadError GetReadError() const override { return PERSISTENCE_FAILURE_NONE; } - - bool GetValue(const base::DictionaryValue** result) const override { - *result = &storage_; - return true; - } - bool GetMutableValue(base::DictionaryValue** result) override { - *result = &storage_; - return true; - } - void SetValue(std::unique_ptr<base::DictionaryValue> value) override { - storage_.Clear(); - storage_.MergeDictionary(value.get()); - } - - void ReportValueChanged() override {} - - // This storage class requires no special initialization. - bool IsInitializationComplete() override { return initialized_; } - void StartObservingInit(SdchOwner* observer) override { - DCHECK(!initialization_observer_); - initialization_observer_ = observer; - } - void StopObservingInit() override { initialization_observer_ = nullptr; } - - private: - bool initialized_; - SdchOwner* initialization_observer_; - - base::DictionaryValue storage_; -}; - -} // namespace - -static const char generic_url[] = "http://www.example.com"; -static const char generic_domain[] = "www.example.com"; - -static std::string NewSdchDictionary(size_t dictionary_size) { - std::string dictionary; - dictionary.append("Domain: "); - dictionary.append(generic_domain); - dictionary.append("\n"); - dictionary.append("\n"); - - size_t original_dictionary_size = dictionary.size(); - dictionary.resize(dictionary_size); - for (size_t i = original_dictionary_size; i < dictionary_size; ++i) - dictionary[i] = static_cast<char>((i % 127) + 1); - - return dictionary; -} - -int outstanding_url_request_error_counting_jobs = 0; -base::Closure* empty_url_request_jobs_callback = 0; - -// Variation of URLRequestErrorJob to count number of outstanding -// instances and notify when that goes to zero. -class URLRequestErrorCountingJob : public URLRequestJob { - public: - URLRequestErrorCountingJob(URLRequest* request, - NetworkDelegate* network_delegate, - int error) - : URLRequestJob(request, network_delegate), - error_(error), - weak_factory_(this) { - ++outstanding_url_request_error_counting_jobs; - } - - void Start() override { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&URLRequestErrorCountingJob::StartAsync, - weak_factory_.GetWeakPtr())); - } - - private: - ~URLRequestErrorCountingJob() override { - --outstanding_url_request_error_counting_jobs; - if (0 == outstanding_url_request_error_counting_jobs && - empty_url_request_jobs_callback) { - empty_url_request_jobs_callback->Run(); - } - } - - void StartAsync() { - NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error_)); - } - - int error_; - - base::WeakPtrFactory<URLRequestErrorCountingJob> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(URLRequestErrorCountingJob); -}; - -static int error_jobs_created = 0; - -class MockURLRequestJobFactory : public URLRequestJobFactory { - public: - MockURLRequestJobFactory() {} - - ~MockURLRequestJobFactory() override {} - - URLRequestJob* MaybeCreateJobWithProtocolHandler( - const std::string& scheme, - URLRequest* request, - NetworkDelegate* network_delegate) const override { - ++error_jobs_created; - return new URLRequestErrorCountingJob(request, network_delegate, - ERR_INTERNET_DISCONNECTED); - } - - URLRequestJob* MaybeInterceptRedirect(URLRequest* request, - NetworkDelegate* network_delegate, - const GURL& location) const override { - return nullptr; - } - - URLRequestJob* MaybeInterceptResponse( - URLRequest* request, - NetworkDelegate* network_delegate) const override { - return nullptr; - } - - bool IsHandledProtocol(const std::string& scheme) const override { - return scheme == "http"; - }; - - bool IsSafeRedirectTarget(const GURL& location) const override { - return false; - } -}; - -class MockSdchDictionaryFetcher : public SdchDictionaryFetcher { - public: - MockSdchDictionaryFetcher() : SdchDictionaryFetcher(&test_context_) {} - ~MockSdchDictionaryFetcher() {} - - struct PendingRequest { - PendingRequest(const GURL& url, - const OnDictionaryFetchedCallback& callback) - : url_(url), callback_(callback) {} - GURL url_; - OnDictionaryFetchedCallback callback_; - }; - - virtual bool Schedule(const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback) { - if (!HasPendingRequest(dictionary_url)) { - requests_.push_back(PendingRequest(dictionary_url, callback)); - return true; - } - return false; - } - - virtual bool ScheduleReload(const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback) { - if (!HasPendingRequest(dictionary_url)) { - requests_.push_back(PendingRequest(dictionary_url, callback)); - return true; - } - return false; - } - - virtual void Cancel() { - requests_.clear(); - } - - bool HasPendingRequest(const GURL& dictionary_url) { - for (std::vector<PendingRequest>::iterator it = requests_.begin(); - it != requests_.end(); ++it) { - if (it->url_ == dictionary_url) - return true; - } - return false; - } - - bool CompletePendingRequest(const GURL& dictionary_url, - const std::string& dictionary_text, - const NetLogWithSource& net_log, - bool was_from_cache) { - for (std::vector<PendingRequest>::iterator it = requests_.begin(); - it != requests_.end(); ++it) { - if (it->url_ == dictionary_url) { - it->callback_.Run(dictionary_text, dictionary_url, net_log, - was_from_cache); - requests_.erase(it); - return true; - } - } - return false; - } - - private: - TestURLRequestContext test_context_; - std::vector<PendingRequest> requests_; - DISALLOW_COPY_AND_ASSIGN(MockSdchDictionaryFetcher); -}; - -// File testing infrastructure summary: -// * NewSdchDictionary(): Creates a dictionary of a specific size. -// * URLRequestErrorCountingJob: A URLRequestJob that returns an error -// and counts the number of outstanding (started but not finished) -// jobs, and calls a global callback when that number transitions to zero. -// * MockURLRequestJobFactory: Factory to create the above jobs. Tracks -// the number of jobs created. -// * SdchOwnerTest: Interfaces -// * Access manager, owner, and net log -// * Return the number of jobs created in a time interval -// * Return dictionary present in the manager -// * Notify SdchOwner of an incoming dictionary (& wait until jobs clear) -// * Attempt to add a dictionary and test for success. -// Test patterns: -// * Let the owner know about a Get-Dictionary header and test for -// appropriate jobs being created. -// * Let the owner know that a dictionary was successfully fetched -// and test for appropriate outcome. -// * Either of the above, having previously added dictionaries to create -// a particular initial state. -class SdchOwnerTest : public testing::Test { - public: - static const size_t kMaxSizeForTesting = 1000 * 50; - static const size_t kMinFetchSpaceForTesting = 500; - - SdchOwnerTest() - : last_jobs_created_(error_jobs_created), - dictionary_creation_index_(0), - sdch_owner_(new SdchOwner(&sdch_manager_, &url_request_context_)) { - // Any jobs created on this context will immediately error, - // which leaves the test in control of signals to SdchOwner. - url_request_context_.set_job_factory(&job_factory_); - - // Reduce sizes to reduce time for string operations. - sdch_owner_->SetMaxTotalDictionarySize(kMaxSizeForTesting); - sdch_owner_->SetMinSpaceForDictionaryFetch(kMinFetchSpaceForTesting); - } - - SdchManager& sdch_manager() { return sdch_manager_; } - SdchOwner& sdch_owner() { return *(sdch_owner_.get()); } - NetLogWithSource& net_log() { return net_log_; } - - int JobsRecentlyCreated() { - int result = error_jobs_created - last_jobs_created_; - last_jobs_created_ = error_jobs_created; - return result; - } - - bool DictionaryPresentInManager(const std::string& server_hash) { - // Presumes all tests use generic url. - SdchProblemCode tmp; - std::unique_ptr<SdchManager::DictionarySet> set( - sdch_manager_.GetDictionarySetByHash(GURL(generic_url), server_hash, - &tmp)); - return !!set.get(); - } - - void WaitForNoJobs() { - if (outstanding_url_request_error_counting_jobs == 0) - return; - - base::RunLoop run_loop; - base::Closure quit_closure(run_loop.QuitClosure()); - empty_url_request_jobs_callback = &quit_closure; - run_loop.Run(); - empty_url_request_jobs_callback = NULL; - } - - void SignalGetDictionaryAndClearJobs(GURL request_url, GURL dictionary_url) { - sdch_owner().OnGetDictionary(request_url, dictionary_url); - WaitForNoJobs(); - } - - // Create a unique (by hash) dictionary of the given size, - // associate it with a unique URL, add it to the manager through - // SdchOwner::OnDictionaryFetched(), and return whether that - // addition was successful or not. - bool CreateAndAddDictionary(size_t size, - base::Time last_used_time, - base::Time created_time, - std::string* server_hash_p) { - GURL dictionary_url( - base::StringPrintf("%s/d%d", generic_url, dictionary_creation_index_)); - std::string dictionary_text(NewSdchDictionary(size - 4)); - dictionary_text += base::StringPrintf("%04d", dictionary_creation_index_); - ++dictionary_creation_index_; - std::string client_hash; - std::string server_hash; - SdchManager::GenerateHash(dictionary_text, &client_hash, &server_hash); - - if (DictionaryPresentInManager(server_hash)) - return false; - sdch_owner().OnDictionaryFetched(last_used_time, created_time, 0, - dictionary_text, dictionary_url, net_log_, - false); - if (server_hash_p) - *server_hash_p = server_hash; - return DictionaryPresentInManager(server_hash); - } - - bool CreateAndAddDictionary(size_t size, - base::Time last_used_time, - std::string* server_hash_p) { - return CreateAndAddDictionary(size, last_used_time, base::Time(), - server_hash_p); - } - - void ResetOwner() { - sdch_owner_.reset(new SdchOwner(&sdch_manager_, &url_request_context_)); - } - - private: - int last_jobs_created_; - NetLogWithSource net_log_; - int dictionary_creation_index_; - - // The dependencies of these objects (sdch_owner_ -> {sdch_manager_, - // url_request_context_}, url_request_context_->job_factory_) require - // this order for correct destruction semantics. - MockURLRequestJobFactory job_factory_; - URLRequestContext url_request_context_; - SdchManager sdch_manager_; - std::unique_ptr<SdchOwner> sdch_owner_; - - DISALLOW_COPY_AND_ASSIGN(SdchOwnerTest); -}; - -// Does OnGetDictionary result in a fetch when there's enough space, and not -// when there's not? -TEST_F(SdchOwnerTest, OnGetDictionary_Fetching) { - GURL request_url(std::string(generic_url) + "/r1"); - - // Fetch generated when empty. - GURL dict_url1(std::string(generic_url) + "/d1"); - EXPECT_EQ(0, JobsRecentlyCreated()); - SignalGetDictionaryAndClearJobs(request_url, dict_url1); - EXPECT_EQ(1, JobsRecentlyCreated()); - - // Fetch generated when half full. - GURL dict_url2(std::string(generic_url) + "/d2"); - std::string dictionary1(NewSdchDictionary(kMaxSizeForTesting / 2)); - sdch_owner().OnDictionaryFetched(base::Time::Now(), base::Time::Now(), 1, - dictionary1, dict_url1, net_log(), false); - EXPECT_EQ(0, JobsRecentlyCreated()); - SignalGetDictionaryAndClearJobs(request_url, dict_url2); - EXPECT_EQ(1, JobsRecentlyCreated()); - - // Fetch not generated when close to completely full. - GURL dict_url3(std::string(generic_url) + "/d3"); - std::string dictionary2(NewSdchDictionary( - (kMaxSizeForTesting / 2 - kMinFetchSpaceForTesting / 2))); - sdch_owner().OnDictionaryFetched(base::Time::Now(), base::Time::Now(), 1, - dictionary2, dict_url2, net_log(), false); - EXPECT_EQ(0, JobsRecentlyCreated()); - SignalGetDictionaryAndClearJobs(request_url, dict_url3); - EXPECT_EQ(0, JobsRecentlyCreated()); -} - -// Make sure attempts to add dictionaries do what they should. -TEST_F(SdchOwnerTest, OnDictionaryFetched_Fetching) { - GURL request_url(std::string(generic_url) + "/r1"); - std::string client_hash; - std::string server_hash; - - // In the past, but still fresh for an unused dictionary. - base::Time dictionary_last_used_time(base::Time::Now() - - base::TimeDelta::FromMinutes(30)); - - // Add successful when empty. - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 2, - dictionary_last_used_time, nullptr)); - EXPECT_EQ(0, JobsRecentlyCreated()); - - // Add successful when half full. - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 2, - dictionary_last_used_time, nullptr)); - EXPECT_EQ(0, JobsRecentlyCreated()); - - // Add unsuccessful when full. - EXPECT_FALSE(CreateAndAddDictionary(kMaxSizeForTesting / 2, - dictionary_last_used_time, nullptr)); - EXPECT_EQ(0, JobsRecentlyCreated()); -} - -// Confirm auto-eviction happens if space is needed. -TEST_F(SdchOwnerTest, ConfirmAutoEviction) { - base::Time start_time = base::Time::Now(); - std::string server_hash_d1; - std::string server_hash_d2; - std::string server_hash_d3; - - base::SimpleTestClock* test_clock = new base::SimpleTestClock(); - sdch_owner().SetClockForTesting(base::WrapUnique(test_clock)); - test_clock->SetNow(base::Time::Now()); - - // Add two dictionaries, one recent, one more than a day in the past. - base::Time fresh(base::Time::Now() - base::TimeDelta::FromHours(23)); - base::Time stale(base::Time::Now() - base::TimeDelta::FromHours(25)); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d1)); - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, stale, &server_hash_d2)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - - base::HistogramTester tester; - const base::TimeDelta synthetic_delta = base::TimeDelta::FromSeconds(5); - - test_clock->Advance(synthetic_delta); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d3)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - - base::TimeDelta expected_proc_lifetime = synthetic_delta * 3 + - base::Time::Now() - start_time; - size_t expected_value_base = ((kMaxSizeForTesting / 2) * - synthetic_delta.InMilliseconds()) / - expected_proc_lifetime.InMilliseconds(); - - const char *kHistogram = "Sdch3.TimeWeightedMemoryUse"; - tester.ExpectTotalCount(kHistogram, 0); - - // Dictionary insertions and deletions: - // T = 0: insert d1 and d2 - // T = 5: insert d3, which evicts d2 - // T = 15: destroy SdchOwner, which evicts d1 and d3 - // Therefore, d2's lifetime is synthetic_delta, d1's is synthetic_delta * 3, - // and d3's is synthetic_delta * 2. The expected_value_base variable is the - // base factor for d2's memory consumption, of which d1's and d3's are - // multiples. - test_clock->Advance(synthetic_delta * 2); - ResetOwner(); - - tester.ExpectTotalCount(kHistogram, 3); - tester.ExpectBucketCount(kHistogram, expected_value_base, 1); - tester.ExpectBucketCount(kHistogram, expected_value_base * 2, 1); - tester.ExpectBucketCount(kHistogram, expected_value_base * 3, 1); -} - -// Confirm auto-eviction happens if space is needed, with a more complicated -// situation -TEST_F(SdchOwnerTest, ConfirmAutoEviction_2) { - std::string server_hash_d1; - std::string server_hash_d2; - std::string server_hash_d3; - - // Add dictionaries, one recent, two more than a day in the past that - // between them add up to the space needed. - base::Time fresh(base::Time::Now() - base::TimeDelta::FromHours(23)); - base::Time stale(base::Time::Now() - base::TimeDelta::FromHours(25)); - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d1)); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 4, stale, &server_hash_d2)); - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 4, stale, &server_hash_d3)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - - std::string server_hash_d4; - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d4)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d3)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d4)); -} - -// Confirm if only one dictionary needs to be evicted it's the oldest. -TEST_F(SdchOwnerTest, ConfirmAutoEviction_Oldest) { - std::string server_hash_d1; - std::string server_hash_d2; - std::string server_hash_d3; - - // Add dictionaries, one recent, one two days in the past, and one - // four days in the past. - base::Time fresh(base::Time::Now() - base::TimeDelta::FromHours(23)); - base::Time stale_newer(base::Time::Now() - base::TimeDelta::FromHours(47)); - base::Time stale_older(base::Time::Now() - base::TimeDelta::FromHours(71)); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 4, fresh, &server_hash_d1)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_newer, - &server_hash_d2)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_older, - &server_hash_d3)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - - // The addition of a new dictionary should succeed, evicting only the - // oldest one. - - std::string server_hash_d4; - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d4)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d3)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d4)); -} - -// Confirm using a dictionary changes eviction behavior properly. -TEST_F(SdchOwnerTest, UseChangesEviction) { - std::string server_hash_d1; - std::string server_hash_d2; - std::string server_hash_d3; - - // Add dictionaries, one recent, one two days in the past, and one - // four days in the past. - base::Time fresh(base::Time::Now() - base::TimeDelta::FromHours(23)); - base::Time stale_newer(base::Time::Now() - base::TimeDelta::FromHours(47)); - base::Time stale_older(base::Time::Now() - base::TimeDelta::FromHours(71)); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 4, fresh, &server_hash_d1)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_newer, - &server_hash_d2)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_older, - &server_hash_d3)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - - // Use the oldest dictionary. - sdch_owner().OnDictionaryUsed(server_hash_d3); - - // The addition of a new dictionary should succeed, evicting only the - // newer stale one. - std::string server_hash_d4; - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d4)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d4)); -} - -// Confirm using a dictionary can prevent the addition of a new dictionary. -TEST_F(SdchOwnerTest, UsePreventsAddition) { - std::string server_hash_d1; - std::string server_hash_d2; - std::string server_hash_d3; - - // Add dictionaries, one recent, one two days in the past, and one - // four days in the past. - base::Time fresh(base::Time::Now() - base::TimeDelta::FromMinutes(30)); - base::Time stale_newer(base::Time::Now() - base::TimeDelta::FromHours(47)); - base::Time stale_older(base::Time::Now() - base::TimeDelta::FromHours(71)); - - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting / 4, fresh, &server_hash_d1)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_newer, - &server_hash_d2)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 4, stale_older, - &server_hash_d3)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - - // Use the older dictionaries. - sdch_owner().OnDictionaryUsed(server_hash_d2); - sdch_owner().OnDictionaryUsed(server_hash_d3); - - // The addition of a new dictionary should fail, not evicting anything. - std::string server_hash_d4; - EXPECT_FALSE( - CreateAndAddDictionary(kMaxSizeForTesting / 2, fresh, &server_hash_d4)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d3)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d4)); -} - -// Confirm clear gets all the space back. -TEST_F(SdchOwnerTest, ClearReturnsSpace) { - std::string server_hash_d1; - std::string server_hash_d2; - - // Take up all the space. - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), - &server_hash_d1)); - // Addition should fail. - EXPECT_FALSE(CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), - &server_hash_d2)); - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - sdch_manager().ClearData(); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - - // Addition should now succeed. - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), nullptr)); -} - -// Confirm memory pressure gets all the space back. -TEST_F(SdchOwnerTest, MemoryPressureReturnsSpace) { - std::string server_hash_d1; - std::string server_hash_d2; - - // Take up all the space. - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), - &server_hash_d1)); - - // Addition should fail. - EXPECT_FALSE(CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), - &server_hash_d2)); - - EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - - base::MemoryPressureListener::NotifyMemoryPressure( - base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE); - // The notification may have (implementation note: does :-}) use a PostTask, - // so we drain the local message queue. This should be safe (i.e. not have - // an inifinite number of messages) in a unit test. - base::RunLoop().RunUntilIdle(); - - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1)); - EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); - - // Addition should now succeed. - EXPECT_TRUE( - CreateAndAddDictionary(kMaxSizeForTesting, base::Time::Now(), nullptr)); -} - -// Confirm that use of a pinned dictionary after its removal works properly. -TEST_F(SdchOwnerTest, PinRemoveUse) { - // Pass ownership of the storage to the SdchOwner, but keep a pointer. - TestPrefStorage* pref_store = new TestPrefStorage(true); - sdch_owner().EnablePersistentStorage( - std::unique_ptr<SdchOwner::PrefStorage>(pref_store)); - - std::string server_hash_d1; - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 2, base::Time::Now(), - &server_hash_d1)); - - std::unique_ptr<SdchManager::DictionarySet> return_set( - sdch_manager().GetDictionarySet( - GURL(std::string(generic_url) + "/x.html"))); - ASSERT_TRUE(return_set.get()); - EXPECT_TRUE(return_set->GetDictionaryText(server_hash_d1)); - - const base::Value* result = nullptr; - const base::DictionaryValue* dict_result = nullptr; - ASSERT_TRUE(pref_store->GetValue(&dict_result)); - EXPECT_TRUE(dict_result->Get("dictionaries", &result)); - EXPECT_TRUE(dict_result->Get("dictionaries." + server_hash_d1, &result)); - - sdch_manager().ClearData(); - - ASSERT_TRUE(pref_store->GetValue(&dict_result)); - EXPECT_TRUE(dict_result->Get("dictionaries", &result)); - EXPECT_FALSE(dict_result->Get("dictionaries." + server_hash_d1, &result)); - - std::unique_ptr<SdchManager::DictionarySet> return_set2( - sdch_manager().GetDictionarySet( - GURL(std::string(generic_url) + "/x.html"))); - EXPECT_FALSE(return_set2.get()); - - sdch_manager().OnDictionaryUsed(server_hash_d1); - - ASSERT_TRUE(pref_store->GetValue(&dict_result)); - EXPECT_TRUE(dict_result->Get("dictionaries", &result)); - EXPECT_FALSE(dict_result->Get("dictionaries." + server_hash_d1, &result)); -} - -TEST_F(SdchOwnerTest, UsageIntervalMetrics) { - const GURL url("http://www.example.com/dict0"); - - std::string server_hash; - base::Time last_used_time(base::Time::Now() - base::TimeDelta::FromHours(23)); - base::Time created_time(base::Time::Now() - base::TimeDelta::FromHours(47)); - - EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting / 3, last_used_time, - created_time, &server_hash)); - - base::HistogramTester tester; - - sdch_owner().OnDictionaryUsed(server_hash); - tester.ExpectTotalCount("Sdch3.FirstUseInterval", 1); - tester.ExpectTotalCount("Sdch3.UsageInterval2", 0); - - sdch_owner().OnDictionaryUsed(server_hash); - tester.ExpectTotalCount("Sdch3.FirstUseInterval", 1); // count didn't change - tester.ExpectTotalCount("Sdch3.UsageInterval2", 1); -} - -class SdchOwnerPersistenceTest : public ::testing::Test { - public: - SdchOwnerPersistenceTest() {} - virtual ~SdchOwnerPersistenceTest() {} - - void ClearOwner() { - owner_.reset(NULL); - } - - // If the storage points is non-null it will be saved as the persistent - // storage for the SdchOwner. - void ResetOwner(std::unique_ptr<SdchOwner::PrefStorage> storage) { - // This has to be done first, since SdchOwner may be observing SdchManager, - // and SdchManager can't be destroyed with a live observer. - owner_.reset(NULL); - manager_.reset(new SdchManager()); - fetcher_ = new MockSdchDictionaryFetcher(); - owner_.reset(new SdchOwner(manager_.get(), - &url_request_context_)); - owner_->SetMaxTotalDictionarySize(SdchOwnerTest::kMaxSizeForTesting); - owner_->SetMinSpaceForDictionaryFetch( - SdchOwnerTest::kMinFetchSpaceForTesting); - owner_->SetFetcherForTesting(base::WrapUnique(fetcher_)); - if (storage) - owner_->EnablePersistentStorage(std::move(storage)); - } - - void InsertDictionaryForURL(const GURL& url, const std::string& nonce) { - owner_->OnDictionaryFetched(base::Time::Now(), base::Time::Now(), 1, - CreateDictionary(url, nonce), url, net_log_, - false); - } - - bool CompleteLoadFromURL(const GURL& url, const std::string& nonce, - bool was_from_cache) { - return fetcher_->CompletePendingRequest(url, CreateDictionary(url, nonce), - net_log_, was_from_cache); - } - - std::string CreateDictionary(const GURL& url, const std::string& nonce) { - std::string dict; - dict.append("Domain: "); - dict.append(url.host()); - dict.append("\n\n"); - dict.append(url.spec()); - dict.append(nonce); - return dict; - } - - protected: - NetLogWithSource net_log_; - std::unique_ptr<SdchManager> manager_; - MockSdchDictionaryFetcher* fetcher_; - std::unique_ptr<SdchOwner> owner_; - TestURLRequestContext url_request_context_; -}; - -// Test an empty persistence store. -TEST_F(SdchOwnerPersistenceTest, Empty) { - ResetOwner(base::WrapUnique(new TestPrefStorage(true))); - EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); -} - -// Test a persistence store with a bad version number. -TEST_F(SdchOwnerPersistenceTest, Persistent_BadVersion) { - std::unique_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); - sdch_dict->SetInteger("version", 2); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - storage->SetValue(std::move(sdch_dict)); - - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - - storage.reset(new TestPrefStorage(*old_storage)); - ResetOwner(std::move(storage)); - EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); -} - -// Test a persistence store with an empty dictionaries map. -TEST_F(SdchOwnerPersistenceTest, Persistent_EmptyDictList) { - std::unique_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); - std::unique_ptr<base::DictionaryValue> dicts(new base::DictionaryValue()); - sdch_dict->SetInteger("version", 1); - sdch_dict->Set("dictionaries", std::move(dicts)); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - storage->SetValue(std::move(sdch_dict)); - ResetOwner(std::move(storage)); - EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); -} - -TEST_F(SdchOwnerPersistenceTest, OneDict) { - const GURL url("http://www.example.com/dict"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); - InsertDictionaryForURL(url, "0"); - EXPECT_EQ(1, owner_->GetDictionaryCountForTesting()); - - storage.reset(new TestPrefStorage(*old_storage)); - ResetOwner(std::move(storage)); - EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); - EXPECT_TRUE(CompleteLoadFromURL(url, "0", true)); - EXPECT_EQ(1, owner_->GetDictionaryCountForTesting()); -} - -TEST_F(SdchOwnerPersistenceTest, TwoDicts) { - const GURL url0("http://www.example.com/dict0"); - const GURL url1("http://www.example.com/dict1"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - InsertDictionaryForURL(url0, "0"); - InsertDictionaryForURL(url1, "1"); - - storage.reset(new TestPrefStorage(*old_storage)); - ResetOwner(std::move(storage)); - EXPECT_TRUE(CompleteLoadFromURL(url0, "0", true)); - EXPECT_TRUE(CompleteLoadFromURL(url1, "1", true)); - EXPECT_EQ(2, owner_->GetDictionaryCountForTesting()); - EXPECT_TRUE(owner_->HasDictionaryFromURLForTesting(url0)); - EXPECT_TRUE(owner_->HasDictionaryFromURLForTesting(url1)); -} - -TEST_F(SdchOwnerPersistenceTest, OneGoodDictOneBadDict) { - const GURL url0("http://www.example.com/dict0"); - const GURL url1("http://www.example.com/dict1"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage. - InsertDictionaryForURL(url0, "0"); - InsertDictionaryForURL(url1, "1"); - - // Make a new storage based on the current contents of the old one. - storage.reset(new TestPrefStorage(*old_storage)); - base::DictionaryValue* dict = nullptr; - ASSERT_TRUE(GetDictionaryForURL(storage.get(), url1, nullptr, &dict)); - dict->Remove("use_count", nullptr); - - ResetOwner(std::move(storage)); - EXPECT_TRUE(CompleteLoadFromURL(url0, "0", true)); - EXPECT_FALSE(CompleteLoadFromURL(url1, "1", true)); - EXPECT_EQ(1, owner_->GetDictionaryCountForTesting()); - EXPECT_TRUE(owner_->HasDictionaryFromURLForTesting(url0)); - EXPECT_FALSE(owner_->HasDictionaryFromURLForTesting(url1)); -} - -TEST_F(SdchOwnerPersistenceTest, UsingDictionaryUpdatesUseCount) { - const GURL url("http://www.example.com/dict"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - InsertDictionaryForURL(url, "0"); - - std::string hash; - int old_count; - storage.reset(new TestPrefStorage(*old_storage)); - { - ClearOwner(); - base::DictionaryValue* dict = nullptr; - ASSERT_TRUE(GetDictionaryForURL(storage.get(), url, &hash, &dict)); - ASSERT_TRUE(dict->GetInteger("use_count", &old_count)); - } - - old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - ASSERT_TRUE(CompleteLoadFromURL(url, "0", true)); - owner_->OnDictionaryUsed(hash); - - int new_count; - { - base::DictionaryValue* dict = nullptr; - ASSERT_TRUE(GetDictionaryForURL(old_storage, url, nullptr, &dict)); - ASSERT_TRUE(dict->GetInteger("use_count", &new_count)); - } - - EXPECT_EQ(old_count + 1, new_count); -} - -TEST_F(SdchOwnerPersistenceTest, LoadingDictionaryMerges) { - const GURL url0("http://www.example.com/dict0"); - const GURL url1("http://www.example.com/dict1"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - InsertDictionaryForURL(url1, "1"); - - storage.reset(new TestPrefStorage(*old_storage)); - ResetOwner(std::unique_ptr<SdchOwner::PrefStorage>()); - InsertDictionaryForURL(url0, "0"); - EXPECT_EQ(1, owner_->GetDictionaryCountForTesting()); - owner_->EnablePersistentStorage(std::move(storage)); - ASSERT_TRUE(CompleteLoadFromURL(url1, "1", true)); - EXPECT_EQ(2, owner_->GetDictionaryCountForTesting()); -} - -TEST_F(SdchOwnerPersistenceTest, PersistenceMetrics) { - const GURL url0("http://www.example.com/dict0"); - const GURL url1("http://www.example.com/dict1"); - - std::unique_ptr<TestPrefStorage> storage(new TestPrefStorage(true)); - TestPrefStorage* old_storage = storage.get(); // Save storage pointer. - ResetOwner(std::move(storage)); // Takes ownership of storage pointer. - - InsertDictionaryForURL(url0, "0"); - InsertDictionaryForURL(url1, "1"); - - storage.reset(new TestPrefStorage(*old_storage)); - ResetOwner(std::move(storage)); - - base::HistogramTester tester; - - EXPECT_TRUE(CompleteLoadFromURL(url0, "0", true)); - EXPECT_TRUE(CompleteLoadFromURL(url1, "1", false)); - - tester.ExpectTotalCount("Sdch3.NetworkBytesSpent", 1); - tester.ExpectUniqueSample("Sdch3.NetworkBytesSpent", - CreateDictionary(url1, "1").size(), 1); -} - -} // namespace net
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index b7ec2a64..7d69a275 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -901,6 +901,12 @@ case kTLS13VariantNoSessionIDExperiment: SSL_set_tls13_variant(ssl_.get(), tls13_no_session_id_experiment); break; + case kTLS13VariantExperiment2: + SSL_set_tls13_variant(ssl_.get(), tls13_experiment2); + break; + case kTLS13VariantExperiment3: + SSL_set_tls13_variant(ssl_.get(), tls13_experiment3); + break; } // OpenSSL defaults some options to on, others to off. To avoid ambiguity,
diff --git a/net/ssl/ssl_config.h b/net/ssl/ssl_config.h index 01dae35..e6f02854 100644 --- a/net/ssl/ssl_config.h +++ b/net/ssl/ssl_config.h
@@ -40,6 +40,8 @@ kTLS13VariantExperiment, kTLS13VariantRecordTypeExperiment, kTLS13VariantNoSessionIDExperiment, + kTLS13VariantExperiment2, + kTLS13VariantExperiment3, }; // Default minimum protocol version.
diff --git a/net/url_request/sdch_dictionary_fetcher.cc b/net/url_request/sdch_dictionary_fetcher.cc deleted file mode 100644 index 82ec8752..0000000 --- a/net/url_request/sdch_dictionary_fetcher.cc +++ /dev/null
@@ -1,410 +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 "net/url_request/sdch_dictionary_fetcher.h" - -#include <stdint.h> -#include <set> - -#include "base/auto_reset.h" -#include "base/bind.h" -#include "base/compiler_specific.h" -#include "base/containers/queue.h" -#include "base/macros.h" -#include "base/threading/thread_task_runner_handle.h" -#include "net/base/io_buffer.h" -#include "net/base/load_flags.h" -#include "net/base/sdch_net_log_params.h" -#include "net/http/http_response_headers.h" -#include "net/log/net_log_event_type.h" -#include "net/log/net_log_with_source.h" -#include "net/traffic_annotation/network_traffic_annotation.h" -#include "net/url_request/redirect_info.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_status.h" -#include "net/url_request/url_request_throttler_manager.h" - -namespace net { - -namespace { - -const int kBufferSize = 4096; - -// Map the bytes_read result from a read attempt and a URLRequest's -// status into a single net return value. -int GetReadResult(int rv, const URLRequest* request) { - DCHECK_NE(ERR_IO_PENDING, rv); - - if (rv < 0) { - rv = ERR_FAILED; - request->net_log().AddEventWithNetErrorCode( - NetLogEventType::SDCH_DICTIONARY_FETCH_IMPLIED_ERROR, rv); - } - - return rv; -} - -struct FetchInfo { - FetchInfo(const GURL& url, - bool cache_only, - const SdchDictionaryFetcher::OnDictionaryFetchedCallback& callback) - : url(url), cache_only(cache_only), callback(callback) {} - FetchInfo() {} - - GURL url; - bool cache_only; - SdchDictionaryFetcher::OnDictionaryFetchedCallback callback; -}; - -} // namespace - -// A UniqueFetchQueue is used to queue outgoing requests, which are either cache -// requests or network requests (which *may* still be served from cache). -// The UniqueFetchQueue enforces that a URL can only be queued for network fetch -// at most once. Calling Clear() resets UniqueFetchQueue's memory of which URLs -// have been queued. -class SdchDictionaryFetcher::UniqueFetchQueue { - public: - UniqueFetchQueue(); - ~UniqueFetchQueue(); - - bool Push(const FetchInfo& info); - bool Pop(FetchInfo* info); - bool IsEmpty() const; - void Clear(); - - private: - base::queue<FetchInfo> queue_; - std::set<GURL> ever_network_queued_; - - DISALLOW_COPY_AND_ASSIGN(UniqueFetchQueue); -}; - -SdchDictionaryFetcher::UniqueFetchQueue::UniqueFetchQueue() {} -SdchDictionaryFetcher::UniqueFetchQueue::~UniqueFetchQueue() {} - -bool SdchDictionaryFetcher::UniqueFetchQueue::Push(const FetchInfo& info) { - if (ever_network_queued_.count(info.url) != 0) - return false; - if (!info.cache_only) - ever_network_queued_.insert(info.url); - queue_.push(info); - return true; -} - -bool SdchDictionaryFetcher::UniqueFetchQueue::Pop(FetchInfo* info) { - if (IsEmpty()) - return false; - *info = queue_.front(); - queue_.pop(); - return true; -} - -bool SdchDictionaryFetcher::UniqueFetchQueue::IsEmpty() const { - return queue_.empty(); -} - -void SdchDictionaryFetcher::UniqueFetchQueue::Clear() { - ever_network_queued_.clear(); - while (!queue_.empty()) - queue_.pop(); -} - -SdchDictionaryFetcher::SdchDictionaryFetcher(URLRequestContext* context) - : next_state_(STATE_NONE), - in_loop_(false), - fetch_queue_(new UniqueFetchQueue()), - context_(context) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(context); -} - -SdchDictionaryFetcher::~SdchDictionaryFetcher() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); -} - -bool SdchDictionaryFetcher::Schedule( - const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback) { - return ScheduleInternal(dictionary_url, false, callback); -} - -bool SdchDictionaryFetcher::ScheduleReload( - const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback) { - return ScheduleInternal(dictionary_url, true, callback); -} - -void SdchDictionaryFetcher::Cancel() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - ResetRequest(); - next_state_ = STATE_NONE; - - fetch_queue_->Clear(); -} - -void SdchDictionaryFetcher::OnReceivedRedirect( - URLRequest* request, - const RedirectInfo& redirect_info, - bool* defer_redirect) { - DCHECK_EQ(next_state_, STATE_SEND_REQUEST_PENDING); - - next_state_ = STATE_RECEIVED_REDIRECT; - - DoLoop(OK); -} - -void SdchDictionaryFetcher::OnResponseStarted(URLRequest* request, - int net_error) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK_EQ(request, current_request_.get()); - DCHECK_EQ(next_state_, STATE_SEND_REQUEST_PENDING); - DCHECK(!in_loop_); - DCHECK_NE(ERR_IO_PENDING, net_error); - - // Confirm that the response isn't a stale read from the cache (as - // may happen in the reload case). If the response was not retrieved over - // HTTP, it is presumed to be fresh. - HttpResponseHeaders* response_headers = request->response_headers(); - if (net_error == OK && response_headers) { - bool requires_validation = response_headers->RequiresValidation( - request->response_info().request_time, - request->response_info().response_time, base::Time::Now()); - if (requires_validation) - net_error = ERR_FAILED; - } - - DoLoop(net_error); -} - -void SdchDictionaryFetcher::OnReadCompleted(URLRequest* request, - int bytes_read) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK_EQ(request, current_request_.get()); - DCHECK_EQ(next_state_, STATE_READ_BODY_COMPLETE); - DCHECK(!in_loop_); - DCHECK_NE(ERR_IO_PENDING, bytes_read); - - DoLoop(GetReadResult(bytes_read, current_request_.get())); -} - -bool SdchDictionaryFetcher::ScheduleInternal( - const GURL& dictionary_url, - bool reload, - const OnDictionaryFetchedCallback& callback) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // If Push() fails, |dictionary_url| has already been fetched or scheduled to - // be fetched. - if (!fetch_queue_->Push(FetchInfo(dictionary_url, reload, callback))) { - // TODO(rdsmith): Log this error to the net log. In the case of a - // normal fetch, this can be through the URLRequest - // initiating this fetch (once the URLRequest is passed to the fetcher); - // in the case of a reload, it's more complicated. - SdchManager::SdchErrorRecovery( - SDCH_DICTIONARY_PREVIOUSLY_SCHEDULED_TO_DOWNLOAD); - return false; - } - - // If the loop is already processing, it'll pick up the above in the - // normal course of events. - if (next_state_ != STATE_NONE) - return true; - - next_state_ = STATE_SEND_REQUEST; - - // There are no callbacks to user code from the dictionary fetcher, - // and Schedule() is only called from user code, so this call to DoLoop() - // does not require an |if (in_loop_) return;| guard. - DoLoop(OK); - return true; -} - -void SdchDictionaryFetcher::ResetRequest() { - current_request_.reset(); - buffer_ = nullptr; - current_callback_.Reset(); - dictionary_.reset(); - return; -} - -int SdchDictionaryFetcher::DoLoop(int rv) { - DCHECK(!in_loop_); - base::AutoReset<bool> auto_reset_in_loop(&in_loop_, true); - - do { - State state = next_state_; - next_state_ = STATE_NONE; - switch (state) { - case STATE_SEND_REQUEST: - rv = DoSendRequest(rv); - break; - case STATE_RECEIVED_REDIRECT: - rv = DoReceivedRedirect(rv); - break; - case STATE_SEND_REQUEST_PENDING: - rv = DoSendRequestPending(rv); - break; - case STATE_READ_BODY: - rv = DoReadBody(rv); - break; - case STATE_READ_BODY_COMPLETE: - rv = DoReadBodyComplete(rv); - break; - case STATE_REQUEST_COMPLETE: - rv = DoCompleteRequest(rv); - break; - case STATE_NONE: - NOTREACHED(); - } - } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); - - return rv; -} - -int SdchDictionaryFetcher::DoSendRequest(int rv) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // |rv| is ignored, as the result from the previous request doesn't - // affect the next request. - - if (fetch_queue_->IsEmpty() || current_request_.get()) { - next_state_ = STATE_NONE; - return OK; - } - - next_state_ = STATE_SEND_REQUEST_PENDING; - - FetchInfo info; - bool success = fetch_queue_->Pop(&info); - DCHECK(success); - net::NetworkTrafficAnnotationTag traffic_annotation = - net::DefineNetworkTrafficAnnotation("sdch_dictionary_fetch", R"( - semantics { - sender: "SDCH" - description: - "The Chrome Network Stack can use less bandwidth and reduces " - "request latency if a dictionary shared between client and server " - "is used to compress content on the server before sending, and " - "decompress content on the client after reception. This request is " - "fetching such a dictionary; it is dispatched when the response to " - "a previous URL request indicated that there was a dictionary that " - "the client did not currently have in memory, and could be used " - "for compression." - trigger: - "A response to a previous URL request indicated that this URL " - "contained a dictionary that could be used to compress other URL " - "responses." - data: - "The URL of the dictionary, as specified in a previous response " - "from a server." - destination: WEBSITE - } - policy { - cookies_allowed: NO - setting: - "This feature is disabled in Chrome and can only be enabled in non-" - "Chromium embedders." - policy_exception_justification: - "Not implemented, not part of Chrome." - })"); - current_request_ = - context_->CreateRequest(info.url, IDLE, this, traffic_annotation); - int load_flags = LOAD_DO_NOT_SEND_COOKIES | LOAD_DO_NOT_SAVE_COOKIES; - if (info.cache_only) - load_flags |= LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION; - current_request_->SetLoadFlags(load_flags); - - buffer_ = new IOBuffer(kBufferSize); - dictionary_.reset(new std::string()); - current_callback_ = info.callback; - - current_request_->Start(); - current_request_->net_log().AddEvent(NetLogEventType::SDCH_DICTIONARY_FETCH); - - return ERR_IO_PENDING; -} - -int SdchDictionaryFetcher::DoReceivedRedirect(int rv) { - // Fetching SDCH through a redirect is forbidden; it raises possible - // security issues cross-origin, and isn't obviously useful within - // an origin. - ResetRequest(); - next_state_ = STATE_SEND_REQUEST; - return ERR_UNSAFE_REDIRECT; -} - -int SdchDictionaryFetcher::DoSendRequestPending(int rv) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // If there's been an error, abort the current request. - if (rv != OK) { - ResetRequest(); - next_state_ = STATE_SEND_REQUEST; - return OK; - } - - next_state_ = STATE_READ_BODY; - return OK; -} - -int SdchDictionaryFetcher::DoReadBody(int rv) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // If there's been an error, abort the current request. - if (rv != OK) { - ResetRequest(); - next_state_ = STATE_SEND_REQUEST; - return OK; - } - - next_state_ = STATE_READ_BODY_COMPLETE; - int bytes_read = current_request_->Read(buffer_.get(), kBufferSize); - if (bytes_read == ERR_IO_PENDING) - return ERR_IO_PENDING; - - return GetReadResult(bytes_read, current_request_.get()); -} - -int SdchDictionaryFetcher::DoReadBodyComplete(int rv) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // An error; abort the current request. - if (rv < 0) { - ResetRequest(); - next_state_ = STATE_SEND_REQUEST; - return OK; - } - - DCHECK_GE(rv, 0); - - // Data; append to the dictionary and look for more data. - if (rv > 0) { - dictionary_->append(buffer_->data(), rv); - next_state_ = STATE_READ_BODY; - return OK; - } - - // End of file; complete the request. - next_state_ = STATE_REQUEST_COMPLETE; - return OK; -} - -int SdchDictionaryFetcher::DoCompleteRequest(int rv) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // If the dictionary was successfully fetched, add it to the manager. - if (rv == OK) { - current_callback_.Run(*dictionary_, current_request_->url(), - current_request_->net_log(), - current_request_->was_cached()); - } - - ResetRequest(); - next_state_ = STATE_SEND_REQUEST; - return OK; -} - -} // namespace net
diff --git a/net/url_request/sdch_dictionary_fetcher.h b/net/url_request/sdch_dictionary_fetcher.h deleted file mode 100644 index adf0122..0000000 --- a/net/url_request/sdch_dictionary_fetcher.h +++ /dev/null
@@ -1,130 +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. - -// TODO(rdsmith): This class needs to delegate URLRequest::Delegate methods -// to the net/ embedder for correct implementation of authentication. -// Specifically, this class needs the embedder to provide functionality -// corresponding to -// URLRequest::Delegate::{OnAuthRequired,OnCertificateRequested}. - -#ifndef NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ -#define NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_ - -#include <memory> -#include <string> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/threading/thread_checker.h" -#include "net/base/net_export.h" -#include "net/base/sdch_manager.h" -#include "net/url_request/url_fetcher_delegate.h" -#include "net/url_request/url_request.h" -#include "url/gurl.h" - -namespace net { - -class NetLogWithSource; -class URLRequest; - -// This class is used by embedder SDCH policy object to fetch -// dictionaries. It queues requests for dictionaries and dispatches -// them serially, implementing the URLRequest::Delegate interface to -// handle callbacks (but see above TODO). It tracks all requests, only -// attempting to fetch each dictionary once. -class NET_EXPORT SdchDictionaryFetcher : public URLRequest::Delegate { - public: - typedef base::Callback<void(const std::string& dictionary_text, - const GURL& dictionary_url, - const NetLogWithSource& net_log, - bool was_from_cache)> - OnDictionaryFetchedCallback; - - // The consumer must guarantee that |*context| outlives this object. - explicit SdchDictionaryFetcher(URLRequestContext* context); - ~SdchDictionaryFetcher() override; - - // Request a new dictionary fetch. The callback will be called - // only if the dictionary is successfully fetched. Returns true if a - // request for |dictionary_url| has been scheduled, and false otherwise. - virtual bool Schedule(const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback); - - // Request a dictionary fetch from cache only. The callback will be called - // only if the dictionary is successfully fetched. Returns true if a request - // for |dictionary_url| has been scheduled, and false otherwise. - virtual bool ScheduleReload(const GURL& dictionary_url, - const OnDictionaryFetchedCallback& callback); - - // Cancel any in-progress requests. - virtual void Cancel(); - - // Implementation of URLRequest::Delegate methods. - void OnReceivedRedirect(URLRequest* request, - const RedirectInfo& redirect_info, - bool* defer_redirect) override; - void OnResponseStarted(URLRequest* request, int net_error) override; - void OnReadCompleted(URLRequest* request, int bytes_read) override; - - private: - enum State { - STATE_NONE, - STATE_SEND_REQUEST, - STATE_RECEIVED_REDIRECT, - STATE_SEND_REQUEST_PENDING, - STATE_READ_BODY, - STATE_READ_BODY_COMPLETE, - STATE_REQUEST_COMPLETE, - }; - - class UniqueFetchQueue; - - // Schedule implementation. Returns true if a request for |dictionary_url| has - // been added to the queue, and false otherwise. - bool ScheduleInternal(const GURL& dictionary_url, - bool reload, - const OnDictionaryFetchedCallback& callback); - - // Null out the current request and push the state machine to the - // next request, if any. - void ResetRequest(); - - // State machine implementation. - int DoLoop(int rv); - int DoSendRequest(int rv); - int DoReceivedRedirect(int rv); - int DoSendRequestPending(int rv); - int DoReadBody(int rv); - int DoReadBodyComplete(int rv); - int DoCompleteRequest(int rv); - - State next_state_; - bool in_loop_; - - // A queue of URLs that are being used to download dictionaries. - std::unique_ptr<UniqueFetchQueue> fetch_queue_; - - // The request, buffer, and consumer supplied data used for getting - // the current dictionary. All are null when a fetch is not in progress. - std::unique_ptr<URLRequest> current_request_; - scoped_refptr<IOBuffer> buffer_; - OnDictionaryFetchedCallback current_callback_; - - // The currently accumulating dictionary. Stored as a unique_ptr so all memory - // it consumes can be easily freed, as it gets quite big, and - // std::string::clear() may not free memory. - std::unique_ptr<std::string> dictionary_; - - // Store the URLRequestContext associated with the owning SdchManager for - // use while fetching. - URLRequestContext* const context_; - - THREAD_CHECKER(thread_checker_); - - DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); -}; - -} // namespace net - -#endif // NET_URL_REQUEST_SDCH_DICTIONARY_FETCHER_H_
diff --git a/net/url_request/sdch_dictionary_fetcher_unittest.cc b/net/url_request/sdch_dictionary_fetcher_unittest.cc deleted file mode 100644 index 2b1f2d36..0000000 --- a/net/url_request/sdch_dictionary_fetcher_unittest.cc +++ /dev/null
@@ -1,579 +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 "net/url_request/sdch_dictionary_fetcher.h" - -#include <algorithm> -#include <string> -#include <utility> -#include <vector> - -#include "base/bind.h" -#include "base/callback.h" -#include "base/logging.h" -#include "base/macros.h" -#include "base/run_loop.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/threading/thread_task_runner_handle.h" -#include "net/base/load_flags.h" -#include "net/base/net_errors.h" -#include "net/base/sdch_manager.h" -#include "net/http/http_response_headers.h" -#include "net/url_request/url_request_filter.h" -#include "net/url_request/url_request_interceptor.h" -#include "net/url_request/url_request_job.h" -#include "net/url_request/url_request_redirect_job.h" -#include "net/url_request/url_request_test_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace net { - -namespace { - -const char kSampleBufferContext[] = "This is a sample buffer."; -const char kTestDomain1[] = "top.domain.test"; -const char kTestDomain2[] = "top2.domain.test"; - -// A URLRequestJob that returns a fixed response body, based on the URL, with -// the specified HttpResponseInfo. Can also be made to return an error after the -// response body has been read. -class URLRequestSpecifiedResponseJob : public URLRequestJob { - public: - // Called on destruction with load flags used for this request. - typedef base::Callback<void(int)> DestructionCallback; - - URLRequestSpecifiedResponseJob( - URLRequest* request, - NetworkDelegate* network_delegate, - const HttpResponseInfo& response_info_to_return, - const DestructionCallback& destruction_callback) - : URLRequestJob(request, network_delegate), - response_info_to_return_(response_info_to_return), - last_load_flags_seen_(request->load_flags()), - destruction_callback_(destruction_callback), - bytes_read_(0), - final_read_result_(OK), - weak_factory_(this) { - DCHECK(!destruction_callback.is_null()); - } - - ~URLRequestSpecifiedResponseJob() override { - destruction_callback_.Run(last_load_flags_seen_); - } - - // Sets the result of the final read, after the entire body has been read. - // Defaults to OK. - void set_final_read_result(Error final_read_result) { - final_read_result_ = final_read_result; - } - - // URLRequestJob implementation: - void Start() override { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&URLRequestSpecifiedResponseJob::StartAsync, - weak_factory_.GetWeakPtr())); - } - - int ReadRawData(IOBuffer* buf, int buf_size) override { - std::string response = ExpectedResponseForURL(request_->url()); - response = response.substr(bytes_read_); - size_t bytes_to_copy = - std::min(static_cast<size_t>(buf_size), response.size()); - if (bytes_to_copy == 0) - return final_read_result_; - memcpy(buf->data(), response.c_str(), bytes_to_copy); - bytes_read_ += bytes_to_copy; - return bytes_to_copy; - } - - static std::string ExpectedResponseForURL(const GURL& url) { - return base::StringPrintf("Response for %s\n%s\nEnd Response for %s\n", - url.spec().c_str(), - kSampleBufferContext, - url.spec().c_str()); - } - - void GetResponseInfo(HttpResponseInfo* info) override { - *info = response_info_to_return_; - } - - private: - void StartAsync() { NotifyHeadersComplete(); } - - const HttpResponseInfo response_info_to_return_; - int last_load_flags_seen_; - const DestructionCallback destruction_callback_; - - int bytes_read_; - Error final_read_result_; - - base::WeakPtrFactory<URLRequestSpecifiedResponseJob> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(URLRequestSpecifiedResponseJob); -}; - -// Wrap URLRequestRedirectJob in a destruction callback. -class TestURLRequestRedirectJob : public URLRequestRedirectJob { - public: - TestURLRequestRedirectJob(URLRequest* request, - NetworkDelegate* network_delegate, - const GURL& redirect_destination, - ResponseCode response_code, - const std::string& redirect_reason, - base::Closure destruction_callback) - : URLRequestRedirectJob(request, - network_delegate, - redirect_destination, - response_code, - redirect_reason), - destruction_callback_(destruction_callback) {} - ~TestURLRequestRedirectJob() override { destruction_callback_.Run(); } - - private: - const base::Closure destruction_callback_; -}; - -const char kRedirectPath[] = "/redirect/"; -const char kBodyErrorPath[] = "/body_error/"; - -class SDCHTestRequestInterceptor : public URLRequestInterceptor { - public: - // A callback to be called whenever a URLRequestJob child of this - // interceptor is created or destroyed. The first argument will be the - // change in number of jobs (i.e. +1 for created, -1 for destroyed). - // The second argument will be undefined if the job is being created - // or a redirect job is being destroyed, and (for non-redirect job - // destruction) will contain the load flags passed to the request the - // job was created for. - typedef base::Callback<void(int outstanding_job_delta, - int destruction_load_flags)> LifecycleCallback; - - // |*info| will be returned from all child URLRequestSpecifiedResponseJobs. - // Note that: a) this pointer is shared with the caller, and the caller must - // guarantee that |*info| outlives the SDCHTestRequestInterceptor, and - // b) |*info| is mutable, and changes to should propagate to - // URLRequestSpecifiedResponseJobs created after any change. - SDCHTestRequestInterceptor(HttpResponseInfo* http_response_info, - const LifecycleCallback& lifecycle_callback) - : http_response_info_(http_response_info), - lifecycle_callback_(lifecycle_callback) { - DCHECK(!lifecycle_callback_.is_null()); - } - ~SDCHTestRequestInterceptor() override {} - - URLRequestJob* MaybeInterceptRequest( - URLRequest* request, - NetworkDelegate* network_delegate) const override { - lifecycle_callback_.Run(1, 0); - - std::string path = request->url().path(); - if (base::StartsWith(path, kRedirectPath, base::CompareCase::SENSITIVE)) { - return new TestURLRequestRedirectJob( - request, network_delegate, GURL(path.substr(strlen(kRedirectPath))), - URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "testing", - base::Bind(lifecycle_callback_, -1, 0)); - } - - std::unique_ptr<URLRequestSpecifiedResponseJob> job( - new URLRequestSpecifiedResponseJob( - request, network_delegate, *http_response_info_, - base::Bind(lifecycle_callback_, -1))); - if (base::StartsWith(path, kBodyErrorPath, base::CompareCase::SENSITIVE)) - job->set_final_read_result(net::ERR_FAILED); - return job.release(); - } - - // The caller must ensure that both |*http_response_info| and the - // callback remain valid for the lifetime of the - // SDCHTestRequestInterceptor (i.e. until Unregister() is called). - static void RegisterWithFilter(HttpResponseInfo* http_response_info, - const LifecycleCallback& lifecycle_callback) { - URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "http", kTestDomain1, - std::unique_ptr<URLRequestInterceptor>(new SDCHTestRequestInterceptor( - http_response_info, lifecycle_callback))); - - URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "https", kTestDomain1, - std::unique_ptr<URLRequestInterceptor>(new SDCHTestRequestInterceptor( - http_response_info, lifecycle_callback))); - - URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "http", kTestDomain2, - std::unique_ptr<URLRequestInterceptor>(new SDCHTestRequestInterceptor( - http_response_info, lifecycle_callback))); - - URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "https", kTestDomain2, - std::unique_ptr<URLRequestInterceptor>(new SDCHTestRequestInterceptor( - http_response_info, lifecycle_callback))); - } - - static void Unregister() { - URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", - kTestDomain1); - URLRequestFilter::GetInstance()->RemoveHostnameHandler("https", - kTestDomain1); - URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", - kTestDomain2); - URLRequestFilter::GetInstance()->RemoveHostnameHandler("https", - kTestDomain2); - } - - private: - HttpResponseInfo* http_response_info_; - LifecycleCallback lifecycle_callback_; - DISALLOW_COPY_AND_ASSIGN(SDCHTestRequestInterceptor); -}; - -// Local test infrastructure -// * URLRequestSpecifiedResponseJob: A URLRequestJob that returns -// a different but derivable response for each URL (used for all -// url requests in this file). This class is initialized with -// the HttpResponseInfo to return (if any), as well as a callback -// that is called when the class is destroyed. That callback -// takes as arguemnt the load flags used for the request the -// job was created for. -// * SDCHTestRequestInterceptor: This class is a -// URLRequestInterceptor that generates either the class above or an -// instance of URLRequestRedirectJob (if the first component of the path -// is "redirect"). It is constructed -// with a pointer to the (mutable) resposne info that should be -// returned from constructed URLRequestSpecifiedResponseJobs, as well as -// a callback that is run when URLRequestSpecifiedResponseJobs are -// created or destroyed. -// * SdchDictionaryFetcherTest: This class registers the above interceptor, -// tracks the number of jobs requested and the subset of those -// that are still outstanding. It exports an interface to wait until there -// are no jobs outstanding. It shares an HttpResponseInfo structure -// with the SDCHTestRequestInterceptor to control the response -// information returned by the jbos. -// The standard pattern for tests is to schedule a dictionary fetch, wait -// for no jobs outstanding, then test that the fetch results are as expected. - -class SdchDictionaryFetcherTest : public ::testing::Test { - public: - struct DictionaryAdditions { - DictionaryAdditions(const std::string& dictionary_text, - const GURL& dictionary_url) - : dictionary_text(dictionary_text), dictionary_url(dictionary_url) {} - - std::string dictionary_text; - GURL dictionary_url; - }; - - SdchDictionaryFetcherTest() - : jobs_requested_(0), - jobs_outstanding_(0), - last_load_flags_seen_(LOAD_NORMAL), - context_(new TestURLRequestContext), - fetcher_(new SdchDictionaryFetcher(context_.get())), - factory_(this) { - response_info_to_return_.request_time = base::Time::Now(); - response_info_to_return_.response_time = base::Time::Now(); - SDCHTestRequestInterceptor::RegisterWithFilter( - &response_info_to_return_, - base::Bind(&SdchDictionaryFetcherTest::OnNumberJobsChanged, - factory_.GetWeakPtr())); - } - - ~SdchDictionaryFetcherTest() override { - SDCHTestRequestInterceptor::Unregister(); - } - - void OnDictionaryFetched(const std::string& dictionary_text, - const GURL& dictionary_url, - const NetLogWithSource& net_log, - bool was_from_cache) { - dictionary_additions_.push_back( - DictionaryAdditions(dictionary_text, dictionary_url)); - } - - // Return (in |*out|) all dictionary additions since the last time - // this function was called. - void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { - out->swap(dictionary_additions_); - dictionary_additions_.clear(); - } - - SdchDictionaryFetcher* fetcher() { return fetcher_.get(); } - - // May not be called outside the SetUp()/TearDown() interval. - int jobs_requested() const { return jobs_requested_; } - - GURL PathToGurl(const char* path) const { - std::string gurl_string("http://"); - gurl_string += kTestDomain1; - gurl_string += "/"; - gurl_string += path; - return GURL(gurl_string); - } - - // Block until there are no outstanding URLRequestSpecifiedResponseJobs. - void WaitForNoJobs() { - // A job may be started after the previous one was destroyed, with a brief - // period of 0 jobs in between, so may have to start the run loop multiple - // times. - while (jobs_outstanding_ != 0) { - run_loop_.reset(new base::RunLoop); - run_loop_->Run(); - run_loop_.reset(); - } - } - - HttpResponseInfo* response_info_to_return() { - return &response_info_to_return_; - } - - int last_load_flags_seen() const { return last_load_flags_seen_; } - - const SdchDictionaryFetcher::OnDictionaryFetchedCallback - GetDefaultCallback() { - return base::Bind(&SdchDictionaryFetcherTest::OnDictionaryFetched, - base::Unretained(this)); - } - - private: - void OnNumberJobsChanged(int outstanding_jobs_delta, int load_flags) { - DCHECK_NE(0, outstanding_jobs_delta); - if (outstanding_jobs_delta > 0) - jobs_requested_ += outstanding_jobs_delta; - else - last_load_flags_seen_ = load_flags; - jobs_outstanding_ += outstanding_jobs_delta; - if (jobs_outstanding_ == 0 && run_loop_) - run_loop_->Quit(); - } - - int jobs_requested_; - int jobs_outstanding_; - - // Last load flags seen by the interceptor installed in - // SdchDictionaryFetcherTest(). These are available to test bodies and - // currently used for ensuring that certain loads are marked only-from-cache. - int last_load_flags_seen_; - - std::unique_ptr<base::RunLoop> run_loop_; - std::unique_ptr<TestURLRequestContext> context_; - std::unique_ptr<SdchDictionaryFetcher> fetcher_; - std::vector<DictionaryAdditions> dictionary_additions_; - - // The request_time and response_time fields are filled in by the constructor - // for SdchDictionaryFetcherTest. Tests can fill the other fields of this - // member in to alter the HttpResponseInfo returned by the fetcher's - // URLRequestJob. - HttpResponseInfo response_info_to_return_; - - base::WeakPtrFactory<SdchDictionaryFetcherTest> factory_; - - DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcherTest); -}; - -// Schedule a fetch and make sure it happens. -TEST_F(SdchDictionaryFetcherTest, Basic) { - GURL dictionary_url(PathToGurl("dictionary")); - fetcher()->Schedule(dictionary_url, GetDefaultCallback()); - WaitForNoJobs(); - - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), - additions[0].dictionary_text); - EXPECT_FALSE(last_load_flags_seen() & LOAD_ONLY_FROM_CACHE); -} - -// Multiple fetches of the same URL should result in only one request. -TEST_F(SdchDictionaryFetcherTest, Multiple) { - GURL dictionary_url(PathToGurl("dictionary")); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - EXPECT_FALSE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - EXPECT_FALSE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - WaitForNoJobs(); - - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), - additions[0].dictionary_text); -} - -// A cancel should result in no actual requests being generated. -TEST_F(SdchDictionaryFetcherTest, Cancel) { - GURL dictionary_url_1(PathToGurl("dictionary_1")); - GURL dictionary_url_2(PathToGurl("dictionary_2")); - GURL dictionary_url_3(PathToGurl("dictionary_3")); - - fetcher()->Schedule(dictionary_url_1, GetDefaultCallback()); - fetcher()->Schedule(dictionary_url_2, GetDefaultCallback()); - fetcher()->Schedule(dictionary_url_3, GetDefaultCallback()); - fetcher()->Cancel(); - WaitForNoJobs(); - - // Synchronous execution may have resulted in a single job being scheduled. - EXPECT_GE(1, jobs_requested()); -} - -// Attempt to confuse the fetcher loop processing by scheduling a -// dictionary addition while another fetch is in process. -TEST_F(SdchDictionaryFetcherTest, LoopRace) { - GURL dictionary0_url(PathToGurl("dictionary0")); - GURL dictionary1_url(PathToGurl("dictionary1")); - fetcher()->Schedule(dictionary0_url, GetDefaultCallback()); - fetcher()->Schedule(dictionary1_url, GetDefaultCallback()); - WaitForNoJobs(); - - ASSERT_EQ(2, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - ASSERT_EQ(2u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary0_url), - additions[0].dictionary_text); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary1_url), - additions[1].dictionary_text); -} - -TEST_F(SdchDictionaryFetcherTest, ScheduleReloadLoadFlags) { - GURL dictionary_url(PathToGurl("dictionary")); - fetcher()->ScheduleReload(dictionary_url, GetDefaultCallback()); - - WaitForNoJobs(); - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), - additions[0].dictionary_text); - EXPECT_TRUE(last_load_flags_seen() & LOAD_ONLY_FROM_CACHE); -} - -TEST_F(SdchDictionaryFetcherTest, ScheduleReloadFresh) { - std::string raw_headers = "\0"; - response_info_to_return()->headers = new HttpResponseHeaders( - HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size())); - response_info_to_return()->headers->AddHeader("Cache-Control: max-age=1000"); - - GURL dictionary_url(PathToGurl("dictionary")); - fetcher()->ScheduleReload(dictionary_url, GetDefaultCallback()); - - WaitForNoJobs(); - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), - additions[0].dictionary_text); - EXPECT_TRUE(last_load_flags_seen() & LOAD_ONLY_FROM_CACHE); -} - -TEST_F(SdchDictionaryFetcherTest, ScheduleReloadStale) { - response_info_to_return()->headers = new HttpResponseHeaders(""); - response_info_to_return()->headers->AddHeader("Cache-Control: no-cache"); - - GURL dictionary_url(PathToGurl("dictionary")); - fetcher()->ScheduleReload(dictionary_url, GetDefaultCallback()); - - WaitForNoJobs(); - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - EXPECT_EQ(0u, additions.size()); - EXPECT_TRUE(last_load_flags_seen() & LOAD_ONLY_FROM_CACHE); -} - -TEST_F(SdchDictionaryFetcherTest, ScheduleReloadThenLoad) { - GURL dictionary_url(PathToGurl("dictionary")); - EXPECT_TRUE(fetcher()->ScheduleReload(dictionary_url, GetDefaultCallback())); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - - WaitForNoJobs(); - EXPECT_EQ(2, jobs_requested()); -} - -TEST_F(SdchDictionaryFetcherTest, ScheduleLoadThenReload) { - GURL dictionary_url(PathToGurl("dictionary")); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - EXPECT_FALSE(fetcher()->ScheduleReload(dictionary_url, GetDefaultCallback())); - - WaitForNoJobs(); - EXPECT_EQ(1, jobs_requested()); -} - -TEST_F(SdchDictionaryFetcherTest, CancelAllowsFutureFetches) { - GURL dictionary_url(PathToGurl("dictionary")); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - EXPECT_FALSE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - - WaitForNoJobs(); - EXPECT_EQ(1, jobs_requested()); - - fetcher()->Cancel(); - WaitForNoJobs(); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - - WaitForNoJobs(); - EXPECT_EQ(2, jobs_requested()); -} - -TEST_F(SdchDictionaryFetcherTest, Redirect) { - GURL dictionary_url(PathToGurl("dictionary")); - GURL local_redirect_url(dictionary_url.GetWithEmptyPath().spec() + - "redirect/" + dictionary_url.spec()); - EXPECT_TRUE(fetcher()->Schedule(local_redirect_url, GetDefaultCallback())); - WaitForNoJobs(); - - // The redirect should have been rejected with no dictionary added. - EXPECT_EQ(1, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - EXPECT_EQ(0u, additions.size()); - - // Simple SDCH dictionary fetch test, to make sure the fetcher was left - // in reasonable shape by the above. - - GURL dictionary2_url(PathToGurl("dictionary2")); - fetcher()->Schedule(dictionary2_url, GetDefaultCallback()); - WaitForNoJobs(); - - EXPECT_EQ(2, jobs_requested()); - GetDictionaryAdditions(&additions); - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary2_url), - additions[0].dictionary_text); - EXPECT_FALSE(last_load_flags_seen() & LOAD_ONLY_FROM_CACHE); -} - -// Check the case of two requests for different URLs, where the first request -// fails after receiving body data. -TEST_F(SdchDictionaryFetcherTest, TwoDictionariesFirstFails) { - GURL dictionary_with_error_url(PathToGurl("body_error/")); - GURL dictionary_url(PathToGurl("dictionary")); - EXPECT_TRUE( - fetcher()->Schedule(dictionary_with_error_url, GetDefaultCallback())); - EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); - WaitForNoJobs(); - - EXPECT_EQ(2, jobs_requested()); - std::vector<DictionaryAdditions> additions; - GetDictionaryAdditions(&additions); - // Should only have a dictionary for the successful request. - ASSERT_EQ(1u, additions.size()); - EXPECT_EQ( - URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), - additions[0].dictionary_text); -} - -} // namespace - -} // namespace net
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index e96c601..619f38d 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -168,7 +168,8 @@ const base::FilePath::CharType kTestFilePath[] = FILE_PATH_LITERAL("net/data/url_request_unittest"); -#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) +#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) && \ + !defined(OS_FUCHSIA) // Test file used in most FTP tests. const char kFtpTestFile[] = "BullRunSpeech.txt"; #endif @@ -281,7 +282,8 @@ EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null()); } -#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) +#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) && \ + !defined(OS_FUCHSIA) // Tests load timing in the case that there is no HTTP response. This can be // used to test in the case of errors or non-HTTP requests. void TestLoadTimingNoHttpResponse( @@ -11340,10 +11342,12 @@ } #endif // !defined(OS_IOS) -#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) -// These tests aren't passing on Android. Either the RemoteTestServer isn't -// starting up successfully, or it can't access the test files. -// TODO(mmenke): Fix this. See http://crbug.com/495220 +#if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) && \ + !defined(OS_FUCHSIA) +// FTP uses a second TCP connection with the port number allocated dynamically +// on the server side, so it would be hard to make RemoteTestServer proxy FTP +// connections reliably. FTP tests are disabled on platforms that use +// RemoteTestServer. See http://crbug.com/495220 class URLRequestTestFTP : public URLRequestTest { public: URLRequestTestFTP()
diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc index 16744bf..968c47c 100644 --- a/printing/pdf_metafile_cg_mac.cc +++ b/printing/pdf_metafile_cg_mac.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" +#include "base/numerics/math_constants.h" #include "base/numerics/safe_conversions.h" #include "base/strings/sys_string_conversions.h" #include "ui/gfx/geometry/rect.h" @@ -30,7 +31,7 @@ // content is now "off screen". Shift it right to move it back on screen. CGContextTranslateCTM(context, rect.size.width, 0); // Rotates counter-clockwise by 90 degrees. - CGContextRotateCTM(context, M_PI_2); + CGContextRotateCTM(context, base::kPiDouble / 2); break; case 2: // After rotating by 180 degrees with the axis at the origin, the page @@ -38,14 +39,14 @@ // screen. CGContextTranslateCTM(context, rect.size.width, rect.size.height); // Rotates counter-clockwise by 90 degrees. - CGContextRotateCTM(context, M_PI); + CGContextRotateCTM(context, base::kPiDouble); break; case 3: // After rotating by 270 degrees with the axis at the origin, the page // content is now "off screen". Shift it right to move it back on screen. CGContextTranslateCTM(context, 0, rect.size.height); // Rotates counter-clockwise by 90 degrees. - CGContextRotateCTM(context, -M_PI_2); + CGContextRotateCTM(context, -base::kPiDouble / 2); break; default: NOTREACHED();
diff --git a/remoting/codec/audio_encoder_opus_unittest.cc b/remoting/codec/audio_encoder_opus_unittest.cc index 989b6744..449b777 100644 --- a/remoting/codec/audio_encoder_opus_unittest.cc +++ b/remoting/codec/audio_encoder_opus_unittest.cc
@@ -2,18 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to get M_PI. -#define _USE_MATH_DEFINES - #include "remoting/codec/audio_encoder_opus.h" -#include <math.h> #include <stddef.h> #include <stdint.h> +#include <cmath> #include <utility> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "remoting/codec/audio_decoder_opus.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,7 +25,7 @@ const int kChannels = 2; // Phase shift between left and right channels. -const double kChannelPhaseShift = 2 * M_PI / 3; +const double kChannelPhaseShift = 2 * base::kPiDouble / 3; // The sampling rate that OPUS uses internally and that we expect to get // from the decoder. @@ -60,9 +58,9 @@ double frequency_hz, double pos, int channel) { - double angle = pos * 2 * M_PI * frequency_hz / rate + - kChannelPhaseShift * channel; - return static_cast<int>(sin(angle) * kMaxSampleValue + 0.5); + double angle = pos * 2 * base::kPiDouble * frequency_hz / rate + + kChannelPhaseShift * channel; + return static_cast<int>(std::sin(angle) * kMaxSampleValue + 0.5); } // Creates audio packet filled with a test signal with the specified @@ -121,8 +119,8 @@ GetSampleValue(rate, frequency_hz, i - shift, 1); diff_sqare_sum += d * d; } - double deviation = sqrt(diff_sqare_sum / received_data.size()) - / kMaxSampleValue; + double deviation = + std::sqrt(diff_sqare_sum / received_data.size()) / kMaxSampleValue; LOG(ERROR) << "Decoded signal deviation: " << deviation; EXPECT_LE(deviation, kMaxSignalDeviation); }
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc index f42fd437..09e82cd 100644 --- a/remoting/host/disconnect_window_linux.cc +++ b/remoting/host/disconnect_window_linux.cc
@@ -3,12 +3,12 @@ // found in the LICENSE file. #include <gtk/gtk.h> -#include <math.h> #include "base/compiler_specific.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/numerics/math_constants.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "remoting/base/string_resources.h" @@ -74,10 +74,14 @@ void AddRoundRectPath(cairo_t* cairo_context, int width, int height, int radius) { cairo_new_sub_path(cairo_context); - cairo_arc(cairo_context, width - radius, radius, radius, -M_PI_2, 0); - cairo_arc(cairo_context, width - radius, height - radius, radius, 0, M_PI_2); - cairo_arc(cairo_context, radius, height - radius, radius, M_PI_2, 2 * M_PI_2); - cairo_arc(cairo_context, radius, radius, radius, 2 * M_PI_2, 3 * M_PI_2); + cairo_arc(cairo_context, width - radius, radius, radius, -base::kPiDouble / 2, + 0); + cairo_arc(cairo_context, width - radius, height - radius, radius, 0, + base::kPiDouble / 2); + cairo_arc(cairo_context, radius, height - radius, radius, base::kPiDouble / 2, + base::kPiDouble); + cairo_arc(cairo_context, radius, radius, radius, base::kPiDouble, + 3 * base::kPiDouble / 2); cairo_close_path(cairo_context); }
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc index 08bb9201..b555218 100644 --- a/remoting/protocol/connection_unittest.cc +++ b/remoting/protocol/connection_unittest.cc
@@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. - #include <utility> #include "base/bind.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/numerics/math_constants.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "base/threading/thread.h" @@ -150,7 +149,8 @@ static int16_t GetSampleValue(double pos, int frequency) { const int kMaxSampleValue = 32767; return static_cast<int>( - sin(pos * 2 * M_PI * frequency / kAudioSampleRate) * kMaxSampleValue + + sin(pos * 2 * base::kPiDouble * frequency / kAudioSampleRate) * + kMaxSampleValue + 0.5); }
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index bc413890..8630346 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd
@@ -1101,7 +1101,7 @@ </message> <message desc="Error message indicating that the host is offline because the session script keeps dying." name="IDS_OFFLINE_REASON_SESSION_RETRIES_EXCEEDED" formatter_data="android_java"> - Session crashed or failed to start. If ~/.chrome-remote-desktop-session exists on the remote computer, make sure it runs a long-running process such as a desktop environment or window manager. + Session crashed or failed to start. If ~/.chrome-remote-desktop-session exists on the remote computer, make sure it starts a long-running foreground process such as a desktop environment or window manager. </message> <message desc="Error message indicating that the host is offline because the host keeps dying." name="IDS_OFFLINE_REASON_HOST_RETRIES_EXCEEDED" formatter_data="android_java">
diff --git a/remoting/test/fake_socket_factory.cc b/remoting/test/fake_socket_factory.cc index f08881d..051a642 100644 --- a/remoting/test/fake_socket_factory.cc +++ b/remoting/test/fake_socket_factory.cc
@@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "remoting/test/fake_socket_factory.h" #include <algorithm> -#include <cmath> #include <cstddef> #include <cstdlib> #include <string> @@ -17,6 +13,7 @@ #include "base/callback.h" #include "base/location.h" #include "base/macros.h" +#include "base/numerics/math_constants.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -40,9 +37,8 @@ double GetNormalRandom(double average, double stddev) { // Based on Box-Muller transform, see // http://en.wikipedia.org/wiki/Box_Muller_transform . - return average + - stddev * sqrt(-2.0 * log(1.0 - RandDouble())) * - cos(RandDouble() * 2.0 * M_PI); + return average + stddev * sqrt(-2.0 * log(1.0 - RandDouble())) * + cos(RandDouble() * 2.0 * base::kPiDouble); } class FakeUdpSocket : public rtc::AsyncPacketSocket {
diff --git a/services/resource_coordinator/BUILD.gn b/services/resource_coordinator/BUILD.gn index 6e363bd..8e49a7f 100644 --- a/services/resource_coordinator/BUILD.gn +++ b/services/resource_coordinator/BUILD.gn
@@ -12,9 +12,6 @@ source_set("lib") { sources = [ - "coordination_unit/background_metrics_reporter.h", - "coordination_unit/coordination_unit_graph_observer.cc", - "coordination_unit/coordination_unit_graph_observer.h", "coordination_unit/coordination_unit_impl.cc", "coordination_unit/coordination_unit_impl.h", "coordination_unit/coordination_unit_introspector_impl.cc", @@ -25,18 +22,21 @@ "coordination_unit/coordination_unit_provider_impl.h", "coordination_unit/frame_coordination_unit_impl.cc", "coordination_unit/frame_coordination_unit_impl.h", - "coordination_unit/metrics_collector.cc", - "coordination_unit/metrics_collector.h", + "coordination_unit/page_coordination_unit_impl.cc", + "coordination_unit/page_coordination_unit_impl.h", "coordination_unit/process_coordination_unit_impl.cc", "coordination_unit/process_coordination_unit_impl.h", - "coordination_unit/tab_signal_generator_impl.cc", - "coordination_unit/tab_signal_generator_impl.h", - "coordination_unit/web_contents_coordination_unit_impl.cc", - "coordination_unit/web_contents_coordination_unit_impl.h", "memory_instrumentation/coordinator_impl.cc", "memory_instrumentation/coordinator_impl.h", "memory_instrumentation/process_map.cc", "memory_instrumentation/process_map.h", + "observers/background_metrics_reporter.h", + "observers/coordination_unit_graph_observer.cc", + "observers/coordination_unit_graph_observer.h", + "observers/metrics_collector.cc", + "observers/metrics_collector.h", + "observers/tab_signal_generator_impl.cc", + "observers/tab_signal_generator_impl.h", "resource_coordinator_service.cc", "resource_coordinator_service.h", "service_callbacks_impl.cc", @@ -49,6 +49,7 @@ "//mojo/public/cpp/bindings", "//services/metrics/public/cpp:ukm_builders", "//services/resource_coordinator/public/cpp:resource_coordinator_cpp", + "//services/resource_coordinator/tracing:lib", "//services/service_manager/public/cpp/standalone_service:standalone_service", ] } @@ -73,17 +74,17 @@ testonly = true sources = [ - "coordination_unit/coordination_unit_graph_observer_unittest.cc", "coordination_unit/coordination_unit_impl_unittest.cc", "coordination_unit/coordination_unit_impl_unittest_util.cc", "coordination_unit/coordination_unit_impl_unittest_util.h", - "coordination_unit/metrics_collector_unittest.cc", "coordination_unit/mock_coordination_unit_graphs.cc", "coordination_unit/mock_coordination_unit_graphs.h", - "coordination_unit/tab_signal_generator_impl_unittest.cc", - "coordination_unit/web_contents_coordination_unit_impl_unittest.cc", + "coordination_unit/page_coordination_unit_impl_unittest.cc", "memory_instrumentation/coordinator_impl_unittest.cc", "memory_instrumentation/process_map_unittest.cc", + "observers/coordination_unit_graph_observer_unittest.cc", + "observers/metrics_collector_unittest.cc", + "observers/tab_signal_generator_impl_unittest.cc", "public/cpp/memory_instrumentation/os_metrics_unittest.cc", "public/cpp/memory_instrumentation/struct_traits_unittest.cc", "public/cpp/memory_instrumentation/tracing_integration_unittest.cc",
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc index f1a61a1d..99e3473 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
@@ -8,10 +8,10 @@ #include "base/strings/string_number_conversions.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" namespace resource_coordinator { @@ -36,19 +36,17 @@ } // static -WebContentsCoordinationUnitImpl* -CoordinationUnitImpl::ToWebContentsCoordinationUnit( +PageCoordinationUnitImpl* CoordinationUnitImpl::ToPageCoordinationUnit( CoordinationUnitImpl* coordination_unit) { - DCHECK(coordination_unit->id().type == CoordinationUnitType::kWebContents); - return static_cast<WebContentsCoordinationUnitImpl*>(coordination_unit); + DCHECK(coordination_unit->id().type == CoordinationUnitType::kPage); + return static_cast<PageCoordinationUnitImpl*>(coordination_unit); } // static -const WebContentsCoordinationUnitImpl* -CoordinationUnitImpl::ToWebContentsCoordinationUnit( +const PageCoordinationUnitImpl* CoordinationUnitImpl::ToPageCoordinationUnit( const CoordinationUnitImpl* cu) { - DCHECK(cu->id().type == CoordinationUnitType::kWebContents); - return static_cast<const WebContentsCoordinationUnitImpl*>(cu); + DCHECK(cu->id().type == CoordinationUnitType::kPage); + return static_cast<const PageCoordinationUnitImpl*>(cu); } // static @@ -84,8 +82,8 @@ new_cu = base::MakeUnique<ProcessCoordinationUnitImpl>( id, std::move(service_ref)); break; - case CoordinationUnitType::kWebContents: - new_cu = base::MakeUnique<WebContentsCoordinationUnitImpl>( + case CoordinationUnitType::kPage: + new_cu = base::MakeUnique<PageCoordinationUnitImpl>( id, std::move(service_ref)); break; default:
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h index 4bac3b5..6ffc4fb6 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
@@ -24,7 +24,7 @@ class CoordinationUnitGraphObserver; class FrameCoordinationUnitImpl; -class WebContentsCoordinationUnitImpl; +class PageCoordinationUnitImpl; class CoordinationUnitImpl : public mojom::CoordinationUnit { public: @@ -36,9 +36,9 @@ static const FrameCoordinationUnitImpl* ToFrameCoordinationUnit( const CoordinationUnitImpl* coordination_unit); - static WebContentsCoordinationUnitImpl* ToWebContentsCoordinationUnit( + static PageCoordinationUnitImpl* ToPageCoordinationUnit( CoordinationUnitImpl* coordination_unit); - static const WebContentsCoordinationUnitImpl* ToWebContentsCoordinationUnit( + static const PageCoordinationUnitImpl* ToPageCoordinationUnit( const CoordinationUnitImpl* coordination_unit); static std::vector<CoordinationUnitImpl*> GetCoordinationUnitsOfType(
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc index 65b92e933..fa2127c 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc
@@ -27,20 +27,15 @@ } // namespace TEST_F(CoordinationUnitImplTest, AddChildBasic) { - CoordinationUnitID tab_cu_id(CoordinationUnitType::kFrame, std::string()); - CoordinationUnitID frame1_cu_id(CoordinationUnitType::kFrame, std::string()); - CoordinationUnitID frame2_cu_id(CoordinationUnitType::kFrame, std::string()); - CoordinationUnitID frame3_cu_id(CoordinationUnitType::kFrame, std::string()); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); + auto frame1_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); + auto frame2_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); + auto frame3_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - auto tab_cu = CreateCoordinationUnit(tab_cu_id); - auto frame1_cu = CreateCoordinationUnit(frame1_cu_id); - auto frame2_cu = CreateCoordinationUnit(frame2_cu_id); - auto frame3_cu = CreateCoordinationUnit(frame3_cu_id); - - tab_cu->AddChild(frame1_cu->id()); - tab_cu->AddChild(frame2_cu->id()); - tab_cu->AddChild(frame3_cu->id()); - EXPECT_EQ(3u, tab_cu->children().size()); + page_cu->AddChild(frame1_cu->id()); + page_cu->AddChild(frame2_cu->id()); + page_cu->AddChild(frame3_cu->id()); + EXPECT_EQ(3u, page_cu->children().size()); } #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST @@ -114,8 +109,7 @@ } TEST_F(CoordinationUnitImplTest, GetSetProperty) { - auto coordination_unit = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto coordination_unit = CreateCoordinationUnit(CoordinationUnitType::kPage); // An empty value should be returned if property is not found int64_t test_value; @@ -131,102 +125,102 @@ } TEST_F(CoordinationUnitImplTest, - GetAssociatedCoordinationUnitsForSingleTabInSingleProcess) { - MockSingleTabInSingleProcessCoordinationUnitGraph cu_graph; + GetAssociatedCoordinationUnitsForSinglePageInSingleProcess) { + MockSinglePageInSingleProcessCoordinationUnitGraph cu_graph; - auto tabs_associated_with_process = + auto pages_associated_with_process = cu_graph.process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(1u, tabs_associated_with_process.size()); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(1u, pages_associated_with_process.size()); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.page.get())); - auto processes_associated_with_tab = - cu_graph.tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_page = + cu_graph.page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(1u, processes_associated_with_tab.size()); - EXPECT_EQ(1u, processes_associated_with_tab.count(cu_graph.process.get())); + EXPECT_EQ(1u, processes_associated_with_page.size()); + EXPECT_EQ(1u, processes_associated_with_page.count(cu_graph.process.get())); } TEST_F(CoordinationUnitImplTest, - GetAssociatedCoordinationUnitsForMultipleTabsInSingleProcess) { - MockMultipleTabsInSingleProcessCoordinationUnitGraph cu_graph; + GetAssociatedCoordinationUnitsForMultiplePagesInSingleProcess) { + MockMultiplePagesInSingleProcessCoordinationUnitGraph cu_graph; - auto tabs_associated_with_process = + auto pages_associated_with_process = cu_graph.process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(2u, tabs_associated_with_process.size()); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.tab.get())); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.other_tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(2u, pages_associated_with_process.size()); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.page.get())); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.other_page.get())); - auto processes_associated_with_tab = - cu_graph.tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_page = + cu_graph.page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(1u, processes_associated_with_tab.size()); - EXPECT_EQ(1u, processes_associated_with_tab.count(cu_graph.process.get())); + EXPECT_EQ(1u, processes_associated_with_page.size()); + EXPECT_EQ(1u, processes_associated_with_page.count(cu_graph.process.get())); - auto processes_associated_with_other_tab = - cu_graph.other_tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_other_page = + cu_graph.other_page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(1u, processes_associated_with_other_tab.size()); - EXPECT_EQ(1u, processes_associated_with_tab.count(cu_graph.process.get())); + EXPECT_EQ(1u, processes_associated_with_other_page.size()); + EXPECT_EQ(1u, processes_associated_with_page.count(cu_graph.process.get())); } TEST_F(CoordinationUnitImplTest, - GetAssociatedCoordinationUnitsForSingleTabWithMultipleProcesses) { - MockSingleTabWithMultipleProcessesCoordinationUnitGraph cu_graph; + GetAssociatedCoordinationUnitsForSinglePageWithMultipleProcesses) { + MockSinglePageWithMultipleProcessesCoordinationUnitGraph cu_graph; - auto tabs_associated_with_process = + auto pages_associated_with_process = cu_graph.process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(1u, tabs_associated_with_process.size()); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(1u, pages_associated_with_process.size()); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.page.get())); - auto tabs_associated_with_other_process = + auto pages_associated_with_other_process = cu_graph.other_process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(1u, tabs_associated_with_other_process.size()); - EXPECT_EQ(1u, tabs_associated_with_other_process.count(cu_graph.tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(1u, pages_associated_with_other_process.size()); + EXPECT_EQ(1u, pages_associated_with_other_process.count(cu_graph.page.get())); - auto processes_associated_with_tab = - cu_graph.tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_page = + cu_graph.page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(2u, processes_associated_with_tab.size()); - EXPECT_EQ(1u, processes_associated_with_tab.count(cu_graph.process.get())); + EXPECT_EQ(2u, processes_associated_with_page.size()); + EXPECT_EQ(1u, processes_associated_with_page.count(cu_graph.process.get())); EXPECT_EQ(1u, - processes_associated_with_tab.count(cu_graph.other_process.get())); + processes_associated_with_page.count(cu_graph.other_process.get())); } TEST_F(CoordinationUnitImplTest, - GetAssociatedCoordinationUnitsForMultipleTabsWithMultipleProcesses) { - MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph cu_graph; + GetAssociatedCoordinationUnitsForMultiplePagesWithMultipleProcesses) { + MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph cu_graph; - auto tabs_associated_with_process = + auto pages_associated_with_process = cu_graph.process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(2u, tabs_associated_with_process.size()); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.tab.get())); - EXPECT_EQ(1u, tabs_associated_with_process.count(cu_graph.other_tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(2u, pages_associated_with_process.size()); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.page.get())); + EXPECT_EQ(1u, pages_associated_with_process.count(cu_graph.other_page.get())); - auto tabs_associated_with_other_process = + auto pages_associated_with_other_process = cu_graph.other_process->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - EXPECT_EQ(1u, tabs_associated_with_other_process.size()); - EXPECT_EQ(1u, - tabs_associated_with_other_process.count(cu_graph.other_tab.get())); + CoordinationUnitType::kPage); + EXPECT_EQ(1u, pages_associated_with_other_process.size()); + EXPECT_EQ( + 1u, pages_associated_with_other_process.count(cu_graph.other_page.get())); - auto processes_associated_with_tab = - cu_graph.tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_page = + cu_graph.page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(1u, processes_associated_with_tab.size()); - EXPECT_EQ(1u, processes_associated_with_tab.count(cu_graph.process.get())); + EXPECT_EQ(1u, processes_associated_with_page.size()); + EXPECT_EQ(1u, processes_associated_with_page.count(cu_graph.process.get())); - auto processes_associated_with_other_tab = - cu_graph.other_tab->GetAssociatedCoordinationUnitsOfType( + auto processes_associated_with_other_page = + cu_graph.other_page->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess); - EXPECT_EQ(2u, processes_associated_with_other_tab.size()); + EXPECT_EQ(2u, processes_associated_with_other_page.size()); EXPECT_EQ(1u, - processes_associated_with_other_tab.count(cu_graph.process.get())); - EXPECT_EQ(1u, processes_associated_with_other_tab.count( + processes_associated_with_other_page.count(cu_graph.process.get())); + EXPECT_EQ(1u, processes_associated_with_other_page.count( cu_graph.other_process.get())); }
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc index 861f655..54994963 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc
@@ -9,6 +9,7 @@ #include "base/process/process_handle.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" +#include "services/service_manager/public/cpp/bind_source_info.h" namespace resource_coordinator { @@ -31,12 +32,12 @@ process_info->pid = pid; DCHECK_NE(base::kNullProcessId, process_info->pid); - std::set<CoordinationUnitImpl*> web_contents_cus = + std::set<CoordinationUnitImpl*> page_cus = process_cu->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents); - for (CoordinationUnitImpl* web_contents_cu : web_contents_cus) { + CoordinationUnitType::kPage); + for (CoordinationUnitImpl* page_cu : page_cus) { int64_t ukm_source_id; - if (web_contents_cu->GetProperty( + if (page_cu->GetProperty( resource_coordinator::mojom::PropertyType::kUKMSourceId, &ukm_source_id)) { process_info->ukm_source_ids.push_back(ukm_source_id); @@ -48,7 +49,8 @@ } void CoordinationUnitIntrospectorImpl::BindToInterface( - resource_coordinator::mojom::CoordinationUnitIntrospectorRequest request) { + resource_coordinator::mojom::CoordinationUnitIntrospectorRequest request, + const service_manager::BindSourceInfo& source_info) { bindings_.AddBinding(this, std::move(request)); }
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.h index f668bc0..bd1f8a0 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.h
@@ -9,6 +9,10 @@ #include "services/resource_coordinator/public/interfaces/coordination_unit_introspector.mojom.h" #include "services/service_manager/public/cpp/bind_source_info.h" +namespace service_manager { +struct BindSourceInfo; +} // namespace service_manager + namespace resource_coordinator { class CoordinationUnitIntrospectorImpl @@ -18,7 +22,8 @@ ~CoordinationUnitIntrospectorImpl() override; void BindToInterface( - resource_coordinator::mojom::CoordinationUnitIntrospectorRequest request); + resource_coordinator::mojom::CoordinationUnitIntrospectorRequest request, + const service_manager::BindSourceInfo& source_info); // Overridden from mojom::CoordinationUnitIntrospector: void GetProcessToURLMap(const GetProcessToURLMapCallback& callback) override;
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc b/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc index a1abb5c..698ef54 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc
@@ -9,10 +9,11 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" #include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/binder_registry.h" namespace ukm { @@ -33,7 +34,8 @@ } void CoordinationUnitManager::OnStart( - service_manager::BinderRegistry* registry, + service_manager::BinderRegistryWithArgs< + const service_manager::BindSourceInfo&>* registry, service_manager::ServiceContextRefFactory* service_ref_factory) { provider_ = base::MakeUnique<CoordinationUnitProviderImpl>(service_ref_factory, this);
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_manager.h b/services/resource_coordinator/coordination_unit/coordination_unit_manager.h index f62b7d95..f5b9655 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_manager.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_manager.h
@@ -13,9 +13,11 @@ #include "base/macros.h" #include "services/metrics/public/cpp/mojo_ukm_recorder.h" #include "services/metrics/public/cpp/ukm_recorder.h" -#include "services/service_manager/public/cpp/binder_registry.h" namespace service_manager { +template <typename... BinderArgs> +class BinderRegistryWithArgs; +struct BindSourceInfo; class ServiceContextRefFactory; } // service_manager @@ -39,7 +41,8 @@ } ukm::MojoUkmRecorder* ukm_recorder() const { return ukm_recorder_; } - void OnStart(service_manager::BinderRegistry* registry, + void OnStart(service_manager::BinderRegistryWithArgs< + const service_manager::BindSourceInfo&>* registry, service_manager::ServiceContextRefFactory* service_ref_factory); void RegisterObserver( std::unique_ptr<CoordinationUnitGraphObserver> observer);
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc index ba37c5f..1a97e3c 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc
@@ -8,8 +8,8 @@ #include <utility> #include "base/macros.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" +#include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/service_context_ref.h" namespace resource_coordinator { @@ -49,7 +49,8 @@ } void CoordinationUnitProviderImpl::Bind( - resource_coordinator::mojom::CoordinationUnitProviderRequest request) { + resource_coordinator::mojom::CoordinationUnitProviderRequest request, + const service_manager::BindSourceInfo& source_info) { bindings_.AddBinding(this, std::move(request)); }
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h index ce31af6..7eefacd6 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h
@@ -14,6 +14,7 @@ #include "services/resource_coordinator/public/interfaces/coordination_unit_provider.mojom.h" namespace service_manager { +struct BindSourceInfo; class ServiceContextRefFactory; class ServiceContextRef; } // service_manager @@ -28,7 +29,8 @@ ~CoordinationUnitProviderImpl() override; void Bind( - resource_coordinator::mojom::CoordinationUnitProviderRequest request); + resource_coordinator::mojom::CoordinationUnitProviderRequest request, + const service_manager::BindSourceInfo& source_info); void OnConnectionError(CoordinationUnitImpl* coordination_unit);
diff --git a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc index a4a0c76..66d0449 100644 --- a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc
@@ -4,8 +4,8 @@ #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" namespace resource_coordinator { @@ -21,8 +21,8 @@ CoordinationUnitType type) const { switch (type) { case CoordinationUnitType::kProcess: - case CoordinationUnitType::kWebContents: - // Processes and WebContents are only associated with a frame if + case CoordinationUnitType::kPage: + // Processes and Page are only associated with a frame if // they are a direct parents of the frame. return GetParentCoordinationUnitsOfType(type); case CoordinationUnitType::kFrame: { @@ -60,12 +60,12 @@ } } -WebContentsCoordinationUnitImpl* -FrameCoordinationUnitImpl::GetWebContentsCoordinationUnit() const { +PageCoordinationUnitImpl* FrameCoordinationUnitImpl::GetPageCoordinationUnit() + const { for (auto* parent : parents_) { - if (parent->id().type != CoordinationUnitType::kWebContents) + if (parent->id().type != CoordinationUnitType::kPage) continue; - return CoordinationUnitImpl::ToWebContentsCoordinationUnit(parent); + return CoordinationUnitImpl::ToPageCoordinationUnit(parent); } return nullptr; }
diff --git a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h index c70647e..a9c8e11 100644 --- a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h
@@ -26,7 +26,7 @@ std::set<CoordinationUnitImpl*> GetAssociatedCoordinationUnitsOfType( CoordinationUnitType type) const override; - WebContentsCoordinationUnitImpl* GetWebContentsCoordinationUnit() const; + PageCoordinationUnitImpl* GetPageCoordinationUnit() const; bool IsMainFrame() const;
diff --git a/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.cc b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.cc index 5de45c7..d20fc729 100644 --- a/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.cc +++ b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.cc
@@ -26,51 +26,51 @@ } // namespace -MockSingleTabInSingleProcessCoordinationUnitGraph:: - MockSingleTabInSingleProcessCoordinationUnitGraph() +MockSinglePageInSingleProcessCoordinationUnitGraph:: + MockSinglePageInSingleProcessCoordinationUnitGraph() : frame(CreateCoordinationUnit(CoordinationUnitType::kFrame)), process(CreateCoordinationUnit(CoordinationUnitType::kProcess)), - tab(CreateCoordinationUnit(CoordinationUnitType::kWebContents)) { - tab->AddChild(frame->id()); + page(CreateCoordinationUnit(CoordinationUnitType::kPage)) { + page->AddChild(frame->id()); process->AddChild(frame->id()); } -MockSingleTabInSingleProcessCoordinationUnitGraph:: - ~MockSingleTabInSingleProcessCoordinationUnitGraph() = default; +MockSinglePageInSingleProcessCoordinationUnitGraph:: + ~MockSinglePageInSingleProcessCoordinationUnitGraph() = default; -MockMultipleTabsInSingleProcessCoordinationUnitGraph:: - MockMultipleTabsInSingleProcessCoordinationUnitGraph() +MockMultiplePagesInSingleProcessCoordinationUnitGraph:: + MockMultiplePagesInSingleProcessCoordinationUnitGraph() : other_frame(CreateCoordinationUnit(CoordinationUnitType::kFrame)), - other_tab(CreateCoordinationUnit(CoordinationUnitType::kWebContents)) { - other_tab->AddChild(other_frame->id()); + other_page(CreateCoordinationUnit(CoordinationUnitType::kPage)) { + other_page->AddChild(other_frame->id()); process->AddChild(other_frame->id()); } -MockMultipleTabsInSingleProcessCoordinationUnitGraph:: - ~MockMultipleTabsInSingleProcessCoordinationUnitGraph() = default; +MockMultiplePagesInSingleProcessCoordinationUnitGraph:: + ~MockMultiplePagesInSingleProcessCoordinationUnitGraph() = default; -MockSingleTabWithMultipleProcessesCoordinationUnitGraph:: - MockSingleTabWithMultipleProcessesCoordinationUnitGraph() +MockSinglePageWithMultipleProcessesCoordinationUnitGraph:: + MockSinglePageWithMultipleProcessesCoordinationUnitGraph() : child_frame(CreateCoordinationUnit(CoordinationUnitType::kFrame)), other_process(CreateCoordinationUnit(CoordinationUnitType::kProcess)) { frame->AddChild(child_frame->id()); - tab->AddChild(child_frame->id()); + page->AddChild(child_frame->id()); other_process->AddChild(child_frame->id()); } -MockSingleTabWithMultipleProcessesCoordinationUnitGraph:: - ~MockSingleTabWithMultipleProcessesCoordinationUnitGraph() = default; +MockSinglePageWithMultipleProcessesCoordinationUnitGraph:: + ~MockSinglePageWithMultipleProcessesCoordinationUnitGraph() = default; -MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph:: - MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph() +MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph:: + MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph() : child_frame(CreateCoordinationUnit(CoordinationUnitType::kFrame)), other_process(CreateCoordinationUnit(CoordinationUnitType::kProcess)) { other_frame->AddChild(child_frame->id()); - other_tab->AddChild(child_frame->id()); + other_page->AddChild(child_frame->id()); other_process->AddChild(child_frame->id()); } -MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph:: - ~MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph() = default; +MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph:: + ~MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph() = default; } // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h index 65044d0..894435a 100644 --- a/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h +++ b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h
@@ -12,91 +12,91 @@ namespace resource_coordinator { // The following coordination unit graph topology is created to emulate a -// scenario when a single tab are executes in a single process: +// scenario when a single page are executes in a single process: // -// T P +// P' P // \ / // F // // Where: -// T: tab // F: frame // P: process -struct MockSingleTabInSingleProcessCoordinationUnitGraph { - MockSingleTabInSingleProcessCoordinationUnitGraph(); - ~MockSingleTabInSingleProcessCoordinationUnitGraph(); +// P': page +struct MockSinglePageInSingleProcessCoordinationUnitGraph { + MockSinglePageInSingleProcessCoordinationUnitGraph(); + ~MockSinglePageInSingleProcessCoordinationUnitGraph(); TestCoordinationUnitWrapper frame; TestCoordinationUnitWrapper process; - TestCoordinationUnitWrapper tab; + TestCoordinationUnitWrapper page; }; // The following coordination unit graph topology is created to emulate a -// scenario where multiple tabs are executing in a single process: +// scenario where multiple pages are executing in a single process: // -// T P OT +// P' P OP' // \ / \ / // F OF // // Where: -// T: tab -// OT: other_tab // F: frame // OF: other_frame +// P': page +// OP': other_page // P: process -struct MockMultipleTabsInSingleProcessCoordinationUnitGraph - : public MockSingleTabInSingleProcessCoordinationUnitGraph { - MockMultipleTabsInSingleProcessCoordinationUnitGraph(); - ~MockMultipleTabsInSingleProcessCoordinationUnitGraph(); +struct MockMultiplePagesInSingleProcessCoordinationUnitGraph + : public MockSinglePageInSingleProcessCoordinationUnitGraph { + MockMultiplePagesInSingleProcessCoordinationUnitGraph(); + ~MockMultiplePagesInSingleProcessCoordinationUnitGraph(); TestCoordinationUnitWrapper other_frame; - TestCoordinationUnitWrapper other_tab; + TestCoordinationUnitWrapper other_page; }; // The following coordination unit graph topology is created to emulate a -// scenario where a single tab that has frames executing in different +// scenario where a single page that has frames executing in different // processes (e.g. out-of-process iFrames): // -// T P +// P' P // |\ / // | F OP // | \ / // |__CF // // Where: -// T: tab // F: frame // CF: chid_frame +// P': page // P: process // OP: other_process -struct MockSingleTabWithMultipleProcessesCoordinationUnitGraph - : public MockSingleTabInSingleProcessCoordinationUnitGraph { - MockSingleTabWithMultipleProcessesCoordinationUnitGraph(); - ~MockSingleTabWithMultipleProcessesCoordinationUnitGraph(); +struct MockSinglePageWithMultipleProcessesCoordinationUnitGraph + : public MockSinglePageInSingleProcessCoordinationUnitGraph { + MockSinglePageWithMultipleProcessesCoordinationUnitGraph(); + ~MockSinglePageWithMultipleProcessesCoordinationUnitGraph(); TestCoordinationUnitWrapper child_frame; TestCoordinationUnitWrapper other_process; }; // The following coordination unit graph topology is created to emulate a -// scenario where multiple tabs are utilizing multiple processes (e.g. -// out-of-process iFrames and multiple tabs in a process): +// scenario where multiple pages are utilizing multiple processes (e.g. +// out-of-process iFrames and multiple pages in a process): // -// T P OT____ +// P' P OP'___ // \ / \ / | // F OF OP | // \ / | // CF___| // // Where: -// T: tab_coordination_unit -// OT: other_tab_coordination_unit // F: frame_coordination_unit // OF: other_frame_coordination_unit // CF: another_frame_coordination_unit +// P': page_coordination_unit +// OP': other_page_coordination_unit // P: process_coordination_unit // OP: other_process_coordination_unit -struct MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph - : public MockMultipleTabsInSingleProcessCoordinationUnitGraph { - MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph(); - ~MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph(); +struct MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph + : public MockMultiplePagesInSingleProcessCoordinationUnitGraph { + MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph(); + ~MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph(); TestCoordinationUnitWrapper child_frame; TestCoordinationUnitWrapper other_process; };
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl.cc similarity index 70% rename from services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc rename to services/resource_coordinator/coordination_unit/page_coordination_unit_impl.cc index 496d5f2..1c1c2739a 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl.cc
@@ -2,31 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" #include "base/logging.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" namespace resource_coordinator { -WebContentsCoordinationUnitImpl::WebContentsCoordinationUnitImpl( +PageCoordinationUnitImpl::PageCoordinationUnitImpl( const CoordinationUnitID& id, std::unique_ptr<service_manager::ServiceContextRef> service_ref) : CoordinationUnitImpl(id, std::move(service_ref)) {} -WebContentsCoordinationUnitImpl::~WebContentsCoordinationUnitImpl() = default; +PageCoordinationUnitImpl::~PageCoordinationUnitImpl() = default; std::set<CoordinationUnitImpl*> -WebContentsCoordinationUnitImpl::GetAssociatedCoordinationUnitsOfType( +PageCoordinationUnitImpl::GetAssociatedCoordinationUnitsOfType( CoordinationUnitType type) const { switch (type) { case CoordinationUnitType::kProcess: { std::set<CoordinationUnitImpl*> process_coordination_units; // There is currently not a direct relationship between processes and - // tabs. However, frames are children of both processes and frames, so we - // find all of the processes that are reachable from the tabs's child + // pages. However, frames are children of both processes and frames, so we + // find all of the processes that are reachable from the pages's child // frames. for (auto* frame_coordination_unit : GetChildCoordinationUnitsOfType(CoordinationUnitType::kFrame)) { @@ -46,7 +46,7 @@ } } -void WebContentsCoordinationUnitImpl::RecalculateProperty( +void PageCoordinationUnitImpl::RecalculateProperty( const mojom::PropertyType property_type) { switch (property_type) { case mojom::PropertyType::kCPUUsage: { @@ -65,49 +65,48 @@ } } -bool WebContentsCoordinationUnitImpl::IsVisible() const { +bool PageCoordinationUnitImpl::IsVisible() const { int64_t is_visible; bool has_property = GetProperty(mojom::PropertyType::kVisible, &is_visible); DCHECK(has_property && (is_visible == 0 || is_visible == 1)); return is_visible; } -void WebContentsCoordinationUnitImpl::OnEventReceived( - const mojom::Event event) { +void PageCoordinationUnitImpl::OnEventReceived(const mojom::Event event) { for (auto& observer : observers()) - observer.OnWebContentsEventReceived(this, event); + observer.OnPageEventReceived(this, event); } -void WebContentsCoordinationUnitImpl::OnPropertyChanged( +void PageCoordinationUnitImpl::OnPropertyChanged( const mojom::PropertyType property_type, int64_t value) { for (auto& observer : observers()) { - observer.OnWebContentsPropertyChanged(this, property_type, value); + observer.OnPagePropertyChanged(this, property_type, value); } } -double WebContentsCoordinationUnitImpl::CalculateCPUUsage() { +double PageCoordinationUnitImpl::CalculateCPUUsage() { double cpu_usage = 0.0; for (auto* process_coordination_unit : GetAssociatedCoordinationUnitsOfType(CoordinationUnitType::kProcess)) { - size_t tabs_in_process = process_coordination_unit - ->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents) - .size(); - DCHECK_LE(1u, tabs_in_process); + size_t pages_in_process = + process_coordination_unit + ->GetAssociatedCoordinationUnitsOfType(CoordinationUnitType::kPage) + .size(); + DCHECK_LE(1u, pages_in_process); int64_t process_cpu_usage; if (process_coordination_unit->GetProperty(mojom::PropertyType::kCPUUsage, &process_cpu_usage)) { - cpu_usage += (double)process_cpu_usage / tabs_in_process; + cpu_usage += (double)process_cpu_usage / pages_in_process; } } return cpu_usage; } -bool WebContentsCoordinationUnitImpl::CalculateExpectedTaskQueueingDuration( +bool PageCoordinationUnitImpl::CalculateExpectedTaskQueueingDuration( int64_t* output) { // Calculate the EQT for the process of the main frame only because // the smoothness of the main frame may affect the users the most. @@ -130,8 +129,7 @@ ->GetProperty(mojom::PropertyType::kExpectedTaskQueueingDuration, output); } -CoordinationUnitImpl* -WebContentsCoordinationUnitImpl::GetMainFrameCoordinationUnit() { +CoordinationUnitImpl* PageCoordinationUnitImpl::GetMainFrameCoordinationUnit() { for (auto* cu : GetAssociatedCoordinationUnitsOfType(CoordinationUnitType::kFrame)) { if (ToFrameCoordinationUnit(cu)->IsMainFrame())
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h similarity index 67% rename from services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h rename to services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h index 83978422..3ef871c 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_WEB_CONTENTS_COORDINATION_UNIT_IMPL_H_ -#define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_WEB_CONTENTS_COORDINATION_UNIT_IMPL_H_ +#ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PAGE_COORDINATION_UNIT_IMPL_H_ +#define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PAGE_COORDINATION_UNIT_IMPL_H_ #include <set> @@ -12,12 +12,12 @@ namespace resource_coordinator { -class WebContentsCoordinationUnitImpl : public CoordinationUnitImpl { +class PageCoordinationUnitImpl : public CoordinationUnitImpl { public: - WebContentsCoordinationUnitImpl( + PageCoordinationUnitImpl( const CoordinationUnitID& id, std::unique_ptr<service_manager::ServiceContextRef> service_ref); - ~WebContentsCoordinationUnitImpl() override; + ~PageCoordinationUnitImpl() override; // CoordinationUnitImpl implementation. std::set<CoordinationUnitImpl*> GetAssociatedCoordinationUnitsOfType( @@ -36,12 +36,12 @@ // Returns true for a valid value. Returns false otherwise. bool CalculateExpectedTaskQueueingDuration(int64_t* output); - // Returns the main frame CU or nullptr if this tab has no main frame. + // Returns the main frame CU or nullptr if this page has no main frame. CoordinationUnitImpl* GetMainFrameCoordinationUnit(); - DISALLOW_COPY_AND_ASSIGN(WebContentsCoordinationUnitImpl); + DISALLOW_COPY_AND_ASSIGN(PageCoordinationUnitImpl); }; } // namespace resource_coordinator -#endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_WEB_CONTENTS_COORDINATION_UNIT_IMPL_H_ +#endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PAGE_COORDINATION_UNIT_IMPL_H_
diff --git a/services/resource_coordinator/coordination_unit/page_coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl_unittest.cc new file mode 100644 index 0000000..d7b9c43 --- /dev/null +++ b/services/resource_coordinator/coordination_unit/page_coordination_unit_impl_unittest.cc
@@ -0,0 +1,106 @@ +// 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 "base/run_loop.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h" +#include "services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace resource_coordinator { + +namespace { + +class PageCoordinationUnitImplTest : public CoordinationUnitImplTestBase {}; + +} // namespace + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageCPUUsageForSinglePageInSingleProcess) { + MockSinglePageInSingleProcessCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.page->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(40, cpu_usage); +} + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageCPUUsageForMultiplePagesInSingleProcess) { + MockMultiplePagesInSingleProcessCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.page->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(20, cpu_usage); + EXPECT_TRUE(cu_graph.other_page->GetProperty(mojom::PropertyType::kCPUUsage, + &cpu_usage)); + EXPECT_EQ(20, cpu_usage); +} + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageCPUUsageForSinglePageWithMultipleProcesses) { + MockSinglePageWithMultipleProcessesCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); + + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.page->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(70, cpu_usage); +} + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageCPUUsageForMultiplePagesWithMultipleProcesses) { + MockMultiplePagesWithMultipleProcessesCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); + + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.page->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(20, cpu_usage); + EXPECT_TRUE(cu_graph.other_page->GetProperty(mojom::PropertyType::kCPUUsage, + &cpu_usage)); + EXPECT_EQ(50, cpu_usage); +} + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageEQTForSinglePageInSingleProcess) { + MockSinglePageInSingleProcessCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty( + mojom::PropertyType::kExpectedTaskQueueingDuration, 1); + + int64_t eqt; + ASSERT_TRUE(cu_graph.page->GetProperty( + mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); + EXPECT_EQ(1, eqt); +} + +TEST_F(PageCoordinationUnitImplTest, + CalculatePageEQTForMultiplePagesInSingleProcess) { + MockMultiplePagesInSingleProcessCoordinationUnitGraph cu_graph; + + cu_graph.process->SetProperty( + mojom::PropertyType::kExpectedTaskQueueingDuration, 1); + + int64_t eqt; + ASSERT_TRUE(cu_graph.page->GetProperty( + mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); + EXPECT_EQ(1, eqt); + ASSERT_TRUE(cu_graph.other_page->GetProperty( + mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); + EXPECT_EQ(1, eqt); +} + +} // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc index 22aff1d..c8e775b 100644 --- a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc
@@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/values.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" namespace resource_coordinator { @@ -22,24 +22,22 @@ ProcessCoordinationUnitImpl::GetAssociatedCoordinationUnitsOfType( CoordinationUnitType type) const { switch (type) { - case CoordinationUnitType::kWebContents: { + case CoordinationUnitType::kPage: { // There is currently not a direct relationship between processes and - // tabs. However, frames are children of both processes and frames, so we - // find all of the tabs that are reachable from the process's child + // pages. However, frames are children of both processes and frames, so we + // find all of the pages that are reachable from the process's child // frames. - std::set<CoordinationUnitImpl*> web_contents_coordination_units; + std::set<CoordinationUnitImpl*> page_cus; - for (auto* frame_coordination_unit : + for (auto* frame_cu : GetChildCoordinationUnitsOfType(CoordinationUnitType::kFrame)) { - for (auto* web_contents_coordination_unit : - frame_coordination_unit->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents)) { - web_contents_coordination_units.insert( - web_contents_coordination_unit); + for (auto* page_cu : frame_cu->GetAssociatedCoordinationUnitsOfType( + CoordinationUnitType::kPage)) { + page_cus.insert(page_cu); } } - return web_contents_coordination_units; + return page_cus; } case CoordinationUnitType::kFrame: return GetChildCoordinationUnitsOfType(type); @@ -52,11 +50,11 @@ mojom::PropertyType property_type, int64_t value) { switch (property_type) { - // Trigger WebContents CU to recalculate their CPU usage. + // Trigger Page CU to recalculate their CPU usage. case mojom::PropertyType::kCPUUsage: { - for (auto* web_contents_cu : GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents)) { - web_contents_cu->RecalculateProperty(mojom::PropertyType::kCPUUsage); + for (auto* page_cu : + GetAssociatedCoordinationUnitsOfType(CoordinationUnitType::kPage)) { + page_cu->RecalculateProperty(mojom::PropertyType::kCPUUsage); } break; } @@ -68,10 +66,10 @@ if (!frame_cu->IsMainFrame()) continue; - auto* web_contents_cu = frame_cu->GetWebContentsCoordinationUnit(); + auto* page_cu = frame_cu->GetPageCoordinationUnit(); - if (web_contents_cu) { - web_contents_cu->RecalculateProperty( + if (page_cu) { + page_cu->RecalculateProperty( mojom::PropertyType::kExpectedTaskQueueingDuration); } }
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc deleted file mode 100644 index bad4ddd..0000000 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc +++ /dev/null
@@ -1,108 +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 "base/run_loop.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h" -#include "services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h" -#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" -#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace resource_coordinator { - -namespace { - -class WebContentsCoordinationUnitImplTest - : public CoordinationUnitImplTestBase {}; - -} // namespace - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabCPUUsageForSingleTabInSingleProcess) { - MockSingleTabInSingleProcessCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - - int64_t cpu_usage; - EXPECT_TRUE( - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); - EXPECT_EQ(40, cpu_usage); -} - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabCPUUsageForMultipleTabsInSingleProcess) { - MockMultipleTabsInSingleProcessCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - - int64_t cpu_usage; - EXPECT_TRUE( - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); - EXPECT_EQ(20, cpu_usage); - EXPECT_TRUE(cu_graph.other_tab->GetProperty(mojom::PropertyType::kCPUUsage, - &cpu_usage)); - EXPECT_EQ(20, cpu_usage); -} - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabCPUUsageForSingleTabWithMultipleProcesses) { - MockSingleTabWithMultipleProcessesCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); - - int64_t cpu_usage; - EXPECT_TRUE( - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); - EXPECT_EQ(70, cpu_usage); -} - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabCPUUsageForMultipleTabsWithMultipleProcesses) { - MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); - - int64_t cpu_usage; - EXPECT_TRUE( - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); - EXPECT_EQ(20, cpu_usage); - EXPECT_TRUE(cu_graph.other_tab->GetProperty(mojom::PropertyType::kCPUUsage, - &cpu_usage)); - EXPECT_EQ(50, cpu_usage); -} - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabEQTForSingleTabInSingleProcess) { - MockSingleTabInSingleProcessCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty( - mojom::PropertyType::kExpectedTaskQueueingDuration, 1); - - int64_t eqt; - ASSERT_TRUE(cu_graph.tab->GetProperty( - mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); - EXPECT_EQ(1, eqt); -} - -TEST_F(WebContentsCoordinationUnitImplTest, - CalculateTabEQTForMultipleTabsInSingleProcess) { - MockMultipleTabsInSingleProcessCoordinationUnitGraph cu_graph; - - cu_graph.process->SetProperty( - mojom::PropertyType::kExpectedTaskQueueingDuration, 1); - - int64_t eqt; - ASSERT_TRUE(cu_graph.tab->GetProperty( - mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); - EXPECT_EQ(1, eqt); - ASSERT_TRUE(cu_graph.other_tab->GetProperty( - mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); - EXPECT_EQ(1, eqt); -} - -} // namespace resource_coordinator
diff --git a/services/resource_coordinator/manifest.json b/services/resource_coordinator/manifest.json index 855e1ab1..80646649 100644 --- a/services/resource_coordinator/manifest.json +++ b/services/resource_coordinator/manifest.json
@@ -4,16 +4,24 @@ "interface_provider_specs": { "service_manager:connector": { "provides": { + "app": [ + "memory_instrumentation::mojom::Coordinator", + "tracing::mojom::AgentRegistry" + ], "coordination_unit_introspector": [ "resource_coordinator::mojom::CoordinationUnitIntrospector" ], "coordination_unit": [ "resource_coordinator::mojom::CoordinationUnitProvider" ], "service_callbacks": [ "resource_coordinator::mojom::ServiceCallbacks" ], "tab_signal": [ "resource_coordinator::mojom::TabSignalGenerator" ], + "tracing": [ "tracing::mojom::Coordinator" ], "tests": [ "*" ] }, "requires": { - "service_manager": [ "service_manager:all_users" ] + "service_manager": [ + "service_manager:all_users", + "service_manager:service_manager" + ] } } }
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc index d894662..50d3de80 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc
@@ -103,12 +103,7 @@ base::ProcessId CoordinatorImpl::GetProcessIdForClientIdentity( service_manager::Identity identity) const { - // TODO(primiano): the browser process registers bypassing mojo and ends up - // with an invalid identity. Fix that (crbug.com/733165) and remove the - // special case in the else branch below. - if (!identity.IsValid()) { - return base::GetCurrentProcId(); - } + DCHECK(identity.IsValid()); return process_map_->GetProcessId(identity); } @@ -268,7 +263,6 @@ service_manager::Identity client_identity = kv.second->identity; const base::ProcessId pid = GetProcessIdForClientIdentity(client_identity); if (pid == base::kNullProcessId) { - // TODO(hjd): Change to NOTREACHED when crbug.com/739710 is fixed. VLOG(1) << "Couldn't find a PID for client \"" << client_identity.name() << "." << client_identity.instance() << "\""; continue; @@ -311,7 +305,6 @@ service_manager::Identity client_identity = kv.second->identity; const base::ProcessId pid = GetProcessIdForClientIdentity(client_identity); if (pid == base::kNullProcessId) { - // TODO(hjd): Change to NOTREACHED when crbug.com/739710 is fixed. VLOG(1) << "Couldn't find a PID for client \"" << client_identity.name() << "." << client_identity.instance() << "\""; continue;
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h index ca4512e2..196a644c 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl.h +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl.h
@@ -20,8 +20,10 @@ #include "services/resource_coordinator/public/cpp/memory_instrumentation/coordinator.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer.h" #include "services/resource_coordinator/public/interfaces/memory_instrumentation/memory_instrumentation.mojom.h" +#include "services/service_manager/public/cpp/identity.h" namespace service_manager { +struct BindSourceInfo; class Connector; }
diff --git a/services/resource_coordinator/coordination_unit/background_metrics_reporter.h b/services/resource_coordinator/observers/background_metrics_reporter.h similarity index 97% rename from services/resource_coordinator/coordination_unit/background_metrics_reporter.h rename to services/resource_coordinator/observers/background_metrics_reporter.h index a2692a6..4f35c53 100644 --- a/services/resource_coordinator/coordination_unit/background_metrics_reporter.h +++ b/services/resource_coordinator/observers/background_metrics_reporter.h
@@ -10,7 +10,7 @@ #include "base/time/time.h" #include "services/metrics/public/cpp/ukm_builders.h" -// Tabs can be kept in the background for a long time, metrics show 75th +// Pages can be kept in the background for a long time, metrics show 75th // percentile of time spent in background is 2.5 hours, and the 95th is 24 hour. // In order to guide the selection of an appropriate observation window we are // proposing using a CUSTOM_TIMES histogram from 1s to 48h, with 100 buckets.
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc b/services/resource_coordinator/observers/coordination_unit_graph_observer.cc similarity index 69% rename from services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc rename to services/resource_coordinator/observers/coordination_unit_graph_observer.cc index fc69dab..7e752f1a 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc +++ b/services/resource_coordinator/observers/coordination_unit_graph_observer.cc
@@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" - -#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" namespace resource_coordinator {
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h b/services/resource_coordinator/observers/coordination_unit_graph_observer.h similarity index 90% rename from services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h rename to services/resource_coordinator/observers/coordination_unit_graph_observer.h index 6630ec7..f49dec2 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h +++ b/services/resource_coordinator/observers/coordination_unit_graph_observer.h
@@ -13,7 +13,7 @@ class CoordinationUnitImpl; class CoordinationUnitManager; class FrameCoordinationUnitImpl; -class WebContentsCoordinationUnitImpl; +class PageCoordinationUnitImpl; // An observer API for the coordination unit graph maintained by GRC. // @@ -81,11 +81,10 @@ const mojom::PropertyType property_type, int64_t value) {} - // Called whenever a property of the WebContentsCoordinationUnit is changed. - virtual void OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* web_contents_cu, - const mojom::PropertyType property_type, - int64_t value) {} + // Called whenever a property of the PageCoordinationUnit is changed. + virtual void OnPagePropertyChanged(const PageCoordinationUnitImpl* page_cu, + const mojom::PropertyType property_type, + int64_t value) {} // Called whenever an event is received in |coordination_unit| if the // |coordination_unit| doesn't implement its own EventReceived handler. @@ -93,9 +92,8 @@ const mojom::Event event) {} virtual void OnFrameEventReceived(const FrameCoordinationUnitImpl* frame_cu, const mojom::Event event) {} - virtual void OnWebContentsEventReceived( - const WebContentsCoordinationUnitImpl* web_contents_cu, - const mojom::Event event) {} + virtual void OnPageEventReceived(const PageCoordinationUnitImpl* page_cu, + const mojom::Event event) {} void set_coordination_unit_manager( CoordinationUnitManager* coordination_unit_manager) {
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc b/services/resource_coordinator/observers/coordination_unit_graph_observer_unittest.cc similarity index 98% rename from services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc rename to services/resource_coordinator/observers/coordination_unit_graph_observer_unittest.cc index d186d08a..ab1113a0 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc +++ b/services/resource_coordinator/observers/coordination_unit_graph_observer_unittest.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 "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" #include <string>
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector.cc b/services/resource_coordinator/observers/metrics_collector.cc similarity index 67% rename from services/resource_coordinator/coordination_unit/metrics_collector.cc rename to services/resource_coordinator/observers/metrics_collector.cc index 409bb30..881aff6 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector.cc +++ b/services/resource_coordinator/observers/metrics_collector.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 "services/resource_coordinator/coordination_unit/metrics_collector.h" +#include "services/resource_coordinator/observers/metrics_collector.h" #include "base/metrics/histogram_macros.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" #include "services/resource_coordinator/public/cpp/resource_coordinator_features.h" @@ -16,7 +16,7 @@ const size_t kDefaultMaxCPUUsageMeasurements = 30u; -// Audio is considered to have started playing if the tab has never +// Audio is considered to have started playing if the page has never // previously played audio, or has been silent for at least one minute. const base::TimeDelta kMaxAudioSlientTimeout = base::TimeDelta::FromMinutes(1); // Delay the metrics report from GRC to UMA/UKM for 5 minutes from when the main @@ -37,16 +37,16 @@ "FromBackgroundedToFirstNonPersistentNotificationCreated"; // Gets the number of tabs that are co-resident in all of the render processes -// associated with a |CoordinationUnitType::kWebContents| coordination unit. +// associated with a |CoordinationUnitType::kPage| coordination unit. size_t GetNumCoresidentTabs(const CoordinationUnitImpl* coordination_unit) { - DCHECK_EQ(CoordinationUnitType::kWebContents, coordination_unit->id().type); + DCHECK_EQ(CoordinationUnitType::kPage, coordination_unit->id().type); std::set<CoordinationUnitImpl*> coresident_tabs; for (auto* process_coordination_unit : coordination_unit->GetAssociatedCoordinationUnitsOfType( CoordinationUnitType::kProcess)) { for (auto* tab_coordination_unit : process_coordination_unit->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kWebContents)) { + CoordinationUnitType::kPage)) { coresident_tabs.insert(tab_coordination_unit); } } @@ -65,12 +65,12 @@ bool MetricsCollector::ShouldObserve( const CoordinationUnitImpl* coordination_unit) { return coordination_unit->id().type == CoordinationUnitType::kFrame || - coordination_unit->id().type == CoordinationUnitType::kWebContents; + coordination_unit->id().type == CoordinationUnitType::kPage; } void MetricsCollector::OnCoordinationUnitCreated( const CoordinationUnitImpl* coordination_unit) { - if (coordination_unit->id().type == CoordinationUnitType::kWebContents) { + if (coordination_unit->id().type == CoordinationUnitType::kPage) { metrics_report_record_map_.emplace(coordination_unit->id(), MetricsReportRecord()); } @@ -80,9 +80,8 @@ const CoordinationUnitImpl* coordination_unit) { if (coordination_unit->id().type == CoordinationUnitType::kFrame) { frame_data_map_.erase(coordination_unit->id()); - } else if (coordination_unit->id().type == - CoordinationUnitType::kWebContents) { - web_contents_data_map_.erase(coordination_unit->id()); + } else if (coordination_unit->id().type == CoordinationUnitType::kPage) { + page_data_map_.erase(coordination_unit->id()); metrics_report_record_map_.erase(coordination_unit->id()); ukm_cpu_usage_collection_state_map_.erase(coordination_unit->id()); } @@ -99,21 +98,18 @@ frame_data.last_audible_time = clock_->NowTicks(); return; } - auto* web_contents_cu = frame_cu->GetWebContentsCoordinationUnit(); + auto* page_cu = frame_cu->GetPageCoordinationUnit(); // Only record metrics while it is backgrounded. - if (!web_contents_cu || web_contents_cu->IsVisible() || - !ShouldReportMetrics(web_contents_cu)) { + if (!page_cu || page_cu->IsVisible() || !ShouldReportMetrics(page_cu)) { return; } - // Audio is considered to have started playing if the tab has never + // Audio is considered to have started playing if the page has never // previously played audio, or has been silent for at least one minute. auto now = clock_->NowTicks(); if (frame_data.last_audible_time + kMaxAudioSlientTimeout < now) { MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu->id())->second; - auto duration = - now - - web_contents_data_map_[web_contents_cu->id()].last_invisible_time; + metrics_report_record_map_.find(page_cu->id())->second; + auto duration = now - page_data_map_[page_cu->id()].last_invisible_time; record.first_audible.OnSignalReceived( frame_cu->IsMainFrame(), duration, coordination_unit_manager().ukm_recorder()); @@ -121,31 +117,29 @@ } } -void MetricsCollector::OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* web_contents_cu, +void MetricsCollector::OnPagePropertyChanged( + const PageCoordinationUnitImpl* page_cu, const mojom::PropertyType property_type, int64_t value) { - const auto web_contents_cu_id = web_contents_cu->id(); + const auto page_cu_id = page_cu->id(); if (property_type == mojom::PropertyType::kVisible) { if (value) { - // The web contents becomes visible again, clear all record in order to - // report metrics when web contents becomes invisible next time. - ResetMetricsReportRecord(web_contents_cu_id); + // The page becomes visible again, clear all record in order to + // report metrics when page becomes invisible next time. + ResetMetricsReportRecord(page_cu_id); return; } - web_contents_data_map_[web_contents_cu_id].last_invisible_time = - clock_->NowTicks(); + page_data_map_[page_cu_id].last_invisible_time = clock_->NowTicks(); } else if (property_type == mojom::PropertyType::kCPUUsage) { - if (IsCollectingCPUUsageForUkm(web_contents_cu_id)) { - RecordCPUUsageForUkm(web_contents_cu_id, - static_cast<double>(value) / 1000, - GetNumCoresidentTabs(web_contents_cu)); + if (IsCollectingCPUUsageForUkm(page_cu_id)) { + RecordCPUUsageForUkm(page_cu_id, static_cast<double>(value) / 1000, + GetNumCoresidentTabs(page_cu)); } } else if (property_type == mojom::PropertyType::kUKMSourceId) { ukm::SourceId ukm_source_id = value; - UpdateUkmSourceIdForWebContents(web_contents_cu_id, ukm_source_id); + UpdateUkmSourceIdForPage(page_cu_id, ukm_source_id); MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu_id)->second; + metrics_report_record_map_.find(page_cu_id)->second; record.UpdateUKMSourceID(ukm_source_id); } } @@ -154,91 +148,84 @@ const FrameCoordinationUnitImpl* frame_cu, const mojom::Event event) { if (event == mojom::Event::kAlertFired) { - auto* web_contents_cu = frame_cu->GetWebContentsCoordinationUnit(); + auto* page_cu = frame_cu->GetPageCoordinationUnit(); // Only record metrics while it is backgrounded. - if (!web_contents_cu || web_contents_cu->IsVisible() || - !ShouldReportMetrics(web_contents_cu)) { + if (!page_cu || page_cu->IsVisible() || !ShouldReportMetrics(page_cu)) { return; } auto duration = - clock_->NowTicks() - - web_contents_data_map_[web_contents_cu->id()].last_invisible_time; + clock_->NowTicks() - page_data_map_[page_cu->id()].last_invisible_time; MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu->id())->second; + metrics_report_record_map_.find(page_cu->id())->second; record.first_alert_fired.OnSignalReceived( frame_cu->IsMainFrame(), duration, coordination_unit_manager().ukm_recorder()); } else if (event == mojom::Event::kNonPersistentNotificationCreated) { - auto* web_contents_cu = frame_cu->GetWebContentsCoordinationUnit(); + auto* page_cu = frame_cu->GetPageCoordinationUnit(); // Only record metrics while it is backgrounded. - if (!web_contents_cu || web_contents_cu->IsVisible() || - !ShouldReportMetrics(web_contents_cu)) { + if (!page_cu || page_cu->IsVisible() || !ShouldReportMetrics(page_cu)) { return; } auto duration = - clock_->NowTicks() - - web_contents_data_map_[web_contents_cu->id()].last_invisible_time; + clock_->NowTicks() - page_data_map_[page_cu->id()].last_invisible_time; MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu->id())->second; + metrics_report_record_map_.find(page_cu->id())->second; record.first_non_persistent_notification_created.OnSignalReceived( frame_cu->IsMainFrame(), duration, coordination_unit_manager().ukm_recorder()); } } -void MetricsCollector::OnWebContentsEventReceived( - const WebContentsCoordinationUnitImpl* web_contents_cu, +void MetricsCollector::OnPageEventReceived( + const PageCoordinationUnitImpl* page_cu, const mojom::Event event) { if (event == mojom::Event::kTitleUpdated) { // Only record metrics while it is backgrounded. - if (web_contents_cu->IsVisible() || !ShouldReportMetrics(web_contents_cu)) + if (page_cu->IsVisible() || !ShouldReportMetrics(page_cu)) return; auto duration = - clock_->NowTicks() - - web_contents_data_map_[web_contents_cu->id()].last_invisible_time; + clock_->NowTicks() - page_data_map_[page_cu->id()].last_invisible_time; MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu->id())->second; + metrics_report_record_map_.find(page_cu->id())->second; record.first_title_updated.OnSignalReceived( true, duration, coordination_unit_manager().ukm_recorder()); } else if (event == mojom::Event::kFaviconUpdated) { // Only record metrics while it is backgrounded. - if (web_contents_cu->IsVisible() || !ShouldReportMetrics(web_contents_cu)) + if (page_cu->IsVisible() || !ShouldReportMetrics(page_cu)) return; auto duration = - clock_->NowTicks() - - web_contents_data_map_[web_contents_cu->id()].last_invisible_time; + clock_->NowTicks() - page_data_map_[page_cu->id()].last_invisible_time; MetricsReportRecord& record = - metrics_report_record_map_.find(web_contents_cu->id())->second; + metrics_report_record_map_.find(page_cu->id())->second; record.first_favicon_updated.OnSignalReceived( true, duration, coordination_unit_manager().ukm_recorder()); } else if (event == mojom::Event::kNavigationCommitted) { - web_contents_data_map_[web_contents_cu->id()].navigation_finished_time = - clock_->NowTicks(); + page_data_map_[page_cu->id()].navigation_finished_time = clock_->NowTicks(); } } bool MetricsCollector::ShouldReportMetrics( - const WebContentsCoordinationUnitImpl* web_contents_cu) { - return clock_->NowTicks() - web_contents_data_map_[web_contents_cu->id()] - .navigation_finished_time > + const PageCoordinationUnitImpl* page_cu) { + return clock_->NowTicks() - + page_data_map_[page_cu->id()].navigation_finished_time > kMetricsReportDelayTimeout; } bool MetricsCollector::IsCollectingCPUUsageForUkm( - const CoordinationUnitID& web_contents_cu_id) { + const CoordinationUnitID& page_cu_id) { UkmCPUUsageCollectionState& state = - ukm_cpu_usage_collection_state_map_[web_contents_cu_id]; + ukm_cpu_usage_collection_state_map_[page_cu_id]; return state.ukm_source_id > -1 && state.num_cpu_usage_measurements < max_ukm_cpu_usage_measurements_; } void MetricsCollector::RecordCPUUsageForUkm( - const CoordinationUnitID& web_contents_cu_id, + const CoordinationUnitID& page_cu_id, double cpu_usage, size_t num_coresident_tabs) { UkmCPUUsageCollectionState& state = - ukm_cpu_usage_collection_state_map_[web_contents_cu_id]; + ukm_cpu_usage_collection_state_map_[page_cu_id]; ukm::builders::CPUUsageMeasurement(state.ukm_source_id) .SetTick(state.num_cpu_usage_measurements++) @@ -247,11 +234,11 @@ .Record(coordination_unit_manager().ukm_recorder()); } -void MetricsCollector::UpdateUkmSourceIdForWebContents( - const CoordinationUnitID& web_contents_cu_id, +void MetricsCollector::UpdateUkmSourceIdForPage( + const CoordinationUnitID& page_cu_id, ukm::SourceId ukm_source_id) { UkmCPUUsageCollectionState& state = - ukm_cpu_usage_collection_state_map_[web_contents_cu_id]; + ukm_cpu_usage_collection_state_map_[page_cu_id]; state.ukm_source_id = ukm_source_id; // Updating the |ukm_source_id| restarts CPU usage collection.
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector.h b/services/resource_coordinator/observers/metrics_collector.h similarity index 82% rename from services/resource_coordinator/coordination_unit/metrics_collector.h rename to services/resource_coordinator/observers/metrics_collector.h index 16c6eed..c0d40c3 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector.h +++ b/services/resource_coordinator/observers/metrics_collector.h
@@ -10,14 +10,14 @@ #include "base/time/default_tick_clock.h" #include "base/time/time.h" #include "services/metrics/public/cpp/ukm_builders.h" -#include "services/resource_coordinator/coordination_unit/background_metrics_reporter.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" +#include "services/resource_coordinator/observers/background_metrics_reporter.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" namespace resource_coordinator { class CoordinationUnitImpl; class FrameCoordinationUnitImpl; -class WebContentsCoordinationUnitImpl; +class PageCoordinationUnitImpl; extern const char kTabFromBackgroundedToFirstAlertFiredUMA[]; extern const char kTabFromBackgroundedToFirstAudioStartsUMA[]; @@ -44,15 +44,13 @@ void OnFramePropertyChanged(const FrameCoordinationUnitImpl* frame_cu, const mojom::PropertyType property_type, int64_t value) override; - void OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* web_contents_cu, - const mojom::PropertyType property_type, - int64_t value) override; + void OnPagePropertyChanged(const PageCoordinationUnitImpl* page_cu, + const mojom::PropertyType property_type, + int64_t value) override; void OnFrameEventReceived(const FrameCoordinationUnitImpl* frame_cu, const mojom::Event event) override; - void OnWebContentsEventReceived( - const WebContentsCoordinationUnitImpl* web_contents_cu, - const mojom::Event event) override; + void OnPageEventReceived(const PageCoordinationUnitImpl* page_cu, + const mojom::Event event) override; private: friend class MetricsCollectorTest; @@ -94,7 +92,7 @@ base::TimeTicks last_audible_time; }; - struct WebContentsData { + struct PageData { base::TimeTicks last_invisible_time; base::TimeTicks navigation_finished_time; }; @@ -106,15 +104,13 @@ ukm::SourceId ukm_source_id = -1; }; - bool ShouldReportMetrics( - const WebContentsCoordinationUnitImpl* web_contents_cu); - bool IsCollectingCPUUsageForUkm(const CoordinationUnitID& web_contents_cu_id); - void RecordCPUUsageForUkm(const CoordinationUnitID& web_contents_cu_id, + bool ShouldReportMetrics(const PageCoordinationUnitImpl* page_cu); + bool IsCollectingCPUUsageForUkm(const CoordinationUnitID& page_cu_id); + void RecordCPUUsageForUkm(const CoordinationUnitID& page_cu_id, double cpu_usage, size_t num_coresident_tabs); - void UpdateUkmSourceIdForWebContents( - const CoordinationUnitID& web_contents_cu_id, - ukm::SourceId ukm_source_id); + void UpdateUkmSourceIdForPage(const CoordinationUnitID& page_cu_id, + ukm::SourceId ukm_source_id); void UpdateWithFieldTrialParams(); void ResetMetricsReportRecord(CoordinationUnitID cu_id); @@ -123,7 +119,7 @@ base::DefaultTickClock default_tick_clock_; base::TickClock* const clock_; std::map<CoordinationUnitID, FrameData> frame_data_map_; - std::map<CoordinationUnitID, WebContentsData> web_contents_data_map_; + std::map<CoordinationUnitID, PageData> page_data_map_; // The metrics_report_record_map_ is used to record whether a metric was // already reported to avoid reporting multiple metrics. std::map<CoordinationUnitID, MetricsReportRecord> metrics_report_record_map_;
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc b/services/resource_coordinator/observers/metrics_collector_unittest.cc similarity index 64% rename from services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc rename to services/resource_coordinator/observers/metrics_collector_unittest.cc index 9c6a70f..d1573a0 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc +++ b/services/resource_coordinator/observers/metrics_collector_unittest.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 "services/resource_coordinator/coordination_unit/metrics_collector.h" +#include "services/resource_coordinator/observers/metrics_collector.h" #include "base/test/histogram_tester.h" #include "base/test/simple_test_tick_clock.h" @@ -46,54 +46,53 @@ FromBackgroundedToFirstAudioStartsUMA #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstAudioStartsUMA) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab is not backgrounded, thus no metrics recorded. + // The page is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); frame_cu->SetProperty(mojom::PropertyType::kAudible, false); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab was recently audible, thus no metrics recorded. + // The page was recently audible, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); frame_cu->SetProperty(mojom::PropertyType::kAudible, false); AdvanceClock(kTestMaxAudioSlientTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab was not recently audible but it is not backgrounded, thus no + // The page was not recently audible but it is not backgrounded, thus no // metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); frame_cu->SetProperty(mojom::PropertyType::kAudible, false); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); AdvanceClock(kTestMaxAudioSlientTimeout); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab was not recently audible and it is backgrounded, thus metrics + // The page was not recently audible and it is backgrounded, thus metrics // recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 1); frame_cu->SetProperty(mojom::PropertyType::kAudible, false); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); AdvanceClock(kTestMaxAudioSlientTimeout); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab becomes visible and then invisible again, thus metrics recorded. + // The page becomes visible and then invisible again, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 2); } @@ -108,19 +107,18 @@ #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstAudioStartsUMA5MinutesTimeout) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); frame_cu->SetProperty(mojom::PropertyType::kAudible, true); - // The tab is within 5 minutes after main frame navigation was committed, thus - // no metrics recorded. + // The page is within 5 minutes after main frame navigation was committed, + // thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); frame_cu->SetProperty(mojom::PropertyType::kAudible, false); @@ -139,34 +137,33 @@ FromBackgroundedToFirstTitleUpdatedUMA #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstTitleUpdatedUMA) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); - // The tab is not backgrounded, thus no metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SendEvent(mojom::Event::kTitleUpdated); + // The page is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 0); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); - // The tab is backgrounded, thus metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kTitleUpdated); + // The page is backgrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 1); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); + page_cu->SendEvent(mojom::Event::kTitleUpdated); // Metrics should only be recorded once per background period, thus metrics // not recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 1); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); - // The tab is backgrounded from foregrounded, thus metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kTitleUpdated); + // The page is backgrounded from foregrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 2); } @@ -181,19 +178,18 @@ #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstTitleUpdatedUMA5MinutesTimeout) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); - // The tab is within 5 minutes after main frame navigation was committed, thus - // no metrics recorded. + page_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kTitleUpdated); + // The page is within 5 minutes after main frame navigation was committed, + // thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 0); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SendEvent(mojom::Event::kTitleUpdated); + page_cu->SendEvent(mojom::Event::kTitleUpdated); histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstTitleUpdatedUMA, 1); } @@ -207,25 +203,24 @@ FromBackgroundedToFirstAlertFiredUMA #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstAlertFiredUMA) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); frame_cu->SendEvent(mojom::Event::kAlertFired); - // The tab is not backgrounded, thus no metrics recorded. + // The page is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAlertFiredUMA, 0); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kAlertFired); - // The tab is backgrounded, thus metrics recorded. + // The page is backgrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAlertFiredUMA, 1); frame_cu->SendEvent(mojom::Event::kAlertFired); @@ -234,10 +229,10 @@ histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAlertFiredUMA, 1); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kAlertFired); - // The tab is backgrounded from foregrounded, thus metrics recorded. + // The page is backgrounded from foregrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAlertFiredUMA, 2); } @@ -252,18 +247,17 @@ #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstAlertFiredUMA5MinutesTimeout) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kAlertFired); - // The tab is within 5 minutes after main frame navigation was committed, thus - // no metrics recorded. + // The page is within 5 minutes after main frame navigation was committed, + // thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAlertFiredUMA, 0); AdvanceClock(kTestMetricsReportDelayTimeout); @@ -282,25 +276,24 @@ #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstNonPersistentNotificationCreatedUMA) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); frame_cu->SendEvent(mojom::Event::kNonPersistentNotificationCreated); - // The tab is not backgrounded, thus no metrics recorded. + // The page is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstNonPersistentNotificationCreatedUMA, 0); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kNonPersistentNotificationCreated); - // The tab is backgrounded, thus metrics recorded. + // The page is backgrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstNonPersistentNotificationCreatedUMA, 1); frame_cu->SendEvent(mojom::Event::kNonPersistentNotificationCreated); @@ -309,10 +302,10 @@ histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstNonPersistentNotificationCreatedUMA, 1); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kNonPersistentNotificationCreated); - // The tab is backgrounded from foregrounded, thus metrics recorded. + // The page is backgrounded from foregrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstNonPersistentNotificationCreatedUMA, 2); } @@ -328,18 +321,17 @@ TEST_F( MetricsCollectorTest, MAYBE_FromBackgroundedToFirstNonPersistentNotificationCreatedUMA5MinutesTimeout) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); auto frame_cu = CreateCoordinationUnit(CoordinationUnitType::kFrame); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); coordination_unit_manager().OnCoordinationUnitCreated(frame_cu.get()); - web_contents_cu->AddChild(frame_cu->id()); + page_cu->AddChild(frame_cu->id()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); frame_cu->SendEvent(mojom::Event::kNonPersistentNotificationCreated); - // The tab is within 5 minutes after main frame navigation was committed, thus - // no metrics recorded. + // The page is within 5 minutes after main frame navigation was committed, + // thus no metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstNonPersistentNotificationCreatedUMA, 0); AdvanceClock(kTestMetricsReportDelayTimeout); @@ -357,34 +349,33 @@ FromBackgroundedToFirstFaviconUpdatedUMA #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstFaviconUpdatedUMA) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SendEvent(mojom::Event::kNavigationCommitted); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); - // The tab is not backgrounded, thus no metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); + // The page is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 0); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); - // The tab is backgrounded, thus metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); + // The page is backgrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 1); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); // Metrics should only be recorded once per background period, thus metrics // not recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 1); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, true); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); - // The tab is backgrounded from foregrounded, thus metrics recorded. + page_cu->SetProperty(mojom::PropertyType::kVisible, true); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); + // The page is backgrounded from foregrounded, thus metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 2); } @@ -399,19 +390,18 @@ #endif TEST_F(MetricsCollectorTest, MAYBE_FromBackgroundedToFirstFaviconUpdatedUMA5MinutesTimeout) { - auto web_contents_cu = - CreateCoordinationUnit(CoordinationUnitType::kWebContents); - coordination_unit_manager().OnCoordinationUnitCreated(web_contents_cu.get()); + auto page_cu = CreateCoordinationUnit(CoordinationUnitType::kPage); + coordination_unit_manager().OnCoordinationUnitCreated(page_cu.get()); - web_contents_cu->SendEvent(mojom::Event::kNavigationCommitted); - web_contents_cu->SetProperty(mojom::PropertyType::kVisible, false); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); - // The tab is within 5 minutes after main frame navigation was committed, thus - // no metrics recorded. + page_cu->SendEvent(mojom::Event::kNavigationCommitted); + page_cu->SetProperty(mojom::PropertyType::kVisible, false); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); + // The page is within 5 minutes after main frame navigation was committed, + // thus no metrics recorded. histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 0); AdvanceClock(kTestMetricsReportDelayTimeout); - web_contents_cu->SendEvent(mojom::Event::kFaviconUpdated); + page_cu->SendEvent(mojom::Event::kFaviconUpdated); histogram_tester_.ExpectTotalCount( kTabFromBackgroundedToFirstFaviconUpdatedUMA, 1); }
diff --git a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc b/services/resource_coordinator/observers/tab_signal_generator_impl.cc similarity index 76% rename from services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc rename to services/resource_coordinator/observers/tab_signal_generator_impl.cc index c4b33114..b62131b 100644 --- a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc +++ b/services/resource_coordinator/observers/tab_signal_generator_impl.cc
@@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h" +#include "services/resource_coordinator/observers/tab_signal_generator_impl.h" #include <utility> #include "base/values.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h" -#include "services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/page_coordination_unit_impl.h" +#include "services/service_manager/public/cpp/bind_source_info.h" namespace resource_coordinator { @@ -29,7 +30,7 @@ bool TabSignalGeneratorImpl::ShouldObserve( const CoordinationUnitImpl* coordination_unit) { auto coordination_unit_type = coordination_unit->id().type; - return coordination_unit_type == CoordinationUnitType::kWebContents || + return coordination_unit_type == CoordinationUnitType::kPage || coordination_unit_type == CoordinationUnitType::kFrame; } @@ -43,7 +44,7 @@ return; // TODO(lpy) Combine CPU usage or long task idleness signal. for (auto* parent : frame_cu->parents()) { - if (parent->id().type != CoordinationUnitType::kWebContents) + if (parent->id().type != CoordinationUnitType::kPage) continue; DISPATCH_TAB_SIGNAL(observers_, OnEventReceived, parent, mojom::TabEvent::kDoneLoading); @@ -52,18 +53,19 @@ } } -void TabSignalGeneratorImpl::OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* web_contents_cu, +void TabSignalGeneratorImpl::OnPagePropertyChanged( + const PageCoordinationUnitImpl* page_cu, const mojom::PropertyType property_type, int64_t value) { if (property_type == mojom::PropertyType::kExpectedTaskQueueingDuration) { - DISPATCH_TAB_SIGNAL(observers_, OnPropertyChanged, web_contents_cu, - property_type, value); + DISPATCH_TAB_SIGNAL(observers_, OnPropertyChanged, page_cu, property_type, + value); } } void TabSignalGeneratorImpl::BindToInterface( - resource_coordinator::mojom::TabSignalGeneratorRequest request) { + resource_coordinator::mojom::TabSignalGeneratorRequest request, + const service_manager::BindSourceInfo& source_info) { bindings_.AddBinding(this, std::move(request)); }
diff --git a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h b/services/resource_coordinator/observers/tab_signal_generator_impl.h similarity index 80% rename from services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h rename to services/resource_coordinator/observers/tab_signal_generator_impl.h index 02ecae66..ba8a0637 100644 --- a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h +++ b/services/resource_coordinator/observers/tab_signal_generator_impl.h
@@ -8,14 +8,18 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_ptr_set.h" -#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" +#include "services/resource_coordinator/observers/coordination_unit_graph_observer.h" #include "services/resource_coordinator/public/interfaces/tab_signal.mojom.h" +namespace service_manager { +struct BindSourceInfo; +} // namespace service_manager + namespace resource_coordinator { class CoordinationUnitImpl; class FrameCoordinationUnitImpl; -class WebContentsCoordinationUnitImpl; +class PageCoordinationUnitImpl; // The TabSignalGenerator is a dedicated |CoordinationUnitGraphObserver| for // calculating and emitting tab-scoped signals. This observer observes Tab @@ -35,13 +39,13 @@ void OnFramePropertyChanged(const FrameCoordinationUnitImpl* frame_cu, const mojom::PropertyType property_type, int64_t value) override; - void OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* web_contents_cu, - const mojom::PropertyType property_type, - int64_t value) override; + void OnPagePropertyChanged(const PageCoordinationUnitImpl* page_cu, + const mojom::PropertyType property_type, + int64_t value) override; void BindToInterface( - resource_coordinator::mojom::TabSignalGeneratorRequest request); + resource_coordinator::mojom::TabSignalGeneratorRequest request, + const service_manager::BindSourceInfo& source_info); private: mojo::BindingSet<mojom::TabSignalGenerator> bindings_;
diff --git a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl_unittest.cc b/services/resource_coordinator/observers/tab_signal_generator_impl_unittest.cc similarity index 79% rename from services/resource_coordinator/coordination_unit/tab_signal_generator_impl_unittest.cc rename to services/resource_coordinator/observers/tab_signal_generator_impl_unittest.cc index 3295ab1..d5885b9 100644 --- a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl_unittest.cc +++ b/services/resource_coordinator/observers/tab_signal_generator_impl_unittest.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 "services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h" +#include "services/resource_coordinator/observers/tab_signal_generator_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h" @@ -16,10 +16,9 @@ class MockTabSignalGeneratorImpl : public TabSignalGeneratorImpl { public: // Overridden from TabSignalGeneratorImpl. - void OnWebContentsPropertyChanged( - const WebContentsCoordinationUnitImpl* coordination_unit, - const mojom::PropertyType property_type, - int64_t value) override { + void OnPagePropertyChanged(const PageCoordinationUnitImpl* coordination_unit, + const mojom::PropertyType property_type, + int64_t value) override { if (property_type == mojom::PropertyType::kExpectedTaskQueueingDuration) ++eqt_change_count_; } @@ -42,8 +41,8 @@ TEST_F(TabSignalGeneratorImplTest, CalculateTabEQTForSingleTabWithMultipleProcesses) { - MockSingleTabWithMultipleProcessesCoordinationUnitGraph cu_graph; - cu_graph.tab->AddObserver(tab_signal_generator()); + MockSinglePageWithMultipleProcessesCoordinationUnitGraph cu_graph; + cu_graph.page->AddObserver(tab_signal_generator()); cu_graph.process->SetProperty( mojom::PropertyType::kExpectedTaskQueueingDuration, 1); @@ -51,10 +50,10 @@ mojom::PropertyType::kExpectedTaskQueueingDuration, 10); // The |other_process| is not for the main frame so its EQT values does not - // propagate to the tab. + // propagate to the page. EXPECT_EQ(1u, tab_signal_generator()->eqt_change_count()); int64_t eqt; - ASSERT_TRUE(cu_graph.tab->GetProperty( + ASSERT_TRUE(cu_graph.page->GetProperty( mojom::PropertyType::kExpectedTaskQueueingDuration, &eqt)); EXPECT_EQ(1, eqt); }
diff --git a/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.cc b/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.cc index e30343a..8721645 100644 --- a/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.cc +++ b/services/resource_coordinator/public/cpp/coordination_unit_struct_traits.cc
@@ -12,18 +12,16 @@ resource_coordinator::CoordinationUnitType>:: ToMojom(resource_coordinator::CoordinationUnitType type) { switch (type) { - case resource_coordinator::CoordinationUnitType::kWebContents: - return resource_coordinator::mojom::CoordinationUnitType::kWebContents; + case resource_coordinator::CoordinationUnitType::kPage: + return resource_coordinator::mojom::CoordinationUnitType::kPage; case resource_coordinator::CoordinationUnitType::kFrame: return resource_coordinator::mojom::CoordinationUnitType::kFrame; - case resource_coordinator::CoordinationUnitType::kNavigation: - return resource_coordinator::mojom::CoordinationUnitType::kNavigation; case resource_coordinator::CoordinationUnitType::kProcess: return resource_coordinator::mojom::CoordinationUnitType::kProcess; default: NOTREACHED() << "Invalid type: " << static_cast<uint8_t>(type); // This should not be reached. Just return a random value. - return resource_coordinator::mojom::CoordinationUnitType::kWebContents; + return resource_coordinator::mojom::CoordinationUnitType::kPage; } } @@ -33,15 +31,12 @@ FromMojom(resource_coordinator::mojom::CoordinationUnitType input, resource_coordinator::CoordinationUnitType* out) { switch (input) { - case resource_coordinator::mojom::CoordinationUnitType::kWebContents: - *out = resource_coordinator::CoordinationUnitType::kWebContents; + case resource_coordinator::mojom::CoordinationUnitType::kPage: + *out = resource_coordinator::CoordinationUnitType::kPage; break; case resource_coordinator::mojom::CoordinationUnitType::kFrame: *out = resource_coordinator::CoordinationUnitType::kFrame; break; - case resource_coordinator::mojom::CoordinationUnitType::kNavigation: - *out = resource_coordinator::CoordinationUnitType::kNavigation; - break; case resource_coordinator::mojom::CoordinationUnitType::kProcess: *out = resource_coordinator::CoordinationUnitType::kProcess; break;
diff --git a/services/resource_coordinator/public/cpp/coordination_unit_types.h b/services/resource_coordinator/public/cpp/coordination_unit_types.h index 9e1255d3..6731570 100644 --- a/services/resource_coordinator/public/cpp/coordination_unit_types.h +++ b/services/resource_coordinator/public/cpp/coordination_unit_types.h
@@ -13,9 +13,8 @@ // coordination_unit_struct_traits.h/.cc enum class CoordinationUnitType : uint8_t { kInvalidType, - kWebContents, kFrame, - kNavigation, + kPage, kProcess, };
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/struct_traits_unittest.cc b/services/resource_coordinator/public/cpp/memory_instrumentation/struct_traits_unittest.cc index c408f082..fa8df3d8 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/struct_traits_unittest.cc +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/struct_traits_unittest.cc
@@ -121,11 +121,9 @@ EXPECT_EQ(10u, output->GetSizeInternal()); EXPECT_EQ(MemoryDumpLevelOfDetail::DETAILED, output->level_of_detail()); MemoryAllocatorDump::Entry expected_entry1("size", "bytes", 10); - EXPECT_THAT(output->entries_for_testing(), - Contains(Eq(ByRef(expected_entry1)))); + EXPECT_THAT(output->entries(), Contains(Eq(ByRef(expected_entry1)))); MemoryAllocatorDump::Entry expected_entry2("count", "number", 20); - EXPECT_THAT(output->entries_for_testing(), - Contains(Eq(ByRef(expected_entry2)))); + EXPECT_THAT(output->entries(), Contains(Eq(ByRef(expected_entry2)))); } TEST_F(StructTraitsTest, ProcessMemoryDump) { @@ -162,44 +160,40 @@ ASSERT_NE(dumps.end(), mad_it); MemoryAllocatorDump::Entry expected_entry1("size", "bytes", 10); MemoryAllocatorDump::Entry expected_entry2("count", "number", 11); - EXPECT_THAT(mad_it->second->entries_for_testing(), + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry1)))); - EXPECT_THAT(mad_it->second->entries_for_testing(), + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry2)))); } { auto mad_it = dumps.find("mad/2"); ASSERT_NE(dumps.end(), mad_it); MemoryAllocatorDump::Entry expected_entry("size", "bytes", 20); - EXPECT_EQ(1u, mad_it->second->entries_for_testing().size()); - EXPECT_THAT(mad_it->second->entries_for_testing(), - Contains(Eq(ByRef(expected_entry)))); + EXPECT_EQ(1u, mad_it->second->entries().size()); + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry)))); } { auto mad_it = dumps.find("mad/3"); ASSERT_NE(dumps.end(), mad_it); MemoryAllocatorDump::Entry expected_entry("count", "number", 31); - EXPECT_EQ(1u, mad_it->second->entries_for_testing().size()); - EXPECT_THAT(mad_it->second->entries_for_testing(), - Contains(Eq(ByRef(expected_entry)))); + EXPECT_EQ(1u, mad_it->second->entries().size()); + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry)))); } { auto mad_it = dumps.find("global/1"); ASSERT_NE(dumps.end(), mad_it); EXPECT_FALSE(mad_it->second->flags() & MemoryAllocatorDump::WEAK); MemoryAllocatorDump::Entry expected_entry("shared_name", "url", "!"); - EXPECT_EQ(1u, mad_it->second->entries_for_testing().size()); - EXPECT_THAT(mad_it->second->entries_for_testing(), - Contains(Eq(ByRef(expected_entry)))); + EXPECT_EQ(1u, mad_it->second->entries().size()); + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry)))); } { auto mad_it = dumps.find("global/2"); ASSERT_NE(dumps.end(), mad_it); EXPECT_TRUE(mad_it->second->flags() & MemoryAllocatorDump::WEAK); MemoryAllocatorDump::Entry expected_entry("shared_weak_name", "url", "."); - EXPECT_EQ(1u, mad_it->second->entries_for_testing().size()); - EXPECT_THAT(mad_it->second->entries_for_testing(), - Contains(Eq(ByRef(expected_entry)))); + EXPECT_EQ(1u, mad_it->second->entries().size()); + EXPECT_THAT(mad_it->second->entries(), Contains(Eq(ByRef(expected_entry)))); } const auto& edges = output->allocator_dumps_edges_for_testing(); {
diff --git a/services/resource_coordinator/public/interfaces/coordination_unit.mojom b/services/resource_coordinator/public/interfaces/coordination_unit.mojom index a48a9af2..462352c 100644 --- a/services/resource_coordinator/public/interfaces/coordination_unit.mojom +++ b/services/resource_coordinator/public/interfaces/coordination_unit.mojom
@@ -11,9 +11,8 @@ // coordination_unit.mojom, and have mappings between the two defined in // coordination_unit_struct_traits.h/.cc (see comment in coordination_unit_id.h). enum CoordinationUnitType { - kWebContents, kFrame, - kNavigation, + kPage, kProcess, };
diff --git a/services/resource_coordinator/resource_coordinator_service.cc b/services/resource_coordinator/resource_coordinator_service.cc index 6f694bc..386675a 100644 --- a/services/resource_coordinator/resource_coordinator_service.cc +++ b/services/resource_coordinator/resource_coordinator_service.cc
@@ -7,9 +7,12 @@ #include <utility> #include "base/memory/ptr_util.h" -#include "services/resource_coordinator/coordination_unit/metrics_collector.h" -#include "services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h" +#include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h" +#include "services/resource_coordinator/observers/metrics_collector.h" +#include "services/resource_coordinator/observers/tab_signal_generator_impl.h" #include "services/resource_coordinator/service_callbacks_impl.h" +#include "services/resource_coordinator/tracing/agent_registry.h" +#include "services/resource_coordinator/tracing/coordinator.h" #include "services/service_manager/public/cpp/service_context.h" namespace resource_coordinator { @@ -53,13 +56,36 @@ base::MakeUnique<MetricsCollector>()); coordination_unit_manager_.OnStart(®istry_, ref_factory_.get()); + + // TODO(chiniforooshan): The abstract class Coordinator in the + // public/cpp/memory_instrumentation directory should not be needed anymore. + // We should be able to delete that and rename + // memory_instrumentation::CoordinatorImpl to + // memory_instrumentation::Coordinator. + memory_instrumentation_coordinator_ = + base::MakeUnique<memory_instrumentation::CoordinatorImpl>( + context()->connector()); + registry_.AddInterface(base::BindRepeating( + &memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest, + base::Unretained(memory_instrumentation_coordinator_.get()))); + + tracing_agent_registry_ = base::MakeUnique<tracing::AgentRegistry>(); + registry_.AddInterface( + base::BindRepeating(&tracing::AgentRegistry::BindAgentRegistryRequest, + base::Unretained(tracing_agent_registry_.get()))); + + tracing_coordinator_ = base::MakeUnique<tracing::Coordinator>(); + registry_.AddInterface( + base::BindRepeating(&tracing::Coordinator::BindCoordinatorRequest, + base::Unretained(tracing_coordinator_.get()))); } void ResourceCoordinatorService::OnBindInterface( const service_manager::BindSourceInfo& source_info, const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { - registry_.BindInterface(interface_name, std::move(interface_pipe)); + registry_.BindInterface(interface_name, std::move(interface_pipe), + source_info); } void ResourceCoordinatorService::SetUkmRecorder(
diff --git a/services/resource_coordinator/resource_coordinator_service.h b/services/resource_coordinator/resource_coordinator_service.h index dcc76e6..7c7de34 100644 --- a/services/resource_coordinator/resource_coordinator_service.h +++ b/services/resource_coordinator/resource_coordinator_service.h
@@ -14,6 +14,9 @@ #include "services/metrics/public/cpp/mojo_ukm_recorder.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" +#include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h" +#include "services/resource_coordinator/tracing/agent_registry.h" +#include "services/resource_coordinator/tracing/coordinator.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/service.h" #include "services/service_manager/public/cpp/service_context_ref.h" @@ -37,7 +40,6 @@ void SetUkmRecorder(std::unique_ptr<ukm::MojoUkmRecorder> ukm_recorder); - service_manager::BinderRegistry& registry() { return registry_; } service_manager::ServiceContextRefFactory* ref_factory() { return ref_factory_.get(); } @@ -47,11 +49,17 @@ } private: - service_manager::BinderRegistry registry_; + service_manager::BinderRegistryWithArgs< + const service_manager::BindSourceInfo&> + registry_; std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_; CoordinationUnitManager coordination_unit_manager_; CoordinationUnitIntrospectorImpl introspector_; std::unique_ptr<ukm::MojoUkmRecorder> ukm_recorder_; + std::unique_ptr<memory_instrumentation::CoordinatorImpl> + memory_instrumentation_coordinator_; + std::unique_ptr<tracing::AgentRegistry> tracing_agent_registry_; + std::unique_ptr<tracing::Coordinator> tracing_coordinator_; // WeakPtrFactory members should always come last so WeakPtrs are destructed // before other members.
diff --git a/services/resource_coordinator/resource_coordinator_service_unittest.cc b/services/resource_coordinator/resource_coordinator_service_unittest.cc index 6a036f8..e9ff43b 100644 --- a/services/resource_coordinator/resource_coordinator_service_unittest.cc +++ b/services/resource_coordinator/resource_coordinator_service_unittest.cc
@@ -42,7 +42,7 @@ mojom::CoordinationUnitProviderPtr provider; connector()->BindInterface(mojom::kServiceName, mojo::MakeRequest(&provider)); - CoordinationUnitID new_id(CoordinationUnitType::kWebContents, "test_id"); + CoordinationUnitID new_id(CoordinationUnitType::kPage, "test_id"); mojom::CoordinationUnitPtr coordination_unit; provider->CreateCoordinationUnit(mojo::MakeRequest(&coordination_unit), new_id);
diff --git a/services/resource_coordinator/service_callbacks_impl.cc b/services/resource_coordinator/service_callbacks_impl.cc index 46474f4..5c7a9f67 100644 --- a/services/resource_coordinator/service_callbacks_impl.cc +++ b/services/resource_coordinator/service_callbacks_impl.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "services/metrics/public/cpp/mojo_ukm_recorder.h" #include "services/resource_coordinator/resource_coordinator_service.h" +#include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/service_context_ref.h" namespace resource_coordinator { @@ -27,7 +28,8 @@ void ServiceCallbacksImpl::Create( service_manager::ServiceContextRefFactory* service_ref_factory, ResourceCoordinatorService* resource_coordinator_service, - resource_coordinator::mojom::ServiceCallbacksRequest request) { + resource_coordinator::mojom::ServiceCallbacksRequest request, + const service_manager::BindSourceInfo& source_info) { mojo::MakeStrongBinding( base::MakeUnique<ServiceCallbacksImpl>(service_ref_factory, resource_coordinator_service),
diff --git a/services/resource_coordinator/service_callbacks_impl.h b/services/resource_coordinator/service_callbacks_impl.h index a800c55..761bc69 100644 --- a/services/resource_coordinator/service_callbacks_impl.h +++ b/services/resource_coordinator/service_callbacks_impl.h
@@ -13,6 +13,7 @@ #include "services/resource_coordinator/public/interfaces/service_callbacks.mojom.h" namespace service_manager { +struct BindSourceInfo; class ServiceContextRefFactory; class ServiceContextRef; } // namespace service_manager @@ -31,7 +32,8 @@ static void Create( service_manager::ServiceContextRefFactory* service_ref_factory, ResourceCoordinatorService* resource_coordinator_service, - resource_coordinator::mojom::ServiceCallbacksRequest request); + resource_coordinator::mojom::ServiceCallbacksRequest request, + const service_manager::BindSourceInfo& source_info); void IsUkmRecorderInterfaceInitialized( const IsUkmRecorderInterfaceInitializedCallback& callback) override;
diff --git a/services/ui/public/interfaces/ime/ime.mojom b/services/ui/public/interfaces/ime/ime.mojom index b8167bfd..bc71a91e 100644 --- a/services/ui/public/interfaces/ime/ime.mojom +++ b/services/ui/public/interfaces/ime/ime.mojom
@@ -60,6 +60,7 @@ enum ImeTextSpanType { kComposition, kSuggestion, + kMisspellingSuggestion, }; // Represents an underlined segment of text currently composed by IME.
diff --git a/services/ui/public/interfaces/ime/ime_struct_traits.cc b/services/ui/public/interfaces/ime/ime_struct_traits.cc index 925a001..45183679e4 100644 --- a/services/ui/public/interfaces/ime/ime_struct_traits.cc +++ b/services/ui/public/interfaces/ime/ime_struct_traits.cc
@@ -75,6 +75,8 @@ return ui::mojom::ImeTextSpanType::kComposition; case ui::ImeTextSpan::Type::kSuggestion: return ui::mojom::ImeTextSpanType::kSuggestion; + case ui::ImeTextSpan::Type::kMisspellingSuggestion: + return ui::mojom::ImeTextSpanType::kMisspellingSuggestion; } NOTREACHED(); @@ -92,6 +94,9 @@ case ui::mojom::ImeTextSpanType::kSuggestion: *out = ui::ImeTextSpan::Type::kSuggestion; return true; + case ui::mojom::ImeTextSpanType::kMisspellingSuggestion: + *out = ui::ImeTextSpan::Type::kMisspellingSuggestion; + return true; } NOTREACHED();
diff --git a/services/ui/public/interfaces/window_tree.mojom b/services/ui/public/interfaces/window_tree.mojom index 08d3fdd0..3a4a692 100644 --- a/services/ui/public/interfaces/window_tree.mojom +++ b/services/ui/public/interfaces/window_tree.mojom
@@ -455,9 +455,12 @@ // specified by StartPointerWatcher(). The client will not receive farther // events until the event is ack'ed, regardless of the value of // |matches_pointer_watcher|. + // TODO(sky): remove |event_location_in_screen_pixel_layout| temporary until + // http://crbug.com/747465 is fixed. OnWindowInputEvent(uint32 event_id, uint32 window, int64 display_id, + gfx.mojom.PointF event_location_in_screen_pixel_layout, ui.mojom.Event event, bool matches_pointer_watcher);
diff --git a/services/ui/ws/BUILD.gn b/services/ui/ws/BUILD.gn index 0b7f9d8..c141476 100644 --- a/services/ui/ws/BUILD.gn +++ b/services/ui/ws/BUILD.gn
@@ -47,6 +47,7 @@ "event_dispatcher.cc", "event_dispatcher.h", "event_dispatcher_delegate.h", + "event_location.h", "event_matcher.cc", "event_matcher.h", "event_targeter.cc",
diff --git a/services/ui/ws/DEPS b/services/ui/ws/DEPS index 963ba76..c52616ef 100644 --- a/services/ui/ws/DEPS +++ b/services/ui/ws/DEPS
@@ -1,5 +1,5 @@ include_rules = [ - "+components/viz/common/gpu", + "+components/viz/common", "+components/viz/host", "+gpu/command_buffer/client", "+gpu/config",
diff --git a/services/ui/ws/default_access_policy.cc b/services/ui/ws/default_access_policy.cc index 2271041..8bd5268 100644 --- a/services/ui/ws/default_access_policy.cc +++ b/services/ui/ws/default_access_policy.cc
@@ -240,9 +240,9 @@ bool DefaultAccessPolicy::IsValidIdForNewWindow( const ClientWindowId& id) const { // Clients using DefaultAccessPolicy only see windows they have created (for - // the embed point they choose the id), so it's ok for clients to use whatever - // id they want. - return true; + // the embed point they choose the id), which should have the same client_id + // as the client_id_ since we should have already filled in the real one. + return base::checked_cast<ClientSpecificId>(id.client_id()) == client_id_; } } // namespace ws
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc index b55ad82..1cabe3e 100644 --- a/services/ui/ws/display.cc +++ b/services/ui/ws/display.cc
@@ -93,6 +93,10 @@ return display_; } +const display::ViewportMetrics& Display::GetViewportMetrics() const { + return platform_display_->GetViewportMetrics(); +} + DisplayManager* Display::display_manager() { return window_server_->display_manager(); } @@ -256,9 +260,9 @@ void Display::CreateRootWindow(const gfx::Size& size) { DCHECK(!root_); - root_.reset(window_server_->CreateServerWindow( - display_manager()->GetAndAdvanceNextRootId(), - ServerWindow::Properties())); + WindowId id = display_manager()->GetAndAdvanceNextRootId(); + root_.reset(window_server_->CreateServerWindow(id, id.ToClientWindowId(), + ServerWindow::Properties())); root_->set_event_targeting_policy( mojom::EventTargetingPolicy::DESCENDANTS_ONLY); root_->SetBounds(gfx::Rect(size), allocator_.GenerateId()); @@ -413,7 +417,7 @@ WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); if (display_root) { WindowManagerState* wm_state = display_root->window_manager_state(); - wm_state->ProcessEvent(*event, GetId()); + wm_state->ProcessEvent(event, GetId()); } UserActivityMonitor* activity_monitor =
diff --git a/services/ui/ws/display.h b/services/ui/ws/display.h index 2fd2d6d..f5fdf0a1 100644 --- a/services/ui/ws/display.h +++ b/services/ui/ws/display.h
@@ -79,6 +79,8 @@ // PlatformDisplayDelegate: const display::Display& GetDisplay() override; + const display::ViewportMetrics& GetViewportMetrics() const; + DisplayManager* display_manager(); const DisplayManager* display_manager() const;
diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc index 93ab1a0f1..0ca95162 100644 --- a/services/ui/ws/display_manager.cc +++ b/services/ui/ws/display_manager.cc
@@ -29,6 +29,7 @@ #include "ui/display/screen_base.h" #include "ui/display/types/display_constants.h" #include "ui/events/event_rewriter.h" +#include "ui/gfx/geometry/point_conversions.h" #if defined(OS_CHROMEOS) #include "ui/chromeos/events/event_rewriter_chromeos.h" @@ -335,8 +336,8 @@ int64_t mouse_display_id = 0; if (previous_window_manager_state) { mouse_location_on_display = - previous_window_manager_state->event_dispatcher() - ->mouse_pointer_last_location(); + gfx::ToFlooredPoint(previous_window_manager_state->event_dispatcher() + ->mouse_pointer_last_location()); mouse_display_id = previous_window_manager_state->event_dispatcher() ->mouse_pointer_display_id(); previous_window_manager_state->Deactivate();
diff --git a/services/ui/ws/display_unittest.cc b/services/ui/ws/display_unittest.cc index eb16dd89..01f37c8 100644 --- a/services/ui/ws/display_unittest.cc +++ b/services/ui/ws/display_unittest.cc
@@ -277,7 +277,7 @@ EXPECT_TRUE(EventDispatcherTestApi(active_wms->event_dispatcher()) .AreAnyPointersDown()); - EXPECT_EQ(gfx::Point(20, 25), + EXPECT_EQ(gfx::PointF(20, 25), active_wms->event_dispatcher()->mouse_pointer_last_location()); // Switch the user. Should trigger resetting state in old event dispatcher @@ -291,7 +291,7 @@ active_wms = display->GetActiveWindowManagerDisplayRoot()->window_manager_state(); EXPECT_EQ(kTestId2, active_wms->user_id()); - EXPECT_EQ(gfx::Point(20, 25), + EXPECT_EQ(gfx::PointF(20, 25), active_wms->event_dispatcher()->mouse_pointer_last_location()); EXPECT_FALSE(EventDispatcherTestApi(active_wms->event_dispatcher()) .AreAnyPointersDown());
diff --git a/services/ui/ws/event_dispatcher.cc b/services/ui/ws/event_dispatcher.cc index 5577e74..9930028 100644 --- a/services/ui/ws/event_dispatcher.cc +++ b/services/ui/ws/event_dispatcher.cc
@@ -12,6 +12,7 @@ #include "services/ui/ws/drag_controller.h" #include "services/ui/ws/drag_source.h" #include "services/ui/ws/event_dispatcher_delegate.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/server_window.h" #include "services/ui/ws/server_window_delegate.h" #include "services/ui/ws/window_coordinate_conversions.h" @@ -209,7 +210,8 @@ if (!mouse_button_down_ && mouse_cursor_source_window_) { event_targeter_->FindTargetForLocation( EventSource::MOUSE, - {mouse_pointer_last_location_, mouse_pointer_display_id_}, + {mouse_pointer_last_location_, mouse_pointer_last_location_, + mouse_pointer_display_id_}, base::BindOnce( &EventDispatcher::UpdateNonClientAreaForCurrentWindowOnFoundWindow, base::Unretained(this))); @@ -220,7 +222,8 @@ if (!mouse_button_down_) { event_targeter_->FindTargetForLocation( EventSource::MOUSE, - {mouse_pointer_last_location_, mouse_pointer_display_id_}, + {mouse_pointer_last_location_, mouse_pointer_last_location_, + mouse_pointer_display_id_}, base::BindOnce(&EventDispatcher:: UpdateCursorProviderByLastKnownLocationOnFoundWindow, base::Unretained(this))); @@ -272,7 +275,7 @@ } void EventDispatcher::ProcessEvent(const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, AcceleratorMatchPhase match_phase) { #if !defined(NDEBUG) if (match_phase == AcceleratorMatchPhase::POST_ONLY) { @@ -295,12 +298,12 @@ FindAccelerator(*key_event, ui::mojom::AcceleratorPhase::PRE_TARGET); if (pre_target) { delegate_->OnAccelerator( - pre_target->id(), display_id, event, + pre_target->id(), event_location.display_id, event, EventDispatcherDelegate::AcceleratorPhase::PRE); return; } } - ProcessKeyEvent(*key_event, display_id, match_phase); + ProcessKeyEvent(*key_event, event_location.display_id, match_phase); return; } @@ -308,27 +311,22 @@ DCHECK(!waiting_on_event_targeter_); const EventSource event_source = event.IsMousePointerEvent() ? EventSource::MOUSE : EventSource::TOUCH; + DCHECK(event_location.location == event.AsPointerEvent()->root_location_f()); + DCHECK(event_location.location == event.AsPointerEvent()->location_f()); if (ShouldUseEventTargeter(*event.AsPointerEvent())) { waiting_on_event_targeter_ = true; event_targeter_->FindTargetForLocation( - event_source, {event.AsPointerEvent()->root_location(), display_id}, + event_source, event_location, base::BindOnce(&EventDispatcher::ProcessPointerEventOnFoundTarget, base::Unretained(this), *event.AsPointerEvent())); } else { - // Using GetDisplayLocationFromEvent() may alter the display (and location). - // We need to always dispatch using the display the event came in on. The - // expectation for capture is events are dispatched from the display with - // capture, regardless of where the pointer happens to be. - ProcessPointerEventOnFoundTargetImpl( - *event.AsPointerEvent(), - {event.AsPointerEvent()->root_location(), display_id}, nullptr); + ProcessPointerEventOnFoundTargetImpl(*event.AsPointerEvent(), + event_location, nullptr); } } -ServerWindow* EventDispatcher::GetRootWindowContaining( - gfx::Point* location_in_display, - int64_t* display_id) { - return delegate_->GetRootWindowContaining(location_in_display, display_id); +ServerWindow* EventDispatcher::GetRootWindowForDisplay(int64_t display_id) { + return delegate_->GetRootWindowForDisplay(display_id); } void EventDispatcher::ProcessNextAvailableEvent() { @@ -345,15 +343,6 @@ return delegate_->GetWindowFromFrameSinkId(frame_sink_id); } -DisplayLocation EventDispatcher::GetDisplayLocationFromEvent( - const ui::PointerEvent& event, - int64_t display_id) const { - DisplayLocation display_location{event.root_location(), display_id}; - delegate_->GetRootWindowContaining(&display_location.location, - &display_location.display_id); - return display_location; -} - DeepestWindow EventDispatcher::AdjustTargetForModal( const DeepestWindow& target) const { const ServerWindow* modal_transient = @@ -384,8 +373,11 @@ } void EventDispatcher::SetMousePointerLocation( - const gfx::Point& new_mouse_location, + const gfx::PointF& new_mouse_location, int64_t new_mouse_display_id) { + // TODO: this needs to account for grab and a different display. By that I + // mean during a grab |mouse_pointer_last_location_| may actually be in a + // different display. mouse_pointer_last_location_ = new_mouse_location; mouse_pointer_display_id_ = new_mouse_display_id; } @@ -413,8 +405,9 @@ const bool in_nonclient_area = false; const ClientSpecificId client_id = delegate_->GetEventTargetClientId(focused_window, in_nonclient_area); - delegate_->DispatchInputEventToWindow(focused_window, client_id, display_id, - event, post_target); + delegate_->DispatchInputEventToWindow(focused_window, client_id, + EventLocation(display_id), event, + post_target); return; } delegate_->OnEventTargetNotFound(event, display_id); @@ -459,23 +452,22 @@ void EventDispatcher::ProcessPointerEventOnFoundTarget( const ui::PointerEvent& event, - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target) { DCHECK(waiting_on_event_targeter_); waiting_on_event_targeter_ = false; - ProcessPointerEventOnFoundTargetImpl(event, display_location, &target); + ProcessPointerEventOnFoundTargetImpl(event, event_location, &target); } void EventDispatcher::ProcessPointerEventOnFoundTargetImpl( const ui::PointerEvent& event, - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow* found_target) { DCHECK(!waiting_on_event_targeter_); // WARNING: |found_target| may be null! std::unique_ptr<ui::Event> cloned_event = ui::Event::Clone(event); - cloned_event->AsLocatedEvent()->set_root_location(display_location.location); - UpdateCursorRelatedProperties(event, display_location); + UpdateCursorRelatedProperties(event, event_location); const bool is_mouse_event = event.IsMousePointerEvent(); const bool is_pointer_going_up = IsPointerGoingUp(event); @@ -500,8 +492,7 @@ if (capture_window_) { SetMouseCursorSourceWindow(capture_window_); DispatchToClient(capture_window_, capture_window_client_id_, - *cloned_event->AsPointerEvent(), - display_location.display_id); + *cloned_event->AsPointerEvent(), event_location); return; } @@ -515,7 +506,7 @@ result->deepest_window.in_non_client_area; result->pointer_target.is_pointer_down = event.type() == ui::ET_POINTER_DOWN; - result->pointer_target.display_id = display_location.display_id; + result->pointer_target.display_id = event_location.display_id; } const int32_t pointer_id = event.pointer_details().id; @@ -525,7 +516,7 @@ DCHECK(result); const bool any_pointers_down = AreAnyPointersDown(); UpdateTargetForPointer(pointer_id, *cloned_event->AsPointerEvent(), - result->pointer_target); + result->pointer_target, event_location); if (is_mouse_event) SetMouseCursorSourceWindow(pointer_targets_[pointer_id].window); @@ -538,10 +529,8 @@ // will do that. ServerWindow* capture_window = pointer_target.window; if (!capture_window) { - int64_t event_display_id = display_location.display_id; - gfx::Point location = display_location.location; capture_window = - delegate_->GetRootWindowContaining(&location, &event_display_id); + delegate_->GetRootWindowForDisplay(event_location.display_id); } delegate_->SetNativeCapture(capture_window); } @@ -559,7 +548,7 @@ } DispatchToPointerTarget(pointer_targets_[pointer_id], - *cloned_event->AsPointerEvent()); + *cloned_event->AsPointerEvent(), event_location); if (is_pointer_going_up) { if (is_mouse_event) @@ -581,7 +570,7 @@ void EventDispatcher::UpdateCursorRelatedProperties( const ui::PointerEvent& event, - const DisplayLocation& display_location) { + const EventLocation& event_location) { if (event.IsMousePointerEvent()) { // This corresponds to the code in CompoundEventFilter which updates // visibility on each mouse event. Here, we're sure that we're a non-exit @@ -590,10 +579,10 @@ delegate_->OnEventChangesCursorTouchVisibility(event, true); delegate_->OnEventChangesCursorVisibility(event, true); - SetMousePointerLocation(display_location.location, - display_location.display_id); - delegate_->OnMouseCursorLocationChanged(display_location.location, - display_location.display_id); + SetMousePointerLocation(event_location.raw_location, + event_location.display_id); + delegate_->OnMouseCursorLocationChanged(event_location.raw_location, + event_location.display_id); } else { // When we have a non-touch event that wasn't synthesized, hide the mouse // cursor until the next non-synthesized mouse event. @@ -602,7 +591,7 @@ } void EventDispatcher::UpdateNonClientAreaForCurrentWindowOnFoundWindow( - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target) { if (!mouse_cursor_source_window_) return; @@ -616,7 +605,7 @@ } void EventDispatcher::UpdateCursorProviderByLastKnownLocationOnFoundWindow( - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target) { UpdateCursorProvider(AdjustTargetForModal(target)); } @@ -629,8 +618,8 @@ if (mouse_cursor_source_window_) { mouse_cursor_in_non_client_area_ = target.in_non_client_area; } else { - SetMouseCursorSourceWindow(delegate_->GetRootWindowContaining( - &mouse_pointer_last_location_, &mouse_pointer_display_id_)); + SetMouseCursorSourceWindow( + delegate_->GetRootWindowForDisplay(mouse_pointer_display_id_)); mouse_cursor_in_non_client_area_ = true; } delegate_->UpdateNativeCursorFromDispatcher(); @@ -673,7 +662,8 @@ void EventDispatcher::UpdateTargetForPointer( int32_t pointer_id, const ui::PointerEvent& event, - const PointerTarget& pointer_target) { + const PointerTarget& pointer_target, + const EventLocation& event_location) { if (!IsTrackingPointer(pointer_id)) { StartTrackingPointer(pointer_id, pointer_target); return; @@ -697,7 +687,8 @@ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, ui::MouseEvent::kMousePointerId), event.time_stamp()); - DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event); + DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event, + event_location); } // Technically we're updating in place, but calling start then stop makes for @@ -714,8 +705,10 @@ return false; } -void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target, - const ui::LocatedEvent& event) { +void EventDispatcher::DispatchToPointerTarget( + const PointerTarget& target, + const ui::LocatedEvent& event, + const EventLocation& event_location) { if (!target.window) { delegate_->OnEventTargetNotFound(event, target.display_id); return; @@ -727,13 +720,13 @@ DispatchToClient(target.window, delegate_->GetEventTargetClientId(target.window, target.in_nonclient_area), - event, target.display_id); + event, event_location); } void EventDispatcher::DispatchToClient(ServerWindow* window, ClientSpecificId client_id, const ui::LocatedEvent& event, - int64_t display_id) { + const EventLocation& event_location) { gfx::Point location = ConvertPointFromRootForEventDispatch( delegate_->GetRootWindowForEventDispatch(window), window, event.location()); @@ -741,8 +734,8 @@ clone->AsLocatedEvent()->set_location(location); // TODO(jonross): add post-target accelerator support once accelerators // support pointer events. - delegate_->DispatchInputEventToWindow(window, client_id, display_id, *clone, - nullptr); + delegate_->DispatchInputEventToWindow(window, client_id, event_location, + *clone, nullptr); } void EventDispatcher::CancelPointerEventsToTarget(ServerWindow* window) { @@ -827,7 +820,8 @@ 0 /* changed_button_flags */, ui::PointerDetails(pointer_type, pair.first), ui::EventTimeForNow()); - DispatchToPointerTarget(pair.second, event); + DispatchToPointerTarget(pair.second, event, + EventLocation(pair.second.display_id)); } pointer_targets_.clear(); }
diff --git a/services/ui/ws/event_dispatcher.h b/services/ui/ws/event_dispatcher.h index 2e203fb..bb08ab7 100644 --- a/services/ui/ws/event_dispatcher.h +++ b/services/ui/ws/event_dispatcher.h
@@ -22,6 +22,7 @@ #include "services/ui/ws/modal_window_controller.h" #include "services/ui/ws/server_window_observer.h" #include "ui/display/types/display_constants.h" +#include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect_f.h" namespace viz { @@ -43,7 +44,7 @@ class EventDispatcherDelegate; class ServerWindow; -struct DisplayLocation; +struct EventLocation; namespace test { class EventDispatcherTestApi; @@ -74,7 +75,7 @@ // any events to the delegate. void Reset(); - const gfx::Point& mouse_pointer_last_location() const { + const gfx::PointF& mouse_pointer_last_location() const { return mouse_pointer_last_location_; } int64_t mouse_pointer_display_id() const { return mouse_pointer_display_id_; } @@ -161,13 +162,14 @@ // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. // This may be asynchronous if we need to find the target window for |event| // asynchronously. + // NOTE: if |event| is a LocatedEvent, then |event_location.location| is the + // same as the location (and root_location) of |event|. void ProcessEvent(const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, AcceleratorMatchPhase match_phase); // EventTargeterDelegate: - ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, - int64_t* display_id) override; + ServerWindow* GetRootWindowForDisplay(int64_t display_id) override; void ProcessNextAvailableEvent() override; viz::HitTestQuery* GetHitTestQueryForDisplay(int64_t display_id) override; ServerWindow* GetWindowFromFrameSinkId( @@ -198,9 +200,6 @@ DeepestWindow deepest_window; }; - DisplayLocation GetDisplayLocationFromEvent(const ui::PointerEvent& event, - int64_t display_id) const; - // EventTargeter returns the deepest window based on hit-test data. If the // target is blocked by a modal window this returns a different target, // otherwise the supplied target is returned. @@ -216,7 +215,7 @@ // TODO(riajiang): No need to update mouse location after ozone drm can tell // us the right display the cursor is on for drag-n-drop events. // crbug.com/726470 - void SetMousePointerLocation(const gfx::Point& new_mouse_location, + void SetMousePointerLocation(const gfx::PointF& new_mouse_location, int64_t new_mouse_display_id); void ProcessKeyEvent(const ui::KeyEvent& event, @@ -237,7 +236,7 @@ // Callback from EventTargeter once the target has been found. Calls // ProcessPointerEventOnFoundTargetImpl(). void ProcessPointerEventOnFoundTarget(const ui::PointerEvent& event, - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target); // EventDispatcher provides the following logic for pointer events: @@ -254,24 +253,23 @@ // If ShouldUseEventTargeter() returned false it means this function should // not need |found_target| and has enough information to process the event // without a DeepestWindow. - void ProcessPointerEventOnFoundTargetImpl( - const ui::PointerEvent& event, - const DisplayLocation& display_location, - const DeepestWindow* found_target); + void ProcessPointerEventOnFoundTargetImpl(const ui::PointerEvent& event, + const EventLocation& event_location, + const DeepestWindow* found_target); // Called when processing a pointer event to updated cursor related // properties. void UpdateCursorRelatedProperties(const ui::PointerEvent& event, - const DisplayLocation& display_location); + const EventLocation& event_location); void UpdateNonClientAreaForCurrentWindowOnFoundWindow( - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target); // This callback is triggered by UpdateCursorProviderByLastKnownLocation(). // It calls UpdateCursorProvider() as appropriate. void UpdateCursorProviderByLastKnownLocationOnFoundWindow( - const DisplayLocation& display_location, + const EventLocation& event_location, const DeepestWindow& target); // Immediatley updates the cursor provider (|mouse_cursor_source_window_|) @@ -293,20 +291,22 @@ // currently tracked PointerTarget appropriately. void UpdateTargetForPointer(int32_t pointer_id, const ui::PointerEvent& event, - const PointerTarget& pointer_target); + const PointerTarget& pointer_target, + const EventLocation& event_location); // Returns true if any pointers are in the pressed/down state. bool AreAnyPointersDown() const; // If |target->window| is valid, then passes the event to the delegate. void DispatchToPointerTarget(const PointerTarget& target, - const ui::LocatedEvent& event); + const ui::LocatedEvent& event, + const EventLocation& event_location); // Dispatch |event| to the delegate. void DispatchToClient(ServerWindow* window, ClientSpecificId client_id, const ui::LocatedEvent& event, - int64_t display_id); + const EventLocation& event_location); // Stops sending pointer events to |window|. This does not remove the entry // for |window| from |pointer_targets_|, rather it nulls out the window. This @@ -358,7 +358,7 @@ // The location of the mouse pointer in display coordinates. This can be // outside the bounds of |mouse_cursor_source_window_|, which can capture the // cursor. - gfx::Point mouse_pointer_last_location_; + gfx::PointF mouse_pointer_last_location_; // Id of the display |mouse_pointer_last_location_| is on. int64_t mouse_pointer_display_id_ = display::kInvalidDisplayId;
diff --git a/services/ui/ws/event_dispatcher_delegate.h b/services/ui/ws/event_dispatcher_delegate.h index c128b15..f8f0ef7 100644 --- a/services/ui/ws/event_dispatcher_delegate.h +++ b/services/ui/ws/event_dispatcher_delegate.h
@@ -10,7 +10,7 @@ #include "services/ui/common/types.h" namespace gfx { -class Point; +class PointF; } namespace viz { @@ -61,7 +61,7 @@ virtual void OnCaptureChanged(ServerWindow* new_capture, ServerWindow* old_capture) = 0; - virtual void OnMouseCursorLocationChanged(const gfx::Point& point, + virtual void OnMouseCursorLocationChanged(const gfx::PointF& point, int64_t display_id) = 0; virtual void OnEventChangesCursorVisibility(const ui::Event& event, @@ -73,7 +73,7 @@ // Dispatches an event to the specific client. virtual void DispatchInputEventToWindow(ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, Accelerator* accelerator) = 0; @@ -93,8 +93,7 @@ // TODO(riajiang): No need to update |location_in_display| and |display_id| // after ozone drm can tell us the right display the cursor is on for // drag-n-drop events. crbug.com/726470 - virtual ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, - int64_t* display_id) = 0; + virtual ServerWindow* GetRootWindowForDisplay(int64_t display_id) = 0; // Returns the root of |window| that is used for event dispatch. The returned // value is used for coordinate conversion.
diff --git a/services/ui/ws/event_dispatcher_unittest.cc b/services/ui/ws/event_dispatcher_unittest.cc index b1afd56e..3bc6ca2 100644 --- a/services/ui/ws/event_dispatcher_unittest.cc +++ b/services/ui/ws/event_dispatcher_unittest.cc
@@ -21,6 +21,7 @@ #include "services/ui/public/interfaces/window_tree_constants.mojom.h" #include "services/ui/ws/accelerator.h" #include "services/ui/ws/event_dispatcher_delegate.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/server_window.h" #include "services/ui/ws/test_server_window_delegate.h" #include "services/ui/ws/test_utils.h" @@ -150,7 +151,7 @@ ServerWindow* old_capture_window) override { lost_capture_window_ = old_capture_window; } - void OnMouseCursorLocationChanged(const gfx::Point& point, + void OnMouseCursorLocationChanged(const gfx::PointF& point, int64_t display_id) override {} void OnEventChangesCursorVisibility(const ui::Event& event, bool visible) override { @@ -160,7 +161,7 @@ bool visible) override {} void DispatchInputEventToWindow(ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, Accelerator* accelerator) override { std::unique_ptr<DispatchedEventDetails> details(new DispatchedEventDetails); @@ -175,8 +176,7 @@ bool in_nonclient_area) override { return in_nonclient_area ? kNonclientAreaId : kClientAreaId; } - ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, - int64_t* display_id) override { + ServerWindow* GetRootWindowForDisplay(int64_t display_id) override { return root_; } void OnEventTargetNotFound(const ui::Event& event, @@ -264,6 +264,15 @@ return matcher; } +EventLocation EventLocationFromEvent(const Event& event) { + EventLocation event_location(0); + if (event.IsLocatedEvent()) { + event_location.raw_location = event_location.location = + event.AsLocatedEvent()->root_location_f(); + } + return event_location; +} + } // namespace // Test fixture for EventDispatcher with friend access to verify the internal @@ -283,7 +292,6 @@ void DispatchEvent(EventDispatcher* dispatcher, const ui::Event& event, - int64_t display_id, EventDispatcher::AcceleratorMatchPhase match_phase); void RunMouseEventTests(EventDispatcher* dispatcher, TestEventDispatcherDelegate* dispatcher_delegate, @@ -329,9 +337,8 @@ void EventDispatcherTest::DispatchEvent( EventDispatcher* dispatcher, const ui::Event& event, - int64_t display_id, EventDispatcher::AcceleratorMatchPhase match_phase) { - dispatcher->ProcessEvent(event, display_id, match_phase); + dispatcher->ProcessEvent(event, EventLocationFromEvent(event), match_phase); RunTasks(); } @@ -344,7 +351,7 @@ const MouseEventTest& test = tests[i]; ASSERT_FALSE(dispatcher_delegate->has_queued_events()) << " unexpected queued events before running " << i; - DispatchEvent(dispatcher, ui::PointerEvent(*test.input_event), 0, + DispatchEvent(dispatcher, ui::PointerEvent(*test.input_event), EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -459,9 +466,8 @@ void DispatchEvent(EventDispatcher* dispatcher, const ui::Event& event, - int64_t display_id, EventDispatcher::AcceleratorMatchPhase match_phase) { - dispatcher->ProcessEvent(event, display_id, match_phase); + dispatcher->ProcessEvent(event, EventLocationFromEvent(event), match_phase); if (!is_event_processing_async()) return; @@ -546,7 +552,7 @@ const ui::PointerEvent ui_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), ui_event, 0, + DispatchEvent(event_dispatcher(), ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -565,7 +571,7 @@ TEST_P(EventDispatcherTest, ProcessEventNoTarget) { // Send event without a target. ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); - DispatchEvent(event_dispatcher(), key, 0, + DispatchEvent(event_dispatcher(), key, EventDispatcher::AcceleratorMatchPhase::ANY); // Event wasn't dispatched to a target. @@ -630,8 +636,7 @@ dispatcher->AddAccelerator(accelerator_1, std::move(matcher)); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(accelerator_1, event_dispatcher_delegate->GetAndClearLastAccelerator()); @@ -639,28 +644,24 @@ // ignoring. key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN | ui::EF_NUM_LOCK_ON); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(accelerator_1, event_dispatcher_delegate->GetAndClearLastAccelerator()); key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_NONE); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator()); uint32_t accelerator_2 = 2; matcher = ui::CreateKeyMatcher(ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagNone); dispatcher->AddAccelerator(accelerator_2, std::move(matcher)); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(accelerator_2, event_dispatcher_delegate->GetAndClearLastAccelerator()); dispatcher->RemoveAccelerator(accelerator_2); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator()); } @@ -678,8 +679,7 @@ ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); // The post-target accelerator should be fired if there is no focused window. - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(accelerator_1, event_dispatcher_delegate->GetAndClearLastAccelerator()); std::unique_ptr<DispatchedEventDetails> details = @@ -691,8 +691,7 @@ event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get()); // With a focused window the event should be dispatched. - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator()); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(details); @@ -704,8 +703,7 @@ EXPECT_FALSE(accelerator_weak_ptr); // Post deletion there should be no accelerator - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator()); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(details); @@ -740,15 +738,14 @@ // Dispatch for ANY, which should trigger PRE and not call // DispatchInputEventToWindow(). ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); - DispatchEvent(dispatcher, key, 0, - EventDispatcher::AcceleratorMatchPhase::ANY); + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(EventDispatcherDelegate::AcceleratorPhase::PRE, event_dispatcher_delegate->last_accelerator_phase()); EXPECT_EQ(pre_id, event_dispatcher_delegate->GetAndClearLastAccelerator()); EXPECT_FALSE(event_dispatcher_delegate->has_queued_events()); // Dispatch for POST, which should trigger POST. - DispatchEvent(dispatcher, key, 0, + DispatchEvent(dispatcher, key, EventDispatcher::AcceleratorMatchPhase::POST_ONLY); std::unique_ptr<DispatchedEventDetails> details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); @@ -866,7 +863,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event, 0, + DispatchEvent(dispatcher, press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target child and be in the non-client area. @@ -881,7 +878,7 @@ const ui::PointerEvent move_event( ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(17, 18), gfx::Point(17, 18), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(dispatcher, move_event, 0, + DispatchEvent(dispatcher, move_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Still same target. @@ -894,7 +891,7 @@ const ui::PointerEvent release_event(ui::MouseEvent( ui::ET_MOUSE_RELEASED, gfx::Point(17, 18), gfx::Point(17, 18), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, release_event, 0, + DispatchEvent(dispatcher, release_event, EventDispatcher::AcceleratorMatchPhase::ANY); // The event should not have been dispatched to the delegate. @@ -908,7 +905,7 @@ const ui::PointerEvent press_event2(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(21, 22), gfx::Point(21, 22), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event2, 0, + DispatchEvent(dispatcher, press_event2, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(event_dispatcher_delegate->has_queued_events()); @@ -939,7 +936,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(28, 11), gfx::Point(28, 11), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), press_event, 0, + DispatchEvent(event_dispatcher(), press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target child and be in the client area. @@ -961,7 +958,7 @@ const ui::PointerEvent move1(ui::MouseEvent( ui::ET_MOUSE_MOVED, gfx::Point(11, 11), gfx::Point(11, 11), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(event_dispatcher(), move1, 0, + DispatchEvent(event_dispatcher(), move1, EventDispatcher::AcceleratorMatchPhase::ANY); // Event went through the child window and hit the root. @@ -976,7 +973,7 @@ const ui::PointerEvent move2(ui::MouseEvent( ui::ET_MOUSE_MOVED, gfx::Point(11, 12), gfx::Point(11, 12), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(event_dispatcher(), move2, 0, + DispatchEvent(event_dispatcher(), move2, EventDispatcher::AcceleratorMatchPhase::ANY); // Mouse exits the root. @@ -1005,7 +1002,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event, 0, + DispatchEvent(dispatcher, press_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); @@ -1030,7 +1027,7 @@ const ui::PointerEvent touch_event1(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, touch_event1, 0, + DispatchEvent(dispatcher, touch_event1, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); @@ -1040,7 +1037,7 @@ const ui::PointerEvent drag_event1(ui::TouchEvent( ui::ET_TOUCH_MOVED, gfx::Point(53, 54), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, drag_event1, 0, + DispatchEvent(dispatcher, drag_event1, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child1.get(), details->window); @@ -1049,7 +1046,7 @@ const ui::PointerEvent touch_event2(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2))); - DispatchEvent(dispatcher, touch_event2, 0, + DispatchEvent(dispatcher, touch_event2, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child2.get(), details->window); @@ -1058,13 +1055,13 @@ const ui::PointerEvent drag_event2(ui::TouchEvent( ui::ET_TOUCH_MOVED, gfx::Point(13, 14), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2))); - DispatchEvent(dispatcher, drag_event2, 0, + DispatchEvent(dispatcher, drag_event2, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child2.get(), details->window); // Drag again with id 1, child1 should continue to get it. - DispatchEvent(dispatcher, drag_event1, 0, + DispatchEvent(dispatcher, drag_event1, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child1.get(), details->window); @@ -1073,14 +1070,14 @@ const ui::PointerEvent touch_release(ui::TouchEvent( ui::ET_TOUCH_RELEASED, gfx::Point(54, 55), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, touch_release, 0, + DispatchEvent(dispatcher, touch_release, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child1.get(), details->window); const ui::PointerEvent touch_event3(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2))); - DispatchEvent(dispatcher, touch_event3, 0, + DispatchEvent(dispatcher, touch_event3, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(child2.get(), details->window); @@ -1100,7 +1097,7 @@ const ui::PointerEvent touch_event1(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, touch_event1, 0, + DispatchEvent(dispatcher, touch_event1, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); @@ -1113,7 +1110,7 @@ const ui::PointerEvent drag_event1(ui::TouchEvent( ui::ET_TOUCH_MOVED, gfx::Point(53, 54), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, drag_event1, 0, + DispatchEvent(dispatcher, drag_event1, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(nullptr, details.get()); @@ -1134,7 +1131,7 @@ const ui::PointerEvent ui_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(8, 9), gfx::Point(8, 9), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, ui_event, 0, + DispatchEvent(dispatcher, ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); @@ -1144,7 +1141,7 @@ const ui::PointerEvent release_event(ui::MouseEvent( ui::ET_MOUSE_RELEASED, gfx::Point(8, 9), gfx::Point(8, 9), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, release_event, 0, + DispatchEvent(dispatcher, release_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_FALSE(event_dispatcher_delegate->has_queued_events()); @@ -1155,7 +1152,7 @@ // region. Should result in exit for root, followed by press for child. root->set_extended_hit_test_regions_for_children(gfx::Insets(-5, -5, -5, -5), gfx::Insets(-5, -5, -5, -5)); - DispatchEvent(dispatcher, ui_event, 0, + DispatchEvent(dispatcher, ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_EQ(root, details->window); @@ -1222,7 +1219,7 @@ const ui::PointerEvent left_press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, left_press_event, 0, + DispatchEvent(dispatcher, left_press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target child. @@ -1239,7 +1236,7 @@ ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, right_press_event, 0, + DispatchEvent(dispatcher, right_press_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(IsMouseButtonDown()); @@ -1249,7 +1246,7 @@ ui::ET_MOUSE_RELEASED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, left_release_event, 0, + DispatchEvent(dispatcher, left_release_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(IsMouseButtonDown()); @@ -1258,7 +1255,7 @@ const ui::PointerEvent touch_event(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(15, 15), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2))); - DispatchEvent(dispatcher, touch_event, 0, + DispatchEvent(dispatcher, touch_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(IsMouseButtonDown()); @@ -1268,7 +1265,7 @@ ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(15, 5), gfx::Point(15, 5), base::TimeTicks(), ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, move_event, 0, + DispatchEvent(dispatcher, move_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_TRUE(IsMouseButtonDown()); @@ -1278,7 +1275,7 @@ ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, right_release_event, 0, + DispatchEvent(dispatcher, right_release_event, EventDispatcher::AcceleratorMatchPhase::ANY); details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); EXPECT_FALSE(IsMouseButtonDown()); @@ -1290,7 +1287,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event, 0, + DispatchEvent(dispatcher, press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target the root. @@ -1353,7 +1350,7 @@ const ui::PointerEvent touch_event(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, touch_event, 0, + DispatchEvent(dispatcher, touch_event, EventDispatcher::AcceleratorMatchPhase::ANY); } @@ -1386,7 +1383,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event, 0, + DispatchEvent(dispatcher, press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target the root. @@ -1407,7 +1404,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(dispatcher, press_event, 0, + DispatchEvent(dispatcher, press_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1419,7 +1416,7 @@ const ui::PointerEvent touch_event(ui::TouchEvent( ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1))); - DispatchEvent(dispatcher, touch_event, 0, + DispatchEvent(dispatcher, touch_event, EventDispatcher::AcceleratorMatchPhase::ANY); } @@ -1490,7 +1487,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(6, 6), gfx::Point(6, 6), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), press_event, 0, + DispatchEvent(event_dispatcher(), press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // Events should target child and be in the client area. @@ -1511,7 +1508,7 @@ const ui::PointerEvent pointer_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), pointer_event, 0, + DispatchEvent(event_dispatcher(), pointer_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1533,7 +1530,7 @@ ui::ET_TOUCH_RELEASED, gfx::Point(25, 20), base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, touch_id))); - DispatchEvent(event_dispatcher(), pointer_event, 0, + DispatchEvent(event_dispatcher(), pointer_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1561,7 +1558,7 @@ const ui::PointerEvent ui_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), ui_event, 0, + DispatchEvent(event_dispatcher(), ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1605,7 +1602,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); // As |w2| is modal and the event is over |w1|, no events should be queued, // and the delegate should be informed of this. @@ -1617,7 +1614,7 @@ const ui::PointerEvent mouse_released(ui::MouseEvent( ui::ET_MOUSE_RELEASED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_released, 0, + DispatchEvent(event_dispatcher(), mouse_released, EventDispatcher::AcceleratorMatchPhase::ANY); ASSERT_FALSE(test_event_dispatcher_delegate()->has_queued_events()); EXPECT_FALSE(test_event_dispatcher_delegate()->window_that_blocked_event()); @@ -1626,7 +1623,7 @@ const ui::PointerEvent mouse_pressed2(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed2, 0, + DispatchEvent(event_dispatcher(), mouse_pressed2, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); @@ -1658,7 +1655,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1694,7 +1691,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(75, 15), gfx::Point(75, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1730,7 +1727,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); // The event is targeted at |w11|, but is blocked by the modal window |w2|. @@ -1761,7 +1758,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1790,7 +1787,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1820,7 +1817,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); ASSERT_TRUE(test_event_dispatcher_delegate()->last_event_target_not_found()); @@ -1845,7 +1842,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -1896,7 +1893,7 @@ ui::PointerEvent(ui::TouchEvent( ui::ET_TOUCH_PRESSED, kTouchData[i].location, base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0))), - 0, EventDispatcher::AcceleratorMatchPhase::ANY); + EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); ASSERT_TRUE(details) << " details is nullptr " << i; @@ -1908,7 +1905,7 @@ ui::PointerEvent(ui::TouchEvent( ui::ET_TOUCH_RELEASED, kTouchData[i].location, base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0))), - 0, EventDispatcher::AcceleratorMatchPhase::ANY); + EventDispatcher::AcceleratorMatchPhase::ANY); test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); } } @@ -2029,7 +2026,7 @@ const ui::PointerEvent mouse_pressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), mouse_pressed, 0, + DispatchEvent(event_dispatcher(), mouse_pressed, EventDispatcher::AcceleratorMatchPhase::ANY); event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId); @@ -2167,7 +2164,7 @@ const ui::PointerEvent move_event( ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(15, 15), gfx::Point(15, 15), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(event_dispatcher(), move_event, 0, + DispatchEvent(event_dispatcher(), move_event, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(c1.get(), event_dispatcher()->mouse_cursor_source_window()); @@ -2189,7 +2186,7 @@ const ui::PointerEvent ui_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), ui_event, 0, + DispatchEvent(event_dispatcher(), ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details = @@ -2212,7 +2209,7 @@ const ui::PointerEvent move1( ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(11, 11), gfx::Point(11, 11), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(event_dispatcher(), move1, 0, + DispatchEvent(event_dispatcher(), move1, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(base::Optional<bool>(true), @@ -2232,7 +2229,7 @@ event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get()); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); - DispatchEvent(event_dispatcher(), key, 0, + DispatchEvent(event_dispatcher(), key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(base::Optional<bool>(), @@ -2252,7 +2249,7 @@ event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get()); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); - DispatchEvent(event_dispatcher(), key, 0, + DispatchEvent(event_dispatcher(), key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(base::Optional<bool>(), @@ -2272,7 +2269,7 @@ event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get()); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); - DispatchEvent(event_dispatcher(), key, 0, + DispatchEvent(event_dispatcher(), key, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(base::Optional<bool>(false), @@ -2295,7 +2292,7 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), press_event, 0, + DispatchEvent(event_dispatcher(), press_event, EventDispatcher::AcceleratorMatchPhase::ANY); // As the event falls over |modal_parent|, but there is a CHILD_MODAL window, @@ -2341,7 +2338,7 @@ const ui::PointerEvent move( ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(11, 11), gfx::Point(11, 11), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0)); - DispatchEvent(event_dispatcher(), move, 0, + DispatchEvent(event_dispatcher(), move, EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_EQ(nullptr, event_dispatcher()->mouse_cursor_source_window()); @@ -2365,14 +2362,15 @@ const ui::PointerEvent press_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), press_event, 0, + DispatchEvent(event_dispatcher(), press_event, EventDispatcher::AcceleratorMatchPhase::ANY); ASSERT_FALSE(event_dispatcher()->IsProcessingEvent()); const ui::PointerEvent move_event(ui::MouseEvent( ui::ET_MOUSE_MOVED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - event_dispatcher()->ProcessEvent(move_event, 0, + event_dispatcher()->ProcessEvent(move_event, + EventLocationFromEvent(move_event), EventDispatcher::AcceleratorMatchPhase::ANY); EXPECT_FALSE(event_dispatcher()->IsProcessingEvent()); } @@ -2399,7 +2397,7 @@ const ui::PointerEvent ui_event(ui::MouseEvent( ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25), base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - DispatchEvent(event_dispatcher(), ui_event, 0, + DispatchEvent(event_dispatcher(), ui_event, EventDispatcher::AcceleratorMatchPhase::ANY); std::unique_ptr<DispatchedEventDetails> details =
diff --git a/services/ui/ws/event_location.h b/services/ui/ws/event_location.h new file mode 100644 index 0000000..f51d7f0 --- /dev/null +++ b/services/ui/ws/event_location.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 SERVICES_UI_WS_EVENT_LOCATION_H_ +#define SERVICES_UI_WS_EVENT_LOCATION_H_ + +#include <stdint.h> + +#include "ui/display/types/display_constants.h" +#include "ui/gfx/geometry/point_f.h" + +namespace ui { +namespace ws { + +// Contains a location relative to a particular display in two different +// coordinate systems. The location the event is received at is |raw_location|. +// |raw_location| is in terms of the pixel display layout. |location| is derived +// from |raw_location| and in terms of the DIP display layout (but in pixels). +// Typically |raw_location| is on a single display, in which case |location| is +// exactly the same value. If there is a grab then the events are still +// generated for the display the grab was initiated on, even if the mouse moves +// to another display. As the pixel layout of displays differs from the DIP +// layout |location| is converted to follow the DIP layout (but in pixels). +// +// For example, two displays might have pixels bounds of: +// 0,0 1000x1000 and 0,1060 1000x1000 +// where as the DIP bounds might be: +// 0,0 500x500 and 500,0 1000x1000 +// Notice the pixel bounds are staggered along the y-axis and the DIP bounds +// along the x-axis. +// If there is a grab on the first display and the mouse moves into the second +// display then |raw_location| would be 0,1060 which is converted to a +// |location| of 1000,0 (|display_id| remains the same regardless of the display +// the mouse is on. +struct EventLocation { + EventLocation() : display_id(display::kInvalidDisplayId) {} + explicit EventLocation(int64_t display_id) : display_id(display_id) {} + EventLocation(const gfx::PointF& raw_location, + const gfx::PointF& location, + int64_t display_id) + : raw_location(raw_location), + location(location), + display_id(display_id) {} + + // Location of event in terms of pixel display layout. + gfx::PointF raw_location; + + // Location of event in terms of DIP display layout (but in pixels). + gfx::PointF location; + + // Id of the display the event was generated from. + int64_t display_id; +}; + +} // namespace ws +} // namespace ui + +#endif // SERVICES_UI_WS_EVENT_LOCATION_H_
diff --git a/services/ui/ws/event_targeter.cc b/services/ui/ws/event_targeter.cc index ddd1353..0bae4d8 100644 --- a/services/ui/ws/event_targeter.cc +++ b/services/ui/ws/event_targeter.cc
@@ -6,11 +6,14 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "base/metrics/user_metrics.h" #include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "components/viz/host/hit_test/hit_test_query.h" #include "services/ui/common/switches.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/event_targeter_delegate.h" +#include "ui/gfx/geometry/point_conversions.h" namespace ui { namespace ws { @@ -21,10 +24,9 @@ EventTargeter::~EventTargeter() {} -void EventTargeter::FindTargetForLocation( - EventSource event_source, - const DisplayLocation& display_location, - HitTestCallback callback) { +void EventTargeter::FindTargetForLocation(EventSource event_source, + const EventLocation& event_location, + HitTestCallback callback) { // TODO(riajiang): After the async ask-client part is implemented, the async // part should be moved to after sync viz-hit-test call. if (base::CommandLine::ForCurrentProcess()->HasSwitch( @@ -32,49 +34,48 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EventTargeter::FindTargetForLocationNow, weak_ptr_factory_.GetWeakPtr(), event_source, - display_location, base::Passed(&callback))); + event_location, base::Passed(&callback))); } else { - FindTargetForLocationNow(event_source, display_location, - std::move(callback)); + FindTargetForLocationNow(event_source, event_location, std::move(callback)); } } void EventTargeter::FindTargetForLocationNow( EventSource event_source, - const DisplayLocation& display_location, + const EventLocation& event_location, HitTestCallback callback) { - DisplayLocation updated_display_location = display_location; - ServerWindow* root = event_targeter_delegate_->GetRootWindowContaining( - &updated_display_location.location, &updated_display_location.display_id); + ServerWindow* root = event_targeter_delegate_->GetRootWindowForDisplay( + event_location.display_id); DeepestWindow deepest_window; if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kUseVizHitTest)) { if (root) { deepest_window = ui::ws::FindDeepestVisibleWindowForLocation( - root, event_source, updated_display_location.location); + root, event_source, gfx::ToFlooredPoint(event_location.raw_location)); } } else { viz::HitTestQuery* hit_test_query = event_targeter_delegate_->GetHitTestQueryForDisplay( - updated_display_location.display_id); + event_location.display_id); if (hit_test_query) { viz::Target target = hit_test_query->FindTargetForLocation( - event_source, updated_display_location.location); + event_source, gfx::ToFlooredPoint(event_location.raw_location)); if (target.frame_sink_id.is_valid()) { ServerWindow* target_window = event_targeter_delegate_->GetWindowFromFrameSinkId( target.frame_sink_id); if (!target_window) { - // TODO(riajiang): There's no target window with this frame_sink_id, - // maybe a security fault. http://crbug.com/746470 - NOTREACHED(); + // TODO(riajiang): Investigate when this would be a security fault. + // http://crbug.com/746470 + base::RecordAction( + base::UserMetricsAction("EventTargeting_DeletedTarget")); } deepest_window.window = target_window; // TODO(riajiang): use |target.location_in_target|. } } } - std::move(callback).Run(updated_display_location, deepest_window); + std::move(callback).Run(event_location, deepest_window); } } // namespace ws
diff --git a/services/ui/ws/event_targeter.h b/services/ui/ws/event_targeter.h index 0a8ae3c..56935f9 100644 --- a/services/ui/ws/event_targeter.h +++ b/services/ui/ws/event_targeter.h
@@ -17,19 +17,14 @@ namespace ws { class EventTargeterDelegate; +struct EventLocation; namespace test { class EventTargeterTestApi; } -// Contains a location relative to a particular display. -struct DisplayLocation { - gfx::Point location; - int64_t display_id; -}; - using HitTestCallback = - base::OnceCallback<void(const DisplayLocation&, const DeepestWindow&)>; + base::OnceCallback<void(const EventLocation&, const DeepestWindow&)>; // Finds the target window for a location. class EventTargeter { @@ -40,14 +35,14 @@ // Calls WindowFinder to find the target for |display_location|. |callback| is // called with the found target. void FindTargetForLocation(EventSource event_source, - const DisplayLocation& display_location, + const EventLocation& event_location, HitTestCallback callback); private: friend class test::EventTargeterTestApi; void FindTargetForLocationNow(EventSource event_source, - const DisplayLocation& display_location, + const EventLocation& display_location, HitTestCallback callback); EventTargeterDelegate* event_targeter_delegate_;
diff --git a/services/ui/ws/event_targeter_delegate.h b/services/ui/ws/event_targeter_delegate.h index 2aad9d7..6705f00 100644 --- a/services/ui/ws/event_targeter_delegate.h +++ b/services/ui/ws/event_targeter_delegate.h
@@ -7,10 +7,6 @@ #include <stdint.h> -namespace gfx { -class Point; -} - namespace viz { class HitTestQuery; } @@ -22,10 +18,9 @@ // Used by EventTargeter to talk to WindowManagerState. class EventTargeterDelegate { public: - // Calls EventDispatcherDelegate::GetRootWindowContaining, see + // Calls EventDispatcherDelegate::GetRootWindowForDisplay(), see // event_dispatcher_delegate.h for details. - virtual ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, - int64_t* display_id) = 0; + virtual ServerWindow* GetRootWindowForDisplay(int64_t display_id) = 0; // Calls EventDispatcherDelegate::ProcessNextAvailableEvent, see // event_dispatcher_delegate.h for details.
diff --git a/services/ui/ws/focus_controller_unittest.cc b/services/ui/ws/focus_controller_unittest.cc index ecd26f6..6b5f3e2 100644 --- a/services/ui/ws/focus_controller_unittest.cc +++ b/services/ui/ws/focus_controller_unittest.cc
@@ -76,21 +76,21 @@ TEST(FocusControllerTest, Basic) { TestServerWindowDelegate server_window_delegate; - ServerWindow root(&server_window_delegate, WindowId()); + ServerWindow root(&server_window_delegate, WindowId(1, 1)); server_window_delegate.set_root_window(&root); root.SetVisible(true); root.set_is_activation_parent(true); - ServerWindow child(&server_window_delegate, WindowId()); + ServerWindow child(&server_window_delegate, WindowId(1, 2)); child.SetVisible(true); child.set_is_activation_parent(true); root.Add(&child); - ServerWindow child_child(&server_window_delegate, WindowId()); + ServerWindow child_child(&server_window_delegate, WindowId(1, 3)); child_child.SetVisible(true); child.Add(&child_child); child_child.set_is_activation_parent(true); // Sibling of |child|. - ServerWindow child2(&server_window_delegate, WindowId()); + ServerWindow child2(&server_window_delegate, WindowId(1, 4)); child2.SetVisible(true); root.Add(&child2); @@ -174,19 +174,19 @@ TEST(FocusControllerTest, ActiveWindowMovesToDifferentDisplay) { TestServerWindowDelegate2 server_window_delegate; - ServerWindow root1(&server_window_delegate, WindowId()); + ServerWindow root1(&server_window_delegate, WindowId(1, 1)); root1.SetVisible(true); root1.set_is_activation_parent(true); - ServerWindow root2(&server_window_delegate, WindowId()); + ServerWindow root2(&server_window_delegate, WindowId(1, 2)); root2.SetVisible(true); root2.set_is_activation_parent(true); - ServerWindow child(&server_window_delegate, WindowId()); + ServerWindow child(&server_window_delegate, WindowId(1, 3)); root1.Add(&child); child.SetVisible(true); child.set_is_activation_parent(true); - ServerWindow child_child(&server_window_delegate, WindowId()); + ServerWindow child_child(&server_window_delegate, WindowId(1, 4)); child.Add(&child_child); child_child.SetVisible(true);
diff --git a/services/ui/ws/ids.h b/services/ui/ws/ids.h index 1b44be8..183f0266 100644 --- a/services/ui/ws/ids.h +++ b/services/ui/ws/ids.h
@@ -13,6 +13,7 @@ #include "base/containers/hash_tables.h" #include "base/hash.h" #include "base/strings/stringprintf.h" +#include "components/viz/common/surfaces/frame_sink_id.h" #include "services/ui/common/types.h" #include "services/ui/common/util.h" @@ -23,6 +24,8 @@ // id. const ClientSpecificId kInvalidClientId = 0; +const Id kInvalidTransportId = 0; + // A client id used to indicate WindowServer. const ClientSpecificId kWindowServerClientId = 1; @@ -40,6 +43,10 @@ // multiple windows having the same ClientWindowId. WindowTree enforces // that embed roots use the client id in creating the window id to avoid // possible conflicts. + +// Used for ids assigned by the client. +using ClientWindowId = viz::FrameSinkId; + struct WindowId { constexpr WindowId(ClientSpecificId client_id, ClientSpecificId window_id) : client_id(client_id), window_id(window_id) {} @@ -56,6 +63,10 @@ std::tie(other.client_id, other.window_id); } + ClientWindowId ToClientWindowId() const { + return ClientWindowId(client_id, window_id); + } + std::string ToString() const { return base::StringPrintf("%u:%u", client_id, window_id); } @@ -64,24 +75,6 @@ ClientSpecificId window_id; }; -// Used for ids assigned by the client. -struct ClientWindowId { - explicit ClientWindowId(Id id) : id(id) {} - ClientWindowId(ClientSpecificId client_id, ClientSpecificId window_id) - : ClientWindowId((client_id << 16) | window_id) {} - ClientWindowId() : id(0u) {} - - bool operator==(const ClientWindowId& other) const { return other.id == id; } - - bool operator!=(const ClientWindowId& other) const { - return !(*this == other); - } - - bool operator<(const ClientWindowId& other) const { return id < other.id; } - - Id id; -}; - inline WindowId WindowIdFromTransportId(Id id) { return WindowId(HiWord(id), LoWord(id)); } @@ -97,9 +90,7 @@ return WindowId(kWindowServerClientId, 2 + index); } -struct ClientWindowIdHash { - size_t operator()(const ClientWindowId& id) const { return id.id; } -}; +using ClientWindowIdHash = viz::FrameSinkIdHash; struct WindowIdHash { size_t operator()(const WindowId& id) const {
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc index 9932521e..f8c9e19 100644 --- a/services/ui/ws/server_window.cc +++ b/services/ui/ws/server_window.cc
@@ -22,14 +22,15 @@ namespace ws { ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id) - : ServerWindow(delegate, id, Properties()) {} + : ServerWindow(delegate, id, id.ToClientWindowId(), Properties()) {} ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id, + const viz::FrameSinkId& frame_sink_id, const Properties& properties) : delegate_(delegate), id_(id), - frame_sink_id_((id_.client_id << 16) | id_.window_id, 0), + frame_sink_id_(frame_sink_id), parent_(nullptr), stacking_target_(nullptr), transient_parent_(nullptr), @@ -50,6 +51,7 @@ DCHECK(delegate); // Must provide a delegate. // TODO(kylechar): Add method to reregister |frame_sink_id_| when viz service // has crashed. + DCHECK(frame_sink_id_.is_valid()); auto* host_frame_sink_manager = delegate_->GetHostFrameSinkManager(); if (host_frame_sink_manager) { host_frame_sink_manager->RegisterFrameSinkId(frame_sink_id_, this);
diff --git a/services/ui/ws/server_window.h b/services/ui/ws/server_window.h index 3ed98e9..f579f9c 100644 --- a/services/ui/ws/server_window.h +++ b/services/ui/ws/server_window.h
@@ -14,6 +14,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/observer_list.h" +#include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/host/host_frame_sink_client.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" @@ -51,8 +52,11 @@ using Windows = std::vector<ServerWindow*>; ServerWindow(ServerWindowDelegate* delegate, const WindowId& id); + // |frame_sink_id| needs to be an input here as we are creating frame_sink_id_ + // based on the ClientWindowId clients provided. ServerWindow(ServerWindowDelegate* delegate, const WindowId& id, + const viz::FrameSinkId& frame_sink_id, const Properties& properties); ~ServerWindow() override;
diff --git a/services/ui/ws/server_window_drawn_tracker_unittest.cc b/services/ui/ws/server_window_drawn_tracker_unittest.cc index 313443b..17451d98 100644 --- a/services/ui/ws/server_window_drawn_tracker_unittest.cc +++ b/services/ui/ws/server_window_drawn_tracker_unittest.cc
@@ -63,12 +63,18 @@ DISALLOW_COPY_AND_ASSIGN(TestServerWindowDrawnTrackerObserver); }; +WindowId MakeWindowId() { + constexpr int client_id = 1; + static int window_id = 0; + return WindowId(client_id, ++window_id); +} + } // namespace TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfDeletionAndVisibility) { TestServerWindowDelegate server_window_delegate; std::unique_ptr<ServerWindow> window( - new ServerWindow(&server_window_delegate, WindowId())); + new ServerWindow(&server_window_delegate, MakeWindowId())); server_window_delegate.set_root_window(window.get()); TestServerWindowDrawnTrackerObserver drawn_observer; ServerWindowDrawnTracker tracker(window.get(), &drawn_observer); @@ -107,10 +113,10 @@ TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfRemovingFromRoot) { TestServerWindowDelegate server_window_delegate; - ServerWindow root(&server_window_delegate, WindowId()); + ServerWindow root(&server_window_delegate, MakeWindowId()); server_window_delegate.set_root_window(&root); root.SetVisible(true); - ServerWindow child(&server_window_delegate, WindowId()); + ServerWindow child(&server_window_delegate, MakeWindowId()); child.SetVisible(true); root.Add(&child); @@ -134,14 +140,14 @@ TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfRemovingAncestorFromRoot) { TestServerWindowDelegate server_window_delegate; - ServerWindow root(&server_window_delegate, WindowId()); + ServerWindow root(&server_window_delegate, MakeWindowId()); server_window_delegate.set_root_window(&root); root.SetVisible(true); - ServerWindow child(&server_window_delegate, WindowId()); + ServerWindow child(&server_window_delegate, MakeWindowId()); child.SetVisible(true); root.Add(&child); - ServerWindow child_child(&server_window_delegate, WindowId()); + ServerWindow child_child(&server_window_delegate, MakeWindowId()); child_child.SetVisible(true); child.Add(&child_child); @@ -165,10 +171,10 @@ TEST(ServerWindowDrawnTrackerTest, VisibilityChangeFromNonParentAncestor) { TestServerWindowDelegate server_window_delegate; - ServerWindow root(&server_window_delegate, WindowId()); - ServerWindow child1(&server_window_delegate, WindowId()); - ServerWindow child2(&server_window_delegate, WindowId()); - ServerWindow child3(&server_window_delegate, WindowId()); + ServerWindow root(&server_window_delegate, MakeWindowId()); + ServerWindow child1(&server_window_delegate, MakeWindowId()); + ServerWindow child2(&server_window_delegate, MakeWindowId()); + ServerWindow child3(&server_window_delegate, MakeWindowId()); server_window_delegate.set_root_window(&root); root.Add(&child1); @@ -206,11 +212,11 @@ TEST(ServerWindowDrawnTrackerTest, TreeHierarchyChangeFromNonParentAncestor) { TestServerWindowDelegate server_window_delegate; - ServerWindow root(&server_window_delegate, WindowId()); - ServerWindow child1(&server_window_delegate, WindowId()); - ServerWindow child2(&server_window_delegate, WindowId()); - ServerWindow child11(&server_window_delegate, WindowId()); - ServerWindow child111(&server_window_delegate, WindowId()); + ServerWindow root(&server_window_delegate, MakeWindowId()); + ServerWindow child1(&server_window_delegate, MakeWindowId()); + ServerWindow child2(&server_window_delegate, MakeWindowId()); + ServerWindow child11(&server_window_delegate, MakeWindowId()); + ServerWindow child111(&server_window_delegate, MakeWindowId()); server_window_delegate.set_root_window(&root); root.Add(&child1);
diff --git a/services/ui/ws/test_change_tracker.cc b/services/ui/ws/test_change_tracker.cc index b267cc09..fb2518a3 100644 --- a/services/ui/ws/test_change_tracker.cc +++ b/services/ui/ws/test_change_tracker.cc
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/map.h" #include "services/ui/common/util.h" #include "ui/base/cursor/cursor.h" +#include "ui/gfx/geometry/point_conversions.h" namespace ui { @@ -30,6 +31,8 @@ enum class ChangeDescriptionType { ONE, TWO, + // Includes display id and location of events. + THREE, }; std::string ChangeToDescription(const Change& change, @@ -232,7 +235,8 @@ bool_value(false), float_value(0.f), cursor_type(ui::CursorType::kNull), - change_id(0u) {} + change_id(0u), + display_id(0) {} Change::Change(const Change& other) = default; @@ -379,14 +383,21 @@ AddChange(change); } -void TestChangeTracker::OnWindowInputEvent(Id window_id, - const ui::Event& event, - bool matches_pointer_watcher) { +void TestChangeTracker::OnWindowInputEvent( + Id window_id, + const ui::Event& event, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + bool matches_pointer_watcher) { Change change; change.type = CHANGE_TYPE_INPUT_EVENT; change.window_id = window_id; change.event_action = static_cast<int32_t>(event.type()); change.matches_pointer_watcher = matches_pointer_watcher; + change.display_id = display_id; + if (event.IsLocatedEvent()) + change.location1 = event.AsLocatedEvent()->root_location(); + change.location2 = event_location_in_screen_pixel_layout; if (event.IsKeyEvent() && event.AsKeyEvent()->properties()) change.key_event_properties = *event.AsKeyEvent()->properties(); AddChange(change);
diff --git a/services/ui/ws/test_change_tracker.h b/services/ui/ws/test_change_tracker.h index c295167..070d4ce 100644 --- a/services/ui/ws/test_change_tracker.h +++ b/services/ui/ws/test_change_tracker.h
@@ -15,6 +15,8 @@ #include "services/ui/common/types.h" #include "services/ui/public/interfaces/window_tree.mojom.h" #include "ui/gfx/geometry/mojo/geometry.mojom.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/point_f.h" namespace ui { @@ -97,6 +99,9 @@ gfx::Transform transform; // Set in OnWindowInputEvent() if the event is a KeyEvent. std::unordered_map<std::string, std::vector<uint8_t>> key_event_properties; + int64_t display_id; + gfx::Point location1; + gfx::PointF location2; }; // Converts Changes to string descriptions. @@ -168,9 +173,12 @@ void OnWindowVisibilityChanged(Id window_id, bool visible); void OnWindowOpacityChanged(Id window_id, float opacity); void OnWindowParentDrawnStateChanged(Id window_id, bool drawn); - void OnWindowInputEvent(Id window_id, - const ui::Event& event, - bool matches_pointer_watcher); + void OnWindowInputEvent( + Id window_id, + const ui::Event& event, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + bool matches_pointer_watcher); void OnPointerEventObserved(const ui::Event& event, uint32_t window_id); void OnWindowSharedPropertyChanged(
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc index 9fd3387..b0ec7f7 100644 --- a/services/ui/ws/test_utils.cc +++ b/services/ui/ws/test_utils.cc
@@ -48,6 +48,7 @@ display::ViewportMetrics metrics; metrics.bounds_in_pixels.set_size(pixel_size); metrics.device_scale_factor = display.device_scale_factor(); + metrics.ui_scale_factor = 1; return metrics; } @@ -110,10 +111,15 @@ return display_id; } -void TestScreenManager::ModifyDisplay(const display::Display& display) { +void TestScreenManager::ModifyDisplay( + const display::Display& display, + const base::Optional<display::ViewportMetrics>& metrics) { DCHECK(display_ids_.count(display.id()) == 1); screen_->display_list().UpdateDisplay(display); - delegate_->OnDisplayModified(display, MakeViewportMetrics(display)); + if (metrics) + delegate_->OnDisplayModified(display, *metrics); + else + delegate_->OnDisplayModified(display, MakeViewportMetrics(display)); } void TestScreenManager::RemoveDisplay(int64_t display_id) { @@ -400,12 +406,16 @@ tracker_.OnWindowSharedPropertyChanged(window, name, new_data); } -void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, - uint32_t window, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) { - tracker_.OnWindowInputEvent(window, *event.get(), matches_pointer_watcher); +void TestWindowTreeClient::OnWindowInputEvent( + uint32_t event_id, + uint32_t window, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) { + tracker_.OnWindowInputEvent(window, *event.get(), display_id, + event_location_in_screen_pixel_layout, + matches_pointer_watcher); } void TestWindowTreeClient::OnPointerEventObserved(
diff --git a/services/ui/ws/test_utils.h b/services/ui/ws/test_utils.h index b2ba6e2..4d9f0b5d 100644 --- a/services/ui/ws/test_utils.h +++ b/services/ui/ws/test_utils.h
@@ -14,6 +14,7 @@ #include "base/atomicops.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" +#include "base/optional.h" #include "base/single_thread_task_runner.h" #include "services/service_manager/public/cpp/bind_source_info.h" #include "services/ui/display/screen_manager.h" @@ -71,7 +72,9 @@ int64_t AddDisplay(const display::Display& display); // Calls OnDisplayModified() on delegate. - void ModifyDisplay(const display::Display& display); + void ModifyDisplay(const display::Display& display, + const base::Optional<display::ViewportMetrics>& metrics = + base::Optional<display::ViewportMetrics>()); // Calls OnDisplayRemoved() on delegate. void RemoveDisplay(int64_t id); @@ -243,10 +246,10 @@ void DispatchInputEventToWindow(ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, Accelerator* accelerator) { - wms_->DispatchInputEventToWindow(target, client_id, display_id, event, + wms_->DispatchInputEventToWindow(target, client_id, event_location, event, accelerator); } @@ -255,7 +258,7 @@ return wms_->GetEventTargetClientId(window, in_nonclient_area); } - void ProcessEvent(const ui::Event& event, int64_t display_id = 0) { + void ProcessEvent(ui::Event* event, int64_t display_id = 0) { wms_->ProcessEvent(event, display_id); } @@ -522,11 +525,13 @@ uint32_t window, const std::string& name, const base::Optional<std::vector<uint8_t>>& new_data) override; - void OnWindowInputEvent(uint32_t event_id, - uint32_t window, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) override; + void OnWindowInputEvent( + uint32_t event_id, + uint32_t window, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) override; void OnPointerEventObserved(std::unique_ptr<ui::Event> event, uint32_t window_id, int64_t display_id) override;
diff --git a/services/ui/ws/transient_windows_unittest.cc b/services/ui/ws/transient_windows_unittest.cc index f2d00c8..ff87f425 100644 --- a/services/ui/ws/transient_windows_unittest.cc +++ b/services/ui/ws/transient_windows_unittest.cc
@@ -79,7 +79,7 @@ TestServerWindowDelegate server_window_delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&server_window_delegate, WindowId(), nullptr)); + CreateTestWindow(&server_window_delegate, WindowId(1, 0), nullptr)); std::unique_ptr<ServerWindow> w1( CreateTestWindow(&server_window_delegate, WindowId(1, 1), parent.get())); std::unique_ptr<ServerWindow> w3( @@ -107,189 +107,189 @@ TestServerWindowDelegate server_window_delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&server_window_delegate, WindowId(), nullptr)); - std::unique_ptr<ServerWindow> w1( - CreateTestWindow(&server_window_delegate, WindowId(0, 1), parent.get())); - - ServerWindow* w11 = - CreateTestWindow(&server_window_delegate, WindowId(0, 11), parent.get()); + CreateTestWindow(&server_window_delegate, WindowId(0, 1), nullptr)); std::unique_ptr<ServerWindow> w2( CreateTestWindow(&server_window_delegate, WindowId(0, 2), parent.get())); ServerWindow* w21 = CreateTestWindow(&server_window_delegate, WindowId(0, 21), parent.get()); - ServerWindow* w211 = - CreateTestWindow(&server_window_delegate, WindowId(0, 211), parent.get()); - ServerWindow* w212 = - CreateTestWindow(&server_window_delegate, WindowId(0, 212), parent.get()); - ServerWindow* w213 = - CreateTestWindow(&server_window_delegate, WindowId(0, 213), parent.get()); - ServerWindow* w22 = - CreateTestWindow(&server_window_delegate, WindowId(0, 22), parent.get()); + std::unique_ptr<ServerWindow> w3( + CreateTestWindow(&server_window_delegate, WindowId(0, 3), parent.get())); + + ServerWindow* w31 = + CreateTestWindow(&server_window_delegate, WindowId(0, 31), parent.get()); + ServerWindow* w311 = + CreateTestWindow(&server_window_delegate, WindowId(0, 311), parent.get()); + ServerWindow* w312 = + CreateTestWindow(&server_window_delegate, WindowId(0, 312), parent.get()); + ServerWindow* w313 = + CreateTestWindow(&server_window_delegate, WindowId(0, 313), parent.get()); + ServerWindow* w32 = + CreateTestWindow(&server_window_delegate, WindowId(0, 32), parent.get()); ASSERT_EQ(8u, parent->children().size()); - // w11 is now owned by w1. - w1->AddTransientWindow(w11); // w21 is now owned by w2. w2->AddTransientWindow(w21); - // w22 is now owned by w2. - w2->AddTransientWindow(w22); - // w211 is now owned by w21. - w21->AddTransientWindow(w211); - // w212 is now owned by w21. - w21->AddTransientWindow(w212); - // w213 is now owned by w21. - w21->AddTransientWindow(w213); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + // w31 is now owned by w3. + w3->AddTransientWindow(w31); + // w32 is now owned by w3. + w3->AddTransientWindow(w32); + // w311 is now owned by w31. + w31->AddTransientWindow(w311); + // w312 is now owned by w31. + w31->AddTransientWindow(w312); + // w313 is now owned by w31. + w31->AddTransientWindow(w313); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - // Stack w1 at the top (end), this should force w11 to be last (on top of w1). - parent->StackChildAtTop(w1.get()); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get())); + // Stack w2 at the top (end), this should force w11 to be last (on top of w2). + parent->StackChildAtTop(w2.get()); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 31 311 312 313 32 2 21", ChildWindowIDsAsString(parent.get())); // This tests that the order in children_ array rather than in // transient_children_ array is used when reinserting transient children. - // If transient_children_ array was used '22' would be following '21'. - parent->StackChildAtTop(w2.get()); - EXPECT_EQ(w22, parent->children().back()); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + // If transient_children_ array was used '32' would be following '31'. + parent->StackChildAtTop(w3.get()); + EXPECT_EQ(w32, parent->children().back()); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - w11->Reorder(w2.get(), mojom::OrderDirection::ABOVE); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get())); + w21->Reorder(w3.get(), mojom::OrderDirection::ABOVE); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 31 311 312 313 32 2 21", ChildWindowIDsAsString(parent.get())); - w21->Reorder(w1.get(), mojom::OrderDirection::ABOVE); - EXPECT_EQ(w22, parent->children().back()); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w2.get(), mojom::OrderDirection::ABOVE); + EXPECT_EQ(w32, parent->children().back()); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - w21->Reorder(w22, mojom::OrderDirection::ABOVE); - EXPECT_EQ(w213, parent->children().back()); - EXPECT_EQ("1 11 2 22 21 211 212 213", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w32, mojom::OrderDirection::ABOVE); + EXPECT_EQ(w313, parent->children().back()); + EXPECT_EQ("2 21 3 32 31 311 312 313", ChildWindowIDsAsString(parent.get())); - w11->Reorder(w21, mojom::OrderDirection::ABOVE); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 211 212 213 1 11", ChildWindowIDsAsString(parent.get())); + w21->Reorder(w31, mojom::OrderDirection::ABOVE); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 311 312 313 2 21", ChildWindowIDsAsString(parent.get())); - w213->Reorder(w21, mojom::OrderDirection::ABOVE); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w313->Reorder(w31, mojom::OrderDirection::ABOVE); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); // No change when stacking a transient parent above its transient child. - w21->Reorder(w211, mojom::OrderDirection::ABOVE); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w311, mojom::OrderDirection::ABOVE); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); // This tests that the order in children_ array rather than in // transient_children_ array is used when reinserting transient children. - // If transient_children_ array was used '22' would be following '21'. - w2->Reorder(w1.get(), mojom::OrderDirection::ABOVE); - EXPECT_EQ(w212, parent->children().back()); - EXPECT_EQ("1 11 2 22 21 213 211 212", ChildWindowIDsAsString(parent.get())); + // If transient_children_ array was used '32' would be following '31'. + w3->Reorder(w2.get(), mojom::OrderDirection::ABOVE); + EXPECT_EQ(w312, parent->children().back()); + EXPECT_EQ("2 21 3 32 31 313 311 312", ChildWindowIDsAsString(parent.get())); - w11->Reorder(w213, mojom::OrderDirection::ABOVE); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w21->Reorder(w313, mojom::OrderDirection::ABOVE); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); } TEST_F(TransientWindowsTest, TransienChildGroupBelow) { TestServerWindowDelegate server_window_delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&server_window_delegate, WindowId(), nullptr)); - std::unique_ptr<ServerWindow> w1( - CreateTestWindow(&server_window_delegate, WindowId(0, 1), parent.get())); - - ServerWindow* w11 = - CreateTestWindow(&server_window_delegate, WindowId(0, 11), parent.get()); + CreateTestWindow(&server_window_delegate, WindowId(0, 1), nullptr)); std::unique_ptr<ServerWindow> w2( CreateTestWindow(&server_window_delegate, WindowId(0, 2), parent.get())); ServerWindow* w21 = CreateTestWindow(&server_window_delegate, WindowId(0, 21), parent.get()); - ServerWindow* w211 = - CreateTestWindow(&server_window_delegate, WindowId(0, 211), parent.get()); - ServerWindow* w212 = - CreateTestWindow(&server_window_delegate, WindowId(0, 212), parent.get()); - ServerWindow* w213 = - CreateTestWindow(&server_window_delegate, WindowId(0, 213), parent.get()); - ServerWindow* w22 = - CreateTestWindow(&server_window_delegate, WindowId(0, 22), parent.get()); + std::unique_ptr<ServerWindow> w3( + CreateTestWindow(&server_window_delegate, WindowId(0, 3), parent.get())); + + ServerWindow* w31 = + CreateTestWindow(&server_window_delegate, WindowId(0, 31), parent.get()); + ServerWindow* w311 = + CreateTestWindow(&server_window_delegate, WindowId(0, 311), parent.get()); + ServerWindow* w312 = + CreateTestWindow(&server_window_delegate, WindowId(0, 312), parent.get()); + ServerWindow* w313 = + CreateTestWindow(&server_window_delegate, WindowId(0, 313), parent.get()); + ServerWindow* w32 = + CreateTestWindow(&server_window_delegate, WindowId(0, 32), parent.get()); ASSERT_EQ(8u, parent->children().size()); - // w11 is now owned by w1. - w1->AddTransientWindow(w11); // w21 is now owned by w2. w2->AddTransientWindow(w21); - // w22 is now owned by w2. - w2->AddTransientWindow(w22); - // w211 is now owned by w21. - w21->AddTransientWindow(w211); - // w212 is now owned by w21. - w21->AddTransientWindow(w212); - // w213 is now owned by w21. - w21->AddTransientWindow(w213); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + // w31 is now owned by w3. + w3->AddTransientWindow(w31); + // w32 is now owned by w3. + w3->AddTransientWindow(w32); + // w311 is now owned by w31. + w31->AddTransientWindow(w311); + // w312 is now owned by w31. + w31->AddTransientWindow(w312); + // w313 is now owned by w31. + w31->AddTransientWindow(w313); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - // Stack w2 at the bottom, this should force w11 to be last (on top of w1). + // Stack w3 at the bottom, this should force w21 to be last (on top of w2). // This also tests that the order in children_ array rather than in // transient_children_ array is used when reinserting transient children. - // If transient_children_ array was used '22' would be following '21'. + // If transient_children_ array was used '32' would be following '31'. + parent->StackChildAtBottom(w3.get()); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 31 311 312 313 32 2 21", ChildWindowIDsAsString(parent.get())); + parent->StackChildAtBottom(w2.get()); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ(w32, parent->children().back()); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - parent->StackChildAtBottom(w1.get()); - EXPECT_EQ(w22, parent->children().back()); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w2.get(), mojom::OrderDirection::BELOW); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 31 311 312 313 32 2 21", ChildWindowIDsAsString(parent.get())); - w21->Reorder(w1.get(), mojom::OrderDirection::BELOW); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get())); + w21->Reorder(w3.get(), mojom::OrderDirection::BELOW); + EXPECT_EQ(w32, parent->children().back()); + EXPECT_EQ("2 21 3 31 311 312 313 32", ChildWindowIDsAsString(parent.get())); - w11->Reorder(w2.get(), mojom::OrderDirection::BELOW); - EXPECT_EQ(w22, parent->children().back()); - EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get())); + w32->Reorder(w31, mojom::OrderDirection::BELOW); + EXPECT_EQ(w313, parent->children().back()); + EXPECT_EQ("2 21 3 32 31 311 312 313", ChildWindowIDsAsString(parent.get())); - w22->Reorder(w21, mojom::OrderDirection::BELOW); - EXPECT_EQ(w213, parent->children().back()); - EXPECT_EQ("1 11 2 22 21 211 212 213", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w21, mojom::OrderDirection::BELOW); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 311 312 313 2 21", ChildWindowIDsAsString(parent.get())); - w21->Reorder(w11, mojom::OrderDirection::BELOW); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 211 212 213 1 11", ChildWindowIDsAsString(parent.get())); - - w213->Reorder(w211, mojom::OrderDirection::BELOW); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w313->Reorder(w311, mojom::OrderDirection::BELOW); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); // No change when stacking a transient parent below its transient child. - w21->Reorder(w211, mojom::OrderDirection::BELOW); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w31->Reorder(w311, mojom::OrderDirection::BELOW); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); - w1->Reorder(w2.get(), mojom::OrderDirection::BELOW); - EXPECT_EQ(w212, parent->children().back()); - EXPECT_EQ("1 11 2 22 21 213 211 212", ChildWindowIDsAsString(parent.get())); + w2->Reorder(w3.get(), mojom::OrderDirection::BELOW); + EXPECT_EQ(w312, parent->children().back()); + EXPECT_EQ("2 21 3 32 31 313 311 312", ChildWindowIDsAsString(parent.get())); - w213->Reorder(w11, mojom::OrderDirection::BELOW); - EXPECT_EQ(w11, parent->children().back()); - EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get())); + w313->Reorder(w21, mojom::OrderDirection::BELOW); + EXPECT_EQ(w21, parent->children().back()); + EXPECT_EQ("3 32 31 313 311 312 2 21", ChildWindowIDsAsString(parent.get())); } // Tests that transient windows are stacked properly when created. TEST_F(TransientWindowsTest, StackUponCreation) { TestServerWindowDelegate delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&delegate, WindowId(), nullptr)); + CreateTestWindow(&delegate, WindowId(0, 1), nullptr)); std::unique_ptr<ServerWindow> window0( - CreateTestWindow(&delegate, WindowId(0, 1), parent.get())); - std::unique_ptr<ServerWindow> window1( CreateTestWindow(&delegate, WindowId(0, 2), parent.get())); + std::unique_ptr<ServerWindow> window1( + CreateTestWindow(&delegate, WindowId(0, 3), parent.get())); ServerWindow* window2 = - CreateTestWindow(&delegate, WindowId(0, 3), parent.get()); + CreateTestWindow(&delegate, WindowId(0, 4), parent.get()); window0->AddTransientWindow(window2); - EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 4 3", ChildWindowIDsAsString(parent.get())); } // Tests that windows are restacked properly after a call to @@ -297,33 +297,34 @@ TEST_F(TransientWindowsTest, RestackUponAddOrRemoveTransientWindow) { TestServerWindowDelegate delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&delegate, WindowId(), nullptr)); + CreateTestWindow(&delegate, WindowId(0, 1), nullptr)); std::unique_ptr<ServerWindow> windows[4]; for (int i = 0; i < 4; i++) - windows[i].reset(CreateTestWindow(&delegate, WindowId(0, i), parent.get())); + windows[i].reset( + CreateTestWindow(&delegate, WindowId(0, i + 2), parent.get())); - EXPECT_EQ("0 1 2 3", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 3 4 5", ChildWindowIDsAsString(parent.get())); windows[0]->AddTransientWindow(windows[2].get()); - EXPECT_EQ("0 2 1 3", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 4 3 5", ChildWindowIDsAsString(parent.get())); windows[0]->AddTransientWindow(windows[3].get()); - EXPECT_EQ("0 2 3 1", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 4 5 3", ChildWindowIDsAsString(parent.get())); windows[0]->RemoveTransientWindow(windows[2].get()); - EXPECT_EQ("0 3 2 1", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 5 4 3", ChildWindowIDsAsString(parent.get())); windows[0]->RemoveTransientWindow(windows[3].get()); - EXPECT_EQ("0 3 2 1", ChildWindowIDsAsString(parent.get())); + EXPECT_EQ("2 5 4 3", ChildWindowIDsAsString(parent.get())); } // Verifies TransientWindowObserver is notified appropriately. TEST_F(TransientWindowsTest, TransientWindowObserverNotified) { TestServerWindowDelegate delegate; std::unique_ptr<ServerWindow> parent( - CreateTestWindow(&delegate, WindowId(), nullptr)); + CreateTestWindow(&delegate, WindowId(0, 1), nullptr)); std::unique_ptr<ServerWindow> w1( - CreateTestWindow(&delegate, WindowId(0, 1), parent.get())); + CreateTestWindow(&delegate, WindowId(0, 2), parent.get())); TestTransientWindowObserver test_observer; parent->AddObserver(&test_observer);
diff --git a/services/ui/ws/window_manager_access_policy.cc b/services/ui/ws/window_manager_access_policy.cc index 400d1f8..bfaa9e69 100644 --- a/services/ui/ws/window_manager_access_policy.cc +++ b/services/ui/ws/window_manager_access_policy.cc
@@ -219,7 +219,7 @@ // use the client id when creating windows the WM could end up with two // windows with the same id. Because of this the wm must use the same // client id for all windows it creates. - return WindowIdFromTransportId(id.id).client_id == client_id_; + return base::checked_cast<ClientSpecificId>(id.client_id()) == client_id_; } bool WindowManagerAccessPolicy::WasCreatedByThisClient(
diff --git a/services/ui/ws/window_manager_display_root.cc b/services/ui/ws/window_manager_display_root.cc index f29b961..45b5595 100644 --- a/services/ui/ws/window_manager_display_root.cc +++ b/services/ui/ws/window_manager_display_root.cc
@@ -25,9 +25,9 @@ properties[mojom::WindowManager::kName_Property] = std::vector<uint8_t>(name.begin(), name.end()); - root_.reset(window_server()->CreateServerWindow( - window_server()->display_manager()->GetAndAdvanceNextRootId(), - properties)); + WindowId id = window_server()->display_manager()->GetAndAdvanceNextRootId(); + root_.reset(window_server()->CreateServerWindow(id, id.ToClientWindowId(), + properties)); root_->set_event_targeting_policy( mojom::EventTargetingPolicy::DESCENDANTS_ONLY); // Our root is always a child of the Display's root. Do this
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc index 9dec2e2..f3d3167 100644 --- a/services/ui/ws/window_manager_state.cc +++ b/services/ui/ws/window_manager_state.cc
@@ -16,6 +16,7 @@ #include "services/ui/ws/display.h" #include "services/ui/ws/display_creation_config.h" #include "services/ui/ws/display_manager.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/event_targeter.h" #include "services/ui/ws/platform_display.h" #include "services/ui/ws/server_window.h" @@ -28,6 +29,7 @@ #include "ui/events/event.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/point3_f.h" +#include "ui/gfx/geometry/point_conversions.h" namespace ui { namespace ws { @@ -45,7 +47,7 @@ #endif } -bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) { +bool CanEventsBeCoalesced(const ui::Event& one, const ui::Event& two) { if (one.type() != two.type() || one.flags() != two.flags()) return false; @@ -76,6 +78,24 @@ return embed_root; } +const gfx::Rect& GetDisplayBoundsInPixels(Display* display) { + return display->GetViewportMetrics().bounds_in_pixels; +} + +gfx::Point PixelsToDips(Display* display, const gfx::Point& location) { + return gfx::ConvertPointToDIP( + display->GetDisplay().device_scale_factor() / + display->GetViewportMetrics().ui_scale_factor, + location); +} + +gfx::Point DipsToPixels(Display* display, const gfx::Point& location) { + return gfx::ConvertPointToPixel( + display->GetDisplay().device_scale_factor() / + display->GetViewportMetrics().ui_scale_factor, + location); +} + } // namespace WindowManagerState::InFlightEventDispatchDetails::InFlightEventDispatchDetails( @@ -134,8 +154,14 @@ !event.is_char(); } -WindowManagerState::QueuedEvent::QueuedEvent() {} -WindowManagerState::QueuedEvent::~QueuedEvent() {} +struct WindowManagerState::QueuedEvent { + QueuedEvent() = default; + ~QueuedEvent() = default; + + std::unique_ptr<Event> event; + std::unique_ptr<ProcessedEventTarget> processed_target; + EventLocation event_location; +}; WindowManagerState::WindowManagerState(WindowTree* window_tree) : window_tree_(window_tree), @@ -311,13 +337,12 @@ // Fake a mouse event to update cursor and ensure mouse location in client // is up to date. - const PointerEvent move_event( - ET_POINTER_MOVED, mouse_location_on_display, mouse_location_on_display, - EF_NONE, EF_NONE, - PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, - MouseEvent::kMousePointerId), - base::TimeTicks::Now()); - ProcessEvent(move_event, display_id); + PointerEvent move_event(ET_POINTER_MOVED, mouse_location_on_display, + mouse_location_on_display, EF_NONE, EF_NONE, + PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, + MouseEvent::kMousePointerId), + base::TimeTicks::Now()); + ProcessEvent(&move_event, display_id); } void WindowManagerState::Deactivate() { @@ -329,24 +354,30 @@ event_queue.swap(event_queue_); } -void WindowManagerState::ProcessEvent(const ui::Event& event, - int64_t display_id) { +void WindowManagerState::ProcessEvent(ui::Event* event, int64_t display_id) { + EventLocation event_location(display_id); + if (event->IsLocatedEvent()) { + event_location.raw_location = event->AsLocatedEvent()->location_f(); + AdjustEventLocation(display_id, event->AsLocatedEvent()); + event_location.location = event->AsLocatedEvent()->root_location_f(); + } + // If this is still waiting for an ack from a previously sent event, then // queue up the event to be dispatched once the ack is received. if (event_dispatcher_.IsProcessingEvent() || in_flight_event_dispatch_details_) { if (!event_queue_.empty() && !event_queue_.back()->processed_target && - EventsCanBeCoalesced(*event_queue_.back()->event, event)) { + CanEventsBeCoalesced(*event_queue_.back()->event, *event)) { event_queue_.back()->event = CoalesceEvents( - std::move(event_queue_.back()->event), ui::Event::Clone(event)); - event_queue_.back()->display_id = display_id; + std::move(event_queue_.back()->event), ui::Event::Clone(*event)); + event_queue_.back()->event_location = event_location; return; } - QueueEvent(event, nullptr, display_id); + QueueEvent(*event, nullptr, event_location); return; } - ProcessEventImpl(event, display_id); + ProcessEventImpl(*event, event_location); } void WindowManagerState::OnAcceleratorAck( @@ -364,7 +395,7 @@ if (!properties.empty()) details->event->AsKeyEvent()->SetProperties(properties); event_dispatcher_.ProcessEvent( - *details->event, details->display_id, + *details->event, EventLocation(details->display_id), EventDispatcher::AcceleratorMatchPhase::POST_ONLY); } else { // We're not going to process the event any further, notify event observers. @@ -458,23 +489,23 @@ } void WindowManagerState::ProcessEventImpl(const ui::Event& event, - int64_t display_id) { + const EventLocation& event_location) { DCHECK(!in_flight_event_dispatch_details_ && !event_dispatcher_.IsProcessingEvent()); // Debug accelerators are always checked and don't interfere with processing. - ProcessDebugAccelerator(event, display_id); - event_dispatcher_.ProcessEvent(event, display_id, + ProcessDebugAccelerator(event, event_location.display_id); + event_dispatcher_.ProcessEvent(event, event_location, EventDispatcher::AcceleratorMatchPhase::ANY); } void WindowManagerState::QueueEvent( const ui::Event& event, std::unique_ptr<ProcessedEventTarget> processed_event_target, - int64_t display_id) { + const EventLocation& event_location) { std::unique_ptr<QueuedEvent> queued_event(new QueuedEvent); queued_event->event = ui::Event::Clone(event); queued_event->processed_target = std::move(processed_event_target); - queued_event->display_id = display_id; + queued_event->event_location = event_location; event_queue_.push(std::move(queued_event)); } @@ -483,7 +514,7 @@ void WindowManagerState::DispatchInputEventToWindowImpl( ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, base::WeakPtr<Accelerator> accelerator) { DCHECK(!in_flight_event_dispatch_details_); @@ -498,16 +529,16 @@ WindowTree* tree = window_server()->GetTreeWithId(client_id); DCHECK(tree); - ScheduleInputEventTimeout(tree, target, display_id, event, + ScheduleInputEventTimeout(tree, target, event_location.display_id, event, EventDispatchPhase::TARGET); in_flight_event_dispatch_details_->post_target_accelerator = accelerator; // Ignore |tree| because it will receive the event via normal dispatch. window_server()->SendToPointerWatchers(event, user_id(), target, tree, - display_id); + event_location.display_id); tree->DispatchInputEvent( - target, event, display_id, + target, event, event_location, base::BindOnce( &WindowManagerState::OnEventAck, in_flight_event_dispatch_details_->weak_factory.GetWeakPtr(), tree)); @@ -600,6 +631,62 @@ return true; } +Display* WindowManagerState::FindDisplayContainingPixelLocation( + const gfx::Point& screen_pixels) { + for (auto& display_root_ptr : window_manager_display_roots_) { + if (GetDisplayBoundsInPixels(display_root_ptr->display()) + .Contains(screen_pixels)) { + return display_root_ptr->display(); + } + } + return nullptr; +} + +void WindowManagerState::AdjustEventLocation(int64_t display_id, + LocatedEvent* event) { + if (window_manager_display_roots_.empty()) + return; + + Display* display = display_manager()->GetDisplayById(display_id); + if (!display) + return; + + const gfx::Rect& display_bounds_in_pixels = GetDisplayBoundsInPixels(display); + // Typical case is the display contains the location. + if (gfx::Rect(display_bounds_in_pixels.size()).Contains(event->location())) { + return; + } + + // The location is outside the bounds of the specified display. This generally + // happens when there is a grab and the mouse is moved to another display. + // When this happens the location of the event is in terms of the pixel + // display layout. Find the display using the pixel display layout. + const gfx::Point screen_pixels = + event->location() + display_bounds_in_pixels.origin().OffsetFromOrigin(); + Display* containing_display = + FindDisplayContainingPixelLocation(screen_pixels); + if (!containing_display) { + DVLOG(1) << "Invalid event location " << event->location().ToString() + << " / display id " << display_id; + return; + } + + // Adjust the location of the event to be in terms of the DIP display layout + // (but in pixels). See EventLocation for details on this. + const gfx::Point location_in_containing_display = + screen_pixels - + GetDisplayBoundsInPixels(containing_display).origin().OffsetFromOrigin(); + const gfx::Point screen_dip_location = + containing_display->GetDisplay().bounds().origin() + + PixelsToDips(containing_display, location_in_containing_display) + .OffsetFromOrigin(); + const gfx::Point pixel_relative_location = DipsToPixels( + display, screen_dip_location - + display->GetDisplay().bounds().origin().OffsetFromOrigin()); + event->set_location(pixel_relative_location); + event->set_root_location(pixel_relative_location); +} + //////////////////////////////////////////////////////////////////////////////// // EventDispatcherDelegate: @@ -674,9 +761,9 @@ } void WindowManagerState::OnMouseCursorLocationChanged( - const gfx::Point& point_in_display, + const gfx::PointF& point_in_display, int64_t display_id) { - gfx::Point point_in_screen(point_in_display); + gfx::Point point_in_screen = gfx::ToFlooredPoint(point_in_display); if (ConvertPointToScreen(display_id, &point_in_screen)) { window_server() ->display_manager() @@ -705,25 +792,26 @@ cursor_state_.SetCursorTouchVisible(visible); } -void WindowManagerState::DispatchInputEventToWindow(ServerWindow* target, - ClientSpecificId client_id, - int64_t display_id, - const ui::Event& event, - Accelerator* accelerator) { +void WindowManagerState::DispatchInputEventToWindow( + ServerWindow* target, + ClientSpecificId client_id, + const EventLocation& event_location, + const ui::Event& event, + Accelerator* accelerator) { DCHECK(IsActive()); // TODO(sky): this needs to see if another wms has capture and if so forward // to it. if (in_flight_event_dispatch_details_) { std::unique_ptr<ProcessedEventTarget> processed_event_target( new ProcessedEventTarget(target, client_id, accelerator)); - QueueEvent(event, std::move(processed_event_target), display_id); + QueueEvent(event, std::move(processed_event_target), event_location); return; } base::WeakPtr<Accelerator> weak_accelerator; if (accelerator) weak_accelerator = accelerator->GetWeakPtr(); - DispatchInputEventToWindowImpl(target, client_id, display_id, event, + DispatchInputEventToWindowImpl(target, client_id, event_location, event, weak_accelerator); } @@ -741,14 +829,15 @@ std::unique_ptr<QueuedEvent> queued_event = std::move(event_queue_.front()); event_queue_.pop(); if (!queued_event->processed_target) { - ProcessEventImpl(*queued_event->event, queued_event->display_id); + ProcessEventImpl(*queued_event->event, queued_event->event_location); return; } if (queued_event->processed_target->IsValid()) { DispatchInputEventToWindowImpl( queued_event->processed_target->window(), - queued_event->processed_target->client_id(), queued_event->display_id, - *queued_event->event, queued_event->processed_target->accelerator()); + queued_event->processed_target->client_id(), + queued_event->event_location, *queued_event->event, + queued_event->processed_target->accelerator()); return; } } @@ -782,46 +871,13 @@ return tree->id(); } -ServerWindow* WindowManagerState::GetRootWindowContaining( - gfx::Point* location_in_display, - int64_t* display_id) { - if (window_manager_display_roots_.empty()) +ServerWindow* WindowManagerState::GetRootWindowForDisplay(int64_t display_id) { + Display* display = display_manager()->GetDisplayById(display_id); + if (!display) return nullptr; - gfx::Point location_in_screen(*location_in_display); - if (!ConvertPointToScreen(*display_id, &location_in_screen)) - return nullptr; - - WindowManagerDisplayRoot* target_display_root = nullptr; - for (auto& display_root_ptr : window_manager_display_roots_) { - if (display_root_ptr->display()->GetDisplay().bounds().Contains( - location_in_screen)) { - target_display_root = display_root_ptr.get(); - break; - } - } - - // TODO(kylechar): Better handle locations outside the window. Overlapping X11 - // windows, dragging and touch sensors need to be handled properly. - if (!target_display_root) { - DVLOG(1) << "Invalid event location " << location_in_display->ToString() - << " / display id " << *display_id; - target_display_root = window_manager_display_roots_.begin()->get(); - } - - // Update |location_in_display| and |display_id| if the target display is - // different from the originated display, e.g. drag-and-drop. - if (*display_id != target_display_root->display()->GetId()) { - gfx::Point origin = - target_display_root->display()->GetDisplay().bounds().origin(); - *location_in_display = location_in_screen - origin.OffsetFromOrigin(); - *location_in_display = gfx::ConvertPointToPixel( - target_display_root->display()->GetDisplay().device_scale_factor(), - *location_in_display); - *display_id = target_display_root->display()->GetId(); - } - - return target_display_root->GetClientVisibleRoot(); + return display->GetWindowManagerDisplayRootForUser(user_id()) + ->GetClientVisibleRoot(); } ServerWindow* WindowManagerState::GetRootWindowForEventDispatch( @@ -872,11 +928,8 @@ ServerWindow* WindowManagerState::GetWindowFromFrameSinkId( const viz::FrameSinkId& frame_sink_id) { - // TODO(riajiang): Use the correct id to look up window once FrameSinkId - // refactoring is done. DCHECK(frame_sink_id.is_valid()); - return window_tree()->GetWindow( - WindowIdFromTransportId(frame_sink_id.client_id())); + return window_tree()->GetWindowByClientId(frame_sink_id); } void WindowManagerState::OnWindowEmbeddedAppDisconnected(ServerWindow* window) {
diff --git a/services/ui/ws/window_manager_state.h b/services/ui/ws/window_manager_state.h index 2b1e762..6380e49 100644 --- a/services/ui/ws/window_manager_state.h +++ b/services/ui/ws/window_manager_state.h
@@ -113,8 +113,9 @@ int64_t display_id); void Deactivate(); - // Processes an event from PlatformDisplay. - void ProcessEvent(const Event& event, int64_t display_id); + // Processes an event from PlatformDisplay. This doesn't take ownership of + // |event|, but it may modify it. + void ProcessEvent(ui::Event* event, int64_t display_id); private: class ProcessedEventTarget; @@ -157,14 +158,7 @@ // |processed_target| are valid. // The second case happens if EventDispatcher generates more than one event // at a time. - struct QueuedEvent { - QueuedEvent(); - ~QueuedEvent(); - - std::unique_ptr<Event> event; - std::unique_ptr<ProcessedEventTarget> processed_target; - int64_t display_id; - }; + struct QueuedEvent; // Tracks state associated with an event being dispatched to a client. struct InFlightEventDispatchDetails { @@ -220,17 +214,18 @@ // Implemenation of processing an event with a match phase of all. This // handles debug accelerators and forwards to EventDispatcher. - void ProcessEventImpl(const Event& event, int64_t display_id); + void ProcessEventImpl(const Event& event, + const EventLocation& event_location); // Schedules an event to be processed later. void QueueEvent(const Event& event, std::unique_ptr<ProcessedEventTarget> processed_event_target, - int64_t display_id); + const EventLocation& event_location); // Dispatches the event to the appropriate client and starts the ack timer. void DispatchInputEventToWindowImpl(ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const Event& event, base::WeakPtr<Accelerator> accelerator); @@ -257,6 +252,10 @@ // false otherwise. bool ConvertPointToScreen(int64_t display_id, gfx::Point* point); + Display* FindDisplayContainingPixelLocation(const gfx::Point& screen_pixels); + + void AdjustEventLocation(int64_t display_id, LocatedEvent* event); + // EventDispatcherDelegate: void OnAccelerator(uint32_t accelerator_id, int64_t display_id, @@ -269,7 +268,7 @@ void UpdateNativeCursorFromDispatcher() override; void OnCaptureChanged(ServerWindow* new_capture, ServerWindow* old_capture) override; - void OnMouseCursorLocationChanged(const gfx::Point& point, + void OnMouseCursorLocationChanged(const gfx::PointF& point, int64_t display_id) override; void OnEventChangesCursorVisibility(const ui::Event& event, bool visible) override; @@ -277,7 +276,7 @@ bool visible) override; void DispatchInputEventToWindow(ServerWindow* target, ClientSpecificId client_id, - int64_t display_id, + const EventLocation& event_location, const Event& event, Accelerator* accelerator) override; // Processes the next valid event in |event_queue_|. If the event has already @@ -286,8 +285,7 @@ void ProcessNextAvailableEvent() override; ClientSpecificId GetEventTargetClientId(const ServerWindow* window, bool in_nonclient_area) override; - ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, - int64_t* display_id) override; + ServerWindow* GetRootWindowForDisplay(int64_t display_id) override; ServerWindow* GetRootWindowForEventDispatch(ServerWindow* window) override; void OnEventTargetNotFound(const Event& event, int64_t display_id) override; ServerWindow* GetFallbackTargetForEventBlockedByModal(
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc index bcbc324..701d3ad 100644 --- a/services/ui/ws/window_manager_state_unittest.cc +++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -19,6 +19,7 @@ #include "services/ui/ws/cursor_location_manager.h" #include "services/ui/ws/display.h" #include "services/ui/ws/display_manager.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/platform_display.h" #include "services/ui/ws/test_change_tracker.h" #include "services/ui/ws/test_server_window_delegate.h" @@ -50,7 +51,7 @@ ServerWindow** server_window); void DispatchInputEventToWindow(ServerWindow* target, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, Accelerator* accelerator); void OnEventAckTimeout(ClientSpecificId client_id); @@ -145,12 +146,12 @@ void WindowManagerStateTest::DispatchInputEventToWindow( ServerWindow* target, - int64_t display_id, + const EventLocation& event_location, const ui::Event& event, Accelerator* accelerator) { WindowManagerStateTestApi test_api(window_manager_state_); ClientSpecificId client_id = test_api.GetEventTargetClientId(target, false); - test_api.DispatchInputEventToWindow(target, client_id, display_id, event, + test_api.DispatchInputEventToWindow(target, client_id, event_location, event, accelerator); } @@ -170,7 +171,7 @@ window_tree_ = window_event_targeting_helper_.last_binding()->tree(); window_tree_client_ = window_event_targeting_helper_.last_window_tree_client(); - DCHECK(window_tree_->HasRoot(window_)); + ASSERT_TRUE(window_tree_->HasRoot(window_)); WindowTreeTestApi(tree()).set_window_manager_internal(&window_manager_); wm_client()->tracker()->changes()->clear(); @@ -200,6 +201,16 @@ DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestAsync); }; +EventLocation EventLocationFromEvent(const Event& event, + const Display& display) { + EventLocation event_location(display.GetId()); + if (event.IsLocatedEvent()) { + event_location.raw_location = event_location.location = + event.AsLocatedEvent()->root_location_f(); + } + return event_location; +} + // Tests that when an event is dispatched with no accelerator, that post target // accelerator is not triggered. TEST_F(WindowManagerStateTest, NullAccelerator) { @@ -208,9 +219,10 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); + ASSERT_TRUE(display); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); - DispatchInputEventToWindow(target, display->GetId(), key, nullptr); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + nullptr); WindowTree* target_tree = window_tree(); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); @@ -230,8 +242,9 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -247,7 +260,7 @@ // is done. TEST_F(WindowManagerStateTest, PreTargetConsumed) { // Set up two trees with focus on a child in the second. - const ClientWindowId child_window_id(11); + const ClientWindowId child_window_id(window_tree()->id(), 11); window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); ServerWindow* child_window = window_tree()->GetWindowByClientId(child_window_id); @@ -273,7 +286,7 @@ // Send and ensure only the pre accelerator is called. ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); - window_manager_state()->ProcessEvent(key, 0); + window_manager_state()->ProcessEvent(&key, 0); EXPECT_TRUE(window_manager()->on_accelerator_called()); EXPECT_EQ(accelerator_id, window_manager()->on_accelerator_id()); EXPECT_TRUE(tracker->changes()->empty()); @@ -288,7 +301,7 @@ window_manager()->ClearAcceleratorCalled(); // Repeat, but respond with UNHANDLED. - window_manager_state()->ProcessEvent(key, 0); + window_manager_state()->ProcessEvent(&key, 0); EXPECT_TRUE(window_manager()->on_accelerator_called()); EXPECT_EQ(accelerator_id, window_manager()->on_accelerator_id()); EXPECT_TRUE(tracker->changes()->empty()); @@ -303,7 +316,7 @@ TEST_F(WindowManagerStateTest, AckWithProperties) { // Set up two trees with focus on a child in the second. - const ClientWindowId child_window_id(11); + const ClientWindowId child_window_id(window_tree()->id(), 11); window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); ServerWindow* child_window = window_tree()->GetWindowByClientId(child_window_id); @@ -329,7 +342,7 @@ // Send and ensure only the pre accelerator is called. ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); - window_manager_state()->ProcessEvent(key, 0); + window_manager_state()->ProcessEvent(&key, 0); EXPECT_TRUE(window_manager()->on_accelerator_called()); EXPECT_EQ(accelerator_id, window_manager()->on_accelerator_id()); EXPECT_TRUE(tracker->changes()->empty()); @@ -358,7 +371,7 @@ // Send the event again, and ack with no properties. Ensure client gets no // properties. window_manager()->ClearAcceleratorCalled(); - window_manager_state()->ProcessEvent(key, 0); + window_manager_state()->ProcessEvent(&key, 0); EXPECT_TRUE(window_manager()->on_accelerator_called()); EXPECT_EQ(accelerator_id, window_manager()->on_accelerator_id()); EXPECT_TRUE(tracker->changes()->empty()); @@ -382,8 +395,9 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -403,8 +417,9 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -425,8 +440,9 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -441,8 +457,8 @@ uint32_t accelerator_id = 2; std::unique_ptr<Accelerator> accelerator2( new Accelerator(accelerator_id, *matcher)); - DispatchInputEventToWindow(target, display->GetId(), key2, - accelerator2.get()); + DispatchInputEventToWindow(target, EventLocationFromEvent(key2, *display), + key2, accelerator2.get()); EXPECT_TRUE(tracker->changes()->empty()); WindowTreeTestApi(window_tree()).AckOldestEvent(); @@ -461,8 +477,9 @@ ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -487,8 +504,9 @@ ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); std::unique_ptr<Accelerator> accelerator = CreateAccelerator(); const Display* display = target_tree->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), key, accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, EventLocationFromEvent(key, *display), key, + accelerator.get()); TestChangeTracker* tracker = embed_connection->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); // clients that created this window is receiving the event, so client_id part @@ -509,11 +527,12 @@ TestChangeTracker* tracker = window_tree_client()->tracker(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); + ASSERT_TRUE(display); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON); - DispatchInputEventToWindow(target, display->GetId(), press, nullptr); + DispatchInputEventToWindow(target, EventLocationFromEvent(press, *display), + press, nullptr); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( "InputEvent window=" + kWindowManagerClientIdString + ",1 event_action=1", @@ -526,7 +545,8 @@ ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(5, 5), gfx::Point(5, 5), base::TimeTicks(), EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON); - DispatchInputEventToWindow(target, display->GetId(), release, nullptr); + DispatchInputEventToWindow(target, EventLocationFromEvent(release, *display), + release, nullptr); EXPECT_EQ(0u, tracker->changes()->size()); // Destroying a window tree with an event in queue shouldn't crash. @@ -538,9 +558,9 @@ ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); std::unique_ptr<Accelerator> accelerator = CreateAccelerator(); const Display* display = window_tree()->GetDisplay(window()); - DCHECK(display); - DispatchInputEventToWindow(window(), display->GetId(), key, - accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(window(), EventLocationFromEvent(key, *display), + key, accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -559,10 +579,8 @@ embedder_tree->NewWindow(embed_window_id, ServerWindow::Properties()); ServerWindow* embedder_window = embedder_tree->GetWindowByClientId(embed_window_id); - WindowId embedder_root_id = embedder_root->id(); - ASSERT_TRUE(embedder_tree->AddWindow( - ClientWindowId(embedder_root_id.client_id, embedder_root_id.window_id), - embed_window_id)); + ASSERT_TRUE(embedder_tree->AddWindow(embedder_root->id().ToClientWindowId(), + embed_window_id)); TestWindowTreeClient* embedder_client = wm_client(); @@ -577,10 +595,11 @@ // Send an event to the embed window. It should go to the embedded client. const Display* display = embed_tree->GetDisplay(embedder_window); - DCHECK(display); + ASSERT_TRUE(display); ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), base::TimeTicks(), 0, 0); - DispatchInputEventToWindow(embedder_window, display->GetId(), mouse, + DispatchInputEventToWindow(embedder_window, + EventLocationFromEvent(mouse, *display), mouse, nullptr); ASSERT_EQ(1u, embed_client_proxy->tracker()->changes()->size()); EXPECT_EQ(CHANGE_TYPE_INPUT_EVENT, @@ -603,10 +622,11 @@ // Send an event to the embed window. But this time, it should reach the // embedder. const Display* display = embed_tree->GetDisplay(embedder_window); - DCHECK(display); + ASSERT_TRUE(display); ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), base::TimeTicks(), 0, 0); - DispatchInputEventToWindow(embedder_window, display->GetId(), mouse, + DispatchInputEventToWindow(embedder_window, + EventLocationFromEvent(mouse, *display), mouse, nullptr); ASSERT_EQ(0u, embed_client_proxy->tracker()->changes()->size()); ASSERT_EQ(1u, embedder_client->tracker()->changes()->size()); @@ -619,9 +639,8 @@ // Embed another tree in the embedded tree. const ClientWindowId nested_embed_window_id(embed_tree->id(), 23); embed_tree->NewWindow(nested_embed_window_id, ServerWindow::Properties()); - WindowId embed_root_window_id = (*embed_tree->roots().begin())->id(); - const ClientWindowId embed_root_id(embed_root_window_id.client_id, - embed_root_window_id.window_id); + const ClientWindowId embed_root_id = + (*embed_tree->roots().begin())->id().ToClientWindowId(); ASSERT_TRUE(embed_tree->AddWindow(embed_root_id, nested_embed_window_id)); WindowTree* nested_embed_tree = nullptr; @@ -636,10 +655,11 @@ // the outermost embedder. ServerWindow* nested_embed_window = embed_tree->GetWindowByClientId(nested_embed_window_id); - DCHECK(nested_embed_window->parent()); + ASSERT_TRUE(nested_embed_window->parent()); mouse = ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), base::TimeTicks(), 0, 0); - DispatchInputEventToWindow(nested_embed_window, display->GetId(), mouse, + DispatchInputEventToWindow(nested_embed_window, + EventLocationFromEvent(mouse, *display), mouse, nullptr); ASSERT_EQ(0u, nested_embed_client_proxy->tracker()->changes()->size()); ASSERT_EQ(0u, embed_client_proxy->tracker()->changes()->size()); @@ -661,9 +681,10 @@ std::unique_ptr<Accelerator> accelerator = CreateAccelerator(); ServerWindow* target = window(); const Display* display = window_tree()->GetDisplay(target); - DCHECK(display); - DispatchInputEventToWindow(target, display->GetId(), accelerator_key, - accelerator.get()); + ASSERT_TRUE(display); + DispatchInputEventToWindow(target, + EventLocationFromEvent(accelerator_key, *display), + accelerator_key, accelerator.get()); TestChangeTracker* tracker = window_tree_client()->tracker(); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( @@ -677,8 +698,9 @@ // shouldn't be called. ui::KeyEvent non_accelerator_key(ui::ET_KEY_PRESSED, ui::VKEY_T, ui::EF_CONTROL_DOWN); - DispatchInputEventToWindow(target, display->GetId(), non_accelerator_key, - nullptr); + DispatchInputEventToWindow( + target, EventLocationFromEvent(non_accelerator_key, *display), + non_accelerator_key, nullptr); ASSERT_EQ(1u, tracker->changes()->size()); EXPECT_EQ( "InputEvent window=" + kWindowManagerClientIdString + ",1 event_action=7", @@ -713,7 +735,7 @@ TEST_F(WindowManagerStateTest, CursorResetOverNoTarget) { ASSERT_EQ(1u, window_server()->display_manager()->displays().size()); - const ClientWindowId child_window_id(11); + const ClientWindowId child_window_id(window_tree()->id(), 11); window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); ServerWindow* child_window = window_tree()->GetWindowByClientId(child_window_id); @@ -728,12 +750,53 @@ ui::ET_POINTER_MOVED, gfx::Point(25, 25), gfx::Point(25, 25), 0, 0, ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, 0), base::TimeTicks()); - window_manager_state()->ProcessEvent(move, 0); + window_manager_state()->ProcessEvent(&move, 0); // The event isn't over a valid target, which should trigger resetting the // cursor to POINTER. EXPECT_EQ(ui::CursorType::kPointer, cursor_type()); } +TEST(WindowManagerStateEventTest, AdjustEventLocation) { + WindowServerTestHelper ws_test_helper; + WindowServer* window_server = ws_test_helper.window_server(); + TestScreenManager screen_manager; + screen_manager.Init(window_server->display_manager()); + const UserId kUserId1 = "2"; + AddWindowManager(window_server, kUserId1); + window_server->user_id_tracker()->AddUserId(kUserId1); + window_server->user_id_tracker()->SetActiveUserId(kUserId1); + const int64_t first_display_id = screen_manager.AddDisplay(); + const int64_t second_display_id = screen_manager.AddDisplay(); + Display* second_display = + window_server->display_manager()->GetDisplayById(second_display_id); + ASSERT_TRUE(second_display); + display::Display second_display_display = second_display->GetDisplay(); + second_display_display.set_bounds(gfx::Rect(100, 0, 100, 100)); + display::ViewportMetrics second_metrics; + // The DIP display layout is horizontal and the pixel layout vertical. + second_metrics.device_scale_factor = 1.0f; + second_metrics.bounds_in_pixels = gfx::Rect(0, 200, 100, 100); + second_metrics.ui_scale_factor = 1.0f; + screen_manager.ModifyDisplay(second_display_display, second_metrics); + const gfx::Point move_location(5, 210); + ui::PointerEvent move( + ui::ET_POINTER_MOVED, move_location, move_location, 0, 0, + ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, 0), + base::TimeTicks()); + WindowManagerDisplayRoot* window_manager_display_root = + second_display->GetWindowManagerDisplayRootForUser(kUserId1); + TestChangeTracker* tracker = + ws_test_helper.window_server_delegate()->last_client()->tracker(); + tracker->changes()->clear(); + window_manager_display_root->window_manager_state()->ProcessEvent( + &move, first_display_id); + ASSERT_EQ(1u, tracker->changes()->size()); + // |location2| is the location supplied in terms of the pixel display layout. + EXPECT_EQ(gfx::PointF(move_location), (*tracker->changes())[0].location2); + // |location1| is the location in DIP display layout. + EXPECT_EQ(gfx::Point(105, 10), (*tracker->changes())[0].location1); +} + TEST_F(WindowManagerStateTest, CursorLocationManagerUpdatedOnMouseMove) { WindowManagerStateTestApi test_api(window_manager_state()); ASSERT_EQ(1u, test_api.window_manager_display_roots().size()); @@ -750,7 +813,7 @@ ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, 0), base::TimeTicks()); // Tests add display with kInvalidDisplayId. - window_manager_state()->ProcessEvent(move, display::kInvalidDisplayId); + window_manager_state()->ProcessEvent(&move, display::kInvalidDisplayId); CursorLocationManager* cursor_location_manager = window_server()->display_manager()->GetCursorLocationManager( window_manager_state()->user_id()); @@ -763,7 +826,7 @@ TEST_F(WindowManagerStateTestAsync, CursorResetOverNoTargetAsync) { ASSERT_EQ(1u, window_server()->display_manager()->displays().size()); - const ClientWindowId child_window_id(11); + const ClientWindowId child_window_id(window_tree()->id(), 11); window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); ServerWindow* child_window = window_tree()->GetWindowByClientId(child_window_id); @@ -787,7 +850,7 @@ base::TimeTicks()); WindowManagerStateTestApi test_api(window_manager_state()); EXPECT_TRUE(test_api.is_event_queue_empty()); - window_manager_state()->ProcessEvent(move, 0); + window_manager_state()->ProcessEvent(&move, 0); EXPECT_FALSE(test_api.tree_awaiting_input_ack()); EXPECT_TRUE(window_manager_state()->event_dispatcher()->IsProcessingEvent()); EXPECT_TRUE(test_api.is_event_queue_empty());
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc index fccabe9..a822975 100644 --- a/services/ui/ws/window_server.cc +++ b/services/ui/ws/window_server.cc
@@ -113,8 +113,9 @@ ServerWindow* WindowServer::CreateServerWindow( const WindowId& id, + const viz::FrameSinkId& frame_sink_id, const std::map<std::string, std::vector<uint8_t>>& properties) { - ServerWindow* window = new ServerWindow(this, id, properties); + ServerWindow* window = new ServerWindow(this, id, frame_sink_id, properties); window->AddObserver(this); return window; }
diff --git a/services/ui/ws/window_server.h b/services/ui/ws/window_server.h index 7553519c..a3f7dae3 100644 --- a/services/ui/ws/window_server.h +++ b/services/ui/ws/window_server.h
@@ -14,6 +14,7 @@ #include "base/macros.h" #include "base/optional.h" +#include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/host/host_frame_sink_manager.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom.h" @@ -82,6 +83,7 @@ // must be destroyed before WindowServer. ServerWindow* CreateServerWindow( const WindowId& id, + const viz::FrameSinkId& frame_sink_id, const std::map<std::string, std::vector<uint8_t>>& properties); // Returns the id for the next WindowTree.
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc index ac2aef5..f66bf42 100644 --- a/services/ui/ws/window_tree.cc +++ b/services/ui/ws/window_tree.cc
@@ -20,6 +20,7 @@ #include "services/ui/ws/display.h" #include "services/ui/ws/display_manager.h" #include "services/ui/ws/event_dispatcher.h" +#include "services/ui/ws/event_location.h" #include "services/ui/ws/event_matcher.h" #include "services/ui/ws/focus_controller.h" #include "services/ui/ws/frame_generator.h" @@ -75,11 +76,11 @@ public: TargetedEvent(ServerWindow* target, const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, WindowTree::DispatchEventCallback callback) : target_(target), event_(ui::Event::Clone(event)), - display_id_(display_id), + event_location_(event_location), callback_(std::move(callback)) { target_->AddObserver(this); } @@ -90,7 +91,7 @@ ServerWindow* target() { return target_; } std::unique_ptr<ui::Event> TakeEvent() { return std::move(event_); } - int64_t display_id() const { return display_id_; } + const EventLocation& event_location() const { return event_location_; } WindowTree::DispatchEventCallback TakeCallback() { return std::move(callback_); } @@ -105,7 +106,7 @@ ServerWindow* target_; std::unique_ptr<ui::Event> event_; - const int64_t display_id_; + const EventLocation event_location_; WindowTree::DispatchEventCallback callback_; DISALLOW_COPY_AND_ASSIGN(TargetedEvent); @@ -277,10 +278,8 @@ // Notify our client if |tree| was embedded in any of our windows. for (const auto* tree_root : tree->roots_) { const bool owns_tree_root = tree_root->id().client_id == id_; - if (owns_tree_root) { - client()->OnEmbeddedAppDisconnected( - ClientWindowIdForWindow(tree_root).id); - } + if (owns_tree_root) + client()->OnEmbeddedAppDisconnected(TransportIdForWindow(tree_root)); } } @@ -312,7 +311,7 @@ const ClientWindowId& client_window_id) { DCHECK(window_manager_state_); // Only called for window manager. DVLOG(3) << "SetDisplayRoot client=" << id_ - << " global window_id=" << client_window_id.id; + << " global window_id=" << client_window_id.ToString(); if (display_manager()->GetDisplayById(display_to_create.id())) { DVLOG(1) << "SetDisplayRoot called with existing display " << display_to_create.id(); @@ -330,7 +329,7 @@ window && window->parent() && base::ContainsKey(roots_, window); if (!window || (window->parent() && !is_moving_to_new_display)) { DVLOG(1) << "SetDisplayRoot called with invalid window id " - << client_window_id.id; + << client_window_id.ToString(); return nullptr; } @@ -468,15 +467,16 @@ const ClientWindowId& client_window_id, const std::map<std::string, std::vector<uint8_t>>& properties) { DVLOG(3) << "new window client=" << id_ - << " window_id=" << client_window_id.id; + << " window_id=" << client_window_id.ToString(); if (!IsValidIdForNewWindow(client_window_id)) { DVLOG(1) << "NewWindow failed (id is not valid for client)"; return false; } + DCHECK(!GetWindowByClientId(client_window_id)); const WindowId window_id = GenerateNewWindowId(); DCHECK(!GetWindow(window_id)); - ServerWindow* window = - window_server_->CreateServerWindow(window_id, properties); + ServerWindow* window = window_server_->CreateServerWindow( + window_id, client_window_id, properties); created_window_map_[window_id] = window; client_id_to_window_id_map_[client_window_id] = window_id; window_id_to_client_id_map_[window_id] = client_window_id; @@ -488,9 +488,9 @@ ServerWindow* parent = GetWindowByClientId(parent_id); ServerWindow* child = GetWindowByClientId(child_id); DVLOG(3) << "add window client=" << id_ - << " client parent window_id=" << parent_id.id + << " client parent window_id=" << parent_id.ToString() << " global window_id=" << DebugWindowId(parent) - << " client child window_id= " << child_id.id + << " client child window_id= " << child_id.ToString() << " global window_id=" << DebugWindowId(child); if (!parent) { DVLOG(1) << "AddWindow failed (no parent)"; @@ -532,7 +532,7 @@ bool WindowTree::DeleteWindow(const ClientWindowId& window_id) { ServerWindow* window = GetWindowByClientId(window_id); DVLOG(3) << "removing window from parent client=" << id_ - << " client window_id= " << window_id.id + << " client window_id= " << window_id.ToString() << " global window_id=" << DebugWindowId(window); if (!window) return false; @@ -572,7 +572,7 @@ ->window_manager_state() ->window_tree(); wm_tree->window_manager_internal_->WmSetModalType( - wm_tree->ClientWindowIdForWindow(window).id, modal_type); + wm_tree->TransportIdForWindow(window), modal_type); return true; } @@ -622,7 +622,7 @@ bool visible) { ServerWindow* window = GetWindowByClientId(window_id); DVLOG(3) << "SetWindowVisibility client=" << id_ - << " client window_id= " << window_id.id + << " client window_id= " << window_id.ToString() << " global window_id=" << DebugWindowId(window); if (!window) { DVLOG(1) << "SetWindowVisibility failed (no window)"; @@ -655,7 +655,7 @@ ServerWindow* window = GetWindowByClientId(window_id); ServerWindow* currently_focused = window_server_->GetFocusedWindow(); DVLOG(3) << "SetFocusedWindow client=" << id_ - << " client window_id=" << window_id.id + << " client window_id=" << window_id.ToString() << " window=" << DebugWindowId(window); if (!currently_focused && !window) { DVLOG(1) << "SetFocus failed (no focused window to clear)"; @@ -693,18 +693,19 @@ window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(window_tree_client), flags, base::WrapUnique(new DefaultAccessPolicy)); - client()->OnFrameSinkIdAllocated(window_id.id, window->frame_sink_id()); + client()->OnFrameSinkIdAllocated(ClientWindowIdToTransportId(window_id), + window->frame_sink_id()); return true; } void WindowTree::DispatchInputEvent(ServerWindow* target, const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, DispatchEventCallback callback) { if (event_ack_id_) { // This is currently waiting for an event ack. Add it to the queue. - event_queue_.push(base::MakeUnique<TargetedEvent>(target, event, display_id, - std::move(callback))); + event_queue_.push(base::MakeUnique<TargetedEvent>( + target, event, event_location, std::move(callback))); // TODO(sad): If the |event_queue_| grows too large, then this should notify // Display, so that it can stop sending events. return; @@ -714,12 +715,12 @@ // and dispatch the latest event from the queue instead that still has a live // target. if (!event_queue_.empty()) { - event_queue_.push(base::MakeUnique<TargetedEvent>(target, event, display_id, - std::move(callback))); + event_queue_.push(base::MakeUnique<TargetedEvent>( + target, event, event_location, std::move(callback))); return; } - DispatchInputEventImpl(target, event, display_id, std::move(callback)); + DispatchInputEventImpl(target, event, event_location, std::move(callback)); } bool WindowTree::IsWaitingForNewTopLevelWindow(uint32_t wm_change_id) { @@ -924,15 +925,15 @@ if (!knows_old && !knows_new) return; - const ClientWindowId new_parent_client_window_id = - knows_new ? ClientWindowIdForWindow(new_parent) : ClientWindowId(); - const ClientWindowId old_parent_client_window_id = - knows_old ? ClientWindowIdForWindow(old_parent) : ClientWindowId(); - const ClientWindowId client_window_id = - window ? ClientWindowIdForWindow(window) : ClientWindowId(); + const Id new_parent_client_window_id = + knows_new ? TransportIdForWindow(new_parent) : kInvalidTransportId; + const Id old_parent_client_window_id = + knows_old ? TransportIdForWindow(old_parent) : kInvalidTransportId; + const Id client_window_id = + window ? TransportIdForWindow(window) : kInvalidTransportId; client()->OnWindowHierarchyChanged( - client_window_id.id, old_parent_client_window_id.id, - new_parent_client_window_id.id, WindowsToWindowDatas(to_send)); + client_window_id, old_parent_client_window_id, + new_parent_client_window_id, WindowsToWindowDatas(to_send)); window_server_->OnTreeMessagedClient(id_); } @@ -1106,6 +1107,15 @@ display_id); } +Id WindowTree::ClientWindowIdToTransportId( + const ClientWindowId& client_window_id) const { + if (client_window_id.client_id() == id_) + return client_window_id.sink_id(); + return (base::checked_cast<ClientSpecificId>(client_window_id.client_id()) + << 16) | + base::checked_cast<ClientSpecificId>(client_window_id.sink_id()); +} + bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const { if (window_manager_state_) return false; // We are the window manager, don't route to ourself. @@ -1142,15 +1152,15 @@ return; } - client()->OnCaptureChanged(new_capture_window_client_id.id, - old_capture_window_client_id.id); + client()->OnCaptureChanged( + ClientWindowIdToTransportId(new_capture_window_client_id), + ClientWindowIdToTransportId(old_capture_window_client_id)); } -ClientWindowId WindowTree::ClientWindowIdForWindow( - const ServerWindow* window) const { +Id WindowTree::TransportIdForWindow(const ServerWindow* window) const { auto iter = window_id_to_client_id_map_.find(window->id()); DCHECK(iter != window_id_to_client_id_map_.end()); - return ClientWindowId(ClientWindowIdToTransportId(iter->second)); + return ClientWindowIdToTransportId(iter->second); } bool WindowTree::IsValidIdForNewWindow(const ClientWindowId& id) const { @@ -1286,11 +1296,11 @@ return; } - const ClientWindowId client_window_id(ClientWindowIdForWindow(window)); + const Id client_window_id = TransportIdForWindow(window); if (reason == RemoveRootReason::EMBED) { - client()->OnUnembed(client_window_id.id); - client()->OnWindowDeleted(client_window_id.id); + client()->OnUnembed(client_window_id); + client()->OnWindowDeleted(client_window_id); window_server_->OnTreeMessagedClient(id_); } @@ -1310,7 +1320,7 @@ if (owning_tree) { DCHECK(owning_tree && owning_tree != this); owning_tree->client()->OnEmbeddedAppDisconnected( - owning_tree->ClientWindowIdForWindow(window).id); + owning_tree->TransportIdForWindow(window)); } window->OnEmbeddedAppDisconnected(); @@ -1338,12 +1348,12 @@ transient_parent = nullptr; mojom::WindowDataPtr window_data(mojom::WindowData::New()); window_data->parent_id = - parent ? ClientWindowIdForWindow(parent).id : ClientWindowId().id; + parent ? TransportIdForWindow(parent) : kInvalidTransportId; window_data->window_id = - window ? ClientWindowIdForWindow(window).id : ClientWindowId().id; + window ? TransportIdForWindow(window) : kInvalidTransportId; window_data->transient_parent_id = - transient_parent ? ClientWindowIdForWindow(transient_parent).id - : ClientWindowId().id; + transient_parent ? TransportIdForWindow(transient_parent) + : kInvalidTransportId; window_data->bounds = window->bounds(); window_data->properties = mojo::MapToUnorderedMap(window->properties()); window_data->visible = window->visible(); @@ -1377,8 +1387,8 @@ for (auto* root : roots_) { if (window->Contains(root) && (new_drawn_value != root->IsDrawn())) { - client()->OnWindowParentDrawnStateChanged( - ClientWindowIdForWindow(root).id, new_drawn_value); + client()->OnWindowParentDrawnStateChanged(TransportIdForWindow(root), + new_drawn_value); } } } @@ -1443,7 +1453,7 @@ void WindowTree::DispatchInputEventImpl(ServerWindow* target, const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, DispatchEventCallback callback) { // DispatchInputEventImpl() is called so often that log level 4 is used. DVLOG(4) << "DispatchInputEventImpl client=" << id_; @@ -1456,8 +1466,9 @@ DCHECK(event_source_wms_); bool matched_pointer_watcher = EventMatchesPointerWatcher(event); client()->OnWindowInputEvent( - event_ack_id_, ClientWindowIdForWindow(target).id, display_id, - ui::Event::Clone(event), matched_pointer_watcher); + event_ack_id_, TransportIdForWindow(target), event_location.display_id, + event_location.raw_location, ui::Event::Clone(event), + matched_pointer_watcher); } bool WindowTree::EventMatchesPointerWatcher(const ui::Event& event) const { @@ -1474,21 +1485,15 @@ ClientWindowId WindowTree::MakeClientWindowId(Id transport_window_id) const { if (!HiWord(transport_window_id)) - transport_window_id = ((id_ << 16) | transport_window_id); - return ClientWindowId(transport_window_id); + return ClientWindowId(id_, transport_window_id); + return ClientWindowId(HiWord(transport_window_id), + LoWord(transport_window_id)); } ClientWindowId WindowTree::MakeClientWindowId(const WindowId& id) const { return MakeClientWindowId((id.client_id << 16) | id.window_id); } -Id WindowTree::ClientWindowIdToTransportId( - const ClientWindowId& client_window_id) const { - if (HiWord(client_window_id.id) == id_) - return LoWord(client_window_id.id); - return client_window_id.id; -} - void WindowTree::NewWindow( uint32_t change_id, Id transport_window_id, @@ -1690,8 +1695,7 @@ GetWindowManagerDisplayRoot(window); WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); wm_tree->window_manager_internal_->WmSetBounds( - wm_change_id, wm_tree->ClientWindowIdForWindow(window).id, - std::move(bounds)); + wm_change_id, wm_tree->TransportIdForWindow(window), std::move(bounds)); return; } @@ -1767,7 +1771,7 @@ GetWindowManagerDisplayRoot(window); WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); wm_tree->window_manager_internal_->WmSetProperty( - wm_change_id, wm_tree->ClientWindowIdForWindow(window).id, name, value); + wm_change_id, wm_tree->TransportIdForWindow(window), name, value); return; } const bool success = window && access_policy_->CanSetWindowProperties(window); @@ -1859,18 +1863,19 @@ ServerWindow* target = nullptr; std::unique_ptr<ui::Event> event; DispatchEventCallback callback; - int64_t display_id = display::kInvalidDisplayId; + EventLocation event_location; do { std::unique_ptr<TargetedEvent> targeted_event = std::move(event_queue_.front()); event_queue_.pop(); target = targeted_event->target(); event = targeted_event->TakeEvent(); - display_id = targeted_event->display_id(); + event_location = targeted_event->event_location(); callback = targeted_event->TakeCallback(); } while (!event_queue_.empty() && !GetDisplay(target)); if (target) - DispatchInputEventImpl(target, *event, display_id, std::move(callback)); + DispatchInputEventImpl(target, *event, event_location, + std::move(callback)); } } @@ -2034,7 +2039,7 @@ WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); wm_tree->window_manager_internal_->WmDeactivateWindow( - wm_tree->ClientWindowIdForWindow(window).id); + wm_tree->TransportIdForWindow(window)); } void WindowTree::StackAbove(uint32_t change_id, Id above_id, Id below_id) { @@ -2090,9 +2095,8 @@ const uint32_t wm_change_id = window_server_->GenerateWindowManagerChangeId(this, change_id); wm_tree->window_manager_internal_->WmStackAbove( - wm_change_id, - wm_tree->ClientWindowIdForWindow(above).id, - wm_tree->ClientWindowIdForWindow(below).id); + wm_change_id, wm_tree->TransportIdForWindow(above), + wm_tree->TransportIdForWindow(below)); } void WindowTree::StackAtTop(uint32_t change_id, Id window_id) { @@ -2138,7 +2142,7 @@ const uint32_t wm_change_id = window_server_->GenerateWindowManagerChangeId(this, change_id); wm_tree->window_manager_internal_->WmStackAtTop( - wm_change_id, wm_tree->ClientWindowIdForWindow(window).id); + wm_change_id, wm_tree->TransportIdForWindow(window)); } void WindowTree::GetWindowManagerClient( @@ -2283,8 +2287,8 @@ window_server_->GenerateWindowManagerChangeId(this, change_id); window_server_->StartMoveLoop(wm_change_id, window, this, window->bounds()); wms->window_tree()->window_manager_internal_->WmPerformMoveLoop( - wm_change_id, wms->window_tree()->ClientWindowIdForWindow(window).id, - source, cursor); + wm_change_id, wms->window_tree()->TransportIdForWindow(window), source, + cursor); } void WindowTree::CancelWindowMove(Id window_id) { @@ -2470,7 +2474,7 @@ GetWindowByClientId(MakeClientWindowId(transport_window_id)); WindowTree* tree = window_server_->GetTreeWithRoot(window); if (tree && tree != this) { - tree->client()->RequestClose(tree->ClientWindowIdForWindow(window).id); + tree->client()->RequestClose(tree->TransportIdForWindow(window)); } // TODO(sky): think about what else case means. }
diff --git a/services/ui/ws/window_tree.h b/services/ui/ws/window_tree.h index 8711929..1c859046 100644 --- a/services/ui/ws/window_tree.h +++ b/services/ui/ws/window_tree.h
@@ -53,6 +53,8 @@ class WindowManagerState; class WindowServer; +struct EventLocation; + namespace test { class WindowTreeTestApi; } @@ -199,7 +201,7 @@ using DispatchEventCallback = base::OnceCallback<void(mojom::EventResult)>; void DispatchInputEvent(ServerWindow* target, const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, DispatchEventCallback callback); bool IsWaitingForNewTopLevelWindow(uint32_t wm_change_id); @@ -299,6 +301,11 @@ ServerWindow* target_window, int64_t display_id); + // Before the ClientWindowId gets sent back to the client, making sure we + // reset the high 16 bits back to 0 if it's being sent back to the client + // that created the window. + Id ClientWindowIdToTransportId(const ClientWindowId& client_window_id) const; + private: friend class test::WindowTreeTestApi; @@ -328,7 +335,7 @@ bool ShouldRouteToWindowManager(const ServerWindow* window) const; - ClientWindowId ClientWindowIdForWindow(const ServerWindow* window) const; + Id TransportIdForWindow(const ServerWindow* window) const; // Returns true if |id| is a valid WindowId for a new window. bool IsValidIdForNewWindow(const ClientWindowId& id) const; @@ -395,7 +402,7 @@ void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event, - int64_t display_id, + const EventLocation& event_location, DispatchEventCallback callback); // Returns true if the client has a pointer watcher and this event matches. @@ -428,11 +435,6 @@ ClientWindowId MakeClientWindowId(Id transport_window_id) const; ClientWindowId MakeClientWindowId(const WindowId& id) const; - // Before the ClientWindowId gets sent back to the client, making sure we - // reset the high 16 bits back to 0 if it's being sent back to the client - // that created the window. - Id ClientWindowIdToTransportId(const ClientWindowId& client_window_id) const; - // WindowTree: void NewWindow(uint32_t change_id, Id transport_window_id,
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc index 72d50d6..b3de122 100644 --- a/services/ui/ws/window_tree_client_unittest.cc +++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -360,11 +360,13 @@ void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override { tracker()->OnWindowParentDrawnStateChanged(window, drawn); } - void OnWindowInputEvent(uint32_t event_id, - Id window_id, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) override { + void OnWindowInputEvent( + uint32_t event_id, + Id window_id, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) override { // Ack input events to clear the state on the server. These can be received // during test startup. X11Window::DispatchEvent sends a synthetic move // event to notify of entry. @@ -2294,8 +2296,11 @@ // Make sure the parent connection gets the surface ID. wt_client1()->WaitForChangeCount(1); // Verify that the submitted frame is for |window_2_101|. - EXPECT_EQ(window_1_100_in_ws2, - changes1()->back().surface_id.frame_sink_id().client_id()); + viz::FrameSinkId frame_sink_id = + changes1()->back().surface_id.frame_sink_id(); + // FrameSinkId is based on window's ClientWindowId. + EXPECT_NE(0u, frame_sink_id.client_id()); + EXPECT_EQ(LoWord(window_1_100), frame_sink_id.sink_id()); changes1()->clear(); // The first window created in the second client gets a server id of @@ -2331,8 +2336,11 @@ // Make sure the parent connection gets the surface ID. wt_client2()->WaitForChangeCount(1); // Verify that the submitted frame is for |window_2_101|. - EXPECT_EQ(window_2_101_in_ws2, - changes2()->back().surface_id.frame_sink_id().client_id()); + viz::FrameSinkId frame_sink_id2 = + changes2()->back().surface_id.frame_sink_id(); + // FrameSinkId is based on window's ClientWindowId. + EXPECT_NE(0u, frame_sink_id2.client_id()); + EXPECT_EQ(LoWord(window_2_101), frame_sink_id2.sink_id()); } // Verifies when an unknown window with a known child is added to a hierarchy
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc index 609e2f8..727f882 100644 --- a/services/ui/ws/window_tree_unittest.cc +++ b/services/ui/ws/window_tree_unittest.cc
@@ -49,12 +49,8 @@ const std::string kNextWindowClientIdString = std::to_string(kWindowManagerClientId + 1); -std::string WindowIdToString(const WindowId& id) { - return base::StringPrintf("%d,%d", id.client_id, id.window_id); -} - std::string ClientWindowIdToString(const ClientWindowId& id) { - return WindowIdToString(WindowIdFromTransportId(id.id)); + return base::StringPrintf("%d,%d", id.client_id(), id.sink_id()); } ClientWindowId BuildClientWindowId(WindowTree* tree, @@ -678,11 +674,13 @@ ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()) << SingleChangeToDescription(*wm_client()->tracker()->changes()); // The window manager should be told about the FrameSinkId of the embedded - // window. + // window. Clients that created this window is receiving the event, so + // client_id part would be reset to 0 before sending back to clients. EXPECT_EQ( base::StringPrintf( "OnFrameSinkIdAllocated window=%s %s", - WindowIdToString(WindowIdFromTransportId(embed_window_id.id)).c_str(), + ClientWindowIdToString(ClientWindowId(0, embed_window_id.sink_id())) + .c_str(), embed_window->frame_sink_id().ToString().c_str()), SingleChangeToDescription(*wm_client()->tracker()->changes())); } @@ -766,10 +764,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // The binding should be paused until the wm acks the change. uint32_t wm_change_id = 0u; @@ -786,31 +786,35 @@ // Ack the change, which should resume the binding. child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + wm_change_id, + wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id2); ASSERT_TRUE(embed_window); ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()) << SingleChangeToDescription(*wm_client()->tracker()->changes()); // The window manager should be told about the FrameSinkId of the embedded - // window. - EXPECT_EQ(base::StringPrintf( - "OnFrameSinkIdAllocated window=%s %s", - WindowIdToString(WindowIdFromTransportId(embed_window_id2.id)) - .c_str(), - embed_window->frame_sink_id().ToString().c_str()), - SingleChangeToDescription(*wm_client()->tracker()->changes())); + // window. Clients that created this window is receiving the event, so + // client_id part would be reset to 0 before sending back to clients. + EXPECT_EQ( + base::StringPrintf( + "OnFrameSinkIdAllocated window=%s %s", + ClientWindowIdToString(ClientWindowId(0, embed_window_id2.sink_id())) + .c_str(), + embed_window->frame_sink_id().ToString().c_str()), + SingleChangeToDescription(*wm_client()->tracker()->changes())); EXPECT_FALSE(child_binding->is_paused()); // TODO(fsamuel): Currently the FrameSinkId maps directly to the server's // window ID. This is likely bad from a security perspective and should be // fixed. - EXPECT_EQ( - base::StringPrintf("TopLevelCreated id=17 window_id=%s drawn=true", - WindowIdToString(WindowIdFromTransportId( - embed_window_id2_in_child.id)) - .c_str()), - SingleChangeToDescription( - *child_binding->client()->tracker()->changes())); + EXPECT_EQ(base::StringPrintf( + "TopLevelCreated id=17 window_id=%s drawn=true", + ClientWindowIdToString( + ClientWindowId(0, embed_window_id2_in_child.sink_id())) + .c_str()), + SingleChangeToDescription( + *child_binding->client()->tracker()->changes())); child_binding->client()->tracker()->changes()->clear(); // Change the visibility of the window from the owner and make sure the @@ -820,8 +824,8 @@ ClientWindowIdForWindow(wm_tree(), embed_window), false)); EXPECT_FALSE(embed_window->visible()); EXPECT_EQ("VisibilityChanged window=" + - WindowIdToString( - WindowIdFromTransportId(embed_window_id2_in_child.id)) + + ClientWindowIdToString( + ClientWindowId(0, embed_window_id2_in_child.sink_id())) + " visible=false", SingleChangeToDescription( *child_binding->client()->tracker()->changes())); @@ -845,21 +849,21 @@ // Set capture. mojom::WindowTree* mojom_window_tree = static_cast<mojom::WindowTree*>(tree); uint32_t change_id = 42; - WindowId window_id = window->id(); mojom_window_tree->SetCapture( - change_id, ClientWindowId(window_id.client_id, window_id.window_id).id); + change_id, + tree->ClientWindowIdToTransportId(window->id().ToClientWindowId())); Display* display = tree->GetDisplay(window); EXPECT_EQ(window, GetCaptureWindow(display)); // Only the capture window should be able to release capture - WindowId root_window_id = root_window->id(); mojom_window_tree->ReleaseCapture( ++change_id, - ClientWindowId(root_window_id.client_id, root_window_id.window_id).id); + tree->ClientWindowIdToTransportId(root_window->id().ToClientWindowId())); EXPECT_EQ(window, GetCaptureWindow(display)); mojom_window_tree->ReleaseCapture( - ++change_id, ClientWindowId(window_id.client_id, window_id.window_id).id); + ++change_id, + tree->ClientWindowIdToTransportId(window->id().ToClientWindowId())); EXPECT_EQ(nullptr, GetCaptureWindow(display)); } @@ -904,7 +908,7 @@ // Create |w2| as a child of |root_window| and modal to |w1| and leave it // hidden. - ClientWindowId w2_id = BuildClientWindowId(tree, 2); + ClientWindowId w2_id = BuildClientWindowId(tree, 3); ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties())); ServerWindow* w2 = tree->GetWindowByClientId(w2_id); w2->SetBounds(gfx::Rect(50, 10, 10, 10)); @@ -947,7 +951,7 @@ ASSERT_TRUE(tree->SetWindowVisibility(w11_id, true)); // Create |w2| as a child of |root_window| and make it visible. - ClientWindowId w2_id = BuildClientWindowId(tree, 2); + ClientWindowId w2_id = BuildClientWindowId(tree, 3); ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties())); ServerWindow* w2 = tree->GetWindowByClientId(w2_id); w2->SetBounds(gfx::Rect(50, 10, 10, 10)); @@ -1195,8 +1199,8 @@ const float new_opacity = 0.5f; ASSERT_NE(new_opacity, unknown_window.opacity()); - EXPECT_FALSE(tree->SetWindowOpacity( - ClientWindowId(window_id.client_id, window_id.window_id), new_opacity)); + EXPECT_FALSE( + tree->SetWindowOpacity(window_id.ToClientWindowId(), new_opacity)); EXPECT_NE(new_opacity, unknown_window.opacity()); } @@ -1235,10 +1239,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // The binding should be paused until the wm acks the change. uint32_t wm_change_id = 0u; @@ -1255,14 +1261,18 @@ // Ack the change, which should resume the binding. child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + wm_change_id, + wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); EXPECT_FALSE(child_binding->is_paused()); // The child_tree is the one that has to make this call; the const uint32_t change_id = 7; static_cast<mojom::WindowTree*>(child_tree) - ->PerformWindowMove(change_id, embed_window_id2_in_child.id, - mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); + ->PerformWindowMove( + change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); EXPECT_TRUE(wm_internal.on_perform_move_loop_called()); } @@ -1280,10 +1290,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // The binding should be paused until the wm acks the change. uint32_t wm_change_id = 0u; @@ -1300,15 +1312,19 @@ // Ack the change, which should resume the binding. child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + wm_change_id, + wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); EXPECT_FALSE(child_binding->is_paused()); // The child_tree is the one that has to make this call; the const uint32_t change_id = 7; child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowTree*>(child_tree) - ->PerformWindowMove(change_id, embed_window_id2_in_child.id, - mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); + ->PerformWindowMove( + change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); // There should be three changes, the first two relating to capture changing, // the last for the completion. @@ -1335,10 +1351,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // The binding should be paused until the wm acks the change. uint32_t wm_change_id = 0u; @@ -1355,14 +1373,16 @@ // Ack the change, which should resume the binding. child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + wm_change_id, + wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); EXPECT_FALSE(child_binding->is_paused()); // Making this call from the wm_tree() must be invalid. const uint32_t change_id = 7; static_cast<mojom::WindowTree*>(wm_tree())->PerformWindowMove( - change_id, embed_window_id2.id, mojom::MoveLoopSource::MOUSE, - gfx::Point(0, 0)); + change_id, wm_tree()->ClientWindowIdToTransportId(embed_window_id2), + mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); EXPECT_FALSE(wm_internal.on_perform_move_loop_called()); } @@ -1380,10 +1400,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // The binding should be paused until the wm acks the change. uint32_t wm_change_id = 0u; @@ -1400,14 +1422,18 @@ // Ack the change, which should resume the binding. child_binding->client()->tracker()->changes()->clear(); static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + wm_change_id, + wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); EXPECT_FALSE(child_binding->is_paused()); // The child_tree is the one that has to make this call; the const uint32_t change_id = 7; static_cast<mojom::WindowTree*>(child_tree) - ->PerformWindowMove(change_id, embed_window_id2_in_child.id, - mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); + ->PerformWindowMove( + change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + mojom::MoveLoopSource::MOUSE, gfx::Point(0, 0)); ServerWindow* server_window = wm_tree()->GetWindowByClientId(embed_window_id2); @@ -1452,7 +1478,7 @@ EXPECT_EQ(mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS, window->event_targeting_policy()); WindowTreeTestApi(tree).SetEventTargetingPolicy( - ClientWindowIdForWindow(tree, window).id, + tree->ClientWindowIdToTransportId(ClientWindowIdForWindow(tree, window)), mojom::EventTargetingPolicy::NONE); EXPECT_EQ(mojom::EventTargetingPolicy::NONE, window->event_targeting_policy()); @@ -1488,8 +1514,10 @@ wm_client()->tracker()->changes()->clear(); EXPECT_TRUE(embed_tree->SetCapture(FirstRootId(embed_tree))); ASSERT_TRUE(!wm_client()->tracker()->changes()->empty()); - EXPECT_EQ("OnCaptureChanged new_window=" + kWindowManagerClientIdString + - ",1 old_window=" + kNextWindowClientIdString + ",1", + // clients that created this window is receiving the event, so client_id part + // would be reset to 0 before sending back to clients. + EXPECT_EQ("OnCaptureChanged new_window=0,1 old_window=" + + kNextWindowClientIdString + ",1", ChangesToDescription1(*wm_client()->tracker()->changes())[0]); EXPECT_TRUE(embed_client->tracker()->changes()->empty()); wm_client()->tracker()->changes()->clear(); @@ -1515,10 +1543,12 @@ std::unordered_map<std::string, std::vector<uint8_t>> properties; const uint32_t initial_change_id = 17; // Explicitly use an id that does not contain the client id. - const ClientWindowId embed_window_id2_in_child(45 << 16 | 27); + const ClientWindowId embed_window_id2_in_child(child_tree->id(), 27); static_cast<mojom::WindowTree*>(child_tree) - ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id, - properties); + ->NewTopLevelWindow( + initial_change_id, + child_tree->ClientWindowIdToTransportId(embed_window_id2_in_child), + properties); // Create the window for |embed_window_id2_in_child|. const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); @@ -1529,7 +1559,8 @@ // Ack the change, which should resume the binding. static_cast<mojom::WindowManagerClient*>(wm_tree()) - ->OnWmCreatedTopLevelWindow(0u, embed_window_id2.id); + ->OnWmCreatedTopLevelWindow( + 0u, wm_tree()->ClientWindowIdToTransportId(embed_window_id2)); // Change modal type to MODAL_TYPE_SYSTEM and check that it is forwarded to // the window manager.
diff --git a/services/viz/public/cpp/compositing/render_pass_struct_traits.cc b/services/viz/public/cpp/compositing/render_pass_struct_traits.cc index a7dbc13..92b6682 100644 --- a/services/viz/public/cpp/compositing/render_pass_struct_traits.cc +++ b/services/viz/public/cpp/compositing/render_pass_struct_traits.cc
@@ -34,6 +34,7 @@ (*out)->cache_render_pass = data.cache_render_pass(); (*out)->has_damage_from_contributing_content = data.has_damage_from_contributing_content(); + (*out)->generate_mipmap = data.generate_mipmap(); mojo::ArrayDataView<viz::mojom::DrawQuadDataView> quads; data.GetQuadListDataView(&quads);
diff --git a/services/viz/public/cpp/compositing/render_pass_struct_traits.h b/services/viz/public/cpp/compositing/render_pass_struct_traits.h index 1ddc9ce..b8b4b40 100644 --- a/services/viz/public/cpp/compositing/render_pass_struct_traits.h +++ b/services/viz/public/cpp/compositing/render_pass_struct_traits.h
@@ -68,6 +68,10 @@ return input->has_damage_from_contributing_content; } + static bool generate_mipmap(const std::unique_ptr<cc::RenderPass>& input) { + return input->generate_mipmap; + } + static const cc::QuadList& quad_list( const std::unique_ptr<cc::RenderPass>& input) { return input->quad_list;
diff --git a/services/viz/public/cpp/compositing/struct_traits_unittest.cc b/services/viz/public/cpp/compositing/struct_traits_unittest.cc index a23ad63a..8186abd 100644 --- a/services/viz/public/cpp/compositing/struct_traits_unittest.cc +++ b/services/viz/public/cpp/compositing/struct_traits_unittest.cc
@@ -744,9 +744,9 @@ background_filters.Append(cc::FilterOperation::CreateSaturateFilter(2.f)); gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); const bool has_transparent_background = true; - const bool cache_render_pass = false; - const bool has_damage_from_contributing_content = false; - const bool generate_mipmap = false; + const bool cache_render_pass = true; + const bool has_damage_from_contributing_content = true; + const bool generate_mipmap = true; std::unique_ptr<cc::RenderPass> input = cc::RenderPass::Create(); input->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, filters, background_filters, color_space, @@ -806,6 +806,10 @@ EXPECT_EQ(has_transparent_background, output->has_transparent_background); EXPECT_EQ(filters, output->filters); EXPECT_EQ(background_filters, output->background_filters); + EXPECT_EQ(cache_render_pass, output->cache_render_pass); + EXPECT_EQ(has_damage_from_contributing_content, + output->has_damage_from_contributing_content); + EXPECT_EQ(generate_mipmap, output->generate_mipmap); SharedQuadState* out_sqs1 = output->shared_quad_state_list.ElementAt(0); EXPECT_EQ(shared_state_1->quad_to_target_transform,
diff --git a/services/viz/public/interfaces/compositing/render_pass.mojom b/services/viz/public/interfaces/compositing/render_pass.mojom index c983ae3..76fca4d 100644 --- a/services/viz/public/interfaces/compositing/render_pass.mojom +++ b/services/viz/public/interfaces/compositing/render_pass.mojom
@@ -22,5 +22,6 @@ bool has_transparent_background; bool cache_render_pass = false; bool has_damage_from_contributing_content = false; + bool generate_mipmap = false; array<DrawQuad> quad_list; };
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 65ae037..64f3d25 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -208,6 +208,10 @@ #define SK_SUPPORT_LEGACY_STREAM_API #endif +#ifndef SK_SUPPORT_LEGACY_SLOW_SMALL_BLUR +#define SK_SUPPORT_LEGACY_SLOW_SMALL_BLUR +#endif + #ifndef SK_DISABLE_DEFERRED_PROXIES #define SK_DISABLE_DEFERRED_PROXIES #endif @@ -220,6 +224,10 @@ #define SK_SUPPORT_LEGACY_TILED_BITMAPS #endif +#ifndef SK_JUMPER_LEGACY_LOWP +#define SK_JUMPER_LEGACY_LOWP +#endif + ///////////////////////// Imported from BUILD.gn and skia_common.gypi /* In some places Skia can use static initializers for global initialization,
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc index 7cccd8d..c699717 100644 --- a/skia/ext/image_operations.cc +++ b/skia/ext/image_operations.cc
@@ -2,22 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include <stddef.h> #include <stdint.h> #include <algorithm> -#include <cmath> #include <limits> #include "skia/ext/image_operations.h" -// TODO(pkasting): skia/ext should not depend on base/! #include "base/containers/stack_container.h" #include "base/logging.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" +#include "base/numerics/math_constants.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" @@ -59,7 +56,7 @@ if (x > -std::numeric_limits<float>::epsilon() && x < std::numeric_limits<float>::epsilon()) return 1.0f; // Special case the discontinuity at the origin. - float xpi = x * static_cast<float>(M_PI); + float xpi = x * base::kPiFloat; return (sin(xpi) / xpi) * // sinc(x) sin(xpi / filter_size) / (xpi / filter_size); // sinc(x/filter_size) } @@ -85,7 +82,7 @@ if (x > -std::numeric_limits<float>::epsilon() && x < std::numeric_limits<float>::epsilon()) return 1.0f; // Special case the sinc discontinuity at the origin. - const float xpi = x * static_cast<float>(M_PI); + const float xpi = x * base::kPiFloat; return ((sin(xpi) / xpi) * // sinc(x) (0.54f + 0.46f * cos(xpi / filter_size))); // hamming(x)
diff --git a/skia/ext/image_operations_unittest.cc b/skia/ext/image_operations_unittest.cc index a05dfeda..fb78555 100644 --- a/skia/ext/image_operations_unittest.cc +++ b/skia/ext/image_operations_unittest.cc
@@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/files/file_util.h" #include "base/macros.h" +#include "base/numerics/math_constants.h" #include "base/strings/string_util.h" #include "skia/ext/image_operations.h" #include "testing/gtest/include/gtest/gtest.h" @@ -497,15 +498,9 @@ } } - -#ifndef M_PI -// No M_PI in math.h on windows? No problem. -#define M_PI 3.14159265358979323846 -#endif - static double sinc(double x) { if (x == 0.0) return 1.0; - x *= M_PI; + x *= base::kPiDouble; return sin(x) / x; }
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 96dc4b8..87db9694 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -6909,6 +6909,598 @@ } ] }, + "ClangToTWinCFI": { + "gtest_tests": [ + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "angle_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "base_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "blink_heap_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "blink_platform_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 10 + }, + "test": "browser_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "cacheinvalidation_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "capture_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "chrome_app_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "chrome_elf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "content_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "content_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "courgette_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "crypto_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "device_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gcm_unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "google_apis_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gpu_ipc_service_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gpu_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "installer_util_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ipc_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "jingle_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "media_blink_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "media_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "midi_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "native_theme_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "net_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "pdf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ppapi_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "printing_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "remoting_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "sbox_integration_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sbox_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sbox_validation_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "services_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "setup_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "skia_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sql_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ui_base_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "url_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "views_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "webkit_unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "wtf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "zucchini_unittests" + } + ] + }, + "ClangToTWinCFI64": { + "gtest_tests": [ + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "angle_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "base_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "blink_heap_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "blink_platform_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 10 + }, + "test": "browser_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "cacheinvalidation_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "capture_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "chrome_app_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "chrome_elf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "content_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "content_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "courgette_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "crypto_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "device_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gcm_unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "google_apis_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gpu_ipc_service_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "gpu_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "installer_util_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ipc_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "jingle_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "media_blink_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "media_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "midi_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "native_theme_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "net_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "pdf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ppapi_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "printing_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "remoting_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "sbox_integration_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sbox_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sbox_validation_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "services_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "integrity": "high" + } + ] + }, + "test": "setup_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "skia_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sql_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "ui_base_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "url_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "views_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "webkit_unit_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "wtf_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "zucchini_unittests" + } + ] + }, "CrWinAsan tester": { "gtest_tests": [ {
diff --git a/testing/buildbot/chromium.perf.fyi.json b/testing/buildbot/chromium.perf.fyi.json index bf83a334..406d6b46 100644 --- a/testing/buildbot/chromium.perf.fyi.json +++ b/testing/buildbot/chromium.perf.fyi.json
@@ -9,6 +9,7 @@ "-v", "--upload-results", "--output-format=histograms", + "--output-format=json-test-results", "--browser=release" ], "isolate_name": "telemetry_perf_tests", @@ -387,6 +388,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:22b1", + "id": "build139-b1", + "os": "Windows-10-10586", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:22b1", + "id": "build139-b1", + "os": "Windows-10-10586", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -2391,68 +2454,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:22b1", - "id": "build155-b1", - "os": "Windows-10-10586", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:22b1", - "id": "build155-b1", - "os": "Windows-10-10586", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -4864,6 +4865,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:9874", + "id": "build203-b4", + "os": "Windows-10-10586", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:9874", + "id": "build203-b4", + "os": "Windows-10-10586", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -6784,68 +6847,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:9874", - "id": "build219-b4", - "os": "Windows-10-10586", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:9874", - "id": "build219-b4", - "os": "Windows-10-10586", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results",
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index 5db84f7..e09dcedf 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -320,6 +320,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-chromium", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build13-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build13-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -5561,6 +5623,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-chromium", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build73-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build73-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -10626,6 +10750,37 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-webview", + "--output-format=chartjson", + "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" + ], + "isolate_name": "telemetry_perf_webview_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_webview_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build164-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -13296,6 +13451,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-chromium", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build15-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build15-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -18382,6 +18599,37 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-webview", + "--output-format=chartjson", + "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" + ], + "isolate_name": "telemetry_perf_webview_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_webview_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build112-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -21052,6 +21300,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-chromium", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build9-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build9-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -26293,6 +26603,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=android-chromium", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build17-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "android_devices": "1", + "id": "build17-b1--device3", + "os": "Android", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -31518,6 +31890,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build149-m1", + "os": "Ubuntu-14.04", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -33501,68 +33935,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0534", - "id": "build152-m1", - "os": "Ubuntu-14.04", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0534", - "id": "build152-m1", - "os": "Ubuntu-14.04", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -36160,6 +36532,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0166", + "id": "build103-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0166", + "id": "build103-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -37791,130 +38225,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0166", - "id": "build105-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0166", - "id": "build105-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0166", - "id": "build102-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0166", - "id": "build102-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -40739,6 +41049,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a2e", + "id": "build159-m1", + "os": "Mac-10.12", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a2e", + "id": "build159-m1", + "os": "Mac-10.12", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -42370,130 +42742,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a2e", - "id": "build161-m1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a2e", - "id": "build161-m1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a2e", - "id": "build158-m1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a2e", - "id": "build158-m1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -45318,6 +45566,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:1626", + "id": "build124-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:1626", + "id": "build124-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -46949,130 +47259,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1626", - "id": "build126-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1626", - "id": "build126-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1626", - "id": "build123-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1626", - "id": "build123-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -49897,6 +50083,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a26", + "id": "build25-b1", + "os": "Mac-10.12", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a26", + "id": "build25-b1", + "os": "Mac-10.12", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -51507,130 +51755,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a26", - "id": "build27-b1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a26", - "id": "build27-b1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a26", - "id": "build24-b1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0a26", - "id": "build24-b1", - "os": "Mac-10.12", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -54455,6 +54579,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:6821", + "id": "build129-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:6821", + "id": "build129-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -56086,130 +56272,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6821", - "id": "build131-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6821", - "id": "build131-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6821", - "id": "build128-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6821", - "id": "build128-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -59034,6 +59096,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0d26", + "id": "build5-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0d26", + "id": "build5-b1", + "os": "Mac-10.11", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -60665,130 +60789,6 @@ }, { "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0d26", - "id": "build7-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.steady_state", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.steady_state.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0d26", - "id": "build7-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0d26", - "id": "build4-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "power.trivial_pages", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "power.trivial_pages.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:0d26", - "id": "build4-b1", - "os": "Mac-10.11", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "rasterize_and_record_micro.partial_invalidation", "-v", "--upload-results", @@ -63489,6 +63489,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:1616", + "id": "build118-b1", + "os": "Windows-10-10240", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:1616", + "id": "build118-b1", + "os": "Windows-10-10240", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -65409,68 +65471,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build180-b4", - "os": "Windows-10-10240", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:1616", - "id": "build180-b4", - "os": "Windows-10-10240", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -67861,6 +67861,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build133-m1", + "os": "Windows-10-10240", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0534", + "id": "build133-m1", + "os": "Windows-10-10240", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -69802,68 +69864,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0534", - "id": "build136-m1", - "os": "Windows-10-10240", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0534", - "id": "build136-m1", - "os": "Windows-10-10240", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -72275,6 +72275,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:6613", + "id": "build102-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "1002:6613", + "id": "build102-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -74258,68 +74320,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6613", - "id": "build105-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "1002:6613", - "id": "build105-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -76731,6 +76731,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:041a", + "id": "build165-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:041a", + "id": "build165-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -78693,68 +78755,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:041a", - "id": "build168-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:041a", - "id": "build168-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -81166,6 +81166,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "10de:104a", + "id": "build93-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "10de:104a", + "id": "build93-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -83128,68 +83190,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:104a", - "id": "build96-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:104a", - "id": "build96-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -85580,6 +85580,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build186-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build186-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -87542,68 +87604,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build189-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build189-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -89994,6 +89994,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build139-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build139-m1", + "os": "Windows-2008ServerR2-SP1", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -91956,68 +92018,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build142-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build142-m1", - "os": "Windows-2008ServerR2-SP1", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results", @@ -94408,6 +94408,68 @@ }, { "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=release_x64", + "--output-format=chartjson" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build144-m1", + "os": "Windows-2012ServerR2-SP0", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": false, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ + "blink_perf.image_decoder", + "-v", + "--upload-results", + "--browser=reference", + "--output-format=chartjson", + "--max-failures=5", + "--output-trace-tag=_ref" + ], + "isolate_name": "telemetry_perf_tests", + "name": "blink_perf.image_decoder.reference", + "override_compile_targets": [ + "telemetry_perf_tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "102b:0532", + "id": "build144-m1", + "os": "Windows-2012ServerR2-SP0", + "pool": "Chrome-perf" + } + ], + "expiration": 36000, + "hard_timeout": 10800, + "ignore_task_failure": true, + "io_timeout": 600, + "upload_test_results": false + } + }, + { + "args": [ "blink_perf.layout", "-v", "--upload-results", @@ -96391,68 +96453,6 @@ }, { "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=release_x64", - "--output-format=chartjson" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build147-m1", - "os": "Windows-2012ServerR2-SP0", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ - "smoothness.desktop_tough_pinch_zoom_cases", - "-v", - "--upload-results", - "--browser=reference", - "--output-format=chartjson", - "--max-failures=5", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "smoothness.desktop_tough_pinch_zoom_cases.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "102b:0532", - "id": "build147-m1", - "os": "Windows-2012ServerR2-SP0", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 600, - "upload_test_results": false - } - }, - { - "args": [ "smoothness.gpu_rasterization.polymer", "-v", "--upload-results",
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index 93c620a..4f5bfc68 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -957,551 +957,6 @@ "test": "sbox_validation_tests" }, { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "services_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "integrity": "high" - } - ] - }, - "test": "setup_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "skia_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "sql_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "storage_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "sync_integration_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "ui_base_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "ui_touch_selection_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "unit_tests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_unit_tests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "unit_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "url_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "views_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "viz_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "wm_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "zucchini_unittests" - } - ] - }, - "Win10 Tests x64 (GCE)": { - "gtest_tests": [ - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "accessibility_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "app_shell_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "aura_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "base_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "battor_agent_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "boringssl_crypto_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "boringssl_ssl_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true, - "shards": 10 - }, - "test": "browser_tests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_browser_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "shards": 10 - }, - "test": "browser_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "cacheinvalidation_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "capture_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "cast_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "cc_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "chrome_app_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "chrome_elf_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "chromedriver_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_browsertests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_components_browsertests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_browsertests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_unittests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_components_unittests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "compositor_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_browsertests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_content_browsertests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_browsertests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_unittests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_content_unittests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "courgette_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "crypto_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "device_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "display_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "events_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "extensions_browsertests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_extensions_browsertests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "extensions_browsertests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "extensions_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "gcm_unit_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "gfx_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "gn_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "google_apis_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "gpu_ipc_service_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "gpu_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "headless_browsertests" - }, - { - "args": [ - "--enable-browser-side-navigation" - ], - "name": "browser_side_navigation_headless_browsertests", - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "headless_browsertests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "headless_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "install_static_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "integrity": "high" - } - ] - }, - "test": "installer_util_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "ipc_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "jingle_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "keyboard_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "latency_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "libjingle_xmpp_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "media_blink_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "media_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "message_center_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "midi_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "mojo_common_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "mojo_public_bindings_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "mojo_public_system_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "mojo_system_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "nacl_loader_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "native_theme_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "net_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "pdf_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "ppapi_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "printing_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "remoting_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "integrity": "high" - } - ] - }, - "test": "sbox_integration_tests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "sbox_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "sbox_validation_tests" - }, - { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/win10.services_unittests.filter" ],
diff --git a/testing/buildbot/filters/ash_unittests_mash.filter b/testing/buildbot/filters/ash_unittests_mash.filter index 113efc5..df2e7e1 100644 --- a/testing/buildbot/filters/ash_unittests_mash.filter +++ b/testing/buildbot/filters/ash_unittests_mash.filter
@@ -27,6 +27,7 @@ -CursorWindowControllerTest.DSF -CursorWindowControllerTest.MoveToDifferentDisplay -CursorWindowControllerTest.VisibilityTest +# TODO: decide if this needs to be ported. http://crbug.com/695566. -DIPTest.WorkArea -DisplayManagerFontTest.TextSubpixelPositioningWithDsf125External -DisplayManagerFontTest.TextSubpixelPositioningWithDsf125Internal @@ -214,10 +215,6 @@ -PartialScreenshotControllerTest.TouchMousePointerHoverIgnoredWithPointerEvents -PartialScreenshotControllerTest.TwoFingerTouch -PartialScreenshotControllerTest.VisibilityTest --PointerWatcherAdapterClassicTest.MouseEvents --PointerWatcherAdapterClassicTest.TouchEvents --PointerWatcherdapterClassicTest.Mousevents --PointerWatcherdapterClassicTest.Touchvents -ResizeShadowAndCursorTest.MaximizeRestore -ResizeShadowAndCursorTest.Minimize -ResizeShadowAndCursorTest.MouseDrag @@ -361,3 +358,10 @@ -TrayTilesTest.ButtonStatesAddingUser -TrayTilesTest.ButtonStatesLockScreen -TrayTilesTest.ButtonStatesSupervisedUserFlow + + +# The following are specific to classic ash and don't need to be ported. +-PointerWatcherAdapterClassicTest.MouseEvents +-PointerWatcherAdapterClassicTest.TouchEvents +-PointerWatcherdapterClassicTest.Mousevents +-PointerWatcherdapterClassicTest.Touchvents
diff --git a/testing/buildbot/filters/fuchsia.net_unittests.filter b/testing/buildbot/filters/fuchsia.net_unittests.filter index 4f14556..868a111 100644 --- a/testing/buildbot/filters/fuchsia.net_unittests.filter +++ b/testing/buildbot/filters/fuchsia.net_unittests.filter
@@ -4,7 +4,6 @@ -ProxyScriptFetcherImplTest.Priority -PythonUtils* -UDPSocketTest.PartialRecv --URLRequest*FTP* -URLRequestQuic* # Following tests pass locally, but flake on bots.
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter index 16560e0..7c2637d 100644 --- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -28,8 +28,22 @@ -ServiceWorkerV8CacheStrategiesNoneTest.V8CacheOnCacheStorage -ServiceWorkerV8CacheStrategiesNormalTest.V8CacheOnCacheStorage -ServiceWorkerV8CacheStrategiesTest.V8CacheOnCacheStorage +-ServiceWorkerVersionBrowserTest.Activate_NoEventListener +-ServiceWorkerVersionBrowserTest.Activate_Rejected +-ServiceWorkerVersionBrowserTest.FetchEvent_respondWithRejection +-ServiceWorkerVersionBrowserTest.FetchEvent_Response +-ServiceWorkerVersionBrowserTest.FetchEvent_ResponseViaCache +-ServiceWorkerVersionBrowserTest.FetchWithoutSaveData +-ServiceWorkerVersionBrowserTest.FetchWithSaveData +-ServiceWorkerVersionBrowserTest.Install +-ServiceWorkerVersionBrowserTest.InstallWithFetchHandler +-ServiceWorkerVersionBrowserTest.InstallWithoutFetchHandler +-ServiceWorkerVersionBrowserTest.InstallWithWaitUntil_Fulfilled +-ServiceWorkerVersionBrowserTest.InstallWithWaitUntil_RejectConsoleMessage +-ServiceWorkerVersionBrowserTest.InstallWithWaitUntil_Rejected -ServiceWorkerVersionBrowserTest.ReadResourceFailure -ServiceWorkerVersionBrowserTest.ReadResourceFailure_WaitingWorker +-ServiceWorkerVersionBrowserTest.RequestWorkerScriptWithSaveData -ServiceWorkerVersionBrowserTest.ServiceWorkerScriptHeader -ServiceWorkerVersionBrowserTest.StartNotFound @@ -40,6 +54,13 @@ # http://crbug.com/721398 -ClearSiteDataThrottleBrowserTest.* +# Plugin throttle is not implemented. http://crbug.com/764474 +-DataUrlNavigationBrowserTest.PDF_BrowserInitiatedNavigation_Allow +-DataUrlNavigationBrowserTest.PDF_FormPost_Block +-DataUrlNavigationBrowserTest.PDF_Navigation_Block +-DataUrlNavigationBrowserTest.PDF_NavigationFromFrame_Block +-DataUrlNavigationBrowserTest.PDF_NavigationFromFrame_TopFrameIsDataURL_Block + -AsyncResourceHandlerBrowserTest/AsyncResourceHandlerBrowserTest.UploadProgress* -BrowserSideNavigationBrowserTest.FailedNavigation -CrossSiteResourceHandlerTest.NoDeliveryToDetachedFrame @@ -55,12 +76,12 @@ -DataUrlNavigationBrowserTest.UnknownMimeType_NavigationFromFrame_Download -DataUrlNavigationBrowserTest.UnknownMimeType_Navigation_Download -DataUrlNavigationBrowserTest.UnknownMimeType_WindowOpen_Download --DevToolsDownloadContentTest.MultiDownload --DevToolsDownloadContentTest.DefaultDownload --DevToolsDownloadContentTest.ResetDownloadState --DevToolsDownloadContentTest.DownloadCancelled --DevToolsDownloadContentTest.DeniedDownload --DevToolsDownloadContentTest.DefaultDownloadHeadless +-DevToolsDownloadContentTest.MultiDownload +-DevToolsDownloadContentTest.DefaultDownload +-DevToolsDownloadContentTest.ResetDownloadState +-DevToolsDownloadContentTest.DownloadCancelled +-DevToolsDownloadContentTest.DeniedDownload +-DevToolsDownloadContentTest.DefaultDownloadHeadless -DevToolsDownloadContentTest.SingleDownload -DevToolsProtocolTest.CertificateError -DevToolsProtocolTest.ControlNavigationsMainFrame @@ -86,6 +107,7 @@ -PreviewsStateResourceDispatcherHostBrowserTest.ShouldEnableLoFiModeOn -PreviewsStateResourceDispatcherHostBrowserTest.ShouldEnableLoFiModeReload -PreviewsStateResourceDispatcherHostBrowserTest.ShouldEnableLoFiModeReloadDisableLoFi +-RenderFrameHostImplBrowserTest.AbortedRendererInitiatedNavigationDoNotCancelPendingXHR -RenderFrameHostImplBrowserTest.StreamHandleReleasedOnRendererCrash -RenderThreadImplBrowserTest.NonResourceDispatchIPCTasksDontGoThroughScheduler -RenderThreadImplBrowserTest.ResourceDispatchIPCTasksGoThroughScheduler @@ -95,7 +117,7 @@ -RequestDataResourceDispatcherHostBrowserTest.CrossOriginAuxiliary -RequestDataResourceDispatcherHostBrowserTest.CrossOriginNested -RequestDataResourceDispatcherHostBrowserTest.FailedNavigation --RequestDataResourceDispatcherHostBrowserTest.LinkRelPrefetch +-RequestDataResourceDispatcherHostBrowserTest.LinkRelPrefetch -RequestDataResourceDispatcherHostBrowserTest.LinkRelPrefetchReferrerPolicy -RequestDataResourceDispatcherHostBrowserTest.SameOriginAuxiliary -RequestDataResourceDispatcherHostBrowserTest.SameOriginNested @@ -106,7 +128,10 @@ -ResourceDispatcherHostBrowserTest.CrossSiteAfterCrash -ResourceDispatcherHostBrowserTest.CrossSiteNavigationNonBuffered -ResourceDispatcherHostBrowserTest.CrossSiteNoUnloadOn204 +-ResourceDispatcherHostBrowserTest.DoNotSniffHTMLFromImageGIF +-ResourceDispatcherHostBrowserTest.DoNotSniffHTMLFromTextPlain -ResourceDispatcherHostBrowserTest.PageTransitionClientRedirect +-ResourceDispatcherHostBrowserTest.RespectNoSniffDirective -ResourceDispatcherHostBrowserTest.SniffHTMLWithNoContentType -ResourceDispatcherHostBrowserTest.SniffNoContentTypeNoData -SessionHistoryTest.HistoryLength
diff --git a/testing/libfuzzer/fuzzer_test.gni b/testing/libfuzzer/fuzzer_test.gni index 1ab6835c..7ef36c7 100644 --- a/testing/libfuzzer/fuzzer_test.gni +++ b/testing/libfuzzer/fuzzer_test.gni
@@ -119,6 +119,8 @@ test(target_name) { forward_variables_from(invoker, [ + "cflags", + "cflags_cc", "check_includes", "defines", "include_dirs",
diff --git a/testing/libfuzzer/fuzzers/BUILD.gn b/testing/libfuzzer/fuzzers/BUILD.gn index 3410c72..6d740d5 100644 --- a/testing/libfuzzer/fuzzers/BUILD.gn +++ b/testing/libfuzzer/fuzzers/BUILD.gn
@@ -7,6 +7,7 @@ import("//build/config/features.gni") import("//media/media_options.gni") import("//testing/libfuzzer/fuzzer_test.gni") +import("//third_party/protobuf/proto_library.gni") # root BUILD depends on this target. Needed for package discovery group("fuzzers") { @@ -138,6 +139,25 @@ dict = "dicts/generated/url_parse_fuzzer.dict" } +fuzzer_test("url_parse_proto_fuzzer") { + sources = [ + "url_parse_proto_fuzzer.cc", + ] + deps = [ + ":url_proto", + "//base", + "//base:i18n", + "//third_party/libprotobuf-mutator", + "//url:url", + ] +} + +proto_library("url_proto") { + sources = [ + "url.proto", + ] +} + fuzzer_test("usrsctp_fuzzer") { sources = [ "usrsctp_fuzzer.cc",
diff --git a/testing/libfuzzer/fuzzers/url.proto b/testing/libfuzzer/fuzzers/url.proto new file mode 100644 index 0000000..9148a0d --- /dev/null +++ b/testing/libfuzzer/fuzzers/url.proto
@@ -0,0 +1,94 @@ +// 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. + +// This file contains the definition of the Url protobuf used in the +// url_parse_proto_fuzzer that is meant to serve as an example for future +// Chromium fuzzers that use libprotobuf-mutator. +// We will consider the format of a URL for this fuzzer, to be +// [scheme:][//[user[:password]@]host[:port]][/path][?query][#value] +// There may be some URLs Chromium treats as valid that this syntax does not +// capture. However, we will ignore them for the sake of simplicity. +// It is recommended to read this file in conjunction with +// convert_protobuf_to_string() in url_parse_proto_fuzzer.cc as logic in this +// function is sometimes used to ensure that the Url Protocol Buffer obeys the +// syntax we have defined for URLs. Though reading it is completely unecessary +// for understand this fuzzer, we have roughly followed RFC 3986 +// (https://tools.ietf.org/html/rfc3986) which defines the syntax of URIs (which +// URLs are a subset of). + +syntax = "proto2"; + +package url_parse_proto_fuzzer; + +// Here we define the format for a Url Protocol Buffer. This will be passed to +// our fuzzer function. +message Url { + // If there is a scheme, then it must be followed by a colon. A scheme is in + // practice not required in a URL. Therefore, we will define the scheme as + // optional but ensure it is followed by a colon in our conversion code if it + // is included. + optional string scheme = 1; + + enum Slash { + NONE = 0; // Seperate path segments using "" + FORWARD = 1; // Seperate path segments using / + BACKWARD = 2; // Seperate path segments using \ + } + // The syntax rules of the two slashes that precede the host in a URL are + // surprisingly complex. They are not required, even if a scheme is included + // (http:example.com is treated as valid), and are valid even if a scheme is + // not included (//example.com is treated as file:///example.com). They can + // even be backslashes (http:\\example.com and http\/example.com are both + // valid) and there can be any number of them (http:/example.com and + // http://////example.com are both valid). + // We will therefore define slashes as a list of enum values (repeated Slash). + // In our conversion code, this will be read to append the appropriate kind and + // appropriate number of slashes to the URL. + repeated Slash slashes = 2 [packed=true]; + + + // The [user:password@] part of the URL shown above is called the userinfo. + // Userinfo is not mandatory, but if it is included in a URL, then it must + // contain a string called user. There is another optional field in userinfo + // called the password. If a password is included, the user must be separated + // from it by ":". In either case, the userinfo must be separated from the + // host by "@". A URL must have a host if it has a userinfo. + // These requirements will be ensured by the conversion code. + message Userinfo { + required string user = 1; + optional string password = 2; + } + optional Userinfo userinfo = 3; + + // Hosts, like most else in our Url definition, are optional (there are + // are URLs such as data URLs that do not have hosts). + optional string host = 4; + + // ports are unsigned integers between 1-2^16. The closest type to this in the + // proto2 format is uint32. Also if a port number is specified it must be + // preceded by a colon (consider "google.com80" 80 will be interpreted as part + // of the host). The conversion code will ensure this is the case. + optional uint32 port = 5; + + // The rules for the path are somewhat complex. A path is not required, + // however if it follows a port or host, it must start with "/" according + // to the RFC, though Chromium accepts "\" as it converts all backslashes to + // slashes. It does not need to start with "/" if there is no host (in data + // URLs for example). Thus we will define path as a repeated string where each + // member contains a segment of the path and will be preceded by the + // path_separator. The one exception to this is for the first segment if + // path_seperator == NONE and there is a non empty path and host, then the + // first segment will be preceeded by "/". + repeated string path = 6; + required Slash path_separator = 7 [default = FORWARD]; + + // A query must preceded by "?". This will be ensured in the conversion + // code. Queries can have many components which the converter will separate + // using "&", as is the convention. + repeated string query = 8; + + // A fragment must preceded by "#". This will be ensured in the conversion + // code. + optional string fragment = 9; +}
diff --git a/testing/libfuzzer/fuzzers/url_parse_proto_fuzzer.cc b/testing/libfuzzer/fuzzers/url_parse_proto_fuzzer.cc new file mode 100644 index 0000000..2fa5df6 --- /dev/null +++ b/testing/libfuzzer/fuzzers/url_parse_proto_fuzzer.cc
@@ -0,0 +1,131 @@ +// 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. + +// includes copied from url_parse_fuzzer.cc +#include "base/at_exit.h" +#include "base/i18n/icu_util.h" +#include "url/gurl.h" + +// Includes *not* copied from url_parse_fuzzer.cc +// Contains DEFINE_BINARY_PROTO_FUZZER, a macro we use to define our target +// function. +#include "third_party/libprotobuf-mutator/src/src/libfuzzer/libfuzzer_macro.h" +// Header information about the Protocol Buffer Url class. +#include "testing/libfuzzer/fuzzers/url.pb.h" + +#include <assert.h> + +// The code using TestCase is copied from url_parse_fuzzer.cc +struct TestCase { + TestCase() { + CHECK(base::i18n::InitializeICU()); + } + // used by ICU integration. + base::AtExitManager at_exit_manager; +}; + +TestCase* test_case = new TestCase(); + +// Boilerplate code to silence libprotobuf-mutators logging. +protobuf_mutator::protobuf::LogSilencer log_silincer; + +using namespace url_parse_proto_fuzzer; + +std::string Slash_to_string(int slash) { + if (slash == Url::NONE) + return ""; + if (slash == Url::FORWARD) + return "/"; + if (slash == Url::BACKWARD) { + return "\\"; + } + assert(false && "Received unexpected value for slash"); + // Silence compiler warning about not returning in non-void function. + return ""; +} + +// Converts a URL in Protocol Buffer format to a url in string format. +// Since protobuf is a relatively simple format, fuzzing targets that do not +// accept protobufs (such as this one) will require code to convert from +// protobuf to the accepted format (string in this case). +std::string protobuf_to_string(const Url& url) { + // Build url_string piece by piece from url and then return it. + std::string url_string = std::string(""); + + if (url.has_scheme()) { // Get the scheme if Url has it. + // Append the scheme to the url. This may be empty. Then append a colon + // which is mandatory if there is a scheme. + url_string += url.scheme() + ":"; + } + + // Just append the slashes without doing validation, since it would be too + // complex. libFuzzer will hopefully figure out good values. + for (const int slash : url.slashes()) + url_string += Slash_to_string(slash); + + // Get host. This is simple since hosts are simply strings according to our + // definition. + if (url.has_host()) { + // Get userinfo if libFuzzer set it. Ensure that user is seperated + // from the password by ":" (if a password is included) and that userinfo is + // separated from the host by "@". + if (url.has_userinfo()) { + url_string += url.userinfo().user(); + if (url.userinfo().has_password()) { + url_string += ":"; + url_string += url.userinfo().password(); + } + url_string += "@"; + } + url_string += url.host(); + + // As explained in url.proto, if libFuzzer included a port in url ensure + // that it is preceded by the host and then ":". + if (url.has_port()) + // Convert url.port() from an unsigned 32 bit int before appending it. + url_string += ":" + std::to_string(url.port()); + } + + // Append the path segments to the url, with each segment separated by + // the path_separator. + bool first_segment = true; + std::string path_separator = Slash_to_string(url.path_separator()); + for (const std::string& path_segment : url.path()) { + // There does not need to be a path, but if there is a path and a host, + // ensure the path begins with "/". + if (url.has_host() && first_segment) { + url_string += "/" + path_segment; + first_segment = false; + } else + url_string += path_separator + path_segment; + } + + // Queries must be started by "?". If libFuzzer included a query in url, + // ensure that it is preceded by "?". Also Seperate query components with + // ampersands as is the convention. + bool first_component = true; + for (const std::string& query_component : url.query()) { + if (first_component) { + url_string += "?" + query_component; + first_component = false; + } else + url_string += "&" + query_component; + } + + // Fragments must be started by "#". If libFuzzer included a fragment + // in url, ensure that it is preceded by "#". + if (url.has_fragment()) + url_string += "#" + url.fragment(); + + return url_string; +} + +// The target function. This is the equivalent of LLVMFuzzerTestOneInput in +// typical libFuzzer based fuzzers. It is passed our Url protobuf object that +// was mutated by libFuzzer, converts it to a string and then feeds it to url() +// for fuzzing. +DEFINE_BINARY_PROTO_FUZZER(const Url& url_protobuf) { + std::string url_string = protobuf_to_string(url_protobuf); + GURL url(url_string); +}
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 2b869f7c..67411d0 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1,4 +1,24 @@ { + "AccountConsistencyVariations": [ + { + "platforms": [ + "linux", + "mac", + "win" + ], + "experiments": [ + { + "name": "DiceFixAuthErrors", + "params": { + "method": "dice_fix_auth_errors" + }, + "enable_features": [ + "AccountConsistency" + ] + } + ] + } + ], "AlternateComponentUrls": [ { "platforms": [ @@ -1508,10 +1528,7 @@ ], "experiments": [ { - "name": "EnableAppNap", - "params": { - "app_nap": "true" - }, + "name": "EnableTaskPolicy", "enable_features": [ "MacAllowBackgroundingProcesses" ] @@ -3135,6 +3152,12 @@ ], "experiments": [ { + "name": "Experiment2", + "params": { + "variant": "experiment2" + } + }, + { "name": "Experiment", "params": { "variant": "experiment" @@ -3157,6 +3180,12 @@ "params": { "variant": "record-type" } + }, + { + "name": "Experiment3", + "params": { + "variant": "experiment3" + } } ] }
diff --git a/third_party/WebKit/LayoutTests/ASANExpectations b/third_party/WebKit/LayoutTests/ASANExpectations index bb37c304..22b23506 100644 --- a/third_party/WebKit/LayoutTests/ASANExpectations +++ b/third_party/WebKit/LayoutTests/ASANExpectations
@@ -72,5 +72,3 @@ # Intentionally failed allocations, via partitionAllocGenericFlags() crbug.com/577889 [ Linux ] fast/js/typed-array-allocation-failure.html [ Crash ] -crbug.com/717019 [ Linux ] virtual/gpu/fast/canvas/canvas-clip-rule.html [ Crash ] -crbug.com/717019 [ Linux ] virtual/gpu/fast/canvas/canvas-path-context-clip.html [ Crash ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 6f5e9760..6e1ef1f 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -1638,8 +1638,8 @@ crbug.com/591099 css3/masking/clip-path-circle-overflow.html [ Failure Pass ] crbug.com/591099 css3/masking/clip-path-circle-relative-overflow.html [ Failure Pass ] crbug.com/591099 css3/masking/clip-path-circle.html [ Failure Pass ] -crbug.com/591099 css3/masking/clip-path-columns-shape.html [ Failure ] -crbug.com/591099 css3/masking/clip-path-columns-svg-clippath-usou.html [ Failure ] +crbug.com/591099 css3/masking/clip-path-columns-shape.html [ Failure Pass ] +crbug.com/591099 css3/masking/clip-path-columns-svg-clippath-usou.html [ Failure Pass ] crbug.com/591099 css3/masking/clip-path-ellipse.html [ Failure Pass ] crbug.com/591099 css3/masking/clip-path-inset-corners.html [ Failure ] crbug.com/591099 css3/masking/clip-path-polygon-evenodd.html [ Failure Pass ] @@ -3774,7 +3774,6 @@ crbug.com/591099 external/wpt/css/css-writing-modes-3/block-flow-direction-vrl-021.xht [ Failure ] 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/block-plaintext-004.html [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/central-baseline-alignment-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/clearance-calculations-vrl-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes-3/clearance-calculations-vrl-004.xht [ Failure ] @@ -3903,8 +3902,9 @@ crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-declaration-17.html [ Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-declaration-18.html [ Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-01.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/dynamic-offset-vrl-002.html [ Failure ] -crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/dynamic-offset-vrl-rtl-002.html [ Failure ] +crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-02.html [ Failure Pass ] +crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/dynamic-offset-vrl-002.html [ Failure Pass ] +crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/dynamic-offset-vrl-rtl-002.html [ Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-break-inside-001.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-001.html [ Crash Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-003.html [ Crash Failure ] @@ -4098,6 +4098,7 @@ crbug.com/591099 external/wpt/longtask-timing/longtask-in-sibling-iframe.html [ Pass Timeout ] crbug.com/591099 external/wpt/media-source/mediasource-getvideoplaybackquality.html [ Crash Timeout ] crbug.com/591099 external/wpt/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Pass ] +crbug.com/591099 external/wpt/payment-request/interfaces.https.html [ Timeout ] crbug.com/591099 external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html [ Pass ] 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 ] @@ -4136,7 +4137,7 @@ crbug.com/591099 external/wpt/selection/extend-00.html [ Pass Timeout ] crbug.com/591099 external/wpt/selection/extend-20.html [ Pass Timeout ] crbug.com/591099 external/wpt/selection/selectAllChildren.html [ Pass Timeout ] -crbug.com/591099 external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Crash Timeout ] +crbug.com/591099 external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Crash Pass Timeout ] crbug.com/591099 external/wpt/svg/interfaces.html [ Pass Timeout ] crbug.com/591099 external/wpt/svg/linking/reftests/href-filter-element.html [ Crash Failure ] crbug.com/591099 external/wpt/uievents/order-of-events/focus-events/focus-manual.html [ Crash Failure Timeout ] @@ -7028,7 +7029,7 @@ crbug.com/591099 fast/events/event-targets.html [ Crash Failure Pass ] crbug.com/591099 fast/events/event-trace.html [ Failure Pass ] crbug.com/591099 fast/events/event-trusted.html [ Failure ] -crbug.com/591099 fast/events/event-view-toString.html [ Failure Pass ] +crbug.com/591099 fast/events/event-view-toString.html [ Failure Pass Timeout ] crbug.com/591099 fast/events/fire-mousedown-while-pressing-mouse-button.html [ Crash Failure Pass ] crbug.com/591099 fast/events/fire-popstate-event.html [ Failure Pass ] crbug.com/591099 fast/events/fire-scroll-event-element.html [ Failure Pass Timeout ] @@ -7578,7 +7579,7 @@ crbug.com/591099 fast/forms/calendar-picker/calendar-picker-with-step.html [ Crash Failure Pass ] crbug.com/591099 fast/forms/calendar-picker/date-open-picker-with-f4-key.html [ Failure Pass ] crbug.com/591099 fast/forms/calendar-picker/date-picker-ax.html [ Crash Failure Pass ] -crbug.com/591099 fast/forms/calendar-picker/date-picker-choose-default-value-after-set-value.html [ Crash Failure Pass ] +crbug.com/591099 fast/forms/calendar-picker/date-picker-choose-default-value-after-set-value.html [ Crash Failure Pass Timeout ] crbug.com/591099 fast/forms/calendar-picker/date-picker-events.html [ Crash Failure Pass Timeout ] crbug.com/591099 fast/forms/calendar-picker/date-picker-open-without-focus.html [ Failure Pass ] crbug.com/591099 fast/forms/calendar-picker/datetimelocal-change-type-on-input-crash.html [ Crash Failure Pass ] @@ -8786,7 +8787,7 @@ crbug.com/591099 fast/html/imports/sub-imports-onload.html [ Failure Pass ] crbug.com/591099 fast/html/imports/xhr.html [ Failure Pass ] crbug.com/591099 fast/html/input-type-change-crash.html [ Failure Pass ] -crbug.com/757767 fast/html/layout-runs-and-floats-crash.html [ Timeout ] +crbug.com/757767 fast/html/layout-runs-and-floats-crash.html [ Pass Timeout ] crbug.com/591099 fast/html/meter-user-modify.html [ Failure Pass ] crbug.com/591099 fast/html/object-border.html [ Failure Pass ] crbug.com/591099 fast/html/progress-user-modify.html [ Failure Pass ] @@ -9398,7 +9399,7 @@ crbug.com/591099 fast/multicol/change-height.html [ Failure ] crbug.com/591099 fast/multicol/client-rect-after-spanner.html [ Failure Timeout ] crbug.com/591099 fast/multicol/client-rect-nested.html [ Failure Timeout ] -crbug.com/591099 fast/multicol/client-rects-crossing-boundaries-nested.html [ Failure ] +crbug.com/591099 fast/multicol/client-rects-crossing-boundaries-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/client-rects-crossing-boundaries.html [ Failure ] crbug.com/591099 fast/multicol/client-rects-rtl.html [ Failure ] crbug.com/591099 fast/multicol/client-rects-sole-empty-block.html [ Failure ] @@ -9409,7 +9410,7 @@ crbug.com/591099 fast/multicol/column-width-zero.html [ Failure Pass ] crbug.com/591099 fast/multicol/columns-shorthand-parsing-2.html [ Failure Pass ] crbug.com/591099 fast/multicol/columns-shorthand-parsing.html [ Failure ] -crbug.com/591099 fast/multicol/composited-inner-multicol.html [ Failure ] +crbug.com/591099 fast/multicol/composited-inner-multicol.html [ Failure Timeout ] crbug.com/591099 fast/multicol/composited-layer-multiple-fragments-translated.html [ Failure ] crbug.com/591099 fast/multicol/composited-layer.html [ Failure ] crbug.com/591099 fast/multicol/composited-opacity-2nd-and-3rd-column.html [ Failure ] @@ -9425,8 +9426,8 @@ crbug.com/591099 fast/multicol/content-height-zero-crash.html [ Failure Pass ] crbug.com/591099 fast/multicol/cssom-view.html [ Failure ] crbug.com/591099 fast/multicol/doubly-nested-with-increasing-row-heights-crash.html [ Failure Pass ] -crbug.com/757767 fast/multicol/doubly-nested-with-insane-child-height-crash.html [ Timeout ] -crbug.com/591099 fast/multicol/doubly-nested-with-top-padding-crossing-row-boundaries.html [ Failure ] +crbug.com/757767 fast/multicol/doubly-nested-with-insane-child-height-crash.html [ Timeout Pass ] +crbug.com/591099 fast/multicol/doubly-nested-with-top-padding-crossing-row-boundaries.html [ Failure Timeout ] crbug.com/591099 fast/multicol/dynamic/abspos-becomes-spanner.html [ Failure ] crbug.com/591099 fast/multicol/dynamic/abspos-multicol-with-spanner-becomes-spanner.html [ Failure Timeout ] crbug.com/591099 fast/multicol/dynamic/block-becomes-spanner.html [ Failure ] @@ -9494,7 +9495,7 @@ crbug.com/591099 fast/multicol/dynamic/valid-spanner-container-becomes-invalid.html [ Failure ] crbug.com/591099 fast/multicol/empty-list-item.html [ Failure Pass ] crbug.com/591099 fast/multicol/event-offset-complex-tree.html [ Failure ] -crbug.com/591099 fast/multicol/event-offset-in-nested.html [ Failure ] +crbug.com/591099 fast/multicol/event-offset-in-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/event-offset.html [ Failure ] crbug.com/591099 fast/multicol/explicit-columns-auto.html [ Failure Pass ] crbug.com/591099 fast/multicol/filter-in-second-column.html [ Failure ] @@ -9602,7 +9603,7 @@ crbug.com/591099 fast/multicol/nested-with-padding.html [ Failure ] crbug.com/591099 fast/multicol/nested-with-single-empty-block.html [ Failure Timeout ] crbug.com/591099 fast/multicol/nested-with-single-tall-line.html [ Failure ] -crbug.com/591099 fast/multicol/nested-with-tall-block.html [ Failure ] +crbug.com/591099 fast/multicol/nested-with-tall-block.html [ Failure Timeout ] crbug.com/591099 fast/multicol/newmulticol/avoid-column-break-inside.html [ Failure ] crbug.com/591099 fast/multicol/newmulticol/balance-images.html [ Failure Timeout ] crbug.com/591099 fast/multicol/newmulticol/balance-maxheight1.html [ Failure ] @@ -9679,7 +9680,7 @@ crbug.com/591099 fast/multicol/span/abspos-containing-block-outside-spanner.html [ Failure Timeout ] crbug.com/591099 fast/multicol/span/adjacent-spanners-with-margin.html [ Failure ] crbug.com/591099 fast/multicol/span/adjacent-spanners.html [ Failure Timeout ] -crbug.com/591099 fast/multicol/span/after-row-with-uneven-height-nested-multicol.html [ Failure ] +crbug.com/591099 fast/multicol/span/after-row-with-uneven-height-nested-multicol.html [ Failure Timeout ] crbug.com/591099 fast/multicol/span/anonymous-before-child-parent-crash.html [ Failure Pass ] crbug.com/591099 fast/multicol/span/anonymous-split-block-crash.html [ Failure Pass ] crbug.com/591099 fast/multicol/span/as-inner-multicol-after-composited-layer-crash.html [ Failure Pass ] @@ -9720,7 +9721,7 @@ crbug.com/591099 fast/multicol/span/invalid-spanner-in-transform.html [ Failure ] crbug.com/591099 fast/multicol/span/margin-on-multicol.html [ Failure ] crbug.com/591099 fast/multicol/span/multicol-with-padding.html [ Failure ] -crbug.com/591099 fast/multicol/span/nested-multicol.html [ Failure ] +crbug.com/591099 fast/multicol/span/nested-multicol.html [ Failure Timeout ] crbug.com/591099 fast/multicol/span/offset-properties-empty-content.html [ Failure Timeout ] crbug.com/591099 fast/multicol/span/offset-properties.html [ Failure Timeout ] crbug.com/591099 fast/multicol/span/outer-column-break-after-inner-spanner-2.html [ Failure ] @@ -9791,7 +9792,7 @@ crbug.com/757767 fast/multicol/vertical-lr/caret-range-outside-columns-rtl.html [ Failure Timeout ] crbug.com/757767 fast/multicol/vertical-lr/caret-range-outside-columns.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-lr/client-rect-after-spanner.html [ Failure Timeout ] -crbug.com/591099 fast/multicol/vertical-lr/client-rects-crossing-boundaries-nested.html [ Failure ] +crbug.com/591099 fast/multicol/vertical-lr/client-rects-crossing-boundaries-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-lr/column-break-with-balancing.html [ Failure ] crbug.com/591099 fast/multicol/vertical-lr/column-count-with-rules.html [ Failure ] crbug.com/591099 fast/multicol/vertical-lr/column-rules.html [ Failure ] @@ -9806,7 +9807,7 @@ crbug.com/591099 fast/multicol/vertical-lr/gap-non-negative.html [ Failure Pass ] crbug.com/591099 fast/multicol/vertical-lr/image-inside-nested-blocks-with-border.html [ Failure ] crbug.com/591099 fast/multicol/vertical-lr/nested-columns.html [ Failure ] -crbug.com/591099 fast/multicol/vertical-lr/offset-top-and-left-at-boundaries-nested.html [ Failure ] +crbug.com/591099 fast/multicol/vertical-lr/offset-top-and-left-at-boundaries-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-lr/offset-top-and-left-at-boundaries.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-lr/offset-top-and-left-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-lr/rules-with-border-before.html [ Failure ] @@ -9822,7 +9823,7 @@ crbug.com/591099 fast/multicol/vertical-rl/caret-range-outside-columns-rtl.html [ Failure ] crbug.com/591099 fast/multicol/vertical-rl/caret-range-outside-columns.html [ Failure ] crbug.com/591099 fast/multicol/vertical-rl/client-rect-after-spanner.html [ Failure Timeout ] -crbug.com/591099 fast/multicol/vertical-rl/client-rects-crossing-boundaries-nested.html [ Failure ] +crbug.com/591099 fast/multicol/vertical-rl/client-rects-crossing-boundaries-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-rl/column-break-with-balancing.html [ Failure ] crbug.com/591099 fast/multicol/vertical-rl/column-count-with-rules.html [ Failure ] crbug.com/591099 fast/multicol/vertical-rl/column-rules.html [ Failure ] @@ -9837,12 +9838,12 @@ crbug.com/591099 fast/multicol/vertical-rl/gap-non-negative.html [ Failure Pass ] crbug.com/591099 fast/multicol/vertical-rl/image-inside-nested-blocks-with-border.html [ Failure ] crbug.com/757767 fast/multicol/vertical-rl/nested-columns.html [ Crash Failure ] -crbug.com/591099 fast/multicol/vertical-rl/offset-top-and-left-at-boundaries-nested.html [ Failure ] +crbug.com/591099 fast/multicol/vertical-rl/offset-top-and-left-at-boundaries-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-rl/offset-top-and-left-at-boundaries.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-rl/offset-top-and-left-nested.html [ Failure Timeout ] crbug.com/591099 fast/multicol/vertical-rl/rules-with-border-before.html [ Failure ] crbug.com/591099 fast/multicol/vertical-rl/unsplittable-inline-block.html [ Failure ] -crbug.com/757767 fast/multicol/very-tall-block-crash.html [ Timeout Failure ] +crbug.com/757767 fast/multicol/very-tall-block-crash.html [ Timeout Pass ] crbug.com/591099 fast/multicol/very-wide-rtl-crash.html [ Failure Pass ] crbug.com/591099 fast/multicol/widows-and-orphans.html [ Failure ] crbug.com/591099 fast/multicol/widows.html [ Failure ] @@ -10740,7 +10741,6 @@ crbug.com/591099 fast/text/international/text-combine-parser-test.html [ Failure Pass ] crbug.com/591099 fast/text/international/thai-cursor-position.html [ Failure Pass ] crbug.com/591099 fast/text/international/thai-offsetForPosition-inside-character.html [ Failure Pass ] -crbug.com/591099 fast/text/international/unicode-bidi-plaintext.html [ Failure ] crbug.com/591099 fast/text/international/vertical-text-metrics-test.html [ Failure Pass ] crbug.com/591099 fast/text/justify-ideograph-vertical.html [ Crash Failure ] crbug.com/591099 fast/text/large-text-composed-char.html [ Failure Timeout ] @@ -11315,7 +11315,7 @@ crbug.com/591099 html/dialog/inert-node-is-unselectable.html [ Failure ] crbug.com/591099 html/dialog/modal-dialog-ancestor-is-inert.html [ Failure Pass ] crbug.com/591099 html/dialog/modal-dialog-blocks-mouse-events.html [ Failure Pass ] -crbug.com/591099 html/dialog/modal-dialog-distributed-child-is-not-inert.html [ Failure Pass ] +crbug.com/591099 html/dialog/modal-dialog-distributed-child-is-not-inert.html [ Failure Pass Timeout ] crbug.com/591099 html/dialog/multiple-centered-dialogs.html [ Failure ] crbug.com/591099 html/dialog/non-modal-dialog-does-not-block-mouse-events.html [ Failure Pass ] crbug.com/591099 html/dialog/non-modal-dialog-layout.html [ Failure Pass ] @@ -11479,6 +11479,9 @@ crbug.com/591099 http/tests/devtools/animation/animation-timeline.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/animation/animation-transition-setTiming-crash.html [ Crash Failure Pass Timeout ] crbug.com/591099 http/tests/devtools/animation/animation-web-anim-negative-start-time.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/appcache/appcache-iframe-manifests.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/appcache/appcache-manifest-with-non-existing-file.html [ Failure Timeout ] +crbug.com/591099 http/tests/devtools/appcache/appcache-swap.html [ Failure Timeout ] crbug.com/591099 http/tests/devtools/audits/audits-empty-stylesheet.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/audits/audits-panel-functional.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/changes/changes-highlighter.html [ Crash Failure Pass Timeout ] @@ -11644,6 +11647,7 @@ crbug.com/591099 http/tests/devtools/elements/elements-delete-inline-style.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/elements/elements-img-tooltip.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/elements/elements-inspect-iframe-from-different-domain.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/elements/elements-linkify-attributes.html [ Crash Failure Timeout ] crbug.com/591099 http/tests/devtools/elements/elements-panel-correct-case.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/elements/elements-panel-limited-children.html [ Crash Failure Pass Timeout ] crbug.com/591099 http/tests/devtools/elements/elements-panel-reload-assert.html [ Crash Failure Pass Timeout ] @@ -11841,6 +11845,7 @@ crbug.com/591099 http/tests/devtools/modules-load-source.html [ Failure Pass ] crbug.com/591099 http/tests/devtools/network/network-columns-visible.html [ Crash Failure Pass Timeout ] crbug.com/591099 http/tests/devtools/network/network-cookies-pane.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/network/network-datareceived.html [ Pass Timeout ] crbug.com/591099 http/tests/devtools/network/network-disable-cache-preloads.php [ Crash Failure ] crbug.com/591099 http/tests/devtools/network/network-domain-filter.html [ Failure Pass ] crbug.com/591099 http/tests/devtools/network/network-filmstrip-overview-showing.html [ Failure Pass ] @@ -11933,6 +11938,11 @@ crbug.com/591099 http/tests/devtools/sass/test-ssp-editing.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/sass/test-ssp-incremental-edit-invalid-value.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/schema-get-domains-matches-agents.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/search/search-in-non-existing-resource.html [ Failure ] +crbug.com/591099 http/tests/devtools/search/search-in-resource.html [ Failure ] +crbug.com/591099 http/tests/devtools/search/search-in-script.html [ Failure ] +crbug.com/591099 http/tests/devtools/search/search-in-static.html [ Failure ] +crbug.com/591099 http/tests/devtools/service-workers/user-agent-override.html [ Failure Pass Timeout ] crbug.com/591099 http/tests/devtools/sources/autocomplete-css.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/sources/autocomplete-general.html [ Crash Failure Pass ] crbug.com/591099 http/tests/devtools/sources/autocomplete-hide-on-smart-brace.html [ Crash Failure Pass ] @@ -12348,212 +12358,118 @@ crbug.com/591099 http/tests/inspector-protocol/network/request-interception-patterns.js [ Timeout ] crbug.com/591099 http/tests/inspector-unit/viewport-datagrid-items-attached-to-dom.js [ Failure ] crbug.com/591099 http/tests/inspector-unit/viewport-datagrid-items-expandable-attached-to-dom.js [ Failure ] -crbug.com/591099 http/tests/devtools/appcache/appcache-iframe-manifests.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/appcache/appcache-manifest-with-non-existing-file.html [ Failure Timeout ] -crbug.com/591099 http/tests/devtools/appcache/appcache-swap.html [ Failure Timeout ] -crbug.com/591099 http/tests/inspector/application-panel/resources-panel-on-navigation.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/application-panel/resources-panel-resource-preview.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/application-panel/resources-panel-selection-on-reload.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/application-panel/resources-panel-websql.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/application-panel/storage-view-reports-quota.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/bindings-frame-attach-detach.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/bindings-frame-navigate.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/bindings-main-frame-navigated.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/bindings-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/contentscripts-bindings-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/contentscripts-navigator-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/livelocation-main-frame-navigated.html [ Failure Timeout ] -crbug.com/591099 http/tests/inspector/bindings/navigator-frame-attach-detach.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/navigator-frame-navigate.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/navigator-main-frame-navigated.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/navigator-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/shadowdom-bindings.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/shadowdom-navigator.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/sourcemap-bindings-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/sourcemap-navigator-multiple-frames.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/suspendtarget-bindings.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/bindings/suspendtarget-navigator.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-data.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-deletion.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-entry-deletion.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-live-update-cache-content.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-live-update-list.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/cache-storage/cache-names.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/command-line-api-inspect.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/compiler-script-mapping.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/compiler-source-mapping-debug.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-cd-completions.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/console-cd.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-completions.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-cross-origin-iframe-logging.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-resource-errors.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-show-all-messages.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-xhr-logging-async.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console-xhr-logging.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/console/console-links-on-messages-before-inspection.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/debugger/fetch-breakpoints.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/elements-linkify-attributes.html [ Crash Failure Timeout ] -crbug.com/591099 http/tests/devtools/elements/event-listeners-framework-with-service-worker.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/elements/html-link-import.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/edit-css-with-source-url.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/import-added-through-js-crash.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/elements/styles/inline-stylesheet-sourceurl-and-sourcemapurl.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/selector-line-deprecated.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/selector-line-sourcemap-header-deprecated.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/selector-line-sourcemap-header.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/selector-line.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/styles-do-not-add-inline-stylesheets-in-navigator.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/styles-redirected-css.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/stylesheet-tracking.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/elements/styles/xsl-transformed.xml [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/extensions-headers.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions-iframe-eval.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions-ignore-cache.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions-network-redirect.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions-useragent.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-api.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-audits-api.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-audits-content-script.html [ Crash Failure Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-audits.html [ Crash Failure Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-eval-content-script.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-eval.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-events.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-network.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-panel.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/extensions/extensions-reload.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-resources.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/extensions/extensions-sidebar.html [ Crash Failure ] -crbug.com/591099 http/tests/inspector/extensions/extensions-timeline-api.html [ Crash Failure ] -crbug.com/591099 http/tests/inspector/extensions/multiple-extensions.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/forced-layout-in-microtask.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/fragment.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/database-data.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/database-names.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/database-refresh-view.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/indexeddb/database-structure.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/resources-panel.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/transaction-promise-console.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/indexeddb/upgrade-events.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/inline-source-map-loading.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/inspect-element.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/inspect-iframe-from-different-domain.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/modify-cross-domain-rule.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/network-preflight-options.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-absolute-paths.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-git-folders.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-rename-files.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-sane.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/automapping-sourcemap-nameclash.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/filesystem-delete-file.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/navigator-create-file-copy.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-do-not-overwrite-css.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-go-to-file-dialog.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-merge-editor-tabs.html [ Crash Failure ] -crbug.com/591099 http/tests/inspector/persistence/persistence-mimetype-on-rename.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-move-breakpoints-on-reload.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-move-breakpoints.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-navigator.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-rename-mapped-file.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-search-across-all-files.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-sourceframe-messages.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-switch-editor-tab.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-sync-content-nodejs.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-sync-content.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/resource-har-conversion.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/resource-har-headers.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/resource-parameters-ipv6.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/resource-parameters.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/cached-resource-metadata.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/iframe-main-resource.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-metadata.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-request-content-after-loading-and-clearing-cache.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-request-content-while-loading.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-crafted-frame-add.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-document-url.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-events.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-frame-add.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-frame-in-crafted-frame.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-frame-navigate.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-htmlimports.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-invalid-mime-type-css-content.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-no-xhrs.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/resource-tree/resource-tree-non-unique-url.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/search/search-ignore-binary-files.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/search/search-in-non-existing-resource.html [ Failure ] -crbug.com/591099 http/tests/devtools/search/search-in-resource.html [ Failure ] -crbug.com/591099 http/tests/devtools/search/search-in-script.html [ Failure ] -crbug.com/591099 http/tests/devtools/search/search-in-static.html [ Failure ] -crbug.com/591099 http/tests/devtools/search/source-frame-replace-1.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/search/source-frame-replace-2.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/search/source-frame-replace-3.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/search/source-frame-replace-4.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/search/source-frame-search.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/search/sources-search-scope-in-files.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/search/sources-search-scope-many-projects.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/blank-origins-not-shown.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/security/blocked-mixed-content.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/failed-request.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/interstitial-sidebar.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/main-origin-assigned-despite-request-missing.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/security/mixed-content-active-and-passive-reload.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/mixed-content-reload.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/origin-group-names-unique.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/origin-view-then-interstitial.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-blocked-mixed-content.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-details-updated-with-security-state.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-explanation-ordering.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-state-comparator.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-summary.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/security/security-unknown-resource.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/service-workers/lazy-addeventlisteners.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-worker-agents.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-worker-manager.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-worker-network-fetch-blocked.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-worker-network-fetch.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-worker-pause.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-workers-bypass-for-network-redirect.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-workers-force-update-on-page-load.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-workers-navigation-preload.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-workers-redundant.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/service-workers-view.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/service-workers/user-agent-override.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/sources/css-sourcemaps-toggle-enabled.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/async-callstack-fetch.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/async-callstack-network-initiator-image.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/async-callstack-network-initiator.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/sources/debugger/pause-in-removed-frame.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/source-map-http-header.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/worker-debugging-script-mapping.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger/worker-debugging.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/event-listener-breakpoints-script-fst-stmt-for-module.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/devtools/sources/js-sourcemaps-toggle-enabled.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/navigator-view-content-scripts.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/ui-source-code-highlight.php [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/ui-source-code-metadata.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/stacktraces/csp-inline-warning-contains-stacktrace.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/stacktraces/csp-setInterval-warning-contains-stacktrace.html [ Failure Pass ] -crbug.com/591099 http/tests/devtools/stacktraces/csp-setTimeout-warning-contains-stacktrace.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/stylesheet-source-mapping.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/template-content-inspect-crash.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/text-source-map.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/tracing/timeline-network-received-data.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/tracing/timeline-receive-response-event.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/tracing/timeline-script-parse.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/tracing/timeline-xhr-event.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/tracing/timeline-xhr-response-type-blob-event.html [ Crash Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/tracing/websocket/timeline-websocket-event.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/websocket/network-preserve-selection-on-frame-receive.html [ Failure Pass Timeout ] -crbug.com/591099 http/tests/inspector/websocket/websocket-frame-error.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/websocket/websocket-frame.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/inspector/websocket/websocket-handshake.html [ Failure Pass ] -crbug.com/591099 http/tests/inspector/workers-on-navigation.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/application-panel/resources-panel-on-navigation.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/application-panel/resources-panel-resource-preview.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/application-panel/resources-panel-selection-on-reload.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/application-panel/resources-panel-websql.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/application-panel/storage-view-reports-quota.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/bindings-frame-attach-detach.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/bindings-frame-navigate.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/bindings-main-frame-navigated.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/bindings-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/contentscripts-bindings-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/contentscripts-navigator-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/livelocation-main-frame-navigated.html [ Failure Timeout ] +crbug.com/591099 http/tests/devtools/bindings/navigator-frame-attach-detach.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/navigator-frame-navigate.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/navigator-main-frame-navigated.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/navigator-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/shadowdom-bindings.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/shadowdom-navigator.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/sourcemap-bindings-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/sourcemap-navigator-multiple-frames.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/suspendtarget-bindings.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/bindings/suspendtarget-navigator.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/command-line-api-inspect.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/compiler-script-mapping.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/compiler-source-mapping-debug.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-cd-completions.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/console-cd.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-completions.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-cross-origin-iframe-logging.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-resource-errors.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-show-all-messages.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-xhr-logging-async.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console-xhr-logging.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/console/console-links-on-messages-before-inspection.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions-headers.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions-iframe-eval.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions-ignore-cache.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions-network-redirect.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions-useragent.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-api.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-audits-api.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-audits-content-script.html [ Crash Failure Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-audits.html [ Crash Failure Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-eval-content-script.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-eval.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-events.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-network.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-panel.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/extensions/extensions-reload.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-resources.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/extensions/extensions-sidebar.html [ Crash Failure ] +crbug.com/591099 http/tests/devtools/extensions/extensions-timeline-api.html [ Crash Failure ] +crbug.com/591099 http/tests/devtools/extensions/multiple-extensions.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/forced-layout-in-microtask.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/fragment.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/database-data.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/database-names.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/database-refresh-view.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/indexeddb/database-structure.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/resources-panel.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/transaction-promise-console.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/indexeddb/upgrade-events.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/inline-source-map-loading.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/inspect-element.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/inspect-iframe-from-different-domain.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/modify-cross-domain-rule.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/network-preflight-options.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-absolute-paths.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-dynamic-uisourcecodes.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-git-folders.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-rename-files.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-sane.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/automapping-sourcemap-nameclash.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/filesystem-delete-file.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/navigator-create-file-copy.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-do-not-overwrite-css.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-go-to-file-dialog.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-merge-editor-tabs.html [ Crash Failure ] +crbug.com/591099 http/tests/devtools/persistence/persistence-mimetype-on-rename.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-move-breakpoints-on-reload.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-move-breakpoints.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-navigator.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-rename-mapped-file.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-search-across-all-files.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-sourceframe-messages.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-switch-editor-tab.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-sync-content-nodejs.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-sync-content.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/resource-har-conversion.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/resource-har-headers.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/resource-parameters-ipv6.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/resource-parameters.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/stylesheet-source-mapping.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/template-content-inspect-crash.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/text-source-map.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/tracing/timeline-network-received-data.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/tracing/timeline-receive-response-event.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/tracing/timeline-script-parse.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/tracing/timeline-xhr-event.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/tracing/timeline-xhr-response-type-blob-event.html [ Crash Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/tracing/websocket/timeline-websocket-event.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/websocket/network-preserve-selection-on-frame-receive.html [ Failure Pass Timeout ] +crbug.com/591099 http/tests/devtools/websocket/websocket-frame-error.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/websocket/websocket-frame.html [ Crash Failure Pass ] +crbug.com/591099 http/tests/devtools/websocket/websocket-handshake.html [ Failure Pass ] +crbug.com/591099 http/tests/devtools/workers-on-navigation.html [ Failure Pass ] crbug.com/591099 http/tests/loading/fire-error-event-empty-404-script.html [ Failure Pass ] crbug.com/591099 http/tests/loading/fire-error-event-script-no-content-type.html [ Failure Pass ] crbug.com/591099 http/tests/loading/preload-css-test.html [ Failure Pass ] @@ -13248,7 +13164,6 @@ crbug.com/591099 http/tests/workers/worker-workerScriptNotThere.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/XMLHttpRequestException.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/abort-should-destroy-responseText.html [ Failure Pass ] -crbug.com/591099 http/tests/xmlhttprequest/access-control-response-with-body-sync.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/async-xhr-revalidate-after-sync-xhr.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/authorization-header.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/binary-x-user-defined.html [ Failure Pass ] @@ -14569,9 +14484,9 @@ crbug.com/591099 plugins/release-frame-content-window.html [ Failure Pass ] crbug.com/591099 plugins/sequential-focus.html [ Failure Pass ] crbug.com/591099 plugins/tabindex.html [ Crash Failure ] -crbug.com/591099 plugins/webview-plugin-lifecycle.html [ Failure Pass ] -crbug.com/591099 plugins/webview-plugin-nested-iframe-scroll.html [ Failure ] -crbug.com/591099 plugins/webview-plugin-scroll.html [ Failure Pass ] +crbug.com/591099 plugins/webview-plugin-lifecycle.html [ Crash Failure Pass ] +crbug.com/591099 plugins/webview-plugin-nested-iframe-scroll.html [ Crash Failure ] +crbug.com/591099 plugins/webview-plugin-scroll.html [ Crash Failure Pass ] crbug.com/591099 plugins/webview-plugin-type-change.html [ Failure Pass ] crbug.com/591099 pointer-lock/bug90391-move-then-window-open-crash.html [ Failure Pass ] crbug.com/591099 pointer-lock/lock-already-locked.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService index ebe7243..82459a9 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
@@ -278,8 +278,8 @@ Bug(none) http/tests/fetch/window/fetch.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/fetch-base-https-other-https.html [ Failure Timeout ] Bug(none) http/tests/fetch/workers/fetch.html [ Failure Timeout ] -crbug.com/721408 http/tests/inspector/extensions-ignore-cache.html [ Crash ] -crbug.com/721408 http/tests/inspector/extensions-useragent.html [ Crash ] +crbug.com/721408 http/tests/devtools/extensions-ignore-cache.html [ Crash ] +crbug.com/721408 http/tests/devtools/extensions-useragent.html [ Crash ] crbug.com/721408 http/tests/devtools/network/load-resource-for-frontend.html [ Failure Timeout ] crbug.com/721408 http/tests/devtools/network/long-script-content.html [ Crash ] crbug.com/721408 http/tests/devtools/network/network-datareceived.html [ Failure ] @@ -287,7 +287,7 @@ crbug.com/721408 http/tests/devtools/network/network-worker-fetch.html [ Failure ] crbug.com/721408 http/tests/devtools/network/network-worker-fetch-parallel.html [ Failure ] crbug.com/721408 http/tests/devtools/network/x-frame-options-deny.html [ Failure ] -crbug.com/721408 http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order.html [ Crash ] +crbug.com/721408 http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order.html [ Crash ] crbug.com/721408 http/tests/inspector-protocol/cachestorage/read-cached-response.js [ Timeout ] crbug.com/721408 http/tests/inspector-protocol/network-data-length.js [ Failure ] crbug.com/721408 http/tests/inspector-protocol/network/disable-interception-midway.js [ Failure ] @@ -443,7 +443,6 @@ Bug(none) http/tests/websocket/cookie-document-to-ws.html [ Failure ] Bug(none) http/tests/websocket/cookie-http-to-ws.pl [ Failure ] Bug(none) http/tests/websocket/httponly-cookie.pl [ Failure ] -Bug(none) http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie.html [ Failure ] Bug(none) http/tests/xmlhttprequest/filename-encoding.html [ Failure ] Bug(none) http/tests/xmlhttprequest/simple-cross-origin-progress-events.html [ Failure Pass ] Bug(none) http/tests/xmlhttprequest/upload-onprogress-event.html [ Failure ] @@ -607,3 +606,14 @@ crbug.com/758675 presentation/presentation-start-error.html [ Timeout ] crbug.com/758675 presentation/presentation-start.html [ Timeout ] crbug.com/758675 presentation/presentationconnectionavailableevent-ctor-mock.html [ Timeout ] + +# Plugin throttle is not implemented. +crbug.com/764474 http/tests/security/contentSecurityPolicy/object-src-url-allowed.html [ Failure ] +crbug.com/764474 http/tests/security/contentSecurityPolicy/1.1/plugintypes-affects-cross-site-child-disallowed.html [ Failure ] +crbug.com/764474 http/tests/security/contentSecurityPolicy/object-src-does-not-affect-child.html [ Failure ] +crbug.com/764474 fast/frames/iframe-plugin-load-remove-document-crash.html [ Failure ] +crbug.com/764474 http/tests/security/contentSecurityPolicy/plugin-in-iframe-with-csp.html [ Failure ] +crbug.com/764474 http/tests/security/contentSecurityPolicy/1.1/plugintypes-affects-child.html [ Failure ] +crbug.com/764474 http/tests/security/contentSecurityPolicy/1.1/plugintypes-affects-cross-site-child-allowed.html [ Failure ] +crbug.com/764474 fast/loader/reload-zero-byte-plugin.html [ Failure ] +crbug.com/764474 plugins/plugin-document-back-forward.html [ Crash Failure Timeout ] \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 index 9b05039..a9c90db8 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
@@ -722,7 +722,6 @@ Bug(none) fast/multicol/newmulticol/hide-box-vertical-rl.html [ Failure ] Bug(none) fast/multicol/newmulticol/list-item.html [ Failure ] Bug(none) fast/multicol/newmulticol/table-cell.html [ Failure ] -Bug(none) fast/multicol/one-column-with-break.html [ Failure ] Bug(none) fast/multicol/out-of-flow/abspos-auto-position-on-line-at-boundary.html [ Failure ] Bug(none) fast/multicol/out-of-flow/abspos-auto-position-on-line-rtl.html [ Failure ] Bug(none) fast/multicol/out-of-flow/abspos-auto-position-on-line.html [ Failure ] @@ -743,7 +742,6 @@ Bug(none) fast/multicol/scrolling-overflow.html [ Failure ] Bug(none) fast/multicol/single-line.html [ Failure ] Bug(none) fast/multicol/span/abspos-containing-block-outside-spanner.html [ Failure ] -Bug(none) fast/multicol/span/adjacent-spanners.html [ Failure ] Bug(none) fast/multicol/span/after-row-with-uneven-height-nested-multicol.html [ Failure ] Bug(none) fast/multicol/span/as-inner-multicol.html [ Failure ] Bug(none) fast/multicol/span/balance-after-spanner-exact-fit.html [ Failure ] @@ -763,13 +761,11 @@ Bug(none) fast/multicol/span/invalid-spanner-in-abspos.html [ Failure ] Bug(none) fast/multicol/span/invalid-spanner-in-transform.html [ Failure ] Bug(none) fast/multicol/span/nested-multicol.html [ Failure ] -Bug(none) fast/multicol/span/relpos-in-block.html [ Failure ] Bug(none) fast/multicol/span/relpos-spanner-with-abspos-child.html [ Failure ] Bug(none) fast/multicol/span/remaining-space-in-last-column.html [ Failure ] Bug(none) fast/multicol/span/span-between-text.html [ Failure ] Bug(none) fast/multicol/span/spanner-first.html [ Failure ] Bug(none) fast/multicol/span/spanner-img.html [ Failure ] -Bug(none) fast/multicol/span/spanner-inline-block.html [ Failure ] Bug(none) fast/multicol/span/spanner-with-margin.html [ Failure ] Bug(none) fast/multicol/span/spanner-with-relpos-child.html [ Failure ] Bug(none) fast/multicol/span/summary-split.html [ Failure ] @@ -782,7 +778,6 @@ Bug(none) fast/multicol/table-cell-content-change-with-decorations.html [ Failure ] Bug(none) fast/multicol/table-margin-collapse.html [ Failure ] Bug(none) fast/multicol/tall-float2.html [ Failure ] -Bug(none) fast/multicol/text-shadow-at-column-boundaries.html [ Failure ] Bug(none) fast/multicol/transform-inside-opacity.html [ Failure ] Bug(none) fast/multicol/transform-with-fixedpos.html [ Crash ] Bug(none) fast/multicol/unbreakable-block-too-tall-at-column-start.html [ Failure ] @@ -1605,7 +1600,7 @@ Bug(none) virtual/threaded/compositing/visibility/visibility-image-layers.html [ Failure ] Bug(none) virtual/threaded/compositing/visibility/visibility-simple-video-layer.html [ Failure ] Bug(none) virtual/threaded/compositing/webgl/webgl-reflection.html [ Failure Crash ] -Bug(none) virtual/threaded/compositing/webgl/webgl-with-accelerated-background-color.html [ Failure ] +Bug(none) virtual/threaded/compositing/webgl/webgl-with-accelerated-background-color.html [ Failure Pass ] Bug(none) virtual/threaded/printing/ [ Skip ] # Tests that fail after changes to border dash painting, due to antialiasing differences
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process b/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process index 89a43a0..1e91e06 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process +++ b/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process
@@ -5,7 +5,7 @@ # (apparently https://crbug.com/599670 doesn't affect the Site Isolation bot, # so there is no need to carry-over the [ Failure ] expectation from baseline # expectations in LayoutTests/TestExpectations). -crbug.com/758075 http/tests/inspector/resource-parameters-ipv6.html [ Timeout ] +crbug.com/758075 http/tests/devtools/resource-parameters-ipv6.html [ Timeout ] # https://crbug.com/393285: Text-autosizing doesn't support OOPIFs. # https://crbug.com/667551: Pixel dumps don't support OOPIFs. @@ -42,10 +42,10 @@ crbug.com/582245 virtual/mojo-loading/http/tests/security/xssAuditor/full-block-script-tag-cross-domain.html [ Failure ] # https://crbug.com/582176 - InspectorTest.changeExecutionContext doesn't like OOPIFs. -crbug.com/582176 http/tests/inspector/console-cd-completions.html [ Failure ] -crbug.com/582176 http/tests/inspector/console-cd.html [ Failure ] -crbug.com/582176 virtual/mojo-loading/http/tests/inspector/console-cd-completions.html [ Failure ] -crbug.com/582176 virtual/mojo-loading/http/tests/inspector/console-cd.html [ Failure ] +crbug.com/582176 http/tests/devtools/console-cd-completions.html [ Failure ] +crbug.com/582176 http/tests/devtools/console-cd.html [ Failure ] +crbug.com/582176 virtual/mojo-loading/http/tests/devtools/console-cd-completions.html [ Failure ] +crbug.com/582176 virtual/mojo-loading/http/tests/devtools/console-cd.html [ Failure ] # https://crbug.com/608015 - node.contentDocument is undefined. crbug.com/608015 http/tests/inspector-protocol/access-inspected-object.js [ Failure Timeout ] @@ -121,12 +121,12 @@ crbug.com/623268 virtual/mojo-loading/http/tests/inspector-protocol/request-mixed-content-status-none.js [ Timeout ] crbug.com/623268 virtual/mojo-loading/http/tests/inspector-protocol/request-mixed-content-status-optionally-blockable.js [ Timeout ] crbug.com/623268 virtual/mojo-loading/http/tests/inspector-protocol/request-referrer-policy.js [ Timeout ] -crbug.com/623268 http/tests/inspector/console-cross-origin-iframe-logging.html [ Failure ] -crbug.com/623268 virtual/mojo-loading/http/tests/inspector/console-cross-origin-iframe-logging.html [ Failure ] +crbug.com/623268 http/tests/devtools/console-cross-origin-iframe-logging.html [ Failure ] +crbug.com/623268 virtual/mojo-loading/http/tests/devtools/console-cross-origin-iframe-logging.html [ Failure ] # https://crbug.com/623265 - cross-site navigation in main page breaks test. -crbug.com/623265 http/tests/inspector/indexeddb/resources-panel.html [ Timeout ] -crbug.com/623265 virtual/mojo-loading/http/tests/inspector/indexeddb/resources-panel.html [ Timeout ] +crbug.com/623265 http/tests/devtools/indexeddb/resources-panel.html [ Timeout ] +crbug.com/623265 virtual/mojo-loading/http/tests/devtools/indexeddb/resources-panel.html [ Timeout ] # https://crbug.com/645641 - test_runner.cc(1863) Check failed: # layout_test_runtime_flags_.have_top_loading_frame()
diff --git a/third_party/WebKit/LayoutTests/MSANExpectations b/third_party/WebKit/LayoutTests/MSANExpectations index cc73d81..fc684f5 100644 --- a/third_party/WebKit/LayoutTests/MSANExpectations +++ b/third_party/WebKit/LayoutTests/MSANExpectations
@@ -58,8 +58,8 @@ # marking them as "Timeout" while crbug.com/729136 is worked out. crbug.com/729136 [ Linux ] external/wpt/encoding/textdecoder-fatal-single-byte.html [ Timeout ] crbug.com/729136 [ Linux ] fast/css/css-selector-deeply-nested.html [ Timeout ] -crbug.com/729136 [ Linux ] http/tests/inspector/forced-layout-in-microtask.html [ Timeout ] -crbug.com/729136 [ Linux ] http/tests/inspector/tracing/timeline-xhr-response-type-blob-event.html [ Timeout ] +crbug.com/729136 [ Linux ] http/tests/devtools/forced-layout-in-microtask.html [ Timeout ] +crbug.com/729136 [ Linux ] http/tests/devtools/tracing/timeline-xhr-response-type-blob-event.html [ Timeout ] crbug.com/729136 [ Linux ] http/tests/devtools/components/file-path-scoring.html [ Timeout ] crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/components/file-path-scoring.html [ Timeout ] crbug.com/729136 [ Linux ] http/tests/devtools/elements/styles-4/styles-should-not-force-sync-style-recalc.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/NeverFixTests b/third_party/WebKit/LayoutTests/NeverFixTests index 3dcb2eeb..57017a8 100644 --- a/third_party/WebKit/LayoutTests/NeverFixTests +++ b/third_party/WebKit/LayoutTests/NeverFixTests
@@ -851,6 +851,7 @@ external/wpt/vibration/pattern-array-with-0-manual.html [ WontFix ] external/wpt/vibration/simple-array-manual.html [ WontFix ] external/wpt/vibration/simple-scalar-manual.html [ WontFix ] +external/wpt/viewport/viewport-attribute-event-handlers-manual.html [ WontFix ] external/wpt/viewport/viewport-dimensions-custom-scrollbars-manual.html [ WontFix ] external/wpt/viewport/viewport-dimensions-scrollbars-manual.html [ WontFix ] external/wpt/viewport/viewport-offset-manual.html [ WontFix ]
diff --git a/third_party/WebKit/LayoutTests/OWNERS b/third_party/WebKit/LayoutTests/OWNERS index 92d7595..72776863a 100644 --- a/third_party/WebKit/LayoutTests/OWNERS +++ b/third_party/WebKit/LayoutTests/OWNERS
@@ -2,3 +2,5 @@ per-file ImageFirstTests=set noparent per-file ImageFirstTests=file://third_party/WebKit/Source/core/layout/OWNERS +per-file SmokeTests=set noparent +per-file SmokeTests=file://third_party/WebKit/Tools/OWNERS
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests index 31f4962..34be1265 100644 --- a/third_party/WebKit/LayoutTests/SlowTests +++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -96,9 +96,9 @@ crbug.com/451577 [ Debug ] fast/dom/gc-treescope.html [ Slow ] crbug.com/451577 [ Debug ] fast/frames/calculate-round.html [ Slow ] crbug.com/451577 external/wpt/IndexedDB/idbindex-multientry-big.htm [ Slow ] -crbug.com/451577 [ Mac ] http/tests/inspector/extensions/extensions-reload.html [ Slow ] -crbug.com/451577 [ Mac ] http/tests/inspector/extensions/extensions-resources.html [ Slow ] -crbug.com/451577 [ Win10 ] http/tests/inspector/extensions/extensions-sidebar.html [ Slow ] +crbug.com/451577 [ Mac ] http/tests/devtools/extensions/extensions-reload.html [ Slow ] +crbug.com/451577 [ Mac ] http/tests/devtools/extensions/extensions-resources.html [ Slow ] +crbug.com/451577 [ Win10 ] http/tests/devtools/extensions/extensions-sidebar.html [ Slow ] crbug.com/451577 [ Mac ] http/tests/devtools/layers/layer-canvas-log.html [ Slow ] crbug.com/667560 [ Mac ] virtual/mojo-loading/http/tests/devtools/layers/layer-canvas-log.html [ Slow ] crbug.com/451577 [ Mac ] http/tests/devtools/network/network-domain-filter.html [ Slow ] @@ -121,8 +121,6 @@ ############################################################# # Most inspector tests are slow in Debug. -webkit.org/b/90488 [ Debug ] http/tests/inspector/ [ Slow ] -webkit.org/b/90488 [ Debug ] virtual/mojo-loading/http/tests/inspector/ [ Slow ] webkit.org/b/90488 [ Debug ] http/tests/inspector-enabled/ [ Slow ] webkit.org/b/90488 [ Debug ] virtual/mojo-loading/http/tests/inspector-enabled/ [ Slow ] webkit.org/b/90488 [ Debug ] inspector-protocol/ [ Slow ] @@ -138,26 +136,26 @@ crbug.com/420008 http/tests/devtools/tracing/ [ Slow ] crbug.com/420008 virtual/mojo-loading/http/tests/devtools/tracing/ [ Slow ] crbug.com/420008 virtual/threaded/http/tests/devtools/tracing/ [ Slow ] -crbug.com/246190 [ Release ] http/tests/inspector/indexeddb/ [ Slow ] -crbug.com/246190 [ Release ] virtual/mojo-loading/http/tests/inspector/indexeddb/ [ Slow ] -crbug.com/451577 [ Mac ] http/tests/inspector/extensions/extensions-sidebar.html [ Slow ] -crbug.com/451577 [ Mac ] http/tests/inspector/extensions/extensions-events.html [ Slow ] +crbug.com/246190 [ Release ] http/tests/devtools/indexeddb/ [ Slow ] +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 ] # Random slow tests -webkit.org/b/90488 [ Release ] http/tests/inspector/compiler-source-mapping-debug.html [ Slow ] -webkit.org/b/90488 [ Release ] virtual/mojo-loading/http/tests/inspector/compiler-source-mapping-debug.html [ Slow ] +webkit.org/b/90488 [ Release ] http/tests/devtools/compiler-source-mapping-debug.html [ Slow ] +webkit.org/b/90488 [ Release ] virtual/mojo-loading/http/tests/devtools/compiler-source-mapping-debug.html [ Slow ] crbug.com/243492 http/tests/inspector-enabled/injected-script-discard.html [ Slow ] crbug.com/243492 virtual/mojo-loading/http/tests/inspector-enabled/injected-script-discard.html [ Slow ] crbug.com/327078 http/tests/devtools/network/long-script-content.html [ Slow ] crbug.com/327078 virtual/mojo-loading/http/tests/devtools/network/long-script-content.html [ Slow ] crbug.com/420008 [ Release ] http/tests/devtools/editor/text-editor-word-jumps.html [ Slow ] crbug.com/667560 [ Release ] virtual/mojo-loading/http/tests/devtools/editor/text-editor-word-jumps.html [ Slow ] -crbug.com/420008 [ Release ] http/tests/inspector/console-xhr-logging.html [ Slow ] -crbug.com/420008 [ Release ] virtual/mojo-loading/http/tests/inspector/console-xhr-logging.html [ Slow ] +crbug.com/420008 [ Release ] http/tests/devtools/console-xhr-logging.html [ Slow ] +crbug.com/420008 [ Release ] virtual/mojo-loading/http/tests/devtools/console-xhr-logging.html [ Slow ] crbug.com/596486 [ Linux ] http/tests/devtools/elements/insert-node.html [ Slow ] crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/elements/insert-node.html [ Slow ] -webkit.org/b/84735 [ Win ] http/tests/inspector/change-iframe-src.html [ Slow ] -webkit.org/b/84735 [ Win ] virtual/mojo-loading/http/tests/inspector/change-iframe-src.html [ Slow ] +webkit.org/b/84735 [ Win ] http/tests/devtools/change-iframe-src.html [ Slow ] +webkit.org/b/84735 [ Win ] virtual/mojo-loading/http/tests/devtools/change-iframe-src.html [ Slow ] crbug.com/504565 [ Mac ] http/tests/devtools/search/sources-search-scope.html [ Slow ] crbug.com/504565 [ Mac ] virtual/mojo-loading/http/tests/devtools/search/sources-search-scope.html [ Slow ] crbug.com/451577 http/tests/devtools/resource-tree/resource-tree-crafted-frame-add.html [ Slow ] @@ -233,7 +231,7 @@ crbug.com/241576 [ Win ] virtual/mojo-loading/http/tests/appcache/404-manifest.html [ Slow ] crbug.com/241869 [ Debug ] css3/flexbox/multiline-justify-content.html [ Slow ] crbug.com/245154 editing/selection/modify_move/move-by-character-brute-force.html [ Slow ] -crbug.com/246749 http/tests/inspector/extensions/extensions-panel.html [ Slow ] +crbug.com/246749 http/tests/devtools/extensions/extensions-panel.html [ Slow ] # This test takes 5+ seconds as intended because it tests connection throttling. crbug.com/459377 http/tests/websocket/multiple-connections-throttled.html [ Slow ] @@ -283,8 +281,8 @@ crbug.com/480769 virtual/mojo-loading/http/tests/devtools/service-workers/service-worker-agents.html [ Slow ] crbug.com/504703 inspector-protocol/debugger/debugger-step-into-dedicated-worker.js [ Slow ] crbug.com/535478 [ Win ] virtual/threaded/http/tests/devtools/tracing/decode-resize.html [ Slow ] -crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Slow ] -crbug.com/548765 virtual/mojo-loading/http/tests/inspector/console-fetch-logging.html [ Slow ] +crbug.com/548765 http/tests/devtools/console-fetch-logging.html [ Slow ] +crbug.com/548765 virtual/mojo-loading/http/tests/devtools/console-fetch-logging.html [ Slow ] crbug.com/419993 [ Debug ] fast/css/giant-stylesheet-crash.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/SmokeTests b/third_party/WebKit/LayoutTests/SmokeTests index af52760..829d6ab 100644 --- a/third_party/WebKit/LayoutTests/SmokeTests +++ b/third_party/WebKit/LayoutTests/SmokeTests
@@ -980,11 +980,14 @@ virtual/gpu-rasterization/images/drag-image-descendant-painting-sibling.html virtual/layout_ng/fast/block/float/floats-not-cleared-crash.html virtual/layout_ng/fast/block/float/positioned-float-crash.html + +# Include //media/OWNERS on review of changes to media-gpu-accelerated SmokeTests coverage. virtual/media-gpu-accelerated/media/video-autoplay.html virtual/media-gpu-accelerated/http/tests/media/media-source/mediasource-play.html virtual/media-gpu-accelerated/http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html virtual/media-gpu-accelerated/http/tests/media/media-source/mediasource-config-change-mp4-av-framesize.html virtual/media-gpu-accelerated/http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html + virtual/layout_ng/fast/block/margin-collapse/019.html virtual/mojo-loading/http/tests/htmlimports/csp-block-import.html virtual/mojo-localstorage/external/wpt/webstorage/storage_enumerate.html
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 477922a..a975a85 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -89,6 +89,9 @@ crbug.com/726075 [ Win ] external/wpt/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html [ Failure ] crbug.com/726075 [ Win Debug ] virtual/exotic-color-space/images/color-profile-border-fade.html [ Failure ] +# Fails because the manual test hasn't been automated yet +crbug.com/762054 external/wpt/cssom-view/scrollBoundaryBehavior-manual.html [ Skip ] + # Fails consistently on WebKit Mac10.10, WebKit Mac10.11 (retina) and mac10.10_blink_rel tryserver, but not on other Mac bots. crbug.com/614910 [ Mac ] virtual/gpu-rasterization/images/pixel-crack-image-background-webkit-transform-scale.html [ Pass Failure ] @@ -104,9 +107,6 @@ # Should make a pixel test to keep coverage. crbug.com/713891 virtual/exotic-color-space/images/animated-png.html [ Pass Failure ] -crbug.com/717389 [ Linux Debug ] virtual/gpu/fast/canvas/canvas-clip-rule.html [ Crash ] -crbug.com/717389 [ Win7 Debug ] virtual/gpu/fast/canvas/canvas-clip-rule.html [ Timeout ] - # Flakily timing out or failing. # TODO(ccameron): Investigate this. crbug.com/730267 virtual/gpu-rasterization/images/color-profile-group.html [ Pass Timeout Failure ] @@ -633,7 +633,7 @@ crbug.com/520611 [ Debug ] fast/filesystem/workers/file-writer-events-shared-worker.html [ Failure Pass ] crbug.com/520194 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-overridesexpires.html [ Failure Pass ] -crbug.com/749251 [ Mac ] http/tests/inspector/application-panel/resources-panel-websql.html [ Failure Pass ] +crbug.com/749251 [ Mac ] http/tests/devtools/application-panel/resources-panel-websql.html [ Failure Pass ] crbug.com/761798 [ Mac ] inspector-protocol/emulation/device-emulation-desktop.js [ Failure ] @@ -722,14 +722,14 @@ crbug.com/731731 inspector-protocol/layers/paint-profiler-load-empty.js [ Failure Pass ] -crbug.com/734744 http/tests/inspector/indexeddb/resources-panel.html [ Pass Failure Timeout ] -crbug.com/734744 virtual/mojo-loading/http/tests/inspector/indexeddb/resources-panel.html [ Pass Failure Timeout ] +crbug.com/734744 http/tests/devtools/indexeddb/resources-panel.html [ Pass Failure Timeout ] +crbug.com/734744 virtual/mojo-loading/http/tests/devtools/indexeddb/resources-panel.html [ Pass Failure Timeout ] -crbug.com/734793 http/tests/inspector/indexeddb/database-names.html [ Pass Failure Timeout ] -crbug.com/734793 virtual/mojo-loading/http/tests/inspector/indexeddb/database-names.html [ Pass Failure Timeout ] +crbug.com/734793 http/tests/devtools/indexeddb/database-names.html [ Pass Failure Timeout ] +crbug.com/734793 virtual/mojo-loading/http/tests/devtools/indexeddb/database-names.html [ Pass Failure Timeout ] -crbug.com/735259 http/tests/inspector/indexeddb/upgrade-events.html [ Pass Failure ] -crbug.com/735259 virtual/mojo-loading/http/tests/inspector/indexeddb/upgrade-events.html [ Pass Failure ] +crbug.com/735259 http/tests/devtools/indexeddb/upgrade-events.html [ Pass Failure ] +crbug.com/735259 virtual/mojo-loading/http/tests/devtools/indexeddb/upgrade-events.html [ Pass Failure ] # Will be re-enabled and rebaselined once we remove the '--enable-file-cookies' flag. crbug.com/470482 fast/cookies/local-file-can-set-cookies.html [ Skip ] @@ -780,8 +780,8 @@ crbug.com/552494 virtual/prefer_compositing_to_lcd_text/scrollbars/overflow-scrollbar-combinations.html [ Pass Failure ] crbug.com/552494 virtual/rootlayerscrolls/scrollbars/overflow-scrollbar-combinations.html [ Pass Failure ] -crbug.com/659456 http/tests/inspector/persistence/automapping-sourcemap.html [ Pass Failure ] -crbug.com/659456 virtual/mojo-loading/http/tests/inspector/persistence/automapping-sourcemap.html [ Pass Failure ] +crbug.com/659456 http/tests/devtools/persistence/automapping-sourcemap.html [ Pass Failure ] +crbug.com/659456 virtual/mojo-loading/http/tests/devtools/persistence/automapping-sourcemap.html [ Pass Failure ] crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphen-min-preferred-width-mock.html [ Skip ] crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphens-align.html [ Skip ] @@ -1180,8 +1180,8 @@ crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Pass Failure ] crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/track-scroll.html [ Pass Failure ] -crbug.com/599670 [ Win Linux ] http/tests/inspector/resource-parameters-ipv6.html [ Failure Pass ] -crbug.com/599670 [ Win Linux ] virtual/mojo-loading/http/tests/inspector/resource-parameters-ipv6.html [ Failure Pass ] +crbug.com/599670 [ Win Linux ] http/tests/devtools/resource-parameters-ipv6.html [ Failure Pass ] +crbug.com/599670 [ Win Linux ] virtual/mojo-loading/http/tests/devtools/resource-parameters-ipv6.html [ Failure Pass ] crbug.com/472330 fast/borders/border-image-outset-split-inline-vertical-lr.html [ Failure ] crbug.com/472330 fast/writing-mode/box-shadow-vertical-lr.html [ Failure ] crbug.com/472330 fast/writing-mode/box-shadow-vertical-rl.html [ Failure ] @@ -1487,10 +1487,10 @@ crbug.com/546215 [ Android ] fast/inline-block/overflow-clip.html [ Failure ] -crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Failure Pass ] -crbug.com/548765 virtual/mojo-loading/http/tests/inspector/console-fetch-logging.html [ Failure Pass ] +crbug.com/548765 http/tests/devtools/console-fetch-logging.html [ Failure Pass ] +crbug.com/548765 virtual/mojo-loading/http/tests/devtools/console-fetch-logging.html [ Failure Pass ] -crbug.com/564109 [ Win ] external/wpt/css-font-display/font-display.html [ Pass Failure Timeout ] +crbug.com/564109 [ Win ] external/wpt/css-fonts/font-display/font-display.html [ Failure Pass Timeout ] crbug.com/564109 [ Win ] http/tests/webfont/font-display-intervention.html [ Pass Failure Timeout ] crbug.com/564109 [ Win ] virtual/mojo-loading/http/tests/webfont/font-display-intervention.html [ Pass Failure Timeout ] @@ -1706,26 +1706,25 @@ # These tests have machine-dependent names in the output (e.g. ... debugger:///VM37 ...) # # which makes them have different results on different machines. -crbug.com/763718 http/tests/inspector/bindings/livelocation-main-frame-navigated.html [ Pass Failure ] -crbug.com/763718 virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated.html [ Pass Failure ] +crbug.com/763718 http/tests/devtools/bindings/livelocation-main-frame-navigated.html [ Pass Failure ] +crbug.com/763718 virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated.html [ Pass Failure ] # Untriaged failures after https://crrev.com/c/543695/. # These need to be updated but appear not to be related to that change. -crbug.com/626703 http/tests/inspector/indexeddb/database-refresh-view.html [ Pass Failure ] -crbug.com/626703 virtual/mojo-loading/http/tests/inspector/indexeddb/database-refresh-view.html [ Pass Failure ] +crbug.com/626703 http/tests/devtools/indexeddb/database-refresh-view.html [ Pass Failure ] +crbug.com/626703 virtual/mojo-loading/http/tests/devtools/indexeddb/database-refresh-view.html [ Pass Failure ] crbug.com/626703 http/tests/devtools/network/network-filters.html [ Pass Failure ] crbug.com/626703 virtual/mojo-loading/http/tests/devtools/network/network-filters.html [ Pass Failure ] -crbug.com/626703 http/tests/inspector/application-panel/resources-panel-selection-on-reload.html [ Pass Failure ] -crbug.com/626703 virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload.html [ Pass Failure ] -crbug.com/626703 http/tests/inspector/extensions/extensions-sidebar.html [ Pass Failure ] -crbug.com/626703 virtual/mojo-loading/http/tests/inspector/extensions/extensions-sidebar.html [ Pass Failure ] +crbug.com/626703 http/tests/devtools/application-panel/resources-panel-selection-on-reload.html [ Pass Failure ] +crbug.com/626703 virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload.html [ Pass Failure ] +crbug.com/626703 http/tests/devtools/extensions/extensions-sidebar.html [ Pass Failure ] +crbug.com/626703 virtual/mojo-loading/http/tests/devtools/extensions/extensions-sidebar.html [ Pass Failure ] crbug.com/626703 http/tests/devtools/network/network-columns-visible.html [ Pass Failure ] crbug.com/626703 virtual/mojo-loading/http/tests/devtools/network/network-columns-visible.html [ Pass Failure ] -crbug.com/626703 http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Pass Failure ] -crbug.com/626703 virtual/mojo-loading/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Pass Failure ] +crbug.com/626703 http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Pass Failure ] +crbug.com/626703 virtual/mojo-loading/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html [ Pass Failure ] crbug.com/626703 virtual/threaded/transitions/transition-end-event-multiple-03.html [ Pass Failure ] crbug.com/751952 external/wpt/editing/run/forwarddelete.html [ Failure Pass Timeout ] -crbug.com/751952 external/wpt/beacon/headers/header-content-type.html [ Failure Pass Timeout ] crbug.com/751952 fast/text/international/complex-text-rectangle.html [ Timeout Pass ] crbug.com/751952 editing/selection/modify_extend/extend_by_character.html [ Pass Failure ] crbug.com/751952 fast/dom/Range/getClientRects.html [ Pass Failure ] @@ -1761,6 +1760,7 @@ crbug.com/626703 external/wpt/beacon/beacon-cors.sub.window.html [ Timeout ] crbug.com/626703 external/wpt/beacon/beacon-navigate.html [ Timeout ] crbug.com/626703 external/wpt/beacon/beacon-redirect.window.html [ Timeout ] +crbug.com/626703 external/wpt/beacon/headers/header-content-type.html [ Pass Timeout ] crbug.com/626703 external/wpt/css/css-fonts-3/alternates-order.html [ Failure ] crbug.com/626703 external/wpt/css/css-fonts-3/font-family-name-000.xht [ Skip ] crbug.com/626703 external/wpt/css/css-fonts-3/font-family-name-001.xht [ Skip ] @@ -2334,8 +2334,8 @@ crbug.com/660295 http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.html [ Pass Failure ] crbug.com/667560 virtual/mojo-loading/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.html [ Pass Failure ] -crbug.com/735245 http/tests/inspector/application-panel/storage-view-reports-quota.html [ Pass Timeout Failure ] -crbug.com/735245 virtual/mojo-loading/http/tests/inspector/application-panel/storage-view-reports-quota.html [ Pass Timeout Failure ] +crbug.com/735245 http/tests/devtools/application-panel/storage-view-reports-quota.html [ Pass Timeout Failure ] +crbug.com/735245 virtual/mojo-loading/http/tests/devtools/application-panel/storage-view-reports-quota.html [ Pass Timeout Failure ] # [css-grid] crbug.com/659610 fast/css-grid-layout/grid-baseline.html [ Failure ] @@ -2383,8 +2383,8 @@ crbug.com/657646 [ Win ] fast/text/drawBidiText.html [ Failure Pass ] crbug.com/657646 [ Win ] fast/text/font-features/caps-native-synthesis.html [ Failure Pass ] -crbug.com/664450 http/tests/inspector/console/console-on-animation-worklet.html [ Skip ] -crbug.com/664450 virtual/mojo-loading/http/tests/inspector/console/console-on-animation-worklet.html [ Skip ] +crbug.com/664450 http/tests/devtools/console/console-on-animation-worklet.html [ Skip ] +crbug.com/664450 virtual/mojo-loading/http/tests/devtools/console/console-on-animation-worklet.html [ Skip ] # Fail when run with --enable-wptserve due to data: URLs treated as cross-origin: (crbug.com/508730) crbug.com/508730 external/wpt/dom/nodes/Document-contentType/contentType/contenttype_datauri_02.html [ Failure ] @@ -2719,8 +2719,8 @@ crbug.com/680050 http/tests/devtools/sources/debugger-ui/watch-expressions-panel-switch.html [ Pass Timeout ] crbug.com/667560 virtual/mojo-loading/http/tests/devtools/sources/debugger-ui/watch-expressions-panel-switch.html [ Pass Timeout ] -crbug.com/747751 http/tests/inspector/application-panel/resources-panel-resource-preview.html [ Failure Pass ] -crbug.com/747751 virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-resource-preview.html [ Failure Pass ] +crbug.com/747751 http/tests/devtools/application-panel/resources-panel-resource-preview.html [ Failure Pass ] +crbug.com/747751 virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-resource-preview.html [ Failure Pass ] crbug.com/689781 external/wpt/media-source/mediasource-duration.html [ Failure Pass ] @@ -2784,8 +2784,8 @@ # Sheriff failures 2017-03-10 crbug.com/741210 [ Mac ] inspector-protocol/emulation/device-emulation-restore.js [ Failure ] -crbug.com/700374 [ Win ] virtual/mojo-loading/http/tests/inspector/workers-on-navigation.html [ Failure Pass ] -crbug.com/700374 [ Win ] http/tests/inspector/workers-on-navigation.html [ Failure Pass ] +crbug.com/700374 [ Win ] virtual/mojo-loading/http/tests/devtools/workers-on-navigation.html [ Failure Pass ] +crbug.com/700374 [ Win ] http/tests/devtools/workers-on-navigation.html [ Failure Pass ] # Sheriff failures 2017-03-21 crbug.com/703518 http/tests/devtools/tracing/worker-js-frames.html [ Failure Pass ] @@ -2893,8 +2893,8 @@ # Sheriff failures 2017-06-14 crbug.com/733357 [ Win Mac ] http/tests/devtools/elements/styles-4/styles-history.html [ Failure Pass ] crbug.com/667560 [ Win Mac ] virtual/mojo-loading/http/tests/devtools/elements/styles-4/styles-history.html [ Failure Pass ] -crbug.com/733448 http/tests/inspector/extensions/extensions-network.html [ Failure Pass ] -crbug.com/733448 virtual/mojo-loading/http/tests/inspector/extensions/extensions-network.html [ Failure Pass ] +crbug.com/733448 http/tests/devtools/extensions/extensions-network.html [ Failure Pass ] +crbug.com/733448 virtual/mojo-loading/http/tests/devtools/extensions/extensions-network.html [ Failure Pass ] # Sheriff failures 2017-06-23 crbug.com/736548 [ Mac ] css2.1/t040304-c64-uri-00-a-g.html [ Failure Pass ] @@ -3043,7 +3043,6 @@ crbug.com/708994 virtual/mojo-loading/http/tests/security/cross-frame-mouse-source-capabilities.html [ Timeout Pass ] crbug.com/745887 [ Mac Win ] fast/frames/sandboxed-iframe-plugins.html [ Failure Pass ] -crbug.com/745899 [ Linux ] vr/getFrameData_samewithinframe.html [ Failure Pass ] crbug.com/626703 [ Win7 ] external/wpt/domxpath/xml_xpath_runner.html [ Timeout Pass ] @@ -3057,8 +3056,37 @@ crbug.com/747163 [ Linux ] imagecapture/MediaStreamTrack-applyConstraints.html [ Pass Crash ] crbug.com/747163 [ Linux ] imagecapture/MediaStreamTrack-getSettings.html [ Pass Crash ] -crbug.com/749738 [ Win7 Debug ] http/tests/devtools/console/console-format-es6.js [ Timeout ] -crbug.com/749738 [ Win7 Debug ] virtual/mojo-loading/http/tests/devtools/console/console-format-es6.js [ Timeout ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/console/console-eval-scoped.js [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/console/console-functions.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/console/console-log-object-with-getter.js [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/elements/event-listener-sidebar-jquery1.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/elements/event-listener-sidebar-jquery2.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/elements/event-listener-sidebar.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/runtime/runtime-getProperties.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/sources/debugger-ui/function-generator-details.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/sources/debugger/properties-special.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/persistence/automapping-sourcemap-nameclash.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/persistence/automapping-sourcemap-nameclash.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 inspector-protocol/debugger/domdebugger-getEventListeners.js [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/console/console-eval-scoped.js [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/console/console-functions.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/console/console-log-object-with-getter.js [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/elements/event-listener-sidebar-jquery1.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/elements/event-listener-sidebar-jquery2.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/elements/event-listener-sidebar.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/runtime/runtime-getProperties.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/sources/debugger-ui/function-generator-details.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion.html [ NeedsManualRebaseline ] +crbug.com/v8/4958 http/tests/devtools/sources/debugger/properties-special.html [ NeedsManualRebaseline ] + +crbug.com/v8/4958 http/tests/devtools/console/console-format-es6.js [ NeedsManualRebaseline Timeout ] +crbug.com/v8/4958 virtual/mojo-loading/http/tests/devtools/console/console-format-es6.js [ NeedsManualRebaseline Timeout ] +# http/tests/devtools/console/console-format-es6.js and its virtual counterpart needs attention, but is listed as NeedsManualRebaseline directly above for all platforms +# crbug.com/749738 [ Win7 Debug ] http/tests/devtools/console/console-format-es6.js [ Timeout ] +# crbug.com/749738 [ Win7 Debug ] virtual/mojo-loading/http/tests/devtools/console/console-format-es6.js [ Timeout ] crbug.com/749738 [ Win7 Debug ] http/tests/devtools/editor/text-editor-word-jumps.html [ Timeout ] crbug.com/667560 [ Win7 Debug ] virtual/mojo-loading/http/tests/devtools/editor/text-editor-word-jumps.html [ Timeout ] @@ -3474,7 +3502,7 @@ crbug.com/757165 [ Win ] fast/spatial-navigation/snav-z-index.html [ Pass Failure Timeout Crash ] crbug.com/757165 [ Win ] http/tests/devtools/console/console-filter-test.js [ Skip ] crbug.com/757165 [ Win ] http/tests/devtools/console/console-links-in-errors-with-trace.js [ Skip ] -crbug.com/757165 [ Win ] http/tests/inspector/extensions/extensions-panel.html [ Skip ] +crbug.com/757165 [ Win ] http/tests/devtools/extensions/extensions-panel.html [ Skip ] crbug.com/757165 [ Win ] http/tests/devtools/sources/ui-source-code-metadata.html [ Skip ] crbug.com/757165 [ Win ] http/tests/misc/client-hints-accept-meta-preloader.html [ Skip ] crbug.com/757165 [ Win ] inspector-protocol/debugger/debugger-evaluate-in-worker-while-pause-in-page.js [ Skip ] @@ -3485,7 +3513,7 @@ crbug.com/757165 [ Win ] virtual/gpu/fast/canvas/canvas-filter-modified.html [ Skip ] crbug.com/757165 [ Win ] virtual/mojo-loading/http/tests/devtools/console/console-filter-test.js [ Skip ] crbug.com/757165 [ Win ] virtual/mojo-loading/http/tests/devtools/console/console-links-in-errors-with-trace.js [ Skip ] -crbug.com/757165 [ Win ] virtual/mojo-loading/http/tests/inspector/extensions/extensions-panel.html [ Skip ] +crbug.com/757165 [ Win ] virtual/mojo-loading/http/tests/devtools/extensions/extensions-panel.html [ Skip ] crbug.com/757165 [ Win ] virtual/threaded/animations/svg/animated-filter-svg-element.html [ Skip ] crbug.com/757165 [ Win ] virtual/wheelscrolllatching/fast/compositor-wheel-scroll-latching/touchpad-scroll-impl-to-main.html [ Skip ] crbug.com/626703 [ Win Debug ] external/wpt/encoding/legacy-mb-korean/euc-kr/euckr-encode-href-errors-han.html [ Skip ] @@ -3630,6 +3658,9 @@ # Test flaky (crashing) on WebKit Android (Nexus4) crbug.com/762008 [ Android ] http/tests/appcache/abort-cache-onchecking-resource-404.html [ Pass Crash ] +# Editing commands incorrectly assume no plain text length change after formatting text. +crbug.com/764489 editing/execCommand/format-block-multiple-paragraphs-in-pre.html [ Failure ] + # Sheriff failure 2017-09-06 crbug.com/762390 [ Android ] http/tests/devtools/console/only-one-deprecation-warning.html [ Pass Crash ] crbug.com/762423 [ Android ] http/tests/dom/create-contextual-fragment-from-svg-document-range.html [ Pass Crash ] @@ -3648,5 +3679,11 @@ crbug.com/763975 [ Linux Debug ] webaudio/internals/cycle-connection-gc.html [ Pass Failure ] # Sheriff failures 2017-09-12 -crbug.com/764179 [ Mac10.11 ] virtual/gpu-rasterization/images/color-profile-background-image-space.html [ Pass Failure ] +# Temporarily disabling this for JPEG change. Restore after fixes for 763605 are rebaselined. +# crbug.com/764179 [ Mac10.11 ] virtual/gpu-rasterization/images/color-profile-background-image-space.html [ Pass Failure ] crbug.com/764180 [ Android ] virtual/display_list_2d_canvas/fast/canvas/script-inside-canvas-fallback.html [ Pass Crash ] + +# JPEG decoding change in Skia +crbug.com/763605 virtual/gpu-rasterization/images/color-profile-background-image-space.html [ NeedsManualRebaseline ] +crbug.com/763605 virtual/gpu-rasterization/images/color-profile-svg-fill-text.html [ NeedsManualRebaseline ] +crbug.com/763605 virtual/gpu-rasterization/images/color-profile-svg.html [ NeedsManualRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/accessibility/aria-controls-with-tabs-expected.txt b/third_party/WebKit/LayoutTests/accessibility/aria-controls-with-tabs-expected.txt index 7e3bcbf..461958eb 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aria-controls-with-tabs-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/aria-controls-with-tabs-expected.txt
@@ -1,9 +1,7 @@ Crust Veges Test - Select Crust - Select Crust This tests that the aria tab item becomes selected if either aria-selected is used, or if aria-controls points to an item that contains KB focus.
diff --git a/third_party/WebKit/LayoutTests/accessibility/aria-none-role-expected.txt b/third_party/WebKit/LayoutTests/accessibility/aria-none-role-expected.txt index eb08a374..13be9a8 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aria-none-role-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/aria-none-role-expected.txt
@@ -1,5 +1,4 @@ Link and text - This tests that the aria 'none' role works by successfully removing the element from the AX tree. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/WebKit/LayoutTests/accessibility/aria-presentational-role-expected.txt b/third_party/WebKit/LayoutTests/accessibility/aria-presentational-role-expected.txt index 17fb1b8..e98ba3a 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aria-presentational-role-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/aria-presentational-role-expected.txt
@@ -1,5 +1,4 @@ Link and text - This tests that the aria 'presentation' role works by successfully removing the element from the AX tree. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/WebKit/LayoutTests/accessibility/aria-tab-roles-expected.txt b/third_party/WebKit/LayoutTests/accessibility/aria-tab-roles-expected.txt index bb19768..3eee612 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aria-tab-roles-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/aria-tab-roles-expected.txt
@@ -1,7 +1,6 @@ Crust Veges Select Crust - This tests that the aria roles for tab, tabpanel and tablist work as expected correctly. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/WebKit/LayoutTests/accessibility/contenteditable-hidden-div-expected.txt b/third_party/WebKit/LayoutTests/accessibility/contenteditable-hidden-div-expected.txt index 15ecbcf7..b8881d60 100644 --- a/third_party/WebKit/LayoutTests/accessibility/contenteditable-hidden-div-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/contenteditable-hidden-div-expected.txt
@@ -1,5 +1,4 @@ test - This tests that a contenteditable element will not be ignored by accessibility. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types-expected.txt b/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types-expected.txt index b332db4d..7800962 100644 --- a/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types-expected.txt +++ b/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types-expected.txt
@@ -11,7 +11,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS eventSrcElement == document.getElementById('container') is true +PASS eventSrcElement == document.getElementById('group') is true PASS eventSrcElement == document.getElementById('button') is true PASS eventSrcElement == document.getElementById('tab') is true PASS eventSrcElement == document.getElementById('radio') is true
diff --git a/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types.html b/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types.html index 979271c5..2f37a7f 100644 --- a/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types.html +++ b/third_party/WebKit/LayoutTests/accessibility/press-works-on-control-types.html
@@ -28,10 +28,12 @@ function handlePress(e) { eventSrcElement = e.srcElement; - // First press was on the group element. That is not a control type and it should - // have caused the container to be the target element instead of the group element. + // First press was on the group element. Even though that isn't a control + // type, that was the element pressed, and the page should be given an + // accurate target. The press will eventually bubble up to any ancestor + // listeners. if (pressCount == 0) - shouldBeTrue("eventSrcElement == document.getElementById('container')"); + shouldBeTrue("eventSrcElement == document.getElementById('group')"); else if (pressCount == 1) shouldBeTrue("eventSrcElement == document.getElementById('button')"); else if (pressCount == 2)
diff --git a/third_party/WebKit/LayoutTests/accessibility/set-selection-child-offset.html b/third_party/WebKit/LayoutTests/accessibility/set-selection-child-offset.html index 8c3f2d3d..483a29e 100644 --- a/third_party/WebKit/LayoutTests/accessibility/set-selection-child-offset.html +++ b/third_party/WebKit/LayoutTests/accessibility/set-selection-child-offset.html
@@ -52,7 +52,7 @@ assert_equals(sel.startContainer.textContent, "this is a"); // Select the second child. - axRegion.setSelection(axRegion, 1, axRegion, 2); + axRegion.setSelection(axRegion, 1, axRegion, 3); updateSelectedRangeFromPage(); assert_equals(sel.toString(), "test\n"); assert_false(sel.collapsed); @@ -65,7 +65,7 @@ assert_equals(sel.endContainer.textContent, "\n "); // Next, another insertion point between second and third child. - axRegion.setSelection(axRegion, 2, axRegion, 2); + axRegion.setSelection(axRegion, 3, axRegion, 3); updateSelectedRangeFromPage(); assert_equals(sel.toString(), ""); assert_true(sel.collapsed); @@ -74,7 +74,7 @@ assert_equals(sel.startContainer.textContent, "\n "); // Select the third child. - axRegion.setSelection(axRegion, 2, axRegion, 3); + axRegion.setSelection(axRegion, 3, axRegion, 4); updateSelectedRangeFromPage(); assert_equals(sel.toString(), "of selection"); assert_false(sel.collapsed); @@ -86,7 +86,7 @@ assert_equals(sel.endContainer.textContent, "of selection"); // Select the first and second children. - axRegion.setSelection(axRegion, 0, axRegion, 2); + axRegion.setSelection(axRegion, 0, axRegion, 3); updateSelectedRangeFromPage(); assert_equals(sel.toString(), "this is atest\n"); assert_false(sel.collapsed); @@ -98,7 +98,7 @@ assert_equals(sel.endContainer.textContent, "\n "); // Select the second and third children. - axRegion.setSelection(axRegion, 1, axRegion, 3); + axRegion.setSelection(axRegion, 1, axRegion, 4); updateSelectedRangeFromPage(); assert_equals(sel.toString(), "test\n of selection"); assert_false(sel.collapsed); @@ -110,7 +110,7 @@ assert_equals(sel.endContainer.textContent, "of selection"); // Select everything. - axRegion.setSelection(axRegion, 0, axRegion, 3); + axRegion.setSelection(axRegion, 0, axRegion, 4); updateSelectedRangeFromPage(); assert_equals(sel.toString(), "this is atest\n of selection"); assert_false(sel.collapsed); @@ -122,7 +122,7 @@ assert_equals(sel.endContainer.textContent, "of selection"); // Last, the insertion point after third child. - axRegion.setSelection(axRegion, 3, axRegion, 3); + axRegion.setSelection(axRegion, 4, axRegion, 4); updateSelectedRangeFromPage(); assert_equals(sel.toString(), ""); assert_true(sel.collapsed);
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash-expected.txt b/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash-expected.txt deleted file mode 100644 index aa6e4c7d..0000000 --- a/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash-expected.txt +++ /dev/null
@@ -1,2 +0,0 @@ -> -The test passes if the page does not crash.
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash.html b/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash.html index 86485e9..71825fa 100644 --- a/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash.html +++ b/third_party/WebKit/LayoutTests/editing/execCommand/inserting-ordered-list-crash.html
@@ -1,21 +1,40 @@ -<!DOCTYPE html> -<html> -<body> -<input> -<hr> -> +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> <script> - if (window.testRunner) - testRunner.dumpAsText(); - - document.designMode = 'on'; - document.execCommand('SelectAll'); - document.execCommand('Strikethrough'); - document.execCommand('InsertOrderedList'); - window.getSelection().deleteFromDocument(); - document.execCommand('SelectAll'); - document.execCommand('Strikethrough'); - document.write('The test passes if the page does not crash.'); +// This is a test for crash bag for https://crbug.com/343799. +test(()=> assert_selection( + [ + "<div contenteditable>", + "<strike>", + "^<input>", + "</strike>", + "<hr>", + "<strike>", + ">|", + "</strike>", + "</div>" + ] , + 'InsertOrderedList', + [ + "<div contenteditable>", + "<ol>", + "<li>", + "<strike>", + "^<input>", + "</strike>", + "</li>", + "<li>", + "<hr>|", + "</li>", + "<li>", + "<strike>", + ">", + "</strike>", + "</li>", + "</ol>", + "</div>" + ]), + "This InsertOrderedList should not cause page crash."); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/editing/selection/drag-start-event-client-x-y-expected.txt b/third_party/WebKit/LayoutTests/editing/selection/drag-start-event-client-x-y-expected.txt index ecb4236..ce53859 100644 --- a/third_party/WebKit/LayoutTests/editing/selection/drag-start-event-client-x-y-expected.txt +++ b/third_party/WebKit/LayoutTests/editing/selection/drag-start-event-client-x-y-expected.txt
@@ -1,5 +1,4 @@ Test for WebKit bug 26723: clientX,Y , screenX , Y always (0, 0) in dragstart event - DRAG ME! SUCCESS Expected 119 for clientX and got it.
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 09af48f..290af00 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -2725,6 +2725,12 @@ {} ] ], + "cssom-view/scrollBoundaryBehavior-manual.html": [ + [ + "/cssom-view/scrollBoundaryBehavior-manual.html", + {} + ] + ], "fullscreen/api/document-exit-fullscreen-manual.html": [ [ "/fullscreen/api/document-exit-fullscreen-manual.html", @@ -4591,6 +4597,12 @@ {} ] ], + "viewport/viewport-attribute-event-handlers-manual.html": [ + [ + "/viewport/viewport-attribute-event-handlers-manual.html", + {} + ] + ], "viewport/viewport-dimensions-custom-scrollbars-manual.html": [ [ "/viewport/viewport-dimensions-custom-scrollbars-manual.html", @@ -5511,12 +5523,12 @@ {} ] ], - "css-font-display/font-display.html": [ + "css-fonts/font-display/font-display.html": [ [ - "/css-font-display/font-display.html", + "/css-fonts/font-display/font-display.html", [ [ - "/css-font-display/font-display-ref.html", + "/css-fonts/font-display/font-display-ref.html", "==" ] ], @@ -70603,6 +70615,11 @@ {} ] ], + "XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py": [ + [ + {} + ] + ], "XMLHttpRequest/resources/access-control-basic-denied.py": [ [ {} @@ -70633,6 +70650,11 @@ {} ] ], + "XMLHttpRequest/resources/access-control-cookie.py": [ + [ + {} + ] + ], "XMLHttpRequest/resources/access-control-origin-header.py": [ [ {} @@ -70663,6 +70685,11 @@ {} ] ], + "XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py": [ + [ + {} + ] + ], "XMLHttpRequest/resources/access-control-sandboxed-iframe.html": [ [ {} @@ -73488,16 +73515,6 @@ {} ] ], - "css-font-display/font-display-ref.html": [ - [ - {} - ] - ], - "css-font-display/resources/slow-ahem-loading.py": [ - [ - {} - ] - ], "css-font-loading/OWNERS": [ [ {} @@ -73508,6 +73525,16 @@ {} ] ], + "css-fonts/font-display/font-display-ref.html": [ + [ + {} + ] + ], + "css-fonts/font-display/resources/slow-ahem-loading.py": [ + [ + {} + ] + ], "css-fonts/matching/README.md": [ [ {} @@ -87963,6 +87990,11 @@ {} ] ], + "css/css-logical-1/OWNERS": [ + [ + {} + ] + ], "css/css-logical-1/cascading-001-ref.html": [ [ {} @@ -101063,11 +101095,6 @@ {} ] ], - "generic-sensor/idlharness-expected.txt": [ - [ - {} - ] - ], "geolocation-API/OWNERS": [ [ {} @@ -101098,11 +101125,6 @@ {} ] ], - "gyroscope/idlharness.https-expected.txt": [ - [ - {} - ] - ], "hr-time/OWNERS": [ [ {} @@ -112783,16 +112805,6 @@ {} ] ], - "html/webappapis/scripting/events/event-handler-spec-example-expected.txt": [ - [ - {} - ] - ], - "html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt": [ - [ - {} - ] - ], "html/webappapis/scripting/events/messageevent-constructor.https-expected.txt": [ [ {} @@ -115293,11 +115305,6 @@ {} ] ], - "orientation-sensor/idlharness.https-expected.txt": [ - [ - {} - ] - ], "page-visibility/OWNERS": [ [ {} @@ -133463,6 +133470,12 @@ {} ] ], + "XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm": [ + [ + "/XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm", + {} + ] + ], "XMLHttpRequest/access-control-basic-denied.htm": [ [ "/XMLHttpRequest/access-control-basic-denied.htm", @@ -133511,6 +133524,12 @@ {} ] ], + "XMLHttpRequest/access-control-preflight-async-not-supported.htm": [ + [ + "/XMLHttpRequest/access-control-preflight-async-not-supported.htm", + {} + ] + ], "XMLHttpRequest/access-control-preflight-credential-async.htm": [ [ "/XMLHttpRequest/access-control-preflight-credential-async.htm", @@ -133571,6 +133590,12 @@ {} ] ], + "XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm": [ + [ + "/XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm", + {} + ] + ], "XMLHttpRequest/access-control-preflight-sync-header-denied.htm": [ [ "/XMLHttpRequest/access-control-preflight-sync-header-denied.htm", @@ -133583,6 +133608,24 @@ {} ] ], + "XMLHttpRequest/access-control-preflight-sync-not-supported.htm": [ + [ + "/XMLHttpRequest/access-control-preflight-sync-not-supported.htm", + {} + ] + ], + "XMLHttpRequest/access-control-recursive-failed-request.htm": [ + [ + "/XMLHttpRequest/access-control-recursive-failed-request.htm", + {} + ] + ], + "XMLHttpRequest/access-control-response-with-body-sync.htm": [ + [ + "/XMLHttpRequest/access-control-response-with-body-sync.htm", + {} + ] + ], "XMLHttpRequest/access-control-response-with-body.htm": [ [ "/XMLHttpRequest/access-control-response-with-body.htm", @@ -146803,9 +146846,9 @@ {} ] ], - "generic-sensor/idlharness.html": [ + "generic-sensor/idlharness.https.html": [ [ - "/generic-sensor/idlharness.html", + "/generic-sensor/idlharness.https.html", {} ] ], @@ -190653,7 +190696,7 @@ "support" ], "./lint.whitelist": [ - "41972c110065c638f914d33d35d123a5732f84d6", + "85909de8994c7339bd86c969094a072de473a6de", "support" ], "./update-built-tests.sh": [ @@ -196805,7 +196848,7 @@ "testharness" ], "WebCryptoAPI/OWNERS": [ - "6b3912f3c429e9c99ba542db34c51986b6de890b", + "6761dcfa3196604b8f4f3be42f1abfd432d9f8f0", "support" ], "WebCryptoAPI/README.md": [ @@ -197421,7 +197464,7 @@ "testharness" ], "WebIDL/OWNERS": [ - "84dab860a34720bd705697303b702ab3a87cffe6", + "bc227c95d467672dac52ec90562d31d9dcae16c4", "support" ], "WebIDL/current-realm-expected.txt": [ @@ -197509,7 +197552,7 @@ "testharness" ], "XMLHttpRequest/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "bb2738dafe22a65000695059dfb22d1b3559772d", "support" ], "XMLHttpRequest/README.md": [ @@ -197656,6 +197699,10 @@ "8c2f2df46c8086f657806f763e68d775e1294bd0", "testharness" ], + "XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm": [ + "29b6638f3de85cc39b77b86353dc49865e1fdc39", + "testharness" + ], "XMLHttpRequest/access-control-basic-denied.htm": [ "890170b5b2857a6e837ea3ed0dc4692e206a864a", "testharness" @@ -197673,7 +197720,7 @@ "testharness" ], "XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type.htm": [ - "4db804485282525ce98ef71c2824ade7fdb0f357", + "d7877dca1a16e5c3f52881558f9951e4a5f78ba8", "testharness" ], "XMLHttpRequest/access-control-basic-preflight-denied.htm": [ @@ -197688,6 +197735,10 @@ "29bb39b957742d739bb0d54464b48a53533206fe", "testharness" ], + "XMLHttpRequest/access-control-preflight-async-not-supported.htm": [ + "7520098b97455ca0795304751cef93197be469f6", + "testharness" + ], "XMLHttpRequest/access-control-preflight-credential-async.htm": [ "ae93b44faf45f95927a1ee82052a414273333e61", "testharness" @@ -197728,6 +197779,10 @@ "a59b9c8f77991992faade11e955061078b9d9623", "testharness" ], + "XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm": [ + "78f95f6f962f1696a1ff37a6a3216fba4e741f56", + "testharness" + ], "XMLHttpRequest/access-control-preflight-sync-header-denied.htm": [ "98e89f8ddccbba846b6f21f1d77b6a64554bcb52", "testharness" @@ -197736,6 +197791,18 @@ "536deb1a3322c4ef45e259849e659d1fa4bea7c7", "testharness" ], + "XMLHttpRequest/access-control-preflight-sync-not-supported.htm": [ + "997d43197782650b479ccdef1cc43d8bde7e31e4", + "testharness" + ], + "XMLHttpRequest/access-control-recursive-failed-request.htm": [ + "03650f5362e483a6e29a05554723385ab601495f", + "testharness" + ], + "XMLHttpRequest/access-control-response-with-body-sync.htm": [ + "ae7e24c4b3b3295caa7e76555ac8a21d9062556a", + "testharness" + ], "XMLHttpRequest/access-control-response-with-body.htm": [ "e5b2ae207a2ae58bd20a4d6903991cff5e27b5a7", "testharness" @@ -198180,6 +198247,10 @@ "b7351f59af91646549075b6b732eeb6c750e3faf", "support" ], + "XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py": [ + "19a0b1d88765fa152c17c7f684651be8c4bae3da", + "support" + ], "XMLHttpRequest/resources/access-control-basic-denied.py": [ "35e7b6c552caf55e8ea7d34ec51d354c8eb2bc6e", "support" @@ -198204,6 +198275,10 @@ "eda02da8e1d89f28ff0e07442539b7eca4ca556f", "support" ], + "XMLHttpRequest/resources/access-control-cookie.py": [ + "0551a6a4284fcae2ed5314d5d02767a4da1ad981", + "support" + ], "XMLHttpRequest/resources/access-control-origin-header.py": [ "529883eed380c4505c1ddbc87ae5885254756626", "support" @@ -198228,6 +198303,10 @@ "c572b1e3d79f66df0a40766e6e4c3cc785458d0e", "support" ], + "XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py": [ + "1343bfee18c64bfbb625591bc65117e5b692c487", + "support" + ], "XMLHttpRequest/resources/access-control-sandboxed-iframe.html": [ "3aa5a903afc03e167a88322db44c29b287509f47", "support" @@ -199097,11 +199176,11 @@ "support" ], "accelerometer/idlharness.https-expected.txt": [ - "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", + "fad45e3137874b58df73f6609bef167a2f1cd586", "support" ], "accelerometer/idlharness.https.html": [ - "ac421649ad01868af57e06d322515b4fa36a2dda", + "a4b5c164268d6742e7da504d15d6b9eeb4cfc6ce", "testharness" ], "apng/OWNERS": [ @@ -199261,7 +199340,7 @@ "support" ], "battery-status/OWNERS": [ - "0a6b169fb5e90abd7e72bc708c58b6c46fb3306c", + "6bf7340116fe26dce548f3eabac414f02c75b17b", "support" ], "battery-status/battery-charging-manual.https.html": [ @@ -202505,7 +202584,7 @@ "testharness" ], "cors/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "6c3764028d1d7154d9d4200bf28a2249dbbb333f", "support" ], "cors/README.md": [ @@ -202696,18 +202775,6 @@ "67ecb845c4bcdacc8185b0f78d36856f9a408342", "testharness" ], - "css-font-display/font-display-ref.html": [ - "26fcc2758c649ce922397cd1c4aa862bdbf1e6a0", - "support" - ], - "css-font-display/font-display.html": [ - "d83914326318602ce0eef5f248254a391b338df0", - "reftest" - ], - "css-font-display/resources/slow-ahem-loading.py": [ - "aac16c1e618841ebdd28463adf5688ca837b9d57", - "support" - ], "css-font-loading/OWNERS": [ "5046d8b1e4fbcb3579ba632d66e81b1cd82384e8", "support" @@ -202720,6 +202787,18 @@ "9e80ce00e7e18fb9f37ece769507e08432f35cc7", "support" ], + "css-fonts/font-display/font-display-ref.html": [ + "26fcc2758c649ce922397cd1c4aa862bdbf1e6a0", + "support" + ], + "css-fonts/font-display/font-display.html": [ + "d83914326318602ce0eef5f248254a391b338df0", + "reftest" + ], + "css-fonts/font-display/resources/slow-ahem-loading.py": [ + "450ae01cb9fbd2c2cc436f1a8ace5386eb13442c", + "support" + ], "css-fonts/matching/README.md": [ "194fbc4cdaf1ff4a43e1a4e6b7bc7fbc17eec6d8", "support" @@ -229000,6 +229079,10 @@ "e633dc7584fbc7bfe99177aa5dd9fbd107a2d3f5", "support" ], + "css/css-logical-1/OWNERS": [ + "adcf6f1311695d9cc8f490be1f7e411a1048d824", + "support" + ], "css/css-logical-1/cascading-001-ref.html": [ "b95cd62ce3592f653aaa54de0dbc27e16618064b", "support" @@ -245029,7 +245112,7 @@ "testharness" ], "css/geometry-1/OWNERS": [ - "aaa869d8034b625e56b6a42a751640dd8c3bb18f", + "d285ff64ce6e1d989fcdaa872058291292c4a383", "support" ], "css/geometry-1/WebKitCSSMatrix.html": [ @@ -247924,6 +248007,10 @@ "0a8784c474ccdd4a3e76cb936855a8ef59566217", "support" ], + "cssom-view/scrollBoundaryBehavior-manual.html": [ + "987051cdbad355cbb1bbb8ea1030a3b17e533f09", + "manual" + ], "cssom-view/scrollIntoView-empty-args.html": [ "57e22136750f54145c37722674389590b7f340b6", "testharness" @@ -252737,7 +252824,7 @@ "support" ], "eventsource/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "ddfd29fafabbb74b189fbee2c6cb208d713954b6", "support" ], "eventsource/README.md": [ @@ -253121,7 +253208,7 @@ "support" ], "fetch/OWNERS": [ - "812135b282a6af912a5d67187fa74cb10a0178f9", + "6bc2dd179ac2fa34263a4b623ef4a14245a4ec3f", "support" ], "fetch/README.md": [ @@ -254481,27 +254568,23 @@ "support" ], "gamepad/idlharness.html": [ - "9bbceffc0b80b990f6f72e1e77a9fa451536bbbc", + "c9d8668d614404f24a8bf15d803e07e2ff6debd4", "testharness" ], "generic-sensor/OWNERS": [ - "305876b135d7b96817de262d8f5df28cf11ba5ef", + "1cb8a0e23d31dcdeb5ba273a40e35c021c0c53f2", "support" ], "generic-sensor/generic-sensor-tests.js": [ "0b89e14eadd32fd23202977471c9913f5213dce4", "support" ], - "generic-sensor/idlharness-expected.txt": [ - "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", - "support" - ], - "generic-sensor/idlharness.html": [ - "f968f5a81d25796f79cd22987810ec6832fa120d", + "generic-sensor/idlharness.https.html": [ + "fdb816b5036bae53a60672d3b6910ddb06dd9d51", "testharness" ], "geolocation-API/OWNERS": [ - "249b200b19b1bae83fbd114ab32bb3c7e91a637e", + "4c338ed1db3ab41c3a0664ea20c95dc6896c377e", "support" ], "geolocation-API/PositionOptions.https.html": [ @@ -254588,16 +254671,12 @@ "4f1c57a6bfbceaea2e725ce40ab449b5a687d611", "support" ], - "gyroscope/idlharness.https-expected.txt": [ - "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", - "support" - ], "gyroscope/idlharness.https.html": [ - "69699b3b533c8fd4047a3b5e80f95f8cdc82d24d", + "2aedb883f553cae594afb7c5ef59222c0ee3fefb", "testharness" ], "hr-time/OWNERS": [ - "84dab860a34720bd705697303b702ab3a87cffe6", + "e07e8c929145256675de1fcac336296cc31576d0", "support" ], "hr-time/basic.any.js": [ @@ -254709,7 +254788,7 @@ "support" ], "html-media-capture/OWNERS": [ - "784bcb876f764153dd31dd7c6e76bff82b695313", + "5ff5e5457fe80ab08a86e491a7fc1d980805714a", "support" ], "html-media-capture/capture_audio-manual.html": [ @@ -270908,10 +270987,6 @@ "9a1fa2065ba742d6ab945065d65bdc0f60783d94", "testharness" ], - "html/webappapis/scripting/events/event-handler-spec-example-expected.txt": [ - "3103a0e8e8ddc6143ba9c91aeabb63b4b2eedaad", - "support" - ], "html/webappapis/scripting/events/event-handler-spec-example.html": [ "8d4d0bfdf447591695ac134cd243277ea2326c84", "testharness" @@ -270920,10 +270995,6 @@ "491fd73a4ec8812cb8dc1ee01e34a7ff2a07ffb3", "testharness" ], - "html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt": [ - "07d43bac679645d8540e3d56e1d4a49c9a4cb1cf", - "support" - ], "html/webappapis/scripting/events/inline-event-handler-ordering.html": [ "873c69a87a5257a0e5278532b162338e9de2a596", "testharness" @@ -271457,7 +271528,7 @@ "support" ], "http/OWNERS": [ - "a7ec90613b57afc2f99d40420119e8ece80586b0", + "1344f0cf0c9b61570697a2f8c3e5a89f0c39bf74", "support" ], "http/basic-auth-cache-test-ref.html": [ @@ -271725,7 +271796,7 @@ "support" ], "innerText/getter-expected.txt": [ - "77e80d74e88dbaceb78773b67522423ae1bf7515", + "b54d8d89aca8588416b81b2412d62d4c3f2d66b2", "support" ], "innerText/getter-tests.js": [ @@ -271981,7 +272052,7 @@ "testharness" ], "longtask-timing/OWNERS": [ - "ef8e006eb532afaf6f561aa9ba2a46afa6b5693c", + "6f4986c5e5cc0863d61e32ecfce3cd7a8cc4a4d6", "support" ], "longtask-timing/longtask-attributes.html": [ @@ -272053,11 +272124,11 @@ "support" ], "magnetometer/idlharness.https-expected.txt": [ - "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", + "6078f1d70aaf7d8a274127b501972fcc2f704684", "support" ], "magnetometer/idlharness.https.html": [ - "caa1de6ebcd32508ea4e61a7412f6c165699cc58", + "a72e1c3443feae9bf9d19385c0ba96e66b97f20c", "testharness" ], "media-capabilities/OWNERS": [ @@ -272721,7 +272792,7 @@ "testharness" ], "mediacapture-record/OWNERS": [ - "249b200b19b1bae83fbd114ab32bb3c7e91a637e", + "516d0ce85279e3cc210b69f49e9ea7259226ef03", "support" ], "mediacapture-record/idlharness-expected.txt": [ @@ -272889,11 +272960,11 @@ "testharness" ], "mediacapture-streams/OWNERS": [ - "1b2f5b099268a66853be224cbf59c3f1b55bc4c3", + "07fc6a5ece5e626316fe1d70f23fbe377b6618d3", "support" ], "mediasession/OWNERS": [ - "9de93c74b73f6aa008e24ad02f98c4b4476cf708", + "27bf5ebefa8583974d0961d9a9b68ebede0dfb67", "support" ], "mediasession/README.md": [ @@ -274605,7 +274676,7 @@ "support" ], "navigation-timing/OWNERS": [ - "ddecc912f630fc43e1a64a73f97d102fe9fcfa78", + "877fd815e2bd375bdde158455bf077f4ae878916", "support" ], "navigation-timing/idlharness.html": [ @@ -274817,7 +274888,7 @@ "testharness" ], "notifications/OWNERS": [ - "d1fd72951c6f1860cd862c0e694c64c1076bc049", + "4ed62abe9b6484ff66fbec2f517e3faec811e4c0", "support" ], "notifications/body-basic-manual.html": [ @@ -281120,12 +281191,8 @@ "6f0eb976affc21e49f48c42c1bd9d9eb0083ee40", "manual" ], - "orientation-sensor/idlharness.https-expected.txt": [ - "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", - "support" - ], "orientation-sensor/idlharness.https.html": [ - "71100177bcb537c18f98edfd7bf04d420714a78b", + "9301519eebff3db962bbeb148bf3dd3b1e305a23", "testharness" ], "page-visibility/OWNERS": [ @@ -281205,7 +281272,7 @@ "testharness" ], "paint-timing/OWNERS": [ - "09e469f1ff3205daa6163ef3860735bb423dd1a7", + "36a1024fde66dc2ce8ea694b6e95a863f0c3e62a", "support" ], "paint-timing/basetest.html": [ @@ -281489,7 +281556,7 @@ "manual" ], "performance-timeline/OWNERS": [ - "117a9d08c8413d908bd157018e5dfe848e38c0d7", + "ce4a23c1bac992f3085f3dd3575ebc376c51f432", "support" ], "performance-timeline/case-sensitivity.any.js": [ @@ -282105,7 +282172,7 @@ "testharness" ], "presentation-api/OWNERS": [ - "6da9f3292a8790c1713e459e20cbf64e811933a3", + "b02ed0132a687bf09ad3f7380e1a4ceda6f2c3a7", "support" ], "presentation-api/README.md": [ @@ -282333,7 +282400,7 @@ "support" ], "progress-events/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "bb2738dafe22a65000695059dfb22d1b3559772d", "support" ], "progress-events/Status.html": [ @@ -289853,7 +289920,7 @@ "testharness" ], "remote-playback/OWNERS": [ - "adab36a884d16dd8db9d979a8c4ee170ff95fa38", + "0898aa08d3d5ef8f8b7399b4ca443c73cc1253f2", "support" ], "remote-playback/README.md": [ @@ -289885,7 +289952,7 @@ "testharness" ], "resource-timing/OWNERS": [ - "5fed409fed6c24eb8002e608db5fc85535572756", + "826012660a4485be172a109082c77fc6305e7307", "support" ], "resource-timing/SyntheticResponse.py": [ @@ -290073,7 +290140,7 @@ "support" ], "screen-orientation/OWNERS": [ - "6450ccc43d7f182fa76c7f9770d6003a401522b6", + "970c0e5b33815109f17231ffeaf4cea22cf9096c", "support" ], "screen-orientation/lock-bad-argument-expected.txt": [ @@ -291065,7 +291132,7 @@ "testharness" ], "service-workers/service-worker/fetch-frame-resource.https.html": [ - "77709ff94cfaeec0b01e157714244d1b568c6b18", + "0e0cf1dbe113b8403d6f1de0462ca8dd9641b3c4", "testharness" ], "service-workers/service-worker/fetch-header-visibility.https.html": [ @@ -293201,7 +293268,7 @@ "testharness" ], "storage/OWNERS": [ - "84dab860a34720bd705697303b702ab3a87cffe6", + "12440f4f1664a6de93ebe0662f153492cbe5e428", "support" ], "storage/README.md": [ @@ -293285,7 +293352,7 @@ "testharness" ], "streams/OWNERS": [ - "a24ac1da1e1fdf2dd31486f54f646a2220f498bb", + "20bf01bf67bc93c91033814539b4550efdf0ef7e", "support" ], "streams/README.md": [ @@ -294533,7 +294600,7 @@ "testharness" ], "uievents/OWNERS": [ - "fb1bd00f4c9383566682fcec6ba0bac105b8203e", + "96e9f482d18db4fbce38a14c069af1494171fc4a", "support" ], "uievents/README.md": [ @@ -294937,7 +295004,7 @@ "testharness" ], "url/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "ddfd29fafabbb74b189fbee2c6cb208d713954b6", "support" ], "url/README.md": [ @@ -295089,7 +295156,7 @@ "support" ], "user-timing/OWNERS": [ - "84dab860a34720bd705697303b702ab3a87cffe6", + "6f4986c5e5cc0863d61e32ecfce3cd7a8cc4a4d6", "support" ], "user-timing/clear_all_marks.any.js": [ @@ -295177,7 +295244,7 @@ "testharness" ], "vibration/OWNERS": [ - "d1fd72951c6f1860cd862c0e694c64c1076bc049", + "dc5baeffc8871efedf5e79588219466cfe76eb36", "support" ], "vibration/api-is-present.html": [ @@ -295244,6 +295311,10 @@ "a4fed30c25d50d5ce774e4e5b431efa99f73ecf3", "support" ], + "viewport/viewport-attribute-event-handlers-manual.html": [ + "09901d9056f2e31f630becdd07f800e00496700a", + "manual" + ], "viewport/viewport-dimensions-custom-scrollbars-manual.html": [ "ccef0829da2e4ebcad983235f97a6f3f767a0f51", "manual" @@ -295805,7 +295876,7 @@ "testharness" ], "web-nfc/OWNERS": [ - "02d51aabab777d41cee48e8bfcaedec67f712325", + "8be535b568f97ca151f13ede98fcd2459640308f", "support" ], "web-nfc/idlharness.https.html": [ @@ -295985,7 +296056,7 @@ "support" ], "webaudio/OWNERS": [ - "416da2f04aa3f612a5c5d8f7a459f64578f37877", + "73d9bb2cb2f23589c3935bef954cd2c5e280ff13", "support" ], "webaudio/README.md": [ @@ -296281,7 +296352,7 @@ "testharness" ], "webmessaging/OWNERS": [ - "9d4c63a866073b94bd7eb921bcb8ccdf2c5f67dd", + "36bd10410e1cffb8705cf58b60a9a6e51d2b6718", "support" ], "webmessaging/README.md": [ @@ -296669,7 +296740,7 @@ "testharness" ], "webrtc/OWNERS": [ - "d9a7290ec6c2f0b4715b8161d1b683f64938fe07", + "8edd63a3a9622e18424a4e9c6dc41ae8620c6af9", "support" ], "webrtc/RTCCertificate-expected.txt": [ @@ -296693,11 +296764,11 @@ "support" ], "webrtc/RTCConfiguration-iceCandidatePoolSize-expected.txt": [ - "03f43188c1e8484e881d5c63e542d617ca77a8b2", + "61a7ffbb058a16327cd5252b39b3b8c3f237cce6", "support" ], "webrtc/RTCConfiguration-iceCandidatePoolSize.html": [ - "7816790d82628acb7cf04e0a046046884c1207e7", + "6b55bd01a1422f2315cae765a7d539bf81151c1f", "testharness" ], "webrtc/RTCConfiguration-iceServers-expected.txt": [ @@ -297385,7 +297456,7 @@ "testharness" ], "websockets/OWNERS": [ - "5e0081d16b92f9be37809fc63c8e16773382fc45", + "f3989c79b38f8107e53c21c79148e705cf3ff500", "support" ], "websockets/README.md": [ @@ -297657,7 +297728,7 @@ "testharness" ], "websockets/constructor/011.html": [ - "60f0ca813c13a6003a3f376ffbddd38a8a7a6f98", + "47314c9d8762f552694791286e2607bab72ec39d", "testharness" ], "websockets/constructor/012.html": [ @@ -298401,7 +298472,7 @@ "testharness" ], "webstorage/storage_enumerate.html": [ - "6d7c52b7b8fef7b6e987d4fade5fb1271266c6bb", + "68a6b26b33dbad422b25d95f67ffa7d057662894", "testharness" ], "webstorage/storage_functions_not_overwritten.html": [ @@ -298581,7 +298652,7 @@ "testharness" ], "webvr/OWNERS": [ - "a410828e76aa74576eaadc4ebed114f36a2d7e12", + "4fa6f2f6ab03104db765afe5f8551564461c95d7", "support" ], "webvr/idlharness-expected.txt": [ @@ -298625,7 +298696,7 @@ "support" ], "webvtt/OWNERS": [ - "5cce79f37f795f4fb35130c174d3a553f18fcff4", + "dcf85b8b4c54addc98e82ecc66501eee0368e475", "support" ], "webvtt/README.md": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm new file mode 100644 index 0000000..1d570a3c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-request-headers.htm
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <title>Tests that CORS-safelisted request headers are permitted in cross-origin request</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> + test(function() { + const xhr = new XMLHttpRequest; + + xhr.open("POST", get_host_info().HTTP_REMOTE_ORIGIN + "/XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py", false); + + xhr.setRequestHeader("Accept", "*"); + xhr.setRequestHeader("Accept-Language", "ru"); + xhr.setRequestHeader("Content-Language", "ru"); + xhr.setRequestHeader("Content-Type", "text/plain"); + xhr.setRequestHeader("Save-Data", "on"); + + xhr.send(); + + assert_equals(xhr.responseText, + "Accept: *\n" + + "Accept-Language: ru\n" + + "Content-Language: ru\n" + + "Content-Type: text/plain\n"); + }, "Request with CORS-safelisted headers"); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-response-headers.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-response-headers.htm new file mode 100644 index 0000000..c795083 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-cors-safelisted-response-headers.htm
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <title>Tests that CORS-safelisted response headers are permitted in cross-origin request</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> + test(function() { + const xhr = new XMLHttpRequest; + + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + + "/XMLHttpRequest/resources/access-control-basic-whitelist-response-headers.py", false); + xhr.send(); + + assert_not_equals(xhr.getResponseHeader("cache-control"), null); + assert_not_equals(xhr.getResponseHeader("content-language"), null); + assert_not_equals(xhr.getResponseHeader("content-type"), null); + assert_not_equals(xhr.getResponseHeader("expires"), null); + assert_not_equals(xhr.getResponseHeader("last-modified"), null); + assert_not_equals(xhr.getResponseHeader("pragma"), null); + assert_equals(xhr.getResponseHeader("x-webkit"), null); + + assert_not_equals(xhr.getAllResponseHeaders().match("en"), null); + assert_equals(xhr.getAllResponseHeaders().match("foobar"), null); + }, "Response with CORS-safelisted headers"); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type.htm index 4820f66..9867c79 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-basic-post-with-non-cors-safelisted-content-type.htm
@@ -18,7 +18,7 @@ xhr.send(); - assert_equals(xhr.status, 200, "Cross-domain access was denied in 'send'."); + assert_equals(xhr.status, 200, "Same-origin access doesn't issue preflight; not denied."); }, "Same-origin request with non-safelisted content type succeeds"); test(function() {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm new file mode 100644 index 0000000..c7cb5cd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-preflight-request-must-not-contain-cookie.htm
@@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html> + <head> + <title>Preflight request must not contain any cookie header</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> + async_test((test) => { + function setupCookie() { + const xhr = new XMLHttpRequest; + // Delete all preexisting cookies and set a cookie named "foo" + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + + "/XMLHttpRequest/resources/access-control-cookie.py?cookie_name=foo"); + xhr.withCredentials = true; + xhr.send(); + xhr.onerror = test.unreached_func("Unexpected error."); + xhr.onload = test.step_func(() => { + assert_equals(xhr.status, 200); + sendPreflightedRequest(); + }); + } + + function sendPreflightedRequest() { + const xhr = new XMLHttpRequest; + // Request to server-side file fails if cookie is included in preflight + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + + "/XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py"); + xhr.withCredentials = true; + xhr.setRequestHeader("X-Proprietary-Header", "foo"); + xhr.onerror = test.unreached_func("Unexpected error."); + xhr.onload = test.step_func(() => { + assert_equals(xhr.status, 200); + assert_equals(xhr.responseText, "COOKIE"); + cleanupCookies(); + }); + xhr.send(); + } + + function cleanupCookies() { + const xhr = new XMLHttpRequest; + // Delete all cookies + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + + "/XMLHttpRequest/resources/access-control-cookie.py"); + xhr.withCredentials = true; + xhr.send(); + xhr.onerror = test.unreached_func("Unexpected error."); + xhr.onload = test.step_func_done(() => {}); + } + + setupCookie(); + }); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-recursive-failed-request.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-recursive-failed-request.htm new file mode 100644 index 0000000..e29a34a6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-recursive-failed-request.htm
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <title>Recursively repeated CORS requests with failed preflights should never result in unexpected behavior</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> +let requestCount = 0; +const requestMax = 10; + +async_test((test) => { + function preflightRequest() { + const xhr = new XMLHttpRequest; + + xhr.onload = test.unreached_func("Request succeeded unexpectedly."); + + xhr.onerror = test.step_func(() => { + assert_equals(xhr.status, 0); + if (++requestCount >= requestMax) { + test.done(); + return; + } + preflightRequest(); + }); + + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + + "/XMLHttpRequest/resources/access-control-basic-denied.py"); + xhr.send(); + } + + preflightRequest(); +}); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-response-with-body-sync.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-response-with-body-sync.htm new file mode 100644 index 0000000..559b7d21 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-response-with-body-sync.htm
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <head> + <title>Tests body from CORS preflight response and actual response with sync request</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> +test(() => { + const xhr = new XMLHttpRequest; + + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN+ + "/XMLHttpRequest/resources/access-control-allow-with-body.py", false); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + xhr.send(); + + assert_equals(xhr.status, 200); + assert_equals(xhr.responseText, "PASS"); +}); + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py new file mode 100644 index 0000000..eba0e7d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-cors-safelisted-request-headers.py
@@ -0,0 +1,14 @@ +def main(request, response): + response.headers.set("Cache-Control", "no-store") + + # This should be a simple request; deny preflight + if request.method != "POST": + response.status = 400 + return + + response.headers.set("Access-Control-Allow-Credentials", "true") + response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin")) + + for header in ["Accept", "Accept-Language", "Content-Language", "Content-Type"]: + value = request.headers.get(header) + response.content += header + ": " + (value if value else "<None>") + '\n'
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-whitelist-response-headers.py b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-whitelist-response-headers.py new file mode 100644 index 0000000..e7c15bb --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-basic-whitelist-response-headers.py
@@ -0,0 +1,19 @@ +def main(request, response): + headers = { + # CORS-safelisted + "content-type": "text/plain", + "cache-control": "no cache", + "content-language": "en", + "expires": "Fri, 30 Oct 1998 14:19:41 GMT", + "last-modified": "Tue, 15 Nov 1994 12:45:26 GMT", + "pragma": "no-cache", + + # Non-CORS-safelisted + "x-test": "foobar", + + "Access-Control-Allow-Origin": "*" + } + for header in headers: + response.headers.set(header, headers[header]) + + response.content = "PASS: Cross-domain access allowed."
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-cookie.py b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-cookie.py new file mode 100644 index 0000000..1e0d41d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-cookie.py
@@ -0,0 +1,16 @@ +import datetime + +def main(request, response): + cookie_name = request.GET.first("cookie_name", "") + + response.headers.set("Cache-Control", "no-store") + response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin")) + response.headers.set("Access-Control-Allow-Credentials", "true") + + for cookie in request.cookies: + # Set cookie to expire yesterday + response.set_cookie(cookie, "deleted", expires=-datetime.timedelta(days=1)) + + if cookie_name: + # Set cookie to expire tomorrow + response.set_cookie(cookie_name, "COOKIE", expires=datetime.timedelta(days=1))
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py new file mode 100644 index 0000000..eb49bf5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/resources/access-control-preflight-request-must-not-contain-cookie.py
@@ -0,0 +1,12 @@ +def main(request, response): + if request.method == "OPTIONS" and request.cookies.get("foo"): + response.status = 400 + else: + response.headers.set("Cache-Control", "no-store") + response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin")) + response.headers.set("Access-Control-Allow-Credentials", "true") + response.headers.set("Access-Control-Allow-Headers", "X-Proprietary-Header") + response.headers.set("Connection", "close") + + if request.cookies.get("foo"): + response.content = request.cookies["foo"].value
diff --git a/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https-expected.txt index 8b13789..e017612 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https-expected.txt
@@ -1 +1,69 @@ +This is a testharness.js-based test. +PASS Sensor interface: existence and properties of interface object +PASS Sensor interface object length +PASS Sensor interface object name +PASS Sensor interface: existence and properties of interface prototype object +PASS Sensor interface: existence and properties of interface prototype object's "constructor" property +PASS Sensor interface: attribute activated +PASS Sensor interface: attribute timestamp +PASS Sensor interface: operation start() +PASS Sensor interface: operation stop() +PASS Sensor interface: attribute onreading +PASS Sensor interface: attribute onactivate +PASS Sensor interface: attribute onerror +PASS Accelerometer interface: existence and properties of interface object +PASS Accelerometer interface object length +PASS Accelerometer interface object name +PASS Accelerometer interface: existence and properties of interface prototype object +PASS Accelerometer interface: existence and properties of interface prototype object's "constructor" property +PASS Accelerometer interface: attribute x +PASS Accelerometer interface: attribute y +PASS Accelerometer interface: attribute z +PASS Accelerometer must be primary interface of new Accelerometer(); +PASS Stringification of new Accelerometer(); +PASS Accelerometer interface: new Accelerometer(); must inherit property "x" with the proper type +PASS Accelerometer interface: new Accelerometer(); must inherit property "y" with the proper type +PASS Accelerometer interface: new Accelerometer(); must inherit property "z" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "activated" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "timestamp" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "start()" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "stop()" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "onreading" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "onactivate" with the proper type +PASS Sensor interface: new Accelerometer(); must inherit property "onerror" with the proper type +PASS LinearAccelerationSensor interface: existence and properties of interface object +PASS LinearAccelerationSensor interface object length +PASS LinearAccelerationSensor interface object name +PASS LinearAccelerationSensor interface: existence and properties of interface prototype object +PASS LinearAccelerationSensor interface: existence and properties of interface prototype object's "constructor" property +PASS LinearAccelerationSensor must be primary interface of new LinearAccelerationSensor(); +PASS Stringification of new LinearAccelerationSensor(); +PASS Accelerometer interface: new LinearAccelerationSensor(); must inherit property "x" with the proper type +PASS Accelerometer interface: new LinearAccelerationSensor(); must inherit property "y" with the proper type +PASS Accelerometer interface: new LinearAccelerationSensor(); must inherit property "z" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "activated" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "timestamp" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "start()" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "stop()" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "onreading" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "onactivate" with the proper type +PASS Sensor interface: new LinearAccelerationSensor(); must inherit property "onerror" with the proper type +FAIL GravitySensor interface: existence and properties of interface object assert_own_property: self does not have own property "GravitySensor" expected property "GravitySensor" missing +FAIL GravitySensor interface object length assert_own_property: self does not have own property "GravitySensor" expected property "GravitySensor" missing +FAIL GravitySensor interface object name assert_own_property: self does not have own property "GravitySensor" expected property "GravitySensor" missing +FAIL GravitySensor interface: existence and properties of interface prototype object assert_own_property: self does not have own property "GravitySensor" expected property "GravitySensor" missing +FAIL GravitySensor interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "GravitySensor" expected property "GravitySensor" missing +FAIL GravitySensor must be primary interface of new GravitySensor(); assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Stringification of new GravitySensor(); assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Accelerometer interface: new GravitySensor(); must inherit property "x" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Accelerometer interface: new GravitySensor(); must inherit property "y" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Accelerometer interface: new GravitySensor(); must inherit property "z" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "activated" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "timestamp" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "start()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "stop()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "onreading" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "onactivate" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +FAIL Sensor interface: new GravitySensor(); must inherit property "onerror" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: GravitySensor is not defined" +Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https.html b/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https.html index 6c9c9bb..b6d9ce5 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/accelerometer/idlharness.https.html
@@ -8,32 +8,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/WebIDLParser.js"></script> <script src="/resources/idlharness.js"></script> -<style> - pre { - display: none; - } -</style> <div id="log"></div> -<pre id="idl"> -interface Event { -}; - -interface Error { -}; - -dictionary EventInit { -}; - +<script id="idl" type="text/plain"> interface EventTarget { }; interface EventHandler { }; -</pre> +</script> -<pre id="generic-idl"> -[SecureContext] +<script id="accelerometer-idl" type="text/plain"> +// The interface of Sensor is defined in +// https://www.w3.org/TR/generic-sensor/#idl-index +[SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; readonly attribute DOMHighResTimeStamp? timestamp; @@ -44,44 +32,27 @@ attribute EventHandler onerror; }; -dictionary SensorOptions { - double? frequency; -}; - -[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] -interface SensorErrorEvent : Event { - readonly attribute Error error; -}; - -dictionary SensorErrorEventInit : EventInit { - required Error error; -}; -</pre> - -<pre id="accelerometer-idl"> -[Constructor(optional SensorOptions options)] +[Constructor(optional SensorOptions options), Exposed=Window] interface Accelerometer : Sensor { readonly attribute unrestricted double? x; readonly attribute unrestricted double? y; readonly attribute unrestricted double? z; }; -[Constructor(optional SensorOptions options)] +[Constructor(optional SensorOptions options), Exposed=Window] interface LinearAccelerationSensor : Accelerometer { }; -[Constructor(optional SensorOptions options)] +[Constructor(optional SensorOptions options), Exposed=Window] interface GravitySensor : Accelerometer { }; -</pre> +</script> <script> - (() => { "use strict"; let idl_array = new IdlArray(); idl_array.add_untested_idls(document.getElementById('idl').textContent); - idl_array.add_untested_idls(document.getElementById('generic-idl').textContent); idl_array.add_idls(document.getElementById('accelerometer-idl').textContent); idl_array.add_objects({ @@ -92,5 +63,4 @@ idl_array.test(); })(); - </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css-font-display/font-display-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/font-display-ref.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/css-font-display/font-display-ref.html rename to third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/font-display-ref.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css-font-display/font-display.html b/third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/font-display.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/css-font-display/font-display.html rename to third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/font-display.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css-font-display/resources/slow-ahem-loading.py b/third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/resources/slow-ahem-loading.py similarity index 80% rename from third_party/WebKit/LayoutTests/external/wpt/css-font-display/resources/slow-ahem-loading.py rename to third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/resources/slow-ahem-loading.py index 4598950..bb556d1 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css-font-display/resources/slow-ahem-loading.py +++ b/third_party/WebKit/LayoutTests/external/wpt/css-fonts/font-display/resources/slow-ahem-loading.py
@@ -2,7 +2,7 @@ import time def main(request, response): - body = open(os.path.join(os.path.dirname(__file__), "../../css/fonts/ahem/ahem.ttf"), "rb").read() + body = open(os.path.join(os.path.dirname(__file__), "../../../css/fonts/ahem/ahem.ttf"), "rb").read() delay = float(request.GET.first("ms", 500)) if delay > 0: time.sleep(delay / 1E3);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollBoundaryBehavior-manual.html b/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollBoundaryBehavior-manual.html new file mode 100644 index 0000000..efd0043 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollBoundaryBehavior-manual.html
@@ -0,0 +1,151 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style> +.outer { + height: 400px; + width: 1000px; + background: white +} +.content { + height: 600px; + width: 1200px; +} +#root { + overflow: scroll; + height: 600px; + width: 800px; + background: white; +} +#container { + overflow: scroll; +} +#non_scrollable { + overflow: none; +} +#green { + background: repeating-linear-gradient(to bottom right, green 15%, white 30%); +} +#blue { + background: repeating-linear-gradient(to bottom right, blue 15%, white 30%); +} +</style> + +<div id='root'> + <div id='non_scrollable' class='outer'> + <div id='green' class='content'></div> + </div> + <div id='container' class='outer'> + <div id='blue' class='content'></div> + </div> +</div> +<input type="button" id="btnDone" value="DONE" style="width: 100px; height: 50px;"/> +<h1>scroll-boundary-behavior</h1> +<h4>Tests that scroll-boundary-behavior prevents scroll-propagation in the area and direction as specified.</h4> +<ol> + <li id="i1">Make two scrolls on <span style="color: blue">BLUE</span>, in this order: scroll UP (or drag down), then scroll LEFT (or drag right). Scroll (or drag) until nothing is scrolling. Then tap on DONE.</li> + <li id="i2">Repeat the same scrolls as in step 1 and then tap on DONE.</li> + <li id="i3">Repeat the same scrolls as in step 1 and then tap on DONE.</li> + <li id="i4">Make two separate scrolls on <span style="color: green">GREEN</span>, in this order: scroll UP (or drag down), then scroll LEFT (or drag right). Scroll (or drag) until nothing is scrolling. Then tap on DONE.</li> +</ol> + + +<script> +const container = document.getElementById('container'); +const non_scrollable = document.getElementById('non_scrollable'); +const root = document.getElementById('root'); +var test = async_test("scroll-boundary-behavior prevents scroll-propagation in the area and direction as specified"); +var instruction1 = document.getElementById("i1"); +var instruction2 = document.getElementById("i2"); +var instruction3 = document.getElementById("i3"); +var instruction4 = document.getElementById("i4"); + +function setUpForRoot(offset) { + root.scrollTop = offset; + root.scrollLeft = offset; +} + +function setUpForContainer(offset) { + container.scrollTop = offset; + container.scrollLeft = offset +} + +function set_boundary_prevents_y() { + instruction1.style.color = 'red'; + instruction1.style.fontWeight = 'bold'; + container.style.scrollBoundaryBehaviorX = 'auto'; + container.style.scrollBoundaryBehaviorY = 'none'; + setUpForRoot(100); + setUpForContainer(0); +} + +function verify_y_prevented_and_set_boundary_prevents_x() { + instruction1.style.fontWeight = 'normal'; + instruction2.style.fontWeight = 'bold'; + test.step(function() { + assert_equals(root.scrollTop, 100); + assert_equals(root.scrollLeft, 0); + }, "scroll-boundary-behavior-y: none should only prevent scroll propagation on y axis."); + + container.style.scrollBoundaryBehaviorX = 'none'; + container.style.scrollBoundaryBehaviorY = 'auto'; + setUpForRoot(100); + setUpForContainer(0); +} + +function verify_x_prevented_and_set_boundary_allows_inner() { + instruction2.style.fontWeight = 'normal'; + instruction3.style.fontWeight = 'bold'; + test.step(function() { + assert_equals(root.scrollTop, 0); + assert_equals(root.scrollLeft, 100); + }, "scroll-boundary-behavior-x: none should only prevent scroll propagation on x axis."); + + container.style.scrollBoundaryBehaviorX = 'none'; + container.style.scrollBoundaryBehaviorY = 'none'; + setUpForRoot(100); + setUpForContainer(100); +} + +function verify_inner_allowed_and_set_nonscrollable_allows_propagation() { + instruction1.style.color = 'black'; + instruction4.style.color = 'red'; + instruction3.style.fontWeight = 'normal'; + instruction4.style.fontWeight = 'bold'; + test.step(function() { + assert_equals(container.scrollTop, 0); + assert_equals(container.scrollLeft, 0); + assert_equals(root.scrollTop, 100); + assert_equals(root.scrollLeft, 100); + }, "scroll-boundary-behavior should latch the scroll to the inner container."); + + non_scrollable.style.scrollBoundaryBehaviorX = 'none'; + non_scrollable.style.scrollBoundaryBehaviorY = 'none'; + setUpForRoot(100); +} + +function verify_non_scrollable_allows_propagation() { + test.step(function() { + assert_equals(root.scrollLeft, 0); + assert_equals(root.scrollTop, 0); + }, "scroll-boundary-behavior on non-scrollable area should not affect scroll propagation."); + test.done(); +} + +var verifyAndSetupForNext = [ + set_boundary_prevents_y, + verify_y_prevented_and_set_boundary_prevents_x, + verify_x_prevented_and_set_boundary_allows_inner, + verify_inner_allowed_and_set_nonscrollable_allows_propagation, + verify_non_scrollable_allows_propagation]; + +on_event(document.getElementById("btnDone"), "click", function() { + if (current_test < verifyAndSetupForNext.length) + verifyAndSetupForNext[current_test++](); +}); + +var current_test = 0; +verifyAndSetupForNext[current_test++](); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/gamepad/idlharness.html b/third_party/WebKit/LayoutTests/external/wpt/gamepad/idlharness.html index 0acd4cae..559d2ef 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/gamepad/idlharness.html +++ b/third_party/WebKit/LayoutTests/external/wpt/gamepad/idlharness.html
@@ -26,8 +26,8 @@ readonly attribute boolean connected; readonly attribute DOMHighResTimeStamp timestamp; readonly attribute GamepadMappingType mapping; - readonly attribute double[] axes; - readonly attribute GamepadButton[] buttons; + readonly attribute FrozenArray<double> axes; + readonly attribute FrozenArray<GamepadButton> buttons; }; enum GamepadMappingType {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness-expected.txt deleted file mode 100644 index 8b13789..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness-expected.txt +++ /dev/null
@@ -1 +0,0 @@ -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.html b/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.https.html similarity index 82% rename from third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.html rename to third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.https.html index 5fffbbb..da0bb71a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.html +++ b/third_party/WebKit/LayoutTests/external/wpt/generic-sensor/idlharness.https.html
@@ -7,14 +7,9 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/WebIDLParser.js"></script> <script src="/resources/idlharness.js"></script> -<style> - pre { - display: none; - } -</style> <div id="log"></div> -<pre id="idl"> +<script id="idl" type="text/plain"> interface Event { }; @@ -24,7 +19,7 @@ dictionary EventInit { }; -[SecureContext] +[SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; readonly attribute DOMHighResTimeStamp? timestamp; @@ -38,10 +33,11 @@ dictionary SensorOptions { double? frequency; }; -</pre> +</script> -<pre id="generic-idl"> -[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] +<script id="generic-idl" type="text/plain"> +[Constructor(DOMString type, SensorErrorEventInit errorEventInitDict), + SecureContext, Exposed=Window] interface SensorErrorEvent : Event { readonly attribute Error error; }; @@ -49,12 +45,12 @@ dictionary SensorErrorEventInit : EventInit { required Error error; }; -</pre> +</script> <script> -(function() { +(() => { "use strict"; - var idl_array = new IdlArray(); + let idl_array = new IdlArray(); idl_array.add_untested_idls(document.getElementById('idl').textContent); idl_array.add_idls(document.getElementById('generic-idl').textContent);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https-expected.txt deleted file mode 100644 index 8b13789..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https-expected.txt +++ /dev/null
@@ -1 +0,0 @@ -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https.html b/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https.html index 791bdc1..ca8f69d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/gyroscope/idlharness.https.html
@@ -8,32 +8,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/WebIDLParser.js"></script> <script src="/resources/idlharness.js"></script> -<style> - pre { - display: none; - } -</style> <div id="log"></div> -<pre id="idl"> -interface Event { -}; - -interface Error { -}; - -dictionary EventInit { -}; - +<script id="idl" type="text/plain"> interface EventTarget { }; interface EventHandler { }; -</pre> +</script> -<pre id="generic-idl"> -[SecureContext] +<script id="gyroscope-idl" type="text/plain"> +// The interface of Sensor is defined in +// https://www.w3.org/TR/generic-sensor/#idl-index +[SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; readonly attribute DOMHighResTimeStamp? timestamp; @@ -44,36 +32,19 @@ attribute EventHandler onerror; }; -dictionary SensorOptions { - double? frequency; -}; - -[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] -interface SensorErrorEvent : Event { - readonly attribute Error error; -}; - -dictionary SensorErrorEventInit : EventInit { - required Error error; -}; -</pre> - -<pre id="gyroscope-idl"> -[Constructor(optional SensorOptions sensorOptions)] +[Constructor(optional SensorOptions sensorOptions), Exposed=Window] interface Gyroscope : Sensor { readonly attribute unrestricted double? x; readonly attribute unrestricted double? y; readonly attribute unrestricted double? z; }; -</pre> +</script> <script> - (() => { "use strict"; let idl_array = new IdlArray(); idl_array.add_untested_idls(document.getElementById('idl').textContent); - idl_array.add_untested_idls(document.getElementById('generic-idl').textContent); idl_array.add_idls(document.getElementById('gyroscope-idl').textContent); idl_array.add_objects({ @@ -82,5 +53,4 @@ idl_array.test(); })(); - </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/event-handler-spec-example-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/event-handler-spec-example-expected.txt deleted file mode 100644 index 18e2bcb..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/event-handler-spec-example-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -FAIL Event handler listeners should be registered when they are first set to an object value (object "[object Object]"). assert_equals: expected 2 but got 1 -FAIL Event handler listeners should be registered when they are first set to an object value (function "function () {}"). assert_equals: expected 2 but got 1 -FAIL Event handler listeners should be registered when they are first set to an object value (object "42"). assert_equals: expected 2 but got 1 -FAIL Event handler listeners should be registered when they are first set to an object value (object ""). assert_equals: expected 2 but got 1 -FAIL Event handler listeners should be registered when they are first set to an object value (42). assert_equals: expected 3 but got 2 -FAIL Event handler listeners should be registered when they are first set to an object value (null). assert_equals: expected 3 but got 2 -FAIL Event handler listeners should be registered when they are first set to an object value (undefined). assert_equals: expected 3 but got 2 -FAIL Event handler listeners should be registered when they are first set to an object value (""). assert_equals: expected 3 but got 2 -FAIL Event handler listeners should be registered when they are first set to an object value. assert_equals: expected 3 but got 2 -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt deleted file mode 100644 index e310d230..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Inline event handlers retain their ordering when invalid and force-compiled assert_array_equals: property 1, expected "TWO" but got "THREE" -FAIL Inline event handlers retain their ordering when invalid and force-compiled via dispatch assert_array_equals: property 3, expected "TWO" but got "THREE" -FAIL Inline event handlers retain their ordering when invalid and lazy-compiled assert_array_equals: property 1, expected "TWO" but got "THREE" -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/http/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/http/OWNERS index 1d011a7..5cb08fb 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/http/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/http/OWNERS
@@ -1 +1,2 @@ # TEAM: loading-dev@chromium.org +# COMPONENT: Blink>Loader
diff --git a/third_party/WebKit/LayoutTests/external/wpt/innerText/getter-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/innerText/getter-expected.txt index 10a8f78..db82993 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/innerText/getter-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/innerText/getter-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 213 tests; 129 PASS, 84 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 213 tests; 130 PASS, 83 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS Simplest possible test ("<div>abc") PASS Leading whitespace removed ("<div> abc") PASS Trailing whitespace removed ("<div>abc ") @@ -138,7 +138,7 @@ FAIL Blank lines around <p> even without margin ("<div>123<p style='margin:0px'>abc</p>def") assert_equals: expected "123\n\nabc\n\ndef" but got "123\nabc\n\ndef" FAIL No blank lines around <h1> ("<div>123<h1>abc</h1>def") assert_equals: expected "123\nabc\ndef" but got "123\nabc\n\ndef" FAIL No blank lines around <h2> ("<div>123<h2>abc</h2>def") assert_equals: expected "123\nabc\ndef" but got "123\nabc\n\ndef" -FAIL No blank lines around <h3> ("<div>123<h3>abc</h3>def") assert_equals: expected "123\nabc\ndef" but got "123\nabc\n\ndef" +PASS No blank lines around <h3> ("<div>123<h3>abc</h3>def") PASS No blank lines around <h4> ("<div>123<h4>abc</h4>def") PASS No blank lines around <h5> ("<div>123<h5>abc</h5>def") PASS No blank lines around <h6> ("<div>123<h6>abc</h6>def")
diff --git a/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist b/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist index 7e33959..40d2a7dd 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist +++ b/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist
@@ -152,7 +152,7 @@ SET TIMEOUT: common/reftest-wait.js SET TIMEOUT: conformance-checkers/* SET TIMEOUT: content-security-policy/* -SET TIMEOUT: css-font-display/font-display.html +SET TIMEOUT: css-fonts/font-display/font-display.html SET TIMEOUT: encrypted-media/Google/migrated_to_root_disabled/encrypted-media-utils.js SET TIMEOUT: encrypted-media/polyfill/chrome-polyfill.js SET TIMEOUT: encrypted-media/polyfill/clearkey-polyfill.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https-expected.txt index 8b13789..3af2ee7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https-expected.txt
@@ -1 +1,61 @@ +This is a testharness.js-based test. +PASS Sensor interface: existence and properties of interface object +PASS Sensor interface object length +PASS Sensor interface object name +PASS Sensor interface: existence and properties of interface prototype object +PASS Sensor interface: existence and properties of interface prototype object's "constructor" property +PASS Sensor interface: attribute activated +PASS Sensor interface: attribute timestamp +PASS Sensor interface: operation start() +PASS Sensor interface: operation stop() +PASS Sensor interface: attribute onreading +PASS Sensor interface: attribute onactivate +PASS Sensor interface: attribute onerror +PASS Magnetometer interface: existence and properties of interface object +PASS Magnetometer interface object length +PASS Magnetometer interface object name +PASS Magnetometer interface: existence and properties of interface prototype object +PASS Magnetometer interface: existence and properties of interface prototype object's "constructor" property +PASS Magnetometer interface: attribute x +PASS Magnetometer interface: attribute y +PASS Magnetometer interface: attribute z +PASS Magnetometer must be primary interface of new Magnetometer(); +PASS Stringification of new Magnetometer(); +PASS Magnetometer interface: new Magnetometer(); must inherit property "x" with the proper type +PASS Magnetometer interface: new Magnetometer(); must inherit property "y" with the proper type +PASS Magnetometer interface: new Magnetometer(); must inherit property "z" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "activated" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "timestamp" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "start()" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "stop()" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "onreading" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "onactivate" with the proper type +PASS Sensor interface: new Magnetometer(); must inherit property "onerror" with the proper type +FAIL UncalibratedMagnetometer interface: existence and properties of interface object assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface object length assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface object name assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: existence and properties of interface prototype object assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute x assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute y assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute z assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute xBias assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute yBias assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer interface: attribute zBias assert_own_property: self does not have own property "UncalibratedMagnetometer" expected property "UncalibratedMagnetometer" missing +FAIL UncalibratedMagnetometer must be primary interface of new UncalibratedMagnetometer(); assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Stringification of new UncalibratedMagnetometer(); assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "x" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "y" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "z" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "xBias" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "yBias" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL UncalibratedMagnetometer interface: new UncalibratedMagnetometer(); must inherit property "zBias" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "activated" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "timestamp" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "start()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "stop()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "onreading" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "onactivate" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +FAIL Sensor interface: new UncalibratedMagnetometer(); must inherit property "onerror" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: UncalibratedMagnetometer is not defined" +Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https.html b/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https.html index f32b72706..2f98dda 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/magnetometer/idlharness.https.html
@@ -8,32 +8,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/WebIDLParser.js"></script> <script src="/resources/idlharness.js"></script> -<style> - pre { - display: none; - } -</style> <div id="log"></div> -<pre id="idl"> -interface Event { -}; - -interface Error { -}; - -dictionary EventInit { -}; - +<script id="idl" type="text/plain"> interface EventTarget { }; interface EventHandler { }; -</pre> +</script> -<pre id="generic-idl"> -[SecureContext] +<script id="magnetometer-idl" type="text/plain"> +// The interface of Sensor is defined in +// https://www.w3.org/TR/generic-sensor/#idl-index +[SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; readonly attribute DOMHighResTimeStamp? timestamp; @@ -44,29 +32,14 @@ attribute EventHandler onerror; }; -dictionary SensorOptions { - double? frequency; -}; - -[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] -interface SensorErrorEvent : Event { - readonly attribute Error error; -}; - -dictionary SensorErrorEventInit : EventInit { - required Error error; -}; -</pre> - -<pre id="magnetometer-idl"> -[Constructor(optional SensorOptions sensorOptions)] +[Constructor(optional SensorOptions sensorOptions), Exposed=Window] interface Magnetometer : Sensor { readonly attribute unrestricted double? x; readonly attribute unrestricted double? y; readonly attribute unrestricted double? z; }; -[Constructor(optional SensorOptions sensorOptions)] +[Constructor(optional SensorOptions sensorOptions), Exposed=Window] interface UncalibratedMagnetometer : Sensor { readonly attribute unrestricted double? x; readonly attribute unrestricted double? y; @@ -75,26 +48,20 @@ readonly attribute unrestricted double? yBias; readonly attribute unrestricted double? zBias; }; -</pre> +</script> <script> - (() => { "use strict"; let idl_array = new IdlArray(); idl_array.add_untested_idls(document.getElementById('idl').textContent); - idl_array.add_untested_idls(document.getElementById('generic-idl').textContent); idl_array.add_idls(document.getElementById('magnetometer-idl').textContent); idl_array.add_objects({ - Magnetometer: ['new Magnetometer();'] - }); - - idl_array.add_objects({ + Magnetometer: ['new Magnetometer();'], UncalibratedMagnetometer: ['new UncalibratedMagnetometer();'] }); idl_array.test(); })(); - </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https-expected.txt deleted file mode 100644 index 8b13789..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https-expected.txt +++ /dev/null
@@ -1 +0,0 @@ -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https.html b/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https.html index 92ed7d4bd..82ab9b3 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/orientation-sensor/idlharness.https.html
@@ -8,32 +8,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/WebIDLParser.js"></script> <script src="/resources/idlharness.js"></script> -<style> - pre { - display: none; - } -</style> <div id="log"></div> -<pre id="idl"> -interface Event { -}; - -interface Error { -}; - -dictionary EventInit { -}; - +<script id="idl" type="text/plain"> interface EventTarget { }; interface EventHandler { }; -</pre> +</script> -<pre id="generic-idl"> -[SecureContext] +<script id="orientation-idl" type="text/plain"> +// The interface of Sensor is defined in +// https://www.w3.org/TR/generic-sensor/#idl-index +[SecureContext, Exposed=Window] interface Sensor : EventTarget { readonly attribute boolean activated; readonly attribute DOMHighResTimeStamp? timestamp; @@ -44,54 +32,35 @@ attribute EventHandler onerror; }; -dictionary SensorOptions { - double? frequency; -}; - -[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] -interface SensorErrorEvent : Event { - readonly attribute Error error; -}; - -dictionary SensorErrorEventInit : EventInit { - required Error error; -}; -</pre> - -<pre id="orientation-idl"> typedef (Float32Array or Float64Array or DOMMatrix) RotationMatrixType; + +[Exposed=Window] interface OrientationSensor : Sensor { readonly attribute FrozenArray<double>? quaternion; void populateMatrix(RotationMatrixType targetMatrix); }; -[Constructor(optional SensorOptions sensorOptions)] +[Constructor(optional SensorOptions sensorOptions), Exposed=Window] interface AbsoluteOrientationSensor : OrientationSensor { }; -[Constructor(optional SensorOptions sensorOptions)] +[Constructor(optional SensorOptions sensorOptions), Exposed=Window] interface RelativeOrientationSensor : OrientationSensor { }; -</pre> +</script> <script> - (() => { "use strict"; let idl_array = new IdlArray(); idl_array.add_untested_idls(document.getElementById('idl').textContent); - idl_array.add_untested_idls(document.getElementById('generic-idl').textContent); idl_array.add_idls(document.getElementById('orientation-idl').textContent); idl_array.add_objects({ - AbsoluteOrientationSensor: ['new AbsoluteOrientationSensor();'] - }); - - idl_array.add_objects({ + AbsoluteOrientationSensor: ['new AbsoluteOrientationSensor();'], RelativeOrientationSensor: ['new RelativeOrientationSensor();'] }); idl_array.test(); })(); - </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/viewport/viewport-attribute-event-handlers-manual.html b/third_party/WebKit/LayoutTests/external/wpt/viewport/viewport-attribute-event-handlers-manual.html new file mode 100644 index 0000000..896f6cd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/viewport/viewport-attribute-event-handlers-manual.html
@@ -0,0 +1,75 @@ +<!doctype html> +<html> + <head> + <title>Viewport: Attribute event handlers test</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="viewport_support.js"></script> + <script> + setup({explicit_timeout: true, explicit_done: true}) + </script> + </head> + <body> + <h1>Viewport: Attribute event handlers test</h1> + <h4> + Test Description: This test checks that attribute event handlers function correctly. + </h4> + <h2 style="color: red">THIS IS A MANUAL TEST</h2> + <p id="skip"> + <button id="skipbtn" onclick="skipManualTest();">Skip Test</button> + </p> + <p id="instruction"></p> + <button id="continue">Start Test</button> + <div id="log"></div> + </body> + <script> + var continueBtn = document.getElementById("continue"); + + function continueTest() { + nextStep(function(instructionText) { + var instruction = document.getElementById("instruction"); + continueBtn.innerText = "Continue"; + instruction.innerText = instructionText; + }); + } + + continueBtn.addEventListener('click', continueTest); + + var didFireResize = false; + var didFireScroll = false; + + addManualTestStep( + function() { + test(() => { + assert_not_equals(typeof(window.visualViewport.onresize), + 'undefined', + 'onresize is defined'); + assert_not_equals(typeof(window.visualViewport.onscroll), + 'undefined', + 'onscroll is defined'); + }, 'Attribute event handlers defined'); + + window.visualViewport.onresize = function(e) { + didFireResize = true; + }; + window.visualViewport.onscroll = function(e) { + didFireScroll = true; + }; + }, + null, + '1. Pinch-zoom into the screen anywhere by any amount.'); + + addManualTestStep( + function() { + test(() => { + assert_true(didFireResize, 'Resize event fired'); + assert_true(didFireScroll, 'Scroll event fired'); + }, 'Event handler functionality'); + continueBtn.remove(); + }, + null, + 'Test Complete'); + </script> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize-expected.txt index 318f6cb..9165128 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL Initialize a new RTCPeerConnection with no iceCandidatePoolSize pc.getConfiguration is not a function -FAIL Initialize a new RTCPeerConnection with iceCandidatePoolSize: 0 pc.getConfiguration is not a function -FAIL Initialize a new RTCPeerConnection with iceCandidatePoolSize: 255 pc.getConfiguration is not a function +FAIL Initialize a new RTCPeerConnection with no iceCandidatePoolSize assert_idl_attribute: property "getConfiguration" not found in prototype chain +FAIL Initialize a new RTCPeerConnection with iceCandidatePoolSize: 0 assert_idl_attribute: property "getConfiguration" not found in prototype chain +FAIL Initialize a new RTCPeerConnection with iceCandidatePoolSize: 255 assert_idl_attribute: property "getConfiguration" not found in prototype chain PASS Initialize a new RTCPeerConnection with iceCandidatePoolSize: -1 (Out Of Range) PASS Initialize a new RTCPeerConnection with iceCandidatePoolSize: 256 (Out Of Range) -FAIL Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 0 pc.getConfiguration is not a function -FAIL Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 255 pc.getConfiguration is not a function +FAIL Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 0 assert_idl_attribute: property "getConfiguration" not found in prototype chain +FAIL Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 255 assert_idl_attribute: property "getConfiguration" not found in prototype chain PASS Reconfigure RTCPeerConnection instance iceCandidatePoolSize to -1 (Out Of Range) PASS Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 256 (Out Of Range) Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize.html b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize.html index f424ec60..2e6859d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize.html +++ b/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCConfiguration-iceCandidatePoolSize.html
@@ -26,6 +26,7 @@ */ test(() => { const pc = new RTCPeerConnection(); + assert_idl_attribute(pc, "getConfiguration"); assert_equals(pc.getConfiguration().iceCandidatePoolSize, 0); }, "Initialize a new RTCPeerConnection with no iceCandidatePoolSize"); @@ -33,6 +34,7 @@ const pc = new RTCPeerConnection({ iceCandidatePoolSize: 0 }); + assert_idl_attribute(pc, "getConfiguration"); assert_equals(pc.getConfiguration().iceCandidatePoolSize, 0); }, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 0"); @@ -40,6 +42,7 @@ const pc = new RTCPeerConnection({ iceCandidatePoolSize: 255 }); + assert_idl_attribute(pc, "getConfiguration"); assert_equals(pc.getConfiguration().iceCandidatePoolSize, 255); }, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 255"); @@ -63,9 +66,11 @@ /* Reconfiguration */ -const pc = new RTCPeerConnection({}); test(() => { + const pc = new RTCPeerConnection(); + assert_idl_attribute(pc, "getConfiguration"); + assert_idl_attribute(pc, "setConfiguration"); pc.setConfiguration({ iceCandidatePoolSize: 0 }); @@ -73,6 +78,9 @@ }, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 0"); test(() => { + const pc = new RTCPeerConnection(); + assert_idl_attribute(pc, "getConfiguration"); + assert_idl_attribute(pc, "setConfiguration"); pc.setConfiguration({ iceCandidatePoolSize: 255 }); @@ -88,8 +96,8 @@ */ test(() => { + const pc = new RTCPeerConnection(); assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented"); - assert_throws(new TypeError(), () => { pc.setConfiguration({ iceCandidatePoolSize: -1 @@ -98,8 +106,8 @@ }, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to -1 (Out Of Range)"); test(() => { + const pc = new RTCPeerConnection(); assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented"); - assert_throws(new TypeError(), () => { pc.setConfiguration({ iceCandidatePoolSize: 256
diff --git a/third_party/WebKit/LayoutTests/external/wpt/websockets/constructor/011.html b/third_party/WebKit/LayoutTests/external/wpt/websockets/constructor/011.html index 6f55bc0..f7a2b99b 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/websockets/constructor/011.html +++ b/third_party/WebKit/LayoutTests/external/wpt/websockets/constructor/011.html
@@ -8,20 +8,20 @@ <div id=log></div> <script> async_test(function(t) { + // Sub-protocol matching is case-sensitive. var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/handshake_protocol', 'FOOBAR'); var gotOpen = false; var gotError = false; ws.onopen = t.step_func(function(e) { gotOpen = true; - }) + }); ws.onerror = t.step_func(function(e) { gotError = true; - }) + }); ws.onclose = t.step_func(function(e) { - assert_true(gotOpen, 'got open'); + assert_false(gotOpen, 'got open'); assert_true(gotError, 'got error'); - ws.onclose = t.unreached_func(); - t.step_timeout(() => t.done(), 50); - }) + t.done(); + }); }); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/block/min-max-height-percent-height-child-expected.txt b/third_party/WebKit/LayoutTests/fast/block/min-max-height-percent-height-child-expected.txt index 0069aeb..27fb444 100644 --- a/third_party/WebKit/LayoutTests/fast/block/min-max-height-percent-height-child-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/block/min-max-height-percent-height-child-expected.txt
@@ -5,53 +5,38 @@ Each of the following tests should display a green rectangle with a 1 pixel red border on all sides. Parent with fixed height and min set - PASS Parent with fixed height and max set - PASS Parent with fixed height and min greater than max - PASS Vertical parent with fixed width and max set - PASS Vertical parent with fixed width and min set - PASS Parent with percent height and a max set - PASS Parent with percent height and a min set - PASS Parent with fixed height and percentage max - PASS Parent with fixed height and percentage min - PASS Parent with auto height and a max set. This test will not have the border all around, it will only be on the top portion. - XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX PASS Parent with auto height and a min set - XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX PASS The following two tests will have a 6 pixel red border. Parent with fixed height and padding and max set - PASS Parent with fixed height and padding and min set - PASS Fixed height parent with scroll bar - XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX PASS Parent with percent height and scroll bar - XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX PASS
diff --git a/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-iframe-expected.txt b/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-iframe-expected.txt index cb23fdf..a1ffe61 100644 --- a/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-iframe-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-iframe-expected.txt
@@ -2,6 +2,5 @@ This test verifies that offsetLeft is calculated correctly for a relatively positioned iframe element inside a table. - node.offsetLeft=303 (Should be 303 as in FF and IE) findPosX=303 (Should be 303 as in FF and IE)
diff --git a/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-td-expected.txt b/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-td-expected.txt index ae222aa..2e0dbb8 100644 --- a/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-td-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-td-expected.txt
@@ -2,6 +2,5 @@ This test verifies that offsetLeft is calculated correctly for a relatively positioned td element. - node.offsetParent.offsetLeft=302 (Should be 302 as in FF and IE) findPosX=302 (Should be 302 as in FF and IE)
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-overflow-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-overflow-expected.txt index 66adacad..e445189 100644 --- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-overflow-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-overflow-expected.txt
@@ -1,6 +1,5 @@ Test for WebKit bug 27554: getComputedStyle does not contain a value for text-overflow - This text should overflow the box but should show ellipsis when the text is cut off at the edge of the box because it doesn't fit in the box as is. This text should also overflow the box but should be clipped so that you don't see any ellipsis and the text just seems to end at an awkward place because it doesn't fit in the box.
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt index 012c6bbf..7c1082a49 100644 --- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt
@@ -1,6 +1,5 @@ Test for WebKit bug 24021: pseudo-element styles not accessible / retrievable via DOM methods - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Middle
diff --git a/third_party/WebKit/LayoutTests/fast/css/list-item-text-align-expected.txt b/third_party/WebKit/LayoutTests/fast/css/list-item-text-align-expected.txt index c57943b..9131fee 100644 --- a/third_party/WebKit/LayoutTests/fast/css/list-item-text-align-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/css/list-item-text-align-expected.txt
@@ -1,5 +1,4 @@ This test verifies that text-align:-webkit-match-parent is the default style for list elements. - The test passes if all the lines containing the text "Left Align" are aligned to the left and vice-versa for "Right Align". PASS PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css/text-align-webkit-match-parent-expected.txt b/third_party/WebKit/LayoutTests/fast/css/text-align-webkit-match-parent-expected.txt index 21e131dc..a8e8dca 100644 --- a/third_party/WebKit/LayoutTests/fast/css/text-align-webkit-match-parent-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/css/text-align-webkit-match-parent-expected.txt
@@ -1,5 +1,4 @@ Test that verifies the behavior of text-align:-webkit-match-parent. - The test passes if all the lines containing the text "Left Align" are aligned to the left and vice-versa for "Right Align". Cases where the outermost div is LTR. PASS
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Range/surround-contents-font-face-crash-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Range/surround-contents-font-face-crash-expected.txt index 553fce6..5043424 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Range/surround-contents-font-face-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Range/surround-contents-font-face-crash-expected.txt
@@ -1,7 +1,5 @@ ALERT: PASS. WebKit didn't crash. This page contains the following errors: - error on line 20 at column 10: Extra content at the end of the document Below is a rendering of the page up to the first error. -
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt index a3eef918..797b754 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
@@ -101,6 +101,8 @@ PASS window.cached_visualViewport.height is 0 PASS window.cached_visualViewport.offsetLeft is 0 PASS window.cached_visualViewport.offsetTop is 0 +PASS window.cached_visualViewport.onresize is null +PASS window.cached_visualViewport.onscroll is null PASS window.cached_visualViewport.pageLeft is 0 PASS window.cached_visualViewport.pageTop is 0 PASS window.cached_visualViewport.scale is 0
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt index 0c524bba..0500d98 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
@@ -101,6 +101,8 @@ PASS window.cached_visualViewport.height is 0 PASS window.cached_visualViewport.offsetLeft is 0 PASS window.cached_visualViewport.offsetTop is 0 +PASS window.cached_visualViewport.onresize is null +PASS window.cached_visualViewport.onscroll is null PASS window.cached_visualViewport.pageLeft is 0 PASS window.cached_visualViewport.pageTop is 0 PASS window.cached_visualViewport.scale is 0
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt index ff49816..b82f5e74 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
@@ -101,6 +101,8 @@ PASS window.cached_visualViewport.height is 0 PASS window.cached_visualViewport.offsetLeft is 0 PASS window.cached_visualViewport.offsetTop is 0 +PASS window.cached_visualViewport.onresize is null +PASS window.cached_visualViewport.onscroll is null PASS window.cached_visualViewport.pageLeft is 0 PASS window.cached_visualViewport.pageTop is 0 PASS window.cached_visualViewport.scale is 0
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt index f6ae968..d871814e 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
@@ -225,6 +225,8 @@ PASS oldChildWindow.visualViewport.height is newChildWindow.visualViewport.height PASS oldChildWindow.visualViewport.offsetLeft is newChildWindow.visualViewport.offsetLeft PASS oldChildWindow.visualViewport.offsetTop is newChildWindow.visualViewport.offsetTop +PASS oldChildWindow.visualViewport.onresize is newChildWindow.visualViewport.onresize +PASS oldChildWindow.visualViewport.onscroll is newChildWindow.visualViewport.onscroll PASS oldChildWindow.visualViewport.pageLeft is newChildWindow.visualViewport.pageLeft PASS oldChildWindow.visualViewport.pageTop is newChildWindow.visualViewport.pageTop PASS oldChildWindow.visualViewport.scale is newChildWindow.visualViewport.scale
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt index 0ddd635c..8c37d30 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
@@ -193,6 +193,8 @@ PASS childWindow.visualViewport.height is 0 PASS childWindow.visualViewport.offsetLeft is 0 PASS childWindow.visualViewport.offsetTop is 0 +PASS childWindow.visualViewport.onresize is null +PASS childWindow.visualViewport.onscroll is null PASS childWindow.visualViewport.pageLeft is 0 PASS childWindow.visualViewport.pageTop is 0 PASS childWindow.visualViewport.scale is 0
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt index ca90a90..aed7502 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
@@ -193,6 +193,8 @@ PASS childWindow.visualViewport.height is 0 PASS childWindow.visualViewport.offsetLeft is 0 PASS childWindow.visualViewport.offsetTop is 0 +PASS childWindow.visualViewport.onresize is null +PASS childWindow.visualViewport.onscroll is null PASS childWindow.visualViewport.pageLeft is 0 PASS childWindow.visualViewport.pageTop is 0 PASS childWindow.visualViewport.scale is 0
diff --git a/third_party/WebKit/LayoutTests/fast/dom/adopt-attribute-crash-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/adopt-attribute-crash-expected.txt index 1084a1a..686d157 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/adopt-attribute-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/adopt-attribute-crash-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 3 at column 66: Namespaced Attribute href in 'http://www.w3.org/1999/xlink' redefined error on line 18 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error. -
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inner-text-001-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/inner-text-001-expected.txt index e5e2c9d..5a96289 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/inner-text-001-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/inner-text-001-expected.txt
@@ -1,7 +1,6 @@ Test innerText Check lists, tables, styled text, and images. - Block flow elements get line breaks before and after. Table cells are tab separated. Item 1 Item 2 @@ -12,7 +11,6 @@ And an inline table with one row is here, too. And an inline table with rows not far behind. Check collapsed margins - Collapsed margins are supposed to result in an extra line break. First header Second header @@ -24,7 +22,6 @@ Test innerText Check lists, tables, styled text, and images. - Block flow elements get line breaks before and after. Table cells are tab separated. Item 1 Item 2 @@ -35,7 +32,6 @@ And an inline table with one row is here, too. And an inline table with rows not far behind. Check collapsed margins - Collapsed margins are supposed to result in an extra line break. First header Second header
diff --git a/third_party/WebKit/LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt index fedbc414..accf9b2 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt
@@ -1,6 +1,4 @@ This page contains the following errors: - error on line 14 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error. -
diff --git a/third_party/WebKit/LayoutTests/fast/events/drag-link-expected.txt b/third_party/WebKit/LayoutTests/fast/events/drag-link-expected.txt index 142f83a..30b0fdeb 100644 --- a/third_party/WebKit/LayoutTests/fast/events/drag-link-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/drag-link-expected.txt
@@ -2,7 +2,6 @@ Test Link Editable area - Test Link PASS
diff --git a/third_party/WebKit/LayoutTests/fast/events/drag-selects-image-expected.txt b/third_party/WebKit/LayoutTests/fast/events/drag-selects-image-expected.txt index 8e7b0e5..cecab69 100644 --- a/third_party/WebKit/LayoutTests/fast/events/drag-selects-image-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/drag-selects-image-expected.txt
@@ -1,9 +1,7 @@ Non-editable area - Editable area - This tests that images are properly left selected or unselected when an image drag is started. Only the image in the editable area should be selected when an image drag is started. Starting test...
diff --git a/third_party/WebKit/LayoutTests/fast/forms/button/button-click-DOM-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/button/button-click-DOM-expected.txt index 9702152..186b6a1 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/button/button-click-DOM-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/forms/button/button-click-DOM-expected.txt
@@ -1,5 +1,4 @@ Test case for HTMLButtonElement.click() - Successful if it reads "test passed" below upon loading the page No need to click me. In fact, don't. test passed
diff --git a/third_party/WebKit/LayoutTests/fast/forms/select/select-namedItem-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/select/select-namedItem-expected.txt index dba57c9d..3295be5 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/select/select-namedItem-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/forms/select/select-namedItem-expected.txt
@@ -1,5 +1,4 @@ Test for HTMLSelectElement.namedItem() - FOUND ITEM: 2 FOUND ITEM: 1 FOUND ITEM: 1
diff --git a/third_party/WebKit/LayoutTests/fast/invalid/nestedh3s-rapidweaver-expected.txt b/third_party/WebKit/LayoutTests/fast/invalid/nestedh3s-rapidweaver-expected.txt index 5e2a1af0..12683c5 100644 --- a/third_party/WebKit/LayoutTests/fast/invalid/nestedh3s-rapidweaver-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/invalid/nestedh3s-rapidweaver-expected.txt
@@ -4,5 +4,4 @@ h3.nextSibling: DIV h3.nextSibling.innerText: content header - content
diff --git a/third_party/WebKit/LayoutTests/fast/multicol/widows-and-orphans-expected.txt b/third_party/WebKit/LayoutTests/fast/multicol/widows-and-orphans-expected.txt index 2b6da5f..930f453 100644 --- a/third_party/WebKit/LayoutTests/fast/multicol/widows-and-orphans-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/multicol/widows-and-orphans-expected.txt
@@ -1,17 +1,11 @@ Testing widows and orphans. Any green lines should be at the bottom of pages/columns, and any red lines should be at the top of pages/columns. test1 - Normal breaking - test2 - Basic Orphan - test3 - Basic Widow - test4 - Orphans causing Widows - test5 - Widows blocked by Orphan rule - test6 - Ridiculous values - PASS: test1 Block 1 Line 1 is correct. PASS: test1 Block 2 Line 5 is correct.
diff --git a/third_party/WebKit/LayoutTests/fast/parser/external-entities-expected.txt b/third_party/WebKit/LayoutTests/fast/parser/external-entities-expected.txt index 7e5115b..526b7b9 100644 --- a/third_party/WebKit/LayoutTests/fast/parser/external-entities-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/parser/external-entities-expected.txt
@@ -1,6 +1,4 @@ This page contains the following errors: - error on line 9 at column 13: Entity 'message' not defined Below is a rendering of the page up to the first error. - This should be the only line on this page. You should see a parse error above.
diff --git a/third_party/WebKit/LayoutTests/fast/parser/xml-colon-entity-expected.txt b/third_party/WebKit/LayoutTests/fast/parser/xml-colon-entity-expected.txt index db8839b6..b9f0b41 100644 --- a/third_party/WebKit/LayoutTests/fast/parser/xml-colon-entity-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/parser/xml-colon-entity-expected.txt
@@ -8,7 +8,6 @@ Frame: 'xml-parser' -------- This page contains the following errors: - error on line 2 at column 14: Entity ':' not defined error on line 5 at column 1: AttValue: ' expected Below is a rendering of the page up to the first error.
diff --git a/third_party/WebKit/LayoutTests/fast/parser/xml-declaration-missing-ending-mark-expected.txt b/third_party/WebKit/LayoutTests/fast/parser/xml-declaration-missing-ending-mark-expected.txt index dd95547..581cb4a 100644 --- a/third_party/WebKit/LayoutTests/fast/parser/xml-declaration-missing-ending-mark-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/parser/xml-declaration-missing-ending-mark-expected.txt
@@ -11,6 +11,5 @@ Frame: 'xml-parser' -------- This page contains the following errors: - error on line 1 at column 20: Blank needed here Below is a rendering of the page up to the first error.
diff --git a/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt index 6bd7377..0ad69480 100644 --- a/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 396653. Tables with specific merge cell configuration render improperly when removing table column. - Second row is rowspan-only-cell and some empty cells present in the row because td node is deleted from the dom tree using script. So Please check that second row height should not be zero in this case. PASS PASS
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt index c24f1a7..7adf830 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 252120. Content of the row spanning cell is flowing out of the cell boundries. - Row spanning cell height is not set as per its content height or given height to this cells. Test 1 - One row spanning cell present under the boundries of other row spanning cell and inner row spanning cell have lots of content. row0 col0 rowspan=6 height=400px row0 col1
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-colgroup-present-after-table-row-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-colgroup-present-after-table-row-expected.txt index fef0630..4e52fe0 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-colgroup-present-after-table-row-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-colgroup-present-after-table-row-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 305169. <colgroup> is ignored if seen after <tr>. - Columns width are not based on width specified in colGroup because colGroup is present after table row and we was supporting it only when colGroup is present at the start in table. First PASS
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-override-logical-content-height-reset-issue-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-override-logical-content-height-reset-issue-expected.txt index e72b8a0..f13cf41 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-override-logical-content-height-reset-issue-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-override-logical-content-height-reset-issue-expected.txt
@@ -1,4 +1,3 @@ Test for chromium bug : 445253. Setting rowspan=2 on the table cell causes the whole table to resize again and again. - PASS
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-with-empty-cell-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-with-empty-cell-expected.txt index 25d949f..e187833 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-with-empty-cell-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-cell-with-empty-cell-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 258420. Table rows are incorrectly collapsed in case of hidden cells and rowspans. - A spanning cell whose rows have only empty cell(s) shouldn't have a non-zero height. A A1 A1.1 A2
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-only-percent-rows-with-less-than-100-percent-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-only-percent-rows-with-less-than-100-percent-expected.txt index 219b6e6..3579a3e 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-only-percent-rows-with-less-than-100-percent-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-only-percent-rows-with-less-than-100-percent-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 366579. ASSERTION FAILED: !extraRowSpanningHeight in WebCore::LayoutTableSection::distributeRowSpanHeightToRows. For this test to PASS, it should not crash. - A
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-pedding-value-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-pedding-value-expected.txt index 63cda34..1b3b10f 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-pedding-value-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-pedding-value-expected.txt
@@ -1,7 +1,6 @@ Test for chromium bug : 334652. ASSERTION FAILED: !remainder in WebCore::LayoutTableSection::distributeExtraRowSpanHeightToAutoRows. For this test to PASS, it should not crash. - r0c0 r0c1 rowspan=2
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-2-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-2-expected.txt index fedbe85..fa8b556d 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-2-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-2-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 296003. Heap-buffer-overflow in void std::__final_insertion_sort. - For this test to PASS, it should not crash. row0col0 (rowspan=3) row0col1 (rowspan=3) row0col2 (rowspan=6) row0col3 (rowspan=4) row0col4 (rowspan=16) row0col5 (rowspan=4) row0col6 (rowspan=12) row0col7 (rowspan=4) row0col8 (rowspan=12) row1col9
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-expected.txt index 7457bd1..f072852 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-crash-with-huge-rowspan-cells-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 276253. Crash when opening web page http://build.webkit.org/waterfall. - It should not crash. delete stale build files killed old processes
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt index a38256c..acf3b5e 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 78724. Extra logical height is not properly spread over the rows in a row-spanning cell. - Rows in rowspan should get proportional height. Test 1 - One rowSpan cell row0 col0
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt index b8fc36f..02af5d8 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 254914. Height of fixed height cell is not proper when cell's row is under row spanning cell. - Rows in rowspan should get proportional height. Test 1 - One rowSpan cell row0 col0
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-less-than-one-percent-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-less-than-one-percent-expected.txt index 537d251..b22c5dc 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-less-than-one-percent-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-less-than-one-percent-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 408066. ASSERTION FAILED: !extraRowSpanningHeight in blink::RenderTableSection::distributeRowSpanHeightToRows. - FAIL: Expected 22 for height, but got 20.
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt index 0fdccbc..87ccb731 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 406043. Negative row height when cell has percentage height. - This is rowspan cell. It would span 3 rows in table. This is first row second column. PASS This is second row first column. But it should display as second column.
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-table-height-and-row-precent-height-too-large-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-table-height-and-row-precent-height-too-large-expected.txt index 4654f37..ae4a158 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-table-height-and-row-precent-height-too-large-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-table-height-and-row-precent-height-too-large-expected.txt
@@ -1,6 +1,5 @@ Test for chromium bug : 408066. Page is crashing on assression when table row span cell's percent height is too large. - For this test to PASS, it should not crash. This row span cell height is too large.
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-wrong-height-with-only-spanning-cells-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-wrong-height-with-only-spanning-cells-expected.txt index bfe733f2..faab1cf0 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-wrong-height-with-only-spanning-cells-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-wrong-height-with-only-spanning-cells-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 396655. Tables with specific merge cell configuration render with extra height to tr elements. - We have the below table. Because cell A and cell D overlap in the second row, the height of the second row is the 1px difference between A and B and the 1px difference between C and D. +-----+-----+
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-sections-border-spacing-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-sections-border-spacing-expected.txt index aa2f4c5..d0c536b 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-sections-border-spacing-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-sections-border-spacing-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 29502. border-spacing is doubled between table-row-groups. - Border-spacing was adding twice, One for bottom of first section and another for top of second section. But bottom of first section and top of second section border spacing should be common. Distance between all rows in the table should be same.
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-toggle-paragraph-padding-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-toggle-paragraph-padding-expected.txt index a3eb63c..9359605 100644 --- a/third_party/WebKit/LayoutTests/fast/table/table-toggle-paragraph-padding-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/table/table-toggle-paragraph-padding-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 241331. Margins on children of display:table-cell elements get stuck at highest value. - BeforeMargin of the row was not reseting back to 0 when margin of the cell's child is changed from 100px to 0. The two blocks below should look identical.
diff --git a/third_party/WebKit/LayoutTests/fast/tokenizer/004-expected.txt b/third_party/WebKit/LayoutTests/fast/tokenizer/004-expected.txt index 13e14f6..510a5f6 100644 --- a/third_party/WebKit/LayoutTests/fast/tokenizer/004-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/tokenizer/004-expected.txt
@@ -1,5 +1,4 @@ Variations on type attribute of script tag - These scripts should execute no type attribute executed empty string executed @@ -91,7 +90,6 @@ xxxjavascriptxxx bogus Variations on language attribute of script tag - These scripts should execute no language attribute executed empty string executed @@ -154,7 +152,6 @@ xxxjavascriptxxx bogus Variations on combined type and language attributes of script tag - These scripts should execute empty string type, "javascript" language executed empty string language, "text/javascript" type executed
diff --git a/third_party/WebKit/LayoutTests/fast/xpath/xpath-functional-test-expected.txt b/third_party/WebKit/LayoutTests/fast/xpath/xpath-functional-test-expected.txt index 98967b3..f798ed6d 100644 --- a/third_party/WebKit/LayoutTests/fast/xpath/xpath-functional-test-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/xpath/xpath-functional-test-expected.txt
@@ -93,6 +93,5 @@ font dfna - subsup abbrq
diff --git a/third_party/WebKit/LayoutTests/html/tabular_data/table_insertrow-expected.txt b/third_party/WebKit/LayoutTests/html/tabular_data/table_insertrow-expected.txt index b281a504..ece74e5 100644 --- a/third_party/WebKit/LayoutTests/html/tabular_data/table_insertrow-expected.txt +++ b/third_party/WebKit/LayoutTests/html/tabular_data/table_insertrow-expected.txt
@@ -1,5 +1,4 @@ HTMLTableElement's insertRow() method - The first three test whether HTMLTableElement's insertRow() method can add an implicit tbody into a table without one, to hold the inserted row. The first tests an empty table
diff --git a/third_party/WebKit/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html b/third_party/WebKit/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html deleted file mode 100644 index d6a6307b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html +++ /dev/null
@@ -1,68 +0,0 @@ -<html> -<script src="resetCookies.js"></script> -<script> -resetCookies(); - -if (window.testRunner) - testRunner.dumpAsText(); - -window.onmessage = function(evt) -{ - if (evt.data == "showCookies") { - showCookies(); - return; - } else if (evt.data.split(" ")[0] == "sendXHR") { - sendXHR(evt.data.split(" ")[1]); - return; - } else if (evt.data == "resetCookiesAndNotifyDone") { - resetCookiesAndNotifyDone(); - return; - } else - alert("Unknown message."); -} - -var stage = 1; -function showCookies() -{ - alert("Test stage " + stage++ + " document.cookie is: " + document.cookie); - parent.window.postMessage("done", "*"); -} - -function sendXHR(queryCommand) -{ - if (window.testRunner) { - // setBlockThirdPartyCookies() takes effect asynchronously (IPC is involved). - testRunner.setBlockThirdPartyCookies(false); - } - - var baseurl = "http://localhost:8000/cookies/resources/cookie-utility.php"; - var url = queryCommand ? baseurl + "?queryfunction=" + queryCommand : baseurl; - alert(url); - var req = new XMLHttpRequest(); - req.open('GET', url, false); - req.send(); - - if (req.status == 200) - alert("XHR response - " + req.responseText); - else - alert("xhr error"); - - if (window.testRunner) { - testRunner.setBlockThirdPartyCookies(true); - } - - parent.window.postMessage("done", "*"); -} - -function resetCookiesAndNotifyDone() -{ - resetCookies(); - if (window.testRunner) - testRunner.notifyDone(); -} - -</script> -<body> -HELLO THERE -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-on-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-on-navigation-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-on-navigation-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-on-navigation-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-on-navigation.html b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-on-navigation.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-on-navigation.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-on-navigation.html index 7937dc1c..acab8f66 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-on-navigation.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-on-navigation.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> -<script src="../indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() { @@ -44,7 +44,7 @@ UI.panels.resources._sidebar.databasesListTreeElement.firstChild().select(false, true); dumpCurrentState('Initial state:'); await TestRunner.navigatePromise( - 'http://127.0.0.1:8000/inspector/application-panel/resources-panel-on-navigation.html'); + 'http://127.0.0.1:8000/devtools/application-panel/resources-panel-on-navigation.html'); dumpCurrentState('After navigation:'); TestRunner.completeTest(); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-resource-preview-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-resource-preview-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-resource-preview-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-resource-preview-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-resource-preview.html b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-resource-preview.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-resource-preview.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-resource-preview.html index 8a96fc42..2c1823a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-resource-preview.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-resource-preview.html
@@ -5,11 +5,11 @@ // This is here for the JSON file imported via the script tag below } </script> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script src="../resources/json-value.js"></script> -<script src="../indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-selection-on-reload.html b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-selection-on-reload.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-selection-on-reload.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-selection-on-reload.html index 51a4894..8c17ae2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-selection-on-reload.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-selection-on-reload.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> -<script src="../indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-websql-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-websql-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-websql-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-websql-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-websql.html b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-websql.html similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-websql.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-websql.html index e118487..a59ee77 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/resources-panel-websql.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/resources-panel-websql.html
@@ -5,11 +5,11 @@ // This is here for the JSON file imported via the script tag below } </script> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script src="../resources/json-value.js"></script> -<script src="../indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/storage-view-reports-quota-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/storage-view-reports-quota-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/storage-view-reports-quota-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/storage-view-reports-quota-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/storage-view-reports-quota.html b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/storage-view-reports-quota.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/storage-view-reports-quota.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/storage-view-reports-quota.html index 92bb552..ba03ba1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/application-panel/storage-view-reports-quota.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/application-panel/storage-view-reports-quota.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> -<script src="../indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() { var updateListener = null;
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach-expected.txt similarity index 70% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach-expected.txt index b6bc7c3..aacf084b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach-expected.txt
@@ -8,7 +8,7 @@ debugger:///VM[XXX] bindings-frame-attach-detach.html debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] inspector-test.js - http://127.0.0.1:8000/inspector/bindings/bindings-frame-attach-detach.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js http://127.0.0.1:8000/inspector/inspector-test.js @@ -21,19 +21,19 @@ debugger:///VM[XXX] inspector-test.js [+] debugger:///VM[XXX] magic-script.js [+] debugger:///VM[XXX] _test_attachFrame.js - http://127.0.0.1:8000/inspector/bindings/bindings-frame-attach-detach.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-attach-detach.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_attachFrame.js Running: detachFrame Removed: 3 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css Workspace: 12 uiSourceCodes. debugger:///VM[XXX] bindings-frame-attach-detach.html debugger:///VM[XXX] bindings-frame-attach-detach.html @@ -42,7 +42,7 @@ debugger:///VM[XXX] magic-script.js debugger:///VM[XXX] _test_attachFrame.js [+] debugger:///VM[XXX] _test_detachFrame.js - http://127.0.0.1:8000/inspector/bindings/bindings-frame-attach-detach.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach.html similarity index 84% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach.html index 7eac1806..64cb589c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-attach-detach.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-attach-detach.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate-expected.txt similarity index 67% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate-expected.txt index a309af9..1ad6db7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate-expected.txt
@@ -9,7 +9,7 @@ debugger:///VM[XXX] bindings-frame-navigate.html debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] inspector-test.js - http://127.0.0.1:8000/inspector/bindings/bindings-frame-navigate.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-navigate.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js http://127.0.0.1:8000/inspector/inspector-test.js @@ -22,19 +22,19 @@ debugger:///VM[XXX] inspector-test.js [+] debugger:///VM[XXX] magic-script.js [+] debugger:///VM[XXX] _test_attachFrame.js - http://127.0.0.1:8000/inspector/bindings/bindings-frame-navigate.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-navigate.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_attachFrame.js Running: navigateFrame Removed: 3 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css Workspace: 13 uiSourceCodes. debugger:///VM[XXX] bindings-frame-navigate.html debugger:///VM[XXX] bindings-frame-navigate.html @@ -43,9 +43,9 @@ debugger:///VM[XXX] magic-script.js debugger:///VM[XXX] _test_attachFrame.js [+] debugger:///VM[XXX] _test_navigateFrame - http://127.0.0.1:8000/inspector/bindings/bindings-frame-navigate.html + http://127.0.0.1:8000/devtools/bindings/bindings-frame-navigate.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/empty-frame.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/empty-frame.html http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame.js [+] _test_navigateFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate.html similarity index 85% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate.html index 10f2a56..d5b3827 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-frame-navigate.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-frame-navigate.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated-expected.txt new file mode 100644 index 0000000..f546e298 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated-expected.txt
@@ -0,0 +1,58 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: dumpInitialWorkspace +Removed: 0 uiSourceCodes +Workspace: 7 uiSourceCodes. + debugger:///VM[XXX] bindings-main-frame-navigated.html + debugger:///VM[XXX] bindings-main-frame-navigated.html + debugger:///VM[XXX] bindings-test.js + debugger:///VM[XXX] inspector-test.js + http://127.0.0.1:8000/devtools/bindings/bindings-main-frame-navigated.html + http://127.0.0.1:8000/inspector/bindings/bindings-test.js + http://127.0.0.1:8000/inspector/inspector-test.js + +Running: attachFrame +Removed: 0 uiSourceCodes +Workspace: 15 uiSourceCodes. + debugger:///VM[XXX] bindings-main-frame-navigated.html + debugger:///VM[XXX] bindings-main-frame-navigated.html + debugger:///VM[XXX] bindings-test.js + debugger:///VM[XXX] inspector-test.js +[+] debugger:///VM[XXX] sourcemap-script.js +[+] debugger:///VM[XXX] _test_attachFrame.js + http://127.0.0.1:8000/devtools/bindings/bindings-main-frame-navigated.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/inspector/bindings/bindings-test.js + http://127.0.0.1:8000/inspector/inspector-test.js +[+] _test_attachFrame.js + +Running: navigateMainFrame +Page reloaded. +Removed: 15 uiSourceCodes +[-] debugger:///VM[XXX] bindings-main-frame-navigated.html +[-] debugger:///VM[XXX] bindings-main-frame-navigated.html +[-] debugger:///VM[XXX] bindings-test.js +[-] debugger:///VM[XXX] inspector-test.js +[-] debugger:///VM[XXX] sourcemap-script.js +[-] debugger:///VM[XXX] _test_attachFrame.js +[-] http://127.0.0.1:8000/devtools/bindings/bindings-main-frame-navigated.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts +[-] http://127.0.0.1:8000/inspector/bindings/bindings-test.js +[-] http://127.0.0.1:8000/inspector/inspector-test.js +[-] _test_attachFrame.js +Workspace: 2 uiSourceCodes. +[+] debugger:///VM[XXX] empty-page.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/empty-page.html + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated.html similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated.html index 047dd88..213710e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-main-frame-navigated.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script> @@ -18,12 +18,12 @@ snapshot = BindingsTestRunner.dumpWorkspace(snapshot); TestRunner.markStep('navigateMainFrame'); - var url = 'http://127.0.0.1:8000/inspector/bindings/resources/empty-page.html'; + var url = 'http://127.0.0.1:8000/devtools/bindings/resources/empty-page.html'; await TestRunner.navigatePromise(url); snapshot = BindingsTestRunner.dumpWorkspace(snapshot); TestRunner.markStep('navigateBack'); - var originalUrl = 'http://127.0.0.1:8000/inspector/bindings/bindings-main-frame-navigated.html'; + var originalUrl = 'http://127.0.0.1:8000/devtools/bindings/bindings-main-frame-navigated.html'; await TestRunner.navigatePromise(originalUrl); TestRunner.completeTest();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames-expected.txt similarity index 69% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames-expected.txt index 58351f73..3afcf4aa 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames-expected.txt
@@ -8,7 +8,7 @@ debugger:///VM[XXX] bindings-multiple-frames.html debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] inspector-test.js - http://127.0.0.1:8000/inspector/bindings/bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js http://127.0.0.1:8000/inspector/inspector-test.js @@ -23,19 +23,19 @@ [+] debugger:///VM[XXX] magic-script.js [+] debugger:///VM[XXX] _test_create-iframe1.js [+] debugger:///VM[XXX] _test_create-iframe2.js - http://127.0.0.1:8000/inspector/bindings/bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/bindings-multiple-frames.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_create-iframe1.js [+] _test_create-iframe2.js Running: detachFrame1 Removed: 1 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js Workspace: 18 uiSourceCodes. debugger:///VM[XXX] bindings-multiple-frames.html debugger:///VM[XXX] bindings-multiple-frames.html @@ -46,11 +46,11 @@ debugger:///VM[XXX] _test_create-iframe1.js debugger:///VM[XXX] _test_create-iframe2.js [+] debugger:///VM[XXX] _test_detachFrame1.js - http://127.0.0.1:8000/inspector/bindings/bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html + http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js + http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html - http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js - http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css http://127.0.0.1:8000/inspector/inspector-test.js _test_create-iframe1.js _test_create-iframe2.js @@ -58,9 +58,9 @@ Running: detachFrame2 Removed: 3 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-frame.html -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/magic-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/magic-style.css Workspace: 17 uiSourceCodes. debugger:///VM[XXX] bindings-multiple-frames.html debugger:///VM[XXX] bindings-multiple-frames.html @@ -72,7 +72,7 @@ debugger:///VM[XXX] _test_create-iframe2.js debugger:///VM[XXX] _test_detachFrame1.js [+] debugger:///VM[XXX] _test_detachFrame2.js - http://127.0.0.1:8000/inspector/bindings/bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js http://127.0.0.1:8000/inspector/inspector-test.js _test_create-iframe1.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames.html index bc11957..bf9c2ba6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/bindings-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames-expected.txt similarity index 82% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames-expected.txt index f2f7c272..a8f6fa6c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames-expected.txt
@@ -8,8 +8,8 @@ debugger:///VM[XXX] contentscripts-bindings-multiple-frames.html debugger:///VM[XXX] contentscripts-bindings-multiple-frames.html debugger:///VM[XXX] inspector-test.js + http://127.0.0.1:8000/devtools/bindings/contentscripts-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/contentscripts-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js Running: attachFrame1 @@ -23,9 +23,9 @@ debugger:///VM[XXX] contentscripts-bindings-multiple-frames.html debugger:///VM[XXX] inspector-test.js [+] debugger:///VM[XXX] _test_attachFrame1.js + http://127.0.0.1:8000/devtools/bindings/contentscripts-bindings-multiple-frames.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/contentscripts-bindings-multiple-frames.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_attachFrame1.js @@ -43,9 +43,9 @@ debugger:///VM[XXX] inspector-test.js debugger:///VM[XXX] _test_attachFrame1.js [+] debugger:///VM[XXX] _test_attachFrame2.js + http://127.0.0.1:8000/devtools/bindings/contentscripts-bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/contentscripts-bindings-multiple-frames.html - http://127.0.0.1:8000/inspector/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame1.js [+] _test_attachFrame2.js @@ -65,9 +65,9 @@ debugger:///VM[XXX] _test_attachFrame1.js debugger:///VM[XXX] _test_attachFrame2.js [+] debugger:///VM[XXX] _test_detachFrame1.js + http://127.0.0.1:8000/devtools/bindings/contentscripts-bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/contentscripts-bindings-multiple-frames.html - http://127.0.0.1:8000/inspector/bindings/resources/contentscript-frame.html http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame1.js _test_attachFrame2.js @@ -75,7 +75,7 @@ Running: detachFrame2 Removed: 1 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/contentscript-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/contentscript-frame.html Workspace: 20 uiSourceCodes. content-script-42.js debugger:///VM[XXX] bindings-test.js @@ -90,8 +90,8 @@ debugger:///VM[XXX] _test_attachFrame2.js debugger:///VM[XXX] _test_detachFrame1.js [+] debugger:///VM[XXX] _test_detachFrame2.js + http://127.0.0.1:8000/devtools/bindings/contentscripts-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/contentscripts-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame1.js _test_attachFrame2.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames.html index 26d168fa..1b166635 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-bindings-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-bindings-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-navigator-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-navigator-multiple-frames-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-navigator-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-navigator-multiple-frames-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-navigator-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-navigator-multiple-frames.html similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-navigator-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-navigator-multiple-frames.html index 7d4b0a9..abdbb4d6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/contentscripts-navigator-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/contentscripts-navigator-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach-expected.txt similarity index 81% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach-expected.txt index 0541f07..f55f41b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach-expected.txt
@@ -8,8 +8,8 @@ debugger:///VM[XXX] dynamic-bindings-frame-attach-detach.html debugger:///VM[XXX] dynamic-bindings-frame-attach-detach.html debugger:///VM[XXX] inspector-test.js + http://127.0.0.1:8000/devtools/bindings/dynamic-bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/dynamic-bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/inspector-test.js Running: attachFrame @@ -24,9 +24,9 @@ [+] debugger:///VM[XXX] _test_attachFrame.js [+] dynamic-script.js [+] dynamic-style.css + http://127.0.0.1:8000/devtools/bindings/dynamic-bindings-frame-attach-detach.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/dynamic-frame.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/dynamic-bindings-frame-attach-detach.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/dynamic-frame.html http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_attachFrame.js @@ -34,7 +34,7 @@ Removed: 3 uiSourceCodes [-] dynamic-script.js [-] dynamic-style.css -[-] http://127.0.0.1:8000/inspector/bindings/resources/dynamic-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/dynamic-frame.html Workspace: 13 uiSourceCodes. debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] dynamic-bindings-frame-attach-detach.html @@ -44,8 +44,8 @@ debugger:///VM[XXX] inspector-test.js debugger:///VM[XXX] _test_attachFrame.js [+] debugger:///VM[XXX] _test_detachFrame.js + http://127.0.0.1:8000/devtools/bindings/dynamic-bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/dynamic-bindings-frame-attach-detach.html http://127.0.0.1:8000/inspector/inspector-test.js _test_attachFrame.js [+] _test_detachFrame.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach.html similarity index 85% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach.html index 6197834..8540bdd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-bindings-frame-attach-detach.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-bindings-frame-attach-detach.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach-expected.txt similarity index 71% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach-expected.txt index 5ef1035..3050c76 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach-expected.txt
@@ -4,23 +4,25 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + dynamic-navigator-frame-attach-detach.html inspector bindings - dynamic-navigator-frame-attach-detach.html bindings-test.js inspector-test.js Running: attachFrame top 127.0.0.1:8000 + devtools/bindings + dynamic-navigator-frame-attach-detach.html inspector bindings - dynamic-navigator-frame-attach-detach.html bindings-test.js inspector-test.js frame (dynamic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources dynamic-frame.html (no domain) dynamic-script.js @@ -29,9 +31,10 @@ Running: detachFrame top 127.0.0.1:8000 + devtools/bindings + dynamic-navigator-frame-attach-detach.html inspector bindings - dynamic-navigator-frame-attach-detach.html bindings-test.js inspector-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach.html index 467b4c7..e6432f65 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/dynamic-navigator-frame-attach-detach.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/dynamic-navigator-frame-attach-detach.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/livelocation-main-frame-navigated.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/livelocation-main-frame-navigated.html similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/livelocation-main-frame-navigated.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/livelocation-main-frame-navigated.html index 1137951..9aeab39 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/livelocation-main-frame-navigated.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/livelocation-main-frame-navigated.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script> @@ -17,13 +17,13 @@ var cssLiveLocation = BindingsTestRunner.createCSSLiveLocation('css', 'sourcemap-style.css'); TestRunner.markStep('navigateMainFrame'); - var url = 'http://127.0.0.1:8000/inspector/bindings/resources/empty-page.html'; + var url = 'http://127.0.0.1:8000/devtools/bindings/resources/empty-page.html'; await TestRunner.navigatePromise(url); BindingsTestRunner.dumpLocation(jsLiveLocation); BindingsTestRunner.dumpLocation(cssLiveLocation); TestRunner.markStep('navigateBack'); - var originalUrl = 'http://127.0.0.1:8000/inspector/bindings/bindings-main-frame-navigated.html'; + var originalUrl = 'http://127.0.0.1:8000/devtools/bindings/bindings-main-frame-navigated.html'; await TestRunner.navigatePromise(originalUrl); TestRunner.completeTest();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach-expected.txt similarity index 71% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach-expected.txt index 8b8f5fc..7497c3af 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach-expected.txt
@@ -4,23 +4,25 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + navigator-frame-attach-detach.html inspector bindings - navigator-frame-attach-detach.html bindings-test.js inspector-test.js Running: attachFrame top 127.0.0.1:8000 + devtools/bindings + navigator-frame-attach-detach.html inspector bindings - navigator-frame-attach-detach.html bindings-test.js inspector-test.js frame (magic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources magic-frame.html magic-script.js magic-style.css @@ -28,9 +30,10 @@ Running: detachFrame top 127.0.0.1:8000 + devtools/bindings + navigator-frame-attach-detach.html inspector bindings - navigator-frame-attach-detach.html bindings-test.js inspector-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach.html index dc1242f..e08fc09 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-attach-detach.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-attach-detach.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate-expected.txt similarity index 72% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate-expected.txt index bacf478..33aaf14 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate-expected.txt
@@ -5,23 +5,25 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + navigator-frame-navigate.html inspector bindings - navigator-frame-navigate.html bindings-test.js inspector-test.js Running: attachFrame top 127.0.0.1:8000 + devtools/bindings + navigator-frame-navigate.html inspector bindings - navigator-frame-navigate.html bindings-test.js inspector-test.js frame (magic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources magic-frame.html magic-script.js magic-style.css @@ -29,13 +31,14 @@ Running: navigateFrame top 127.0.0.1:8000 + devtools/bindings + navigator-frame-navigate.html inspector bindings - navigator-frame-navigate.html bindings-test.js inspector-test.js frame (empty-frame.html) 127.0.0.1:8000 - inspector/bindings/resource + devtools/bindings/resource empty-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate.html index 1abc8f34..eab1f18 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-frame-navigate.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-frame-navigate.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated-expected.txt similarity index 76% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated-expected.txt index e1b2a5e..f2ed157 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated-expected.txt
@@ -4,23 +4,25 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + navigator-main-frame-navigated.html inspector bindings - navigator-main-frame-navigated.html bindings-test.js inspector-test.js Running: attachFrame top 127.0.0.1:8000 + devtools/bindings + navigator-main-frame-navigated.html inspector bindings - navigator-main-frame-navigated.html bindings-test.js inspector-test.js frame (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -31,7 +33,7 @@ Page reloaded. top 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources empty-page.html Running: navigateBack
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated.html similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated.html index 97e3aaa2..bc0fe32 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-main-frame-navigated.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-main-frame-navigated.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script> @@ -21,12 +21,12 @@ SourcesTestRunner.dumpNavigatorView(sourcesNavigator, false); TestRunner.markStep('navigateMainFrame'); - var url = 'http://127.0.0.1:8000/inspector/bindings/resources/empty-page.html'; + var url = 'http://127.0.0.1:8000/devtools/bindings/resources/empty-page.html'; await TestRunner.navigatePromise(url); SourcesTestRunner.dumpNavigatorView(sourcesNavigator, false); TestRunner.markStep('navigateBack'); - var originalUrl = 'http://127.0.0.1:8000/inspector/bindings/navigator-main-frame-navigated.html'; + var originalUrl = 'http://127.0.0.1:8000/devtools/bindings/navigator-main-frame-navigated.html'; await TestRunner.navigatePromise(originalUrl); TestRunner.completeTest(); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames-expected.txt similarity index 73% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames-expected.txt index e64729d..57f5f7a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames-expected.txt
@@ -4,29 +4,31 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + navigator-multiple-frames.html inspector bindings - navigator-multiple-frames.html bindings-test.js inspector-test.js Running: createIframes top 127.0.0.1:8000 + devtools/bindings + navigator-multiple-frames.html inspector bindings - navigator-multiple-frames.html bindings-test.js inspector-test.js frame1 (magic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources magic-frame.html magic-script.js magic-style.css frame2 (magic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources magic-frame.html magic-script.js magic-style.css @@ -34,14 +36,15 @@ Running: detachFrame1 top 127.0.0.1:8000 + devtools/bindings + navigator-multiple-frames.html inspector bindings - navigator-multiple-frames.html bindings-test.js inspector-test.js frame2 (magic-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources magic-frame.html magic-script.js magic-style.css @@ -49,9 +52,10 @@ Running: detachFrame2 top 127.0.0.1:8000 + devtools/bindings + navigator-multiple-frames.html inspector bindings - navigator-multiple-frames.html bindings-test.js inspector-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames.html index eee2c6f..219a6c3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/navigator-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/navigator-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/contentscript-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/contentscript-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/contentscript-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/contentscript-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/dynamic-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/dynamic-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/dynamic-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/dynamic-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/empty-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/empty-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/empty-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/empty-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/empty-page.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/empty-page.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/empty-page.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/empty-page.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-script.js b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-script.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-script.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-script.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-style.css b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-style.css similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/magic-style.css rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/magic-style.css
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-sass.scss b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-sass.scss similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-sass.scss rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-sass.scss
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-script.js b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-script.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-script.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-script.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-script.js.map b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-script.js.map similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-script.js.map rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-script.js.map
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-style.css b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-style.css similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-style.css rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-style.css
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-style.css.map b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-style.css.map similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-style.css.map rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-style.css.map
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-typescript.ts b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-typescript.ts similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/resources/sourcemap-typescript.ts rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/resources/sourcemap-typescript.ts
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings-expected.txt similarity index 76% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings-expected.txt index 14957526..64bfe1f8 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings-expected.txt
@@ -8,8 +8,8 @@ debugger:///VM[XXX] inspector-test.js debugger:///VM[XXX] shadowdom-bindings.html debugger:///VM[XXX] shadowdom-bindings.html + http://127.0.0.1:8000/devtools/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/inspector-test.js Running: attachShadow1 @@ -21,10 +21,10 @@ debugger:///VM[XXX] shadowdom-bindings.html [+] debugger:///VM[XXX] sourcemap-script.js [+] debugger:///VM[XXX] _test_attachShadow1.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/inspector-test.js [+] sourcemap-script.js [+] sourcemap-style.css @@ -41,10 +41,10 @@ [+] debugger:///VM[XXX] sourcemap-script.js debugger:///VM[XXX] _test_attachShadow1.js [+] debugger:///VM[XXX] _test_attachShadow2.js + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/inspector-test.js sourcemap-script.js sourcemap-style.css @@ -63,10 +63,10 @@ debugger:///VM[XXX] _test_attachShadow1.js debugger:///VM[XXX] _test_attachShadow2.js [+] debugger:///VM[XXX] _test_detachShadow1.js + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/inspector-test.js sourcemap-script.js sourcemap-style.css @@ -76,7 +76,7 @@ Running: detachShadow2 Removed: 2 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss [-] sourcemap-style.css Workspace: 19 uiSourceCodes. debugger:///VM[XXX] bindings-test.js @@ -89,9 +89,9 @@ debugger:///VM[XXX] _test_attachShadow2.js debugger:///VM[XXX] _test_detachShadow1.js [+] debugger:///VM[XXX] _test_detachShadow2.js + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/shadowdom-bindings.html http://127.0.0.1:8000/inspector/inspector-test.js sourcemap-script.js _test_attachShadow1.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings.html similarity index 93% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings.html index 5d9f1338..a969281 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-bindings.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-bindings.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator-expected.txt similarity index 63% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator-expected.txt index 87802c2..6a53eef 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator-expected.txt
@@ -4,21 +4,23 @@ Running: dumpInitialNavigator top 127.0.0.1:8000 + devtools/bindings + shadowdom-navigator.html inspector bindings - shadowdom-navigator.html bindings-test.js inspector-test.js Running: attachShadow1 top 127.0.0.1:8000 + devtools/bindings + resources + sourcemap-typescript.ts + sourcemap-sass.scss + shadowdom-navigator.html inspector bindings - resources - sourcemap-typescript.ts - sourcemap-sass.scss - shadowdom-navigator.html bindings-test.js inspector-test.js (no domain) @@ -28,12 +30,13 @@ Running: attachShadow2 top 127.0.0.1:8000 + devtools/bindings + resources + sourcemap-typescript.ts + sourcemap-sass.scss + shadowdom-navigator.html inspector bindings - resources - sourcemap-typescript.ts - sourcemap-sass.scss - shadowdom-navigator.html bindings-test.js inspector-test.js (no domain) @@ -43,12 +46,13 @@ Running: detachShadow1 top 127.0.0.1:8000 + devtools/bindings + resources + sourcemap-typescript.ts + sourcemap-sass.scss + shadowdom-navigator.html inspector bindings - resources - sourcemap-typescript.ts - sourcemap-sass.scss - shadowdom-navigator.html bindings-test.js inspector-test.js (no domain) @@ -58,11 +62,12 @@ Running: detachShadow2 top 127.0.0.1:8000 + devtools/bindings + resources + sourcemap-typescript.ts + shadowdom-navigator.html inspector bindings - resources - sourcemap-typescript.ts - shadowdom-navigator.html bindings-test.js inspector-test.js (no domain)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator.html similarity index 93% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator.html index ca2437a..aff0bdc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/shadowdom-navigator.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/shadowdom-navigator.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames-expected.txt similarity index 61% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames-expected.txt index 477ce781..fa8a176 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames-expected.txt
@@ -8,8 +8,8 @@ debugger:///VM[XXX] inspector-test.js debugger:///VM[XXX] sourcemap-bindings-multiple-frames.html debugger:///VM[XXX] sourcemap-bindings-multiple-frames.html + http://127.0.0.1:8000/devtools/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js Running: createIframesAndWaitForSourceMaps @@ -23,21 +23,21 @@ [+] debugger:///VM[XXX] sourcemap-script.js [+] debugger:///VM[XXX] _test_create-iframe1.js [+] debugger:///VM[XXX] _test_create-iframe2.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js [+] _test_create-iframe1.js [+] _test_create-iframe2.js Running: detachFrame1 Removed: 1 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js Workspace: 20 uiSourceCodes. debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] inspector-test.js @@ -48,13 +48,13 @@ debugger:///VM[XXX] _test_create-iframe1.js debugger:///VM[XXX] _test_create-iframe2.js [+] debugger:///VM[XXX] _test_detachFrame1.js + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js _test_create-iframe1.js _test_create-iframe2.js @@ -62,11 +62,11 @@ Running: detachFrame2 Removed: 5 uiSourceCodes -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts Workspace: 17 uiSourceCodes. debugger:///VM[XXX] bindings-test.js debugger:///VM[XXX] inspector-test.js @@ -78,8 +78,8 @@ debugger:///VM[XXX] _test_create-iframe2.js debugger:///VM[XXX] _test_detachFrame1.js [+] debugger:///VM[XXX] _test_detachFrame2.js + http://127.0.0.1:8000/devtools/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/sourcemap-bindings-multiple-frames.html http://127.0.0.1:8000/inspector/inspector-test.js _test_create-iframe1.js _test_create-iframe2.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames.html similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames.html index 94a25a0c..8d4b03a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-bindings-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-bindings-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames-expected.txt similarity index 78% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames-expected.txt index 467bda8..dfade61 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames-expected.txt
@@ -4,25 +4,27 @@ Running: initialWorkspace top 127.0.0.1:8000 + devtools/bindings + sourcemap-navigator-multiple-frames.html inspector bindings - sourcemap-navigator-multiple-frames.html bindings-test.js inspector-test.js Running: attachFrame1 top 127.0.0.1:8000 + devtools/bindings + sourcemap-navigator-multiple-frames.html inspector bindings - sourcemap-navigator-multiple-frames.html bindings-test.js inspector-test.js (no domain) _test_create-iframe1.js frame1 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -32,9 +34,10 @@ Running: attachFrame2 top 127.0.0.1:8000 + devtools/bindings + sourcemap-navigator-multiple-frames.html inspector bindings - sourcemap-navigator-multiple-frames.html bindings-test.js inspector-test.js (no domain) @@ -42,7 +45,7 @@ _test_create-iframe2.js frame1 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -50,7 +53,7 @@ sourcemap-style.css frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -60,9 +63,10 @@ Running: detachFrame1 top 127.0.0.1:8000 + devtools/bindings + sourcemap-navigator-multiple-frames.html inspector bindings - sourcemap-navigator-multiple-frames.html bindings-test.js inspector-test.js (no domain) @@ -71,7 +75,7 @@ _test_detachFrame1.js frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -81,9 +85,10 @@ Running: detachFrame2 top 127.0.0.1:8000 + devtools/bindings + sourcemap-navigator-multiple-frames.html inspector bindings - sourcemap-navigator-multiple-frames.html bindings-test.js inspector-test.js (no domain)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames.html index 5fabf7e..796c2545 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/sourcemap-navigator-multiple-frames.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/sourcemap-navigator-multiple-frames.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings-expected.txt new file mode 100644 index 0000000..127ec157 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings-expected.txt
@@ -0,0 +1,84 @@ +Verify that bindings handle target suspension as expected. + + + +Running: initialWorkspace +Removed: 0 uiSourceCodes +Workspace: 7 uiSourceCodes. + debugger:///VM[XXX] bindings-test.js + debugger:///VM[XXX] inspector-test.js + debugger:///VM[XXX] suspendtarget-bindings.html + debugger:///VM[XXX] suspendtarget-bindings.html + http://127.0.0.1:8000/devtools/bindings/suspendtarget-bindings.html + http://127.0.0.1:8000/inspector/bindings/bindings-test.js + http://127.0.0.1:8000/inspector/inspector-test.js + +Running: createIframesAndWaitForSourceMaps +Removed: 0 uiSourceCodes +Workspace: 19 uiSourceCodes. + debugger:///VM[XXX] bindings-test.js + debugger:///VM[XXX] inspector-test.js +[+] debugger:///VM[XXX] sourcemap-script.js +[+] debugger:///VM[XXX] sourcemap-script.js + debugger:///VM[XXX] suspendtarget-bindings.html + debugger:///VM[XXX] suspendtarget-bindings.html +[+] debugger:///VM[XXX] _test_create-iframe1.js +[+] debugger:///VM[XXX] _test_create-iframe2.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/suspendtarget-bindings.html + http://127.0.0.1:8000/inspector/bindings/bindings-test.js + http://127.0.0.1:8000/inspector/inspector-test.js +[+] _test_create-iframe1.js +[+] _test_create-iframe2.js + +Running: Suspending targets. +Removed: 17 uiSourceCodes +[-] debugger:///VM[XXX] bindings-test.js +[-] debugger:///VM[XXX] inspector-test.js +[-] debugger:///VM[XXX] sourcemap-script.js +[-] debugger:///VM[XXX] sourcemap-script.js +[-] debugger:///VM[XXX] suspendtarget-bindings.html +[-] debugger:///VM[XXX] suspendtarget-bindings.html +[-] debugger:///VM[XXX] _test_create-iframe1.js +[-] debugger:///VM[XXX] _test_create-iframe2.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[-] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts +[-] http://127.0.0.1:8000/inspector/bindings/bindings-test.js +[-] http://127.0.0.1:8000/inspector/inspector-test.js +[-] _test_create-iframe1.js +[-] _test_create-iframe2.js +Workspace: 2 uiSourceCodes. + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html + http://127.0.0.1:8000/devtools/bindings/suspendtarget-bindings.html + +Running: detachFrame +Removed: 0 uiSourceCodes +Workspace: 2 uiSourceCodes. + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html + http://127.0.0.1:8000/devtools/bindings/suspendtarget-bindings.html + +Running: Resuming targets. +Removed: 0 uiSourceCodes +Workspace: 13 uiSourceCodes. +[+] debugger:///VM[XXX] bindings-test.js +[+] debugger:///VM[XXX] inspector-test.js +[+] debugger:///VM[XXX] sourcemap-script.js +[+] debugger:///VM[XXX] suspendtarget-bindings.html +[+] debugger:///VM[XXX] suspendtarget-bindings.html + http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-frame.html +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-style.css +[+] http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts + http://127.0.0.1:8000/devtools/bindings/suspendtarget-bindings.html +[+] http://127.0.0.1:8000/inspector/bindings/bindings-test.js +[+] http://127.0.0.1:8000/inspector/inspector-test.js +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings.html index 6dd7f25..06e76d6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-bindings.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator-expected.txt similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator-expected.txt index fc8c0ce..41360f0 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator-expected.txt
@@ -5,18 +5,20 @@ Running: initialWorkspace top 127.0.0.1:8000 + devtools/bindings + suspendtarget-navigator.html inspector bindings - suspendtarget-navigator.html bindings-test.js inspector-test.js Running: attachFramesAndWaitForSourceMaps top 127.0.0.1:8000 + devtools/bindings + suspendtarget-navigator.html inspector bindings - suspendtarget-navigator.html bindings-test.js inspector-test.js (no domain) @@ -24,7 +26,7 @@ _test_create-iframe2.js frame1 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -32,7 +34,7 @@ sourcemap-style.css frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts @@ -42,40 +44,39 @@ Running: Suspending targets. top 127.0.0.1:8000 - inspector - bindings - suspendtarget-navigator.html + devtools/bindings + suspendtarget-navigator.html frame1 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html Running: detachFrame top 127.0.0.1:8000 - inspector - bindings - suspendtarget-navigator.html + devtools/bindings + suspendtarget-navigator.html frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html Running: Resuming targets. top 127.0.0.1:8000 + devtools/bindings + suspendtarget-navigator.html inspector bindings - suspendtarget-navigator.html bindings-test.js inspector-test.js frame2 (sourcemap-frame.html) 127.0.0.1:8000 - inspector/bindings/resources + devtools/bindings/resources sourcemap-frame.html sourcemap-script.js sourcemap-typescript.ts
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator.html b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator.html index c5179443..f075ba7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-navigator.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/bindings/suspendtarget-navigator.html
@@ -1,6 +1,6 @@ <head> -<script src="../inspector-test.js"></script> -<script src="./bindings-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/bindings/bindings-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/change-iframe-src-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/change-iframe-src-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/change-iframe-src-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/change-iframe-src-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/change-iframe-src.html b/third_party/WebKit/LayoutTests/http/tests/devtools/change-iframe-src.html similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/change-iframe-src.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/change-iframe-src.html index 91fbf32..d34c39cb 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/change-iframe-src.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/change-iframe-src.html
@@ -1,8 +1,8 @@ <html> <head> <title>Change inspected iframe's "src" attribute.</title> -<script src="inspector-test.js"></script> -<script src="elements-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/elements-test.js"></script> <script> var onIFrameLoadCalled = false; @@ -18,7 +18,7 @@ ElementsTestRunner.nodeWithId('receiver', step1); function step1(node) { - node.setAttribute('src', 'src="http://localhost:8000/inspector/resources/iframe-from-different-domain-data.html"'); + node.setAttribute('src', 'src="http://localhost:8000/devtools/resources/iframe-from-different-domain-data.html"'); ConsoleTestRunner.addConsoleSniffer(step2); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/command-line-api-inspect-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/command-line-api-inspect-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/command-line-api-inspect-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/command-line-api-inspect-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/command-line-api-inspect.html b/third_party/WebKit/LayoutTests/http/tests/devtools/command-line-api-inspect.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/command-line-api-inspect.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/command-line-api-inspect.html index de205d6f..812cd27 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/command-line-api-inspect.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/command-line-api-inspect.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> <script> function onload()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-script-mapping-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/compiler-script-mapping-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-script-mapping.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/compiler-script-mapping.html index fc9eb65..cc5cf97 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-script-mapping.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="debugger-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/debugger-test.js"></script> <script> @@ -49,9 +49,9 @@ function secondUISourceCodeAdded(uiSourceCode) { TestRunner.addResult('source2.js UISourceCode arrived'); var uiSourceCode1 = - Workspace.workspace.uiSourceCodeForURL('http://127.0.0.1:8000/inspector/resources/source1.js'); + Workspace.workspace.uiSourceCodeForURL('http://127.0.0.1:8000/devtools/resources/source1.js'); var uiSourceCode2 = - Workspace.workspace.uiSourceCodeForURL('http://127.0.0.1:8000/inspector/resources/source2.js'); + Workspace.workspace.uiSourceCodeForURL('http://127.0.0.1:8000/devtools/resources/source2.js'); SourcesTestRunner.checkUILocation(uiSourceCode1, 4, 4, uiLocation(script, 0, 81)); SourcesTestRunner.checkUILocation(uiSourceCode1, 5, 4, uiLocation(script, 0, 93)); @@ -129,13 +129,13 @@ function testSourceMapCouldNotBeLoaded(next) { TestRunner.addResult('Adding compiled.js'); - TestRunner.evaluateInPage('\n//# sourceMappingURL=http://127.0.0.1:8000/inspector/resources/source-map.json_\n'); + TestRunner.evaluateInPage('\n//# sourceMappingURL=http://127.0.0.1:8000/devtools/resources/source-map.json_\n'); TestRunner.debuggerModel.sourceMapManager().addEventListener( SDK.SourceMapManager.Events.SourceMapFailedToAttach, onSourceMapLoaded, this); function onSourceMapLoaded(event) { var script = event.data; - if (script.sourceMapURL !== 'http://127.0.0.1:8000/inspector/resources/source-map.json_') + if (script.sourceMapURL !== 'http://127.0.0.1:8000/devtools/resources/source-map.json_') return; TestRunner.addResult('SourceMap Failed to load.'); var location = uiLocation(script, 0, 0);
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-source-mapping-debug-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-source-mapping-debug-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/compiler-source-mapping-debug-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/compiler-source-mapping-debug-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-source-mapping-debug.html b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-source-mapping-debug.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/compiler-source-mapping-debug.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/compiler-source-mapping-debug.html index 68768f7b..293cccfc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-source-mapping-debug.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/compiler-source-mapping-debug.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="debugger-test.js"></script> -<script src="console-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/debugger-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/network-test.js"></script> <script src="resources/compiled.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-completions-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-completions-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-completions.html similarity index 95% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-completions.html index a19808f2..b12a040 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-completions.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="console-test.js"></script> -<script src="inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script> window.counter = 0; @@ -180,7 +180,7 @@ are found among completions AND there are NO console messages. <a href="https://bugs.webkit.org/show_bug.cgi?id=65457">Bug 65457.</a> </p> -<iframe name="myIFrame" src="http://localhost:8000/inspector/resources/console-cd-completions-iframe.html" onload="runTest()"></iframe> +<iframe name="myIFrame" src="http://localhost:8000/devtools/resources/console-cd-completions-iframe.html" onload="runTest()"></iframe> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cd-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd.html similarity index 64% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cd.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cd.html index 6bb52962..ffa4842 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cd.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cd.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="console-test.js"></script> -<script src="inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script> @@ -20,7 +20,7 @@ <p> Tests that console evaluation can be performed in an iframe context.<a href="https://bugs.webkit.org/show_bug.cgi?id=19872">Bug 19872.</a> </p> -<iframe name="myIFrame" src="http://localhost:8000/inspector/resources/console-cd-iframe.html" onload="runTest()"></iframe> +<iframe name="myIFrame" src="http://localhost:8000/devtools/resources/console-cd-iframe.html" onload="runTest()"></iframe> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-completions-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-completions-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-completions-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-completions-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-completions.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-completions.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-completions.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-completions.html index 4423f5f50..aa56b6c0 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-completions.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-completions.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="console-test.js"></script> -<script src="inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script> function A() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cross-origin-iframe-logging-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cross-origin-iframe-logging-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cross-origin-iframe-logging-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cross-origin-iframe-logging-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cross-origin-iframe-logging.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cross-origin-iframe-logging.html similarity index 82% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-cross-origin-iframe-logging.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-cross-origin-iframe-logging.html index 02d2fc4..3051a02 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-cross-origin-iframe-logging.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-cross-origin-iframe-logging.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> <script> function accessFrame() { @@ -39,6 +39,6 @@ </head> <body onload="runTest()"> <p>Tests that cross origin errors are logged with source url and line number.</p> -<iframe src="http://localhost:8000/inspector/resources/cross-origin-iframe.html"></iframe> +<iframe src="http://localhost:8000/devtools/resources/cross-origin-iframe.html"></iframe> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging-expected.txt new file mode 100644 index 0000000..3fbfcb0f --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging-expected.txt
@@ -0,0 +1,28 @@ +CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-exists.html +CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-does-not-exist.html +CONSOLE MESSAGE: line 9: sending a POST request to resources/post-target.cgi +CONSOLE MESSAGE: line 9: sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +CONSOLE ERROR: Fetch API cannot load http://localhost:8000/devtools/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. +CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-exists.html +CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-does-not-exist.html +CONSOLE MESSAGE: line 9: sending a POST request to resources/post-target.cgi +CONSOLE MESSAGE: line 9: sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +CONSOLE ERROR: Fetch API cannot load http://localhost:8000/devtools/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. +Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn't show logs when it is Disabled. + +console-fetch-logging.html:4 sending a GET request to resources/xhr-exists.html +network-test.js:48 Fetch complete: GET "http://127.0.0.1:8000/devtools/resources/xhr-exists.html".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step1 @ console-fetch-logging.html:24makeRequests @ console-fetch-logging.html:18(anonymous) @ VM:1 +console-fetch-logging.html:4 sending a GET request to resources/xhr-does-not-exist.html +network-test.js:48 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 +network-test.js:48 Fetch complete: GET "http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 +console-fetch-logging.html:4 sending a POST request to resources/post-target.cgi +network-test.js:48 Fetch complete: POST "http://127.0.0.1:8000/devtools/resources/post-target.cgi".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step3 @ console-fetch-logging.html:36 +console-fetch-logging.html:4 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +console-fetch-logging.html:1 Fetch API cannot load http://localhost:8000/devtools/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. +console-fetch-logging.html:4 sending a GET request to resources/xhr-exists.html +console-fetch-logging.html:4 sending a GET request to resources/xhr-does-not-exist.html +network-test.js:48 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 +console-fetch-logging.html:4 sending a POST request to resources/post-target.cgi +console-fetch-logging.html:4 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +console-fetch-logging.html:1 Fetch API cannot load http://localhost:8000/devtools/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging.html index 1009db50..5e2c72e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-fetch-logging.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> function requestHelper(method, url, callback) { @@ -44,7 +44,7 @@ function step4() { // (Failed) cross-origin request - requestHelper("GET", "http://localhost:8000/inspector/resources/xhr-exists.html", callback); + requestHelper("GET", "http://localhost:8000/devtools/resources/xhr-exists.html", callback); } }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors-expected.txt similarity index 71% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors-expected.txt index 0e049ce..3e98f79 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors-expected.txt
@@ -2,14 +2,14 @@ Tests that errors to load a resource cause error messages to be logged to console. -console-resource-errors-iframe.html:3 GET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-message-wrapper console-error-level > console-message -console-resource-errors-iframe.html:4 GET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-message-wrapper console-error-level > console-message -console-resource-errors-iframe.html:8 GET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) console-message-wrapper console-error-level > console-message +console-resource-errors-iframe.html:3 GET http://127.0.0.1:8000/devtools/missing.css 404 (Not Found) console-message-wrapper console-error-level > console-message +console-resource-errors-iframe.html:4 GET http://127.0.0.1:8000/devtools/non-existent-script.js 404 (Not Found) console-message-wrapper console-error-level > console-message +console-resource-errors-iframe.html:8 GET http://127.0.0.1:8000/devtools/non-existent-iframe.html 404 (Not Found) console-message-wrapper console-error-level > console-message console-resource-errors.html:17 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. loadXHR @ console-resource-errors.html:17 performActions @ console-resource-errors.html:10 (anonymous) @ VM:1 console-message-wrapper console-warning-level > console-message -console-resource-errors.html:18 GET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) +console-resource-errors.html:18 GET http://127.0.0.1:8000/devtools/non-existent-xhr 404 (Not Found) loadXHR @ console-resource-errors.html:18 performActions @ console-resource-errors.html:10 (anonymous) @ VM:1 console-message-wrapper console-error-level > console-message
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors.html similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors.html index 77968ef..ac4f46a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-resource-errors.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-resource-errors.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-show-all-messages-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-show-all-messages-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-show-all-messages.html similarity index 93% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-show-all-messages.html index 7229fb2..57765cc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-show-all-messages.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-show-all-messages.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="console-test.js"></script> -<script src="inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script> console.log("message from page!");
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async-expected.txt similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async-expected.txt index 7604d45..d55fadcd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async-expected.txt
@@ -4,7 +4,7 @@ Bug 79229 network-test.js:6 XHR loaded: 1 -network-test.js:37 XHR finished loading: GET "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". +network-test.js:37 XHR finished loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-exists.html". makeXHR @ network-test.js:37 makeXHRForJSONArguments @ network-test.js:43 (anonymous) @ VM:1
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async.html index f80b699..1cbef17 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-async.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-async.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> function test() { step1();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt similarity index 70% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt index 1c332bc..edbb312e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging-expected.txt
@@ -3,12 +3,12 @@ CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s -CONSOLE ERROR: line 37: Failed to load http://localhost:8000/inspector/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +CONSOLE ERROR: line 37: Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s -CONSOLE ERROR: line 37: Failed to load http://localhost:8000/inspector/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +CONSOLE ERROR: line 37: Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled. console-xhr-logging.html:5 sending a GET request to resources/xhr-exists.html @@ -18,40 +18,40 @@ makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 -network-test.js:37 XHR finished loading: GET "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". +network-test.js:37 XHR finished loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-exists.html". makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 console-xhr-logging.html:5 sending a GET request to resources/xhr-does-not-exist.html -network-test.js:37 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) +network-test.js:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found) makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 -network-test.js:37 XHR failed loading: GET "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html". +network-test.js:37 XHR failed loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html". makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 console-xhr-logging.html:5 sending a POST request to resources/post-target.cgi -network-test.js:37 XHR finished loading: POST "http://127.0.0.1:8000/inspector/resources/post-target.cgi". +network-test.js:37 XHR finished loading: POST "http://127.0.0.1:8000/devtools/resources/post-target.cgi". makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 -console-xhr-logging.html:5 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -network-test.js:37 Failed to load http://localhost:8000/inspector/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +console-xhr-logging.html:5 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +network-test.js:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 -network-test.js:37 XHR finished loading: GET "http://localhost:8000/inspector/resources/xhr-exists.html". +network-test.js:37 XHR finished loading: GET "http://localhost:8000/devtools/resources/xhr-exists.html". makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 @@ -59,15 +59,15 @@ (anonymous) @ VM:1 console-xhr-logging.html:5 sending a GET request to resources/xhr-exists.html console-xhr-logging.html:5 sending a GET request to resources/xhr-does-not-exist.html -network-test.js:37 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) +network-test.js:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found) makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11 requestHelper @ console-xhr-logging.html:6 (anonymous) @ VM:1 console-xhr-logging.html:5 sending a POST request to resources/post-target.cgi -console-xhr-logging.html:5 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -network-test.js:37 Failed to load http://localhost:8000/inspector/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +console-xhr-logging.html:5 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html +network-test.js:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. makeXHR @ network-test.js:37 makeSimpleXHRWithPayload @ network-test.js:16 makeSimpleXHR @ network-test.js:11
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.html similarity index 79% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.html index 8176917..4ddb677 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-xhr-logging.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console-xhr-logging.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> function requestHelper(method, url) { @@ -17,13 +17,13 @@ await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-does-not-exist.html\')'); await TestRunner.evaluateInPagePromise('requestHelper(\'POST\', \'resources/post-target.cgi\')'); await TestRunner.evaluateInPagePromise( - 'requestHelper(\'GET\', \'http://localhost:8000/inspector/resources/xhr-exists.html\')'); + 'requestHelper(\'GET\', \'http://localhost:8000/devtools/resources/xhr-exists.html\')'); Common.settingForTest('monitoringXHREnabled').set(false); await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-exists.html\')'); await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-does-not-exist.html\')'); await TestRunner.evaluateInPagePromise('requestHelper(\'POST\', \'resources/post-target.cgi\')'); await TestRunner.evaluateInPagePromise( - 'requestHelper(\'GET\', \'http://localhost:8000/inspector/resources/xhr-exists.html\')'); + 'requestHelper(\'GET\', \'http://localhost:8000/devtools/resources/xhr-exists.html\')'); TestRunner.deprecatedRunAfterPendingDispatches(() => { ConsoleTestRunner.dumpConsoleMessages();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-eval-scoped-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-eval-scoped-expected.txt index 2f32d0e..9c625c4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-eval-scoped-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-eval-scoped-expected.txt
@@ -18,7 +18,7 @@ enumerable : true get : { className : "Function" - description : "function getter() { }" + description : "get getter() { }" objectId : <string> type : "function" } @@ -38,7 +38,7 @@ name : "setter" set : { className : "Function" - description : "function setter(_) { }" + description : "set setter(_) { }" objectId : <string> type : "function" }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-format-es6-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-format-es6-expected.txt index a0ad82a7..46070f1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-format-es6-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-format-es6-expected.txt
@@ -263,7 +263,7 @@ console-format-es6.js:15 genFunction {[[GeneratorStatus]]: "suspended"} __proto__: Generator [[GeneratorStatus]]: "suspended" - [[GeneratorFunction]]: ƒ* () + [[GeneratorFunction]]: ƒ *() [[GeneratorReceiver]]: Window [[GeneratorLocation]]: console-format-es6.js:59 [[Scopes]]: Scopes[2] @@ -275,7 +275,7 @@ genFunction {[[GeneratorStatus]]: "suspended"} __proto__: Generator [[GeneratorStatus]]: "suspended" - [[GeneratorFunction]]: ƒ* () + [[GeneratorFunction]]: ƒ *() [[GeneratorReceiver]]: Window [[GeneratorLocation]]: console-format-es6.js:59 [[Scopes]]: Scopes[2]
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-functions-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-functions-expected.txt index 53b80a3..acdec56c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-functions-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-functions-expected.txt
@@ -4,20 +4,20 @@ CONSOLE MESSAGE: line 25: async function asyncSimple() {} CONSOLE MESSAGE: line 24: function* genSimple() {} CONSOLE MESSAGE: line 25: function* genSimple() {} -CONSOLE MESSAGE: line 24: function (){} -CONSOLE MESSAGE: line 25: function (){} -CONSOLE MESSAGE: line 24: function (x, y){} -CONSOLE MESSAGE: line 25: function (x, y){} +CONSOLE MESSAGE: line 24: function(){} +CONSOLE MESSAGE: line 25: function(){} +CONSOLE MESSAGE: line 24: function(x, y){} +CONSOLE MESSAGE: line 25: function(x, y){} CONSOLE MESSAGE: line 24: function namedArgs(x) {} CONSOLE MESSAGE: line 25: function namedArgs(x) {} CONSOLE MESSAGE: line 24: function namedArgs2(x, y) {} CONSOLE MESSAGE: line 25: function namedArgs2(x, y) {} CONSOLE MESSAGE: line 24: function ({}) {} CONSOLE MESSAGE: line 25: function ({}) {} -CONSOLE MESSAGE: line 24: function* whitespace( x ) { } -CONSOLE MESSAGE: line 25: function* whitespace( x ) { } -CONSOLE MESSAGE: line 24: async function whitespace2( x , y , z ) { } -CONSOLE MESSAGE: line 25: async function whitespace2( x , y , z ) { } +CONSOLE MESSAGE: line 24: function * whitespace ( x ) { } +CONSOLE MESSAGE: line 25: function * whitespace ( x ) { } +CONSOLE MESSAGE: line 24: async function whitespace2 ( x , y , z ) { } +CONSOLE MESSAGE: line 25: async function whitespace2 ( x , y , z ) { } CONSOLE MESSAGE: line 28: [object Object] CONSOLE MESSAGE: line 29: [object Object] Tests that console logging different types of functions correctly. @@ -102,8 +102,8 @@ __proto__: ƒ () [[FunctionLocation]]: console-functions.html:17 [[Scopes]]: Scopes[1] -console-functions.html:24 ƒ* whitespace( x ) { } -console-functions.html:25 ƒ* whitespace( x ) +console-functions.html:24 ƒ * whitespace ( x ) { } +console-functions.html:25 ƒ * whitespace( x ) arguments: (...) caller: (...) length: 1 @@ -113,7 +113,7 @@ [[FunctionLocation]]: console-functions.html:18 [[IsGenerator]]: true [[Scopes]]: Scopes[1] -console-functions.html:24 async ƒ whitespace2( x , y , z ) { } +console-functions.html:24 async ƒ whitespace2 ( x , y , z ) { } console-functions.html:25 async ƒ whitespace2( x , y , z ) arguments: (...) caller: (...) @@ -131,7 +131,7 @@ func5: ƒ namedArgs(x) func6: ƒ namedArgs2(x, y) func7: ƒ ({}) - func8: ƒ* whitespace( x ) + func8: ƒ * whitespace( x ) func9: async ƒ whitespace2( x , y , z ) __proto__: Object console-functions.html:29 Object @@ -143,7 +143,7 @@ func5: ƒ namedArgs(x) func6: ƒ namedArgs2(x, y) func7: ƒ ({}) - func8: ƒ* whitespace( x ) + func8: ƒ * whitespace( x ) func9: async ƒ whitespace2( x , y , z ) __proto__: Object
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection-expected.txt similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection-expected.txt index 1ae5110..13abb82b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection-expected.txt
@@ -1,6 +1,6 @@ Tests a handling of a click on the link in a message, which had been shown before its originating script was added. -:8000/inspector/resources/source2.js:1 hello? +:8000/devtools/resources/source2.js:1 hello? script was added Panel sources was opened
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection.html index d4f771b..744880dd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-links-on-messages-before-inspection.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-links-on-messages-before-inspection.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script> function loadScript() { @@ -15,7 +15,7 @@ var message = new ConsoleModel.ConsoleMessage( TestRunner.runtimeModel, ConsoleModel.ConsoleMessage.MessageSource.JS, ConsoleModel.ConsoleMessage.MessageLevel.Info, 'hello?', null, - 'http://127.0.0.1:8000/inspector/resources/source2.js'); + 'http://127.0.0.1:8000/devtools/resources/source2.js'); ConsoleModel.consoleModel.addMessage(message); TestRunner.debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource, onScriptAdded);
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-log-object-with-getter-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-log-object-with-getter-expected.txt index 0020177..5a86c29 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-log-object-with-getter-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-log-object-with-getter-expected.txt
@@ -5,5 +5,5 @@ console-log-object-with-getter.js:32 {} console-log-object-with-getter.js:30 {}foo: Objecta: 1b: 2__proto__: Objectget foo: ƒ ()set bar: ƒ (x)__proto__: Object console-message > source-code > console-message-anchor > devtools-link > hidden console-message-badge > hide-badge-title > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > console-object-preview > object-properties-preview source-code > object-state-note info-note > children expanded > parent expanded > name > object-properties-section-separator > object-value-object value > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children console-log-object-with-getter.js:31 (2) [(...), empty]0: 1length: 2get 0: ƒ ()set 1: ƒ (x)__proto__: Array(0) console-message > source-code > console-message-anchor > devtools-link > hidden console-message-badge > hide-badge-title > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > console-object-preview > object-description > object-properties-preview source-code > object-value-accessor > object-value-undefined > object-state-note info-note > children expanded > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children -console-log-object-with-getter.js:32 {}error: [Exception: Error: myError]function: [Exception: ƒ ()]number: [Exception: 123]string: [Exception: "myString"]get error: ƒ error()get function: ƒ function()get number: ƒ number()get string: ƒ string()__proto__: Object console-message > source-code > console-message-anchor > devtools-link > hidden console-message-badge > hide-badge-title > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > console-object-preview > object-properties-preview source-code > object-state-note info-note > children expanded > name > object-properties-section-separator > error value > object-value-error > children > name > object-properties-section-separator > error value > object-value-function > object-value-function-prefix > children > name > object-properties-section-separator > error value > object-value-number > children > name > object-properties-section-separator > error value > object-value-string > object-value-string-quote > object-value-string-quote > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children +console-log-object-with-getter.js:32 {}error: [Exception: Error: myError]function: [Exception: ƒ ()]number: [Exception: 123]string: [Exception: "myString"]get error: ƒ error()get function: ƒ ()get number: ƒ number()get string: ƒ string()__proto__: Object console-message > source-code > console-message-anchor > devtools-link > hidden console-message-badge > hide-badge-title > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > console-object-preview > object-properties-preview source-code > object-state-note info-note > children expanded > name > object-properties-section-separator > error value > object-value-error > children > name > object-properties-section-separator > error value > object-value-function > object-value-function-prefix > children > name > object-properties-section-separator > error value > object-value-number > children > name > object-properties-section-separator > error value > object-value-string > object-value-string-quote > object-value-string-quote > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-on-animation-worklet-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-on-animation-worklet-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console/console-on-animation-worklet-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/console/console-on-animation-worklet-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-on-animation-worklet.html b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-on-animation-worklet.html similarity index 79% rename from third_party/WebKit/LayoutTests/http/tests/inspector/console/console-on-animation-worklet.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/console/console-on-animation-worklet.html index fc0b7ce..4b402d22 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console/console-on-animation-worklet.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/console/console-on-animation-worklet.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script> function importWorklet() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-expected.txt index 00881e8..6717a425 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-expected.txt
@@ -14,7 +14,7 @@ useCapture: true passive: false once: false - handler: function () { console.log("click - document - handleEvent"); } + handler: function() { console.log("click - document - handleEvent"); } == Raw [expanded] documentRemoveevent-listener-sidebar.html:25 useCapture: true @@ -26,19 +26,19 @@ useCapture: true passive: false once: false - handler: function (event) { console.log("click - document - capturing"); } + handler: function(event) { console.log("click - document - capturing"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar.html:17 useCapture: false passive: false once: false - handler: function (event) { console.log("click - button - bubbling (registered after attribute)"); } + handler: function(event) { console.log("click - button - bubbling (registered after attribute)"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar.html:16 useCapture: false passive: false once: false - handler: function (event) { console.log("click - button - attribute"); } + handler: function(event) { console.log("click - button - attribute"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar.html:12 useCapture: false @@ -50,7 +50,7 @@ useCapture: true passive: false once: false - handler: function (event) { console.log("click - button - capturing"); } + handler: function(event) { console.log("click - button - capturing"); } ======== custom event ======== == Raw
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery1-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery1-expected.txt index f97b6c5..93d75c34 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery1-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery1-expected.txt
@@ -8,25 +8,25 @@ useCapture: true passive: false once: false - handler: function (){ console.log("second jquery"); } + handler: function(){ console.log("second jquery"); } == FrameworkUser [expanded] button#nodeRemoveevent-listener-sidebar-jquery1.html:10 useCapture: true passive: false once: false - handler: function (){ console.log("first jquery"); } + handler: function(){ console.log("first jquery"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar-jquery1.html:12 useCapture: false passive: false once: false - handler: function () { console.log("addEventListener"); } + handler: function() { console.log("addEventListener"); } == Framework [expanded] button#nodeRemovejquery-1.11.3.min.js:4 useCapture: false passive: false once: false - handler: function (a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)} + handler: function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)} ======== load ======== == Raw
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery2-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery2-expected.txt index 8a115d2..930e0ce 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery2-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/event-listener-sidebar-jquery2-expected.txt
@@ -8,31 +8,31 @@ useCapture: true passive: false once: false - handler: function (){ console.log("second jquery"); } + handler: function(){ console.log("second jquery"); } == FrameworkUser [expanded] button#nodeRemoveevent-listener-sidebar-jquery2.html:10 useCapture: true passive: false once: false - handler: function (){ console.log("first jquery"); } + handler: function(){ console.log("first jquery"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar-jquery2.html:13 useCapture: false passive: false once: false - handler: function () { console.log("onclick"); } + handler: function() { console.log("onclick"); } == Raw [expanded] button#nodeRemoveevent-listener-sidebar-jquery2.html:12 useCapture: false passive: false once: false - handler: function () { console.log("addEventListener"); } + handler: function() { console.log("addEventListener"); } == Framework [expanded] button#nodeRemovejquery-2.1.4.min.js:3 useCapture: false passive: false once: false - handler: function (b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0} + handler: function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0} ======== load ======== == Raw
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-headers-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-headers-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-headers.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-headers.html index fd2f123..a058986 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-headers.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="extensions-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/extensions-test.js"></script> <script type="text/javascript"> function extension_testAddHeaders(nextTest)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval-expected.txt similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval-expected.txt index a7febd3..6bcf861 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval-expected.txt
@@ -4,7 +4,7 @@ Started extension. Running tests... RUNNING TEST: extension_testEvalInIFrame -Evaluate: "/inspector/resources/extensions-frame-eval.html" (exception: undefined) +Evaluate: "/devtools/resources/extensions-frame-eval.html" (exception: undefined) RUNNING TEST: extension_testEvalInIFrameBadOption error: Extension server error: Object not found: bogus Evaluate: undefined (exception: [object Object])
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval.html similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval.html index cf91b15..24dca51 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-iframe-eval.html
@@ -1,12 +1,12 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="extensions-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/extensions-test.js"></script> <script type="text/javascript"> function extension_testEvalInIFrame(nextTest) { - var url = 'http://127.0.0.1:8000/inspector/resources/extensions-frame-eval.html'; + var url = 'http://127.0.0.1:8000/devtools/resources/extensions-frame-eval.html'; var origin = "http://127.0.0.1:8000" var options = { frameURL: url @@ -17,7 +17,7 @@ function extension_testEvalInIFrameBadOption(nextTest) { - var url = 'http://127.0.0.1:8000/inspector/resources/extensions-frame-eval.html'; + var url = 'http://127.0.0.1:8000/devtools/resources/extensions-frame-eval.html'; var origin = "http://127.0.0.1:8000" var options = { frameURL: url,
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-ignore-cache-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-ignore-cache-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-ignore-cache-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-ignore-cache-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-ignore-cache.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-ignore-cache.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-ignore-cache.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-ignore-cache.html index a9261003..18c455b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-ignore-cache.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-ignore-cache.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="extensions-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/extensions-test.js"></script> <script src="network/resources/random-script.php"></script> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect-expected.txt similarity index 93% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect-expected.txt index 46e0b13c..8a328a3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect-expected.txt
@@ -11,7 +11,7 @@ Finished request: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true RUNNING TEST: extension_testRedirectRequestInHAR Requests in HAR: -http://127.0.0.1:8000/inspector/extensions-network-redirect.html +http://127.0.0.1:8000/devtools/extensions-network-redirect.html http://127.0.0.1:8000/inspector/extensions-network-test.js http://127.0.0.1:8000/inspector/extensions-test.js http://127.0.0.1:8000/inspector/inspector-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect.html index 2297aa2..e096244 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-network-redirect.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-network-redirect.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="extensions-network-test.js"></script> -<script src="extensions-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/extensions-network-test.js"></script> +<script src="../inspector/extensions-test.js"></script> <script type="text/javascript"> function extension_doRequest(force, callback)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-useragent-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-useragent-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-useragent-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-useragent-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-useragent.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-useragent.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions-useragent.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions-useragent.html index 0b65f00..cef11b6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-useragent.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions-useragent.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="extensions-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/extensions-test.js"></script> <script type="text/javascript"> function extension_testUserAgent(nextTest)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-api-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-api-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-api-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-api-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-api.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-api.html similarity index 68% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-api.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-api.html index b4789e4..4bb44f1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-api.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-api.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> function extension_testAPI(nextTest) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-api-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-api-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-api-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-api-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-api.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-api.html similarity index 78% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-api.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-api.html index e3006d7..efcf53e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-api.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-api.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../audits-test.js"></script> -<script src="extensions-audits-tests.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/audits-test.js"></script> +<script src="../../inspector/extensions/extensions-audits-tests.js"></script> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-content-script-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-content-script-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-content-script-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-content-script-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-content-script.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-content-script.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-content-script.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-content-script.html index 16925c9..20ede7ee 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-content-script.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-content-script.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../audits-test.js"></script> -<script src="extensions-audits-tests.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/audits-test.js"></script> +<script src="../../inspector/extensions/extensions-audits-tests.js"></script> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits.html index 0e862444..c8751c8a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-audits.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-audits.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../audits-test.js"></script> -<script src="extensions-audits-tests.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/audits-test.js"></script> +<script src="../../inspector/extensions/extensions-audits-tests.js"></script> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-content-script-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-content-script-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-content-script-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-content-script-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-content-script.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-content-script.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-content-script.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-content-script.html index 8c4c0ef..aa7b803 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-content-script.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-content-script.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> window.whereAmI = "main world";
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval.html index 15e74a57..7956dc15 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-eval.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-eval.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> window.inspectedValue = { str: "foo", num: 42 };
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-events-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-events-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-events.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events.html similarity index 96% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-events.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events.html index 7b42539..e39a703 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-events.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../debugger-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> <script src="resources/test-script.js"></script> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-network-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-network-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-network-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-network-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-network.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-network.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-network.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-network.html index 513e111..f2cb314 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-network.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-network.html
@@ -9,9 +9,9 @@ p { font-family: 'test'; } </style> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../extensions-network-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/extensions-network-test.js"></script> <link rel="stylesheet" href="resources/audits-style1.css" type="text/css"> <script type="text/javascript">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel-expected.txt similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel-expected.txt index f1e00c8..9e399864 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel-expected.txt
@@ -30,7 +30,7 @@ Panel resized, test passed. RUNNING TEST: extension_testOpenResource Showing .../extensions-panel.html -Showing resource .../inspector/extensions/extensions-panel.html in panel sources), line: 1001 +Showing resource .../devtools/extensions/extensions-panel.html in panel sources), line: 1001 Showing .../abe.png Showing resource .../extensions/resources/abe.png in panel sources), line: 1002 Showing .../missing.txt @@ -61,12 +61,12 @@ } button1 clicked Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two tooltip', disabled: true +status bar item 0, icon: ".../devtools/resources/button1.png", tooltip: 'Button One tooltip', disabled: false +status bar item 1, icon: ".../devtools/resources/button2.png", tooltip: 'Button Two tooltip', disabled: true Updated status bar buttons Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1-updated.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two updated tooltip', disabled: false +status bar item 0, icon: ".../devtools/resources/button1-updated.png", tooltip: 'Button One tooltip', disabled: false +status bar item 1, icon: ".../devtools/resources/button2.png", tooltip: 'Button Two updated tooltip', disabled: false button2 clicked RUNNING TEST: extension_testThemeName Theme name: themeNameForTest
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel.html similarity index 97% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel.html index d11789d..cbe72380 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-panel.html
@@ -1,11 +1,11 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../console-test.js"></script> -<script src="../network-test.js"></script> -<script src="../sources-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/network-test.js"></script> +<script src="../../inspector/sources-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> function logMessage() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-reload-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-reload-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-reload.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-reload.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-reload.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-reload.html index 2e4906f..5d2a78a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-reload.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-reload.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script type="text/javascript"> window.bar = "foo = " + window.foo;
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-resources-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-resources-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-resources-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-resources-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-resources.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-resources.html similarity index 96% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-resources.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-resources.html index 694602cc..f1c1bffb 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-resources.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-resources.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../console-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../debugger-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> <script type="text/javascript"> function loadFrame() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-sidebar-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-sidebar-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-sidebar-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-sidebar-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-sidebar.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-sidebar.html similarity index 98% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-sidebar.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-sidebar.html index dd8d588..df753da 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-sidebar.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-sidebar.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> function initialize_extensionsSidebarTest()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-timeline-api-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-timeline-api-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-timeline-api-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-timeline-api-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-timeline-api.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-timeline-api.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-timeline-api.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-timeline-api.html index 445387f8..e07194c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-timeline-api.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-timeline-api.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> -<script src="../timeline-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> <script type="text/javascript"> function initialize_timelineExtensionTest()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/multiple-extensions-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/multiple-extensions-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/multiple-extensions-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/multiple-extensions-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/multiple-extensions.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/multiple-extensions.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/multiple-extensions.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/multiple-extensions.html index 0667db7..d175a3ad 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/multiple-extensions.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/multiple-extensions.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../extensions-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/extensions-test.js"></script> <script type="text/javascript"> function initialize_multipleExtensionsTest() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/abe.png b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/abe.png similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/abe.png rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/abe.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/audits-style1.css b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/audits-style1.css similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/audits-style1.css rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/audits-style1.css
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/subframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/subframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/subframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/subframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/test-script.js b/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/test-script.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/resources/test-script.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/extensions/resources/test-script.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/forced-layout-in-microtask-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/forced-layout-in-microtask-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/forced-layout-in-microtask-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/forced-layout-in-microtask-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/forced-layout-in-microtask.html b/third_party/WebKit/LayoutTests/http/tests/devtools/forced-layout-in-microtask.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/forced-layout-in-microtask.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/forced-layout-in-microtask.html index 24cd4f0..858c9f7b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/forced-layout-in-microtask.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/forced-layout-in-microtask.html
@@ -3,8 +3,8 @@ <style> .test { height: 20px; } </style> -<script src="inspector-test.js"></script> -<script src="timeline-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/timeline-test.js"></script> <script> function performActions() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/fragment-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/fragment-expected.txt new file mode 100644 index 0000000..cb654bc --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/fragment-expected.txt
@@ -0,0 +1,8 @@ +CONSOLE MESSAGE: line 16: Done. +Tests fragment is stripped from url by resource and page agents. + + +Child frame url: http://127.0.0.1:8000/devtools/resources/fragment-frame.html +Child frame resource url: http://127.0.0.1:8000/devtools/resources/fragment-frame.html +Child frame request url: http://127.0.0.1:8000/devtools/resources/fragment-frame.html +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/fragment.html b/third_party/WebKit/LayoutTests/http/tests/devtools/fragment.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/fragment.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/fragment.html index 09ec4e2d..88c5d89 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/fragment.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/fragment.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/network-test.js"></script> <script type="text/javascript"> function loadIFrame() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-data-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-data-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-data-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-data-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-data.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-data.html similarity index 97% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-data.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-data.html index 7fad7964..bee2d51 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-data.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-data.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> function test() { var indexedDBModel = ApplicationTestRunner.createIndexedDBModel();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-names-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-names-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-names-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-names-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-names.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-names.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-names.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-names.html index 85582a6..e43034dd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-names.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-names.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> function test() { var indexedDBModel = ApplicationTestRunner.createIndexedDBModel();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-refresh-view-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-refresh-view-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-refresh-view.html similarity index 95% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-refresh-view.html index a2b24cc..eb7a147 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-refresh-view.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> -<script src="indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-structure-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-structure-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-structure-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-structure-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-structure.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-structure.html similarity index 97% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-structure.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-structure.html index 7ee280f..1433020b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-structure.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/database-structure.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> function test() { var indexedDBModel = ApplicationTestRunner.createIndexedDBModel();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources-panel-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources-panel-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources-panel-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources-panel-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources-panel.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources-panel.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources-panel.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources-panel.html index 559d7c0..ec7350e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources-panel.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources-panel.html
@@ -1,15 +1,15 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="indexeddb-test.js"></script> -<script src="../resources-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> +<script src="../../inspector/resources-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script> function test() { var mainFrameId = TestRunner.resourceTreeModel.mainFrame.id; var indexedDBModel; var withoutIndexedDBURL = 'http://localhost:8000/inspector/indexeddb/resources/without-indexed-db.html'; - var originalURL = 'http://127.0.0.1:8000/inspector/indexeddb/resources-panel.html'; + var originalURL = 'http://127.0.0.1:8000/devtools/indexeddb/resources-panel.html'; var databaseName = 'testDatabase'; var objectStoreName = 'testObjectStore'; var indexName = 'testIndexName';
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources/without-indexed-db.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources/without-indexed-db.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/resources/without-indexed-db.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/resources/without-indexed-db.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/transaction-promise-console-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/transaction-promise-console-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/transaction-promise-console-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/transaction-promise-console-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/transaction-promise-console.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/transaction-promise-console.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/transaction-promise-console.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/transaction-promise-console.html index efecead9..2362488 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/transaction-promise-console.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/transaction-promise-console.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../console-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/console-test.js"></script> <script> function test() { testRunner.waitUntilDone();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/upgrade-events-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/upgrade-events-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/upgrade-events-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/upgrade-events-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/upgrade-events.html b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/upgrade-events.html similarity index 96% rename from third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/upgrade-events.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/upgrade-events.html index 326347d..dab0cafd5 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/upgrade-events.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/indexeddb/upgrade-events.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="indexeddb-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/indexeddb/indexeddb-test.js"></script> <script> function test() { var indexedDBModel = ApplicationTestRunner.createIndexedDBModel();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading-expected.txt similarity index 82% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading-expected.txt index f14ba88..325e423 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading-expected.txt
@@ -2,5 +2,5 @@ SourceMap Loaded: url: data:application/json;base64,eyJmaWxlIjoiY29tcGlsZWQuanMiLCJtYXBwaW5ncyI6IkFBQVNBLFFBQUFBLElBQUcsQ0FBQ0MsQ0FBRCxDQUFhQyxDQUFiLENBQ1osQ0FDSSxNQUFPRCxFQUFQLENBQW9CQyxDQUR4QixDQUlBLElBQUlDLE9BQVM7Iiwic291cmNlcyI6WyJzb3VyY2UuanMiXSwic291cmNlc0NvbnRlbnQiOlsiPHNvdXJjZSBjb250ZW50PiJdfQ== -compiledURL: http://127.0.0.1:8000/inspector/inline-source-map-loading.html +compiledURL: http://127.0.0.1:8000/devtools/inline-source-map-loading.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading.html b/third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading.html index d89d926..e482016 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/inline-source-map-loading.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/inline-source-map-loading.html
@@ -1,6 +1,6 @@ <html> <head> -<script src="inspector-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-element-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-element-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inspect-element-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/inspect-element-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-element.html b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-element.html similarity index 82% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inspect-element.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/inspect-element.html index 1632455..25505e5a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-element.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-element.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="console-test.js"></script> -<script src="elements-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/console-test.js"></script> +<script src="../inspector/elements-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-iframe-from-different-domain-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/inspect-iframe-from-different-domain-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-iframe-from-different-domain.html similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/inspect-iframe-from-different-domain.html index 0dbe9f6..5119c87 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/inspect-iframe-from-different-domain.html
@@ -1,8 +1,8 @@ <html> <head> <title>Inspect style in iframe from different domain.</title> -<script src="inspector-test.js"></script> -<script src="elements-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/elements-test.js"></script> <script> var onIFrameLoadCalled = false; @@ -27,7 +27,7 @@ </script> </head> <body> - <iframe src="http://localhost:8000/inspector/resources/iframe-from-different-domain-data.html" id="receiver" onload="onIFrameLoad()"></iframe> + <iframe src="http://localhost:8000/devtools/resources/iframe-from-different-domain-data.html" id="receiver" onload="onIFrameLoad()"></iframe> <p> Tests that style properties of elements in iframes loaded from domain different from the main document domain can be inspected.
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/modify-cross-domain-rule-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/modify-cross-domain-rule-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/modify-cross-domain-rule-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/modify-cross-domain-rule-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/modify-cross-domain-rule.html b/third_party/WebKit/LayoutTests/http/tests/devtools/modify-cross-domain-rule.html similarity index 96% rename from third_party/WebKit/LayoutTests/http/tests/inspector/modify-cross-domain-rule.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/modify-cross-domain-rule.html index 72edb201..53447adc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/modify-cross-domain-rule.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/modify-cross-domain-rule.html
@@ -1,8 +1,8 @@ <html> <head> <link rel="stylesheet" href="http://localhost:8000/devtools/elements/styles/modify-cross-domain-rule.css"> -<script src="inspector-test.js"></script> -<script src="elements-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/elements-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options-expected.txt new file mode 100644 index 0000000..ba762ad --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options-expected.txt
@@ -0,0 +1,17 @@ +CONSOLE WARNING: line 17: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. +CONSOLE ERROR: line 20: Failed to load http://localhost:8000/devtools/resources/cors-target.php?id=0&deny=yes: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +CONSOLE ERROR: line 20: Failed to load http://localhost:8000/devtools/resources/cors-target.php?id=1&deny=yes: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +CONSOLE ERROR: Failed to load http://localhost:8000/devtools/resources/cors-target.php?id=3&deny=yes: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +CONSOLE ERROR: Failed to load http://localhost:8000/devtools/resources/cors-target.php?id=4&deny=yes: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. +Tests that preflight OPTIONS requests appear in Network resources + +Bug 63712 +0 xhr:POST http://localhost:8000/devtools/resources/cors-target.php?id=0&deny=yes +1 xhr:OPTIONS http://localhost:8000/devtools/resources/cors-target.php?id=1&deny=yes +2 xhr:OPTIONS http://localhost:8000/devtools/resources/cors-target.php?id=2 +2 xhr:POST http://localhost:8000/devtools/resources/cors-target.php?id=2 +3 xhr:POST http://localhost:8000/devtools/resources/cors-target.php?id=3&deny=yes +4 xhr:OPTIONS http://localhost:8000/devtools/resources/cors-target.php?id=4&deny=yes +5 xhr:OPTIONS http://localhost:8000/devtools/resources/cors-target.php?id=5 +5 xhr:POST http://localhost:8000/devtools/resources/cors-target.php?id=5 +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options.html b/third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options.html similarity index 95% rename from third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options.html index 6fdcbcb..0753605 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network-preflight-options.html
@@ -1,6 +1,6 @@ <html> <head> -<script src="inspector-test.js"></script> +<script src="../inspector/inspector-test.js"></script> <script type="text/javascript"> function sendXHR(url, forcePreflight, async, callback) { @@ -22,7 +22,7 @@ } } -var baseTargetURL = "http://localhost:8000/inspector/resources/cors-target.php"; +var baseTargetURL = "http://localhost:8000/devtools/resources/cors-target.php"; function targetURL(id, deny, addTimestamp) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-blocked-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-blocked-expected.txt index 3ad8085..3cfbb7a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-blocked-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-blocked-expected.txt
@@ -1,10 +1,10 @@ Tests blocking fetch in worker. Fetch in worker result: FETCH_FAILED -http://127.0.0.1:8000/inspector/network/resources/fetch-worker.js +http://127.0.0.1:8000/devtools/network/resources/fetch-worker.js resource.type: other request.failed: false -http://127.0.0.1:8000/inspector/network/resources/resource.php +http://127.0.0.1:8000/devtools/network/resources/resource.php resource.type: other request.failed: true
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-expected.txt index b144a52e..6e298957 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-worker-fetch-expected.txt
@@ -1,10 +1,10 @@ Tests fetch in worker. Fetch in worker result: Hello world -http://127.0.0.1:8000/inspector/network/resources/fetch-worker.js +http://127.0.0.1:8000/devtools/network/resources/fetch-worker.js resource.type: other request.failed: false -http://127.0.0.1:8000/inspector/network/resources/resource.php +http://127.0.0.1:8000/devtools/network/resources/resource.php resource.type: fetch request.failed: false
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/network/resources/docwrite.js b/third_party/WebKit/LayoutTests/http/tests/devtools/network/resources/docwrite.js index c6dd9f06..f6f63126 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/network/resources/docwrite.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network/resources/docwrite.js
@@ -1,3 +1,3 @@ -document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-1"></s' + 'cript>'); -document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-2"></s' + 'cript>'); -document.write('<script src="http://localhost:8000/inspector/network/resources/empty-script.js?docWritten-3"></s' + 'cript>'); +document.write('<script src="http://localhost:8000/devtools/network/resources/empty-script.js?docWritten-1"></s' + 'cript>'); +document.write('<script src="http://localhost:8000/devtools/network/resources/empty-script.js?docWritten-2"></s' + 'cript>'); +document.write('<script src="http://localhost:8000/devtools/network/resources/empty-script.js?docWritten-3"></s' + 'cript>');
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-absolute-paths-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-absolute-paths-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-absolute-paths.html similarity index 74% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-absolute-paths.html index 5e4b1dd..fa80dad 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-absolute-paths.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-dynamic-uisourcecodes-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-dynamic-uisourcecodes-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-dynamic-uisourcecodes.html similarity index 85% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-dynamic-uisourcecodes.html index 25eac49..299d5cf4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-dynamic-uisourcecodes.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-dynamic-uisourcecodes.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-git-folders-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-git-folders-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-git-folders-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-git-folders-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-git-folders.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-git-folders.html similarity index 84% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-git-folders.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-git-folders.html index f7674de..21085fce 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-git-folders.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-git-folders.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-rename-files-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-rename-files-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-rename-files-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-rename-files-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-rename-files.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-rename-files.html similarity index 81% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-rename-files.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-rename-files.html index 50761303..04e032f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-rename-files.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-rename-files.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sane-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sane-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sane.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sane.html index f7b4182c..37325004 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sane.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sane.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt new file mode 100644 index 0000000..e2343f57 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt
@@ -0,0 +1,16 @@ +CONSOLE MESSAGE: line 1: 1 +CONSOLE MESSAGE: line 1: function(){} +Verify that sourcemap sources are mapped event when sourcemap compiled url matches with one of the source urls. + +Binding created: { + network: http://127.0.0.1:8000/devtools/persistence/resources/sourcemap-name-clash/out.js? [sm] + fileSystem: file:///var/www/src/out.js + exactMatch: true +} +Binding created: { + network: http://127.0.0.1:8000/devtools/persistence/resources/sourcemap-name-clash/out.js + fileSystem: file:///var/www/out.js + exactMatch: true +} +Mapping has stabilized. +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash.html similarity index 73% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash.html index 96279fb..1eb7d6e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash.html
@@ -1,17 +1,17 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> -<script src="./resources/sourcemap-name-clash/out.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> +<script src="resources/sourcemap-name-clash/out.js"></script> <script> function test() { BindingsTestRunner.initializeTestMapping(); BindingsTestRunner.overrideNetworkModificationTime( - {'http://127.0.0.1:8000/inspector/persistence/resources/sourcemap-name-clash/out.js': null}); + {'http://127.0.0.1:8000/devtools/persistence/resources/sourcemap-name-clash/out.js': null}); Promise.all([getResourceContent('out.js'), getResourceContent('out.js? [sm]')]).then(onResourceContents);
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap.html similarity index 76% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap.html index 8c06ce5..70ce0ed 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap.html
@@ -1,17 +1,17 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <link href="./resources/s.css" rel="stylesheet"> <script> function test() { BindingsTestRunner.initializeTestMapping(); BindingsTestRunner.overrideNetworkModificationTime( - {'http://127.0.0.1:8000/inspector/persistence/resources/s.css': null}); + {'http://127.0.0.1:8000/devtools/persistence/resources/s.css': null}); Promise.all([getResourceContent('s.css'), getResourceContent('s.scss')]).then(onResourceContents);
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/filesystem-delete-file-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/filesystem-delete-file-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/filesystem-delete-file-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/filesystem-delete-file-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/filesystem-delete-file.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/filesystem-delete-file.html similarity index 72% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/filesystem-delete-file.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/filesystem-delete-file.html index a7e73ed78..99ff074 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/filesystem-delete-file.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/filesystem-delete-file.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/navigator-create-file-copy-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/navigator-create-file-copy-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/navigator-create-file-copy-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/navigator-create-file-copy-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/navigator-create-file-copy.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/navigator-create-file-copy.html similarity index 75% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/navigator-create-file-copy.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/navigator-create-file-copy.html index baa40ca..bde5328 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/navigator-create-file-copy.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/navigator-create-file-copy.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt new file mode 100644 index 0000000..50ccaaf --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt
@@ -0,0 +1,12 @@ +Verify that dirty uiSourceCodes are not bound. + + +Running: waitForUISourceCodes + +Running: addFileSystemMapping +Failed to create binding: { + network: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + fileSystem: file:///var/www/devtools/persistence/resources/foo.js + exactMatch: false +} +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode.html similarity index 76% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode.html index 0f0c348..cdf6abfe 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-bind-dirty-sourcecode.html
@@ -1,11 +1,11 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../console-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/console-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-overwrite-css-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-overwrite-css-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-overwrite-css.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-overwrite-css.html index 49825a3..3e79e6f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-do-not-overwrite-css.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <style> body { color: red;
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog-expected.txt similarity index 66% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog-expected.txt index ecf8d8a..aadda67 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog-expected.txt
@@ -4,21 +4,21 @@ Running: waitForUISourceCodes Running: goToSourceDialogBeforeBinding -file:///var/www/inspector/persistence/resources/foo.js +file:///var/www/devtools/persistence/resources/foo.js +http://127.0.0.1:8000/devtools/persistence/persistence-go-to-file-dialog.html +http://127.0.0.1:8000/devtools/persistence/resources/foo.js http://127.0.0.1:8000/inspector/debugger-test.js http://127.0.0.1:8000/inspector/inspector-test.js http://127.0.0.1:8000/inspector/isolated-filesystem-test.js -http://127.0.0.1:8000/inspector/persistence/persistence-go-to-file-dialog.html http://127.0.0.1:8000/inspector/persistence/persistence-test.js -http://127.0.0.1:8000/inspector/persistence/resources/foo.js Running: addFileSystemMapping Running: goToSourceAfterBinding -file:///var/www/inspector/persistence/resources/foo.js +file:///var/www/devtools/persistence/resources/foo.js +http://127.0.0.1:8000/devtools/persistence/persistence-go-to-file-dialog.html http://127.0.0.1:8000/inspector/debugger-test.js http://127.0.0.1:8000/inspector/inspector-test.js http://127.0.0.1:8000/inspector/isolated-filesystem-test.js -http://127.0.0.1:8000/inspector/persistence/persistence-go-to-file-dialog.html http://127.0.0.1:8000/inspector/persistence/persistence-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog.html index 7e3e6ca6..3aa9237c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-go-to-file-dialog.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-go-to-file-dialog.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs-expected.txt new file mode 100644 index 0000000..0da1c5a --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs-expected.txt
@@ -0,0 +1,36 @@ +Verify that tabs get merged when binding is added and removed. + + +Running: addFileSystem + +Running: openNetworkTab +SourceFrame: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + selection: {"startLine":2,"startColumn":0,"endLine":2,"endColumn":5} + firstVisibleLine: 2 + isDirty: false + +Running: openFileSystemTab +SourceFrame: file:///var/www/devtools/persistence/resources/foo.js + selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} + firstVisibleLine: 1 + isDirty: false +Opened tabs: + file:///var/www/devtools/persistence/resources/foo.js + http://127.0.0.1:8000/devtools/persistence/resources/foo.js + +Running: addFileMapping +Opened tabs: + file:///var/www/devtools/persistence/resources/foo.js +SourceFrame: file:///var/www/devtools/persistence/resources/foo.js + selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} + firstVisibleLine: 1 + isDirty: false + +Running: removeFileMapping +Opened tabs: + file:///var/www/devtools/persistence/resources/foo.js +SourceFrame: file:///var/www/devtools/persistence/resources/foo.js + selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} + firstVisibleLine: 1 + isDirty: false +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs.html index 3022a9c..deb4d0f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-merge-editor-tabs.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-mimetype-on-rename-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-mimetype-on-rename-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-mimetype-on-rename-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-mimetype-on-rename-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-mimetype-on-rename.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-mimetype-on-rename.html similarity index 80% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-mimetype-on-rename.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-mimetype-on-rename.html index 72cab2d..6f6a5f14 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-mimetype-on-rename.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-mimetype-on-rename.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./automapping-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/automapping-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt similarity index 65% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt index c2aea508..78503a4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt
@@ -12,6 +12,6 @@ foo.js:1 Running: removeFileMapping - file:///var/www/inspector/persistence/resources/foo.js:0 - http://127.0.0.1:8000/inspector/persistence/resources/foo.js:0 + file:///var/www/devtools/persistence/resources/foo.js:0 + http://127.0.0.1:8000/devtools/persistence/resources/foo.js:0
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload-expected.txt similarity index 63% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload-expected.txt index 5bbab8c5..fe61fe9 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload-expected.txt
@@ -6,9 +6,9 @@ Running: addNetworkFooJS Running: setBreakpointInFileSystemUISourceCode - http://127.0.0.1:8000/inspector/persistence/resources/foo.js:2 + http://127.0.0.1:8000/devtools/persistence/resources/foo.js:2 Running: reloadPageAndDumpBreakpoints Page reloaded. - file:///var/www/inspector/persistence/resources/foo.js:0 + file:///var/www/devtools/persistence/resources/foo.js:0
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload.html similarity index 89% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload.html index 8722ded..1818888 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints-on-reload.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints-on-reload.html
@@ -1,9 +1,9 @@ <html> <head> -<script src='../inspector-test.js'></script> -<script src='../debugger-test.js'></script> -<script src='../isolated-filesystem-test.js'></script> -<script src='./persistence-test.js'></script> +<script src='../../inspector/inspector-test.js'></script> +<script src='../../inspector/debugger-test.js'></script> +<script src='../../inspector/isolated-filesystem-test.js'></script> +<script src='../../inspector/persistence/persistence-test.js'></script> <script> function addFooJS() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints.html index d1f621a9..8ed45f83 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-move-breakpoints.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-move-breakpoints.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator-expected.txt similarity index 65% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator-expected.txt index 9534ffd..f20872c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator-expected.txt
@@ -6,48 +6,51 @@ Running: waitForUISourceCodes [largeicon-navigator-frame] top [largeicon-navigator-domain] 127.0.0.1:8000 + [largeicon-navigator-folder] devtools/persistence + [largeicon-navigator-folder] resources + [largeicon-navigator-file] foo.js + [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-folder] inspector [largeicon-navigator-folder] persistence - [largeicon-navigator-folder] resources - [largeicon-navigator-file] foo.js - [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-file] persistence-test.js [largeicon-navigator-file] debugger-test.js [largeicon-navigator-file] inspector-test.js [largeicon-navigator-file] isolated-filesystem-test.js [largeicon-navigator-folder] www [dimmed] - [largeicon-navigator-folder] inspector/persistence/resources [dimmed] + [largeicon-navigator-folder] devtools/persistence/resources [dimmed] [largeicon-navigator-file] foo.js Running: addFileMapping [largeicon-navigator-frame] top [largeicon-navigator-domain] 127.0.0.1:8000 + [largeicon-navigator-folder] devtools/persistence + [largeicon-navigator-folder] resources + [largeicon-navigator-file-sync, badge-navigator-file-sync] foo.js + [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-folder] inspector [largeicon-navigator-folder] persistence - [largeicon-navigator-folder] resources - [largeicon-navigator-file-sync, badge-navigator-file-sync] foo.js - [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-file] persistence-test.js [largeicon-navigator-file] debugger-test.js [largeicon-navigator-file] inspector-test.js [largeicon-navigator-file] isolated-filesystem-test.js [largeicon-navigator-folder] www - [largeicon-navigator-folder] inspector/persistence/resources + [largeicon-navigator-folder] devtools/persistence/resources [largeicon-navigator-file-sync, badge-navigator-file-sync] foo.js Running: removeFileMapping [largeicon-navigator-frame] top [largeicon-navigator-domain] 127.0.0.1:8000 + [largeicon-navigator-folder] devtools/persistence + [largeicon-navigator-folder] resources + [largeicon-navigator-file] foo.js + [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-folder] inspector [largeicon-navigator-folder] persistence - [largeicon-navigator-folder] resources - [largeicon-navigator-file] foo.js - [largeicon-navigator-file] persistence-navigator.html [largeicon-navigator-file] persistence-test.js [largeicon-navigator-file] debugger-test.js [largeicon-navigator-file] inspector-test.js [largeicon-navigator-file] isolated-filesystem-test.js [largeicon-navigator-folder] www [dimmed] - [largeicon-navigator-folder] inspector/persistence/resources [dimmed] + [largeicon-navigator-folder] devtools/persistence/resources [dimmed] [largeicon-navigator-file] foo.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator.html index 6c2bc11..fa965bd 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-navigator.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-navigator.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file-expected.txt new file mode 100644 index 0000000..8087ad1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file-expected.txt
@@ -0,0 +1,14 @@ +Verify that binding gets removed as the fileSystem file gets renamed. + +Binding created: { + network: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + fileSystem: file:///var/www/devtools/persistence/resources/foo.js + exactMatch: false +} +Renaming foo.js -> bar.js +Binding successfully removed: { + network: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + fileSystem: file:///var/www/devtools/persistence/resources/bar.js + exactMatch: false +} +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file.html similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file.html index 66e0926..5371c5a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-rename-mapped-file.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files-expected.txt similarity index 60% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files-expected.txt index 2a930d0..930751a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files-expected.txt
@@ -4,14 +4,14 @@ Running: waitForUISourceCodes Running: dumpSearchResults -Search result #1: uiSourceCode.url = file:///var/www/inspector/persistence/resources/foo.js +Search result #1: uiSourceCode.url = file:///var/www/devtools/persistence/resources/foo.js search match #1: lineNumber = 2, lineContent = 'window.foo = ()=>'foo';' -Search result #2: uiSourceCode.url = http://127.0.0.1:8000/inspector/persistence/resources/foo.js +Search result #2: uiSourceCode.url = http://127.0.0.1:8000/devtools/persistence/resources/foo.js search match #1: lineNumber = 2, lineContent = 'window.foo = ()=>'foo';' Running: addFileMapping Running: dumpSearchResults -Search result #1: uiSourceCode.url = file:///var/www/inspector/persistence/resources/foo.js +Search result #1: uiSourceCode.url = file:///var/www/devtools/persistence/resources/foo.js search match #1: lineNumber = 2, lineContent = 'window.foo = ()=>'foo';'
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files.html similarity index 80% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files.html index 632bb2d..9c152880b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-search-across-all-files.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-search-across-all-files.html
@@ -1,11 +1,11 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../search/search-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/search/search-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages-expected.txt new file mode 100644 index 0000000..0d7b9e6c --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages-expected.txt
@@ -0,0 +1,25 @@ +Verify that messages are synced in UISourceCodeFrame between UISourceCodes of persistence binding. + + +Running: waitForUISourceCodes + +Running: addMessages +SourceFrame file:///var/www/devtools/persistence/resources/foo.js: 1 message(s) + 0:0 [Error] error in filesystem +SourceFrame http://127.0.0.1:8000/devtools/persistence/resources/foo.js: 1 message(s) + 1:0 [Warning] warning in network + +Running: addMapping +SourceFrame file:///var/www/devtools/persistence/resources/foo.js: 2 message(s) + 1:0 [Warning] warning in network + 0:0 [Error] error in filesystem +SourceFrame http://127.0.0.1:8000/devtools/persistence/resources/foo.js: 2 message(s) + 1:0 [Warning] warning in network + 0:0 [Error] error in filesystem + +Running: removeMapping +SourceFrame file:///var/www/devtools/persistence/resources/foo.js: 1 message(s) + 0:0 [Error] error in filesystem +SourceFrame http://127.0.0.1:8000/devtools/persistence/resources/foo.js: 1 message(s) + 1:0 [Warning] warning in network +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages.html similarity index 90% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages.html index d19ba65..e550f59 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sourceframe-messages.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab-expected.txt new file mode 100644 index 0000000..e654292a --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab-expected.txt
@@ -0,0 +1,11 @@ +Verify that a network file tab gets substituted with filesystem tab when persistence binding comes. + + +Running: openNetworkTab +Opened tabs: + http://127.0.0.1:8000/devtools/persistence/resources/foo.js + +Running: addMapping +Opened tabs: + file:///var/www/devtools/persistence/resources/foo.js +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab.html similarity index 82% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab.html index f051a8e..1e01865 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-switch-editor-tab.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-expected.txt similarity index 81% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-expected.txt index 65a221a..1b9f492 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-expected.txt
@@ -5,8 +5,8 @@ Running: addFileMapping Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - fileSystem: file:///var/www/inspector/persistence/resources/foo.js + network: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + fileSystem: file:///var/www/devtools/persistence/resources/foo.js exactMatch: false }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-nodejs-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-nodejs-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-nodejs.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-nodejs.html index f2001097..0a22182 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content-nodejs.html
@@ -1,9 +1,9 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> <script> async function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content.html similarity index 88% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content.html index a95514e..20014960 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-sync-content.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab.html similarity index 86% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab.html index 10eec93d..7c1335c6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab.html
@@ -1,9 +1,9 @@ <html> <head> -<script src='../inspector-test.js'></script> -<script src='../debugger-test.js'></script> -<script src='../isolated-filesystem-test.js'></script> -<script src='./persistence-test.js'></script> +<script src='../../inspector/inspector-test.js'></script> +<script src='../../inspector/debugger-test.js'></script> +<script src='../../inspector/isolated-filesystem-test.js'></script> +<script src='../../inspector/persistence/persistence-test.js'></script> <script src='./resources/foo.js'></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html similarity index 81% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html index b93f42b..4e3db73 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.html
@@ -1,10 +1,10 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order.html b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order.html index c5ec433b..f26f3d7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-tabbed-editor-tabs-order.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/persistence-tabbed-editor-tabs-order.html
@@ -1,18 +1,18 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../debugger-test.js"></script> -<script src="../isolated-filesystem-test.js"></script> -<script src="./persistence-test.js"></script> -<script src="./resources/foo.js"></script> -<script src="./resources/bar.js"></script> -<script src="./resources/baz.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/debugger-test.js"></script> +<script src="../../inspector/isolated-filesystem-test.js"></script> +<script src="../../inspector/persistence/persistence-test.js"></script> +<script src="resources/foo.js"></script> +<script src="resources/bar.js"></script> +<script src="resources/baz.js"></script> <script> function test() { BindingsTestRunner.forceUseDefaultMapping(); var fs = new BindingsTestRunner.TestFileSystem('file:///var/www'); - var folder = fs.root.mkdir('inspector').mkdir('persistence').mkdir('resources'); + var folder = fs.root.mkdir('devtools').mkdir('persistence').mkdir('resources'); folder.addFile('foo.js', '\n\nwindow.foo = ()=>\'foo\';'); folder.addFile('bar.js', 'window.bar = () => "bar";'); folder.addFile('baz.js', 'window.baz = () => "baz";');
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/bar.js b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/bar.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/bar.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/bar.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/baz.js b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/baz.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/baz.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/baz.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/foo.js b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/foo.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/foo.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/foo.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.css b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.css similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.css rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.css
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.css.map b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.css.map similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.css.map rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.css.map
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.scss b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.scss similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/s.scss rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/s.scss
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/sourcemap-name-clash/out.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/sourcemap-name-clash/out.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js.map b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/sourcemap-name-clash/out.js.map similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js.map rename to third_party/WebKit/LayoutTests/http/tests/devtools/persistence/resources/sourcemap-name-clash/out.js.map
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt similarity index 96% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt index 50ee8198..e61a4c4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt
@@ -23,7 +23,7 @@ method : "GET" queryString : [ ] - url : "http://127.0.0.1:8000/inspector/resource-har-conversion.html" + url : "http://127.0.0.1:8000/devtools/resource-har-conversion.html" } response : { _transferSize : <number> @@ -200,7 +200,7 @@ } queryString : [ ] - url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi" + url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi" } response : { _transferSize : <number> @@ -233,7 +233,7 @@ onLoad : <number> } startedDateTime : <plausible> - title : "http://127.0.0.1:8000/inspector/resource-har-conversion.html" + title : "http://127.0.0.1:8000/devtools/resource-har-conversion.html" } ] version : <string>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion.html similarity index 94% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion.html index bfd5cacd29..732e38e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion.html
@@ -1,8 +1,8 @@ <!doctype html> <html> <head> -<script src="inspector-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/network-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-headers-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-headers.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers.html similarity index 92% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-headers.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers.html index 9848073d3..4c0e99f 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-headers.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers.html
@@ -1,9 +1,9 @@ <!doctype html> <html> <head> -<script src="inspector-test.js"></script> -<script src="resources-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/resources-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> var test = function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt similarity index 87% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt index 2889fc6..98c41aca 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt
@@ -2,7 +2,7 @@ -http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt similarity index 87% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt index c5f4c2fd..6d551e3d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt
@@ -2,7 +2,7 @@ -http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.html similarity index 78% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.html index 07f18a11..aa3164c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> function submit() @@ -27,7 +27,7 @@ <p> Tests that resources panel shows form data parameters. </p> -<form target="target-iframe" method="POST" action="http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2="> +<form target="target-iframe" method="POST" action="http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2="> <input name="formParam1" value="formValue1"> <input name="formParam2"> <input id="submit" type="submit">
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.html similarity index 78% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.html index 1800b7a..e585db3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="network-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/network-test.js"></script> <script> function submit() @@ -27,7 +27,7 @@ <p> Tests that resources panel shows form data parameters. </p> -<form target="target-iframe" method="POST" action="http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2="> +<form target="target-iframe" method="POST" action="http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2="> <input name="formParam1" value="formValue1"> <input name="formParam2"> <input id="submit" type="submit">
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-tree/resource-tree-reload-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-tree/resource-tree-reload-expected.txt index e1ede37..4328f4a 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-tree/resource-tree-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-tree/resource-tree-reload-expected.txt
@@ -10,7 +10,7 @@ script http://127.0.0.1:8000/inspector/resource-tree/resources/script-initial.js stylesheet http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial-2.css stylesheet http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial.css -script http://127.0.0.1:8000/inspector/resources-test.js +script http://127.0.0.1:8000/devtools/resources-test.js Resources URL Map: http://127.0.0.1:8000/inspector/inspector-test.js == http://127.0.0.1:8000/inspector/inspector-test.js @@ -20,7 +20,7 @@ http://127.0.0.1:8000/inspector/resource-tree/resources/script-initial.js == http://127.0.0.1:8000/inspector/resource-tree/resources/script-initial.js http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial-2.css == http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial-2.css http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial.css == http://127.0.0.1:8000/inspector/resource-tree/resources/styles-initial.css -http://127.0.0.1:8000/inspector/resources-test.js == http://127.0.0.1:8000/inspector/resources-test.js +http://127.0.0.1:8000/devtools/resources-test.js == http://127.0.0.1:8000/devtools/resources-test.js Resources Tree: Frames
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/bar.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/bar.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/bar.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/bar.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/compiled-with-wrong-source-map-url.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/compiled-with-wrong-source-map-url.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/compiled-with-wrong-source-map-url.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/compiled-with-wrong-source-map-url.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/compiled.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/compiled.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/compiled.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/compiled.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-cd-completions-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-cd-completions-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-cd-completions-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-cd-completions-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-cd-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-cd-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-cd-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-cd-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-resource-errors-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-resource-errors-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-resource-errors-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-resource-errors-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-show-all-messages-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-show-all-messages-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/console-show-all-messages-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/console-show-all-messages-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/cors-target.php b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-target.php similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/cors-target.php rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/cors-target.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/cross-origin-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/cross-origin-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/cross-origin-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/cross-origin-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/echo-headers.php b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/echo-headers.php similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/echo-headers.php rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/echo-headers.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/empty.zip b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/empty.zip similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/empty.zip rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/empty.zip Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.css b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.css similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.css rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.css
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.css.map b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.css.map similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.css.map rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.css.map
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.scss b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.scss similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/example.scss rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/example.scss
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-main.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-main.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-main.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-main.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-main.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-main.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-main.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-main.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-panel.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-panel.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-panel.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-panel.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-sidebar.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-sidebar.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/extension-sidebar.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/extension-sidebar.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/extensions-frame-eval.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/extensions-frame-eval.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/extensions-frame-eval.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/extensions-frame-eval.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/fragment-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/fragment-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/fragment-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/fragment-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/har-pages-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/har-pages-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/har-pages-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/har-pages-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/har-pages-navigation-target.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/har-pages-navigation-target.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/har-pages-navigation-target.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/har-pages-navigation-target.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/html/foo.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/html/foo.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/html/foo.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/html/foo.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/html2/bar.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/html2/bar.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/html2/bar.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/html2/bar.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/iframe-from-different-domain-data.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/iframe-from-different-domain-data.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/iframe-from-different-domain-data.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/iframe-from-different-domain-data.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/image.png b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/image.png similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/image.png rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/image.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/inspect-element-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/inspect-element-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/inspect-element-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/json-value.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/json-value.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/json-value.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/json-value.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/layer-navigation-target.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/layer-navigation-target.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/layer-navigation-target.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/layer-navigation-target.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/load-resource-synchronously-encoding.php b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/load-resource-synchronously-encoding.php similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/load-resource-synchronously-encoding.php rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/load-resource-synchronously-encoding.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/post-target.cgi b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/post-target.cgi similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/post-target.cgi rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/post-target.cgi
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/resource-form-data-receiver-iframe.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/resource-form-data-receiver-iframe.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/resource-form-data-receiver-iframe.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/resource-form-data-receiver-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source-map.json b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source-map.json similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/source-map.json rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/source-map.json
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source1.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source1.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/source1.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/source1.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source2.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source2.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/source2.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/source2.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source3.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source3.js index bd7d8a5..91ecf0d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source3.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/source3.js
@@ -1,4 +1,4 @@ function foo() { - console.error(new Error("http://127.0.0.1:8000/inspector/resources/source3.js")); + console.error(new Error("http://127.0.0.1:8000/devtools/resources/source3.js")); } \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/test-scanner.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/test-scanner.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/test-scanner.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/test-scanner.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/worker.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/worker.js similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/worker.js rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/xhr-exists.html b/third_party/WebKit/LayoutTests/http/tests/devtools/resources/xhr-exists.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/resources/xhr-exists.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/resources/xhr-exists.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/runtime/runtime-getProperties-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/runtime/runtime-getProperties-expected.txt index 338d884..c709018 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/runtime/runtime-getProperties-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/runtime/runtime-getProperties-expected.txt
@@ -7,14 +7,14 @@ { enumerable : true getter : { - description : "function () { return 1; }" + description : "get foo() { return 1; }" objectId : <string> type : "function" } isOwn : true name : "foo" setter : { - description : "function (value) { }" + description : "set foo(value) { }" objectId : <string> type : "function" } @@ -27,7 +27,7 @@ { enumerable : true getter : { - description : "function () { return 1; }" + description : "get foo() { return 1; }" objectId : <string> type : "function" }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/service-workers/resources/user-agent-override-worker.js b/third_party/WebKit/LayoutTests/http/tests/devtools/service-workers/resources/user-agent-override-worker.js index 533546b..bec438f3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/service-workers/resources/user-agent-override-worker.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/service-workers/resources/user-agent-override-worker.js
@@ -1,6 +1,6 @@ function dumpUserAgent() { - fetch('http://127.0.0.1:8000/inspector/resources/echo-headers.php') + fetch('http://127.0.0.1:8000/devtools/resources/echo-headers.php') .then(function(response) { return response.text(); }).then(function(body) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-breakpoints/debugger-reload-breakpoints-with-source-maps.html b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-breakpoints/debugger-reload-breakpoints-with-source-maps.html index 3a49180..762604d4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-breakpoints/debugger-reload-breakpoints-with-source-maps.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-breakpoints/debugger-reload-breakpoints-with-source-maps.html
@@ -2,7 +2,7 @@ <head> <script src="../../../inspector/inspector-test.js"></script> <script src="../../../inspector/debugger-test.js"></script> -<script src="../../../inspector/resources/compiled.js"></script> +<script src="../../resources/compiled.js"></script> <script> var test = function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal-expected.txt index 8dd4e007..23c0cd397 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE ERROR: line 2: Uncaught SyntaxError: Unexpected token ) +CONSOLE ERROR: line 3: Uncaught SyntaxError: Unexpected token ) Tests that pause on exception in internal script does not crash. Script source was shown.
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/function-generator-details-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/function-generator-details-expected.txt index 6a6fe6b3..71532357 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/function-generator-details-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/function-generator-details-expected.txt
@@ -48,7 +48,7 @@ Running: testIterObjGenerator iterObjGenerator: type = object, subtype = generator [[GeneratorStatus]] = suspended -[[GeneratorFunction]] = function* () +[[GeneratorFunction]] = function*() { yield 11; yield 12; @@ -63,7 +63,7 @@ Running: testAnonymousGenIter anonymousGenIter: type = object, subtype = generator [[GeneratorStatus]] = suspended -[[GeneratorFunction]] = function* () { +[[GeneratorFunction]] = function*() { yield 21; yield 22; yield 23;
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion-expected.txt index 348399e..d47ea94 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/watch-expressions-preserve-expansion-expected.txt
@@ -122,7 +122,7 @@ 299: 299 length: 300 __proto__: Array(0) -func: function () {return a + b;} +func: function() {return a + b;} arguments: null caller: null length: 0 @@ -249,7 +249,7 @@ 299: 299 length: 300 __proto__: Array(0) -func: function () {return a + b;} +func: function() {return a + b;} arguments: null caller: null length: 0
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/properties-special-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/properties-special-expected.txt index 23d3821..3932cae 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/properties-special-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/properties-special-expected.txt
@@ -1,7 +1,7 @@ CONSOLE MESSAGE: line 10: true -CONSOLE MESSAGE: line 11: function (a,b) { return a + b; } +CONSOLE MESSAGE: line 11: function(a,b) { return a + b; } CONSOLE MESSAGE: line 12: function () { [native code] } -CONSOLE MESSAGE: line 13: function* () { yield [1,2,3] } +CONSOLE MESSAGE: line 13: function*() { yield [1,2,3] } Tests how debugger presents special properties of closures, bound functions and object wrappers. properties-special.html:10 Boolean
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping-expected.txt similarity index 60% rename from third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping-expected.txt index 9d0b3952..0beb700 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping-expected.txt
@@ -1,7 +1,7 @@ Tests SourceMap and StyleSheetMapping. -Added CSS uiSourceCode: http://127.0.0.1:8000/inspector/resources/example.css -Added SCSS uiSourceCode: http://127.0.0.1:8000/inspector/resources/example.scss +Added CSS uiSourceCode: http://127.0.0.1:8000/devtools/resources/example.css +Added SCSS uiSourceCode: http://127.0.0.1:8000/devtools/resources/example.scss 0:3 0:3(expected: 0:3) -> 0:3 1:0 1:0(expected: 1:0) -> 1:0 2:4 2:2(expected: 2:2) -> 2:2 @@ -13,5 +13,5 @@ 4:11 4:11(expected: 4:11) -> 4:11 4:15 4:13(expected: 4:13) -> 4:13 4:20 4:17(expected: 4:17) -> 4:17 -UILocation upon LiveLocation update: http://127.0.0.1:8000/inspector/resources/example.scss:2:2 +UILocation upon LiveLocation update: http://127.0.0.1:8000/devtools/resources/example.scss:2:2
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html b/third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping.html index 2c2a2bb..3d594d9 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/stylesheet-source-mapping.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="debugger-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/debugger-test.js"></script> <script> function addStyleSheet() @@ -9,7 +9,7 @@ var style = document.createElement("link"); style.setAttribute("rel", "stylesheet"); style.setAttribute("type", "text/css"); - style.setAttribute("href", "http://127.0.0.1:8000/inspector/resources/example.css"); + style.setAttribute("href", "http://127.0.0.1:8000/devtools/resources/example.css"); document.head.appendChild(style); } @@ -19,8 +19,8 @@ var target = TestRunner.mainTarget; var cssModel = TestRunner.cssModel; - const styleSheetURL = 'http://127.0.0.1:8000/inspector/resources/example.css'; - const sourceURL = 'http://127.0.0.1:8000/inspector/resources/example.scss'; + const styleSheetURL = 'http://127.0.0.1:8000/devtools/resources/example.css'; + const sourceURL = 'http://127.0.0.1:8000/devtools/resources/example.scss'; var styleSheetId; TestRunner.waitForUISourceCode(styleSheetURL).then(cssUISourceCodeAdded);
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/template-content-inspect-crash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/template-content-inspect-crash-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/template-content-inspect-crash-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/template-content-inspect-crash-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/template-content-inspect-crash.html b/third_party/WebKit/LayoutTests/http/tests/devtools/template-content-inspect-crash.html similarity index 79% rename from third_party/WebKit/LayoutTests/http/tests/inspector/template-content-inspect-crash.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/template-content-inspect-crash.html index 9edc0fb4..fe2adbc2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/template-content-inspect-crash.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/template-content-inspect-crash.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="elements-test.js"></script> -<script src="console-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/elements-test.js"></script> +<script src="../inspector/console-test.js"></script> <script> function test() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/text-source-map-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/text-source-map-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map.html b/third_party/WebKit/LayoutTests/http/tests/devtools/text-source-map.html similarity index 98% rename from third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/text-source-map.html index a8de072..037956b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/text-source-map.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="inspector-test.js"></script> -<script src="debugger-test.js"></script> +<script src="../inspector/inspector-test.js"></script> +<script src="../inspector/debugger-test.js"></script> <script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/timeline-script-parse.php b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/resources/timeline-script-parse.php similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/timeline-script-parse.php rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/resources/timeline-script-parse.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-network-received-data-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-network-received-data-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-network-received-data-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-network-received-data-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-network-received-data.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-network-received-data.html similarity index 91% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-network-received-data.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-network-received-data.html index b96ca09..04707b73 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-network-received-data.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-network-received-data.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../timeline-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-receive-response-event-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-receive-response-event-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-receive-response-event.html similarity index 95% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-receive-response-event.html index 33d67bd..1e2bb2d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-receive-response-event.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../timeline-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse-expected.txt similarity index 76% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse-expected.txt index c957fc3e..9b929148 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse-expected.txt
@@ -4,7 +4,7 @@ { data : { requestId : <string> - url : .../inspector/tracing/resources/timeline-script-parse.php + url : http://127.0.0.1:8000/devtools/tracing/resources/timeline-script-parse.php } endTime : <number> startTime : <number>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse.html similarity index 84% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse.html index 01f8283..16fe6ea5 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-script-parse.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-script-parse.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../timeline-test.js"></script> -<script src="../network-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> +<script src="../../inspector/network-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event-expected.txt similarity index 77% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event-expected.txt index 7344afa..ae0ec0b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event-expected.txt
@@ -6,7 +6,7 @@ frame : <string> readyState : 1 stackTrace : <object> - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -20,7 +20,7 @@ data : { frame : <string> readyState : 2 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -33,7 +33,7 @@ data : { frame : <string> readyState : 3 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -46,7 +46,7 @@ data : { frame : <string> readyState : 4 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -58,7 +58,7 @@ { data : { frame : <string> - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event.html similarity index 83% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event.html index 556182f..224428c 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-event.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-event.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../timeline-test.js"></script> -<script src="../network-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> +<script src="../../inspector/network-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event-expected.txt similarity index 72% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event-expected.txt index 688554a7..ddfbf64 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event-expected.txt
@@ -6,7 +6,7 @@ frame : <string> readyState : 1 stackTrace : <object> - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -19,7 +19,7 @@ data : { frame : <string> readyState : 2 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -31,7 +31,7 @@ data : { frame : <string> readyState : 3 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -43,7 +43,7 @@ data : { frame : <string> readyState : 4 - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string> @@ -54,7 +54,7 @@ { data : { frame : <string> - url : .../inspector/tracing/network/resources/resource.php + url : http://127.0.0.1:8000/devtools/tracing/network/resources/resource.php } endTime : <number> frameId : <string>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event.html similarity index 85% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event.html index ffc49c8..ffd3de1 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-xhr-response-type-blob-event.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/timeline-xhr-response-type-blob-event.html
@@ -1,8 +1,8 @@ <html> <head> -<script src="../inspector-test.js"></script> -<script src="../timeline-test.js"></script> -<script src="../network-test.js"></script> +<script src="../../inspector/inspector-test.js"></script> +<script src="../../inspector/timeline-test.js"></script> +<script src="../../inspector/network-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/websocket/timeline-websocket-event-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/websocket/timeline-websocket-event-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/websocket/timeline-websocket-event-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/websocket/timeline-websocket-event-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/websocket/timeline-websocket-event.html b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/websocket/timeline-websocket-event.html similarity index 87% rename from third_party/WebKit/LayoutTests/http/tests/inspector/tracing/websocket/timeline-websocket-event.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/tracing/websocket/timeline-websocket-event.html index f240ee99..cb172b1e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/websocket/timeline-websocket-event.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/tracing/websocket/timeline-websocket-event.html
@@ -1,7 +1,7 @@ <html> <head> -<script src="../../inspector-test.js"></script> -<script src="../../timeline-test.js"></script> +<script src="../../../inspector/inspector-test.js"></script> +<script src="../../../inspector/timeline-test.js"></script> <script> function performActions()
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/network-preserve-selection-on-frame-receive-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/network-preserve-selection-on-frame-receive-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive.html b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/network-preserve-selection-on-frame-receive.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/network-preserve-selection-on-frame-receive.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-error-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-error-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-error-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-error-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-error.html b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-error.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-error.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-error.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame.html b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-frame.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-frame.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-handshake-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-handshake-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-handshake-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-handshake-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-handshake.html b/third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-handshake.html similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/websocket/websocket-handshake.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/websocket/websocket-handshake.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/workers-on-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/http/tests/inspector/workers-on-navigation-expected.txt rename to third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/workers-on-navigation.html b/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.html similarity index 87% rename from third_party/WebKit/LayoutTests/http/tests/inspector/workers-on-navigation.html rename to third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.html index 4a5bfe875..4582799 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/workers-on-navigation.html +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.html
@@ -1,6 +1,6 @@ <html> <head> -<script src='inspector-test.js'></script> +<script src='../inspector/inspector-test.js'></script> <script> function startWorker() { @@ -33,7 +33,7 @@ SDK.targetManager.observeTargets(observer); await TestRunner.evaluateInPagePromise('startWorker()'); - await TestRunner.navigatePromise('http://localhost:8080/inspector/workers-on-navigation.html'); + await TestRunner.navigatePromise('http://localhost:8080/devtools/workers-on-navigation.html'); navigated = true; await TestRunner.evaluateInPagePromise('startWorker()'); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated-expected.txt deleted file mode 100644 index 5476105..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/bindings-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,58 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: dumpInitialWorkspace -Removed: 0 uiSourceCodes -Workspace: 7 uiSourceCodes. - debugger:///VM[XXX] bindings-main-frame-navigated.html - debugger:///VM[XXX] bindings-main-frame-navigated.html - debugger:///VM[XXX] bindings-test.js - debugger:///VM[XXX] inspector-test.js - http://127.0.0.1:8000/inspector/bindings/bindings-main-frame-navigated.html - http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/inspector-test.js - -Running: attachFrame -Removed: 0 uiSourceCodes -Workspace: 15 uiSourceCodes. - debugger:///VM[XXX] bindings-main-frame-navigated.html - debugger:///VM[XXX] bindings-main-frame-navigated.html - debugger:///VM[XXX] bindings-test.js - debugger:///VM[XXX] inspector-test.js -[+] debugger:///VM[XXX] sourcemap-script.js -[+] debugger:///VM[XXX] _test_attachFrame.js - http://127.0.0.1:8000/inspector/bindings/bindings-main-frame-navigated.html - http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/inspector-test.js -[+] _test_attachFrame.js - -Running: navigateMainFrame -Page reloaded. -Removed: 15 uiSourceCodes -[-] debugger:///VM[XXX] bindings-main-frame-navigated.html -[-] debugger:///VM[XXX] bindings-main-frame-navigated.html -[-] debugger:///VM[XXX] bindings-test.js -[-] debugger:///VM[XXX] inspector-test.js -[-] debugger:///VM[XXX] sourcemap-script.js -[-] debugger:///VM[XXX] _test_attachFrame.js -[-] http://127.0.0.1:8000/inspector/bindings/bindings-main-frame-navigated.html -[-] http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts -[-] http://127.0.0.1:8000/inspector/inspector-test.js -[-] _test_attachFrame.js -Workspace: 2 uiSourceCodes. -[+] debugger:///VM[XXX] empty-page.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/empty-page.html - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings-expected.txt deleted file mode 100644 index 748b529e..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/bindings/suspendtarget-bindings-expected.txt +++ /dev/null
@@ -1,84 +0,0 @@ -Verify that bindings handle target suspension as expected. - - - -Running: initialWorkspace -Removed: 0 uiSourceCodes -Workspace: 7 uiSourceCodes. - debugger:///VM[XXX] bindings-test.js - debugger:///VM[XXX] inspector-test.js - debugger:///VM[XXX] suspendtarget-bindings.html - debugger:///VM[XXX] suspendtarget-bindings.html - http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/suspendtarget-bindings.html - http://127.0.0.1:8000/inspector/inspector-test.js - -Running: createIframesAndWaitForSourceMaps -Removed: 0 uiSourceCodes -Workspace: 19 uiSourceCodes. - debugger:///VM[XXX] bindings-test.js - debugger:///VM[XXX] inspector-test.js -[+] debugger:///VM[XXX] sourcemap-script.js -[+] debugger:///VM[XXX] sourcemap-script.js - debugger:///VM[XXX] suspendtarget-bindings.html - debugger:///VM[XXX] suspendtarget-bindings.html -[+] debugger:///VM[XXX] _test_create-iframe1.js -[+] debugger:///VM[XXX] _test_create-iframe2.js - http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/suspendtarget-bindings.html - http://127.0.0.1:8000/inspector/inspector-test.js -[+] _test_create-iframe1.js -[+] _test_create-iframe2.js - -Running: Suspending targets. -Removed: 17 uiSourceCodes -[-] debugger:///VM[XXX] bindings-test.js -[-] debugger:///VM[XXX] inspector-test.js -[-] debugger:///VM[XXX] sourcemap-script.js -[-] debugger:///VM[XXX] sourcemap-script.js -[-] debugger:///VM[XXX] suspendtarget-bindings.html -[-] debugger:///VM[XXX] suspendtarget-bindings.html -[-] debugger:///VM[XXX] _test_create-iframe1.js -[-] debugger:///VM[XXX] _test_create-iframe2.js -[-] http://127.0.0.1:8000/inspector/bindings/bindings-test.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[-] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts -[-] http://127.0.0.1:8000/inspector/inspector-test.js -[-] _test_create-iframe1.js -[-] _test_create-iframe2.js -Workspace: 2 uiSourceCodes. - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html - http://127.0.0.1:8000/inspector/bindings/suspendtarget-bindings.html - -Running: detachFrame -Removed: 0 uiSourceCodes -Workspace: 2 uiSourceCodes. - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html - http://127.0.0.1:8000/inspector/bindings/suspendtarget-bindings.html - -Running: Resuming targets. -Removed: 0 uiSourceCodes -Workspace: 13 uiSourceCodes. -[+] debugger:///VM[XXX] bindings-test.js -[+] debugger:///VM[XXX] inspector-test.js -[+] debugger:///VM[XXX] sourcemap-script.js -[+] debugger:///VM[XXX] suspendtarget-bindings.html -[+] debugger:///VM[XXX] suspendtarget-bindings.html -[+] http://127.0.0.1:8000/inspector/bindings/bindings-test.js - http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-frame.html -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-style.css -[+] http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts - http://127.0.0.1:8000/inspector/bindings/suspendtarget-bindings.html -[+] http://127.0.0.1:8000/inspector/inspector-test.js -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging-expected.txt deleted file mode 100644 index 1781d8c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-fetch-logging-expected.txt +++ /dev/null
@@ -1,28 +0,0 @@ -CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-exists.html -CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-does-not-exist.html -CONSOLE MESSAGE: line 9: sending a POST request to resources/post-target.cgi -CONSOLE MESSAGE: line 9: sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -CONSOLE ERROR: Fetch API cannot load http://localhost:8000/inspector/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. -CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-exists.html -CONSOLE MESSAGE: line 9: sending a GET request to resources/xhr-does-not-exist.html -CONSOLE MESSAGE: line 9: sending a POST request to resources/post-target.cgi -CONSOLE MESSAGE: line 9: sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -CONSOLE ERROR: Fetch API cannot load http://localhost:8000/inspector/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. -Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn't show logs when it is Disabled. - -console-fetch-logging.html:4 sending a GET request to resources/xhr-exists.html -network-test.js:48 Fetch complete: GET "http://127.0.0.1:8000/inspector/resources/xhr-exists.html".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step1 @ console-fetch-logging.html:24makeRequests @ console-fetch-logging.html:18(anonymous) @ VM:1 -console-fetch-logging.html:4 sending a GET request to resources/xhr-does-not-exist.html -network-test.js:48 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 -network-test.js:48 Fetch complete: GET "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 -console-fetch-logging.html:4 sending a POST request to resources/post-target.cgi -network-test.js:48 Fetch complete: POST "http://127.0.0.1:8000/inspector/resources/post-target.cgi".makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step3 @ console-fetch-logging.html:36 -console-fetch-logging.html:4 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -console-fetch-logging.html:1 Fetch API cannot load http://localhost:8000/inspector/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. -console-fetch-logging.html:4 sending a GET request to resources/xhr-exists.html -console-fetch-logging.html:4 sending a GET request to resources/xhr-does-not-exist.html -network-test.js:48 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)makeFetch @ network-test.js:48requestHelper @ console-fetch-logging.html:11step2 @ console-fetch-logging.html:30 -console-fetch-logging.html:4 sending a POST request to resources/post-target.cgi -console-fetch-logging.html:4 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html -console-fetch-logging.html:1 Fetch API cannot load http://localhost:8000/inspector/resources/xhr-exists.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-test.js index e427aee9..54c0dab6 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-test.js
@@ -61,8 +61,8 @@ var pageURL = result.value; var extensionURL = (/^https?:/.test(pageURL) ? pageURL.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") : - pageURL.replace(/\/inspector\/extensions\/[^/]*$/, "/http/tests")) + - "inspector/resources/extension-main.html"; + pageURL.replace(/\/devtools\/extensions\/[^/]*$/, "/http/tests")) + + "devtools/resources/extension-main.html"; extensionURL = extensionURL.replace("127.0.0.1", extensionsHost); InspectorFrontendAPI.addExtensions([{ startPage: extensionURL, name: "test extension", exposeWebInspectorNamespace: true }]); Extensions.extensionServer.initializeExtensions();
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/fragment-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/fragment-expected.txt deleted file mode 100644 index 036843f9..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/fragment-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -CONSOLE MESSAGE: line 16: Done. -Tests fragment is stripped from url by resource and page agents. - - -Child frame url: http://127.0.0.1:8000/inspector/resources/fragment-frame.html -Child frame resource url: http://127.0.0.1:8000/inspector/resources/fragment-frame.html -Child frame request url: http://127.0.0.1:8000/inspector/resources/fragment-frame.html -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt deleted file mode 100644 index f17c909..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt +++ /dev/null
@@ -1,17 +0,0 @@ -CONSOLE WARNING: line 17: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -CONSOLE ERROR: line 20: Failed to load http://localhost:8000/inspector/resources/cors-target.php?id=0&deny=yes: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: line 20: Failed to load http://localhost:8000/inspector/resources/cors-target.php?id=1&deny=yes: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/inspector/resources/cors-target.php?id=3&deny=yes: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/inspector/resources/cors-target.php?id=4&deny=yes: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -Tests that preflight OPTIONS requests appear in Network resources - -Bug 63712 -0 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=0&deny=yes -1 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=1&deny=yes -2 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=2 -2 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=2 -3 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=3&deny=yes -4 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=4&deny=yes -5 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=5 -5 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=5 -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js index 285257410..0a860029 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
@@ -55,7 +55,7 @@ function makeFetchInWorker(url, requestInitializer) { return new Promise((resolve) => { - var worker = new Worker('/inspector/network/resources/fetch-worker.js'); + var worker = new Worker('/devtools/network/resources/fetch-worker.js'); worker.onmessage = (event) => { resolve(event.data); };
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash-expected.txt deleted file mode 100644 index 2a5ab85..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash-expected.txt +++ /dev/null
@@ -1,16 +0,0 @@ -CONSOLE MESSAGE: line 1: 1 -CONSOLE MESSAGE: line 1: function (){} -Verify that sourcemap sources are mapped event when sourcemap compiled url matches with one of the source urls. - -Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/sourcemap-name-clash/out.js? [sm] - fileSystem: file:///var/www/src/out.js - exactMatch: true -} -Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/sourcemap-name-clash/out.js - fileSystem: file:///var/www/out.js - exactMatch: true -} -Mapping has stabilized. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt deleted file mode 100644 index 361d13db..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-bind-dirty-sourcecode-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Verify that dirty uiSourceCodes are not bound. - - -Running: waitForUISourceCodes - -Running: addFileSystemMapping -Failed to create binding: { - network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - fileSystem: file:///var/www/inspector/persistence/resources/foo.js - exactMatch: false -} -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs-expected.txt deleted file mode 100644 index 21fe7e5..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs-expected.txt +++ /dev/null
@@ -1,36 +0,0 @@ -Verify that tabs get merged when binding is added and removed. - - -Running: addFileSystem - -Running: openNetworkTab -SourceFrame: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - selection: {"startLine":2,"startColumn":0,"endLine":2,"endColumn":5} - firstVisibleLine: 2 - isDirty: false - -Running: openFileSystemTab -SourceFrame: file:///var/www/inspector/persistence/resources/foo.js - selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} - firstVisibleLine: 1 - isDirty: false -Opened tabs: - file:///var/www/inspector/persistence/resources/foo.js - http://127.0.0.1:8000/inspector/persistence/resources/foo.js - -Running: addFileMapping -Opened tabs: - file:///var/www/inspector/persistence/resources/foo.js -SourceFrame: file:///var/www/inspector/persistence/resources/foo.js - selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} - firstVisibleLine: 1 - isDirty: false - -Running: removeFileMapping -Opened tabs: - file:///var/www/inspector/persistence/resources/foo.js -SourceFrame: file:///var/www/inspector/persistence/resources/foo.js - selection: {"startLine":1,"startColumn":0,"endLine":2,"endColumn":5} - firstVisibleLine: 1 - isDirty: false -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file-expected.txt deleted file mode 100644 index 21656647..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-rename-mapped-file-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -Verify that binding gets removed as the fileSystem file gets renamed. - -Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - fileSystem: file:///var/www/inspector/persistence/resources/foo.js - exactMatch: false -} -Renaming foo.js -> bar.js -Binding successfully removed: { - network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - fileSystem: file:///var/www/inspector/persistence/resources/bar.js - exactMatch: false -} -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages-expected.txt deleted file mode 100644 index 9122402..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sourceframe-messages-expected.txt +++ /dev/null
@@ -1,25 +0,0 @@ -Verify that messages are synced in UISourceCodeFrame between UISourceCodes of persistence binding. - - -Running: waitForUISourceCodes - -Running: addMessages -SourceFrame file:///var/www/inspector/persistence/resources/foo.js: 1 message(s) - 0:0 [Error] error in filesystem -SourceFrame http://127.0.0.1:8000/inspector/persistence/resources/foo.js: 1 message(s) - 1:0 [Warning] warning in network - -Running: addMapping -SourceFrame file:///var/www/inspector/persistence/resources/foo.js: 2 message(s) - 1:0 [Warning] warning in network - 0:0 [Error] error in filesystem -SourceFrame http://127.0.0.1:8000/inspector/persistence/resources/foo.js: 2 message(s) - 1:0 [Warning] warning in network - 0:0 [Error] error in filesystem - -Running: removeMapping -SourceFrame file:///var/www/inspector/persistence/resources/foo.js: 1 message(s) - 0:0 [Error] error in filesystem -SourceFrame http://127.0.0.1:8000/inspector/persistence/resources/foo.js: 1 message(s) - 1:0 [Warning] warning in network -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab-expected.txt deleted file mode 100644 index e305b37ec..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-switch-editor-tab-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -Verify that a network file tab gets substituted with filesystem tab when persistence binding comes. - - -Running: openNetworkTab -Opened tabs: - http://127.0.0.1:8000/inspector/persistence/resources/foo.js - -Running: addMapping -Opened tabs: - file:///var/www/inspector/persistence/resources/foo.js -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-test.js index 0c3b675..4a2f416d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-test.js
@@ -33,7 +33,7 @@ InspectorTest.addFooJSFile = function(fs) { - return fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources").addFile("foo.js", "\n\nwindow.foo = ()=>'foo';"); + return fs.root.mkdir("devtools").mkdir("persistence").mkdir("resources").addFile("foo.js", "\n\nwindow.foo = ()=>'foo';"); } InspectorTest.forceUseDefaultMapping = function() {
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document-2.html b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document-2.html deleted file mode 100644 index 87d9de76..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document-2.html +++ /dev/null
@@ -1,15 +0,0 @@ -<div class="warning"> - <style scoped> - h3 { - color: red; - } - </style> - <h3>Warning!</h3> - <p>This page is under construction</p> -</div> - -<div class="outdated"> - <h3>Heads up!</h3> - <p>This content may be out of date</p> -</div> -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document.html b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document.html deleted file mode 100644 index 045e208..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/imported-document.html +++ /dev/null
@@ -1,7 +0,0 @@ -<head> -<link rel="import" href="imported-document.html"> -<link rel="import" href="imported-document-2.html"> -</head> -<div class="first-level"> -</div> -
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source3.js b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source3.js deleted file mode 100644 index bd7d8a5..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/source3.js +++ /dev/null
@@ -1,4 +0,0 @@ -function foo() -{ - console.error(new Error("http://127.0.0.1:8000/inspector/resources/source3.js")); -} \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anImage.png b/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anImage.png deleted file mode 100644 index 2d1a0e6c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anImage.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anotherImage.png b/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anotherImage.png deleted file mode 100644 index 2d1a0e6c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/anotherImage.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/timeline-network-resource.js b/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/timeline-network-resource.js deleted file mode 100644 index 916a330..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/resources/timeline-network-resource.js +++ /dev/null
@@ -1,7 +0,0 @@ -// Sample script resource to find in timeline data - -var element = document.createElement("div"); -element.innerHTML = "Script resource loaded"; -document.body.appendChild(element); - -window.timelineNetworkResourceEvaluated();
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation-expected.txt index 655ebe4..ec0b3c7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation-expected.txt
@@ -4,7 +4,6 @@ Frame: '<!--framePath //<!--frame0-->-->' -------- Frame-with-link-to-navigate - localhost Test PASSED Click me
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/w3c/cross-origin-objects-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/w3c/cross-origin-objects-expected.txt deleted file mode 100644 index 7bffbb20..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/security/w3c/cross-origin-objects-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -This is a testharness.js-based test. -PASS Basic sanity-checking -PASS Only whitelisted properties are accessible cross-origin -PASS [[GetPrototypeOf]] should return null -PASS [[SetPrototypeOf]] should throw -PASS [[IsExtensible]] should return true for cross-origin objects -PASS [[PreventExtensions]] should throw for cross-origin objects -FAIL [[GetOwnProperty]] - Properties on cross-origin objects should be reported |own| Blocked a frame with origin "http://web-platform.test:8000" from accessing a cross-origin frame. -FAIL [[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly assert_equals: property descriptor for postMessage should have writable: false expected false but got true -PASS [[Delete]] Should throw on cross-origin objects -PASS [[DefineOwnProperty]] Should throw for cross-origin objects -PASS [[Enumerate]] should return an empty iterator -FAIL [[OwnPropertyKeys]] should return all properties from cross-origin objects assert_array_equals: Object.getOwnPropertyNames() gives the right answer for cross-origin Location lengths differ, expected 2 got 3 -PASS A and B jointly observe the same identity for cross-origin Window and Location -PASS Cross-origin functions get local Function.prototype -FAIL Cross-origin Window accessors get local Function.prototype Cannot read property 'name' of undefined -FAIL Same-origin observers get different functions for cross-origin objects assert_true: same-origin Window functions get their own object expected true got false -FAIL Same-origin obsevers get different accessors for cross-origin Window assert_true: different Window accessors per-incumbent script settings object expected true got false -FAIL Same-origin observers get different accessors for cross-origin Location Blocked a frame with origin "http://web-platform.test:8000" from accessing a cross-origin frame. -PASS Cross-origin object identity preserved across document.domain -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt deleted file mode 100644 index a325f9c7..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -CONSOLE WARNING: line 15: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -Accept: * -Accept-Language: ru -Content-Language: ru -Content-Type: text/plain - -
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers.html deleted file mode 100644 index 7a75d4b62..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers.html +++ /dev/null
@@ -1,28 +0,0 @@ -<html> -<body> -<pre id='console'></pre> -<script type="text/javascript"> - if (window.testRunner) - testRunner.dumpAsText(); - - function log(message) - { - document.getElementById('console').appendChild(document.createTextNode(message + "\n")); - } - - try { - var xhr = new XMLHttpRequest; - xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-whitelist-request-headers.cgi", false); - xhr.setRequestHeader("Accept", "*"); - xhr.setRequestHeader("Accept-Language", "ru"); - xhr.setRequestHeader("Content-Language", "ru"); - xhr.setRequestHeader("Content-Type", "text/plain"); - xhr.send(""); - - log(xhr.responseText); - } catch (ex) { - log("Unexpected exception: " + ex); - } -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers-expected.txt deleted file mode 100644 index 82c0440b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -CONSOLE WARNING: line 33: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -CONSOLE ERROR: line 25: Refused to get unsafe header "x-webkit" -PASS: Response header cache-control allowed. -PASS: Response header content-language allowed. -PASS: Response header content-type allowed. -PASS: Response header expires allowed. -PASS: Response header last-modified allowed. -PASS: Response header pragma allowed. -PASS: Response header x-webkit denied. -PASS: Non-whitelisted headers not passed to getAllResponseHeaders(). -
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers.html deleted file mode 100644 index a6d758ce..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-response-headers.html +++ /dev/null
@@ -1,52 +0,0 @@ -<html> -<body> -<pre id='console'></pre> -<script type="text/javascript"> - if (window.testRunner) - testRunner.dumpAsText(); - - function log(message) - { - document.getElementById('console').appendChild(document.createTextNode(message + "\n")); - } - - var xhr; - - function testAllowed(name) - { - if (xhr.getResponseHeader(name)) - log("PASS: Response header " + name + " allowed."); - else - log("FAIL: Response header " + name + " not allowed."); - } - - function testDenied(name) - { - if (!xhr.getResponseHeader(name)) - log("PASS: Response header " + name + " denied."); - else - log("FAIL: Response header " + name + " not denied."); - } - - - xhr = new XMLHttpRequest; - xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-whitelist-response-headers.cgi", false); - xhr.send(); - - // Test getResponseHeader() - testAllowed("cache-control"); - testAllowed("content-language"); - testAllowed("content-type"); - testAllowed("expires"); - testAllowed("last-modified"); - testAllowed("pragma"); - testDenied("x-webkit"); - - // Test getAllResponseHeaders() - if (!xhr.getAllResponseHeaders().match("foobar")) - log("PASS: Non-whitelisted headers not passed to getAllResponseHeaders()."); - else - log("FAIL: Non-whitelisted headers passed to getAllResponseHeaders()."); -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie-expected.txt deleted file mode 100644 index 873184b0..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -CONSOLE WARNING: line 10: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -This is a testharness.js-based test. -FAIL Preflight request must not contain any cookie header assert_equals: expected "awesomevalue" but got "" -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie.html deleted file mode 100644 index d1be954..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-must-not-contain-cookie.html +++ /dev/null
@@ -1,77 +0,0 @@ -<html> -<head> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<script> -var t = async_test("Preflight request must not contain any cookie header"); -var runTest = t.step_func(function() -{ - var resolveSetCookiePromise = null; - var setCookiePromise = new Promise(function(resolve, reject) - { - resolveSetCookiePromise = resolve; - }); - - var resolveClearCookiesPromise = null; - var clearCookiesPromise = new Promise(function(resolve, reject) - { - resolveClearCookiesPromise = resolve; - }); - - var cookieSet = false; - - window.onmessage = t.step_func(function(evt) - { - assert_equals(evt.data, "done"); - - if (!cookieSet) { - resolveSetCookiePromise(); - cookieSet = true; - } else { - resolveClearCookiesPromise(); - } - }); - - // Set a cookie for localhost:8000. - window.frames[0].postMessage("sendXHR setFooCookie", "*"); - - setCookiePromise.then(t.step_func(function() - { - var xhr = new XMLHttpRequest; - xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-preflight-request-must-not-contain-cookie.php"); - xhr.setRequestHeader("X-Proprietary-Header", "foo") - xhr.withCredentials = true; - xhr.onerror = t.step_func(function (e) { - assert_unreached(e); - }); - var doneXHRPromise = new Promise(function(resolve, reject) - { - xhr.onreadystatechange = t.step_func(function () { - if (xhr.readyState != xhr.DONE) - return; - assert_equals(xhr.status, 200); - assert_equals(xhr.responseText, "awesomevalue"); - resolve(); - }); - }); - xhr.send(); - return doneXHRPromise; - })).then(t.step_func(function() - { - // Clean up all cookies for localhost:8000. - window.frames[0].postMessage("resetCookiesAndNotifyDone", "*"); - return resolveClearCookiesPromise; - })).then(t.step_func(function() - { - t.done(); - })).catch(t.step_func(function(e) - { - assert_unreached(e); - })); -}); -</script> -</head> -<body onload="runTest()"> -<iframe src="http://localhost:8000/cookies/resources/third-party-cookie-relaxing-iframe.html"></iframe> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash-expected.txt deleted file mode 100644 index 274519d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -CONSOLE ERROR: Failed to load http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. -PASS
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash.html deleted file mode 100644 index ce62980c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash.html +++ /dev/null
@@ -1,37 +0,0 @@ -<base href="http://localhost:8000/"></base> -<script> -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); -} - -var requestCount = 0; - -function preflightRequest() { - var xhr = new XMLHttpRequest(); - xhr.onsuccess = function() { finish("FAIL"); } - xhr.onerror = function() { - if (requestCount == 5) { - finish("PASS"); - return; - } - requestCount++; - // This hack of showing and hiding the inspector greatly increases the likelihood - // that references to the CachedResource underlying the XHR get cleaned out. - if (window.testRunner) { - testRunner.showWebInspector(); - testRunner.closeWebInspector(); - } - preflightRequest(); - } - xhr.open("GET", "xmlhttprequest/resources/access-control-basic-denied.cgi"); - xhr.send(); -} - -function finish(result) { - document.body.appendChild(document.createTextNode(result)); - if (window.testRunner) - testRunner.notifyDone(); -} -</script> -<body onload="preflightRequest()"></body>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync-expected.txt deleted file mode 100644 index d812a26..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -CONSOLE WARNING: line 13: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -Test for bug 36854: Body from cross origin preflight response is prepended to the actual response body. - -PASS
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync.html deleted file mode 100644 index fb625b3a..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body-sync.html +++ /dev/null
@@ -1,24 +0,0 @@ -<html> -<body> -<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=36854">bug 36854<a>: -Body from cross origin preflight response is prepended to the actual response body.</p> -<div id=result>Running test...</div> -<script> - - if (window.testRunner) - testRunner.dumpAsText(); - - window.onload = function() { - var xhr = new XMLHttpRequest(); - xhr.open("GET","http://localhost:8000/xmlhttprequest/resources/access-control-allow-with-body.php", false); - xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - xhr.send(null); - - document.getElementById("result").innerHTML = (xhr.responseText == "echo") ? "PASS" : ("FAIL: " + xhr.responseText); - }; - -</script> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-request-headers.cgi b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-request-headers.cgi deleted file mode 100755 index d3cb3c1..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-request-headers.cgi +++ /dev/null
@@ -1,17 +0,0 @@ -#!/usr/bin/perl -wT -use strict; - -print "Cache-Control: no-store\n"; - -# This should be a simple request, deny preflight. -if ($ENV{'REQUEST_METHOD'} eq "POST") { - print "Access-Control-Allow-Credentials: true\n"; - print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n"; - - print "Accept: $ENV{'HTTP_ACCEPT'}\n"; - print "Accept-Language: $ENV{'HTTP_ACCEPT_LANGUAGE'}\n"; - print "Content-Language: $ENV{'HTTP_CONTENT_LANGUAGE'}\n"; - print "Content-Type: $ENV{'CONTENT_TYPE'}\n"; -} else { - print "\n"; -}
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-response-headers.cgi b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-response-headers.cgi deleted file mode 100755 index 173d369..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-whitelist-response-headers.cgi +++ /dev/null
@@ -1,17 +0,0 @@ -#!/usr/bin/perl -wT -use strict; - -# in whitelist -print "content-type: text/plain\n"; -print "cache-control: no cache\n"; -print "content-language: en\n"; -print "expires: Fri, 30 Oct 1998 14:19:41 GMT\n"; -print "last-modified: Tue, 15 Nov 1994 12:45:26 GMT\n"; -print "pragma: no-cache\n"; - -# not in whitelist -print "x-webkit: foobar\n"; - -print "Access-Control-Allow-Origin: *\n\n"; - -print "PASS: Cross-domain access allowed.\n";
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-must-not-contain-cookie.php b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-must-not-contain-cookie.php deleted file mode 100644 index db49136..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-must-not-contain-cookie.php +++ /dev/null
@@ -1,13 +0,0 @@ -<?php -if (isset($_SERVER["HTTP_ACCESS_CONTROL_REQUEST_METHOD"]) && - isset($_COOKIE["foo"])) { - header("HTTP/1.1 400 Bad Request"); -} else { - header("Cache-Control: no-store"); - header("Access-Control-Allow-Origin: http://127.0.0.1:8000"); - header("Access-Control-Allow-Credentials: true"); - header("Access-Control-Allow-Headers: X-Proprietary-Header"); - header("Connection: close"); - echo $_COOKIE["foo"]; -} -?>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt index 6569a286..bfed1ce4 100644 --- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/domdebugger-getEventListeners-expected.txt
@@ -22,7 +22,7 @@ columnNumber:54 handler.type:function handler.className:Function - handler.description:function (){ consol.log(42) } + handler.description:function(){ consol.log(42) } type:scroll useCapture:false @@ -30,7 +30,7 @@ columnNumber:54 handler.type:function handler.className:Function - handler.description:function (){ consol.log(42) } + handler.description:function(){ consol.log(42) } Event listeners of div#listeners1
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe-expected.txt new file mode 100644 index 0000000..7680c77 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe-expected.txt
@@ -0,0 +1,2 @@ +Tests Runtime.getProperties doesnt crash on document.all in iframe +
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe.js b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe.js new file mode 100644 index 0000000..0f8046f8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-get-properties-document-all-in-iframe.js
@@ -0,0 +1,17 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank('Tests Runtime.getProperties doesnt crash on document.all in iframe'); + await dp.Runtime.enable(); + await dp.Debugger.enable(); + session.evaluate(` + window.frame = document.createElement('iframe'); + frame.src = '${testRunner.url('../resources/blank.html')}'; + document.body.appendChild(frame); + `); + let {params:{context:{id}}} = await dp.Runtime.onceExecutionContextCreated(); + let {result:{result:{objectId}}} = await dp.Runtime.evaluate({ + contextId: id, + expression: 'document.all', + }); + await dp.Runtime.getProperties({objectId}); + testRunner.completeTest(); +})
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/drag-start-event-client-x-y-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/drag-start-event-client-x-y-expected.txt index 4a94f1b..aaa622f4 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/drag-start-event-client-x-y-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/drag-start-event-client-x-y-expected.txt
@@ -1,5 +1,4 @@ Test for WebKit bug 26723: clientX,Y , screenX , Y always (0, 0) in dragstart event - DRAG ME! SUCCESS Expected 119 for clientX and got it.
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/table/table-rowspan-height-less-than-one-percent-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/table/table-rowspan-height-less-than-one-percent-expected.txt index 7b753e9..86557dd 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/table/table-rowspan-height-less-than-one-percent-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/table/table-rowspan-height-less-than-one-percent-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 408066. ASSERTION FAILED: !extraRowSpanningHeight in blink::RenderTableSection::distributeRowSpanHeightToRows. - PASS r0c0 r2c0
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..5747fcb --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM37 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/indexeddb/database-refresh-view-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/indexeddb/database-refresh-view-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/indexeddb/database-refresh-view-expected.txt rename to third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/indexeddb/database-refresh-view-expected.txt
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt similarity index 87% copy from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt copy to third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt index 2889fc6..98c41aca 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt
@@ -2,7 +2,7 @@ -http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt similarity index 87% copy from third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt copy to third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt index c5f4c2fd..6d551e3d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-parameters-ipv6-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt
@@ -2,7 +2,7 @@ -http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 97d7eb6..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM37 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-expected.txt deleted file mode 100644 index 2889fc6..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-expected.txt +++ /dev/null
@@ -1,66 +0,0 @@ -Tests that resources panel shows form data parameters. - - - -http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 14 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-ipv6-expected.txt deleted file mode 100644 index c5f4c2fd..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/inspector/resource-parameters-ipv6-expected.txt +++ /dev/null
@@ -1,66 +0,0 @@ -Tests that resources panel shows form data parameters. - - - -http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 14 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "[::1]" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/svg/custom/use-invalid-pattern-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/svg/custom/use-invalid-pattern-expected.txt index 3718571..eeb1077 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/svg/custom/use-invalid-pattern-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/svg/custom/use-invalid-pattern-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 11 at column 7: Opening and ending tag mismatch: use line 0 and svg Below is a rendering of the page up to the first error. - This should not crash, but display an error document.
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..8f34245 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM51 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index eda12f6..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM51 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..7f7a2c68 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM101 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 00259f8c8..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM101 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..939b9b1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM53 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt index 28cc408..cc94339 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt
@@ -1,6 +1,6 @@ Tests to ensure column names are matching data. -name: empty.html?xhr/inspector/network/resources +name: empty.html?xhr/devtools/network/resources method: GET status: 200OK protocol: http/1.1
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index d1f1d4c..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM53 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..ea781c0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM354 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 84f416c6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM354 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..20039ac --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM94 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 5fb5268..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM94 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..fd3235de --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM210 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index b82eabd0..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM210 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..426f93c1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM307 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/extensions/extensions-panel-expected.txt similarity index 75% copy from third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt copy to third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/extensions/extensions-panel-expected.txt index f1e00c8..9e399864 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions/extensions-panel-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/extensions/extensions-panel-expected.txt
@@ -30,7 +30,7 @@ Panel resized, test passed. RUNNING TEST: extension_testOpenResource Showing .../extensions-panel.html -Showing resource .../inspector/extensions/extensions-panel.html in panel sources), line: 1001 +Showing resource .../devtools/extensions/extensions-panel.html in panel sources), line: 1001 Showing .../abe.png Showing resource .../extensions/resources/abe.png in panel sources), line: 1002 Showing .../missing.txt @@ -61,12 +61,12 @@ } button1 clicked Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two tooltip', disabled: true +status bar item 0, icon: ".../devtools/resources/button1.png", tooltip: 'Button One tooltip', disabled: false +status bar item 1, icon: ".../devtools/resources/button2.png", tooltip: 'Button Two tooltip', disabled: true Updated status bar buttons Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1-updated.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two updated tooltip', disabled: false +status bar item 0, icon: ".../devtools/resources/button1-updated.png", tooltip: 'Button One tooltip', disabled: false +status bar item 1, icon: ".../devtools/resources/button2.png", tooltip: 'Button Two updated tooltip', disabled: false button2 clicked RUNNING TEST: extension_testThemeName Theme name: themeNameForTest
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/extensions/extensions-sidebar-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/extensions/extensions-sidebar-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/extensions/extensions-sidebar-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/extensions/extensions-sidebar-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/indexeddb/database-refresh-view-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/indexeddb/database-refresh-view-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/indexeddb/database-refresh-view-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/indexeddb/database-refresh-view-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt new file mode 100644 index 0000000..0ac44a2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt
@@ -0,0 +1,13 @@ +Verify that for a fileSystem UISourceCode with persistence binding TabbedEditorContainer opens filesystem UISourceCode. + +Binding created: { + network: http://127.0.0.1:8000/devtools/persistence/resources/foo.js + fileSystem: file:///var/www/devtools/persistence/resources/foo.js + exactMatch: false +} +Opened tabs before opening any UISourceCodes: + file:///var/www/devtools/persistence/resources/foo.js +request open uiSourceCode: file:///var/www/devtools/persistence/resources/foo.js +Opened tabs after opening UISourceCode: + file:///var/www/devtools/persistence/resources/foo.js +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 5067f51f6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM307 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/extensions/extensions-panel-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/extensions/extensions-panel-expected.txt deleted file mode 100644 index f1e00c8..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/extensions/extensions-panel-expected.txt +++ /dev/null
@@ -1,74 +0,0 @@ -CONSOLE MESSAGE: line 12: hello -Tests WebInspector extension API - - -Started extension. -Running tests... -RUNNING TEST: extension_testCreatePanel -Panel created -{ - createStatusBarButton : <function> - onHidden : { - addListener : <function> - removeListener : <function> - } - onSearch : { - addListener : <function> - removeListener : <function> - } - onShown : { - addListener : <function> - removeListener : <function> - } - show : <function> -} -Panel shown -Extension panel size correct -Panel hidden -RUNNING TEST: extension_testGlobalShortcuts -Panel shown, now toggling console... -Panel resized, test passed. -RUNNING TEST: extension_testOpenResource -Showing .../extensions-panel.html -Showing resource .../inspector/extensions/extensions-panel.html in panel sources), line: 1001 -Showing .../abe.png -Showing resource .../extensions/resources/abe.png in panel sources), line: 1002 -Showing .../missing.txt -Showing resource .../extensions/resources/missing.txt in panel network), line: undefined -Showing not-found.html -error: Extension server error: Object not found: not-found.html -Showing javascript:console.error('oh no!') -error: Extension server error: Object not found: javascript:console.error('oh no!') -RUNNING TEST: extension_testSearch -Panel searched: -{ - 0 : "performSearch" - 1 : "hello" -} -Panel searched: -{ - 0 : "cancelSearch" - 1 : undefined -} -RUNNING TEST: extension_testStatusBarButtons -Created a status bar button, dump follows: -{ - onClicked : { - addListener : <function> - removeListener : <function> - } - update : <function> -} -button1 clicked -Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two tooltip', disabled: true -Updated status bar buttons -Status bar buttons state: -status bar item 0, icon: ".../inspector/resources/button1-updated.png", tooltip: 'Button One tooltip', disabled: false -status bar item 1, icon: ".../inspector/resources/button2.png", tooltip: 'Button Two updated tooltip', disabled: false -button2 clicked -RUNNING TEST: extension_testThemeName -Theme name: themeNameForTest -All tests done. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt deleted file mode 100644 index 8e10afd..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/inspector/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -Verify that for a fileSystem UISourceCode with persistence binding TabbedEditorContainer opens filesystem UISourceCode. - -Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js - fileSystem: file:///var/www/inspector/persistence/resources/foo.js - exactMatch: false -} -Opened tabs before opening any UISourceCodes: - file:///var/www/inspector/persistence/resources/foo.js -request open uiSourceCode: file:///var/www/inspector/persistence/resources/foo.js -Opened tabs after opening UISourceCode: - file:///var/www/inspector/persistence/resources/foo.js -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/http/tests/devtools/tracing/timeline-js/timeline-runtime-stats-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/http/tests/devtools/tracing/timeline-js/timeline-runtime-stats-expected.txt index 3bea6ca6..93cf52b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/http/tests/devtools/tracing/timeline-js/timeline-runtime-stats-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/http/tests/devtools/tracing/timeline-js/timeline-runtime-stats-expected.txt
@@ -8,6 +8,6 @@ at Timeline.TimelinePanel.InspectorTest.addSniffer (evaluateInWebInspector0.js:1236:75) at Timeline.TimelinePanel.result (evaluateInWebInspector0.js:673:25) at Timeline.TimelinePanel.receiver.(anonymous function) (evaluateInWebInspector0.js:703:22) - at Timeline.TimelineController._finalizeTrace (file:///b/c/b/mac_layout/src/out/Release/resources/inspector/timeline/timeline_module.js:130:99) - at setTimeout (file:///b/c/b/mac_layout/src/out/Release/resources/inspector/timeline/timeline_module.js:129:76) + at Timeline.TimelineController._finalizeTrace (file:///b/c/b/mac_layout/src/out/Release/resources/devtools/timeline/timeline_module.js:130:99) + at setTimeout (file:///b/c/b/mac_layout/src/out/Release/resources/devtools/timeline/timeline_module.js:129:76)
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..c531b17a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM161 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index d31f4d5..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM161 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..2fc09b9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM108 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt index 28cc408..cc94339 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt
@@ -1,6 +1,6 @@ Tests to ensure column names are matching data. -name: empty.html?xhr/inspector/network/resources +name: empty.html?xhr/devtools/network/resources method: GET status: 200OK protocol: http/1.1
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index fbdf51c..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM108 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt index e59dc818..ebf6d06 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 249600. Extra logical height is not properly spread over the rows in a row-spanning cell. - Rows in rowspan should get proportional height. Test 1 - Three rowSpan cells row0 col0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt index 6bd815d..dfa1bfa 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 252120. Content of the row spanning cell is flowing out of the cell boundries. - Row spanning cell height is not set as per its content height or given height to this cells. Test 1 - One row spanning cell present under the boundries of other row spanning cell and inner row spanning cell have lots of content. row0 col0 rowspan=6 height=400px row0 col1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt index d6568c97..193b4f2e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 78724. Extra logical height is not properly spread over the rows in a row-spanning cell. - Rows in rowspan should get proportional height. Test 1 - One rowSpan cell row0 col0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt index d0b2aa4..c3844aa 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 254914. Height of fixed height cell is not proper when cell's row is under row spanning cell. - Rows in rowspan should get proportional height. Test 1 - One rowSpan cell row0 col0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..8b792802 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM202 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 92ae9ab..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM202 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/inspector/application-panel/resources-panel-selection-on-reload-expected.txt rename to third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/application-panel/resources-panel-selection-on-reload-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..4e02363 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM165 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt index 0cfb620..99fe7a0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/devtools/network/network-columns-visible-expected.txt
@@ -1,6 +1,6 @@ Tests to ensure column names are matching data. -name: empty.html?xhr/inspector/network/resources +name: empty.html?xhr/devtools/network/resources method: GET status: 200OK protocol: http/1.1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index cf2a4e96..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM165 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
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 ad2b9284e..9e21254 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
@@ -6263,11 +6263,15 @@ getter height getter offsetLeft getter offsetTop + getter onresize + getter onscroll getter pageLeft getter pageTop getter scale getter width method constructor + setter onresize + setter onscroll interface WaveShaperNode : AudioNode attribute @@toStringTag getter curve
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/drag-start-event-client-x-y-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/drag-start-event-client-x-y-expected.txt index 4a94f1b..aaa622f4 100644 --- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/drag-start-event-client-x-y-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/drag-start-event-client-x-y-expected.txt
@@ -1,5 +1,4 @@ Test for WebKit bug 26723: clientX,Y , screenX , Y always (0, 0) in dragstart event - DRAG ME! SUCCESS Expected 119 for clientX and got it.
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt index 3bbe6245..4282df1e 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 249600. Extra logical height is not properly spread over the rows in a row-spanning cell. - Rows in rowspan should get proportional height. Test 1 - Three rowSpan cells row0 col0
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/table/table-rowspan-height-less-than-one-percent-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/table/table-rowspan-height-less-than-one-percent-expected.txt index 7b753e9..86557dd 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/table/table-rowspan-height-less-than-one-percent-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/fast/table/table-rowspan-height-less-than-one-percent-expected.txt
@@ -1,5 +1,4 @@ Test for chromium bug : 408066. ASSERTION FAILED: !extraRowSpanningHeight in blink::RenderTableSection::distributeRowSpanHeightToRows. - PASS r0c0 r2c0
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..408eb9d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM180 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/indexeddb/database-refresh-view-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/indexeddb/database-refresh-view-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/indexeddb/database-refresh-view-expected.txt rename to third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/indexeddb/database-refresh-view-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt rename to third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/persistence/persistence-tabbed-editor-keeps-selected-tab-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt similarity index 87% rename from third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-expected.txt rename to third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt index 2127f64..2cbd759 100644 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt
@@ -2,7 +2,7 @@ -http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt similarity index 87% rename from third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-ipv6-expected.txt rename to third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt index b143e60..e487e692 100644 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/resource-parameters-ipv6-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt
@@ -2,7 +2,7 @@ -http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= +http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= { cache : { } @@ -39,7 +39,7 @@ value : "" } ] - url : "http://[::1]:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" + url : "http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" } response : { _transferSize : <number>
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index bb2892a9..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM180 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/svg/custom/use-invalid-pattern-expected.txt b/third_party/WebKit/LayoutTests/platform/win/svg/custom/use-invalid-pattern-expected.txt index 3718571..eeb1077 100644 --- a/third_party/WebKit/LayoutTests/platform/win/svg/custom/use-invalid-pattern-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/svg/custom/use-invalid-pattern-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 11 at column 7: Opening and ending tag mismatch: use line 0 and svg Below is a rendering of the page up to the first error. - This should not crash, but display an error document.
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..b81d237 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM242 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 29046c9..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM242 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
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 4ddee9b6..46734b3 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
@@ -6192,11 +6192,15 @@ getter height getter offsetLeft getter offsetTop + getter onresize + getter onscroll getter pageLeft getter pageTop getter scale getter width method constructor + setter onresize + setter onscroll interface WaveShaperNode : AudioNode attribute @@toStringTag getter curve
diff --git a/third_party/WebKit/LayoutTests/platform/win7/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..c0289bf --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win7/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM317 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/indexeddb/database-refresh-view-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/http/tests/devtools/indexeddb/database-refresh-view-expected.txt similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/indexeddb/database-refresh-view-expected.txt rename to third_party/WebKit/LayoutTests/platform/win7/http/tests/devtools/indexeddb/database-refresh-view-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index 9305d014..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM317 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt new file mode 100644 index 0000000..71df864 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/devtools/bindings/livelocation-main-frame-navigated-expected.txt
@@ -0,0 +1,19 @@ +Verify that UISourceCodes are removed as main frame gets navigated. + + +Running: attachFrame +[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-typescript.ts:0:0 +[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-sass.scss:0:0 + +Running: navigateMainFrame +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-css: null +[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/devtools/bindings/resources/sourcemap-script.js:0:0 +[ UPDATE ] LiveLocation-js: debugger:///VM227 sourcemap-script.js:0:0 +Page reloaded. +[ GET ] LiveLocation-js: null +[ GET ] LiveLocation-css: null + +Running: navigateBack +Page reloaded. +
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt deleted file mode 100644 index f3a5b8c9..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/bindings/livelocation-main-frame-navigated-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -Verify that UISourceCodes are removed as main frame gets navigated. - - -Running: attachFrame -[ CREATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-typescript.ts:0:0 -[ CREATE ] LiveLocation-css: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-sass.scss:0:0 - -Running: navigateMainFrame -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-css: null -[ UPDATE ] LiveLocation-js: http://127.0.0.1:8000/inspector/bindings/resources/sourcemap-script.js:0:0 -[ UPDATE ] LiveLocation-js: debugger:///VM227 sourcemap-script.js:0:0 -Page reloaded. -[ GET ] LiveLocation-js: null -[ GET ] LiveLocation-css: null - -Running: navigateBack -Page reloaded. -
diff --git a/third_party/WebKit/LayoutTests/svg/custom/bug78807-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/bug78807-expected.txt index e754b0b..aa4f081 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/bug78807-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/bug78807-expected.txt
@@ -1,6 +1,4 @@ This page contains the following errors: - error on line 11 at column 24: Extra content at the end of the document Below is a rendering of the page up to the first error. -
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-crash-in-non-wellformed-document-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/use-crash-in-non-wellformed-document-expected.txt index 2ee8d79..0891d51b 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/use-crash-in-non-wellformed-document-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/use-crash-in-non-wellformed-document-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 19 at column 7: Opening and ending tag mismatch: use line 0 and svg Below is a rendering of the page up to the first error. - PASS without crash.
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-html-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-html-expected.txt index f2dbad0..bd165a79 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-html-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-html-expected.txt
@@ -1,6 +1,4 @@ This page contains the following errors: - error on line 18 at column 9: Extra content at the end of the document Below is a rendering of the page up to the first error. - This test passes if a malformed html document triggers an error, not crash.
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-pattern-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-pattern-expected.txt index 3718571..eeb1077 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-pattern-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-pattern-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 11 at column 7: Opening and ending tag mismatch: use line 0 and svg Below is a rendering of the page up to the first error. - This should not crash, but display an error document.
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-style-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-style-expected.txt index 70bc21e..c7ef458 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/use-invalid-style-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/use-invalid-style-expected.txt
@@ -1,7 +1,5 @@ This page contains the following errors: - error on line 10 at column 7: Opening and ending tag mismatch: junk line 0 and svg Below is a rendering of the page up to the first error. - This should not crash, but display an error document.
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-referencing-style-crash-expected.txt b/third_party/WebKit/LayoutTests/svg/custom/use-referencing-style-crash-expected.txt index 1f3b2f39..3741e8d 100644 --- a/third_party/WebKit/LayoutTests/svg/custom/use-referencing-style-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/custom/use-referencing-style-crash-expected.txt
@@ -1,6 +1,4 @@ This page contains the following errors: - error on line 9 at column 12: Extra content at the end of the document Below is a rendering of the page up to the first error. -
diff --git a/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2-expected.html b/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2-expected.html new file mode 100644 index 0000000..873e673 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2-expected.html
@@ -0,0 +1,4 @@ +<!DOCTYPE html> +<svg> + <text y="20">foo bar<tspan dx="50">baz</tspan></text> +</svg>
diff --git a/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2.html b/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2.html new file mode 100644 index 0000000..f091658 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/text/text-positioning-mutate-textnode-2.html
@@ -0,0 +1,14 @@ +<!DOCTYPE html> +<script src="../../resources/run-after-layout-and-paint.js"></script> +<svg> + <text y="20"> + foo + <tspan dx="50">baz</tspan> + </text> +</svg> +<script> +runAfterLayoutAndPaint(function() { + let text = document.querySelector('tspan').previousSibling; + text.textContent = text.textContent + "bar"; +}, true); +</script>
diff --git a/third_party/WebKit/LayoutTests/traversal/node-iterator-009-expected.txt b/third_party/WebKit/LayoutTests/traversal/node-iterator-009-expected.txt index 38ede4c..2eb9893 100644 --- a/third_party/WebKit/LayoutTests/traversal/node-iterator-009-expected.txt +++ b/third_party/WebKit/LayoutTests/traversal/node-iterator-009-expected.txt
@@ -2,33 +2,25 @@ XML doc elements: records - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 movieinfo - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 info - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 title - Across the Universe runtime - 2:30 rating - Not yet rated postdate - 2007-02-15 releasedate - 2007-09-28
diff --git a/third_party/WebKit/LayoutTests/traversal/tree-walker-006-expected.txt b/third_party/WebKit/LayoutTests/traversal/tree-walker-006-expected.txt index 38ede4c..2eb9893 100644 --- a/third_party/WebKit/LayoutTests/traversal/tree-walker-006-expected.txt +++ b/third_party/WebKit/LayoutTests/traversal/tree-walker-006-expected.txt
@@ -2,33 +2,25 @@ XML doc elements: records - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 movieinfo - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 info - Across the Universe 2:30 Not yet rated Sony Pictures 2007-02-15 2007-09-28 title - Across the Universe runtime - 2:30 rating - Not yet rated postdate - 2007-02-15 releasedate - 2007-09-28
diff --git a/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/security/w3c/cross-origin-objects-expected.txt b/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/security/w3c/cross-origin-objects-expected.txt deleted file mode 100644 index 1a84457..0000000 --- a/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/security/w3c/cross-origin-objects-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -This is a testharness.js-based test. -FAIL Basic sanity-checking Test bug: need to pass exception to assert_throws() -FAIL Only whitelisted properties are accessible cross-origin Test bug: need to pass exception to assert_throws() -FAIL [[GetPrototypeOf]] should return null Test bug: need to pass exception to assert_throws() -FAIL [[SetPrototypeOf]] should throw Test bug: need to pass exception to assert_throws() -PASS [[IsExtensible]] should return true for cross-origin objects -FAIL [[PreventExtensions]] should throw for cross-origin objects Test bug: need to pass exception to assert_throws() -FAIL [[GetOwnProperty]] - Properties on cross-origin objects should be reported |own| Blocked a frame with origin "http://web-platform.test:8000" from accessing a cross-origin frame. -FAIL [[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly assert_equals: property descriptor for postMessage should have writable: false expected false but got true -FAIL [[Delete]] Should throw on cross-origin objects Test bug: need to pass exception to assert_throws() -FAIL [[DefineOwnProperty]] Should throw for cross-origin objects Test bug: need to pass exception to assert_throws() -PASS [[Enumerate]] should return an empty iterator -FAIL [[OwnPropertyKeys]] should return all properties from cross-origin objects assert_array_equals: Object.getOwnPropertyNames() gives the right answer for cross-origin Location lengths differ, expected 2 got 3 -PASS A and B jointly observe the same identity for cross-origin Window and Location -PASS Cross-origin functions get local Function.prototype -FAIL Cross-origin Window accessors get local Function.prototype Cannot read property 'name' of undefined -FAIL Same-origin observers get different functions for cross-origin objects assert_true: same-origin Window functions get their own object expected true got false -FAIL Same-origin obsevers get different accessors for cross-origin Window assert_true: different Window accessors per-incumbent script settings object expected true got false -FAIL Same-origin observers get different accessors for cross-origin Location Blocked a frame with origin "http://web-platform.test:8000" from accessing a cross-origin frame. -PASS Cross-origin object identity preserved across document.domain -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/vr/getFrameData_samewithinframe.html b/third_party/WebKit/LayoutTests/vr/getFrameData_samewithinframe.html index 0a376e3..559981d 100644 --- a/third_party/WebKit/LayoutTests/vr/getFrameData_samewithinframe.html +++ b/third_party/WebKit/LayoutTests/vr/getFrameData_samewithinframe.html
@@ -16,14 +16,22 @@ var fd1 = new VRFrameData(); var fd2 = new VRFrameData(); mock_service.mockVRDisplays_[0].setPose(expected_pose); - var counter = 0; + var numFrames = 0; function onFrame() { display.requestAnimationFrame(onFrame); + numFrames++; + // Let one rAF run before checking in order to ensure we actually get + // frame data + if (numFrames == 1) { + return; + } + t.step( () => { assert_true(display.getFrameData(fd1)); assert_true(display.getFrameData(fd2)); }, "getFrameData successfully updated object"); + t.step( () => { for (let i = 0; i < 16; i++) { assert_equals(fd1.leftProjectionMatrix[i], @@ -33,6 +41,7 @@ fd2.rightProjectionMatrix[i]); assert_equals(fd1.rightViewMatrix[i], fd2.rightViewMatrix[i]); } + let counter = 0; for (let field in fd1.pose) { counter++; @@ -42,6 +51,7 @@ assert_equals(fd1.pose[field][i], fd2.pose[field][i]); } } + assert_equals(counter, 6); }, "frame data matches within the same frame"); t.done();
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 958003e..7f3c820 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -7290,11 +7290,15 @@ getter height getter offsetLeft getter offsetTop + getter onresize + getter onscroll getter pageLeft getter pageTop getter scale getter width method constructor + setter onresize + setter onscroll interface WaveShaperNode : AudioNode attribute @@toStringTag getter curve
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp index 342dc06..08fa5f2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
@@ -44,7 +44,6 @@ #include "core/html/imports/HTMLImportsController.h" #include "core/inspector/InspectorTraceEvents.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ActiveScriptWrappable.h" #include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/WrapperTypeInfo.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h index b9eee2ba0..8f6479c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h
@@ -29,7 +29,7 @@ #include <memory> #include "core/CoreExport.h" #include "gin/public/v8_idle_task_runner.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 2d4da18..1feafa8 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -50,13 +50,13 @@ #include "core/inspector/MainThreadDebugger.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/EventDispatchForbiddenScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/DOMWrapperWorld.h" #include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/V8PerContextData.h" #include "platform/bindings/V8PrivateProperty.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/AccessControlStatus.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/SecurityViolationReportingPolicy.h" #include "platform/wtf/AddressSanitizer.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp index c0060eda..a6ddaa0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
@@ -24,7 +24,6 @@ #include "core/offscreencanvas/OffscreenCanvas.h" #include "core/typed_arrays/DOMArrayBuffer.h" #include "core/typed_arrays/DOMSharedArrayBuffer.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/DateMath.h" #include "public/platform/WebBlobInfo.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp index e7a9972..c05cdcd4 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp
@@ -30,7 +30,6 @@ #include "core/geometry/DOMRectReadOnly.h" #include "core/html/ImageData.h" #include "core/typed_arrays/DOMArrayBufferBase.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/AutoReset.h" #include "platform/wtf/DateMath.h" #include "platform/wtf/allocator/Partitions.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp index 5778c47..1bf5707 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
@@ -42,8 +42,8 @@ #include "core/geometry/DOMRectReadOnly.h" #include "core/html/ImageData.h" #include "core/offscreencanvas/OffscreenCanvas.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/StaticBitmapImage.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/DateMath.h" #include "public/platform/WebBlobInfo.h"
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp index 2b1e2df..2fbc9e3e 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp
@@ -48,7 +48,6 @@ #include "modules/indexeddb/IDBKeyRange.h" #include "modules/indexeddb/IDBTracing.h" #include "modules/indexeddb/IDBValue.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/wtf/MathExtras.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp index 49ccea0..747d4456 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp
@@ -17,7 +17,6 @@ #include "modules/crypto/CryptoResultImpl.h" #include "modules/filesystem/DOMFileSystem.h" #include "modules/peerconnection/RTCCertificate.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" #include "public/platform/WebCryptoAlgorithmParams.h"
diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator.py b/third_party/WebKit/Source/bindings/scripts/code_generator.py index 1acce6b..7462317 100644 --- a/third_party/WebKit/Source/bindings/scripts/code_generator.py +++ b/third_party/WebKit/Source/bindings/scripts/code_generator.py
@@ -107,7 +107,7 @@ match = re.search(r'/([^/]+)\.h$', include_path) if match: name = match.group(1) - if name.lower() != name and name != 'RuntimeEnabledFeatures' and name != 'OriginTrials': + if name.lower() != name and name != 'OriginTrials': include_path = include_path[0:match.start(1)] + to_snake_case(name) + '.h' normalized_include_paths.append(include_path) return sorted(normalized_include_paths)
diff --git a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py index 9f9f524..3f2d20d 100644 --- a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py +++ b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
@@ -209,7 +209,7 @@ class IdlDictionary(object): def __init__(self, node): self.extended_attributes = {} - self.is_partial = bool(node.GetProperty('Partial')) + self.is_partial = bool(node.GetProperty('PARTIAL')) self.name = node.GetName() self.members = [] self.parent = None @@ -308,8 +308,7 @@ self.partial_interfaces = [] self.is_callback = bool(node.GetProperty('CALLBACK')) - # FIXME: uppercase 'Partial' => 'PARTIAL' in base IDL parser - self.is_partial = bool(node.GetProperty('Partial')) + self.is_partial = bool(node.GetProperty('PARTIAL')) self.name = node.GetName() self.idl_type = IdlType(self.name)
diff --git a/third_party/WebKit/Source/bindings/scripts/scripts.gni b/third_party/WebKit/Source/bindings/scripts/scripts.gni index e7a18ed..574a10b6 100644 --- a/third_party/WebKit/Source/bindings/scripts/scripts.gni +++ b/third_party/WebKit/Source/bindings/scripts/scripts.gni
@@ -253,7 +253,11 @@ ] } - args = [ + args = [] + if (snake_case_source_files) { + args += [ "--snake-case-generated-files" ] + } + args += [ "--cache-dir", rebase_path(bindings_scripts_output_dir, root_build_dir), "--output-dir", @@ -264,9 +268,6 @@ invoker.target_component, "{{source}}", ] - if (snake_case_source_files) { - args += [ "--snake-case-generated-files" ] - } } } } @@ -308,13 +309,24 @@ rel_path = rebase_path(dict_idl, "//third_party/WebKit/Source") impl_dir = get_path_info(rel_path, "dir") idl_name = get_path_info(rel_path, "name") - outputs += [ - "${dictionary_impl_output_dir}$impl_dir/$idl_name.cpp", - "${dictionary_impl_output_dir}$impl_dir/$idl_name.h", - ] + if (snake_case_source_files) { + outputs += [ + "${dictionary_impl_output_dir}$impl_dir/$idl_name.cc", + "${dictionary_impl_output_dir}$impl_dir/$idl_name.h", + ] + } else { + outputs += [ + "${dictionary_impl_output_dir}$impl_dir/$idl_name.cpp", + "${dictionary_impl_output_dir}$impl_dir/$idl_name.h", + ] + } } - args = [ + args = [] + if (snake_case_source_files) { + args += [ "--snake-case-generated-files" ] + } + args += [ "--cache-dir", rebase_path(bindings_scripts_output_dir, root_build_dir), "--output-dir", @@ -328,9 +340,6 @@ "--generate-impl", rebase_path(idl_files_list, root_build_dir), ] - if (snake_case_source_files) { - args += [ "--snake-case-generated-files" ] - } deps = [ # FIXME: should be interfaces_info_core (w/o modules)
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py index afa8ab71..17df959 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
@@ -71,7 +71,7 @@ for member in members: if member['runtime_enabled_feature_name']: - includes.add('platform/RuntimeEnabledFeatures.h') + includes.add('platform/runtime_enabled_features.h') break cpp_class = v8_utilities.cpp_name(dictionary)
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py index 8ff321e3..1caec10 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
@@ -470,7 +470,7 @@ extended_attributes = definition_or_member.extended_attributes if 'RuntimeEnabled' not in extended_attributes: return None - includes.add('platform/RuntimeEnabledFeatures.h') + includes.add('platform/runtime_enabled_features.h') return extended_attributes['RuntimeEnabled']
diff --git a/third_party/WebKit/Source/bindings/tests/idls/core/TestInterfaceGarbageCollected.idl b/third_party/WebKit/Source/bindings/tests/idls/core/TestInterfaceGarbageCollected.idl index bf9c404..7e5313d 100644 --- a/third_party/WebKit/Source/bindings/tests/idls/core/TestInterfaceGarbageCollected.idl +++ b/third_party/WebKit/Source/bindings/tests/idls/core/TestInterfaceGarbageCollected.idl
@@ -8,5 +8,5 @@ attribute TestInterfaceGarbageCollected attr1; void func(TestInterfaceGarbageCollected arg); - setlike<DOMString>; + setlike<[TreatNullAs=EmptyString] DOMString>; };
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp index 513ea7d..a8b75191 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp
@@ -17,9 +17,9 @@ #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" #include "core/origin_trials/OriginTrials.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp index 0198f4a..d0f1d9e 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -28,7 +28,7 @@ #include "core/frame/Deprecation.h" #include "core/typed_arrays/ArrayBufferViewHelpers.h" #include "core/typed_arrays/FlexibleArrayBufferView.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp index 3fdd055..1982cb1 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
@@ -33,10 +33,10 @@ #include "core/dom/ExecutionContext.h" #include "core/frame/UseCounter.h" #include "core/inspector/ConsoleMessage.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp index 7059f2d..f633297 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp
@@ -20,10 +20,10 @@ #include "bindings/core/v8/V8TestInterfaceEmpty.h" #include "core/dom/ExecutionContext.h" #include "core/frame/LocalDOMWindow.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp index dafc188..6ce3e11 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp
@@ -198,7 +198,7 @@ return; } - V8StringResource<> value; + V8StringResource<kTreatNullAsEmptyString> value; value = info[0]; if (!value.Prepare()) return; @@ -222,7 +222,7 @@ return; } - V8StringResource<> value; + V8StringResource<kTreatNullAsEmptyString> value; value = info[0]; if (!value.Prepare()) return; @@ -259,7 +259,7 @@ return; } - V8StringResource<> value; + V8StringResource<kTreatNullAsEmptyString> value; value = info[0]; if (!value.Prepare()) return;
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp index 2e41d78b..19d9a0d 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp
@@ -16,9 +16,9 @@ #include "bindings/core/v8/NativeValueTraitsImpl.h" #include "bindings/core/v8/V8DOMConfiguration.h" #include "core/dom/ExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp index fc6040c..0f916177 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp
@@ -16,9 +16,9 @@ #include "bindings/core/v8/NativeValueTraitsImpl.h" #include "bindings/core/v8/V8DOMConfiguration.h" #include "core/dom/ExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp index d19e0625..e6a88d57b 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -70,11 +70,11 @@ #include "core/typed_arrays/ArrayBufferViewHelpers.h" #include "core/typed_arrays/DOMArrayBufferBase.h" #include "core/typed_arrays/FlexibleArrayBufferView.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ObjectConstructor.h" #include "platform/bindings/V8PrivateProperty.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp index e644ae0..052a8e53 100644 --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp
@@ -19,9 +19,9 @@ #include "bindings/tests/idls/modules/TestInterface2Partial.h" #include "bindings/tests/idls/modules/TestInterface2Partial2.h" #include "core/dom/ExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp index c985b06..44d03aa 100644 --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp
@@ -19,9 +19,9 @@ #include "bindings/modules/v8/V8TestInterface5.h" #include "bindings/modules/v8/v8_void_callback_function_modules.h" #include "core/dom/ExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp index 452e463..e9c839a 100644 --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
@@ -24,10 +24,10 @@ #include "bindings/tests/idls/modules/TestInterfacePartial4.h" #include "core/dom/ExecutionContext.h" #include "core/origin_trials/OriginTrials.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ObjectConstructor.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/build/scripts/make_media_features.py b/third_party/WebKit/Source/build/scripts/core/css/make_media_features.py similarity index 87% rename from third_party/WebKit/Source/build/scripts/make_media_features.py rename to third_party/WebKit/Source/build/scripts/core/css/make_media_features.py index 33fc8d2..aa9c230 100755 --- a/third_party/WebKit/Source/build/scripts/make_media_features.py +++ b/third_party/WebKit/Source/build/scripts/core/css/make_media_features.py
@@ -4,11 +4,14 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os +import sys +sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) + import media_feature_symbol import json5_generator import template_expander import name_utilities -import sys class MakeMediaFeaturesWriter(json5_generator.Writer): @@ -33,7 +36,7 @@ 'input_files': self._input_files, } - @template_expander.use_jinja('templates/MediaFeatures.h.tmpl', filters=filters) + @template_expander.use_jinja('core/css/templates/MediaFeatures.h.tmpl', filters=filters) def generate_header(self): return self._template_context
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.h.tmpl index d2daff0..0d074320 100644 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.h.tmpl
@@ -62,6 +62,7 @@ virtual void ApplyValue(StyleResolverState&, const CSSValue&) const { NOTREACHED(); } + virtual bool IsAffectedByAll() const { return IsEnabled() && IsProperty(); } }; {% for api_class_data in api_classes_by_property_id %}
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl index a8d4989f..43909d47 100644 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl
@@ -23,7 +23,7 @@ #include "core/style/ComputedStyle.h" #include "core/style/SVGComputedStyle.h" {% if property.runtime_flag %} -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" {% endif %} #include "platform/heap/HeapAllocator.h" @@ -111,6 +111,9 @@ return RuntimeEnabledFeatures::{{property.runtime_flag}}Enabled(); } {% endif %} + {% if not property.affected_by_all %} + bool IsAffectedByAll() const override { return false; } + {% endif %} }; } // namespace blink
diff --git a/third_party/WebKit/Source/build/scripts/templates/MediaFeatures.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/templates/MediaFeatures.h.tmpl similarity index 100% rename from third_party/WebKit/Source/build/scripts/templates/MediaFeatures.h.tmpl rename to third_party/WebKit/Source/build/scripts/core/css/templates/MediaFeatures.h.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/json5_generator.py b/third_party/WebKit/Source/build/scripts/json5_generator.py index 39c88a1..11848f2 100644 --- a/third_party/WebKit/Source/build/scripts/json5_generator.py +++ b/third_party/WebKit/Source/build/scripts/json5_generator.py
@@ -202,22 +202,17 @@ class_name = None default_metadata = None default_parameters = None + snake_case_source_files = False def __init__(self, json5_files): self._input_files = copy.copy(json5_files) self._outputs = {} # file_name -> generator self.gperf_path = None - self.snake_case_input_files = False if json5_files: self.json5_file = Json5File.load_from_files(json5_files, self.default_metadata, self.default_parameters) - # TODO(tkent): This is an ugly hack. Remove the function after the great mv. - # crbug.com/760462 - def set_snake_case_input_files(self, flag): - self.snake_case_input_files = flag - def _write_file_if_changed(self, output_dir, contents, file_name): path = os.path.join(output_dir, file_name) @@ -256,14 +251,17 @@ parser.add_argument("--developer_dir", help="Path to Xcode.") parser.add_argument("--output_dir", default=os.getcwd()) # TODO(tkent): Remove the option after the great mv. crbug.com/760462 - parser.add_argument("--snake-case-input-files", + parser.add_argument("--snake-case-source-files", action="store_true", default=False) args = parser.parse_args() if args.developer_dir: os.environ["DEVELOPER_DIR"] = args.developer_dir + # TODO(tkent): This is an ugly hack. Remove the hack after the great mv. + # crbug.com/760462 + Writer.snake_case_source_files = args.snake_case_source_files + writer = self._writer_class(args.files) - writer.set_snake_case_input_files(args.snake_case_input_files) writer.set_gperf_path(args.gperf) writer.write_files(args.output_dir)
diff --git a/third_party/WebKit/Source/build/scripts/make_element_type_helpers.py b/third_party/WebKit/Source/build/scripts/make_element_type_helpers.py index 0dec188..dabead81 100755 --- a/third_party/WebKit/Source/build/scripts/make_element_type_helpers.py +++ b/third_party/WebKit/Source/build/scripts/make_element_type_helpers.py
@@ -54,7 +54,11 @@ (self.namespace + "ElementTypeHelpers.cpp"): self.generate_helper_implementation, } + base_element_header = 'core/%s/%s_element.h' % (self.namespace.lower(), self.namespace.lower()) + if not self.snake_case_source_files: + base_element_header = 'core/%s/%sElement.h' % (self.namespace.lower(), self.namespace) self._template_context = { + 'base_element_header': base_element_header, 'input_files': self._input_files, 'namespace': self.namespace, 'tags': self.json5_file.name_dictionaries,
diff --git a/third_party/WebKit/Source/build/scripts/make_event_factory.py b/third_party/WebKit/Source/build/scripts/make_event_factory.py index 2288cec..bedb055 100755 --- a/third_party/WebKit/Source/build/scripts/make_event_factory.py +++ b/third_party/WebKit/Source/build/scripts/make_event_factory.py
@@ -132,7 +132,7 @@ exit(1) def _get_basename(self, name, prefix=None): - if self.snake_case_input_files: + if json5_generator.Writer.snake_case_source_files: if prefix: return '%s_%s' % (prefix.lower(), name_utilities.snake_case(name)) return name_utilities.snake_case(name)
diff --git a/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py b/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py index 92e76bb..fe0b2e3 100755 --- a/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py +++ b/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py
@@ -43,8 +43,11 @@ def __init__(self, json5_file_path): super(InternalRuntimeFlagsWriter, self).__init__(json5_file_path) - self._outputs = {(self.class_name + '.idl'): self.generate_idl, - (self.class_name + '.h'): self.generate_header, + basename = self.class_name + if json5_generator.Writer.snake_case_source_files: + basename = 'internal_runtime_flags' + self._outputs = {(basename + '.idl'): self.generate_idl, + (basename + '.h'): self.generate_header, } @template_expander.use_jinja('templates/' + class_name + '.idl.tmpl')
diff --git a/third_party/WebKit/Source/build/scripts/make_internal_settings.py b/third_party/WebKit/Source/build/scripts/make_internal_settings.py index 8f69b3c..6eba0018 100755 --- a/third_party/WebKit/Source/build/scripts/make_internal_settings.py +++ b/third_party/WebKit/Source/build/scripts/make_internal_settings.py
@@ -54,8 +54,16 @@ } self._template_context = { 'input_files': self._input_files, + 'primary_header_name': 'InternalSettingsGenerated.h', 'settings': self.json5_file.name_dictionaries, } + if json5_generator.Writer.snake_case_source_files: + self._outputs = { + 'internal_settings_generated.h': self.generate_header, + 'internal_settings_generated.cc': self.generate_implementation, + 'internal_settings_generated.idl': self.generate_idl, + } + self._template_context['primary_header_name'] = 'internal_settings_generated.h' @template_expander.use_jinja('templates/InternalSettingsGenerated.h.tmpl', filters=filters) def generate_header(self):
diff --git a/third_party/WebKit/Source/build/scripts/make_runtime_features.py b/third_party/WebKit/Source/build/scripts/make_runtime_features.py index 64d489e..5395f298 100755 --- a/third_party/WebKit/Source/build/scripts/make_runtime_features.py +++ b/third_party/WebKit/Source/build/scripts/make_runtime_features.py
@@ -38,11 +38,12 @@ class RuntimeFeatureWriter(json5_generator.Writer): class_name = 'RuntimeEnabledFeatures' + file_basename = 'runtime_enabled_features' def __init__(self, json5_file_path): super(RuntimeFeatureWriter, self).__init__(json5_file_path) - self._outputs = {(self.class_name + '.h'): self.generate_header, - (self.class_name + '.cpp'): self.generate_implementation, + self._outputs = {(self.file_basename + '.h'): self.generate_header, + (self.file_basename + '.cc'): self.generate_implementation, } self._features = self.json5_file.name_dictionaries @@ -76,11 +77,11 @@ 'origin_trial_controlled_features': self._origin_trial_features, } - @template_expander.use_jinja('templates/' + class_name + '.h.tmpl') + @template_expander.use_jinja('templates/' + file_basename + '.h.tmpl') def generate_header(self): return self._template_inputs() - @template_expander.use_jinja('templates/' + class_name + '.cpp.tmpl') + @template_expander.use_jinja('templates/' + file_basename + '.cc.tmpl') def generate_implementation(self): return self._template_inputs()
diff --git a/third_party/WebKit/Source/build/scripts/scripts.gni b/third_party/WebKit/Source/build/scripts/scripts.gni index 8932844f..c7a7795 100644 --- a/third_party/WebKit/Source/build/scripts/scripts.gni +++ b/third_party/WebKit/Source/build/scripts/scripts.gni
@@ -123,7 +123,7 @@ args += invoker.other_args } if (snake_case_source_files) { - args += [ "--snake-case-input-files" ] + args += [ "--snake-case-source-files" ] } if (defined(invoker.deps)) {
diff --git a/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl index b462617f..9f3fd35 100644 --- a/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl
@@ -19,7 +19,7 @@ #include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/dom/Document.h" #include "core/frame/Settings.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashMap.h" namespace blink {
diff --git a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.cpp.tmpl index bb640712..d7d73884 100644 --- a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.cpp.tmpl
@@ -6,7 +6,7 @@ #include "{{namespace}}ElementTypeHelpers.h" #include "core/dom/Document.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl index a8b3b98..a7fe4a5 100644 --- a/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/ElementTypeHelpers.h.tmpl
@@ -6,9 +6,9 @@ #ifndef {{namespace}}ElementTypeHelpers_h #define {{namespace}}ElementTypeHelpers_h -#include "core/{{namespace|lower}}/{{namespace}}Element.h" +#include "{{base_element_header}}" #include "{{namespace}}Names.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink { // Type checking.
diff --git a/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl index 0f3827f5..79b183f 100644 --- a/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl
@@ -11,7 +11,7 @@ #include "Event{{suffix}}Headers.h" #include "core/frame/Deprecation.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl index 74b60947..48877ca 100644 --- a/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl
@@ -7,8 +7,8 @@ #define InternalRuntimeFlags_h #include "platform/bindings/ScriptWrappable.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/RefPtr.h" #include "platform/wtf/RefCounted.h"
diff --git a/third_party/WebKit/Source/build/scripts/templates/InternalSettingsGenerated.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/InternalSettingsGenerated.cpp.tmpl index 9028a66..e08e390 100644 --- a/third_party/WebKit/Source/build/scripts/templates/InternalSettingsGenerated.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/InternalSettingsGenerated.cpp.tmpl
@@ -3,7 +3,7 @@ {{source_files_for_generated_file(template_file, input_files)}} -#include "InternalSettingsGenerated.h" +#include "{{primary_header_name}}" #include "core/page/Page.h" #include "core/frame/Settings.h"
diff --git a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl index f2db247..a338f2e 100644 --- a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
@@ -6,7 +6,7 @@ #include "core/origin_trials/OriginTrials.h" #include "core/origin_trials/OriginTrialContext.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl index d53e07794..eded09d 100644 --- a/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl
@@ -24,7 +24,7 @@ #include "StylePropertyShorthand.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/runtime_enabled_features.cc.tmpl similarity index 97% rename from third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl rename to third_party/WebKit/Source/build/scripts/templates/runtime_enabled_features.cc.tmpl index 9e73298..e2dfc7e 100644 --- a/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/runtime_enabled_features.cc.tmpl
@@ -3,7 +3,7 @@ {{source_files_for_generated_file(template_file, input_files)}} -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/runtime_enabled_features.h.tmpl similarity index 100% rename from third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl rename to third_party/WebKit/Source/build/scripts/templates/runtime_enabled_features.h.tmpl
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 325b2cf..880642e3 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -250,8 +250,6 @@ ] sources = [ - "$blink_core_output_dir/testing/InternalSettingsGenerated.cpp", - "$blink_core_output_dir/testing/InternalSettingsGenerated.h", "testing/CallbackFunctionTest.cpp", "testing/CallbackFunctionTest.h", "testing/DeathAwareScriptWrappable.cpp", @@ -292,16 +290,39 @@ "testing/v8/WebCoreTestSupport.cpp", "testing/v8/WebCoreTestSupport.h", ] + if (snake_case_source_files) { + sources += [ + "$blink_core_output_dir/testing/internal_settings_generated.cc", + "$blink_core_output_dir/testing/internal_settings_generated.h", + ] + } else { + sources += [ + "$blink_core_output_dir/testing/InternalSettingsGenerated.cpp", + "$blink_core_output_dir/testing/InternalSettingsGenerated.h", + ] + } # Compile the sources produced by these IDL file lists. - sources += process_file_template( - webcore_testing_idl_files + core_testing_dictionary_idl_files + - generated_webcore_testing_idl_files + - webcore_testing_idl_with_modules_dependency_files, - [ - "$bindings_core_v8_output_dir/V8{{source_name_part}}.cpp", - "$bindings_core_v8_output_dir/V8{{source_name_part}}.h", - ]) + testing_idl_files = + webcore_testing_idl_files + core_testing_dictionary_idl_files + + generated_webcore_testing_idl_files + + webcore_testing_idl_with_modules_dependency_files + + if (snake_case_source_files) { + sources += process_file_template( + testing_idl_files, + [ + "$bindings_core_v8_output_dir/v8_{{source_name_part}}.cc", + "$bindings_core_v8_output_dir/v8_{{source_name_part}}.h", + ]) + } else { + sources += process_file_template( + testing_idl_files, + [ + "$bindings_core_v8_output_dir/V8{{source_name_part}}.cpp", + "$bindings_core_v8_output_dir/V8{{source_name_part}}.h", + ]) + } } # core_bindings_generated ------------------------------------------------------ @@ -384,17 +405,27 @@ "../build/scripts/templates/InternalSettingsGenerated.h.tmpl", "frame/Settings.json5", ] - outputs = [ - "$blink_core_output_dir/testing/InternalSettingsGenerated.idl", - "$blink_core_output_dir/testing/InternalSettingsGenerated.cpp", - "$blink_core_output_dir/testing/InternalSettingsGenerated.h", - ] args = [ rebase_path("frame/Settings.json5", root_build_dir), "--output_dir", "$rel_blink_core_gen_dir/testing", ] + + if (snake_case_source_files) { + args += [ "--snake-case-source-files" ] + outputs = [ + "$blink_core_output_dir/testing/internal_settings_generated.idl", + "$blink_core_output_dir/testing/internal_settings_generated.cc", + "$blink_core_output_dir/testing/internal_settings_generated.h", + ] + } else { + outputs = [ + "$blink_core_output_dir/testing/InternalSettingsGenerated.idl", + "$blink_core_output_dir/testing/InternalSettingsGenerated.cpp", + "$blink_core_output_dir/testing/InternalSettingsGenerated.h", + ] + } } action("generated_testing_idls_internal_runtime_flags") { @@ -402,20 +433,29 @@ inputs = scripts_for_json5_files + [ "../build/scripts/make_internal_runtime_flags.py", - "../platform/RuntimeEnabledFeatures.json5", + "../platform/runtime_enabled_features.json5", "../build/scripts/templates/InternalRuntimeFlags.h.tmpl", "../build/scripts/templates/InternalRuntimeFlags.idl.tmpl", ] - outputs = [ - "$blink_core_output_dir/testing/InternalRuntimeFlags.idl", - "$blink_core_output_dir/testing/InternalRuntimeFlags.h", - ] args = [ - rebase_path("../platform/RuntimeEnabledFeatures.json5", root_build_dir), + rebase_path("../platform/runtime_enabled_features.json5", root_build_dir), "--output_dir", "$rel_blink_core_gen_dir/testing", ] + + if (snake_case_source_files) { + args += [ "--snake-case-source-files" ] + outputs = [ + "$blink_core_output_dir/testing/internal_runtime_flags.idl", + "$blink_core_output_dir/testing/internal_runtime_flags.h", + ] + } else { + outputs = [ + "$blink_core_output_dir/testing/InternalRuntimeFlags.idl", + "$blink_core_output_dir/testing/InternalRuntimeFlags.h", + ] + } } css_properties("make_core_generated_computed_style_base") { @@ -485,6 +525,7 @@ "$blink_core_output_dir/css/properties/CSSPropertyAPIAlignItems.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAlignOrJustifyContent.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAlignSelf.h", + "$blink_core_output_dir/css/properties/CSSPropertyAPIAll.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationDirection.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationFillMode.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationIterationCount.h", @@ -525,6 +566,7 @@ "$blink_core_output_dir/css/properties/CSSPropertyAPID.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIDelay.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIDescriptorOnly.h", + "$blink_core_output_dir/css/properties/CSSPropertyAPIDirection.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIDuration.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIFillOrStrokeOpacity.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIFilter.h", @@ -623,6 +665,7 @@ "$blink_core_output_dir/css/properties/CSSPropertyAPITransformOrigin.h", "$blink_core_output_dir/css/properties/CSSPropertyAPITransitionProperty.h", "$blink_core_output_dir/css/properties/CSSPropertyAPITranslate.h", + "$blink_core_output_dir/css/properties/CSSPropertyAPIUnicodeBidi.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIVerticalAlign.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIVisibility.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIWebkitBorderColor.h", @@ -729,15 +772,12 @@ ] } -process_json5_files("make_core_generated_media_features") { - script = "../build/scripts/make_media_features.py" - in_files = [ "css/MediaFeatureNames.json5" ] - other_inputs = [ - "../build/scripts/make_media_features.py", - "../build/scripts/templates/MediaFeatures.h.tmpl", - ] +code_generator("make_core_generated_media_features") { + script = "../build/scripts/core/css/make_media_features.py" + json_inputs = [ "css/MediaFeatureNames.json5" ] + templates = [ "../build/scripts/core/css/templates/MediaFeatures.h.tmpl" ] outputs = [ - "$blink_core_output_dir/MediaFeatures.h", + "$blink_core_output_dir/css/MediaFeatures.h", ] } @@ -1100,7 +1140,7 @@ inputs = scripts_for_json5_files + [ "../build/scripts/make_origin_trials.py", - "../platform/RuntimeEnabledFeatures.json5", + "../platform/runtime_enabled_features.json5", "../build/scripts/templates/OriginTrials.cpp.tmpl", "../build/scripts/templates/OriginTrials.h.tmpl", ] @@ -1110,7 +1150,7 @@ ] args = [ - rebase_path("../platform/RuntimeEnabledFeatures.json5", root_build_dir), + rebase_path("../platform/runtime_enabled_features.json5", root_build_dir), "--output_dir", "$rel_blink_core_gen_dir/origin_trials", ]
diff --git a/third_party/WebKit/Source/core/CoreInitializer.cpp b/third_party/WebKit/Source/core/CoreInitializer.cpp index 76599ac..3bc5c386 100644 --- a/third_party/WebKit/Source/core/CoreInitializer.cpp +++ b/third_party/WebKit/Source/core/CoreInitializer.cpp
@@ -54,7 +54,6 @@ #include "core/workers/WorkerThread.h" #include "platform/FontFamilyNames.h" #include "platform/HTTPNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/FetchInitiatorTypeNames.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SchemeRegistry.h"
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp index aa5ba66..ec9d16de 100644 --- a/third_party/WebKit/Source/core/animation/Animation.cpp +++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -46,12 +46,12 @@ #include "core/inspector/InspectorTraceEvents.h" #include "core/paint/PaintLayer.h" #include "core/probe/CoreProbes.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebTaskRunner.h" #include "platform/animation/CompositorAnimationPlayer.h" #include "platform/heap/Persistent.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/MathExtras.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp index 25526eb..5ef84537 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -20,7 +20,6 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/ComputedStyle.h" #include "core/style/DataEquivalency.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/PtrUtil.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp b/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp index 78dc2a61c..42163ee2 100644 --- a/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp +++ b/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp
@@ -38,7 +38,6 @@ #include "core/frame/LocalFrameView.h" #include "core/loader/DocumentLoader.h" #include "core/page/Page.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/animation/EffectStack.cpp b/third_party/WebKit/Source/core/animation/EffectStack.cpp index 788f043..57c1905d 100644 --- a/third_party/WebKit/Source/core/animation/EffectStack.cpp +++ b/third_party/WebKit/Source/core/animation/EffectStack.cpp
@@ -34,7 +34,7 @@ #include "core/animation/CompositorAnimations.h" #include "core/animation/InvalidatableInterpolation.h" #include "core/animation/css/CSSAnimations.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/NonCopyingSort.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/ElementAnimation.h b/third_party/WebKit/Source/core/animation/ElementAnimation.h index 32e2935d..57c83a2 100644 --- a/third_party/WebKit/Source/core/animation/ElementAnimation.h +++ b/third_party/WebKit/Source/core/animation/ElementAnimation.h
@@ -43,7 +43,6 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/ExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/wtf/Allocator.h"
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffect.h b/third_party/WebKit/Source/core/animation/InterpolationEffect.h index 01fc3795..981e835 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationEffect.h +++ b/third_party/WebKit/Source/core/animation/InterpolationEffect.h
@@ -8,7 +8,6 @@ #include "core/CoreExport.h" #include "core/animation/Interpolation.h" #include "core/animation/Keyframe.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/TimingFunction.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/StringKeyframe.cpp b/third_party/WebKit/Source/core/animation/StringKeyframe.cpp index a50fc44..8e92fc3 100644 --- a/third_party/WebKit/Source/core/animation/StringKeyframe.cpp +++ b/third_party/WebKit/Source/core/animation/StringKeyframe.cpp
@@ -9,7 +9,6 @@ #include "core/css/CSSCustomPropertyDeclaration.h" #include "core/css/resolver/StyleResolver.h" #include "core/svg/SVGElement.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp index 5597db10..9aa5bac 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -34,6 +34,7 @@ #include "core/clipboard/DataTransferItemList.h" #include "core/editing/EphemeralRange.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/serializers/Serialization.h" #include "core/fileapi/FileList.h" #include "core/frame/LocalFrame.h" @@ -378,7 +379,11 @@ float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); - FloatRect device_bounds = DeviceSpaceBounds(css_bounds, frame); + // Exclude content not in the visual viewport. + auto viewport = frame.GetPage()->GetVisualViewport().VisibleRectInDocument(); + FloatRect clipped_bounds = Intersection(css_bounds, viewport); + + FloatRect device_bounds = DeviceSpaceBounds(clipped_bounds, frame); AffineTransform transform; transform.Scale(device_scale_factor * page_scale_factor);
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.h b/third_party/WebKit/Source/core/clipboard/DataTransfer.h index 68cab15..03a82334 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.h +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.h
@@ -134,6 +134,11 @@ DataObject* GetDataObject() const; + // Returns the rect with device scale factor and page scale factor applied to + // the rect's dimensions. + // TODO(pdr): The input rect is in CSS pixels and the output location is in + // CSS pixels but the output bounds are in device space (physical pixels). + // This should be refactored to return a rect entirely in device coordinates. static FloatRect DeviceSpaceBounds(const FloatRect, const LocalFrame&); static std::unique_ptr<DragImage> CreateDragImageForFrame( const LocalFrame&,
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp index 3cf1357..d20f564 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp
@@ -7,6 +7,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" #include "core/frame/PerformanceMonitor.h" +#include "core/frame/Settings.h" #include "core/layout/LayoutObject.h" #include "core/testing/DummyPageHolder.h" #include "core/timing/Performance.h" @@ -21,6 +22,7 @@ ~DataTransferTest() override = default; Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } + Page& GetPage() const { return dummy_page_holder_->GetPage(); } LocalFrame& GetFrame() const { return *GetDocument().GetFrame(); } Performance* GetPerformance() const { return performance_; } @@ -125,4 +127,76 @@ << "#sample doesn't have :-webkit-drag."; } +TEST_F(DataTransferTest, NodeImageExceedsViewportBounds) { + SetBodyContent( + "<style>" + " * { margin: 0; } " + " #node { width: 2000px; height: 2000px; }" + "</style>" + "<div id='node'></div>"); + Element& node = *GetDocument().getElementById("node"); + const auto image = DataTransfer::NodeImage(GetFrame(), node); + EXPECT_EQ(IntSize(800, 600), image->Size()); +} + +TEST_F(DataTransferTest, NodeImageUnderScrollOffset) { + SetBodyContent( + "<style>" + " * { margin: 0; } " + " #first { width: 500px; height: 500px; }" + " #second { width: 300px; height: 200px; }" + "</style>" + "<div id='first'></div>" + "<div id='second'></div>"); + + const int scroll_amount = 10; + LocalFrameView* frame_view = GetDocument().View(); + frame_view->LayoutViewportScrollableArea()->SetScrollOffset( + ScrollOffset(0, scroll_amount), kProgrammaticScroll); + + // The first div should be offset by the scroll offset. + Element& first = *GetDocument().getElementById("first"); + const auto first_image = DataTransfer::NodeImage(GetFrame(), first); + const int first_height = 500; + EXPECT_EQ(IntSize(500, first_height - scroll_amount), first_image->Size()); + + // The second div should also be offset by the scroll offset. In addition, + // the second div should be clipped by the viewport. + Element& second = *GetDocument().getElementById("second"); + const auto second_image = DataTransfer::NodeImage(GetFrame(), second); + const int viewport_height = 600; + EXPECT_EQ(IntSize(300, viewport_height - (first_height - scroll_amount)), + second_image->Size()); +} + +TEST_F(DataTransferTest, NodeImageWithPageScaleFactor) { + SetBodyContent( + "<style>" + " * { margin: 0; } " + " html, body { height: 2000px; }" + " #node { width: 200px; height: 141px; }" + "</style>" + "<div id='node'></div>"); + const int page_scale_factor = 2; + GetPage().SetPageScaleFactor(page_scale_factor); + Element& node = *GetDocument().getElementById("node"); + const auto image = DataTransfer::NodeImage(GetFrame(), node); + const int node_width = 200; + const int node_height = 141; + EXPECT_EQ( + IntSize(node_width * page_scale_factor, node_height * page_scale_factor), + image->Size()); + + // Check that a scroll offset is scaled to device coordinates which includes + // page scale factor. + const int scroll_amount = 10; + LocalFrameView* frame_view = GetDocument().View(); + frame_view->LayoutViewportScrollableArea()->SetScrollOffset( + ScrollOffset(0, scroll_amount), kProgrammaticScroll); + const auto image_with_offset = DataTransfer::NodeImage(GetFrame(), node); + EXPECT_EQ(IntSize(node_width * page_scale_factor, + (node_height - scroll_amount) * page_scale_factor), + image_with_offset->Size()); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/core_idl_files.gni b/third_party/WebKit/Source/core/core_idl_files.gni index b0b3d42..1cc3af6 100644 --- a/third_party/WebKit/Source/core/core_idl_files.gni +++ b/third_party/WebKit/Source/core/core_idl_files.gni
@@ -641,13 +641,23 @@ webcore_testing_dependency_idl_files = get_path_info([ "testing/OriginTrialsTestPartial.idl" ], "abspath") -generated_webcore_testing_idl_files = - get_path_info( - [ - "$blink_core_output_dir/testing/InternalRuntimeFlags.idl", - "$blink_core_output_dir/testing/InternalSettingsGenerated.idl", - ], - "abspath") +if (snake_case_source_files) { + generated_webcore_testing_idl_files = + get_path_info( + [ + "$blink_core_output_dir/testing/internal_runtime_flags.idl", + "$blink_core_output_dir/testing/internal_settings_generated.idl", + ], + "abspath") +} else { + generated_webcore_testing_idl_files = + get_path_info( + [ + "$blink_core_output_dir/testing/InternalRuntimeFlags.idl", + "$blink_core_output_dir/testing/InternalSettingsGenerated.idl", + ], + "abspath") +} core_definition_idl_files = core_dictionary_idl_files + core_idl_files + core_idl_with_modules_dependency_files
diff --git a/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp b/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp index 74d1469..d926cec 100644 --- a/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp
@@ -31,13 +31,13 @@ #include "core/dom/Node.h" #include "core/loader/resource/FontResource.h" #include "platform/CrossOriginAttributeValue.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontCustomPlatformData.h" #include "platform/loader/fetch/FetchInitiatorTypeNames.h" #include "platform/loader/fetch/FetchParameters.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceLoaderOptions.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityPolicy.h" #include "platform/wtf/text/StringBuilder.h" #include "public/platform/WebURLRequest.h"
diff --git a/third_party/WebKit/Source/core/css/CSSFontSelector.cpp b/third_party/WebKit/Source/core/css/CSSFontSelector.cpp index ae5ac87a..5ade733d 100644 --- a/third_party/WebKit/Source/core/css/CSSFontSelector.cpp +++ b/third_party/WebKit/Source/core/css/CSSFontSelector.cpp
@@ -36,7 +36,6 @@ #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "core/loader/FrameLoader.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontSelectorClient.h" #include "platform/fonts/SimpleFontData.h"
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index 0ed15a0..95152fd 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -191,6 +191,17 @@ valid_type: "bool", }, + // - affected_by_all + // The affected_by_all flag indicates whether a change to the CSS property + // "all" affects this property. + // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand + // Descriptors (is_property: false) are never affected by changes to the + // all property. + affected_by_all: { + default: true, + valid_type: "bool", + }, + // The remaining arguments are used for the StyleBuilder and allow us to // succinctly describe how to apply properties. When default handlers are not // sufficient, we should prefer to use converter, and failing that define @@ -416,7 +427,8 @@ }, { name: "direction", - api_class: "CSSPropertyAPIInherited", + api_class: true, + affected_by_all: false, custom_value: true, type_name: "TextDirection", inherited: true, @@ -2867,6 +2879,8 @@ }, { name: "unicode-bidi", + api_class: true, + affected_by_all: false, include_paths: ["platform/text/UnicodeBidi.h"], default_value: "normal", field_template: "keyword", @@ -3764,6 +3778,8 @@ { name: "all", + api_class: true, + affected_by_all: false, builder_skip: true, }, {
diff --git a/third_party/WebKit/Source/core/css/CSSProperty.cpp b/third_party/WebKit/Source/core/css/CSSProperty.cpp index b6bc7c4..0df5d81 100644 --- a/third_party/WebKit/Source/core/css/CSSProperty.cpp +++ b/third_party/WebKit/Source/core/css/CSSProperty.cpp
@@ -299,31 +299,6 @@ } } -bool CSSProperty::IsAffectedByAllProperty(CSSPropertyID property_id) { - if (property_id == CSSPropertyAll) - return false; - - const CSSPropertyAPI& property_api = - CSSPropertyAPI::Get(resolveCSSPropertyID(property_id)); - if (!property_api.IsEnabled()) - return false; - - if (property_id == CSSPropertyVariable) - return false; - - if (!property_api.IsProperty()) - return false; - - // all shorthand spec says: - // The all property is a shorthand that resets all CSS properties except - // direction and unicode-bidi. It only accepts the CSS-wide keywords. - // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand - // So CSSPropertyUnicodeBidi and CSSPropertyDirection are not - // affected by all property. - return property_id != CSSPropertyUnicodeBidi && - property_id != CSSPropertyDirection; -} - void CSSProperty::FilterEnabledCSSPropertiesIntoVector( const CSSPropertyID* properties, size_t propertyCount,
diff --git a/third_party/WebKit/Source/core/css/CSSProperty.h b/third_party/WebKit/Source/core/css/CSSProperty.h index c3f2570..bee41fd 100644 --- a/third_party/WebKit/Source/core/css/CSSProperty.h +++ b/third_party/WebKit/Source/core/css/CSSProperty.h
@@ -24,7 +24,6 @@ #include "core/CSSPropertyNames.h" #include "core/css/CSSValue.h" #include "core/css/properties/CSSPropertyAPI.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/text/TextDirection.h" #include "platform/text/WritingMode.h" #include "platform/wtf/Allocator.h" @@ -95,7 +94,6 @@ static CSSPropertyID ResolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode); - static bool IsAffectedByAllProperty(CSSPropertyID); static void FilterEnabledCSSPropertiesIntoVector(const CSSPropertyID*, size_t length,
diff --git a/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp b/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp index e0a38582..b306d2e 100644 --- a/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp +++ b/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
@@ -27,7 +27,6 @@ #include "core/css/CSSFontFace.h" #include "core/css/CSSFontSelector.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontDescription.h" #include "platform/fonts/FontFaceCreationParams.h"
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.cpp b/third_party/WebKit/Source/core/css/CSSSelector.cpp index 689040b..acff806c2 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelector.cpp
@@ -32,7 +32,7 @@ #include "core/css/CSSMarkup.h" #include "core/css/CSSSelectorList.h" #include "core/css/parser/CSSParserContext.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/core/css/CSSTimingFunctionValue.h b/third_party/WebKit/Source/core/css/CSSTimingFunctionValue.h index 73f1fcc14..41880b4 100644 --- a/third_party/WebKit/Source/core/css/CSSTimingFunctionValue.h +++ b/third_party/WebKit/Source/core/css/CSSTimingFunctionValue.h
@@ -27,8 +27,8 @@ #define CSSTimingFunctionValue_h #include "core/css/CSSValue.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/TimingFunction.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp index 389015a..45037f6e 100644 --- a/third_party/WebKit/Source/core/css/FontFace.cpp +++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -61,10 +61,10 @@ #include "core/typed_arrays/DOMArrayBufferView.h" #include "platform/FontFamilyNames.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/WebTaskRunner.h" #include "platform/bindings/ScriptState.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp index 9e32e38a..55a2356a 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp
@@ -30,12 +30,12 @@ #include "core/css/MediaQueryEvaluator.h" #include "core/CSSValueKeywords.h" -#include "core/MediaFeatures.h" #include "core/MediaTypeNames.h" #include "core/css/CSSHelper.h" #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSToLengthConversionData.h" #include "core/css/MediaFeatureNames.h" +#include "core/css/MediaFeatures.h" #include "core/css/MediaList.h" #include "core/css/MediaQuery.h" #include "core/css/MediaValuesDynamic.h" @@ -46,7 +46,6 @@ #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "core/probe/CoreProbes.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/ColorSpaceGamut.h" #include "platform/wtf/HashMap.h"
diff --git a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp index 56f356b..4f868546 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp
@@ -32,7 +32,7 @@ #include "core/css/parser/CSSParserToken.h" #include "core/html/parser/HTMLParserIdioms.h" #include "platform/Decimal.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/StringBuffer.h" #include "platform/wtf/text/StringBuilder.h"
diff --git a/third_party/WebKit/Source/core/css/OffscreenFontSelector.cpp b/third_party/WebKit/Source/core/css/OffscreenFontSelector.cpp index cc00c3ba..6e77796a 100644 --- a/third_party/WebKit/Source/core/css/OffscreenFontSelector.cpp +++ b/third_party/WebKit/Source/core/css/OffscreenFontSelector.cpp
@@ -12,7 +12,6 @@ #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "core/loader/FrameLoader.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontSelectorClient.h" #include "platform/fonts/SimpleFontData.h"
diff --git a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp index 82876ed..76a92ef 100644 --- a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp +++ b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -37,7 +37,6 @@ #include "core/html/custom/CustomElement.h" #include "core/html/custom/CustomElementDefinition.h" #include "core/probe/CoreProbes.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp index 3e205eb4..140b294 100644 --- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp +++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -11,7 +11,6 @@ #include "core/frame/LocalFrameClient.h" #include "core/inspector/ConsoleMessage.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontCustomPlatformData.h" #include "platform/fonts/FontDescription.h" @@ -19,6 +18,7 @@ #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceLoadPriority.h" #include "platform/network/NetworkStateNotifier.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "public/platform/WebEffectiveConnectionType.h"
diff --git a/third_party/WebKit/Source/core/css/RuleSet.cpp b/third_party/WebKit/Source/core/css/RuleSet.cpp index a07dad7e..51ccf461 100644 --- a/third_party/WebKit/Source/core/css/RuleSet.cpp +++ b/third_party/WebKit/Source/core/css/RuleSet.cpp
@@ -38,7 +38,6 @@ #include "core/css/StyleRuleImport.h" #include "core/css/StyleSheetContents.h" #include "core/html/track/TextTrackCue.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/HeapTerminatedArrayBuilder.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp index 6a476e63..bb79936b 100644 --- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp +++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -57,7 +57,7 @@ #include "core/page/Page.h" #include "core/probe/CoreProbes.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollableArea.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/wtf/AutoReset.h"
diff --git a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp index da934b2..8aa2975e 100644 --- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp +++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -31,6 +31,7 @@ #include "core/css/CSSPendingSubstitutionValue.h" #include "core/css/CSSValuePool.h" #include "core/css/properties/CSSPropertyAPI.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/StdLibExtras.h" #include "platform/wtf/text/StringBuilder.h" @@ -48,7 +49,8 @@ property_set_->PropertyAt(all_index_); for (unsigned i = 0; i < property_set_->PropertyCount(); ++i) { StylePropertySet::PropertyReference property = property_set_->PropertyAt(i); - if (CSSProperty::IsAffectedByAllProperty(property.Id())) { + if (CSSPropertyAPI::Get(resolveCSSPropertyID(property.Id())) + .IsAffectedByAll()) { if (all_property.IsImportant() && !property.IsImportant()) continue; if (static_cast<unsigned>(all_index_) >= i) @@ -110,7 +112,8 @@ StylePropertySet::PropertyReference property = property_set_->PropertyAt(index); if (property.Id() == CSSPropertyAll || - !CSSProperty::IsAffectedByAllProperty(property.Id())) + !CSSPropertyAPI::Get(resolveCSSPropertyID(property.Id())) + .IsAffectedByAll()) return true; if (!isCSSPropertyIDWithName(property.Id())) return false; @@ -130,7 +133,7 @@ // The all property is a shorthand that resets all CSS properties except // direction and unicode-bidi. It only accepts the CSS-wide keywords. // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand - if (!CSSProperty::IsAffectedByAllProperty(property_id)) + if (!CSSPropertyAPI::Get(resolveCSSPropertyID(property_id)).IsAffectedByAll()) return longhand_property_used_.test(index); return true;
diff --git a/third_party/WebKit/Source/core/css/StylePropertySet.cpp b/third_party/WebKit/Source/core/css/StylePropertySet.cpp index 5bfa3bb..3ddd5523 100644 --- a/third_party/WebKit/Source/core/css/StylePropertySet.cpp +++ b/third_party/WebKit/Source/core/css/StylePropertySet.cpp
@@ -32,7 +32,6 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/properties/CSSPropertyAPI.h" #include "core/frame/UseCounter.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/text/StringBuilder.h" #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp index 8124e362..4b4f9dc0 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -12,12 +12,13 @@ #include "core/css/CSSInheritedValue.h" #include "core/css/CSSInitialValue.h" #include "core/css/CSSPrimitiveValue.h" +#include "core/css/CSSUnsetValue.h" #include "core/css/StyleColor.h" #include "core/css/parser/CSSParserIdioms.h" #include "core/css/parser/CSSPropertyParser.h" #include "core/css/properties/CSSPropertyAPI.h" #include "core/html/parser/HTMLParserIdioms.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/StringToNumber.h" namespace blink { @@ -985,12 +986,13 @@ DCHECK(!string.IsEmpty()); if (!CSSParserFastPaths::IsKeywordPropertyID(property_id)) { - // All properties accept the values of "initial" and "inherit". + // All properties accept the values of "initial," "inherit" and "unset". if (!EqualIgnoringASCIICase(string, "initial") && - !EqualIgnoringASCIICase(string, "inherit")) + !EqualIgnoringASCIICase(string, "inherit") && + !EqualIgnoringASCIICase(string, "unset")) return nullptr; - // Parse initial/inherit shorthands using the CSSPropertyParser. + // Parse initial/inherit/unset shorthands using the CSSPropertyParser. if (shorthandForProperty(property_id).length()) return nullptr; @@ -1008,6 +1010,8 @@ return CSSInheritedValue::Create(); if (value_id == CSSValueInitial) return CSSInitialValue::Create(); + if (value_id == CSSValueUnset) + return CSSUnsetValue::Create(); if (CSSParserFastPaths::IsValidKeywordPropertyAndValue(property_id, value_id, parser_mode)) return CSSIdentifierValue::Create(value_id);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp index d2a96be..eff8239 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPathsTest.cpp
@@ -24,7 +24,8 @@ kHTMLStandardMode); ASSERT_EQ(nullptr, value); } -TEST(CSSParserFastPathsTest, ParseInitialAndInheritKeyword) { + +TEST(CSSParserFastPathsTest, ParseCSSWideKeywords) { CSSValue* value = CSSParserFastPaths::MaybeParseValue( CSSPropertyMarginTop, "inherit", kHTMLStandardMode); ASSERT_NE(nullptr, value); @@ -41,6 +42,14 @@ kHTMLStandardMode); ASSERT_NE(nullptr, value); EXPECT_TRUE(value->IsInitialValue()); + value = CSSParserFastPaths::MaybeParseValue(CSSPropertyMarginTop, "unset", + kHTMLStandardMode); + ASSERT_NE(nullptr, value); + EXPECT_TRUE(value->IsUnsetValue()); + value = CSSParserFastPaths::MaybeParseValue(CSSPropertyMarginLeft, "unsEt", + kHTMLStandardMode); + ASSERT_NE(nullptr, value); + EXPECT_TRUE(value->IsUnsetValue()); // Fast path doesn't handle short hands. value = CSSParserFastPaths::MaybeParseValue(CSSPropertyMargin, "initial", kHTMLStandardMode);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index 06ccc3ae..c958425a 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -18,6 +18,7 @@ #include "core/css/parser/CSSVariableParser.h" #include "core/css/properties/CSSPropertyAPI.h" #include "core/css/properties/CSSPropertyFontUtils.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp index 10050a5a3..b31a226d 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -26,7 +26,7 @@ #include "core/css/properties/CSSPropertyBoxShadowUtils.h" #include "core/css/properties/CSSPropertyTransformUtils.h" #include "core/frame/UseCounter.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp index 01df3c9..f15ba4d 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp
@@ -6,6 +6,7 @@ #include "core/css/CSSValueList.h" #include "core/css/parser/CSSParser.h" +#include "platform/runtime_enabled_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp index 927876f..ce99ae4 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -10,7 +10,7 @@ #include "core/css/parser/CSSParserContext.h" #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp index 2424a35..1b3e68c0 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp
@@ -6,7 +6,6 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp index 017f1be..338a0c9d1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSPropertyAPIAlignOrJustifyContent.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignSelf.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignSelf.cpp index 1c84a230..8133a108 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignSelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignSelf.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSPropertyAPIAlignSelf.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp index 03a0740..71f69881 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp
@@ -5,7 +5,7 @@ #include "core/css/properties/CSSPropertyAPIFontSizeAdjust.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp index e387582..0bf6ac0e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp
@@ -8,7 +8,7 @@ #include "core/css/CSSValueList.h" #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp index cb528e1..bbb426dd 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp
@@ -7,7 +7,6 @@ #include "core/css/CSSIdentifierValue.h" #include "core/css/CSSValueList.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoLine.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoLine.cpp index ad56b05..45833104 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoLine.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoLine.cpp
@@ -5,9 +5,7 @@ #include "core/css/properties/CSSPropertyAPIGridAutoLine.h" #include "core/css/parser/CSSParserContext.h" - #include "core/css/properties/CSSPropertyGridUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridLine.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridLine.cpp index fd0a93708..fa3cba2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridLine.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridLine.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSPropertyAPIGridLine.h" #include "core/css/properties/CSSPropertyGridUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp index 07badd65..ab07d74e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp
@@ -11,7 +11,6 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyGridUtils.h" #include "core/style/GridArea.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateLine.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateLine.cpp index db0500f..3dfbcca 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateLine.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateLine.cpp
@@ -6,7 +6,6 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/properties/CSSPropertyGridUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp index 55c7e91..44f02a82 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp
@@ -7,7 +7,7 @@ #include "core/CSSValueKeywords.h" #include "core/css/CSSPrimitiveValue.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp index ebce885..09ff0f4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp
@@ -7,7 +7,6 @@ #include "core/css/CSSValuePair.h" #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifySelf.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifySelf.cpp index 557eb68..1b693a23 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifySelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifySelf.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSPropertyAPIJustifySelf.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp index f635ac6..f045bed 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp
@@ -7,7 +7,7 @@ #include "core/CSSValueKeywords.h" #include "core/css/CSSValueList.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp index b1b450d..d3fc3137 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp
@@ -6,7 +6,7 @@ #include "core/css/CSSValueList.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp index 0963a479..2f54fa74 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp
@@ -6,7 +6,6 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp index 502f25d..b8506179 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp
@@ -7,7 +7,6 @@ #include "core/css/CSSIdentifierValue.h" #include "core/css/CSSValueList.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp index f21e601..4926eb10 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp
@@ -7,7 +7,7 @@ #include "core/css/CSSValueList.h" #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp index 8c559c3d..8f094e1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSPropertyAPITextUnderlinePosition.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp index dccd9b3..a9eabd3e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp
@@ -6,7 +6,6 @@ #include "core/css/CSSValueList.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVariable.h b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVariable.h index 7c310b6..7609428 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVariable.h +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVariable.h
@@ -12,6 +12,7 @@ class CSSPropertyAPIVariable : public CSSPropertyAPI { public: bool IsInherited() const override { return true; } + bool IsAffectedByAll() const override { return false; } }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAnimationTimingFunctionUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAnimationTimingFunctionUtils.cpp index 57961c2..86c9fee4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAnimationTimingFunctionUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAnimationTimingFunctionUtils.cpp
@@ -6,7 +6,7 @@ #include "core/css/CSSTimingFunctionValue.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyBackgroundUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyBackgroundUtils.cpp index 1940bddd..b35e540c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyBackgroundUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyBackgroundUtils.cpp
@@ -10,7 +10,7 @@ #include "core/css/CSSValuePair.h" #include "core/css/parser/CSSParserTokenRange.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyGridUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyGridUtils.cpp index aaa2a41..daa4b8b0 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyGridUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyGridUtils.cpp
@@ -13,7 +13,6 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserIdioms.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp index 9de08fd..bfdc5f6 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp
@@ -12,7 +12,7 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathUtilities.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp index 6ea9a829..7c556b5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp
@@ -9,7 +9,6 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyGridUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp index 3e54e9f..1667bc03 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp
@@ -7,7 +7,6 @@ #include "core/StylePropertyShorthand.h" #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyGridUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp index 76c06cd..0447c72 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp
@@ -7,7 +7,6 @@ #include "core/StylePropertyShorthand.h" #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp index 9d199fa..099db15 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp
@@ -10,7 +10,7 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyOffsetPathUtils.h" #include "core/css/properties/CSSPropertyOffsetRotateUtils.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp index 320c467..231d85f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp
@@ -8,7 +8,6 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" #include "core/css/properties/CSSPropertyPlaceUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp index ce5a1a181..bd7a5fd 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp
@@ -8,7 +8,6 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" #include "core/css/properties/CSSPropertyPlaceUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp index ae58633..b606b09d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp
@@ -8,7 +8,6 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" #include "core/css/properties/CSSPropertyPlaceUtils.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp index af68d52..7bd76f4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp
@@ -5,7 +5,6 @@ #include "core/css/properties/CSSShorthandPropertyAPITextDecoration.h" #include "core/StylePropertyShorthand.h" #include "core/css/parser/CSSPropertyParserHelpers.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index 84107ee..86af14e3 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -91,7 +91,7 @@ #include "core/probe/CoreProbes.h" #include "core/style/StyleInheritedVariables.h" #include "core/svg/SVGElement.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/StdLibExtras.h" namespace blink { @@ -1492,7 +1492,8 @@ // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand // We skip applyProperty when a given property is unicode-bidi or // direction. - if (!CSSProperty::IsAffectedByAllProperty(property_id)) + if (!CSSPropertyAPI::Get(resolveCSSPropertyID(property_id)) + .IsAffectedByAll()) continue; if (!IsPropertyInWhitelist(property_whitelist_type, property_id,
diff --git a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp index 49abf1d6..7f7ed13 100644 --- a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp +++ b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
@@ -9,7 +9,7 @@ #include "core/dom/Element.h" #include "core/dom/QualifiedName.h" #include "core/frame/Settings.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp b/third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp index 8ca72a3..a48c025 100644 --- a/third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp +++ b/third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp
@@ -5,7 +5,7 @@ #include "core/dom/AccessibleNodeList.h" #include "core/dom/AccessibleNode.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp index b0c8962..293f8f6 100644 --- a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp +++ b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp
@@ -29,7 +29,6 @@ #include <memory> #include "core/dom/Document.h" #include "core/page/Page.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index a6b2ece..572d9f2 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -227,7 +227,6 @@ #include "platform/Language.h" #include "platform/LengthFunctions.h" #include "platform/PluginScriptForbiddenScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebFrameScheduler.h" #include "platform/bindings/DOMDataStore.h" @@ -239,6 +238,7 @@ #include "platform/network/ContentSecurityPolicyParsers.h" #include "platform/network/HTTPParsers.h" #include "platform/network/NetworkStateNotifier.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/text/PlatformLocale.h"
diff --git a/third_party/WebKit/Source/core/dom/DocumentInit.cpp b/third_party/WebKit/Source/core/dom/DocumentInit.cpp index 39882316..a5c3240 100644 --- a/third_party/WebKit/Source/core/dom/DocumentInit.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentInit.cpp
@@ -35,7 +35,6 @@ #include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html/imports/HTMLImportsController.h" #include "core/loader/DocumentLoader.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/network/NetworkUtils.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp index e62d9174..d1ea26a 100644 --- a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp
@@ -30,7 +30,7 @@ #include "core/dom/DocumentLifecycle.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #if DCHECK_IS_ON()
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index dbb96ac..3fa5a02 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -80,6 +80,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/serializers/Serialization.h" #include "core/events/FocusEvent.h" @@ -136,12 +137,12 @@ #include "core/svg/SVGElement.h" #include "core/svg/SVGTreeScopeResources.h" #include "platform/EventDispatchForbiddenScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/DOMDataStore.h" #include "platform/bindings/V8DOMWrapper.h" #include "platform/bindings/V8PerContextData.h" #include "platform/graphics/CompositorMutableProperties.h" #include "platform/graphics/CompositorMutation.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollableArea.h" #include "platform/scroll/SmoothScrollSequencer.h" #include "platform/wtf/BitVector.h"
diff --git a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp index 3815025..cf61d7fa 100644 --- a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
@@ -41,7 +41,6 @@ #include "core/layout/LayoutText.h" #include "core/layout/LayoutView.h" #include "core/svg/SVGElement.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 8caa2f3b..9adaa0a 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -98,13 +98,13 @@ #include "core/svg/graphics/SVGImage.h" #include "platform/EventDispatchForbiddenScope.h" #include "platform/InstanceCounters.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/DOMDataStore.h" #include "platform/bindings/Microtask.h" #include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/V8DOMWrapper.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/instrumentation/tracing/TracedValue.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/Vector.h" #include "platform/wtf/allocator/Partitions.h"
diff --git a/third_party/WebKit/Source/core/dom/SandboxFlags.cpp b/third_party/WebKit/Source/core/dom/SandboxFlags.cpp index a9fa78c..c8683e4 100644 --- a/third_party/WebKit/Source/core/dom/SandboxFlags.cpp +++ b/third_party/WebKit/Source/core/dom/SandboxFlags.cpp
@@ -28,7 +28,7 @@ #include "core/html/HTMLIFrameElement.h" #include "core/html/parser/HTMLParserIdioms.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/text/StringBuilder.h" #include "public/web/WebSandboxFlags.h"
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp index 56a73383..5047e3a6 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -30,8 +30,8 @@ #include "core/dom/Document.h" #include "core/dom/ScriptLoader.h" #include "core/dom/TaskRunnerHelper.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "public/platform/Platform.h" #include "public/platform/WebThread.h"
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp index 04696fb..38dc4cd8 100644 --- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp +++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
@@ -27,7 +27,7 @@ #include "core/dom/SecurityContext.h" #include "core/frame/csp/ContentSecurityPolicy.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/core/dom/events/EventTarget.cpp b/third_party/WebKit/Source/core/dom/events/EventTarget.cpp index 65a99a78..1555d1ff 100644 --- a/third_party/WebKit/Source/core/dom/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/dom/events/EventTarget.cpp
@@ -458,15 +458,7 @@ const AtomicString& event_type, const RegisteredEventListener& registered_listener) {} -bool EventTarget::SetAttributeEventListener(const AtomicString& event_type, - EventListener* listener) { - ClearAttributeEventListener(event_type); - if (!listener) - return false; - return addEventListener(event_type, listener, false); -} - -EventListener* EventTarget::GetAttributeEventListener( +RegisteredEventListener* EventTarget::GetAttributeRegisteredEventListener( const AtomicString& event_type) { EventListenerVector* listener_vector = GetEventListeners(event_type); if (!listener_vector) @@ -476,16 +468,34 @@ EventListener* listener = event_listener.Listener(); if (listener->IsAttribute() && listener->BelongsToTheCurrentWorld(GetExecutionContext())) - return listener; + return &event_listener; } return nullptr; } -bool EventTarget::ClearAttributeEventListener(const AtomicString& event_type) { - EventListener* listener = GetAttributeEventListener(event_type); - if (!listener) +bool EventTarget::SetAttributeEventListener(const AtomicString& event_type, + EventListener* listener) { + RegisteredEventListener* registered_listener = + GetAttributeRegisteredEventListener(event_type); + if (!listener) { + if (registered_listener) + removeEventListener(event_type, registered_listener->Listener(), false); return false; - return removeEventListener(event_type, listener, false); + } + if (registered_listener) { + registered_listener->SetListener(listener); + return true; + } + return addEventListener(event_type, listener, false); +} + +EventListener* EventTarget::GetAttributeEventListener( + const AtomicString& event_type) { + RegisteredEventListener* registered_listener = + GetAttributeRegisteredEventListener(event_type); + if (registered_listener) + return registered_listener->Listener(); + return nullptr; } bool EventTarget::dispatchEventForBindings(Event* event,
diff --git a/third_party/WebKit/Source/core/dom/events/EventTarget.h b/third_party/WebKit/Source/core/dom/events/EventTarget.h index b092fb37..436a2c7 100644 --- a/third_party/WebKit/Source/core/dom/events/EventTarget.h +++ b/third_party/WebKit/Source/core/dom/events/EventTarget.h
@@ -212,13 +212,14 @@ EventListener*, AddEventListenerOptionsResolved&); + RegisteredEventListener* GetAttributeRegisteredEventListener( + const AtomicString& event_type); + bool FireEventListeners(Event*, EventTargetData*, EventListenerVector&); void CountLegacyEvents(const AtomicString& legacy_type_name, EventListenerVector*, EventListenerVector*); - bool ClearAttributeEventListener(const AtomicString& event_type); - friend class EventListenerIterator; };
diff --git a/third_party/WebKit/Source/core/editing/BUILD.gn b/third_party/WebKit/Source/core/editing/BUILD.gn index 81dde9a..ff1512a 100644 --- a/third_party/WebKit/Source/core/editing/BUILD.gn +++ b/third_party/WebKit/Source/core/editing/BUILD.gn
@@ -32,6 +32,7 @@ "EphemeralRange.h", "FindInPageCoordinates.cpp", "FindInPageCoordinates.h", + "Forward.h", "FrameCaret.cpp", "FrameCaret.h", "FrameSelection.cpp",
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp index 47e24dce..4902ca9 100644 --- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp +++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -40,6 +40,7 @@ #include "core/editing/FrameSelection.h" #include "core/editing/SelectionModifier.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/iterators/TextIterator.h" #include "core/frame/Deprecation.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.h b/third_party/WebKit/Source/core/editing/DOMSelection.h index 42f77c4..186e3b3 100644 --- a/third_party/WebKit/Source/core/editing/DOMSelection.h +++ b/third_party/WebKit/Source/core/editing/DOMSelection.h
@@ -31,8 +31,9 @@ #define DOMSelection_h #include "core/dom/ContextLifecycleObserver.h" +#include "core/editing/Forward.h" #include "core/editing/Position.h" -#include "core/editing/VisibleSelection.h" +#include "core/editing/SelectionTemplate.h" #include "platform/bindings/ScriptWrappable.h" #include "platform/heap/Handle.h" #include "platform/wtf/Forward.h"
diff --git a/third_party/WebKit/Source/core/editing/DragCaret.cpp b/third_party/WebKit/Source/core/editing/DragCaret.cpp index 41a5739..93a18a1 100644 --- a/third_party/WebKit/Source/core/editing/DragCaret.cpp +++ b/third_party/WebKit/Source/core/editing/DragCaret.cpp
@@ -27,6 +27,7 @@ #include "core/editing/CaretDisplayItemClient.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/frame/Settings.h" #include "core/layout/api/LayoutViewItem.h" #include "core/paint/PaintLayer.h"
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp index b770246..aa98f74 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp +++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -54,6 +54,7 @@ #include "core/editing/Editor.h" #include "core/editing/FrameSelection.h" #include "core/editing/Position.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/commands/ApplyStyleCommand.h" #include "core/editing/serializers/HTMLInterchange.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.h b/third_party/WebKit/Source/core/editing/EditingStyle.h index 4c791d671..9ddb416c3 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyle.h +++ b/third_party/WebKit/Source/core/editing/EditingStyle.h
@@ -35,8 +35,8 @@ #include "core/CSSPropertyNames.h" #include "core/CSSValueKeywords.h" #include "core/CoreExport.h" +#include "core/editing/Forward.h" #include "core/editing/Position.h" -#include "core/editing/VisibleSelection.h" #include "core/editing/WritingDirection.h" #include "platform/heap/Handle.h" #include "platform/wtf/Forward.h"
diff --git a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp index d5d633a..62f519a 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp +++ b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp
@@ -34,6 +34,8 @@ #include "core/css/parser/CSSParser.h" #include "core/editing/EditingStyle.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.h b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.h index 204c6ff..9ceade99 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.h +++ b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.h
@@ -33,7 +33,10 @@ #define EditingStyleUtilities_h #include "core/CSSValueKeywords.h" -#include "core/editing/VisibleSelection.h" +#include "core/css/CSSValue.h" +#include "core/dom/ContainerNode.h" +#include "core/editing/Forward.h" +#include "platform/wtf/Allocator.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.h b/third_party/WebKit/Source/core/editing/EditingUtilities.h index a03b21df..7f696d2 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilities.h +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.h
@@ -29,10 +29,10 @@ #include "core/CoreExport.h" #include "core/editing/EditingBoundary.h" #include "core/editing/EphemeralRange.h" +#include "core/editing/Forward.h" #include "core/editing/Position.h" #include "core/editing/PositionWithAffinity.h" -#include "core/editing/VisiblePosition.h" -#include "core/editing/VisibleSelection.h" +#include "core/editing/TextGranularity.h" #include "core/events/InputEvent.h" #include "platform/text/TextDirection.h" #include "platform/wtf/Forward.h"
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp b/third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp index 4db7fd6..3c8f8356 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp +++ b/third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp
@@ -6,6 +6,7 @@ #include "core/dom/StaticNodeList.h" #include "core/editing/EditingTestBase.h" +#include "core/editing/VisiblePosition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 2b4ef18..3c6066c 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -48,6 +48,7 @@ #include "core/editing/InputMethodController.h" #include "core/editing/RenderedPosition.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/ApplyStyleCommand.h" #include "core/editing/commands/DeleteSelectionCommand.h"
diff --git a/third_party/WebKit/Source/core/editing/Forward.h b/third_party/WebKit/Source/core/editing/Forward.h new file mode 100644 index 0000000..5ebccd73 --- /dev/null +++ b/third_party/WebKit/Source/core/editing/Forward.h
@@ -0,0 +1,35 @@ +// 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. + +// This file contains forward declarations of template classes in editing/ + +namespace blink { + +class NodeTraversal; +class FlatTreeTraversal; + +template <typename Traversal> +class EditingAlgorithm; +using EditingStrategy = EditingAlgorithm<NodeTraversal>; +using EditingInFlatTreeStrategy = EditingAlgorithm<FlatTreeTraversal>; + +// TODO(editing-dev): Add forward declaration of +// - PositionTemplate +// - PositionWithAffinityTemplate +// - EphemeralRangeTemplate +// - SelectionTemplate + +template <typename Strategy> +class VisiblePositionTemplate; +using VisiblePosition = VisiblePositionTemplate<EditingStrategy>; +using VisiblePositionInFlatTree = + VisiblePositionTemplate<EditingInFlatTreeStrategy>; + +template <typename Strategy> +class VisibleSelectionTemplate; +using VisibleSelection = VisibleSelectionTemplate<EditingStrategy>; +using VisibleSelectionInFlatTree = + VisibleSelectionTemplate<EditingInFlatTreeStrategy>; + +}; // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.cpp b/third_party/WebKit/Source/core/editing/FrameCaret.cpp index ccc02d88..31d7b5e 100644 --- a/third_party/WebKit/Source/core/editing/FrameCaret.cpp +++ b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
@@ -30,6 +30,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/SelectionEditor.h" +#include "core/editing/VisiblePosition.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" #include "core/frame/Settings.h"
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp index f65402d..4a49aae 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -49,6 +49,8 @@ #include "core/editing/SelectionEditor.h" #include "core/editing/SelectionModifier.h" #include "core/editing/TextAffinity.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/TypingCommand.h" #include "core/editing/iterators/TextIterator.h" @@ -903,6 +905,8 @@ if (!view) return LayoutRect(); + // TODO(pdr): Should this be the VisualViewport's VisibleRectInDocument + // instead of VisibleContentRect to include the viewport pan-zoom offset? return Intersection(UnclippedBounds(), LayoutRect(view->VisibleContentRect())); }
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h index 201f3987..b4cbe35 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.h +++ b/third_party/WebKit/Source/core/editing/FrameSelection.h
@@ -31,9 +31,9 @@ #include "core/CoreExport.h" #include "core/dom/SynchronousMutationObserver.h" #include "core/editing/EphemeralRange.h" +#include "core/editing/Forward.h" +#include "core/editing/SelectionTemplate.h" #include "core/editing/SetSelectionOptions.h" -#include "core/editing/VisiblePosition.h" -#include "core/editing/VisibleSelection.h" #include "core/layout/ScrollAlignment.h" #include "platform/geometry/IntRect.h" #include "platform/geometry/LayoutRect.h"
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp index d88b372..9afaf03d 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -13,6 +13,7 @@ #include "core/editing/FrameCaret.h" #include "core/editing/SelectionController.h" #include "core/editing/SelectionModifier.h" +#include "core/editing/VisiblePosition.h" #include "core/frame/LocalFrameView.h" #include "core/html/HTMLBodyElement.h" #include "core/input/EventHandler.h"
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp index 98b560d..9ee2047 100644 --- a/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp +++ b/third_party/WebKit/Source/core/editing/GranularityStrategy.cpp
@@ -6,6 +6,9 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" +#include "core/editing/VisibleUnits.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp index 2521b00..4e9dc9b 100644 --- a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp +++ b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
@@ -8,6 +8,8 @@ #include "core/dom/Element.h" #include "core/dom/Text.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/frame/LocalFrameView.h" #include "core/frame/Settings.h" #include "core/html/HTMLBodyElement.h"
diff --git a/third_party/WebKit/Source/core/editing/ImeTextSpan.cpp b/third_party/WebKit/Source/core/editing/ImeTextSpan.cpp index e01f799..6938822 100644 --- a/third_party/WebKit/Source/core/editing/ImeTextSpan.cpp +++ b/third_party/WebKit/Source/core/editing/ImeTextSpan.cpp
@@ -48,6 +48,8 @@ return ImeTextSpan::Type::kComposition; case WebImeTextSpan::Type::kSuggestion: return ImeTextSpan::Type::kSuggestion; + case WebImeTextSpan::Type::kMisspellingSuggestion: + return ImeTextSpan::Type::kMisspellingSuggestion; } NOTREACHED();
diff --git a/third_party/WebKit/Source/core/editing/ImeTextSpan.h b/third_party/WebKit/Source/core/editing/ImeTextSpan.h index 1ee97f3c..9f96087 100644 --- a/third_party/WebKit/Source/core/editing/ImeTextSpan.h +++ b/third_party/WebKit/Source/core/editing/ImeTextSpan.h
@@ -40,7 +40,7 @@ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); public: - enum class Type { kComposition, kSuggestion }; + enum class Type { kComposition, kSuggestion, kMisspellingSuggestion }; ImeTextSpan(Type, unsigned start_offset,
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.h b/third_party/WebKit/Source/core/editing/LayoutSelection.h index 70f9940..5e23005 100644 --- a/third_party/WebKit/Source/core/editing/LayoutSelection.h +++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h
@@ -22,8 +22,8 @@ #ifndef LayoutSelection_h #define LayoutSelection_h +#include "core/editing/Forward.h" #include "core/editing/Position.h" -#include "core/editing/VisibleSelection.h" #include "platform/heap/Handle.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/RenderedPosition.h b/third_party/WebKit/Source/core/editing/RenderedPosition.h index 60a1533..8fa0368c 100644 --- a/third_party/WebKit/Source/core/editing/RenderedPosition.h +++ b/third_party/WebKit/Source/core/editing/RenderedPosition.h
@@ -32,7 +32,8 @@ #define RenderedPosition_h #include "core/CoreExport.h" -#include "core/editing/VisiblePosition.h" +#include "core/editing/Forward.h" +#include "core/editing/TextAffinity.h" #include "core/layout/line/InlineBox.h" #include "platform/wtf/Allocator.h"
diff --git a/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp b/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp index 3b5bb31..4320644 100644 --- a/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp +++ b/third_party/WebKit/Source/core/editing/RenderedPositionTest.cpp
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "core/css/CSSStyleDeclaration.h" #include "core/editing/EditingTestBase.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/SelectionAdjuster.h b/third_party/WebKit/Source/core/editing/SelectionAdjuster.h index 836b83c..35ffe53b 100644 --- a/third_party/WebKit/Source/core/editing/SelectionAdjuster.h +++ b/third_party/WebKit/Source/core/editing/SelectionAdjuster.h
@@ -5,7 +5,7 @@ #ifndef SelectionAdjuster_h #define SelectionAdjuster_h -#include "core/editing/VisibleSelection.h" +#include "core/editing/EphemeralRange.h" #include "platform/wtf/Allocator.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp index dfe85f87..828ba2a 100644 --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -38,6 +38,7 @@ #include "core/editing/FrameSelection.h" #include "core/editing/RenderedPosition.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleSelection.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/markers/DocumentMarkerController.h" @@ -50,7 +51,6 @@ #include "core/layout/api/LayoutViewItem.h" #include "core/page/FocusController.h" #include "core/page/Page.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/AutoReset.h" #include "public/platform/WebMenuSourceType.h"
diff --git a/third_party/WebKit/Source/core/editing/SelectionControllerTest.cpp b/third_party/WebKit/Source/core/editing/SelectionControllerTest.cpp index cca3ffc..2bc90dd 100644 --- a/third_party/WebKit/Source/core/editing/SelectionControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionControllerTest.cpp
@@ -6,6 +6,7 @@ #include "core/editing/EditingTestBase.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleSelection.h" #include "core/frame/LocalFrameView.h" #include "core/frame/Settings.h" #include "core/input/EventHandler.h"
diff --git a/third_party/WebKit/Source/core/editing/SelectionEditor.h b/third_party/WebKit/Source/core/editing/SelectionEditor.h index da262d6..f9cd698 100644 --- a/third_party/WebKit/Source/core/editing/SelectionEditor.h +++ b/third_party/WebKit/Source/core/editing/SelectionEditor.h
@@ -31,6 +31,7 @@ #include "core/dom/events/EventDispatchResult.h" #include "core/editing/FrameSelection.h" #include "core/editing/SelectionTemplate.h" +#include "core/editing/VisibleSelection.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp index 593e8bd..811b339 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp
@@ -28,6 +28,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/Editor.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h"
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifierCharacter.cpp b/third_party/WebKit/Source/core/editing/SelectionModifierCharacter.cpp index 71cc532..c9e6e398 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifierCharacter.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifierCharacter.cpp
@@ -32,6 +32,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/InlineBoxTraversal.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/layout/api/LineLayoutAPIShim.h" #include "core/layout/api/LineLayoutItem.h"
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifierTest.cpp b/third_party/WebKit/Source/core/editing/SelectionModifierTest.cpp index 89ed37d..d5d36713 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifierTest.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifierTest.cpp
@@ -5,6 +5,7 @@ #include "core/editing/SelectionModifier.h" #include "core/editing/EditingTestBase.h" +#include "core/editing/VisiblePosition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifierWord.cpp b/third_party/WebKit/Source/core/editing/SelectionModifierWord.cpp index 9ed2c28..a535edb 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifierWord.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifierWord.cpp
@@ -27,6 +27,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/RenderedPosition.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/layout/line/InlineTextBox.h" #include "core/layout/line/RootInlineBox.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp index 7a39a3ab..2c9c265 100644 --- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -31,6 +31,7 @@ #include "core/dom/Range.h" #include "core/editing/EditingUtilities.h" #include "core/editing/SelectionAdjuster.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/iterators/CharacterIterator.h" #include "platform/geometry/LayoutPoint.h" #include "platform/wtf/Assertions.h" @@ -830,6 +831,38 @@ } template <typename Strategy> +VisiblePositionTemplate<Strategy> +VisibleSelectionTemplate<Strategy>::VisibleStart() const { + return CreateVisiblePosition( + Start(), IsRange() ? TextAffinity::kDownstream : Affinity()); +} + +template <typename Strategy> +VisiblePositionTemplate<Strategy> +VisibleSelectionTemplate<Strategy>::VisibleEnd() const { + return CreateVisiblePosition( + End(), IsRange() ? TextAffinity::kUpstream : Affinity()); +} + +template <typename Strategy> +VisiblePositionTemplate<Strategy> +VisibleSelectionTemplate<Strategy>::VisibleBase() const { + return CreateVisiblePosition( + base_, IsRange() ? (IsBaseFirst() ? TextAffinity::kUpstream + : TextAffinity::kDownstream) + : Affinity()); +} + +template <typename Strategy> +VisiblePositionTemplate<Strategy> +VisibleSelectionTemplate<Strategy>::VisibleExtent() const { + return CreateVisiblePosition( + extent_, IsRange() ? (IsBaseFirst() ? TextAffinity::kDownstream + : TextAffinity::kUpstream) + : Affinity()); +} + +template <typename Strategy> DEFINE_TRACE(VisibleSelectionTemplate<Strategy>) { visitor->Trace(base_); visitor->Trace(extent_);
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.h b/third_party/WebKit/Source/core/editing/VisibleSelection.h index 694480b..b597d510 100644 --- a/third_party/WebKit/Source/core/editing/VisibleSelection.h +++ b/third_party/WebKit/Source/core/editing/VisibleSelection.h
@@ -29,11 +29,11 @@ #include "core/CoreExport.h" #include "core/editing/EditingStrategy.h" #include "core/editing/EphemeralRange.h" +#include "core/editing/Forward.h" #include "core/editing/SelectionTemplate.h" #include "core/editing/SelectionType.h" #include "core/editing/TextAffinity.h" #include "core/editing/TextGranularity.h" -#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "platform/wtf/Allocator.h" @@ -69,26 +69,10 @@ PositionTemplate<Strategy> Start() const; PositionTemplate<Strategy> End() const; - VisiblePositionTemplate<Strategy> VisibleStart() const { - return CreateVisiblePosition( - Start(), IsRange() ? TextAffinity::kDownstream : Affinity()); - } - VisiblePositionTemplate<Strategy> VisibleEnd() const { - return CreateVisiblePosition( - End(), IsRange() ? TextAffinity::kUpstream : Affinity()); - } - VisiblePositionTemplate<Strategy> VisibleBase() const { - return CreateVisiblePosition( - base_, IsRange() ? (IsBaseFirst() ? TextAffinity::kUpstream - : TextAffinity::kDownstream) - : Affinity()); - } - VisiblePositionTemplate<Strategy> VisibleExtent() const { - return CreateVisiblePosition( - extent_, IsRange() ? (IsBaseFirst() ? TextAffinity::kDownstream - : TextAffinity::kUpstream) - : Affinity()); - } + VisiblePositionTemplate<Strategy> VisibleStart() const; + VisiblePositionTemplate<Strategy> VisibleEnd() const; + VisiblePositionTemplate<Strategy> VisibleBase() const; + VisiblePositionTemplate<Strategy> VisibleExtent() const; bool operator==(const VisibleSelectionTemplate&) const; bool operator!=(const VisibleSelectionTemplate& other) const {
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp index 7e51ab3..cb42047 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -40,6 +40,7 @@ #include "core/editing/RenderedPosition.h" #include "core/editing/TextAffinity.h" #include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/iterators/BackwardsCharacterIterator.h" #include "core/editing/iterators/BackwardsTextBuffer.h" #include "core/editing/iterators/CharacterIterator.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.h b/third_party/WebKit/Source/core/editing/VisibleUnits.h index de97d1d..ed210290 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnits.h +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.h
@@ -29,8 +29,8 @@ #include "core/CoreExport.h" #include "core/editing/EditingBoundary.h" #include "core/editing/EphemeralRange.h" +#include "core/editing/Forward.h" #include "core/editing/PositionWithAffinity.h" -#include "core/editing/VisiblePosition.h" #include "platform/text/TextDirection.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp index 0c90856..d254cbf 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
@@ -32,6 +32,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/RenderedPosition.h" +#include "core/editing/VisiblePosition.h" #include "core/layout/api/LineLayoutBlockFlow.h" #include "core/layout/line/InlineTextBox.h" #include "core/layout/line/RootInlineBox.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsParagraph.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsParagraph.cpp index 9eb57a8..530a760 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsParagraph.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsParagraph.cpp
@@ -31,6 +31,7 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/layout/LayoutText.h" #include "core/layout/api/LayoutItem.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsSentence.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsSentence.cpp index 3a9d0bce..24d544b5 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsSentence.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsSentence.cpp
@@ -30,6 +30,7 @@ #include "core/editing/VisibleUnits.h" +#include "core/editing/VisiblePosition.h" #include "platform/text/TextBreakIterator.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsWord.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsWord.cpp index 8267257..15ccf9a 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsWord.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsWord.cpp
@@ -31,6 +31,7 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/iterators/BackwardsCharacterIterator.h" #include "core/editing/iterators/BackwardsTextBuffer.h" #include "core/editing/iterators/CharacterIterator.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp index 751075e..76a1019 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp
@@ -5,6 +5,7 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/EditingTestBase.h" +#include "core/editing/VisiblePosition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/WebSubstringUtil.mm b/third_party/WebKit/Source/core/editing/WebSubstringUtil.mm index 0f229179..e2fd1ad 100644 --- a/third_party/WebKit/Source/core/editing/WebSubstringUtil.mm +++ b/third_party/WebKit/Source/core/editing/WebSubstringUtil.mm
@@ -39,6 +39,7 @@ #include "core/dom/Node.h" #include "core/editing/FrameSelection.h" #include "core/editing/PlainTextRange.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/iterators/TextIterator.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp index e81ba839..1ee99b1 100644 --- a/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp
@@ -32,6 +32,7 @@ #include "core/dom/Text.h" #include "core/editing/EditingUtilities.h" #include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/html/HTMLBRElement.h" #include "core/html/HTMLElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp index 26017f3..2ac0092 100644 --- a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
@@ -40,6 +40,8 @@ #include "core/editing/EditingStyleUtilities.h" #include "core/editing/EditingUtilities.h" #include "core/editing/PlainTextRange.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/serializers/HTMLInterchange.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp b/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp index 1de611ac..042d3cc 100644 --- a/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp
@@ -30,6 +30,8 @@ #include "core/dom/Text.h" #include "core/editing/EditingUtilities.h" #include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" +#include "core/editing/VisibleUnits.h" #include "core/html/HTMLBRElement.h" #include "core/html/HTMLElement.h" #include "core/html/HTMLQuoteElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp index 8db7690..3252fdd 100644 --- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -39,6 +39,8 @@ #include "core/editing/Editor.h" #include "core/editing/PlainTextRange.h" #include "core/editing/RelocatablePosition.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/AppendNodeCommand.h" #include "core/editing/commands/ApplyStyleCommand.h" @@ -1218,6 +1220,10 @@ // Deleting a paragraph will leave a placeholder. Remove it (and prune // empty or unrendered parents). +void CompositeEditCommand::CleanupAfterDeletion(EditingState* editing_state) { + CleanupAfterDeletion(editing_state, VisiblePosition()); +} + void CompositeEditCommand::CleanupAfterDeletion(EditingState* editing_state, VisiblePosition destination) { GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h index 625861f4..2617a70 100644 --- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h
@@ -28,7 +28,7 @@ #include "core/CSSPropertyNames.h" #include "core/CoreExport.h" -#include "core/editing/VisibleSelection.h" +#include "core/editing/Forward.h" #include "core/editing/commands/EditCommand.h" #include "core/editing/commands/EditingState.h" #include "core/editing/commands/UndoStep.h" @@ -214,8 +214,8 @@ Node* outer_node, Element* block_element, EditingState*); - void CleanupAfterDeletion(EditingState*, - VisiblePosition destination = VisiblePosition()); + void CleanupAfterDeletion(EditingState*, VisiblePosition destination); + void CleanupAfterDeletion(EditingState*); bool BreakOutOfEmptyListItem(EditingState*); bool BreakOutOfEmptyMailBlockquotedParagraph(EditingState*);
diff --git a/third_party/WebKit/Source/core/editing/commands/CreateLinkCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CreateLinkCommand.cpp index 3c61262..2c5b5ef 100644 --- a/third_party/WebKit/Source/core/editing/commands/CreateLinkCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/CreateLinkCommand.cpp
@@ -26,6 +26,7 @@ #include "core/editing/commands/CreateLinkCommand.h" #include "core/dom/Text.h" +#include "core/editing/VisibleSelection.h" #include "core/html/HTMLAnchorElement.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp index bcfac36..1f04c5db 100644 --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -34,6 +34,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/Editor.h" #include "core/editing/RelocatablePosition.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLBRElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h index 03e65841..bff0a63 100644 --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h
@@ -26,6 +26,7 @@ #ifndef DeleteSelectionCommand_h #define DeleteSelectionCommand_h +#include "core/editing/VisibleSelection.h" #include "core/editing/commands/CompositeEditCommand.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp index bdaca0d..414bbad 100644 --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -45,6 +45,7 @@ #include "core/editing/FrameSelection.h" #include "core/editing/SelectionModifier.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/commands/CreateLinkCommand.h" #include "core/editing/commands/EditorCommandNames.h" #include "core/editing/commands/FormatBlockCommand.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp index 434f829..438335e 100644 --- a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
@@ -30,6 +30,7 @@ #include "core/dom/Element.h" #include "core/dom/Range.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/html/HTMLBRElement.h" #include "core/html/HTMLElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.h b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.h index dddb236..69e41eda 100644 --- a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.h
@@ -28,8 +28,8 @@ #include "core/dom/QualifiedName.h" #include "core/editing/EphemeralRange.h" +#include "core/editing/Forward.h" #include "core/editing/Position.h" -#include "core/editing/VisiblePosition.h" #include "core/editing/commands/ApplyBlockElementCommand.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp b/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp index fdb78248..7ba09b03 100644 --- a/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp
@@ -29,6 +29,8 @@ #include "core/dom/Document.h" #include "core/dom/ElementTraversal.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/InsertListCommand.h" #include "core/html/HTMLBRElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp index 407c5831..58809014 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -31,6 +31,8 @@ #include "core/dom/Element.h" #include "core/dom/ElementTraversal.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/iterators/TextIterator.h" #include "core/html/HTMLBRElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp index 3004a82..843b12f7 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
@@ -31,6 +31,8 @@ #include "core/dom/Text.h" #include "core/editing/EditingStyle.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/InsertLineBreakCommand.h" #include "core/html/HTMLBRElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp index 3665c3b..efe5baa 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
@@ -30,6 +30,7 @@ #include "core/dom/Text.h" #include "core/editing/EditingUtilities.h" #include "core/editing/Editor.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLSpanElement.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/RemoveFormatCommand.cpp b/third_party/WebKit/Source/core/editing/commands/RemoveFormatCommand.cpp index 7461479bd..256fa315 100644 --- a/third_party/WebKit/Source/core/editing/commands/RemoveFormatCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/RemoveFormatCommand.cpp
@@ -33,6 +33,7 @@ #include "core/dom/Element.h" #include "core/editing/EditingStyle.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/commands/ApplyStyleCommand.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp index ac20eb7..68ff95f 100644 --- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -39,6 +39,7 @@ #include "core/editing/EditingStyle.h" #include "core/editing/EditingUtilities.h" #include "core/editing/Editor.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/ApplyStyleCommand.h" #include "core/editing/commands/BreakBlockquoteCommand.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.cpp b/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.cpp index 5dd84a8..4ee5e37 100644 --- a/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.cpp +++ b/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.cpp
@@ -6,6 +6,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/TextAffinity.h" +#include "core/editing/VisibleSelection.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.h b/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.h index d7e0314..97c3de4 100644 --- a/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.h +++ b/third_party/WebKit/Source/core/editing/commands/SelectionForUndoStep.h
@@ -6,11 +6,10 @@ #define SelectionForUndoStep_h #include "base/macros.h" +#include "core/editing/Forward.h" #include "core/editing/Position.h" #include "core/editing/SelectionTemplate.h" #include "core/editing/TextAffinity.h" -#include "core/editing/VisiblePosition.h" -#include "core/editing/VisibleSelection.h" #include "platform/heap/Handle.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp index a8d11a2..7a1a920f 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -35,6 +35,7 @@ #include "core/editing/PlainTextRange.h" #include "core/editing/SelectionModifier.h" #include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/BreakBlockquoteCommand.h" #include "core/editing/commands/DeleteSelectionCommand.h"
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h index e9037230..54a4fd8e 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
@@ -26,6 +26,7 @@ #ifndef TypingCommand_h #define TypingCommand_h +#include "core/editing/TextGranularity.h" #include "core/editing/commands/CompositeEditCommand.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp index 500e8c02..cc91d16 100644 --- a/third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp +++ b/third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp
@@ -29,6 +29,7 @@ #include "core/dom/FirstLetterPseudoElement.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisibleUnits.h" #include "core/editing/iterators/TextIterator.h" #include "core/html/HTMLFormControlElement.h" #include "core/layout/LayoutTextFragment.h"
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp index 87e8aad..d463bd8b 100644 --- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp +++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -656,8 +656,7 @@ if (node->HasTagName(pTag)) return true; - if (node->HasTagName(h1Tag) || node->HasTagName(h2Tag) || - node->HasTagName(h3Tag)) { + if (node->HasTagName(h1Tag) || node->HasTagName(h2Tag)) { const ComputedStyle* style = r->Style(); if (style) { int bottom_margin = ToLayoutBox(r)->CollapsedMarginAfter().ToInt();
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp index 248b97e..5c2427f 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -99,6 +99,14 @@ return nullptr; } +void InvalidatePaintForNode(const Node& node) { + if (!node.GetLayoutObject()) + return; + + node.GetLayoutObject()->SetShouldDoFullPaintInvalidation( + PaintInvalidationReason::kDocumentMarker); +} + } // namespace Member<DocumentMarkerList>& DocumentMarkerController::ListForType( @@ -282,11 +290,7 @@ DocumentMarkerList* const list = ListForType(markers, new_marker_type); list->Add(new_marker); - // repaint the affected node - if (node->GetLayoutObject()) { - node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - } + InvalidatePaintForNode(*node); } // Moves markers from src_node to dst_node. Markers are moved if their start @@ -325,11 +329,10 @@ doc_dirty = true; } - // repaint the affected node - if (doc_dirty && dst_node->GetLayoutObject()) { - dst_node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - } + if (!doc_dirty) + return; + + InvalidatePaintForNode(*dst_node); } void DocumentMarkerController::RemoveMarkersInternal( @@ -376,11 +379,10 @@ possibly_existing_marker_types_ = 0; } - // repaint the affected node - if (doc_dirty && node->GetLayoutObject()) { - node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - } + if (!doc_dirty) + return; + + InvalidatePaintForNode(*node); } DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingOffsetRange( @@ -659,10 +661,7 @@ if (needs_repainting) { const Node& node = *iterator->key; - if (LayoutObject* layout_object = node.GetLayoutObject()) { - layout_object->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - } + InvalidatePaintForNode(node); InvalidatePaintForTickmarks(node); } @@ -691,12 +690,7 @@ if (!list || list->IsEmpty() || !marker_types.Contains(type)) continue; - // cause the node to be redrawn - if (LayoutObject* layout_object = node->GetLayoutObject()) { - layout_object->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - break; - } + InvalidatePaintForNode(*node); } } } @@ -745,12 +739,10 @@ bool doc_dirty = ToTextMatchMarkerListImpl(list)->SetTextMatchMarkersActive( start_offset, end_offset, active); - // repaint the affected node - if (doc_dirty && node->GetLayoutObject()) { - node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( - PaintInvalidationReason::kDocumentMarker); - } - return doc_dirty; + if (!doc_dirty) + return false; + InvalidatePaintForNode(*node); + return true; } #ifndef NDEBUG @@ -817,8 +809,7 @@ if (!node->GetLayoutObject()) return; InvalidateRectsForTextMatchMarkersInNode(*node); - // repaint the affected node - node->GetLayoutObject()->SetShouldDoFullPaintInvalidation(); + InvalidatePaintForNode(*node); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp index 8014a50..8a1748a5 100644 --- a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp +++ b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp
@@ -37,6 +37,7 @@ #include "core/editing/EditingStyle.h" #include "core/editing/EditingStyleUtilities.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/serializers/Serialization.h"
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp index c23c749..8f04f1d 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp
@@ -19,8 +19,8 @@ #include "core/editing/spellcheck/SpellCheckRequester.h" #include "core/editing/spellcheck/SpellChecker.h" #include "core/frame/LocalFrame.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp index e85be81..cad40b03 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp
@@ -7,7 +7,7 @@ #include "core/editing/spellcheck/SpellCheckTestBase.h" #include "core/editing/spellcheck/SpellChecker.h" #include "core/frame/LocalFrame.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp index 53a4c820..615598d3 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -38,6 +38,7 @@ #include "core/editing/Editor.h" #include "core/editing/EphemeralRange.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/editing/commands/CompositeEditCommand.h" #include "core/editing/commands/ReplaceSelectionCommand.h"
diff --git a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.cpp b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.cpp index 850ad6a..f54a6c1e 100644 --- a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.cpp +++ b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.cpp
@@ -204,6 +204,13 @@ void TextSuggestionController::HandlePotentialSuggestionTap( const PositionInFlatTree& caret_position) { + // It's theoretically possible, but extremely unlikely, that the user has + // managed to tap on some text after TextSuggestionController has told the + // browser to open the text suggestions menu, but before the browser has + // actually done so. In this case, we should just ignore the tap. + if (is_suggestion_menu_open_) + return; + const EphemeralRangeInFlatTree& range_to_check = ComputeRangeSurroundingCaret(caret_position);
diff --git a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h index 361899ec..9868897 100644 --- a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h +++ b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionController.h
@@ -8,7 +8,6 @@ #include "core/CoreExport.h" #include "core/dom/DocumentShutdownObserver.h" #include "core/editing/EphemeralRange.h" -#include "core/editing/VisiblePosition.h" #include "core/editing/markers/DocumentMarker.h" #include "platform/heap/Handle.h" #include "public/platform/input_host.mojom-blink.h"
diff --git a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionControllerTest.cpp b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionControllerTest.cpp index f39d182..705cda8 100644 --- a/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/suggestion/TextSuggestionControllerTest.cpp
@@ -6,6 +6,7 @@ #include "core/editing/EditingTestBase.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/markers/DocumentMarkerController.h" #include "core/editing/spellcheck/SpellChecker.h"
diff --git a/third_party/WebKit/Source/core/events/RegisteredEventListener.h b/third_party/WebKit/Source/core/events/RegisteredEventListener.h index 4bbc5f06..65808b5 100644 --- a/third_party/WebKit/Source/core/events/RegisteredEventListener.h +++ b/third_party/WebKit/Source/core/events/RegisteredEventListener.h
@@ -73,6 +73,8 @@ EventListener* Listener() { return listener_; } + void SetListener(EventListener* listener) { listener_ = listener; } + bool Passive() const { return passive_; } bool Once() const { return once_; }
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp index 57f24336..58b4cb34 100644 --- a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp +++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp
@@ -63,7 +63,6 @@ #include "core/loader/HistoryItem.h" #include "core/page/Page.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebFrameScheduler.h" #include "platform/exported/WrappedResourceRequest.h" #include "platform/exported/WrappedResourceResponse.h" @@ -71,6 +70,7 @@ #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/network/HTTPParsers.h" #include "platform/plugins/PluginData.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/StringExtras.h" #include "platform/wtf/text/CString.h"
diff --git a/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp index f86369f..3b3d2ae 100644 --- a/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp
@@ -74,7 +74,6 @@ #include "core/probe/CoreProbes.h" #include "platform/CrossThreadFunctional.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" #include "platform/instrumentation/tracing/TraceEvent.h"
diff --git a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp index 9869621..57b9868 100644 --- a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp
@@ -17,7 +17,6 @@ #include "core/html/HTMLLinkElement.h" #include "core/page/Page.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/Color.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h"
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index 8bc9d7ac..549f7be7 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -99,7 +99,6 @@ #include "platform/Cursor.h" #include "platform/DragImage.h" #include "platform/KeyboardCodes.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/Microtask.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/GraphicsLayer.h" @@ -109,6 +108,7 @@ #include "platform/loader/fetch/ResourceError.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceLoaderOptions.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/Scrollbar.h" #include "platform/scroll/ScrollbarTestSuite.h" #include "platform/testing/HistogramTester.h"
diff --git a/third_party/WebKit/Source/core/exported/WebInputElement.cpp b/third_party/WebKit/Source/core/exported/WebInputElement.cpp index 2c130ba..ba3bd1f 100644 --- a/third_party/WebKit/Source/core/exported/WebInputElement.cpp +++ b/third_party/WebKit/Source/core/exported/WebInputElement.cpp
@@ -39,7 +39,6 @@ #include "core/html/HTMLInputElement.h" #include "core/html/forms/TextControlInnerElements.h" #include "core/html/shadow/ShadowElementNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/RefPtr.h" #include "public/platform/WebString.h" #include "public/web/WebElementCollection.h"
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp index 4bc312b..6c0abb6 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
@@ -75,13 +75,13 @@ #include "core/paint/LayoutObjectDrawingRecorder.h" #include "core/paint/PaintLayer.h" #include "platform/KeyboardCodes.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/exported/WrappedResourceResponse.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/paint/CullRect.h" #include "platform/graphics/paint/ForeignLayerDisplayItem.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/wtf/Assertions.h" @@ -203,9 +203,7 @@ (layout_object->BorderLeft() + layout_object->PaddingLeft()).ToInt(), (layout_object->BorderTop() + layout_object->PaddingTop()).ToInt()); - pending_invalidation_rect_.Unite(dirty_rect); - - layout_object->SetMayNeedPaintInvalidation(); + layout_object->InvalidatePaintRectangle(LayoutRect(dirty_rect)); } void WebPluginContainerImpl::SetFocused(bool focused, WebFocusType focus_type) { @@ -1014,19 +1012,6 @@ frame->GetPage()->GetFocusController().SetFocusedElement(element_, frame); } -void WebPluginContainerImpl::IssuePaintInvalidations() { - if (pending_invalidation_rect_.IsEmpty()) - return; - - LayoutBox* layout_object = ToLayoutBox(element_->GetLayoutObject()); - if (!layout_object) - return; - - layout_object->InvalidatePaintRectangle( - LayoutRect(pending_invalidation_rect_)); - pending_invalidation_rect_ = IntRect(); -} - void WebPluginContainerImpl::ComputeClipRectsForPlugin( const HTMLFrameOwnerElement* owner_element, IntRect& window_rect,
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h index 3776b539..a57e7fe 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h
@@ -92,7 +92,6 @@ bool CanProcessDrag() const override; bool WantsWheelEvents() override; void UpdateAllLifecyclePhases() override; - void InvalidatePaint() override { IssuePaintInvalidations(); } void InvalidateRect(const IntRect&); void SetFocused(bool, WebFocusType) override; void HandleEvent(Event*) override; @@ -221,8 +220,6 @@ void FocusPlugin(); - void IssuePaintInvalidations(); - void CalculateGeometry(IntRect& window_rect, IntRect& clip_rect, IntRect& unobscured_rect); @@ -233,7 +230,6 @@ WebPlugin* web_plugin_; WebLayer* web_layer_; IntRect frame_rect_; - IntRect pending_invalidation_rect_; TouchEventRequestType touch_event_request_type_; bool wants_wheel_events_; bool self_visible_;
diff --git a/third_party/WebKit/Source/core/exported/WebRange.cpp b/third_party/WebKit/Source/core/exported/WebRange.cpp index 0459e3e..962d3a34 100644 --- a/third_party/WebKit/Source/core/exported/WebRange.cpp +++ b/third_party/WebKit/Source/core/exported/WebRange.cpp
@@ -34,6 +34,7 @@ #include "core/dom/Range.h" #include "core/editing/FrameSelection.h" #include "core/editing/PlainTextRange.h" +#include "core/editing/VisibleSelection.h" #include "core/frame/LocalFrame.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp index 396a43d2..06bae7b 100644 --- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
@@ -52,12 +52,12 @@ #include "core/workers/WorkerInspectorProxy.h" #include "core/workers/WorkerScriptLoader.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" #include "platform/heap/Persistent.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceResponse.h" #include "platform/network/ContentSecurityPolicyParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Functional.h"
diff --git a/third_party/WebKit/Source/core/exported/WebSurroundingText.cpp b/third_party/WebKit/Source/core/exported/WebSurroundingText.cpp index 75023c6e..942cd22 100644 --- a/third_party/WebKit/Source/core/exported/WebSurroundingText.cpp +++ b/third_party/WebKit/Source/core/exported/WebSurroundingText.cpp
@@ -32,6 +32,7 @@ #include "core/editing/FrameSelection.h" #include "core/editing/SurroundingText.h" #include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/frame/LocalFrame.h" #include "core/frame/WebLocalFrameImpl.h" #include "core/layout/LayoutObject.h"
diff --git a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp index 827581a..8ce37bb 100644 --- a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
@@ -112,7 +112,6 @@ #include "platform/Cursor.h" #include "platform/Histogram.h" #include "platform/KeyboardCodes.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/exported/WebActiveGestureAnimation.h" #include "platform/fonts/FontCache.h" @@ -128,6 +127,7 @@ #include "platform/image-decoders/ImageDecoder.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/UniqueIdentifier.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/scroll/ScrollbarTheme.h"
diff --git a/third_party/WebKit/Source/core/frame/DOMVisualViewport.h b/third_party/WebKit/Source/core/frame/DOMVisualViewport.h index 8588abb..a7c030b1 100644 --- a/third_party/WebKit/Source/core/frame/DOMVisualViewport.h +++ b/third_party/WebKit/Source/core/frame/DOMVisualViewport.h
@@ -66,6 +66,9 @@ double height() const; double scale() const; + DEFINE_ATTRIBUTE_EVENT_LISTENER(resize); + DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); + private: explicit DOMVisualViewport(LocalDOMWindow*);
diff --git a/third_party/WebKit/Source/core/frame/Deprecation.cpp b/third_party/WebKit/Source/core/frame/Deprecation.cpp index ade418c..41c4303 100644 --- a/third_party/WebKit/Source/core/frame/Deprecation.cpp +++ b/third_party/WebKit/Source/core/frame/Deprecation.cpp
@@ -14,7 +14,7 @@ #include "core/inspector/ConsoleMessage.h" #include "core/page/Page.h" #include "core/workers/WorkerOrWorkletGlobalScope.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "public/platform/WebFeaturePolicyFeature.h" namespace {
diff --git a/third_party/WebKit/Source/core/frame/FrameTestHelpers.h b/third_party/WebKit/Source/core/frame/FrameTestHelpers.h index ee69bca..52ce7b8 100644 --- a/third_party/WebKit/Source/core/frame/FrameTestHelpers.h +++ b/third_party/WebKit/Source/core/frame/FrameTestHelpers.h
@@ -37,8 +37,8 @@ #include <string> #include "core/exported/WebViewImpl.h" #include "core/frame/Settings.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebTaskRunner.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 6fb6bd3..3b5d4eb 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -43,6 +43,7 @@ #include "core/editing/Editor.h" #include "core/editing/FrameSelection.h" #include "core/editing/InputMethodController.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/serializers/Serialization.h" #include "core/editing/spellcheck/SpellChecker.h" #include "core/editing/suggestion/TextSuggestionController.h" @@ -78,7 +79,6 @@ #include "core/timing/Performance.h" #include "platform/Histogram.h" #include "platform/PluginScriptForbiddenScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebFrameScheduler.h" #include "platform/graphics/paint/ClipRecorder.h" @@ -92,6 +92,7 @@ #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/plugins/PluginData.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/text/TextStream.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp index acb00824..c50e916 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -40,6 +40,8 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/RenderedPosition.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/markers/DocumentMarkerController.h" #include "core/events/ErrorEvent.h" #include "core/frame/BrowserControls.h" @@ -105,7 +107,6 @@ #include "platform/Histogram.h" #include "platform/Language.h" #include "platform/PlatformChromeClient.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebFrameScheduler.h" #include "platform/fonts/FontCache.h" @@ -124,6 +125,7 @@ #include "platform/instrumentation/tracing/TracedValue.h" #include "platform/json/JSONValues.h" #include "platform/loader/fetch/ResourceFetcher.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/scroll/ScrollerSizeMetrics.h" @@ -554,9 +556,6 @@ paint_invalidation_rect.Move( (layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); - // FIXME: We should not allow paint invalidation out of paint invalidation - // state. crbug.com/457415 - DisablePaintInvalidationStateAsserts paint_invalidation_assert_disabler; layout_item.InvalidatePaintRectangle(LayoutRect(paint_invalidation_rect)); } @@ -1831,9 +1830,6 @@ if (ContentsInCompositedLayer()) { IntRect update_rect = VisibleContentRect(); DCHECK(!GetLayoutViewItem().IsNull()); - // FIXME: We should not allow paint invalidation out of paint invalidation - // state. crbug.com/457415 - DisablePaintInvalidationStateAsserts disabler; GetLayoutViewItem().InvalidatePaintRectangle(LayoutRect(update_rect)); } LayoutEmbeddedContentItem frame_layout_item = frame_->OwnerLayoutItem(); @@ -1843,9 +1839,6 @@ frame_layout_item.BorderLeft() + frame_layout_item.PaddingLeft(), frame_layout_item.BorderTop() + frame_layout_item.PaddingTop(), LayoutUnit(VisibleWidth()), LayoutUnit(VisibleHeight())); - // FIXME: We should not allow paint invalidation out of paint invalidation - // state. crbug.com/457415 - DisablePaintInvalidationStateAsserts disabler; frame_layout_item.InvalidatePaintRectangle(rect); return; }
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.h b/third_party/WebKit/Source/core/frame/LocalFrameView.h index 0cc55426..1f14871 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.h +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.h
@@ -42,7 +42,6 @@ #include "core/paint/ScrollbarManager.h" #include "core/paint/compositing/PaintLayerCompositor.h" #include "platform/PlatformFrameView.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/geometry/IntRect.h" @@ -50,6 +49,7 @@ #include "platform/graphics/Color.h" #include "platform/graphics/CompositorElementId.h" #include "platform/graphics/GraphicsLayerClient.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollTypes.h" #include "platform/scroll/Scrollbar.h" #include "platform/scroll/SmoothScrollSequencer.h"
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp index cf8b085..ee13a30 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp
@@ -10,9 +10,9 @@ #include "core/layout/LayoutTestHelper.h" #include "core/layout/LayoutView.h" #include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/IntSize.h" #include "platform/graphics/paint/PaintArtifact.h" +#include "platform/runtime_enabled_features.h" #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/third_party/WebKit/Source/core/frame/Navigator.cpp b/third_party/WebKit/Source/core/frame/Navigator.cpp index 26089b1..8d2ad879 100644 --- a/third_party/WebKit/Source/core/frame/Navigator.cpp +++ b/third_party/WebKit/Source/core/frame/Navigator.cpp
@@ -34,6 +34,7 @@ #include "core/page/Page.h" #include "platform/Language.h" #include "platform/MemoryCoordinator.h" +#include "third_party/WebKit/common/device_memory/approximated_device_memory.h" namespace blink { @@ -52,7 +53,7 @@ } float Navigator::deviceMemory() const { - return MemoryCoordinator::GetApproximatedDeviceMemory(); + return ApproximatedDeviceMemory::GetApproximatedDeviceMemory(); } String Navigator::vendorSub() const {
diff --git a/third_party/WebKit/Source/core/frame/Settings.cpp b/third_party/WebKit/Source/core/frame/Settings.cpp index 1291d0e..ada45f5 100644 --- a/third_party/WebKit/Source/core/frame/Settings.cpp +++ b/third_party/WebKit/Source/core/frame/Settings.cpp
@@ -29,7 +29,6 @@ #include <memory> #include "build/build_config.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.idl b/third_party/WebKit/Source/core/frame/VisualViewport.idl index 65fad2bf..be7e37d 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.idl +++ b/third_party/WebKit/Source/core/frame/VisualViewport.idl
@@ -40,4 +40,7 @@ [Measure] readonly attribute double height; [Measure] readonly attribute double scale; + + attribute EventHandler onresize; + attribute EventHandler onscroll; };
diff --git a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp index a2fd7db..b8e333f3 100644 --- a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp
@@ -120,6 +120,7 @@ #include "core/editing/SetSelectionOptions.h" #include "core/editing/TextAffinity.h" #include "core/editing/TextFinder.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/markers/DocumentMarkerController.h" #include "core/editing/serializers/Serialization.h"
diff --git a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h index ff8fcca..ceee83e 100644 --- a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h
@@ -32,7 +32,7 @@ #define WebLocalFrameImpl_h #include "core/CoreExport.h" -#include "core/editing/VisiblePosition.h" +#include "core/editing/Forward.h" #include "core/exported/WebInputMethodControllerImpl.h" #include "core/frame/ContentSettingsClient.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp index a4bb435..9f85b564 100644 --- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp +++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -14,7 +14,6 @@ #include "core/html/HTMLScriptElement.h" #include "core/inspector/ConsoleMessage.h" #include "platform/Crypto.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/network/ContentSecurityPolicyParsers.h" #include "platform/weborigin/KURL.h" #include "platform/wtf/text/Base64.h"
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp index 3dd12061..53cbcc0 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -49,7 +49,6 @@ #include "core/loader/PingLoader.h" #include "core/probe/CoreProbes.h" #include "core/workers/WorkerGlobalScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/json/JSONValues.h" #include "platform/loader/fetch/IntegrityMetadata.h" #include "platform/loader/fetch/ResourceRequest.h" @@ -57,6 +56,7 @@ #include "platform/network/ContentSecurityPolicyParsers.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" #include "platform/network/EncodedFormData.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/KnownPorts.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp index dc8ce5e..e14504a 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
@@ -8,10 +8,10 @@ #include "core/html/HTMLScriptElement.h" #include "core/testing/NullExecutionContext.h" #include "platform/Crypto.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/IntegrityMetadata.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/network/ContentSecurityPolicyParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index 7ea6018..f8e8a46 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -69,7 +69,6 @@ #include "core/paint/compositing/PaintLayerCompositor.h" #include "core/probe/CoreProbes.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/CanvasHeuristicParameters.h" #include "platform/graphics/CanvasMetrics.h" #include "platform/graphics/GraphicsLayer.h" @@ -80,6 +79,7 @@ #include "platform/graphics/gpu/SharedGpuContext.h" #include "platform/graphics/paint/PaintCanvas.h" #include "platform/image-encoders/ImageEncoderUtils.h" +#include "platform/runtime_enabled_features.h" #include "platform/transforms/AffineTransform.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLContentElement.cpp b/third_party/WebKit/Source/core/html/HTMLContentElement.cpp index cc90887..fafc129 100644 --- a/third_party/WebKit/Source/core/html/HTMLContentElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLContentElement.cpp
@@ -34,7 +34,6 @@ #include "core/dom/QualifiedName.h" #include "core/dom/ShadowRoot.h" #include "core/frame/UseCounter.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp index 5324df3..a8714ee7 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
@@ -24,6 +24,7 @@ #include "core/html/HTMLFormControlElement.h" +#include "core/dom/AXObjectCache.h" #include "core/dom/ElementTraversal.h" #include "core/dom/TaskRunnerHelper.h" #include "core/dom/events/Event.h" @@ -188,12 +189,20 @@ if (GetLayoutObject()) LayoutTheme::GetTheme().ControlStateChanged(*GetLayoutObject(), kEnabledControlState); + // TODO(dmazzoni): http://crbug.com/699438. + // Replace |CheckedStateChanged| with a generic tree changed event. + if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache()) + cache->CheckedStateChanged(this); } void HTMLFormControlElement::RequiredAttributeChanged() { SetNeedsValidityCheck(); PseudoStateChanged(CSSSelector::kPseudoRequired); PseudoStateChanged(CSSSelector::kPseudoOptional); + // TODO(dmazzoni): http://crbug.com/699438. + // Replace |CheckedStateChanged| with a generic tree changed event. + if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache()) + cache->CheckedStateChanged(this); } bool HTMLFormControlElement::IsReadOnly() const {
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp index 68025b9..d147c80 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -42,26 +42,30 @@ namespace blink { -using PluginSet = HeapHashSet<Member<PluginView>>; -static PluginSet& PluginsPendingDispose() { - DEFINE_STATIC_LOCAL(PluginSet, set, (new PluginSet)); +namespace { + +using PluginSet = PersistentHeapHashSet<Member<PluginView>>; +PluginSet& PluginsPendingDispose() { + DEFINE_STATIC_LOCAL(PluginSet, set, ()); return set; } +} // namespace + SubframeLoadingDisabler::SubtreeRootSet& SubframeLoadingDisabler::DisabledSubtreeRoots() { DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, ()); return nodes; } -static unsigned g_plugin_dispose_suspend_count = 0; - -HTMLFrameOwnerElement::PluginDisposeSuspendScope::PluginDisposeSuspendScope() { - ++g_plugin_dispose_suspend_count; -} +// static +int HTMLFrameOwnerElement::PluginDisposeSuspendScope::suspend_count_ = 0; void HTMLFrameOwnerElement::PluginDisposeSuspendScope:: PerformDeferredPluginDispose() { + DCHECK_EQ(suspend_count_, 1); + suspend_count_ = 0; + PluginSet dispose_set; PluginsPendingDispose().swap(dispose_set); for (const auto& plugin : dispose_set) { @@ -69,13 +73,6 @@ } } -HTMLFrameOwnerElement::PluginDisposeSuspendScope::~PluginDisposeSuspendScope() { - DCHECK_GT(g_plugin_dispose_suspend_count, 0u); - if (g_plugin_dispose_suspend_count == 1) - PerformDeferredPluginDispose(); - --g_plugin_dispose_suspend_count; -} - HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tag_name, Document& document) : HTMLElement(tag_name, document), @@ -159,9 +156,10 @@ } void HTMLFrameOwnerElement::DisposePluginSoon(PluginView* plugin) { - if (g_plugin_dispose_suspend_count) + if (PluginDisposeSuspendScope::suspend_count_) { PluginsPendingDispose().insert(plugin); - else + PluginDisposeSuspendScope::suspend_count_ |= 1; + } else plugin->Dispose(); }
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h index e2173b3..e3372cf 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h +++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
@@ -76,11 +76,20 @@ STACK_ALLOCATED(); public: - PluginDisposeSuspendScope(); - ~PluginDisposeSuspendScope(); + PluginDisposeSuspendScope() { suspend_count_ += 2; } + ~PluginDisposeSuspendScope() { + suspend_count_ -= 2; + if (suspend_count_ == 1) + PerformDeferredPluginDispose(); + } private: void PerformDeferredPluginDispose(); + + // Low bit indicates if there are plugins to dispose. + static int suspend_count_; + + friend class HTMLFrameOwnerElement; }; // FrameOwner overrides:
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp index 5c53441..ebe903fa 100644 --- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
@@ -31,7 +31,7 @@ #include "core/html/HTMLDocument.h" #include "core/inspector/ConsoleMessage.h" #include "core/layout/LayoutIFrame.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp index c23fe49..a894755 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -72,7 +72,7 @@ #include "core/page/ChromeClient.h" #include "core/page/Page.h" #include "platform/Language.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/PlatformLocale.h" #include "platform/wtf/MathExtras.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLLabelElement.cpp b/third_party/WebKit/Source/core/html/HTMLLabelElement.cpp index 6e64ac37..28b2208d 100644 --- a/third_party/WebKit/Source/core/html/HTMLLabelElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLLabelElement.cpp
@@ -30,6 +30,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/SelectionController.h" +#include "core/editing/VisibleSelection.h" #include "core/events/MouseEvent.h" #include "core/frame/LocalFrame.h" #include "core/frame/UseCounter.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index 400ffc9..44b0e7e8 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -74,7 +74,6 @@ #include "core/paint/compositing/PaintLayerCompositor.h" #include "platform/Histogram.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/audio/AudioBus.h" #include "platform/audio/AudioSourceProviderClient.h" #include "platform/bindings/Microtask.h" @@ -84,6 +83,7 @@ #include "platform/network/ParsedContentType.h" #include "platform/network/mime/ContentType.h" #include "platform/network/mime/MIMETypeFromURL.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/AutoReset.h" #include "platform/wtf/CurrentTime.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp index 0e7dde2..333ec14 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp
@@ -11,7 +11,7 @@ #include "core/html/media/MediaCustomControlsFullscreenDetector.h" #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/testing/EmptyWebMediaPlayer.h" #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLMetaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMetaElement.cpp index abd5300a..898232c 100644 --- a/third_party/WebKit/Source/core/html/HTMLMetaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMetaElement.cpp
@@ -32,7 +32,6 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "core/inspector/ConsoleMessage.h" #include "core/loader/HttpEquiv.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/text/StringToNumber.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp index 023ae5f..1f88bd0 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -44,10 +44,10 @@ #include "core/layout/LayoutImage.h" #include "core/layout/LayoutVideo.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/gpu/Extensions3DUtil.h" +#include "platform/runtime_enabled_features.h" #include "public/platform/WebCanvas.h" namespace blink { @@ -67,7 +67,6 @@ inline HTMLVideoElement::HTMLVideoElement(Document& document) : HTMLMediaElement(videoTag, document), - media_remoting_status_(MediaRemotingStatus::kNotStarted), remoting_interstitial_(nullptr) { if (document.GetSettings()) { default_poster_url_ = @@ -510,8 +509,6 @@ void HTMLVideoElement::MediaRemotingStarted( const WebString& remote_device_friendly_name) { - DCHECK(media_remoting_status_ == MediaRemotingStatus::kNotStarted); - media_remoting_status_ = MediaRemotingStatus::kStarted; if (!remoting_interstitial_) { remoting_interstitial_ = new MediaRemotingInterstitial(*this); ShadowRoot& shadow_root = EnsureUserAgentShadowRoot(); @@ -522,12 +519,8 @@ } void HTMLVideoElement::MediaRemotingStopped() { - DCHECK(media_remoting_status_ == MediaRemotingStatus::kDisabled || - media_remoting_status_ == MediaRemotingStatus::kStarted); - if (media_remoting_status_ != MediaRemotingStatus::kDisabled) - media_remoting_status_ = MediaRemotingStatus::kNotStarted; - DCHECK(remoting_interstitial_); - remoting_interstitial_->Hide(); + if (remoting_interstitial_) + remoting_interstitial_->Hide(); } WebMediaPlayer::DisplayType HTMLVideoElement::DisplayType() const { @@ -537,9 +530,12 @@ } void HTMLVideoElement::DisableMediaRemoting() { - media_remoting_status_ = MediaRemotingStatus::kDisabled; if (GetWebMediaPlayer()) GetWebMediaPlayer()->RequestRemotePlaybackDisabled(true); } +bool HTMLVideoElement::IsRemotingInterstitialVisible() const { + return remoting_interstitial_ && remoting_interstitial_->IsVisible(); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.h b/third_party/WebKit/Source/core/html/HTMLVideoElement.h index 68a1b7a..b630ac1 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElement.h +++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.h
@@ -55,8 +55,6 @@ bool HasPendingActivity() const final; - enum class MediaRemotingStatus { kNotStarted, kStarted, kDisabled }; - // Node override. Node::InsertionNotificationRequest InsertedInto(ContainerNode*) override; void RemovedFrom(ContainerNode*) override; @@ -148,9 +146,7 @@ bool IsPersistent() const; - MediaRemotingStatus GetMediaRemotingStatus() const { - return media_remoting_status_; - } + bool IsRemotingInterstitialVisible() const; void DisableMediaRemoting(); void MediaRemotingStarted(const WebString& remote_device_friendly_name) final; @@ -186,8 +182,6 @@ Member<MediaCustomControlsFullscreenDetector> custom_controls_fullscreen_detector_; - MediaRemotingStatus media_remoting_status_; - Member<MediaRemotingInterstitial> remoting_interstitial_; AtomicString default_poster_url_;
diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp index b70297c8..7a152f6d 100644 --- a/third_party/WebKit/Source/core/html/ImageData.cpp +++ b/third_party/WebKit/Source/core/html/ImageData.cpp
@@ -32,7 +32,6 @@ #include "core/dom/DOMException.h" #include "core/imagebitmap/ImageBitmap.h" #include "core/imagebitmap/ImageBitmapOptions.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/ColorBehavior.h" #include "third_party/skia/include/core/SkColorSpaceXform.h" #include "v8/include/v8.h"
diff --git a/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp b/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp index 372e08d71..d4803eda 100644 --- a/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp +++ b/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp
@@ -30,7 +30,6 @@ #include "core/html/LinkRelAttribute.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/text/CString.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/html/RelList.cpp b/third_party/WebKit/Source/core/html/RelList.cpp index fa494ed..b775c80 100644 --- a/third_party/WebKit/Source/core/html/RelList.cpp +++ b/third_party/WebKit/Source/core/html/RelList.cpp
@@ -8,7 +8,6 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/origin_trials/OriginTrials.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/HashMap.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp index dff58e5..e11278d 100644 --- a/third_party/WebKit/Source/core/html/TextControlElement.cpp +++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -37,6 +37,7 @@ #include "core/editing/Editor.h" #include "core/editing/FrameSelection.h" #include "core/editing/SetSelectionOptions.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/iterators/CharacterIterator.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/serializers/Serialization.h"
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.h b/third_party/WebKit/Source/core/html/TextControlElement.h index 536967f..eb354b5 100644 --- a/third_party/WebKit/Source/core/html/TextControlElement.h +++ b/third_party/WebKit/Source/core/html/TextControlElement.h
@@ -28,8 +28,8 @@ #include "base/gtest_prod_util.h" #include "core/CoreExport.h" +#include "core/editing/Forward.h" #include "core/editing/SelectionTemplate.h" -#include "core/editing/VisiblePosition.h" #include "core/html/HTMLFormControlElementWithState.h" #include "public/platform/WebFocusType.h"
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp index 25f5459..af7a6fa 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp
@@ -27,7 +27,7 @@ #include "core/html/canvas/CanvasContextCreationAttributes.h" #include "core/html/canvas/CanvasImageSource.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp index 50e5e01..109b71a 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
@@ -47,7 +47,6 @@ #include "core/html/forms/ColorChooser.h" #include "core/layout/LayoutTheme.h" #include "core/page/ChromeClient.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/Color.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/html/forms/ExternalDateTimeChooser.cpp b/third_party/WebKit/Source/core/html/forms/ExternalDateTimeChooser.cpp index cd06e5d..e9dece78 100644 --- a/third_party/WebKit/Source/core/html/forms/ExternalDateTimeChooser.cpp +++ b/third_party/WebKit/Source/core/html/forms/ExternalDateTimeChooser.cpp
@@ -28,7 +28,7 @@ #include "core/InputTypeNames.h" #include "core/html/forms/DateTimeChooserClient.h" #include "core/page/ChromeClient.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/AtomicString.h" #include "public/web/WebDateTimeChooserCompletion.h" #include "public/web/WebDateTimeChooserParams.h"
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp index 2d76572b..ffe9745 100644 --- a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
@@ -39,7 +39,7 @@ #include "core/page/ChromeClient.h" #include "core/page/DragData.h" #include "platform/FileMetadata.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/PlatformLocale.h" #include "platform/wtf/text/StringBuilder.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/html/forms/InputType.cpp b/third_party/WebKit/Source/core/html/forms/InputType.cpp index 960ba19..93d6d2d 100644 --- a/third_party/WebKit/Source/core/html/forms/InputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/InputType.cpp
@@ -70,7 +70,6 @@ #include "core/inspector/ConsoleMessage.h" #include "core/layout/LayoutTheme.h" #include "core/page/Page.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/json/JSONValues.h" #include "platform/text/PlatformLocale.h" #include "platform/text/TextBreakIterator.h"
diff --git a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp index e2739b62..da6234d 100644 --- a/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp +++ b/third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp
@@ -47,7 +47,6 @@ #include "core/page/Page.h" #include "core/style/ComputedStyle.h" #include "platform/DateComponents.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/text/DateTimeFormat.h" #include "platform/text/PlatformLocale.h" #include "platform/wtf/DateMath.h"
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp index 8adf2d1..9162bc3 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
@@ -12,7 +12,7 @@ #include "core/frame/Settings.h" #include "core/html/HTMLMediaElement.h" #include "core/html/media/AutoplayUmaHelper.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "public/platform/WebMediaPlayer.h" #include "public/web/WebSettings.h"
diff --git a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp index 1f11e0a7..ae789e3 100644 --- a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp +++ b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp
@@ -7,8 +7,8 @@ #include "core/EventTypeNames.h" #include "core/html/HTMLVideoElement.h" #include "core/testing/DummyPageHolder.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/IntRect.h" +#include "platform/runtime_enabled_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.cpp b/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.cpp index 13877d3..91b403d5 100644 --- a/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.cpp +++ b/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.cpp
@@ -48,7 +48,8 @@ void MediaRemotingInterstitial::Show( const WebString& remote_device_friendly_name) { - DCHECK(!should_be_visible_); + if (should_be_visible_) + return; if (remote_device_friendly_name.IsEmpty()) { cast_text_message_->setInnerText( GetVideoElement().GetLocale().QueryString( @@ -71,7 +72,8 @@ } void MediaRemotingInterstitial::Hide() { - DCHECK(should_be_visible_); + if (!should_be_visible_) + return; if (toggle_insterstitial_timer_.IsActive()) toggle_insterstitial_timer_.Stop(); should_be_visible_ = false;
diff --git a/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.h b/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.h index c638c46..68be48b5 100644 --- a/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.h +++ b/third_party/WebKit/Source/core/html/media/MediaRemotingInterstitial.h
@@ -40,6 +40,9 @@ void OnPosterImageChanged(); + // Query for whether the remoting interstitial is visible. + bool IsVisible() const { return should_be_visible_; } + HTMLVideoElement& GetVideoElement() const { return *video_element_; } DECLARE_VIRTUAL_TRACE(); @@ -52,7 +55,7 @@ void ToggleInterstitialTimerFired(TimerBase*); // Indicates whether the interstitial should be visible. It is set/changed - // when SHow()/Hide() is called. + // when Show()/Hide() is called. bool should_be_visible_ = false; TaskRunnerTimer<MediaRemotingInterstitial> toggle_insterstitial_timer_;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp index 4b72fa7..1370a1d2 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -224,7 +224,7 @@ parser_blocking_script_ = nullptr; } - if (ScriptLoader* script_loader = pending_script->GetElement()->Loader()) { + if (pending_script->GetElement()->Loader()) { // 7. "Increment the parser's script nesting level by one (it should be // zero before this step, so this sets it to one)." HTMLParserReentryPermit::ScriptNestingLevelIncrementer
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLStackItem.h b/third_party/WebKit/Source/core/html/parser/HTMLStackItem.h index 97b2812..b61e89363 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLStackItem.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLStackItem.h
@@ -31,7 +31,6 @@ #include "core/SVGNames.h" #include "core/dom/Element.h" #include "core/html/parser/AtomicHTMLToken.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/text/AtomicString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/TokenizedChunkQueue.cpp b/third_party/WebKit/Source/core/html/parser/TokenizedChunkQueue.cpp index 528ecd3..182225b 100644 --- a/third_party/WebKit/Source/core/html/parser/TokenizedChunkQueue.cpp +++ b/third_party/WebKit/Source/core/html/parser/TokenizedChunkQueue.cpp
@@ -4,7 +4,6 @@ #include "core/html/parser/TokenizedChunkQueue.h" -#include "platform/RuntimeEnabledFeatures.h" #include <algorithm> #include <memory>
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp index 2b48f693..56301d3 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
@@ -47,7 +47,7 @@ #include "core/html/track/vtt/VTTRegion.h" #include "core/html/track/vtt/VTTScanner.h" #include "core/layout/LayoutVTTCue.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/BidiResolver.h" #include "platform/text/TextRunIterator.h" #include "platform/wtf/MathExtras.h"
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp index 693be2a..a4d4d64 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp
@@ -36,8 +36,8 @@ #include "core/html/track/vtt/VTTElement.h" #include "core/html/track/vtt/VTTRegion.h" #include "core/html/track/vtt/VTTScanner.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/TextResourceDecoderOptions.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/SegmentedString.h" #include "platform/wtf/text/CharacterNames.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index 48495ee..026c966 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -86,12 +86,12 @@ #include "core/paint/PaintLayer.h" #include "core/style/ComputedStyle.h" #include "core/style/CursorData.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WindowsKeyboardCodes.h" #include "platform/geometry/FloatPoint.h" #include "platform/graphics/Image.h" #include "platform/heap/Handle.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "platform/scroll/Scrollbar.h" #include "platform/wtf/Assertions.h"
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp index 9b87ccb..69c328fe 100644 --- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp +++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -13,6 +13,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/SelectionController.h" +#include "core/editing/VisibleSelection.h" #include "core/events/DragEvent.h" #include "core/events/MouseEvent.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp index 9a9accc..ea207bd3 100644 --- a/third_party/WebKit/Source/core/input/ScrollManager.cpp +++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -24,7 +24,6 @@ #include "core/page/scrolling/ScrollState.h" #include "core/paint/PaintLayer.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollerSizeMetrics.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp index 5f8b6228..d48d4c82 100644 --- a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp
@@ -13,13 +13,13 @@ #include "core/input/EventHandler.h" #include "core/page/Page.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatRect.h" #include "platform/geometry/FloatSize.h" #include "platform/geometry/IntRect.h" #include "platform/geometry/IntSize.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/loader/fetch/MemoryCache.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/WebLayerTreeView.h" #include "public/web/WebSettings.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 592adf4f..32b45bb 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -55,7 +55,6 @@ #include "core/probe/CoreProbes.h" #include "core/workers/WorkerGlobalScope.h" #include "core/xmlhttprequest/XMLHttpRequest.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/blob/BlobData.h" #include "platform/loader/fetch/FetchInitiatorInfo.h" #include "platform/loader/fetch/FetchInitiatorTypeNames.h" @@ -71,6 +70,7 @@ #include "platform/network/NetworkStateNotifier.h" #include "platform/network/WebSocketHandshakeRequest.h" #include "platform/network/WebSocketHandshakeResponse.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/ReferrerPolicy.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp index a1bfa07f..ed851813 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -53,6 +53,7 @@ #include "core/inspector/InspectorNetworkAgent.h" #include "core/inspector/InspectorResourceContainer.h" #include "core/svg/SVGStyleElement.h" +#include "platform/wtf/Allocator.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/text/StringBuilder.h" #include "platform/wtf/text/TextPosition.h" @@ -145,8 +146,9 @@ } } -class StyleSheetHandler final : public GarbageCollected<StyleSheetHandler>, - public CSSParserObserver { +class StyleSheetHandler final : public CSSParserObserver { + STACK_ALLOCATED(); + public: StyleSheetHandler(const String& parsed_text, Document* document, @@ -155,8 +157,6 @@ DCHECK(result_); } - DECLARE_TRACE(); - private: void StartRuleHeader(StyleRule::RuleType, unsigned) override; void EndRuleHeader(unsigned) override; @@ -335,13 +335,6 @@ true, true, SourceRange(start_offset, end_offset))); } -DEFINE_TRACE(StyleSheetHandler) { - visitor->Trace(document_); - visitor->Trace(result_); - visitor->Trace(current_rule_data_stack_); - visitor->Trace(current_rule_data_); -} - bool VerifyRuleText(Document* document, const String& rule_text) { DEFINE_STATIC_LOCAL(String, bogus_property_name, ("-webkit-boguz-propertee")); StyleSheetContents* style_sheet =
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp index d11d09be..c0614d1 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp +++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
@@ -43,8 +43,8 @@ #include "core/workers/WorkerReportingProxy.h" #include "core/workers/WorkerThread.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebThreadSupportingGC.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/HitTestResult.cpp b/third_party/WebKit/Source/core/layout/HitTestResult.cpp index 189a6adc..0e7c51d 100644 --- a/third_party/WebKit/Source/core/layout/HitTestResult.cpp +++ b/third_party/WebKit/Source/core/layout/HitTestResult.cpp
@@ -28,6 +28,7 @@ #include "core/dom/ShadowRoot.h" #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLImageElement.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index 9eb62be..6f9eec58 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -56,7 +56,7 @@ #include "core/paint/ObjectPaintInvalidator.h" #include "core/paint/PaintLayer.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 3b7056d8..68daa1b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -55,7 +55,7 @@ #include "core/layout/shapes/ShapeOutsideInfo.h" #include "core/paint/BlockFlowPaintInvalidator.h" #include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp index cacecad..5a11dcf 100644 --- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -29,7 +29,6 @@ #include "core/layout/LayoutMultiColumnFlowThread.h" #include "core/layout/MultiColumnFragmentainerGroup.h" #include "core/paint/MultiColumnSetPainter.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index d1b5ac1bf..ceee5d9 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -42,6 +42,7 @@ #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/TextAffinity.h" +#include "core/editing/VisibleUnits.h" #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" #include "core/frame/EventHandlerRegistry.h" #include "core/frame/LocalFrame.h" @@ -85,12 +86,12 @@ #include "core/style/ContentData.h" #include "core/style/CursorData.h" #include "platform/InstanceCounters.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/TransformState.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/TouchAction.h" #include "platform/graphics/paint/PropertyTreeState.h" #include "platform/instrumentation/tracing/TracedValue.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/allocator/Partitions.h" #include "platform/wtf/text/StringBuilder.h" #include "platform/wtf/text/WTFString.h" @@ -1128,11 +1129,21 @@ return IntSize(); } -LayoutRect LayoutObject::InvalidatePaintRectangle( - const LayoutRect& dirty_rect, - DisplayItemClient* display_item_client) const { - return ObjectPaintInvalidator(*this).InvalidatePaintRectangle( - dirty_rect, display_item_client); +void LayoutObject::InvalidatePaintRectangle(const LayoutRect& dirty_rect) { + if (dirty_rect.IsEmpty()) + return; + + auto& rare_paint_data = EnsureRarePaintData(); + rare_paint_data.SetPartialInvalidationRect( + UnionRect(dirty_rect, rare_paint_data.PartialInvalidationRect())); + + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { + SetMayNeedPaintInvalidationWithoutGeometryChange(); + } else { + // Not using the WithoutGeometryChange version because we need to map + // the partial invalidated rect to visual rect in backing. + SetMayNeedPaintInvalidation(); + } } LayoutRect LayoutObject::SelectionRectInViewCoordinates() const { @@ -3370,6 +3381,8 @@ #if DCHECK_IS_ON() DCHECK(!ShouldCheckForPaintInvalidation() || PaintInvalidationStateIsDirty()); #endif + if (rare_paint_data_) + rare_paint_data_->SetPartialInvalidationRect(LayoutRect()); ClearShouldDoFullPaintInvalidation(); bitfields_.SetMayNeedPaintInvalidation(false); bitfields_.SetMayNeedPaintInvalidationSubtree(false);
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h index 52edf5cc..85709b192 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -1364,12 +1364,7 @@ // Invalidate the paint of a specific subrectangle within a given object. The // rect is in the object's coordinate space. - // If a DisplayItemClient is specified, that client is invalidated rather than - // |this|. - // Returns the visual rect that was invalidated (i.e, invalidation in the - // space of the GraphicsLayer backing this LayoutObject). - LayoutRect InvalidatePaintRectangle(const LayoutRect&, - DisplayItemClient* = nullptr) const; + void InvalidatePaintRectangle(const LayoutRect&); void SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); @@ -1891,6 +1886,10 @@ return rare_paint_data_ ? rare_paint_data_->SelectionVisualRect() : LayoutRect(); } + LayoutRect PartialInvalidationRect() const { + return rare_paint_data_ ? rare_paint_data_->PartialInvalidationRect() + : LayoutRect(); + } protected: enum LayoutObjectType {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp index 4299eb8..af5ecb8 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -45,7 +45,7 @@ #include "core/paint/PaintLayer.h" #include "core/paint/TablePaintInvalidator.h" #include "core/paint/TablePainter.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp index be213a9..aacbf4966 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -37,7 +37,7 @@ #include "core/layout/LayoutView.h" #include "core/layout/SubtreeLayoutScope.h" #include "core/paint/TableSectionPainter.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashSet.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp index 58dde2f2..fadda3a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp
@@ -47,10 +47,10 @@ #include "core/style/ComputedStyle.h" #include "platform/FileMetadata.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/Theme.h" #include "platform/fonts/FontSelector.h" #include "platform/graphics/TouchAction.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/PlatformLocale.h" #include "platform/text/StringTruncator.h" #include "platform/wtf/text/StringBuilder.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm index 49c01e18..c9e33dd2 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -33,13 +33,13 @@ #import "core/style/ShadowList.h" #import "platform/DataResourceHelper.h" #import "platform/LayoutTestSupport.h" -#import "platform/RuntimeEnabledFeatures.h" #import "platform/Theme.h" #import "platform/graphics/BitmapImage.h" #import "platform/mac/ColorMac.h" #import "platform/mac/ThemeMac.h" #import "platform/mac/VersionUtilMac.h" #import "platform/mac/WebCoreNSCellExtras.h" +#import "platform/runtime_enabled_features.h" #import "platform/text/PlatformLocale.h" #import "platform/text/StringTruncator.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp index ba33a37..31d6a647 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
@@ -30,6 +30,7 @@ #include "core/dom/Document.h" #include "core/dom/PseudoElement.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisibleSelection.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" #include "core/frame/Settings.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index 705b25c..278a6a6 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -45,12 +45,12 @@ #include "core/paint/compositing/PaintLayerCompositor.h" #include "core/svg/SVGDocumentExtensions.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/TransformState.h" #include "platform/graphics/paint/PaintController.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/instrumentation/tracing/TracedValue.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.h b/third_party/WebKit/Source/core/layout/LayoutView.h index 8786000a..c344ba7 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.h +++ b/third_party/WebKit/Source/core/layout/LayoutView.h
@@ -28,7 +28,6 @@ #include "core/layout/LayoutBlockFlow.h" #include "core/layout/LayoutState.h" #include "platform/PODFreeListArena.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" #include "platform/scroll/ScrollableArea.h" #include <memory>
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc index 69d8700f..2ec0c0d 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc
@@ -44,6 +44,15 @@ return true; } +TextDirection NGBidiParagraph::BaseDirectionForString(const StringView& text) { + DCHECK(!text.Is8Bit()); + if (text.Is8Bit()) + return TextDirection::kLtr; + UBiDiDirection direction = + ubidi_getBaseDirection(text.Characters16(), text.length()); + return direction == UBIDI_RTL ? TextDirection::kRtl : TextDirection::kLtr; +} + unsigned NGBidiParagraph::GetLogicalRun(unsigned start, UBiDiLevel* level) const { int32_t end;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h index eb88454..f9dd929 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h
@@ -42,8 +42,16 @@ } // The base direction (a.k.a. paragraph direction) of this block. + // This is determined by the 'direction' property of the block, or by the + // heuristic rules defined in UAX#9 if 'unicode-bidi: plaintext'. TextDirection BaseDirection() const { return base_direction_; } + // Compute the base direction for a given string using the heuristic + // rules defined in UAX#9. + // This is generally determined by the first strong character. + // http://unicode.org/reports/tr9/#The_Paragraph_Level + static TextDirection BaseDirectionForString(const StringView&); + // Returns the end offset of a logical run that starts from the |start| // offset. unsigned GetLogicalRun(unsigned start, UBiDiLevel*) const;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h index c7c2e4e..0f52c03 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.h
@@ -139,6 +139,12 @@ void SetStartOffset(unsigned offset) { start_offset_ = offset; } void SetEndOffset(unsigned offset) { end_offset_ = offset; } + // The base direction of this line for the bidi algorithm. + TextDirection BaseDirection() const { return base_direction_; } + void SetBaseDirection(TextDirection direction) { + base_direction_ = direction; + } + private: const ComputedStyle* line_style_ = nullptr; NGInlineItemResults results_; @@ -150,6 +156,8 @@ unsigned start_offset_; unsigned end_offset_; + TextDirection base_direction_ = TextDirection::kLtr; + bool use_first_line_style_ = false; bool is_last_line_ = false; };
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 9e21709..38e66e31 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -265,8 +265,8 @@ // indivisual items do not change their relative position to the line box. LayoutUnit inline_size = position; if (text_align != ETextAlign::kJustify) { - ApplyTextAlign(text_align, &line_offset.inline_offset, inline_size, - line_info->AvailableWidth()); + ApplyTextAlign(*line_info, text_align, &line_offset.inline_offset, + inline_size); } line_box.SetInlineSize(inline_size); @@ -348,7 +348,7 @@ // Compute the spacing to justify. ShapeResultSpacing<String> spacing(line_text); - spacing.SetExpansion(expansion, Node().BaseDirection(), + spacing.SetExpansion(expansion, line_info->BaseDirection(), line_info->LineStyle().GetTextJustify()); if (!spacing.HasExpansion()) return false; // no expansion opportunities exist. @@ -379,13 +379,12 @@ return true; } -void NGInlineLayoutAlgorithm::ApplyTextAlign(ETextAlign text_align, +void NGInlineLayoutAlgorithm::ApplyTextAlign(const NGLineInfo& line_info, + ETextAlign text_align, LayoutUnit* line_left, - LayoutUnit inline_size, - LayoutUnit available_width) { - bool is_base_ltr = IsLtr(Node().BaseDirection()); - // TODO(kojii): Investigate handling trailing spaces for 'white-space: - // pre|pre-wrap'. Refer to LayoutBlockFlow::UpdateLogicalWidthForAlignment(). + LayoutUnit inline_size) { + bool is_base_ltr = IsLtr(line_info.BaseDirection()); + LayoutUnit available_width = line_info.AvailableWidth(); while (true) { switch (text_align) { case ETextAlign::kLeft:
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h index 7f613abb..9cea92e5 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
@@ -58,10 +58,10 @@ LayoutUnit position, NGLineBoxFragmentBuilder*); - void ApplyTextAlign(ETextAlign, + void ApplyTextAlign(const NGLineInfo&, + ETextAlign, LayoutUnit* line_left, - LayoutUnit inline_size, - LayoutUnit available_width); + LayoutUnit inline_size); bool ApplyJustify(NGLineInfo*); LayoutUnit ComputeContentSize(const NGLineInfo&,
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc index 4be5e20..f692f68e 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
@@ -32,9 +32,9 @@ #include "core/layout/ng/ng_length_utils.h" #include "core/layout/ng/ng_physical_box_fragment.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/shaping/HarfBuzzShaper.h" #include "platform/fonts/shaping/ShapeResultSpacing.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/CharacterNames.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc index d993acb..bfc8ba4b0 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
@@ -4,6 +4,7 @@ #include "core/layout/ng/inline/ng_line_breaker.h" +#include "core/layout/ng/inline/ng_bidi_paragraph.h" #include "core/layout/ng/inline/ng_inline_break_token.h" #include "core/layout/ng/inline/ng_inline_node.h" #include "core/layout/ng/ng_box_fragment.h" @@ -30,7 +31,8 @@ unpositioned_floats_(unpositioned_floats), break_iterator_(node.Text()), shaper_(node.Text().Characters16(), node.Text().length()), - spacing_(node.Text()) { + spacing_(node.Text()), + base_direction_(node_.BaseDirection()) { if (break_token) { item_index_ = break_token->ItemIndex(); offset_ = break_token->TextOffset(); @@ -56,6 +58,22 @@ return true; } +// Compute the base direction for bidi algorithm for this line. +void NGLineBreaker::ComputeBaseDirection() { + // If 'unicode-bidi' is not 'plaintext', use the base direction of the block. + if (!line_.is_after_forced_break || + node_.Style().GetUnicodeBidi() != UnicodeBidi::kPlaintext) + return; + // If 'unicode-bidi: plaintext', compute the base direction for each paragraph + // (separated by forced break.) + const String& text = node_.Text(); + if (text.Is8Bit()) + return; + size_t end_offset = text.find(kNewlineCharacter, offset_); + base_direction_ = NGBidiParagraph::BaseDirectionForString(node_.Text( + offset_, end_offset == kNotFound ? text.length() : end_offset)); +} + // Initialize internal states for the next line. void NGLineBreaker::PrepareNextLine(const NGExclusionSpace& exclusion_space, NGLineInfo* line_info) { @@ -65,6 +83,9 @@ line_info->SetLineStyle(node_, constraint_space_, IsFirstFormattedLine(), line_.is_after_forced_break); SetCurrentStyle(line_info->LineStyle()); + ComputeBaseDirection(); + line_info->SetBaseDirection(base_direction_); + line_.is_after_forced_break = false; line_.should_create_line_box = false; @@ -239,7 +260,7 @@ if (LayoutUnit text_indent = line_info->TextIndent()) { // Move the line box by indent. Negative indents are ink overflow, let the // line box overflow from the container box. - if (IsLtr(node_.BaseDirection())) + if (IsLtr(line_info->BaseDirection())) line_left += text_indent; available_width -= text_indent; }
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h index 05fea2fe..2152135 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h
@@ -130,6 +130,7 @@ void SkipCollapsibleWhitespaces(); bool IsFirstFormattedLine() const; + void ComputeBaseDirection(); LineData line_; NGInlineNode node_; @@ -147,6 +148,11 @@ // Keep track of handled float items. See HandleFloat(). unsigned handled_floats_end_item_index_ = 0; + // The current base direction for the bidi algorithm. + // This is copied from NGInlineNode, then updated after each forced line break + // if 'unicode-bidi: plaintext'. + TextDirection base_direction_; + // True when current box allows line wrapping. bool auto_wrap_ = false;
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc index 3e06b7f..8b638e93 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc
@@ -10,7 +10,7 @@ #include "core/layout/ng/ng_layout_result.h" #include "core/layout/ng/ng_length_utils.h" #include "core/paint/ng/ng_block_flow_painter.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc index b60d359a..5e461646 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc
@@ -75,7 +75,7 @@ .SetTextDirection(direction) .SetIsShrinkToFit(shrink_to_fit) .SetIsNewFormattingContext(is_new_formatting_context) - .SetFragmentainerSpaceAvailable(fragmentainer_space_available) + .SetFragmentainerSpaceAtBfcStart(fragmentainer_space_available) .SetFragmentationType(block_fragmentation) .ToConstraintSpace(writing_mode); }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_child_iterator_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_child_iterator_test.cc index 773660c..18334fb 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_child_iterator_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_child_iterator_test.cc
@@ -7,7 +7,7 @@ #include "core/layout/LayoutTestHelper.h" #include "core/layout/ng/ng_block_break_token.h" #include "core/layout/ng/ng_block_node.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc index 6034842f..6db3fddb 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -53,13 +53,6 @@ return false; } -// Whether we've run out of space in this flow. If so, there will be no work -// left to do for this block in this fragmentainer. -bool IsOutOfSpace(const NGConstraintSpace& space, LayoutUnit content_size) { - return space.HasBlockFragmentation() && - content_size >= space.FragmentainerSpaceAvailable(); -} - // Returns if the resulting fragment should be considered an "empty block". // There is special casing for fragments like this, e.g. margins "collapse // through", etc. @@ -319,8 +312,7 @@ container_builder_.SwapUnpositionedFloats(&unpositioned_floats_); return container_builder_.Abort(NGLayoutResult::kBfcOffsetResolved); } - if (container_builder_.DidBreak() && - IsOutOfSpace(ConstraintSpace(), content_size_)) + if (container_builder_.DidBreak() && IsFragmentainerOutOfSpace()) break; } } @@ -921,6 +913,20 @@ return child_bfc_offset; } +LayoutUnit NGBlockLayoutAlgorithm::FragmentainerSpaceAvailable() const { + DCHECK(container_builder_.BfcOffset().has_value()); + return ConstraintSpace().FragmentainerSpaceAtBfcStart() - + container_builder_.BfcOffset()->block_offset; +} + +bool NGBlockLayoutAlgorithm::IsFragmentainerOutOfSpace() const { + if (!ConstraintSpace().HasBlockFragmentation()) + return false; + if (!container_builder_.BfcOffset().has_value()) + return false; + return content_size_ >= FragmentainerSpaceAvailable(); +} + void NGBlockLayoutAlgorithm::FinalizeForFragmentation() { LayoutUnit used_block_size = BreakToken() ? BreakToken()->UsedBlockSize() : LayoutUnit(); @@ -932,8 +938,7 @@ << "Adding and subtracting the used_block_size shouldn't leave the " "block_size for this fragment smaller than zero."; - LayoutUnit space_left = ConstraintSpace().FragmentainerSpaceAvailable() - - ContainerBfcOffset().block_offset; + LayoutUnit space_left = FragmentainerSpaceAvailable(); DCHECK_GE(space_left, LayoutUnit()); if (container_builder_.DidBreak()) { @@ -1057,7 +1062,7 @@ LayoutUnit space_available; if (ConstraintSpace().HasBlockFragmentation()) { - space_available = ConstraintSpace().FragmentainerSpaceAvailable(); + space_available = ConstraintSpace().FragmentainerSpaceAtBfcStart(); // If a block establishes a new formatting context we must know our // position in the formatting context, and are able to adjust the // fragmentation line. @@ -1065,7 +1070,7 @@ space_available -= child_data.bfc_offset_estimate.block_offset; } } - space_builder.SetFragmentainerSpaceAvailable(space_available) + space_builder.SetFragmentainerSpaceAtBfcStart(space_available) .SetFragmentationType(ConstraintSpace().BlockFragmentationType()); return space_builder.ToConstraintSpace(
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h index afe57df5..8ef33bf 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
@@ -148,6 +148,14 @@ NGBreakToken* child_break_token, NGPreviousInflowPosition*); + // Return the amount of block space available in the current fragmentainer + // for the node being laid out by this algorithm. + LayoutUnit FragmentainerSpaceAvailable() const; + + // Return true if the node being laid out by this fragmentainer has used all + // the available space in the current fragmentainer. + bool IsFragmentainerOutOfSpace() const; + // Final adjustments before fragment creation. We need to prevent the // fragment from crossing fragmentainer boundaries, and rather create a break // token if we're out of space.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc index 46eec86..cf1399c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -18,7 +18,7 @@ #include "core/layout/ng/ng_physical_box_fragment.h" #include "core/layout/ng/ng_physical_fragment.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "testing/gmock/include/gmock/gmock.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index 7b922a3..7ca0e47 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -23,7 +23,7 @@ #include "core/layout/ng/ng_length_utils.h" #include "core/layout/ng/ng_writing_mode.h" #include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm.cc index d670ee6..c152a04 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm.cc
@@ -108,7 +108,7 @@ space_builder.AddBaselineRequests(ConstraintSpace().BaselineRequests()); space_builder.SetFragmentationType(kFragmentColumn); - space_builder.SetFragmentainerSpaceAvailable(adjusted_size.block_size); + space_builder.SetFragmentainerSpaceAtBfcStart(adjusted_size.block_size); space_builder.SetIsNewFormattingContext(true); space_builder.SetIsAnonymous(true);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm_test.cc index 5191c65..838482a 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_column_layout_algorithm_test.cc
@@ -511,5 +511,43 @@ EXPECT_EQ(expectation, dump); } +TEST_F(NGColumnLayoutAlgorithmTest, NestedBlockAfterBlock) { + SetBodyInnerHTML(R"HTML( + <style> + #parent { + columns: 3; + column-fill: auto; + column-gap: 10px; + width: 320px; + height: 100px; + } + </style> + <div id="container"> + <div id="parent"> + <div style="height:10px;"></div> + <div> + <div style="width:60px; height:120px;"></div> + <div style="width:50px; height:20px;"></div> + </div> + </div> + </div> + )HTML"); + + String dump = DumpFragmentTree(GetElementById("container")); + String expectation = R"DUMP(.:: LayoutNG Physical Fragment Tree ::. + offset:unplaced size:1000x100 + offset:0,0 size:320x100 + offset:0,0 size:100x100 + offset:0,0 size:100x10 + offset:0,10 size:100x90 + offset:0,0 size:60x90 + offset:110,0 size:100x50 + offset:0,0 size:100x50 + offset:0,0 size:60x30 + offset:0,30 size:50x20 +)DUMP"; + EXPECT_EQ(expectation, dump); +} + } // anonymous namespace } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc index 128f764..8742e5b2 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -17,7 +17,7 @@ NGLogicalSize percentage_resolution_size, Optional<LayoutUnit> parent_percentage_resolution_inline_size, NGPhysicalSize initial_containing_block_size, - LayoutUnit fragmentainer_space_available, + LayoutUnit fragmentainer_space_at_bfc_start, bool is_fixed_size_inline, bool is_fixed_size_block, bool is_shrink_to_fit, @@ -38,7 +38,7 @@ parent_percentage_resolution_inline_size_( parent_percentage_resolution_inline_size), initial_containing_block_size_(initial_containing_block_size), - fragmentainer_space_available_(fragmentainer_space_available), + fragmentainer_space_at_bfc_start_(fragmentainer_space_at_bfc_start), is_fixed_size_inline_(is_fixed_size_inline), is_fixed_size_block_(is_fixed_size_block), is_shrink_to_fit_(is_shrink_to_fit), @@ -180,8 +180,8 @@ other.parent_percentage_resolution_inline_size_ && initial_containing_block_size_ == other.initial_containing_block_size_ && - fragmentainer_space_available_ == - other.fragmentainer_space_available_ && + fragmentainer_space_at_bfc_start_ == + other.fragmentainer_space_at_bfc_start_ && is_fixed_size_inline_ == other.is_fixed_size_inline_ && is_fixed_size_block_ == other.is_fixed_size_block_ && is_shrink_to_fit_ == other.is_shrink_to_fit_ &&
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h index 53564073..2e38c77d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
@@ -73,10 +73,13 @@ return initial_containing_block_size_; } - // Return the block-direction space available in the current fragmentainer. - LayoutUnit FragmentainerSpaceAvailable() const { + // Return the block space that was available in the current fragmentainer at + // the start of the current block formatting context. Note that if the start + // of the current block formatting context is in a previous fragmentainer, the + // size of the current fragmentainer is returned instead. + LayoutUnit FragmentainerSpaceAtBfcStart() const { DCHECK(HasBlockFragmentation()); - return fragmentainer_space_available_; + return fragmentainer_space_at_bfc_start_; } // Whether the current constraint space is for the newly established @@ -184,7 +187,7 @@ NGLogicalSize percentage_resolution_size, Optional<LayoutUnit> parent_percentage_resolution_inline_size, NGPhysicalSize initial_containing_block_size, - LayoutUnit fragmentainer_space_available, + LayoutUnit fragmentainer_space_at_bfc_start, bool is_fixed_size_inline, bool is_fixed_size_block, bool is_shrink_to_fit, @@ -206,7 +209,7 @@ Optional<LayoutUnit> parent_percentage_resolution_inline_size_; NGPhysicalSize initial_containing_block_size_; - LayoutUnit fragmentainer_space_available_; + LayoutUnit fragmentainer_space_at_bfc_start_; unsigned is_fixed_size_inline_ : 1; unsigned is_fixed_size_block_ : 1;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc index 3c7a6420..fcb3fd3d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
@@ -16,7 +16,7 @@ NGConstraintSpaceBuilder::NGConstraintSpaceBuilder(NGWritingMode writing_mode, NGPhysicalSize icb_size) : initial_containing_block_size_(icb_size), - fragmentainer_space_available_(NGSizeIndefinite), + fragmentainer_space_at_bfc_start_(NGSizeIndefinite), parent_writing_mode_(writing_mode), is_fixed_size_inline_(false), is_fixed_size_block_(false), @@ -222,7 +222,7 @@ static_cast<NGWritingMode>(out_writing_mode), static_cast<TextDirection>(text_direction_), available_size, percentage_resolution_size, parent_percentage_resolution_inline_size, - initial_containing_block_size_, fragmentainer_space_available_, + initial_containing_block_size_, fragmentainer_space_at_bfc_start_, is_fixed_size_inline_, is_fixed_size_block_, is_shrink_to_fit_, is_inline_direction_triggers_scrollbar_, is_block_direction_triggers_scrollbar_, @@ -235,7 +235,7 @@ out_writing_mode, static_cast<TextDirection>(text_direction_), available_size, percentage_resolution_size, parent_percentage_resolution_inline_size, initial_containing_block_size_, - fragmentainer_space_available_, is_fixed_size_block_, + fragmentainer_space_at_bfc_start_, is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, is_block_direction_triggers_scrollbar_, is_inline_direction_triggers_scrollbar_,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h index c474c07..8e91f7fc 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
@@ -30,8 +30,8 @@ NGConstraintSpaceBuilder& SetPercentageResolutionSize( NGLogicalSize percentage_resolution_size); - NGConstraintSpaceBuilder& SetFragmentainerSpaceAvailable(LayoutUnit space) { - fragmentainer_space_available_ = space; + NGConstraintSpaceBuilder& SetFragmentainerSpaceAtBfcStart(LayoutUnit space) { + fragmentainer_space_at_bfc_start_ = space; return *this; } @@ -86,7 +86,7 @@ NGLogicalSize percentage_resolution_size_; Optional<NGLogicalSize> parent_percentage_resolution_size_; NGPhysicalSize initial_containing_block_size_; - LayoutUnit fragmentainer_space_available_; + LayoutUnit fragmentainer_space_at_bfc_start_; unsigned parent_writing_mode_ : 3; unsigned is_fixed_size_inline_ : 1;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc index f6a4d6f..dbbd53da 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
@@ -108,7 +108,7 @@ parent_space.WritingMode()); if (parent_space.HasBlockFragmentation()) { - return parent_space.FragmentainerSpaceAvailable() - origin_block_offset; + return parent_space.FragmentainerSpaceAtBfcStart() - origin_block_offset; } return WTF::nullopt; @@ -124,7 +124,7 @@ NGConstraintSpaceBuilder builder(parent_space); if (fragmentation_offset) { - builder.SetFragmentainerSpaceAvailable(fragmentation_offset.value()) + builder.SetFragmentainerSpaceAtBfcStart(fragmentation_offset.value()) .SetFragmentationType(parent_space.BlockFragmentationType()); } else { builder.SetFragmentationType(NGFragmentationType::kFragmentNone);
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp index 3c91fda..35fbbdb5 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
@@ -56,7 +56,7 @@ scaling_factor_(1) {} void LayoutSVGInlineText::SetTextInternal(RefPtr<StringImpl> text) { - LayoutText::SetTextInternal(std::move(text)); + LayoutText::SetTextInternal(NormalizeWhitespace(std::move(text))); if (LayoutSVGText* text_layout_object = LayoutSVGText::LocateLayoutSVGTextAncestor(this)) text_layout_object->SubtreeTextDidChange(); @@ -421,11 +421,4 @@ return Parent()->VisualRectInLocalSVGCoordinates(); } -RefPtr<StringImpl> LayoutSVGInlineText::OriginalText() const { - RefPtr<StringImpl> result = LayoutText::OriginalText(); - if (!result) - return nullptr; - return NormalizeWhitespace(std::move(result)); -} - } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h index 1ba4ce7..c90feef 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h
@@ -53,8 +53,6 @@ // round and does a better job than enclosingIntRect. FloatRect FloatLinesBoundingBox() const; - RefPtr<StringImpl> OriginalText() const override; - const char* GetName() const override { return "LayoutSVGInlineText"; } private:
diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp index 078bc511..62e6a50 100644 --- a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp
@@ -31,7 +31,7 @@ #include "core/loader/BaseFetchContext.h" #include "core/testing/NullExecutionContext.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index a633b67..3221f39e 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -87,6 +87,7 @@ #include "public/platform/WebCachePolicy.h" #include "public/platform/WebInsecureRequestPolicy.h" #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" +#include "third_party/WebKit/common/device_memory/approximated_device_memory.h" namespace blink { @@ -783,8 +784,8 @@ hints_preferences, enabled_hints)) { request.AddHTTPHeaderField( "Device-Memory", - AtomicString( - String::Number(MemoryCoordinator::GetApproximatedDeviceMemory()))); + AtomicString(String::Number( + ApproximatedDeviceMemory::GetApproximatedDeviceMemory()))); } float dpr = GetDevicePixelRatio();
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp index 539e415..34daf33 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -60,6 +60,7 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/common/device_memory/approximated_device_memory.h" namespace blink { @@ -521,13 +522,13 @@ ClientHintsPreferences preferences; preferences.SetShouldSendForTesting(mojom::WebClientHintsType::kDeviceMemory); document->GetClientHintsPreferences().UpdateFrom(preferences); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(4096); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(4096); ExpectHeader("http://www.example.com/1.gif", "Device-Memory", true, "4"); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(2048); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(2048); ExpectHeader("http://www.example.com/1.gif", "Device-Memory", true, "2"); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(64385); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(64385); ExpectHeader("http://www.example.com/1.gif", "Device-Memory", true, "64"); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(768); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(768); ExpectHeader("http://www.example.com/1.gif", "Device-Memory", true, "0.75"); ExpectHeader("http://www.example.com/1.gif", "DPR", false, ""); ExpectHeader("http://www.example.com/1.gif", "Width", false, ""); @@ -588,7 +589,7 @@ mojom::WebClientHintsType::kResourceWidth); preferences.SetShouldSendForTesting( mojom::WebClientHintsType::kViewportWidth); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(4096); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(4096); document->GetClientHintsPreferences().UpdateFrom(preferences); ExpectHeader("http://www.example.com/1.gif", "Device-Memory", true, "4"); ExpectHeader("http://www.example.com/1.gif", "DPR", true, "1");
diff --git a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp index dc04263d..6df0874 100644 --- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp +++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
@@ -41,7 +41,6 @@ #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerOrWorkletGlobalScope.h" #include "core/workers/WorkerSettings.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/network/NetworkUtils.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp index f1c6965b..3b86957 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp
@@ -36,7 +36,7 @@ #include "core/loader/ThreadableLoadingContext.h" #include "core/loader/WorkerThreadableLoader.h" #include "core/workers/WorkerGlobalScope.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp index e0a2ad97..406c669 100644 --- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
@@ -13,11 +13,11 @@ #include "core/timing/WorkerGlobalScopePerformance.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerGlobalScope.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/Supplementable.h" #include "platform/WebTaskRunner.h" #include "platform/exported/WrappedResourceRequest.h" #include "platform/loader/fetch/ResourceFetcher.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityPolicy.h" #include "public/platform/Platform.h" #include "public/platform/WebMixedContent.h"
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp index 96be84a4..5377717 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -30,7 +30,6 @@ #include "core/loader/resource/ImageResourceContent.h" #include "core/loader/resource/ImageResourceInfo.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/MemoryCache.h" @@ -40,6 +39,7 @@ #include "platform/loader/fetch/ResourceLoaderOptions.h" #include "platform/loader/fetch/ResourceLoadingLog.h" #include "platform/network/HTTPParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityViolationReportingPolicy.h" #include "platform/wtf/CurrentTime.h"
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp index 6aa815c9..6a55a41 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp
@@ -11,7 +11,6 @@ #include "core/loader/resource/ImageResourceObserver.h" #include "core/svg/graphics/SVGImage.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/geometry/IntSize.h" #include "platform/graphics/BitmapImage.h"
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp index 8aa36faf..e19e76e 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
@@ -32,7 +32,6 @@ #include <memory> #include "core/loader/resource/MockImageResourceObserver.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/exported/WrappedResourceResponse.h" #include "platform/graphics/BitmapImage.h" @@ -46,6 +45,7 @@ #include "platform/loader/fetch/UniqueIdentifier.h" #include "platform/loader/testing/MockFetchContext.h" #include "platform/loader/testing/MockResourceClient.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/test/fake_web_task_runner.h" #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" #include "platform/testing/ScopedMockedURL.h"
diff --git a/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp b/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp index 264073e9..ec49965 100644 --- a/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp
@@ -27,12 +27,12 @@ #include "core/loader/resource/XSLStyleSheetResource.h" #include "core/loader/resource/StyleSheetResourceClient.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/loader/fetch/FetchParameters.h" #include "platform/loader/fetch/ResourceClientWalker.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/TextResourceDecoderOptions.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp index b88b02d..7d8a1b6 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
@@ -13,8 +13,8 @@ #include "core/frame/LocalFrame.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ConditionalFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Vector.h" #include "platform/wtf/text/StringBuilder.h"
diff --git a/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp b/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp index 581b6b5..aa206d2b 100644 --- a/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
@@ -77,13 +77,13 @@ #include "platform/Cursor.h" #include "platform/Histogram.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebFrameScheduler.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/exported/WrappedResourceRequest.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/TouchAction.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/renderer/web_view_scheduler.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Optional.h"
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index 930d1e3b4..df2f51b 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -44,7 +44,6 @@ #include "core/paint/compositing/CompositedLayerMapping.h" #include "core/paint/compositing/PaintLayerCompositor.h" #include "core/plugins/PluginView.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/exported/WebScrollbarImpl.h" @@ -53,6 +52,7 @@ #include "platform/geometry/TransformState.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #if defined(OS_MACOSX) #include "platform/mac/ScrollAnimatorMac.h" #endif
diff --git a/third_party/WebKit/Source/core/page/scrolling/SmoothScrollTest.cpp b/third_party/WebKit/Source/core/page/scrolling/SmoothScrollTest.cpp index dfe2b0c..632c121d 100644 --- a/third_party/WebKit/Source/core/page/scrolling/SmoothScrollTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/SmoothScrollTest.cpp
@@ -416,6 +416,64 @@ ASSERT_EQ(Window().scrollY(), content->OffsetTop()); } +// This test passes if it doesn't crash/hit an ASAN check. +TEST_F(SmoothScrollTest, RemoveSequencedScrollableArea) { + v8::HandleScope HandleScope(v8::Isolate::GetCurrent()); + WebView().Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete( + "<!DOCTYPE html>" + "<style>" + ".scroller {" + " scroll-behavior: smooth;" + " overflow: scroll;" + " position: absolute;" + " z-index: 0;" + " border: 10px solid #cce;" + "}" + "#outer {" + " width: 350px;" + " height: 200px;" + " left: 50px;" + " top: 50px;" + "}" + "#inner {" + " width: 200px;" + " height: 100px;" + " left: 50px;" + " top: 200px;" + "}" + "#target {" + " margin: 200px 0 20px 200px;" + " width: 50px;" + " height: 30px;" + " background-color: #c88;" + "}" + "</style>" + "<body>" + "<div class='scroller' id='outer'>" + " <div class='scroller' id='inner'>" + " <div id='target'></div>" + " </div>" + "</div>"); + + Compositor().BeginFrame(); + + Element* target = GetDocument().getElementById("target"); + target->scrollIntoView(); + + Compositor().BeginFrame(); // update run_state_. + Compositor().BeginFrame(); // Set start_time = now. + + Element* inner = GetDocument().getElementById("inner"); + Element* outer = GetDocument().getElementById("outer"); + outer->removeChild(inner); + + // Make sure that we don't try to animate the removed scroller. + Compositor().BeginFrame(1); +} + } // namespace } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp b/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp index e37ad43..2b35e26 100644 --- a/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp +++ b/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp
@@ -10,7 +10,6 @@ #include "core/paint/PaintInfo.h" #include "core/style/BorderEdge.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/GraphicsContextStateSaver.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/paint/BoxClipper.cpp b/third_party/WebKit/Source/core/paint/BoxClipper.cpp index 373a49a5..a92aa2415 100644 --- a/third_party/WebKit/Source/core/paint/BoxClipper.cpp +++ b/third_party/WebKit/Source/core/paint/BoxClipper.cpp
@@ -9,10 +9,10 @@ #include "core/paint/ObjectPaintProperties.h" #include "core/paint/PaintInfo.h" #include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/paint/ClipDisplayItem.h" #include "platform/graphics/paint/PaintController.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/BoxDecorationData.cpp b/third_party/WebKit/Source/core/paint/BoxDecorationData.cpp index feef3cf..c026a650 100644 --- a/third_party/WebKit/Source/core/paint/BoxDecorationData.cpp +++ b/third_party/WebKit/Source/core/paint/BoxDecorationData.cpp
@@ -9,7 +9,6 @@ #include "core/paint/BoxPainter.h" #include "core/style/BorderEdge.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.cpp b/third_party/WebKit/Source/core/paint/FilterPainter.cpp index 8c53a55..c43dafb 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
@@ -8,13 +8,13 @@ #include "core/paint/FilterEffectBuilder.h" #include "core/paint/LayerClipRecorder.h" #include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/CompositorFilterOperations.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/filters/FilterEffect.h" #include "platform/graphics/paint/FilterDisplayItem.h" #include "platform/graphics/paint/PaintController.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/FragmentData.h b/third_party/WebKit/Source/core/paint/FragmentData.h index 4734982..3a20abf 100644 --- a/third_party/WebKit/Source/core/paint/FragmentData.h +++ b/third_party/WebKit/Source/core/paint/FragmentData.h
@@ -7,7 +7,6 @@ #include "core/paint/ClipRects.h" #include "core/paint/ObjectPaintProperties.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/HTMLCanvasPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/HTMLCanvasPaintInvalidator.cpp index a1b6443..8c49a4a9 100644 --- a/third_party/WebKit/Source/core/paint/HTMLCanvasPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/HTMLCanvasPaintInvalidator.cpp
@@ -12,17 +12,11 @@ namespace blink { PaintInvalidationReason HTMLCanvasPaintInvalidator::InvalidatePaint() { - PaintInvalidationReason reason = - BoxPaintInvalidator(html_canvas_, context_).InvalidatePaint(); - - HTMLCanvasElement* element = toHTMLCanvasElement(html_canvas_.GetNode()); - if (element->IsDirty()) { + auto* element = toHTMLCanvasElement(html_canvas_.GetNode()); + if (element->IsDirty()) element->DoDeferredPaintInvalidation(); - if (reason < PaintInvalidationReason::kRectangle) - reason = PaintInvalidationReason::kRectangle; - } - return reason; + return BoxPaintInvalidator(html_canvas_, context_).InvalidatePaint(); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp b/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp index ca86c4d..670891ae 100644 --- a/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp +++ b/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp
@@ -38,7 +38,6 @@ #include "core/paint/PaintLayer.h" #include "core/paint/compositing/CompositedLayerMapping.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimation.h" #include "platform/animation/CompositorAnimationCurve.h" #include "platform/animation/CompositorFloatAnimationCurve.h"
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp index 93c7be0..3f8ae83 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -353,42 +353,6 @@ } } -LayoutRect ObjectPaintInvalidator::InvalidatePaintRectangle( - const LayoutRect& dirty_rect, - DisplayItemClient* display_item_client) { - CHECK(object_.IsRooted()); - - if (dirty_rect.IsEmpty()) - return LayoutRect(); - - if (object_.View()->GetDocument().Printing() && - !RuntimeEnabledFeatures::PrintBrowserEnabled()) - return LayoutRect(); // Don't invalidate paints if we're printing. - - const LayoutBoxModelObject& paint_invalidation_container = - object_.ContainerForPaintInvalidation(); - LayoutRect dirty_rect_on_backing = dirty_rect; - PaintLayer::MapRectToPaintInvalidationBacking( - object_, paint_invalidation_container, dirty_rect_on_backing); - dirty_rect_on_backing.Move(object_.ScrollAdjustmentForPaintInvalidation( - paint_invalidation_container)); - // TODO(crbug.com/732612): Implement rectangle raster invalidation for SPv2. - if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { - InvalidatePaintUsingContainer(paint_invalidation_container, - dirty_rect_on_backing, - PaintInvalidationReason::kRectangle); - } - SlowSetPaintingLayerNeedsRepaint(); - if (display_item_client) { - InvalidateDisplayItemClient(*display_item_client, - PaintInvalidationReason::kRectangle); - } else { - object_.InvalidateDisplayItemClients(PaintInvalidationReason::kRectangle); - } - - return dirty_rect_on_backing; -} - void ObjectPaintInvalidator::SlowSetPaintingLayerNeedsRepaint() { if (PaintLayer* painting_layer = object_.PaintingLayer()) painting_layer->SetNeedsRepaint(); @@ -534,7 +498,7 @@ } DISABLE_CFI_PERF -void ObjectPaintInvalidatorWithContext::InvalidateSelectionIfNeeded( +void ObjectPaintInvalidatorWithContext::InvalidateSelection( PaintInvalidationReason reason) { // Update selection rect when we are doing full invalidation with geometry // change (in case that the object is moved, composite status changed, etc.) @@ -572,6 +536,32 @@ } DISABLE_CFI_PERF +void ObjectPaintInvalidatorWithContext::InvalidatePartialRect( + PaintInvalidationReason reason) { + if (IsImmediateFullPaintInvalidationReason(reason)) + return; + + auto rect = object_.PartialInvalidationRect(); + if (rect.IsEmpty()) + return; + + if (reason == PaintInvalidationReason::kNone) { + context_.painting_layer->SetNeedsRepaint(); + object_.InvalidateDisplayItemClients(PaintInvalidationReason::kRectangle); + } + + // TODO(crbug.com/732612): Implement rectangle raster invalidation for SPv2. + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) + return; + + context_.MapLocalRectToVisualRectInBacking(object_, rect); + if (rect.IsEmpty()) + return; + InvalidatePaintRectangleWithContext(rect, + PaintInvalidationReason::kRectangle); +} + +DISABLE_CFI_PERF PaintInvalidationReason ObjectPaintInvalidatorWithContext::InvalidatePaintWithComputedReason( PaintInvalidationReason reason) { @@ -581,7 +571,9 @@ // We need to invalidate the selection before checking for whether we are // doing a full invalidation. This is because we need to update the previous // selection rect regardless. - InvalidateSelectionIfNeeded(reason); + InvalidateSelection(reason); + + InvalidatePartialRect(reason); switch (reason) { case PaintInvalidationReason::kNone:
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h index c378560c..85142d09 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h
@@ -60,13 +60,6 @@ const LayoutRect&, PaintInvalidationReason); - // Invalidate the paint of a specific subrectangle within a given object. The - // rect is in the object's coordinate space. If a DisplayItemClient is - // specified, that client is invalidated rather than |m_object|. - // Returns the visual rect that was invalidated (i.e, invalidation in the - // space of the GraphicsLayer backing this LayoutObject). - LayoutRect InvalidatePaintRectangle(const LayoutRect&, DisplayItemClient*); - void InvalidatePaintIncludingNonCompositingDescendants(); void InvalidatePaintIncludingNonSelfPaintingLayerDescendants( const LayoutBoxModelObject& paint_invalidation_container); @@ -109,14 +102,16 @@ PaintInvalidationReason); private: - void InvalidateSelectionIfNeeded(PaintInvalidationReason); + void InvalidateSelection(PaintInvalidationReason); + void InvalidatePartialRect(PaintInvalidationReason); bool ParentFullyInvalidatedOnSameBacking(); const PaintInvalidatorContext& context_; }; -// TODO(crbug.com/457415): We should not allow paint invalidation out of paint -// invalidation state. +// Use this for cases that compositing will change and we have to do immediate +// paint invalidation. TODO(wangxianzhu): Remove this for SPv2 and SPv175 which +// will always invalidate raster after paint. class DisablePaintInvalidationStateAsserts { STACK_ALLOCATED(); WTF_MAKE_NONCOPYABLE(DisablePaintInvalidationStateAsserts);
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp index 01a2f2d..9e242bd 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp
@@ -7,6 +7,7 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutTestHelper.h" #include "core/paint/PaintLayer.h" +#include "platform/graphics/GraphicsLayer.h" #include "platform/json/JSONValues.h" #include "testing/gtest/include/gtest/gtest.h" @@ -260,4 +261,47 @@ EXPECT_EQ(target->DebugName(), s); } +TEST_F(ObjectPaintInvalidatorTest, InvalidatePaintRectangle) { + EnableCompositing(); + SetBodyInnerHTML( + "<div id='target' style='width: 200px; height: 200px; background: blue'>" + "</div>"); + + GetDocument().View()->SetTracksPaintInvalidations(true); + + auto* target = GetLayoutObjectByElementId("target"); + target->InvalidatePaintRectangle(LayoutRect(10, 10, 50, 50)); + EXPECT_EQ(LayoutRect(10, 10, 50, 50), target->PartialInvalidationRect()); + target->InvalidatePaintRectangle(LayoutRect(30, 30, 60, 60)); + EXPECT_EQ(LayoutRect(10, 10, 80, 80), target->PartialInvalidationRect()); + EXPECT_TRUE(target->MayNeedPaintInvalidation()); + + GetDocument().View()->UpdateAllLifecyclePhases(); + EXPECT_EQ(LayoutRect(), target->PartialInvalidationRect()); + + auto object_invalidations = + GetDocument().View()->TrackedObjectPaintInvalidationsAsJSON(); + ASSERT_EQ(1u, object_invalidations->size()); + String s; + const auto* entry = JSONObject::Cast(object_invalidations->at(0)); + entry->Get("reason")->AsString(&s); + EXPECT_EQ(String(PaintInvalidationReasonToString( + PaintInvalidationReason::kRectangle)), + s); + entry->Get("object")->AsString(&s); + EXPECT_EQ(target->DebugName(), s); + + const auto& raster_invalidations = GetLayoutView() + .Layer() + ->GraphicsLayerBacking() + ->GetRasterInvalidationTracking() + ->invalidations; + ASSERT_EQ(1u, raster_invalidations.size()); + EXPECT_EQ(IntRect(18, 18, 80, 80), raster_invalidations[0].rect); + EXPECT_EQ(PaintInvalidationReason::kRectangle, + raster_invalidations[0].reason); + + GetDocument().View()->SetTracksPaintInvalidations(false); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/ObjectPainter.h b/third_party/WebKit/Source/core/paint/ObjectPainter.h index 8f808c8..7b823eec 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPainter.h +++ b/third_party/WebKit/Source/core/paint/ObjectPainter.h
@@ -6,7 +6,7 @@ #define ObjectPainter_h #include "core/style/ComputedStyleConstants.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp index 9f04dd5..ef8fac7 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
@@ -54,6 +54,8 @@ const LayoutObject& object, const Rect& local_rect, const PaintInvalidatorContext& context) { + DCHECK(context.NeedsVisualRectUpdate(object)); + if (local_rect.IsEmpty()) return LayoutRect(); @@ -153,7 +155,6 @@ void PaintInvalidatorContext::MapLocalRectToVisualRectInBacking( const LayoutObject& object, LayoutRect& rect) const { - DCHECK(NeedsVisualRectUpdate(object)); rect = PaintInvalidator::MapLocalRectToVisualRectInBacking<LayoutRect, LayoutPoint>( object, rect, *this);
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index d567b4b..343418b 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -75,7 +75,6 @@ #include "core/paint/compositing/CompositedLayerMapping.h" #include "core/paint/compositing/PaintLayerCompositor.h" #include "platform/LengthFunctions.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/bindings/V8PerIsolateData.h" #include "platform/geometry/FloatPoint3D.h" @@ -84,6 +83,7 @@ #include "platform/graphics/CompositorFilterOperations.h" #include "platform/graphics/filters/Filter.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/transforms/TransformationMatrix.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp index dc0bc26..b08d2a2 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -17,7 +17,6 @@ #include "core/paint/ScrollableAreaPainter.h" #include "core/paint/Transform3DRecorder.h" #include "core/paint/compositing/CompositedLayerMapping.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatPoint3D.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/paint/CompositingRecorder.h" @@ -26,6 +25,7 @@ #include "platform/graphics/paint/ScopedPaintChunkProperties.h" #include "platform/graphics/paint/SubsequenceRecorder.h" #include "platform/graphics/paint/Transform3DDisplayItem.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Optional.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp index 6360376..dbb50a96 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -212,6 +212,9 @@ !Box().DocumentBeingDestroyed()) scroll_anchor_.ClearSelf(); + if (SmoothScrollSequencer* sequencer = GetSmoothScrollSequencer()) + sequencer->DidDisposeScrollableArea(*this); + has_been_disposed_ = true; }
diff --git a/third_party/WebKit/Source/core/paint/RarePaintData.h b/third_party/WebKit/Source/core/paint/RarePaintData.h index 9f73951..3a3d8e50 100644 --- a/third_party/WebKit/Source/core/paint/RarePaintData.h +++ b/third_party/WebKit/Source/core/paint/RarePaintData.h
@@ -47,6 +47,13 @@ selection_visual_rect_ = r; } + LayoutRect PartialInvalidationRect() const { + return partial_invalidation_rect_; + } + void SetPartialInvalidationRect(const LayoutRect& r) { + partial_invalidation_rect_ = r; + } + private: // The PaintLayer associated with this LayoutBoxModelObject. This can be null // depending on the return value of LayoutBoxModelObject::layerTypeRequired(). @@ -58,6 +65,7 @@ LayoutPoint location_in_backing_; LayoutRect selection_visual_rect_; + LayoutRect partial_invalidation_rect_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/ViewPainter.cpp b/third_party/WebKit/Source/core/paint/ViewPainter.cpp index b3fb6d7..b5104d5 100644 --- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp +++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
@@ -17,7 +17,7 @@ #include "core/paint/PaintLayer.h" #include "core/paint/ScrollRecorder.h" #include "core/paint/compositing/CompositedLayerMapping.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp index f904c82..08e69cee 100644 --- a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
@@ -65,7 +65,6 @@ #include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "platform/LengthFunctions.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontCache.h" #include "platform/geometry/TransformState.h" #include "platform/graphics/BitmapImage.h" @@ -79,6 +78,7 @@ #include "platform/graphics/paint/PaintController.h" #include "platform/graphics/paint/PaintRecordBuilder.h" #include "platform/graphics/paint/TransformDisplayItem.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/text/StringBuilder.h" #include "public/platform/WebLayerStickyPositionConstraint.h"
diff --git a/third_party/WebKit/Source/core/paint/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/paint/compositing/PaintLayerCompositor.cpp index 8ae0b46..83a46594 100644 --- a/third_party/WebKit/Source/core/paint/compositing/PaintLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/PaintLayerCompositor.cpp
@@ -56,7 +56,6 @@ #include "core/paint/compositing/GraphicsLayerUpdater.h" #include "core/probe/CoreProbes.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/CompositorMutableProperties.h" @@ -68,6 +67,7 @@ #include "platform/graphics/paint/TransformDisplayItem.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/json/JSONValues.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Optional.h" namespace blink { @@ -663,8 +663,7 @@ // to the previous frame's compositing state when changing the compositing // backing of the layer. DisableCompositingQueryAsserts disabler; - // FIXME: We should not allow paint invalidation out of paint invalidation - // state. crbug.com/457415 + // We have to do immediate paint invalidation because compositing will change. DisablePaintInvalidationStateAsserts paint_invalidation_assertisabler; ObjectPaintInvalidator(layer->GetLayoutObject())
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_block_flow_painter.cc b/third_party/WebKit/Source/core/paint/ng/ng_block_flow_painter.cc index 21be290..4067ae82 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_block_flow_painter.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_block_flow_painter.cc
@@ -9,7 +9,6 @@ #include "core/layout/ng/ng_physical_box_fragment.h" #include "core/paint/PaintInfo.h" #include "core/paint/ng/ng_box_fragment_painter.h" -#include "platform/RuntimeEnabledFeatures.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc index c7d94c3..f165d1c1 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter_test.cc
@@ -13,9 +13,9 @@ #include "core/paint/PaintInfo.h" #include "core/paint/PaintLayerPainter.h" #include "core/style/ComputedStyle.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" +#include "platform/runtime_enabled_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp index ee3d10b..ebb63665 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -50,7 +50,6 @@ #include "core/style/StyleNonInheritedVariables.h" #include "core/style/StyleRay.h" #include "platform/LengthFunctions.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/Font.h" #include "platform/fonts/FontSelector.h" #include "platform/geometry/FloatRoundedRect.h"
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index d1362d87..ad696c9 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -50,7 +50,6 @@ #include "platform/LengthBox.h" #include "platform/LengthPoint.h" #include "platform/LengthSize.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ThemeTypes.h" #include "platform/fonts/Font.h" #include "platform/fonts/FontDescription.h" @@ -58,6 +57,7 @@ #include "platform/geometry/LayoutRectOutsets.h" #include "platform/graphics/Color.h" #include "platform/graphics/TouchAction.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollTypes.h" #include "platform/text/TextDirection.h" #include "platform/text/WritingModeUtils.h"
diff --git a/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp b/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp index 2100a40..9fd8c0609 100644 --- a/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp
@@ -27,6 +27,8 @@ #include "core/SVGNames.h" #include "core/XMLNames.h" #include "core/editing/FrameSelection.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/frame/UseCounter.h" #include "core/layout/api/LineLayoutItem.h"
diff --git a/third_party/WebKit/Source/core/testing/InternalSettings.cpp b/third_party/WebKit/Source/core/testing/InternalSettings.cpp index 4d51829..7656105 100644 --- a/third_party/WebKit/Source/core/testing/InternalSettings.cpp +++ b/third_party/WebKit/Source/core/testing/InternalSettings.cpp
@@ -30,8 +30,8 @@ #include "core/dom/ExceptionCode.h" #include "core/frame/Settings.h" #include "core/page/Page.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/Supplementable.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/LocaleToScriptMapping.h" #define InternalSettingsGuardForSettingsReturn(returnValue) \
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index f4eccbe..d84d6f1 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -61,6 +61,7 @@ #include "core/editing/Editor.h" #include "core/editing/PlainTextRange.h" #include "core/editing/SurroundingText.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/iterators/TextIterator.h" #include "core/editing/markers/DocumentMarker.h" #include "core/editing/markers/DocumentMarkerController.h" @@ -134,7 +135,6 @@ #include "platform/InstanceCounters.h" #include "platform/Language.h" #include "platform/LayoutLocale.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/V8ThrowException.h" #include "platform/geometry/IntRect.h" #include "platform/geometry/LayoutRect.h" @@ -145,6 +145,7 @@ #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceLoadPriority.h" #include "platform/network/NetworkStateNotifier.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ProgrammaticScrollAnimator.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/testing/URLTestHelpers.h"
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp index db4a7f37..77211b4 100644 --- a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp +++ b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
@@ -34,7 +34,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/MathExtras.h" #include "platform/wtf/ThreadSpecific.h"
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp index 18c6ce4..90260b4c 100644 --- a/third_party/WebKit/Source/core/timing/Performance.cpp +++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -44,7 +44,7 @@ #include "core/origin_trials/OriginTrials.h" #include "core/timing/PerformanceTiming.h" #include "platform/loader/fetch/ResourceTimingInfo.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" static const double kLongTaskObserverThreshold = 0.05;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp index 28f38e4..62c48565 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -43,9 +43,9 @@ #include "core/timing/PerformanceObserver.h" #include "core/timing/PerformanceResourceTiming.h" #include "core/timing/PerformanceUserTiming.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/ResourceResponse.h" #include "platform/loader/fetch/ResourceTimingInfo.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp index 1d4e4a0..1f2f3478 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp
@@ -6,7 +6,7 @@ #include "core/frame/DOMWindow.h" #include "core/timing/SubTaskAttribution.h" #include "core/timing/TaskAttributionTiming.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp index bc14874..ad151a0 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
@@ -14,8 +14,8 @@ #include "core/loader/WorkerFetchContext.h" #include "core/workers/GlobalScopeCreationParams.h" #include "core/workers/WorkerInspectorProxy.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/ResourceFetcher.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "public/platform/WebWorkerFetchContext.h" #include "public/web/WebFrameClient.h"
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp index 2219c14..2b8d750 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp
@@ -13,9 +13,9 @@ #include "core/inspector/WorkerThreadDebugger.h" #include "core/workers/WorkerBackingThreadStartupData.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebThreadSupportingGC.h" #include "platform/bindings/V8PerIsolateData.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h"
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp index 877aee79..65cfb0d 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -53,9 +53,9 @@ #include "core/workers/WorkerThread.h" #include "platform/CrossThreadFunctional.h" #include "platform/InstanceCounters.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/MemoryCache.h" #include "platform/network/ContentSecurityPolicyParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp index 6a463f17..2c1befe 100644 --- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -13,8 +13,8 @@ #include "core/workers/WorkerReportingProxy.h" #include "core/workers/WorkerThread.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/ResourceFetcher.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Functional.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index 51179ed0..d9f610fc 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -46,12 +46,12 @@ #include "core/workers/WorkerReportingProxy.h" #include "platform/CrossThreadFunctional.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/WebThreadSupportingGC.h" #include "platform/bindings/Microtask.h" #include "platform/heap/SafePoint.h" #include "platform/heap/ThreadState.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" #include "platform/scheduler/child/worker_global_scope_scheduler.h" #include "platform/weborigin/KURL.h"
diff --git a/third_party/WebKit/Source/core/xml/XSLImportRule.h b/third_party/WebKit/Source/core/xml/XSLImportRule.h index c926336..87c8e79 100644 --- a/third_party/WebKit/Source/core/xml/XSLImportRule.h +++ b/third_party/WebKit/Source/core/xml/XSLImportRule.h
@@ -24,7 +24,7 @@ #define XSLImportRule_h #include "core/xml/XSLStyleSheet.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/xml/XSLStyleSheet.h b/third_party/WebKit/Source/core/xml/XSLStyleSheet.h index c6eba02f..36286de 100644 --- a/third_party/WebKit/Source/core/xml/XSLStyleSheet.h +++ b/third_party/WebKit/Source/core/xml/XSLStyleSheet.h
@@ -27,7 +27,7 @@ #include <libxslt/transform.h> #include "core/css/StyleSheet.h" #include "core/dom/ProcessingInstruction.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp b/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp index 7f49a3fa4..72cfe78 100644 --- a/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp +++ b/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp
@@ -30,7 +30,7 @@ #include <libxslt/extensions.h> #include <libxslt/extra.h> #include <libxslt/xsltutils.h> -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/xml/XSLTProcessor.h b/third_party/WebKit/Source/core/xml/XSLTProcessor.h index a891027..2846ef0 100644 --- a/third_party/WebKit/Source/core/xml/XSLTProcessor.h +++ b/third_party/WebKit/Source/core/xml/XSLTProcessor.h
@@ -25,8 +25,8 @@ #include "core/dom/Node.h" #include "core/xml/XSLStyleSheet.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptWrappable.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/text/StringHash.h"
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index 4354dca..090fc826e 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -61,7 +61,6 @@ #include "core/xml/parser/SharedBufferReader.h" #include "core/xml/parser/XMLDocumentParserScope.h" #include "core/xml/parser/XMLParserInput.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/FetchInitiatorTypeNames.h" @@ -70,6 +69,7 @@ #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/loader/fetch/ResourceResponse.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/AutoReset.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index 83040c71..c84b47e 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -60,7 +60,6 @@ #include "core/xmlhttprequest/XMLHttpRequestUpload.h" #include "platform/FileMetadata.h" #include "platform/HTTPNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/bindings/DOMWrapperWorld.h" #include "platform/bindings/ScriptState.h" @@ -75,6 +74,7 @@ #include "platform/network/HTTPParsers.h" #include "platform/network/NetworkLog.h" #include "platform/network/ParsedContentType.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/SecurityPolicy.h" #include "platform/wtf/Assertions.h"
diff --git a/third_party/WebKit/Source/devtools/front_end/object_ui/ObjectPropertiesSection.js b/third_party/WebKit/Source/devtools/front_end/object_ui/ObjectPropertiesSection.js index ea17463..0ae56e0 100644 --- a/third_party/WebKit/Source/devtools/front_end/object_ui/ObjectPropertiesSection.js +++ b/third_party/WebKit/Source/devtools/front_end/object_ui/ObjectPropertiesSection.js
@@ -129,18 +129,23 @@ */ static valueElementForFunctionDescription(description, includePreview, defaultName) { var valueElement = createElementWithClass('span', 'object-value-function'); - var text = description ? description.replace(/^function [gs]et /, 'function ') : ''; + var text = ''; + if (description) { + text = description.replace(/^function [gs]et /, 'function ') + .replace(/^function [gs]et\(/, 'function\(') + .replace(/^[gs]et /, ''); + } defaultName = defaultName || ''; // This set of best-effort regular expressions captures common function descriptions. // Ideally, some parser would provide prefix, arguments, function body text separately. - var isAsync = text.startsWith('async function '); - var isGenerator = text.startsWith('function* '); + var asyncMatch = text.match(/^(async\s+function)/); + var isGenerator = text.startsWith('function*'); var isGeneratorShorthand = text.startsWith('*'); - var isBasic = !isGenerator && text.startsWith('function '); + var isBasic = !isGenerator && text.startsWith('function'); var isClass = text.startsWith('class ') || text.startsWith('class{'); var firstArrowIndex = text.indexOf('=>'); - var isArrow = !isAsync && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0; + var isArrow = !asyncMatch && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0; var textAfterPrefix; if (isClass) { @@ -150,8 +155,8 @@ if (classNameMatch) className = classNameMatch[0].trim() || defaultName; addElements('class', textAfterPrefix, className); - } else if (isAsync) { - textAfterPrefix = text.substring('async function'.length); + } else if (asyncMatch) { + textAfterPrefix = text.substring(asyncMatch[1].length); addElements('async \u0192', textAfterPrefix, nameAndArguments(textAfterPrefix)); } else if (isGenerator) { textAfterPrefix = text.substring('function*'.length);
diff --git a/third_party/WebKit/Source/devtools/scripts/migrate_test/move.js b/third_party/WebKit/Source/devtools/scripts/migrate_test/move.js index 25b73f9..8f02bd7 100644 --- a/third_party/WebKit/Source/devtools/scripts/migrate_test/move.js +++ b/third_party/WebKit/Source/devtools/scripts/migrate_test/move.js
@@ -18,17 +18,7 @@ function main() { const originalTests = scanForTests([ - '../../../../LayoutTests/http/tests/inspector/appcache', - '../../../../LayoutTests/http/tests/inspector/audits', - '../../../../LayoutTests/http/tests/inspector/cache-storage', - '../../../../LayoutTests/http/tests/inspector/debugger', - '../../../../LayoutTests/http/tests/inspector/elements', - '../../../../LayoutTests/http/tests/inspector/resource-tree', - '../../../../LayoutTests/http/tests/inspector/search', - '../../../../LayoutTests/http/tests/inspector/security', - '../../../../LayoutTests/http/tests/inspector/service-workers', - '../../../../LayoutTests/http/tests/inspector/sources', - '../../../../LayoutTests/http/tests/inspector/stacktraces', + '../../../../LayoutTests/http/tests/inspector/', ]); console.log(originalTests);
diff --git a/third_party/WebKit/Source/modules/BUILD.gn b/third_party/WebKit/Source/modules/BUILD.gn index 0130611..375b540 100644 --- a/third_party/WebKit/Source/modules/BUILD.gn +++ b/third_party/WebKit/Source/modules/BUILD.gn
@@ -180,10 +180,6 @@ jumbo_source_set("modules_testing") { sources = [ - "$bindings_modules_v8_output_dir/V8InternalsPartial.cpp", - "$bindings_modules_v8_output_dir/V8InternalsPartial.h", - "$bindings_modules_v8_output_dir/V8WorkerInternalsPartial.cpp", - "$bindings_modules_v8_output_dir/V8WorkerInternalsPartial.h", "accessibility/testing/InternalsAccessibility.cpp", "accessibility/testing/InternalsAccessibility.h", "fetch/testing/InternalsFetch.cpp", @@ -209,6 +205,21 @@ "webaudio/testing/InternalsWebAudio.cpp", "webaudio/testing/InternalsWebAudio.h", ] + if (snake_case_source_files) { + sources += [ + "$bindings_modules_v8_output_dir/v8_internals_partial.cc", + "$bindings_modules_v8_output_dir/v8_internals_partial.h", + "$bindings_modules_v8_output_dir/v8_worker_internals_partial.cc", + "$bindings_modules_v8_output_dir/v8_worker_internals_partial.h", + ] + } else { + sources += [ + "$bindings_modules_v8_output_dir/V8InternalsPartial.cpp", + "$bindings_modules_v8_output_dir/V8InternalsPartial.h", + "$bindings_modules_v8_output_dir/V8WorkerInternalsPartial.cpp", + "$bindings_modules_v8_output_dir/V8WorkerInternalsPartial.h", + ] + } configs += [ "//third_party/WebKit/Source:config",
diff --git a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp index 2ee5ef7e..e1d71fd 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp
@@ -112,7 +112,7 @@ } void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& words) const { - if (!inline_text_box_) + if (!inline_text_box_ || inline_text_box_->GetText().ContainsOnlyWhitespace()) return; Vector<AbstractInlineTextBox::WordBoundaries> word_boundaries;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp index 9b7e2af..da7b066 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -39,6 +39,8 @@ #include "core/editing/FrameSelection.h" #include "core/editing/RenderedPosition.h" #include "core/editing/TextAffinity.h" +#include "core/editing/VisiblePosition.h" +#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" #include "core/editing/iterators/CharacterIterator.h" #include "core/editing/iterators/TextIterator.h" @@ -733,15 +735,6 @@ return true; } -bool AXLayoutObject::IsFocusableByDefault(Element* elem) const { - // These are the only naturally focusable elements that are focusable without - // contenteditable or tabindex. - DCHECK(elem); - return elem->IsFormControlElement() || elem->HasTagName(aTag) || - elem->HasTagName(audioTag) || elem->HasTagName(iframeTag) || - elem->HasTagName(summaryTag) || elem->HasTagName(videoTag); -} - bool AXLayoutObject::HasAriaCellRole(Element* elem) const { DCHECK(elem); const AtomicString& aria_role_str = elem->FastGetAttribute(roleAttr); @@ -792,7 +785,7 @@ Node* node = layout->GetNode(); if (node && node->IsElementNode()) { Element* elem = ToElement(node); - if (IsFocusableByDefault(elem) || HasAriaCellRole(elem)) + if (HasAriaCellRole(elem)) return true; }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h index 1d0c937..4bee3a1 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.h
@@ -213,7 +213,6 @@ bool CanIgnoreTextAsEmpty() const; bool CanIgnoreSpaceNextTo(LayoutObject*, bool is_after) const; - bool IsFocusableByDefault(Element*) const; bool HasAriaCellRole(Element*) const; };
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp index 48d6a42..aca2060 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -335,7 +335,10 @@ if (RoleValue() != kSliderRole) return; - float value = ValueForRange(); + float value; + if (!ValueForRange(&value)) + return; + float step = StepValueForRange(); value += increase ? step : -step; @@ -1803,46 +1806,64 @@ .GetString(); } -float AXNodeObject::ValueForRange() const { +bool AXNodeObject::ValueForRange(float* out_value) const { float value_now; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueNow, value_now)) - return value_now; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueNow, value_now)) { + *out_value = value_now; + return true; + } - if (IsNativeSlider()) - return toHTMLInputElement(*GetNode()).valueAsNumber(); + if (IsNativeSlider()) { + *out_value = toHTMLInputElement(*GetNode()).valueAsNumber(); + return true; + } - if (isHTMLMeterElement(GetNode())) - return toHTMLMeterElement(*GetNode()).value(); + if (isHTMLMeterElement(GetNode())) { + *out_value = toHTMLMeterElement(*GetNode()).value(); + return true; + } - return 0.0; + return false; } -float AXNodeObject::MaxValueForRange() const { +bool AXNodeObject::MaxValueForRange(float* out_value) const { float value_max; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMax, value_max)) - return value_max; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMax, value_max)) { + *out_value = value_max; + return true; + } - if (IsNativeSlider()) - return toHTMLInputElement(*GetNode()).Maximum(); + if (IsNativeSlider()) { + *out_value = toHTMLInputElement(*GetNode()).Maximum(); + return true; + } - if (isHTMLMeterElement(GetNode())) - return toHTMLMeterElement(*GetNode()).max(); + if (isHTMLMeterElement(GetNode())) { + *out_value = toHTMLMeterElement(*GetNode()).max(); + return true; + } - return 0.0; + return false; } -float AXNodeObject::MinValueForRange() const { +bool AXNodeObject::MinValueForRange(float* out_value) const { float value_min; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMin, value_min)) - return value_min; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMin, value_min)) { + *out_value = value_min; + return true; + } - if (IsNativeSlider()) - return toHTMLInputElement(*GetNode()).Minimum(); + if (IsNativeSlider()) { + *out_value = toHTMLInputElement(*GetNode()).Minimum(); + return true; + } - if (isHTMLMeterElement(GetNode())) - return toHTMLMeterElement(*GetNode()).min(); + if (isHTMLMeterElement(GetNode())) { + *out_value = toHTMLMeterElement(*GetNode()).min(); + return true; + } - return 0.0; + return false; } float AXNodeObject::StepValueForRange() const { @@ -1962,7 +1983,9 @@ GetAOMPropertyOrARIAAttribute(AOMStringProperty::kValueText); if (!aria_valuetext.IsNull()) return aria_valuetext.GetString(); - return String::Number(ValueForRange()); + float value; + if (ValueForRange(&value)) + return String::Number(value); } return StringValue();
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h index a69b6f4..47f97a5c 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h
@@ -151,9 +151,9 @@ // Only used when invalidState() returns InvalidStateOther. String AriaInvalidValue() const final; String ValueDescription() const override; - float ValueForRange() const override; - float MaxValueForRange() const override; - float MinValueForRange() const override; + bool ValueForRange(float* out_value) const override; + bool MaxValueForRange(float* out_value) const override; + bool MinValueForRange(float* out_value) const override; String StringValue() const override; // ARIA attributes.
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp index a83bb197..4e7052be 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -34,6 +34,7 @@ #include "core/dom/AccessibleNode.h" #include "core/dom/UserGestureIndicator.h" #include "core/editing/EditingUtilities.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" @@ -1919,9 +1920,13 @@ std::unique_ptr<UserGestureIndicator> gesture_indicator = LocalFrame::CreateUserGesture(document->GetFrame(), UserGestureToken::kNewGesture); - Element* action_elem = ActionElement(); - if (action_elem) { - action_elem->AccessKeyAction(true); + + Element* element = GetElement(); + if (!element && GetNode()) + element = GetNode()->parentElement(); + + if (element) { + element->AccessKeyAction(true); return true; } @@ -2360,6 +2365,10 @@ return internal_role_name_vector->at(role); } +VisiblePosition AXObject::VisiblePositionForIndex(int) const { + return VisiblePosition(); +} + DEFINE_TRACE(AXObject) { visitor->Trace(children_); visitor->Trace(parent_);
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.h b/third_party/WebKit/Source/modules/accessibility/AXObject.h index 72cf1dd..d062afb4 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObject.h
@@ -30,7 +30,9 @@ #ifndef AXObject_h #define AXObject_h -#include "core/editing/VisiblePosition.h" +#include "core/dom/Element.h" +#include "core/editing/Forward.h" +#include "core/editing/TextAffinity.h" #include "core/editing/markers/DocumentMarker.h" #include "core/inspector/protocol/Accessibility.h" #include "modules/ModulesExport.h" @@ -38,6 +40,7 @@ #include "platform/geometry/FloatQuad.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/Color.h" +#include "platform/weborigin/KURL.h" #include "platform/wtf/Forward.h" #include "platform/wtf/Vector.h" @@ -48,7 +51,6 @@ class AccessibleNodeList; class AXObject; class AXObjectCacheImpl; -class Element; class IntPoint; class LayoutObject; class LocalFrameView; @@ -626,9 +628,9 @@ // Only used when invalidState() returns InvalidStateOther. virtual String AriaInvalidValue() const { return String(); } virtual String ValueDescription() const { return String(); } - virtual float ValueForRange() const { return 0.0f; } - virtual float MaxValueForRange() const { return 0.0f; } - virtual float MinValueForRange() const { return 0.0f; } + virtual bool ValueForRange(float* out_value) const { return 0.0f; } + virtual bool MaxValueForRange(float* out_value) const { return 0.0f; } + virtual bool MinValueForRange(float* out_value) const { return false; } virtual String StringValue() const { return String(); } virtual AXRestriction Restriction() const { return kNone; } @@ -818,9 +820,7 @@ virtual void UpdateAccessibilityRole() {} // Text metrics. Most of these should be deprecated, needs major cleanup. - virtual VisiblePosition VisiblePositionForIndex(int) const { - return VisiblePosition(); - } + virtual VisiblePosition VisiblePositionForIndex(int) const; int LineForPosition(const VisiblePosition&) const; virtual int Index(const VisiblePosition&) const { return -1; } virtual void LineBreaks(Vector<int>&) const {}
diff --git a/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.cpp b/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.cpp index 3ea26dee..7fc606f 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.cpp
@@ -51,31 +51,41 @@ return AccessibilityIsIgnoredByDefault(ignored_reasons); } -float AXProgressIndicator::ValueForRange() const { +bool AXProgressIndicator::ValueForRange(float* out_value) const { float value_now; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueNow, value_now)) - return value_now; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueNow, value_now)) { + *out_value = value_now; + return true; + } - if (GetProgressElement()->position() >= 0) - return clampTo<float>(GetProgressElement()->value()); - // Indeterminate progress bar should return 0. - return 0.0f; + if (GetProgressElement()->position() >= 0) { + *out_value = clampTo<float>(GetProgressElement()->value()); + return true; + } + // Indeterminate progress bar has no value. + return false; } -float AXProgressIndicator::MaxValueForRange() const { +bool AXProgressIndicator::MaxValueForRange(float* out_value) const { float value_max; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMax, value_max)) - return value_max; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMax, value_max)) { + *out_value = value_max; + return true; + } - return clampTo<float>(GetProgressElement()->max()); + *out_value = clampTo<float>(GetProgressElement()->max()); + return true; } -float AXProgressIndicator::MinValueForRange() const { +bool AXProgressIndicator::MinValueForRange(float* out_value) const { float value_min; - if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMin, value_min)) - return value_min; + if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMin, value_min)) { + *out_value = value_min; + return true; + } - return 0.0f; + *out_value = 0.0f; + return true; } HTMLProgressElement* AXProgressIndicator::GetProgressElement() const {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.h b/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.h index e3aae0e..dd7fd44 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.h +++ b/third_party/WebKit/Source/modules/accessibility/AXProgressIndicator.h
@@ -40,9 +40,9 @@ bool IsProgressIndicator() const override { return true; } - float ValueForRange() const override; - float MaxValueForRange() const override; - float MinValueForRange() const override; + bool ValueForRange(float* out_value) const override; + bool MaxValueForRange(float* out_value) const override; + bool MinValueForRange(float* out_value) const override; AXProgressIndicator(LayoutProgress*, AXObjectCacheImpl&);
diff --git a/third_party/WebKit/Source/modules/accessibility/AccessibilityObjectModelTest.cpp b/third_party/WebKit/Source/modules/accessibility/AccessibilityObjectModelTest.cpp index a41d279..f00e2f7 100644 --- a/third_party/WebKit/Source/modules/accessibility/AccessibilityObjectModelTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AccessibilityObjectModelTest.cpp
@@ -149,9 +149,13 @@ auto* cache = AXObjectCache(); ASSERT_NE(nullptr, cache); auto* ax_slider = cache->GetOrCreate(slider); - EXPECT_EQ(-0.5f, ax_slider->MinValueForRange()); - EXPECT_EQ(0.5f, ax_slider->MaxValueForRange()); - EXPECT_EQ(0.1f, ax_slider->ValueForRange()); + float value = 0.0f; + EXPECT_TRUE(ax_slider->MinValueForRange(&value)); + EXPECT_EQ(-0.5f, value); + EXPECT_TRUE(ax_slider->MaxValueForRange(&value)); + EXPECT_EQ(0.5f, value); + EXPECT_TRUE(ax_slider->ValueForRange(&value)); + EXPECT_EQ(0.1f, value); } TEST_F(AccessibilityObjectModelTest, Level) {
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp index 6317734..d63cf0aa 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -10,6 +10,7 @@ #include "core/dom/DOMNodeIds.h" #include "core/dom/Element.h" #include "core/dom/ElementShadow.h" +#include "core/dom/FlatTreeTraversal.h" #include "core/dom/Node.h" #include "core/dom/NodeList.h" #include "core/inspector/IdentifiersFactory.h" @@ -227,12 +228,18 @@ } if (ax_object.IsRange()) { - properties.addItem( - CreateProperty(AXWidgetAttributesEnum::Valuemin, - CreateValue(ax_object.MinValueForRange()))); - properties.addItem( - CreateProperty(AXWidgetAttributesEnum::Valuemax, - CreateValue(ax_object.MaxValueForRange()))); + float min_value; + if (ax_object.MinValueForRange(&min_value)) { + properties.addItem(CreateProperty(AXWidgetAttributesEnum::Valuemin, + CreateValue(min_value))); + } + + float max_value; + if (ax_object.MaxValueForRange(&max_value)) { + properties.addItem(CreateProperty(AXWidgetAttributesEnum::Valuemax, + CreateValue(max_value))); + } + properties.addItem( CreateProperty(AXWidgetAttributesEnum::Valuetext, CreateValue(ax_object.ValueDescription()))); @@ -646,7 +653,9 @@ } // Value. if (ax_object.SupportsRangeValue()) { - node_object.setValue(CreateValue(ax_object.ValueForRange())); + float value; + if (ax_object.ValueForRange(&value)) + node_object.setValue(CreateValue(value)); } else { String string_value = ax_object.StringValue(); if (!string_value.IsEmpty())
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp index 1340ed5..2790b953 100644 --- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -22,7 +22,6 @@ #include "modules/canvas2d/CanvasStyle.h" #include "modules/canvas2d/Path2D.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/geometry/FloatQuad.h" #include "platform/graphics/CanvasHeuristicParameters.h" @@ -33,6 +32,7 @@ #include "platform/graphics/paint/PaintCanvas.h" #include "platform/graphics/paint/PaintFlags.h" #include "platform/graphics/skia/SkiaUtils.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CheckedNumeric.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp index db53e10..3bdc2a5 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -21,11 +21,11 @@ #include "modules/encryptedmedia/MediaKeysController.h" #include "platform/EncryptedMediaRequest.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ThrowException.h" #include "platform/network/ParsedContentType.h" #include "platform/network/mime/ContentType.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/Vector.h" #include "platform/wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/modules/exported/WebAXObject.cpp b/third_party/WebKit/Source/modules/exported/WebAXObject.cpp index 01a1dfd..045a9e8 100644 --- a/third_party/WebKit/Source/modules/exported/WebAXObject.cpp +++ b/third_party/WebKit/Source/modules/exported/WebAXObject.cpp
@@ -35,6 +35,7 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/dom/Document.h" #include "core/dom/Node.h" +#include "core/editing/VisiblePosition.h" #include "core/editing/markers/DocumentMarker.h" #include "core/exported/WebViewImpl.h" #include "core/frame/LocalFrameView.h" @@ -965,25 +966,25 @@ return private_->ValueDescription(); } -float WebAXObject::ValueForRange() const { +bool WebAXObject::ValueForRange(float* out_value) const { if (IsDetached()) - return 0.0; + return false; - return private_->ValueForRange(); + return private_->ValueForRange(out_value); } -float WebAXObject::MaxValueForRange() const { +bool WebAXObject::MaxValueForRange(float* out_value) const { if (IsDetached()) - return 0.0; + return false; - return private_->MaxValueForRange(); + return private_->MaxValueForRange(out_value); } -float WebAXObject::MinValueForRange() const { +bool WebAXObject::MinValueForRange(float* out_value) const { if (IsDetached()) - return 0.0; + return false; - return private_->MinValueForRange(); + return private_->MinValueForRange(out_value); } WebNode WebAXObject::GetNode() const {
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp index c1223a4..27b1462 100644 --- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
@@ -53,12 +53,12 @@ #include "modules/serviceworkers/ServiceWorkerGlobalScopeProxy.h" #include "modules/serviceworkers/ServiceWorkerInstalledScriptsManager.h" #include "modules/serviceworkers/ServiceWorkerThread.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/heap/Handle.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/loader/fetch/SubstituteData.h" #include "platform/network/NetworkUtils.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/Functional.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/modules/fetch/Request.cpp b/third_party/WebKit/Source/modules/fetch/Request.cpp index 8ecce78..5cc01db 100644 --- a/third_party/WebKit/Source/modules/fetch/Request.cpp +++ b/third_party/WebKit/Source/modules/fetch/Request.cpp
@@ -12,12 +12,12 @@ #include "modules/fetch/FetchManager.h" #include "modules/fetch/RequestInit.h" #include "platform/HTTPNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/V8PrivateProperty.h" #include "platform/loader/fetch/FetchUtils.h" #include "platform/loader/fetch/ResourceLoaderOptions.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/network/HTTPParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/OriginAccessEntry.h" #include "platform/weborigin/Referrer.h" #include "public/platform/WebURLRequest.h"
diff --git a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp index c3b2ee5..36e962a 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp +++ b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
@@ -20,9 +20,9 @@ #include "modules/fetch/BlobBytesConsumer.h" #include "modules/fetch/FormDataBytesConsumer.h" #include "modules/fetch/Headers.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/ReferrerPolicy.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp index 0cc971a..6186a195 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -73,7 +73,7 @@ #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" #include "modules/remoteplayback/RemotePlayback.h" #include "platform/EventDispatchForbiddenScope.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink { @@ -602,8 +602,7 @@ bool MediaControlsImpl::ShouldHideMediaControls(unsigned behavior_flags) const { // Never hide for a media element without visual representation. if (!MediaElement().IsHTMLVideoElement() || !MediaElement().HasVideo() || - toHTMLVideoElement(MediaElement()).GetMediaRemotingStatus() == - HTMLVideoElement::MediaRemotingStatus::kStarted) { + toHTMLVideoElement(MediaElement()).IsRemotingInterstitialVisible()) { return false; }
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp index 21f5b0b..5a20948 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
@@ -30,8 +30,8 @@ #include "modules/media_controls/elements/MediaControlVolumeSliderElement.h" #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" #include "modules/remoteplayback/RemotePlayback.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" +#include "platform/runtime_enabled_features.h" #include "platform/testing/EmptyWebMediaPlayer.h" #include "platform/testing/HistogramTester.h" #include "platform/testing/TestingPlatformSupport.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp index 5b79dc6..7ee2e519 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp
@@ -17,7 +17,7 @@ #include "modules/screen_orientation/ScreenOrientation.h" #include "modules/screen_orientation/ScreenScreenOrientation.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Functional.h" #include "platform/wtf/MathExtras.h" #include "public/platform/WebScreenInfo.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlInputElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlInputElement.cpp index 861cd47..e01431c 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlInputElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlInputElement.cpp
@@ -9,7 +9,7 @@ #include "core/html/HTMLMediaElement.h" #include "modules/media_controls/MediaControlsImpl.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/PlatformLocale.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp index a325386..b434552 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
@@ -43,10 +43,10 @@ #include "core/html/track/VideoTrackList.h" #include "modules/mediasource/MediaSourceRegistry.h" #include "modules/mediasource/SourceBufferTrackBaseSupplement.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/network/mime/ContentType.h" #include "platform/network/mime/MIMETypeRegistry.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "platform/wtf/text/CString.h" #include "public/platform/WebMediaSource.h"
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index f7ca719..5f908a5 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -51,8 +51,8 @@ #include "core/typed_arrays/DOMArrayBufferView.h" #include "modules/mediasource/MediaSource.h" #include "modules/mediasource/SourceBufferTrackBaseSupplement.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/MathExtras.h" #include "public/platform/WebSourceBuffer.h"
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp index 29cbdf4..9c104cf 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
@@ -37,7 +37,7 @@ #include "core/frame/UseCounter.h" #include "core/inspector/ConsoleMessage.h" #include "modules/mediastream/MediaTrackConstraints.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp index 049c7896..b907405 100644 --- a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp +++ b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
@@ -10,7 +10,7 @@ #include "core/dom/TaskRunnerHelper.h" #include "core/dom/events/Event.h" #include "modules/EventTargetModules.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp index 0add4ac..732d0caa 100644 --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -51,9 +51,9 @@ #include "modules/notifications/NotificationOptions.h" #include "modules/notifications/NotificationPermissionCallback.h" #include "modules/notifications/NotificationResourcesLoader.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/Functional.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp index 256d1a3..f671bd44 100644 --- a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp +++ b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp
@@ -6,7 +6,7 @@ #include "core/dom/QualifiedName.h" #include "core/html/HTMLIFrameElement.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp index 1cf724f..fa14ee6 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -39,11 +39,11 @@ #include "modules/payments/PaymentShippingOption.h" #include "modules/payments/PaymentsValidators.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/UUID.h" #include "platform/bindings/ScriptState.h" #include "platform/feature_policy/FeaturePolicy.h" #include "platform/mojo/MojoHelper.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashSet.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h"
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp index 100f7470..1967959 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
@@ -80,12 +80,12 @@ #include "modules/peerconnection/RTCTrackEvent.h" #include "modules/peerconnection/RTCVoidRequestImpl.h" #include "modules/peerconnection/RTCVoidRequestPromiseImpl.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/Microtask.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ThrowException.h" #include "platform/peerconnection/RTCAnswerOptionsPlatform.h" #include "platform/peerconnection/RTCOfferOptionsPlatform.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp index 1dfa8757..949b812 100644 --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
@@ -21,7 +21,7 @@ #include "modules/permissions/PermissionDescriptor.h" #include "modules/permissions/PermissionStatus.h" #include "modules/permissions/PermissionUtils.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Functional.h" #include "platform/wtf/NotFound.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp index 3d7b4fd5..33c7864d 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp +++ b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
@@ -27,7 +27,6 @@ #include "core/page/Page.h" #include "modules/plugins/DOMMimeTypeArray.h" #include "modules/plugins/NavigatorPlugins.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/plugins/PluginData.h" #include "platform/wtf/Vector.h" #include "platform/wtf/debug/Alias.h"
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp index 312048c..32c3c7a 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -52,7 +52,6 @@ #include "modules/serviceworkers/ServiceWorkerContainerClient.h" #include "modules/serviceworkers/ServiceWorkerError.h" #include "modules/serviceworkers/ServiceWorkerRegistration.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8ThrowException.h" #include "platform/weborigin/SchemeRegistry.h"
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp index 7cdf5f5..dc4d69d5 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp
@@ -5,9 +5,9 @@ #include "public/web/WebEmbeddedWorker.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/WebTaskRunner.h" +#include "platform/runtime_enabled_features.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp index b3851276..ab064403 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp
@@ -33,7 +33,7 @@ #include "modules/speech/SpeechRecognitionError.h" #include "modules/speech/SpeechRecognitionResult.h" #include "modules/speech/SpeechRecognitionResultList.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp index 231e83d..60ab742 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp
@@ -8,7 +8,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Screen.h" #include "core/page/PageVisibilityState.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "services/service_manager/public/cpp/interface_provider.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp index 2e8321bf..0870ea6e 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp
@@ -32,7 +32,7 @@ #include "core/frame/LocalDOMWindow.h" #include "modules/webdatabase/Database.h" #include "modules/webdatabase/DatabaseManager.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 26c91f82..1a158df9 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -90,7 +90,6 @@ #include "modules/webgl/WebGLVertexArrayObject.h" #include "modules/webgl/WebGLVertexArrayObjectOES.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/V8BindingMacros.h" @@ -100,6 +99,7 @@ #include "platform/graphics/UnacceleratedImageBufferSurface.h" #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" #include "platform/graphics/gpu/SharedGpuContext.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/Functional.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index e934390..4349a1e5 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -60,16 +60,16 @@ action("runtime_enabled_features") { script = "../build/scripts/make_runtime_features.py" - runtime_enabled_features_json5 = "RuntimeEnabledFeatures.json5" + runtime_enabled_features_json5 = "runtime_enabled_features.json5" inputs = scripts_for_json5_files + [ runtime_enabled_features_json5, - "../build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl", - "../build/scripts/templates/RuntimeEnabledFeatures.h.tmpl", + "../build/scripts/templates/runtime_enabled_features.cc.tmpl", + "../build/scripts/templates/runtime_enabled_features.h.tmpl", ] outputs = [ - "$blink_platform_output_dir/RuntimeEnabledFeatures.cpp", - "$blink_platform_output_dir/RuntimeEnabledFeatures.h", + "$blink_platform_output_dir/runtime_enabled_features.cc", + "$blink_platform_output_dir/runtime_enabled_features.h", ] args = [ @@ -1574,7 +1574,9 @@ "/wd4724", # Modulo by 0. ] } else { - sources -= [ "text/LocaleWin.cpp" ] + if (!snake_case_source_files) { + sources -= [ "text/LocaleWin.cpp" ] + } } if (is_android) { @@ -1588,7 +1590,9 @@ ] set_sources_assignment_filter(sources_assignment_filter) } else { - sources -= [ "scroll/ScrollbarThemeAndroid.cpp" ] + if (!snake_case_source_files) { + sources -= [ "scroll/ScrollbarThemeAndroid.cpp" ] + } } if (is_fuchsia) { @@ -1738,7 +1742,6 @@ "LayoutUnitTest.cpp", "LifecycleContextTest.cpp", "LongTaskDetectorTest.cpp", - "MemoryCoordinatorTest.cpp", "PODArenaTest.cpp", "PODFreeListArenaTest.cpp", "PODIntervalTreeTest.cpp",
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp index 4f5a7d1..6d6d5a5 100644 --- a/third_party/WebKit/Source/platform/DragImage.cpp +++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -27,7 +27,6 @@ #include <algorithm> #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/Font.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontDescription.h" @@ -41,6 +40,7 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/StaticBitmapImage.h" #include "platform/graphics/paint/DrawingRecorder.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/BidiTextRun.h" #include "platform/text/StringTruncator.h" #include "platform/text/TextRun.h"
diff --git a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp index 10ac888..6867e0d 100644 --- a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp +++ b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
@@ -13,6 +13,7 @@ #include "platform/wtf/allocator/Partitions.h" #include "public/platform/WebThread.h" #include "public/web/WebKit.h" +#include "third_party/WebKit/common/device_memory/approximated_device_memory.h" #if defined(OS_ANDROID) #include "base/android/sys_utils.h" @@ -26,9 +27,7 @@ } // static -float MemoryCoordinator::approximated_device_memory_gb_ = 0.0; bool MemoryCoordinator::is_low_end_device_ = false; -int64_t MemoryCoordinator::physical_memory_mb_ = 0; // static bool MemoryCoordinator::IsLowEndDevice() { @@ -36,50 +35,6 @@ } // static -int64_t MemoryCoordinator::GetPhysicalMemoryMB() { - return physical_memory_mb_; -} - -// static -void MemoryCoordinator::SetPhysicalMemoryMBForTesting( - int64_t physical_memory_mb) { - physical_memory_mb_ = physical_memory_mb; - CalculateAndSetApproximatedDeviceMemory(); -} - -// static -float MemoryCoordinator::GetApproximatedDeviceMemory() { - return approximated_device_memory_gb_; -} - -// static -void MemoryCoordinator::CalculateAndSetApproximatedDeviceMemory() { - // The calculations in this method are described in the specifcations: - // https://github.com/WICG/device-memory. - DCHECK_GT(physical_memory_mb_, 0); - int lower_bound = physical_memory_mb_; - int power = 0; - - // Extract the most significant 2-bits and their location. - while (lower_bound >= 4) { - lower_bound >>= 1; - power++; - } - // The lower_bound value is either 0b10 or 0b11. - DCHECK(lower_bound & 2); - - int64_t upper_bound = lower_bound + 1; - lower_bound = lower_bound << power; - upper_bound = upper_bound << power; - - // Find the closest bound, and convert it to GB. - if (physical_memory_mb_ - lower_bound <= upper_bound - physical_memory_mb_) - approximated_device_memory_gb_ = static_cast<float>(lower_bound) / 1024.0; - else - approximated_device_memory_gb_ = static_cast<float>(upper_bound) / 1024.0; -} - -// static bool MemoryCoordinator::IsCurrentlyLowMemory() { #if defined(OS_ANDROID) return base::android::SysUtils::IsCurrentlyLowMemory(); @@ -91,8 +46,7 @@ // static void MemoryCoordinator::Initialize() { is_low_end_device_ = ::base::SysInfo::IsLowEndDevice(); - physical_memory_mb_ = ::base::SysInfo::AmountOfPhysicalMemoryMB(); - CalculateAndSetApproximatedDeviceMemory(); + ApproximatedDeviceMemory::Initialize(); } // static
diff --git a/third_party/WebKit/Source/platform/MemoryCoordinator.h b/third_party/WebKit/Source/platform/MemoryCoordinator.h index 4103aedf..5765dee 100644 --- a/third_party/WebKit/Source/platform/MemoryCoordinator.h +++ b/third_party/WebKit/Source/platform/MemoryCoordinator.h
@@ -40,18 +40,6 @@ // Can be overridden in layout tests via internals. static bool IsLowEndDevice(); - // Returns the amount of physical memory in megabytes on the device. - static int64_t GetPhysicalMemoryMB(); - - // Returns an approximation of the physical memory rounded to to the most - // significant 2-bits. This information is provided to web-developers to allow - // them to customize the experience of their page to the possible available - // device memory. - static float GetApproximatedDeviceMemory(); - - // Override the value of the physical memory for testing. - static void SetPhysicalMemoryMBForTesting(int64_t); - // Returns true when available memory is low. // This is not cheap and should not be called repeatedly. // TODO(keishi): Remove when MemoryState is ready. @@ -89,11 +77,7 @@ void ClearMemory(); static void ClearThreadSpecificMemory(); - static void CalculateAndSetApproximatedDeviceMemory(); - - static float approximated_device_memory_gb_; static bool is_low_end_device_; - static int64_t physical_memory_mb_; HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_; HashSet<WebThread*> web_threads_;
diff --git a/third_party/WebKit/Source/platform/MemoryCoordinatorTest.cpp b/third_party/WebKit/Source/platform/MemoryCoordinatorTest.cpp deleted file mode 100644 index 9401e8f..0000000 --- a/third_party/WebKit/Source/platform/MemoryCoordinatorTest.cpp +++ /dev/null
@@ -1,50 +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 "platform/MemoryCoordinator.h" - -#include "platform/testing/TestingPlatformSupport.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace blink { - -class MemoryCoordinatorTest : public ::testing::Test {}; - -TEST_F(MemoryCoordinatorTest, GetApproximatedDeviceMemory) { - MemoryCoordinator::SetPhysicalMemoryMBForTesting(128); // 128MB - EXPECT_EQ(0.125, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(256); // 256MB - EXPECT_EQ(0.25, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(510); // <512MB - EXPECT_EQ(0.5, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(512); // 512MB - EXPECT_EQ(0.5, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(640); // 512+128MB - EXPECT_EQ(0.5, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(768); // 512+256MB - EXPECT_EQ(0.75, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(1000); // <1GB - EXPECT_EQ(1, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(1024); // 1GB - EXPECT_EQ(1, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(1536); // 1.5GB - EXPECT_EQ(1.5, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(2000); // <2GB - EXPECT_EQ(2, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(2048); // 2GB - EXPECT_EQ(2, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(3000); // <3GB - EXPECT_EQ(3, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(5120); // 5GB - EXPECT_EQ(4, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(8192); // 8GB - EXPECT_EQ(8, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(16384); // 16GB - EXPECT_EQ(16, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(32768); // 32GB - EXPECT_EQ(32, MemoryCoordinator::GetApproximatedDeviceMemory()); - MemoryCoordinator::SetPhysicalMemoryMBForTesting(64385); // <64GB - EXPECT_EQ(64, MemoryCoordinator::GetApproximatedDeviceMemory()); -} -} // namespace blink
diff --git a/third_party/WebKit/Source/platform/PRESUBMIT.py b/third_party/WebKit/Source/platform/PRESUBMIT.py index 87b3261c..e053782 100644 --- a/third_party/WebKit/Source/platform/PRESUBMIT.py +++ b/third_party/WebKit/Source/platform/PRESUBMIT.py
@@ -16,7 +16,7 @@ def RuntimeEnabledFeatureNames(filename): - """Reads the 'name' of each feature in RuntimeEnabledFeatures.json5.""" + """Reads the 'name' of each feature in runtime_enabled_features.json5.""" # Note: We don't have a JSON5 parser available, so just use a regex. with open(filename) as f: for line in f: @@ -26,11 +26,11 @@ def _CheckRuntimeEnabledFeaturesSorted(input_api, output_api): - """Check: RuntimeEnabledFeatures.json5 feature list sorted alphabetically. + """Check: runtime_enabled_features.json5 feature list sorted alphabetically. """ - # Read RuntimeEnabledFeatures.json5 using the JSON5 parser. + # Read runtime_enabled_features.json5 using the JSON5 parser. filename = os.path.join(input_api.PresubmitLocalPath(), - 'RuntimeEnabledFeatures.json5') + 'runtime_enabled_features.json5') features = list(RuntimeEnabledFeatureNames(filename)) # Sort the 'data' section by name. @@ -43,7 +43,7 @@ differ = difflib.Differ() diff = differ.compare(features, features_sorted) return [output_api.PresubmitError( - 'RuntimeEnabledFeatures.json5 features must be sorted alphabetically. ' + 'runtime_enabled_features.json5 features must be sorted alphabetically. ' 'Diff of feature order follows:', long_text='\n'.join(diff))]
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunction.h b/third_party/WebKit/Source/platform/animation/TimingFunction.h index 3cf2fa43..7a60607 100644 --- a/third_party/WebKit/Source/platform/animation/TimingFunction.h +++ b/third_party/WebKit/Source/platform/animation/TimingFunction.h
@@ -27,7 +27,7 @@ #include "cc/animation/timing_function.h" #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/RefCounted.h"
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp index 0d93ff75..779b204d 100644 --- a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp +++ b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp
@@ -32,7 +32,7 @@ #include <sstream> #include <string> -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/text/WTFString.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp index 4061495..1e61fb9 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -31,11 +31,11 @@ #include <memory> #include "platform/CrossThreadFunctional.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebTaskRunner.h" #include "platform/audio/AudioUtilities.h" #include "platform/audio/PushPullFIFO.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/platform/bindings/RuntimeCallStats.h b/third_party/WebKit/Source/platform/bindings/RuntimeCallStats.h index 3b1214cf..26932ce 100644 --- a/third_party/WebKit/Source/platform/bindings/RuntimeCallStats.h +++ b/third_party/WebKit/Source/platform/bindings/RuntimeCallStats.h
@@ -9,10 +9,10 @@ #define RuntimeCallStats_h #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/bindings/RuntimeCallStatsCountEverything.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/instrumentation/tracing/TracedValue.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Optional.h" #include "platform/wtf/Time.h"
diff --git a/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp b/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp index edbf206..773e4e6 100644 --- a/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp +++ b/third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp
@@ -4,7 +4,7 @@ #include "platform/bindings/RuntimeCallStats.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp index f59565c..e6ea7b17 100644 --- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
@@ -27,7 +27,6 @@ #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebTaskRunner.h" #include "platform/bindings/DOMDataStore.h"
diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h index 2e8b465..10475068 100644 --- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h +++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
@@ -249,8 +249,17 @@ explicit V8PerIsolateData(const intptr_t* reference_table); ~V8PerIsolateData(); + // A really simple hash function, which makes lookups faster. The set of + // possible keys for this is relatively small and fixed at compile time, so + // collisions are less of a worry than they would otherwise be. + struct SimplePtrHash : WTF::PtrHash<const void> { + static unsigned GetHash(const void* key) { + uintptr_t k = reinterpret_cast<uintptr_t>(key); + return static_cast<unsigned>(k ^ (k >> 8)); + } + }; using V8FunctionTemplateMap = - HashMap<const void*, v8::Eternal<v8::FunctionTemplate>>; + HashMap<const void*, v8::Eternal<v8::FunctionTemplate>, SimplePtrHash>; V8FunctionTemplateMap& SelectInterfaceTemplateMap(const DOMWrapperWorld&); V8FunctionTemplateMap& SelectOperationTemplateMap(const DOMWrapperWorld&); bool HasInstance(const WrapperTypeInfo* untrusted,
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.cpp b/third_party/WebKit/Source/platform/blob/BlobData.cpp index 3419935a..55470e0a 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobData.cpp
@@ -33,11 +33,11 @@ #include <memory> #include "mojo/public/cpp/bindings/strong_binding.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/UUID.h" #include "platform/WebTaskRunner.h" #include "platform/blob/BlobBytesProvider.h" #include "platform/blob/BlobRegistry.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/LineEnding.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp index 6777ec77..b9cd83e 100644 --- a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
@@ -30,7 +30,7 @@ #include "public/platform/WebRuntimeFeatures.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp index 1b5e54e..dec046a 100644 --- a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp
@@ -31,7 +31,6 @@ #include "public/platform/WebURLRequest.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp index 90cd83a..e04bd4e2 100644 --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
@@ -3,9 +3,9 @@ #include "platform/feature_policy/FeaturePolicy.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/json/JSONValues.h" #include "platform/network/HTTPParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/ASCIICType.h" #include "platform/wtf/BitVector.h"
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp index e3f3ea03..85bec50 100644 --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
@@ -4,7 +4,6 @@ #include "platform/feature_policy/FeaturePolicy.h" -#include "platform/RuntimeEnabledFeatures.h" #include "testing/gtest/include/gtest/gtest.h" // Origin strings used for tests
diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp index ed7ea02a..4474fbef 100644 --- a/third_party/WebKit/Source/platform/fonts/Font.cpp +++ b/third_party/WebKit/Source/platform/fonts/Font.cpp
@@ -26,7 +26,6 @@ #include "platform/LayoutTestSupport.h" #include "platform/LayoutUnit.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/CharacterRange.h" #include "platform/fonts/FontCache.h" #include "platform/fonts/FontFallbackIterator.h"
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index ca0d7dae..f3bbedb 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -35,7 +35,6 @@ #include "build/build_config.h" #include "platform/FontFamilyNames.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/AcceptLanguagesResolver.h" #include "platform/fonts/AlternateFontFamily.h" #include "platform/fonts/FontCacheClient.h" @@ -51,6 +50,7 @@ #include "platform/fonts/shaping/ShapeCache.h" #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" #include "platform/instrumentation/tracing/web_process_memory_dump.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/ListHashSet.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp index 26dc849..fa8b94f 100644 --- a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
@@ -30,7 +30,6 @@ #include "platform/fonts/FontDescription.h" #include "platform/Language.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/HashFunctions.h" #include "platform/wtf/StringHasher.h"
diff --git a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm index 2f91a0bb..3b5d5dd 100644 --- a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm +++ b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm
@@ -33,7 +33,6 @@ #include <memory> #include "platform/FontFamilyNames.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebTaskRunner.h" #include "platform/fonts/FontDescription.h" #include "platform/fonts/FontFaceCreationParams.h"
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp index 31a1affa..7a34a790d 100644 --- a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp +++ b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp
@@ -35,7 +35,6 @@ #include "SkFontMgr.h" #include "SkTypeface_win.h" #include "platform/Language.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/fonts/FontDescription.h" #include "platform/fonts/FontFaceCreationParams.h" #include "platform/fonts/FontPlatformData.h"
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp index 45ad8d1..93abad85 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -26,7 +26,6 @@ #include "platform/graphics/BitmapImage.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/Timer.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/BitmapImageMetrics.h" @@ -39,6 +38,7 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/instrumentation/PlatformInstrumentation.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/PassRefPtr.h"
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 0e6c1347..8387b8c 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -33,7 +33,6 @@ #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" #include "gpu/command_buffer/common/capabilities.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebTaskRunner.h" #include "platform/graphics/AcceleratedStaticBitmapImage.h" #include "platform/graphics/CanvasHeuristicParameters.h" @@ -45,6 +44,7 @@ #include "platform/graphics/gpu/SharedGpuContext.h" #include "platform/graphics/paint/PaintCanvas.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index cb72bc7..cb7a78f2 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -32,7 +32,6 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/capabilities.h" #include "platform/CrossThreadFunctional.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/WebTaskRunner.h" #include "platform/graphics/ImageBuffer.h" @@ -43,6 +42,7 @@ #include "platform/graphics/paint/PaintFlags.h" #include "platform/graphics/test/FakeGLES2Interface.h" #include "platform/graphics/test/FakeWebGraphicsContext3DProvider.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/testing/TestingPlatformSupport.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasColorParams.cpp b/third_party/WebKit/Source/platform/graphics/CanvasColorParams.cpp index 3651c40..9c941fc 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasColorParams.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasColorParams.cpp
@@ -4,7 +4,7 @@ #include "platform/graphics/CanvasColorParams.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "ui/gfx/color_space.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/Color.cpp b/third_party/WebKit/Source/platform/graphics/Color.cpp index 15c92dd..2b255fc 100644 --- a/third_party/WebKit/Source/platform/graphics/Color.cpp +++ b/third_party/WebKit/Source/platform/graphics/Color.cpp
@@ -27,7 +27,7 @@ #include "build/build_config.h" #include "platform/Decimal.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/HexNumber.h" #include "platform/wtf/MathExtras.h"
diff --git a/third_party/WebKit/Source/platform/graphics/ColorCorrectionTestUtils.h b/third_party/WebKit/Source/platform/graphics/ColorCorrectionTestUtils.h index deb12c27..996828a 100644 --- a/third_party/WebKit/Source/platform/graphics/ColorCorrectionTestUtils.h +++ b/third_party/WebKit/Source/platform/graphics/ColorCorrectionTestUtils.h
@@ -5,7 +5,7 @@ #ifndef ColorCorrectionTestUtils_h #define ColorCorrectionTestUtils_h -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp index da8bd5f..b212145 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp
@@ -4,8 +4,6 @@ #include "platform/graphics/CompositorElementId.h" -#include "platform/RuntimeEnabledFeatures.h" - namespace blink { UniqueObjectId NewUniqueObjectId() {
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp index b73d44e..d8208f88 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -26,13 +26,13 @@ #include "platform/graphics/DeferredImageDecoder.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/graphics/DecodingImageGenerator.h" #include "platform/graphics/ImageDecodingStore.h" #include "platform/graphics/ImageFrameGenerator.h" #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/SegmentReader.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/PtrUtil.h" #include "third_party/skia/include/core/SkImage.h"
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index cb634a1..c402c71e 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -26,7 +26,6 @@ #include "platform/graphics/GraphicsLayer.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimation.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/animation/CompositorAnimationPlayer.h"
diff --git a/third_party/WebKit/Source/platform/graphics/Image.cpp b/third_party/WebKit/Source/platform/graphics/Image.cpp index 7041ff9..a476366 100644 --- a/third_party/WebKit/Source/platform/graphics/Image.cpp +++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
@@ -27,7 +27,6 @@ #include "platform/graphics/Image.h" #include "platform/Length.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/geometry/FloatPoint.h" #include "platform/geometry/FloatRect.h"
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index 9bc56f8..d729cb4 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -36,7 +36,6 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/sync_token.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/CanvasHeuristicParameters.h" #include "platform/graphics/GraphicsContext.h" @@ -51,6 +50,7 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-encoders/ImageEncoder.h" #include "platform/network/mime/MIMETypeRegistry.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/MathExtras.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp index 5467cb6..a805bc3b 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -8,7 +8,6 @@ #include "cc/layers/picture_layer.h" #include "cc/paint/display_item_list.h" #include "cc/trees/layer_tree_host.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/compositing/ContentLayerClientImpl.h" #include "platform/graphics/paint/ClipPaintPropertyNode.h" @@ -21,6 +20,7 @@ #include "platform/graphics/paint/ScrollHitTestDisplayItem.h" #include "platform/graphics/paint/ScrollPaintPropertyNode.h" #include "platform/graphics/paint/TransformPaintPropertyNode.h" +#include "platform/runtime_enabled_features.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "public/platform/WebLayer.h"
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h index 96793eb..50175af 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
@@ -8,7 +8,6 @@ #include <memory> #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsLayerClient.h" #include "platform/graphics/compositing/PropertyTreeManager.h" #include "platform/graphics/paint/PaintController.h"
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index b110b72..26ff4404 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -40,7 +40,6 @@ #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" #include "gpu/command_buffer/common/capabilities.h" #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/AcceleratedStaticBitmapImage.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/ImageBuffer.h" @@ -48,6 +47,7 @@ #include "platform/graphics/WebGraphicsContext3DProviderWrapper.h" #include "platform/graphics/gpu/Extensions3DUtil.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CheckedNumeric.h" #include "platform/wtf/typed_arrays/ArrayBufferContents.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h index 4e54511af..dc30c52 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h
@@ -7,10 +7,10 @@ #include "build/build_config.h" #include "gpu/command_buffer/common/capabilities.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/CanvasColorParams.h" #include "platform/graphics/gpu/DrawingBuffer.h" #include "platform/graphics/gpu/Extensions3DUtil.h" +#include "platform/runtime_enabled_features.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp index 74c70d0b..4dce065 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.cpp
@@ -4,7 +4,6 @@ #include "platform/graphics/paint/CompositingDisplayItem.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/skia/SkiaUtils.h" #include "public/platform/WebDisplayItemList.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h index ea9b8333..f3d5d5f2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -6,9 +6,9 @@ #define DisplayItem_h #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/ContiguousContainer.h" #include "platform/graphics/paint/DisplayItemClient.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h index 9fa74b0..313ab30 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h
@@ -7,10 +7,10 @@ #include "base/compiler_specific.h" #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/paint/DisplayItem.h" #include "platform/graphics/paint/PaintRecord.h" +#include "platform/runtime_enabled_features.h" #include "third_party/skia/include/core/SkRefCnt.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp index 6bcbdbdc..02c3709 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
@@ -4,11 +4,11 @@ #include "platform/graphics/paint/DrawingRecorder.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/paint/PaintController.h" #include "platform/graphics/paint/PaintRecord.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h index 9fbd67e..f0cae5f 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.h
@@ -7,7 +7,6 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/paint/DisplayItem.h" namespace cc {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp index 1df57ef..a94e67e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -4,8 +4,8 @@ #include "platform/graphics/paint/GeometryMapper.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/LayoutRect.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkTest.cpp index a1df592..bcd93bf 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkTest.cpp
@@ -4,7 +4,6 @@ #include "platform/graphics/paint/PaintChunk.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/testing/FakeDisplayItemClient.h" #include "platform/wtf/Optional.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp index ef04c25a..5904634d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
@@ -4,7 +4,7 @@ #include "platform/graphics/paint/PaintChunker.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h index 44281f8..8a856b71 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h
@@ -8,7 +8,6 @@ #include <memory> #include <utility> #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/IntRect.h" #include "platform/geometry/LayoutPoint.h" #include "platform/graphics/ContiguousContainer.h" @@ -19,6 +18,7 @@ #include "platform/graphics/paint/PaintChunker.h" #include "platform/graphics/paint/RasterInvalidationTracking.h" #include "platform/graphics/paint/Transform3DDisplayItem.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Alignment.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/HashMap.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index 6cfeb9b..5585a263 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -6,7 +6,6 @@ #include <memory> #include "build/build_config.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/ClipPathDisplayItem.h" #include "platform/graphics/paint/ClipPathRecorder.h" @@ -15,6 +14,7 @@ #include "platform/graphics/paint/DrawingDisplayItem.h" #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/SubsequenceRecorder.h" +#include "platform/runtime_enabled_features.h" #include "platform/testing/FakeDisplayItemClient.h" #include "platform/testing/PaintPropertyTestHelpers.h" #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h b/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h index e65b3890..4ad2c98a 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h +++ b/third_party/WebKit/Source/platform/graphics/paint/RasterInvalidationTracking.h
@@ -5,7 +5,6 @@ #ifndef RasterInvalidationTracking_h #define RasterInvalidationTracking_h -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/IntRect.h" #include "platform/geometry/Region.h" #include "platform/graphics/PaintInvalidationReason.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h index e02a0b78..6a6ea2fe 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollHitTestDisplayItem.h
@@ -7,7 +7,6 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/paint/DisplayItem.h" #include "platform/graphics/paint/TransformPaintPropertyNode.h"
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index 09eece73..a066b73 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -32,7 +32,6 @@ #include <memory> #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/heap/BlinkGCMemoryDumpProvider.h" #include "platform/heap/CallbackStack.h"
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp index 8b925d1..c76e291 100644 --- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -5,9 +5,9 @@ #include "platform/heap/HeapCompact.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Heap.h" #include "platform/heap/SparseHeapBitmap.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/CurrentTime.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/HashSet.h"
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 26f0ecd..4df4a15f 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -37,7 +37,6 @@ #include "base/trace_event/process_memory_dump.h" #include "build/build_config.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/bindings/RuntimeCallStats.h" #include "platform/heap/BlinkGCMemoryDumpProvider.h"
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp index 3b129f19..a2e5e9cc 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -21,7 +21,6 @@ #include "platform/image-decoders/ImageDecoder.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/BitmapImageMetrics.h" #include "platform/image-decoders/FastSharedBufferReader.h" #include "platform/image-decoders/bmp/BMPImageDecoder.h"
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp index f7330361..cfda667c 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
@@ -26,7 +26,6 @@ #include "platform/image-decoders/ImageFrame.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/ImageDecoder.h"
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp index 4b9e404..e10c8b25 100644 --- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
@@ -31,7 +31,6 @@ #include "platform/image-decoders/webp/WEBPImageDecoder.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/image-decoders/ImageDecoderTestHelpers.h" #include "platform/wtf/PtrUtil.h"
diff --git a/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.cpp b/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.cpp index 65a3e3c..1df853c 100644 --- a/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.cpp +++ b/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.cpp
@@ -5,8 +5,8 @@ #include "platform/loader/SubresourceIntegrity.h" #include "platform/Crypto.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/Resource.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/ASCIICType.h"
diff --git a/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp b/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp index c4677ad7..849aa741 100644 --- a/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp +++ b/third_party/WebKit/Source/platform/loader/SubresourceIntegrityTest.cpp
@@ -5,7 +5,6 @@ #include "platform/loader/SubresourceIntegrity.h" #include "platform/Crypto.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/IntegrityMetadata.h" #include "platform/loader/fetch/RawResource.h" #include "platform/loader/fetch/Resource.h" @@ -15,6 +14,7 @@ #include "platform/loader/fetch/ResourceResponse.h" #include "platform/loader/testing/CryptoTestingPlatformSupport.h" #include "platform/loader/testing/MockFetchContext.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp index adedfdeb..ce37b08 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
@@ -5,9 +5,9 @@ #include "platform/loader/fetch/ClientHintsPreferences.h" #include "platform/HTTPNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/fetch/ResourceResponse.h" #include "platform/network/HTTPParsers.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp index 4352014..c3dc56c 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
@@ -33,7 +33,6 @@ #include "build/build_config.h" #include "platform/Histogram.h" #include "platform/InstanceCounters.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" #include "platform/WebTaskRunner.h" #include "platform/instrumentation/tracing/TraceEvent.h"
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index 0cebff5..c925881 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -29,7 +29,6 @@ #include "base/time/time.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/instrumentation/tracing/TracedValue.h" @@ -46,6 +45,7 @@ #include "platform/network/NetworkInstrumentation.h" #include "platform/network/NetworkUtils.h" #include "platform/probe/PlatformProbes.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/child/web_scheduler.h" #include "platform/weborigin/KnownPorts.h" #include "platform/weborigin/SecurityOrigin.h"
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp index c103a455..f9f0680 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadScheduler.cpp
@@ -7,7 +7,7 @@ #include "base/metrics/field_trial_params.h" #include "base/strings/string_number_conversions.h" #include "platform/Histogram.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp index 733e75f..26762098 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoadSchedulerTest.cpp
@@ -4,8 +4,8 @@ #include "platform/loader/fetch/ResourceLoadScheduler.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/loader/testing/MockFetchContext.h" +#include "platform/runtime_enabled_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp index 0cb87da2..ece439c 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp
@@ -28,8 +28,8 @@ #include <memory> #include "platform/HTTPNames.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/network/NetworkUtils.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/WebAddressSpace.h"
diff --git a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm index f714162..65d62da 100644 --- a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm +++ b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm
@@ -7,7 +7,7 @@ #import <AppKit/AppKit.h> #import <CoreGraphics/CoreGraphics.h> -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/RetainPtr.h" #include "skia/ext/skia_utils_mac.h"
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/runtime_enabled_features.json5 similarity index 99% rename from third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 rename to third_party/WebKit/Source/platform/runtime_enabled_features.json5 index 933992ed..caf432c 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/runtime_enabled_features.json5
@@ -1,7 +1,7 @@ { // http://dev.chromium.org/blink/runtime-enabled-features // - // This list is used to generate RuntimeEnabledFeatures.h/cpp which contains + // This list is used to generate runtime_enabled_features.h/cc which contains // a class that stores static enablers for all experimental features. parameters: {
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue.cc index f2d6a30..e28ed44 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue.cc
@@ -20,6 +20,15 @@ bool nestable) : PendingTask(posted_from, std::move(task), desired_run_time, nestable) {} +TaskQueue::PostedTask::PostedTask(base::OnceClosure callback, + base::Location posted_from, + base::TimeDelta delay, + bool nestable) + : callback(std::move(callback)), + posted_from(posted_from), + delay(delay), + nestable(nestable) {} + void TaskQueue::UnregisterTaskQueue() { impl_->UnregisterTaskQueue(this); } @@ -31,13 +40,15 @@ bool TaskQueue::PostDelayedTask(const base::Location& from_here, base::OnceClosure task, base::TimeDelta delay) { - return impl_->PostDelayedTask(from_here, std::move(task), delay); + return impl_->PostDelayedTask( + PostedTask(std::move(task), from_here, delay, /* nestable */ true)); } bool TaskQueue::PostNonNestableDelayedTask(const base::Location& from_here, base::OnceClosure task, base::TimeDelta delay) { - return impl_->PostNonNestableDelayedTask(from_here, std::move(task), delay); + return impl_->PostDelayedTask( + PostedTask(std::move(task), from_here, delay, /* nestable */ false)); } std::unique_ptr<TaskQueue::QueueEnabledVoter>
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue.h index 3613a9aa..77b9154f 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue.h +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue.h
@@ -48,6 +48,20 @@ base::TimeTicks next_wake_up) = 0; }; + // A wrapper around base::OnceClosure with additional metadata to be passed + // to PostTask and plumbed until PendingTask is created. + struct PostedTask { + PostedTask(base::OnceClosure callback, + base::Location posted_from, + base::TimeDelta delay, + bool nestable); + + base::OnceClosure callback; + base::Location posted_from; + base::TimeDelta delay; + bool nestable; + }; + // Unregisters the task queue after which no tasks posted to it will run and // the TaskQueueManager's reference to it will be released soon. virtual void UnregisterTaskQueue();
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc index 9ad2512..9a4b43b 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -164,33 +164,17 @@ return base::PlatformThread::CurrentId() == thread_id_; } -bool TaskQueueImpl::PostDelayedTask(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay) { - if (delay.is_zero()) - return PostImmediateTaskImpl(from_here, std::move(task), TaskType::NORMAL); +bool TaskQueueImpl::PostDelayedTask(TaskQueue::PostedTask task) { + if (task.delay.is_zero()) + return PostImmediateTaskImpl(std::move(task)); - return PostDelayedTaskImpl(from_here, std::move(task), delay, - TaskType::NORMAL); + return PostDelayedTaskImpl(std::move(task)); } -bool TaskQueueImpl::PostNonNestableDelayedTask(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay) { - if (delay.is_zero()) - return PostImmediateTaskImpl(from_here, std::move(task), - TaskType::NON_NESTABLE); - - return PostDelayedTaskImpl(from_here, std::move(task), delay, - TaskType::NON_NESTABLE); -} - -bool TaskQueueImpl::PostImmediateTaskImpl(const base::Location& from_here, - base::OnceClosure task, - TaskType task_type) { +bool TaskQueueImpl::PostImmediateTaskImpl(TaskQueue::PostedTask task) { // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167 // for details. - CHECK(task); + CHECK(task.callback); base::AutoLock lock(any_thread_lock_); if (!any_thread().task_queue_manager) return false; @@ -198,20 +182,17 @@ EnqueueOrder sequence_number = any_thread().task_queue_manager->GetNextSequenceNumber(); - PushOntoImmediateIncomingQueueLocked(from_here, std::move(task), - base::TimeTicks(), sequence_number, - task_type != TaskType::NON_NESTABLE); + PushOntoImmediateIncomingQueueLocked( + Task(task.posted_from, std::move(task.callback), base::TimeTicks(), + sequence_number, task.nestable, sequence_number)); return true; } -bool TaskQueueImpl::PostDelayedTaskImpl(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay, - TaskType task_type) { +bool TaskQueueImpl::PostDelayedTaskImpl(TaskQueue::PostedTask task) { // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167 // for details. - CHECK(task); - DCHECK_GT(delay, base::TimeDelta()); + CHECK(task.callback); + DCHECK_GT(task.delay, base::TimeDelta()); if (base::PlatformThread::CurrentId() == thread_id_) { // Lock-free fast path for delayed tasks posted from the main thread. if (!main_thread_only().task_queue_manager) @@ -221,10 +202,10 @@ main_thread_only().task_queue_manager->GetNextSequenceNumber(); base::TimeTicks time_domain_now = main_thread_only().time_domain->Now(); - base::TimeTicks time_domain_delayed_run_time = time_domain_now + delay; + base::TimeTicks time_domain_delayed_run_time = time_domain_now + task.delay; PushOntoDelayedIncomingQueueFromMainThread( - Task(from_here, std::move(task), time_domain_delayed_run_time, - sequence_number, task_type != TaskType::NON_NESTABLE), + Task(task.posted_from, std::move(task.callback), + time_domain_delayed_run_time, sequence_number, task.nestable), time_domain_now); } else { // NOTE posting a delayed task from a different thread is not expected to @@ -239,10 +220,10 @@ any_thread().task_queue_manager->GetNextSequenceNumber(); base::TimeTicks time_domain_now = any_thread().time_domain->Now(); - base::TimeTicks time_domain_delayed_run_time = time_domain_now + delay; + base::TimeTicks time_domain_delayed_run_time = time_domain_now + task.delay; PushOntoDelayedIncomingQueueLocked( - Task(from_here, std::move(task), time_domain_delayed_run_time, - sequence_number, task_type != TaskType::NON_NESTABLE)); + Task(task.posted_from, std::move(task.callback), + time_domain_delayed_run_time, sequence_number, task.nestable)); } return true; } @@ -273,10 +254,11 @@ int thread_hop_task_sequence_number = any_thread().task_queue_manager->GetNextSequenceNumber(); PushOntoImmediateIncomingQueueLocked( - FROM_HERE, - base::Bind(&TaskQueueImpl::ScheduleDelayedWorkTask, - base::Unretained(this), base::Passed(&pending_task)), - base::TimeTicks(), thread_hop_task_sequence_number, false); + Task(FROM_HERE, + base::Bind(&TaskQueueImpl::ScheduleDelayedWorkTask, + base::Unretained(this), base::Passed(&pending_task)), + base::TimeTicks(), thread_hop_task_sequence_number, false, + thread_hop_task_sequence_number)); } void TaskQueueImpl::ScheduleDelayedWorkTask(Task pending_task) { @@ -300,22 +282,18 @@ TraceQueueSize(); } -void TaskQueueImpl::PushOntoImmediateIncomingQueueLocked( - const base::Location& posted_from, - base::OnceClosure task, - base::TimeTicks desired_run_time, - EnqueueOrder sequence_number, - bool nestable) { +void TaskQueueImpl::PushOntoImmediateIncomingQueueLocked(Task task) { // If the |immediate_incoming_queue| is empty we need a DoWork posted to make // it run. bool was_immediate_incoming_queue_empty; + EnqueueOrder sequence_number = task.sequence_num; + base::TimeTicks desired_run_time = task.delayed_run_time; + { base::AutoLock lock(immediate_incoming_queue_lock_); was_immediate_incoming_queue_empty = immediate_incoming_queue().empty(); - immediate_incoming_queue().emplace_back(posted_from, std::move(task), - desired_run_time, sequence_number, - nestable, sequence_number); + immediate_incoming_queue().push_back(std::move(task)); any_thread().task_queue_manager->DidQueueTask( immediate_incoming_queue().back()); }
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h index 0bf4356..388f130 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
@@ -143,12 +143,7 @@ // TaskQueue implementation. const char* GetName() const; bool RunsTasksInCurrentSequence() const; - bool PostDelayedTask(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay); - bool PostNonNestableDelayedTask(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay); + bool PostDelayedTask(TaskQueue::PostedTask task); // Require a reference to enclosing task queue for lifetime control. std::unique_ptr<TaskQueue::QueueEnabledVoter> CreateQueueEnabledVoter( scoped_refptr<TaskQueue> owning_task_queue); @@ -280,11 +275,6 @@ friend class WorkQueue; friend class WorkQueueTest; - enum class TaskType { - NORMAL, - NON_NESTABLE, - }; - struct AnyThread { AnyThread(TaskQueueManager* task_queue_manager, TimeDomain* time_domain); ~AnyThread(); @@ -329,13 +319,8 @@ bool is_enabled_for_test; }; - bool PostImmediateTaskImpl(const base::Location& from_here, - base::OnceClosure task, - TaskType task_type); - bool PostDelayedTaskImpl(const base::Location& from_here, - base::OnceClosure task, - base::TimeDelta delay, - TaskType task_type); + bool PostImmediateTaskImpl(TaskQueue::PostedTask task); + bool PostDelayedTaskImpl(TaskQueue::PostedTask task); // Push the task onto the |delayed_incoming_queue|. Lock-free main thread // only fast path. @@ -353,11 +338,7 @@ // Push the task onto the |immediate_incoming_queue| and for auto pumped // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was // empty. - void PushOntoImmediateIncomingQueueLocked(const base::Location& posted_from, - base::OnceClosure task, - base::TimeTicks desired_run_time, - EnqueueOrder sequence_number, - bool nestable); + void PushOntoImmediateIncomingQueueLocked(Task task); // We reserve an inline capacity of 8 tasks to try and reduce the load on // PartitionAlloc.
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index 8051aaf..9fa0ef1a 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -14,9 +14,9 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" #include "components/viz/common/frame_sinks/begin_frame_args.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/instrumentation/resource_coordinator/BlinkResourceCoordinatorBase.h" #include "platform/instrumentation/resource_coordinator/RendererResourceCoordinator.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/real_time_domain.h" #include "platform/scheduler/base/task_queue_impl.h" #include "platform/scheduler/base/task_queue_selector.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc index 79a3c56..e092b54 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc
@@ -7,7 +7,7 @@ #include <memory> #include "base/memory/ptr_util.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/task_queue.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h" #include "platform/scheduler/renderer/web_view_scheduler_impl.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc index e51dbc3f9d..ac13ff0 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc
@@ -5,7 +5,7 @@ #include "platform/scheduler/renderer/web_frame_scheduler_impl.h" #include "base/trace_event/blame_context.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/real_time_domain.h" #include "platform/scheduler/base/trace_helper.h" #include "platform/scheduler/base/virtual_time_domain.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc index aa0ad36..ea4b8f3 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc
@@ -10,8 +10,8 @@ #include "base/memory/ptr_util.h" #include "base/test/simple_test_tick_clock.h" #include "components/viz/test/ordered_simple_task_runner.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebTaskRunner.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/test_time_source.h" #include "platform/scheduler/child/scheduler_tqm_delegate_for_test.h" #include "platform/scheduler/renderer/renderer_scheduler_impl.h"
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc index 728b05c..7985056d 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc
@@ -8,8 +8,8 @@ #include "base/metrics/field_trial_params.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/WebFrameScheduler.h" +#include "platform/runtime_enabled_features.h" #include "platform/scheduler/base/trace_helper.h" #include "platform/scheduler/base/virtual_time_domain.h" #include "platform/scheduler/child/scheduler_tqm_delegate.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp index e68b891..0b11e99 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -30,7 +30,6 @@ #include "platform/scroll/ScrollAnimatorBase.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollableArea.h" #include "platform/wtf/MathExtras.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp index 3b5ca0d..e4cbd9e 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
@@ -6,13 +6,13 @@ #include <memory> #include "cc/animation/scroll_offset_animation_curve.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/CompositorAnimation.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/animation/CompositorAnimationPlayer.h" #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/graphics/CompositorMutableProperties.h" #include "platform/graphics/GraphicsLayer.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollableArea.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/Platform.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h index d213aab3..ece7f21 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
@@ -27,11 +27,11 @@ #define ScrollableArea_h #include "platform/PlatformExport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/Color.h" #include "platform/heap/Handle.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "platform/scroll/ScrollTypes.h" #include "platform/scroll/Scrollbar.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp index 2a5c60b..24f3160 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
@@ -26,7 +26,6 @@ #include "platform/scroll/ScrollbarTheme.h" #include "build/build_config.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/Color.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/GraphicsContextStateSaver.h" @@ -35,6 +34,7 @@ #include "platform/graphics/paint/DrawingDisplayItem.h" #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/PaintController.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/Scrollbar.h" #include "platform/scroll/ScrollbarThemeMock.h" #include "platform/scroll/ScrollbarThemeOverlayMock.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp index 48fd785..d223b210 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp
@@ -31,9 +31,9 @@ #include "platform/scroll/ScrollbarThemeAura.h" #include "platform/LayoutTestSupport.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/DrawingRecorder.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollableArea.h" #include "platform/scroll/Scrollbar.h" #include "platform/scroll/ScrollbarThemeOverlay.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm index 2922366f..95108cf 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm
@@ -23,7 +23,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollbarThemeMac.h" #include <Carbon/Carbon.h> @@ -34,6 +33,7 @@ #include "platform/mac/LocalCurrentGraphicsContext.h" #include "platform/mac/NSScrollerImpDetails.h" #include "platform/mac/ScrollAnimatorMac.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/ScrollbarThemeClient.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/RetainPtr.h"
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp index a256bc4..2c12141 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp
@@ -25,9 +25,9 @@ #include "platform/scroll/ScrollbarThemeMock.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/DrawingRecorder.h" +#include "platform/runtime_enabled_features.h" #include "platform/scroll/Scrollbar.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.cpp b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.cpp index 49daa5b..e9119fe 100644 --- a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.cpp +++ b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.cpp
@@ -41,6 +41,16 @@ queue_.clear(); } +void SmoothScrollSequencer::DidDisposeScrollableArea( + const ScrollableArea& area) { + for (Member<SequencedScroll>& sequenced_scroll : queue_) { + if (sequenced_scroll->scrollable_area.Get() == &area) { + AbortAnimations(); + break; + } + } +} + DEFINE_TRACE(SmoothScrollSequencer) { visitor->Trace(queue_); visitor->Trace(current_scrollable_);
diff --git a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h index 9743490..79e9314 100644 --- a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h +++ b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h
@@ -50,6 +50,8 @@ // Abort the currently running animation and all the animations in the queue. void AbortAnimations(); + void DidDisposeScrollableArea(const ScrollableArea&); + DECLARE_TRACE(); private:
diff --git a/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h index 0ddb902..f09be719 100644 --- a/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h +++ b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h
@@ -5,7 +5,7 @@ #ifndef RuntimeEnabledFeaturesTestHelpers_h #define RuntimeEnabledFeaturesTestHelpers_h -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/wtf/Assertions.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/text/TextRun.cpp b/third_party/WebKit/Source/platform/text/TextRun.cpp index b21d1d75..6ba7c29 100644 --- a/third_party/WebKit/Source/platform/text/TextRun.cpp +++ b/third_party/WebKit/Source/platform/text/TextRun.cpp
@@ -25,7 +25,7 @@ #include "platform/text/TextRun.h" -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/text/Character.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp index b20bc80..f4af5272 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -29,7 +29,7 @@ #include "platform/weborigin/SecurityOrigin.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/KnownPorts.h" #include "platform/weborigin/SchemeRegistry.h"
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp index 5a0012a..d12752ab 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -30,8 +30,8 @@ #include "platform/weborigin/SecurityOrigin.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/blob/BlobURL.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityPolicy.h" #include "platform/weborigin/Suborigin.h"
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp index 6fac7e2..f4f9834 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -29,7 +29,7 @@ #include "platform/weborigin/SecurityPolicy.h" #include <memory> -#include "platform/RuntimeEnabledFeatures.h" +#include "platform/runtime_enabled_features.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/OriginAccessEntry.h" #include "platform/weborigin/SchemeRegistry.h"
diff --git a/third_party/WebKit/Source/platform/wtf/BUILD.gn b/third_party/WebKit/Source/platform/wtf/BUILD.gn index d1b1a98..2a1a674 100644 --- a/third_party/WebKit/Source/platform/wtf/BUILD.gn +++ b/third_party/WebKit/Source/platform/wtf/BUILD.gn
@@ -294,10 +294,12 @@ all_dependent_configs = [ "//tools/win/DebugVisualizers:webkit" ] } else { # Non-Windows. - sources -= [ - "ThreadSpecificWin.cpp", - "ThreadingWin.cpp", - ] + if (!snake_case_source_files) { + sources -= [ + "ThreadSpecificWin.cpp", + "ThreadingWin.cpp", + ] + } } if (is_android) {
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py index c29633347..2c56b19 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -921,6 +921,17 @@ """ return self.skipped_due_to_smoke_tests(test) or self.skipped_in_never_fix_tests(test) + @memoized + def _tests_from_file(self, filename): + tests = set() + file_contents = self._filesystem.read_text_file(filename) + for line in file_contents.splitlines(): + line = line.strip() + if line.startswith('#') or not line: + continue + tests.add(line) + return tests + def skipped_due_to_smoke_tests(self, test): """Checks if the test is skipped based on the set of Smoke tests. @@ -930,8 +941,10 @@ if not self.default_smoke_test_only(): return False smoke_test_filename = self.path_to_smoke_tests_file() - return (self._filesystem.exists(smoke_test_filename) and - test not in self._filesystem.read_text_file(smoke_test_filename)) + if not self._filesystem.exists(smoke_test_filename): + return False + smoke_tests = self._tests_from_file(smoke_test_filename) + return test not in smoke_tests def path_to_smoke_tests_file(self): return self._filesystem.join(self.layout_tests_dir(), 'SmokeTests') @@ -960,16 +973,6 @@ def path_to_never_fix_tests_file(self): return self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests') - def _tests_from_skipped_file_contents(self, skipped_file_contents): - tests_to_skip = [] - for line in skipped_file_contents.split('\n'): - line = line.strip() - line = line.rstrip('/') # Best to normalize directory names to not include the trailing slash. - if line.startswith('#') or not len(line): - continue - tests_to_skip.append(line) - return tests_to_skip - def _expectations_from_skipped_files(self, skipped_file_paths): # TODO(qyearsley): Remove this if there are no more "Skipped" files. tests_to_skip = [] @@ -979,13 +982,15 @@ _log.debug('Skipped does not exist: %s', filename) continue _log.debug('Using Skipped file: %s', filename) - skipped_file_contents = self._filesystem.read_text_file(filename) - tests_to_skip.extend(self._tests_from_skipped_file_contents(skipped_file_contents)) + tests_to_skip.extend(self._tests_from_file(filename)) return tests_to_skip @memoized def skipped_perf_tests(self): - return self._expectations_from_skipped_files([self._perf_tests_dir()]) + tests = self._expectations_from_skipped_files([self._perf_tests_dir()]) + # Best to normalize directory names to not include the trailing slash. + # TODO(qyearsley): Explain why removing trailing slashes is needed here. + return sorted(test.rstrip('/') for test in tests) def skips_perf_test(self, test_name): for test_or_category in self.skipped_perf_tests():
diff --git a/third_party/WebKit/common/BUILD.gn b/third_party/WebKit/common/BUILD.gn index ce76bfd..9a1140fc 100644 --- a/third_party/WebKit/common/BUILD.gn +++ b/third_party/WebKit/common/BUILD.gn
@@ -21,6 +21,8 @@ sources = [ "common_export.h", + "device_memory/approximated_device_memory.cc", + "device_memory/approximated_device_memory.h", "mime_util/mime_util.cc", "mime_util/mime_util.h", ] @@ -40,6 +42,7 @@ visibility = [ "*" ] sources = [ + "device_memory/approximated_device_memory_unittest.cc", "mime_util/mime_util_unittest.cc", "test/run_all_unittests.cc", ]
diff --git a/third_party/WebKit/common/device_memory/approximated_device_memory.cc b/third_party/WebKit/common/device_memory/approximated_device_memory.cc new file mode 100644 index 0000000..2b89a30 --- /dev/null +++ b/third_party/WebKit/common/device_memory/approximated_device_memory.cc
@@ -0,0 +1,63 @@ +// 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/device_memory/approximated_device_memory.h" + +#include "base/logging.h" +#include "base/sys_info.h" + +namespace blink { + +// static +float ApproximatedDeviceMemory::approximated_device_memory_gb_ = 0.0; +int64_t ApproximatedDeviceMemory::physical_memory_mb_ = 0; + +// static +void ApproximatedDeviceMemory::Initialize() { + DCHECK_EQ(0.0, approximated_device_memory_gb_); + DCHECK_EQ(0, physical_memory_mb_); + physical_memory_mb_ = ::base::SysInfo::AmountOfPhysicalMemoryMB(); + CalculateAndSetApproximatedDeviceMemory(); +} + +// static +float ApproximatedDeviceMemory::GetApproximatedDeviceMemory() { + return approximated_device_memory_gb_; +} + +// static +void ApproximatedDeviceMemory::CalculateAndSetApproximatedDeviceMemory() { + // The calculations in this method are described in the specifcations: + // https://github.com/WICG/device-memory. + DCHECK_GT(physical_memory_mb_, 0); + int lower_bound = physical_memory_mb_; + int power = 0; + + // Extract the most significant 2-bits and their location. + while (lower_bound >= 4) { + lower_bound >>= 1; + power++; + } + // The lower_bound value is either 0b10 or 0b11. + DCHECK(lower_bound & 2); + + int64_t upper_bound = lower_bound + 1; + lower_bound = lower_bound << power; + upper_bound = upper_bound << power; + + // Find the closest bound, and convert it to GB. + if (physical_memory_mb_ - lower_bound <= upper_bound - physical_memory_mb_) + approximated_device_memory_gb_ = static_cast<float>(lower_bound) / 1024.0; + else + approximated_device_memory_gb_ = static_cast<float>(upper_bound) / 1024.0; +} + +// static +void ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting( + int64_t physical_memory_mb) { + physical_memory_mb_ = physical_memory_mb; + CalculateAndSetApproximatedDeviceMemory(); +} + +} // namespace blink
diff --git a/third_party/WebKit/common/device_memory/approximated_device_memory.h b/third_party/WebKit/common/device_memory/approximated_device_memory.h new file mode 100644 index 0000000..eaa0259 --- /dev/null +++ b/third_party/WebKit/common/device_memory/approximated_device_memory.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 THIRD_PARTY_WEBKIT_COMMON_DEVICE_MEMORY_APPROXIMATED_DEVICE_MEMORY_H_ +#define THIRD_PARTY_WEBKIT_COMMON_DEVICE_MEMORY_APPROXIMATED_DEVICE_MEMORY_H_ + +#include <stdint.h> + +#include "third_party/WebKit/common/common_export.h" + +namespace blink { + +class ApproximatedDeviceMemory { + public: + // Caches the device's physical memory in static members. + static void BLINK_COMMON_EXPORT Initialize(); + + // Returns an approximation of the physical memory rounded to to the most + // significant 2-bits. This information is provided to web-developers to allow + // them to customize the experience of their page to the possible available + // device memory. + static float BLINK_COMMON_EXPORT GetApproximatedDeviceMemory(); + + // Override the value of the physical memory for testing. + static void BLINK_COMMON_EXPORT SetPhysicalMemoryMBForTesting(int64_t); + + private: + static void CalculateAndSetApproximatedDeviceMemory(); + + static float approximated_device_memory_gb_; + static int64_t physical_memory_mb_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_WEBKIT_COMMON_DEVICE_MEMORY_APPROXIMATED_DEVICE_MEMORY_H_
diff --git a/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc b/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc new file mode 100644 index 0000000..416193b2 --- /dev/null +++ b/third_party/WebKit/common/device_memory/approximated_device_memory_unittest.cc
@@ -0,0 +1,54 @@ +// 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/device_memory/approximated_device_memory.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +namespace { + +class ApproximatedDeviceMemoryTest : public ::testing::Test {}; + +TEST_F(ApproximatedDeviceMemoryTest, GetApproximatedDeviceMemory) { + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(128); // 128MB + EXPECT_EQ(0.125, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(256); // 256MB + EXPECT_EQ(0.25, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(510); // <512MB + EXPECT_EQ(0.5, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(512); // 512MB + EXPECT_EQ(0.5, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(640); // 512+128MB + EXPECT_EQ(0.5, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(768); // 512+256MB + EXPECT_EQ(0.75, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(1000); // <1GB + EXPECT_EQ(1, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(1024); // 1GB + EXPECT_EQ(1, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(1536); // 1.5GB + EXPECT_EQ(1.5, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(2000); // <2GB + EXPECT_EQ(2, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(2048); // 2GB + EXPECT_EQ(2, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(3000); // <3GB + EXPECT_EQ(3, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(5120); // 5GB + EXPECT_EQ(4, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(8192); // 8GB + EXPECT_EQ(8, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(16384); // 16GB + EXPECT_EQ(16, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(32768); // 32GB + EXPECT_EQ(32, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); + ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(64385); // <64GB + EXPECT_EQ(64, ApproximatedDeviceMemory::GetApproximatedDeviceMemory()); +} + +} // namespace + +} // namespace blink
diff --git a/third_party/WebKit/public/platform/WebLayer.h b/third_party/WebKit/public/platform/WebLayer.h index 92ae802..bce439d7 100644 --- a/third_party/WebKit/public/platform/WebLayer.h +++ b/third_party/WebKit/public/platform/WebLayer.h
@@ -89,6 +89,13 @@ virtual void SetOpacity(float) = 0; virtual float Opacity() const = 0; + // If set to true, content opaqueness cannot be changed using + // WebLayer::SetOpaque. However, it can still be modified using + // SetContentsOpaque on the cc::Layer. This is a roundabout way of allowing + // creators of WebLayers to specify opaqueness without + // CompositedLayerMapping/PaintArtifactCompositor clobbering it later. This + // will be addressed once WebLayer is removed. + virtual void SetContentsOpaqueIsFixed(bool) = 0; virtual void SetBlendMode(WebBlendMode) = 0; virtual WebBlendMode BlendMode() const = 0;
diff --git a/third_party/WebKit/public/platform/WebRuntimeFeatures.h b/third_party/WebKit/public/platform/WebRuntimeFeatures.h index dddecf0..738db304 100644 --- a/third_party/WebKit/public/platform/WebRuntimeFeatures.h +++ b/third_party/WebKit/public/platform/WebRuntimeFeatures.h
@@ -42,19 +42,19 @@ class WebRuntimeFeatures { public: // Enable or disable features with status=experimental listed in - // Source/platform/RuntimeEnabledFeatures.in. + // Source/platform/runtime_enabled_features.json5. BLINK_PLATFORM_EXPORT static void EnableExperimentalFeatures(bool); // Enable or disable features with status=test listed in - // Source/platform/RuntimeEnabledFeatures.in. + // Source/platform/runtime_enabled_features.json5. BLINK_PLATFORM_EXPORT static void EnableTestOnlyFeatures(bool); // Enable or disable features with non-empty origin_trial_feature_name in - // Source/platform/RuntimeEnabledFeatures.in. + // Source/platform/runtime_enabled_features.json5. BLINK_PLATFORM_EXPORT static void EnableOriginTrialControlledFeatures(bool); // Enables or disables a feature by its string identifier from - // Source/platform/RuntimeEnabledFeatures.in. + // Source/platform/runtime_enabled_features.json5. // Note: We use std::string instead of WebString because this API can // be called before blink::Initalize(). We can't create WebString objects // before blink::Initialize().
diff --git a/third_party/WebKit/public/web/WebAXObject.h b/third_party/WebKit/public/web/WebAXObject.h index b796e87..d32762f 100644 --- a/third_party/WebKit/public/web/WebAXObject.h +++ b/third_party/WebKit/public/web/WebAXObject.h
@@ -248,9 +248,9 @@ BLINK_EXPORT bool SupportsRangeValue() const; BLINK_EXPORT WebString ValueDescription() const; - BLINK_EXPORT float ValueForRange() const; - BLINK_EXPORT float MaxValueForRange() const; - BLINK_EXPORT float MinValueForRange() const; + BLINK_EXPORT bool ValueForRange(float* out_value) const; + BLINK_EXPORT bool MaxValueForRange(float* out_value) const; + BLINK_EXPORT bool MinValueForRange(float* out_value) const; BLINK_EXPORT WebNode GetNode() const; BLINK_EXPORT WebDocument GetDocument() const;
diff --git a/third_party/WebKit/public/web/WebImeTextSpan.h b/third_party/WebKit/public/web/WebImeTextSpan.h index 481be8ac..5b77ed4d 100644 --- a/third_party/WebKit/public/web/WebImeTextSpan.h +++ b/third_party/WebKit/public/web/WebImeTextSpan.h
@@ -41,11 +41,15 @@ // setComposition() method. struct WebImeTextSpan { enum class Type { - // Creates a composition marker + // Creates a composition marker. kComposition, // Creates a suggestion marker that isn't cleared after the user picks a - // replacement + // replacement. kSuggestion, + // Creates a suggestion marker that is cleared after the user picks a + // replacement, and will be ignored if added to an element with spell + // checking disabled. + kMisspellingSuggestion, }; WebImeTextSpan()
diff --git a/third_party/blink/tools/move_blink_source.py b/third_party/blink/tools/move_blink_source.py index 1f96731..6d56432 100755 --- a/third_party/blink/tools/move_blink_source.py +++ b/third_party/blink/tools/move_blink_source.py
@@ -267,7 +267,7 @@ _log.info('Processing #include in %s ...', self._shorten_path(dirname)) files = self._fs.files_under( dirname, file_filter=lambda fs, _, basename: basename.endswith( - ('.h', '.cc', '.cpp', '.mm', '.cpp.tmpl', '.h.tmpl'))) + ('.h', '.cc', '.cpp', '.mm', '.cc.tmpl', '.cpp.tmpl', '.h.tmpl'))) for file_path in files: original_content = self._fs.read_text_file(file_path)
diff --git a/third_party/gvr-android-sdk/BUILD.gn b/third_party/gvr-android-sdk/BUILD.gn index bc7e79ec..754fd0cd 100644 --- a/third_party/gvr-android-sdk/BUILD.gn +++ b/third_party/gvr-android-sdk/BUILD.gn
@@ -40,6 +40,195 @@ "*google/common/logging/nano/Vr\$VREvent\$Cyclops*.class", "*google/common/logging/nano/Vr\$VREvent\$AudioStats.class", "*ThrowableExtension*.class", + + # The following list contains all the java classes in + # com.google.vr.cardboard.* and com.google.vr.ndk.base.*. Gvr allows + # loading GvrLayout and GvrUiLayout from VrCore. So a lot of classes in the + # two namespaces are no longer needed. + # For classes that are still needed, we comment them out from the list + # instead of removing them. + # If any class is needed in the future, please also comment it out from the + # list instead of removing. + # TODO(bshe): Instead of excluding classes, we should consider use something + # like jar_included_patterns. So that we only need to include the classes + # that we need. And we don't need to worry about forget to exclude new + # classes after a GVR roll. See crbug.com/764446 + #"*google/vr/cardboard/AndroidNCompat\$1.class", + #"*google/vr/cardboard/AndroidNCompat\$2.class", + #"*google/vr/cardboard/AndroidNCompat\$3.class", + #"*google/vr/cardboard/AndroidNCompat.class", + "*google/vr/cardboard/CardboardGLSurfaceView.class", + "*google/vr/cardboard/CardboardGLSurfaceView\$DetachListener.class", + #"*google/vr/cardboard/ConfigUtils.class", + #"*google/vr/cardboard/ContentProviderVrParamsProvider.class", + #"*google/vr/cardboard/ContextUtils.class", + #"*google/vr/cardboard/DisplaySynchronizer.class", + #"*google/vr/cardboard/DisplayUtils.class", + "*google/vr/cardboard/EglFactory.class", + "*google/vr/cardboard/EglReadyListener.class", + "*google/vr/cardboard/EglReadyListener\$EventListener.class", + "*google/vr/cardboard/ExternalSurfaceManager\$1.class", + "*google/vr/cardboard/ExternalSurfaceManager.class", + "*google/vr/cardboard/ExternalSurfaceManager\$ExternalSurface\$1.class", + "*google/vr/cardboard/ExternalSurfaceManager\$ExternalSurfaceCallback.class", + "*google/vr/cardboard/ExternalSurfaceManager\$ExternalSurface.class", + "*google/vr/cardboard/ExternalSurfaceManager\$ExternalSurfaceData.class", + "*google/vr/cardboard/ExternalSurfaceManager\$UpdateSurfaceCallback.class", + #"*google/vr/cardboard/FrameMonitor.class", + "*google/vr/cardboard/FullscreenMode\$1\$1.class", + "*google/vr/cardboard/FullscreenMode\$1.class", + "*google/vr/cardboard/FullscreenMode.class", + "*google/vr/cardboard/LegacyVrParamsProvider.class", + "*google/vr/cardboard/MutableEglConfigChooser.class", + "*google/vr/cardboard/NFCUtils\$1.class", + "*google/vr/cardboard/NFCUtils.class", + #"*google/vr/cardboard/PackageUtils.class", + "*google/vr/cardboard/PhoneParams.class", + "*google/vr/cardboard/PhoneParams\$PpiOverride.class", + "*google/vr/cardboard/ScanlineRacingRenderer\$1.class", + "*google/vr/cardboard/ScanlineRacingRenderer.class", + "*google/vr/cardboard/ScreenOrientationDetector.class", + "*google/vr/cardboard/ScreenOrientationDetector\$Listener.class", + "*google/vr/cardboard/ScreenOrientationDetector\$Orientation.class", + "*google/vr/cardboard/StoragePermissionUtils.class", + "*google/vr/cardboard/ThreadUtils.class", + "*google/vr/cardboard/TransitionView\$1.class", + "*google/vr/cardboard/TransitionView\$2.class", + "*google/vr/cardboard/TransitionView\$3.class", + "*google/vr/cardboard/TransitionView\$4.class", + "*google/vr/cardboard/TransitionView\$5.class", + "*google/vr/cardboard/TransitionView.class", + "*google/vr/cardboard/UiLayer\$10.class", + "*google/vr/cardboard/UiLayer\$11.class", + "*google/vr/cardboard/UiLayer\$1.class", + "*google/vr/cardboard/UiLayer\$2.class", + "*google/vr/cardboard/UiLayer\$3.class", + "*google/vr/cardboard/UiLayer\$4.class", + "*google/vr/cardboard/UiLayer\$5.class", + "*google/vr/cardboard/UiLayer\$6.class", + "*google/vr/cardboard/UiLayer\$7.class", + "*google/vr/cardboard/UiLayer\$8.class", + "*google/vr/cardboard/UiLayer\$9.class", + "*google/vr/cardboard/UiLayer.class", + "*google/vr/cardboard/UiUtils\$1.class", + "*google/vr/cardboard/UiUtils\$2.class", + "*google/vr/cardboard/UiUtils\$3.class", + "*google/vr/cardboard/UiUtils\$4.class", + "*google/vr/cardboard/UiUtils.class", + "*google/vr/cardboard/UsedByNative.class", + #"*google/vr/cardboard/VrContextWrapper.class", + #"*google/vr/cardboard/VrCoreLibraryLoader.class", + #"*google/vr/cardboard/VrParamsProvider.class", + #"*google/vr/cardboard/VrParamsProviderFactory.class", + #"*google/vr/cardboard/VrParamsProviderFactory\$ContentProviderClientHandle.class", + "*google/vr/cardboard/VrParamsProviderJni.class", + #"*google/vr/cardboard/VrSettingsProviderContract.class", + "*google/vr/cardboard/annotations/UsedByNative.class", + "*google/vr/cardboard/annotations/UsedByReflection.class", + "*google/vr/ndk/base/AbstractDaydreamTouchListener.class", + #"*google/vr/ndk/base/AndroidCompat.class", + "*google/vr/ndk/base/BufferSpec.class", + "*google/vr/ndk/base/BufferSpec\$ColorFormat.class", + "*google/vr/ndk/base/BufferSpec\$DepthStencilFormat.class", + "*google/vr/ndk/base/BufferViewport.class", + "*google/vr/ndk/base/BufferViewport\$EyeType.class", + "*google/vr/ndk/base/BufferViewportList.class", + "*google/vr/ndk/base/BufferViewport\$Reprojection.class", + #"*google/vr/ndk/base/BuildConstants.class", + "*google/vr/ndk/base/BuildFlags.class", + "*google/vr/ndk/base/CardboardEmulator.class", + "*google/vr/ndk/base/CardboardEmulator\$ControllerCallbacks.class", + "*google/vr/ndk/base/Constants.class", + #"*google/vr/ndk/base/DaydreamApi\$10.class", + #"*google/vr/ndk/base/DaydreamApi\$11.class", + #"*google/vr/ndk/base/DaydreamApi\$12.class", + #"*google/vr/ndk/base/DaydreamApi\$1.class", + #"*google/vr/ndk/base/DaydreamApi\$2.class", + #"*google/vr/ndk/base/DaydreamApi\$3.class", + #"*google/vr/ndk/base/DaydreamApi\$4.class", + #"*google/vr/ndk/base/DaydreamApi\$5.class", + #"*google/vr/ndk/base/DaydreamApi\$6\$1.class", + #"*google/vr/ndk/base/DaydreamApi\$6.class", + #"*google/vr/ndk/base/DaydreamApi\$7.class", + #"*google/vr/ndk/base/DaydreamApi\$8.class", + #"*google/vr/ndk/base/DaydreamApi\$9.class", + #"*google/vr/ndk/base/DaydreamApi.class", + #"*google/vr/ndk/base/DaydreamUtils.class", + "*google/vr/ndk/base/DaydreamUtilsWrapper.class", + "*google/vr/ndk/base/ExtensionManager.class", + "*google/vr/ndk/base/ExternalSurface\$1.class", + "*google/vr/ndk/base/ExternalSurface\$2.class", + "*google/vr/ndk/base/ExternalSurface.class", + "*google/vr/ndk/base/FadeOverlayView\$1.class", + "*google/vr/ndk/base/FadeOverlayView\$2.class", + "*google/vr/ndk/base/FadeOverlayView.class", + "*google/vr/ndk/base/Frame.class", + #"*google/vr/ndk/base/GvrApi.class", + "*google/vr/ndk/base/GvrApi\$Error.class", + "*google/vr/ndk/base/GvrApi\$Feature.class", + "*google/vr/ndk/base/GvrApi\$IdleListener.class", + "*google/vr/ndk/base/GvrApi\$PoseTracker.class", + "*google/vr/ndk/base/GvrApi\$ViewerType.class", + #"*google/vr/ndk/base/GvrLayout.class", + "*google/vr/ndk/base/GvrLayout\$ExternalSurfaceListener.class", + #"*google/vr/ndk/base/GvrLayoutFactory.class", + "*google/vr/ndk/base/GvrLayoutImpl\$1.class", + "*google/vr/ndk/base/GvrLayoutImpl\$2.class", + "*google/vr/ndk/base/GvrLayoutImpl\$3.class", + "*google/vr/ndk/base/GvrLayoutImpl\$4.class", + "*google/vr/ndk/base/GvrLayoutImpl\$AsyncReprojectionSurfaceView\$1.class", + "*google/vr/ndk/base/GvrLayoutImpl\$AsyncReprojectionSurfaceView.class", + "*google/vr/ndk/base/GvrLayoutImpl.class", + "*google/vr/ndk/base/GvrLayoutImpl\$FrameFlushWorkaround.class", + "*google/vr/ndk/base/GvrLayoutImpl\$NullExtensionManager.class", + "*google/vr/ndk/base/GvrLayoutImpl\$PresentationFactory.class", + "*google/vr/ndk/base/GvrLayoutImpl\$PresentationHelper.class", + "*google/vr/ndk/base/GvrLayoutImpl\$PresentationListener.class", + "*google/vr/ndk/base/GvrLayoutImpl\$ScreenOnManager\$1.class", + "*google/vr/ndk/base/GvrLayoutImpl\$ScreenOnManager\$2.class", + "*google/vr/ndk/base/GvrLayoutImpl\$ScreenOnManager.class", + "*google/vr/ndk/base/GvrLayoutImplWrapper.class", + "*google/vr/ndk/base/GvrSurfaceView\$1.class", + "*google/vr/ndk/base/GvrSurfaceView\$BaseConfigChooser.class", + "*google/vr/ndk/base/GvrSurfaceView.class", + "*google/vr/ndk/base/GvrSurfaceView\$ComponentSizeChooser.class", + "*google/vr/ndk/base/GvrSurfaceView\$DefaultContextFactory.class", + "*google/vr/ndk/base/GvrSurfaceView\$DefaultWindowSurfaceFactory.class", + "*google/vr/ndk/base/GvrSurfaceView\$EglHelper.class", + "*google/vr/ndk/base/GvrSurfaceView\$GLThread.class", + "*google/vr/ndk/base/GvrSurfaceView\$GLThread\$GLThreadManager.class", + "*google/vr/ndk/base/GvrSurfaceView\$GLWrapper.class", + "*google/vr/ndk/base/GvrSurfaceView\$LogWriter.class", + "*google/vr/ndk/base/GvrSurfaceView\$SimpleEGLConfigChooser.class", + #"*google/vr/ndk/base/GvrUiLayout.class", + "*google/vr/ndk/base/GvrUiLayoutImpl\$1.class", + "*google/vr/ndk/base/GvrUiLayoutImpl\$2.class", + "*google/vr/ndk/base/GvrUiLayoutImpl\$3.class", + "*google/vr/ndk/base/GvrUiLayoutImpl.class", + "*google/vr/ndk/base/GvrUiLayoutImpl\$CloseButtonListenerWrapper.class", + #"*google/vr/ndk/base/SdkConfigurationReader.class", + "*google/vr/ndk/base/SdkDaydreamTouchListener\$1.class", + "*google/vr/ndk/base/SdkDaydreamTouchListener.class", + "*google/vr/ndk/base/SdkDaydreamTouchListener\$FinishInitilizationTask.class", + "*google/vr/ndk/base/SdkDaydreamTouchListener\$RefreshViewerProfileTask.class", + "*google/vr/ndk/base/SerializationConstants.class", + "*google/vr/ndk/base/SwapChain.class", + "*google/vr/ndk/base/ThrottlingMonitor\$1.class", + "*google/vr/ndk/base/ThrottlingMonitor\$2.class", + "*google/vr/ndk/base/ThrottlingMonitor.class", + "*google/vr/ndk/base/ThrottlingMonitor\$SetupCallback.class", + "*google/vr/ndk/base/ThrottlingMonitor\$TemperatureTrigger.class", + "*google/vr/ndk/base/ThrottlingMonitor\$ThrottlingTriggerCallback\$1.class", + "*google/vr/ndk/base/ThrottlingMonitor\$ThrottlingTriggerCallback.class", + #"*google/vr/ndk/base/TraceCompat.class", + "*google/vr/ndk/base/UserPrefs.class", + "*google/vr/ndk/base/UserPrefs\$ControllerHandedness.class", + #"*google/vr/ndk/base/Version.class", + "*google/vr/ndk/base/VrCoreSdkClient\$1.class", + "*google/vr/ndk/base/VrCoreSdkClient.class", + "*google/vr/ndk/base/VrCoreSdkClient\$DaydreamListenerImpl\$1.class", + "*google/vr/ndk/base/VrCoreSdkClient\$DaydreamListenerImpl\$2.class", + "*google/vr/ndk/base/VrCoreSdkClient\$DaydreamListenerImpl.class", ] deps = [
diff --git a/third_party/gvr-android-sdk/proguard-gvr-chromium.txt b/third_party/gvr-android-sdk/proguard-gvr-chromium.txt index 5b303440..78c52d5 100644 --- a/third_party/gvr-android-sdk/proguard-gvr-chromium.txt +++ b/third_party/gvr-android-sdk/proguard-gvr-chromium.txt
@@ -29,3 +29,4 @@ # All the above is copied from src/proguard-gvr.txt. # Chromium needs the following line to be able to exclude some unused auto generated classes. -dontwarn com.google.common.logging.nano.Vr$** +-dontwarn com.google.vr.**
diff --git a/third_party/leveldatabase/BUILD.gn b/third_party/leveldatabase/BUILD.gn index f01769cb..22b00076 100644 --- a/third_party/leveldatabase/BUILD.gn +++ b/third_party/leveldatabase/BUILD.gn
@@ -18,6 +18,8 @@ sources = [ "env_chromium.cc", "env_chromium.h", + "leveldb_chrome.cc", + "leveldb_chrome.h", "port/port_chromium.cc", "port/port_chromium.h", "src/db/builder.cc",
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index 5c29b64..14fc6f6 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc
@@ -25,7 +25,6 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "base/sys_info.h" #include "base/threading/thread_restrictions.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_provider.h" @@ -33,7 +32,7 @@ #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "third_party/leveldatabase/chromium_logger.h" -#include "third_party/leveldatabase/src/include/leveldb/cache.h" +#include "third_party/leveldatabase/leveldb_chrome.h" #include "third_party/leveldatabase/src/include/leveldb/options.h" #include "third_party/re2/src/re2/re2.h" @@ -44,6 +43,54 @@ namespace leveldb_env { +// Helper class to limit resource usage to avoid exhaustion. Currently used to +// limit read-only file usage so that we do not end up running out of file +// descriptors, or running into kernel performance problems for very large +// databases. +class Semaphore { + public: + // Limit maximum number of resources to |n|. + explicit Semaphore(intptr_t n) { SetAvailable(n); } + + // If another resource is available, acquire it and return true. + // Else return false. + bool TryAcquire() { + if (GetAvailable() <= 0) + return false; + leveldb::MutexLock l(&mutex_); + intptr_t x = GetAvailable(); + if (x <= 0) { + return false; + } else { + SetAvailable(x - 1); + return true; + } + } + + // Release a resource acquired by a previous call to TryAcquire() that + // returned true. + void Release() { + leveldb::MutexLock l(&mutex_); + SetAvailable(GetAvailable() + 1); + } + + private: + intptr_t GetAvailable() const { + return reinterpret_cast<intptr_t>(available_.Acquire_Load()); + } + + // REQUIRES: mutex_ must be held + void SetAvailable(intptr_t v) { + DCHECK_LE(0, v); + available_.Release_Store(reinterpret_cast<void*>(v)); + } + + leveldb::port::Mutex mutex_; + leveldb::port::AtomicPointer available_; + + DISALLOW_COPY_AND_ASSIGN(Semaphore); +}; + namespace { const FilePath::CharType backup_table_extension[] = FILE_PATH_LITERAL(".bak"); @@ -225,11 +272,22 @@ class ChromiumRandomAccessFile : public leveldb::RandomAccessFile { public: - ChromiumRandomAccessFile(const std::string& fname, + ChromiumRandomAccessFile(base::FilePath file_path, base::File file, - const UMALogger* uma_logger) - : filename_(fname), file_(std::move(file)), uma_logger_(uma_logger) {} - virtual ~ChromiumRandomAccessFile() {} + const UMALogger* uma_logger, + Semaphore* file_semaphore) + : filepath_(std::move(file_path)), + file_(std::move(file)), + uma_logger_(uma_logger), + file_semaphore_(file_semaphore), + open_before_read_(!file_semaphore->TryAcquire()) { + if (open_before_read_) + file_.Close(); // Open file on every access. + } + virtual ~ChromiumRandomAccessFile() { + if (!open_before_read_) + file_semaphore_->Release(); + } Status Read(uint64_t offset, size_t n, @@ -237,11 +295,22 @@ char* scratch) const override { TRACE_EVENT2("leveldb", "ChromiumRandomAccessFile::Read", "offset", offset, "size", n); + if (open_before_read_) { + DCHECK(!file_.IsValid()); + int flags = base::File::FLAG_READ | base::File::FLAG_OPEN; + file_.Initialize(filepath_, flags); + if (!file_.IsValid()) { + return MakeIOError(filepath_.AsUTF8Unsafe(), "Could not perform read", + kRandomAccessFileRead); + } + } int bytes_read = file_.Read(offset, scratch, n); + if (open_before_read_) + file_.Close(); *result = Slice(scratch, (bytes_read < 0) ? 0 : bytes_read); if (bytes_read < 0) { uma_logger_->RecordErrorAt(kRandomAccessFileRead); - return MakeIOError(filename_, "Could not perform read", + return MakeIOError(filepath_.AsUTF8Unsafe(), "Could not perform read", kRandomAccessFileRead); } if (bytes_read > 0) @@ -250,9 +319,12 @@ } private: - std::string filename_; + const base::FilePath filepath_; mutable base::File file_; const UMALogger* uma_logger_; + Semaphore* file_semaphore_; + // If true, file_ is closed and we open on every read. + bool open_before_read_; DISALLOW_COPY_AND_ASSIGN(ChromiumRandomAccessFile); }; @@ -364,34 +436,15 @@ base::LazyInstance<ChromiumEnv>::Leaky default_env = LAZY_INSTANCE_INITIALIZER; -size_t DefaultBlockCacheSize() { - if (base::SysInfo::IsLowEndDevice()) - return 1 << 20; // 1MB - else - return 8 << 20; // 8MB -} - -leveldb::Cache* GetDefaultBlockCache() { - static leveldb::Cache* cache = leveldb::NewLRUCache(DefaultBlockCacheSize()); - return cache; +// Return the maximum number of read-only files to keep open. +int MaxOpenFiles() { + // Allow use of 20% of available file descriptors for read-only files. + int open_read_only_file_limit = base::GetMaxFds() / 5; + return open_read_only_file_limit; } } // unnamed namespace -// Returns a separate (from the default) block cache for use by web APIs. -// This must be used when opening the databases accessible to Web-exposed APIs, -// so rogue pages can't mount a denial of service attack by hammering the block -// cache. Without separate caches, such an attack might slow down Chrome's UI to -// the point where the user can't close the offending page's tabs. -leveldb::Cache* SharedWebBlockCache() { - if (base::SysInfo::IsLowEndDevice()) - return GetDefaultBlockCache(); - - const int block_cache_size = 8 << 20; // 8MB - static leveldb::Cache* cache = leveldb::NewLRUCache(block_cache_size); - return cache; -} - Options::Options() { // Note: Ensure that these default values correspond to those in // components/leveldb/public/interfaces/leveldb.mojom. @@ -411,7 +464,7 @@ // By default use a single shared block cache to conserve memory. The owner of // this object can create their own, or set to NULL to have leveldb create a // new db-specific block cache. - block_cache = GetDefaultBlockCache(); + block_cache = leveldb_chrome::GetSharedBrowserBlockCache(); } const char* MethodIDToString(MethodID method) { @@ -630,7 +683,8 @@ : kMaxRetryTimeMillis(1000), name_(name), bgsignal_(&mu_), - started_bgthread_(false) { + started_bgthread_(false), + file_semaphore_(new Semaphore(MaxOpenFiles())) { uma_ioerror_base_name_ = name_ + ".IOError.BFE"; } @@ -703,6 +757,11 @@ } } +// Test must call this *before* opening any random-access files. +void ChromiumEnv::SetReadOnlyFileLimitForTesting(int max_open_files) { + file_semaphore_.reset(new Semaphore(max_open_files)); +} + Status ChromiumEnv::GetChildren(const std::string& dir, std::vector<std::string>* result) { FilePath dir_path = FilePath::FromUTF8Unsafe(dir); @@ -931,9 +990,11 @@ Status ChromiumEnv::NewRandomAccessFile(const std::string& fname, leveldb::RandomAccessFile** result) { int flags = base::File::FLAG_READ | base::File::FLAG_OPEN; - base::File file(FilePath::FromUTF8Unsafe(fname), flags); + base::FilePath file_path = FilePath::FromUTF8Unsafe(fname); + base::File file(file_path, flags); if (file.IsValid()) { - *result = new ChromiumRandomAccessFile(fname, std::move(file), this); + *result = new ChromiumRandomAccessFile( + std::move(file_path), std::move(file), this, file_semaphore_.get()); RecordOpenFilesLimit("Success"); return Status::OK(); }
diff --git a/third_party/leveldatabase/env_chromium.h b/third_party/leveldatabase/env_chromium.h index feb6001..87d518f 100644 --- a/third_party/leveldatabase/env_chromium.h +++ b/third_party/leveldatabase/env_chromium.h
@@ -87,10 +87,6 @@ Web, }; -// Return the shared leveldb block cache for web APIs. The caller *does not* -// own the returned instance. -extern leveldb::Cache* SharedWebBlockCache(); - const char* MethodIDToString(MethodID method); leveldb::Status MakeIOError(leveldb::Slice filename, @@ -141,6 +137,8 @@ MethodID method) const = 0; }; +class Semaphore; + class ChromiumEnv : public leveldb::Env, public UMALogger, public RetrierProvider { @@ -179,6 +177,7 @@ leveldb::WritableFile** result); virtual leveldb::Status NewLogger(const std::string& fname, leveldb::Logger** result); + void SetReadOnlyFileLimitForTesting(int max_open_files); protected: explicit ChromiumEnv(const std::string& name); @@ -246,6 +245,7 @@ typedef std::deque<BGItem> BGQueue; BGQueue queue_; LockTable locks_; + std::unique_ptr<Semaphore> file_semaphore_; }; // Tracks databases open via OpenDatabase() method and exposes them to
diff --git a/third_party/leveldatabase/env_chromium_unittest.cc b/third_party/leveldatabase/env_chromium_unittest.cc index e4474ce..4df0ab8f 100644 --- a/third_party/leveldatabase/env_chromium_unittest.cc +++ b/third_party/leveldatabase/env_chromium_unittest.cc
@@ -33,6 +33,8 @@ using leveldb_env::MethodID; using leveldb_env::Options; +static const int kReadOnlyFileLimit = 4; + TEST(ErrorEncoding, OnlyAMethod) { const MethodID in_method = leveldb_env::kSequentialFileRead; const Status s = MakeIOError("Somefile.txt", "message", in_method); @@ -215,6 +217,40 @@ EXPECT_TRUE(env->UnlockFile(lock).ok()); } +TEST(ChromiumEnvTest, TestOpenOnRead) { + // Write some test data to a single file that will be opened |n| times. + base::FilePath tmp_file_path; + ASSERT_TRUE(base::CreateTemporaryFile(&tmp_file_path)); + + FILE* f = fopen(tmp_file_path.AsUTF8Unsafe().c_str(), "w"); + ASSERT_TRUE(f != NULL); + const char kFileData[] = "abcdefghijklmnopqrstuvwxyz"; + fputs(kFileData, f); + fclose(f); + + std::unique_ptr<ChromiumEnv> env(new ChromiumEnv()); + env->SetReadOnlyFileLimitForTesting(kReadOnlyFileLimit); + + // Open test file some number greater than kReadOnlyFileLimit to force the + // open-on-read behavior of POSIX Env leveldb::RandomAccessFile. + const int kNumFiles = kReadOnlyFileLimit + 5; + leveldb::RandomAccessFile* files[kNumFiles] = {0}; + for (int i = 0; i < kNumFiles; i++) { + ASSERT_TRUE( + env->NewRandomAccessFile(tmp_file_path.AsUTF8Unsafe(), &files[i]).ok()); + } + char scratch; + Slice read_result; + for (int i = 0; i < kNumFiles; i++) { + ASSERT_TRUE(files[i]->Read(i, 1, &read_result, &scratch).ok()); + ASSERT_EQ(kFileData[i], read_result[0]); + } + for (int i = 0; i < kNumFiles; i++) { + delete files[i]; + } + ASSERT_TRUE(env->DeleteFile(tmp_file_path.AsUTF8Unsafe()).ok()); +} + class ChromiumEnvDBTrackerTest : public ::testing::Test { protected: void SetUp() override {
diff --git a/third_party/leveldatabase/leveldb_chrome.cc b/third_party/leveldatabase/leveldb_chrome.cc new file mode 100644 index 0000000..037a890 --- /dev/null +++ b/third_party/leveldatabase/leveldb_chrome.cc
@@ -0,0 +1,69 @@ +// 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. See the AUTHORS file for names of contributors. + +#include "third_party/leveldatabase/leveldb_chrome.h" + +#include <memory> +#include "base/sys_info.h" + +using leveldb::Cache; +using leveldb::NewLRUCache; + +namespace leveldb_chrome { + +namespace { + +size_t DefaultBlockCacheSize() { + if (base::SysInfo::IsLowEndDevice()) + return 1 << 20; // 1MB + else + return 8 << 20; // 8MB +} + +// Singleton owning resources shared by Chrome's leveldb databases. +class Globals { + public: + static Globals* GetInstance() { + static Globals* globals = new Globals(); + return globals; + } + + Globals() : browser_block_cache_(NewLRUCache(DefaultBlockCacheSize())) { + if (!base::SysInfo::IsLowEndDevice()) + web_block_cache_.reset(NewLRUCache(DefaultBlockCacheSize())); + } + + Cache* web_block_cache() const { + if (web_block_cache_) + return web_block_cache_.get(); + return browser_block_cache(); + } + + Cache* browser_block_cache() const { return browser_block_cache_.get(); } + + private: + ~Globals() {} + + std::unique_ptr<Cache> web_block_cache_; // null on low end devices. + std::unique_ptr<Cache> browser_block_cache_; // Never null. + + DISALLOW_COPY_AND_ASSIGN(Globals); +}; + +} // namespace + +// Returns a separate (from the default) block cache for use by web APIs. +// This must be used when opening the databases accessible to Web-exposed APIs, +// so rogue pages can't mount a denial of service attack by hammering the block +// cache. Without separate caches, such an attack might slow down Chrome's UI to +// the point where the user can't close the offending page's tabs. +Cache* GetSharedWebBlockCache() { + return Globals::GetInstance()->web_block_cache(); +} + +Cache* GetSharedBrowserBlockCache() { + return Globals::GetInstance()->browser_block_cache(); +} + +} // namespace leveldb_chrome
diff --git a/third_party/leveldatabase/leveldb_chrome.h b/third_party/leveldatabase/leveldb_chrome.h new file mode 100644 index 0000000..aea1879 --- /dev/null +++ b/third_party/leveldatabase/leveldb_chrome.h
@@ -0,0 +1,22 @@ +// 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. See the AUTHORS file for names of contributors. + +#ifndef THIRD_PARTY_LEVELDATABASE_LEVELDB_CHROME_H_ +#define THIRD_PARTY_LEVELDATABASE_LEVELDB_CHROME_H_ + +#include "leveldb/cache.h" + +namespace leveldb_chrome { + +// Return the shared leveldb block cache for web APIs. The caller *does not* +// own the returned instance. +extern leveldb::Cache* GetSharedWebBlockCache(); + +// Return the shared leveldb block cache for browser (non web) APIs. The caller +// *does not* own the returned instance. +extern leveldb::Cache* GetSharedBrowserBlockCache(); + +} // namespace leveldb_chrome + +#endif // THIRD_PARTY_LEVELDATABASE_LEVELDB_CHROME_H_
diff --git a/third_party/ow2_asm/BUILD.gn b/third_party/ow2_asm/BUILD.gn index 4511c45b..b89c4b85 100644 --- a/third_party/ow2_asm/BUILD.gn +++ b/third_party/ow2_asm/BUILD.gn
@@ -5,12 +5,14 @@ import("//build/config/android/rules.gni") java_prebuilt("asm_java") { - # Not "testonly" because //build/android/java_assertion_enabler depends on it. + # Not "testonly" because //build/android/bytecode:java_bytecode_rewriter + # depends on it. jar_path = "lib/asm-5.0.1.jar" } java_prebuilt("asm_tree_java") { - testonly = true + # Not "testonly" because //build/android/bytecode:java_bytecode_rewriter + # depends on it. jar_path = "lib/asm-tree-5.0.1.jar" deps = [ ":asm_java", @@ -34,7 +36,8 @@ } java_prebuilt("asm_util_java") { - testonly = true + # Not "testonly" because //build/android/bytecode:java_bytecode_rewriter + # depends on it. jar_path = "lib/asm-util-5.0.1.jar" deps = [ ":asm_tree_java",
diff --git a/third_party/ow2_asm/OWNERS b/third_party/ow2_asm/OWNERS index 7fcd92b..61cee31 100644 --- a/third_party/ow2_asm/OWNERS +++ b/third_party/ow2_asm/OWNERS
@@ -1,3 +1,3 @@ jbudorick@chromium.org -mikecase@chromium.org -yolandyan@chromium.org \ No newline at end of file +estevenson@chromium.org +yolandyan@chromium.org
diff --git a/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.cc b/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.cc index 7d3c72b..fd811b6 100644 --- a/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.cc +++ b/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.cc
@@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h" +#include "third_party/webrtc/rtc_base/task_queue.h" #include "base/bind.h" #include "base/lazy_instance.h"
diff --git a/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h b/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h index 008efcff..04864bb4 100644 --- a/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h +++ b/third_party/webrtc_overrides/webrtc/rtc_base/task_queue.h
@@ -8,234 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_RTC_BASE_TASK_QUEUE_H_ -#define WEBRTC_RTC_BASE_TASK_QUEUE_H_ - -#include <stdint.h> -#include <memory> - -#include "base/macros.h" -#include "third_party/webrtc/rtc_base/scoped_ref_ptr.h" -#include "third_party/webrtc/rtc_base/thread_annotations.h" - -namespace rtc { - -// Base interface for asynchronously executed tasks. -// The interface basically consists of a single function, Run(), that executes -// on the target queue. For more details see the Run() method and TaskQueue. -class QueuedTask { - public: - QueuedTask() {} - virtual ~QueuedTask() {} - - // Main routine that will run when the task is executed on the desired queue. - // The task should return |true| to indicate that it should be deleted or - // |false| to indicate that the queue should consider ownership of the task - // having been transferred. Returning |false| can be useful if a task has - // re-posted itself to a different queue or is otherwise being re-used. - virtual bool Run() = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(QueuedTask); -}; - -// Simple implementation of QueuedTask for use with rtc::Bind and lambdas. -template <class Closure> -class ClosureTask : public QueuedTask { - public: - explicit ClosureTask(const Closure& closure) : closure_(closure) {} - - private: - bool Run() override { - closure_(); - return true; - } - - Closure closure_; -}; - -// Extends ClosureTask to also allow specifying cleanup code. -// This is useful when using lambdas if guaranteeing cleanup, even if a task -// was dropped (queue is too full), is required. -template <class Closure, class Cleanup> -class ClosureTaskWithCleanup : public ClosureTask<Closure> { - public: - ClosureTaskWithCleanup(const Closure& closure, Cleanup cleanup) - : ClosureTask<Closure>(closure), cleanup_(cleanup) {} - ~ClosureTaskWithCleanup() { cleanup_(); } - - private: - Cleanup cleanup_; -}; - -// Convenience function to construct closures that can be passed directly -// to methods that support std::unique_ptr<QueuedTask> but not template -// based parameters. -template <class Closure> -static std::unique_ptr<QueuedTask> NewClosure(const Closure& closure) { - return std::unique_ptr<QueuedTask>(new ClosureTask<Closure>(closure)); -} - -template <class Closure, class Cleanup> -static std::unique_ptr<QueuedTask> NewClosure(const Closure& closure, - const Cleanup& cleanup) { - return std::unique_ptr<QueuedTask>( - new ClosureTaskWithCleanup<Closure, Cleanup>(closure, cleanup)); -} - -// Implements a task queue that asynchronously executes tasks in a way that -// guarantees that they're executed in FIFO order and that tasks never overlap. -// Tasks may always execute on the same worker thread and they may not. -// To DCHECK that tasks are executing on a known task queue, use IsCurrent(). -// -// Here are some usage examples: -// -// 1) Asynchronously running a lambda: -// -// class MyClass { -// ... -// TaskQueue queue_("MyQueue"); -// }; -// -// void MyClass::StartWork() { -// queue_.PostTask([]() { Work(); }); -// ... -// -// 2) Doing work asynchronously on a worker queue and providing a notification -// callback on the current queue, when the work has been done: -// -// void MyClass::StartWorkAndLetMeKnowWhenDone( -// std::unique_ptr<QueuedTask> callback) { -// DCHECK(TaskQueue::Current()) << "Need to be running on a queue"; -// queue_.PostTaskAndReply([]() { Work(); }, std::move(callback)); -// } -// ... -// my_class->StartWorkAndLetMeKnowWhenDone( -// NewClosure([]() { LOG(INFO) << "The work is done!";})); -// -// 3) Posting a custom task on a timer. The task posts itself again after -// every running: -// -// class TimerTask : public QueuedTask { -// public: -// TimerTask() {} -// private: -// bool Run() override { -// ++count_; -// TaskQueue::Current()->PostDelayedTask( -// std::unique_ptr<QueuedTask>(this), 1000); -// // Ownership has been transferred to the next occurance, -// // so return false to prevent from being deleted now. -// return false; -// } -// int count_ = 0; -// }; -// ... -// queue_.PostDelayedTask( -// std::unique_ptr<QueuedTask>(new TimerTask()), 1000); -// -// For more examples, see task_queue_unittests.cc. -// -// A note on destruction: -// -// When a TaskQueue is deleted, pending tasks will not be executed but they will -// be deleted. The deletion of tasks may happen asynchronously after the -// TaskQueue itself has been deleted or it may happen synchronously while the -// TaskQueue instance is being deleted. This may vary from one OS to the next -// so assumptions about lifetimes of pending tasks should not be made. -class RTC_LOCKABLE TaskQueue { - public: - // TaskQueue priority levels. On some platforms these will map to thread - // priorities, on others such as Mac and iOS, GCD queue priorities. - enum class Priority { - NORMAL = 0, - HIGH, - LOW, - }; - - explicit TaskQueue(const char* queue_name, - Priority priority = Priority::NORMAL); - ~TaskQueue(); - - static TaskQueue* Current(); - - // Used for DCHECKing the current queue. - bool IsCurrent() const; - - // TODO(tommi): For better debuggability, implement RTC_FROM_HERE. - - // Ownership of the task is passed to PostTask. - void PostTask(std::unique_ptr<QueuedTask> task); - void PostTaskAndReply(std::unique_ptr<QueuedTask> task, - std::unique_ptr<QueuedTask> reply, - TaskQueue* reply_queue); - void PostTaskAndReply(std::unique_ptr<QueuedTask> task, - std::unique_ptr<QueuedTask> reply); - - // Schedules a task to execute a specified number of milliseconds from when - // the call is made. The precision should be considered as "best effort" - // and in some cases, such as on Windows when all high precision timers have - // been used up, can be off by as much as 15 millseconds (although 8 would be - // more likely). This can be mitigated by limiting the use of delayed tasks. - void PostDelayedTask(std::unique_ptr<QueuedTask> task, uint32_t milliseconds); - - // std::enable_if is used here to make sure that calls to PostTask() with - // std::unique_ptr<SomeClassDerivedFromQueuedTask> would not end up being - // caught by this template. - template <class Closure, - typename std::enable_if< - std::is_copy_constructible<Closure>::value>::type* = nullptr> - void PostTask(const Closure& closure) { - PostTask(std::unique_ptr<QueuedTask>(new ClosureTask<Closure>(closure))); - } - - // See documentation above for performance expectations. - template <class Closure> - void PostDelayedTask(const Closure& closure, uint32_t milliseconds) { - PostDelayedTask( - std::unique_ptr<QueuedTask>(new ClosureTask<Closure>(closure)), - milliseconds); - } - - template <class Closure1, class Closure2> - void PostTaskAndReply(const Closure1& task, - const Closure2& reply, - TaskQueue* reply_queue) { - PostTaskAndReply( - std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)), - std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply)), - reply_queue); - } - - template <class Closure> - void PostTaskAndReply(std::unique_ptr<QueuedTask> task, - const Closure& reply) { - PostTaskAndReply(std::move(task), std::unique_ptr<QueuedTask>( - new ClosureTask<Closure>(reply))); - } - - template <class Closure> - void PostTaskAndReply(const Closure& task, - std::unique_ptr<QueuedTask> reply) { - PostTaskAndReply( - std::unique_ptr<QueuedTask>(new ClosureTask<Closure>(task)), - std::move(reply)); - } - - template <class Closure1, class Closure2> - void PostTaskAndReply(const Closure1& task, const Closure2& reply) { - PostTaskAndReply( - std::unique_ptr<QueuedTask>(new ClosureTask<Closure1>(task)), - std::unique_ptr<QueuedTask>(new ClosureTask<Closure2>(reply))); - } - - private: - class Impl; - const scoped_refptr<Impl> impl_; - - DISALLOW_COPY_AND_ASSIGN(TaskQueue); -}; - -} // namespace rtc - -#endif // WEBRTC_RTC_BASE_TASK_QUEUE_H_ +// TODO(nisse): This file is obsolete, but still referenced by +// webrtc's rtc_base/BUILD.gn. Update that, then delete this file. +#include "third_party/webrtc/rtc_base/task_queue.h"
diff --git a/tools/android/android_studio/ChromiumInspections.xml b/tools/android/android_studio/ChromiumInspections.xml new file mode 100644 index 0000000..efd75ca --- /dev/null +++ b/tools/android/android_studio/ChromiumInspections.xml
@@ -0,0 +1,6 @@ +<profile version="1.0"> + <option name="myName" value="Chromium" /> + <!-- We use asserts in Chromium. See https://chromium.googlesource.com/chromium/src/+/master/styleguide/java/java.md#Asserts --> + <inspection_tool class="AndroidLintAssert" enabled="false" level="WARNING" enabled_by_default="false" /> + <inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" /> +</profile>
diff --git a/tools/battor_agent/battor_agent.cc b/tools/battor_agent/battor_agent.cc index 2812166..7c126f94 100644 --- a/tools/battor_agent/battor_agent.cc +++ b/tools/battor_agent/battor_agent.cc
@@ -8,7 +8,7 @@ #include <vector> #include "base/bind.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "tools/battor_agent/battor_connection_impl.h" #include "tools/battor_agent/battor_sample_converter.h" @@ -127,17 +127,17 @@ last_action_(Action::INVALID), command_(Command::INVALID), num_command_attempts_(0) { - // We don't care what thread the constructor is called on - we only care that - // all of the other method invocations happen on the same thread. - thread_checker_.DetachFromThread(); + // We don't care what sequence the constructor is called on - we only care + // that all of the other method invocations happen on the same sequence. + DETACH_FROM_SEQUENCE(sequence_checker_); } BattOrAgent::~BattOrAgent() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void BattOrAgent::StartTracing() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // When tracing is restarted, all previous clock sync markers are invalid. clock_sync_markers_.clear(); @@ -148,14 +148,14 @@ } void BattOrAgent::StopTracing() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); command_ = Command::STOP_TRACING; PerformAction(Action::REQUEST_CONNECTION); } void BattOrAgent::RecordClockSyncMarker(const std::string& marker) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); command_ = Command::RECORD_CLOCK_SYNC_MARKER; pending_clock_sync_marker_ = marker; @@ -163,14 +163,14 @@ } void BattOrAgent::GetFirmwareGitHash() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); command_ = Command::GET_FIRMWARE_GIT_HASH; PerformAction(Action::REQUEST_CONNECTION); } void BattOrAgent::BeginConnect() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); connection_->Open(); } @@ -201,7 +201,7 @@ } void BattOrAgent::OnBytesSent(bool success) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!success) { CompleteCommand(BATTOR_ERROR_SEND_ERROR); @@ -394,7 +394,7 @@ } void BattOrAgent::PerformAction(Action action) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); last_action_ = action; @@ -484,7 +484,7 @@ } void BattOrAgent::PerformDelayedAction(Action action, base::TimeDelta delay) { - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&BattOrAgent::PerformAction, AsWeakPtr(), action), delay); } @@ -510,7 +510,7 @@ void BattOrAgent::SendControlMessage(BattOrControlMessageType type, uint16_t param1, uint16_t param2) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); SetActionTimeout(kBattOrControlMessageTimeoutSeconds); @@ -544,7 +544,7 @@ NOTREACHED(); } - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, next_command, base::TimeDelta::FromSeconds(kCommandRetryDelaySeconds)); } @@ -552,26 +552,26 @@ void BattOrAgent::CompleteCommand(BattOrError error) { switch (command_) { case Command::START_TRACING: - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&Listener::OnStartTracingComplete, base::Unretained(listener_), error)); break; case Command::STOP_TRACING: - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&Listener::OnStopTracingComplete, base::Unretained(listener_), SamplesToResults(), error)); break; case Command::RECORD_CLOCK_SYNC_MARKER: - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&Listener::OnRecordClockSyncMarkerComplete, base::Unretained(listener_), error)); break; case Command::GET_FIRMWARE_GIT_HASH: - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&Listener::OnGetFirmwareGitHashComplete, - base::Unretained(listener_), - firmware_git_hash_, error)); + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&Listener::OnGetFirmwareGitHashComplete, + base::Unretained(listener_), firmware_git_hash_, error)); break; case Command::INVALID: NOTREACHED(); @@ -637,7 +637,7 @@ void BattOrAgent::SetActionTimeout(uint16_t timeout_seconds) { timeout_callback_.Reset( base::Bind(&BattOrAgent::OnActionTimeout, AsWeakPtr())); - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, timeout_callback_.callback(), base::TimeDelta::FromSeconds(timeout_seconds)); }
diff --git a/tools/battor_agent/battor_agent.h b/tools/battor_agent/battor_agent.h index 90fd975..f0179be3 100644 --- a/tools/battor_agent/battor_agent.h +++ b/tools/battor_agent/battor_agent.h
@@ -12,8 +12,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" -#include "base/threading/thread_checker.h" #include "base/time/default_tick_clock.h" #include "tools/battor_agent/battor_connection.h" #include "tools/battor_agent/battor_error.h" @@ -196,9 +196,6 @@ // The time at which the last clock sync marker was recorded. base::TimeTicks last_clock_sync_time_; - // Checker to make sure that this is only ever called on the IO thread. - base::ThreadChecker thread_checker_; - // The BattOr's EEPROM (which is required for calibration). std::unique_ptr<BattOrEEPROM> battor_eeprom_; @@ -221,6 +218,8 @@ // The git hash of the BattOr firmware. std::string firmware_git_hash_; + SEQUENCE_CHECKER(sequence_checker_); + DISALLOW_COPY_AND_ASSIGN(BattOrAgent); };
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 11aa7670..d7f1478 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -596,9 +596,10 @@ # Build PDBs for archival on Windows. Don't use RelWithDebInfo since it # has different optimization defaults than Release. + # Also disable stack cookies (/GS-) for performance. if sys.platform == 'win32': - cflags += ['/Zi'] - cxxflags += ['/Zi'] + cflags += ['/Zi', '/GS-'] + cxxflags += ['/Zi', '/GS-'] ldflags += ['/DEBUG', '/OPT:REF', '/OPT:ICF'] CreateChromeToolsShim()
diff --git a/tools/idl_parser/idl_node.py b/tools/idl_parser/idl_node.py index afc309e..266a526fc 100755 --- a/tools/idl_parser/idl_node.py +++ b/tools/idl_parser/idl_node.py
@@ -76,6 +76,11 @@ # version aware. # class IDLNode(object): + VERBOSE_PROPS = [ + 'PROD', 'NAME', 'VALUE', 'TYPE', + 'ERRORS', 'WARNINGS', 'FILENAME', 'LINENO', 'POSITION', 'DATETIME', + ] + def __init__(self, cls, filename, lineno, pos, children=None): self._cls = cls self._properties = { @@ -140,29 +145,28 @@ search.Exit(self) - def Tree(self, filter_nodes=None, accept_props=None): + def Tree(self, filter_nodes=None, suppress_props=VERBOSE_PROPS): class DumpTreeSearch(IDLSearch): def __init__(self, props): IDLSearch.__init__(self) self.out = [] - self.props = props + self.props = props or [] def Enter(self, node): tab = ''.rjust(self.depth * 2) self.out.append(tab + str(node)) - if self.props: - proplist = [] - for key, value in node.GetProperties().iteritems(): - if key in self.props: - proplist.append(tab + ' %s: %s' % (key, str(value))) - if proplist: - self.out.append(tab + ' PROPERTIES') - self.out.extend(proplist) + + proplist = [] + for key, value in node.GetProperties().iteritems(): + if key not in self.props: + proplist.append(tab + ' %s: %s' % (key, str(value))) + if proplist: + self.out.extend(proplist) if filter_nodes == None: filter_nodes = ['SpecialComment'] - search = DumpTreeSearch(accept_props) + search = DumpTreeSearch(suppress_props) self.Traverse(search, filter_nodes) return search.out
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py index caa0011..c73d51f 100755 --- a/tools/idl_parser/idl_parser.py +++ b/tools/idl_parser/idl_parser.py
@@ -270,7 +270,8 @@ """CallbackOrInterface : CALLBACK CallbackRestOrInterface | Interface""" if len(p) > 2: - p[2].AddChildren(self.BuildTrue('CALLBACK')) + if p[2].GetClass() != 'Callback': + p[2].AddChildren(self.BuildTrue('CALLBACK')) p[0] = p[2] else: p[0] = p[1] @@ -291,7 +292,7 @@ def p_Partial(self, p): """Partial : PARTIAL PartialDefinition""" - p[2].AddChildren(self.BuildTrue('Partial')) + p[2].AddChildren(self.BuildTrue('PARTIAL')) p[0] = p[2] # Error recovery for Partial @@ -382,8 +383,7 @@ def p_PartialDictionary(self, p): """PartialDictionary : DICTIONARY identifier '{' DictionaryMembers '}' ';'""" - partial = self.BuildTrue('Partial') - p[0] = self.BuildNamed('Dictionary', p, 2, ListFromConcat(p[4], partial)) + p[0] = self.BuildNamed('Dictionary', p, 2, p[4]) # Error recovery for Partial Dictionary def p_PartialDictionaryError(self, p): @@ -751,7 +751,7 @@ p[0] = self.BuildProduction('Maplike', p, 2, childlist) def p_SetlikeRest(self, p): - """SetlikeRest : SETLIKE '<' Type '>' ';'""" + """SetlikeRest : SETLIKE '<' TypeWithExtendedAttributes '>' ';'""" p[0] = self.BuildProduction('Setlike', p, 2, p[3]) # This rule has custom additions (i.e. SpecialComments). @@ -1054,7 +1054,7 @@ p[0] = self.BuildNamed('StringType', p, 1) def p_RecordType(self, p): - """RecordType : RECORD '<' StringType ',' Type '>'""" + """RecordType : RECORD '<' StringType ',' TypeWithExtendedAttributes '>'""" p[0] = self.BuildProduction('Record', p, 2, ListFromConcat(p[3], p[5])) # Error recovery for RecordType. @@ -1173,8 +1173,8 @@ def BuildError(self, p, prod): self._parse_errors += 1 name = self.BuildAttribute('NAME', self._last_error_msg) - line = self.BuildAttribute('LINE', self._last_error_lineno) - pos = self.BuildAttribute('POS', self._last_error_pos) + line = self.BuildAttribute('LINENO', self._last_error_lineno) + pos = self.BuildAttribute('POSITION', self._last_error_pos) prod = self.BuildAttribute('PROD', prod) node = self.BuildProduction('Error', p, 1, @@ -1256,7 +1256,7 @@ ast = IDLNode('AST', '__AST__', 0, 0, nodes) - print '\n'.join(ast.Tree(accept_props=['PROD'])) + print '\n'.join(ast.Tree()) if errors: print '\nFound %d errors.\n' % errors
diff --git a/tools/idl_parser/idl_parser_test.py b/tools/idl_parser/idl_parser_test.py index cd0a709..f9d0edf 100755 --- a/tools/idl_parser/idl_parser_test.py +++ b/tools/idl_parser/idl_parser_test.py
@@ -397,4 +397,4 @@ self._CheckDefaultValue(default_value, 'NULL', 'NULL') if __name__ == '__main__': - unittest.main(verbosity=2) \ No newline at end of file + unittest.main(verbosity=2)
diff --git a/tools/idl_parser/test_parser/dictionary_web.idl b/tools/idl_parser/test_parser/dictionary_web.idl index 6260c28..b33d0bd 100644 --- a/tools/idl_parser/test_parser/dictionary_web.idl +++ b/tools/idl_parser/test_parser/dictionary_web.idl
@@ -35,6 +35,7 @@ /** TREE *Dictionary(MyDictPartial) + * PARTIAL: True */ partial dictionary MyDictPartial { }; @@ -64,6 +65,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) */ @@ -97,6 +99,7 @@ *Dictionary(MyDictNull) * Key(setString) * Type() + * NULLABLE: True * StringType(DOMString) * Default() = "NULL" */ @@ -112,6 +115,7 @@ /** TREE *Dictionary(MyDictRequiredClampNotAppliedToType) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -124,6 +128,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -136,6 +141,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -149,6 +155,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -163,6 +170,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -177,6 +185,7 @@ /** TREE *Dictionary(MyDictRequired) * Key(setLong) + * REQUIRED: True * Type() * PrimitiveType(long) * ExtAttributes() @@ -287,4 +296,4 @@ */ dictionary MyDict { [XAttr1, XAttr2] long setLong; -}; \ No newline at end of file +};
diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl index 02645ed..052aece 100644 --- a/tools/idl_parser/test_parser/interface_web.idl +++ b/tools/idl_parser/test_parser/interface_web.idl
@@ -35,6 +35,7 @@ /** TREE *Interface(MyIFacePartial) + * PARTIAL: True */ partial interface MyIFacePartial { }; @@ -98,6 +99,7 @@ *Interface(MyIFaceBig) * Const(setString) * StringType(DOMString) + * NULLABLE: True * Value() = "NULL" */ interface MyIFaceBig { @@ -109,6 +111,7 @@ * Operation(foo) * Arguments() * Argument(arg) + * OPTIONAL: True * Type() * Sequence() * Type() @@ -131,6 +134,8 @@ * StringType(DOMString) * Type() * PrimitiveType(long) + * ExtAttributes() + * ExtAttribute(EnforceRange) * Type() * PrimitiveType(void) * Operation(bar) @@ -148,7 +153,7 @@ * PrimitiveType(double) */ interface MyIfaceWithRecords { - void foo(record<DOMString, long> arg); + void foo(record<DOMString, [EnforceRange] long> arg); double bar(int arg1, record<ByteString, float> arg2); }; @@ -156,6 +161,7 @@ *Interface(MyIFaceBig2) * Const(nullValue) * StringType(DOMString) + * NULLABLE: True * Value() = "NULL" * Const(longValue) * PrimitiveType(long) @@ -167,9 +173,11 @@ * Type() * StringType(DOMString) * Attribute(readOnlyString) + * READONLY: True * Type() * StringType(DOMString) * Attribute(staticString) + * STATIC: True * Type() * StringType(DOMString) * Operation(myFunction) @@ -180,6 +188,7 @@ * Type() * PrimitiveType(void) * Operation(staticFunction) + * STATIC: True * Arguments() * Argument(myLong) * Type() @@ -201,6 +210,8 @@ /** TREE *Interface(MyIFaceSpecials) * Operation(set) + * CREATOR: True + * SETTER: True * Arguments() * Argument(property) * Type() @@ -208,6 +219,7 @@ * Type() * PrimitiveType(void) * Operation(_unnamed_) + * GETTER: True * Arguments() * Argument(property) * Type() @@ -346,6 +358,7 @@ /** TREE *Interface(MyIfaceMaplike) * Maplike() + * READONLY: True * Type() * PrimitiveType(long) * Type() @@ -374,15 +387,22 @@ /** TREE *Interface(MyIfaceSetlike) * Setlike() + * READONLY: True * Type() * PrimitiveType(long) * Setlike() * Type() * PrimitiveType(double) + * Setlike() + * Type() + * PrimitiveType(long) + * ExtAttributes() + * ExtAttribute(EnforceRange) */ interface MyIfaceSetlike { readonly setlike<long>; setlike<double>; + setlike<[EnforceRange] long>; }; /** TREE @@ -394,26 +414,38 @@ * Type() * Any() * Serializer() + * ATTRIBUTE: name * Serializer() * Map() * Serializer() * Map() + * GETTER: True * Serializer() * Map() + * ATTRIBUTE: True * Serializer() * Map() + * ATTRIBUTE: True + * INHERIT: True * Serializer() * Map() + * INHERIT: True + * ATTRIBUTES: None * Serializer() * Map() + * INHERIT: True + * ATTRIBUTES: ['name1', 'name2'] * Serializer() * Map() + * ATTRIBUTES: ['name1', 'name2'] * Serializer() * List() * Serializer() * List() + * GETTER: True * Serializer() * List() + * ATTRIBUTES: ['name1', 'name2'] */ interface MyIfaceSerializer { serializer; @@ -434,6 +466,7 @@ /** TREE *Interface(MyIfaceFrozenArray) * Attribute(foo) + * READONLY: True * Type() * FrozenArray() * Type() @@ -474,6 +507,7 @@ * Operation(myFunction) * Arguments() * Argument(myLong) + * OPTIONAL: True * Type() * PrimitiveType(long long) * ExtAttributes() @@ -511,4 +545,4 @@ interface MyIFaceArgumentWithAnnotatedType2 { void voidMethodTestArgumentWithExtAttribute1([Clamp, XAttr] long long myLong); void voidMethodTestArgumentWithExtAttribute2([EnforceRange] long longArg); -}; \ No newline at end of file +};
diff --git a/tools/idl_parser/test_parser/typedef_web.idl b/tools/idl_parser/test_parser/typedef_web.idl index b100abc..8028c06e 100644 --- a/tools/idl_parser/test_parser/typedef_web.idl +++ b/tools/idl_parser/test_parser/typedef_web.idl
@@ -109,6 +109,7 @@ *Typedef(MyUFloat) * Type() * PrimitiveType(float) + * UNRESTRICTED: True */ typedef unrestricted float MyUFloat; @@ -123,6 +124,7 @@ *Typedef(MyUDouble) * Type() * PrimitiveType(double) + * UNRESTRICTED: True */ typedef unrestricted double MyUDouble;
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index dc343147..f25faeb 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -169,6 +169,8 @@ 'ClangToTWin64': 'clang_tot_official_minimal_symbols_static_release', 'ClangToTWin64(dbg)': 'clang_tot_shared_debug', 'ClangToTWin64(dll)': 'clang_tot_shared_release_dcheck', + 'ClangToTWinCFI': 'clang_tot_cfi_full_cfi_diag_thin_lto_release_static_dcheck_always_on_x86', + 'ClangToTWinCFI64': 'clang_tot_cfi_full_cfi_diag_thin_lto_release_static_dcheck_always_on', 'ClangToTiOS': 'ios', 'Closure Compilation Linux': 'closure_compilation', 'CrWinAsan': 'asan_clang_fuzzer_static_v8_heap_x86_full_symbols_release', @@ -1120,6 +1122,10 @@ 'clang_tot', 'cfi_full', 'cfi_diag', 'thin_lto', 'release', 'static', 'dcheck_always_on', ], + 'clang_tot_cfi_full_cfi_diag_thin_lto_release_static_dcheck_always_on_x86': [ + 'clang_tot', 'cfi_full', 'cfi_diag', 'thin_lto', 'release', 'static', 'dcheck_always_on', 'x86', + ], + 'clang_tot_edge_ubsan_no_recover_hack_static_release': [ 'clang_tot', 'edge', 'ubsan_no_recover_hack', 'static', 'release', ],
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 63c89e41..1d377314 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -4600,6 +4600,15 @@ <description>Please enter the description of this user action.</description> </action> +<action name="EventTargeting_DeletedTarget"> + <owner>riajiang@chromium.org</owner> + <owner>rjkroege@chromium.org</owner> + <description> + Events for a target window are processed after that target window has been + deleted. + </description> +</action> + <action name="Exit"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index e125d16b..2f8edcf1 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -21195,6 +21195,7 @@ <int value="7" label="User preference disabled"/> <int value="8" label="Enabled"/> <int value="9" label="BLE not present"/> + <int value="10" label="WiFi not present"/> </enum> <enum name="InstantTethering_HostScanResult"> @@ -23837,6 +23838,7 @@ <int value="304901781" label="NewUsbBackend:enabled"/> <int value="313303258" label="WebPaymentsModifiers:disabled"/> <int value="316182183" label="MediaDocumentDownloadButton:disabled"/> + <int value="319683583" label="ContentSuggestionsDebugLog:enabled"/> <int value="323605372" label="ui-disable-compositor-animation-timelines"/> <int value="324522065" label="app-menu-icon"/> <int value="324631366" label="enable-drive-search-in-app-launcher"/> @@ -23978,6 +23980,7 @@ <int value="695385040" label="enable-external-drive-rename"/> <int value="696600628" label="VibrateRequiresUserGesture:disabled"/> <int value="698809951" label="WebRtcHWVP8Encoding:enabled"/> + <int value="699149897" label="ContentSuggestionsDebugLog:disabled"/> <int value="705713283" label="EasyUnlockPromotions:disabled"/> <int value="709850261" label="disable-touch-editing"/> <int value="711424932" label="enable-cloud-print-xps"/> @@ -24677,7 +24680,9 @@ <int value="1007" label="CBErrorPeripheralDisconnected"/> <int value="1008" label="CBErrorUUIDNotAllowed"/> <int value="1009" label="CBErrorAlreadyAdvertising"/> - <int value="1010" label="CBErrorMaxConnection"/> + <int value="1010" label="CBErrorConnectionFailed"/> + <int value="1011" label="CBErrorConnectionLimitReached"/> + <int value="1012" label="CBErrorUnknownDevice"/> <int value="1999" label="Unknown CBError code"/> </enum>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index ae818fd..1724fc6 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -73048,6 +73048,14 @@ <summary>Execution time of ServiceWorkerGlobalScope.onpush.</summary> </histogram> +<histogram name="ServiceWorker.RegisteredOriginCount" units="origins"> + <owner>falken@chromium.org</owner> + <summary> + The number of origins that have a service worker registration. Recorded near + browser startup, when the service worker storage system is initialized. + </summary> +</histogram> + <histogram name="ServiceWorker.RequestTimeouts.Count" enum="ServiceWorkerMetrics.EventType"> <owner>jeremyarcher@google.com</owner> @@ -88011,7 +88019,26 @@ </summary> </histogram> +<histogram name="Web.CurrentOriginEqualsLastCommittedOrigin" + enum="BooleanEqual"> + <owner>eugenebut@chromium.com</owner> + <summary> + [iOS] Reports URL matches between the return value from the WebState's + GetLastCommittedURL and GetCurrentURL methods. It is expected the origins + will be equal to confirm that GetCurrentURL can now be replaced with + GetLastCommittedURL. This will be called each time WebStateImpl:: + GetCurrentURL(URLVerificationTrustLevel* trust_level) is called, which is an + old method of obtaining the url and trust level. The trust level was only + relevant with UIWebView, so this method is only called from code which has + not yet been updated since UIWebView was removed. + </summary> +</histogram> + <histogram name="Web.CurrentURLEqualsLastCommittedURL" enum="BooleanEqual"> + <obsolete> + Deprecated as of 9/2013, replaced by + Web.CurrentOriginEqualsLastCommittedOrigin. + </obsolete> <owner>michaeldo@chromium.com</owner> <summary> [iOS] Reports URL matches between the return value from the WebState's @@ -92291,6 +92318,16 @@ </summary> </histogram> +<histogram name="WebsiteSettings.Menu.PermissionChanged.SessionOnly" + enum="ContentType"> + <owner>timloh@chromium.org</owner> + <summary> + Count of how often a specific content type (permission) is changed to the + session only value using the content settings menu. This option only exists + for cookies. + </summary> +</histogram> + <histogram name="WebsiteSettings.OriginInfo.PermissionChanged" enum="ContentType"> <owner>sashab@chromium.org</owner>
diff --git a/tools/perf/benchmark.csv b/tools/perf/benchmark.csv index c9d0265..b50b730 100644 --- a/tools/perf/benchmark.csv +++ b/tools/perf/benchmark.csv
@@ -9,6 +9,7 @@ blink_perf.css,rune@opera.com, blink_perf.dom,"jbroman@chromium.org, yukishiino@chromium.org, haraken@chromium.org", blink_perf.events,hayato@chromium.org, +blink_perf.image_decoder,"cblume@chromium.org, reveman@chromium.org", blink_perf.layout,eae@chromium.org, blink_perf.owp_storage,dmurph@chromium.org, blink_perf.paint,wangxianzhu@chromium.org, @@ -46,8 +47,6 @@ oortonline_tbmv2,ulan@chromium.org, performance_browser_tests,miu@chromium.org, power.idle_platform,, -power.steady_state,, -power.trivial_pages,erikchen@chromium.org, power.typical_10_mobile,perezju@chromium.org, rasterize_and_record_micro.partial_invalidation,"vmpstr@chromium.org, wkorman@chromium.org",Internals>Compositing>Rasterization rasterize_and_record_micro.top_25,"vmpstr@chromium.org, wkorman@chromium.org",Internals>Compositing>Rasterization
diff --git a/tools/perf/benchmarks/octane.py b/tools/perf/benchmarks/octane.py index 25334da6..3919c0f 100644 --- a/tools/perf/benchmarks/octane.py +++ b/tools/perf/benchmarks/octane.py
@@ -143,5 +143,7 @@ def GetExpectations(self): class StoryExpectations(story.expectations.StoryExpectations): def SetExpectations(self): - pass # Octane not disabled. + self.DisableStory( + 'http://chromium.github.io/octane/index.html?auto=1', + [story.expectations.ANDROID_ONE], 'http://crbug.com/764875') return StoryExpectations()
diff --git a/tools/perf/benchmarks/power.py b/tools/perf/benchmarks/power.py index d5966a6..d66e8b1 100644 --- a/tools/perf/benchmarks/power.py +++ b/tools/perf/benchmarks/power.py
@@ -43,43 +43,6 @@ return StoryExpectations() -@benchmark.Owner(emails=['erikchen@chromium.org']) -class PowerScrollingTrivialPage(perf_benchmark.PerfBenchmark): - """Measure power consumption for some very simple pages.""" - test = power.QuiescentPower - page_set = page_sets.TrivialSitesStorySet - SUPPORTED_PLATFORMS = [story.expectations.ALL_MAC] - - @classmethod - def Name(cls): - return 'power.trivial_pages' - - def GetExpectations(self): - class StoryExpectations(story.expectations.StoryExpectations): - def SetExpectations(self): - pass - return StoryExpectations() - - -class PowerSteadyStatePages(perf_benchmark.PerfBenchmark): - """Measure power consumption for real web sites in steady state (no user - interactions).""" - test = power.QuiescentPower - page_set = page_sets.IdleAfterLoadingStories - SUPPORTED_PLATFORMS = [story.expectations.ALL_MAC] - - @classmethod - def Name(cls): - return 'power.steady_state' - - def GetExpectations(self): - class StoryExpectations(story.expectations.StoryExpectations): - def SetExpectations(self): - self.DisableStory('http://abcnews.go.com/', [story.expectations.ALL], - 'crbug.com/505990') - return StoryExpectations() - - class IdlePlatformBenchmark(perf_benchmark.PerfBenchmark): """Idle platform benchmark. @@ -118,4 +81,3 @@ def SetExpectations(self): pass # Nothing disabled. return StoryExpectations() -
diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index 66f1e573..db38f8a 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py
@@ -267,6 +267,10 @@ [story_module.expectations.ALL], 'crbug.com/338838') self.DisableStory('inbox_app.html?slide_drawer', [story_module.expectations.ALL], 'crbug.com/446332') + self.DisableStory('inbox_app.html?swipe_to_dismiss', + [story_module.expectations.ALL], 'crbug.com/764825') + self.DisableStory('masonry.html', + [story_module.expectations.ALL], 'crbug.com/764825') return StoryExpectations() @@ -438,9 +442,6 @@ self.DisableStory('LinkedIn', [story_module.expectations.ALL_ANDROID], 'crbug.com/631015') - self.DisableStory('Wikipedia (1 tab)', - [story_module.expectations.ALL_ANDROID], - 'crbug.com/631015') self.DisableStory('Twitter', [story_module.expectations.ALL_ANDROID], 'crbug.com/631015') @@ -480,7 +481,7 @@ cases. Uses lower zoom levels customized for desktop limits. """ page_set = page_sets.DesktopToughPinchZoomCasesPageSet - SUPPORTED_PLATFORMS = [story_module.expectations.ALL_DESKTOP] + SUPPORTED_PLATFORMS = [story_module.expectations.ALL_MAC] @classmethod def Name(cls): @@ -489,7 +490,7 @@ def GetExpectations(self): class StoryExpectations(story_module.expectations.StoryExpectations): def SetExpectations(self): - pass + pass # Nothing disabled. return StoryExpectations() @@ -536,9 +537,6 @@ 'crbug.com/610021') self.DisableStory('LinkedIn', [story_module.expectations.ALL_ANDROID], 'crbug.com/610021') - self.DisableStory('Wikipedia (1 tab)', - [story_module.expectations.ALL_ANDROID], - 'crbug.com/610021') self.DisableStory('Twitter', [story_module.expectations.ALL_ANDROID], 'crbug.com/610021') self.DisableStory('ESPN', [story_module.expectations.ALL_ANDROID],
diff --git a/tools/perf/benchmarks/thread_times.py b/tools/perf/benchmarks/thread_times.py index df49c84..c1a1dda 100644 --- a/tools/perf/benchmarks/thread_times.py +++ b/tools/perf/benchmarks/thread_times.py
@@ -54,6 +54,12 @@ [story.expectations.ALL], 'crbug.com/338838') self.DisableStory('inbox_app.html?slide_drawer', [story.expectations.ALL], 'crbug.com/446332') + self.DisableStory('http://s.codepen.io/befamous/fullpage/pFsqb?scroll', + [story.expectations.ALL], 'crbug.com/764825') + self.DisableStory('inbox_app.html?swipe_to_dismiss', + [story.expectations.ALL], 'crbug.com/764825') + self.DisableStory('masonry.html', + [story.expectations.ALL], 'crbug.com/764825') return StoryExpectations()
diff --git a/tools/perf/benchmarks/tracing.py b/tools/perf/benchmarks/tracing.py index 6e6391d0..e7c0b77 100644 --- a/tools/perf/benchmarks/tracing.py +++ b/tools/perf/benchmarks/tracing.py
@@ -5,6 +5,7 @@ from core import perf_benchmark from telemetry import benchmark +from telemetry import decorators from telemetry import story from telemetry.timeline import chrome_trace_category_filter from telemetry.timeline import chrome_trace_config @@ -14,6 +15,7 @@ @benchmark.Owner(emails=['ssid@chromium.org']) +@decorators.Disabled('all') # crbug.com/765140 class TracingWithBackgroundMemoryInfra(perf_benchmark.PerfBenchmark): """Measures the overhead of background memory-infra dumps""" page_set = page_sets.Top10PageSet
diff --git a/tools/perf/chromium.perf.fyi.extras.json b/tools/perf/chromium.perf.fyi.extras.json index 32457afe..3f43b39 100644 --- a/tools/perf/chromium.perf.fyi.extras.json +++ b/tools/perf/chromium.perf.fyi.extras.json
@@ -37,6 +37,7 @@ "-v", "--upload-results", "--output-format=histograms", + "--output-format=json-test-results", "--browser=release" ], "isolate_name": "telemetry_perf_tests",
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index e4d70f9..b0ad8b3 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -32,7 +32,6 @@ _UNSCHEDULED_TELEMETRY_BENCHMARKS = set([ - 'blink_perf.image_decoder', ])
diff --git a/tools/perf/core/trybot_command.py b/tools/perf/core/trybot_command.py index 9e99811..79e738b0 100644 --- a/tools/perf/core/trybot_command.py +++ b/tools/perf/core/trybot_command.py
@@ -416,6 +416,12 @@ else: arguments.insert(1, '--browser=release') + dummy_parser = argparse.ArgumentParser() + dummy_parser.add_argument('--output-format', action='append') + args, _ = dummy_parser.parse_known_args(arguments) + if not args.output_format or 'html' not in args.output_format: + arguments.append('--output-format=html') + command = ' '.join(arguments) return {
diff --git a/tools/perf/core/trybot_command_unittest.py b/tools/perf/core/trybot_command_unittest.py index a639948b..3980ca77 100644 --- a/tools/perf/core/trybot_command_unittest.py +++ b/tools/perf/core/trybot_command_unittest.py
@@ -135,7 +135,8 @@ def _ExpectedGitTryTestArgs(self, test_name, browser, target_arch='ia32'): return ('perf_try_config={' '"repeat_count": "1", "command": "src/tools/perf/run_benchmark ' - '--browser=%s %s --verbose", "max_time_minutes": "120", ' + '--browser=%s %s --verbose --output-format=html", ' + '"max_time_minutes": "120", ' '"target_arch": "%s", "truncate_percent": "0"}' % ( browser, test_name, target_arch)) @@ -398,7 +399,8 @@ config, _ = self._GetConfigForTrybot('android-nexus4', 'android') self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=android-chromium sunspider --verbose'), + '--browser=android-chromium sunspider --verbose ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'ia32', @@ -410,7 +412,8 @@ 'android-webview-nexus6-aosp', 'android-webview') self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=android-webview sunspider --verbose'), + '--browser=android-webview sunspider --verbose ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'ia32', @@ -421,7 +424,8 @@ config, _ = self._GetConfigForTrybot('mac-10-9', 'mac') self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=release sunspider --verbose'), + '--browser=release sunspider --verbose ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'ia32', @@ -433,7 +437,8 @@ self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=release_x64 sunspider --verbose'), + '--browser=release_x64 sunspider --verbose ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'x64', @@ -445,7 +450,8 @@ 'win-x64', 'win-x64', extra_benchmark_args=['-v']) self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=release_x64 sunspider -v'), + '--browser=release_x64 sunspider -v ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'x64', @@ -456,7 +462,8 @@ config, _ = self._GetConfigForTrybot('winx64nvidia', 'win-x64') self.assertEquals( {'command': ('src/tools/perf/run_benchmark ' - '--browser=release_x64 sunspider --verbose'), + '--browser=release_x64 sunspider --verbose ' + '--output-format=html'), 'max_time_minutes': '120', 'repeat_count': '1', 'target_arch': 'x64', @@ -471,6 +478,57 @@ {'win_perf_bisect': 'stuff'} ) + def testConfig_EmptyOutputFormat_AddsHtml(self): + config, _ = self._GetConfigForTrybot('android-nexus4', 'android') + self.assertEquals( + {'command': ('src/tools/perf/run_benchmark ' + '--browser=android-chromium sunspider --verbose ' + '--output-format=html'), + 'max_time_minutes': '120', + 'repeat_count': '1', + 'target_arch': 'ia32', + 'truncate_percent': '0' + }, config) + + def testConfig_OtherOutputFormat_AddsHtml(self): + config, _ = self._GetConfigForTrybot('android-nexus4', 'android', + extra_benchmark_args=['--output-format=foo']) + self.assertEquals( + {'command': ('src/tools/perf/run_benchmark ' + '--browser=android-chromium sunspider --output-format=foo ' + '--verbose --output-format=html'), + 'max_time_minutes': '120', + 'repeat_count': '1', + 'target_arch': 'ia32', + 'truncate_percent': '0' + }, config) + + def testConfig_HtmlOutputFormat_Skipped(self): + config, _ = self._GetConfigForTrybot('android-nexus4', 'android', + extra_benchmark_args=['--output-format', 'html']) + self.assertEquals( + {'command': ('src/tools/perf/run_benchmark ' + '--browser=android-chromium sunspider ' + '--output-format html --verbose'), + 'max_time_minutes': '120', + 'repeat_count': '1', + 'target_arch': 'ia32', + 'truncate_percent': '0' + }, config) + + def testConfig_HtmlOutputFormat_UsesEquals_Skipped(self): + config, _ = self._GetConfigForTrybot('android-nexus4', 'android', + extra_benchmark_args=['--output-format=html']) + self.assertEquals( + {'command': ('src/tools/perf/run_benchmark ' + '--browser=android-chromium sunspider ' + '--output-format=html --verbose'), + 'max_time_minutes': '120', + 'repeat_count': '1', + 'target_arch': 'ia32', + 'truncate_percent': '0' + }, config) + def testGetChangeListCommandError(self): temp_file = self._MockTempFile(None, None) command, _ = self._SetupTrybotCommand(
diff --git a/tools/perf/page_sets/data/top_25_009.wprgo.sha1 b/tools/perf/page_sets/data/top_25_009.wprgo.sha1 index a64c98f..a74d18d5 100644 --- a/tools/perf/page_sets/data/top_25_009.wprgo.sha1 +++ b/tools/perf/page_sets/data/top_25_009.wprgo.sha1
@@ -1 +1 @@ -3830b520b5bd595ac5780dca488ceebb0e0deb49 \ No newline at end of file +368f14d8ef40118d51fd16a6a8ba612693b5c397 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/tough_pinch_zoom_cases.json b/tools/perf/page_sets/data/tough_pinch_zoom_cases.json index 8a1ad83..f62640d 100644 --- a/tools/perf/page_sets/data/tough_pinch_zoom_cases.json +++ b/tools/perf/page_sets/data/tough_pinch_zoom_cases.json
@@ -1,67 +1,64 @@ { "archives": { "Blogger": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "ESPN": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "Facebook": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "LinkedIn": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "Twitter": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "Weather.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" - }, - "Wikipedia (1 tab)": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://answers.yahoo.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://booking.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://games.yahoo.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://news.yahoo.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://sports.yahoo.com/": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://www.amazon.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://www.cnn.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://www.ebay.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "http://www.youtube.com": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "https://mail.google.com/mail/": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "https://plus.google.com/+BarackObama/posts": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "https://www.google.com/#hl=en&q=barack+obama": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "https://www.google.com/calendar/": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" }, "https://www.google.com/search?q=cats&tbm=isch": { - "DEFAULT": "tough_pinch_zoom_cases_000.wpr" + "DEFAULT": "tough_pinch_zoom_cases_000.wprgo" } }, "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
diff --git a/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wpr.sha1 b/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wpr.sha1 deleted file mode 100644 index 88ecf57..0000000 --- a/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wpr.sha1 +++ /dev/null
@@ -1 +0,0 @@ -580e431e289c68b1a93a83f5cc4ea917ba864b48 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wprgo.sha1 b/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wprgo.sha1 new file mode 100644 index 0000000..8775907 --- /dev/null +++ b/tools/perf/page_sets/data/tough_pinch_zoom_cases_000.wprgo.sha1
@@ -0,0 +1 @@ +b6afe49d7c933aca24f3e365d04fd0ffa884be88 \ No newline at end of file
diff --git a/tools/perf/page_sets/system_health/expectations.py b/tools/perf/page_sets/system_health/expectations.py index 3775641..9dffd5d 100644 --- a/tools/perf/page_sets/system_health/expectations.py +++ b/tools/perf/page_sets/system_health/expectations.py
@@ -85,12 +85,12 @@ 'Webview does not have tabs') self.DisableStory('browse:shopping:avito', [expectations.ANDROID_NEXUS6], 'crbug.com/736497') - self.DisableStory('browse:social:pinterest_infinite_scroll', - [expectations.ANDROID_WEBVIEW], 'crbug.com/728528') class SystemHealthMobileMemoryExpectations(expectations.StoryExpectations): def SetExpectations(self): + self.DisableStory('long_running:tools:gmail-background', + [expectations.ANDROID_ONE], 'crbug.com/764924') self.DisableStory('browse:shopping:flipkart', [expectations.ALL_ANDROID], 'crbug.com/708300') self.DisableStory('browse:news:globo', [expectations.ALL_ANDROID], @@ -115,8 +115,6 @@ self.DisableStory('long_running:tools:gmail-background', [expectations.ANDROID_WEBVIEW], 'Webview does not have tabs') - self.DisableStory('browse:social:pinterest_infinite_scroll', - [expectations.ANDROID_WEBVIEW], 'crbug.com/728528') # Should only include browse:*:* stories. @@ -154,8 +152,6 @@ self.DisableStory('browse:chrome:newtab', [expectations.ANDROID_WEBVIEW], 'Webview does not have NTP') - self.DisableStory('browse:social:pinterest_infinite_scroll', - [expectations.ANDROID_WEBVIEW], 'crbug.com/728528') class SystemHealthWebviewStartupExpectations(expectations.StoryExpectations):
diff --git a/tools/perf/page_sets/tough_pinch_zoom_cases.py b/tools/perf/page_sets/tough_pinch_zoom_cases.py index cecbc7e..2c3dc50f 100644 --- a/tools/perf/page_sets/tough_pinch_zoom_cases.py +++ b/tools/perf/page_sets/tough_pinch_zoom_cases.py
@@ -153,16 +153,6 @@ page_set=page_set, name='LinkedIn') -class WikipediaPage(ToughPinchZoomCasesPage): - - """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page """ - - def __init__(self, page_set): - super(WikipediaPage, self).__init__( - url='http://en.wikipedia.org/wiki/Wikipedia', - page_set=page_set, name='Wikipedia (1 tab)') - - class TwitterPage(ToughPinchZoomCasesPage): """ Why: #8 (Alexa global),Picked an interesting page """ @@ -230,7 +220,6 @@ self.AddStory(BlogSpotPage(self)) self.AddStory(FacebookPage(self)) self.AddStory(LinkedinPage(self)) - self.AddStory(WikipediaPage(self)) self.AddStory(TwitterPage(self)) self.AddStory(ESPNPage(self))
diff --git a/tools/perf/unowned_benchmarks.txt b/tools/perf/unowned_benchmarks.txt index 1f7ccc90..f4c2231 100644 --- a/tools/perf/unowned_benchmarks.txt +++ b/tools/perf/unowned_benchmarks.txt
@@ -1,6 +1,5 @@ load_library_perf_tests power.idle_platform -power.steady_state smoothness.tough_image_decode_cases thread_times.key_hit_test_cases thread_times.key_noop_cases
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn index b1b35724..3792c69d 100644 --- a/tools/v8_context_snapshot/BUILD.gn +++ b/tools/v8_context_snapshot/BUILD.gn
@@ -20,7 +20,7 @@ declare_args() { # TODO(crbug.com/764576): Enable the feature on more environments. use_v8_context_snapshot = !is_chromeos && !is_android && !is_chromecast && - v8_target_cpu == target_cpu + (v8_target_cpu == target_cpu || is_msan) } if (is_android) {
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index 6467c1d..93c4793e 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -3,6 +3,9 @@ // found in the LICENSE file. #include "ui/accessibility/platform/ax_platform_node_win.h" + +#include <vector> + #include "base/containers/hash_tables.h" #include "base/lazy_instance.h" #include "base/strings/string_number_conversions.h" @@ -1068,58 +1071,37 @@ STDMETHODIMP AXPlatformNodeWin::get_accSelection(VARIANT* selected) { WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_SELECTION); COM_OBJECT_VALIDATE_1_ARG(selected); - - if (GetData().role != AX_ROLE_LIST_BOX) - return E_NOTIMPL; - - unsigned long selected_count = 0; - for (auto i = 0; i < delegate_->GetChildCount(); ++i) { - AXPlatformNodeWin* node = static_cast<AXPlatformNodeWin*>( + std::vector<base::win::ScopedComPtr<IDispatch>> selected_nodes; + for (int i = 0; i < delegate_->GetChildCount(); ++i) { + auto* node = static_cast<AXPlatformNodeWin*>( FromNativeViewAccessible(delegate_->ChildAtIndex(i))); - if (node && node->GetData().HasState(AX_STATE_SELECTED)) - ++selected_count; + selected_nodes.emplace_back(node); } - if (selected_count == 0) { + if (selected_nodes.empty()) { selected->vt = VT_EMPTY; return S_OK; } - if (selected_count == 1) { - for (auto i = 0; i < delegate_->GetChildCount(); ++i) { - AXPlatformNodeWin* node = static_cast<AXPlatformNodeWin*>( - FromNativeViewAccessible(delegate_->ChildAtIndex(i))); - - if (node && node->GetData().HasState(AX_STATE_SELECTED)) { - selected->vt = VT_DISPATCH; - selected->pdispVal = node; - node->AddRef(); - return S_OK; + if (selected_nodes.size() == 1) { + selected->vt = VT_DISPATCH; + selected->pdispVal = selected_nodes[0].Detach(); + return S_OK; } - } - } // Multiple items are selected. - base::win::EnumVariant* enum_variant = - new base::win::EnumVariant(selected_count); - enum_variant->AddRef(); - unsigned long index = 0; - for (auto i = 0; i < delegate_->GetChildCount(); ++i) { - AXPlatformNodeWin* node = static_cast<AXPlatformNodeWin*>( - FromNativeViewAccessible(delegate_->ChildAtIndex(i))); - - if (node && node->GetData().HasState(AX_STATE_SELECTED)) { - enum_variant->ItemAt(index)->vt = VT_DISPATCH; - enum_variant->ItemAt(index)->pdispVal = node; - node->AddRef(); - ++index; - } + LONG selected_count = static_cast<LONG>(selected_nodes.size()); + auto* enum_variant = new base::win::EnumVariant(selected_count); + enum_variant->AddRef(); + for (LONG i = 0; i < selected_count; ++i) { + enum_variant->ItemAt(i)->vt = VT_DISPATCH; + enum_variant->ItemAt(i)->pdispVal = selected_nodes[i].Detach(); } selected->vt = VT_UNKNOWN; - selected->punkVal = static_cast<IUnknown*>( - static_cast<base::win::IUnknownImpl*>(enum_variant)); - return S_OK; + HRESULT hr = enum_variant->QueryInterface(IID_PPV_ARGS(&V_UNKNOWN(selected))); + enum_variant->Release(); + return hr; } STDMETHODIMP AXPlatformNodeWin::accSelect(
diff --git a/ui/accessibility/platform/ax_platform_node_win_unittest.cc b/ui/accessibility/platform/ax_platform_node_win_unittest.cc index 160ab8e3..105087e5 100644 --- a/ui/accessibility/platform/ax_platform_node_win_unittest.cc +++ b/ui/accessibility/platform/ax_platform_node_win_unittest.cc
@@ -136,10 +136,11 @@ void CheckVariantHasName(ScopedVariant& variant, const wchar_t* expected_name) { + ASSERT_NE(nullptr, variant.ptr()); ScopedComPtr<IAccessible> accessible; - HRESULT hr = - V_DISPATCH(variant.ptr())->QueryInterface(IID_PPV_ARGS(&accessible)); - EXPECT_EQ(S_OK, hr); + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(variant.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); ScopedBstr name; EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); EXPECT_STREQ(expected_name, name); @@ -157,7 +158,7 @@ AXTreeUpdate Build3X3Table() { /* - Build a table the looks like: + Build a table that looks like: ---------------------- (A) Column Header | | (A) | (B) | (B) Column Header @@ -202,7 +203,7 @@ AXNodeData table_column_header_2; table_column_header_2.id = 52; table_column_header_2.role = AX_ROLE_COLUMN_HEADER; - table_column_header_2.AddStringAttribute(AX_ATTR_NAME, "column header 1"); + table_column_header_2.SetName("column header 1"); AXNodeData table_column_header_3; table_column_header_3.id = 53; @@ -223,17 +224,17 @@ AXNodeData table_row_header_1; table_row_header_1.id = 2; table_row_header_1.role = AX_ROLE_ROW_HEADER; - table_row_header_1.AddStringAttribute(AX_ATTR_NAME, "row header 1"); + table_row_header_1.SetName("row header 1"); AXNodeData table_cell_1; table_cell_1.id = 3; table_cell_1.role = AX_ROLE_CELL; - table_cell_1.AddStringAttribute(AX_ATTR_NAME, "1"); + table_cell_1.SetName("1"); AXNodeData table_cell_2; table_cell_2.id = 4; table_cell_2.role = AX_ROLE_CELL; - table_cell_2.AddStringAttribute(AX_ATTR_NAME, "2"); + table_cell_2.SetName("2"); // Row 2 AXNodeData table_row_2; @@ -253,12 +254,12 @@ AXNodeData table_cell_3; table_cell_3.id = 12; table_cell_3.role = AX_ROLE_CELL; - table_cell_3.AddStringAttribute(AX_ATTR_NAME, "3"); + table_cell_3.SetName("3"); AXNodeData table_cell_4; table_cell_4.id = 13; table_cell_4.role = AX_ROLE_CELL; - table_cell_4.AddStringAttribute(AX_ATTR_NAME, "4"); + table_cell_4.SetName("4"); AXTreeUpdate update; update.root_id = table.id; @@ -426,161 +427,352 @@ root_obj->get_accKeyboardShortcut(bad_id, k2.Receive())); } -TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionNotListBox) { - // We only support AX_ROLE_LIST_BOX as this point, so, this should return - // not implemented. We're choosing AX_ROLE_ALERT, but it could be anything - // but AX_ROLE_LIST_BOX_OPTION. - - AXNodeData not_supported; - not_supported.id = 0; - not_supported.role = AX_ROLE_ALERT; - - Init(not_supported); - ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); - - ScopedVariant selection; - EXPECT_EQ(E_NOTIMPL, root_obj->get_accSelection(selection.Receive())); -} - -TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionNothingSelected) { - // We're going to set up a AX_ROLE_LIST_BOX_OPTION with 2 options with - // nothing selected +TEST_F(AXPlatformNodeWinTest, + TestIAccessibleSelectionListBoxOptionNothingSelected) { AXNodeData list; list.id = 0; list.role = AX_ROLE_LIST_BOX; - list.child_ids.push_back(2); - list.child_ids.push_back(3); + AXNodeData list_item_1; + list_item_1.id = 1; + list_item_1.role = AX_ROLE_LIST_BOX_OPTION; + list_item_1.SetName("Name1"); AXNodeData list_item_2; list_item_2.id = 2; list_item_2.role = AX_ROLE_LIST_BOX_OPTION; - list_item_2.AddStringAttribute(AX_ATTR_NAME, "Name2"); + list_item_2.SetName("Name2"); - AXNodeData list_item_3; - list_item_3.id = 3; - list_item_3.role = AX_ROLE_LIST_BOX_OPTION; - list_item_3.AddStringAttribute(AX_ATTR_NAME, "Name3"); + list.child_ids.push_back(list_item_1.id); + list.child_ids.push_back(list_item_2.id); - // Nothing is selected. This should return S_OK and the selection should - // be VT_EMPTY. + Init(list, list_item_1, list_item_2); - Init(list, list_item_2, list_item_3); ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); ScopedVariant selection; EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); EXPECT_EQ(VT_EMPTY, selection.type()); } -TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionOneSelected) { - // We're going to set up a AX_ROLE_LIST_BOX_OPTION with 2 options with - // one selected. +TEST_F(AXPlatformNodeWinTest, + TestIAccessibleSelectionListBoxOptionOneSelected) { AXNodeData list; list.id = 0; list.role = AX_ROLE_LIST_BOX; - list.child_ids.push_back(2); - list.child_ids.push_back(3); + AXNodeData list_item_1; + list_item_1.id = 1; + list_item_1.role = AX_ROLE_LIST_BOX_OPTION; + list_item_1.AddState(AX_STATE_SELECTED); + list_item_1.SetName("Name1"); AXNodeData list_item_2; list_item_2.id = 2; list_item_2.role = AX_ROLE_LIST_BOX_OPTION; - list_item_2.state = 1 << AX_STATE_SELECTED; - list_item_2.AddStringAttribute(AX_ATTR_NAME, "Name2"); + list_item_2.SetName("Name2"); - AXNodeData list_item_3; - list_item_3.id = 3; - list_item_3.role = AX_ROLE_LIST_BOX_OPTION; - list_item_3.AddStringAttribute(AX_ATTR_NAME, "Name3"); + list.child_ids.push_back(list_item_1.id); + list.child_ids.push_back(list_item_2.id); - Init(list, list_item_2, list_item_3); + Init(list, list_item_1, list_item_2); ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); ScopedVariant selection; EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); - ASSERT_NE(nullptr, selection.ptr()); + EXPECT_EQ(VT_DISPATCH, selection.type()); - CheckVariantHasName(selection, L"Name2"); + CheckVariantHasName(selection, L"Name1"); } -TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionMultipleSelected) { - // We're going to set up a AX_ROLE_LIST_BOX_OPTION with 3 options with - // two selected. +TEST_F(AXPlatformNodeWinTest, + TestIAccessibleSelectionListBoxOptionMultipleSelected) { AXNodeData list; list.id = 0; list.role = AX_ROLE_LIST_BOX; - list.child_ids.push_back(2); - list.child_ids.push_back(3); - list.child_ids.push_back(4); + AXNodeData list_item_1; + list_item_1.id = 1; + list_item_1.role = AX_ROLE_LIST_BOX_OPTION; + list_item_1.AddState(AX_STATE_SELECTED); + list_item_1.SetName("Name1"); AXNodeData list_item_2; list_item_2.id = 2; list_item_2.role = AX_ROLE_LIST_BOX_OPTION; - list_item_2.state = 1 << AX_STATE_SELECTED; - list_item_2.AddStringAttribute(AX_ATTR_NAME, "Name2"); + list_item_2.AddState(AX_STATE_SELECTED); + list_item_2.SetName("Name2"); AXNodeData list_item_3; list_item_3.id = 3; list_item_3.role = AX_ROLE_LIST_BOX_OPTION; - list_item_3.state = 1 << AX_STATE_SELECTED; - list_item_3.AddStringAttribute(AX_ATTR_NAME, "Name3"); + list_item_3.SetName("Name3"); - AXNodeData list_item_4; - list_item_4.id = 4; - list_item_4.role = AX_ROLE_LIST_BOX_OPTION; - list_item_4.AddStringAttribute(AX_ATTR_NAME, "Name4"); - Init(list, list_item_2, list_item_3, list_item_4); + list.child_ids.push_back(list_item_1.id); + list.child_ids.push_back(list_item_2.id); + list.child_ids.push_back(list_item_3.id); + + Init(list, list_item_1, list_item_2, list_item_3); ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); ScopedVariant selection; EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_UNKNOWN, selection.type()); ASSERT_NE(nullptr, selection.ptr()); - // Loop through the selections and make sure we have the right ones + // Loop through the selections and make sure we have the right ones. ScopedComPtr<IEnumVARIANT> accessibles; - HRESULT hr = - V_DISPATCH(selection.ptr())->QueryInterface(IID_PPV_ARGS(&accessibles)); - EXPECT_EQ(S_OK, hr); - ULONG ignore; + ASSERT_HRESULT_SUCCEEDED( + V_UNKNOWN(selection.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessibles.GetAddressOf()))); + ULONG retrieved_count; // Check out the first selected item. { ScopedVariant item; - hr = accessibles->Next(1, item.Receive(), &ignore); + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); EXPECT_EQ(S_OK, hr); ScopedComPtr<IAccessible> accessible; - HRESULT hr = - V_DISPATCH(item.ptr())->QueryInterface(IID_PPV_ARGS(&accessible)); + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); + ScopedBstr name; + EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); + EXPECT_STREQ(L"Name1", name); + } + + // And the second selected element. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); EXPECT_EQ(S_OK, hr); + + ScopedComPtr<IAccessible> accessible; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); ScopedBstr name; EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); EXPECT_STREQ(L"Name2", name); } - // and the second selected element. + // There shouldn't be any more selected. { ScopedVariant item; - hr = accessibles->Next(1, item.Receive(), &ignore); + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); + EXPECT_EQ(S_FALSE, hr); + } +} + +TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionTableNothingSelected) { + Init(Build3X3Table()); + + ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); + + ScopedVariant selection; + EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_EMPTY, selection.type()); +} + +TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionTableRowOneSelected) { + AXTreeUpdate update = Build3X3Table(); + + // 5 == table_row_1 + update.nodes[5].AddState(AX_STATE_SELECTED); + + Init(update); + + ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); + + ScopedVariant selection; + EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_DISPATCH, selection.type()); + ASSERT_NE(nullptr, selection.ptr()); + + ScopedComPtr<IAccessible> row; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(selection.ptr()) + ->QueryInterface(IID_PPV_ARGS(row.GetAddressOf()))); + + ScopedVariant role; + EXPECT_HRESULT_SUCCEEDED(row->get_accRole(SELF, role.Receive())); + EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.ptr())); +} + +TEST_F(AXPlatformNodeWinTest, + TestIAccessibleSelectionTableRowMultipleSelected) { + AXTreeUpdate update = Build3X3Table(); + + // 5 == table_row_1 + // 9 == table_row_2 + update.nodes[5].AddState(AX_STATE_SELECTED); + update.nodes[9].AddState(AX_STATE_SELECTED); + + Init(update); + + ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); + + ScopedVariant selection; + EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_UNKNOWN, selection.type()); + ASSERT_NE(nullptr, selection.ptr()); + + // Loop through the selections and make sure we have the right ones. + ScopedComPtr<IEnumVARIANT> accessibles; + ASSERT_HRESULT_SUCCEEDED( + V_UNKNOWN(selection.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessibles.GetAddressOf()))); + ULONG retrieved_count; + + // Check out the first selected row. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); EXPECT_EQ(S_OK, hr); ScopedComPtr<IAccessible> accessible; - HRESULT hr = - V_DISPATCH(item.ptr())->QueryInterface(IID_PPV_ARGS(&accessible)); + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); + ScopedVariant role; + EXPECT_HRESULT_SUCCEEDED(accessible->get_accRole(SELF, role.Receive())); + EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.ptr())); + } + + // And the second selected element. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); EXPECT_EQ(S_OK, hr); - ScopedBstr name; - EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); - EXPECT_STREQ(L"Name3", name); + + ScopedComPtr<IAccessible> accessible; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); + ScopedVariant role; + EXPECT_HRESULT_SUCCEEDED(accessible->get_accRole(SELF, role.Receive())); + EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.ptr())); } // There shouldn't be any more selected. { ScopedVariant item; - hr = accessibles->Next(1, item.Receive(), &ignore); + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); + EXPECT_EQ(S_FALSE, hr); + } +} + +TEST_F(AXPlatformNodeWinTest, TestIAccessibleSelectionTableCellOneSelected) { + AXTreeUpdate update = Build3X3Table(); + + // 7 == table_cell_1 + update.nodes[7].AddState(AX_STATE_SELECTED); + + Init(update); + + ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); + + ScopedComPtr<IDispatch> row2; + ASSERT_HRESULT_SUCCEEDED( + root_obj->get_accChild(ScopedVariant(2), row2.GetAddressOf())); + ScopedComPtr<IAccessible> row2_accessible; + ASSERT_HRESULT_SUCCEEDED(row2.As(&row2_accessible)); + + ScopedVariant selection; + EXPECT_EQ(S_OK, row2_accessible->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_DISPATCH, selection.type()); + ASSERT_NE(nullptr, selection.ptr()); + + ScopedComPtr<IAccessible> cell; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(selection.ptr()) + ->QueryInterface(IID_PPV_ARGS(cell.GetAddressOf()))); + + ScopedVariant role; + EXPECT_HRESULT_SUCCEEDED(cell->get_accRole(SELF, role.Receive())); + EXPECT_EQ(ROLE_SYSTEM_CELL, V_I4(role.ptr())); + + ScopedBstr name; + EXPECT_EQ(S_OK, cell->get_accName(SELF, name.Receive())); + EXPECT_STREQ(L"1", name); +} + +TEST_F(AXPlatformNodeWinTest, + TestIAccessibleSelectionTableCellMultipleSelected) { + AXTreeUpdate update = Build3X3Table(); + + // 11 == table_cell_3 + // 12 == table_cell_4 + update.nodes[11].AddState(AX_STATE_SELECTED); + update.nodes[12].AddState(AX_STATE_SELECTED); + + Init(update); + + ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); + ASSERT_NE(nullptr, root_obj.Get()); + + ScopedComPtr<IDispatch> row3; + ASSERT_HRESULT_SUCCEEDED( + root_obj->get_accChild(ScopedVariant(3), row3.GetAddressOf())); + ScopedComPtr<IAccessible> row3_accessible; + ASSERT_HRESULT_SUCCEEDED(row3.As(&row3_accessible)); + + ScopedVariant selection; + EXPECT_EQ(S_OK, row3_accessible->get_accSelection(selection.Receive())); + EXPECT_EQ(VT_UNKNOWN, selection.type()); + ASSERT_NE(nullptr, selection.ptr()); + + // Loop through the selections and make sure we have the right ones. + ScopedComPtr<IEnumVARIANT> accessibles; + ASSERT_HRESULT_SUCCEEDED( + V_UNKNOWN(selection.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessibles.GetAddressOf()))); + ULONG retrieved_count; + + // Check out the first selected cell. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); + EXPECT_EQ(S_OK, hr); + + ScopedComPtr<IAccessible> accessible; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); + ScopedBstr name; + EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); + EXPECT_STREQ(L"3", name); + } + + // And the second selected cell. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); + EXPECT_EQ(S_OK, hr); + + ScopedComPtr<IAccessible> accessible; + ASSERT_HRESULT_SUCCEEDED( + V_DISPATCH(item.ptr()) + ->QueryInterface(IID_PPV_ARGS(accessible.GetAddressOf()))); + ScopedBstr name; + EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); + EXPECT_STREQ(L"4", name); + } + + // There shouldn't be any more selected. + { + ScopedVariant item; + HRESULT hr = accessibles->Next(1, item.Receive(), &retrieved_count); EXPECT_EQ(S_FALSE, hr); } }
diff --git a/ui/app_list/app_list_constants.cc b/ui/app_list/app_list_constants.cc index c39cd453..3e13dda 100644 --- a/ui/app_list/app_list_constants.cc +++ b/ui/app_list/app_list_constants.cc
@@ -31,6 +31,8 @@ // The keyboard select color for grid views, which are on top of a black shield // view for new design (12% white). const SkColor kGridSelectedColor = SkColorSetARGB(0x1F, 0xFF, 0xFF, 0xFF); +// Selection color for answer card (3% black). +const SkColor kAnswerCardSelectedColor = SkColorSetARGB(0x08, 0x00, 0x00, 0x00); const SkColor kPagerHoverColor = SkColorSetRGB(0xB4, 0xB4, 0xB4); const SkColor kPagerNormalColor = SkColorSetRGB(0xE2, 0xE2, 0xE2);
diff --git a/ui/app_list/app_list_constants.h b/ui/app_list/app_list_constants.h index 3b8f1ca9..a5edf5f0 100644 --- a/ui/app_list/app_list_constants.h +++ b/ui/app_list/app_list_constants.h
@@ -30,6 +30,7 @@ APP_LIST_EXPORT extern const SkColor kHighlightedColor; APP_LIST_EXPORT extern const SkColor kSelectedColor; APP_LIST_EXPORT extern const SkColor kGridSelectedColor; +APP_LIST_EXPORT extern const SkColor kAnswerCardSelectedColor; APP_LIST_EXPORT extern const SkColor kPagerHoverColor; APP_LIST_EXPORT extern const SkColor kPagerNormalColor;
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc index 3b26f71..05dcecb 100644 --- a/ui/app_list/views/apps_grid_view.cc +++ b/ui/app_list/views/apps_grid_view.cc
@@ -11,6 +11,7 @@ #include "base/guid.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" +#include "base/numerics/ranges.h" #include "build/build_config.h" #include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_features.h" @@ -249,10 +250,6 @@ AppListFolderItem::FOLDER_TYPE_OEM; } -int ClampToRange(int value, int min, int max) { - return std::min(std::max(value, min), max); -} - } // namespace // A layer delegate used for AppsGridView's mask layer, with top and bottom @@ -1719,7 +1716,7 @@ int x_offset = x_offset_direction * (total_tile_size.width() - kFolderDroppingCircleRadius) / 2; int col = (point.x() - bounds.x() + x_offset) / total_tile_size.width(); - col = ClampToRange(col, 0, cols_ - 1); + col = base::ClampToRange(col, 0, cols_ - 1); *drop_target = std::min(Index(pagination_model_.selected_page(), row * cols_ + col), GetLastViewIndex()); @@ -2529,13 +2526,13 @@ const int current_page = pagination_model_.selected_page(); bounds.Inset(0, GetHeightOnTopOfAllAppsTiles(current_page), 0, 0); const gfx::Size total_tile_size = GetTotalTileSize(); - int col = ClampToRange((point.x() - bounds.x()) / total_tile_size.width(), 0, - cols_ - 1); + int col = base::ClampToRange( + (point.x() - bounds.x()) / total_tile_size.width(), 0, cols_ - 1); int row = rows_per_page_; bool show_suggested_apps = is_fullscreen_app_list_enabled_ && current_page == 0; - row = ClampToRange((point.y() - bounds.y()) / total_tile_size.height(), 0, - rows_per_page_ - (show_suggested_apps ? 2 : 1)); + row = base::ClampToRange((point.y() - bounds.y()) / total_tile_size.height(), + 0, rows_per_page_ - (show_suggested_apps ? 2 : 1)); return Index(current_page, row * cols_ + col); }
diff --git a/ui/app_list/views/search_result_answer_card_view.cc b/ui/app_list/views/search_result_answer_card_view.cc index 735af01..4d123cd1 100644 --- a/ui/app_list/views/search_result_answer_card_view.cc +++ b/ui/app_list/views/search_result_answer_card_view.cc
@@ -16,9 +16,11 @@ namespace app_list { namespace { + constexpr int kVerticalPadding = 11; constexpr int kHorizontalPadding = 16; -} + +} // namespace // Container of the search answer view. class SearchResultAnswerCardView::SearchAnswerContainerView @@ -107,7 +109,7 @@ private: void UpdateBackgroundColor() { if (selected_) { - SetBackground(views::CreateSolidBackground(kSelectedColor)); + SetBackground(views::CreateSolidBackground(kAnswerCardSelectedColor)); } else { SetBackground(nullptr); }
diff --git a/ui/app_list/views/search_result_answer_card_view_unittest.cc b/ui/app_list/views/search_result_answer_card_view_unittest.cc index b80fa6c6..f33482b 100644 --- a/ui/app_list/views/search_result_answer_card_view_unittest.cc +++ b/ui/app_list/views/search_result_answer_card_view_unittest.cc
@@ -133,7 +133,7 @@ TEST_F(SearchResultAnswerCardViewTest, ButtonBackground) { views::View* button = result_view()->parent(); - EXPECT_EQ(kSelectedColor, button->background()->get_color()); + EXPECT_EQ(kAnswerCardSelectedColor, button->background()->get_color()); ClearSelectedIndex(); EXPECT_EQ(nullptr, button->background());
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc index b3c6a407..b19174fb 100644 --- a/ui/aura/mus/window_tree_client.cc +++ b/ui/aura/mus/window_tree_client.cc
@@ -62,13 +62,6 @@ #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size.h" -#if defined(HiWord) -#undef HiWord -#endif -#if defined(LoWord) -#undef LoWord -#endif - namespace aura { namespace { @@ -161,7 +154,10 @@ // the EventSink. void DispatchEventToTarget(ui::Event* event, WindowMus* target) { ui::Event::DispatcherApi dispatch_helper(event); - dispatch_helper.set_target(target->GetWindow()); + // Ignore the target for key events. They need to go to the focused window, + // which may have changed by the time we process the event. + if (!event->IsKeyEvent()) + dispatch_helper.set_target(target->GetWindow()); GetWindowTreeHostMus(target)->SendEventToSink(event); } @@ -1391,11 +1387,13 @@ name, transport_data.has_value() ? &transport_data.value() : nullptr); } -void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, - Id window_id, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) { +void WindowTreeClient::OnWindowInputEvent( + uint32_t event_id, + Id window_id, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) { DCHECK(event); WindowMus* window = GetWindowByServerId(window_id); // May be null. @@ -1453,11 +1451,11 @@ static_cast<const base::NativeEvent&>(mapped_event.get())); // MouseEvent(NativeEvent) sets the root_location to location. mapped_event_with_native->set_root_location_f( - mapped_event->AsMouseEvent()->root_location_f()); + event_location_in_screen_pixel_layout); // |mapped_event| is now the NativeEvent. It's expected the location of the // NativeEvent is the same as root_location. mapped_event->AsMouseEvent()->set_location_f( - mapped_event->AsMouseEvent()->root_location_f()); + event_location_in_screen_pixel_layout); event_to_dispatch = mapped_event_with_native.get(); } #endif
diff --git a/ui/aura/mus/window_tree_client.h b/ui/aura/mus/window_tree_client.h index 8081ab51..c0f160a 100644 --- a/ui/aura/mus/window_tree_client.h +++ b/ui/aura/mus/window_tree_client.h
@@ -398,11 +398,13 @@ Id window_id, const std::string& name, const base::Optional<std::vector<uint8_t>>& transport_data) override; - void OnWindowInputEvent(uint32_t event_id, - Id window_id, - int64_t display_id, - std::unique_ptr<ui::Event> event, - bool matches_pointer_watcher) override; + void OnWindowInputEvent( + uint32_t event_id, + Id window_id, + int64_t display_id, + const gfx::PointF& event_location_in_screen_pixel_layout, + std::unique_ptr<ui::Event> event, + bool matches_pointer_watcher) override; void OnPointerEventObserved(std::unique_ptr<ui::Event> event, uint32_t window_id, int64_t display_id) override;
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc index 8990a2bf..842150f0 100644 --- a/ui/aura/mus/window_tree_client_unittest.cc +++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -100,6 +100,26 @@ return mojo::ConvertTo<std::vector<uint8_t>>(value); } +WindowTreeHostMusInitParams CreateWindowTreeHostMusInitParams( + WindowTreeClient* window_tree_client, + const gfx::Rect& bounds, + int64_t display_id) { + std::unique_ptr<DisplayInitParams> display_params = + base::MakeUnique<DisplayInitParams>(); + display_params->display = base::MakeUnique<display::Display>(display_id); + display_params->display->set_bounds(bounds); + display_params->viewport_metrics.bounds_in_pixels = bounds; + display_params->viewport_metrics.device_scale_factor = 1.0f; + display_params->viewport_metrics.ui_scale_factor = 1.0f; + WindowTreeHostMusInitParams init_params = + WindowTreeClientPrivate(window_tree_client) + .CallCreateInitParamsForNewDisplay(); + init_params.use_classic_ime = true; + init_params.display_id = display_params->display->id(); + init_params.display_init_params = std::move(display_params); + return init_params; +} + } // namespace using WindowTreeClientWmTest = test::AuraMusWmTestBase; @@ -874,7 +894,8 @@ gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location_in_child), ui::Event::Clone(*ui_event.get()), + 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -907,9 +928,9 @@ ui::ET_POINTER_MOVED, event_location, gfx::Point(), ui::EF_NONE, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, 0), base::TimeTicks()); - window_tree_client()->OnWindowInputEvent(event_id, server_id(&child), - window_tree_host.display_id(), - ui::Event::Clone(pointer_event), 0); + window_tree_client()->OnWindowInputEvent( + event_id, server_id(&child), window_tree_host.display_id(), + gfx::PointF(event_location), ui::Event::Clone(pointer_event), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -955,7 +976,7 @@ ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child1), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -976,7 +997,7 @@ ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child1), window_tree_host.display_id(), - ui::Event::Clone(*ui_event1.get()), 0); + gfx::PointF(event_location), ui::Event::Clone(*ui_event1.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1024,7 +1045,7 @@ ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child1), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1041,7 +1062,7 @@ window_delegate2.set_event_id(event_id); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child2), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1094,7 +1115,7 @@ ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(child1.get()), window_tree_host->display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(root_location), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1117,7 +1138,7 @@ window_delegate2->set_event_id(event_id); window_tree_client()->OnWindowInputEvent( event_id, server_id(child1.get()), window_tree_host->display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(root_location), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1164,7 +1185,7 @@ gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(top_level), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(), ui::Event::Clone(*ui_event.get()), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, @@ -1208,7 +1229,7 @@ ui::EventTimeForNow()); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child), window_tree_host.display_id(), - ui::Event::Clone(pointer_event_down), 0); + gfx::PointF(event_location), ui::Event::Clone(pointer_event_down), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -1228,7 +1249,7 @@ ui::EventTimeForNow()); window_tree_client()->OnWindowInputEvent( event_id, kInvalidServerId, window_tree_host.display_id(), - ui::Event::Clone(pointer_event_up), 0); + gfx::PointF(event_location), ui::Event::Clone(pointer_event_up), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); // WindowTreeClient::OnWindowInputEvent cannot find a target window with // kInvalidServerId but should use the event to update event states kept in @@ -1270,7 +1291,7 @@ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0), ui::EventTimeForNow()); window_tree_client()->OnWindowInputEvent( - event_id, server_id(&child), window_tree_host.display_id(), + event_id, server_id(&child), window_tree_host.display_id(), gfx::PointF(), ui::Event::Clone(pointer_event_down), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, @@ -1286,7 +1307,7 @@ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0), ui::EventTimeForNow()); window_tree_client()->OnWindowInputEvent( - event_id, kInvalidServerId, window_tree_host.display_id(), + event_id, kInvalidServerId, window_tree_host.display_id(), gfx::PointF(), ui::Event::Clone(pointer_event_up), 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); // WindowTreeClient::OnWindowInputEvent cannot find a target window with @@ -1383,6 +1404,7 @@ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1), base::TimeTicks::Now())); window_tree_client()->OnWindowInputEvent(1, server_id(top_level), 0, + gfx::PointF(), std::move(pointer_event_down), true); // Delegate sensed the event. @@ -2362,6 +2384,44 @@ EXPECT_EQ(gfx::Rect(bounds.size()), window_tree_host.window()->bounds()); } +TEST_F(WindowTreeClientWmTest, FocusInDifferentDisplayThanEvent) { + constexpr int64_t kDisplayId1 = 201; + WindowTreeHostMusInitParams init_params1 = CreateWindowTreeHostMusInitParams( + window_tree_client_impl(), gfx::Rect(1, 2, 101, 102), kDisplayId1); + WindowTreeHostMus window_tree_host1(std::move(init_params1)); + window_tree_host1.InitHost(); + window_tree_host1.Show(); + client::SetFocusClient(window_tree_host1.window(), focus_client()); + + constexpr int64_t kDisplayId2 = 202; + WindowTreeHostMusInitParams init_params2 = CreateWindowTreeHostMusInitParams( + window_tree_client_impl(), gfx::Rect(501, 2, 101, 102), kDisplayId2); + WindowTreeHostMus window_tree_host2(std::move(init_params2)); + window_tree_host2.InitHost(); + window_tree_host2.Show(); + client::SetFocusClient(window_tree_host2.window(), focus_client()); + + aura::Window child1(nullptr); + child1.Init(ui::LAYER_NOT_DRAWN); + child1.Show(); + window_tree_host1.window()->AddChild(&child1); + child1.Focus(); + + aura::Window child2(nullptr); + child2.Init(ui::LAYER_NOT_DRAWN); + child2.Show(); + child2.SetEventTargeter(base::MakeUnique<WindowTargeter>()); + window_tree_host2.window()->AddChild(&child2); + + EXPECT_TRUE(child1.HasFocus()); + + std::unique_ptr<ui::KeyEvent> key_event = base::MakeUnique<ui::KeyEvent>( + ui::ET_KEY_PRESSED, ui::VKEY_ESCAPE, ui::EF_NONE); + window_tree_client()->OnWindowInputEvent(1, server_id(&child2), kDisplayId2, + gfx::PointF(), std::move(key_event), + false); +} + TEST_F(WindowTreeClientWmTestHighDPI, BoundsChangeWhenAdded) { const gfx::Rect bounds(1, 2, 101, 102); std::unique_ptr<DisplayInitParams> display_params = @@ -2529,7 +2589,8 @@ ui::EventTimeForNow(), ui::EF_NONE, 0)); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child1), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location_in_pixels), ui::Event::Clone(*ui_event.get()), + 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id)); @@ -2553,7 +2614,8 @@ window_delegate2.set_event_id(event_id); window_tree_client()->OnWindowInputEvent( event_id, server_id(&child2), window_tree_host.display_id(), - ui::Event::Clone(*ui_event.get()), 0); + gfx::PointF(event_location_in_pixels), ui::Event::Clone(*ui_event.get()), + 0); EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); EXPECT_EQ(ui::mojom::EventResult::HANDLED, window_tree()->GetEventResult(event_id));
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h index 7835a515..1fcc13c 100644 --- a/ui/aura/test/aura_test_base.h +++ b/ui/aura/test/aura_test_base.h
@@ -29,6 +29,10 @@ class WindowManagerDelegate; class WindowTreeClientDelegate; +namespace client { +class FocusClient; +} + namespace test { enum class BackendType { CLASSIC, MUS }; @@ -85,6 +89,7 @@ WindowTreeHost* host() { return helper_->host(); } ui::EventSink* event_sink() { return helper_->event_sink(); } TestScreen* test_screen() { return helper_->test_screen(); } + client::FocusClient* focus_client() { return helper_->focus_client(); } TestWindowTree* window_tree() { return helper_->window_tree(); } WindowTreeClient* window_tree_client_impl() {
diff --git a/ui/aura/test/mus/window_tree_client_private.cc b/ui/aura/test/mus/window_tree_client_private.cc index 6eae502d..bb0daf84 100644 --- a/ui/aura/test/mus/window_tree_client_private.cc +++ b/ui/aura/test/mus/window_tree_client_private.cc
@@ -58,9 +58,13 @@ const uint32_t event_id = 0u; const uint32_t observer_id = 0u; const int64_t display_id = 0; + gfx::PointF event_location_in_screen_pixel_layout; + if (event->IsLocatedEvent()) + event_location_in_screen_pixel_layout = + event->AsLocatedEvent()->root_location_f(); tree_client_impl_->OnWindowInputEvent( event_id, WindowPortMus::Get(window)->server_id(), display_id, - std::move(event), observer_id); + event_location_in_screen_pixel_layout, std::move(event), observer_id); } void WindowTreeClientPrivate::CallOnPointerEventObserved(
diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index e30f72c..e1aeec5c 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h
@@ -84,7 +84,7 @@ virtual gfx::Transform GetInverseRootTransform() const; // These functions are used in event translation for translating the local - // coordinates of LocatedEvents. Default implementation calls to non-event + // coordinates of LocatedEvents. Default implementation calls to non-local // ones (e.g. GetRootTransform()). virtual gfx::Transform GetRootTransformForLocalEventCoordinates() const; virtual gfx::Transform GetInverseRootTransformForLocalEventCoordinates()
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index 776e241..a3695832 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -341,10 +341,6 @@ "clipboard/scoped_clipboard_writer.h", "cursor/cursor_util.cc", "cursor/cursor_util.h", - "cursor/cursors_aura.cc", - "cursor/cursors_aura.h", - "cursor/image_cursors.cc", - "cursor/image_cursors.h", "default_theme_provider.cc", "default_theme_provider.h", "dragdrop/cocoa_dnd_util.h", @@ -551,11 +547,6 @@ if (is_mac) { deps += [ "//third_party/mozilla" ] - sources -= [ - "cursor/image_cursors.cc", - "cursor/image_cursors.h", - ] - libs += [ "Accelerate.framework", "AppKit.framework", @@ -567,11 +558,6 @@ ] } - if (use_aura) { - if (is_android) { - sources += [ "cursor/cursor_loader_android.cc" ] - } - } if (use_ozone) { sources += [ "cursor/cursor_loader_ozone.cc", @@ -609,30 +595,29 @@ if (is_android) { deps += [ ":ui_base_jni_headers" ] - libs += [ "jnigraphics" ] + + if (use_aura) { + sources += [ "cursor/cursor_loader_android.cc" ] + } else { + sources -= [ + "cursor/cursor_android.cc", + "default_theme_provider.cc", + "idle/idle.cc", + "idle/idle.h", + "idle/idle_android.cc", + "l10n/l10n_font_util.cc", + "models/button_menu_item_model.cc", + "models/dialog_model.cc", + "theme_provider.cc", + "touch/touch_editing_controller.cc", + "ui_base_types.cc", + ] + } } - if (is_android && !use_aura) { - sources -= [ - "cursor/cursor_android.cc", - "cursor/image_cursors.cc", - "cursor/image_cursors.h", - "default_theme_provider.cc", - "idle/idle.cc", - "idle/idle.h", - "idle/idle_android.cc", - "l10n/l10n_font_util.cc", - "models/button_menu_item_model.cc", - "models/dialog_model.cc", - "theme_provider.cc", - "touch/touch_editing_controller.cc", - "ui_base_types.cc", - ] - } - - # Aura clipboard. if (use_aura) { + # Aura clipboard. if (use_x11 && is_desktop_linux) { sources += [ "clipboard/clipboard_aurax11.cc", @@ -645,6 +630,14 @@ "clipboard/clipboard_aura.h", ] } + + # Cursor + sources += [ + "cursor/cursors_aura.cc", + "cursor/cursors_aura.h", + "cursor/image_cursors.cc", + "cursor/image_cursors.h", + ] } if (is_android || is_ios) {
diff --git a/ui/base/ime/ime_text_span.h b/ui/base/ime/ime_text_span.h index 36b77f7..eee554f4 100644 --- a/ui/base/ime/ime_text_span.h +++ b/ui/base/ime/ime_text_span.h
@@ -25,6 +25,10 @@ // Creates a suggestion marker that isn't cleared after the user picks a // replacement. kSuggestion, + // Creates a suggestion marker that is cleared after the user picks a + // replacement, and will be ignored if added to an element with spell + // checking disabled. + kMisspellingSuggestion, }; // The default constructor is used by generated Mojo code.
diff --git a/ui/compositor/debug_utils.cc b/ui/compositor/debug_utils.cc index 75f3457..d1d998b 100644 --- a/ui/compositor/debug_utils.cc +++ b/ui/compositor/debug_utils.cc
@@ -2,18 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. - #include "ui/compositor/debug_utils.h" #include <stddef.h> -#include <cmath> #include <iomanip> #include <ostream> #include <string> #include "base/logging.h" +#include "base/numerics/math_constants.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_conversions.h" @@ -92,7 +90,7 @@ *out << '\n' << property_indent_str; *out << "rotation: "; - *out << std::acos(decomp.quaternion.w()) * 360.0 / M_PI; + *out << std::acos(decomp.quaternion.w()) * 360.0 / base::kPiDouble; *out << '\n' << property_indent_str; *out << "scale: " << decomp.scale[0];
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc index 1d2b0d9..b1ef399 100644 --- a/ui/events/blink/input_handler_proxy.cc +++ b/ui/events/blink/input_handler_proxy.cc
@@ -1584,7 +1584,26 @@ return true; case DROP_EVENT: break; - case DID_NOT_HANDLE: + case DID_NOT_HANDLE: { + if (touchpad_and_wheel_scroll_latching_enabled_) { + // Send a GSB to the main thread before transfering the curve. This + // may cause scrolling a different target which will be a non-issue + // once fling is handled on browser side. https://crbug.com/249063 + WebGestureEvent synthetic_begin(WebInputEvent::kGestureScrollBegin, + fling_parameters_.modifiers, + InSecondsF(base::TimeTicks::Now())); + synthetic_begin.x = fling_parameters_.point.x; + synthetic_begin.y = fling_parameters_.point.y; + synthetic_begin.global_x = fling_parameters_.global_point.x; + synthetic_begin.global_y = fling_parameters_.global_point.y; + synthetic_begin.source_device = blink::kWebGestureDeviceTouchpad; + synthetic_begin.data.scroll_begin.delta_x_hint = + fling_parameters_.delta.x; + synthetic_begin.data.scroll_begin.delta_y_hint = + fling_parameters_.delta.y; + client_->DispatchNonBlockingEventToMainThread( + ui::WebInputEventTraits::Clone(synthetic_begin), ui::LatencyInfo()); + } TRACE_EVENT_INSTANT0("input", "InputHandlerProxy::scrollBy::AbortFling", TRACE_EVENT_SCOPE_THREAD); @@ -1598,6 +1617,7 @@ fling_may_be_active_on_main_thread_ = true; CancelCurrentFlingWithoutNotifyingClient(); break; + } case DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING: case DID_HANDLE_SHOULD_BUBBLE: NOTREACHED();
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc index 8ccb5e5..16e3cbb7 100644 --- a/ui/events/blink/input_handler_proxy_unittest.cc +++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -1372,6 +1372,9 @@ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread()) .WillOnce(testing::Return(true)); + // A GSB is sent to the main thread before transfering the fling. + EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_(testing::_)) + .Times(1); } // Expected wheel fling animation parameters: // *) fling_delta and fling_point should match the original GestureFlingStart @@ -1609,6 +1612,9 @@ .WillOnce(testing::Return(scroll_result_did_not_scroll_)); EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread()) .WillOnce(testing::Return(true)); + // A GSB is sent to the main thread before transfering the fling. + EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_(testing::_)) + .Times(1); } // Expected wheel fling animation parameters: @@ -1735,6 +1741,9 @@ .WillOnce(testing::Return(scroll_result_did_not_scroll_)); EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread()) .WillOnce(testing::Return(true)); + // A GSB is sent to the main thread before transfering the fling. + EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_(testing::_)) + .Times(1); } // We should get parameters from the second fling, nothing from the first
diff --git a/ui/events/gesture_detection/motion_event_generic.cc b/ui/events/gesture_detection/motion_event_generic.cc index 35a5b88..cc7b0b8 100644 --- a/ui/events/gesture_detection/motion_event_generic.cc +++ b/ui/events/gesture_detection/motion_event_generic.cc
@@ -2,16 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "ui/events/gesture_detection/motion_event_generic.h" -#include <cmath> #include <utility> #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/numerics/math_constants.h" #include "ui/events/base_event_utils.h" namespace ui { @@ -57,16 +54,16 @@ float radius_y, float rotation_angle_degree) { DCHECK(!touch_major && !touch_minor && !orientation); - float rotation_angle_rad = rotation_angle_degree * M_PI / 180.f; + float rotation_angle_rad = rotation_angle_degree * base::kPiFloat / 180.f; DCHECK_GE(radius_x, 0) << "Unexpected x-radius < 0 (" << radius_x << ")"; DCHECK_GE(radius_y, 0) << "Unexpected y-radius < 0 (" << radius_y << ")"; - DCHECK(0 <= rotation_angle_rad && rotation_angle_rad < M_PI) + DCHECK(0 <= rotation_angle_rad && rotation_angle_rad < base::kPiFloat) << "Unexpected touch rotation angle " << rotation_angle_rad << " rad"; // Make the angle acute to ease subsequent logic. The angle range effectively // changes from [0, pi) to [0, pi/2). - if (rotation_angle_rad >= M_PI_2) { - rotation_angle_rad -= static_cast<float>(M_PI_2); + if (rotation_angle_rad >= base::kPiFloat / 2) { + rotation_angle_rad -= base::kPiFloat / 2; std::swap(radius_x, radius_y); } @@ -76,7 +73,7 @@ // cases but always seem to be set to zero) unchanged. touch_major = 2.f * radius_x; touch_minor = 2.f * radius_y; - orientation = rotation_angle_rad - M_PI_2; + orientation = rotation_angle_rad - base::kPiFloat / 2; } else { touch_major = 2.f * radius_y; touch_minor = 2.f * radius_x;
diff --git a/ui/events/gesture_detection/motion_event_generic_unittest.cc b/ui/events/gesture_detection/motion_event_generic_unittest.cc index d60c528b..0f5b2c5e 100644 --- a/ui/events/gesture_detection/motion_event_generic_unittest.cc +++ b/ui/events/gesture_detection/motion_event_generic_unittest.cc
@@ -2,14 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// MSVC++ requires this to be set before any other includes to get M_PI. -#define _USE_MATH_DEFINES - #include "ui/events/gesture_detection/motion_event_generic.h" -#include <cmath> #include <utility> +#include "base/numerics/math_constants.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/event_constants.h" #include "ui/events/test/motion_event_test_utils.h" @@ -193,7 +190,7 @@ properties.SetAxesAndOrientation(radius_x, radius_y, rotation_angle_deg); EXPECT_EQ(20, properties.touch_major); EXPECT_EQ(10, properties.touch_minor); - EXPECT_NEAR(-M_PI_2, properties.orientation, 0.001); + EXPECT_NEAR(-base::kPiDouble / 2, properties.orientation, 0.001); } { PointerProperties properties; @@ -213,7 +210,7 @@ properties.SetAxesAndOrientation(radius_x, radius_y, rotation_angle_deg); EXPECT_EQ(20, properties.touch_major); EXPECT_EQ(10, properties.touch_minor); - EXPECT_NEAR(M_PI_2, properties.orientation, 0.001); + EXPECT_NEAR(base::kPiDouble / 2, properties.orientation, 0.001); } { PointerProperties properties;
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js index 596bcda..105917f0 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js
@@ -38,8 +38,27 @@ }; /** - * Handles change event to update isCheckSelectMode_ BEFORE the change event is - * dispatched to other listeners. + * @override + * Changes to single-select mode if all selected files get deleted. + */ +FileListSelectionModel.prototype.adjustToReordering = function(permutation) { + // Look at the old state. + var oldSelectedItemsCount = this.selectedIndexes.length; + var oldLeadIndex = this.leadIndex; + var newSelectedItemsCount = + this.selectedIndexes.filter(i => permutation[i] != -1).length; + // Call the superclass function. + cr.ui.ListSelectionModel.prototype.adjustToReordering.call(this, permutation); + // Leave check-select mode if all items have been deleted. + if (oldSelectedItemsCount && !newSelectedItemsCount && this.length_ && + oldLeadIndex != -1) { + this.isCheckSelectMode_ = false; + } +}; + +/** + * Handles change event to update isCheckSelectMode_ BEFORE the change event + * is dispatched to other listeners. * @param {!Event} event Event object of 'change' event. * @private */
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.html b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.html new file mode 100644 index 0000000..0f34787 --- /dev/null +++ b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<!-- 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. + --> + +<html> +<body> + <script src="../../../../../../ui/webui/resources/js/cr.js"></script> + <script src="../../../../../../ui/webui/resources/js/cr/event_target.js"></script> + <script src="../../../../../../ui/webui/resources/js/cr/ui.js"></script> + <script src="../../../../../../ui/webui/resources/js/cr/ui/list_selection_model.js"></script> + <script src="../../../../../../ui/webui/resources/js/cr/ui/list_single_selection_model.js"></script> + + <script src="file_list_selection_model.js"></script> + <script src="file_list_selection_model_unittest.js"></script> +</body> +</html>
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.js b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.js new file mode 100644 index 0000000..185ac0e --- /dev/null +++ b/ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model_unittest.js
@@ -0,0 +1,34 @@ +// 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. + +/** @type {!FileListSelectionModel} */ +var selection_model; + +function setUp() { + selection_model = new FileListSelectionModel(); +} + +// Verify that all selection and focus is dropped if all selected files get +// deleted. +function testAdjustToReorderingAllAreDeleted() { + // Set initial selection. + selection_model.selectedIndexes = [0, 1]; + // Delete the selected items. + selection_model.adjustToReordering([-1, -1, 0]); + // Assert nothing is selected or in focus. + assertArrayEquals([], selection_model.selectedIndexes); + assertFalse(selection_model.getCheckSelectMode()); +} + +// Verify that all selection and focus is dropped only if all selected files get +// deleted. +function testAdjustToReorderingSomeAreDeleted() { + // Set initial selection. + selection_model.selectedIndexes = [0, 1]; + // Delete the selected items. + selection_model.adjustToReordering([-1, 0, 1]); + // Assert selection is not dropped. + assertArrayEquals([0], selection_model.selectedIndexes); + assertTrue(selection_model.getCheckSelectMode()); +}
diff --git a/ui/gfx/geometry/matrix3_f.cc b/ui/gfx/geometry/matrix3_f.cc index d727ef0..00ef913 100644 --- a/ui/gfx/geometry/matrix3_f.cc +++ b/ui/gfx/geometry/matrix3_f.cc
@@ -8,9 +8,7 @@ #include <cmath> #include <limits> -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include "base/numerics/math_constants.h" namespace { @@ -171,13 +169,13 @@ // half_det_b should be in <-1, 1>, but beware of rounding error. double phi = 0.0f; if (half_det_b <= -1.0) - phi = M_PI / 3; + phi = base::kPiDouble / 3; else if (half_det_b < 1.0) phi = acos(half_det_b) / 3; eigenvalues[0] = q + 2 * p * static_cast<float>(cos(phi)); - eigenvalues[2] = q + 2 * p * - static_cast<float>(cos(phi + 2.0 * M_PI / 3.0)); + eigenvalues[2] = + q + 2 * p * static_cast<float>(cos(phi + 2.0 * base::kPiDouble / 3.0)); eigenvalues[1] = 3 * q - eigenvalues[0] - eigenvalues[2]; }
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index c3cf898..16a629b0 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc
@@ -13,12 +13,12 @@ #include "base/i18n/break_iterator.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/numerics/ranges.h" #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" -#include "cc/base/math_util.h" #include "cc/paint/paint_canvas.h" #include "cc/paint/paint_shader.h" #include "third_party/icu/source/common/unicode/rbbi.h" @@ -1457,7 +1457,7 @@ guess = lo + static_cast<size_t>(ToRoundedInt((available_width - lo_width) * (hi - lo) / (hi_width - lo_width))); - guess = cc::MathUtil::ClampToRange(guess, lo, hi); + guess = base::ClampToRange(guess, lo, hi); DCHECK_NE(last_guess, guess); // Restore colors. They will be truncated to size by SetText.
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h index 0964f74..0ee622e 100644 --- a/ui/gfx/transform.h +++ b/ui/gfx/transform.h
@@ -122,6 +122,7 @@ void ConcatTransform(const Transform& transform); // Returns true if this is the identity matrix. + // This function modifies a mutable variable in |matrix_|. bool IsIdentity() const { return matrix_.isIdentity(); } // Returns true if the matrix is either identity or pure translation.
diff --git a/ui/ozone/demo/renderer_base.cc b/ui/ozone/demo/renderer_base.cc index 85033c7..577176b 100644 --- a/ui/ozone/demo/renderer_base.cc +++ b/ui/ozone/demo/renderer_base.cc
@@ -4,7 +4,7 @@ #include "ui/ozone/demo/renderer_base.h" -#include <cmath> +#include "base/numerics/math_constants.h" namespace ui { @@ -20,7 +20,8 @@ } float RendererBase::NextFraction() { - float fraction = (sinf(iteration_ * 2 * M_PI / kAnimationSteps) + 1) / 2; + float fraction = + (sinf(iteration_ * 2 * base::kPiFloat / kAnimationSteps) + 1) / 2; iteration_++; iteration_ %= kAnimationSteps;
diff --git a/ui/ozone/platform/cast/BUILD.gn b/ui/ozone/platform/cast/BUILD.gn index fd92abf..3e8234e 100644 --- a/ui/ozone/platform/cast/BUILD.gn +++ b/ui/ozone/platform/cast/BUILD.gn
@@ -43,6 +43,7 @@ "//chromecast:chromecast_features", "//chromecast/base:base", "//chromecast/graphics:libcast_graphics_1.0", + "//ui/display/manager:manager", "//ui/events/ozone:events_ozone", "//ui/events/ozone:events_ozone_evdev", "//ui/events/ozone:events_ozone_layout",
diff --git a/ui/ozone/platform/cast/ozone_platform_cast.cc b/ui/ozone/platform/cast/ozone_platform_cast.cc index 5fe2b53..97f2e6fd 100644 --- a/ui/ozone/platform/cast/ozone_platform_cast.cc +++ b/ui/ozone/platform/cast/ozone_platform_cast.cc
@@ -13,6 +13,7 @@ #include "chromecast/chromecast_features.h" #include "chromecast/public/cast_egl_platform.h" #include "chromecast/public/cast_egl_platform_shlib.h" +#include "ui/display/manager/fake_display_delegate.h" #include "ui/display/types/native_display_delegate.h" #include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/evdev/event_factory_evdev.h" @@ -98,8 +99,7 @@ } std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() override { - NOTREACHED(); - return nullptr; + return base::MakeUnique<display::FakeDisplayDelegate>(); } void InitializeUI(const InitParams& params) override {
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index 54eff09..babf43f72 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<grit latest_public_release="0" current_release="1"> +<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> <outputs> <output filename="grit/ui_resources.h" type="rc_header" context="default_100_percent"> <emit emit_type='prepend'></emit> @@ -15,7 +15,8 @@ <!-- KEEP THESE IN ALPHABETICAL ORDER! DO NOT ADD TO RANDOM PLACES JUST BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE SAME CONDITIONALS. --> - <if expr="is_linux and use_aura"> + <if expr="use_aura"> + <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ALIAS" file="common/pointers/alias.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_ALIAS" file="common/pointers/alias_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_CELL" file="common/pointers/cell_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_COL_RESIZE" file="common/pointers/sb_h_double_arrow_big.png" /> @@ -24,6 +25,8 @@ <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_CROSSHAIR" file="common/pointers/crosshair_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_EAST_RESIZE" file="common/pointers/sb_h_double_arrow_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_EAST_WEST_RESIZE" file="common/pointers/sb_h_double_arrow_big.png" /> + <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_GRAB" file="common/pointers/fleur_big.png" /> + <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_GRABBING" file="common/pointers/hand3_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_HAND" file="common/pointers/hand2_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_HELP" file="common/pointers/help_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_IBEAM" file="common/pointers/xterm_big.png" /> @@ -44,9 +47,6 @@ <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_XTERM_HORIZ" file="common/pointers/xterm_horiz_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_ZOOM_IN" file="common/pointers/zoom_in_big.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_ZOOM_OUT" file="common/pointers/zoom_out_big.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_GRAB" file="common/pointers/fleur_big.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_BIG_GRABBING" file="common/pointers/hand3_big.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ALIAS" file="common/pointers/alias.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_CELL" file="common/pointers/cell.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_COL_RESIZE" file="common/pointers/sb_h_double_arrow.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_CONTEXT_MENU" file="common/pointers/context_menu.png" /> @@ -54,6 +54,8 @@ <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_CROSSHAIR" file="common/pointers/crosshair.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_EAST_RESIZE" file="common/pointers/sb_h_double_arrow.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_EAST_WEST_RESIZE" file="common/pointers/sb_h_double_arrow.png" /> + <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRAB" file="common/pointers/fleur.png" /> + <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRABBING" file="common/pointers/hand3.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_HAND" file="common/pointers/hand2.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_HELP" file="common/pointers/help.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_IBEAM" file="common/pointers/xterm.png" /> @@ -75,8 +77,6 @@ <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_XTERM_HORIZ" file="common/pointers/xterm_horiz.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ZOOM_IN" file="common/pointers/zoom_in.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ZOOM_OUT" file="common/pointers/zoom_out.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRAB" file="common/pointers/fleur.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRABBING" file="common/pointers/hand3.png" /> </if> <structure type="chrome_scaled_image" name="IDR_CLOSE_2" file="close_2.png" /> <structure type="chrome_scaled_image" name="IDR_CLOSE_2_H" file="close_2_hover.png" />
diff --git a/ui/views/resources/views_resources.grd b/ui/views/resources/views_resources.grd index a2bd7584..112662e 100644 --- a/ui/views/resources/views_resources.grd +++ b/ui/views/resources/views_resources.grd
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<grit latest_public_release="0" current_release="1"> +<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> <outputs> <output filename="grit/views_resources.h" type="rc_header" context="default_100_percent"> <emit emit_type='prepend'></emit>
diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index 4192b0e..9ddadf6 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -70,6 +70,10 @@ } int GetDialogButtons() const override { return dialog_buttons_; } + int GetDefaultDialogButton() const override { + return default_button_.value_or( + DialogDelegateView::GetDefaultDialogButton()); + } base::string16 GetDialogButtonLabel(ui::DialogButton button) const override { return button == ui::DIALOG_BUTTON_CANCEL && !cancel_label_.empty() ? cancel_label_ @@ -139,6 +143,8 @@ cancel_label_ = base::ASCIIToUTF16("Cancel Cancel Cancel"); } + void set_default_button(int button) { default_button_ = button; } + DialogClientView* client_view() { return client_view_; } Widget* widget() { return widget_; } @@ -163,6 +169,7 @@ gfx::Size max_size_; base::string16 cancel_label_; // If set, the label for the Cancel button. + base::Optional<int> default_button_; DISALLOW_COPY_AND_ASSIGN(DialogClientViewTest); }; @@ -369,6 +376,10 @@ layout_provider.SetDistanceMetric(DISTANCE_BUTTON_MAX_LINKABLE_WIDTH, 200); SetLongCancelLabel(); + // Ensure there is no default button since getting a bold font can throw off + // the cached sizes. + set_default_button(ui::DIALOG_BUTTON_NONE); + SetDialogButtons(ui::DIALOG_BUTTON_OK); CheckContentsIsSetToPreferredSize(); const int ok_button_only_width = client_view()->ok_button()->width(); @@ -385,6 +396,9 @@ SetDialogButtons(ui::DIALOG_BUTTON_CANCEL | ui::DIALOG_BUTTON_OK); CheckContentsIsSetToPreferredSize(); + // Cancel button shouldn't have changed widths. + EXPECT_EQ(cancel_button_width, client_view()->cancel_button()->width()); + // OK button should now match the bigger, cancel button. EXPECT_EQ(cancel_button_width, client_view()->ok_button()->width());
diff --git a/ui/webui/resources/cr_elements/cr_link_row/cr_link_row.html b/ui/webui/resources/cr_elements/cr_link_row/cr_link_row.html index 42645cc..cd500610 100644 --- a/ui/webui/resources/cr_elements/cr_link_row/cr_link_row.html +++ b/ui/webui/resources/cr_elements/cr_link_row/cr_link_row.html
@@ -15,6 +15,7 @@ border: none; color: inherit; cursor: pointer; + font-size: 100%; /* Specifically for Mac OSX, harmless elsewhere. */ line-height: 154%; /* 20px. */ margin: 0; outline: none;
diff --git a/ui/webui/resources/cr_elements/paper_input_style_css.html b/ui/webui/resources/cr_elements/paper_input_style_css.html new file mode 100644 index 0000000..175aa8b6 --- /dev/null +++ b/ui/webui/resources/cr_elements/paper_input_style_css.html
@@ -0,0 +1,42 @@ +<link rel="import" href="chrome://resources/html/polymer.html"> + +<!-- Common paper-checkbox styling for Material Design WebUI. --> +<dom-module id="paper-input-style"> + <template> + <style> + :root { + --paper-input-container-focus-color: var(--google-blue-500); + --paper-input-container-input: { + color: inherit; + font-size: inherit; + font-weight: inherit; + line-height: 1.54; + vertical-align: baseline; + }; + --paper-input-container-label: { + font-size: inherit; + line-height: 1.54; + }; + --paper-input-container-label-floating: { + /* Using "rem" to make it easier to equalize with other labels. */ + font-size: 1rem; + line-height: 1.65rem; + }; + --paper-input-error: { + font-size: 92.31%; /* Should be 12px when 100% is 13px. */ + line-height: 1.54; + overflow: visible; /* Half-visible error message is not useful at all. */ + }; + --paper-input-max-width: 264px; + --paper-input-container-underline: { + border-color: var(--paper-grey-300); + }; + } + + paper-input { + /* Fix issue with focus animation making labels wiggle. */ + transform: translate3d(0, 0, 0); + } + </style> + </template> +</dom-module>
diff --git a/ui/webui/resources/cr_elements_resources.grdp b/ui/webui/resources/cr_elements_resources.grdp index d7f4a17..8dbd839 100644 --- a/ui/webui/resources/cr_elements_resources.grdp +++ b/ui/webui/resources/cr_elements_resources.grdp
@@ -191,6 +191,9 @@ <structure name="IDR_CR_ELEMENTS_PAPER_CHECKBOX_STYLE_CSS_HTML" file="../../webui/resources/cr_elements/paper_checkbox_style_css.html" type="chrome_html" /> + <structure name="IDR_CR_ELEMENTS_PAPER_INPUT_STYLE_CSS_HTML" + file="../../webui/resources/cr_elements/paper_input_style_css.html" + type="chrome_html" /> <structure name="IDR_CR_ELEMENTS_PAPER_TOGGLE_STYLE_CSS_HTML" file="../../webui/resources/cr_elements/paper_toggle_style_css.html" type="chrome_html" />