diff --git a/DEPS b/DEPS index 30f50f7..893522fc 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,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': '8b8c76506a9a3b07246e6c2770e35dfc413da97a', + 'skia_revision': '1df161ab8a6aac3ca528fd5ffdecd08438889d97', # 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': '1ab705a20be45dadd4687b494328f4f745e9bf50', + 'v8_revision': 'a491782773bf57d1b573f4ce87c5b039df0fb813', # 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. @@ -64,7 +64,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': 'ac2e04797b258115b2dc768a56377d7e78038f42', + 'pdfium_revision': '687a79c5ce07bc338192f19d8452edefaf27dd76', # 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. @@ -72,7 +72,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. - 'boringssl_revision': '3f2611a98fce5c84e5e01408d2b8e18316143e84', + 'boringssl_revision': 'dc8c1d962e688c01cd8903d40ada70a75f700ad7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -96,7 +96,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': '5a31d0e078e186c1a1dda91ff452c13023ab7c41', + 'catapult_revision': 'f25bfea25223277cb04abf0eef039f35f280c987', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/android_webview/browser/aw_contents_client_bridge_base.h b/android_webview/browser/aw_contents_client_bridge_base.h index 3a60dbc..6eeef82 100644 --- a/android_webview/browser/aw_contents_client_bridge_base.h +++ b/android_webview/browser/aw_contents_client_bridge_base.h
@@ -60,12 +60,12 @@ std::unique_ptr<content::ClientCertificateDelegate> delegate) = 0; virtual void RunJavaScriptDialog( - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const GURL& origin_url, const base::string16& message_text, const base::string16& default_prompt_text, - const content::JavaScriptDialogManager::DialogClosedCallback& callback) - = 0; + const content::JavaScriptDialogManager::DialogClosedCallback& + callback) = 0; virtual void RunBeforeUnloadDialog( const GURL& origin_url,
diff --git a/android_webview/browser/aw_javascript_dialog_manager.cc b/android_webview/browser/aw_javascript_dialog_manager.cc index 7e06ff4..6b53386 100644 --- a/android_webview/browser/aw_javascript_dialog_manager.cc +++ b/android_webview/browser/aw_javascript_dialog_manager.cc
@@ -17,7 +17,7 @@ void AwJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -29,11 +29,8 @@ return; } - bridge->RunJavaScriptDialog(message_type, - origin_url, - message_text, - default_prompt_text, - callback); + bridge->RunJavaScriptDialog(dialog_type, origin_url, message_text, + default_prompt_text, callback); } void AwJavaScriptDialogManager::RunBeforeUnloadDialog(
diff --git a/android_webview/browser/aw_javascript_dialog_manager.h b/android_webview/browser/aw_javascript_dialog_manager.h index f7790cd8..831065f 100644 --- a/android_webview/browser/aw_javascript_dialog_manager.h +++ b/android_webview/browser/aw_javascript_dialog_manager.h
@@ -18,7 +18,7 @@ // Overridden from content::JavaScriptDialogManager: void RunJavaScriptDialog(content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java index 3bda004..d00a3da9 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
@@ -50,36 +50,8 @@ mAwContents = testContainerView.getAwContents(); enableJavaScriptOnUiThread(mAwContents); - loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), - getKeySystemTestPage(), "text/html", false); - } - - private String getKeySystemTestPage() { - // requestMediaKeySystemAccess() provides 2 different configurations - // as encrypted webm is only supported on Lollipop+. mp4 is proprietary, - // and may not be supported on all Android devices. - return "<html> <script>" - + "var result;" - + "function success(keySystemAccess) {" - + " result = 'supported';" - + "}" - + "function failure(error){" - + " result = error.name;" - + "}" - + "function isKeySystemSupported(keySystem) {" - + " navigator.requestMediaKeySystemAccess(" - + " keySystem, " - + " [{audioCapabilities:" - + " [{contentType: 'audio/webm; codec=\"vorbis\"'}]}, " - + " {videoCapabilities:" - + " [{contentType: 'video/mp4; codecs=\"avc1.4D000C\"'}]}])" - + " .then(success, failure);" - + "}" - + "function areProprietaryCodecsSupported() {" - + " var video = document.createElement('video');" - + " return video.canPlayType('video/mp4; codecs=\"avc1\"');" - + "}" - + "</script> </html>"; + loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), + "file:///android_asset/key-system-test.html"); } private String isKeySystemSupported(String keySystem) throws Exception {
diff --git a/android_webview/native/aw_autofill_client.cc b/android_webview/native/aw_autofill_client.cc index 11079829..7f60433 100644 --- a/android_webview/native/aw_autofill_client.cc +++ b/android_webview/native/aw_autofill_client.cc
@@ -185,12 +185,12 @@ NOTIMPLEMENTED(); } -bool AwAutofillClient::IsContextSecure(const GURL& form_origin) { +bool AwAutofillClient::IsContextSecure() { content::SSLStatus ssl_status; content::NavigationEntry* navigation_entry = web_contents_->GetController().GetLastCommittedEntry(); if (!navigation_entry) - return false; + return false; ssl_status = navigation_entry->GetSSL(); // Note: The implementation below is a copy of the one in
diff --git a/android_webview/native/aw_autofill_client.h b/android_webview/native/aw_autofill_client.h index f3ce561..6627e71 100644 --- a/android_webview/native/aw_autofill_client.h +++ b/android_webview/native/aw_autofill_client.h
@@ -100,7 +100,7 @@ void DidFillOrPreviewField(const base::string16& autofilled_value, const base::string16& profile_full_name) override; void OnFirstUserGestureObserved() override; - bool IsContextSecure(const GURL& form_origin) override; + bool IsContextSecure() override; bool ShouldShowSigninPromo() override; void StartSigninFlow() override; void ShowHttpNotSecureExplanation() override;
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index 28d089b..dff6c0db8 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -271,7 +271,7 @@ } void AwContentsClientBridge::RunJavaScriptDialog( - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const GURL& origin_url, const base::string16& message_text, const base::string16& default_prompt_text, @@ -293,20 +293,20 @@ ScopedJavaLocalRef<jstring> jmessage( ConvertUTF16ToJavaString(env, message_text)); - switch (message_type) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: { + switch (dialog_type) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: { devtools_instrumentation::ScopedEmbedderCallbackTask("onJsAlert"); Java_AwContentsClientBridge_handleJsAlert(env, obj, jurl, jmessage, callback_id); break; } - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: { + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: { devtools_instrumentation::ScopedEmbedderCallbackTask("onJsConfirm"); Java_AwContentsClientBridge_handleJsConfirm(env, obj, jurl, jmessage, callback_id); break; } - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: { + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: { ScopedJavaLocalRef<jstring> jdefault_value( ConvertUTF16ToJavaString(env, default_prompt_text)); devtools_instrumentation::ScopedEmbedderCallbackTask("onJsPrompt");
diff --git a/android_webview/native/aw_contents_client_bridge.h b/android_webview/native/aw_contents_client_bridge.h index da8909ca..db1f28d 100644 --- a/android_webview/native/aw_contents_client_bridge.h +++ b/android_webview/native/aw_contents_client_bridge.h
@@ -46,7 +46,7 @@ std::unique_ptr<content::ClientCertificateDelegate> delegate) override; void RunJavaScriptDialog( - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const GURL& origin_url, const base::string16& message_text, const base::string16& default_prompt_text,
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index e341ddf0..a638337 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -75,6 +75,7 @@ "shell/assets/full_screen_video_inside_div_test.html", "shell/assets/full_screen_video_test.html", "shell/assets/full_screen_video_test_not_preloaded.html", + "shell/assets/key-system-test.html", "shell/assets/platform-media-codec-test.html", "shell/assets/video.3gp", "shell/assets/video.webm",
diff --git a/android_webview/test/shell/assets/key-system-test.html b/android_webview/test/shell/assets/key-system-test.html new file mode 100644 index 0000000..0de0b9f --- /dev/null +++ b/android_webview/test/shell/assets/key-system-test.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> + +<html> +<script> + +var result; + +function success(keySystemAccess) { + result = 'supported'; +} + +function failure(error) { + result = error.name; +} + +function isKeySystemSupported(keySystem) { + // requestMediaKeySystemAccess() provides 2 different configurations + // as encrypted webm is only supported on Lollipop+. mp4 is proprietary, + // and may not be supported on all Android devices. + navigator + .requestMediaKeySystemAccess( + keySystem, + [ + { + audioCapabilities : + [ {contentType : 'audio/webm; codec=\"vorbis\"'} ] + }, + { + videoCapabilities : + [ {contentType : 'video/mp4; codecs=\"avc1.4D000C\"'} ] + } + ]) + .then(success, failure); +} + +function areProprietaryCodecsSupported() { + var video = document.createElement('video'); + return video.canPlayType('video/mp4; codecs=\"avc1\"'); +} + +</script> +</html>
diff --git a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java index d96fefb..a7218502 100644 --- a/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java +++ b/android_webview/tools/system_webview_shell/layout_tests/src/org/chromium/webview_shell/test/WebViewLayoutTest.java
@@ -231,12 +231,14 @@ "blink-apis/geolocation/geolocation-permission-callbacks-expected.txt"); } + @DisabledTest(message = "crbug.com/690536") @MediumTest public void testMediaStreamApiDenyPermission() throws Exception { runWebViewLayoutTest("blink-apis/webrtc/mediastream-permission-denied-callbacks.html", "blink-apis/webrtc/mediastream-permission-denied-callbacks-expected.txt"); } + @DisabledTest(message = "crbug.com/690536") @MediumTest public void testMediaStreamApi() throws Exception { mTestActivity.setGrantPermission(true);
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index e6e87ac..86484ff 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -167,9 +167,6 @@ </message> <!-- Status tray items --> - <message name="IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the status tray."> - Status tray - </message> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBLE_DESCRIPTION" desc="The accessible description of the status tray and the information on it."> Status tray, time <ph name="time">$1<ex>9:50</ex></ph>, <ph name="battery">$2<ex>Battery is full.</ex></ph> </message> @@ -244,12 +241,6 @@ <message name="IDS_ASH_STATUS_TRAY_CAST_DESKTOP" desc="The label used in the tray popup to notify that desktop may be cast."> Cast devices available </message> - <message name="IDS_ASH_STATUS_TRAY_CAST_NO_DEVICE" desc="The label used in the tray popup to notify that no cast devices are available."> - No cast devices - </message> - <message name="IDS_ASH_STATUS_TRAY_CAST_OPTIONS" desc="The label used in the tray popup to manage cast options."> - Options - </message> <message name="IDS_ASH_STATUS_TRAY_CAST_STOP" desc="The label used in the tray popup to stop casting."> Stop </message> @@ -300,12 +291,6 @@ Mute </message> - <message name="IDS_ASH_STATUS_TRAY_DRIVE" desc="The label used for Google Drive tray details header."> - Google Drive - </message> - <message name="IDS_ASH_STATUS_TRAY_DRIVE_SETTINGS" desc="The label used for Google Drive settings entry."> - Google Drive settings... - </message> <message name="IDS_ASH_STATUS_TRAY_IME" desc="The label used as the header in the IME popup."> Input methods </message> @@ -354,16 +339,10 @@ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD" desc="The label used in the accessibility menu of the system tray to toggle on/off the onscreen keyboard."> On-screen keyboard </message> - <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_MONO_AUDIO" desc="The label used in the accessibility menu of the system tray to toggle on/off mono audio output."> - Play the same audio through all speakers (mono audio) - </message> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LEARN_MORE" desc="The label used in the accessibility menu of the system tray to open a webpage (article on help center) containing explanation about accessibility feature."> Learn more... </message> - <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SETTINGS" desc="The label of the item 'Settings...' used in the accessibility menu of the system tray to open an accessibility setting page."> - Settings... - </message> <message name="IDS_ASH_STATUS_TRAY_HELP" desc="The accessible text for the help button."> Help </message> @@ -411,9 +390,6 @@ DISMISS </message> - <message name="IDS_ASH_NOTIFICATION_UNREAD_COUNT_NINE_PLUS" desc="The text shown in the notification icon for the unread count when the count is more than 9."> - 9+ - </message> <message name="IDS_ASH_EXIT_WARNING_POPUP_TEXT" desc="The text of the popup when the user preses the exit shortcut."> Press Ctrl+Shift+Q twice to quit. </message>
diff --git a/ash/common/system/chromeos/network/network_icon.cc b/ash/common/system/chromeos/network/network_icon.cc index f407404a..021b84ef 100644 --- a/ash/common/system/chromeos/network/network_icon.cc +++ b/ash/common/system/chromeos/network/network_icon.cc
@@ -4,7 +4,6 @@ #include "ash/common/system/chromeos/network/network_icon.h" -#include "ash/common/material_design/material_design_controller.h" #include "ash/common/system/chromeos/network/network_icon_animation.h" #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" #include "ash/common/system/tray/tray_constants.h" @@ -23,7 +22,6 @@ #include "third_party/skia/include/core/SkPath.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/base/webui/web_ui_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/geometry/insets.h" @@ -51,17 +49,13 @@ // Constants for offseting the badge displayed on top of the signal strength // icon. The badge will extend outside of the base icon bounds by these amounts. -// Only used for MD. All values are in dp. +// All values are in dp. // The badge offsets are different depending on whether the icon is in the tray // or menu. const int kTrayIconBadgeOffset = 3; const int kMenuIconBadgeOffset = 2; -bool UseMd() { - return MaterialDesignController::UseMaterialDesignSystemIcons(); -} - //------------------------------------------------------------------------------ // Struct to pass icon badges to NetworkIconImageSource. struct Badges { @@ -206,44 +200,9 @@ // This defines how we assemble a network icon. class NetworkIconImageSource : public gfx::CanvasImageSource { public: - NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges) - : CanvasImageSource(icon.size(), false), icon_(icon), badges_(badges) {} - ~NetworkIconImageSource() override {} - - // TODO(pkotwicz): Figure out what to do when a new image resolution becomes - // available. - void Draw(gfx::Canvas* canvas) override { - canvas->DrawImageInt(icon_, 0, 0); - - if (!badges_.top_left.isNull()) - canvas->DrawImageInt(badges_.top_left, 0, 0); - if (!badges_.top_right.isNull()) - canvas->DrawImageInt(badges_.top_right, - icon_.width() - badges_.top_right.width(), 0); - if (!badges_.bottom_left.isNull()) { - canvas->DrawImageInt(badges_.bottom_left, 0, - icon_.height() - badges_.bottom_left.height()); - } - if (!badges_.bottom_right.isNull()) { - canvas->DrawImageInt(badges_.bottom_right, - icon_.width() - badges_.bottom_right.width(), - icon_.height() - badges_.bottom_right.height()); - } - } - - private: - const gfx::ImageSkia icon_; - const Badges badges_; - - DISALLOW_COPY_AND_ASSIGN(NetworkIconImageSource); -}; - -// This defines how we assemble a network icon. -class NetworkIconImageSourceMd : public gfx::CanvasImageSource { - public: static gfx::ImageSkia CreateImage(const gfx::ImageSkia& icon, const Badges& badges) { - auto source = new NetworkIconImageSourceMd(icon, badges); + auto source = new NetworkIconImageSource(icon, badges); return gfx::ImageSkia(source, source->size()); } @@ -279,11 +238,11 @@ bool HasRepresentationAtAllScales() const override { return true; } private: - NetworkIconImageSourceMd(const gfx::ImageSkia& icon, const Badges& badges) + NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges) : CanvasImageSource(GetSizeForBaseIconSize(icon.size()), false), icon_(icon), badges_(badges) {} - ~NetworkIconImageSourceMd() override {} + ~NetworkIconImageSource() override {} static gfx::Size GetSizeForBaseIconSize(const gfx::Size& base_icon_size) { gfx::Size size = base_icon_size; @@ -297,7 +256,7 @@ const gfx::ImageSkia icon_; const Badges badges_; - DISALLOW_COPY_AND_ASSIGN(NetworkIconImageSourceMd); + DISALLOW_COPY_AND_ASSIGN(NetworkIconImageSource); }; // Depicts a given signal strength using arcs (e.g. for WiFi connections) or @@ -438,20 +397,6 @@ //------------------------------------------------------------------------------ // Utilities for extracting icon images. -gfx::ImageSkia* BaseImageForType(ImageType image_type, IconType icon_type) { - gfx::ImageSkia* image; - if (image_type == BARS) { - image = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_BARS_DARK - : IDR_AURA_UBER_TRAY_NETWORK_BARS_LIGHT); - } else { - image = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_ARCS_DARK - : IDR_AURA_UBER_TRAY_NETWORK_ARCS_LIGHT); - } - return image; -} - ImageType ImageTypeForNetworkType(const std::string& type) { if (type == shill::kTypeWifi) return ARCS; @@ -463,19 +408,9 @@ gfx::ImageSkia GetImageForIndex(ImageType image_type, IconType icon_type, int index) { - if (UseMd()) { - gfx::CanvasImageSource* source = - new SignalStrengthImageSource(image_type, icon_type, index); - return gfx::ImageSkia(source, source->size()); - } - - if (index < 0 || index >= kNumNetworkImages) - return gfx::ImageSkia(); - gfx::ImageSkia* images = BaseImageForType(image_type, icon_type); - int width = images->width(); - int height = images->height() / kNumNetworkImages; - return gfx::ImageSkiaOperations::ExtractSubset( - *images, gfx::Rect(0, index * height, width, height)); + gfx::CanvasImageSource* source = + new SignalStrengthImageSource(image_type, icon_type, index); + return gfx::ImageSkia(source, source->size()); } const gfx::ImageSkia GetDisconnectedImage(IconType icon_type, @@ -519,6 +454,7 @@ if (!s_vpn_images[index]) { // Lazily cache images. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + // TODO(estade): update this icon to MD. See crbug.com/690176 gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_VPN); s_vpn_images[index] = new gfx::ImageSkia( gfx::ImageSkiaOperations::CreateTransparentImage(*icon, animation)); @@ -531,11 +467,8 @@ static gfx::ImageSkia* s_vpn_badges[kNumFadeImages]; if (!s_vpn_badges[index]) { // Lazily cache images. - gfx::ImageSkia badge = - UseMd() ? gfx::CreateVectorIcon(kNetworkBadgeVpnIcon, - GetDefaultColorForIconType(icon_type)) - : *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE); + gfx::ImageSkia badge = gfx::CreateVectorIcon( + kNetworkBadgeVpnIcon, GetDefaultColorForIconType(icon_type)); s_vpn_badges[index] = new gfx::ImageSkia( gfx::ImageSkiaOperations::CreateTransparentImage(badge, animation)); } @@ -554,80 +487,39 @@ gfx::ImageSkia BadgeForNetworkTechnology(const NetworkState* network, IconType icon_type) { const std::string& technology = network->network_technology(); - if (UseMd()) { - const gfx::VectorIcon* icon = &gfx::kNoneIcon; - if (technology == shill::kNetworkTechnologyEvdo) { - icon = &kNetworkBadgeTechnologyEvdoIcon; - } else if (technology == shill::kNetworkTechnology1Xrtt) { - icon = &kNetworkBadgeTechnology1xIcon; - } else if (technology == shill::kNetworkTechnologyGprs || - technology == shill::kNetworkTechnologyGsm) { - icon = &kNetworkBadgeTechnologyGprsIcon; - } else if (technology == shill::kNetworkTechnologyEdge) { - icon = &kNetworkBadgeTechnologyEdgeIcon; - } else if (technology == shill::kNetworkTechnologyUmts) { - icon = &kNetworkBadgeTechnology3gIcon; - } else if (technology == shill::kNetworkTechnologyHspa) { - icon = &kNetworkBadgeTechnologyHspaIcon; - } else if (technology == shill::kNetworkTechnologyHspaPlus) { - icon = &kNetworkBadgeTechnologyHspaPlusIcon; - } else if (technology == shill::kNetworkTechnologyLte) { - icon = &kNetworkBadgeTechnologyLteIcon; - } else if (technology == shill::kNetworkTechnologyLteAdvanced) { - icon = &kNetworkBadgeTechnologyLteAdvancedIcon; - } else { - return gfx::ImageSkia(); - } - return gfx::CreateVectorIcon(*icon, GetDefaultColorForIconType(icon_type)); - } - - int id = -1; + const gfx::VectorIcon* icon = &gfx::kNoneIcon; if (technology == shill::kNetworkTechnologyEvdo) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_EVDO_DARK - : IDR_AURA_UBER_TRAY_NETWORK_EVDO_LIGHT; + icon = &kNetworkBadgeTechnologyEvdoIcon; } else if (technology == shill::kNetworkTechnology1Xrtt) { - id = IDR_AURA_UBER_TRAY_NETWORK_1X; - } else if (technology == shill::kNetworkTechnologyGprs) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_GPRS_DARK - : IDR_AURA_UBER_TRAY_NETWORK_GPRS_LIGHT; + icon = &kNetworkBadgeTechnology1xIcon; + } else if (technology == shill::kNetworkTechnologyGprs || + technology == shill::kNetworkTechnologyGsm) { + icon = &kNetworkBadgeTechnologyGprsIcon; } else if (technology == shill::kNetworkTechnologyEdge) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_EDGE_DARK - : IDR_AURA_UBER_TRAY_NETWORK_EDGE_LIGHT; + icon = &kNetworkBadgeTechnologyEdgeIcon; } else if (technology == shill::kNetworkTechnologyUmts) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_3G_DARK - : IDR_AURA_UBER_TRAY_NETWORK_3G_LIGHT; + icon = &kNetworkBadgeTechnology3gIcon; } else if (technology == shill::kNetworkTechnologyHspa) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_HSPA_DARK - : IDR_AURA_UBER_TRAY_NETWORK_HSPA_LIGHT; + icon = &kNetworkBadgeTechnologyHspaIcon; } else if (technology == shill::kNetworkTechnologyHspaPlus) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_DARK - : IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_LIGHT; + icon = &kNetworkBadgeTechnologyHspaPlusIcon; } else if (technology == shill::kNetworkTechnologyLte) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_LTE_DARK - : IDR_AURA_UBER_TRAY_NETWORK_LTE_LIGHT; + icon = &kNetworkBadgeTechnologyLteIcon; } else if (technology == shill::kNetworkTechnologyLteAdvanced) { - id = IconTypeIsDark(icon_type) - ? IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_DARK - : IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_LIGHT; - } else if (technology == shill::kNetworkTechnologyGsm) { - id = IconTypeIsDark(icon_type) ? IDR_AURA_UBER_TRAY_NETWORK_GPRS_DARK - : IDR_AURA_UBER_TRAY_NETWORK_GPRS_LIGHT; + icon = &kNetworkBadgeTechnologyLteAdvancedIcon; } else { return gfx::ImageSkia(); } - return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); + return gfx::CreateVectorIcon(*icon, GetDefaultColorForIconType(icon_type)); } gfx::ImageSkia GetIcon(const NetworkState* network, IconType icon_type, int strength_index) { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (network->Matches(NetworkTypePattern::Ethernet())) { DCHECK_NE(ICON_TYPE_TRAY, icon_type); - return UseMd() ? gfx::CreateVectorIcon( - kNetworkEthernetIcon, - GetDefaultColorForIconType(ICON_TYPE_LIST)) - : *rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_WIRED); + return gfx::CreateVectorIcon(kNetworkEthernetIcon, + GetDefaultColorForIconType(ICON_TYPE_LIST)); } else if (network->Matches(NetworkTypePattern::Wireless())) { DCHECK(strength_index > 0); return GetImageForIndex(ImageTypeForNetworkType(network->type()), icon_type, @@ -661,9 +553,7 @@ } else { icon = ConnectingVpnImage(animation); } - return UseMd() ? NetworkIconImageSourceMd::CreateImage(icon, badges) - : gfx::ImageSkia(new NetworkIconImageSource(icon, badges), - icon.size()); + return NetworkIconImageSource::CreateImage(icon, badges); } gfx::ImageSkia GetConnectingImage(IconType icon_type, @@ -674,11 +564,8 @@ ImageType image_type = ImageTypeForNetworkType(network_type); double animation = NetworkIconAnimation::GetInstance()->GetAnimation(); - gfx::ImageSkia* icon = - ConnectingWirelessImage(image_type, icon_type, animation); - return UseMd() ? NetworkIconImageSourceMd::CreateImage(*icon, Badges()) - : gfx::ImageSkia(new NetworkIconImageSource(*icon, Badges()), - icon->size()); + return NetworkIconImageSource::CreateImage( + *ConnectingWirelessImage(image_type, icon_type, animation), Badges()); } } // namespace @@ -772,11 +659,8 @@ NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( NetworkTypePattern::VPN()); if (vpn && vpn_badge_.isNull()) { - vpn_badge_ = - UseMd() ? gfx::CreateVectorIcon(kNetworkBadgeVpnIcon, - GetDefaultColorForIconType(icon_type_)) - : *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE); + vpn_badge_ = gfx::CreateVectorIcon(kNetworkBadgeVpnIcon, + GetDefaultColorForIconType(icon_type_)); return true; } if (!vpn && !vpn_badge_.isNull()) { @@ -788,8 +672,6 @@ void NetworkIconImpl::GetBadges(const NetworkState* network, Badges* badges) { DCHECK(network); - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); const std::string& type = network->type(); const SkColor icon_color = GetDefaultColorForIconType(icon_type_); @@ -797,32 +679,22 @@ if (network->security_class() != shill::kSecurityNone && IconTypeIsDark(icon_type_)) { badges->bottom_right = - UseMd() - ? gfx::CreateVectorIcon(kNetworkBadgeSecureIcon, icon_color) - : *rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_NETWORK_SECURE_DARK); + gfx::CreateVectorIcon(kNetworkBadgeSecureIcon, icon_color); } } else if (type == shill::kTypeWimax) { technology_badge_ = - UseMd() - ? gfx::CreateVectorIcon(kNetworkBadgeTechnology4gIcon, icon_color) - : *rb.GetImageSkiaNamed(IconTypeIsDark(icon_type_) - ? IDR_AURA_UBER_TRAY_NETWORK_4G_DARK - : IDR_AURA_UBER_TRAY_NETWORK_4G_LIGHT); + gfx::CreateVectorIcon(kNetworkBadgeTechnology4gIcon, icon_color); } else if (type == shill::kTypeCellular) { if (network->roaming() == shill::kRoamingStateRoaming) { // For networks that are always in roaming don't show roaming badge. const DeviceState* device = - handler->GetDeviceState(network->device_path()); + NetworkHandler::Get()->network_state_handler()->GetDeviceState( + network->device_path()); LOG_IF(WARNING, !device) << "Could not find device state for " << network->device_path(); if (!device || !device->provider_requires_roaming()) { badges->bottom_right = - UseMd() - ? gfx::CreateVectorIcon(kNetworkBadgeRoamingIcon, icon_color) - : *rb.GetImageSkiaNamed( - IconTypeIsDark(icon_type_) - ? IDR_AURA_UBER_TRAY_NETWORK_ROAMING_DARK - : IDR_AURA_UBER_TRAY_NETWORK_ROAMING_LIGHT); + gfx::CreateVectorIcon(kNetworkBadgeRoamingIcon, icon_color); } } } @@ -833,12 +705,7 @@ if (behind_captive_portal_) { badges->bottom_right = - UseMd() - ? gfx::CreateVectorIcon(kNetworkBadgeCaptivePortalIcon, icon_color) - : *rb.GetImageSkiaNamed( - IconTypeIsDark(icon_type_) - ? IDR_AURA_UBER_TRAY_NETWORK_PORTAL_DARK - : IDR_AURA_UBER_TRAY_NETWORK_PORTAL_LIGHT); + gfx::CreateVectorIcon(kNetworkBadgeCaptivePortalIcon, icon_color); } } @@ -847,9 +714,7 @@ gfx::ImageSkia icon = GetIcon(network, icon_type_, strength_index_); Badges badges; GetBadges(network, &badges); - image_ = UseMd() ? NetworkIconImageSourceMd::CreateImage(icon, badges) - : gfx::ImageSkia(new NetworkIconImageSource(icon, badges), - icon.size()); + image_ = NetworkIconImageSource::CreateImage(icon, badges); } namespace { @@ -911,15 +776,12 @@ Badges badges; badges.bottom_right = gfx::CreateVectorIcon(kNetworkBadgeAddOtherIcon, badge_color); - return NetworkIconImageSourceMd::CreateImage(icon, badges); + return NetworkIconImageSource::CreateImage(icon, badges); } gfx::ImageSkia GetVpnImage() { - return UseMd() - ? gfx::CreateVectorIcon(kNetworkVpnIcon, - GetDefaultColorForIconType(ICON_TYPE_LIST)) - : *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_AURA_UBER_TRAY_NETWORK_VPN); + return gfx::CreateVectorIcon(kNetworkVpnIcon, + GetDefaultColorForIconType(ICON_TYPE_LIST)); } base::string16 GetLabelForNetwork(const chromeos::NetworkState* network,
diff --git a/ash/resources/ash_resources.grd b/ash/resources/ash_resources.grd index 85f3a8e..5085cc06 100644 --- a/ash/resources/ash_resources.grd +++ b/ash/resources/ash_resources.grd
@@ -84,40 +84,10 @@ <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_LOCKSCREEN" file="cros/status/status_lockscreen.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER" file="cros/status/status_lockscreen_hover.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_1X" file="cros/network/statusbar_network_1x.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_3G_DARK" file="cros/network/statusbar_network_3g_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_3G_LIGHT" file="cros/network/statusbar_network_3g_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_4G_DARK" file="cros/network/statusbar_network_4g_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_4G_LIGHT" file="cros/network/statusbar_network_4g_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ARCS_DARK" file="cros/network/statusbar_network_arcs_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ARCS_LIGHT" file="cros/network/statusbar_network_arcs_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_BARS_DARK" file="cros/network/statusbar_network_bars_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_BARS_LIGHT" file="cros/network/statusbar_network_bars_light.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_CONTROLLED" file="cros/network/status_captive_portal_access.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EDGE_DARK" file="cros/network/statusbar_network_edge_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EDGE_LIGHT" file="cros/network/statusbar_network_edge_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EVDO_DARK" file="cros/network/statusbar_network_evdo_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_EVDO_LIGHT" file="cros/network/statusbar_network_evdo_light.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_FAILED" file="cros/network/status_network_failed.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_FAILED_CELLULAR" file="cros/network/status_cellular_failed.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_GPRS_DARK" file="cros/network/statusbar_network_gprs_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_GPRS_LIGHT" file="cros/network/statusbar_network_gprs_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_DARK" file="cros/network/statusbar_network_hspa_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_LIGHT" file="cros/network/statusbar_network_hspa_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_DARK" file="cros/network/statusbar_network_hspa_plus_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_HSPA_PLUS_LIGHT" file="cros/network/statusbar_network_hspa_plus_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_DARK" file="cros/network/statusbar_network_lte_advanced_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_ADVANCED_LIGHT" file="cros/network/statusbar_network_lte_advanced_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_DARK" file="cros/network/statusbar_network_lte_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_LTE_LIGHT" file="cros/network/statusbar_network_lte_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_PORTAL_DARK" file="cros/network/statusbar_network_active_portal_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_PORTAL_LIGHT" file="cros/network/statusbar_network_active_portal_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ROAMING_DARK" file="cros/network/statusbar_network_roaming_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_ROAMING_LIGHT" file="cros/network/statusbar_network_roaming_light.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_SECURE_DARK" file="cros/network/statusbar_network_secure_dark.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_VPN" file="cros/network/statusbar_vpn_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_VPN_BADGE" file="cros/network/statusbar_network_vpn_badge.png" /> - <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_WIRED" file="cros/network/statusbar_wired.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_NOTIFICATION_3G" file="cros/network/notification_3g.png" /> <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_NETWORK_NOTIFICATION_DATASAVER" file="cros/network/notification_datasaver.png" />
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_1x.png b/ash/resources/default_100_percent/cros/network/statusbar_network_1x.png deleted file mode 100644 index 5a25e1c9..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_1x.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_3g_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_3g_dark.png deleted file mode 100644 index 8b9b92a..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_3g_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_3g_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_3g_light.png deleted file mode 100644 index 83b5921..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_3g_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_4g_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_4g_dark.png deleted file mode 100644 index daa9f7e4..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_4g_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_4g_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_4g_light.png deleted file mode 100644 index c199a89..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_4g_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png deleted file mode 100644 index b201c39..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png deleted file mode 100644 index 0079811b..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_active_portal_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_dark.png deleted file mode 100644 index 29b6c72..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_light.png deleted file mode 100644 index 2d783f6..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_arcs_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_bars_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_bars_dark.png deleted file mode 100644 index 9facf9fe..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_bars_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_bars_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_bars_light.png deleted file mode 100644 index 4f77026..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_bars_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_edge_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_edge_dark.png deleted file mode 100644 index 8fa7443..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_edge_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_edge_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_edge_light.png deleted file mode 100644 index c9a525cf..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_edge_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_dark.png deleted file mode 100644 index 85c0378..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_light.png deleted file mode 100644 index 1ae959b3..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_evdo_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_dark.png deleted file mode 100644 index 03357a6e..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_light.png deleted file mode 100644 index 3953406..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_gprs_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_dark.png deleted file mode 100644 index bad20a7..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_light.png deleted file mode 100644 index 1eedc06..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_dark.png deleted file mode 100644 index 2b34e394..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_light.png deleted file mode 100644 index 2ee0809..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_hspa_plus_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_dark.png deleted file mode 100644 index db3ab77..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_light.png deleted file mode 100644 index 66d25d3..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_advanced_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_lte_dark.png deleted file mode 100644 index 84b7c7cc..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_lte_light.png deleted file mode 100644 index 29cca1d..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_lte_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_dark.png deleted file mode 100644 index f4d9becb..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_light.png b/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_light.png deleted file mode 100644 index 70544b6..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_roaming_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_secure_dark.png b/ash/resources/default_100_percent/cros/network/statusbar_network_secure_dark.png deleted file mode 100644 index 98b0b51..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_secure_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_network_vpn_badge.png b/ash/resources/default_100_percent/cros/network/statusbar_network_vpn_badge.png deleted file mode 100644 index 906276e..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_network_vpn_badge.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_100_percent/cros/network/statusbar_wired.png b/ash/resources/default_100_percent/cros/network/statusbar_wired.png deleted file mode 100644 index 14335f7..0000000 --- a/ash/resources/default_100_percent/cros/network/statusbar_wired.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/status_wifi_enabled.png b/ash/resources/default_200_percent/cros/network/status_wifi_enabled.png deleted file mode 100644 index e951ff3e..0000000 --- a/ash/resources/default_200_percent/cros/network/status_wifi_enabled.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_3g_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_3g_dark.png deleted file mode 100644 index e58ed2ad..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_3g_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_3g_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_3g_light.png deleted file mode 100644 index 095a889..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_3g_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_4g_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_4g_dark.png deleted file mode 100644 index d17ceb7..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_4g_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_4g_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_4g_light.png deleted file mode 100644 index e783596..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_4g_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png deleted file mode 100644 index b10d869..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png deleted file mode 100644 index 49930ee4..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_active_portal_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_dark.png deleted file mode 100644 index f3c281f..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_light.png deleted file mode 100644 index 108249c..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_arcs_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_bars_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_bars_dark.png deleted file mode 100644 index 548ef5f..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_bars_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_bars_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_bars_light.png deleted file mode 100644 index 90f2232b..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_bars_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_edge_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_edge_dark.png deleted file mode 100644 index fae8b09c..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_edge_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_edge_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_edge_light.png deleted file mode 100644 index 445bc952..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_edge_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_dark.png deleted file mode 100644 index 71351465..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_light.png deleted file mode 100644 index 55b89af5..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_evdo_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_dark.png deleted file mode 100644 index c45081d..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_light.png deleted file mode 100644 index 4277cdfa..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_gprs_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_dark.png deleted file mode 100644 index bf424a3..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_light.png deleted file mode 100644 index ca2f7079..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_dark.png deleted file mode 100644 index a3522894..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_light.png deleted file mode 100644 index 6e2b38b..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_hspa_plus_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_dark.png deleted file mode 100644 index 50c496ae..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_light.png deleted file mode 100644 index ef9f7ce0..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_advanced_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_lte_dark.png deleted file mode 100644 index 1c72085..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_lte_light.png deleted file mode 100644 index 53f9ab11..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_lte_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_dark.png deleted file mode 100644 index f59974f..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_light.png b/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_light.png deleted file mode 100644 index ae7fade4..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_roaming_light.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_secure_dark.png b/ash/resources/default_200_percent/cros/network/statusbar_network_secure_dark.png deleted file mode 100644 index 1089307..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_secure_dark.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_network_vpn_badge.png b/ash/resources/default_200_percent/cros/network/statusbar_network_vpn_badge.png deleted file mode 100644 index 07a0756..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_network_vpn_badge.png +++ /dev/null Binary files differ
diff --git a/ash/resources/default_200_percent/cros/network/statusbar_wired.png b/ash/resources/default_200_percent/cros/network/statusbar_wired.png deleted file mode 100644 index 2db7fa0a..0000000 --- a/ash/resources/default_200_percent/cros/network/statusbar_wired.png +++ /dev/null Binary files differ
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 62f000f8..04aff13 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -21,7 +21,6 @@ #include "ash/common/shelf/wm_shelf.h" #include "ash/common/shelf/wm_shelf_observer.h" #include "ash/common/system/web_notification/web_notification_tray.h" -#include "ash/common/test/material_design_controller_test_api.h" #include "ash/common/test/test_shelf_delegate.h" #include "ash/common/test/test_shelf_item_delegate.h" #include "ash/common/test/test_system_tray_delegate.h" @@ -1806,54 +1805,6 @@ EXPECT_FALSE(GetButtonByID(platform_app_id)->visible()); } -// Tests that the AppListButton renders as active in response to touches. -TEST_F(ShelfViewTest, AppListButtonTouchFeedback) { - // Touch feedback is not available in material mode. - if (ash::MaterialDesignController::IsShelfMaterial()) - return; - - AppListButton* app_list_button = shelf_view_->GetAppListButton(); - EXPECT_FALSE(app_list_button->draw_background_as_active()); - - ui::test::EventGenerator& generator = GetEventGenerator(); - generator.set_current_location( - app_list_button->GetBoundsInScreen().CenterPoint()); - generator.PressTouch(); - EXPECT_TRUE(app_list_button->draw_background_as_active()); - - generator.ReleaseTouch(); - EXPECT_FALSE(app_list_button->draw_background_as_active()); - EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); -} - -// Tests that a touch that slides out of the bounds of the AppListButton leads -// to the end of rendering an active state. -TEST_F(ShelfViewTest, AppListButtonTouchFeedbackCancellation) { - // Touch feedback is not available in material mode. - if (ash::MaterialDesignController::IsShelfMaterial()) - return; - - AppListButton* app_list_button = shelf_view_->GetAppListButton(); - EXPECT_FALSE(app_list_button->draw_background_as_active()); - - ui::test::EventGenerator& generator = GetEventGenerator(); - generator.set_current_location( - app_list_button->GetBoundsInScreen().CenterPoint()); - generator.PressTouch(); - EXPECT_TRUE(app_list_button->draw_background_as_active()); - - gfx::Point moved_point( - app_list_button->GetBoundsInScreen().right() + 1, - app_list_button->GetBoundsInScreen().CenterPoint().y()); - generator.MoveTouch(moved_point); - EXPECT_FALSE(app_list_button->draw_background_as_active()); - - generator.set_current_location(moved_point); - generator.ReleaseTouch(); - EXPECT_FALSE(app_list_button->draw_background_as_active()); - EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); -} - // Verifies that Launcher_ButtonPressed_* UMA user actions are recorded when an // item is selected. TEST_F(ShelfViewTest, @@ -2025,8 +1976,7 @@ } // namespace -// Test fixture that forces material design mode in order to test ink drop -// ripples on shelf. +// Test fixture for testing material design ink drop ripples on shelf. class ShelfViewInkDropTest : public ShelfViewTest { public: ShelfViewInkDropTest() {} @@ -2035,8 +1985,6 @@ void SetUp() override { ash_test_helper()->set_test_shell_delegate(CreateTestShellDelegate()); - set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); - ShelfViewTest::SetUp(); }
diff --git a/base/debug/activity_tracker.cc b/base/debug/activity_tracker.cc index ec2e13b..efdf8c8 100644 --- a/base/debug/activity_tracker.cc +++ b/base/debug/activity_tracker.cc
@@ -121,8 +121,9 @@ Reference cached = cache_values_[--cache_used_]; // Change the type of the cached object to the proper type and return it. // If the type-change fails that means another thread has taken this from - // under us (via the search below) so ignore it and keep trying. - if (allocator_->ChangeType(cached, object_type_, object_free_type_)) + // under us (via the search below) so ignore it and keep trying. Don't + // clear the memory because that was done when the type was made "free". + if (allocator_->ChangeType(cached, object_type_, object_free_type_, false)) return cached; } @@ -140,7 +141,7 @@ // Found a free object. Change it to the proper type and return it. If // the type-change fails that means another thread has taken this from // under us so ignore it and keep trying. - if (allocator_->ChangeType(found, object_type_, object_free_type_)) + if (allocator_->ChangeType(found, object_type_, object_free_type_, false)) return found; } if (found == last) { @@ -161,14 +162,9 @@ } void ActivityTrackerMemoryAllocator::ReleaseObjectReference(Reference ref) { - // Zero the memory so that it is ready for immediate use if needed later. - char* mem_base = allocator_->GetAsArray<char>( - ref, object_type_, PersistentMemoryAllocator::kSizeAny); - DCHECK(mem_base); - memset(mem_base, 0, object_size_); - // Mark object as free. - bool success = allocator_->ChangeType(ref, object_free_type_, object_type_); + bool success = allocator_->ChangeType(ref, object_free_type_, object_type_, + /*clear=*/true); DCHECK(success); // Add this reference to our "free" cache if there is space. If not, the type @@ -1217,8 +1213,7 @@ } size_t required_size = ModuleInfoRecord::EncodedSize(info); - ModuleInfoRecord* record = - allocator_->AllocateObject<ModuleInfoRecord>(required_size); + ModuleInfoRecord* record = allocator_->New<ModuleInfoRecord>(required_size); if (!record) return;
diff --git a/base/feature_list.cc b/base/feature_list.cc index 234d5be..353136c 100644 --- a/base/feature_list.cc +++ b/base/feature_list.cc
@@ -165,7 +165,7 @@ pickle.WriteString(override.second.field_trial->trial_name()); size_t total_size = sizeof(FeatureEntry) + pickle.size(); - FeatureEntry* entry = allocator->AllocateObject<FeatureEntry>(total_size); + FeatureEntry* entry = allocator->New<FeatureEntry>(total_size); if (!entry) return;
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index d16d79f..6b38d55 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc
@@ -1078,7 +1078,7 @@ pickle.WriteString(group_name); size_t total_size = sizeof(FieldTrial::FieldTrialEntry) + pickle.size(); FieldTrial::FieldTrialEntry* new_entry = - allocator->AllocateObject<FieldTrial::FieldTrialEntry>(total_size); + allocator->New<FieldTrial::FieldTrialEntry>(total_size); subtle::NoBarrier_Store(&new_entry->activated, subtle::NoBarrier_Load(&prev_entry->activated)); new_entry->pickle_size = pickle.size(); @@ -1098,7 +1098,8 @@ // Mark the existing entry as unused. allocator->ChangeType(prev_ref, 0, - FieldTrial::FieldTrialEntry::kPersistentTypeId); + FieldTrial::FieldTrialEntry::kPersistentTypeId, + /*clear=*/false); } for (const auto& ref : new_refs) {
diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc index 011d883..939174e 100644 --- a/base/metrics/persistent_histogram_allocator.cc +++ b/base/metrics/persistent_histogram_allocator.cc
@@ -322,7 +322,7 @@ // confusion by another process trying to read it. It will be corrected // once histogram construction is complete. PersistentHistogramData* histogram_data = - memory_allocator_->AllocateObject<PersistentHistogramData>( + memory_allocator_->New<PersistentHistogramData>( offsetof(PersistentHistogramData, name) + name.length() + 1); if (histogram_data) { memcpy(histogram_data->name, name.c_str(), name.size() + 1); @@ -428,7 +428,8 @@ // be created. The allocator does not support releasing the acquired memory // so just change the type to be empty. memory_allocator_->ChangeType(ref, 0, - PersistentHistogramData::kPersistentTypeId); + PersistentHistogramData::kPersistentTypeId, + /*clear=*/false); } } @@ -825,8 +826,8 @@ // likely has histograms stored within it. If the backing memory is also // also released, future accesses to those histograms will seg-fault. CHECK(!subtle::NoBarrier_Load(&g_allocator)); - subtle::NoBarrier_Store(&g_allocator, - reinterpret_cast<uintptr_t>(allocator.release())); + subtle::Release_Store(&g_allocator, + reinterpret_cast<uintptr_t>(allocator.release())); size_t existing = StatisticsRecorder::GetHistogramCount(); DVLOG_IF(1, existing) @@ -836,7 +837,7 @@ // static GlobalHistogramAllocator* GlobalHistogramAllocator::Get() { return reinterpret_cast<GlobalHistogramAllocator*>( - subtle::NoBarrier_Load(&g_allocator)); + subtle::Acquire_Load(&g_allocator)); } // static @@ -866,7 +867,7 @@ DCHECK_NE(kResultHistogram, data->name); } - subtle::NoBarrier_Store(&g_allocator, 0); + subtle::Release_Store(&g_allocator, 0); return WrapUnique(histogram_allocator); };
diff --git a/base/metrics/persistent_memory_allocator.cc b/base/metrics/persistent_memory_allocator.cc index ba0ef2a1..5ac7d56 100644 --- a/base/metrics/persistent_memory_allocator.cc +++ b/base/metrics/persistent_memory_allocator.cc
@@ -511,16 +511,50 @@ bool PersistentMemoryAllocator::ChangeType(Reference ref, uint32_t to_type_id, - uint32_t from_type_id) { + uint32_t from_type_id, + bool clear) { DCHECK(!readonly_); volatile BlockHeader* const block = GetBlock(ref, 0, 0, false, false); if (!block) return false; - // This is a "strong" exchange because there is no loop that can retry in - // the wake of spurious failures possible with "weak" exchanges. Make this - // an "acquire-release" so no memory accesses can be reordered either before - // or after since changes based on type could happen on either side. + // "Strong" exchanges are used below because there is no loop that can retry + // in the wake of spurious failures possible with "weak" exchanges. It is, + // in aggregate, an "acquire-release" operation so no memory accesses can be + // reordered either before or after this method (since changes based on type + // could happen on either side). + + if (clear) { + // If clearing the memory, first change it to the "transitioning" type so + // there can be no confusion by other threads. After the memory is cleared, + // it can be changed to its final type. + if (!block->type_id.compare_exchange_strong( + from_type_id, kTypeIdTransitioning, std::memory_order_acquire, + std::memory_order_acquire)) { + // Existing type wasn't what was expected: fail (with no changes) + return false; + } + + // Clear the memory while the type doesn't match either "from" or "to". + memset(const_cast<char*>(reinterpret_cast<volatile char*>(block) + + sizeof(BlockHeader)), + 0, block->size - sizeof(BlockHeader)); + + // If the destination type is "transitioning" then skip the final exchange. + if (to_type_id == kTypeIdTransitioning) + return true; + + // Finish the change to the desired type. + from_type_id = kTypeIdTransitioning; // Exchange needs modifiable original. + bool success = block->type_id.compare_exchange_strong( + from_type_id, to_type_id, std::memory_order_release, + std::memory_order_relaxed); + DCHECK(success); // Should never fail. + return success; + } + + // One step change to the new type. Will return false if the existing value + // doesn't match what is expected. return block->type_id.compare_exchange_strong(from_type_id, to_type_id, std::memory_order_acq_rel, std::memory_order_acquire);
diff --git a/base/metrics/persistent_memory_allocator.h b/base/metrics/persistent_memory_allocator.h index 9fdef019..7fd96a4 100644 --- a/base/metrics/persistent_memory_allocator.h +++ b/base/metrics/persistent_memory_allocator.h
@@ -51,7 +51,7 @@ // // OBJECTS: Although the allocator can be used in a "malloc" sense, fetching // character arrays and manipulating that memory manually, the better way is -// generally to use the "Object" methods to create and manage allocations. In +// generally to use the "object" methods to create and manage allocations. In // this way the sizing, type-checking, and construction are all automatic. For // this to work, however, every type of stored object must define two public // "constexpr" values, kPersistentTypeId and kExpectedInstanceSize, as such: @@ -83,11 +83,10 @@ // verify that the structure is compatible between both 32-bit and 64-bit // versions of the code. // -// Using AllocateObject (and ChangeObject) will zero the memory and then call -// the default constructor for the object. Given that objects are persistent, -// no destructor is ever called automatically though a caller can explicitly -// call DeleteObject to destruct it and change the type to something indicating -// it is no longer in use. +// Using New manages the memory and then calls the default constructor for the +// object. Given that objects are persistent, no destructor is ever called +// automatically though a caller can explicitly call Delete to destruct it and +// change the type to something indicating it is no longer in use. // // Though persistent memory segments are transferrable between programs built // for different natural word widths, they CANNOT be exchanged between CPUs @@ -215,10 +214,12 @@ enum : Reference { // A common "null" reference value. kReferenceNull = 0, + }; + enum : uint32_t { // A value indicating that the type is in transition. Work is being done // on the contents to prepare it for a new type to come. - kReferenceTransitioning = 0xFFFFFFFF, + kTypeIdTransitioning = 0xFFFFFFFF, }; enum : size_t { @@ -385,12 +386,6 @@ // result will be returned. Reference GetAsReference(const void* memory, uint32_t type_id) const; - // As above but works with objects allocated from persistent memory. - template <typename T> - Reference GetAsReference(const T* obj) const { - return GetAsReference(obj, T::kPersistentTypeId); - } - // Get the number of bytes allocated to a block. This is useful when storing // arrays in order to validate the ending boundary. The returned value will // include any padding added to achieve the required alignment and so could @@ -402,104 +397,21 @@ // even though the memory stays valid and allocated. Changing the type is // an atomic compare/exchange and so requires knowing the existing value. // It will return false if the existing type is not what is expected. + // // Changing the type doesn't mean the data is compatible with the new type. - // It will likely be necessary to clear or reconstruct the type before it - // can be used. Changing the type WILL NOT invalidate existing pointers to - // the data, either in this process or others, so changing the data structure - // could have unpredicatable results. USE WITH CARE! + // Passing true for |clear| will zero the memory after the type has been + // changed away from |from_type_id| but before it becomes |to_type_id| meaning + // that it is done in a manner that is thread-safe. + // + // It will likely be necessary to reconstruct the type before it can be used. + // Changing the type WILL NOT invalidate existing pointers to the data, either + // in this process or others, so changing the data structure could have + // unpredicatable results. USE WITH CARE! uint32_t GetType(Reference ref) const; - bool ChangeType(Reference ref, uint32_t to_type_id, uint32_t from_type_id); - - // Like ChangeType() but gets the "to" type from the object type, clears - // the memory, and constructs a new object of the desired type just as - // though it was fresh from AllocateObject<>(). The old type simply ceases - // to exist; no destructor is called for it. Calling this will not invalidate - // existing pointers to the object, either in this process or others, so - // changing the object could have unpredictable results. USE WITH CARE! - template <typename T> - T* ChangeObject(Reference ref, uint32_t from_type_id) { - DCHECK_LE(sizeof(T), GetAllocSize(ref)) << "alloc not big enough for obj"; - // Make sure the memory is appropriate. This won't be used until after - // the type is changed but checking first avoids the possibility of having - // to change the type back. - void* mem = const_cast<void*>(GetBlockData(ref, 0, sizeof(T))); - if (!mem) - return nullptr; - // Ensure the allocator's internal alignment is sufficient for this object. - // This protects against coding errors in the allocator. - DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); - // First change the type to "transitioning" so that there is no race - // condition with the clearing and construction of the object should - // another thread be simultaneously iterating over data. This will - // "acquire" the memory so no changes get reordered before it. - if (!ChangeType(ref, kReferenceTransitioning, from_type_id)) - return nullptr; - // Clear the memory so that the property of all memory being zero after an - // allocation also applies here. - memset(mem, 0, GetAllocSize(ref)); - // Construct an object of the desired type on this memory, just as if - // AllocateObject had been called to create it. - T* obj = new (mem) T(); - // Finally change the type to the desired one. This will "release" all of - // the changes above and so provide a consistent view to other threads. - bool success = - ChangeType(ref, T::kPersistentTypeId, kReferenceTransitioning); - DCHECK(success); - return obj; - } - - // Reserve space in the memory segment of the desired |size| and |type_id|. - // A return value of zero indicates the allocation failed, otherwise the - // returned reference can be used by any process to get a real pointer via - // the GetAsObject() call. - Reference Allocate(size_t size, uint32_t type_id); - - // Allocate and construct an object in persistent memory. The type must have - // both (size_t) kExpectedInstanceSize and (uint32_t) kPersistentTypeId - // static constexpr fields that are used to ensure compatibility between - // software versions. An optional size parameter can be specified to force - // the allocation to be bigger than the size of the object; this is useful - // when the last field is actually variable length. - template <typename T> - T* AllocateObject(size_t size) { - if (size < sizeof(T)) - size = sizeof(T); - Reference ref = Allocate(size, T::kPersistentTypeId); - void* mem = - const_cast<void*>(GetBlockData(ref, T::kPersistentTypeId, size)); - if (!mem) - return nullptr; - DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); - return new (mem) T(); - } - template <typename T> - T* AllocateObject() { - return AllocateObject<T>(sizeof(T)); - } - - // Deletes an object by destructing it and then changing the type to a - // different value (default 0). - template <typename T> - void DeleteObject(T* obj, uint32_t new_type) { - // Get the reference for the object. - Reference ref = GetAsReference<T>(obj); - // First change the type to "transitioning" so there is no race condition - // where another thread could find the object through iteration while it - // is been destructed. This will "acquire" the memory so no changes get - // reordered before it. It will fail if |ref| is invalid. - if (!ChangeType(ref, kReferenceTransitioning, T::kPersistentTypeId)) - return; - // Destruct the object. - obj->~T(); - // Finally change the type to the desired value. This will "release" all - // the changes above. - bool success = ChangeType(ref, new_type, kReferenceTransitioning); - DCHECK(success); - } - template <typename T> - void DeleteObject(T* obj) { - DeleteObject<T>(obj, 0); - } + bool ChangeType(Reference ref, + uint32_t to_type_id, + uint32_t from_type_id, + bool clear); // Allocated objects can be added to an internal list that can then be // iterated over by other processes. If an allocated object can be found @@ -511,12 +423,6 @@ // Changing the type does not alter its "iterable" status. void MakeIterable(Reference ref); - // As above but works with an object allocated from persistent memory. - template <typename T> - void MakeIterable(const T* obj) { - MakeIterable(GetAsReference<T>(obj)); - } - // Get the information about the amount of free space in the allocator. The // amount of free space should be treated as approximate due to extras from // alignment and metadata. Concurrent allocations from other threads will @@ -541,6 +447,113 @@ // called before such information is to be displayed or uploaded. void UpdateTrackingHistograms(); + // While the above works much like malloc & free, these next methods provide + // an "object" interface similar to new and delete. + + // Reserve space in the memory segment of the desired |size| and |type_id|. + // A return value of zero indicates the allocation failed, otherwise the + // returned reference can be used by any process to get a real pointer via + // the GetAsObject() or GetAsArray calls. + Reference Allocate(size_t size, uint32_t type_id); + + // Allocate and construct an object in persistent memory. The type must have + // both (size_t) kExpectedInstanceSize and (uint32_t) kPersistentTypeId + // static constexpr fields that are used to ensure compatibility between + // software versions. An optional size parameter can be specified to force + // the allocation to be bigger than the size of the object; this is useful + // when the last field is actually variable length. + template <typename T> + T* New(size_t size) { + if (size < sizeof(T)) + size = sizeof(T); + Reference ref = Allocate(size, T::kPersistentTypeId); + void* mem = + const_cast<void*>(GetBlockData(ref, T::kPersistentTypeId, size)); + if (!mem) + return nullptr; + DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); + return new (mem) T(); + } + template <typename T> + T* New() { + return New<T>(sizeof(T)); + } + + // Similar to New, above, but construct the object out of an existing memory + // block and of an expected type. If |clear| is true, memory will be zeroed + // before construction. Though this is not standard object behavior, it + // is present to match with new allocations that always come from zeroed + // memory. Anything previously present simply ceases to exist; no destructor + // is called for it so explicitly Delete() the old object first if need be. + // Calling this will not invalidate existing pointers to the object, either + // in this process or others, so changing the object could have unpredictable + // results. USE WITH CARE! + template <typename T> + T* New(Reference ref, uint32_t from_type_id, bool clear) { + DCHECK_LE(sizeof(T), GetAllocSize(ref)) << "alloc not big enough for obj"; + // Make sure the memory is appropriate. This won't be used until after + // the type is changed but checking first avoids the possibility of having + // to change the type back. + void* mem = const_cast<void*>(GetBlockData(ref, 0, sizeof(T))); + if (!mem) + return nullptr; + // Ensure the allocator's internal alignment is sufficient for this object. + // This protects against coding errors in the allocator. + DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); + // Change the type, clearing the memory if so desired. The new type is + // "transitioning" so that there is no race condition with the construction + // of the object should another thread be simultaneously iterating over + // data. This will "acquire" the memory so no changes get reordered before + // it. + if (!ChangeType(ref, kTypeIdTransitioning, from_type_id, clear)) + return nullptr; + // Construct an object of the desired type on this memory, just as if + // New() had been called to create it. + T* obj = new (mem) T(); + // Finally change the type to the desired one. This will "release" all of + // the changes above and so provide a consistent view to other threads. + bool success = + ChangeType(ref, T::kPersistentTypeId, kTypeIdTransitioning, false); + DCHECK(success); + return obj; + } + + // Deletes an object by destructing it and then changing the type to a + // different value (default 0). + template <typename T> + void Delete(T* obj, uint32_t new_type) { + // Get the reference for the object. + Reference ref = GetAsReference<T>(obj); + // First change the type to "transitioning" so there is no race condition + // where another thread could find the object through iteration while it + // is been destructed. This will "acquire" the memory so no changes get + // reordered before it. It will fail if |ref| is invalid. + if (!ChangeType(ref, kTypeIdTransitioning, T::kPersistentTypeId, false)) + return; + // Destruct the object. + obj->~T(); + // Finally change the type to the desired value. This will "release" all + // the changes above. + bool success = ChangeType(ref, new_type, kTypeIdTransitioning, false); + DCHECK(success); + } + template <typename T> + void Delete(T* obj) { + Delete<T>(obj, 0); + } + + // As above but works with objects allocated from persistent memory. + template <typename T> + Reference GetAsReference(const T* obj) const { + return GetAsReference(obj, T::kPersistentTypeId); + } + + // As above but works with an object allocated from persistent memory. + template <typename T> + void MakeIterable(const T* obj) { + MakeIterable(GetAsReference<T>(obj)); + } + protected: enum MemoryType { MEM_EXTERNAL,
diff --git a/base/metrics/persistent_memory_allocator_unittest.cc b/base/metrics/persistent_memory_allocator_unittest.cc index f8c35332..ebe63eb45 100644 --- a/base/metrics/persistent_memory_allocator_unittest.cc +++ b/base/metrics/persistent_memory_allocator_unittest.cc
@@ -112,7 +112,7 @@ // Validate allocation of test object and make sure it can be referenced // and all metadata looks correct. - TestObject1* obj1 = allocator_->AllocateObject<TestObject1>(); + TestObject1* obj1 = allocator_->New<TestObject1>(); ASSERT_TRUE(obj1); Reference block1 = allocator_->GetAsReference(obj1); ASSERT_NE(0U, block1); @@ -152,7 +152,7 @@ // Create second test-object and ensure everything is good and it cannot // be confused with test-object of another type. - TestObject2* obj2 = allocator_->AllocateObject<TestObject2>(); + TestObject2* obj2 = allocator_->New<TestObject2>(); ASSERT_TRUE(obj2); Reference block2 = allocator_->GetAsReference(obj2); ASSERT_NE(0U, block2); @@ -223,9 +223,9 @@ // Check that an object's type can be changed. EXPECT_EQ(2U, allocator_->GetType(block2)); - allocator_->ChangeType(block2, 3, 2); + allocator_->ChangeType(block2, 3, 2, false); EXPECT_EQ(3U, allocator_->GetType(block2)); - allocator_->ChangeObject<TestObject2>(block2, 3); + allocator_->New<TestObject2>(block2, 3, false); EXPECT_EQ(2U, allocator_->GetType(block2)); // Create second allocator (read/write) using the same memory segment. @@ -272,7 +272,7 @@ EXPECT_EQ(nullptr, iter1d.GetNextOfObject<TestObject2>()); // Ensure that deleting an object works. - allocator_->DeleteObject(obj2); + allocator_->Delete(obj2); PersistentMemoryAllocator::Iterator iter1z(allocator_.get()); EXPECT_EQ(nullptr, iter1z.GetNextOfObject<TestObject2>()); } @@ -587,7 +587,7 @@ r456 = local.Allocate(456, 456); r789 = local.Allocate(789, 789); local.MakeIterable(r123); - local.ChangeType(r456, 654, 456); + local.ChangeType(r456, 654, 456, false); local.MakeIterable(r789); local.GetMemoryInfo(&meminfo1); EXPECT_FALSE(local.IsFull()); @@ -656,6 +656,25 @@ shalloc3.MakeIterable(obj); EXPECT_EQ(obj, iter2.GetNext(&type)); EXPECT_EQ(42U, type); + + // Clear-on-change test. + Reference data_ref = shalloc3.Allocate(sizeof(int) * 4, 911); + int* data = shalloc3.GetAsArray<int>(data_ref, 911, 4); + ASSERT_TRUE(data); + data[0] = 0; + data[1] = 1; + data[2] = 2; + data[3] = 3; + ASSERT_TRUE(shalloc3.ChangeType(data_ref, 119, 911, false)); + EXPECT_EQ(0, data[0]); + EXPECT_EQ(1, data[1]); + EXPECT_EQ(2, data[2]); + EXPECT_EQ(3, data[3]); + ASSERT_TRUE(shalloc3.ChangeType(data_ref, 191, 119, true)); + EXPECT_EQ(0, data[0]); + EXPECT_EQ(0, data[1]); + EXPECT_EQ(0, data[2]); + EXPECT_EQ(0, data[3]); } @@ -676,7 +695,7 @@ r456 = local.Allocate(456, 456); r789 = local.Allocate(789, 789); local.MakeIterable(r123); - local.ChangeType(r456, 654, 456); + local.ChangeType(r456, 654, 456, false); local.MakeIterable(r789); local.GetMemoryInfo(&meminfo1); EXPECT_FALSE(local.IsFull());
diff --git a/base/metrics/persistent_sample_map.cc b/base/metrics/persistent_sample_map.cc index 131e47b6..51cc0c70 100644 --- a/base/metrics/persistent_sample_map.cc +++ b/base/metrics/persistent_sample_map.cc
@@ -165,7 +165,7 @@ PersistentMemoryAllocator* allocator, uint64_t sample_map_id, Sample value) { - SampleRecord* record = allocator->AllocateObject<SampleRecord>(); + SampleRecord* record = allocator->New<SampleRecord>(); if (!record) { NOTREACHED() << "full=" << allocator->IsFull() << ", corrupt=" << allocator->IsCorrupt();
diff --git a/base/security_unittest.cc b/base/security_unittest.cc index d88a2a2..c5fe9215 100644 --- a/base/security_unittest.cc +++ b/base/security_unittest.cc
@@ -94,7 +94,6 @@ #endif // Test array[TooBig][X] and array[X][TooBig] allocations for int overflows. // IOS doesn't honor nothrow, so disable the test there. -// Crashes on Windows Dbg builds, disable there as well. // Disabled on Linux because failing Linux Valgrind bot, and Valgrind exclusions // are not currently read. See http://crbug.com/582398 TEST(SecurityTest, MAYBE_NewOverflow) {
diff --git a/build/android/gradle/android.jinja b/build/android/gradle/android.jinja index 5d6949f..385d999d 100644 --- a/build/android/gradle/android.jinja +++ b/build/android/gradle/android.jinja
@@ -20,6 +20,11 @@ "{{ path }}", {% endfor %} ] + res.srcDirs = [ +{% for path in variables.res_dirs %} + "{{ path }}", +{% endfor %} + ] } {% endif %} {% endmacro %}
diff --git a/build/android/gradle/generate_gradle.py b/build/android/gradle/generate_gradle.py index 6e1ecb7e..fb30872 100755 --- a/build/android/gradle/generate_gradle.py +++ b/build/android/gradle/generate_gradle.py
@@ -34,6 +34,7 @@ _SRCJARS_SUBDIR = 'extracted-srcjars' _JNI_LIBS_SUBDIR = 'symlinked-libs' _ARMEABI_SUBDIR = 'armeabi' +_RES_SUBDIR = 'extracted-res' _DEFAULT_TARGETS = [ # TODO(agrieve): Requires alternate android.jar to compile. @@ -61,6 +62,8 @@ If new_cwd is not specified, absolute paths are returned. If old_cwd is not specified, constants.GetOutDirectory() is assumed. """ + if path_or_list is None: + return [] if not isinstance(path_or_list, basestring): return [_RebasePath(p, new_cwd, old_cwd) for p in path_or_list] if old_cwd is None: @@ -176,6 +179,9 @@ """Returns the target type from its .build_config.""" return self.DepsInfo()['type'] + def ResZips(self): + return self.DepsInfo().get('owned_resources_zips') + def JavaFiles(self): if self._java_files is None: java_sources_file = self.Gradle().get('java_sources_file') @@ -211,6 +217,12 @@ os.path.join(self.EntryOutputDir(entry), _SRCJARS_SUBDIR)) return java_dirs, excludes + def _GenResDirs(self, entry): + res_dirs = list(entry.DepsInfo().get('owned_resources_dirs', [])) + if entry.ResZips(): + res_dirs.append(os.path.join(self.EntryOutputDir(entry), _RES_SUBDIR)) + return res_dirs + def _Relativize(self, entry, paths): return _RebasePath(paths, self.EntryOutputDir(entry)) @@ -226,6 +238,7 @@ def GeneratedInputs(self, entry): generated_inputs = [] generated_inputs.extend(self.Srcjars(entry)) + generated_inputs.extend(_RebasePath(entry.ResZips())) generated_inputs.extend( p for p in entry.JavaFiles() if not p.startswith('..')) generated_inputs.extend(entry.Gradle()['dependent_prebuilt_jars']) @@ -241,6 +254,7 @@ variables['java_dirs'] = self._Relativize(entry, java_dirs) variables['java_excludes'] = excludes variables['jni_libs'] = self._Relativize(entry, self._GenJniLibs(entry)) + variables['res_dirs'] = self._Relativize(entry, self._GenResDirs(entry)) deps = [_ProjectEntry.FromBuildConfigPath(p) for p in entry.Gradle()['dependent_android_projects']] variables['android_project_deps'] = [d.ProjectName() for d in deps] @@ -436,17 +450,21 @@ return '\n'.join(lines) -def _ExtractSrcjars(entry_output_dir, srcjar_tuples): +def _ExtractFile(zip_path, extracted_path): + logging.info('Extracting %s to %s', zip_path, extracted_path) + with zipfile.ZipFile(zip_path) as z: + z.extractall(extracted_path) + + +def _ExtractZips(entry_output_dir, zip_tuples): """Extracts all srcjars to the directory given by the tuples.""" - extracted_paths = set(s[1] for s in srcjar_tuples) + extracted_paths = set(s[1] for s in zip_tuples) for extracted_path in extracted_paths: assert _IsSubpathOf(extracted_path, entry_output_dir) shutil.rmtree(extracted_path, True) - for srcjar_path, extracted_path in srcjar_tuples: - logging.info('Extracting %s to %s', srcjar_path, extracted_path) - with zipfile.ZipFile(srcjar_path) as z: - z.extractall(extracted_path) + for zip_path, extracted_path in zip_tuples: + _ExtractFile(zip_path, extracted_path) def _FindAllProjectEntries(main_entries): @@ -561,7 +579,7 @@ jinja_processor = jinja_template.JinjaProcessor(_FILE_DIR) build_vars = _ReadBuildVars(output_dir) project_entries = [] - srcjar_tuples = [] + zip_tuples = [] generated_inputs = [] for entry in entries: if entry.GetType() not in ('android_apk', 'java_library', 'java_binary'): @@ -572,9 +590,12 @@ project_entries.append(entry) # Build all paths references by .gradle that exist within output_dir. generated_inputs.extend(generator.GeneratedInputs(entry)) - srcjar_tuples.extend( + zip_tuples.extend( (s, os.path.join(generator.EntryOutputDir(entry), _SRCJARS_SUBDIR)) for s in generator.Srcjars(entry)) + zip_tuples.extend( + (s, os.path.join(generator.EntryOutputDir(entry), _RES_SUBDIR)) + for s in _RebasePath(entry.ResZips())) _WriteFile( os.path.join(generator.EntryOutputDir(entry), 'build.gradle'), data) @@ -593,8 +614,8 @@ targets = _RebasePath(generated_inputs, output_dir) _RunNinja(output_dir, targets) - if srcjar_tuples: - _ExtractSrcjars(generator.project_dir, srcjar_tuples) + if zip_tuples: + _ExtractZips(generator.project_dir, zip_tuples) logging.warning('Project created! (%d subprojects)', len(project_entries)) logging.warning('Generated projects work best with Android Studio 2.2')
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index e9e809a..20ad586 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni
@@ -87,7 +87,7 @@ # With instrumentation enabled, debug info puts libchrome.so over 4gb, which # causes the linker to produce an invalid ELF. http://crbug.com/574476 symbol_level = 0 - } else if (is_android && !is_component_build && !is_clang && + } else if (is_android && !is_component_build && !(android_64bit_target_cpu && !build_apk_secondary_abi)) { # Reduce symbol level when it will cause invalid elf files to be created # (due to file size). https://crbug.com/648948. @@ -116,7 +116,7 @@ # Assert that the configuration isn't going to hit https://crbug.com/648948. assert(ignore_elf32_limitations || !is_android || (android_64bit_target_cpu && !build_apk_secondary_abi) || - is_component_build || symbol_level < 2 || is_clang, + is_component_build || symbol_level < 2, "Android 32-bit non-component, non-clang builds cannot have " + "symbol_level=2 due to 4GiB file size limit, see " + "https://crbug.com/648948. If you really want to try this out, " +
diff --git a/build/linux/install-chromeos-fonts.py b/build/linux/install-chromeos-fonts.py index 61f7332..b9120847 100755 --- a/build/linux/install-chromeos-fonts.py +++ b/build/linux/install-chromeos-fonts.py
@@ -82,6 +82,36 @@ for file in files: os.chmod(os.path.join(base, file), 0644) + print """\ + +Chrome OS font rendering settings are specified using Fontconfig. If your +system's configuration doesn't match Chrome OS's (which vary for different +devices), fonts may be rendered with different subpixel rendering, subpixel +positioning, or hinting settings. This may affect font metrics. + +Chrome OS's settings are stored in the media-libs/fontconfig package, which is +at src/third_party/chromiumos-overlay/media-libs/fontconfig in a Chrome OS +checkout. You can configure your system to match Chrome OS's defaults by +creating or editing a ~/.fonts.conf file: + +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<fontconfig> + <match target="font"> + <edit name="antialias" mode="assign"><bool>true</bool></edit> + <edit name="autohint" mode="assign"><bool>true</bool></edit> + <edit name="hinting" mode="assign"><bool>true</bool></edit> + <edit name="hintstyle" mode="assign"><const>hintslight</const></edit> + <edit name="rgba" mode="assign"><const>rgb</const></edit> + </match> +</fontconfig> + +To load additional per-font configs (and assuming you have Chrome OS checked +out), add the following immediately before the "</fontconfig>" line: + + <include ignore_missing="yes">/path/to/src/third_party/chromiumos-overlay/media-libs/fontconfig/files/local.conf</include> +""" + return 0 if __name__ == '__main__':
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc index dce047c..4b54fbe7 100644 --- a/cc/resources/video_resource_updater_unittest.cc +++ b/cc/resources/video_resource_updater_unittest.cc
@@ -55,6 +55,11 @@ TestWebGraphicsContext3D::deleteTexture(texture); } + void deleteTextures(GLsizei count, const GLuint* ids) override { + created_texture_count_ -= count; + TestWebGraphicsContext3D::deleteTextures(count, ids); + } + int UploadCount() { return upload_count_; } void ResetUploadCount() { upload_count_ = 0; }
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc index 95222ed..e7848f80 100644 --- a/cc/surfaces/compositor_frame_sink_support.cc +++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -4,12 +4,17 @@ #include "cc/surfaces/compositor_frame_sink_support.h" +#include <algorithm> +#include <utility> +#include <vector> + #include "cc/output/compositor_frame.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/display.h" #include "cc/surfaces/surface.h" #include "cc/surfaces/surface_manager.h" +#include "cc/surfaces/surface_reference.h" namespace cc { @@ -25,6 +30,7 @@ display_begin_frame_source_(std::move(display_begin_frame_source)), display_(std::move(display)), surface_factory_(frame_sink_id_, surface_manager_, this), + reference_tracker_(frame_sink_id), weak_factory_(this) { surface_manager_->RegisterFrameSinkId(frame_sink_id_); surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); @@ -36,6 +42,12 @@ } CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { + // For display root surfaces, the surface is no longer going to be visible + // so make it unreachable from the top-level root. + if (surface_manager_->using_surface_references() && display_ && + reference_tracker_.current_surface_id().is_valid()) + RemoveTopLevelRootReference(reference_tracker_.current_surface_id()); + for (auto& child_frame_sink_id : child_frame_sinks_) { DCHECK(child_frame_sink_id.is_valid()); surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, @@ -62,14 +74,31 @@ const LocalSurfaceId& local_surface_id, CompositorFrame frame) { ++ack_pending_count_; - surface_factory_.SubmitCompositorFrame( - local_surface_id, std::move(frame), - base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, - weak_factory_.GetWeakPtr())); - if (display_) { - display_->SetLocalSurfaceId(local_surface_id, - frame.metadata.device_scale_factor); + float device_scale_factor = frame.metadata.device_scale_factor; + + if (surface_manager_->using_surface_references()) { + SurfaceId last_surface_id = reference_tracker_.current_surface_id(); + + // Populate list of surface references to add and remove based on reference + // surfaces in current frame compared with the last frame. + reference_tracker_.UpdateReferences(local_surface_id, + frame.metadata.referenced_surfaces); + + surface_factory_.SubmitCompositorFrame( + local_surface_id, std::move(frame), + base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, + weak_factory_.GetWeakPtr())); + + UpdateSurfaceReferences(last_surface_id, local_surface_id); + } else { + surface_factory_.SubmitCompositorFrame( + local_surface_id, std::move(frame), + base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, + weak_factory_.GetWeakPtr())); } + + if (display_) + display_->SetLocalSurfaceId(local_surface_id, device_scale_factor); } void CompositorFrameSinkSupport::Require(const LocalSurfaceId& local_surface_id, @@ -82,6 +111,51 @@ surface_manager_->SatisfySequence(sequence); } +void CompositorFrameSinkSupport::UpdateSurfaceReferences( + const SurfaceId& last_surface_id, + const LocalSurfaceId& local_surface_id) { + const bool surface_id_changed = + last_surface_id.local_surface_id() != local_surface_id; + + // If this is a display root surface and the SurfaceId is changing, make the + // new SurfaceId reachable from the top-level root. + if (display_ && surface_id_changed) + AddTopLevelRootReference(reference_tracker_.current_surface_id()); + + // Add references based on CompositorFrame referenced surfaces. If the + // SurfaceId has changed all referenced surfaces will be in this list. + if (!reference_tracker_.references_to_add().empty()) { + surface_manager_->AddSurfaceReferences( + reference_tracker_.references_to_add()); + } + + // If this is a display root surface and the SurfaceId is changing, make the + // old SurfaceId unreachable from the top-level root. This needs to happen + // after adding all references for the new SurfaceId. + if (display_ && surface_id_changed && last_surface_id.is_valid()) + RemoveTopLevelRootReference(last_surface_id); + + // Remove references based on CompositorFrame referenced surfaces. If the + // SurfaceId has changed this list will be empty. + if (!reference_tracker_.references_to_remove().empty()) { + DCHECK(!surface_id_changed); + surface_manager_->RemoveSurfaceReferences( + reference_tracker_.references_to_remove()); + } +} + +void CompositorFrameSinkSupport::AddTopLevelRootReference( + const SurfaceId& surface_id) { + SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); + surface_manager_->AddSurfaceReferences({reference}); +} + +void CompositorFrameSinkSupport::RemoveTopLevelRootReference( + const SurfaceId& surface_id) { + SurfaceReference reference(surface_manager_->GetRootSurfaceId(), surface_id); + surface_manager_->RemoveSurfaceReferences({reference}); +} + void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { DCHECK_GT(ack_pending_count_, 0); ack_pending_count_--;
diff --git a/cc/surfaces/compositor_frame_sink_support.h b/cc/surfaces/compositor_frame_sink_support.h index 8471bbd..7351723 100644 --- a/cc/surfaces/compositor_frame_sink_support.h +++ b/cc/surfaces/compositor_frame_sink_support.h
@@ -5,14 +5,19 @@ #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ +#include <memory> +#include <unordered_set> + #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "cc/output/compositor_frame.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_client.h" +#include "cc/surfaces/referenced_surface_tracker.h" #include "cc/surfaces/surface_factory.h" #include "cc/surfaces/surface_factory_client.h" +#include "cc/surfaces/surface_id.h" #include "cc/surfaces/surfaces_export.h" namespace cc { @@ -50,6 +55,16 @@ Display* display() { return display_.get(); } private: + // Update surface references with SurfaceManager for current CompositorFrame + // that has |local_surface_id|. UpdateReferences() must be called on + // |reference_tracker_| before calling this. Will add and remove top-level + // root references if |display_| is not null. + void UpdateSurfaceReferences(const SurfaceId& last_surface_id, + const LocalSurfaceId& local_surface_id); + + void AddTopLevelRootReference(const SurfaceId& surface_id); + void RemoveTopLevelRootReference(const SurfaceId& surface_id); + void DidReceiveCompositorFrameAck(); // DisplayClient implementation. @@ -101,6 +116,10 @@ // Whether or not a frame observer has been added. bool added_frame_observer_ = false; + // Track the surface references for the surface corresponding to this + // compositor frame sink. + ReferencedSurfaceTracker reference_tracker_; + // The set of BeginFrame children of this CompositorFrameSink. std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_;
diff --git a/cc/surfaces/referenced_surface_tracker.h b/cc/surfaces/referenced_surface_tracker.h index 395a853..bc6e9064 100644 --- a/cc/surfaces/referenced_surface_tracker.h +++ b/cc/surfaces/referenced_surface_tracker.h
@@ -26,11 +26,11 @@ const SurfaceId& current_surface_id() const { return current_surface_id_; } - std::vector<SurfaceReference>& references_to_add() { + const std::vector<SurfaceReference>& references_to_add() const { return references_to_add_; } - std::vector<SurfaceReference>& references_to_remove() { + const std::vector<SurfaceReference>& references_to_remove() const { return references_to_remove_; }
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h index f0e9630b..82ba742 100644 --- a/cc/surfaces/surface_manager.h +++ b/cc/surfaces/surface_manager.h
@@ -156,6 +156,10 @@ return reference_factory_; } + bool using_surface_references() const { + return lifetime_type_ == LifetimeType::REFERENCES; + } + private: friend class SurfaceManagerRefTest;
diff --git a/cc/test/test_gles2_interface.cc b/cc/test/test_gles2_interface.cc index 8a48d67..a744957e 100644 --- a/cc/test/test_gles2_interface.cc +++ b/cc/test/test_gles2_interface.cc
@@ -44,9 +44,7 @@ } void TestGLES2Interface::DeleteTextures(GLsizei n, const GLuint* textures) { - for (GLsizei i = 0; i < n; ++i) { - test_context_->deleteTexture(textures[i]); - } + test_context_->deleteTextures(n, textures); } void TestGLES2Interface::DeleteBuffers(GLsizei n, const GLuint* buffers) {
diff --git a/cc/test/test_gpu_memory_buffer_manager.cc b/cc/test/test_gpu_memory_buffer_manager.cc index fb6899f..47c2fae 100644 --- a/cc/test/test_gpu_memory_buffer_manager.cc +++ b/cc/test/test_gpu_memory_buffer_manager.cc
@@ -129,7 +129,10 @@ } TestGpuMemoryBufferManager::~TestGpuMemoryBufferManager() { - DCHECK(buffers_.empty()); + { + base::AutoLock hold(buffers_lock_); + DCHECK(buffers_.empty()); + } DCHECK(clients_.empty()); if (parent_gpu_memory_buffer_manager_) parent_gpu_memory_buffer_manager_->clients_.erase(client_id_); @@ -148,6 +151,7 @@ void TestGpuMemoryBufferManager::OnGpuMemoryBufferDestroyed( gfx::GpuMemoryBufferId gpu_memory_buffer_id) { + base::AutoLock hold(buffers_lock_); DCHECK(buffers_.find(gpu_memory_buffer_id.id) != buffers_.end()); buffers_.erase(gpu_memory_buffer_id.id); } @@ -168,6 +172,7 @@ this, last_gpu_memory_buffer_id_, size, format, std::move(shared_memory), 0, base::checked_cast<int>( gfx::RowSizeForBufferFormat(size.width(), format, 0)))); + base::AutoLock hold(buffers_lock_); buffers_[last_gpu_memory_buffer_id_] = result.get(); return result; }
diff --git a/cc/test/test_gpu_memory_buffer_manager.h b/cc/test/test_gpu_memory_buffer_manager.h index befa88f..0df87da6 100644 --- a/cc/test/test_gpu_memory_buffer_manager.h +++ b/cc/test/test_gpu_memory_buffer_manager.h
@@ -8,6 +8,7 @@ #include <memory> #include "base/macros.h" +#include "base/synchronization/lock.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" namespace cc { @@ -35,6 +36,8 @@ private: // Buffers allocated by this manager. int last_gpu_memory_buffer_id_ = 1000; + // Use of |buffers_| must be protected by the lock. + base::Lock buffers_lock_; std::map<int, gfx::GpuMemoryBuffer*> buffers_; // Parent information for child managers.
diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index c8d2191..b1a8ae3 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc
@@ -184,13 +184,13 @@ namespace_->textures.Append(ids[i], new TestTexture()); } -void TestWebGraphicsContext3D::deleteBuffers(GLsizei count, GLuint* ids) { +void TestWebGraphicsContext3D::deleteBuffers(GLsizei count, const GLuint* ids) { for (int i = 0; i < count; ++i) RetireBufferId(ids[i]); } -void TestWebGraphicsContext3D::deleteFramebuffers( - GLsizei count, GLuint* ids) { +void TestWebGraphicsContext3D::deleteFramebuffers(GLsizei count, + const GLuint* ids) { for (int i = 0; i < count; ++i) { if (ids[i]) { RetireFramebufferId(ids[i]); @@ -200,13 +200,14 @@ } } -void TestWebGraphicsContext3D::deleteRenderbuffers( - GLsizei count, GLuint* ids) { +void TestWebGraphicsContext3D::deleteRenderbuffers(GLsizei count, + const GLuint* ids) { for (int i = 0; i < count; ++i) RetireRenderbufferId(ids[i]); } -void TestWebGraphicsContext3D::deleteTextures(GLsizei count, GLuint* ids) { +void TestWebGraphicsContext3D::deleteTextures(GLsizei count, + const GLuint* ids) { for (int i = 0; i < count; ++i) RetireTextureId(ids[i]); base::AutoLock lock(namespace_->lock);
diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index bf6cd1b..e7790d8c 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h
@@ -130,10 +130,10 @@ virtual void genRenderbuffers(GLsizei count, GLuint* ids); virtual void genTextures(GLsizei count, GLuint* ids); - virtual void deleteBuffers(GLsizei count, GLuint* ids); - virtual void deleteFramebuffers(GLsizei count, GLuint* ids); - virtual void deleteRenderbuffers(GLsizei count, GLuint* ids); - virtual void deleteTextures(GLsizei count, GLuint* ids); + virtual void deleteBuffers(GLsizei count, const GLuint* ids); + virtual void deleteFramebuffers(GLsizei count, const GLuint* ids); + virtual void deleteRenderbuffers(GLsizei count, const GLuint* ids); + virtual void deleteTextures(GLsizei count, const GLuint* ids); virtual GLuint createBuffer(); virtual GLuint createFramebuffer();
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index cf8b1cd11..201c30f 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -814,6 +814,11 @@ base::Unretained(this))); break; case 1: + // Copy requests cause a followup commit and draw without the separate + // RenderPass required. This changes the number of active textures. So + // wait for that draw before counting textures and proceeding. + break; + case 2: // We did a readback, so there will be a readback texture around now. num_textures_after_readback_ = display_context_provider_->TestContext3d()->NumTextures(); @@ -1261,13 +1266,12 @@ // End the test! Don't race with copy request callbacks, so post the end // to the main thread. - draw_happened_ = true; MainThreadTaskRunner()->PostTask( FROM_HERE, base::Bind( &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest:: TryEndTest, - base::Unretained(this))); + base::Unretained(this), WhatHappened::DRAW)); break; } return draw_result; @@ -1275,11 +1279,23 @@ void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) { EXPECT_FALSE(TestEnded()); - copy_happened_ = true; - TryEndTest(); + TryEndTest(WhatHappened::COPY); } - void TryEndTest() { + enum class WhatHappened { + DRAW, + COPY, + }; + + void TryEndTest(WhatHappened what) { + switch (what) { + case WhatHappened::DRAW: + draw_happened_ = true; + break; + case WhatHappened::COPY: + copy_happened_ = true; + break; + } if (draw_happened_ && copy_happened_) EndTest(); }
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 3e696f0e..1a2185f 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -909,7 +909,11 @@ script = "//chrome/tools/build/mac/copy_keystone_framework.py" framework_path = "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" - output_path = "$root_out_dir/$chrome_framework_name.framework/Frameworks/" + output_path = "$root_out_dir/$chrome_framework_name.framework/" + if (defined(chrome_framework_version)) { + output_path += "/Versions/$chrome_framework_version/" + } + output_path += "Frameworks/" sources = [ framework_path, @@ -1013,7 +1017,10 @@ ] if (is_chrome_branded) { - framework_contents += [ "Default Apps" ] + framework_contents += [ + "Default Apps", + "Frameworks", # For KeystoneRegistration.framework. + ] } if (enable_nacl) { framework_contents += [ "Internet Plug-Ins" ]
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java index a5b974f..c8356b73 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -404,8 +404,17 @@ ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int maxInnerSize = Math.round(am.getLauncherLargeIconSize() * MAX_INNER_SIZE_RATIO); int innerSize = Math.min(maxInnerSize, Math.max(webIcon.getWidth(), webIcon.getHeight())); - int padding = Math.round(ICON_PADDING_RATIO * innerSize); - int outerSize = innerSize + 2 * padding; + + int outerSize = innerSize; + Rect innerBounds = new Rect(0, 0, innerSize, innerSize); + + // Draw the icon with padding around it if all four corners are not transparent. Otherwise, + // don't add padding. + if (shouldPadIcon(webIcon)) { + int padding = Math.round(ICON_PADDING_RATIO * innerSize); + outerSize += 2 * padding; + innerBounds.offset(padding, padding); + } Bitmap bitmap = null; try { @@ -418,15 +427,6 @@ Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setFilterBitmap(true); - Rect innerBounds; - - // Draw the icon with padding around it if all four corners are not transparent. Otherwise, - // don't add padding. - if (shouldPadIcon(webIcon)) { - innerBounds = new Rect(padding, padding, outerSize - padding, outerSize - padding); - } else { - innerBounds = new Rect(0, 0, outerSize, outerSize); - } canvas.drawBitmap(webIcon, null, innerBounds, paint); return bitmap;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotificationHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotificationHelper.java index 2a28c690..9d7fe784 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotificationHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotificationHelper.java
@@ -364,10 +364,23 @@ SharedPreferences prefs = ContextUtils.getAppSharedPreferences(); int currentValue = prefs.getInt(prefName, 0); - int consecutiveIgnored = 0; - if (action != ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_TAP) { - consecutiveIgnored = 1 + prefs.getInt(PREF_CACHED_CONSECUTIVE_IGNORED, 0); + + int consecutiveIgnored = prefs.getInt(PREF_CACHED_CONSECUTIVE_IGNORED, 0); + switch (action) { + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_TAP: + consecutiveIgnored = 0; + break; + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_DISMISSAL: + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_HIDE_DEADLINE: + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_HIDE_EXPIRY: + ++consecutiveIgnored; + break; + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_HIDE_FRONTMOST: + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_HIDE_DISABLED: + case ContentSuggestionsNotificationAction.CONTENT_SUGGESTIONS_HIDE_SHUTDOWN: + break; // no change } + prefs.edit() .putInt(prefName, currentValue + 1) .putInt(PREF_CACHED_CONSECUTIVE_IGNORED, consecutiveIgnored)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index 2d18e5fd..e5073c7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -297,6 +297,9 @@ private TabModelSelector mObservedTabModelSelector; private TabModel mObservedTabModel; + /** Aborts should only be recorded if the Payment Request was shown to the user. */ + private boolean mShouldRecordAbortReason; + /** True if any of the requested payment methods are supported. */ private boolean mArePaymentMethodsSupported; @@ -532,8 +535,7 @@ buildUI(chromeActivity); if (!mShouldSkipShowingPaymentRequestUi) mUI.show(); - recordSuccessFunnelHistograms("Shown"); - mJourneyLogger.setShowCalled(); + triggerPaymentAppUiSkipIfApplicable(); } @@ -543,6 +545,11 @@ if (mShouldSkipShowingPaymentRequestUi && isFinishedQueryingPaymentApps() && getIsShowing()) { assert !mPaymentMethodsSection.isEmpty(); + + recordSuccessFunnelHistograms("Shown"); + mShouldRecordAbortReason = true; + mJourneyLogger.setShowCalled(); + onPayClicked(null /* selectedShippingAddress */, null /* selectedShippingOption */, mPaymentMethodsSection.getItem(0)); } @@ -816,6 +823,10 @@ new PaymentInformation(mUiShoppingCart, mShippingAddressesSection, mUiShippingOptions, mContactSection, mPaymentMethodsSection)); mPaymentInformationCallback = null; + + recordSuccessFunnelHistograms("Shown"); + mShouldRecordAbortReason = true; + mJourneyLogger.setShowCalled(); } @Override @@ -1396,9 +1407,9 @@ // must be rejected. disconnectFromClientWithDebugMessage("Requested payment methods have no instruments", PaymentErrorReason.NOT_SUPPORTED); - recordAbortReasonHistogram(mArePaymentMethodsSupported - ? PaymentRequestMetrics.ABORT_REASON_NO_MATCHING_PAYMENT_METHOD - : PaymentRequestMetrics.ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD); + recordNoShowReasonHistogram(mArePaymentMethodsSupported + ? PaymentRequestMetrics.NO_SHOW_NO_MATCHING_PAYMENT_METHOD + : PaymentRequestMetrics.NO_SHOW_NO_SUPPORTED_PAYMENT_METHOD); if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); return true; } @@ -1568,7 +1579,7 @@ */ private void recordAbortReasonHistogram(int abortReason) { assert abortReason < PaymentRequestMetrics.ABORT_REASON_MAX; - if (mHasRecordedAbortReason) return; + if (mHasRecordedAbortReason || !mShouldRecordAbortReason) return; mHasRecordedAbortReason = true; RecordHistogram.recordEnumeratedHistogram( @@ -1583,6 +1594,17 @@ } /** + * Adds an entry to the NoShow Payment Request histogram in the bucket corresponding to the + * reason for not showing the Payment Request. + */ + private void recordNoShowReasonHistogram(int reason) { + assert reason < PaymentRequestMetrics.NO_SHOW_REASON_MAX; + + RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CheckoutFunnel.NoShow", reason, + PaymentRequestMetrics.NO_SHOW_REASON_MAX); + } + + /** * Compares two payment instruments by frecency. * Return negative value if a has strictly lower frecency score than b. * Return zero if a and b have the same frecency score.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java index 05c1d5e..1c81ecc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java
@@ -21,10 +21,10 @@ public static final int CAN_MAKE_PAYMENT_NOT_USED = 1; public static final int CAN_MAKE_PAYMENT_USE_MAX = 2; - // Used to log CanMakePayment's effect on whether the transaction was completed. - public static final int CMP_EFFECT_ON_COMPLETION_COMPLETED = 0; - public static final int CMP_EFFECT_ON_COMPLETION_ABORTED = 1; - public static final int CMP_EFFECT_ON_COMPLETION_MAX = 2; + // Used to log different parameters' effect on whether the transaction was completed. + public static final int COMPLETION_STATUS_COMPLETED = 0; + public static final int COMPLETION_STATUS_ABORTED = 1; + public static final int COMPLETION_STATUS_MAX = 2; // Used to mesure the impact of the CanMakePayment return value on whether the Payment Request // is shown to the user. @@ -131,9 +131,8 @@ // Record the CanMakePayment metrics based on whether the transaction was completed or // aborted by the user (UserAborted) or otherwise (OtherAborted). - recordCanMakePaymentStats(submissionType.contains("Abort") - ? CMP_EFFECT_ON_COMPLETION_ABORTED - : CMP_EFFECT_ON_COMPLETION_COMPLETED); + recordCanMakePaymentStats(submissionType.contains("Abort") ? COMPLETION_STATUS_ABORTED + : COMPLETION_STATUS_COMPLETED); } /** @@ -142,6 +141,9 @@ * @param submissionType A string indicating the way the payment request was concluded. */ private void recordSectionSpecificStats(String submissionType) { + // Record whether the user had suggestions for each requested information. + boolean userHadAllRequestedInformation = true; + for (int i = 0; i < mSections.length; ++i) { String nameSuffix = ""; switch (i) { @@ -178,8 +180,26 @@ "PaymentRequest.NumberOfSuggestionsShown." + nameSuffix, Math.min(mSections[i].mNumberSuggestionsShown, MAX_EXPECTED_SAMPLE), MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS); + + if (mSections[i].mNumberSuggestionsShown == 0) { + userHadAllRequestedInformation = false; + } } } + + // Record metrics about completion based on whether the user had suggestions for each + // requested information. + int completionStatus = submissionType.contains("Abort") ? COMPLETION_STATUS_ABORTED + : COMPLETION_STATUS_COMPLETED; + if (userHadAllRequestedInformation) { + RecordHistogram.recordEnumeratedHistogram( + "PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion", + completionStatus, COMPLETION_STATUS_MAX); + } else { + RecordHistogram.recordEnumeratedHistogram( + "PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion", + completionStatus, COMPLETION_STATUS_MAX); + } } /** @@ -231,6 +251,6 @@ } RecordHistogram.recordEnumeratedHistogram( - histogramName, completionStatus, CMP_EFFECT_ON_COMPLETION_MAX); + histogramName, completionStatus, COMPLETION_STATUS_MAX); } } \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java index 2cf087ed..709855b1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java
@@ -40,14 +40,22 @@ @VisibleForTesting public static final int ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5; @VisibleForTesting - public static final int ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6; + public static final int ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6; // Deprecated. @VisibleForTesting - public static final int ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7; + public static final int ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7; // Deprecated. @VisibleForTesting public static final int ABORT_REASON_OTHER = 8; @VisibleForTesting public static final int ABORT_REASON_MAX = 9; + // PaymentRequestNoShowReason defined in tools/metrics/histograms/histograms.xml + @VisibleForTesting + public static final int NO_SHOW_NO_MATCHING_PAYMENT_METHOD = 0; + @VisibleForTesting + public static final int NO_SHOW_NO_SUPPORTED_PAYMENT_METHOD = 1; + @VisibleForTesting + public static final int NO_SHOW_REASON_MAX = 2; + // PaymentRequestPaymentMethods defined in tools/metrics/histograms/histograms.xml. @VisibleForTesting public static final int SELECTED_METHOD_CREDIT_CARD = 0;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/push_messaging/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/push_messaging/OWNERS index 59870a7f..4898e44 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/push_messaging/OWNERS +++ b/chrome/android/java/src/org/chromium/chrome/browser/push_messaging/OWNERS
@@ -1 +1,4 @@ -file://content/browser/push_messaging/OWNERS \ No newline at end of file +file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java index 3043369..6d0324a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java
@@ -72,7 +72,7 @@ assertEquals( 1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -113,7 +113,7 @@ assertEquals( 1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -157,7 +157,7 @@ // the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -191,7 +191,7 @@ // the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -225,7 +225,7 @@ // shown to the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -252,6 +252,6 @@ // shown to the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java index a52d8eb..8d619d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java
@@ -352,4 +352,27 @@ 2, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.NumberOfSelectionEdits.ShippingAddress.Completed", 0)); } + + /** + * Expect that no journey metrics are logged if the payment request was not shown to the user. + */ + @MediumTest + @Feature({"Payments"}) + public void testNoShow() throws InterruptedException, ExecutionException, TimeoutException { + // Android Pay is supported but no instruments are present. + installPaymentApp("https://android.com/pay", NO_INSTRUMENTS, DELAYED_RESPONSE); + openPageAndClickNodeAndWait("androidPayBuy", mShowFailed); + expectResultContains(new String[] {"The payment method is not supported"}); + + // Make sure that no journey metrics were logged. + assertEquals(0, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.NumberOfSuggestionsShown.ShippingAddress.UserAborted", 2)); + assertEquals(0, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.NumberOfSuggestionsShown.ShippingAddress.OtherAborted", 2)); + assertEquals( + 0, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.NumberOfSuggestionsShown.ShippingAddress.Completed", 2)); + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerUnitTest.java index 9cf6fd3..b0291172 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerUnitTest.java
@@ -42,10 +42,10 @@ // There should be no completion stats since PR was not shown to the user assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -72,7 +72,7 @@ // to the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -99,7 +99,7 @@ // shown to the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -130,10 +130,10 @@ // There should be no completion stats since PR was not shown to the user. assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -163,10 +163,10 @@ // There should be no completion stats since PR was not shown to the user. assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -199,7 +199,7 @@ assertEquals( 1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -232,7 +232,7 @@ assertEquals( 1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); } /** @@ -265,7 +265,7 @@ // the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_ABORTED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -298,7 +298,111 @@ // to the user. assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", - PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_COMPLETED)); + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); + } + + /** + * Tests that the completion status metrics based on whether the user had suggestions for all + * the requested sections are logged as correctly. + */ + @SmallTest + @Feature({"Payments"}) + public void testRecordJourneyStatsHistograms_SuggestionsForEverything_Completed() { + PaymentRequestJourneyLogger logger = new PaymentRequestJourneyLogger(); + + // Simulate that the user had suggestions for all the requested sections. + logger.setNumberOfSuggestionsShown(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS, 1); + + // Simulate that the user completes the checkout. + logger.recordJourneyStatsHistograms("Completed"); + + // Make sure the appropriate metric was logged. + assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); + + assertEquals(0, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); + } + + /** + * Tests that the completion status metrics based on whether the user had suggestions for all + * the requested sections are logged as correctly. + */ + @SmallTest + @Feature({"Payments"}) + public void testRecordJourneyStatsHistograms_SuggestionsForEverything_Aborted() { + PaymentRequestJourneyLogger logger = new PaymentRequestJourneyLogger(); + + // Simulate that the user had suggestions for all the requested sections. + logger.setNumberOfSuggestionsShown(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS, 1); + + // Simulate that the user aborts the checkout. + logger.recordJourneyStatsHistograms("Aborted"); + + // Make sure the appropriate metric was logged. + assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); + + assertEquals(0, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); + } + + /** + * Tests that the completion status metrics based on whether the user had suggestions for all + * the requested sections are logged as correctly. + */ + @SmallTest + @Feature({"Payments"}) + public void testRecordJourneyStatsHistograms_NoSuggestionsForEverything_Completed() { + PaymentRequestJourneyLogger logger = new PaymentRequestJourneyLogger(); + + // Simulate that the user did not have suggestions for all the requested sections. + logger.setNumberOfSuggestionsShown(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS, 0); + + // Simulate that the user completes the checkout. + logger.recordJourneyStatsHistograms("Completed"); + + // Make sure the appropriate metric was logged. + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); + + assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_COMPLETED)); + } + + /** + * Tests that the completion status metrics based on whether the user had suggestions for all + * the requested sections are logged as correctly. + */ + @SmallTest + @Feature({"Payments"}) + public void testRecordJourneyStatsHistograms_NoSuggestionsForEverything_Aborted() { + PaymentRequestJourneyLogger logger = new PaymentRequestJourneyLogger(); + + // Simulate that the user had suggestions for all the requested sections. + logger.setNumberOfSuggestionsShown(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS, 0); + + // Simulate that the user aborts the checkout. + logger.recordJourneyStatsHistograms("Aborted"); + + // Make sure the appropriate metric was logged. + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); + + assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion", + PaymentRequestJourneyLogger.COMPLETION_STATUS_ABORTED)); } /** @@ -318,7 +422,7 @@ } // Effect on completion stats. - for (int i = 0; i < PaymentRequestJourneyLogger.CMP_EFFECT_ON_COMPLETION_MAX; ++i) { + for (int i = 0; i < PaymentRequestJourneyLogger.COMPLETION_STATUS_MAX; ++i) { assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", i));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java index 5bba6010..cd4b3e63 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMetricsTest.java
@@ -183,37 +183,48 @@ } /** - * Expect only the ABORT_REASON_NO_MATCHING_PAYMENT_METHOD enum value gets logged when a Payment - * Request gets cancelled because the user does not have any of the payment methods accepted by - * the merchant and the merchant does not accept credit cards. + * Expect no abort metrics to be logged even if there are no matching payment methods because + * the Payment Request was not shown to the user (a Payment Request gets cancelled because the + * user does not have any of the payment methods accepted by the merchant and the merchant does + * not accept credit cards). It should instead be logged as a reason why the Payment Request was + * not shown to the user. */ @MediumTest @Feature({"Payments"}) - public void testAbortMetrics_NoMatchingPaymentMethod() throws InterruptedException, - ExecutionException, TimeoutException { + public void testMetrics_NoMatchingPaymentMethod() + throws InterruptedException, ExecutionException, TimeoutException { // Android Pay is supported but no instruments are present. installPaymentApp("https://android.com/pay", NO_INSTRUMENTS, DELAYED_RESPONSE); openPageAndClickNodeAndWait("androidPayBuy", mShowFailed); expectResultContains(new String[] {"The payment method is not supported"}); - assertOnlySpecificAbortMetricLogged( - PaymentRequestMetrics.ABORT_REASON_NO_MATCHING_PAYMENT_METHOD); + // Make sure that it is not logged as an abort. + assertOnlySpecificAbortMetricLogged(-1 /* none */); + // Make sure that it was logged as a reason why the Payment Request was not shown. + assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.CheckoutFunnel.NoShow", + PaymentRequestMetrics.NO_SHOW_NO_MATCHING_PAYMENT_METHOD)); } /** - * Expect only the ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD enum value gets logged when a - * Payment Request gets cancelled because the merchant only accepts payment methods we don't - * support. + * Expect no abort metrics to be logged even if there are no matching payment methods because + * the Payment Request was not shown to the user (a Payment Request gets cancelled because the + * merchant only accepts payment methods we don't support. It should instead be logged as a + * reason why the Payment Request was not shown to the user. */ @MediumTest @Feature({"Payments"}) - public void testAbortMetrics_NoSupportedPaymentMethod() throws InterruptedException, - ExecutionException, TimeoutException { + public void testMetrics_NoSupportedPaymentMethod() + throws InterruptedException, ExecutionException, TimeoutException { openPageAndClickNodeAndWait("noSupported", mShowFailed); expectResultContains(new String[] {"The payment method is not supported"}); - assertOnlySpecificAbortMetricLogged( - PaymentRequestMetrics.ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD); + // Make sure that it is not logged as an abort. + assertOnlySpecificAbortMetricLogged(-1 /* none */); + // Make sure that it was logged as a reason why the Payment Request was not shown. + assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.CheckoutFunnel.NoShow", + PaymentRequestMetrics.NO_SHOW_NO_SUPPORTED_PAYMENT_METHOD)); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/OWNERS b/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/OWNERS index 59870a7f..4898e44 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/OWNERS +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/OWNERS
@@ -1 +1,4 @@ -file://content/browser/push_messaging/OWNERS \ No newline at end of file +file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 27375d2..2bdd423 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -299,9 +299,6 @@ <message name="IDS_WEBSITE_SETTINGS_TYPE_BACKGROUND_SYNC" desc="The label used for the background sync permission controls in the Website Settings popup."> Background Sync </message> - <message name="IDS_WEBSITE_SETTINGS_TYPE_BATTERY" desc="The label used for the battery consumption type in the Manage Sites settings."> - Battery - </message> <message name="IDS_WEBSITE_SETTINGS_TYPE_IMAGES" desc="The label used for images permission controls in the Website Settings popup."> Images </message> @@ -320,12 +317,6 @@ <message name="IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS" desc="The label used for notifications permission controls in the Website Settings popup."> Notifications </message> - <message name="IDS_WEBSITE_SETTINGS_TYPE_FULLSCREEN" desc="The label used for fullscreen permission controls in the Website Settings popup."> - Full screen - </message> - <message name="IDS_WEBSITE_SETTINGS_TYPE_MOUSELOCK" desc="The label used for mouse lock permission controls in the Website Settings popup."> - Mouse Lock - </message> <message name="IDS_WEBSITE_SETTINGS_TYPE_MIC" desc="The label used for the microphone permission controls in the Website Settings popup."> Microphone </message> @@ -335,33 +326,6 @@ <message name="IDS_WEBSITE_SETTINGS_TYPE_MIDI_SYSEX" desc="The label used for MIDI system exclusive message permission controls in the Website Settings popup."> MIDI devices full control </message> - <message name="IDS_WEBSITE_SETTINGS_TYPE_STORAGE" desc="The label used for the local storage type in the Manage Sites settings."> - Storage - </message> - <message name="IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION" desc="The label of the connection tab of the Website Settings popup."> - Connection - </message> - <message name="IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS" desc="The label of the permissions tab of the Website Settings popup."> - Permissions - </message> - <message name="IDS_WEBSITE_DEPRECATED_SIGNATURE_ALGORITHM" desc="Text that is displayed in the header of the Website Settings popup if the website uses SHA-1 for certificate signatures, which are no longer considered secure."> - This site uses a weak security configuration (SHA-1 signatures), so your connection may not be private. - </message> - <message name="IDS_WEBSITE_SETTINGS_UNKNOWN_TRANSPORT" desc="Text that is displayed in the header of the Website Settings popup if Chrome cannot determine what kind of transport the website used. This string must be the same as IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT."> - Your connection to this site is not private. - </message> - <message name="IDS_WEBSITE_SETTINGS_DETAILS_LINK" desc="Link in the Website Settings that opens up additional security details about the current page in the DevTools Security panel."> - Details - </message> - <message name="IDS_WEBSITE_SETTINGS_BROKEN_TRANSPORT" desc="Text that is displayed in the header of the Website Settings popup if the website uses nominally secure transport that had authentication or other cryptpgraphic errors."> - Your connection to this site is not private. Attackers might be trying to steal your information (for example, photos, passwords, messages and credit cards) from <ph name="DOMAIN">$1<ex>www.example.com</ex></ph>. - </message> - <message name="IDS_WEBSITE_SETTINGS_INSECURE_ACTIVE_CONTENT" desc="Text that is displayed in the header of the Website Settings popup if the website uses secure transport but included script over non-secure transport."> - Your connection to this site is not private because the site loaded an insecure script. - </message> - <message name="IDS_WEBSITE_SETTINGS_INSECURE_PASSIVE_CONTENT" desc="Text that is displayed in the header of the Website Settings popup if the website uses secure transport but included passive resources (e.g. images) over non-secure transport."> - Your connection to this site is private, but someone on the network might be able to change the look of the page. - </message> <message name="IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT" desc="Text that is displayed temporarily as a large toast on first entering a WebVR page over non-secure transport."> Your connection to this site is not private. To exit VR mode at any time, remove headset and press back. </message> @@ -389,9 +353,6 @@ <message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to allow."> Always block on this site </message> - <message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_ASK" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to ask."> - Always ask on this site - </message> <message name="IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT" desc="The text of the menu item of a permissions menu on the Website Settings UI that sets the setting to detect important content."> Always detect important content on this site </message> @@ -405,9 +366,6 @@ <message name="IDS_PERMISSION_ALLOW" desc="Label on button to allow a permissions request."> Allow </message> - <message name="IDS_PERMISSION_ALLOW_COMBOBOX" desc="Label on combobox to allow the user to either allow all or customize."> - Allow all or customize - </message> <message name="IDS_PERMISSION_DENY" desc="Label on button to deny a permissions request."> Block </message> @@ -552,9 +510,6 @@ <message name="IDS_CONTENT_CONTEXT_RELOADFRAME" desc="The name of the Reload Frame command in the content area context menu"> Reload &frame </message> - <message name="IDS_CONTENT_CONTEXT_PRINTFRAME" desc="The name of the Print Frame command in the content area context menu"> - &Print frame... - </message> <message name="IDS_CONTENT_CONTEXT_VIEWFRAMESOURCE" desc="The name of the View Frame Source command in the content area context menu"> &View frame source </message> @@ -618,18 +573,6 @@ <message name="IDS_CONTENT_CONTEXT_LOOP" desc="The name of the Loop command for audio and video playback in the content area context menu"> &Loop </message> - <message name="IDS_CONTENT_CONTEXT_PLAY" desc="The name of the Play command for audio and video playback in the content area context menu"> - &Play - </message> - <message name="IDS_CONTENT_CONTEXT_PAUSE" desc="The name of the Pause command for audio and video playback in the content area context menu"> - &Pause - </message> - <message name="IDS_CONTENT_CONTEXT_MUTE" desc="The name of the Mute command for audio and video playback in the content area context menu"> - &Mute - </message> - <message name="IDS_CONTENT_CONTEXT_UNMUTE" desc="The name of the Unmute command for audio and video playback in the content area context menu"> - Un&mute - </message> <message name="IDS_CONTENT_CONTEXT_CONTROLS" desc="The name of the Show Controls command for audio and video playback in the content area context menu"> Show &controls </message> @@ -690,9 +633,6 @@ <message name="IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY" desc="The name of the Add to dictionary command in the content area context menu"> &Add to dictionary </message> - <message name="IDS_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS" desc="The name of the No Spelling Suggestions display in the content area context menu"> - &No spelling suggestions - </message> <message name="IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE" desc="The context-menu item that asks whether to integrate the spelling service of Google to Chrome. This text is also used as the title of a bubble which confirms it."> Ask Google for suggestions </message> @@ -777,9 +717,6 @@ <message name="IDS_CONTENT_CONTEXT_RELOADFRAME" desc="In Title Case: The name of the Reload Frame command in the content area context menu"> Reload &Frame </message> - <message name="IDS_CONTENT_CONTEXT_PRINTFRAME" desc="In Title Case: The name of the Print Frame command in the content area context menu"> - &Print Frame... - </message> <message name="IDS_CONTENT_CONTEXT_VIEWFRAMESOURCE" desc="In Title Case: The name of the View Frame Source command in the content area context menu"> &View Frame Source </message> @@ -843,18 +780,6 @@ <message name="IDS_CONTENT_CONTEXT_LOOP" desc="In Title Case: The name of the Loop command for audio and video playback in the content area context menu"> &Loop </message> - <message name="IDS_CONTENT_CONTEXT_PLAY" desc="In Title Case: The name of the Play command for audio and video playback in the content area context menu"> - &Play - </message> - <message name="IDS_CONTENT_CONTEXT_PAUSE" desc="In Title Case: The name of the Pause command for audio and video playback in the content area context menu"> - &Pause - </message> - <message name="IDS_CONTENT_CONTEXT_MUTE" desc="In Title Case: The name of the Mute command for audio and video playback in the content area context menu"> - &Mute - </message> - <message name="IDS_CONTENT_CONTEXT_UNMUTE" desc="In Title Case: The name of the Unmute command for audio and video playback in the content area context menu"> - Un&mute - </message> <message name="IDS_CONTENT_CONTEXT_CONTROLS" desc="In Title Case: The name of the Show Controls command for audio and video playback in the content area context menu"> Show &Controls </message> @@ -926,9 +851,6 @@ <message name="IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY" desc="In Title Case: The name of the Add to dictionary command in the content area context menu"> &Add to Dictionary </message> - <message name="IDS_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS" desc="In Title Case: The name of the No Spelling Suggestions display in the content area context menu"> - &No Spelling Suggestions - </message> <message name="IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE" desc="In Title Case: The context-menu item that asks whether to integrate the spelling service of Google to Chrome. This text is also used as the title of a bubble which confirms it."> Ask Google for Suggestions </message> @@ -1036,11 +958,6 @@ <message name="IDS_PIN_TO_START_SCREEN" desc="The text label of the Pin to start screen menu item"> Pin this page to Start screen... </message> - <if expr="is_win"> - <message name="IDS_UNPIN_FROM_START_SCREEN" desc="The text label of the unpin from start screen menu item"> - Unpin this page from Start screen... - </message> - </if> <message name="IDS_EDIT2" desc="The text label before the cut/copy/paste buttons in the merged menu"> Edit </message> @@ -1176,67 +1093,6 @@ Make Text Smaller </message> - <message name="IDS_ENCODING_DISPLAY_TEMPLATE" desc="The format of encodings in the encoding menu. Encoding categories are Unicode, Western, Turkish, Cyrillic, Chinese Simplified, Thai, Arabic, Hebrew and so forth. Encoding names are UTF-8, Windows-1252, ISO-8859-8, GB2312, etc."> - <ph name="ENCODING_CATEGORY">$1<ex>Japanese</ex></ph> (<ph name="ENCODING_NAME">$2<ex>Shift_JIS</ex></ph>) - </message> - <message name="IDS_ENCODING_UNICODE" desc="The text label of Unicode encodings"> - Unicode - </message> - <message name="IDS_ENCODING_WESTERN" desc="The text label of West European character encoding"> - Western - </message> - <message name="IDS_ENCODING_SIMP_CHINESE" desc="The text label of Simplified Chinese encodings"> - Chinese Simplified - </message> - <message name="IDS_ENCODING_TRAD_CHINESE" desc="The text label of Traditional Chinese encodings"> - Chinese Traditional - </message> - <message name="IDS_ENCODING_KOREAN" desc="The text label of Korean encoding"> - Korean - </message> - <message name="IDS_ENCODING_JAPANESE" desc="The text label of Japanese encodings"> - Japanese - </message> - <message name="IDS_ENCODING_THAI" desc="The text label of encoding thai language"> - Thai - </message> - <message name="IDS_ENCODING_CENTRAL_EUROPEAN" desc="The text label of encoding Central European"> - Central European - </message> - <message name="IDS_ENCODING_CYRILLIC" desc="The text label of Cyrillic encodings"> - Cyrillic - </message> - <message name="IDS_ENCODING_GREEK" desc="The text label of Greek encodings"> - Greek - </message> - <message name="IDS_ENCODING_BALTIC" desc="The text label of Baltic encodings"> - Baltic - </message> - <message name="IDS_ENCODING_SOUTH_EUROPEAN" desc="The text label of South European encodings"> - South European - </message> - <message name="IDS_ENCODING_NORDIC" desc="The text label of Nordic encoding"> - Nordic - </message> - <message name="IDS_ENCODING_CELTIC" desc="The text label of Celtic encodings"> - Celtic - </message> - <message name="IDS_ENCODING_ROMANIAN" desc="The text label of Romanian encoding"> - Romanian - </message> - <message name="IDS_ENCODING_TURKISH" desc="The text label of Turkish encodings"> - Turkish - </message> - <message name="IDS_ENCODING_ARABIC" desc="The text label of Arabic encodings"> - Arabic - </message> - <message name="IDS_ENCODING_HEBREW" desc="The text label of Hebrew encodings"> - Hebrew - </message> - <message name="IDS_ENCODING_VIETNAMESE" desc="The text label of Vietnamese encoding"> - Vietnamese - </message> - <if expr="not use_titlecase"> <message name="IDS_VIEW_SOURCE" desc="The text label of the View Page Source menu item"> View s&ource @@ -1718,9 +1574,6 @@ <message name="IDS_DOWNLOAD_STATUS_INTERRUPTED" desc="Status text for a download item that was interrupted."> Failed - <ph name="INTERRUPT_REASON">$1<ex>Disk full</ex></ph> </message> - <message name="IDS_DOWNLOAD_STATUS_COMPLETED" desc="Status text for download item that was completed."> - Completed - </message> <message name="IDS_DOWNLOAD_UNCONFIRMED_PREFIX" desc="The prefix used in the unconfirmed download file."> Unconfirmed </message> @@ -2497,9 +2350,6 @@ </message> <!-- Administrator-provided certificate notifications --> - <message name="IDS_CERT_POLICY_PROVIDED_CERT_HEADER" desc="Text that is displayed in the header of the Website Settings popup when using an administrator-provided certificate"> - Using an administrator-provided certificate - </message> <message name="IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE" desc="Text that is displayed in the Website Settings popup when using an administrator-provided certificate"> You have accessed content using an administrator-provided certificate. Data you provide to <ph name="DOMAIN">$1<ex>www.google.com</ex></ph> can be intercepted by your administrator. </message> @@ -2898,9 +2748,6 @@ <message name="IDS_CERT_X509_KEY_USAGE_ENCIPHER_ONLY" desc="description of certificate usage Encipher Only"> Encipher Only </message> - <message name="IDS_CERT_X509_KEY_USAGE_DECIPHER_ONLY" desc="description of certificate usage Decipher Only"> - Decipher Only - </message> <message name="IDS_CERT_X509_BASIC_CONSTRAINT_IS_CA" desc="description of certificate constraint Is a Certification Authority"> Is a Certification Authority </message> @@ -2940,12 +2787,6 @@ <message name="IDS_CERT_REVOCATION_REASON_CERTIFICATE_HOLD" desc="description of certificate revocation for reason Certificate Hold"> Certificate on Hold </message> - <message name="IDS_CERT_REVOCATION_REASON_PRIVILEGE_WITHDRAWN" desc="description of certificate revocation for reason Privilege Withdrawn"> - Privilege Withdrawn - </message> - <message name="IDS_CERT_REVOCATION_REASON_AA_COMPROMISE" desc="description of certificate revocation for reason AA Compromise"> - AA Compromise - </message> <message name="IDS_CERT_OCSP_RESPONDER_FORMAT" desc="format for info about OCSP responder"> OCSP Responder: <ph name="LOCATION">$1<ex>Foo</ex></ph> </message> @@ -2985,12 +2826,6 @@ <message name="IDS_CERT_GENERAL_NAME_REGISTERED_ID" desc="label for the certRegisteredID general name type"> Registered OID </message> - <message name="IDS_CERT_EDI_PARTY_NAME" desc="format for Electronic Data Identifier (EDI) Party Name"> - Party Name: <ph name="PARTY_NAME">$1<ex>Foo</ex></ph> - </message> - <message name="IDS_CERT_EDI_NAME_ASSIGNER" desc="format for Electronic Data Identifier (EDI) Name Assigner"> - Name Assigner: <ph name="NAME_ASSIGNER">$1<ex>Foo</ex></ph> - </message> <message name="IDS_CERT_EXT_MS_CERT_TYPE" desc="description of extension Microsoft Certificate Template Name"> Microsoft Certificate Template Name </message> @@ -3551,9 +3386,6 @@ <message name="IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME" desc="The prefix for a Task Manager plugin row"> Unknown plugin </message> - <message name="IDS_TASK_MANAGER_WORKER_PREFIX" desc="The prefix for a Task Manager HTML5 Web Worker process row"> - Web Worker: <ph name="WORKER_NAME">$1<ex>http://www.domain.com</ex></ph> - </message> <message name="IDS_TASK_MANAGER_UTILITY_PREFIX" desc="The prefix for a utility process row"> Utility: <ph name="UTILITY_TYPE">$1<ex>Image Decoder</ex></ph> </message> @@ -3609,11 +3441,6 @@ Zip File Creator </message> </if> - <if expr="is_android"> - <message name="IDS_UTILITY_PROCESS_SECCOMP_DETECTOR_NAME" desc="The name of the utility process used for Seccomp support detection."> - Seccomp Detector - </message> - </if> <if expr="not is_android"> <message name="IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME" desc="The name of the utility process used for importing profiles."> Profile Importer @@ -3629,9 +3456,6 @@ <message name="IDS_UTILITY_PROCESS_FILE_DIALOG_NAME" desc="The name of the utility process used for handling a file open/save dialog."> File Open/Save Dialog </message> - <message name="IDS_UTILITY_PROCESS_FONT_CACHE_BUILDER_NAME" desc="The name of the utility process used for building the DirectWrite font cache."> - DirectWrite Font Cache Builder - </message> <message name="IDS_UTILITY_PROCESS_WIFI_CREDENTIALS_GETTER_NAME" desc="The name of the utility process used for getting the WiFi credentials"> WiFi Credentials Getter </message> @@ -3655,11 +3479,6 @@ PWG Raster Convertor </message> </if> - <if expr="enable_service_discovery"> - <message name="IDS_UTILITY_PROCESS_SERVICE_DISCOVERY_HANDLER_NAME" desc="The name of the utility process used for handling service discovery."> - Service Discovery Handler - </message> - </if> <!-- Theme preview info bar --> <message name="IDS_THEME_INSTALL_INFOBAR_LABEL" desc="Text displayed on an infobar when a theme has been installed."> @@ -3669,14 +3488,6 @@ Undo </message> - <!-- ARC app force stop --> - <message name="IDS_ARC_APP_FORCE_STOP_PROMPT_TITLE" desc="Titlebar of the ARC(App Runtime for Chrome) app force stop prompt window"> - Force stop? - </message> - <message name="IDS_ARC_APP_FORCE_STOP_PROMPT_HEADING" desc="First bold line in the content area of the ARC(App Runtime for Chrome) app force stop prompt. Tells the user the app may mishehave if confirmed."> - If you force stop an app, it may misbehave. - </message> - <!-- Extension/App disabled notification --> <message name="IDS_EXTENSION_DISABLED_ERROR_LABEL" desc="Text displayed when an extension was disabled due to a new upgrade requiring an explicit permission check from the user."> The newest version of the extension "<ph name="EXTENSION_NAME">$1<ex>Flashblock</ex></ph>" requires more permissions, so it has been disabled. @@ -3732,24 +3543,6 @@ <message name="IDS_EXTENSION_INSTALL_PROMPT_TITLE" desc="Titlebar of the extension or app installation prompt. Asks the user if they want to install a particular extension or app."> Add "<ph name="EXTENSION_NAME">$1<ex>Gmail Checker</ex></ph>"? </message> - <message name="IDS_EXTENSION_BUNDLE_INSTALL_PROMPT_TITLE_EXTENSIONS" desc="Titlebar of the extension bundle installation prompt. Asks the user if they want to install the set of extensions."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these extensions: - </message> - <message name="IDS_EXTENSION_BUNDLE_INSTALL_PROMPT_TITLE_APPS" desc="Titlebar of the app bundle installation prompt. Asks the user if they want to install the set of apps."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these apps: - </message> - <message name="IDS_EXTENSION_BUNDLE_INSTALL_PROMPT_TITLE_EXTENSION_APPS" desc="Titlebar of the extension and app bundle installation prompt. Asks the user if they want to install the set of apps and extensions."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these apps and extensions: - </message> - <message name="IDS_EXTENSION_BUNDLE_DELEGATED_INSTALL_PROMPT_TITLE_EXTENSIONS" desc="First bold line in the content area of the extension bundle installation prompt. Asks the user if they want to install the set of extensions."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these extensions for <ph name="USER_NAME">$2<ex>Wallace</ex></ph>: - </message> - <message name="IDS_EXTENSION_BUNDLE_DELEGATED_INSTALL_PROMPT_TITLE_APPS" desc="First bold line in the content area of the app bundle installation prompt. Asks the user if they want to install the set of apps."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these apps for <ph name="USER_NAME">$2<ex>Wallace</ex></ph>: - </message> - <message name="IDS_EXTENSION_BUNDLE_DELEGATED_INSTALL_PROMPT_TITLE_EXTENSION_APPS" desc="First bold line in the content area of the extension and app bundle installation prompt. Asks the user if they want to install the set of apps and extensions."> - "<ph name="BUNDLE_NAME">$1<ex>My Awesome Bundle</ex></ph>" adds these apps and extensions for <ph name="USER_NAME">$2<ex>Wallace</ex></ph>: - </message> <message name="IDS_EXTENSION_UNINSTALL_PROMPT_HEADING" desc="First bold line in the content area of the extension or app uninstallation prompt. Asks the user if they want to uninstall a particular extension or app."> Remove "<ph name="EXTENSION_NAME">$1<ex>Gmail Checker</ex></ph>"? </message> @@ -4317,18 +4110,6 @@ </if> <!-- Extension installed bubble --> - <message name="IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_EXTENSIONS" desc="First line in the content area of the extension bundle installed bubble. Instructs which extensions were installed."> - The following extensions are now installed: - </message> - <message name="IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_APPS" desc="First line in the content area of the extension bundle installed bubble. Instructs which apps were installed."> - The following apps are now installed: - </message> - <message name="IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_EXTENSION_APPS" desc="First line in the content area of the extension bundle installed bubble. Instructs which apps and extensions were installed."> - The following apps and extensions were added: - </message> - <message name="IDS_EXTENSION_BUNDLE_ERROR_HEADING" desc="Text displayed in the extension bundle installed bubble when some extensions or apps failed to install. Instructs which extensions did not install."> - We were unable to install: - </message> <if expr="enable_extensions"> <if expr="is_macosx"> <message name="IDS_EXTENSION_INSTALLED_APP_INFO" desc="Text displayed inside a link when an app is installed. Clicking this link opens up the New Tab Page to show the app's icon."> @@ -4991,18 +4772,6 @@ <message name="IDS_EXTENSIONS_CORRUPTED_EXTENSION" desc="The warning for the user that an extension may have been tampered with on disk."> This extension may have been corrupted. </message> - <message name="IDS_EXTENSIONS_CORRUPTED_EXTENSION_2" desc="The warning for the user that an extension may have been tampered with on disk."> - This extension may have been corrupted. Try re-installing. - </message> - <message name="IDS_EXTENSIONS_CORRUPTED_EXTENSION_3" desc="The warning for the user that an extension may have been tampered with on disk."> - This extension may have been incorrectly updated. Try re-installing. - </message> - <message name="IDS_EXTENSIONS_CORRUPTED_EXTENSION_4" desc="The warning for the user that an extension may have been tampered with on disk."> - Extension corrupted. Try re-installing. - </message> - <message name="IDS_EXTENSIONS_CORRUPTED_EXTENSION_5" desc="The warning for the user that an extension may have been tampered with on disk."> - This extension may have been corrupted. Please try uninstalling and reinstalling. - </message> <message name="IDS_EXTENSIONS_DISABLED_UPDATE_REQUIRED_BY_POLICY" desc="Text shown in the extensions settings for extensions disabled due to minimum version requirement from enterprise policy"> This extension is outdated and disabled by enterprise policy. It might become enabled automatically when a newer version is available. </message> @@ -5130,14 +4899,6 @@ If enabled, the chrome://md-policy URL loads the Material Design policy page. </message> - <!-- Material Design version of chrome://downloads --> - <message name="IDS_FLAGS_ENABLE_MATERIAL_DESIGN_DOWNLOADS_NAME" desc="Name for the flag to enable the material design downloads page."> - Enable Material Design downloads - </message> - <message name="IDS_FLAGS_ENABLE_MATERIAL_DESIGN_DOWNLOADS_DESCRIPTION" desc="Description for the flag to enable the material design downloads page."> - If enabled, the chrome://downloads/ URL loads the Material Design downloads page. - </message> - <!-- Material Design version of chrome://history --> <message name="IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_NAME" desc="Name for the flag to enable the material design history page."> Enable Material Design history @@ -5400,12 +5161,6 @@ XPS enables advanced options for classic printers connected to the Cloud Print with Chrome. Printers must be re-connected after changing this flag. </message> </if> - <message name="IDS_FLAGS_IFRAME_BASED_SIGNIN_NAME" desc="Title for the flag for iframe-based sign-in flows."> - iframe-based sign-in flows - </message> - <message name="IDS_FLAGS_IFRAME_BASED_SIGNIN_DESCRIPTION" desc="Description for the flag for iframe-based sign-in flows"> - Uses an iframe-based sign-in flow instead of a webview-based flow. - </message> <message name="IDS_FLAGS_LOAD_MEDIA_ROUTER_COMPONENT_EXTENSION_NAME" desc="Title of the flag for loading the Media Router component extension."> Load Media Router Component Extension </message> @@ -5525,26 +5280,6 @@ <message name="IDS_FLAGS_INERT_VISUAL_VIEWPORT_DESCRIPTION" desc="Description of the flag to enable the inert visual viewport experiment."> Experiment to have all APIs reflect the layout viewport. This will make window.scroll properties relative to the layout viewport. </message> - <message name="IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME" desc="Name of the 'Threaded compositing mode' lab."> - Threaded compositing - </message> - <message name="IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION" desc="Description of the 'Threaded compositing mode' lab."> - Uses a secondary thread to perform web page compositing. This allows smooth scrolling, even when the main thread is unresponsive. - </message> - <message name="IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME" desc="Name of the 'Accelerated overflow scroll mode' lab."> - Accelerated overflow scroll - </message> - <message name="IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION" desc="Description of the 'Accelerated overflow scroll mode' lab."> - When possible, puts the scrolling contents of an overflow scrolling element onto a composited layer for faster scrolling. - </message> - <if expr="is_win"> - <message name="IDS_FLAGS_DIRECT_WRITE_NAME" desc="Name of the 'DirectWrite' lab."> - DirectWrite - </message> - <message name="IDS_FLAGS_DIRECT_WRITE_DESCRIPTION" desc="Description of the 'DirectWrite' lab."> - Enables the use of experimental DirectWrite font rendering system. - </message> - </if> <message name="IDS_FLAGS_EXPERIMENTAL_CANVAS_FEATURES_NAME" desc="Name of the 'Enable experimental canvas features' lab."> Experimental canvas features </message> @@ -5625,12 +5360,6 @@ Whether or not single actions using Contextual Cards data in the Contextual Search Bar is enabled. </message> </if> - <message name="IDS_FLAGS_GESTURE_TAP_HIGHLIGHTING_NAME" desc="Title for the flag to turn on gesture tap highlighting"> - Gesture Tap Highlighting - </message> - <message name="IDS_FLAGS_GESTURE_TAP_HIGHLIGHTING_DESCRIPTION" desc="Description for the flag to turn on gesture tap highlighting"> - Enable the experimental gesture tap highlight implementation. - </message> <message name="IDS_FLAGS_SMOOTH_SCROLLING_NAME" desc="Name of the smooth scrolling flag"> Smooth Scrolling </message> @@ -5643,11 +5372,6 @@ <message name="IDS_FLAGS_OVERLAY_SCROLLBARS_DESCRIPTION" desc="Description for the flag to turn on overlay scrollbars"> Enable the experimental overlay scrollbars implementation. You must also enable threaded compositing to have the scrollbars animate. </message> - <if expr="is_android"> - <message name="IDS_AUTO_LOGIN_FAILED" desc="Message to display when auto-login fails. [CHAR-LIMIT=64]"> - Automatic sign-in failed - </message> - </if> <message name="IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME" desc="Title for the flag to show Autofill field type predictions for all forms"> Show Autofill predictions </message> @@ -5699,12 +5423,6 @@ <message name="IDS_FLAGS_SCROLL_END_EFFECT_DESCRIPTION" desc="Description for the flag that controls scroll end effect from vertical overscroll."> Experimental scroll end effect in response to vertical overscroll. </message> - <message name="IDS_FLAGS_PANELS_NAME" desc="Name of the 'Enable Panels' lab."> - Panels - </message> - <message name="IDS_FLAGS_PANELS_DESCRIPTION" desc="Description for the flag to enable Panel windows."> - Allow extensions to create panel windows that open outside of the browser frame. Attempts to open a panel will open a popup instead if not enabled. Default behavior is to allow only for whitelisted extensions. Enabled behavior is to allow for all extensions. Disabled behavior is to disallow panels for any extension. - </message> <message name="IDS_FLAGS_WEBGL2_NAME" desc="Name of the 'Enable WebGL 2.0' flag."> WebGL 2.0 </message> @@ -5729,12 +5447,6 @@ <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_DESCRIPTION" desc="Description of chrome:flags option to turn off WebRTC hardware video encoding support."> Support in WebRTC for encoding video streams using platform hardware. </message> - <message name="IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_NAME" desc="Name of chrome:flags option to turn off WebRTC vp8 hardware video encoding support."> - WebRTC hardware vp8 video encoding - </message> - <message name="IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_DESCRIPTION" desc="Description of chrome:flags option to turn off WebRTC vp8 hardware video encoding support."> - Support in WebRTC for encoding vp8 video streams using platform hardware. - </message> <message name="IDS_FLAGS_WEBRTC_HW_H264_ENCODING_NAME" desc="Name of chrome:flags option to turn on WebRTC h264 hardware video encoding support."> WebRTC hardware h264 video encoding </message> @@ -5783,21 +5495,6 @@ Enable OSK overscroll support. With this flag on, the OSK will only resize the visual viewport. </message> </if> - <message name="IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_NAME" desc="Name of the 'Compositing for fixed position elements' lab."> - Compositing for fixed position elements. - </message> - <message name="IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_DESCRIPTION" desc="Description for the flag to make fixed position elements become composited layers."> - Enabling this option will make fixed position elements have their own composited layers. Note that fixed position elements must also create stacking contexts for this to work. - </message> - <message name="IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_HIGH_DPI" desc="Description of the 'Compositing for fixed position elements on high DPI' experiment."> - Enabled only for high-DPI displays - </message> - <message name="IDS_FLAGS_ACCELERATED_FIXED_ROOT_BACKGROUND_NAME" desc="Name of the 'Accelerated fixed root background' lab."> - Compositing for fixed root backgrounds. - </message> - <message name="IDS_FLAGS_ACCELERATED_FIXED_ROOT_BACKGROUND_DESCRIPTION" desc="Description for the flag to all fixed root backgrounds to be put in separate, composited layers."> - If this option is enabled, and if the body is styled with background-attachment:fixed, the background will have its own compositied layer. - </message> <message name="IDS_FLAGS_QUIC_NAME" desc="Title for the flag to enable QUIC."> Experimental QUIC protocol </message> @@ -5822,12 +5519,6 @@ <message name="IDS_FLAGS_ENABLE_TOKEN_BINDING_DESCRIPTION" desc="Description for the flag to enable Token Binding. Please do not translate 'Token Binding'."> Enable Token Binding support. </message> - <message name="IDS_FLAGS_ALTSVC_NAME" desc="Title for the flag for Alternative Services. Please do not translate "Alternative Services"."> - Alternative services - </message> - <message name="IDS_FLAGS_ALTSVC_DESCRIPTION" desc="Description for the flag for Alternative Services. Please do not translate "Alternative Services"."> - Enable support for Alternative Services, an experimental HTTP feature. - </message> <message name="IDS_FLAGS_GESTURE_REQUIREMENT_FOR_MEDIA_PLAYBACK_NAME" desc="Title for the flag for gesture requiment for media playback"> Gesture requirement for media playback </message> @@ -5867,9 +5558,6 @@ Forces touchstart, touchmove, mousewheel and wheel event listeners (which haven't requested otherwise) to be treated as passive. This will break touch/wheel behavior on some websites but is useful for demonstrating the potential performance benefits of adopting passive event listeners. </message> <if expr="is_android"> - <message name="IDS_FLAGS_MEDIA_STYLE_NOTIFICATION_DESCRIPTION" desc="Description for the flag for using Android MediaStyle notification"> - Use Android MediaStyle notifications for Chrome media notifications. - </message> <message name="IDS_FLAGS_IMPORTANT_SITES_IN_CBD_NAME" desc="Title for the flag for including important sites whitelisting in the clear browsing dialog."> Important sites options in clear browsing data dialog </message> @@ -5929,12 +5617,6 @@ <message name="IDS_FLAGS_UI_SLOW_ANIMATIONS_DESCRIPTION" desc="Description for the flag that enables slow UI animations."> Makes all UI animations slow. </message> - <message name="IDS_FLAGS_ASH_TEXT_FILTERING_IN_OVERVIEW_MODE_NAME" desc="Title for the flag for window filtering in overview mode by inputing text"> - Text filtering in Overview Mode - </message> - <message name="IDS_FLAGS_ASH_TEXT_FILTERING_IN_OVERVIEW_MODE_DESCRIPTION" desc="Description for the flag for window filtering in overview mode by inputing text"> - Allows filtering the windows shown in overview mode by entering text. - </message> </if> <message name="IDS_FLAGS_JAVASCRIPT_HARMONY_SHIPPING_NAME" desc="Title for the flag for latest (non-experimental) JavaScript fatures"> @@ -5996,12 +5678,6 @@ <message name="IDS_FLAGS_FORCE_GPU_RASTERIZATION" desc="Description of the 'Force GPU rasterization' experiment"> Force-enabled for all layers </message> - <message name="IDS_FLAGS_THREADED_GPU_RASTERIZATION_NAME" desc="Title for the flag to enable threaded GPU rasterization."> - Threaded GPU rasterization - </message> - <message name="IDS_FLAGS_THREADED_GPU_RASTERIZATION_DESCRIPTION" desc="Description for the flag to enable threaded GPU rasterizer."> - Use secondary thread for GPU rasterization of web content. Requires GPU rasterization to be enabled. - </message> <message name="IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_NAME" desc="Name of about:flags option for number of GPU rasterization MSAA samples."> GPU rasterization MSAA sample count. </message> @@ -6071,14 +5747,6 @@ <message name="IDS_FLAGS_SILENT_DEBUGGER_EXTENSION_API_DESCRIPTION" desc="Description for the flag to enable silent debugging via chrome.debugger extension API."> Do not show the infobar when an extension attaches to a page via chrome.debugger API. This is required to debug extension background pages. </message> - <if expr="use_ash"> - <message name="IDS_FLAGS_MINIMIZE_ON_SECOND_LAUNCHER_ITEM_CLICK_NAME" desc="Name for the flag which allows to minimize a window upon launcher item click under certain conditions."> - Shelf minimize-on-click - </message> - <message name="IDS_FLAGS_MINIMIZE_ON_SECOND_LAUNCHER_ITEM_CLICK_DESCRIPTION" desc="Description for the flag which allows to minimize a window upon launcher item click under certain conditions."> - Allows the shelf to minimize a window if a shelf item gets clicked which has only a single, already active, window associated with it. - </message> - </if> <message name="IDS_FLAGS_SHOW_TOUCH_HUD_NAME" desc="Name for the flag to show a heads-up display for tracking touch-points."> Show HUD for touch points @@ -6110,12 +5778,6 @@ <message name="IDS_FLAGS_PINCH_SCALE_DESCRIPTION" desc="Description of the flag to turn on experiental pinch to scale."> Enables experimental support for scale using pinch. </message> - <message name="IDS_FLAGS_PINCH_VIRTUAL_VIEWPORT_NAME" desc="Name of the flag to turn on experimental pinch virtual viewport."> - Pinch virtual viewport - </message> - <message name="IDS_FLAGS_PINCH_VIRTUAL_VIEWPORT_DESCRIPTION" desc="Description of the flag to turn on experimental pinch virtual viewport."> - When zoomed in, fixed-position elements and scaled scrollbars attach to this viewport. - </message> <message name="IDS_FLAGS_CREDENTIAL_MANAGER_API_NAME" desc="Name for the flag to enable 'navigator.credentials'."> Experimental Credential Manager API </message> @@ -6197,12 +5859,6 @@ <message name="IDS_FLAGS_AUTOMATIC_PASSWORD_SAVING_DESCRIPTION" desc="Description of the flag to automatically save password."> Skip the passwords prompt and save passwords automatically. </message> - <message name="IDS_FLAGS_PASSWORD_CHANGE_SUPPORT_NAME" desc="Name of the flag for the password manager's password change support option."> - Change password support - </message> - <message name="IDS_FLAGS_PASSWORD_CHANGE_SUPPORT_DESCRIPTION" desc="Description of the flag for the password manager's change password support option."> - Enable updating a password in the password manager after submitting a "change password" form. - </message> <message name="IDS_FLAGS_PASSWORD_FORCE_SAVING_NAME" desc="Name of the flag for the password manager's force-saving option."> Force-saving of passwords </message> @@ -6215,12 +5871,6 @@ <message name="IDS_FLAGS_MANUAL_PASSWORD_GENERATION_DESCRIPTION" desc="Description of the flag for manual password generation."> Allow the user to manually enforce to generate password on a password field. </message> - <message name="IDS_FLAGS_PASSWORD_MANAGER_LINK_NAME" desc="Name of the flag to enable showing a link to account central on password settings page"> - Remote password management link - </message> - <message name="IDS_FLAGS_PASSWORD_MANAGER_LINK_DESCRIPTION" desc="Description of the flag to enable showing a link to account central on password settings page"> - Show a link in the password manager settings page to manage your synced passwords online. - </message> <message name="IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE_MANY_ACCOUNTS" desc="The title of the account chooser dialog/infobar for more than one account."> Choose your account saved with <ph name="PASSWORD_MANAGER_BRAND">$1<ex>Google Chrome</ex></ph> to sign in </message> @@ -6359,9 +6009,6 @@ <message name="IDS_TRACE_UPLOAD_URL_CHOICE_TESTING"> Testing </message> - <message name="IDS_FLAGS_STALE_WHILE_REVALIDATE_DESCRIPTION" desc="Description for the flag to enable the stale-while-revalidate cache directive."> - Enable the experimental implementation of the Cache-Control: stale-while-revalidate directive. This permits servers to specify that some resources may be revalidated in the background to improve latency. - </message> <message name="IDS_FLAGS_SUPERVISED_USER_MANAGED_BOOKMARKS_FOLDER_NAME" desc="Name of the flag to enable the managed bookmarks folder for supervised users."> Managed bookmarks for supervised users </message> @@ -6380,12 +6027,6 @@ <message name="IDS_FLAGS_DRIVE_SEARCH_IN_CHROME_LAUNCHER_DESCRIPTION" desc="Description for the flag for drive search in chrome launcher."> Files from Drive will show up when searching the Chrome App Launcher. </message> - <message name="IDS_FLAGS_V8_PAC_MOJO_OUT_OF_PROCESS_NAME" desc="Name of the flag to enable out-of-process V8 proxy resolver."> - Out-of-process V8 Proxy Resolver. - </message> - <message name="IDS_FLAGS_V8_PAC_MOJO_OUT_OF_PROCESS_DESCRIPTION" desc="Description for the flag to enable out-of-process V8 proxy resolver."> - Enable Out-of-process V8 Proxy Resolver. Runs the V8 proxy resolver in a utility process instead of inside the browser process. - </message> <message name="IDS_FLAGS_V8_CACHE_OPTIONS_NAME" desc="Name of the about::flags setting for V8 cache options. The V8 JavaScript engine supports three caching modes: disabled; parser; code. This is the option to choose among them."> V8 caching mode. </message> @@ -6454,24 +6095,12 @@ <message name="IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_LITE_PAGE_DESCRIPTION" desc="Describes an about:flags experiment to enable Data Saver lite pages" translateable="false"> Enable lite pages in Data Saver Lo-Fi mode. Previews of pages will be shown instead of image placeholders when Lo-Fi is on. Data Saver and Lo-Fi must be enabled for lite pages to be shown. </message> - <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_RESET_SAVINGS_NAME" desc="Title in about:flags to clear data savings obtained with data reduction proxy when Chrome restarts" translateable="false"> - Clear data savings on startup - </message> - <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_RESET_SAVINGS_DESCRIPTION" desc="Description in about:flags to clear data savings obtained with data reduction proxy when Chrome restarts" translateable="false"> - Clears data savings obtained by using data reduction proxy when chrome starts. - </message> <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_CARRIER_TEST_NAME" desc="An about:flags experiment title to enable using the carrier test data reduction proxy" translateable="false"> Enable a carrier-specific Data Reduction Proxy for testing. </message> <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_CARRIER_TEST_DESCRIPTION" desc="Describes an about:flags experiment to enable using the carrier test data reduction proxy" translateable="false"> Use a carrier-specific Data Reduction Proxy for testing. </message> - <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_CONFIG_CLIENT_NAME" desc="Title in about:flags to use the Data Reduction Proxy configuration service" translateable="false"> - Enable Data Reduction Proxy configuration service client. - </message> - <message name="IDS_FLAGS_DATA_REDUCTION_PROXY_CONFIG_CLIENT_DESCRIPTION" desc="Description in about:flags to use the Data Reduction Proxy configuration service" translateable="false"> - Uses the Data Reduction Proxy configuration service for authentication and proxy configuration. - </message> <message name="IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_NAME" desc="An about:flags experiment title to enable a Data Saver snackbar promo for 1 MB of savings" translateable="false"> Data Saver 1 MB Savings Promo </message> @@ -6508,27 +6137,6 @@ <message name="IDS_FLAGS_ZERO_COPY_DESCRIPTION" desc="Description of about:flags option for zero-copy rasterizer."> Raster threads write directly to GPU memory associated with tiles. </message> - <message name="IDS_FLAGS_TAB_CAPTURE_UPSCALE_QUALITY_NAME" desc=""> - Tab capture upscaling quality. - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_UPSCALE_QUALITY_DESCRIPTION" desc=""> - Specifies quality setting for images captured if scaling up. - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_DOWNSCALE_QUALITY_NAME" desc=""> - Tab capture downscaling quality. - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_DOWNSCALE_QUALITY_DESCRIPTION" desc=""> - Specifies quality setting for images captured if scaling down. - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST" desc=""> - fast - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_GOOD" desc=""> - good - </message> - <message name="IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_BEST" desc=""> - best - </message> <message name="IDS_FLAGS_HIDE_INACTIVE_STACKED_TAB_CLOSE_BUTTONS_NAME" desc=""> Hiding close buttons on inactive tabs when stacked </message> @@ -6693,13 +6301,6 @@ <message name="IDS_FLAGS_THREADED_SCROLLING_DESCRIPTION" desc="Description for the flag for threaded scrolling."> Threaded handling of scroll-related input events. Disabling this will force all such scroll events to be handled on the main thread. Note that this can dramatically hurt scrolling performance of most websites and is intended for testing purposes only. </message> - <message name="IDS_FLAGS_BLEEDING_RENDERER_NAME" desc="Name of the 'Stacked Tabs' lab."> - Bleeding Edge Renderer Paths - LIKELY TO CRASH YOUR BROWSER - </message> - <message name="IDS_FLAGS_BLEEDING_RENDERER_DESCRIPTION" desc="Description of the 'Bleeding edge' lab."> - Use bleeding-edge code to make Chrome draw content faster. The changes - behind this path are very likely to break lots of content. - </message> <message name="IDS_FLAGS_HARFBUZZ_RENDERTEXT_NAME" desc="Name of the about:flags HarfBuzz RenderText experiment."> HarfBuzz for UI text </message> @@ -6712,12 +6313,6 @@ <message name="IDS_FLAGS_EMBEDDED_EXTENSION_OPTIONS_DESCRIPTION" desc="Description of the flag that enables embedding extension options in chrome://extensions."> Display extension options as an embedded element in chrome://extensions rather than opening a new tab. </message> - <message name="IDS_FLAGS_EXTENSION_ACTION_REDESIGN_NAME" desc="Name of the flag to enable the extension toolbar redesign"> - Extension toolbar redesign - </message> - <message name="IDS_FLAGS_EXTENSION_ACTION_REDESIGN_DESCRIPTION" desc="Description for the flag to enable the extension toolbar redesign"> - Enables the (in development) new extension toolbar toolbar design. - </message> <message name="IDS_FLAGS_TAB_AUDIO_MUTING_NAME" desc="Name of the flag that enables the tab audio muting UI experiment in chrome://extensions."> Tab audio muting UI control </message> @@ -6896,12 +6491,6 @@ Group history by website domain (i.e. google.com) on chrome://history. </message> - <message name="IDS_FLAGS_SECURITY_CHIP_NAME" desc="Title of the flag to set the security chip's visibility in the omnibox."> - Security Chip - </message> - <message name="IDS_FLAGS_SECURITY_CHIP_DESCRIPTION" desc="Description of the flag that sets security chip's visibility in the Omnibox"> - Sets the visibility of the security chip in Material Design. - </message> <message name="IDS_FLAGS_SECURITY_CHIP_DEFAULT"> Default </message> @@ -6912,12 +6501,6 @@ Show all </message> - <message name="IDS_FLAGS_SECURITY_CHIP_ANIMATION_NAME" desc="Title of the flag to set the security chip's animation in the omnibox."> - Security Chip Animation - </message> - <message name="IDS_FLAGS_SECURITY_CHIP_ANIMATION_DESCRIPTION" desc="Description of the flag that sets security chip's animation in the Omnibox"> - Sets the animation of the security chip in Material Design. - </message> <message name="IDS_FLAGS_SECURITY_CHIP_ANIMATION_DEFAULT"> Default </message> @@ -7048,10 +6631,6 @@ <message name="IDS_HOTWORD_AUDIO_LOGGING_ENABLE" desc="A checkbox in the hotword confirm dialog that allows for sending audio of 'Ok, Google' plus a few seconds before back to Google to improve voice search."> Improve voice search by sending the sound of "Ok Google," and a few seconds before, to Google. </message> - <message name="IDS_HOTWORD_HELP_LINK" desc="Text that provides a link to the help center troubleshooting page."> - <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>Help<ph name="END_LINK"></a><ex></a></ex></ph> - </message> - <if expr="is_win"> <!-- Conflicts page --> <message name="IDS_CONFLICTS_CHECK_PAGE_TABLE_TITLE_SUFFIX_ONE" desc="What gets appended after the page title if no conflicts were found."> @@ -7105,9 +6684,6 @@ <message name="IDS_CONFLICTS_NOT_LOADED_YET" desc="Shown next to a module that has not been loaded into memory yet"> Not loaded yet </message> - <message name="IDS_HELP_CENTER_VIEW_CONFLICTS" desc="The url of the Help center article for the View Conflicts page" translateable="false"> - https://support.google.com/chrome/?p=<ph name="NAME">$1<ex>Hash</ex></ph>&l=<ph name="LOCATION">$2<ex>Hash</ex></ph>&d=<ph name="DESC">$3<ex>Hash</ex></ph>&s=<ph name="SIGNER">$4<ex>Hash</ex></ph> - </message> <if expr="use_titlecase"> <message name="IDS_CONFLICTS_LEARN_MORE" desc="The Learn More button in the conflicting module bubble"> Learn More @@ -7260,21 +6836,6 @@ Load unsafe scripts </message> </if> - <if expr="not is_android and use_titlecase"> - <message name="IDS_BLOCK_INSECURE_CONTENT_BUTTON" desc="Button to prevent insecure content from being displayed"> - Don't Load (Recommended) - </message> - </if> - <if expr="not is_android and not use_titlecase"> - <message name="IDS_BLOCK_INSECURE_CONTENT_BUTTON" desc="Button to prevent insecure content from being displayed"> - Don't load (recommended) - </message> - </if> - <if expr="is_android"> - <message name="IDS_BLOCK_INSECURE_CONTENT_BUTTON" desc="Mobile: Button to prevent insecure content from being displayed"> - Don't load - </message> - </if> <!-- chromeos bookmark app add to shelf strings --> <message name="IDS_ADD_TO_SHELF_INFOBAR_TITLE" desc="Label displayed in an infobar asking users to add to the site to their shelf"> @@ -7471,10 +7032,6 @@ </message> </if> - <message name="IDS_SITE_CHIP_EV_SSL_LABEL" desc="Formatting for the string displayed in the EV SSL site chip next to the omnibox."> - <ph name="ORGNAME">$1<ex>Google, Inc. [US]</ex></ph> <ph name="HOSTNAME">$2<ex>google.com</ex></ph> - </message> - <!--Accessible name/action strings--> <message name="IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT" desc="The format for the accessible title of an incognito window"> <ph name="WINDOW_TITLE">$1</ph> (Incognito) @@ -7519,9 +7076,6 @@ <message name="IDS_ACCNAME_EXTENSIONS" desc="The accessible name for the Extensions toolbar."> Extensions </message> - <message name="IDS_ACCNAME_EXTENSIONS_CHEVRON" desc="The accessible name for the chevron visible if not all the extension buttons fit."> - Menu containing hidden extensions - </message> <message name="IDS_ACCNAME_NEWTAB" desc="The accessible name for the New Tab (+) button."> New Tab </message> @@ -7540,12 +7094,6 @@ <!-- Browser Hung Plugin Detector --> <if expr="is_win"> - <message name="IDS_UNKNOWN_PLUGIN_NAME" desc="Name for a plugin whose name could not be determined"> - Unknown - </message> - <message name="IDS_BROWSER_HANGMONITOR_TITLE" desc="Title for the hung plugin message"> - Plugin Unresponsive - </message> <message name="IDS_BROWSER_HANGMONITOR" desc="A plugin on a page has hung"> The following plugin is unresponsive: <ph name="PLUGIN_NAME">$1 <ex>Shockwave @@ -8068,12 +7616,6 @@ <message name="IDS_MEDIA_STREAM_CAMERA_HEADER" desc="Header for camera exception management page on Content Settings dialog"> Camera exceptions </message> - <message name="IDS_MEDIA_STREAM_BLOCK_RADIO" desc="A radio button in Content Settings dialog to deny all sites to access any capture device."> - Do not allow sites to access your camera and microphone - </message> - <message name="IDS_MEDIA_STREAM_ASK_RADIO" desc="A radio button in Content Settings dialog to allow site to query the permision to access capture devices."> - Ask when a site requires access to your camera and microphone (recommended) - </message> <message name="IDS_MEDIA_STREAM_BLOCK_AUDIO_ONLY_RADIO" desc="A radio button in Content Settings dialog to deny all sites to access audio capture device."> Do not allow sites to access your microphone </message> @@ -8086,12 +7628,6 @@ <message name="IDS_MEDIA_STREAM_ASK_VIDEO_ONLY_RADIO" desc="A radio button in Content Settings dialog to allow site to query the permision to access video capture devices."> Ask when a site requires access to your camera (recommended) </message> - <message name="IDS_MEDIA_STREAM_AUDIO_MANAGED" desc="A notification bubble shown if the access to audio capture devices is controlled through policy."> - Access to your microphone is controlled by your administrator. - </message> - <message name="IDS_MEDIA_STREAM_VIDEO_MANAGED" desc="A notification bubble shown if the access to video capture devices is controlled through policy."> - Access to your camera is controlled by your administrator. - </message> <message name="IDS_MEDIA_SELECTED_MIC_LABEL" desc="The label of the 'microphone device' select menu"> Microphone: </message> @@ -8116,10 +7652,6 @@ <message name="IDS_MEDIA_PEPPER_FLASH_CHANGE_LINK" desc="The link to change Pepper Flash camera and microphone settings."> Change </message> - <message name="IDS_CONTENT_SETTING_CHANGED_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar."> - Reload - </message> - <message name="IDS_IMAGES_TAB_LABEL" desc="Label for Images tab on Content Settings dialog"> Images </message> @@ -8436,21 +7968,9 @@ <message name="IDS_SRT_BUBBLE_TEXT" desc="Text for the Chrome Cleanup Tool bubble view full description."> Is Chrome crashing, showing unusual startup pages, toolbars, or unexpected ads you can't get rid of, or otherwise changing your browsing experience? You may be able to fix the problem by running the Chrome Cleanup Tool. </message> - <message name="IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAME" desc="Text for the Chrome Cleanup Tool bubble view stating that a single piece of Unwanted Software was found."> - Chrome found an unwanted program (<ph name="UWS_NAME">$1<ex>SoftwareName</ex></ph>) installed on your computer. You may be able to remove it by running the Chrome Cleanup Tool. - </message> - <message name="IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAMES" desc="Text for the Chrome Cleanup Tool bubble view stating that two or more pieces of Unwanted Software were found."> - Chrome found <ph name="NUMBER_OF_UWS_GREATER_THAN_ONE">$1<ex>3</ex></ph> unwanted programs (<ph name="IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES">$1<ex>Software1 and Software2</ex></ph>) installed on your computer. You may be able to remove these programs by running the Chrome Cleanup Tool. - </message> <message name="IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES" desc="Text to put within IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAME when there are 2 UwS found, e.g., Software1 and Software2."> <ph name="UWS_NAME">$1<ex>SoftwareName</ex></ph> and <ph name="UWS_NAME">$2<ex>Software2</ex></ph> </message> - <message name="IDS_SRT_BUBBLE_TEXT_1_MORE_UWS_NAME" desc="Text to replace IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES above when there are 3 found unwanted software, e.g., Software1, Software2, and one more."> - <ph name="UWS_NAME">$1<ex>Software1</ex></ph>, <ph name="UWS_NAME">$2<ex>Software2</ex></ph>, and one more - </message> - <message name="IDS_SRT_BUBBLE_TEXT_MORE_UWS_NAMES" desc="Text to replace IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES above when there are more than 2 found unwanted software, e.g., Software1, Software2, and 3 others."> - <ph name="UWS_NAME">$1<ex>Software1</ex></ph>, <ph name="UWS_NAME">$2<ex>Software2</ex></ph>, and <ph name="NUMBER_OF_UWS_GREATER_THAN_ONE">$1<ex>3</ex></ph> others - </message> <if expr="use_titlecase"> <message name="IDS_SRT_MENU_ITEM" desc="In Title Case: Text for the Chrome menu option to be shown when unusual behavior was detected."> Unusual Behavior Detected @@ -9036,9 +8556,6 @@ <ph name="CITY">$1<ex>Mountain View</ex></ph>, <ph name="COUNTRY">$2<ex>US</ex></ph> </message> - <message name="IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_NO_CT" desc="The text of the identity section when the page is secured with an EV cert and no Certificate Transparency information is present."> - The identity of <ph name="ORGANIZATION">$1<ex>Google</ex></ph> at <ph name="LOCALITY">$2<ex>Mountain View, CA US</ex></ph> has been verified by <ph name="ISSUER">$3<ex>VeriSign</ex></ph>. No Certificate Transparency information was supplied by the server. - </message> <message name="IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_VERIFIED" desc="The text of the identity section when the page is secured with a valid EV cert."> The identity of <ph name="ORGANIZATION">$1<ex>Google</ex></ph> at <ph name="LOCALITY">$2<ex>Mountain View, CA US</ex></ph> has been verified by <ph name="ISSUER">$3<ex>VeriSign</ex></ph>. </message> @@ -9366,9 +8883,6 @@ <!-- chrome://settings. Android uses native UI for settings --> <if expr="not is_android"> <if expr="chromeos"> - <message name="IDS_OPTIONS_INTERNET_TAB_LABEL" desc="The title of the Internet tab"> - Internet - </message> <message name="IDS_OPTIONS_INTERNET_OPTIONS_GROUP_LABEL" desc="The title of the 'Internet connections' group"> Internet connection </message> @@ -9511,9 +9025,6 @@ <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_BUTTON" desc="The label of the button to disable Easy unlock on the settings page and the turn off Easy unlock dialog."> Turn off </message> - <message name="IDS_OPTIONS_EASY_UNLOCK_NOTIFICATION_OPTION_LABEL" desc="The label of the preference in the Smart Lock settings page to control whether notifications should be shown when unlocking the Chromebook."> - Get notified on your phone every time Smart Lock unlocks your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. - </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_TITLE" desc="The title of the Easy unlock turn off dialog."> Turn off Smart Lock for Chromebook? </message> @@ -9975,163 +9486,12 @@ </message> <!-- Autofill dialog: field labels. --> - <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_EMAIL" desc="The placeholder/label text for email in the requestAutocomplete dialog."> - Email address - </message> - <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_CARD_NUMBER" desc="The placeholder/label text for credit card number in the requestAutocomplete dialog."> - Card number - </message> - <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_MONTH" desc="The placeholder/label text for credit card expiration month in the requestAutocomplete dialog."> + <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_MONTH" desc="The placeholder/label text for credit card expiration month in the card unmask dialog."> Month </message> - <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR" desc="The placeholder/label text for credit card expiration year in the requestAutocomplete dialog."> + <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_YEAR" desc="The placeholder/label text for credit card expiration year in the card unmask dialog."> Year </message> - <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_PHONE_NUMBER" desc="The placeholder/label text for phone number in the requestAutocomplete dialog."> - Phone number - </message> - <message name="IDS_AUTOFILL_DIALOG_TOOLTIP_PHONE_NUMBER" desc="A tooltip explaining why the user must enter a phone number."> - Merchants often need this in case there are problems shipping your order. - </message> - - <!-- On Android, we use Google Play Services to handle all the UI for the Autofill Dialog --> - <if expr="not is_android"> - <!-- Autofill dialog: title bar --> - <message name="IDS_AUTOFILL_DIALOG_TITLE" desc="Title for autofill dialog which asks user to input address + payment info."> - Pay - </message> - <message name="IDS_AUTOFILL_DIALOG_SIGN_IN" desc="This link text is shown when the user is not signed in to a GAIA account."> - Sign in to pay with Google Payments - </message> - - <!-- Autofill dialog: notification area --> - <message name="IDS_AUTOFILL_DIALOG_SITE_WARNING" desc="Text that explains that user data will be sent to the site."> - The following details will be shared with <ph name="SITE">$1<ex>www.shopping.com</ex></ph> - </message> - <message name="IDS_AUTOFILL_DIALOG_VERIFY_CVV" desc="Text explaining a user must enter their CVV to continuing submitting for security purposes (while using Google Payments)."> - For your security, please verify your card details. - </message> - - <!-- Autofill dialog: detail section --> - <message name="IDS_AUTOFILL_DIALOG_EDIT" desc="Text of link in autofill dialog which allows user to edit address + payment info."> - Edit - </message> - <message name="IDS_AUTOFILL_DIALOG_SECTION_CC" desc="Label for the credit card section of the autofill dialog."> - Card details - </message> - <message name="IDS_AUTOFILL_DIALOG_SECTION_BILLING" desc="Label for the billing details (credit card + address) section of the autofill dialog."> - Billing details - </message> - <message name="IDS_AUTOFILL_DIALOG_SECTION_SHIPPING" desc="Label for the shipping details section of the autofill dialog."> - Shipping address - </message> - <message name="IDS_AUTOFILL_DIALOG_USING_BILLING_FOR_SHIPPING" desc="Text that is shown when the billing info will also be used for shipping."> - Same as billing address - </message> - <message name="IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON" desc="Button text for confirmation of user details."> - Continue - </message> - <message name="IDS_AUTOFILL_DIALOG_VERIFY_BUTTON" desc="Button text for verifying user details."> - Verify - </message> - - <!-- Autofill dialog: combobox menu items --> - <message name="IDS_AUTOFILL_DIALOG_ADD_CREDIT_CARD" desc="Menu item for adding a new credit card in the autofill dialog."> - New credit card... - </message> - <message name="IDS_AUTOFILL_DIALOG_MANAGE_CREDIT_CARD" desc="Menu item for directing the user to a different UI that can manage credit cards."> - Manage credit cards... - </message> - <message name="IDS_AUTOFILL_DIALOG_ADD_BILLING_ADDRESS" desc="Menu item for adding a new billing address in the autofill dialog."> - New billing address... - </message> - <message name="IDS_AUTOFILL_DIALOG_MANAGE_BILLING_ADDRESS" desc="Menu item for directing the user to a different UI that can manage billing addresses."> - Manage billing addresses... - </message> - <message name="IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS" desc="Menu item for adding new billing details (credit card + address) in the autofill dialog."> - New billing details... - </message> - <message name="IDS_AUTOFILL_DIALOG_MANAGE_BILLING_DETAILS" desc="Menu item for directing the user to a different UI that can manage billing details."> - Manage billing details... - </message> - <message name="IDS_AUTOFILL_DIALOG_ADD_SHIPPING_ADDRESS" desc="Menu item for adding new shipping address in the autofill dialog."> - New shipping address... - </message> - <message name="IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS" desc="Menu item for directing the user to a different UI that can manage shipping addresses."> - Manage shipping addresses... - </message> - <message name="IDS_AUTOFILL_DIALOG_USE_BILLING_FOR_SHIPPING" desc="Menu Item label that asks whether the billing info should also be used for shipping info."> - Use billing address for shipping - </message> - <message name="IDS_AUTOFILL_DIALOG_ENTER_CREDIT_CARD" desc="Menu item label that allows a user to manually enter credit card information."> - Enter credit card... - </message> - <message name="IDS_AUTOFILL_DIALOG_ENTER_BILLING_DETAILS" desc="Menu item label that allows a user to manually enter credit card information."> - Enter billing details... - </message> - <message name="IDS_AUTOFILL_DIALOG_USE_DIFFERENT_SHIPPING_ADDRESS" desc="Menu Item label that allows a user to manually input a shipping address that differs from their billing address."> - Use different shipping address - </message> - - <!-- Autofill dialog: legal documents --> - <message name="IDS_AUTOFILL_DIALOG_LOCATION_DISCLOSURE" desc="Text at the bottom of the autofill dialog which stands alone to inform the user that they'll be sharing their location with Google Payments if they choose to proceed."> - By clicking Continue you agree to use Google Payments. To protect you from fraud, information about your computer (including its location) will be shared with Google Payments. - </message> - <message name="IDS_AUTOFILL_DIALOG_LOCATION_DISCLOSURE_WITH_LEGAL_DOCS" desc="Text at the bottom of the autofill dialog which informs the user that they'll be sharing their location with Google Payments if they choose to proceed, appended to a message about accepting other legal documents like Terms of Service."> - <ph name="LEGAL_DOC_AGREEMENT">$1<ex>By clicking Continue you agree to the Google Payments Terms of Service and Privacy Policy.</ex></ph> To protect you from fraud, information about your computer (including its location) will be shared with Google Payments. - </message> - <message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_2" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service)."> - By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Payments Terms Of Service</ex></ph> and <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Privacy Policy</ex></ph>. - </message> - <message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_3" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service)."> - By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Payments Terms Of Service</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Terms of Use</ex></ph>, and <ph name="LEGAL_DOC_LINK_TEXT_3">$3<ex>Privacy Policy</ex></ph>. - </message> - <message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_4" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service)."> - By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Payments Terms Of Service</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_3">$3<ex>Further Terms of Use</ex></ph>, and <ph name="LEGAL_DOC_LINK_TEXT_4">$4<ex>Privacy Policy</ex></ph>. - </message> - <message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_5" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service)."> - By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Payments Terms Of Service</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_3">$3<ex>Further Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_4">$4<ex>Further Terms of Use</ex></ph>, and <ph name="LEGAL_DOC_LINK_TEXT_5">$5<ex>Privacy Policy</ex></ph>. - </message> - <message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_6" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service)."> - By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Payments Terms Of Service</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_3">$3<ex>Further Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_4">$4<ex>Further Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_5">$5<ex>Further Terms of Use</ex></ph>, and <ph name="LEGAL_DOC_LINK_TEXT_6">$6<ex>Privacy Policy</ex></ph>. - </message> - - <!-- Autofill dialog: validation messages --> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_EMAIL_ADDRESS" desc="Message displayed to user when email address validation fails."> - Invalid email address. Please check and try again. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_CREDIT_CARD_NUMBER" desc="Message displayed to user when credit card number validation fails."> - Invalid card number. Please check and try again. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_CREDIT_CARD_SECURITY_CODE" desc="Message displayed to user when credit card security code validation fails."> - Invalid CVC code. Please check and try again. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_DATE" desc="Message displayed to user when credit card expiration date validation fails."> - The card is expired. Please check the date or enter a new card. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_UNACCEPTED_GENERIC_CARD" desc="Message displayed to user when a site doesn't accept the credit card type they've entered."> - This site doesn't accept this brand of card. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_UNACCEPTED_AMEX" desc="Message displayed to user when a site doesn't accept American Express."> - This site doesn't accept American Express. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_UNACCEPTED_DISCOVER" desc="Message displayed to user when a site doesn't accept Discover."> - This site doesn't accept Discover. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_UNACCEPTED_MASTERCARD" desc="Message displayed to user when a site doesn't accept MasterCard."> - This site doesn't accept MasterCard. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_UNACCEPTED_VISA" desc="Message displayed to user when a site doesn't accept Visa."> - This site doesn't accept Visa. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_PHONE_NUMBER" desc="Message displayed to user when phone number validation fails."> - Invalid phone number. Please check and try again. - </message> - <message name="IDS_AUTOFILL_DIALOG_VALIDATION_WAITING_FOR_RULES" desc="Message displayed to user when validation rules are still downloading."> - Validating... - </message> - </if> - <message name="IDS_AUTOFILL_FROM_GOOGLE_ACCOUNT" desc="The name of the Google product that stores user addresses or credit cards in the cloud." formatter_data="android_java"> Google Payments </message> @@ -10230,13 +9590,6 @@ </message> </if> - <message name="IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON" desc="The string used in the dialog for the button that means 'create a new profile'."> - Create a new user - </message> - <message name="IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON" desc="The string used in the dialog for the button that means 'go ahead and sign in'."> - Sign in anyway - </message> - <!-- One click sign-in bubble and dialog --> <message name="IDS_ONE_CLICK_BUBBLE_UNDO" desc="The text for the undo button in the one click sign-in bubble."> Undo @@ -10253,10 +9606,6 @@ <message name="IDS_ONE_CLICK_SIGNIN_DIALOG_ADVANCED" desc="The advanced link in the one click sign-in dialog. Clicking the link will take the user to advanced settings."> Advanced </message> - <message name="IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_TITLE" desc="The title of the modal dialog window that opens when the user signs in with a different account."> - Sign in - </message> - <!-- Enterprise sign-in profile linking --> <message name="IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE" desc="The link to get more information about profile linking after signing in to an enterprise account"> Learn more @@ -10680,18 +10029,12 @@ <message name="IDS_PROFILES_NEW_AVATAR_MENU_ACCESSIBLE_NAME" desc="Title of the new avatar bubble menu for accessibility"> Switch Person </message> - <message name="IDS_PROFILES_NEW_AVATAR_MENU_ACCESSIBLE_DESCRIPTION" desc="The help text for the new avatar bubble."> - Switch to a different person. - </message> <message name="IDS_PROFILES_CREATE_NEW_PROFILE_OPTION" desc="In Title Case. Create new profile menu item and button title."> Add Person... </message> <message name="IDS_PROFILES_NEW_AVATAR_BUTTON_ACCESSIBLE_NAME" desc="Title of the avatar button for accessibility"> <ph name="PROFILE_NAME">$1<ex>User</ex></ph> Switch person </message> - <message name="IDS_PROFILES_NEW_AVATAR_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME" desc="Title of the avatar button for accessibility"> - <ph name="PROFILE_NAME">$1<ex>User</ex></ph> button: sign in error - </message> <message name="IDS_PROFILES_ACCOUNT_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME" desc="Title of the avatar button for accessibility"> <ph name="PROFILE_NAME">$1<ex>User</ex></ph>: sign in error </message> @@ -10705,47 +10048,12 @@ <ph name="PROFILE_NAME">$1<ex>User</ex></ph>: select to edit </message> </if> - <if expr="not use_titlecase"> - <message name="IDS_PROFILES_SWITCH_PROFILE_LINK" desc="Link in the supervised user bubble view to switch to a different profile."> - Switch users - </message> - </if> - <if expr="use_titlecase"> - <message name="IDS_PROFILES_SWITCH_PROFILE_LINK" desc="In title case. Link in the supervised user bubble view to switch to a different profile."> - Switch Users - </message> - </if> - <if expr="not chromeos"> - <message name="IDS_PROFILES_CREATE_NEW_PROFILE_LINK" desc="Link in the avatar menu bubble view to create a new profile."> - New user - </message> - </if> - <if expr="chromeos"> - <message name="IDS_PROFILES_CREATE_NEW_PROFILE_LINK" desc="Link in the avatar menu bubble view to create a new profile."> - Sign in another account - </message> - </if> - <message name="IDS_PROFILES_MANAGE_PROFILES_BUTTON" desc="Button in the avatar menu bubble view to manage profiles."> - Manage - </message> - <message name="IDS_PROFILES_MANAGE_PROFILES_BUTTON_TIP" desc="Tool-tip text shown for button in the avatar menu bubble view to manage profiles."> - Create, change, or delete profiles. - </message> <message name="IDS_PROFILES_PROFILE_SIGNOUT_BUTTON" desc="Button in the avatar menu bubble view to sign-out the current profile."> Exit and childlock </message> <message name="IDS_PROFILES_CLOSE_ALL_WINDOWS_BUTTON" desc="Button in the avatar menu bubble view to close all windows of the current profile."> Close all your windows </message> - <message name="IDS_PROFILES_PROFILE_SIGNOUT_BUTTON_TIP" desc="Tool-tip text shown for button in the avatar menu bubble view to sign-out the current profile."> - Sign-out user <ph name="PROFILE_USERNAME">$1<ex>user@gmail.com</ex></ph>. - </message> - <message name="IDS_PROFILES_PROFILE_SIGNOUT_BUTTON_TIP_UNAVAILABLE" desc="Tool-tip text shown for button in the avatar menu bubble view to sign-out the current profile when that button is not available because the profile has not been signed-in."> - Sign-out is possible only when signed in. - </message> - <message name="IDS_PROFILES_EDIT_PROFILE_LINK" desc="Link in the avatar menu bubble to edit a profile."> - edit - </message> <message name="IDS_PROFILES_GAIA_SIGNIN_TITLE" desc="Title of the account removal view in the avatar menu bubble."> Sign in </message> @@ -10846,9 +10154,6 @@ <message name="IDS_PROFILES_EDIT_SIGNED_IN_PROFILE_ACCESSIBLE_NAME" desc="Description of the Edit Profile button for a signed-in profile. This is used for accessibility."> Edit person, <ph name="PROFILE_NAME">$1<ex>Jane Doe</ex></ph>, <ph name="USERNAME">$2<ex>jane.doe@gmail.com</ex></ph> </message> - <message name="IDS_PROFILES_SWITCH_TO_PROFILE_ACCESSIBLE_NAME" desc="Description of the switch to profile button. This is used for accessibility."> - Switch to user: <ph name="PROFILE_NAME">$1<ex>First user</ex></ph> - </message> <message name="IDS_PROFILES_GUEST_PROFILE_NAME" desc="Name of the guest profile."> Guest </message> @@ -11077,9 +10382,6 @@ <message name="IDS_SYNC_CONFIRMATION_CHROME_SYNC_TITLE" desc="Title of the chrome sync section of the sync confirmation dialog in the tab modal signin flow" formatter_data="android_java"> Chrome Sync </message> - <message name="IDS_SYNC_CONFIRMATION_CHROME_SYNC_BODY" desc="Body of the chrome sync section of the sync confirmation dialog in the tab modal signin flow"> - Your bookmarks, history, passwords and other settings will be synced to your Google Account so you can use them on all your devices. Control what to sync in <ph name="BEGIN_LINK"><a id="settingsLink" href="#">Settings</a>.</ph> - </message> <message name="IDS_SYNC_CONFIRMATION_CHROME_SYNC_MESSAGE" desc="Body of the chrome sync section of the sync confirmation dialog in the tab modal signin flow" formatter_data="android_java"> Your bookmarks, history, passwords, and other settings will be synced to your Google Account so you can use them on all your devices </message> @@ -11168,9 +10470,6 @@ <message name="IDS_PLUGIN_ENABLE_TEMPORARILY" desc="Info Bar button to run a blocked outdated plugin"> Run this time </message> - <message name="IDS_PLUGIN_ENABLE_ALWAYS" desc="Info Bar button to always run blocked plugins for this website"> - Always run on this site - </message> <message name="IDS_PLUGIN_CRASHED_PROMPT" desc="Info Bar message to notify about a crashed plugin"> <ph name="PLUGIN_NAME">$1<ex>Shockwave</ex> has crashed.</ph> </message> @@ -11458,10 +10757,6 @@ <message name="IDS_HISTORY_MENU" desc="The text label of the History (and recent tabs) sub-menu in the wrench menu."> &History </message> - <message name="IDS_RECENT_TABS_MORE" desc="The label in the Recent Tabs menu in the wrench menu to open the other devices and history page."> - More... - </message> - <message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be."> download </message> @@ -11695,12 +10990,6 @@ </message> <!-- Sync New Tab Page strings --> - <message name="IDS_SYNC_NTP_SYNC_SECTION_ERROR_TITLE" desc="The title to display in the New Tab Page sync status section in case of an error."> - Sync failed - </message> - <message name="IDS_SYNC_NTP_SYNC_SECTION_PROMO_TITLE" desc="The title to display in the New Tab Page sync status section in case of a promotion."> - New! - </message> <message name="IDS_SYNC_NTP_PASSWORD_PROMO" desc="The message to display to promote passwords sync now being available."> <ph name="PRODUCT_NAME">$1<ex>Chrome</ex></ph> can now sync your passwords. </message> @@ -11710,10 +10999,6 @@ <message name="IDS_SYNC_NTP_SETUP_IN_PROGRESS" desc="The message to display in the New Tab Page sync section when the sync setup is underway."> Setup in progress... </message> - <message name="IDS_SYNC_NTP_SYNCED_TO" desc="The message to display in the New Tab Page sync section when the user is in sync."> - Synced as <ph name="USER_EMAIL_ADDRESS">$1<ex>foo@gmail.com</ex></ph> - </message> - <!-- Sync Promo New Tab Page bubble strings --> <message name="IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE" desc="The body of the sync promo NTP bubble."> You're now signed in to <ph name="SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph>. Your bookmarks, history, and other settings are being synced with your Google Account. @@ -11997,21 +11282,12 @@ <message name="IDS_NOTIFICATION_PERMISSIONS_FRAGMENT" desc="Permission sentence fragment to show following the prompt 'This site wants to:' in a permissions request"> Show notifications </message> - <message name="IDS_NOTIFICATION_PERMISSION_YES" desc="The label of the 'allow' button on the notification permission infobar."> - Allow - </message> - <message name="IDS_NOTIFICATION_PERMISSION_NO" desc="The label of the 'deny' button on the notification permission infobar."> - Deny - </message> <message name="IDS_NOTIFICATION_WELCOME_BODY" desc="Notification body for the Welcome Notification"> Stay connected to what you need to know, across all devices. </message> <message name="IDS_NOTIFICATION_WELCOME_BUTTON_LEARN_MORE" desc="Learn more button text for the Welcome Notification"> Learn more </message> - <message name="IDS_NOTIFICATION_WELCOME_DISPLAY_SOURCE" desc="Display source for the Welcome Notification"> - Notifications - </message> <message name="IDS_NOTIFICATION_WELCOME_TITLE" desc="Notification title for the Welcome Notification"> Google Now for Chrome! </message> @@ -12024,9 +11300,6 @@ <message name="IDS_NOTIFICATION_BUTTON_OPTIONS" desc="Button label to display more options like extra buttons or going to the site settings page."> Options </message> - <message name="IDS_NOTIFICATION_SETTINGS" desc="Button label to go to the notification settings panel"> - Notification settings - </message> <message name="IDS_NOTIFIER_WELCOME_BUTTON" desc="Notification body for when a new notifier service is introduced."> Turn off these notifications </message> @@ -12420,7 +11693,6 @@ <message name="IDS_HISTORY_CLOSED_RESTORE_WINDOW_LINUX" desc="The Linux menu item for restoring all the tabs of a recently closed window."> Restore All Tabs </message> - </if> <!-- Geolocation messages --> @@ -12441,12 +11713,6 @@ <message name="IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT" desc="Permission fragment used in the permission bubble, after 'This site wants to:' asking for permission to access the user's physical location."> Know your location </message> - <message name="IDS_GEOLOCATION_ALLOW_BUTTON" desc="A button in geolocation infobar for allowing access to geolocation for a given domain."> - Allow - </message> - <message name="IDS_GEOLOCATION_DENY_BUTTON" desc="A button in geolocation infobar for denying access to geolocation for a given domain."> - Deny - </message> <message name="IDS_GEOLOCATION_BUBBLE_SECTION_ALLOWED" desc="Heading for a section in the geolocation bubble listing all sites which are currently tracking the user's location."> This page contains elements from the following sites that are tracking your location: </message> @@ -12469,19 +11735,6 @@ This page has been blocked from tracking your location. </message> - <!-- CryptoToken messages --> - <if expr="not is_android"> - <message name="IDS_CRYPTOTOKEN_INFOBAR_QUESTION" desc="Question asked on the info bar whenever URL wants to access the user's security keys."> - Allow <ph name="URL">$1<ex>accounts.google.com</ex></ph> to identify you by your Security Key? - </message> - </if> - <message name="IDS_CRYPTOTOKEN_ALLOW_BUTTON" desc="A button in cryptotoken infobar for allowing access to security keys for a given domain."> - Allow - </message> - <message name="IDS_CRYPTOTOKEN_DENY_BUTTON" desc="A button in cryptotoken infobar for denying access to security keys for a given domain."> - Block - </message> - <!-- Web MIDI messages --> <message name="IDS_MIDI_SYSEX_TAB_LABEL" desc="Label for MIDI system exclusive message on Content Settings dialog"> MIDI devices full control @@ -12503,12 +11756,6 @@ <message name="IDS_MIDI_SYSEX_PERMISSION_FRAGMENT" desc="Permission asked in the permission bubble when a URL wants to access MIDI devices with system exclusive messages, along with other permissions requests. Preceded by the prompt 'This site would like to:'"> Use your MIDI devices </message> - <message name="IDS_MIDI_SYSEX_ALLOW_BUTTON" desc="A button in MIDI access infobar for allowing full access to MIDI devices for a given domain."> - Allow - </message> - <message name="IDS_MIDI_SYSEX_DENY_BUTTON" desc="A button in MIDI access infobar for denying full access to MIDI devices for a given domain."> - Block - </message> <message name="IDS_MIDI_SYSEX_ALLOWED_TOOLTIP" desc="Location bar icon tooltip text when a page is allowed to use MIDI system exclusive messages."> This page has full control of MIDI devices. </message> @@ -12657,16 +11904,6 @@ </message> </if> - <message name="IDS_ALLOW_AUTOFILL_SYNC_CREDENTIAL" desc="The text for the choice to allow autofilling in about:flags"> - Allow - </message> - <message name="IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL" desc="The text for the choice to not allow autofilling in about:flags"> - Disallow - </message> - <message name="IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL_FOR_REAUTH" desc="The text for the choice to not allow autofilling for reauth pages in about:flags"> - Disallow for reauth - </message> - <!-- Extra Mac UI Strings --> <if expr="is_macosx"> <message name="IDS_PLEASE_RELAUNCH_BROWSER" desc="Title of the alert when Chrome needs to be relaunched for a change/update to take effect."> @@ -12958,9 +12195,6 @@ <message name="IDS_PROFILES_CREATE_INSTRUCTIONS" desc="Instructions for the create profile dialog"> Choose a picture and name </message> - <message name="IDS_PROFILES_CREATE_CONFIRM" desc="Create button confirmation"> - Create - </message> <message name="IDS_PROFILES_CREATE_LOCAL_ERROR" desc="Message shown when a local error (for example, a disk error) occurs during profile creation."> The new user couldn't be created. Please check your hard drive space and permissions and try again. </message> @@ -13180,9 +12414,6 @@ <message name="IDS_PIN_KEYBOARD_DELETE_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the delete button of the PIN keyboard."> Delete </message> - <message name="IDS_PIN_KEYBOARD_ERROR_MESSAGE" desc="Text to display the error message on the pin keyboard if the user has entered a wrong password or pin."> - PIN or password incorrect. - </message> </if> <message name="IDS_LOGIN_ERROR_AUTHENTICATING" desc="Couldn't sign in because password is invalid"> Sorry, your password could not be verified. Please try again. @@ -13340,12 +12571,6 @@ <message name="IDS_FLAGS_ENABLE_PASSWORD_SEPARATED_SIGNIN_FLOW_DESCRIPTION" desc="Description for the flag to enable the new gaia password-separated sign in flow."> When enabled, signing in to the browser will use a new gaia password-separated sign in flow. </message> - <message name="IDS_FLAGS_ENABLE_MATERIAL_DESIGN_USER_MANAGER_NAME" desc="Title for the flag to enable the new material design user manager."> - Enable Material Design User Manager - </message> - <message name="IDS_FLAGS_ENABLE_MATERIAL_DESIGN_USER_MANAGER_DESCRIPTION" desc="Description for the flag to enable the new material design user manager."> - When enabled, the Switch person button in the avatar menu launches the new Material Design user manager. - </message> <message name="IDS_FLAGS_SHOW_MATERIAL_DESIGN_USER_MENU_NAME" desc="Title for the flag to switch to the material design desktop user menu."> Use material design user menu </message> @@ -13490,13 +12715,6 @@ </message> <!-- Strings for controlling credit card scanning feature in about:flags. --> - <message name="IDS_FLAGS_CREDIT_CARD_SCAN_NAME" desc="The name of about:flags option to enable scanning of credit cards using device camera."> - Credit card scanning - </message> - <message name="IDS_FLAGS_CREDIT_CARD_SCAN_DESCRIPTION" desc="The description of about:flags option to enable scanning of credit cards using device camera."> - Enable scanning a new credit card number when filling out a credit card form. - </message> - <!-- Simple Cache Backend experiment. --> <message name="IDS_FLAGS_SIMPLE_CACHE_BACKEND_NAME" desc="Name of about:flags option to turn on the Simple Cache Backend"> Simple Cache for HTTP @@ -13637,9 +12855,6 @@ <message name="IDS_MEDIA_GALLERIES_DIALOG_CONFIRM" desc="In title case: The text for the accept button on the media galleries configuration dialog."> Apply </message> - <message name="IDS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONFIRM" desc="In title case: The text for the accept button on the media galleries scan result dialog. The results of the dialog are added as new galleries."> - Add - </message> </if> <if expr="not use_titlecase"> <message name="IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY" desc="In sentence case: Button for adding a new gallery by choosing a folder." @@ -13653,9 +12868,6 @@ meaning="In sentence case: The text for the accept button on the media galleries configuration dialog."> Apply </message> - <message name="IDS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONFIRM" desc="In sentence case: The text for the accept button on the media galleries scan result dialog. The results of the dialog are added as new galleries."> - Add - </message> </if> <message name="IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE" desc="The title of the folder selection dialog for adding a new media gallery."> Add Media Gallery by Directory @@ -13719,12 +12931,6 @@ OEM folder </message> </if> - <message name="IDS_ADD_TO_APP_LIST_NOTIFICATION_TEXT" desc="Text explaining that the current site can be added to the App Launcher."> - This page can be added to the App Launcher - </message> - <message name="IDS_ADD_TO_APP_LIST_HINT" desc="Hint text for the button allowing the current site to be added to the App Launcher."> - Add to the App Launcher - </message> <if expr="use_titlecase"> <message name="IDS_APP_LIST_CONTEXT_MENU_NEW_TAB" desc="Title text for the 'open new' context menu item of an app list item configured to open in a tab"> New Tab @@ -13759,12 +12965,6 @@ OEM Folder </message> </if> - <message name="IDS_APP_LIST_SIGNIN_LEARN_MORE_LINK" desc="App launcher sign-in learn more URL."> - https://support.google.com/chrome/?hl=[GRITLANGCODE]&p=settings_sign_in - </message> - <message name="IDS_APP_LIST_SIGNIN_SETTINGS_TEXT" desc="App launcher sign-in settings link text."> - App Launcher Settings - </message> </if> <!-- Pepper 3D and WebGL (client 3D APIs) infobar strings --> @@ -13876,10 +13076,6 @@ <message name="IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there are multiple monitors."> {SCREEN_INDEX, plural, =1{Screen #} other{Screen #}} </message> - <message name="IDS_DESTOP_MEDIA_PICKER_VIRTUAL_SCREEN_NAME" desc="The name of the virtual display which is shown in the picker"> - Virtual Display - </message> - <!-- Local Device Discovery display strings --> <if expr="enable_service_discovery"> <message name="IDS_LOCAL_DISCOVERY_SERVICE_REGISTER" desc="Name for button to register device in the Cloud"> @@ -14152,13 +13348,6 @@ </message> <!-- Mixed content issue workaround flags --> - <message name="IDS_FLAGS_ALLOW_INSECURE_WEBSOCKET_FROM_HTTPS_ORIGIN_NAME" desc="Title for the flag to allow insecure WebSocket from https origin"> - Allow insecure WebSocket from https origin - </message> - <message name="IDS_FLAGS_ALLOW_INSECURE_WEBSOCKET_FROM_HTTPS_ORIGIN_DESCRIPTION" desc="Description to allow insecure WebSocket from https origin"> - This flag makes Chrome unsafe. Use this only if you understand what this does. Note that this flag may be removed without any notice. If enabled, frames with an https origin can use WebSockets with an insecure URL (ws://). - </message> - <if expr="is_android"> <!-- Flag strings for seccomp-bpf sandbox flag. --> <message name="IDS_FLAGS_SECCOMP_FILTER_SANDBOX_ANDROID_NAME" desc="Title for the flag to enable the seccomp-bpf sandbox on Android."> @@ -14169,7 +13358,7 @@ </message> </if> - <!-- Extension Content Verification --> + <!-- Extension Content Verification --> <message name="IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_NAME" desc="Name of the 'Extension Content Verification' flag"> Extension Content Verification </message> @@ -14296,9 +13485,6 @@ Google sent a notification to this phone. Note that with Bluetooth, your phone may keep your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> unlocked from over 100 feet away. In cases where this could be a problem, you can <a>temporarily disable this feature</a>. </message> <!-- TODO(isherman): Remove this duplicate string once proximity work is completed. --> - <message name="IDS_EASY_UNLOCK_SETUP_FOUND_PHONE_HEADER_TEXT_30_FEET" desc="The text to show as the header body text of the Easy Unlock dialog during the second step, after a suitable phone has been found. Note that the <a> element surrounds a link; these HTML elements should be preserved in the translation. This string is identical ot 'IDS_EASY_UNLOCK_SETUP_FOUND_PHONE_HEADER_TEXT', but uses a 30 in place of the 100."> - Google sent a notification to this phone. Note that with Bluetooth, your phone may keep your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> unlocked from over 30 feet away. In cases where this could be a problem, you can <a>temporarily disable this feature</a>. - </message> <message name="IDS_EASY_UNLOCK_SETUP_FOUND_PHONE_USE_THIS_PHONE_BUTTON_LABEL" desc="The text to show as the 'Use this phone' button label in the Easy Unlock dialog. This button is visible during the second step, after a suitable phone is found."> Use this phone </message> @@ -14426,22 +13612,14 @@ Chrome device </message> - <!-- Invalid SSL certificate memory strategy strings --> - <message name="IDS_FLAGS_REMEMBER_CERTIFICATE_ERROR_DECISIONS_NAME" desc="Name of the remember certificate error decisions lab"> - Remember decisions to proceed through SSL errors for a specified length of time. + <!-- Built-in hotword detection display strings --> + <message name="IDS_FLAGS_EXPERIMENTAL_HOTWORD_HARDWARE_NAME" desc="Name of about:flags option for hotword hardware detection."> + Simulated hardware 'Ok Google' features </message> - <message name="IDS_FLAGS_REMEMBER_CERTIFICATE_ERROR_DECISIONS_DESCRIPTION" desc="Description of the remember certificate error decisions lab"> - Remember decisions to proceed through SSL errors for a specified length of time. + <message name="IDS_FLAGS_EXPERIMENTAL_HOTWORD_HARDWARE_DESCRIPTION" desc="Description of about:flags option for hotword hardware detection."> + Enables an experimental version of 'Ok Google' hotword detection features that have a hardware dependency. </message> - <!-- Built-in hotword detection display strings --> - <message name="IDS_FLAGS_EXPERIMENTAL_HOTWORD_HARDWARE_NAME" desc="Name of about:flags option for hotword hardware detection."> - Simulated hardware 'Ok Google' features - </message> - <message name="IDS_FLAGS_EXPERIMENTAL_HOTWORD_HARDWARE_DESCRIPTION" desc="Description of about:flags option for hotword hardware detection."> - Enables an experimental version of 'Ok Google' hotword detection features that have a hardware dependency. - </message> - <!-- Message center strings --> <message name="IDS_FLAGS_MESSAGE_CENTER_ALWAYS_SCROLL_UP_UPON_REMOVAL_NAME" desc="Name of about:flags option for message center always scroll up experiment."> Experiments that message center always scroll up upon notification removal @@ -14633,13 +13811,6 @@ <ph name="EVENT_NAME">$3<ex>Event Description</ex></ph> </message> - <message name="IDS_ENABLE_INVALID_CERT_COLLECTION" desc="Name of the 'Enable invalid certificate collection' flag."> - Enable opt-in for reporting invalid TLS/SSL certificate chains - </message> - <message name="IDS_ENABLE_INVALID_CERT_COLLECTION_DESCRIPTION" desc="Description of the 'Enable invalid certificate collection' flag."> - Allows users to opt in to the collection of invalid TLS/SSL certificate chains. - </message> - <!-- Printer detected notification --> <if expr="chromeos"> <message name="IDS_PRINTER_DETECTED_NOTIFICATION_TITLE" desc="Title for notification shown to the user when a printer gets plugged in to a Chrome OS device."> @@ -14809,13 +13980,7 @@ <message name="IDS_FLAGS_USE_WINRT_MIDI_API_DESCRIPTION" desc="Description for the flag to use Windows Runtime MIDI API."> Use Windows Runtime MIDI API for WebMIDI (effective only on Windows 10 or later). </message> - <message name="IDS_FLAGS_DISABLE_WINRT_MIDI_API_NAME" desc="Name for the flag to disable Windows Runtime MIDI API."> - Disable Windows Runtime MIDI API - </message> - <message name="IDS_FLAGS_DISABLE_WINRT_MIDI_API_DESCRIPTION" desc="Description for the flag to disable Windows Runtime MIDI API."> - Disable Windows Runtime MIDI API for WebMIDI, which is enabled by default on Windows 10 or later. - </message> - </if> + </if> <!-- WebUsb Notification --> <message name="IDS_WEBUSB_DEVICE_DETECTED_NOTIFICATION" desc="Content for notification shown to the user when a USB device gets plugged in."> @@ -14983,27 +14148,9 @@ <message name="IDS_FLAGS_HERB_PROTOTYPE_CHOICES_DESCRIPTION" desc="Description for the flag to enable the new UI prototypes for tab management." translateable="false"> Switching this option changes which tab management prototype is being tested. </message> - <message name="IDS_FLAGS_HERB_PROTOTYPE_FLAVOR_ANISE" desc="CCT for View Intents, regular CTA" translateable="false"> - ANISE: CCT for View Intents, regular CTA - </message> - <message name="IDS_FLAGS_HERB_PROTOTYPE_FLAVOR_BASIL" desc="CCT for View Intents, CTA with X" translateable="false"> - BASIL: CCT for View Intents, CTA with X - </message> - <message name="IDS_FLAGS_HERB_PROTOTYPE_FLAVOR_CHIVE" desc="No CCT, CTA with X" translateable="false"> - CHIVE: All View Intents go to CTA with X - </message> - <message name="IDS_FLAGS_HERB_PROTOTYPE_FLAVOR_DILL" desc="CCT everywhere" translateable="false"> - DILL: All View Intents in CCT - </message> <message name="IDS_FLAGS_HERB_PROTOTYPE_FLAVOR_ELDERBERRY" desc="CCT everywhere" translateable="false"> ELDERBERRY: All View Intents in CCT v2 </message> - <message name="IDS_FLAGS_TAB_SWITCHER_IN_DOCUMENT_MODE_NAME" desc="Name for the flag to enable tab switcher in document mode."> - Enable tab switcher in document mode. - </message> - <message name="IDS_FLAGS_TAB_SWITCHER_IN_DOCUMENT_MODE_DESCRIPTION" desc="Description for the flag to enable tab switcher in document mode."> - If enabled, a tab switcher will show even when 'merge tabs and apps' option is on in the settings. - </message> <message name="IDS_FLAGS_ENABLE_SPECIAL_LOCALE_NAME" desc="Name of the option to show special locale."> Enable custom logic for special locales. </message> @@ -15060,13 +14207,6 @@ <message name="IDS_FLAGS_ENABLE_SCROLL_ANCHORING_DESCRIPTION" desc="Description of the scroll anchoring flag"> Adjusts scroll position to prevent visible jumps when offscreen content changes. </message> - <message name="IDS_FLAGS_ENABLE_DOWNLOADS_UI_NAME" desc="Name of the show downloads ui flag"> - Enable downloads manager UI in the app menu. - </message> - <message name="IDS_FLAGS_ENABLE_DOWNLOADS_UI_DESCRIPTION" desc="Description of the show downloads ui."> - Enable downloads manager UI in the app menu. - </message> - <if expr="chromeos"> <message name="IDS_FLAGS_ENABLE_NATIVE_CUPS_NAME" desc="Name of the native cups flag."> Native CUPS @@ -15170,15 +14310,6 @@ </if> <if expr="is_android"> - <message name="IDS_FLAGS_IME_THREAD_NAME" desc="Name for the flag to use IME thread."> - Run IME on its own thread. - </message> - <message name="IDS_FLAGS_IME_THREAD_DESCRIPTION" desc="Description for the flag to enable and disable IME thread."> - If enabled, InputConnection calls run on IME thread, and instead of keeping a replica editor, each InputConnection call will directly talk to renderer. - </message> - </if> - - <if expr="is_android"> <message name="IDS_FLAGS_OFFLINING_RECENT_PAGES_NAME" desc="Name for the flag to enable offlining of recently visited pages."> Enable offlining of recently visited pages </message> @@ -15232,14 +14363,6 @@ <message name="IDS_IME_API_NEVER_SHOW" desc="Checkbox that controls whether this bubble will be shown every time."> Never show this again. </message> - <if expr="chromeos"> - <message name="IDS_FLAGS_ENABLE_FILES_DETAILS_PANEL_NAME" desc="Name of the flag to enable files details panel."> - Files app details panel - </message> - <message name="IDS_FLAGS_ENABLE_FILES_DETAILS_PANEL_DESCRIPTION" desc="Description for the flag to enable files details panel."> - Shows files details panel, which shows detailed information of files. - </message> - </if> <message name="IDS_FLAGS_OPTIMIZE_LOADING_IPC_FOR_SMALL_RESOURCES_NAME" desc="Title for the flag to enable a loading IPC optimization for small resources."> Enable loading IPC optimization for small resources. </message> @@ -15330,17 +14453,7 @@ Add a card </message> - <!-- Safe Browsing Subresource Filter UI strings. --> - <if expr="use_titlecase"> - <message name="IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_OK" desc="In Title Case: button which dismisses the Content blocked prompt without performing any actions."> - Got It - </message> - </if> - <if expr="not use_titlecase"> - <message name="IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_OK" desc="Button which dismisses the Content blocked prompt without performing any actions."> - Got it - </message> - </if> + <!-- Safe Browsing Subresource Filter UI strings. --> <if expr="use_titlecase"> <message name="IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD" desc="In Title Case: Button which reloads the page in order to also show content that was previously blocked."> Load Full Site @@ -15446,22 +14559,6 @@ <message name="IDS_MEDIA_REMOTING_CAST_ERROR_TEXT" desc="The text shown on the media player when there is an error when trying to stream the video remotely."> Cast Error </message> - <message name="IDS_MEDIA_REMOTING_STREAMING_BLOCKED_TITLE" desc="The title of the modal dialog that is shown when remote video streaming is blocked."> - Video streaming blocked - </message> - <message name="IDS_MEDIA_REMOTING_STREAMING_BLOCKED_DESCRIPTION" desc="The description text of the modal dialog that is shown when remote video streaming is blocked, which recommends the user to reload the page to try enabling streaming."> - This site has blocked streaming to your Cast device. Reload to try again. - </message> - <message name="IDS_MEDIA_REMOTING_RELOAD_BUTTON" desc="A button on a modal dialog, which, on click, will reload the page."> - Reload - </message> - <message name="IDS_MEDIA_REMOTING_CANCEL_BUTTON" desc="A button on a modal dialog, which, on click, will close the dialog."> - Cancel - </message> - <message name="IDS_MEDIA_REMOTING_EXIT_FULL_SCREEN_BUTTON" desc="A button on a full screened tab, which, on click, will exit full screen mode."> - Exit Full Screen - </message> - <!-- Expensive background timer throttling flag --> <message name="IDS_FLAGS_EXPENSIVE_BACKGROUND_TIMER_THROTTLING_NAME" desc="Name for the flag to enable expensive background timer throttling"> Throttle expensive background timers
diff --git a/chrome/browser/android/vr_shell/PRESUBMIT.py b/chrome/browser/android/vr_shell/PRESUBMIT.py new file mode 100644 index 0000000..2292c80e --- /dev/null +++ b/chrome/browser/android/vr_shell/PRESUBMIT.py
@@ -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. + +"""Presubmit script for changes affecting chrome/browser/android/vr_shell + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + +import re + +# chrome/PRESUBMIT.py blocks several linters due to the infeasibility of +# enforcing them on a large codebase. Here we'll start by enforcing all +# linters, and add exclusions if necessary. +# +# Note that this list must be non-empty, or cpplint will use its default set of +# filters. Therefore, explicitly enable a single dummy linter. +LINT_FILTERS = [ + '+build/include', +] + +VERBOSITY_LEVEL = 4 + +INCLUDE_CPP_FILES_ONLY = (r'.*\.(cc|h)$',) + +def _CheckChangeLintsClean(input_api, output_api): + sources = lambda x: input_api.FilterSourceFile( + x, white_list=INCLUDE_CPP_FILES_ONLY) + return input_api.canned_checks.CheckChangeLintsClean( + input_api, output_api, sources, LINT_FILTERS, VERBOSITY_LEVEL) + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results.extend(_CheckChangeLintsClean(input_api, output_api)) + return results + +def CheckChangeOnCommit(input_api, output_api): + results = [] + results.extend(_CheckChangeLintsClean(input_api, output_api)) + return results
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index c6d40d4..1559828 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -324,7 +324,6 @@ </if> <include name="IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST" file="resources\identity_scope_approval_dialog\manifest.json" type="BINDATA" /> - <include name="IDR_NEW_INLINE_LOGIN_HTML" file="resources\inline_login\new_inline_login.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_INLINE_LOGIN_HTML" file="resources\inline_login\inline_login.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_INLINE_LOGIN_CSS" file="resources\inline_login\inline_login.css" flattenhtml="true" type="BINDATA" /> <include name="IDR_INLINE_LOGIN_JS" file="resources\inline_login\inline_login.js" flattenhtml="true" type="BINDATA" />
diff --git a/chrome/browser/budget_service/OWNERS b/chrome/browser/budget_service/OWNERS index 0be0ee4..78836f3 100644 --- a/chrome/browser/budget_service/OWNERS +++ b/chrome/browser/budget_service/OWNERS
@@ -2,4 +2,5 @@ johnme@chromium.org peter@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: Blink>PushAPI
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.cc b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.cc index 10f4bc12..1e9354c0 100644 --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.cc +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.cc
@@ -171,10 +171,11 @@ } void ArcKioskAppManager::UpdateApps() { - // Do not populate ARC kiosk apps if ARC apps can't be run on the device. + // Do not populate ARC kiosk apps if ARC kiosk apps can't be run on the + // device. // Apps won't be added to kiosk Apps menu and won't be auto-launched. - if (!arc::IsArcAvailable()) { - VLOG(1) << "Device doesn't support ARC apps, don't populate ARC kiosk apps"; + if (!arc::IsArcKioskAvailable()) { + VLOG(1) << "Device doesn't support ARC kiosk"; return; }
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc index a1a050f..a1c81b7 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -75,10 +75,8 @@ ash::ShelfDelegate* GetShelfDelegate() { if (g_shelf_delegate_for_testing) return g_shelf_delegate_for_testing; - if (ash::WmShell::HasInstance()) { - DCHECK(ash::WmShell::Get()->shelf_delegate()); + if (ash::WmShell::HasInstance()) return ash::WmShell::Get()->shelf_delegate(); - } return nullptr; }
diff --git a/chrome/browser/chromeos/arc/arc_util.cc b/chrome/browser/chromeos/arc/arc_util.cc index 03dab5b1..de722a7 100644 --- a/chrome/browser/chromeos/arc/arc_util.cc +++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -28,7 +28,10 @@ return false; } - if (!IsArcAvailable()) { + // ARC Kiosk can be enabled even if ARC is not yet supported on the device. + // In that case IsArcKioskMode() should return true as profile is already + // created. + if (!IsArcAvailable() && !(IsArcKioskMode() && IsArcKioskAvailable())) { VLOG(1) << "ARC is not available."; return false; }
diff --git a/chrome/browser/chromeos/arc/arc_util_unittest.cc b/chrome/browser/chromeos/arc/arc_util_unittest.cc index 1fe41ed8..7b2018e 100644 --- a/chrome/browser/chromeos/arc/arc_util_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc
@@ -179,7 +179,30 @@ EXPECT_FALSE(IsArcAllowedForProfile(profile())); } -TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_Kiosk) { +TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcEnabled) { + ScopedLogIn login(GetFakeUserManager(), + AccountId::FromUserEmail(profile()->GetProfileUserName()), + user_manager::USER_TYPE_ARC_KIOSK_APP); + EXPECT_FALSE(chromeos::ProfileHelper::Get() + ->GetUserByProfile(profile()) + ->HasGaiaAccount()); + EXPECT_TRUE(IsArcAllowedForProfile(profile())); +} + +TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcDisabled) { + base::CommandLine::ForCurrentProcess()->InitFromArgv({""}); + ScopedLogIn login(GetFakeUserManager(), + AccountId::FromUserEmail(profile()->GetProfileUserName()), + user_manager::USER_TYPE_ARC_KIOSK_APP); + EXPECT_FALSE(chromeos::ProfileHelper::Get() + ->GetUserByProfile(profile()) + ->HasGaiaAccount()); + EXPECT_FALSE(IsArcAllowedForProfile(profile())); +} + +TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskOnlyEnabled) { + base::CommandLine::ForCurrentProcess()->InitFromArgv( + {"", "--arc-availability=installed-only-kiosk-supported"}); ScopedLogIn login(GetFakeUserManager(), AccountId::FromUserEmail(profile()->GetProfileUserName()), user_manager::USER_TYPE_ARC_KIOSK_APP);
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h index 3beb8a8..1bd7f1f 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h
@@ -96,6 +96,7 @@ FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, TestAuthCodeGetsProperlyReceivedFromGaia); FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput); + FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, ContinueClickedOnlyOnce); FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, Retries); FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryOnTopOfUser); FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryAfterSuccess);
diff --git a/chrome/browser/chromeos/login/screens/base_screen.h b/chrome/browser/chromeos/login/screens/base_screen.h index cb2bebd..dcaa6fea 100644 --- a/chrome/browser/chromeos/login/screens/base_screen.h +++ b/chrome/browser/chromeos/login/screens/base_screen.h
@@ -129,6 +129,7 @@ FRIEND_TEST_ALL_PREFIXES(MultiAuthEnrollmentScreenTest, TestCancel); FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput); + FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, ContinueClickedOnlyOnce); friend class BaseScreenHandler; friend class NetworkScreenTest;
diff --git a/chrome/browser/chromeos/login/screens/network_screen.cc b/chrome/browser/chromeos/login/screens/network_screen.cc index 4e7e084..90d0bd1e 100644 --- a/chrome/browser/chromeos/login/screens/network_screen.cc +++ b/chrome/browser/chromeos/login/screens/network_screen.cc
@@ -360,7 +360,7 @@ view_->ShowConnectingStatus(false, network_id_); GetContextEditor().SetBoolean(kContextKeyContinueButtonEnabled, is_connected); - if (is_connected && + if (is_connected && continue_attempts_ == 0 && policy::DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode() == policy::ZeroTouchEnrollmentMode::HANDS_OFF) { OnContinueButtonPressed(); @@ -384,6 +384,7 @@ } void NetworkScreen::OnContinueButtonPressed() { + ++continue_attempts_; if (view_) { view_->StopDemoModeDetection(); view_->ClearErrors();
diff --git a/chrome/browser/chromeos/login/screens/network_screen.h b/chrome/browser/chromeos/login/screens/network_screen.h index 5e7d162..5fe898d5 100644 --- a/chrome/browser/chromeos/login/screens/network_screen.h +++ b/chrome/browser/chromeos/login/screens/network_screen.h
@@ -98,6 +98,7 @@ FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, Timeout); FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, CanConnect); FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput); + FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, ContinueClickedOnlyOnce); // BaseScreen implementation: void Show() override; @@ -178,8 +179,14 @@ // ID of the the network that we are waiting for. base::string16 network_id_; - // True if user pressed continue button so we should proceed with OOBE - // as soon as we are connected. + // Keeps track of the number of times OnContinueButtonPressed was called. + // OnContinueButtonPressed is called either in response to the user + // pressing the continue button, or automatically during hands-off enrollment + // after a network connection is established. + int continue_attempts_ = 0; + + // True if the user pressed the continue button in the UI. + // Indicates that we should proceed with OOBE as soon as we are connected. bool continue_pressed_ = false; // Timer for connection timeout.
diff --git a/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc index 2c7249e..163cc7d 100644 --- a/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/network_screen_browsertest.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/macros.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/screens/base_screen.h" @@ -237,4 +238,42 @@ ->enrollment_helper_.reset(); } +IN_PROC_BROWSER_TEST_F(HandsOffNetworkScreenTest, ContinueClickedOnlyOnce) { + WizardController* wizard_controller = WizardController::default_controller(); + + // Allow the WizardController to advance through the enrollment flow. + network_screen_->base_screen_delegate_ = wizard_controller; + + // Check that OnContinueButtonPressed has not been called yet. + ASSERT_EQ(0, network_screen_->continue_attempts_); + + // Connect to network "net0". + EXPECT_CALL(*mock_network_state_helper_, GetCurrentNetworkName()) + .Times(AnyNumber()) + .WillRepeatedly(Return(base::ASCIIToUTF16("net0"))); + EXPECT_CALL(*mock_network_state_helper_, IsConnected()) + .Times(AnyNumber()) + .WillRepeatedly(Return(true)); + + // Stop waiting for net0. + network_screen_->StopWaitingForConnection(base::ASCIIToUTF16("net0")); + + // Check that OnContinueButtonPressed has been called exactly once. + ASSERT_EQ(1, network_screen_->continue_attempts_); + + // Stop waiting for another network, net1. + network_screen_->StopWaitingForConnection(base::ASCIIToUTF16("net1")); + + // Check that OnContinueButtonPressed stil has been called exactly once + ASSERT_EQ(1, network_screen_->continue_attempts_); + + // Wait for the enrollment screen. + OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT) + .WaitNoAssertCurrentScreen(); + + // Reset the enrollment helper so there is no side effect with other tests. + static_cast<EnrollmentScreen*>(wizard_controller->current_screen()) + ->enrollment_helper_.reset(); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc index 359a585..782663d 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -64,6 +64,7 @@ #include "chromeos/login/login_state.h" #include "chromeos/settings/cros_settings_names.h" #include "chromeos/timezone/timezone_resolver.h" +#include "components/arc/arc_util.h" #include "components/policy/policy_constants.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" @@ -872,6 +873,7 @@ void ChromeUserManagerImpl::ArcKioskAppLoggedIn(user_manager::User* user) { DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK(arc::IsArcKioskAvailable()); active_user_ = user; active_user_->SetStubImage( @@ -881,13 +883,6 @@ user_manager::User::USER_IMAGE_INVALID, false); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - // This works partially, because sevices calling IsArcAvailable() - // before Kiosk log-in does not work. This causes an issue that ARC apps - // may not be shown in App launcher. cf) crbug.com/685393, crbug.com/678846. - // TODO(hidehiko|poromov|lhchavez): Find a correct approach, then remove - // this. - command_line->AppendSwitchASCII(chromeos::switches::kArcAvailability, - "officially-supported"); command_line->AppendSwitch(::switches::kForceAndroidAppMode); command_line->AppendSwitch(::switches::kSilentLaunch);
diff --git a/chrome/browser/component_updater/recovery_improved_component_installer.cc b/chrome/browser/component_updater/recovery_improved_component_installer.cc index 5ec1ff8..f7a4c7a 100644 --- a/chrome/browser/component_updater/recovery_improved_component_installer.cc +++ b/chrome/browser/component_updater/recovery_improved_component_installer.cc
@@ -8,17 +8,16 @@ #include <utility> #include "base/callback.h" +#include "build/build_config.h" namespace component_updater { // The SHA256 of the SubjectPublicKeyInfo used to sign the component CRX. -// The extension id is: iddcipcljjhfegcfaaaapdilddpplalp +// The component id is: iddcipcljjhfegcfaaaapdilddpplalp constexpr uint8_t kPublicKeySHA256[32] = { - 0x97, 0xf0, 0xbe, 0xe4, 0x3f, 0x2b, 0x9e, 0xcf, 0x2c, 0x50, 0x61, - 0xdf, 0xc2, 0x6e, 0x0b, 0x4a, 0x4f, 0x1e, 0xda, 0x71, 0x29, 0x64, - 0x74, 0x70, 0x15, 0x07, 0x18, 0xb7, 0x92, 0x04, 0xcd, 0x70}; - -constexpr char kRecoveryImprovedManifestName[] = "Chrome Improved Recovery"; + 0x83, 0x32, 0x8f, 0x2b, 0x99, 0x75, 0x46, 0x25, 0x00, 0x00, 0xf3, + 0x8b, 0x33, 0xff, 0xb0, 0xbf, 0xea, 0xea, 0x19, 0xb3, 0x38, 0xfb, + 0xdc, 0xb3, 0x28, 0x90, 0x5f, 0xe2, 0xbe, 0x28, 0x89, 0x11}; RecoveryImprovedInstallerTraits::RecoveryImprovedInstallerTraits( PrefService* prefs) @@ -45,7 +44,9 @@ void RecoveryImprovedInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& install_dir, - std::unique_ptr<base::DictionaryValue> manifest) {} + std::unique_ptr<base::DictionaryValue> manifest) { + DVLOG(1) << "RecoveryImproved component is ready."; +} // Called during startup and installation before ComponentReady(). bool RecoveryImprovedInstallerTraits::VerifyInstallation( @@ -64,7 +65,7 @@ } std::string RecoveryImprovedInstallerTraits::GetName() const { - return kRecoveryImprovedManifestName; + return "Chrome Improved Recovery"; } update_client::InstallerAttributes @@ -78,6 +79,8 @@ void RegisterRecoveryImprovedComponent(ComponentUpdateService* cus, PrefService* prefs) { +#if defined(GOOGLE_CHROME_BUILD) +#if defined(OS_WIN) || defined(OS_MACOSX) DVLOG(1) << "Registering RecoveryImproved component."; std::unique_ptr<ComponentInstallerTraits> traits( @@ -86,6 +89,8 @@ DefaultComponentInstaller* installer = new DefaultComponentInstaller(std::move(traits)); installer->Register(cus, base::Closure()); +#endif +#endif } void RegisterPrefsForRecoveryImprovedComponent(PrefRegistrySimple* registry) {}
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc index 1e7c549d..c6f19a7 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
@@ -37,6 +37,9 @@ const char kTemporaryFileError[] = "Failed to create a temporary file."; const char kTabClosedError[] = "Cannot find the tab for this request."; +void ClearFileReferenceOnIOThread( + scoped_refptr<storage::ShareableFileReference>) {} + } // namespace static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL; @@ -46,10 +49,9 @@ PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { if (mhtml_file_.get()) { - storage::ShareableFileReference* to_release = mhtml_file_.get(); - to_release->AddRef(); - mhtml_file_ = NULL; - BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, to_release); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&ClearFileReferenceOnIOThread, base::Passed(&mhtml_file_))); } }
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc index aaf29b0..e78282b 100644 --- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc +++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
@@ -68,7 +68,6 @@ GaiaAuthExtensionLoader::GaiaAuthExtensionLoader(BrowserContext* context) : browser_context_(context), load_count_(0), - last_data_id_(0), weak_ptr_factory_(this) { } @@ -93,7 +92,6 @@ --load_count_; if (load_count_ == 0) { UnloadGaiaAuthExtension(browser_context_); - data_.clear(); } } @@ -102,7 +100,6 @@ UnloadGaiaAuthExtension(browser_context_); load_count_ = 0; } - data_.clear(); } // static
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.h b/chrome/browser/extensions/signin/gaia_auth_extension_loader.h index a4d84a94..bc1fe6e 100644 --- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.h +++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.h
@@ -5,9 +5,6 @@ #ifndef CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ #define CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ -#include <map> -#include <string> - #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "extensions/browser/browser_context_keyed_api_factory.h" @@ -55,9 +52,6 @@ content::BrowserContext* browser_context_; int load_count_; - int last_data_id_; - std::map<int, std::string> data_; - base::WeakPtrFactory<GaiaAuthExtensionLoader> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader);
diff --git a/chrome/browser/gcm/fake_gcm_profile_service.cc b/chrome/browser/gcm/fake_gcm_profile_service.cc index f2db5fb..58c18f05 100644 --- a/chrome/browser/gcm/fake_gcm_profile_service.cc +++ b/chrome/browser/gcm/fake_gcm_profile_service.cc
@@ -10,20 +10,22 @@ #include "base/format_macros.h" #include "base/location.h" #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_task_runner_handle.h" +#include "base/time/time.h" #include "chrome/browser/profiles/profile.h" #include "components/gcm_driver/fake_gcm_client_factory.h" +#include "components/gcm_driver/gcm_driver.h" #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h" #include "content/public/browser/browser_context.h" namespace gcm { -namespace { - -class CustomFakeGCMDriver : public instance_id::FakeGCMDriverForInstanceID { +class FakeGCMProfileService::CustomFakeGCMDriver + : public instance_id::FakeGCMDriverForInstanceID { public: explicit CustomFakeGCMDriver(FakeGCMProfileService* service); ~CustomFakeGCMDriver() override; @@ -31,8 +33,6 @@ void OnRegisterFinished(const std::string& app_id, const std::string& registration_id, GCMClient::Result result); - void OnUnregisterFinished(const std::string& app_id, - GCMClient::Result result); void OnSendFinished(const std::string& app_id, const std::string& message_id, GCMClient::Result result); @@ -41,7 +41,7 @@ const IncomingMessage& message); protected: - // FakeGCMDriverForInstanceID overrides: + // FakeGCMDriver overrides: void RegisterImpl(const std::string& app_id, const std::vector<std::string>& sender_ids) override; void UnregisterImpl(const std::string& app_id) override; @@ -51,72 +51,151 @@ const std::string& receiver_id, const OutgoingMessage& message) override; + // FakeGCMDriverForInstanceID overrides: + void GetToken(const std::string& app_id, + const std::string& authorized_entity, + const std::string& scope, + const std::map<std::string, std::string>& options, + const GetTokenCallback& callback) override; + void DeleteToken(const std::string& app_id, + const std::string& authorized_entity, + const std::string& scope, + const DeleteTokenCallback& callback) override; + private: + void DoRegister(const std::string& app_id, + const std::vector<std::string>& sender_ids, + const std::string& registration_id); + void DoSend(const std::string& app_id, + const std::string& receiver_id, + const OutgoingMessage& message); + FakeGCMProfileService* service_; + // Used to give each registration a unique registration id. Does not decrease + // when unregister is called. + int registration_count_ = 0; + + base::WeakPtrFactory<CustomFakeGCMDriver> weak_factory_; // Must be last. + DISALLOW_COPY_AND_ASSIGN(CustomFakeGCMDriver); }; -CustomFakeGCMDriver::CustomFakeGCMDriver(FakeGCMProfileService* service) +FakeGCMProfileService::CustomFakeGCMDriver::CustomFakeGCMDriver( + FakeGCMProfileService* service) : instance_id::FakeGCMDriverForInstanceID( base::ThreadTaskRunnerHandle::Get()), - service_(service) {} + service_(service), + weak_factory_(this) {} -CustomFakeGCMDriver::~CustomFakeGCMDriver() { -} +FakeGCMProfileService::CustomFakeGCMDriver::~CustomFakeGCMDriver() {} -void CustomFakeGCMDriver::RegisterImpl( +void FakeGCMProfileService::CustomFakeGCMDriver::RegisterImpl( const std::string& app_id, const std::vector<std::string>& sender_ids) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&FakeGCMProfileService::RegisterFinished, - base::Unretained(service_), app_id, sender_ids)); -} + if (service_->is_offline_) + return; // Drop request. -void CustomFakeGCMDriver::UnregisterImpl(const std::string& app_id) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&FakeGCMProfileService::UnregisterFinished, - base::Unretained(service_), app_id)); -} + // Generate fake registration IDs, encoding the number of sender IDs (used by + // GcmApiTest.RegisterValidation), then an incrementing count (even for the + // same app_id - there's no caching) so tests can distinguish registrations. + std::string registration_id = base::StringPrintf( + "%" PRIuS "-%d", sender_ids.size(), registration_count_); + ++registration_count_; -void CustomFakeGCMDriver::UnregisterWithSenderIdImpl( - const std::string& app_id, - const std::string& sender_id) {} - -void CustomFakeGCMDriver::SendImpl(const std::string& app_id, - const std::string& receiver_id, - const OutgoingMessage& message) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&FakeGCMProfileService::SendFinished, - base::Unretained(service_), app_id, receiver_id, message)); + base::Bind(&CustomFakeGCMDriver::DoRegister, weak_factory_.GetWeakPtr(), + app_id, sender_ids, registration_id)); } -void CustomFakeGCMDriver::OnRegisterFinished( +void FakeGCMProfileService::CustomFakeGCMDriver::DoRegister( const std::string& app_id, - const std::string& registration_id, - GCMClient::Result result) { - RegisterFinished(app_id, registration_id, result); + const std::vector<std::string>& sender_ids, + const std::string& registration_id) { + if (service_->collect_) { + service_->last_registered_app_id_ = app_id; + service_->last_registered_sender_ids_ = sender_ids; + } + RegisterFinished(app_id, registration_id, GCMClient::SUCCESS); } -void CustomFakeGCMDriver::OnUnregisterFinished(const std::string& app_id, - GCMClient::Result result) { - UnregisterFinished(app_id, result); +void FakeGCMProfileService::CustomFakeGCMDriver::UnregisterImpl( + const std::string& app_id) { + if (service_->is_offline_) + return; // Drop request. + + GCMClient::Result result = GCMClient::SUCCESS; + if (!service_->unregister_responses_.empty()) { + result = service_->unregister_responses_.front(); + service_->unregister_responses_.pop_front(); + } + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&CustomFakeGCMDriver::UnregisterFinished, + weak_factory_.GetWeakPtr(), app_id, result)); } -void CustomFakeGCMDriver::OnSendFinished(const std::string& app_id, - const std::string& message_id, - GCMClient::Result result) { - SendFinished(app_id, message_id, result); +void FakeGCMProfileService::CustomFakeGCMDriver::UnregisterWithSenderIdImpl( + const std::string& app_id, + const std::string& sender_id) { + NOTREACHED() << "This Android-specific method is not yet faked."; } -void CustomFakeGCMDriver::OnDispatchMessage(const std::string& app_id, - const IncomingMessage& message) { +void FakeGCMProfileService::CustomFakeGCMDriver::SendImpl( + const std::string& app_id, + const std::string& receiver_id, + const OutgoingMessage& message) { + if (service_->is_offline_) + return; // Drop request. + + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&CustomFakeGCMDriver::DoSend, weak_factory_.GetWeakPtr(), + app_id, receiver_id, message)); +} + +void FakeGCMProfileService::CustomFakeGCMDriver::DoSend( + const std::string& app_id, + const std::string& receiver_id, + const OutgoingMessage& message) { + if (service_->collect_) { + service_->last_sent_message_ = message; + service_->last_receiver_id_ = receiver_id; + } + SendFinished(app_id, message.id, GCMClient::SUCCESS); +} + +void FakeGCMProfileService::CustomFakeGCMDriver::GetToken( + const std::string& app_id, + const std::string& authorized_entity, + const std::string& scope, + const std::map<std::string, std::string>& options, + const GetTokenCallback& callback) { + if (service_->is_offline_) + return; // Drop request. + + instance_id::FakeGCMDriverForInstanceID::GetToken(app_id, authorized_entity, + scope, options, callback); +} + +void FakeGCMProfileService::CustomFakeGCMDriver::DeleteToken( + const std::string& app_id, + const std::string& authorized_entity, + const std::string& scope, + const DeleteTokenCallback& callback) { + if (service_->is_offline_) + return; // Drop request. + + instance_id::FakeGCMDriverForInstanceID::DeleteToken( + app_id, authorized_entity, scope, callback); +} + +void FakeGCMProfileService::CustomFakeGCMDriver::OnDispatchMessage( + const std::string& app_id, + const IncomingMessage& message) { DispatchMessage(app_id, message); } -} // namespace - // static std::unique_ptr<KeyedService> FakeGCMProfileService::Build( content::BrowserContext* context) { @@ -127,73 +206,15 @@ return std::move(service); } -FakeGCMProfileService::FakeGCMProfileService(Profile* profile) - : collect_(false), - registration_count_(0) { -} +FakeGCMProfileService::FakeGCMProfileService(Profile* profile) {} FakeGCMProfileService::~FakeGCMProfileService() {} -void FakeGCMProfileService::RegisterFinished( - const std::string& app_id, - const std::vector<std::string>& sender_ids) { - if (collect_) { - last_registered_app_id_ = app_id; - last_registered_sender_ids_ = sender_ids; - } - - // Generate fake registration IDs, encoding the number of sender IDs (used by - // GcmApiTest.RegisterValidation), then an incrementing count (even for the - // same app_id - there's no caching) so tests can distinguish registrations. - std::string registration_id = base::StringPrintf("%" PRIuS "-%d", - sender_ids.size(), - registration_count_); - ++registration_count_; - - CustomFakeGCMDriver* custom_driver = - static_cast<CustomFakeGCMDriver*>(driver()); - custom_driver->OnRegisterFinished( - app_id, registration_id, GCMClient::SUCCESS); -} - -void FakeGCMProfileService::UnregisterFinished(const std::string& app_id) { - GCMClient::Result result = GCMClient::SUCCESS; - if (!unregister_responses_.empty()) { - result = unregister_responses_.front(); - unregister_responses_.pop_front(); - } - - CustomFakeGCMDriver* custom_driver = - static_cast<CustomFakeGCMDriver*>(driver()); - custom_driver->OnUnregisterFinished(app_id, result); - - if (!unregister_callback_.is_null()) - unregister_callback_.Run(app_id); -} - -void FakeGCMProfileService::SendFinished(const std::string& app_id, - const std::string& receiver_id, - const OutgoingMessage& message) { - if (collect_) { - last_sent_message_ = message; - last_receiver_id_ = receiver_id; - } - - CustomFakeGCMDriver* custom_driver = - static_cast<CustomFakeGCMDriver*>(driver()); - custom_driver->OnSendFinished(app_id, message.id, GCMClient::SUCCESS); -} - void FakeGCMProfileService::AddExpectedUnregisterResponse( GCMClient::Result result) { unregister_responses_.push_back(result); } -void FakeGCMProfileService::SetUnregisterCallback( - const UnregisterCallback& callback) { - unregister_callback_ = callback; -} - void FakeGCMProfileService::DispatchMessage(const std::string& app_id, const IncomingMessage& message) { CustomFakeGCMDriver* custom_driver =
diff --git a/chrome/browser/gcm/fake_gcm_profile_service.h b/chrome/browser/gcm/fake_gcm_profile_service.h index 7b4db7b8..2a5ab46 100644 --- a/chrome/browser/gcm/fake_gcm_profile_service.h +++ b/chrome/browser/gcm/fake_gcm_profile_service.h
@@ -10,7 +10,8 @@ #include <vector> #include "base/macros.h" -#include "components/gcm_driver/gcm_driver.h" +#include "components/gcm_driver/common/gcm_messages.h" +#include "components/gcm_driver/gcm_client.h" #include "components/gcm_driver/gcm_profile_service.h" class Profile; @@ -24,8 +25,6 @@ // Acts as a bridge between GCM API and GCMClient layer for testing purposes. class FakeGCMProfileService : public GCMProfileService { public: - typedef base::Callback<void(const std::string&)> UnregisterCallback; - // Helper function to be used with // KeyedService::SetTestingFactory(). static std::unique_ptr<KeyedService> Build(content::BrowserContext* context); @@ -33,17 +32,8 @@ explicit FakeGCMProfileService(Profile* profile); ~FakeGCMProfileService() override; - void RegisterFinished(const std::string& app_id, - const std::vector<std::string>& sender_ids); - void UnregisterFinished(const std::string& app_id); - void SendFinished(const std::string& app_id, - const std::string& receiver_id, - const OutgoingMessage& message); - void AddExpectedUnregisterResponse(GCMClient::Result result); - void SetUnregisterCallback(const UnregisterCallback& callback); - void DispatchMessage(const std::string& app_id, const IncomingMessage& message); @@ -63,23 +53,26 @@ return last_registered_sender_ids_; } - void set_collect(bool collect) { - collect_ = collect; - } + // Set whether the service will collect parameters of the calls for further + // verification in tests. + void set_collect(bool collect) { collect_ = collect; } + + // Crude offline simulation: requests fail and never run their callbacks (in + // reality, callbacks run within GetGCMBackoffPolicy().maximum_backoff_ms). + void set_offline(bool is_offline) { is_offline_ = is_offline; } private: - // Indicates whether the service will collect paramters of the calls for - // furter verification in tests. - bool collect_; - // Used to give each registration a unique registration id. Does not decrease - // when unregister is called. - int registration_count_; + class CustomFakeGCMDriver; + friend class CustomFakeGCMDriver; + + bool collect_ = false; + bool is_offline_ = false; + std::string last_registered_app_id_; std::vector<std::string> last_registered_sender_ids_; std::list<GCMClient::Result> unregister_responses_; OutgoingMessage last_sent_message_; std::string last_receiver_id_; - UnregisterCallback unregister_callback_; DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); };
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc index 9d392a7c..186811f8 100644 --- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc +++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -9,7 +9,6 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" -#include "base/task_scheduler/post_task.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/metrics/chrome_metrics_service_client.h" @@ -57,19 +56,18 @@ const base::Feature kMetricsReportingFeature{"MetricsReporting", base::FEATURE_ENABLED_BY_DEFAULT}; -// Run |GoogleUpdateSettings::StoreMetricsClientInfo| asynchronously. This -// method cannot run on the UI thread because it does file I/O. +// Posts |GoogleUpdateSettings::StoreMetricsClientInfo| on blocking pool thread +// because it needs access to IO and cannot work from UI thread. void PostStoreMetricsClientInfo(const metrics::ClientInfo& client_info) { - // The UI thread starts running tasks after TaskScheduler is initialized. - // Posting a task to the UI thread to post a task to TaskScheduler ensures - // that TaskScheduler is ready to accept tasks at that time. + // The message loop processes messages after the blocking pool is initialized. + // Posting a task to the message loop to post a task to the blocking pool + // ensures that the blocking pool is ready to accept tasks at that time. content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind( [](const metrics::ClientInfo& client_info) { - base::PostTaskWithTraits( - FROM_HERE, base::TaskTraits().MayBlock().WithPriority( - base::TaskPriority::BACKGROUND), + content::BrowserThread::PostBlockingPoolTask( + FROM_HERE, base::Bind(&GoogleUpdateSettings::StoreMetricsClientInfo, client_info)); },
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index 67dd25a..41497fe 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -150,6 +150,8 @@ precision_percentage); UMA_HISTOGRAM_PERCENTAGE(internal::kResourcePrefetchPredictorRecallHistogram, recall_percentage); + UMA_HISTOGRAM_COUNTS_100(internal::kResourcePrefetchPredictorCountHistogram, + predicted_urls.size()); } } // namespace @@ -506,6 +508,12 @@ PrefetchOrigin origin) { TRACE_EVENT1("browser", "ResourcePrefetchPredictor::StartPrefetching", "url", url.spec()); + // Save prefetch start time to report prefetching duration. + if (inflight_prefetches_.find(url) == inflight_prefetches_.end() && + IsUrlPrefetchable(url)) { + inflight_prefetches_.insert(std::make_pair(url, base::TimeTicks::Now())); + } + if (!prefetch_manager_.get()) // Prefetching not enabled. return; if (!config_.IsPrefetchingEnabledForOrigin(profile_, origin)) @@ -524,6 +532,13 @@ void ResourcePrefetchPredictor::StopPrefetching(const GURL& url) { TRACE_EVENT1("browser", "ResourcePrefetchPredictor::StopPrefetching", "url", url.spec()); + auto it = inflight_prefetches_.find(url); + if (it != inflight_prefetches_.end()) { + UMA_HISTOGRAM_TIMES( + internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, + base::TimeTicks::Now() - it->second); + inflight_prefetches_.erase(it); + } if (!prefetch_manager_.get()) // Not enabled. return; @@ -769,6 +784,14 @@ ++it; } } + + for (auto it = inflight_prefetches_.begin(); + it != inflight_prefetches_.end();) { + if (time_now - it->second > max_navigation_age) + it = inflight_prefetches_.erase(it); + else + ++it; + } } void ResourcePrefetchPredictor::DeleteAllUrls() {
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h index 5bfc2bc..2af4be9e 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.h +++ b/chrome/browser/predictors/resource_prefetch_predictor.h
@@ -43,6 +43,10 @@ "ResourcePrefetchPredictor.LearningPrecision"; constexpr char kResourcePrefetchPredictorRecallHistogram[] = "ResourcePrefetchPredictor.LearningRecall"; +constexpr char kResourcePrefetchPredictorCountHistogram[] = + "ResourcePrefetchPredictor.LearningCount"; +constexpr char kResourcePrefetchPredictorPrefetchingDurationHistogram[] = + "ResourcePrefetchPredictor.PrefetchingDuration"; } // namespace internal class TestObserver; @@ -210,6 +214,8 @@ FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetPrefetchData); FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, TestPrecisionRecallHistograms); + FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, + TestPrefetchingDurationHistogram); enum InitializationState { NOT_INITIALIZED = 0, @@ -283,7 +289,7 @@ void OnHistoryAndCacheLoaded(); // Removes data for navigations where the onload never fired. Will cleanup - // inflight_navigations_. + // inflight_navigations_ and inflight_prefetches_. void CleanupAbandonedNavigations(const NavigationID& navigation_id); // Deletes all URLs from the predictor database, the caches and removes all @@ -364,6 +370,7 @@ std::unique_ptr<RedirectDataMap> url_redirect_table_cache_; std::unique_ptr<RedirectDataMap> host_redirect_table_cache_; + std::map<GURL, base::TimeTicks> inflight_prefetches_; NavigationMap inflight_navigations_; ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index b21c918..2fac583 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
@@ -1601,6 +1601,31 @@ internal::kResourcePrefetchPredictorRecallHistogram, 50, 1); histogram_tester_->ExpectBucketCount( internal::kResourcePrefetchPredictorPrecisionHistogram, 33, 1); + histogram_tester_->ExpectBucketCount( + internal::kResourcePrefetchPredictorCountHistogram, 3, 1); +} + +TEST_F(ResourcePrefetchPredictorTest, TestPrefetchingDurationHistogram) { + // Prefetching duration for an url without resources in the database + // shouldn't be recorded. + const std::string main_frame_url = "http://google.com/?query=cats"; + predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL); + predictor_->StopPrefetching(GURL(main_frame_url)); + histogram_tester_->ExpectTotalCount( + internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 0); + + // Fill the database to record a duration. + PrefetchData google = CreatePrefetchData("google.com", 1); + InitializeResourceData( + google.add_resources(), "https://cdn.google.com/script.js", + content::RESOURCE_TYPE_SCRIPT, 10, 0, 1, 2.1, net::MEDIUM, false, false); + predictor_->host_table_cache_->insert( + std::make_pair(google.primary_key(), google)); + + predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL); + predictor_->StopPrefetching(GURL(main_frame_url)); + histogram_tester_->ExpectTotalCount( + internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 1); } } // namespace predictors
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 5de302c..03f33270 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -2823,6 +2823,39 @@ PrerenderTestURL(replacement_path, FINAL_STATUS_UNSUPPORTED_SCHEME, 0); } +// Checks that non-http/https/chrome-extension subresource does not cancel the +// prerender. +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, + PrerenderSubresourceUnsupportedSchemeForOffline) { + // Set up a page with unsupported subresource. + GURL image_url = GURL("invalidscheme://www.google.com/test.jpg"); + base::StringPairs replacement_text; + replacement_text.push_back( + std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec())); + std::string replacement_path; + net::test_server::GetFilePathWithReplacements( + "/prerender/prerender_with_image.html", replacement_text, + &replacement_path); + const GURL url = src_server()->GetURL(MakeAbsolute(replacement_path)); + + // Navigate to about:blank to get the session storage namespace. + ui_test_utils::NavigateToURL(current_browser(), GURL(url::kAboutBlankURL)); + content::SessionStorageNamespace* storage_namespace = + GetActiveWebContents() + ->GetController() + .GetDefaultSessionStorageNamespace(); + + std::unique_ptr<TestPrerender> test_prerender = + prerender_contents_factory()->ExpectPrerenderContents( + FINAL_STATUS_APP_TERMINATING); + + std::unique_ptr<PrerenderHandle> prerender_handle( + GetPrerenderManager()->AddPrerenderForOffline(url, storage_namespace, + gfx::Size(640, 480))); + ASSERT_EQ(prerender_handle->contents(), test_prerender->contents()); + test_prerender->WaitForLoads(1); +} + // Ensure that about:blank is permitted for any subresource. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAllowAboutBlankSubresource) {
diff --git a/chrome/browser/prerender/prerender_resource_throttle.cc b/chrome/browser/prerender/prerender_resource_throttle.cc index 8d8511e..afd908f 100644 --- a/chrome/browser/prerender/prerender_resource_throttle.cc +++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -184,13 +184,18 @@ cancel = true; } else if (!PrerenderManager::DoesSubresourceURLHaveValidScheme(url) && resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { - // Destroying the prerender for unsupported scheme only for non-main - // resource to allow chrome://crash to actually crash in the - // *RendererCrash tests instead of being intercepted here. The unsupported - // scheme for the main resource is checked in WillRedirectRequestOnUI() - // and PrerenderContents::CheckURL(). See http://crbug.com/673771. - prerender_contents->Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); - ReportUnsupportedPrerenderScheme(url); + // For ORIGIN_OFFLINE, simply cancel this invalid request and continue. + // For other origins, fail the prerender here. + if (prerender_contents->origin() != ORIGIN_OFFLINE) { + // Destroying the prerender for unsupported scheme only for non-main + // resource to allow chrome://crash to actually crash in the + // *RendererCrash tests instead of being intercepted here. The + // unsupported + // scheme for the main resource is checked in WillRedirectRequestOnUI() + // and PrerenderContents::CheckURL(). See http://crbug.com/673771. + prerender_contents->Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); + ReportUnsupportedPrerenderScheme(url); + } cancel = true; #if defined(OS_ANDROID) } else if (resource_type == content::RESOURCE_TYPE_FAVICON) {
diff --git a/chrome/browser/push_messaging/OWNERS b/chrome/browser/push_messaging/OWNERS index d09ffef..4898e44 100644 --- a/chrome/browser/push_messaging/OWNERS +++ b/chrome/browser/push_messaging/OWNERS
@@ -1 +1,4 @@ file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc index 5112e20..024accd 100644 --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -569,7 +569,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); } IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, @@ -615,7 +614,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); // After unsubscribing, subscribe again from the worker with no key. // The sender id should again be read from the datastore, so the @@ -628,7 +626,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); } IN_PROC_BROWSER_TEST_F( @@ -667,7 +664,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); // After unsubscribing, try to resubscribe again without a key. // This should again fail. @@ -770,7 +766,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); // After unsubscribing, subscribe again from the worker with no key. // The sender id should again be read from the datastore, so the @@ -783,7 +778,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); } IN_PROC_BROWSER_TEST_F( @@ -829,7 +823,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); // After unsubscribing, subscribe again from the worker with no key. // The sender id should again be read from the datastore, so the @@ -842,7 +835,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); } IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, ResubscribeWithMismatchedKey) { @@ -885,7 +877,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); // Resubscribe with a different key after unsubscribing. // Should succeed, and we should get a new subscription token. @@ -898,7 +889,6 @@ ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); - EXPECT_NE(push_service(), GetAppHandler()); } IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) { @@ -983,10 +973,17 @@ ASSERT_NO_FATAL_FAILURE(RestartPushService()); EXPECT_EQ(push_service(), GetAppHandler()); - // Unsubscribe. std::string script_result; + + // Unsubscribe. + base::RunLoop run_loop; + push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); + // The app handler is only guaranteed to be unregistered once the unsubscribe + // callback for testing has been run (PushSubscription.unsubscribe() usually + // resolves before that, in order to avoid blocking on network retries etc). + run_loop.Run(); EXPECT_NE(push_service(), GetAppHandler()); ASSERT_NO_FATAL_FAILURE(RestartPushService()); @@ -1695,6 +1692,33 @@ EXPECT_EQ("unsubscribe result: false", script_result); } +IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeOffline) { + std::string script_result; + + EXPECT_NE(push_service(), GetAppHandler()); + + std::string token; + ASSERT_NO_FATAL_FAILURE(SubscribeSuccessfully(true /* use_key */, &token)); + + gcm_service_->set_offline(true); + + // Should quickly resolve true after deleting local state (rather than waiting + // until unsubscribing over the network exceeds the maximum backoff duration). + ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); + EXPECT_EQ("unsubscribe result: true", script_result); + histogram_tester_.ExpectUniqueSample( + "PushMessaging.UnregistrationReason", + content::PUSH_UNREGISTRATION_REASON_JAVASCRIPT_API, 1); + + // Since the service is offline, the network request to GCM is still being + // retried, so the app handler shouldn't have been unregistered yet. + EXPECT_EQ(push_service(), GetAppHandler()); + // But restarting the push service will unregister the app handler, since the + // subscription is no longer stored in the PushMessagingAppIdentifier map. + ASSERT_NO_FATAL_FAILURE(RestartPushService()); + EXPECT_NE(push_service(), GetAppHandler()); +} + IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisteringServiceWorkerUnsubscribes) { std::string script_result; @@ -2130,8 +2154,14 @@ // After dropping the last subscription it is still inactive. std::string script_result; + base::RunLoop run_loop; + push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); + // Background mode is only guaranteed to have updated once the unsubscribe + // callback for testing has been run (PushSubscription.unsubscribe() usually + // resolves before that, in order to avoid blocking on network retries etc). + run_loop.Run(); ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); } @@ -2161,8 +2191,14 @@ // Dropping the last subscription deactivates background mode. std::string script_result; + base::RunLoop run_loop; + push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); + // Background mode is only guaranteed to have updated once the unsubscribe + // callback for testing has been run (PushSubscription.unsubscribe() usually + // resolves before that, in order to avoid blocking on network retries etc). + run_loop.Run(); ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); } @@ -2192,8 +2228,14 @@ // After dropping the last subscription background mode is still inactive. std::string script_result; + base::RunLoop run_loop; + push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); EXPECT_EQ("unsubscribe result: true", script_result); + // Background mode is only guaranteed to have updated once the unsubscribe + // callback for testing has been run (PushSubscription.unsubscribe() usually + // resolves before that, in order to avoid blocking on network retries etc). + run_loop.Run(); ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); } #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS)
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc index 1abf01d..fbc0c0e 100644 --- a/chrome/browser/push_messaging/push_messaging_service_impl.cc +++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -90,6 +90,16 @@ content::PUSH_UNREGISTRATION_REASON_LAST + 1); } +void RecordUnsubscribeGCMResult(gcm::GCMClient::Result result) { + UMA_HISTOGRAM_ENUMERATION("PushMessaging.UnregistrationGCMResult", result, + gcm::GCMClient::LAST_RESULT + 1); +} + +void RecordUnsubscribeIIDResult(InstanceID::Result result) { + UMA_HISTOGRAM_ENUMERATION("PushMessaging.UnregistrationIIDResult", result, + InstanceID::LAST_RESULT + 1); +} + blink::WebPushPermissionStatus ToPushPermission( blink::mojom::PermissionStatus permission_status) { switch (permission_status) { @@ -104,50 +114,6 @@ return blink::WebPushPermissionStatusDenied; } -content::PushUnregistrationStatus ToUnregisterStatus( - InstanceID::Result result) { - switch (result) { - case InstanceID::SUCCESS: - return content::PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED; - case InstanceID::INVALID_PARAMETER: - case InstanceID::DISABLED: - case InstanceID::SERVER_ERROR: - case InstanceID::UNKNOWN_ERROR: - return content::PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR; - case InstanceID::ASYNC_OPERATION_PENDING: - case InstanceID::NETWORK_ERROR: - return content::PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR; - } - NOTREACHED(); - return content::PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE; -} - -content::PushUnregistrationStatus ToUnregisterStatus( - gcm::GCMClient::Result gcm_result) { - switch (gcm_result) { - case gcm::GCMClient::SUCCESS: - return content::PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED; - case gcm::GCMClient::INVALID_PARAMETER: - case gcm::GCMClient::GCM_DISABLED: - case gcm::GCMClient::SERVER_ERROR: - case gcm::GCMClient::UNKNOWN_ERROR: - return content::PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR; - case gcm::GCMClient::ASYNC_OPERATION_PENDING: - case gcm::GCMClient::NETWORK_ERROR: - case gcm::GCMClient::TTL_EXCEEDED: - return content::PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR; - } - NOTREACHED(); - return content::PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE; -} - -void GCMCallbackToUnregisterCallback( - const content::PushMessagingService::UnregisterCallback& callback, - gcm::GCMClient::Result result) { - DCHECK(!callback.is_null()); - callback.Run(ToUnregisterStatus(result)); -} - void UnregisterCallbackToClosure(const base::Closure& closure, content::PushUnregistrationStatus status) { DCHECK(!closure.is_null()); @@ -761,18 +727,27 @@ if (was_subscribed) app_identifier.DeleteFromPrefs(profile_); + // Run the unsubscribe callback *before* asking the InstanceIDDriver/GCMDriver + // to unsubscribe, since that's a slow process involving network retries, and + // by this point enough local state has been deleted that the subscription is + // inactive. Note that DeliverMessageCallback automatically unsubscribes if + // messages are later received for a subscription that was locally deleted, + // so as long as messages keep getting sent to it, the unsubscription should + // eventually reach GCM servers even if this particular attempt fails. + callback.Run( + was_subscribed + ? content::PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED + : content::PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED); + if (PushMessagingAppIdentifier::UseInstanceID(app_id)) { - GetInstanceIDDriver()->GetInstanceID(app_id)->DeleteID(base::Bind( - &PushMessagingServiceImpl::DidDeleteID, weak_factory_.GetWeakPtr(), - app_id, was_subscribed, callback)); + GetInstanceIDDriver()->GetInstanceID(app_id)->DeleteID( + base::Bind(&PushMessagingServiceImpl::DidDeleteID, + weak_factory_.GetWeakPtr(), app_id, was_subscribed)); } else { auto unregister_callback = - base::Bind(&GCMCallbackToUnregisterCallback, - base::Bind(&PushMessagingServiceImpl::DidUnsubscribe, - weak_factory_.GetWeakPtr(), - std::string() /* app_id_when_instance_id */, - was_subscribed, callback)); + base::Bind(&PushMessagingServiceImpl::DidUnregister, + weak_factory_.GetWeakPtr(), was_subscribed); #if defined(OS_ANDROID) // On Android the backend is different, and requires the original sender_id. // UnsubscribeBecausePermissionRevoked and @@ -789,38 +764,42 @@ } } +void PushMessagingServiceImpl::DidUnregister(bool was_subscribed, + gcm::GCMClient::Result result) { + RecordUnsubscribeGCMResult(result); + DidUnsubscribe(std::string() /* app_id_when_instance_id */, was_subscribed); +} + void PushMessagingServiceImpl::DidDeleteID(const std::string& app_id, bool was_subscribed, - const UnregisterCallback& callback, InstanceID::Result result) { + RecordUnsubscribeIIDResult(result); // DidUnsubscribe must be run asynchronously when passing a non-empty // |app_id_when_instance_id|, since it calls // InstanceIDDriver::RemoveInstanceID which deletes the InstanceID itself. // Calling that immediately would cause a use-after-free in our caller. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&PushMessagingServiceImpl::DidUnsubscribe, - weak_factory_.GetWeakPtr(), app_id, was_subscribed, - callback, ToUnregisterStatus(result))); + FROM_HERE, + base::Bind(&PushMessagingServiceImpl::DidUnsubscribe, + weak_factory_.GetWeakPtr(), app_id, was_subscribed)); } void PushMessagingServiceImpl::DidUnsubscribe( const std::string& app_id_when_instance_id, - bool was_subscribed, - const UnregisterCallback& callback, - content::PushUnregistrationStatus status) { + bool was_subscribed) { if (!app_id_when_instance_id.empty()) GetInstanceIDDriver()->RemoveInstanceID(app_id_when_instance_id); - DCHECK(!callback.is_null()); - - if (was_subscribed) { + if (was_subscribed) DecreasePushSubscriptionCount(1, false /* was_pending */); - callback.Run(status); - } else { - // Override status since there was no record of an existing subscription. - callback.Run( - content::PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED); - } + + if (!unsubscribe_callback_for_testing_.is_null()) + unsubscribe_callback_for_testing_.Run(); +} + +void PushMessagingServiceImpl::SetUnsubscribeCallbackForTesting( + const base::Closure& callback) { + unsubscribe_callback_for_testing_ = callback; } // DidDeleteServiceWorkerRegistration methods ----------------------------------
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h index b1faa72..50416f94 100644 --- a/chrome/browser/push_messaging/push_messaging_service_impl.h +++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -113,6 +113,7 @@ void OnMenuClick() override; void SetMessageCallbackForTesting(const base::Closure& callback); + void SetUnsubscribeCallbackForTesting(const base::Closure& callback); void SetContentSettingChangedCallbackForTesting( const base::Closure& callback); void SetServiceWorkerUnregisteredCallbackForTesting( @@ -192,15 +193,12 @@ const std::string& sender_id, const UnregisterCallback& callback); + void DidUnregister(bool was_subscribed, gcm::GCMClient::Result result); void DidDeleteID(const std::string& app_id, bool was_subscribed, - const UnregisterCallback&, instance_id::InstanceID::Result result); - void DidUnsubscribe(const std::string& app_id_when_instance_id, - bool was_subscribed, - const UnregisterCallback& callback, - content::PushUnregistrationStatus status); + bool was_subscribed); // OnContentSettingChanged methods ------------------------------------------- @@ -252,6 +250,7 @@ int pending_push_subscription_count_; base::Closure message_callback_for_testing_; + base::Closure unsubscribe_callback_for_testing_; base::Closure content_setting_changed_callback_for_testing_; base::Closure service_worker_unregistered_callback_for_testing_;
diff --git a/chrome/browser/resources/chromeos/arc_support/background.js b/chrome/browser/resources/chromeos/arc_support/background.js index 1bbfcc6..cece40f 100644 --- a/chrome/browser/resources/chromeos/arc_support/background.js +++ b/chrome/browser/resources/chromeos/arc_support/background.js
@@ -30,6 +30,13 @@ var currentDeviceId = null; /** + * Stores last focused element before showing overlay. It is used to restore + * focus once overlay is closed. + * @type {Object} + */ +var lastFocusedElement = null; + +/** * Host window inner default width. * @const {number} */ @@ -287,6 +294,7 @@ this.loadingContainer_.hidden = true; this.contentContainer_.hidden = false; this.updateTermsHeight_(); + this.contentContainer_.querySelector('#button-agree').focus(); } /** @@ -373,7 +381,7 @@ } /** Called when metrics preference is updated. */ - onMetricxPreferenceChanged(isEnabled, isManaged) { + onMetricsPreferenceChanged(isEnabled, isManaged) { this.metricsCheckbox_.onPreferenceChanged(isEnabled, isManaged); // Applying metrics mode may change page layout, update terms height. @@ -446,7 +454,7 @@ if (message.action == 'initialize') { initialize(message.data, message.deviceId); } else if (message.action == 'setMetricsMode') { - termsPage.onMetricxPreferenceChanged(message.enabled, message.managed); + termsPage.onMetricsPreferenceChanged(message.enabled, message.managed); } else if (message.action == 'setBackupAndRestoreMode') { termsPage.onBackupRestorePreferenceChanged( message.enabled, message.managed); @@ -545,6 +553,8 @@ var overlayContainer = doc.getElementById('overlay-container'); overlayContainer.className = 'overlay ' + overlayClass; overlayContainer.hidden = false; + lastFocusedElement = doc.activeElement; + doc.getElementById('overlay-close').focus(); } /** @@ -574,12 +584,18 @@ * the content of terms view. */ function showPrivacyPolicyOverlay() { + var defaultLink = 'https://www.google.com/intl/' + navigator.language + + '/policies/privacy/'; + if (termsPage.isManaged_) { + showURLOverlay(defaultLink); + return; + } var details = {code: 'getPrivacyPolicyLink();'}; termsPage.termsView_.executeScript(details, function(results) { if (results && results.length == 1 && typeof results[0] == 'string') { showURLOverlay(results[0]); } else { - showURLOverlay('https://www.google.com/policies/privacy/'); + showURLOverlay(defaultLink); } }); } @@ -591,6 +607,10 @@ var doc = appWindow.contentWindow.document; var overlayContainer = doc.getElementById('overlay-container'); overlayContainer.hidden = true; + if (lastFocusedElement) { + lastFocusedElement.focus(); + lastFocusedElement = null; + } } function setWindowBounds() {
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js index 9039c07..6fca7cdc 100644 --- a/chrome/browser/resources/chromeos/login/oobe.js +++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -86,6 +86,21 @@ }, /** + * Returns value of the selected option (see setupSelect() above). + * @param {!Object} list The same as in setupSelect() above. + */ + getSelectedValue: function(list) { + for (var i = 0; i < list.length; ++i) { + var item = list[i]; + if (item.optionGroupName) + continue; + if (item.selected) + return item.value; + } + return null; + }, + + /** * Initializes the OOBE flow. This will cause all C++ handlers to * be invoked to do final setup. */
diff --git a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.html b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.html index dc44d2f..ca3b526 100644 --- a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.html +++ b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.html
@@ -47,7 +47,8 @@ <div id="arc-tos-overlay-content-text"> <span id="arc-learn-more-content"></span> </div> - <button class="arc-tos-overlay-close-bottom arc-overlay-close-button"> + <button id="arc-tos-overlay-text-close" + class="arc-tos-overlay-close-bottom arc-overlay-close-button"> $i18n{arcOverlayClose} </button> </div> @@ -60,7 +61,8 @@ <div id="arc-tos-overlay-webview-container"> <webview id="arc-tos-overlay-webview"></webview> </div> - <button class="arc-tos-overlay-close-bottom arc-overlay-close-button"> + <button id="arc-tos-overlay-url-close" + class="arc-tos-overlay-close-bottom arc-overlay-close-button"> $i18n{arcOverlayClose} </button> </div>
diff --git a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js index 1b5f4c1e..6f33a12f 100644 --- a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js +++ b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js
@@ -81,7 +81,18 @@ typeof results[0] == 'string') { self.showUrlOverlay(results[0]); } else { - self.showUrlOverlay('https://www.google.com/policies/privacy/'); + // currentLanguage can be updated in OOBE but not in Login page. + // languageList exists in OOBE otherwise use navigator.language. + var currentLanguage; + var languageList = loadTimeData.getValue('languageList'); + if (languageList) { + currentLanguage = Oobe.getSelectedValue(languageList); + } else { + currentLanguage = navigator.language; + } + var defaultLink = 'https://www.google.com/intl/' + + currentLanguage + '/policies/privacy/'; + self.showUrlOverlay(defaultLink); } }); }; @@ -253,9 +264,11 @@ * @param {string} content HTML formatted text to show. */ showLearnMoreOverlay: function(content) { + this.lastFocusedElement = document.activeElement; $('arc-learn-more-content').innerHTML = content; $('arc-tos-overlay-content-text').hidden = false; $('arc-tos-overlay-text').hidden = false; + $('arc-tos-overlay-text-close').focus(); }, /** @@ -263,8 +276,10 @@ * @param {string} targetUrl URL to open. */ showUrlOverlay: function(targetUrl) { + this.lastFocusedElement = document.activeElement; $('arc-tos-overlay-webview').src = targetUrl; $('arc-tos-overlay-url').hidden = false; + $('arc-tos-overlay-url-close').focus(); }, /** @@ -273,6 +288,10 @@ hideOverlay: function() { $('arc-tos-overlay-text').hidden = true; $('arc-tos-overlay-url').hidden = true; + if (this.lastFocusedElement) { + this.lastFocusedElement.focus(); + this.lastFocusedElement = null; + } }, /**
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index 07fffad..f9bf3c3 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd
@@ -42,17 +42,7 @@ <!-- Material Design Bookmarks --> <include name="IDR_COMPONENT_MD_BOOKMARKS_BOOKMARKS_HTML" file="md_bookmarks/bookmarks.html" type="BINDATA" /> <!-- Gaia auth extension --> - <include name="IDR_GAIA_AUTH_MAIN" file="gaia_auth/main.html" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_MAIN_JS" file="gaia_auth/main.js" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_MAIN_CSS" file="gaia_auth/main.css" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_OFFLINE" file="gaia_auth/offline.html" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_OFFLINE_JS" file="gaia_auth/offline.js" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_OFFLINE_CSS" file="gaia_auth/offline.css" type="BINDATA" /> <include name="IDR_GAIA_AUTH_SUCCESS" file="gaia_auth/success.html" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_UTIL_JS" file="gaia_auth/util.js" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_BACKGROUND_JS" file="gaia_auth/background.js" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_SAML_INJECTED_JS" file="gaia_auth/saml_injected.js" type="BINDATA" /> - <include name="IDR_GAIA_AUTH_CHANNEL_JS" file="gaia_auth/channel.js" type="BINDATA" /> <!-- Hangout Services extension, included in Google Chrome builds only. --> <if expr="_google_chrome or enable_hangout_services_extension"> <include name="IDR_HANGOUT_SERVICES_BACKGROUND_HTML" file="hangout_services/background.html" type="BINDATA" />
diff --git a/chrome/browser/resources/gaia_auth/background.js b/chrome/browser/resources/gaia_auth/background.js deleted file mode 100644 index 160b312..0000000 --- a/chrome/browser/resources/gaia_auth/background.js +++ /dev/null
@@ -1,463 +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. - -/** - * @fileoverview - * A background script of the auth extension that bridges the communication - * between the main and injected scripts. - * - * Here is an overview of the communication flow when SAML is being used: - * 1. The main script sends the |startAuth| signal to this background script, - * indicating that the authentication flow has started and SAML pages may be - * loaded from now on. - * 2. A script is injected into each SAML page. The injected script sends three - * main types of messages to this background script: - * a) A |pageLoaded| message is sent when the page has been loaded. This is - * forwarded to the main script as |onAuthPageLoaded|. - * b) If the SAML provider supports the credential passing API, the API calls - * are sent to this background script as |apiCall| messages. These - * messages are forwarded unmodified to the main script. - * c) The injected script scrapes passwords. They are sent to this background - * script in |updatePassword| messages. The main script can request a list - * of the scraped passwords by sending the |getScrapedPasswords| message. - */ - -/** - * BackgroundBridgeManager maintains an array of BackgroundBridge, indexed by - * the associated tab id. - */ -function BackgroundBridgeManager() { - this.bridges_ = {}; -} - -BackgroundBridgeManager.prototype = { - CONTINUE_URL_BASE: 'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik' + - '/success.html', - // Maps a tab id to its associated BackgroundBridge. - bridges_: null, - - run: function() { - chrome.runtime.onConnect.addListener(this.onConnect_.bind(this)); - - chrome.webRequest.onBeforeRequest.addListener( - function(details) { - if (this.bridges_[details.tabId]) - return this.bridges_[details.tabId].onInsecureRequest(details.url); - }.bind(this), - {urls: ['http://*/*', 'file://*/*', 'ftp://*/*']}, - ['blocking']); - - chrome.webRequest.onBeforeSendHeaders.addListener( - function(details) { - if (this.bridges_[details.tabId]) - return this.bridges_[details.tabId].onBeforeSendHeaders(details); - else - return {requestHeaders: details.requestHeaders}; - }.bind(this), - {urls: ['*://*/*'], types: ['sub_frame']}, - ['blocking', 'requestHeaders']); - - chrome.webRequest.onHeadersReceived.addListener( - function(details) { - if (this.bridges_[details.tabId]) - return this.bridges_[details.tabId].onHeadersReceived(details); - }.bind(this), - {urls: ['*://*/*'], types: ['sub_frame']}, - ['blocking', 'responseHeaders']); - - chrome.webRequest.onCompleted.addListener( - function(details) { - if (this.bridges_[details.tabId]) - this.bridges_[details.tabId].onCompleted(details); - }.bind(this), - {urls: ['*://*/*', this.CONTINUE_URL_BASE + '*'], types: ['sub_frame']}, - ['responseHeaders']); - }, - - onConnect_: function(port) { - var tabId = this.getTabIdFromPort_(port); - if (!this.bridges_[tabId]) - this.bridges_[tabId] = new BackgroundBridge(tabId); - if (port.name == 'authMain') { - this.bridges_[tabId].setupForAuthMain(port); - port.onDisconnect.addListener(function() { - delete this.bridges_[tabId]; - }.bind(this)); - } else if (port.name == 'injected') { - this.bridges_[tabId].setupForInjected(port); - } else { - console.error('Unexpected connection, port.name=' + port.name); - } - }, - - getTabIdFromPort_: function(port) { - return port.sender.tab ? port.sender.tab.id : -1; - } -}; - -/** - * BackgroundBridge allows the main script and the injected script to - * collaborate. It forwards credentials API calls to the main script and - * maintains a list of scraped passwords. - * @param {string} tabId The associated tab ID. - */ -function BackgroundBridge(tabId) { - this.tabId_ = tabId; - this.passwordStore_ = {}; -} - -BackgroundBridge.prototype = { - // The associated tab ID. Only used for debugging now. - tabId: null, - - // The initial URL loaded in the gaia iframe. We only want to handle - // onCompleted() for the frame that loaded this URL. - initialFrameUrlWithoutParams: null, - - // On process onCompleted() requests that come from this frame Id. - frameId: -1, - - isDesktopFlow_: false, - - // Whether the extension is loaded in a constrained window. - // Set from main auth script. - isConstrainedWindow_: null, - - // Email of the newly authenticated user based on the gaia response header - // 'google-accounts-signin'. - email_: null, - - // Gaia Id of the newly authenticated user based on the gaia response - // header 'google-accounts-signin'. - gaiaId_: null, - - // Session index of the newly authenticated user based on the gaia response - // header 'google-accounts-signin'. - sessionIndex_: null, - - // Gaia URL base that is set from main auth script. - gaiaUrl_: null, - - // Whether to abort the authentication flow and show an error messagen when - // content served over an unencrypted connection is detected. - blockInsecureContent_: false, - - // Whether auth flow has started. It is used as a signal of whether the - // injected script should scrape passwords. - authStarted_: false, - - // Whether SAML flow is going. - isSAML_: false, - - passwordStore_: null, - - channelMain_: null, - channelInjected_: null, - - /** - * Sets up the communication channel with the main script. - */ - setupForAuthMain: function(port) { - this.channelMain_ = new Channel(); - this.channelMain_.init(port); - - // Registers for desktop related messages. - this.channelMain_.registerMessage( - 'initDesktopFlow', this.onInitDesktopFlow_.bind(this)); - - // Registers for SAML related messages. - this.channelMain_.registerMessage( - 'setGaiaUrl', this.onSetGaiaUrl_.bind(this)); - this.channelMain_.registerMessage( - 'setBlockInsecureContent', this.onSetBlockInsecureContent_.bind(this)); - this.channelMain_.registerMessage( - 'resetAuth', this.onResetAuth_.bind(this)); - this.channelMain_.registerMessage( - 'startAuth', this.onAuthStarted_.bind(this)); - this.channelMain_.registerMessage( - 'getScrapedPasswords', - this.onGetScrapedPasswords_.bind(this)); - this.channelMain_.registerMessage( - 'apiResponse', this.onAPIResponse_.bind(this)); - - this.channelMain_.send({ - 'name': 'channelConnected' - }); - }, - - /** - * Sets up the communication channel with the injected script. - */ - setupForInjected: function(port) { - this.channelInjected_ = new Channel(); - this.channelInjected_.init(port); - - this.channelInjected_.registerMessage( - 'apiCall', this.onAPICall_.bind(this)); - this.channelInjected_.registerMessage( - 'updatePassword', this.onUpdatePassword_.bind(this)); - this.channelInjected_.registerMessage( - 'pageLoaded', this.onPageLoaded_.bind(this)); - this.channelInjected_.registerMessage( - 'getSAMLFlag', this.onGetSAMLFlag_.bind(this)); - }, - - /** - * Handler for 'initDesktopFlow' signal sent from the main script. - * Only called in desktop mode. - */ - onInitDesktopFlow_: function(msg) { - this.isDesktopFlow_ = true; - this.gaiaUrl_ = msg.gaiaUrl; - this.isConstrainedWindow_ = msg.isConstrainedWindow; - this.initialFrameUrlWithoutParams = msg.initialFrameUrlWithoutParams; - }, - - /** - * Handler for webRequest.onCompleted. It 1) detects loading of continue URL - * and notifies the main script of signin completion; 2) detects if the - * current page could be loaded in a constrained window and signals the main - * script of switching to full tab if necessary. - */ - onCompleted: function(details) { - // Only monitors requests in the gaia frame. The gaia frame is the one - // where the initial frame URL completes. - if (details.url.lastIndexOf( - this.initialFrameUrlWithoutParams, 0) == 0) { - this.frameId = details.frameId; - } - if (this.frameId == -1) { - // If for some reason the frameId could not be set above, just make sure - // the frame is more than two levels deep (since the gaia frame is at - // least three levels deep). - if (details.parentFrameId <= 0) - return; - } else if (details.frameId != this.frameId) { - return; - } - - if (details.url.lastIndexOf(backgroundBridgeManager.CONTINUE_URL_BASE, 0) == - 0) { - var skipForNow = false; - if (details.url.indexOf('ntp=1') >= 0) - skipForNow = true; - - // TOOD(guohui): For desktop SAML flow, show password confirmation UI. - var passwords = this.onGetScrapedPasswords_(); - var msg = { - 'name': 'completeLogin', - 'email': this.email_, - 'gaiaId': this.gaiaId_, - 'password': passwords[0], - 'sessionIndex': this.sessionIndex_, - 'skipForNow': skipForNow - }; - this.channelMain_.send(msg); - } else if (this.isConstrainedWindow_) { - // The header google-accounts-embedded is only set on gaia domain. - if (this.gaiaUrl_ && details.url.lastIndexOf(this.gaiaUrl_) == 0) { - var headers = details.responseHeaders; - for (var i = 0; headers && i < headers.length; ++i) { - if (headers[i].name.toLowerCase() == 'google-accounts-embedded') - return; - } - } - var msg = { - 'name': 'switchToFullTab', - 'url': details.url - }; - this.channelMain_.send(msg); - } - }, - - /** - * Handler for webRequest.onBeforeRequest, invoked when content served over an - * unencrypted connection is detected. Determines whether the request should - * be blocked and if so, signals that an error message needs to be shown. - * @param {string} url The URL that was blocked. - * @return {!Object} Decision whether to block the request. - */ - onInsecureRequest: function(url) { - if (!this.blockInsecureContent_) - return {}; - this.channelMain_.send({name: 'onInsecureContentBlocked', url: url}); - return {cancel: true}; - }, - - /** - * Handler or webRequest.onHeadersReceived. It reads the authenticated user - * email from google-accounts-signin-header. - * @return {!Object} Modified request headers. - */ - onHeadersReceived: function(details) { - var headers = details.responseHeaders; - - if (this.gaiaUrl_ && details.url.lastIndexOf(this.gaiaUrl_) == 0) { - for (var i = 0; headers && i < headers.length; ++i) { - if (headers[i].name.toLowerCase() == 'google-accounts-signin') { - var headerValues = headers[i].value.toLowerCase().split(','); - var signinDetails = {}; - headerValues.forEach(function(e) { - var pair = e.split('='); - signinDetails[pair[0].trim()] = pair[1].trim(); - }); - // Remove "" around. - this.email_ = signinDetails['email'].slice(1, -1); - this.gaiaId_ = signinDetails['obfuscatedid'].slice(1, -1); - this.sessionIndex_ = signinDetails['sessionindex']; - break; - } - } - } - - if (!this.isDesktopFlow_) { - // Check whether GAIA headers indicating the start or end of a SAML - // redirect are present. If so, synthesize cookies to mark these points. - for (var i = 0; headers && i < headers.length; ++i) { - if (headers[i].name.toLowerCase() == 'google-accounts-saml') { - var action = headers[i].value.toLowerCase(); - if (action == 'start') { - this.isSAML_ = true; - // GAIA is redirecting to a SAML IdP. Any cookies contained in the - // current |headers| were set by GAIA. Any cookies set in future - // requests will be coming from the IdP. Append a cookie to the - // current |headers| that marks the point at which the redirect - // occurred. - headers.push({name: 'Set-Cookie', - value: 'google-accounts-saml-start=now'}); - return {responseHeaders: headers}; - } else if (action == 'end') { - this.isSAML_ = false; - // The SAML IdP has redirected back to GAIA. Add a cookie that marks - // the point at which the redirect occurred occurred. It is - // important that this cookie be prepended to the current |headers| - // because any cookies contained in the |headers| were already set - // by GAIA, not the IdP. Due to limitations in the webRequest API, - // it is not trivial to prepend a cookie: - // - // The webRequest API only allows for deleting and appending - // headers. To prepend a cookie (C), three steps are needed: - // 1) Delete any headers that set cookies (e.g., A, B). - // 2) Append a header which sets the cookie (C). - // 3) Append the original headers (A, B). - // - // Due to a further limitation of the webRequest API, it is not - // possible to delete a header in step 1) and append an identical - // header in step 3). To work around this, a trailing semicolon is - // added to each header before appending it. Trailing semicolons are - // ignored by Chrome in cookie headers, causing the modified headers - // to actually set the original cookies. - var otherHeaders = []; - var cookies = [{name: 'Set-Cookie', - value: 'google-accounts-saml-end=now'}]; - for (var j = 0; j < headers.length; ++j) { - if (headers[j].name.toLowerCase().startsWith('set-cookie')) { - var header = headers[j]; - header.value += ';'; - cookies.push(header); - } else { - otherHeaders.push(headers[j]); - } - } - return {responseHeaders: otherHeaders.concat(cookies)}; - } - } - } - } - - return {}; - }, - - /** - * Handler for webRequest.onBeforeSendHeaders. - * @return {!Object} Modified request headers. - */ - onBeforeSendHeaders: function(details) { - if (!this.isDesktopFlow_ && this.gaiaUrl_ && - details.url.startsWith(this.gaiaUrl_)) { - details.requestHeaders.push({ - name: 'X-Cros-Auth-Ext-Support', - value: 'SAML' - }); - } - return {requestHeaders: details.requestHeaders}; - }, - - /** - * Handler for 'setGaiaUrl' signal sent from the main script. - */ - onSetGaiaUrl_: function(msg) { - this.gaiaUrl_ = msg.gaiaUrl; - }, - - /** - * Handler for 'setBlockInsecureContent' signal sent from the main script. - */ - onSetBlockInsecureContent_: function(msg) { - this.blockInsecureContent_ = msg.blockInsecureContent; - }, - - /** - * Handler for 'resetAuth' signal sent from the main script. - */ - onResetAuth_: function() { - this.authStarted_ = false; - this.passwordStore_ = {}; - this.isSAML_ = false; - }, - - /** - * Handler for 'authStarted' signal sent from the main script. - */ - onAuthStarted_: function() { - this.authStarted_ = true; - this.passwordStore_ = {}; - this.isSAML_ = false; - }, - - /** - * Handler for 'getScrapedPasswords' request sent from the main script. - * @return {Array<string>} The array with de-duped scraped passwords. - */ - onGetScrapedPasswords_: function() { - var passwords = {}; - for (var property in this.passwordStore_) { - passwords[this.passwordStore_[property]] = true; - } - return Object.keys(passwords); - }, - - /** - * Handler for 'apiResponse' signal sent from the main script. Passes on the - * |msg| to the injected script. - */ - onAPIResponse_: function(msg) { - this.channelInjected_.send(msg); - }, - - onAPICall_: function(msg) { - this.channelMain_.send(msg); - }, - - onUpdatePassword_: function(msg) { - if (!this.authStarted_) - return; - - this.passwordStore_[msg.id] = msg.password; - }, - - onPageLoaded_: function(msg) { - if (this.channelMain_) - this.channelMain_.send({name: 'onAuthPageLoaded', - url: msg.url, - isSAMLPage: this.isSAML_}); - }, - - onGetSAMLFlag_: function(msg) { - return this.isSAML_; - } -}; - -var backgroundBridgeManager = new BackgroundBridgeManager(); -backgroundBridgeManager.run();
diff --git a/chrome/browser/resources/gaia_auth/main.css b/chrome/browser/resources/gaia_auth/main.css deleted file mode 100644 index 1bbc0d6d..0000000 --- a/chrome/browser/resources/gaia_auth/main.css +++ /dev/null
@@ -1,24 +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. */ - -html, -body, -iframe { - height: 100%; - margin: 0; - padding: 0; - width: 100%; -} - -iframe { - overflow: hidden; -} - -webview { - display: inline-block; - height: 100%; - margin: 0; - padding: 0; - width: 100%; -}
diff --git a/chrome/browser/resources/gaia_auth/main.html b/chrome/browser/resources/gaia_auth/main.html deleted file mode 100644 index 20d079ea..0000000 --- a/chrome/browser/resources/gaia_auth/main.html +++ /dev/null
@@ -1,15 +0,0 @@ -<!doctype html> -<html> -<head> - <link rel="stylesheet" href="main.css"> - <meta charset="utf-8"> - <script src="channel.js"></script> - <script src="util.js"></script> - <script src="main.js"></script> -</head> -<body> - <iframe id="gaia-frame" name="gaia-frame" src="about:blank" frameborder="0" - sandbox="allow-same-origin allow-scripts allow-popups allow-forms - allow-pointer-lock"></iframe> -</body> -</html>
diff --git a/chrome/browser/resources/gaia_auth/main.js b/chrome/browser/resources/gaia_auth/main.js deleted file mode 100644 index 1fb9c03..0000000 --- a/chrome/browser/resources/gaia_auth/main.js +++ /dev/null
@@ -1,553 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Authenticator class wraps the communications between Gaia and its host. - */ -function Authenticator() { -} - -/** - * Gaia auth extension url origin. - * @type {string} - */ -Authenticator.THIS_EXTENSION_ORIGIN = - 'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik'; - -/** - * The lowest version of the credentials passing API supported. - * @type {number} - */ -Authenticator.MIN_API_VERSION_VERSION = 1; - -/** - * The highest version of the credentials passing API supported. - * @type {number} - */ -Authenticator.MAX_API_VERSION_VERSION = 1; - -/** - * The key types supported by the credentials passing API. - * @type {Array} Array of strings. - */ -Authenticator.API_KEY_TYPES = [ - 'KEY_TYPE_PASSWORD_PLAIN', -]; - -/** - * Allowed origins of the hosting page. - * @type {Array<string>} - */ -Authenticator.ALLOWED_PARENT_ORIGINS = [ - 'chrome://oobe', - 'chrome://chrome-signin' -]; - -/** - * Singleton getter of Authenticator. - * @return {Object} The singleton instance of Authenticator. - */ -Authenticator.getInstance = function() { - if (!Authenticator.instance_) { - Authenticator.instance_ = new Authenticator(); - } - return Authenticator.instance_; -}; - -Authenticator.prototype = { - email_: null, - gaiaId_: null, - - // Depending on the key type chosen, this will contain the plain text password - // or a credential derived from it along with the information required to - // repeat the derivation, such as a salt. The information will be encoded so - // that it contains printable ASCII characters only. The exact encoding is TBD - // when support for key types other than plain text password is added. - passwordBytes_: null, - - needPassword_: false, - chooseWhatToSync_: false, - skipForNow_: false, - sessionIndex_: null, - attemptToken_: null, - - // Input params from extension initialization URL. - inputLang_: undefined, - intputEmail_: undefined, - - isSAMLFlow_: false, - gaiaLoaded_: false, - supportChannel_: null, - - useEafe_: false, - clientId_: '', - - GAIA_URL: 'https://accounts.google.com/', - GAIA_PAGE_PATH: 'ServiceLogin?skipvpage=true&sarp=1&rm=hide', - SERVICE_ID: 'chromeoslogin', - CONTINUE_URL: Authenticator.THIS_EXTENSION_ORIGIN + '/success.html', - CONSTRAINED_FLOW_SOURCE: 'chrome', - - initialize: function() { - var handleInitializeMessage = function(e) { - if (Authenticator.ALLOWED_PARENT_ORIGINS.indexOf(e.origin) == -1) { - console.error('Unexpected parent message, origin=' + e.origin); - return; - } - window.removeEventListener('message', handleInitializeMessage); - - var params = e.data; - params.parentPage = e.origin; - this.initializeFromParent_(params); - this.onPageLoad_(); - }.bind(this); - - document.addEventListener('DOMContentLoaded', function() { - window.addEventListener('message', handleInitializeMessage); - window.parent.postMessage({'method': 'loginUIDOMContentLoaded'}, '*'); - }); - }, - - initializeFromParent_: function(params) { - this.parentPage_ = params.parentPage; - this.gaiaUrl_ = params.gaiaUrl || this.GAIA_URL; - this.gaiaPath_ = params.gaiaPath || this.GAIA_PAGE_PATH; - this.inputLang_ = params.hl; - this.inputEmail_ = params.email; - this.service_ = params.service || this.SERVICE_ID; - this.continueUrl_ = params.continueUrl || this.CONTINUE_URL; - this.desktopMode_ = params.desktopMode == '1'; - this.isConstrainedWindow_ = params.constrained == '1'; - this.useEafe_ = params.useEafe || false; - this.clientId_ = params.clientId || ''; - this.initialFrameUrl_ = params.frameUrl || this.constructInitialFrameUrl_(); - this.initialFrameUrlWithoutParams_ = stripParams(this.initialFrameUrl_); - this.needPassword_ = params.needPassword == '1'; - - // For CrOS 'ServiceLogin' we assume that Gaia is loaded if we recieved - // 'clearOldAttempts' message. For other scenarios Gaia doesn't send this - // message so we have to rely on 'load' event. - // TODO(dzhioev): Do not rely on 'load' event after b/16313327 is fixed. - this.assumeLoadedOnLoadEvent_ = - !this.gaiaPath_.startsWith('ServiceLogin') || - this.service_ !== 'chromeoslogin' || - this.useEafe_; - }, - - isGaiaMessage_: function(msg) { - // Not quite right, but good enough. - return this.gaiaUrl_.startsWith(msg.origin) || - this.GAIA_URL.startsWith(msg.origin); - }, - - isParentMessage_: function(msg) { - return msg.origin == this.parentPage_; - }, - - constructInitialFrameUrl_: function() { - var url = this.gaiaUrl_ + this.gaiaPath_; - - url = appendParam(url, 'service', this.service_); - // Easy bootstrap use auth_code message as success signal instead of - // continue URL. - if (!this.useEafe_) - url = appendParam(url, 'continue', this.continueUrl_); - if (this.inputLang_) - url = appendParam(url, 'hl', this.inputLang_); - if (this.inputEmail_) - url = appendParam(url, 'Email', this.inputEmail_); - if (this.isConstrainedWindow_) - url = appendParam(url, 'source', this.CONSTRAINED_FLOW_SOURCE); - return url; - }, - - onPageLoad_: function() { - window.addEventListener('message', this.onMessage.bind(this), false); - this.initSupportChannel_(); - - if (this.assumeLoadedOnLoadEvent_) { - var gaiaFrame = $('gaia-frame'); - var handler = function() { - gaiaFrame.removeEventListener('load', handler); - if (!this.gaiaLoaded_) { - this.gaiaLoaded_ = true; - this.maybeInitialized_(); - - if (this.useEafe_ && this.clientId_) { - // Sends initial handshake message to EAFE. Note this fails with - // SSO redirect because |gaiaFrame| sits on a different origin. - gaiaFrame.contentWindow.postMessage({ - clientId: this.clientId_ - }, this.gaiaUrl_); - } - } - }.bind(this); - gaiaFrame.addEventListener('load', handler); - } - }, - - initSupportChannel_: function() { - var supportChannel = new Channel(); - supportChannel.connect('authMain'); - - supportChannel.registerMessage('channelConnected', function() { - // Load the gaia frame after the background page indicates that it is - // ready, so that the webRequest handlers are all setup first. - var gaiaFrame = $('gaia-frame'); - gaiaFrame.src = this.initialFrameUrl_; - - if (this.supportChannel_) { - console.error('Support channel is already initialized.'); - return; - } - this.supportChannel_ = supportChannel; - - if (this.desktopMode_) { - this.supportChannel_.send({ - name: 'initDesktopFlow', - gaiaUrl: this.gaiaUrl_, - continueUrl: stripParams(this.continueUrl_), - isConstrainedWindow: this.isConstrainedWindow_, - initialFrameUrlWithoutParams: this.initialFrameUrlWithoutParams_ - }); - - this.supportChannel_.registerMessage( - 'switchToFullTab', this.switchToFullTab_.bind(this)); - } - this.supportChannel_.registerMessage( - 'completeLogin', this.onCompleteLogin_.bind(this)); - this.initSAML_(); - this.supportChannel_.send({name: 'resetAuth'}); - this.maybeInitialized_(); - }.bind(this)); - - window.setTimeout(function() { - if (!this.supportChannel_) { - // Give up previous channel and bind its 'channelConnected' to a no-op. - supportChannel.registerMessage('channelConnected', function() {}); - - // Re-initialize the channel if it is not connected properly, e.g. - // connect may be called before background script started running. - this.initSupportChannel_(); - } - }.bind(this), 200); - }, - - /** - * Called when one of the initialization stages has finished. If all the - * needed parts are initialized, notifies parent about successfull - * initialization. - */ - maybeInitialized_: function() { - if (!this.gaiaLoaded_ || !this.supportChannel_) - return; - var msg = { - 'method': 'loginUILoaded' - }; - window.parent.postMessage(msg, this.parentPage_); - }, - - /** - * Invoked when the background script sends a message to indicate that the - * current content does not fit in a constrained window. - * @param {Object=} msg Extra info to send. - */ - switchToFullTab_: function(msg) { - var parentMsg = { - 'method': 'switchToFullTab', - 'url': msg.url - }; - window.parent.postMessage(parentMsg, this.parentPage_); - }, - - /** - * Invoked when the signin flow is complete. - * @param {Object=} opt_extraMsg Optional extra info to send. - */ - completeLogin_: function(opt_extraMsg) { - var msg = { - 'method': 'completeLogin', - 'email': (opt_extraMsg && opt_extraMsg.email) || this.email_, - 'password': this.passwordBytes_ || - (opt_extraMsg && opt_extraMsg.password), - 'usingSAML': this.isSAMLFlow_, - 'chooseWhatToSync': this.chooseWhatToSync_ || false, - 'skipForNow': (opt_extraMsg && opt_extraMsg.skipForNow) || - this.skipForNow_, - 'sessionIndex': (opt_extraMsg && opt_extraMsg.sessionIndex) || - this.sessionIndex_, - 'gaiaId': (opt_extraMsg && opt_extraMsg.gaiaId) || this.gaiaId_ - }; - window.parent.postMessage(msg, this.parentPage_); - this.supportChannel_.send({name: 'resetAuth'}); - }, - - /** - * Invoked when support channel is connected. - */ - initSAML_: function() { - this.isSAMLFlow_ = false; - - this.supportChannel_.registerMessage( - 'onAuthPageLoaded', this.onAuthPageLoaded_.bind(this)); - this.supportChannel_.registerMessage( - 'onInsecureContentBlocked', this.onInsecureContentBlocked_.bind(this)); - this.supportChannel_.registerMessage( - 'apiCall', this.onAPICall_.bind(this)); - this.supportChannel_.send({ - name: 'setGaiaUrl', - gaiaUrl: this.gaiaUrl_ - }); - if (!this.desktopMode_ && this.gaiaUrl_.startsWith('https://')) { - // Abort the login flow when content served over an unencrypted connection - // is detected on Chrome OS. This does not apply to tests that explicitly - // set a non-https GAIA URL and want to perform all authentication over - // http. - this.supportChannel_.send({ - name: 'setBlockInsecureContent', - blockInsecureContent: true - }); - } - }, - - /** - * Invoked when the background page sends 'onHostedPageLoaded' message. - * @param {!Object} msg Details sent with the message. - */ - onAuthPageLoaded_: function(msg) { - if (msg.isSAMLPage && !this.isSAMLFlow_) { - // GAIA redirected to a SAML login page. The credentials provided to this - // page will determine what user gets logged in. The credentials obtained - // from the GAIA login form are no longer relevant and can be discarded. - this.isSAMLFlow_ = true; - this.email_ = null; - this.gaiaId_ = null; - this.passwordBytes_ = null; - } - - window.parent.postMessage({ - 'method': 'authPageLoaded', - 'isSAML': this.isSAMLFlow_, - 'domain': extractDomain(msg.url) - }, this.parentPage_); - }, - - /** - * Invoked when the background page sends an 'onInsecureContentBlocked' - * message. - * @param {!Object} msg Details sent with the message. - */ - onInsecureContentBlocked_: function(msg) { - window.parent.postMessage({ - 'method': 'insecureContentBlocked', - 'url': stripParams(msg.url) - }, this.parentPage_); - }, - - /** - * Invoked when one of the credential passing API methods is called by a SAML - * provider. - * @param {!Object} msg Details of the API call. - */ - onAPICall_: function(msg) { - var call = msg.call; - if (call.method == 'initialize') { - if (!Number.isInteger(call.requestedVersion) || - call.requestedVersion < Authenticator.MIN_API_VERSION_VERSION) { - this.sendInitializationFailure_(); - return; - } - - this.apiVersion_ = Math.min(call.requestedVersion, - Authenticator.MAX_API_VERSION_VERSION); - this.initialized_ = true; - this.sendInitializationSuccess_(); - return; - } - - if (call.method == 'add') { - if (Authenticator.API_KEY_TYPES.indexOf(call.keyType) == -1) { - console.error('Authenticator.onAPICall_: unsupported key type'); - return; - } - // Not setting |email_| and |gaiaId_| because this API call will - // eventually be followed by onCompleteLogin_() which does set it. - this.apiToken_ = call.token; - this.passwordBytes_ = call.passwordBytes; - } else if (call.method == 'confirm') { - if (call.token != this.apiToken_) - console.error('Authenticator.onAPICall_: token mismatch'); - } else { - console.error('Authenticator.onAPICall_: unknown message'); - } - }, - - onGotAuthCode_: function(authCode) { - window.parent.postMessage({ - 'method': 'completeAuthenticationAuthCodeOnly', - 'authCode': authCode - }, this.parentPage_); - }, - - sendInitializationSuccess_: function() { - this.supportChannel_.send({name: 'apiResponse', response: { - result: 'initialized', - version: this.apiVersion_, - keyTypes: Authenticator.API_KEY_TYPES - }}); - }, - - sendInitializationFailure_: function() { - this.supportChannel_.send({ - name: 'apiResponse', - response: {result: 'initialization_failed'} - }); - }, - - /** - * Callback invoked for 'completeLogin' message. - * @param {Object=} msg Message sent from background page. - */ - onCompleteLogin_: function(msg) { - if (!msg.email || !msg.gaiaId || !msg.sessionIndex) { - // On desktop, if the skipForNow message field is set, send it to handler. - // This does not require the email, gaiaid or session to be valid. - if (this.desktopMode_ && msg.skipForNow) { - this.completeLogin_(msg); - } else { - console.error('Missing fields to complete login.'); - window.parent.postMessage({method: 'missingGaiaInfo'}, - this.parentPage_); - return; - } - } - - // Skip SAML extra steps for desktop flow and non-SAML flow. - if (!this.isSAMLFlow_ || this.desktopMode_) { - this.completeLogin_(msg); - return; - } - - this.email_ = msg.email; - this.gaiaId_ = msg.gaiaId; - // Password from |msg| is not used because ChromeOS SAML flow - // gets password by asking user to confirm. - this.skipForNow_ = msg.skipForNow; - this.sessionIndex_ = msg.sessionIndex; - - if (this.passwordBytes_) { - // If the credentials passing API was used, login is complete. - window.parent.postMessage({method: 'samlApiUsed'}, this.parentPage_); - this.completeLogin_(msg); - } else if (!this.needPassword_) { - // If the credentials passing API was not used, the password was obtained - // by scraping. It must be verified before use. However, the host may not - // be interested in the password at all. In that case, verification is - // unnecessary and login is complete. - this.completeLogin_(msg); - } else { - this.supportChannel_.sendWithCallback( - {name: 'getScrapedPasswords'}, - function(passwords) { - if (passwords.length == 0) { - window.parent.postMessage( - {method: 'noPassword', email: this.email_}, - this.parentPage_); - } else { - window.parent.postMessage({method: 'confirmPassword', - email: this.email_, - passwordCount: passwords.length}, - this.parentPage_); - } - }.bind(this)); - } - }, - - onVerifyConfirmedPassword_: function(password) { - this.supportChannel_.sendWithCallback( - {name: 'getScrapedPasswords'}, - function(passwords) { - for (var i = 0; i < passwords.length; ++i) { - if (passwords[i] == password) { - this.passwordBytes_ = passwords[i]; - // SAML login is complete when the user has successfully - // confirmed the password. - if (this.passwordBytes_ !== null) - this.completeLogin_(); - return; - } - } - window.parent.postMessage( - {method: 'confirmPassword', email: this.email_}, - this.parentPage_); - }.bind(this)); - }, - - onMessage: function(e) { - var msg = e.data; - - if (this.useEafe_) { - if (msg == '!_{h:\'gaia-frame\'}' && this.isGaiaMessage_(e)) { - // Sends client ID again on the hello message to work around the SSO - // signin issue. - // TODO(xiyuan): Revisit this when EAFE is integrated or for webview. - $('gaia-frame').contentWindow.postMessage({ - clientId: this.clientId_ - }, this.gaiaUrl_); - } else if (typeof msg == 'object' && - msg.type == 'authorizationCode' && this.isGaiaMessage_(e)) { - this.onGotAuthCode_(msg.authorizationCode); - } else { - console.error('Authenticator.onMessage: unknown message' + - ', msg=' + JSON.stringify(msg)); - } - - return; - } - - if (msg.method == 'attemptLogin' && this.isGaiaMessage_(e)) { - // At this point GAIA does not yet know the gaiaId, so its not set here. - this.email_ = msg.email; - this.passwordBytes_ = msg.password; - this.attemptToken_ = msg.attemptToken; - this.chooseWhatToSync_ = msg.chooseWhatToSync; - this.isSAMLFlow_ = false; - if (this.supportChannel_) - this.supportChannel_.send({name: 'startAuth'}); - else - console.error('Support channel is not initialized.'); - } else if (msg.method == 'clearOldAttempts' && this.isGaiaMessage_(e)) { - if (!this.gaiaLoaded_) { - this.gaiaLoaded_ = true; - this.maybeInitialized_(); - } - this.email_ = null; - this.gaiaId_ = null; - this.sessionIndex_ = false; - this.passwordBytes_ = null; - this.attemptToken_ = null; - this.isSAMLFlow_ = false; - this.skipForNow_ = false; - this.chooseWhatToSync_ = false; - if (this.supportChannel_) { - this.supportChannel_.send({name: 'resetAuth'}); - // This message is for clearing saml properties in gaia_auth_host and - // oobe_screen_oauth_enrollment. - window.parent.postMessage({ - 'method': 'resetAuthFlow', - }, this.parentPage_); - } - } else if (msg.method == 'verifyConfirmedPassword' && - this.isParentMessage_(e)) { - this.onVerifyConfirmedPassword_(msg.password); - } else if (msg.method == 'redirectToSignin' && - this.isParentMessage_(e)) { - $('gaia-frame').src = this.constructInitialFrameUrl_(); - } else { - console.error('Authenticator.onMessage: unknown message + origin!?'); - } - } -}; - -Authenticator.getInstance().initialize();
diff --git a/chrome/browser/resources/gaia_auth/manifest.json b/chrome/browser/resources/gaia_auth/manifest.json index 0e708d01..a5ff0af 100644 --- a/chrome/browser/resources/gaia_auth/manifest.json +++ b/chrome/browser/resources/gaia_auth/manifest.json
@@ -4,36 +4,9 @@ "name": "GaiaAuthExtension", "version": "0.0.1", "manifest_version": 2, - "background" : { - "scripts": ["channel.js", "background.js"] - }, - "content_scripts": [ - { - "matches": [ - "<all_urls>" - ], - "js": ["channel.js", "saml_injected.js"], - "run_at": "document_start", - "all_frames": true - } - ], - "content_security_policy": "default-src 'self' blob: filesystem:; script-src 'self' blob: filesystem:; frame-src 'self' blob: filesystem: http: https:; style-src 'self' blob: filesystem:", "description": "GAIA Component Extension", "incognito": "split", "web_accessible_resources": [ - "main.css", - "main.html", - "main.js", - "offline.css", - "offline.html", - "offline.js", - "success.html", - "success.js", - "util.js" - ], - "permissions": [ - "<all_urls>", - "webRequest", - "webRequestBlocking" + "success.html" ] }
diff --git a/chrome/browser/resources/gaia_auth/offline.css b/chrome/browser/resources/gaia_auth/offline.css deleted file mode 100644 index 5bf69db..0000000 --- a/chrome/browser/resources/gaia_auth/offline.css +++ /dev/null
@@ -1,282 +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(dbeam): what's wrong with * here? Specificity issues? */ -audio, -body, -canvas, -command, -dd, -div, -dl, -dt, -embed, -form, -group, -h1, -h2, -h3, -h4, -h5, -h6, -html, -img, -mark, -meter, -object, -output, -progress, -summary, -td, -time, -tr, -video { - border: 0; - margin: 0; - padding: 0; -} -html { - background: #fff; - color: #333; - direction: ltr; - font: 81.25% arial, helvetica, sans-serif; - line-height: 1; -} -h1, -h2, -h3, -h4, -h5, -h6 { - color: #222; - font-size: 1.54em; - font-weight: normal; - line-height: 24px; - margin: 0 0 .46em; -} -strong { - color: #222; -} -body, -html { - height: 100%; - min-width: 100%; - position: absolute; -} -.wrapper { - min-height: 100%; - position: relative; -} -.content { - padding: 0 44px; -} -.main { - margin: 0 auto; - padding-bottom: 100px; - padding-top: 23px; - width: 650px; -} -button, -input, -select, -textarea { - font-family: inherit; - font-size: inherit; -} -input[type=email], -input[type=number], -input[type=password], -input[type=text], -input[type=url] { - -webkit-box-sizing: border-box; - background: #fff; - border: 1px solid #d9d9d9; - border-radius: 1px; - border-top: 1px solid #c0c0c0; - box-sizing: border-box; - display: inline-block; - height: 29px; - margin: 0; - padding-left: 8px; -} -input[type=email]:hover, -input[type=number]:hover, -input[type=password]:hover, -input[type=text]:hover, -input[type=url]:hover { - border: 1px solid #b9b9b9; - border-top: 1px solid #a0a0a0; - box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); -} -input[type=email]:focus, -input[type=number]:focus, -input[type=password]:focus, -input[type=text]:focus, -input[type=url]:focus { - border: 1px solid rgb(77, 144, 254); - box-shadow: inset 0 1px 2px rgba(0,0,0,0.3); - outline: none; -} -input[type=email][disabled=disabled], -input[type=number][disabled=disabled], -input[type=password][disabled=disabled], -input[type=text][disabled=disabled], -input[type=url][disabled=disabled] { - background: #f5f5f5; - border: 1px solid #e5e5e5; -} -input[type=email][disabled=disabled]:hover, -input[type=number][disabled=disabled]:hover, -input[type=password][disabled=disabled]:hover, -input[type=text][disabled=disabled]:hover, -input[type=url][disabled=disabled]:hover { - box-shadow: none; -} -.g-button { - -webkit-transition: all 218ms; - -webkit-user-select: none; - background-color: #f5f5f5; - background-image: linear-gradient(to bottom, #f5f5f5, #f1f1f1); - border: 1px solid rgba(0,0,0,0.1); - border-radius: 2px; - color: #555; - cursor: default; - display: inline-block; - font-size: 11px; - font-weight: bold; - height: 27px; - line-height: 27px; - min-width: 54px; - padding: 0 8px; - text-align: center; - transition: all 218ms; - user-select: none; -} -*+html .g-button { - min-width: 70px; -} -button.g-button, -input[type=submit].g-button { - height: 29px; - line-height: 29px; - margin: 0; - vertical-align: bottom; -} -*+html button.g-button, -*+html input[type=submit].g-button { - overflow: visible; -} -.g-button:hover { - -webkit-transition: all 0ms; - background-color: #f8f8f8; - background-image: linear-gradient(to bottom, #f8f8f8, #f1f1f1); - border: 1px solid #c6c6c6; - box-shadow: 0 1px 1px rgba(0,0,0,0.1); - color: #333; - text-decoration: none; - transition: all 0ms; -} -.g-button:active { - background-color: #f6f6f6; - background-image: linear-gradient(to bottom, #f6f6f6, #f1f1f1); - box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); -} -.g-button:visited { - color: #666; -} -.g-button-submit { - background-color: rgb(77, 144, 254); - background-image: - linear-gradient(to bottom, rgb(77, 144, 254), rgb(71, 135, 237)); - border: 1px solid rgb(48, 121, 237); - color: #fff; - text-shadow: 0 1px rgba(0,0,0,0.1); -} -.g-button-submit:hover { - background-color: rgb(53, 122, 232); - background-image: - linear-gradient(to bottom, rgb(77, 144, 254), rgb(53, 122, 232)); - border: 1px solid rgb(47, 91, 183); - color: #fff; - text-shadow: 0 1px rgba(0,0,0,0.3); -} -.g-button-submit:active { - box-shadow: inset 0 1px 2px rgba(0,0,0,0.3); -} -.g-button-submit:visited { - color: #fff; -} -.g-button-submit:focus { - box-shadow: inset 0 0 0 1px #fff; -} -.g-button-submit:focus:hover { - box-shadow: inset 0 0 0 1px #fff, 0 1px 1px rgba(0,0,0,0.1); -} -.g-button:hover img { - opacity: .72; -} -.g-button:active img { - opacity: 1; -} -.errormsg { - color: rgb(221, 75, 57); - display: block; - line-height: 17px; - margin: .5em 0 0; -} -input[type=email].form-error, -input[type=number].form-error, -input[type=password].form-error, -input[type=text].form-error, -input[type=url].form-error, -input[type=text].field-error, -input[type=password].field-error { - border: 1px solid rgb(221, 75, 57); -} -html { - background: transparent; -} -.content { - width: auto; -} -.main { - padding-bottom: 12px; - padding-top: 23px; -} -.signin-box h2 { - font-size: 16px; - height: 16px; - line-height: 17px; - margin: 0 0 1.2em; - position: relative; -} -.signin-box label { - display: block; - margin: 0 0 1.5em; -} -.signin-box input[type=text], -.signin-box input[type=password] { - font-size: 15px; - height: 32px; - width: 100%; -} -.signin-box .email-label, -.signin-box .passwd-label { - -webkit-user-select: none; - display: block; - font-weight: bold; - margin: 0 0 .5em; - user-select: none; -} -.signin-box input[type=submit] { - font-size: 13px; - height: 32px; - margin: 0 1.5em 1.2em 0; -} -.errormsg { - display: none; -} -.form-error + .errormsg, -.field-error + .errormsg { - display: block; -}
diff --git a/chrome/browser/resources/gaia_auth/offline.html b/chrome/browser/resources/gaia_auth/offline.html deleted file mode 100644 index a9afb7c..0000000 --- a/chrome/browser/resources/gaia_auth/offline.html +++ /dev/null
@@ -1,36 +0,0 @@ -<!doctype html> -<html> -<head> - <meta charset="utf-8"> - <link rel="stylesheet" href="offline.css"> - <script src="util.js"></script> - <script src="offline.js"></script> -</head> -<body> - <div class="wrapper"> - <div class="main content"> - <div class="signin-box"> - <h2 id="sign-in-title"></h2> - <form id="offline-login-form"> - <label> - <strong id="email-label" class="email-label"></strong> - <input type="text" name="email" value=""> - <span role="alert" class="errormsg" id="empty-email-alert"> - </span> - </label> - <label> - <strong id="password-label" class="passwd-label"></strong> - <input type="password" name="password"> - <span role="alert" class="errormsg" id="empty-password-alert"> - </span> - <span role="alert" class="errormsg" id="errormsg-alert"> - </span> - </label> - <input id="submit-button" type="submit" - class="g-button g-button-submit"> - </form> - </div> - </div> - </div> -</body> -</html>
diff --git a/chrome/browser/resources/gaia_auth/offline.js b/chrome/browser/resources/gaia_auth/offline.js deleted file mode 100644 index aaf6045..0000000 --- a/chrome/browser/resources/gaia_auth/offline.js +++ /dev/null
@@ -1,87 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview Offline login implementation. - */ - -/** - * Initialize the offline page. - * @param {Object} params Intialization params passed from parent page. - */ -function load(params) { - // Setup localized strings. - $('sign-in-title').textContent = decodeURIComponent(params['stringSignIn']); - $('email-label').textContent = decodeURIComponent(params['stringEmail']); - $('password-label').textContent = - decodeURIComponent(params['stringPassword']); - $('submit-button').value = decodeURIComponent(params['stringSignIn']); - $('empty-email-alert').textContent = - decodeURIComponent(params['stringEmptyEmail']); - $('empty-password-alert').textContent = - decodeURIComponent(params['stringEmptyPassword']); - $('errormsg-alert').textContent = decodeURIComponent(params['stringError']); - - // Setup actions. - var form = $('offline-login-form'); - form.addEventListener('submit', function(e) { - // Clear all previous errors. - form.email.classList.remove('field-error'); - form.password.classList.remove('field-error'); - form.password.classList.remove('form-error'); - - if (form.email.value == '') { - form.email.classList.add('field-error'); - form.email.focus(); - } else if (form.password.value == '') { - form.password.classList.add('field-error'); - form.password.focus(); - } else { - var msg = { - 'method': 'offlineLogin', - 'email': form.email.value, - 'password': form.password.value - }; - window.parent.postMessage(msg, 'chrome://oobe/'); - } - e.preventDefault(); - }); - - var email = params['email']; - if (email) { - // Email is present, which means that unsuccessful login attempt has been - // made. Try to mimic Gaia's behaviour. - form.email.value = email; - form.password.classList.add('form-error'); - form.password.focus(); - } else { - form.email.focus(); - } - window.parent.postMessage({'method': 'loginUILoaded'}, 'chrome://oobe/'); -} - -/** - * Handles initialization message from parent page. - * @param {MessageEvent} e - */ -function handleInitializeMessage(e) { - var ALLOWED_PARENT_ORIGINS = [ - 'chrome://oobe', - 'chrome://chrome-signin' - ]; - - if (ALLOWED_PARENT_ORIGINS.indexOf(e.origin) == -1) - return; - - window.removeEventListener('message', handleInitializeMessage); - - var params = e.data; - params.parentPage = e.origin; - load(params); -} - -document.addEventListener('DOMContentLoaded', function() { - window.addEventListener('message', handleInitializeMessage); - window.parent.postMessage({'method': 'loginUIDOMContentLoaded'}, '*'); -});
diff --git a/chrome/browser/resources/gaia_auth/util.js b/chrome/browser/resources/gaia_auth/util.js deleted file mode 100644 index 1ad55136..0000000 --- a/chrome/browser/resources/gaia_auth/util.js +++ /dev/null
@@ -1,49 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Alias for document.getElementById. - * @param {string} id The ID of the element to find. - * @return {HTMLElement} The found element or null if not found. - */ -function $(id) { - return document.getElementById(id); -} - -/** - * Creates a new URL which is the old URL with a GET param of key=value. - * Copied from ui/webui/resources/js/util.js. - * @param {string} url The base URL. There is not sanity checking on the URL so - * it must be passed in a proper format. - * @param {string} key The key of the param. - * @param {string} value The value of the param. - * @return {string} The new URL. - */ -function appendParam(url, key, value) { - var param = encodeURIComponent(key) + '=' + encodeURIComponent(value); - - if (url.indexOf('?') == -1) - return url + '?' + param; - return url + '&' + param; -} - -/** - * Creates a new URL by striping all query parameters. - * @param {string} url The original URL. - * @return {string} The new URL with all query parameters stripped. - */ -function stripParams(url) { - return url.substring(0, url.indexOf('?')) || url; -} - -/** - * Extract domain name from an URL. - * @param {string} url An URL string. - * @return {string} The host name of the URL. - */ -function extractDomain(url) { - var a = document.createElement('a'); - a.href = url; - return a.hostname; -}
diff --git a/chrome/browser/resources/gaia_auth/channel.js b/chrome/browser/resources/gaia_auth_host/channel.js similarity index 100% rename from chrome/browser/resources/gaia_auth/channel.js rename to chrome/browser/resources/gaia_auth_host/channel.js
diff --git a/chrome/browser/resources/gaia_auth_host/post_message_channel.js b/chrome/browser/resources/gaia_auth_host/post_message_channel.js index 9ba11cd6..8fe4631 100644 --- a/chrome/browser/resources/gaia_auth_host/post_message_channel.js +++ b/chrome/browser/resources/gaia_auth_host/post_message_channel.js
@@ -9,7 +9,7 @@ */ 'use strict'; -// <include src="../gaia_auth/channel.js"> +// <include src="channel.js"> var PostMessageChannel = (function() { /**
diff --git a/chrome/browser/resources/gaia_auth/saml_injected.js b/chrome/browser/resources/gaia_auth_host/saml_injected.js similarity index 100% rename from chrome/browser/resources/gaia_auth/saml_injected.js rename to chrome/browser/resources/gaia_auth_host/saml_injected.js
diff --git a/chrome/browser/resources/gaia_auth_host/webview_saml_injected.js b/chrome/browser/resources/gaia_auth_host/webview_saml_injected.js index 4a7ca561..e148e913 100644 --- a/chrome/browser/resources/gaia_auth_host/webview_saml_injected.js +++ b/chrome/browser/resources/gaia_auth_host/webview_saml_injected.js
@@ -3,4 +3,4 @@ // found in the LICENSE file. // <include src="post_message_channel.js"> -// <include src="../gaia_auth/saml_injected.js"> +// <include src="saml_injected.js">
diff --git a/chrome/browser/resources/inline_login/inline_login.html b/chrome/browser/resources/inline_login/inline_login.html index 3699b9d..bf65d14 100644 --- a/chrome/browser/resources/inline_login/inline_login.html +++ b/chrome/browser/resources/inline_login/inline_login.html
@@ -2,6 +2,8 @@ <html i18n-values="dir:textdirection;lang:language"> <head> <title i18n-content="title"></title> + <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> + <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.html"> <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> <link rel="stylesheet" href="chrome://resources/css/spinner.css"> <link rel="stylesheet" href="chrome://chrome-signin/inline_login.css"> @@ -15,12 +17,13 @@ </head> <body> <div id="contents" class="loading"> - <iframe id="signin-frame" name="signin-frame" frameborder="0" - scrolling="no"></iframe> + <webview id="signin-frame" name="signin-frame" allowscaling></webview> <div id="spinner-container"> <div class="spinner"></div> </div> </div> + <paper-icon-button id="navigation-button" + icon="icons:close"></paper-icon-button> <script src="chrome://resources/js/i18n_template.js"></script> </body> </html>
diff --git a/chrome/browser/resources/inline_login/new_inline_login.html b/chrome/browser/resources/inline_login/new_inline_login.html deleted file mode 100644 index bf65d14..0000000 --- a/chrome/browser/resources/inline_login/new_inline_login.html +++ /dev/null
@@ -1,29 +0,0 @@ -<!doctype html> -<html i18n-values="dir:textdirection;lang:language"> -<head> - <title i18n-content="title"></title> - <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> - <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.html"> - <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> - <link rel="stylesheet" href="chrome://resources/css/spinner.css"> - <link rel="stylesheet" href="chrome://chrome-signin/inline_login.css"> - <script src="chrome://resources/js/cr.js"></script> - <script src="chrome://resources/js/cr/event_target.js"></script> - <script src="chrome://resources/js/load_time_data.js"></script> - <script src="chrome://resources/js/util.js"></script> - <script src="chrome://chrome-signin/gaia_auth_host.js"></script> - <script src="chrome://chrome-signin/inline_login.js"></script> - <script src="chrome://chrome-signin/strings.js"></script> -</head> -<body> - <div id="contents" class="loading"> - <webview id="signin-frame" name="signin-frame" allowscaling></webview> - <div id="spinner-container"> - <div class="spinner"></div> - </div> - </div> - <paper-icon-button id="navigation-button" - icon="icons:close"></paper-icon-button> - <script src="chrome://resources/js/i18n_template.js"></script> -</body> -</html>
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js index 51bb5f4..22b4bd8 100644 --- a/chrome/browser/resources/settings/settings_main/settings_main.js +++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -124,7 +124,8 @@ // How much of the overscroll is visible (may be negative). var visibleOverscroll = overscroll.scrollHeight - (overscrollBottom - visibleBottom); - this.overscroll_ = Math.max(opt_minHeight || 0, visibleOverscroll); + this.overscroll_ = + Math.max(opt_minHeight || 0, Math.ceil(visibleOverscroll)); }, /**
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index c62f620..0e4d121 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc
@@ -747,9 +747,8 @@ // static Browser* SessionRestore::RestoreSession( - Profile* profile, - Browser* browser, - uint32_t behavior, + Profile* profile, Browser* browser, + SessionRestore::BehaviorBitmask behavior, const std::vector<GURL>& urls_to_open) { #if defined(OS_CHROMEOS) chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( @@ -775,7 +774,7 @@ // static void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { - uint32_t behavior = + SessionRestore::BehaviorBitmask behavior = HasSingleNewTabPage(browser) ? SessionRestore::CLOBBER_CURRENT_TAB : 0; SessionRestore::RestoreSession(browser->profile(), browser, behavior, std::vector<GURL>());
diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h index f232a48a..de0a90e9 100644 --- a/chrome/browser/sessions/session_restore.h +++ b/chrome/browser/sessions/session_restore.h
@@ -28,7 +28,11 @@ // variety is meant for startup and blocks until restore is complete. class SessionRestore { public: - enum Behavior { + // Bitmask representing behaviors available when restoring a session. Populate + // using the values below. + using BehaviorBitmask = uint32_t; + + enum { // Indicates the active tab of the supplied browser should be closed. CLOBBER_CURRENT_TAB = 1 << 0, @@ -56,7 +60,7 @@ // If |urls_to_open| is non-empty, a tab is added for each of the URLs. static Browser* RestoreSession(Profile* profile, Browser* browser, - uint32_t behavior, + BehaviorBitmask behavior, const std::vector<GURL>& urls_to_open); // Restores the last session when the last session crashed. It's a wrapper
diff --git a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc index 4d0a9d1..4b93c43 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
@@ -295,17 +295,31 @@ EXPECT_WIFI_YES, EXPECT_WIFI_SSID_YES, EXPECT_LOGIN_URL_YES); } +// Flaky on mac: https://crbug.com/690170 +#if defined(OS_MACOSX) +#define MAYBE_WiFi_NoSSID_LoginURL DISABLED_WiFi_NoSSID_LoginURL +#else +#define MAYBE_WiFi_NoSSID_LoginURL WiFi_NoSSID_LoginURL +#endif + // Same as above, with login URL but no SSID. IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, - WiFi_NoSSID_LoginURL) { + MAYBE_WiFi_NoSSID_LoginURL) { TestInterstitial(true, std::string(), GURL("http://captive.portal/landing_url"), EXPECT_WIFI_YES, EXPECT_WIFI_SSID_NO, EXPECT_LOGIN_URL_YES); } +// Flaky on mac: https://crbug.com/690125 +#if defined(OS_MACOSX) +#define MAYBE_WiFi_SSID_NoLoginURL DISABLED_WiFi_SSID_NoLoginURL +#else +#define MAYBE_WiFi_SSID_NoLoginURL WiFi_SSID_NoLoginURL +#endif + // Same as above, with SSID but no login URL. IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, - WiFi_SSID_NoLoginURL) { + MAYBE_WiFi_SSID_NoLoginURL) { const GURL kLandingUrl(captive_portal::CaptivePortalDetector::kDefaultURL); TestInterstitial(true, kWiFiSSID, kLandingUrl, EXPECT_WIFI_YES, EXPECT_WIFI_SSID_YES, EXPECT_LOGIN_URL_NO);
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index ea1dad3a..42588ca 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1820,6 +1820,8 @@ "views/payments/payment_sheet_view_controller.h", "views/payments/shipping_list_view_controller.cc", "views/payments/shipping_list_view_controller.h", + "views/payments/validating_textfield.cc", + "views/payments/validating_textfield.h", "views/payments/view_stack.cc", "views/payments/view_stack.h", "views/process_singleton_dialog_linux.cc",
diff --git a/chrome/browser/ui/android/javascript_app_modal_dialog_android.cc b/chrome/browser/ui/android/javascript_app_modal_dialog_android.cc index 0e13fb2..fe7062ce 100644 --- a/chrome/browser/ui/android/javascript_app_modal_dialog_android.cc +++ b/chrome/browser/ui/android/javascript_app_modal_dialog_android.cc
@@ -18,7 +18,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "jni/JavascriptAppModalDialog_jni.h" #include "ui/android/window_android.h" @@ -62,14 +62,14 @@ ConvertUTF16ToJavaString(env, dialog_->message_text()); bool foremost = tab->IsUserInteractable(); - switch (dialog_->javascript_message_type()) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: { + switch (dialog_->javascript_dialog_type()) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: { UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Alert", foremost); dialog_object = Java_JavascriptAppModalDialog_createAlertDialog( env, title, message, dialog_->display_suppress_checkbox()); break; } - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: { + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: { if (dialog_->is_before_unload_dialog()) { dialog_object = Java_JavascriptAppModalDialog_createBeforeUnloadDialog( env, title, message, dialog_->is_reload(), @@ -81,7 +81,7 @@ } break; } - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: { + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: { UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Prompt", foremost); ScopedJavaLocalRef<jstring> default_prompt_text = ConvertUTF16ToJavaString(env, dialog_->default_prompt_text());
diff --git a/chrome/browser/ui/ash/app_launcher_id.cc b/chrome/browser/ui/ash/app_launcher_id.cc index fa42b1f..e6f94a76 100644 --- a/chrome/browser/ui/ash/app_launcher_id.cc +++ b/chrome/browser/ui/ash/app_launcher_id.cc
@@ -7,7 +7,6 @@ #include "base/logging.h" namespace ash { -namespace launcher { AppLauncherId::AppLauncherId(const std::string& app_id, const std::string& launch_id) @@ -23,5 +22,4 @@ AppLauncherId::~AppLauncherId() {} -} // namespace launcher } // namespace ash
diff --git a/chrome/browser/ui/ash/app_launcher_id.h b/chrome/browser/ui/ash/app_launcher_id.h index dcdcc6f..5c5eb9b 100644 --- a/chrome/browser/ui/ash/app_launcher_id.h +++ b/chrome/browser/ui/ash/app_launcher_id.h
@@ -8,7 +8,6 @@ #include <string> namespace ash { -namespace launcher { // A unique chrome launcher id used to identify a shelf item. This class is a // wrapper for the chrome launcher identifier. |app_launcher_id_| includes the @@ -41,7 +40,6 @@ std::string launch_id_; }; -} // namespace launcher } // namespace ash #endif // CHROME_BROWSER_UI_ASH_APP_LAUNCHER_ID_H_
diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc index e9b7012..72ecf33f 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc
@@ -127,8 +127,8 @@ AppListSource source, int event_flags) { ChromeLauncherController::instance()->LaunchApp( - ash::launcher::AppLauncherId(extension->id()), - AppListSourceToLaunchSource(source), event_flags); + ash::AppLauncherId(extension->id()), AppListSourceToLaunchSource(source), + event_flags); DismissView(); }
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.h b/chrome/browser/ui/ash/chrome_launcher_prefs.h index f54481c..1fda7a7a 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.h +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h
@@ -26,10 +26,11 @@ } namespace ash { -namespace launcher { class AppLauncherId; +namespace launcher { + // Path within the dictionary entries in the prefs::kPinnedLauncherApps list // specifying the extension ID of the app to be pinned by that entry. extern const char kPinnedAppsPrefAppIDPath[];
diff --git a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc index 872431e8..495d79bb 100644 --- a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc +++ b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc
@@ -108,9 +108,8 @@ // Launching some items replaces this item controller instance, which // destroys the app and launch id strings; making copies avoid crashes. - launcher_controller()->LaunchApp( - ash::launcher::AppLauncherId(app_id(), launch_id()), source, - ui::EF_NONE); + launcher_controller()->LaunchApp(ash::AppLauncherId(app_id(), launch_id()), + source, ui::EF_NONE); return kNewWindowCreated; } return ActivateContent(content);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 2558c41..1ee0afb 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -36,7 +36,7 @@ OnInit(); } -void ChromeLauncherController::LaunchApp(ash::launcher::AppLauncherId id, +void ChromeLauncherController::LaunchApp(ash::AppLauncherId id, ash::LaunchSource source, int event_flags) { launcher_controller_helper_->LaunchApp(id, source, event_flags);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h index 5aa42d4..94c31e4 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
@@ -137,7 +137,7 @@ // Opens a new instance of the application identified by the AppLauncherId. // Used by the app-list, and by pinned-app shelf items. - void LaunchApp(ash::launcher::AppLauncherId id, + void LaunchApp(ash::AppLauncherId id, ash::LaunchSource source, int event_flags);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc index c6f5978..1a50f01 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
@@ -363,8 +363,8 @@ if (update_prefs) { ash::launcher::RemovePinPosition( - profile(), ash::launcher::AppLauncherId(GetAppIDForShelfID(id), - GetLaunchIDForShelfID(id))); + profile(), + ash::AppLauncherId(GetAppIDForShelfID(id), GetLaunchIDForShelfID(id))); } const ash::ShelfItem* item = GetItem(id); @@ -393,7 +393,7 @@ void ChromeLauncherControllerImpl::LockV1AppWithID(const std::string& app_id) { ash::ShelfID id = GetShelfIDForAppID(app_id); if (id == ash::kInvalidShelfID) { - CreateAppShortcutLauncherItemWithType(ash::launcher::AppLauncherId(app_id), + CreateAppShortcutLauncherItemWithType(ash::AppLauncherId(app_id), model_->item_count(), ash::TYPE_APP); id = GetShelfIDForAppID(app_id); } @@ -418,8 +418,7 @@ // Launching some items replaces the associated item controller instance, // which destroys the app and launch id strings; making copies avoid crashes. - LaunchApp(ash::launcher::AppLauncherId(controller->app_id(), - controller->launch_id()), + LaunchApp(ash::AppLauncherId(controller->app_id(), controller->launch_id()), ash::LAUNCH_FROM_UNKNOWN, event_flags); } @@ -464,7 +463,7 @@ if (!app_controller->GetRunningApplications().empty()) app_controller->Activate(source); else - LaunchApp(ash::launcher::AppLauncherId(app_id), source, event_flags); + LaunchApp(ash::AppLauncherId(app_id), source, event_flags); } void ChromeLauncherControllerImpl::SetLauncherItemImage( @@ -958,7 +957,7 @@ } ash::ShelfID ChromeLauncherControllerImpl::CreateAppShortcutLauncherItem( - const ash::launcher::AppLauncherId& app_launcher_id, + const ash::AppLauncherId& app_launcher_id, int index) { return CreateAppShortcutLauncherItemWithType(app_launcher_id, index, ash::TYPE_APP_SHORTCUT); @@ -1001,7 +1000,7 @@ ash::ShelfID ChromeLauncherControllerImpl::CreateAppShortcutLauncherItemWithType( - const ash::launcher::AppLauncherId& app_launcher_id, + const ash::AppLauncherId& app_launcher_id, int index, ash::ShelfItemType shelf_item_type) { AppShortcutLauncherItemController* controller = @@ -1040,8 +1039,8 @@ Pin(shelf_id); } else { // Otherwise, create a shortcut item for it. - shelf_id = CreateAppShortcutLauncherItem( - ash::launcher::AppLauncherId(app_id), model_->item_count()); + shelf_id = CreateAppShortcutLauncherItem(ash::AppLauncherId(app_id), + model_->item_count()); SyncPinPosition(shelf_id); } } @@ -1087,7 +1086,7 @@ std::string app_id_before; std::string launch_id_before; - std::vector<ash::launcher::AppLauncherId> app_launcher_ids_after; + std::vector<ash::AppLauncherId> app_launcher_ids_after; for (int i = index - 1; i > 0; --i) { const ash::ShelfID shelf_id_before = model_->items()[i].id; @@ -1106,17 +1105,17 @@ DCHECK(!app_id_after.empty()); const std::string launch_id_after = GetLaunchIDForShelfID(shelf_id_after); app_launcher_ids_after.push_back( - ash::launcher::AppLauncherId(app_id_after, launch_id_after)); + ash::AppLauncherId(app_id_after, launch_id_after)); } } - ash::launcher::AppLauncherId app_launcher_id_before = + ash::AppLauncherId app_launcher_id_before = app_id_before.empty() - ? ash::launcher::AppLauncherId() - : ash::launcher::AppLauncherId(app_id_before, launch_id_before); + ? ash::AppLauncherId() + : ash::AppLauncherId(app_id_before, launch_id_before); ash::launcher::SetPinPosition(profile(), - ash::launcher::AppLauncherId(app_id, launch_id), + ash::AppLauncherId(app_id, launch_id), app_launcher_id_before, app_launcher_ids_after); } @@ -1144,7 +1143,7 @@ // into the pref state. Therefore we tell |persistPinnedState| to ignore any // invocations while we are running. base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); - const std::vector<ash::launcher::AppLauncherId> pinned_apps = + const std::vector<ash::AppLauncherId> pinned_apps = ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), launcher_controller_helper());
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h index 871876a..1a732720 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h
@@ -156,7 +156,7 @@ // Creates a new app shortcut item and controller on the shelf at |index|. // Use kInsertItemAtEnd to add a shortcut as the last item. ash::ShelfID CreateAppShortcutLauncherItem( - const ash::launcher::AppLauncherId& app_launcher_id, + const ash::AppLauncherId& app_launcher_id, int index); private: @@ -178,7 +178,7 @@ // Creates a new app shortcut item and controller on the shelf at |index|. // Use kInsertItemAtEnd to add a shortcut as the last item. ash::ShelfID CreateAppShortcutLauncherItemWithType( - const ash::launcher::AppLauncherId& app_launcher_id, + const ash::AppLauncherId& app_launcher_id, int index, ash::ShelfItemType shelf_item_type);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc index f4af721d..074f7de 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
@@ -204,7 +204,7 @@ ash::ShelfModel* shelf_model() { return ash::WmShell::Get()->shelf_model(); } ash::ShelfID CreateAppShortcutLauncherItem( - const ash::launcher::AppLauncherId& app_launcher_id) { + const ash::AppLauncherId& app_launcher_id) { return controller_->CreateAppShortcutLauncherItem( app_launcher_id, shelf_model()->item_count()); } @@ -299,7 +299,7 @@ // Then create a shortcut. int item_count = model_->item_count(); ash::ShelfID shortcut_id = controller_->CreateAppShortcutLauncherItem( - ash::launcher::AppLauncherId(app_id), item_count); + ash::AppLauncherId(app_id), item_count); controller_->SyncPinPosition(shortcut_id); EXPECT_EQ(++item_count, model_->item_count()); const ash::ShelfItem& item = *model_->ItemByID(shortcut_id); @@ -313,7 +313,7 @@ ash::ShelfID PinFakeApp(const std::string& app_id) { return controller_->CreateAppShortcutLauncherItem( - ash::launcher::AppLauncherId(app_id), model_->item_count()); + ash::AppLauncherId(app_id), model_->item_count()); } // Get the index of an item which has the given type. @@ -420,7 +420,7 @@ // Then create a shortcut. ash::ShelfID shortcut_id = - CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId(app_id)); + CreateAppShortcutLauncherItem(ash::AppLauncherId(app_id)); ++item_count; ASSERT_EQ(item_count, shelf_model()->item_count()); ash::ShelfItem item = *shelf_model()->ItemByID(shortcut_id); @@ -457,7 +457,7 @@ // Create a shortcut. The app item should be after it. ash::ShelfID foo_id = - CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId("foo")); + CreateAppShortcutLauncherItem(ash::AppLauncherId("foo")); ++item_count; ASSERT_EQ(item_count, shelf_model()->item_count()); EXPECT_LT(shelf_model()->ItemIndexByID(foo_id), @@ -472,7 +472,7 @@ // New shortcuts should come after the item. ash::ShelfID bar_id = - CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId("bar")); + CreateAppShortcutLauncherItem(ash::AppLauncherId("bar")); ++item_count; ASSERT_EQ(item_count, shelf_model()->item_count()); EXPECT_LT(shelf_model()->ItemIndexByID(id), @@ -492,7 +492,7 @@ // Then create a shortcut. ash::ShelfID shortcut_id = - CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId(app_id)); + CreateAppShortcutLauncherItem(ash::AppLauncherId(app_id)); ++item_count; ASSERT_EQ(item_count, shelf_model()->item_count()); ash::ShelfItem item = *shelf_model()->ItemByID(shortcut_id); @@ -502,7 +502,7 @@ // Create a second shortcut. This will be needed to force the first one to // move once it gets unpinned. ash::ShelfID foo_id = - CreateAppShortcutLauncherItem(ash::launcher::AppLauncherId("foo")); + CreateAppShortcutLauncherItem(ash::AppLauncherId("foo")); ++item_count; ASSERT_EQ(item_count, shelf_model()->item_count()); EXPECT_LT(shelf_model()->ItemIndexByID(shortcut_id), @@ -926,9 +926,8 @@ LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB, WindowOpenDisposition::NEW_BACKGROUND_TAB); EXPECT_EQ(++tab_count, tab_strip->count()); - controller_->LaunchApp( - ash::launcher::AppLauncherId(last_loaded_extension_id()), - ash::LAUNCH_FROM_UNKNOWN, 0); + controller_->LaunchApp(ash::AppLauncherId(last_loaded_extension_id()), + ash::LAUNCH_FROM_UNKNOWN, 0); } // Confirm that clicking a icon for an app running in one of 2 maxmized windows @@ -978,7 +977,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchApp) { TabStripModel* tab_strip = browser()->tab_strip_model(); int tab_count = tab_strip->count(); - ash::launcher::AppLauncherId id( + ash::AppLauncherId id( LoadExtension(test_data_dir_.AppendASCII("app1"))->id()); controller_->LaunchApp(id, ash::LAUNCH_FROM_UNKNOWN, 0); EXPECT_EQ(++tab_count, tab_strip->count());
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc index 7421631..86035692 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
@@ -407,8 +407,7 @@ DCHECK(!test_controller_); ash::ShelfID id = launcher_controller_->CreateAppShortcutLauncherItemWithType( - ash::launcher::AppLauncherId(app_id), model_->item_count(), - ash::TYPE_APP); + ash::AppLauncherId(app_id), model_->item_count(), ash::TYPE_APP); DCHECK(id); // Change the created launcher controller into a V2 app controller. test_controller_ = new TestV2AppLauncherItemController(app_id,
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc index d5948dd..fa664f9 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc
@@ -35,7 +35,7 @@ private: // ash::mojom::ShelfItemDelegate: void LaunchItem() override { - controller_->LaunchApp(ash::launcher::AppLauncherId(app_id_), + controller_->LaunchApp(ash::AppLauncherId(app_id_), ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); } void ExecuteCommand(uint32_t command_id, int32_t event_flags) override { @@ -275,7 +275,7 @@ if (!ConnectToShelfController()) return; - std::vector<ash::launcher::AppLauncherId> pinned_apps = + std::vector<ash::AppLauncherId> pinned_apps = ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), launcher_controller_helper());
diff --git a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc index 4d0cf7d..35f1e20 100644 --- a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc +++ b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
@@ -169,7 +169,7 @@ return true; } -void LauncherControllerHelper::LaunchApp(ash::launcher::AppLauncherId id, +void LauncherControllerHelper::LaunchApp(ash::AppLauncherId id, ash::LaunchSource source, int event_flags) { const std::string& app_id = id.app_id(); @@ -218,9 +218,8 @@ } void LauncherControllerHelper::ExtensionEnableFlowFinished() { - LaunchApp( - ash::launcher::AppLauncherId(extension_enable_flow_->extension_id()), - ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); + LaunchApp(ash::AppLauncherId(extension_enable_flow_->extension_id()), + ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); extension_enable_flow_.reset(); }
diff --git a/chrome/browser/ui/ash/launcher/launcher_controller_helper.h b/chrome/browser/ui/ash/launcher/launcher_controller_helper.h index 33e64ab..0319121 100644 --- a/chrome/browser/ui/ash/launcher/launcher_controller_helper.h +++ b/chrome/browser/ui/ash/launcher/launcher_controller_helper.h
@@ -42,7 +42,7 @@ // Note that already running applications are ignored by the restore process. virtual bool IsValidIDForCurrentUser(const std::string& id) const; - void LaunchApp(ash::launcher::AppLauncherId id, + void LaunchApp(ash::AppLauncherId id, ash::LaunchSource source, int event_flags);
diff --git a/chrome/browser/ui/ash/launcher/launcher_item_controller.h b/chrome/browser/ui/ash/launcher/launcher_item_controller.h index 4378732..ed65f3c 100644 --- a/chrome/browser/ui/ash/launcher/launcher_item_controller.h +++ b/chrome/browser/ui/ash/launcher/launcher_item_controller.h
@@ -19,7 +19,7 @@ // LauncherItemController is used by ChromeLauncherController to track one // or more windows associated with a shelf item. -// TODO (khmel): Consider using ash::launcher::AppLauncherId instead of pair +// TODO (khmel): Consider using ash::AppLauncherId instead of pair // |app_id| and |launch_id|. class LauncherItemController : public ash::ShelfItemDelegate { public:
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc index 6a3d000..f32a91d 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
@@ -12,7 +12,6 @@ #include "ash/common/wm_shell.h" #include "ash/common/wm_window.h" #include "ash/public/cpp/shell_window_ids.h" -#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/wm/window_state_aura.h" #include "base/auto_reset.h" @@ -21,7 +20,6 @@ #include "base/strings/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos.h" @@ -34,10 +32,10 @@ #include "content/public/browser/notification_service.h" #include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window_registry.h" -#include "google_apis/gaia/gaia_auth_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" +#include "ui/aura/window_tree_host.h" #include "ui/base/ui_base_types.h" #include "ui/events/event.h" #include "ui/message_center/message_center.h"
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc index 61375328..efd0662 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.cc +++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -342,7 +342,7 @@ } } -bool ChromeAutofillClient::IsContextSecure(const GURL& form_origin) { +bool ChromeAutofillClient::IsContextSecure() { content::SSLStatus ssl_status; content::NavigationEntry* navigation_entry = web_contents()->GetController().GetLastCommittedEntry();
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.h b/chrome/browser/ui/autofill/chrome_autofill_client.h index 8df0fa68..0026609 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.h +++ b/chrome/browser/ui/autofill/chrome_autofill_client.h
@@ -77,7 +77,7 @@ void DidFillOrPreviewField(const base::string16& autofilled_value, const base::string16& profile_full_name) override; void OnFirstUserGestureObserved() override; - bool IsContextSecure(const GURL& form_origin) override; + bool IsContextSecure() override; bool ShouldShowSigninPromo() override; void StartSigninFlow() override; void ShowHttpNotSecureExplanation() override;
diff --git a/chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm b/chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm index 1b84a976..0e56c98 100644 --- a/chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm +++ b/chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm
@@ -238,11 +238,11 @@ NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); bool text_field = false; bool one_button = false; - switch (dialog_->javascript_message_type()) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: + switch (dialog_->javascript_dialog_type()) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: one_button = true; break; - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: if (dialog_->is_before_unload_dialog()) { if (dialog_->is_reload()) { default_button = l10n_util::GetNSStringWithFixup( @@ -257,7 +257,7 @@ } } break; - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: text_field = true; break;
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog.cc index 12ea34a7..4151a826 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog.cc +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog.cc
@@ -20,12 +20,12 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback) { return JavaScriptDialogViews::Create( - parent_web_contents, alerting_web_contents, title, message_type, + parent_web_contents, alerting_web_contents, title, dialog_type, message_text, default_prompt_text, dialog_callback); }
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog.h b/chrome/browser/ui/javascript_dialogs/javascript_dialog.h index 5deecea..877e0ce 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog.h +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog.h
@@ -20,7 +20,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback&
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h b/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h index 5b6b5b4..5521ebf 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h
@@ -24,7 +24,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& @@ -38,7 +38,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback&
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.mm b/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.mm index 10bc7b5..c5ca13d 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.mm +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.mm
@@ -24,7 +24,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& @@ -82,7 +82,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& @@ -97,13 +97,13 @@ keyEquivalent:kKeyEquivalentReturn target:bridge_ action:@selector(onAcceptButton:)]; - if (message_type != content::JAVASCRIPT_MESSAGE_TYPE_ALERT) { + if (dialog_type != content::JAVASCRIPT_DIALOG_TYPE_ALERT) { [alert_ addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL) keyEquivalent:kKeyEquivalentEscape target:bridge_ action:@selector(onCancelButton:)]; } - if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { + if (dialog_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) { textField_.reset( [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 460, 22)]); [[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail]; @@ -153,13 +153,13 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback) { return (new JavaScriptDialogCocoa(parent_web_contents, alerting_web_contents, - title, message_type, message_text, + title, dialog_type, message_text, default_prompt_text, dialog_callback)) ->weak_factory_.GetWeakPtr(); } @@ -173,7 +173,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& @@ -183,7 +183,7 @@ parent_web_contents, alerting_web_contents, title, - message_type, + dialog_type, message_text, default_prompt_text, dialog_callback)),
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_mac.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_mac.cc index 54cebcb9..3865f91a 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_mac.cc +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_mac.cc
@@ -22,18 +22,18 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback) { if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { return JavaScriptDialogViews::Create( - parent_web_contents, alerting_web_contents, title, message_type, + parent_web_contents, alerting_web_contents, title, dialog_type, message_text, default_prompt_text, dialog_callback); } else { return JavaScriptDialogCocoa::Create( - parent_web_contents, alerting_web_contents, title, message_type, + parent_web_contents, alerting_web_contents, title, dialog_type, message_text, default_prompt_text, dialog_callback); } }
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc index 37de8e8..82b1781d 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
@@ -90,7 +90,7 @@ void JavaScriptDialogTabHelper::RunJavaScriptDialog( content::WebContents* alerting_web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -116,21 +116,21 @@ content::WebContents* parent_web_contents = WebContentsObserver::web_contents(); bool foremost = IsWebContentsForemost(parent_web_contents); - switch (message_type) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: + switch (dialog_type) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Alert", foremost); break; - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Confirm", foremost); break; - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Prompt", foremost); break; } if (IsEnabled()) { if (!IsWebContentsForemost(parent_web_contents) && - message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { + dialog_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) { // Don't allow "prompt" dialogs to steal the user's focus. TODO(avi): // Eventually, for subsequent phases of http://bit.ly/project-oldspice, // turn off focus stealing for other dialog types. @@ -154,9 +154,9 @@ base::string16 title = AppModalDialogManager()->GetTitle(alerting_web_contents, origin_url); dialog_callback_ = callback; - message_type_ = message_type; + dialog_type_ = dialog_type; dialog_ = JavaScriptDialog::Create( - parent_web_contents, alerting_web_contents, title, message_type, + parent_web_contents, alerting_web_contents, title, dialog_type, message_text, default_prompt_text, base::Bind(&JavaScriptDialogTabHelper::OnDialogClosed, base::Unretained(this), callback)); @@ -175,7 +175,7 @@ } } else { AppModalDialogManager()->RunJavaScriptDialog( - alerting_web_contents, origin_url, message_type, message_text, + alerting_web_contents, origin_url, dialog_type, message_text, default_prompt_text, callback, did_suppress_message); } @@ -289,18 +289,18 @@ void JavaScriptDialogTabHelper::LogDialogDismissalCause( JavaScriptDialogTabHelper::DismissalCause cause) { - switch (message_type_) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: + switch (dialog_type_) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: UMA_HISTOGRAM_ENUMERATION("JSDialogs.DismissalCause.Alert", static_cast<int>(cause), static_cast<int>(DismissalCause::MAX)); break; - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: UMA_HISTOGRAM_ENUMERATION("JSDialogs.DismissalCause.Confirm", static_cast<int>(cause), static_cast<int>(DismissalCause::MAX)); break; - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: UMA_HISTOGRAM_ENUMERATION("JSDialogs.DismissalCause.Prompt", static_cast<int>(cause), static_cast<int>(DismissalCause::MAX));
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h index 35cc6d8..1417cd7 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h
@@ -41,7 +41,7 @@ // JavaScriptDialogManager: void RunJavaScriptDialog(content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -88,8 +88,8 @@ base::WeakPtr<JavaScriptDialog> dialog_; // The type of dialog being displayed. Only valid when |dialog_| is non-null. - content::JavaScriptMessageType message_type_ = - content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT; + content::JavaScriptDialogType dialog_type_ = + content::JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT; // The callback provided for when the dialog is closed. Usually the dialog // itself calls it, but in the cases where the dialog is closed not by the
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc index ee59a37f..bb8fb8a 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc
@@ -18,13 +18,13 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback) { return (new JavaScriptDialogViews(parent_web_contents, alerting_web_contents, - title, message_type, message_text, + title, dialog_type, message_text, default_prompt_text, dialog_callback)) ->weak_factory_.GetWeakPtr(); } @@ -39,7 +39,7 @@ } int JavaScriptDialogViews::GetDialogButtons() const { - const bool is_alert = message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_ALERT; + const bool is_alert = dialog_type_ == content::JAVASCRIPT_DIALOG_TYPE_ALERT; return ui::DIALOG_BUTTON_OK | (is_alert ? 0 : ui::DIALOG_BUTTON_CANCEL); } @@ -94,20 +94,20 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback) : JavaScriptDialog(parent_web_contents), title_(title), - message_type_(message_type), + dialog_type_(dialog_type), message_text_(message_text), default_prompt_text_(default_prompt_text), dialog_callback_(dialog_callback), weak_factory_(this) { int options = views::MessageBoxView::DETECT_DIRECTIONALITY; - if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) + if (dialog_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) options |= views::MessageBoxView::HAS_PROMPT_FIELD; views::MessageBoxView::InitParams params(message_text);
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h b/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h index 7ecaef55..aef704c 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h
@@ -28,7 +28,7 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& @@ -58,14 +58,14 @@ content::WebContents* parent_web_contents, content::WebContents* alerting_web_contents, const base::string16& title, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const content::JavaScriptDialogManager::DialogClosedCallback& dialog_callback); base::string16 title_; - content::JavaScriptMessageType message_type_; + content::JavaScriptDialogType dialog_type_; base::string16 message_text_; base::string16 default_prompt_text_; content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_;
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index c23de1f..1cdbcaf 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -119,7 +119,24 @@ true); #endif } -#endif + +Browser* OpenNewBrowser(Profile* profile) { + base::CommandLine dummy(base::CommandLine::NO_PROGRAM); + StartupBrowserCreatorImpl creator(base::FilePath(), dummy, + chrome::startup::IS_FIRST_RUN); + creator.Launch(profile, std::vector<GURL>(), false); + return chrome::FindBrowserWithProfile(profile); +} + +Browser* CloseBrowserAndOpenNew(Browser* browser, Profile* profile) { + content::WindowedNotificationObserver observer( + chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser)); + browser->window()->Close(); + observer.Wait(); + return OpenNewBrowser(profile); +} + +#endif // !defined(OS_CHROMEOS) } // namespace @@ -258,18 +275,7 @@ // Close the browser. CloseBrowserAsynchronously(browser()); - // Do a simple non-process-startup browser launch. - base::CommandLine dummy(base::CommandLine::NO_PROGRAM); - chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? - chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - { - StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); - ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false)); - } - - // This should have created a new browser window. |browser()| is still - // around at this point, even though we've closed its window. - Browser* new_browser = FindOneOtherBrowser(browser()); + Browser* new_browser = OpenNewBrowser(profile); ASSERT_TRUE(new_browser); std::vector<GURL> expected_urls(urls); @@ -284,7 +290,6 @@ EXPECT_NE( tab_strip->GetWebContentsAt(tab_strip->count() - 2)->GetSiteInstance(), tab_strip->GetWebContentsAt(tab_strip->count() - 1)->GetSiteInstance()); - } // Verify that startup URLs aren't used when the process already exists @@ -306,46 +311,16 @@ pref.urls = urls; SessionStartupPref::SetStartupPref(browser()->profile(), pref); - // Do a simple non-process-startup browser launch. - base::CommandLine dummy(base::CommandLine::NO_PROGRAM); - chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? - chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - { - StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); - ASSERT_TRUE( - launch.Launch(browser()->profile(), std::vector<GURL>(), false)); - } + DisableWelcomePages({browser()->profile()}); - // This should have created a new browser window. - Browser* new_browser = FindOneOtherBrowser(browser()); + Browser* new_browser = OpenNewBrowser(browser()->profile()); ASSERT_TRUE(new_browser); // The new browser should have exactly one tab (not the startup URLs). - ASSERT_EQ(1, new_browser->tab_strip_model()->count()); - - // Test that the welcome page is not shown the second time through if it was - // above. - if (!IsWindows10OrNewer()) { - // Close the browser opened above. - { - content::WindowedNotificationObserver observer( - chrome::NOTIFICATION_BROWSER_CLOSED, - content::Source<Browser>(new_browser)); - new_browser->window()->Close(); - observer.Wait(); - } - - { - StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); - ASSERT_TRUE( - launch.Launch(browser()->profile(), std::vector<GURL>(), false)); - } - - // Find the new browser and ensure that it has only the one tab this time. - new_browser = FindOneOtherBrowser(browser()); - ASSERT_TRUE(new_browser); - ASSERT_EQ(1, new_browser->tab_strip_model()->count()); - } + TabStripModel* tab_strip = new_browser->tab_strip_model(); + ASSERT_EQ(1, tab_strip->count()); + EXPECT_EQ("chrome://newtab/", + tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); } // App shortcuts are not implemented on mac os. @@ -904,7 +879,7 @@ #endif // !defined(OS_CHROMEOS) // These tests are not applicable to Chrome OS as neither master_preferences nor -// the sync promo exist there. +// the onboarding promos exist there. #if !defined(OS_CHROMEOS) class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { @@ -1072,4 +1047,51 @@ tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); } +IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, WelcomePages) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ProfileManager* profile_manager = g_browser_process->profile_manager(); + + // Open the two profiles. + base::FilePath dest_path = profile_manager->user_data_dir(); + + Profile* profile1 = Profile::CreateProfile( + dest_path.Append(FILE_PATH_LITERAL("New Profile 1")), nullptr, + Profile::CreateMode::CREATE_MODE_SYNCHRONOUS); + ASSERT_TRUE(profile1); + profile_manager->RegisterTestingProfile(profile1, true, false); + + Browser* browser = OpenNewBrowser(profile1); + ASSERT_TRUE(browser); + + TabStripModel* tab_strip = browser->tab_strip_model(); + + // Windows 10 has its own Welcome page; the standard Welcome page does not + // appear until second run. + if (IsWindows10OrNewer()) { + ASSERT_EQ(1, tab_strip->count()); + EXPECT_EQ("chrome://welcome-win10/", + tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); + + browser = CloseBrowserAndOpenNew(browser, profile1); + ASSERT_TRUE(browser); + tab_strip = browser->tab_strip_model(); + } + + // Ensure that the standard Welcome page appears on second run on Win 10, and + // on first run on all other platforms. + ASSERT_EQ(1, tab_strip->count()); + EXPECT_EQ("chrome://welcome/", + tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); + + browser = CloseBrowserAndOpenNew(browser, profile1); + ASSERT_TRUE(browser); + tab_strip = browser->tab_strip_model(); + + // Ensure that the new tab page appears on subsequent runs. + ASSERT_EQ(1, tab_strip->count()); + EXPECT_EQ("chrome://newtab/", + tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); +} + #endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 6ae4c73..237ccc7 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -49,7 +49,6 @@ #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_io_data.h" -#include "chrome/browser/sessions/session_restore.h" #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_service_factory.h" #include "chrome/browser/shell_integration.h" @@ -624,26 +623,35 @@ StartupTabs cmd_line_tabs; UrlsToTabs(cmd_line_urls, &cmd_line_tabs); - bool is_ephemeral_profile = + bool is_incognito_or_guest = profile_->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE; bool is_post_crash_launch = HasPendingUncleanExit(profile_); StartupTabs tabs = DetermineStartupTabs(StartupTabProviderImpl(), cmd_line_tabs, - is_ephemeral_profile, is_post_crash_launch); + is_incognito_or_guest, is_post_crash_launch); // Return immediately if we start an async restore, since the remainder of // that process is self-contained. if (MaybeAsyncRestore(tabs, process_startup, is_post_crash_launch)) return; + BrowserOpenBehaviorOptions behavior_options = 0; + if (process_startup) + behavior_options |= PROCESS_STARTUP; + if (is_post_crash_launch) + behavior_options |= IS_POST_CRASH_LAUNCH; + if (command_line_.HasSwitch(switches::kRestoreLastSession)) + behavior_options |= HAS_RESTORE_SWITCH; + if (command_line_.HasSwitch(switches::kOpenInNewWindow)) + behavior_options |= HAS_NEW_WINDOW_SWITCH; + if (!cmd_line_tabs.empty()) + behavior_options |= HAS_CMD_LINE_TABS; + BrowserOpenBehavior behavior = DetermineBrowserOpenBehavior( StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_), - process_startup, is_post_crash_launch, - command_line_.HasSwitch(switches::kRestoreLastSession), - command_line_.HasSwitch(switches::kOpenInNewWindow), - !cmd_line_tabs.empty()); + behavior_options); - uint32_t restore_options = 0; + SessionRestore::BehaviorBitmask restore_options = 0; if (behavior == BrowserOpenBehavior::SYNCHRONOUS_RESTORE) { #if defined(OS_MACOSX) bool was_mac_login_or_resume = base::mac::WasLaunchedAsLoginOrResumeItem(); @@ -669,12 +677,12 @@ StartupTabs StartupBrowserCreatorImpl::DetermineStartupTabs( const StartupTabProvider& provider, const StartupTabs& cmd_line_tabs, - bool is_ephemeral_profile, + bool is_incognito_or_guest, bool is_post_crash_launch) { // Only the New Tab Page or command line URLs may be shown in incognito mode. // A similar policy exists for crash recovery launches, to prevent getting the // user stuck in a crash loop. - if (is_ephemeral_profile || is_post_crash_launch) { + if (is_incognito_or_guest || is_post_crash_launch) { if (cmd_line_tabs.empty()) return StartupTabs({StartupTab(GURL(chrome::kChromeUINewTabURL), false)}); return cmd_line_tabs; @@ -739,7 +747,7 @@ Browser* StartupBrowserCreatorImpl::RestoreOrCreateBrowser( const StartupTabs& tabs, BrowserOpenBehavior behavior, - uint32_t restore_options, + SessionRestore::BehaviorBitmask restore_options, bool process_startup, bool is_post_crash_launch) { Browser* browser = nullptr; @@ -756,7 +764,8 @@ &StartupBrowserCreator::in_synchronous_profile_launch_, true); // OpenTabsInBrowser requires at least one tab be passed. As a fallback to - // prevent a crash, use the NTP if |tabs| is empty. + // prevent a crash, use the NTP if |tabs| is empty. This could happen if + // we expected a session restore to happen but it did not occur/succeed. browser = OpenTabsInBrowser( browser, process_startup, (tabs.empty() @@ -845,17 +854,13 @@ StartupBrowserCreatorImpl::BrowserOpenBehavior StartupBrowserCreatorImpl::DetermineBrowserOpenBehavior( const SessionStartupPref& pref, - bool process_startup, - bool is_post_crash_launch, - bool has_restore_switch, - bool has_new_window_switch, - bool has_cmd_line_tabs) { - if (!process_startup) { + BrowserOpenBehaviorOptions options) { + if (!(options & PROCESS_STARTUP)) { // For existing processes, restore would have happened before invoking this // function. If Chrome was launched with passed URLs, assume these should // be appended to an existing window if possible, unless overridden by a // switch. - return (has_cmd_line_tabs && !has_new_window_switch) + return ((options & HAS_CMD_LINE_TABS) && !(options & HAS_NEW_WINDOW_SWITCH)) ? BrowserOpenBehavior::USE_EXISTING : BrowserOpenBehavior::NEW; } @@ -863,9 +868,7 @@ if (pref.type == SessionStartupPref::LAST) { // Don't perform a session restore on a post-crash launch, as this could // cause a crash loop. These checks can be overridden by a switch. - // TODO(crbug.com/647851): Group this check with the logic in - // GetSessionStartupPref. - if (!is_post_crash_launch || has_restore_switch) + if (!(options & IS_POST_CRASH_LAUNCH) || (options & HAS_RESTORE_SWITCH)) return BrowserOpenBehavior::SYNCHRONOUS_RESTORE; } @@ -873,11 +876,12 @@ } // static -uint32_t StartupBrowserCreatorImpl::DetermineSynchronousRestoreOptions( +SessionRestore::BehaviorBitmask +StartupBrowserCreatorImpl::DetermineSynchronousRestoreOptions( bool has_create_browser_default, bool has_create_browser_switch, bool was_mac_login_or_resume) { - uint32_t options = SessionRestore::SYNCHRONOUS; + SessionRestore::BehaviorBitmask options = SessionRestore::SYNCHRONOUS; // Suppress the creation of a new window on Mac when restoring with no windows // if launching Chrome via a login item or the resume feature in OS 10.7+. @@ -982,7 +986,8 @@ return false; } - uint32_t restore_behavior = SessionRestore::SYNCHRONOUS; + SessionRestore::BehaviorBitmask restore_behavior = + SessionRestore::SYNCHRONOUS; if (browser_defaults::kAlwaysCreateTabbedBrowserOnSessionRestore || base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kCreateBrowserOnStartupForTests)) {
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.h b/chrome/browser/ui/startup/startup_browser_creator_impl.h index 0ce1f3b7..7094147 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.h +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.h
@@ -11,6 +11,7 @@ #include "base/files/file_path.h" #include "base/gtest_prod_util.h" #include "base/macros.h" +#include "chrome/browser/sessions/session_restore.h" #include "chrome/browser/ui/startup/startup_tab.h" #include "chrome/browser/ui/startup/startup_tab_provider.h" #include "chrome/browser/ui/startup/startup_types.h" @@ -73,6 +74,14 @@ DetermineStartupTabs_CommandLine); FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, DetermineStartupTabs_NewTabPage); + FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, + DetermineBrowserOpenBehavior_Startup); + FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, + DetermineBrowserOpenBehavior_CmdLineTabs); + FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, + DetermineBrowserOpenBehavior_PostCrash); + FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, + DetermineBrowserOpenBehavior_NotStartup); enum class WelcomeRunType { NONE, // Do not inject the welcome page for this run. @@ -80,12 +89,24 @@ FIRST_RUN_LAST_TAB, // Inject the welcome page as the last first-run tab. }; + // Window behaviors possible when opening Chrome. enum class BrowserOpenBehavior { NEW, // Open in a new browser. SYNCHRONOUS_RESTORE, // Attempt a synchronous session restore. USE_EXISTING, // Attempt to add to an existing tabbed browser. }; + // Boolean flags used to indicate state for DetermineBrowserOpenBehavior. + enum BehaviorFlags { + PROCESS_STARTUP = (1 << 0), + IS_POST_CRASH_LAUNCH = (1 << 1), + HAS_RESTORE_SWITCH = (1 << 2), + HAS_NEW_WINDOW_SWITCH = (1 << 3), + HAS_CMD_LINE_TABS = (1 << 4), + }; + + using BrowserOpenBehaviorOptions = uint32_t; + // Creates a tab for each of the Tabs in |tabs|. If browser is non-null // and a tabbed browser, the tabs are added to it. Otherwise a new tabbed // browser is created and the tabs are added to it. The browser the tabs @@ -136,11 +157,10 @@ // Returns a browser displaying the contents of |tabs|. Based on |behavior|, // this may attempt a session restore or create a new browser. May also allow // DOM Storage to begin cleanup once it's clear it is not needed anymore. - Browser* RestoreOrCreateBrowser(const StartupTabs& tabs, - BrowserOpenBehavior behavior, - uint32_t restore_options, - bool process_startup, - bool is_post_crash_launch); + Browser* RestoreOrCreateBrowser( + const StartupTabs& tabs, BrowserOpenBehavior behavior, + SessionRestore::BehaviorBitmask restore_options, bool process_startup, + bool is_post_crash_launch); // Adds a Tab to |tabs| for each url in |urls| that doesn't already exist // in |tabs|. @@ -157,15 +177,11 @@ // Determines how the launch flow should obtain a Browser. static BrowserOpenBehavior DetermineBrowserOpenBehavior( const SessionStartupPref& pref, - bool process_startup, - bool is_post_crash_launch, - bool has_restore_switch, - bool has_new_window_switch, - bool has_cmd_line_tabs); + BrowserOpenBehaviorOptions options); // Returns the relevant bitmask options which must be passed when restoring a // session. - static uint32_t DetermineSynchronousRestoreOptions( + static SessionRestore::BehaviorBitmask DetermineSynchronousRestoreOptions( bool has_create_browser_default, bool has_create_browser_switch, bool was_mac_login_or_resume);
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc b/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc index d36c3a5..5424ca2 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc
@@ -9,6 +9,8 @@ #include "chrome/common/url_constants.cc" #include "testing/gtest/include/gtest/gtest.h" +using Creator = StartupBrowserCreatorImpl; + namespace { // Bits for FakeStartupTabProvider options. @@ -84,9 +86,9 @@ FakeStartupTabProvider provider(kOnboardingTabs | kResetTriggerTabs | kPinnedTabs | kPreferencesTabs | kNewTabPageTabs); - StartupBrowserCreatorImpl impl( - base::FilePath(), base::CommandLine(base::CommandLine::NO_PROGRAM), - chrome::startup::IS_FIRST_RUN); + Creator impl(base::FilePath(), + base::CommandLine(base::CommandLine::NO_PROGRAM), + chrome::startup::IS_FIRST_RUN); StartupTabs output = impl.DetermineStartupTabs(provider, StartupTabs(), false, false); @@ -103,9 +105,9 @@ FakeStartupTabProvider provider(kOnboardingTabs | kDistributionFirstRunTabs | kResetTriggerTabs | kPinnedTabs | kPreferencesTabs | kNewTabPageTabs); - StartupBrowserCreatorImpl impl( - base::FilePath(), base::CommandLine(base::CommandLine::NO_PROGRAM), - chrome::startup::IS_FIRST_RUN); + Creator impl(base::FilePath(), + base::CommandLine(base::CommandLine::NO_PROGRAM), + chrome::startup::IS_FIRST_RUN); // Incognito case: StartupTabs output = @@ -128,9 +130,9 @@ FakeStartupTabProvider provider(kOnboardingTabs | kDistributionFirstRunTabs | kResetTriggerTabs | kPinnedTabs | kPreferencesTabs | kNewTabPageTabs); - StartupBrowserCreatorImpl impl( - base::FilePath(), base::CommandLine(base::CommandLine::NO_PROGRAM), - chrome::startup::IS_FIRST_RUN); + Creator impl(base::FilePath(), + base::CommandLine(base::CommandLine::NO_PROGRAM), + chrome::startup::IS_FIRST_RUN); StartupTabs output = impl.DetermineStartupTabs(provider, StartupTabs(), false, false); @@ -144,9 +146,9 @@ FakeStartupTabProvider provider(kOnboardingTabs | kDistributionFirstRunTabs | kResetTriggerTabs | kPinnedTabs | kPreferencesTabs | kNewTabPageTabs); - StartupBrowserCreatorImpl impl( - base::FilePath(), base::CommandLine(base::CommandLine::NO_PROGRAM), - chrome::startup::IS_FIRST_RUN); + Creator impl(base::FilePath(), + base::CommandLine(base::CommandLine::NO_PROGRAM), + chrome::startup::IS_FIRST_RUN); StartupTabs cmd_line_tabs = {StartupTab(GURL("https://cmd-line"), false)}; @@ -175,9 +177,9 @@ TEST(StartupBrowserCreatorImplTest, DetermineStartupTabs_NewTabPage) { FakeStartupTabProvider provider_allows_ntp(kPinnedTabs | kResetTriggerTabs | kNewTabPageTabs); - StartupBrowserCreatorImpl impl( - base::FilePath(), base::CommandLine(base::CommandLine::NO_PROGRAM), - chrome::startup::IS_FIRST_RUN); + Creator impl(base::FilePath(), + base::CommandLine(base::CommandLine::NO_PROGRAM), + chrome::startup::IS_FIRST_RUN); StartupTabs output = impl.DetermineStartupTabs(provider_allows_ntp, StartupTabs(), false, false); @@ -186,3 +188,93 @@ EXPECT_EQ("new-tab", output[1].url.host()); EXPECT_EQ("pinned", output[2].url.host()); } + +TEST(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_Startup) { + SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); + SessionStartupPref pref_last(SessionStartupPref::Type::LAST); + SessionStartupPref pref_urls(SessionStartupPref::Type::URLS); + + // The most typical case: startup, not recovering from a crash, no switches. + // Test each pref with and without command-line tabs. + Creator::BrowserOpenBehavior output = Creator::DetermineBrowserOpenBehavior( + pref_default, Creator::PROCESS_STARTUP); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior( + pref_default, Creator::PROCESS_STARTUP | Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_urls, + Creator::PROCESS_STARTUP); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior( + pref_urls, Creator::PROCESS_STARTUP | Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_last, + Creator::PROCESS_STARTUP); + EXPECT_EQ(Creator::BrowserOpenBehavior::SYNCHRONOUS_RESTORE, output); + + output = Creator::DetermineBrowserOpenBehavior( + pref_last, Creator::PROCESS_STARTUP | Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::SYNCHRONOUS_RESTORE, output); +} + +TEST(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_CmdLineTabs) { + SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); + SessionStartupPref pref_last(SessionStartupPref::Type::LAST); + SessionStartupPref pref_urls(SessionStartupPref::Type::URLS); + + // Command line tabs after startup should prompt use of existing window, + // regardless of pref. + Creator::BrowserOpenBehavior output = Creator::DetermineBrowserOpenBehavior( + pref_default, Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::USE_EXISTING, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_urls, + Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::USE_EXISTING, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_last, + Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::USE_EXISTING, output); + + // Exception: this can be overridden by passing a switch. + output = Creator::DetermineBrowserOpenBehavior( + pref_urls, Creator::HAS_NEW_WINDOW_SWITCH | Creator::HAS_CMD_LINE_TABS); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); +} + +TEST(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_PostCrash) { + SessionStartupPref pref_last(SessionStartupPref::Type::LAST); + + // Launching after crash should block session restore. + Creator::BrowserOpenBehavior output = Creator::DetermineBrowserOpenBehavior( + pref_last, Creator::PROCESS_STARTUP | Creator::IS_POST_CRASH_LAUNCH); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + // Exception: this can be overridden by passing a switch. + output = Creator::DetermineBrowserOpenBehavior( + pref_last, Creator::PROCESS_STARTUP | Creator::IS_POST_CRASH_LAUNCH | + Creator::HAS_RESTORE_SWITCH); + EXPECT_EQ(Creator::BrowserOpenBehavior::SYNCHRONOUS_RESTORE, output); +} + +TEST(StartupBrowserCreatorImplTest, DetermineBrowserOpenBehavior_NotStartup) { + SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); + SessionStartupPref pref_last(SessionStartupPref::Type::LAST); + SessionStartupPref pref_urls(SessionStartupPref::Type::URLS); + + // Launch after startup without command-line tabs should always create a new + // window. + Creator::BrowserOpenBehavior output = + Creator::DetermineBrowserOpenBehavior(pref_default, 0); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_last, 0); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); + + output = Creator::DetermineBrowserOpenBehavior(pref_urls, 0); + EXPECT_EQ(Creator::BrowserOpenBehavior::NEW, output); +}
diff --git a/chrome/browser/ui/startup/startup_tab_provider.cc b/chrome/browser/ui/startup/startup_tab_provider.cc index 70da7e3..fdd35dd 100644 --- a/chrome/browser/ui/startup/startup_tab_provider.cc +++ b/chrome/browser/ui/startup/startup_tab_provider.cc
@@ -66,14 +66,14 @@ bool is_default_browser = g_browser_process->CachedDefaultWebClientState() == shell_integration::IS_DEFAULT; - return CheckWin10OnboardingTabPolicy( + return GetWin10OnboardingTabsForState( is_first_run, has_seen_welcome_page, has_seen_win10_promo, is_signed_in, set_default_browser_allowed, is_default_browser, is_supervised_user); } #endif // defined(OS_WIN) - return CheckStandardOnboardingTabPolicy(is_first_run, has_seen_welcome_page, - is_signed_in, is_supervised_user); + return GetStandardOnboardingTabsForState(is_first_run, has_seen_welcome_page, + is_signed_in, is_supervised_user); #endif // defined(OS_CHROMEOS) } @@ -81,7 +81,7 @@ StartupBrowserCreator* browser_creator) const { if (!browser_creator) return StartupTabs(); - StartupTabs tabs = CheckMasterPrefsTabPolicy( + StartupTabs tabs = GetMasterPrefsTabsForState( first_run::IsChromeFirstRun(), browser_creator->first_run_tabs_); browser_creator->first_run_tabs_.clear(); return tabs; @@ -93,13 +93,13 @@ TriggeredProfileResetterFactory::GetForBrowserContext(profile); bool has_reset_trigger = triggered_profile_resetter && triggered_profile_resetter->HasResetTrigger(); - return CheckResetTriggerTabPolicy(has_reset_trigger); + return GetResetTriggerTabsForState(has_reset_trigger); } StartupTabs StartupTabProviderImpl::GetPinnedTabs( const base::CommandLine& command_line, Profile* profile) const { - return CheckPinnedTabPolicy( + return GetPinnedTabsForState( StartupBrowserCreator::GetSessionStartupPref(command_line, profile), PinnedTabCodec::ReadPinnedTabs(profile)); } @@ -118,7 +118,7 @@ bool profile_has_other_tabbed_browser = other_tabbed_browser != browser_list->end(); - return CheckPreferencesTabPolicy( + return GetPreferencesTabsForState( StartupBrowserCreator::GetSessionStartupPref(command_line, profile), profile_has_other_tabbed_browser); } @@ -126,12 +126,12 @@ StartupTabs StartupTabProviderImpl::GetNewTabPageTabs( const base::CommandLine& command_line, Profile* profile) const { - return CheckNewTabPageTabPolicy( + return GetNewTabPageTabsForState( StartupBrowserCreator::GetSessionStartupPref(command_line, profile)); } // static -StartupTabs StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( +StartupTabs StartupTabProviderImpl::GetStandardOnboardingTabsForState( bool is_first_run, bool has_seen_welcome_page, bool is_signed_in, @@ -144,7 +144,7 @@ #if defined(OS_WIN) // static -StartupTabs StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( +StartupTabs StartupTabProviderImpl::GetWin10OnboardingTabsForState( bool is_first_run, bool has_seen_welcome_page, bool has_seen_win10_promo, @@ -168,7 +168,7 @@ #endif // static -StartupTabs StartupTabProviderImpl::CheckMasterPrefsTabPolicy( +StartupTabs StartupTabProviderImpl::GetMasterPrefsTabsForState( bool is_first_run, const std::vector<GURL>& first_run_tabs) { // Constants: Magic words used by Master Preferences files in place of a URL @@ -191,7 +191,7 @@ } // static -StartupTabs StartupTabProviderImpl::CheckResetTriggerTabPolicy( +StartupTabs StartupTabProviderImpl::GetResetTriggerTabsForState( bool profile_has_trigger) { StartupTabs tabs; if (profile_has_trigger) @@ -200,7 +200,7 @@ } // static -StartupTabs StartupTabProviderImpl::CheckPinnedTabPolicy( +StartupTabs StartupTabProviderImpl::GetPinnedTabsForState( const SessionStartupPref& pref, const StartupTabs& pinned_tabs) { return (pref.type == SessionStartupPref::Type::LAST) ? StartupTabs() @@ -208,7 +208,7 @@ } // static -StartupTabs StartupTabProviderImpl::CheckPreferencesTabPolicy( +StartupTabs StartupTabProviderImpl::GetPreferencesTabsForState( const SessionStartupPref& pref, bool profile_has_other_tabbed_browser) { StartupTabs tabs; @@ -221,7 +221,7 @@ } // static -StartupTabs StartupTabProviderImpl::CheckNewTabPageTabPolicy( +StartupTabs StartupTabProviderImpl::GetNewTabPageTabsForState( const SessionStartupPref& pref) { StartupTabs tabs; if (pref.type != SessionStartupPref::Type::LAST)
diff --git a/chrome/browser/ui/startup/startup_tab_provider.h b/chrome/browser/ui/startup/startup_tab_provider.h index 4ecc3aa..181ba44 100644 --- a/chrome/browser/ui/startup/startup_tab_provider.h +++ b/chrome/browser/ui/startup/startup_tab_provider.h
@@ -54,13 +54,14 @@ public: StartupTabProviderImpl() = default; - // The static Check*TabPolicy methods below enforce the policies relevant to - // the respective Get*Tabs methods, but do not gather or interact with any - // system state relating to making those policy decisions. + // The static helper methods below implement the policies relevant to the + // respective Get*Tabs methods, but do not gather or interact with any + // system state relating to making those policy decisions. Exposed for + // testing. // Determines which tabs should be shown according to onboarding/first // run policy. - static StartupTabs CheckStandardOnboardingTabPolicy( + static StartupTabs GetStandardOnboardingTabsForState( bool is_first_run, bool has_seen_welcome_page, bool is_signed_in, @@ -69,7 +70,7 @@ #if defined(OS_WIN) // Determines which tabs should be shown according to onboarding/first run // policy, including promo content specific to Windows 10. - static StartupTabs CheckWin10OnboardingTabPolicy( + static StartupTabs GetWin10OnboardingTabsForState( bool is_first_run, bool has_seen_welcome_page, bool has_seen_win10_promo, @@ -81,30 +82,30 @@ // Processes first run URLs specified in Master Preferences file, replacing // any "magic word" URL hosts with appropriate URLs. - static StartupTabs CheckMasterPrefsTabPolicy( + static StartupTabs GetMasterPrefsTabsForState( bool is_first_run, const std::vector<GURL>& first_run_tabs); // Determines which tabs should be shown as a result of the presence/absence // of a Reset Trigger on this profile. - static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger); + static StartupTabs GetResetTriggerTabsForState(bool profile_has_trigger); // Determines whether the startup preference requires the contents of // |pinned_tabs| to be shown. This is needed to avoid duplicates, as the // session restore logic will also resurface pinned tabs on its own. - static StartupTabs CheckPinnedTabPolicy(const SessionStartupPref& pref, - const StartupTabs& pinned_tabs); + static StartupTabs GetPinnedTabsForState(const SessionStartupPref& pref, + const StartupTabs& pinned_tabs); // Determines whether preferences and window state indicate that // user-specified tabs should be shown as the default new window content, and // returns the specified tabs if so. - static StartupTabs CheckPreferencesTabPolicy( + static StartupTabs GetPreferencesTabsForState( const SessionStartupPref& pref, bool profile_has_other_tabbed_browser); // Determines whether startup preferences require the New Tab Page to be // explicitly specified. Session Restore does not expect the NTP to be passed. - static StartupTabs CheckNewTabPageTabPolicy(const SessionStartupPref& pref); + static StartupTabs GetNewTabPageTabsForState(const SessionStartupPref& pref); // Gets the URL for the Welcome page. If |use_later_run_variant| is true, a // URL parameter will be appended so as to access the variant page used when
diff --git a/chrome/browser/ui/startup/startup_tab_provider_unittest.cc b/chrome/browser/ui/startup/startup_tab_provider_unittest.cc index b1567fd..068e032b 100644 --- a/chrome/browser/ui/startup/startup_tab_provider_unittest.cc +++ b/chrome/browser/ui/startup/startup_tab_provider_unittest.cc
@@ -9,17 +9,18 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -TEST(StartupTabProviderTest, CheckStandardOnboardingTabPolicy) { +TEST(StartupTabProviderTest, GetStandardOnboardingTabsForState) { // Show welcome page to new unauthenticated profile on first run. - StartupTabs output = StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( - true, false, false, false); + StartupTabs output = + StartupTabProviderImpl::GetStandardOnboardingTabsForState(true, false, + false, false); ASSERT_EQ(1U, output.size()); EXPECT_EQ(StartupTabProviderImpl::GetWelcomePageUrl(false), output[0].url); EXPECT_FALSE(output[0].is_pinned); // After first run, display welcome page using variant view. - output = StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( + output = StartupTabProviderImpl::GetStandardOnboardingTabsForState( false, false, false, false); ASSERT_EQ(1U, output.size()); @@ -27,31 +28,32 @@ EXPECT_FALSE(output[0].is_pinned); } -TEST(StartupTabProviderTest, CheckStandardOnboardingTabPolicy_Negative) { +TEST(StartupTabProviderTest, GetStandardOnboardingTabsForState_Negative) { // Do not show the welcome page to the same profile twice. - StartupTabs output = StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( - true, true, false, false); + StartupTabs output = + StartupTabProviderImpl::GetStandardOnboardingTabsForState(true, true, + false, false); EXPECT_TRUE(output.empty()); // Do not show the welcome page to authenticated users. - output = StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( + output = StartupTabProviderImpl::GetStandardOnboardingTabsForState( true, false, true, false); EXPECT_TRUE(output.empty()); // Do not show the welcome page to supervised users. - output = StartupTabProviderImpl::CheckStandardOnboardingTabPolicy( + output = StartupTabProviderImpl::GetStandardOnboardingTabsForState( true, false, false, true); EXPECT_TRUE(output.empty()); } #if defined(OS_WIN) -TEST(StartupTabProviderTest, CheckWin10OnboardingTabPolicy) { +TEST(StartupTabProviderTest, GetWin10OnboardingTabsForState) { // Show Win 10 Welcome page if it has not been seen, but the standard page // has. - StartupTabs output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + StartupTabs output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, true, false, false, true, false, false); ASSERT_EQ(1U, output.size()); @@ -61,7 +63,7 @@ // Show standard Welcome page if the Win 10 Welcome page has been seen, but // the standard page has not. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, true, false, true, false, false); ASSERT_EQ(1U, output.size()); @@ -70,7 +72,7 @@ // If neither page has been seen, the Win 10 Welcome page takes precedence // this launch. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, false, false, true, false, false); ASSERT_EQ(1U, output.size()); @@ -79,10 +81,10 @@ EXPECT_FALSE(output[0].is_pinned); } -TEST(StartupTabProviderTest, CheckWin10OnboardingTabPolicy_LaterRunVariant) { +TEST(StartupTabProviderTest, GetWin10OnboardingTabsForState_LaterRunVariant) { // Show a variant of the Win 10 Welcome page after first run, if it has not // been seen. - StartupTabs output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + StartupTabs output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( false, false, false, false, true, false, false); ASSERT_EQ(1U, output.size()); @@ -92,7 +94,7 @@ // Show a variant of the standard Welcome page after first run, if the Win 10 // Welcome page has already been seen but the standard has not. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( false, false, true, false, true, false, false); ASSERT_EQ(1U, output.size()); @@ -100,22 +102,22 @@ EXPECT_FALSE(output[0].is_pinned); } -TEST(StartupTabProviderTest, CheckWin10OnboardingTabPolicy_Negative) { +TEST(StartupTabProviderTest, GetWin10OnboardingTabsForState_Negative) { // Do not show either page if it has already been shown. - StartupTabs output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + StartupTabs output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, true, true, false, true, false, false); EXPECT_TRUE(output.empty()); // Do not show either page to supervised users. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, false, false, true, false, true); EXPECT_TRUE(output.empty()); // If Chrome is already the default browser, don't show the Win 10 Welcome // page, and don't preempt the standard Welcome page. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, false, false, true, true, false); ASSERT_EQ(1U, output.size()); @@ -123,16 +125,16 @@ EXPECT_FALSE(output[0].is_pinned); // If the user is signed in, block showing the standard Welcome page. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, true, true, true, false, false); EXPECT_TRUE(output.empty()); } TEST(StartupTabProviderTest, - CheckWin10OnboardingTabPolicy_SetDefaultBrowserNotAllowed) { + GetWin10OnboardingTabsForState_SetDefaultBrowserNotAllowed) { // Skip the Win 10 promo if setting the default browser is not allowed. - StartupTabs output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + StartupTabs output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, false, false, false, false, false, false); ASSERT_EQ(1U, output.size()); @@ -140,7 +142,7 @@ // After first run, no onboarding content is displayed when setting the // default browser is not allowed. - output = StartupTabProviderImpl::CheckWin10OnboardingTabPolicy( + output = StartupTabProviderImpl::GetWin10OnboardingTabsForState( true, true, false, false, false, false, false); EXPECT_TRUE(output.empty()); @@ -148,13 +150,13 @@ #endif -TEST(StartupTabProviderTest, CheckMasterPrefsTabPolicy) { +TEST(StartupTabProviderTest, GetMasterPrefsTabsForState) { std::vector<GURL> input = {GURL(base::ASCIIToUTF16("https://new_tab_page")), GURL(base::ASCIIToUTF16("https://www.google.com")), GURL(base::ASCIIToUTF16("https://welcome_page"))}; StartupTabs output = - StartupTabProviderImpl::CheckMasterPrefsTabPolicy(true, input); + StartupTabProviderImpl::GetMasterPrefsTabsForState(true, input); ASSERT_EQ(3U, output.size()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), output[0].url); @@ -165,18 +167,19 @@ EXPECT_FALSE(output[2].is_pinned); } -TEST(StartupTabProviderTest, CheckMasterPrefsTabPolicy_FirstRunOnly) { +TEST(StartupTabProviderTest, GetMasterPrefsTabsForState_FirstRunOnly) { std::vector<GURL> input = { GURL(base::ASCIIToUTF16("https://www.google.com"))}; StartupTabs output = - StartupTabProviderImpl::CheckMasterPrefsTabPolicy(false, input); + StartupTabProviderImpl::GetMasterPrefsTabsForState(false, input); EXPECT_TRUE(output.empty()); } -TEST(StartupTabProviderTest, CheckResetTriggerTabPolicy) { - StartupTabs output = StartupTabProviderImpl::CheckResetTriggerTabPolicy(true); +TEST(StartupTabProviderTest, GetResetTriggerTabsForState) { + StartupTabs output = + StartupTabProviderImpl::GetResetTriggerTabsForState(true); ASSERT_EQ(1U, output.size()); EXPECT_EQ(StartupTabProviderImpl::GetTriggeredResetSettingsUrl(), @@ -184,99 +187,99 @@ EXPECT_FALSE(output[0].is_pinned); } -TEST(StartupTabProviderTest, CheckResetTriggerTabPolicy_Negative) { +TEST(StartupTabProviderTest, GetResetTriggerTabsForState_Negative) { StartupTabs output = - StartupTabProviderImpl::CheckResetTriggerTabPolicy(false); + StartupTabProviderImpl::GetResetTriggerTabsForState(false); ASSERT_TRUE(output.empty()); } -TEST(StartupTabProviderTest, CheckPinnedTabPolicy) { +TEST(StartupTabProviderTest, GetPinnedTabsForState) { StartupTabs pinned = {StartupTab(GURL("https://www.google.com"), true)}; SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); SessionStartupPref pref_urls(SessionStartupPref::Type::URLS); StartupTabs output = - StartupTabProviderImpl::CheckPinnedTabPolicy(pref_default, pinned); + StartupTabProviderImpl::GetPinnedTabsForState(pref_default, pinned); ASSERT_EQ(1U, output.size()); EXPECT_EQ("www.google.com", output[0].url.host()); - output = StartupTabProviderImpl::CheckPinnedTabPolicy(pref_urls, pinned); + output = StartupTabProviderImpl::GetPinnedTabsForState(pref_urls, pinned); ASSERT_EQ(1U, output.size()); EXPECT_EQ("www.google.com", output[0].url.host()); } -TEST(StartupTabProviderTest, CheckPinnedTabPolicy_Negative) { +TEST(StartupTabProviderTest, GetPinnedTabsForState_Negative) { StartupTabs pinned = {StartupTab(GURL("https://www.google.com"), true)}; SessionStartupPref pref_last(SessionStartupPref::Type::LAST); StartupTabs output = - StartupTabProviderImpl::CheckPinnedTabPolicy(pref_last, pinned); + StartupTabProviderImpl::GetPinnedTabsForState(pref_last, pinned); ASSERT_TRUE(output.empty()); } -TEST(StartupTabProviderTest, CheckPreferencesTabPolicy) { +TEST(StartupTabProviderTest, GetPreferencesTabsForState) { SessionStartupPref pref(SessionStartupPref::Type::URLS); pref.urls = {GURL(base::ASCIIToUTF16("https://www.google.com"))}; StartupTabs output = - StartupTabProviderImpl::CheckPreferencesTabPolicy(pref, false); + StartupTabProviderImpl::GetPreferencesTabsForState(pref, false); ASSERT_EQ(1U, output.size()); EXPECT_EQ("www.google.com", output[0].url.host()); } -TEST(StartupTabProviderTest, CheckPreferencesTabPolicy_WrongType) { +TEST(StartupTabProviderTest, GetPreferencesTabsForState_WrongType) { SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); pref_default.urls = {GURL(base::ASCIIToUTF16("https://www.google.com"))}; StartupTabs output = - StartupTabProviderImpl::CheckPreferencesTabPolicy(pref_default, false); + StartupTabProviderImpl::GetPreferencesTabsForState(pref_default, false); EXPECT_TRUE(output.empty()); SessionStartupPref pref_last(SessionStartupPref::Type::LAST); pref_last.urls = {GURL(base::ASCIIToUTF16("https://www.google.com"))}; - output = StartupTabProviderImpl::CheckPreferencesTabPolicy(pref_last, false); + output = StartupTabProviderImpl::GetPreferencesTabsForState(pref_last, false); EXPECT_TRUE(output.empty()); } -TEST(StartupTabProviderTest, CheckPreferencesTabPolicy_NotFirstBrowser) { +TEST(StartupTabProviderTest, GetPreferencesTabsForState_NotFirstBrowser) { SessionStartupPref pref(SessionStartupPref::Type::URLS); pref.urls = {GURL(base::ASCIIToUTF16("https://www.google.com"))}; StartupTabs output = - StartupTabProviderImpl::CheckPreferencesTabPolicy(pref, true); + StartupTabProviderImpl::GetPreferencesTabsForState(pref, true); EXPECT_TRUE(output.empty()); } -TEST(StartupTabProviderTest, CheckNewTabPageTabPolicy) { +TEST(StartupTabProviderTest, GetNewTabPageTabsForState) { SessionStartupPref pref_default(SessionStartupPref::Type::DEFAULT); SessionStartupPref pref_urls(SessionStartupPref::Type::URLS); StartupTabs output = - StartupTabProviderImpl::CheckNewTabPageTabPolicy(pref_default); + StartupTabProviderImpl::GetNewTabPageTabsForState(pref_default); ASSERT_EQ(1U, output.size()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), output[0].url); - output = StartupTabProviderImpl::CheckNewTabPageTabPolicy(pref_urls); + output = StartupTabProviderImpl::GetNewTabPageTabsForState(pref_urls); ASSERT_EQ(1U, output.size()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), output[0].url); } -TEST(StartupTabProviderTest, CheckNewTabPageTabPolicy_Negative) { +TEST(StartupTabProviderTest, GetNewTabPageTabsForState_Negative) { SessionStartupPref pref_last(SessionStartupPref::Type::LAST); StartupTabs output = - StartupTabProviderImpl::CheckNewTabPageTabPolicy(pref_last); + StartupTabProviderImpl::GetNewTabPageTabsForState(pref_last); ASSERT_TRUE(output.empty()); }
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index 29df017..a94c2b7 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -71,14 +71,6 @@ const int kTabbedPaneTopPadding = 14; const int kCookieInfoBottomPadding = 4; -LayoutDelegate::Metric GetTreeviewToButtonsMetric() { - // Hack: in the Harmony specs, the buttons under the treeview are "unrelated" - // to it (which looks better), but in the existing dialog they were related. - return LayoutDelegate::Get()->IsHarmonyMode() - ? LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING - : LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING; -} - } // namespace // A custom view that conditionally displays an infobar. @@ -409,7 +401,8 @@ GridLayout::FILL, GridLayout::FILL, kTreeViewWidth, kTreeViewHeight); layout->AddPaddingRow( - 0, LayoutDelegate::Get()->GetMetric(GetTreeviewToButtonsMetric())); + 0, LayoutDelegate::Get()->GetMetric( + LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); layout->StartRow(0, three_columns_layout_id); layout->AddView(block_allowed_button_); @@ -485,7 +478,8 @@ CreateScrollView(blocked_cookies_tree_), 1, 1, GridLayout::FILL, GridLayout::FILL, kTreeViewWidth, kTreeViewHeight); layout->AddPaddingRow( - 0, LayoutDelegate::Get()->GetMetric(GetTreeviewToButtonsMetric())); + 0, LayoutDelegate::Get()->GetMetric( + LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); layout->StartRow(0, three_columns_layout_id); layout->AddView(allow_blocked_button_);
diff --git a/chrome/browser/ui/views/device_chooser_content_view.cc b/chrome/browser/ui/views/device_chooser_content_view.cc index 966571e..6946d87 100644 --- a/chrome/browser/ui/views/device_chooser_content_view.cc +++ b/chrome/browser/ui/views/device_chooser_content_view.cc
@@ -23,10 +23,6 @@ namespace { -const int kChooserWidth = 370; - -const int kChooserHeight = 260; - const int kThrobberDiameter = 24; const int kAdapterOffHelpLinkPadding = 5; @@ -95,10 +91,6 @@ table_view_->SetModel(nullptr); } -gfx::Size DeviceChooserContentView::GetPreferredSize() const { - return gfx::Size(kChooserWidth, kChooserHeight); -} - void DeviceChooserContentView::Layout() { gfx::Rect rect(GetContentsBounds()); table_parent_->SetBoundsRect(rect);
diff --git a/chrome/browser/ui/views/device_chooser_content_view.h b/chrome/browser/ui/views/device_chooser_content_view.h index 92b8c4d..fe1df0b3 100644 --- a/chrome/browser/ui/views/device_chooser_content_view.h +++ b/chrome/browser/ui/views/device_chooser_content_view.h
@@ -35,7 +35,6 @@ ~DeviceChooserContentView() override; // views::View: - gfx::Size GetPreferredSize() const override; void Layout() override; // ui::TableModel:
diff --git a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc index dffa13c..9694f755 100644 --- a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc
@@ -11,13 +11,15 @@ #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" #include "chrome/browser/extensions/device_permissions_dialog_controller.h" #include "chrome/browser/ui/views/device_chooser_content_view.h" +#include "chrome/browser/ui/views/harmony/layout_delegate.h" #include "components/constrained_window/constrained_window_views.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/geometry/insets.h" +#include "ui/views/background.h" #include "ui/views/controls/link.h" #include "ui/views/controls/styled_label.h" -#include "ui/views/layout/layout_constants.h" +#include "ui/views/layout/fill_layout.h" #include "ui/views/window/dialog_client_view.h" ChooserDialogView::ChooserDialogView( @@ -72,7 +74,20 @@ views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) { views::DialogClientView* client = new views::DialogClientView(widget, GetContentsView()); - client->set_button_row_insets(gfx::Insets()); + + constexpr int kMinWidth = 402; + constexpr int kMinHeight = 320; + int min_width = LayoutDelegate::Get()->GetDialogPreferredWidth( + LayoutDelegate::DialogWidth::MEDIUM); + if (!min_width) + min_width = kMinWidth; + client->set_minimum_size(gfx::Size(min_width, kMinHeight)); + + LayoutDelegate* delegate = LayoutDelegate::Get(); + client->set_button_row_insets(gfx::Insets( + delegate->GetMetric( + LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING), + 0, 0, 0)); return client; } @@ -82,8 +97,8 @@ // always be true. DCHECK(ShouldUseCustomFrame()); return views::DialogDelegate::CreateDialogFrameView( - widget, gfx::Insets(views::kPanelVertMargin, views::kPanelHorizMargin, - views::kPanelVertMargin, views::kPanelHorizMargin)); + widget, gfx::Insets(LayoutDelegate::Get()->GetMetric( + LayoutDelegate::Metric::PANEL_CONTENT_MARGIN))); } bool ChooserDialogView::Accept() {
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc index fd14fbe..20439f90 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
@@ -6,13 +6,19 @@ #include <utility> +#include "base/memory/ptr_util.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" #include "chrome/grit/generated_resources.h" +#include "components/autofill/core/browser/autofill_type.h" +#include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/field_types.h" +#include "components/autofill/core/browser/validation.h" +#include "components/autofill/core/common/autofill_constants.h" #include "components/payments/payment_request.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/views/controls/textfield/textfield.h" namespace payments { @@ -25,20 +31,58 @@ std::vector<EditorField> CreditCardEditorViewController::GetFieldDefinitions() { return std::vector<EditorField>{ - {autofill::CREDIT_CARD_NUMBER, - l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER), - EditorField::LengthHint::HINT_LONG}, {autofill::CREDIT_CARD_NAME_FULL, l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD), EditorField::LengthHint::HINT_LONG}, + {autofill::CREDIT_CARD_NUMBER, + l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER), + EditorField::LengthHint::HINT_LONG}, {autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_DATE), EditorField::LengthHint::HINT_SHORT}}; } bool CreditCardEditorViewController::ValidateModelAndSave() { - // TODO(mathp): Actual validation and saving the model on disk. + autofill::CreditCard credit_card; + credit_card.set_origin(autofill::kSettingsOrigin); + for (const auto& field : text_fields()) { + // ValidatingTextfield* is the key, EditorField is the value. + DCHECK_EQ(autofill::CREDIT_CARD, + autofill::AutofillType(field.second.type).group()); + if (field.first->invalid()) + return false; + + credit_card.SetRawInfo(field.second.type, field.first->text()); + } + + // TODO(mathp): Display global error message. + if (!credit_card.IsValid()) + return false; + + // Add the card (will not add a duplicate). + request()->personal_data_manager()->AddCreditCard(credit_card); + return true; } +std::unique_ptr<ValidatingTextfield::Delegate> +CreditCardEditorViewController::CreateValidationDelegate( + const EditorField& field) { + return base::MakeUnique<CreditCardEditorViewController::ValidationDelegate>( + field); +} + +CreditCardEditorViewController::ValidationDelegate::ValidationDelegate( + const EditorField& field) + : field_(field) {} +CreditCardEditorViewController::ValidationDelegate::~ValidationDelegate() {} + +bool CreditCardEditorViewController::ValidationDelegate::ValidateTextfield( + views::Textfield* textfield) { + base::string16 error_message; + // TODO(mathp): Display |error_message| around |textfield|. + return autofill::IsValidForType(textfield->text(), field_.type, + &error_message); +} + } // namespace payments
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h index c30a3e67..15e07fc6 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "chrome/browser/ui/views/payments/editor_view_controller.h" +#include "chrome/browser/ui/views/payments/validating_textfield.h" namespace payments { @@ -21,11 +22,27 @@ PaymentRequestDialogView* dialog); ~CreditCardEditorViewController() override; - // EditorViewController implementation. + // EditorViewController: std::vector<EditorField> GetFieldDefinitions() override; bool ValidateModelAndSave() override; + std::unique_ptr<ValidatingTextfield::Delegate> CreateValidationDelegate( + const EditorField& field) override; private: + class ValidationDelegate : public ValidatingTextfield::Delegate { + public: + explicit ValidationDelegate(const EditorField& field); + ~ValidationDelegate() override; + + // ValidatingTextfield::Delegate: + bool ValidateTextfield(views::Textfield* textfield) override; + + private: + EditorField field_; + + DISALLOW_COPY_AND_ASSIGN(ValidationDelegate); + }; + DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController); };
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.cc b/chrome/browser/ui/views/payments/editor_view_controller.cc index 8d77ce38..47d4967 100644 --- a/chrome/browser/ui/views/payments/editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/editor_view_controller.cc
@@ -4,8 +4,10 @@ #include "chrome/browser/ui/views/payments/editor_view_controller.h" +#include <memory> #include <utility> +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" @@ -36,7 +38,7 @@ SAVE_BUTTON = kFirstTagValue, }; -constexpr int kNumCharactersInShortField = 6; +constexpr int kNumCharactersInShortField = 8; constexpr int kNumCharactersInLongField = 20; } // namespace @@ -60,20 +62,9 @@ // Create an input label/textfield for each field definition. std::vector<EditorField> fields = GetFieldDefinitions(); for (const auto& field : fields) { - views::Textfield* text_field = nullptr; - content_view->AddChildView(CreateInputField(field, &text_field).release()); - // |field| is moved out of the |fields| structure and should not be - // referenced after the following line. - text_fields_.insert(std::make_pair(text_field, std::move(field))); + content_view->AddChildView(CreateInputField(field).release()); } - // TODO(mathp): Use the save button in the footer once it's built. - views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( - this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); - button->set_tag(static_cast<int>(EditorViewControllerTags::SAVE_BUTTON)); - button->set_id(static_cast<int>(DialogViewID::EDITOR_SAVE_BUTTON)); - content_view->AddChildView(button); - return CreatePaymentView( CreateSheetHeaderView( true, l10n_util::GetStringUTF16( @@ -82,6 +73,15 @@ std::move(content_view)); } +std::unique_ptr<views::Button> EditorViewController::CreatePrimaryButton() { + std::unique_ptr<views::Button> button( + views::MdTextButton::CreateSecondaryUiBlueButton( + this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON))); + button->set_tag(static_cast<int>(EditorViewControllerTags::SAVE_BUTTON)); + button->set_id(static_cast<int>(DialogViewID::EDITOR_SAVE_BUTTON)); + return button; +} + void EditorViewController::ButtonPressed(views::Button* sender, const ui::Event& event) { switch (sender->tag()) { @@ -97,12 +97,11 @@ void EditorViewController::ContentsChanged(views::Textfield* sender, const base::string16& new_contents) { - // TODO(mathp): Validate the |sender| textfield and display errors. + static_cast<ValidatingTextfield*>(sender)->OnContentsChanged(); } std::unique_ptr<views::View> EditorViewController::CreateInputField( - const EditorField& field, - views::Textfield** text_field) { + const EditorField& field) { std::unique_ptr<views::View> row = base::MakeUnique<views::View>(); row->SetBorder(payments::CreatePaymentRequestRowBorder()); @@ -127,16 +126,19 @@ layout->StartRow(0, 0); layout->AddView(new views::Label(field.label)); - *text_field = new views::Textfield(); - (*text_field)->set_controller(this); - (*text_field) - ->set_default_width_in_chars(field.length_hint == - EditorField::LengthHint::HINT_SHORT - ? kNumCharactersInShortField - : kNumCharactersInLongField); - // |text_field| will now be owned by the layout, but the caller kept a - // reference. - layout->AddView(*text_field); + ValidatingTextfield* text_field = + new ValidatingTextfield(CreateValidationDelegate(field)); + text_field->set_controller(this); + // Using autofill field type as a view ID (for testing). + text_field->set_id(static_cast<int>(field.type)); + text_field->set_default_width_in_chars( + field.length_hint == EditorField::LengthHint::HINT_SHORT + ? kNumCharactersInShortField + : kNumCharactersInLongField); + + text_fields_.insert(std::make_pair(text_field, field)); + // |text_field| will now be owned by the layout. + layout->AddView(text_field); return row; }
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.h b/chrome/browser/ui/views/payments/editor_view_controller.h index 35dfdd3..14a521a 100644 --- a/chrome/browser/ui/views/payments/editor_view_controller.h +++ b/chrome/browser/ui/views/payments/editor_view_controller.h
@@ -13,6 +13,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/string16.h" #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" +#include "chrome/browser/ui/views/payments/validating_textfield.h" #include "components/autofill/core/browser/field_types.h" #include "ui/views/controls/button/vector_icon_button_delegate.h" #include "ui/views/controls/textfield/textfield_controller.h" @@ -46,6 +47,9 @@ class EditorViewController : public PaymentRequestSheetController, public views::TextfieldController { public: + using TextFieldsMap = + std::unordered_map<ValidatingTextfield*, const EditorField>; + // Does not take ownership of the arguments, which should outlive this object. EditorViewController(PaymentRequest* request, PaymentRequestDialogView* dialog); @@ -58,6 +62,16 @@ virtual std::vector<EditorField> GetFieldDefinitions() = 0; // Validates the data entered and attempts to save; returns true on success. virtual bool ValidateModelAndSave() = 0; + // Creates a ValidatingTextfield::Delegate which knows how to validate for a + // given |field| definition. + virtual std::unique_ptr<ValidatingTextfield::Delegate> + CreateValidationDelegate(const EditorField& field) = 0; + + const TextFieldsMap& text_fields() const { return text_fields_; } + + protected: + // PaymentRequestSheetController; + std::unique_ptr<views::Button> CreatePrimaryButton() override; private: // PaymentRequestSheetController: @@ -70,14 +84,13 @@ // Creates a view for an input field to be added in the editor sheet. |field| // is the field definition, which contains the label and the hint about // the length of the input field. - std::unique_ptr<views::View> CreateInputField(const EditorField& field, - views::Textfield** text_field); + std::unique_ptr<views::View> CreateInputField(const EditorField& field); // Used to remember the association between the input field UI element and the - // original field definition. The Textfield* are owned by their parent view, - // this only keeps a reference that is good as long as the Textfield is - // visible. - std::unordered_map<views::Textfield*, const EditorField> text_fields_; + // original field definition. The ValidatingTextfield* are owned by their + // parent view, this only keeps a reference that is good as long as the + // textfield is visible. + TextFieldsMap text_fields_; DISALLOW_COPY_AND_ASSIGN(EditorViewController); };
diff --git a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc index 0edfcf45..2dfcc616 100644 --- a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc +++ b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
@@ -3,8 +3,12 @@ // found in the LICENSE file. #include "base/macros.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h" +#include "components/autofill/core/browser/field_types.h" +#include "components/autofill/core/browser/personal_data_manager.h" +#include "components/payments/payment_request.h" namespace payments { @@ -14,26 +18,67 @@ PaymentRequestCreditCardEditorTest() : PaymentRequestInteractiveTestBase( "/payment_request_no_shipping_test.html") {} - private: DISALLOW_COPY_AND_ASSIGN(PaymentRequestCreditCardEditorTest); }; -IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, - OpenCreditCardEditor) { +IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, EnteringValidData) { InvokePaymentRequestUI(); OpenPaymentMethodScreen(); OpenCreditCardEditorScreen(); - // TODO(mathp): Test input and validation. + SetEditorTextfieldValue(base::ASCIIToUTF16("Bob Jones"), + autofill::CREDIT_CARD_NAME_FULL); + SetEditorTextfieldValue(base::ASCIIToUTF16("4111111111111111"), + autofill::CREDIT_CARD_NUMBER); + SetEditorTextfieldValue(base::ASCIIToUTF16("05/45"), + autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); ResetEventObserver(DialogEvent::BACK_NAVIGATION); ClickOnDialogViewAndWait(DialogViewID::EDITOR_SAVE_BUTTON); - WaitForObservedEvent(); + // Verifying the data is in the DB. + autofill::PersonalDataManager* personal_data_manager = + GetPaymentRequests(GetActiveWebContents())[0]->personal_data_manager(); + EXPECT_EQ(1u, personal_data_manager->GetCreditCards().size()); + autofill::CreditCard* credit_card = + personal_data_manager->GetCreditCards()[0]; + EXPECT_EQ(5, credit_card->expiration_month()); + EXPECT_EQ(2045, credit_card->expiration_year()); + EXPECT_EQ(2045, credit_card->expiration_year()); + EXPECT_EQ(base::ASCIIToUTF16("1111"), credit_card->LastFourDigits()); + EXPECT_EQ(base::ASCIIToUTF16("Bob Jones"), + credit_card->GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)); +} + +IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, + EnteringInvalidData) { + InvokePaymentRequestUI(); + + OpenPaymentMethodScreen(); + + OpenCreditCardEditorScreen(); + + SetEditorTextfieldValue(base::ASCIIToUTF16("Bob Jones"), + autofill::CREDIT_CARD_NAME_FULL); + SetEditorTextfieldValue(base::ASCIIToUTF16("41111111invalidcard"), + autofill::CREDIT_CARD_NUMBER); + SetEditorTextfieldValue(base::ASCIIToUTF16("05/45"), + autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); + + ClickOnDialogViewAndWait(DialogViewID::EDITOR_SAVE_BUTTON); + + EXPECT_FALSE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NAME_FULL)); + EXPECT_TRUE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NUMBER)); + EXPECT_FALSE( + IsEditorTextfieldInvalid(autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR)); + + autofill::PersonalDataManager* personal_data_manager = + GetPaymentRequests(GetActiveWebContents())[0]->personal_data_manager(); + EXPECT_EQ(0u, personal_data_manager->GetCreditCards().size()); } } // namespace payments
diff --git a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.cc b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.cc index 2ebbfd2..07d43b8 100644 --- a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.cc +++ b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" +#include "chrome/browser/ui/views/payments/validating_textfield.h" #include "chrome/browser/ui/views/payments/view_stack.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" @@ -179,6 +180,25 @@ WaitForObservedEvent(); } +void PaymentRequestInteractiveTestBase::SetEditorTextfieldValue( + const base::string16& value, + autofill::ServerFieldType type) { + ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( + delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); + DCHECK(textfield); + textfield->SetText(value); + textfield->OnContentsChanged(); + textfield->OnBlur(); +} + +bool PaymentRequestInteractiveTestBase::IsEditorTextfieldInvalid( + autofill::ServerFieldType type) { + ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( + delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); + DCHECK(textfield); + return textfield->invalid(); +} + void PaymentRequestInteractiveTestBase::WaitForAnimation() { ViewStack* view_stack = dialog_view()->view_stack_for_testing(); if (view_stack->slide_in_animator_->IsAnimating()) {
diff --git a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h index 85f6b7f8..373d978 100644 --- a/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h +++ b/chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h
@@ -10,9 +10,11 @@ #include "base/command_line.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/strings/string16.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" #include "chrome/browser/ui/views/payments/test_chrome_payment_request_delegate.h" #include "chrome/test/base/in_process_browser_test.h" +#include "components/autofill/core/browser/field_types.h" #include "components/payments/payment_request.mojom.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "ui/views/widget/widget_observer.h" @@ -81,6 +83,14 @@ // to be observed. void ClickOnDialogViewAndWait(DialogViewID view_id); + // Setting the |value| in the textfield of a given |type|. + void SetEditorTextfieldValue(const base::string16& value, + autofill::ServerFieldType type); + + // Whether the editor textfield for the given |type| is currently in an + // invalid state. + bool IsEditorTextfieldInvalid(autofill::ServerFieldType type); + // Sets proper animation delegates and waits for animation to finish. void WaitForAnimation();
diff --git a/chrome/browser/ui/views/payments/validating_textfield.cc b/chrome/browser/ui/views/payments/validating_textfield.cc new file mode 100644 index 0000000..ed8dd7d8 --- /dev/null +++ b/chrome/browser/ui/views/payments/validating_textfield.cc
@@ -0,0 +1,42 @@ +// 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/views/payments/validating_textfield.h" + +#include <utility> + +namespace payments { + +ValidatingTextfield::ValidatingTextfield( + std::unique_ptr<ValidatingTextfield::Delegate> delegate) + : Textfield(), delegate_(std::move(delegate)) {} + +ValidatingTextfield::~ValidatingTextfield() {} + +void ValidatingTextfield::OnBlur() { + Textfield::OnBlur(); + + // The first validation of non-empty data should be on a blur. The subsequent + // validations will occur when the contents changes. + if (!was_validated_ && !text().empty()) { + was_validated_ = true; + Validate(); + } +} + +void ValidatingTextfield::OnContentsChanged() { + // Validation on every keystroke only happens if the field has been validated + // before as part of a blur. + if (!was_validated_) + return; + + Validate(); +} + +void ValidatingTextfield::Validate() { + // ValidateTextfield may have side-effects, such as displaying errors. + SetInvalid(!delegate_->ValidateTextfield(this)); +} + +} // namespace payments
diff --git a/chrome/browser/ui/views/payments/validating_textfield.h b/chrome/browser/ui/views/payments/validating_textfield.h new file mode 100644 index 0000000..44cb5af43 --- /dev/null +++ b/chrome/browser/ui/views/payments/validating_textfield.h
@@ -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. + +#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_ +#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_ + +#include "base/macros.h" +#include "ui/views/controls/textfield/textfield.h" + +namespace payments { + +class ValidatingTextfield : public views::Textfield { + public: + class Delegate { + public: + Delegate() {} + virtual ~Delegate() {} + + // Only the delegate knows how to validate the textfield. + virtual bool ValidateTextfield(views::Textfield* textfield) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(Delegate); + }; + + explicit ValidatingTextfield( + std::unique_ptr<ValidatingTextfield::Delegate> delegate); + ~ValidatingTextfield() override; + + // Textfield: + // The first validation will happen on blur. + void OnBlur() override; + + // Called when the textfield contents is changed. May do validation. + void OnContentsChanged(); + + private: + // Will call to the Delegate to validate the contents of the textfield. + void Validate(); + + std::unique_ptr<ValidatingTextfield::Delegate> delegate_; + bool was_validated_ = false; + + DISALLOW_COPY_AND_ASSIGN(ValidatingTextfield); +}; + +} // namespace payments + +#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_
diff --git a/chrome/browser/ui/views/payments/validating_textfield_unittest.cc b/chrome/browser/ui/views/payments/validating_textfield_unittest.cc new file mode 100644 index 0000000..a7565fb2 --- /dev/null +++ b/chrome/browser/ui/views/payments/validating_textfield_unittest.cc
@@ -0,0 +1,68 @@ +// 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/views/payments/validating_textfield.h" + +#include <memory> + +#include "base/macros.h" +#include "base/strings/string16.h" +#include "base/strings/utf_string_conversions.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/views/controls/textfield/textfield.h" + +namespace payments { + +class ValidatingTextfieldTest : public testing::Test { + public: + ValidatingTextfieldTest() {} + ~ValidatingTextfieldTest() override {} + + protected: + class ValidationDelegate : public ValidatingTextfield::Delegate { + public: + ValidationDelegate() {} + ~ValidationDelegate() override {} + + // ValidatingTextfield::Delegate + bool ValidateTextfield(views::Textfield* textfield) override { + // We really don't like textfields with more than 5 characters in them. + return textfield->text().size() <= 5u; + } + + private: + DISALLOW_COPY_AND_ASSIGN(ValidationDelegate); + }; + + private: + DISALLOW_COPY_AND_ASSIGN(ValidatingTextfieldTest); +}; + +TEST_F(ValidatingTextfieldTest, Validation) { + std::unique_ptr<ValidationDelegate> delegate(new ValidationDelegate()); + std::unique_ptr<ValidatingTextfield> textfield( + new ValidatingTextfield(std::move(delegate))); + + // Set an invalid string (>5 characters). + textfield->SetText(base::ASCIIToUTF16("evilstring")); + // This should be called on new contents by the textfield controller. + textfield->OnContentsChanged(); + + // Not marked as invalid. + EXPECT_FALSE(textfield->invalid()); + + // On blur though, there is a first validation. + textfield->OnBlur(); + EXPECT_TRUE(textfield->invalid()); + + // On further text adjustements, the validation runs now. Set a valid string + // (<=5 characters). + textfield->SetText(base::ASCIIToUTF16("good")); + textfield->OnContentsChanged(); + + // No longer invalid. + EXPECT_FALSE(textfield->invalid()); +} + +} // namespace payments
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc index 465f9803..5880825 100644 --- a/chrome/browser/ui/webui/signin/inline_login_ui.cc +++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -33,7 +33,7 @@ source->OverrideContentSecurityPolicyObjectSrc("object-src chrome:;"); source->SetJsonPath("strings.js"); - source->SetDefaultResource(IDR_NEW_INLINE_LOGIN_HTML); + source->SetDefaultResource(IDR_INLINE_LOGIN_HTML); // Only add a filter when runing as test. base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 05b08cd..608e7cc 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -180,9 +180,6 @@ const base::Feature kOfflinePageDownloadSuggestionsFeature{ "NTPOfflinePageDownloadSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kParallelDownloading{ - "ParallelDownloading", base::FEATURE_DISABLED_BY_DEFAULT}; - // Enables Permissions Blacklisting via Safe Browsing. const base::Feature kPermissionsBlacklist{ "PermissionsBlacklist", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index a4904df..af02252 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -104,8 +104,6 @@ extern const base::Feature kOfflinePageDownloadSuggestionsFeature; -extern const base::Feature kParallelDownloading; - extern const base::Feature kPermissionsBlacklist; #if defined(OS_WIN)
diff --git a/chrome/common/safe_browsing/csd.proto b/chrome/common/safe_browsing/csd.proto index 4089e56..cfcd4d4 100644 --- a/chrome/common/safe_browsing/csd.proto +++ b/chrome/common/safe_browsing/csd.proto
@@ -756,7 +756,7 @@ // A Detailed Safebrowsing Report from clients. Chrome safebrowsing reports are // only sent by Chrome users who have opted into extended Safe Browsing. // This proto is replacing ClientMalwareReportRequest. -// Next tag: 16 +// Next tag: 17 message ClientSafeBrowsingReportRequest { // Note: A lot of the "optional" fields would make sense to be // "required" instead. However, having them as optional allows the @@ -835,6 +835,10 @@ repeated Resource resources = 4; + // Contains the hierarchy of elements on the page (ie: the DOM). Some + // elements can be Resources and will refer to the resources list (above). + repeated HTMLElement dom = 16; + // Whether the report is complete. optional bool complete = 5; @@ -855,6 +859,30 @@ optional bytes token = 15; } +// An HTML Element on the page (eg: iframe, div, script, etc). +message HTMLElement { + // Id of this element. + optional int32 id = 1; + + // The tag type of this element (eg: iframe, div, script, etc). + optional string tag = 2; + + // IDs of elements that are children of this element. + repeated int32 child_ids = 3; + + // If this element represents a Resource then this is the id of the + // Resource, which contains additional data about the Resource. Otherwise + // unset. + optional int32 resource_id = 5; + + // An Attribute of the element (eg: id, border, foo etc) and its value. + message Attribute { + optional string name = 1; + optional string value = 2; + } + repeated Attribute attribute = 6; +} + // Canonical representation of raster image data. message ImageData { // Image bitmap, after downscaling to <= 512x512.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 417fafa..9af0c32e 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3654,6 +3654,7 @@ "../browser/search/instant_unittest_base.h", "../browser/search/search_unittest.cc", "../browser/sessions/persistent_tab_restore_service_unittest.cc", + "../browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc", "../browser/speech/extension_api/extension_manifests_tts_unittest.cc", "../browser/speech/tts_controller_unittest.cc", "../browser/sync/sessions/sessions_sync_manager_unittest.cc", @@ -4024,7 +4025,6 @@ "../browser/signin/easy_unlock_auth_attempt_unittest.cc", "../browser/signin/easy_unlock_screenlock_state_handler_unittest.cc", "../browser/signin/easy_unlock_service_unittest_chromeos.cc", - "../browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc", "../browser/sync/glue/extensions_activity_monitor_unittest.cc", "../browser/sync_file_system/drive_backend/callback_helper_unittest.cc", "../browser/sync_file_system/drive_backend/callback_tracker_unittest.cc", @@ -4846,6 +4846,7 @@ "../browser/ui/views/frame/web_contents_close_handler_unittest.cc", "../browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc", "../browser/ui/views/omnibox/omnibox_view_views_unittest.cc", + "../browser/ui/views/payments/validating_textfield_unittest.cc", "../browser/ui/views/payments/view_stack_unittest.cc", "../browser/ui/views/status_icons/status_tray_win_unittest.cc", "../browser/ui/views/sync/bubble_sync_promo_view_unittest.cc",
diff --git a/chrome/test/media_router/media_router_integration_browsertest.cc b/chrome/test/media_router/media_router_integration_browsertest.cc index 32a5e7d..35fb3ec 100644 --- a/chrome/test/media_router/media_router_integration_browsertest.cc +++ b/chrome/test/media_router/media_router_integration_browsertest.cc
@@ -83,12 +83,14 @@ "}" "domAutomationController.send('');"; const char kFindSinkScript[] = - "var sinks = document.getElementById('media-router-container')." - " shadowRoot.getElementById('sink-list').getElementsByTagName('span');" - "for (var i=0; i<sinks.length; i++) {" - " if (sinks[i].textContent.trim() == '%s') {" - " domAutomationController.send(true);" - "}}" + "var sinkList = document.getElementById('media-router-container')." + " shadowRoot.getElementById('sink-list');" + "if (sinkList) {" + " var sinks = sinkList.getElementsByTagName('span');" + " for (var i=0; i<sinks.length; i++) {" + " if (sinks[i].textContent.trim() == '%s') {" + " domAutomationController.send(true);" + "}}}" "domAutomationController.send(false);"; const char kCheckDialogLoadedScript[] = "var container = document.getElementById('media-router-container');"
diff --git a/chromecast/BUILD.gn b/chromecast/BUILD.gn index 806e41cc..d89cf1d 100644 --- a/chromecast/BUILD.gn +++ b/chromecast/BUILD.gn
@@ -33,6 +33,7 @@ "//chromecast/base:cast_base_unittests", "//chromecast/base/component:cast_component_unittests", "//chromecast/crypto:cast_crypto_unittests", + "//chromecast/media:cast_media_unittests", "//chromecast/system/reboot:cast_reboot_unittests", "//content/test:content_unittests", "//crypto:crypto_unittests", @@ -66,7 +67,7 @@ tests += [ ":cast_shell_browsertests", ":cast_shell_unittests", - "//chromecast/media:cast_media_unittests", + "//chromecast/media/cma:cast_cma_unittests", "//ipc:ipc_tests", "//jingle:jingle_unittests", "//url:url_unittests",
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index 2d6be6d..c2a8922 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn
@@ -47,6 +47,8 @@ "geolocation/cast_access_token_store.h", "media/media_caps_impl.cc", "media/media_caps_impl.h", + "media/supported_codec_finder.cc", + "media/supported_codec_finder.h", "metrics/cast_metrics_prefs.cc", "metrics/cast_metrics_prefs.h", "metrics/cast_metrics_service_client.cc",
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc index 869ae4d..25bd433d5 100644 --- a/chromecast/browser/cast_browser_main_parts.cc +++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -494,6 +494,7 @@ media_resource_tracker()->InitializeMediaLib(); #endif ::media::InitializeMediaLibrary(); + media_caps_->Initialize(); device::GeolocationProvider::SetGeolocationDelegate( new CastGeolocationDelegate(cast_browser_process_->browser_context()));
diff --git a/chromecast/browser/media/media_caps_impl.cc b/chromecast/browser/media/media_caps_impl.cc index 3c46522..c18c519 100644 --- a/chromecast/browser/media/media_caps_impl.cc +++ b/chromecast/browser/media/media_caps_impl.cc
@@ -4,11 +4,23 @@ #include "chromecast/browser/media/media_caps_impl.h" +#include "base/logging.h" +#include "chromecast/browser/media/supported_codec_finder.h" #include "chromecast/media/base/media_caps.h" +#include "chromecast/public/media/decoder_config.h" namespace chromecast { namespace media { +mojom::CodecProfileLevelPtr ConvertCodecProfileLevelToMojo( + const CodecProfileLevel& codec_profile_level) { + mojom::CodecProfileLevelPtr result = mojom::CodecProfileLevel::New(); + result->codec = codec_profile_level.codec; + result->profile = codec_profile_level.profile; + result->level = codec_profile_level.level; + return result; +} + MediaCapsImpl::MediaCapsImpl() : supported_codecs_bitmask_(0), hdcp_version_(0), @@ -22,6 +34,11 @@ MediaCapsImpl::~MediaCapsImpl() = default; +void MediaCapsImpl::Initialize() { + media::SupportedCodecFinder supported_codec_finder; + supported_codec_finder.FindSupportedCodecProfileLevels(this); +} + void MediaCapsImpl::AddBinding(mojom::MediaCapsRequest request) { bindings_.AddBinding(this, std::move(request)); } @@ -70,6 +87,18 @@ }); } +void MediaCapsImpl::AddSupportedCodecProfileLevel( + const CodecProfileLevel& codec_profile_level) { + codec_profile_levels_.push_back(codec_profile_level); + observers_.ForAllPtrs( + [&codec_profile_level](mojom::MediaCapsObserver* observer) { + mojom::CodecProfileLevelPtr mojo_codec_profile_level( + ConvertCodecProfileLevelToMojo(codec_profile_level)); + observer->AddSupportedCodecProfileLevel( + std::move(mojo_codec_profile_level)); + }); +} + void MediaCapsImpl::AddObserver(mojom::MediaCapsObserverPtr observer) { observer->SupportedHdmiSinkCodecsChanged(supported_codecs_bitmask_); observer->ScreenResolutionChanged(screen_resolution_.width(), @@ -78,6 +107,12 @@ dolby_vision_flags_, screen_width_mm_, screen_height_mm_, current_mode_supports_hdr_, current_mode_supports_dv_); + DVLOG(1) << __func__ << ": Sending " << codec_profile_levels_.size() + << " supported codec profile levels to observer."; + for (const auto& codec_profile_level : codec_profile_levels_) { + observer->AddSupportedCodecProfileLevel( + ConvertCodecProfileLevelToMojo(codec_profile_level)); + } observers_.AddPtr(std::move(observer)); }
diff --git a/chromecast/browser/media/media_caps_impl.h b/chromecast/browser/media/media_caps_impl.h index de057517..1324cd3 100644 --- a/chromecast/browser/media/media_caps_impl.h +++ b/chromecast/browser/media/media_caps_impl.h
@@ -5,6 +5,8 @@ #ifndef CHROMECAST_BROWSER_MEDIA_MEDIA_CAPS_IMPL_H_ #define CHROMECAST_BROWSER_MEDIA_MEDIA_CAPS_IMPL_H_ +#include <vector> + #include "base/macros.h" #include "chromecast/common/media/media_caps.mojom.h" #include "mojo/public/cpp/bindings/binding_set.h" @@ -14,11 +16,14 @@ namespace chromecast { namespace media { +struct CodecProfileLevel; + class MediaCapsImpl : public mojom::MediaCaps { public: MediaCapsImpl(); ~MediaCapsImpl() override; + void Initialize(); void AddBinding(mojom::MediaCapsRequest request); void SetSupportedHdmiSinkCodecs(unsigned int supported_codecs_bitmask); @@ -30,6 +35,8 @@ int screen_height_mm, bool current_mode_supports_hdr, bool current_mode_supports_dv); + void AddSupportedCodecProfileLevel( + const CodecProfileLevel& codec_profile_level); private: // chromecast::mojom::MediaCaps implementation. @@ -44,6 +51,7 @@ bool current_mode_supports_hdr_; bool current_mode_supports_dv_; gfx::Size screen_resolution_; + std::vector<CodecProfileLevel> codec_profile_levels_; mojo::InterfacePtrSet<mojom::MediaCapsObserver> observers_; mojo::BindingSet<mojom::MediaCaps> bindings_;
diff --git a/chromecast/browser/media/supported_codec_finder.cc b/chromecast/browser/media/supported_codec_finder.cc new file mode 100644 index 0000000..0c4a5e7 --- /dev/null +++ b/chromecast/browser/media/supported_codec_finder.cc
@@ -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. + +#include "chromecast/browser/media/supported_codec_finder.h" + +#include <vector> + +#include "base/logging.h" +#include "chromecast/browser/media/media_caps_impl.h" +#include "chromecast/media/base/media_codec_support.h" +#if defined(OS_ANDROID) +#include "media/base/android/media_codec_util.h" +#endif +#include "media/base/video_codecs.h" + +namespace chromecast { +namespace media { + +void SupportedCodecFinder::FindSupportedCodecProfileLevels( + MediaCapsImpl* media_caps) { +// Don't need to list supported codecs on non-Android devices. +#if defined(OS_ANDROID) + // Get list of supported codecs from MediaCodec. + std::vector<::media::CodecProfileLevel> codec_profile_levels; + ::media::MediaCodecUtil::AddSupportedCodecProfileLevels( + &codec_profile_levels); + LOG(INFO) << "Adding " << codec_profile_levels.size() + << " supported codec profiles/levels"; + for (const auto& codec_profile_level : codec_profile_levels) { + media_caps->AddSupportedCodecProfileLevel( + ToCastCodecProfileLevel(codec_profile_level)); + } +#endif +} + +} // namespace media +} // namespace chromecast
diff --git a/chromecast/browser/media/supported_codec_finder.h b/chromecast/browser/media/supported_codec_finder.h new file mode 100644 index 0000000..11d3cf06 --- /dev/null +++ b/chromecast/browser/media/supported_codec_finder.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. + +namespace chromecast { +namespace media { + +class MediaCapsImpl; + +class SupportedCodecFinder { + public: + // Notifies the given MediaCaps of all found supported codecs. + void FindSupportedCodecProfileLevels(MediaCapsImpl* media_caps); +}; + +} // namespace media +} // namespace chromecast
diff --git a/chromecast/common/media/cast_media_client.cc b/chromecast/common/media/cast_media_client.cc index 62f44be..9a4213b 100644 --- a/chromecast/common/media/cast_media_client.cc +++ b/chromecast/common/media/cast_media_client.cc
@@ -4,8 +4,8 @@ #include "chromecast/common/media/cast_media_client.h" -#include "base/lazy_instance.h" #include "chromecast/media/base/media_codec_support.h" +#include "chromecast/media/base/supported_codec_profile_levels_memo.h" #include "chromecast/public/media/media_capabilities_shlib.h" // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig @@ -18,19 +18,20 @@ namespace chromecast { namespace media { -static base::LazyInstance<CastMediaClient>::Leaky g_cast_media_client = - LAZY_INSTANCE_INITIALIZER; - -void CastMediaClient::Initialize() { - g_cast_media_client.Get(); +void CastMediaClient::Initialize( + SupportedCodecProfileLevelsMemo* supported_profiles) { + ::media::SetMediaClient( + new CastMediaClient(::media::GetMediaClient(), supported_profiles)); } -CastMediaClient::CastMediaClient() { - content_media_client_ = ::media::GetMediaClient(); +CastMediaClient::CastMediaClient( + ::media::MediaClient* content_media_client, + SupportedCodecProfileLevelsMemo* supported_profiles) { // Ensure that CastMediaClient gets initialized after the // content::RenderMediaClient. - DCHECK(content_media_client_); - ::media::SetMediaClient(this); + DCHECK(content_media_client); + content_media_client_ = content_media_client; + supported_profiles_ = supported_profiles; } CastMediaClient::~CastMediaClient() {} @@ -59,8 +60,13 @@ bool CastMediaClient::IsSupportedVideoConfig(::media::VideoCodec codec, ::media::VideoCodecProfile profile, int level) { +#if defined(OS_ANDROID) + return supported_profiles_->IsSupportedVideoConfig( + ToCastVideoCodec(codec), ToCastVideoProfile(profile), level); +#else return MediaCapabilitiesShlib::IsSupportedVideoConfig( ToCastVideoCodec(codec), ToCastVideoProfile(profile), level); +#endif } } // namespace media
diff --git a/chromecast/common/media/cast_media_client.h b/chromecast/common/media/cast_media_client.h index 3ec011744..e6fa9ab 100644 --- a/chromecast/common/media/cast_media_client.h +++ b/chromecast/common/media/cast_media_client.h
@@ -7,6 +7,7 @@ #include "base/lazy_instance.h" #include "base/macros.h" +#include "chromecast/media/base/supported_codec_profile_levels_memo.h" #include "media/base/media_client.h" namespace chromecast { @@ -19,7 +20,7 @@ public: // Initialize CastMediaClient and SetMediaClient(). Note that the instance // is not exposed because no content code needs to directly access it. - static void Initialize(); + static void Initialize(SupportedCodecProfileLevelsMemo* memo); // MediaClient implementation void AddKeySystemsInfoForUMA(std::vector<::media::KeySystemInfoForUMA>* @@ -36,10 +37,12 @@ private: friend struct base::DefaultLazyInstanceTraits<CastMediaClient>; - CastMediaClient(); + CastMediaClient(::media::MediaClient* content_media_client, + SupportedCodecProfileLevelsMemo* supported_profiles); ~CastMediaClient() override; ::media::MediaClient* content_media_client_; + SupportedCodecProfileLevelsMemo* supported_profiles_; DISALLOW_COPY_AND_ASSIGN(CastMediaClient); };
diff --git a/chromecast/common/media/media_caps.mojom b/chromecast/common/media/media_caps.mojom index 4baa030..e568a45 100644 --- a/chromecast/common/media/media_caps.mojom +++ b/chromecast/common/media/media_caps.mojom
@@ -4,6 +4,12 @@ module chromecast.media.mojom; +struct CodecProfileLevel { + int32 codec; + int32 profile; + int32 level; +}; + interface MediaCaps { AddObserver(MediaCapsObserver observer); }; @@ -18,4 +24,8 @@ int32 dolby_vision_flags, int32 screen_width_mm, int32 screen_height_mm, bool current_mode_supports_hdr, bool current_mode_supports_dolby_vision); + + // Add supported codec profiles and levels. May not be called on all + // platforms, but can be used to infer whether a video config is supported. + AddSupportedCodecProfileLevel(CodecProfileLevel codec_profile_level); };
diff --git a/chromecast/media/BUILD.gn b/chromecast/media/BUILD.gn index eab717e4..ad6caf6 100644 --- a/chromecast/media/BUILD.gn +++ b/chromecast/media/BUILD.gn
@@ -19,53 +19,20 @@ "audio/cast_audio_mixer_unittest.cc", "audio/cast_audio_output_stream_unittest.cc", "base/media_resource_tracker_unittest.cc", - "cma/backend/audio_video_pipeline_device_unittest.cc", - "cma/base/balanced_media_task_runner_unittest.cc", - "cma/base/buffering_controller_unittest.cc", - "cma/base/buffering_frame_provider_unittest.cc", - "cma/base/decoder_buffer_adapter_unittest.cc", - "cma/base/demuxer_stream_adapter_unittest.cc", - "cma/base/demuxer_stream_for_test.cc", - "cma/base/demuxer_stream_for_test.h", - "cma/base/multi_demuxer_stream_adapter_unittest.cc", - "cma/pipeline/audio_video_pipeline_impl_unittest.cc", - "cma/test/frame_generator_for_test.cc", - "cma/test/frame_generator_for_test.h", - "cma/test/frame_segmenter_for_test.cc", - "cma/test/frame_segmenter_for_test.h", - "cma/test/mock_frame_consumer.cc", - "cma/test/mock_frame_consumer.h", - "cma/test/mock_frame_provider.cc", - "cma/test/mock_frame_provider.h", - "cma/test/mock_media_pipeline_backend.cc", - "cma/test/mock_media_pipeline_backend.h", - "cma/test/run_all_unittests.cc", + "base/supported_codec_profile_levels_memo_unittest.cc", ] deps = [ ":media", "//base", - "//base:i18n", + "//base/test:run_all_unittests", "//base/test:test_support", "//chromecast/base", "//chromecast/base/metrics:test_support", - "//chromecast/media/audio", - "//chromecast/media/cma/backend", - "//chromecast/media/cma/base", - "//chromecast/media/cma/pipeline", "//chromecast/public", "//media", "//media/base:test_support", "//testing/gmock", "//testing/gtest", - "//ui/display", - "//ui/gfx/geometry", ] - - # MultizoneBackendTest verifies rendering delay reported by the backend. - # Since rendering delay is optional on video platforms, enable this test - # on audio devices only. - if (is_cast_audio_only && !is_cast_desktop_build) { - sources += [ "cma/backend/multizone_backend_unittest.cc" ] - } }
diff --git a/chromecast/media/base/BUILD.gn b/chromecast/media/base/BUILD.gn index 1b8f1a4..1ac36dc 100644 --- a/chromecast/media/base/BUILD.gn +++ b/chromecast/media/base/BUILD.gn
@@ -34,6 +34,8 @@ "media_codec_support.h", "media_resource_tracker.cc", "media_resource_tracker.h", + "supported_codec_profile_levels_memo.cc", + "supported_codec_profile_levels_memo.h", "video_mode_switcher.cc", "video_mode_switcher.h", "video_plane_controller.cc",
diff --git a/chromecast/media/base/media_codec_support.cc b/chromecast/media/base/media_codec_support.cc index 8a59659..396f2ec 100644 --- a/chromecast/media/base/media_codec_support.cc +++ b/chromecast/media/base/media_codec_support.cc
@@ -91,7 +91,7 @@ case ::media::H264PROFILE_SCALABLEHIGH: return kH264ScalableHigh; case ::media::H264PROFILE_STEREOHIGH: - return kH264Stereohigh; + return kH264StereoHigh; case ::media::H264PROFILE_MULTIVIEWHIGH: return kH264MultiviewHigh; case ::media::HEVCPROFILE_MAIN: @@ -116,5 +116,14 @@ return kVideoProfileUnknown; } +CodecProfileLevel ToCastCodecProfileLevel( + const ::media::CodecProfileLevel& codec_profile_level) { + CodecProfileLevel result; + result.codec = ToCastVideoCodec(codec_profile_level.codec); + result.profile = ToCastVideoProfile(codec_profile_level.profile); + result.level = codec_profile_level.level; + return result; +} + } // namespace media } // namespace chromecast
diff --git a/chromecast/media/base/media_codec_support.h b/chromecast/media/base/media_codec_support.h index 5b8428e..cbbf67c 100644 --- a/chromecast/media/base/media_codec_support.h +++ b/chromecast/media/base/media_codec_support.h
@@ -26,7 +26,8 @@ VideoCodec ToCastVideoCodec(const ::media::VideoCodec codec); VideoProfile ToCastVideoProfile(const ::media::VideoCodecProfile profile); - +CodecProfileLevel ToCastCodecProfileLevel( + const ::media::CodecProfileLevel& codec_profile_level); } // namespace media } // namespace chromecast
diff --git a/chromecast/media/base/supported_codec_profile_levels_memo.cc b/chromecast/media/base/supported_codec_profile_levels_memo.cc new file mode 100644 index 0000000..8af25951 --- /dev/null +++ b/chromecast/media/base/supported_codec_profile_levels_memo.cc
@@ -0,0 +1,44 @@ +// 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/media/base/supported_codec_profile_levels_memo.h" + +#include "base/logging.h" +#include "chromecast/public/media/decoder_config.h" + +namespace chromecast { +namespace media { + +SupportedCodecProfileLevelsMemo::SupportedCodecProfileLevelsMemo() {} + +SupportedCodecProfileLevelsMemo::~SupportedCodecProfileLevelsMemo() {} + +void SupportedCodecProfileLevelsMemo::AddSupportedCodecProfileLevel( + CodecProfileLevel codec_profile_level) { + DCHECK(thread_checker_.CalledOnValidThread()); + DVLOG(2) << __func__ << "(" << codec_profile_level.codec << ", " + << codec_profile_level.profile << ", " << codec_profile_level.level + << ")"; + codec_profile_levels_.push_back(codec_profile_level); +} + +bool SupportedCodecProfileLevelsMemo::IsSupportedVideoConfig( + VideoCodec codec, + VideoProfile profile, + int level) const { + DCHECK(thread_checker_.CalledOnValidThread()); + DVLOG(1) << __func__ << "(" << codec << ", " << profile << ", " << level + << ")"; + for (const auto& supported_profile_info : codec_profile_levels_) { + if (codec == supported_profile_info.codec && + profile == supported_profile_info.profile && + level == supported_profile_info.level) { + return true; + } + } + return false; +} + +} // namespace media +} // namespace chromecast
diff --git a/chromecast/media/base/supported_codec_profile_levels_memo.h b/chromecast/media/base/supported_codec_profile_levels_memo.h new file mode 100644 index 0000000..855bae1 --- /dev/null +++ b/chromecast/media/base/supported_codec_profile_levels_memo.h
@@ -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. + +#ifndef CHROMECAST_MEDIA_BASE_SUPPORTED_CODEC_PROFILE_LEVELS_MEMO_H_ +#define CHROMECAST_MEDIA_BASE_SUPPORTED_CODEC_PROFILE_LEVELS_MEMO_H_ + +#include <vector> + +#include "base/threading/thread_checker.h" +#include "chromecast/public/media/decoder_config.h" + +namespace chromecast { +namespace media { + +// Keeps a memo in the render process for a list of supported codecs and +// profiles obtained from the browser process. +// All calls should be made in the main renderer thread. +class SupportedCodecProfileLevelsMemo { + public: + SupportedCodecProfileLevelsMemo(); + ~SupportedCodecProfileLevelsMemo(); + void AddSupportedCodecProfileLevel(CodecProfileLevel codec_profile_level); + bool IsSupportedVideoConfig(VideoCodec codec, + VideoProfile profile, + int level) const; + + private: + std::vector<CodecProfileLevel> codec_profile_levels_; + const base::ThreadChecker thread_checker_; +}; + +} // namespace media +} // namespace chromecast + +#endif // CHROMECAST_MEDIA_BASE_SUPPORTED_CODEC_PROFILE_LEVELS_MEMO_H_
diff --git a/chromecast/media/base/supported_codec_profile_levels_memo_unittest.cc b/chromecast/media/base/supported_codec_profile_levels_memo_unittest.cc new file mode 100644 index 0000000..1f88800 --- /dev/null +++ b/chromecast/media/base/supported_codec_profile_levels_memo_unittest.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 "chromecast/media/base/supported_codec_profile_levels_memo.h" + +#include "chromecast/public/media/decoder_config.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromecast { +namespace media { + +class SupportedCodecProfileLevelsMemoTest : public ::testing::Test { + protected: + SupportedCodecProfileLevelsMemo memo_; +}; + +TEST_F(SupportedCodecProfileLevelsMemoTest, + IsSupportedVideoConfig_NoProfilesAdded) { + EXPECT_FALSE(memo_.IsSupportedVideoConfig(kCodecH264, kH264Baseline, 10)); + EXPECT_FALSE(memo_.IsSupportedVideoConfig(kCodecHEVC, kHEVCMain, 30)); + EXPECT_FALSE(memo_.IsSupportedVideoConfig(kCodecVP8, kVP8ProfileAny, 0)); + EXPECT_FALSE(memo_.IsSupportedVideoConfig(kCodecVP9, kVP9Profile0, 10)); +} + +TEST_F(SupportedCodecProfileLevelsMemoTest, + IsSupportedVideoConfig_ProfileAdded) { + memo_.AddSupportedCodecProfileLevel({kCodecH264, kH264Baseline, 10}); + EXPECT_TRUE(memo_.IsSupportedVideoConfig(kCodecH264, kH264Baseline, 10)); + EXPECT_FALSE(memo_.IsSupportedVideoConfig(kCodecH264, kH264Main, 10)); +} + +} // namespace media +} // namespace chromecast
diff --git a/chromecast/media/cma/BUILD.gn b/chromecast/media/cma/BUILD.gn index 7c8cb8b..3afa9f1 100644 --- a/chromecast/media/cma/BUILD.gn +++ b/chromecast/media/cma/BUILD.gn
@@ -2,6 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//chromecast/chromecast.gni") +import("//testing/test.gni") + # Targets may depend on this to bring in every CMA component. group("cma") { public_deps = [ @@ -10,3 +13,57 @@ "//chromecast/media/cma/pipeline", ] } + +test("cast_cma_unittests") { + sources = [ + "backend/audio_video_pipeline_device_unittest.cc", + "base/balanced_media_task_runner_unittest.cc", + "base/buffering_controller_unittest.cc", + "base/buffering_frame_provider_unittest.cc", + "base/decoder_buffer_adapter_unittest.cc", + "base/demuxer_stream_adapter_unittest.cc", + "base/demuxer_stream_for_test.cc", + "base/demuxer_stream_for_test.h", + "base/multi_demuxer_stream_adapter_unittest.cc", + "pipeline/audio_video_pipeline_impl_unittest.cc", + "test/frame_generator_for_test.cc", + "test/frame_generator_for_test.h", + "test/frame_segmenter_for_test.cc", + "test/frame_segmenter_for_test.h", + "test/mock_frame_consumer.cc", + "test/mock_frame_consumer.h", + "test/mock_frame_provider.cc", + "test/mock_frame_provider.h", + "test/mock_media_pipeline_backend.cc", + "test/mock_media_pipeline_backend.h", + "test/run_all_unittests.cc", + ] + + deps = [ + "//base", + "//base:i18n", + "//base/test:test_support", + "//chromecast/base", + "//chromecast/base/metrics:test_support", + "//chromecast/common/media:interfaces", + "//chromecast/media", + "//chromecast/media/audio", + "//chromecast/media/cma/backend", + "//chromecast/media/cma/base", + "//chromecast/media/cma/pipeline", + "//chromecast/public", + "//media", + "//media/base:test_support", + "//testing/gmock", + "//testing/gtest", + "//ui/display", + "//ui/gfx/geometry", + ] + + # MultizoneBackendTest verifies rendering delay reported by the backend. + # Since rendering delay is optional on video platforms, enable this test + # on audio devices only. + if (is_cast_audio_only && !is_cast_desktop_build) { + sources += [ "backend/multizone_backend_unittest.cc" ] + } +}
diff --git a/chromecast/media/cma/backend/BUILD.gn b/chromecast/media/cma/backend/BUILD.gn index 26bcf8f..73faff97 100644 --- a/chromecast/media/cma/backend/BUILD.gn +++ b/chromecast/media/cma/backend/BUILD.gn
@@ -25,12 +25,24 @@ ] if (is_android) { - sources += [ "cast_media_android.cc" ] + deps += [ ":cast_media_android" ] } else { deps += [ ":libcast_media_1.0" ] } } +source_set("cast_media_android") { + sources = [ + "cast_media_android.cc", + ] + deps = [ + "//base", + "//chromecast:chromecast_features", + "//chromecast/public", + "//chromecast/public/media", + ] +} + # Target for OEM partners to override media shared library, i.e. # libcast_media_1.0.so. This target is only used to build executables # with correct linkage information.
diff --git a/chromecast/media/cma/backend/cast_media_android.cc b/chromecast/media/cma/backend/cast_media_android.cc index 8546be7..4a5b952 100644 --- a/chromecast/media/cma/backend/cast_media_android.cc +++ b/chromecast/media/cma/backend/cast_media_android.cc
@@ -4,6 +4,7 @@ #include "base/logging.h" #include "chromecast/public/cast_media_shlib.h" +#include "chromecast/public/media/decoder_config.h" #include "chromecast/public/media/media_capabilities_shlib.h" #include "chromecast/public/media_codec_support_shlib.h" @@ -50,9 +51,10 @@ bool MediaCapabilitiesShlib::IsSupportedVideoConfig(VideoCodec codec, VideoProfile profile, int level) { - // TODO(sanfin): implement this. - LOG(INFO) << "IsSupportedVideoConfig not supported, returning true"; - return true; + // This should not be called directly. + NOTREACHED() << "Unexpected call to " + << "MediaCapabilitiesShlib::IsSupportedVideoConfig on Android"; + return false; } } // namespace media
diff --git a/chromecast/public/media/decoder_config.h b/chromecast/public/media/decoder_config.h index d490298..c9a9a0c 100644 --- a/chromecast/public/media/decoder_config.h +++ b/chromecast/public/media/decoder_config.h
@@ -80,7 +80,7 @@ kH264High444Predictive, kH264ScalableBaseline, kH264ScalableHigh, - kH264Stereohigh, + kH264StereoHigh, kH264MultiviewHigh, kVP8ProfileAny, kVP9Profile0, @@ -99,6 +99,12 @@ kVideoProfileMax = kHEVCMainStillPicture, }; +struct CodecProfileLevel { + VideoCodec codec; + VideoProfile profile; + int level; +}; + // Specification of whether and how the stream is encrypted (in whole or part). struct EncryptionScheme { // Algorithm and mode that was used to encrypt the stream.
diff --git a/chromecast/renderer/BUILD.gn b/chromecast/renderer/BUILD.gn index 50c72c9..58c44f02 100644 --- a/chromecast/renderer/BUILD.gn +++ b/chromecast/renderer/BUILD.gn
@@ -32,6 +32,7 @@ "//chromecast/common/media", "//chromecast/crash", "//chromecast/media", + "//chromecast/media/base", "//components/cdm/renderer", "//components/network_hints/renderer", "//content/public/common",
diff --git a/chromecast/renderer/cast_content_renderer_client.cc b/chromecast/renderer/cast_content_renderer_client.cc index f3e32af3..57089ad 100644 --- a/chromecast/renderer/cast_content_renderer_client.cc +++ b/chromecast/renderer/cast_content_renderer_client.cc
@@ -13,6 +13,7 @@ #include "chromecast/base/chromecast_switches.h" #include "chromecast/common/media/cast_media_client.h" #include "chromecast/crash/cast_crash_keys.h" +#include "chromecast/media/base/supported_codec_profile_levels_memo.h" #include "chromecast/renderer/cast_render_frame_action_deferrer.h" #include "chromecast/renderer/key_systems_cast.h" #include "chromecast/renderer/media/media_caps_observer_impl.h" @@ -44,7 +45,8 @@ } // namespace CastContentRendererClient::CastContentRendererClient() - : allow_hidden_media_playback_( + : supported_profiles_(new media::SupportedCodecProfileLevelsMemo()), + allow_hidden_media_playback_( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kAllowHiddenMediaPlayback)) { #if defined(OS_ANDROID) @@ -69,10 +71,11 @@ media::mojom::MediaCapsPtr media_caps; thread->GetRemoteInterfaces()->GetInterface(&media_caps); media::mojom::MediaCapsObserverPtr proxy; - media_caps_observer_.reset(new media::MediaCapsObserverImpl(&proxy)); + media_caps_observer_.reset( + new media::MediaCapsObserverImpl(&proxy, supported_profiles_.get())); media_caps->AddObserver(std::move(proxy)); - chromecast::media::CastMediaClient::Initialize(); + chromecast::media::CastMediaClient::Initialize(supported_profiles_.get()); prescient_networking_dispatcher_.reset( new network_hints::PrescientNetworkingDispatcher());
diff --git a/chromecast/renderer/cast_content_renderer_client.h b/chromecast/renderer/cast_content_renderer_client.h index dfbbedd7..ecc58a1 100644 --- a/chromecast/renderer/cast_content_renderer_client.h +++ b/chromecast/renderer/cast_content_renderer_client.h
@@ -5,6 +5,7 @@ #ifndef CHROMECAST_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ #define CHROMECAST_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ +#include <memory> #include <vector> #include "base/macros.h" @@ -18,6 +19,7 @@ namespace chromecast { namespace media { class MediaCapsObserverImpl; +class SupportedCodecProfileLevelsMemo; } namespace shell { @@ -52,6 +54,8 @@ std::unique_ptr<network_hints::PrescientNetworkingDispatcher> prescient_networking_dispatcher_; std::unique_ptr<media::MediaCapsObserverImpl> media_caps_observer_; + std::unique_ptr<media::SupportedCodecProfileLevelsMemo> supported_profiles_; + const bool allow_hidden_media_playback_; DISALLOW_COPY_AND_ASSIGN(CastContentRendererClient);
diff --git a/chromecast/renderer/media/media_caps_observer_impl.cc b/chromecast/renderer/media/media_caps_observer_impl.cc index 43c566d..d80ae37 100644 --- a/chromecast/renderer/media/media_caps_observer_impl.cc +++ b/chromecast/renderer/media/media_caps_observer_impl.cc
@@ -5,12 +5,16 @@ #include "chromecast/renderer/media/media_caps_observer_impl.h" #include "chromecast/media/base/media_caps.h" +#include "chromecast/media/base/supported_codec_profile_levels_memo.h" +#include "chromecast/public/media/decoder_config.h" namespace chromecast { namespace media { -MediaCapsObserverImpl::MediaCapsObserverImpl(mojom::MediaCapsObserverPtr* proxy) - : binding_(this, proxy) {} +MediaCapsObserverImpl::MediaCapsObserverImpl( + mojom::MediaCapsObserverPtr* proxy, + SupportedCodecProfileLevelsMemo* supported_profiles) + : supported_profiles_(supported_profiles), binding_(this, proxy) {} MediaCapsObserverImpl::~MediaCapsObserverImpl() = default; @@ -36,5 +40,15 @@ screen_height_mm, current_mode_supports_hdr, current_mode_supports_dv); } +void MediaCapsObserverImpl::AddSupportedCodecProfileLevel( + mojom::CodecProfileLevelPtr codec_profile_level) { + CodecProfileLevel converted_codec_profile_level( + {static_cast<VideoCodec>(codec_profile_level->codec), + static_cast<VideoProfile>(codec_profile_level->profile), + codec_profile_level->level}); + supported_profiles_->AddSupportedCodecProfileLevel( + converted_codec_profile_level); +} + } // namespace media } // namespace chromecast
diff --git a/chromecast/renderer/media/media_caps_observer_impl.h b/chromecast/renderer/media/media_caps_observer_impl.h index f70fd78..87238f63 100644 --- a/chromecast/renderer/media/media_caps_observer_impl.h +++ b/chromecast/renderer/media/media_caps_observer_impl.h
@@ -5,8 +5,11 @@ #ifndef CHROMECAST_RENDERER_MEDIA_MEDIA_CAPS_OBSERVER_IMPL_H_ #define CHROMECAST_RENDERER_MEDIA_MEDIA_CAPS_OBSERVER_IMPL_H_ +#include <memory> + #include "base/macros.h" #include "chromecast/common/media/media_caps.mojom.h" +#include "chromecast/media/base/supported_codec_profile_levels_memo.h" #include "mojo/public/cpp/bindings/binding.h" #include "ui/gfx/geometry/size.h" @@ -15,7 +18,8 @@ class MediaCapsObserverImpl : public mojom::MediaCapsObserver { public: - explicit MediaCapsObserverImpl(mojom::MediaCapsObserverPtr* proxy); + MediaCapsObserverImpl(mojom::MediaCapsObserverPtr* proxy, + SupportedCodecProfileLevelsMemo* supported_profiles); ~MediaCapsObserverImpl() override; private: @@ -29,7 +33,10 @@ int32_t screen_height_mm, bool current_mode_supports_hdr, bool current_mode_supports_dolby_vision) override; + void AddSupportedCodecProfileLevel( + mojom::CodecProfileLevelPtr codec_profile_level) override; + std::unique_ptr<SupportedCodecProfileLevelsMemo> supported_profiles_; mojo::Binding<mojom::MediaCapsObserver> binding_; DISALLOW_COPY_AND_ASSIGN(MediaCapsObserverImpl);
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index e6dc9b5..0b264cb 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc
@@ -68,6 +68,8 @@ // - none: ARC is not installed on this device. (default) // - installed: ARC is installed on this device, but not officially supported. // Users can enable ARC only when Finch experiment is turned on. +// - installed-only-kiosk-supported: ARC is installed, but officially supported +// only in kiosk mode. // - officially-supported: ARC is installed and supported on this device. So // users can enable ARC via settings etc. // - officially-supported-with-active-directory: ARC is supported and also
diff --git a/components/app_modal/javascript_app_modal_dialog.cc b/components/app_modal/javascript_app_modal_dialog.cc index 7a48f2a3..dd58080 100644 --- a/components/app_modal/javascript_app_modal_dialog.cc +++ b/components/app_modal/javascript_app_modal_dialog.cc
@@ -59,7 +59,7 @@ content::WebContents* web_contents, ExtraDataMap* extra_data_map, const base::string16& title, - content::JavaScriptMessageType javascript_message_type, + content::JavaScriptDialogType javascript_dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, bool display_suppress_checkbox, @@ -68,7 +68,7 @@ const content::JavaScriptDialogManager::DialogClosedCallback& callback) : AppModalDialog(web_contents, title), extra_data_map_(extra_data_map), - javascript_message_type_(javascript_message_type), + javascript_dialog_type_(javascript_dialog_type), display_suppress_checkbox_(display_suppress_checkbox), is_before_unload_dialog_(is_before_unload_dialog), is_reload_(is_reload),
diff --git a/components/app_modal/javascript_app_modal_dialog.h b/components/app_modal/javascript_app_modal_dialog.h index 0fb4d89978..a87febd 100644 --- a/components/app_modal/javascript_app_modal_dialog.h +++ b/components/app_modal/javascript_app_modal_dialog.h
@@ -40,7 +40,7 @@ content::WebContents* web_contents, ExtraDataMap* extra_data_map, const base::string16& title, - content::JavaScriptMessageType javascript_message_type, + content::JavaScriptDialogType javascript_dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, bool display_suppress_checkbox, @@ -67,8 +67,8 @@ void SetOverridePromptText(const base::string16& prompt_text); // Accessors - content::JavaScriptMessageType javascript_message_type() const { - return javascript_message_type_; + content::JavaScriptDialogType javascript_dialog_type() const { + return javascript_dialog_type_; } base::string16 message_text() const { return message_text_; } base::string16 default_prompt_text() const { return default_prompt_text_; } @@ -89,7 +89,7 @@ ExtraDataMap* extra_data_map_; // Information about the message box is held in the following variables. - const content::JavaScriptMessageType javascript_message_type_; + const content::JavaScriptDialogType javascript_dialog_type_; base::string16 message_text_; base::string16 default_prompt_text_; bool display_suppress_checkbox_;
diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc index 54f3afb4..0faed48e 100644 --- a/components/app_modal/javascript_dialog_manager.cc +++ b/components/app_modal/javascript_dialog_manager.cc
@@ -19,7 +19,7 @@ #include "components/app_modal/native_app_modal_dialog.h" #include "components/url_formatter/elide_url.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/font_list.h" @@ -128,11 +128,11 @@ void JavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, - bool* did_suppress_message) { + bool* did_suppress_message) { *did_suppress_message = false; ChromeJavaScriptDialogExtraData* extra_data = @@ -183,12 +183,8 @@ LogUMAMessageLengthStats(message_text); AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( - web_contents, - &javascript_dialog_extra_data_, - dialog_title, - message_type, - message_text, - default_prompt_text, + web_contents, &javascript_dialog_extra_data_, dialog_title, dialog_type, + message_text, default_prompt_text, ShouldDisplaySuppressCheckbox(extra_data), false, // is_before_unload_dialog false, // is_reload @@ -232,14 +228,11 @@ extensions_client_->OnDialogOpened(web_contents); AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( - web_contents, - &javascript_dialog_extra_data_, - title, - content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, - message, + web_contents, &javascript_dialog_extra_data_, title, + content::JAVASCRIPT_DIALOG_TYPE_CONFIRM, message, base::string16(), // default_prompt_text ShouldDisplaySuppressCheckbox(extra_data), - true, // is_before_unload_dialog + true, // is_before_unload_dialog is_reload, base::Bind(&JavaScriptDialogManager::OnBeforeUnloadDialogClosed, base::Unretained(this), web_contents, callback)));
diff --git a/components/app_modal/javascript_dialog_manager.h b/components/app_modal/javascript_dialog_manager.h index b5f0a97..23212628 100644 --- a/components/app_modal/javascript_dialog_manager.h +++ b/components/app_modal/javascript_dialog_manager.h
@@ -44,7 +44,7 @@ // JavaScriptDialogManager: void RunJavaScriptDialog(content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/components/app_modal/views/javascript_app_modal_dialog_views.cc b/components/app_modal/views/javascript_app_modal_dialog_views.cc index a56abe2..eec5d89 100644 --- a/components/app_modal/views/javascript_app_modal_dialog_views.cc +++ b/components/app_modal/views/javascript_app_modal_dialog_views.cc
@@ -24,8 +24,8 @@ JavaScriptAppModalDialog* parent) : parent_(parent) { int options = views::MessageBoxView::DETECT_DIRECTIONALITY; - if (parent->javascript_message_type() == - content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) + if (parent->javascript_dialog_type() == + content::JAVASCRIPT_DIALOG_TYPE_PROMPT) options |= views::MessageBoxView::HAS_PROMPT_FIELD; views::MessageBoxView::InitParams params(parent->message_text()); @@ -85,8 +85,8 @@ } int JavaScriptAppModalDialogViews::GetDialogButtons() const { - if (parent_->javascript_message_type() == - content::JAVASCRIPT_MESSAGE_TYPE_ALERT) + if (parent_->javascript_dialog_type() == + content::JAVASCRIPT_DIALOG_TYPE_ALERT) return ui::DIALOG_BUTTON_OK; return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
diff --git a/components/arc/arc_util.cc b/components/arc/arc_util.cc index 32d9700..bb876f0 100644 --- a/components/arc/arc_util.cc +++ b/components/arc/arc_util.cc
@@ -24,6 +24,8 @@ // Possible values for --arc-availability flag. constexpr char kAvailabilityNone[] = "none"; constexpr char kAvailabilityInstalled[] = "installed"; +constexpr char kAvailabilityInstalledOnlyKioskSupported[] = + "installed-only-kiosk-supported"; constexpr char kAvailabilityOfficiallySupported[] = "officially-supported"; constexpr char kAvailabilityOfficiallySupportedWithActiveDirectory[] = "officially-supported-with-active-directory"; @@ -36,13 +38,16 @@ if (command_line->HasSwitch(chromeos::switches::kArcAvailability)) { std::string value = command_line->GetSwitchValueASCII( chromeos::switches::kArcAvailability); - DCHECK(value == kAvailabilityNone || value == kAvailabilityInstalled || + DCHECK(value == kAvailabilityNone || + value == kAvailabilityInstalled || + value == kAvailabilityInstalledOnlyKioskSupported || value == kAvailabilityOfficiallySupported || value == kAvailabilityOfficiallySupportedWithActiveDirectory) << "Unknown flag value: " << value; return value == kAvailabilityOfficiallySupported || value == kAvailabilityOfficiallySupportedWithActiveDirectory || - (value == kAvailabilityInstalled && + ((value == kAvailabilityInstalled || + value == kAvailabilityInstalledOnlyKioskSupported) && base::FeatureList::IsEnabled(kEnableArcFeature)); } @@ -54,13 +59,28 @@ base::FeatureList::IsEnabled(kEnableArcFeature)); } +bool IsArcKioskAvailable() { + const auto* command_line = base::CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(chromeos::switches::kArcAvailability)) { + std::string value = + command_line->GetSwitchValueASCII(chromeos::switches::kArcAvailability); + if (value == kAvailabilityInstalledOnlyKioskSupported) + return true; + } + + // If not special kiosk device case, use general ARC check. + return IsArcAvailable(); +} + void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line) { command_line->AppendSwitchASCII(chromeos::switches::kArcAvailability, kAvailabilityOfficiallySupported); } bool IsArcKioskMode() { - return user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp(); + return user_manager::UserManager::IsInitialized() && + user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp(); } bool IsArcAllowedForActiveDirectoryUsers() {
diff --git a/components/arc/arc_util.h b/components/arc/arc_util.h index 30fbd3e..eb31c076 100644 --- a/components/arc/arc_util.h +++ b/components/arc/arc_util.h
@@ -26,6 +26,17 @@ // check, so it is ok to access them directly. bool IsArcAvailable(); +// Returns true if ARC is installed and running ARC kiosk apps on the current +// device is officially supported. +// It doesn't follow that ARC is available for user sessions and +// IsArcAvailable() will return true, although the reverse should be. +// This is used to distinguish special cases when ARC kiosk is available on +// the device, but is not yet supported for regular user sessions. +// In most cases, IsArcAvailable() check should be used instead of this. +// Also not that this function may return true when ARC is not running in +// Kiosk mode, it checks only ARC Kiosk availability. +bool IsArcKioskAvailable(); + // For testing ARC in browser tests, this function should be called in // SetUpCommandLine(), and its argument should be passed to this function. // Also, in unittests, this can be called in SetUp() with @@ -33,7 +44,10 @@ // |command_line| must not be nullptr. void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line); -// Returns true if ARC should run under Kiosk mode. +// Returns true if ARC should run under Kiosk mode for the current profile. +// As it can return true only when user is already initialized, it implies +// that ARC availability was checked before and IsArcKioskAvailable() +// should also return true in that case. bool IsArcKioskMode(); // Returns true if it is allowed to use ARC with Active Directory managed
diff --git a/components/arc/arc_util_unittest.cc b/components/arc/arc_util_unittest.cc index 9796e911..dd803cbb 100644 --- a/components/arc/arc_util_unittest.cc +++ b/components/arc/arc_util_unittest.cc
@@ -61,14 +61,17 @@ // Not available, by-default. EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); { ScopedArcFeature feature(true); EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); } { ScopedArcFeature feature(false); EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); } // If ARC is installed, IsArcAvailable() should return true when EnableARC @@ -77,14 +80,17 @@ // Not available, by-default, too. EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); { ScopedArcFeature feature(true); EXPECT_TRUE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); } { ScopedArcFeature feature(false); EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); } // If ARC is installed, IsArcAvailable() should return true when EnableARC @@ -93,25 +99,43 @@ // Not available, by-default, too. EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); { ScopedArcFeature feature(true); EXPECT_TRUE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); } { ScopedArcFeature feature(false); EXPECT_FALSE(IsArcAvailable()); + EXPECT_FALSE(IsArcKioskAvailable()); } } +TEST_F(ArcUtilTest, IsArcAvailable_OnlyKioskSupported) { + // Regardless of FeatureList, IsArcAvailable() should return true. + auto* command_line = base::CommandLine::ForCurrentProcess(); + command_line->InitFromArgv({"", "--enable-arc"}); + EXPECT_TRUE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); + + command_line->InitFromArgv( + {"", "--arc-availability=installed-only-kiosk-supported"}); + EXPECT_FALSE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); +} + TEST_F(ArcUtilTest, IsArcAvailable_OfficiallySupported) { // Regardless of FeatureList, IsArcAvailable() should return true. auto* command_line = base::CommandLine::ForCurrentProcess(); command_line->InitFromArgv({"", "--enable-arc"}); EXPECT_TRUE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); command_line->InitFromArgv({"", "--arc-availability=officially-supported"}); EXPECT_TRUE(IsArcAvailable()); + EXPECT_TRUE(IsArcKioskAvailable()); } TEST_F(ArcUtilTest, IsArcAvailable_OfficiallySupportedWithActiveDirectory) {
diff --git a/components/autofill/core/browser/autofill_assistant.cc b/components/autofill/core/browser/autofill_assistant.cc index 4fccc2a..3e463b6 100644 --- a/components/autofill/core/browser/autofill_assistant.cc +++ b/components/autofill/core/browser/autofill_assistant.cc
@@ -31,8 +31,7 @@ !IsAutofillCreditCardAssistEnabled() || // Context of the page is not secure or target URL is valid but not // secure. - !(autofill_manager_->client()->IsContextSecure( - form_structures.front()->source_url()) && + !(autofill_manager_->client()->IsContextSecure() && (!form_structures.front()->target_url().is_valid() || !form_structures.front()->target_url().SchemeIs("http")))) { return false;
diff --git a/components/autofill/core/browser/autofill_client.h b/components/autofill/core/browser/autofill_client.h index 041d62b3a..3960f44 100644 --- a/components/autofill/core/browser/autofill_client.h +++ b/components/autofill/core/browser/autofill_client.h
@@ -17,7 +17,6 @@ #include "ui/base/window_open_disposition.h" #include "url/gurl.h" -class GURL; class IdentityProvider; class PrefService; @@ -181,7 +180,7 @@ virtual void OnFirstUserGestureObserved() = 0; // If the context is secure. - virtual bool IsContextSecure(const GURL& form_origin) = 0; + virtual bool IsContextSecure() = 0; // Whether it is appropriate to show a signin promo for this user. virtual bool ShouldShowSigninPromo() = 0;
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 87c8d54..ec67d0c 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -534,7 +534,7 @@ } bool AutofillManager::IsFormNonSecure(const FormData& form) const { - return !client_->IsContextSecure(form.origin) || + return !client_->IsContextSecure() || (form.action.is_valid() && form.action.SchemeIs("http")); } @@ -575,7 +575,6 @@ std::vector<Suggestion> suggestions; const bool is_context_secure = !IsFormNonSecure(form); - const bool is_http_warning_enabled = security_state::IsHttpWarningInFormEnabled(); @@ -1474,6 +1473,8 @@ is_server_data_available); credit_card_form_event_logger_->set_is_local_data_available( is_local_data_available); + credit_card_form_event_logger_->set_is_context_secure( + client_->IsContextSecure()); } { bool is_server_data_available = false;
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index 219ef8e..255d18b7 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -5370,6 +5370,7 @@ CreateTestCreditCardFormData(&form, false, false); form.origin = GURL("http://myform.com/form.html"); form.action = GURL("https://myform.com/submit.html"); + autofill_client_.set_form_origin(form.origin); std::vector<FormData> forms(1, form); FormsSeen(forms);
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index 707e3f8..3300b67 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -693,6 +693,7 @@ : is_for_credit_card_(is_for_credit_card), is_server_data_available_(false), is_local_data_available_(false), + is_context_secure_(false), has_logged_interacted_(false), has_logged_suggestions_shown_(false), has_logged_masked_server_card_suggestion_selected_(false), @@ -700,8 +701,7 @@ has_logged_will_submit_(false), has_logged_submitted_(false), logged_suggestion_filled_was_server_data_(false), - logged_suggestion_filled_was_masked_server_card_(false) { -} + logged_suggestion_filled_was_masked_server_card_(false) {} void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { if (!has_logged_interacted_) { @@ -870,6 +870,14 @@ name += "Address"; LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); + // Log again in a different histogram for credit card forms on nonsecure + // pages, so that form interactions on nonsecure pages can be analyzed on + // their own. + if (is_for_credit_card_ && !is_context_secure_) { + LogUMAHistogramEnumeration(name + ".OnNonsecurePage", event, + NUM_FORM_EVENTS); + } + // Logging again in a different histogram for segmentation purposes. // TODO(waltercacau): Re-evaluate if we still need such fine grained // segmentation. http://crbug.com/454018
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index 32bc42db..4127e9cd0 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h
@@ -694,6 +694,10 @@ is_local_data_available_ = is_local_data_available; } + inline void set_is_context_secure(bool is_context_secure) { + is_context_secure_ = is_context_secure; + } + void OnDidInteractWithAutofillableForm(); void OnDidPollSuggestions(const FormFieldData& field); @@ -718,6 +722,7 @@ bool is_for_credit_card_; bool is_server_data_available_; bool is_local_data_available_; + bool is_context_secure_; bool has_logged_interacted_; bool has_logged_suggestions_shown_; bool has_logged_masked_server_card_suggestion_selected_;
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index cdf459e..b0928c0 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -1877,6 +1877,7 @@ form.name = ASCIIToUTF16("TestForm"); form.origin = GURL("http://example.com/form.html"); form.action = GURL("http://example.com/submit.html"); + autofill_client_.set_form_origin(form.origin); FormFieldData field; std::vector<ServerFieldType> field_types; @@ -1910,6 +1911,7 @@ autofill_manager_->Reset(); form.origin = GURL("https://example.com/form.html"); form.action = GURL("https://example.com/submit.html"); + autofill_client_.set_form_origin(form.origin); autofill_manager_->AddSeenForm(form, field_types, field_types); // Simulate an Autofill query on a credit card field (HTTPS form). @@ -4226,4 +4228,116 @@ "Autofill_ShowedHttpNotSecureExplanation")); } +// Tests that credit card form submissions are logged specially when the form is +// on a non-secure page. +TEST_F(AutofillMetricsTest, NonsecureCreditCardForm) { + personal_data_->RecreateCreditCards( + true /* include_local_credit_card */, + false /* include_masked_server_credit_card */, + false /* include_full_server_credit_card */); + + // Set up our form data. + FormData form; + form.name = ASCIIToUTF16("TestForm"); + form.origin = GURL("http://example.com/form.html"); + form.action = GURL("http://example.com/submit.html"); + autofill_client_.set_form_origin(form.origin); + + FormFieldData field; + std::vector<ServerFieldType> field_types; + test::CreateTestFormField("Name on card", "cc-name", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_NAME_FULL); + test::CreateTestFormField("Credit card", "card", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_NUMBER); + test::CreateTestFormField("Month", "card_month", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_EXP_MONTH); + + // Simulate having seen this form on page load. + // |form_structure| will be owned by |autofill_manager_|. + autofill_manager_->AddSeenForm(form, field_types, field_types); + + // Simulate an Autofill query on a credit card field. + { + base::UserActionTester user_action_tester; + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + EXPECT_EQ(1, user_action_tester.GetActionCount( + "Autofill_PolledCreditCardSuggestions")); + } + + // Simulate submitting the credit card form. + { + base::HistogramTester histograms; + autofill_manager_->SubmitForm(form, TimeTicks::Now()); + histograms.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.OnNonsecurePage", + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); + histograms.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); + histograms.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.WithOnlyLocalData", + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); + } +} + +// Tests that credit card form submissions are *not* logged specially when the +// form is *not* on a non-secure page. +TEST_F(AutofillMetricsTest, + NonsecureCreditCardFormMetricsNotRecordedOnSecurePage) { + personal_data_->RecreateCreditCards( + true /* include_local_credit_card */, + false /* include_masked_server_credit_card */, + false /* include_full_server_credit_card */); + + // Set up our form data. + FormData form; + form.name = ASCIIToUTF16("TestForm"); + form.origin = GURL("https://example.com/form.html"); + form.action = GURL("http://example.com/submit.html"); + + FormFieldData field; + std::vector<ServerFieldType> field_types; + test::CreateTestFormField("Name on card", "cc-name", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_NAME_FULL); + test::CreateTestFormField("Credit card", "card", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_NUMBER); + test::CreateTestFormField("Month", "card_month", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(CREDIT_CARD_EXP_MONTH); + + // Simulate having seen this form on page load. + // |form_structure| will be owned by |autofill_manager_|. + autofill_manager_->AddSeenForm(form, field_types, field_types); + + // Simulate an Autofill query on a credit card field. + { + base::UserActionTester user_action_tester; + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + EXPECT_EQ(1, user_action_tester.GetActionCount( + "Autofill_PolledCreditCardSuggestions")); + } + + // Simulate submitting the credit card form. + { + base::HistogramTester histograms; + autofill_manager_->SubmitForm(form, TimeTicks::Now()); + histograms.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE, 1); + histograms.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE, 1); + // Check that the nonsecure histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ( + 0, histograms.GetTotalCountsForPrefix("Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.OnNonsecurePage"]); + } +} + } // namespace autofill
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc index 32d6545..5b002bc 100644 --- a/components/autofill/core/browser/credit_card.cc +++ b/components/autofill/core/browser/credit_card.cc
@@ -664,50 +664,6 @@ AutofillClock::Now()); } -void CreditCard::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { - supported_types->insert(CREDIT_CARD_NAME_FULL); - supported_types->insert(CREDIT_CARD_NAME_FIRST); - supported_types->insert(CREDIT_CARD_NAME_LAST); - supported_types->insert(CREDIT_CARD_NUMBER); - supported_types->insert(CREDIT_CARD_TYPE); - supported_types->insert(CREDIT_CARD_EXP_MONTH); - supported_types->insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); - supported_types->insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); - supported_types->insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); - supported_types->insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); -} - -base::string16 CreditCard::ExpirationMonthAsString() const { - if (expiration_month_ == 0) - return base::string16(); - - base::string16 month = base::IntToString16(expiration_month_); - if (expiration_month_ >= 10) - return month; - - base::string16 zero = ASCIIToUTF16("0"); - zero.append(month); - return zero; -} - -base::string16 CreditCard::TypeForFill() const { - return ::autofill::TypeForFill(type_); -} - -base::string16 CreditCard::Expiration4DigitYearAsString() const { - if (expiration_year_ == 0) - return base::string16(); - - return base::IntToString16(Expiration4DigitYear()); -} - -base::string16 CreditCard::Expiration2DigitYearAsString() const { - if (expiration_year_ == 0) - return base::string16(); - - return base::IntToString16(Expiration2DigitYear()); -} - bool CreditCard::SetExpirationMonthFromString(const base::string16& text, const std::string& app_locale) { base::string16 trimmed; @@ -775,6 +731,50 @@ SetExpirationYear(num); } +void CreditCard::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { + supported_types->insert(CREDIT_CARD_NAME_FULL); + supported_types->insert(CREDIT_CARD_NAME_FIRST); + supported_types->insert(CREDIT_CARD_NAME_LAST); + supported_types->insert(CREDIT_CARD_NUMBER); + supported_types->insert(CREDIT_CARD_TYPE); + supported_types->insert(CREDIT_CARD_EXP_MONTH); + supported_types->insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); + supported_types->insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); + supported_types->insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); + supported_types->insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); +} + +base::string16 CreditCard::ExpirationMonthAsString() const { + if (expiration_month_ == 0) + return base::string16(); + + base::string16 month = base::IntToString16(expiration_month_); + if (expiration_month_ >= 10) + return month; + + base::string16 zero = ASCIIToUTF16("0"); + zero.append(month); + return zero; +} + +base::string16 CreditCard::TypeForFill() const { + return ::autofill::TypeForFill(type_); +} + +base::string16 CreditCard::Expiration4DigitYearAsString() const { + if (expiration_year_ == 0) + return base::string16(); + + return base::IntToString16(Expiration4DigitYear()); +} + +base::string16 CreditCard::Expiration2DigitYearAsString() const { + if (expiration_year_ == 0) + return base::string16(); + + return base::IntToString16(Expiration2DigitYear()); +} + void CreditCard::SetNumber(const base::string16& number) { number_ = number;
diff --git a/components/autofill/core/browser/credit_card.h b/components/autofill/core/browser/credit_card.h index d0a8a6ee..47d06f18 100644 --- a/components/autofill/core/browser/credit_card.h +++ b/components/autofill/core/browser/credit_card.h
@@ -196,6 +196,20 @@ billing_address_id_ = id; } + // Sets |expiration_month_| to the integer conversion of |text| and returns + // whether the operation was successful. + bool SetExpirationMonthFromString(const base::string16& text, + const std::string& app_locale); + + // Sets |expiration_year_| to the integer conversion of |text|. Will handle + // 4-digit year or 2-digit year (eventually converted to 4-digit year). + void SetExpirationYearFromString(const base::string16& text); + + // Sets |expiration_year_| and |expiration_month_| to the integer conversion + // of |text|. Will handle mmyy, mmyyyy, mm-yyyy and mm-yy as well as single + // digit months, with various separators. + void SetExpirationDateFromString(const base::string16& text); + private: FRIEND_TEST_ALL_PREFIXES(CreditCardTest, SetExpirationDateFromString); FRIEND_TEST_ALL_PREFIXES(CreditCardTest, SetExpirationYearFromString); @@ -213,20 +227,6 @@ base::string16 Expiration4DigitYearAsString() const; base::string16 Expiration2DigitYearAsString() const; - // Sets |expiration_month_| to the integer conversion of |text| and returns - // whether the operation was successful. - bool SetExpirationMonthFromString(const base::string16& text, - const std::string& app_locale); - - // Sets |expiration_year_| to the integer conversion of |text|. Will handle - // 4-digit year or 2-digit year (eventually converted to 4-digit year). - void SetExpirationYearFromString(const base::string16& text); - - // Sets |expiration_year_| and |expiration_month_| to the integer conversion - // of |text|. Will handle mmyy, mmyyyy, mm-yyyy and mm-yy as well as single - // digit months, with various separators. - void SetExpirationDateFromString(const base::string16& text); - // See enum definition above. RecordType record_type_;
diff --git a/components/autofill/core/browser/test_autofill_client.cc b/components/autofill/core/browser/test_autofill_client.cc index 9989e0a..7df6c300 100644 --- a/components/autofill/core/browser/test_autofill_client.cc +++ b/components/autofill/core/browser/test_autofill_client.cc
@@ -11,7 +11,8 @@ TestAutofillClient::TestAutofillClient() : token_service_(new FakeOAuth2TokenService()), identity_provider_(new FakeIdentityProvider(token_service_.get())), - rappor_service_(new rappor::TestRapporServiceImpl()) {} + rappor_service_(new rappor::TestRapporServiceImpl()), + form_origin_(GURL("https://example.test")) {} TestAutofillClient::~TestAutofillClient() { } @@ -115,9 +116,9 @@ void TestAutofillClient::OnFirstUserGestureObserved() { } -bool TestAutofillClient::IsContextSecure(const GURL& form_origin) { +bool TestAutofillClient::IsContextSecure() { // Simplified secure context check for tests. - return form_origin.SchemeIs("https"); + return form_origin_.SchemeIs("https"); } bool TestAutofillClient::ShouldShowSigninPromo() {
diff --git a/components/autofill/core/browser/test_autofill_client.h b/components/autofill/core/browser/test_autofill_client.h index 95311d7..72cdd8c3 100644 --- a/components/autofill/core/browser/test_autofill_client.h +++ b/components/autofill/core/browser/test_autofill_client.h
@@ -67,7 +67,10 @@ void DidFillOrPreviewField(const base::string16& autofilled_value, const base::string16& profile_full_name) override; void OnFirstUserGestureObserved() override; - bool IsContextSecure(const GURL& form_origin) override; + // By default, TestAutofillClient will report that the context is + // secure. This can be adjusted by calling set_form_origin() with an + // http:// URL. + bool IsContextSecure() override; bool ShouldShowSigninPromo() override; void StartSigninFlow() override; void ShowHttpNotSecureExplanation() override; @@ -80,12 +83,15 @@ return rappor_service_.get(); } + void set_form_origin(const GURL& url) { form_origin_ = url; } + private: // NULL by default. std::unique_ptr<PrefService> prefs_; std::unique_ptr<FakeOAuth2TokenService> token_service_; std::unique_ptr<FakeIdentityProvider> identity_provider_; std::unique_ptr<rappor::TestRapporServiceImpl> rappor_service_; + GURL form_origin_; DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); };
diff --git a/components/autofill/core/browser/validation.cc b/components/autofill/core/browser/validation.cc index 15a96e6a..10e0b21 100644 --- a/components/autofill/core/browser/validation.cc +++ b/components/autofill/core/browser/validation.cc
@@ -13,7 +13,10 @@ #include "base/time/time.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/state_names.h" +#include "components/autofill/core/common/autofill_clock.h" #include "components/autofill/core/common/autofill_regexes.h" +#include "grit/components_strings.h" +#include "ui/base/l10n/l10n_util.h" namespace autofill { @@ -174,4 +177,112 @@ return true; } +bool IsValidForType(const base::string16& value, + ServerFieldType type, + base::string16* error_message) { + switch (type) { + case CREDIT_CARD_NAME_FULL: + if (!value.empty()) + return true; + + if (error_message) { + *error_message = + l10n_util::GetStringUTF16(IDS_PAYMENTS_VALIDATION_INVALID_NAME); + } + break; + + case CREDIT_CARD_EXP_MONTH: { + CreditCard temp; + // Expiration month was in an invalid format. + temp.SetExpirationMonthFromString(value, /* app_locale= */ std::string()); + if (temp.expiration_month() == 0) { + if (error_message) { + *error_message = l10n_util::GetStringUTF16( + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_MONTH); + } + break; + } + return true; + } + + case CREDIT_CARD_EXP_2_DIGIT_YEAR: + case CREDIT_CARD_EXP_4_DIGIT_YEAR: { + CreditCard temp; + temp.SetExpirationYearFromString(value); + // Expiration year was in an invalid format. + if ((temp.expiration_year() == 0) || + (type == CREDIT_CARD_EXP_2_DIGIT_YEAR && value.size() != 2u) || + (type == CREDIT_CARD_EXP_4_DIGIT_YEAR && value.size() != 4u)) { + if (error_message) { + *error_message = l10n_util::GetStringUTF16( + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR); + } + break; + } + + base::Time::Exploded now_exploded; + AutofillClock::Now().LocalExplode(&now_exploded); + if (temp.expiration_year() >= now_exploded.year) + return true; + + // If the year is before this year, it's expired. + if (error_message) { + *error_message = l10n_util::GetStringUTF16( + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED); + } + break; + } + + case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: + case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: { + const base::string16 pattern = + type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR + ? base::UTF8ToUTF16("^[0-9]{1,2}[-/|]?[0-9]{2}$") + : base::UTF8ToUTF16("^[0-9]{1,2}[-/|]?[0-9]{4}$"); + + CreditCard temp; + temp.SetExpirationDateFromString(value); + + // Expiration date was in an invalid format. + if (temp.expiration_month() == 0 || temp.expiration_year() == 0 || + !MatchesPattern(value, pattern)) { + if (error_message) { + *error_message = l10n_util::GetStringUTF16( + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE); + } + break; + } + + // Checking for card expiration. + if (IsValidCreditCardExpirationDate(temp.expiration_year(), + temp.expiration_month(), + AutofillClock::Now())) { + return true; + } + + if (error_message) { + *error_message = l10n_util::GetStringUTF16( + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED); + } + break; + } + + case CREDIT_CARD_NUMBER: + if (IsValidCreditCardNumber(value)) + return true; + + if (error_message) + *error_message = + l10n_util::GetStringUTF16(IDS_PAYMENTS_CARD_NUMBER_INVALID); + break; + + default: + // Other types such as CREDIT_CARD_TYPE and CREDIT_CARD_VERIFICATION_CODE + // are not validated for now. + NOTREACHED() << "Attempting to validate unsupported type " << type; + break; + } + return false; +} + } // namespace autofill
diff --git a/components/autofill/core/browser/validation.h b/components/autofill/core/browser/validation.h index a09ae75c..88db88b 100644 --- a/components/autofill/core/browser/validation.h +++ b/components/autofill/core/browser/validation.h
@@ -7,6 +7,7 @@ #include "base/strings/string16.h" #include "base/strings/string_piece.h" +#include "components/autofill/core/browser/field_types.h" namespace base { class Time; @@ -43,6 +44,12 @@ // Returns true if |text| looks like an SSN, with or without separators. bool IsSSN(const base::string16& text); +// Returns whether |value| is valid for the given |type|. If not null, +// |error_message| is populated when the function returns false. +bool IsValidForType(const base::string16& value, + ServerFieldType type, + base::string16* error_message); + } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_
diff --git a/components/autofill/core/browser/validation_unittest.cc b/components/autofill/core/browser/validation_unittest.cc index 798f5346..4a53c84 100644 --- a/components/autofill/core/browser/validation_unittest.cc +++ b/components/autofill/core/browser/validation_unittest.cc
@@ -2,14 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/autofill/core/browser/validation.h" + #include <stddef.h> #include "base/macros.h" +#include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "components/autofill/core/browser/credit_card.h" -#include "components/autofill/core/browser/validation.h" +#include "components/autofill/core/browser/field_types.h" +#include "grit/components_strings.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util.h" using base::ASCIIToUTF16; @@ -148,4 +153,203 @@ } } +struct ValidationCase { + ValidationCase(const char* value, + ServerFieldType field_type, + bool expected_valid, + int expected_error_id) + : value(value), + field_type(field_type), + expected_valid(expected_valid), + expected_error_id(expected_error_id) {} + ~ValidationCase() {} + + const char* const value; + const ServerFieldType field_type; + const bool expected_valid; + const int expected_error_id; +}; + +class AutofillTypeValidationTest + : public testing::TestWithParam<ValidationCase> {}; + +TEST_P(AutofillTypeValidationTest, IsValidForType) { + base::string16 error_message; + EXPECT_EQ(GetParam().expected_valid, + IsValidForType(ASCIIToUTF16(GetParam().value), + GetParam().field_type, &error_message)) + << "Failed to validate " << GetParam().value << " (type " + << GetParam().field_type << ")"; + if (!GetParam().expected_valid) { + EXPECT_EQ(l10n_util::GetStringUTF16(GetParam().expected_error_id), + error_message); + } +} + +INSTANTIATE_TEST_CASE_P( + CreditCardExpDate, + AutofillTypeValidationTest, + testing::Values( + ValidationCase("05/2087", CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, true, 0), + ValidationCase("05-2087", CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, true, 0), + ValidationCase("052087", CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, true, 0), + ValidationCase("05|2087", CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, true, 0), + + ValidationCase("05/2012", + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), + ValidationCase("MM/2012", + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE), + ValidationCase("05/12", + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE), + ValidationCase("05/45", + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE), + ValidationCase("05/1987", + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE), + + ValidationCase("05/87", CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, true, 0), + ValidationCase("05-87", CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, true, 0), + ValidationCase("0587", CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, true, 0), + ValidationCase("05|87", CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, true, 0), + ValidationCase("05/1987", + CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE), + ValidationCase("05/12", + CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED))); + +INSTANTIATE_TEST_CASE_P( + CreditCardNumber, + AutofillTypeValidationTest, + testing::Values( + ValidationCase(kValidNumbers[0], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[1], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[2], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[3], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[4], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[5], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[6], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[7], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[8], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[9], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[10], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[11], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[12], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[13], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[14], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[15], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[16], CREDIT_CARD_NUMBER, true, 0), + ValidationCase(kValidNumbers[17], CREDIT_CARD_NUMBER, true, 0), + + ValidationCase(kInvalidNumbers[0], + CREDIT_CARD_NUMBER, + false, + IDS_PAYMENTS_CARD_NUMBER_INVALID), + ValidationCase(kInvalidNumbers[1], + CREDIT_CARD_NUMBER, + false, + IDS_PAYMENTS_CARD_NUMBER_INVALID), + ValidationCase(kInvalidNumbers[2], + CREDIT_CARD_NUMBER, + false, + IDS_PAYMENTS_CARD_NUMBER_INVALID), + ValidationCase(kInvalidNumbers[3], + CREDIT_CARD_NUMBER, + false, + IDS_PAYMENTS_CARD_NUMBER_INVALID))); + +INSTANTIATE_TEST_CASE_P( + CreditCardMonth, + AutofillTypeValidationTest, + testing::Values( + ValidationCase("01", CREDIT_CARD_EXP_MONTH, true, 0), + ValidationCase("1", CREDIT_CARD_EXP_MONTH, true, 0), + ValidationCase("12", CREDIT_CARD_EXP_MONTH, true, 0), + ValidationCase( + "0", + CREDIT_CARD_EXP_MONTH, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_MONTH), + ValidationCase( + "-1", + CREDIT_CARD_EXP_MONTH, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_MONTH), + ValidationCase( + "13", + CREDIT_CARD_EXP_MONTH, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_MONTH))); + +INSTANTIATE_TEST_CASE_P( + CreditCardYear, + AutofillTypeValidationTest, + testing::Values( + /* 2-digit year */ + ValidationCase("87", CREDIT_CARD_EXP_2_DIGIT_YEAR, true, 0), + // These are considered expired in the context of this millenium. + ValidationCase("02", + CREDIT_CARD_EXP_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), + ValidationCase("15", + CREDIT_CARD_EXP_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), + // Invalid formats. + ValidationCase( + "1", + CREDIT_CARD_EXP_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR), + ValidationCase( + "123", + CREDIT_CARD_EXP_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR), + ValidationCase( + "2087", + CREDIT_CARD_EXP_2_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR), + + /* 4-digit year */ + ValidationCase("2087", CREDIT_CARD_EXP_4_DIGIT_YEAR, true, 0), + // Expired. + ValidationCase("2000", + CREDIT_CARD_EXP_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), + ValidationCase("2015", + CREDIT_CARD_EXP_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), + // Invalid formats. + ValidationCase( + "00", + CREDIT_CARD_EXP_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR), + ValidationCase( + "123", + CREDIT_CARD_EXP_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR), + ValidationCase( + "87", + CREDIT_CARD_EXP_4_DIGIT_YEAR, + false, + IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR))); + } // namespace autofill
diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp index 6aedacd..018f5cae 100644 --- a/components/autofill_strings.grdp +++ b/components/autofill_strings.grdp
@@ -318,24 +318,4 @@ <message name="IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC" desc="The placeholder/label text for credit card verification code in the requestAutocomplete dialog."> CVC </message> - - <!-- Payment Request --> - <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME" desc="The name of the Order Summary section in the Payment Sheet of the Payment Request dialog."> - Order summary - </message> - <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT" desc="The format specifier of the Total label in the Order Summary section of the Payment Sheet of the Payment Request dialog."> - <ph name="TOTAL_LABEL">$1<ex>Total</ex></ph> <ph name="CURRENCY_CODE">$2<ex>USD</ex></ph> <ph name="FORMATTED_TOTAL_AMOUNT">$3<ex>$ 12.34</ex></ph> - </message> - <message name="IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME" desc="The name of the Payment Method section in the Payment Sheet of the Payment Request dialog."> - Payment - </message> - <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SHEET_TOTAL_FORMAT" desc="The format specifier of the Total label in the Order Summary Sheet of the Payment Request dialog."> - <ph name="CURRENCY_CODE">$1<ex>USD</ex></ph> <ph name="FORMATTED_TOTAL_AMOUNT">$2<ex>$ 12.34</ex></ph> - </message> - <message name="IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME" desc="The name of the Shipping Address section in the Payment Sheet of the Payment Request dialog."> - Shipping address - </message> - <message name="IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME" desc="The name of the Contact Info section in the Payment Sheet of the Payment Request dialog."> - Contact info - </message> </grit-part>
diff --git a/components/cdm/browser/cdm_message_filter_android.cc b/components/cdm/browser/cdm_message_filter_android.cc index 2936a81..22417eb 100644 --- a/components/cdm/browser/cdm_message_filter_android.cc +++ b/components/cdm/browser/cdm_message_filter_android.cc
@@ -118,6 +118,9 @@ // TODO(qinmin): check composition is supported or not. response->compositing_codecs = GetSupportedCodecs(request, true); response->non_compositing_codecs = GetSupportedCodecs(request, false); + + response->is_persistent_license_supported = + MediaDrmBridge::IsPersistentLicenseTypeSupported(request.key_system); } void CdmMessageFilterAndroid::OnGetPlatformKeySystemNames(
diff --git a/components/cdm/common/cdm_messages_android.h b/components/cdm/common/cdm_messages_android.h index 028306a..06104da 100644 --- a/components/cdm/common/cdm_messages_android.h +++ b/components/cdm/common/cdm_messages_android.h
@@ -25,6 +25,7 @@ IPC_STRUCT_MEMBER(media::SupportedCodecs, non_compositing_codecs, media::EME_CODEC_NONE) + IPC_STRUCT_MEMBER(bool, is_persistent_license_supported) IPC_STRUCT_END() // Messages sent from the renderer to the browser.
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc index 9f3e6d1..71706cf 100644 --- a/components/cdm/renderer/android_key_systems.cc +++ b/components/cdm/renderer/android_key_systems.cc
@@ -116,8 +116,13 @@ kWidevineKeySystem); // Since we do not control the implementation of the MediaDrm API on Android, - // we assume that it can and will make use of persistence even though no - // persistence-based features are supported. + // we assume that it can and will make use of persistence no matter whether + // persistence-based features are supported or not. + + const EmeSessionTypeSupport persistent_license_support = + response.is_persistent_license_supported + ? EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER + : EmeSessionTypeSupport::NOT_SUPPORTED; if (response.compositing_codecs != media::EME_CODEC_NONE) { concrete_key_systems->emplace_back(new WidevineKeySystemProperties( @@ -125,7 +130,7 @@ response.non_compositing_codecs, // Hardware-secure codecs. Robustness::HW_SECURE_CRYPTO, // Max audio robustness. Robustness::HW_SECURE_ALL, // Max video robustness. - EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. + persistent_license_support, // persistent-license. EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. EmeFeatureSupport::ALWAYS_ENABLED)); // Distinctive identifier.
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index 24d31843..7d0bf0f 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -205,15 +205,15 @@ } std::unique_ptr<base::DictionaryValue> GetDictionaryValue() override { DCHECK(thread_checker_.CalledOnValidThread()); - // TODO(tbansal): Add logic to read prefs if the embedder has enabled cached - // estimates. - return base::WrapUnique(new base::DictionaryValue()); + UMA_HISTOGRAM_EXACT_LINEAR("NQE.Prefs.ReadCount", 1, 2); + return pref_service_->GetDictionary(kNetworkQualities)->CreateDeepCopy(); } private: // Schedules the writing of the lossy prefs. void SchedulePendingLossyWrites() { DCHECK(thread_checker_.CalledOnValidThread()); + UMA_HISTOGRAM_EXACT_LINEAR("NQE.Prefs.WriteCount", 1, 2); pref_service_->SchedulePendingLossyWrites(); lossy_prefs_writing_task_posted_ = false; }
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java index 1f2887f..5023068 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java
@@ -22,6 +22,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.MetricsUtils.HistogramDelta; import org.chromium.net.MetricsTestUtil.TestExecutor; import org.chromium.net.TestUrlRequestCallback.ResponseStep; import org.chromium.net.impl.CronetEngineBase; @@ -323,6 +324,12 @@ testFramework.mCronetEngine.addRttListener(rttListener); testFramework.mCronetEngine.addThroughputListener(throughputListener); + HistogramDelta writeCountHistogram = new HistogramDelta("NQE.Prefs.WriteCount", 1); + assertEquals(0, writeCountHistogram.getDelta()); // Sanity check. + + HistogramDelta readCountHistogram = new HistogramDelta("NQE.Prefs.ReadCount", 1); + assertEquals(0, readCountHistogram.getDelta()); // Sanity check. + TestUrlRequestCallback callback = new TestUrlRequestCallback(); UrlRequest.Builder builder = testFramework.mCronetEngine.newUrlRequestBuilder( mUrl, callback, callback.getExecutor()); @@ -336,6 +343,9 @@ waitForThroughput.block(); assertTrue(throughputListener.throughputObservationCount() > 0); + // Prefs must be read at startup. + assertTrue(readCountHistogram.getDelta() > 0); + // Check RTT observation count after throughput observation has been received. This ensures // that executor has finished posting the RTT observation to the RTT listeners. assertTrue(rttListener.rttObservationCount() > 0); @@ -367,7 +377,7 @@ // Verify that the cached estimates were written to the prefs. while (true) { Log.i(TAG, "Still waiting for pref file update....."); - Thread.sleep(10000); + Thread.sleep(12000); try { if (fileContainsString("local_prefs.json", "network_qualities")) { break; @@ -380,6 +390,7 @@ assertTrue(fileContainsString("local_prefs.json", "network_qualities")); testFramework.mCronetEngine.shutdown(); + assertTrue(writeCountHistogram.getDelta() > 0); } @SmallTest
diff --git a/components/display_compositor/gpu_compositor_frame_sink.cc b/components/display_compositor/gpu_compositor_frame_sink.cc index 9a6347f..9e98a3b 100644 --- a/components/display_compositor/gpu_compositor_frame_sink.cc +++ b/components/display_compositor/gpu_compositor_frame_sink.cc
@@ -24,7 +24,6 @@ std::move(display), std::move(begin_frame_source)), surface_manager_(surface_manager), - surface_tracker_(frame_sink_id), client_(std::move(client)), compositor_frame_sink_private_binding_( this, @@ -34,17 +33,7 @@ base::Unretained(this))); } -GpuCompositorFrameSink::~GpuCompositorFrameSink() { - // For display root surfaces, remove the reference from top level root to - // indicate the display root surface is no longer visible. - if (support_.display() && surface_tracker_.current_surface_id().is_valid()) { - const cc::SurfaceId top_level_root_surface_id = - surface_manager_->GetRootSurfaceId(); - std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference( - top_level_root_surface_id, surface_tracker_.current_surface_id())}; - surface_manager_->RemoveSurfaceReferences(references_to_remove); - } -} +GpuCompositorFrameSink::~GpuCompositorFrameSink() {} void GpuCompositorFrameSink::EvictFrame() { support_.EvictFrame(); @@ -57,43 +46,7 @@ void GpuCompositorFrameSink::SubmitCompositorFrame( const cc::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { - cc::SurfaceId start_surface_id = surface_tracker_.current_surface_id(); - surface_tracker_.UpdateReferences(local_surface_id, - frame.metadata.referenced_surfaces); - // TODO(kylechar): Move adding top-level root references to - // GpuDisplayCompositorFrameSink. - support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); - - // Get the list of surfaces to add/remove from |surface_tracker_| so we can - // append to them before adding/removing. - std::vector<cc::SurfaceReference>& references_to_add = - surface_tracker_.references_to_add(); - std::vector<cc::SurfaceReference>& references_to_remove = - surface_tracker_.references_to_remove(); - - // Append TLR references for the display root surfaces when display root - // surface changes. - if (support_.display() && - start_surface_id != surface_tracker_.current_surface_id()) { - const cc::SurfaceId top_level_root_surface_id = - surface_manager_->GetRootSurfaceId(); - - // The first frame will not have a valid |start_surface_id| and there will - // be no surface to remove. - if (start_surface_id.local_surface_id().is_valid()) { - references_to_remove.push_back( - cc::SurfaceReference(top_level_root_surface_id, start_surface_id)); - } - - references_to_add.push_back(cc::SurfaceReference( - top_level_root_surface_id, surface_tracker_.current_surface_id())); - } - - if (!references_to_add.empty()) - surface_manager_->AddSurfaceReferences(references_to_add); - if (!references_to_remove.empty()) - surface_manager_->RemoveSurfaceReferences(references_to_remove); } void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id,
diff --git a/components/display_compositor/gpu_compositor_frame_sink.h b/components/display_compositor/gpu_compositor_frame_sink.h index 2ccac29..5cfce766 100644 --- a/components/display_compositor/gpu_compositor_frame_sink.h +++ b/components/display_compositor/gpu_compositor_frame_sink.h
@@ -14,7 +14,6 @@ #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" -#include "cc/surfaces/referenced_surface_tracker.h" #include "components/display_compositor/display_compositor_export.h" #include "components/display_compositor/gpu_compositor_frame_sink_delegate.h" #include "mojo/public/cpp/bindings/binding.h" @@ -71,9 +70,6 @@ void ReclaimResources(const cc::ReturnedResourceArray& resources) override; void WillDrawSurface() override; - // Track the surface references for the surface corresponding to this - // compositor frame sink. - cc::ReferencedSurfaceTracker surface_tracker_; bool client_connection_lost_ = false; bool private_connection_lost_ = false;
diff --git a/components/error_page_strings.grdp b/components/error_page_strings.grdp index 89f9593..7f1e15d0 100644 --- a/components/error_page_strings.grdp +++ b/components/error_page_strings.grdp
@@ -7,12 +7,6 @@ <message name="IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS" desc="Label for the button that hides the details on a net error page"> Hide details </message> - <message name="IDS_ERRORPAGES_BUTTON_MORE" desc="Label for the button that expands the details on an error page"> - More - </message> - <message name="IDS_ERRORPAGES_BUTTON_LESS" desc="Label for the button that hides the details on an error page"> - Less - </message> <message name="IDS_ERRORPAGES_BUTTON_RELOAD" desc="Label for the button on an error page to reload the page"> Reload </message> @@ -33,11 +27,6 @@ The owner of this device turned off the dinosaur game. </message> <if expr="is_android"> - <message name="IDS_ERRORPAGES_BUTTON_SETTINGS" desc="Mobile: Label for the button on an error page to launch system settings menu"> - Settings - </message> - </if> - <if expr="is_android"> <message name="IDS_ERRORPAGES_BUTTON_DOWNLOAD" desc="Label for the button on an error page to download the failed-to-load page at a later time"> Download page later </message> @@ -137,12 +126,6 @@ <message name="IDS_ERRORPAGES_HEADING_FILE_NOT_FOUND" desc="Heading in the error page when the local file was not found."> Your file was not found </message> - <message name="IDS_ERRORPAGES_HEADING_TOO_MANY_REDIRECTS" desc="Heading in the error page when there are too many URL redirects."> - This webpage has a redirect loop - </message> - <message name="IDS_ERRORPAGES_HEADING_EMPTY_RESPONSE" desc="Heading in the error page when no data is received."> - No data received - </message> <message name="IDS_ERRORPAGES_HEADING_BLOCKED" desc="Heading of the error page when a request is blocked by the administrator policy, extension or the browser itself."> <ph name="HOST_NAME"><span jscontent="hostName"></span><ex>www.example.com</ex></ph> is blocked </message> @@ -243,10 +226,6 @@ <ph name="HOST_NAME"><strong jscontent="hostName"></strong><ex>www.whatever.com</ex></ph> is currently unable to handle this request. </message> - <message name="IDS_ERRORPAGES_SUMMARY_SERVICE_UNAVAILABLE" desc="Summary in the error page when the server returns a 503."> - The webpage at <ph name="URL"><strong jscontent="failedUrl"></strong></ph> is currently unavailable. It may be overloaded or down for maintenance. - </message> - <message name="IDS_ERRORPAGES_SUMMARY_GATEWAY_TIMEOUT" desc="Summary in the error page when the server returns a 504."> <ph name="HOST_NAME"><strong jscontent="hostName"></strong><ex>www.whatever.com</ex></ph> took too long to respond. </message> @@ -259,9 +238,6 @@ <ph name="HOST_NAME"><strong jscontent="hostName"></strong><ex>www.whatever.com</ex></ph> uses an unsupported protocol. </message> - <message name="IDS_ERRORPAGES_SUMMARY_PINNING_FAILURE_DETAILS" desc="Summary of the error page for a certificate which doesn't match the built-in pins for that name"> - The server certificate at <ph name="HOST_NAME"><strong jscontent="hostName"></strong><ex>www.whatever.com</ex></ph> appears to be a forgery. - </message> <message name="IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION" desc="Heading in the error page for insecure connections."> This site can’t provide a secure connection </message>
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index c9927a8..89cbc34 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -1418,7 +1418,7 @@ } void ShellSurface::UpdateShadow() { - if (!widget_) + if (!widget_ || !surface_) return; aura::Window* window = widget_->GetNativeWindow(); if (!shadow_enabled_) {
diff --git a/components/gcm_driver/gcm_client.h b/components/gcm_driver/gcm_client.h index c4dd12a..95a56d9d 100644 --- a/components/gcm_driver/gcm_client.h +++ b/components/gcm_driver/gcm_client.h
@@ -51,6 +51,7 @@ IMMEDIATE_START }; + // Used for UMA. Can add enum values, but never renumber or delete and reuse. enum Result { // Successful operation. SUCCESS, @@ -68,7 +69,10 @@ // Exceeded the specified TTL during message sending. TTL_EXCEEDED, // Other errors. - UNKNOWN_ERROR + UNKNOWN_ERROR, + + // Used for UMA. Keep LAST_RESULT up to date and sync with histograms.xml. + LAST_RESULT = UNKNOWN_ERROR }; enum ChromePlatform {
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc index a18b585..5420646 100644 --- a/components/gcm_driver/gcm_client_impl.cc +++ b/components/gcm_driver/gcm_client_impl.cc
@@ -961,14 +961,17 @@ Result result; PendingRegistrationRequests::const_iterator iter = pending_registration_requests_.find(registration_info); - if (iter == pending_registration_requests_.end()) + if (iter == pending_registration_requests_.end()) { result = UNKNOWN_ERROR; - else if (status == RegistrationRequest::INVALID_SENDER) + } else if (status == RegistrationRequest::INVALID_SENDER) { result = INVALID_PARAMETER; - else if (registration_id.empty()) + } else if (registration_id.empty()) { + // All other errors are currently treated as SERVER_ERROR (including + // REACHED_MAX_RETRIES due to the device being offline!). result = SERVER_ERROR; - else + } else { result = SUCCESS; + } if (result == SUCCESS) { // Cache it. @@ -1114,7 +1117,8 @@ result = INVALID_PARAMETER; break; default: - // All other errors are treated as SERVER_ERROR. + // All other errors are currently treated as SERVER_ERROR (including + // REACHED_MAX_RETRIES due to the device being offline!). result = SERVER_ERROR; break; }
diff --git a/components/gcm_driver/instance_id/instance_id.h b/components/gcm_driver/instance_id/instance_id.h index 52c1adb..ccf16b7b 100644 --- a/components/gcm_driver/instance_id/instance_id.h +++ b/components/gcm_driver/instance_id/instance_id.h
@@ -27,21 +27,26 @@ // Instance ID is managed by the InstanceIDDriver. class InstanceID { public: + // Used in UMA. Can add enum values, but never renumber or delete and reuse. enum Result { // Successful operation. - SUCCESS, + SUCCESS = 0, // Invalid parameter. - INVALID_PARAMETER, + INVALID_PARAMETER = 1, // Instance ID is disabled. - DISABLED, + DISABLED = 2, // Previous asynchronous operation is still pending to finish. - ASYNC_OPERATION_PENDING, + ASYNC_OPERATION_PENDING = 3, // Network socket error. - NETWORK_ERROR, + NETWORK_ERROR = 4, // Problem at the server. - SERVER_ERROR, + SERVER_ERROR = 5, + // 6 is omitted, in case we ever merge this enum with GCMClient::Result. // Other errors. - UNKNOWN_ERROR + UNKNOWN_ERROR = 7, + + // Used for UMA. Keep LAST_RESULT up to date and sync with histograms.xml. + LAST_RESULT = UNKNOWN_ERROR }; // Asynchronous callbacks. Must not synchronously delete |this| (using
diff --git a/components/image_fetcher/BUILD.gn b/components/image_fetcher/BUILD.gn index cd60562..a2102c7 100644 --- a/components/image_fetcher/BUILD.gn +++ b/components/image_fetcher/BUILD.gn
@@ -11,6 +11,8 @@ "image_fetcher_delegate.h", "image_fetcher_impl.cc", "image_fetcher_impl.h", + "request_metadata.cc", + "request_metadata.h", ] public_deps = [ @@ -25,6 +27,7 @@ testonly = true sources = [ "image_data_fetcher_unittest.cc", + "request_metadata_unittest.cc", ] deps = [ ":image_fetcher",
diff --git a/components/image_fetcher/image_data_fetcher.cc b/components/image_fetcher/image_data_fetcher.cc index e82c367..d597bb3b 100644 --- a/components/image_fetcher/image_data_fetcher.cc +++ b/components/image_fetcher/image_data_fetcher.cc
@@ -5,6 +5,7 @@ #include "components/image_fetcher/image_data_fetcher.h" #include "net/base/load_flags.h" +#include "net/http/http_response_headers.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context_getter.h" @@ -77,11 +78,16 @@ auto request_iter = pending_requests_.find(source); DCHECK(request_iter != pending_requests_.end()); + RequestMetadata metadata; + if (source->GetResponseHeaders()) { + source->GetResponseHeaders()->GetMimeType(&metadata.mime_type); + } + std::string image_data; if (source->GetStatus().status() == net::URLRequestStatus::SUCCESS) { source->GetResponseAsString(&image_data); } - request_iter->second->callback.Run(image_data); + request_iter->second->callback.Run(image_data, metadata); // Remove the finished request. pending_requests_.erase(request_iter);
diff --git a/components/image_fetcher/image_data_fetcher.h b/components/image_fetcher/image_data_fetcher.h index 5383086..79f874be 100644 --- a/components/image_fetcher/image_data_fetcher.h +++ b/components/image_fetcher/image_data_fetcher.h
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "components/data_use_measurement/core/data_use_user_data.h" +#include "components/image_fetcher/request_metadata.h" #include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_request.h" #include "url/gurl.h" @@ -27,7 +28,8 @@ class ImageDataFetcher : public net::URLFetcherDelegate { public: using ImageDataFetcherCallback = - base::Callback<void(const std::string& image_data)>; + base::Callback<void(const std::string& image_data, + const RequestMetadata& request_metadata)>; using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName;
diff --git a/components/image_fetcher/image_data_fetcher_unittest.cc b/components/image_fetcher/image_data_fetcher_unittest.cc index 949e7d6..5f257276e 100644 --- a/components/image_fetcher/image_data_fetcher_unittest.cc +++ b/components/image_fetcher/image_data_fetcher_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" +#include "net/http/http_response_headers.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_status.h" #include "net/url_request/url_request_test_util.h" @@ -33,11 +34,14 @@ image_data_fetcher_(test_request_context_getter_.get()) {} ~ImageDataFetcherTest() override {} - MOCK_METHOD1(OnImageDataFetched, void(const std::string&)); + MOCK_METHOD2(OnImageDataFetched, + void(const std::string&, const RequestMetadata&)); - MOCK_METHOD1(OnImageDataFetchedFailedRequest, void(const std::string&)); + MOCK_METHOD2(OnImageDataFetchedFailedRequest, + void(const std::string&, const RequestMetadata&)); - MOCK_METHOD1(OnImageDataFetchedMultipleRequests, void(const std::string&)); + MOCK_METHOD2(OnImageDataFetchedMultipleRequests, + void(const std::string&, const RequestMetadata&)); protected: base::MessageLoop message_loop_; @@ -57,7 +61,11 @@ GURL(kImageURL), base::Bind(&ImageDataFetcherTest::OnImageDataFetched, base::Unretained(this))); - EXPECT_CALL(*this, OnImageDataFetched(std::string(kURLResponseData))); + + RequestMetadata expected_metadata; + expected_metadata.mime_type = std::string("image/gif"); + EXPECT_CALL(*this, OnImageDataFetched(std::string(kURLResponseData), + expected_metadata)); // Get and configure the TestURLFetcher. net::TestURLFetcher* test_url_fetcher = fetcher_factory_.GetFetcherByID(0); @@ -66,6 +74,15 @@ net::URLRequestStatus(net::URLRequestStatus::SUCCESS, net::OK)); test_url_fetcher->SetResponseString(kURLResponseData); + std::string raw_header = + "HTTP/1.1 200 OK\n" + "Content-type: image/gif\n\n"; + std::replace(raw_header.begin(), raw_header.end(), '\n', '\0'); + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders(raw_header)); + + test_url_fetcher->set_response_headers(headers); + // Call the URLFetcher delegate to continue the test. test_url_fetcher->delegate()->OnURLFetchComplete(test_url_fetcher); } @@ -75,7 +92,10 @@ GURL(kImageURL), base::Bind(&ImageDataFetcherTest::OnImageDataFetchedFailedRequest, base::Unretained(this))); - EXPECT_CALL(*this, OnImageDataFetchedFailedRequest(std::string())); + + RequestMetadata expected_metadata; + EXPECT_CALL( + *this, OnImageDataFetchedFailedRequest(std::string(), expected_metadata)); // Get and configure the TestURLFetcher. net::TestURLFetcher* test_url_fetcher = fetcher_factory_.GetFetcherByID(0); @@ -92,7 +112,8 @@ ImageDataFetcher::ImageDataFetcherCallback callback = base::Bind(&ImageDataFetcherTest::OnImageDataFetchedMultipleRequests, base::Unretained(this)); - EXPECT_CALL(*this, OnImageDataFetchedMultipleRequests(testing::_)).Times(2); + EXPECT_CALL(*this, OnImageDataFetchedMultipleRequests(testing::_, testing::_)) + .Times(2); image_data_fetcher_.FetchImageData(GURL(kImageURL), callback); image_data_fetcher_.FetchImageData(GURL(kImageURL), callback);
diff --git a/components/image_fetcher/image_fetcher_impl.cc b/components/image_fetcher/image_fetcher_impl.cc index d260b2c..e417e3c 100644 --- a/components/image_fetcher/image_fetcher_impl.cc +++ b/components/image_fetcher/image_fetcher_impl.cc
@@ -63,7 +63,8 @@ } void ImageFetcherImpl::OnImageURLFetched(const GURL& image_url, - const std::string& image_data) { + const std::string& image_data, + const RequestMetadata& metadata) { // Inform the ImageFetcherDelegate. if (delegate_) { auto it = pending_net_requests_.find(image_url);
diff --git a/components/image_fetcher/image_fetcher_impl.h b/components/image_fetcher/image_fetcher_impl.h index 05856e8..d8294ef 100644 --- a/components/image_fetcher/image_fetcher_impl.h +++ b/components/image_fetcher/image_fetcher_impl.h
@@ -76,7 +76,9 @@ // Processes image URL fetched events. This is the continuation method used // for creating callbacks that are passed to the ImageDataFetcher. - void OnImageURLFetched(const GURL& image_url, const std::string& image_data); + void OnImageURLFetched(const GURL& image_url, + const std::string& image_data, + const RequestMetadata& metadata); // Processes image decoded events. This is the continuation method used for // creating callbacks that are passed to the ImageDecoder.
diff --git a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h index 81b5f70..9c1c814 100644 --- a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h +++ b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h
@@ -24,7 +24,8 @@ namespace image_fetcher { // Callback that informs of the download of an image encoded in |data|. -using IOSImageDataFetcherCallback = void (^)(NSData* data); +using IOSImageDataFetcherCallback = void (^)(NSData* data, + const RequestMetadata& metadata); class IOSImageDataFetcherWrapper { public:
diff --git a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm index 30eeb6b..247a847 100644 --- a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm +++ b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm
@@ -112,7 +112,8 @@ IOSImageDataFetcherCallback callback) { scoped_refptr<base::TaskRunner> task_runner = task_runner_; - return base::BindBlockArc(^(const std::string& image_data) { + return base::BindBlockArc(^(const std::string& image_data, + const RequestMetadata& metadata) { // Create a NSData from the returned data and notify the callback. NSData* data = [NSData dataWithBytes:image_data.data() length:image_data.size()]; @@ -120,14 +121,18 @@ if (data.length < 12 || image_data.compare(0, 4, kWEBPFirstMagicPattern) != 0 || image_data.compare(8, 4, kWEBPSecondMagicPattern) != 0) { - callback(data); + callback(data, metadata); return; } + RequestMetadata webp_metadata = metadata; + // The image is a webp image. base::PostTaskAndReplyWithResult(task_runner.get(), FROM_HERE, base::Bind(&DecodeWebpImage, data), - base::BindBlockArc(callback)); + base::BindBlockArc(^(NSData* data) { + callback(data, webp_metadata); + })); }); }
diff --git a/components/image_fetcher/request_metadata.cc b/components/image_fetcher/request_metadata.cc new file mode 100644 index 0000000..db3a2c9 --- /dev/null +++ b/components/image_fetcher/request_metadata.cc
@@ -0,0 +1,17 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/image_fetcher/request_metadata.h" + +namespace image_fetcher { + +bool operator==(const RequestMetadata& lhs, const RequestMetadata& rhs) { + return lhs.mime_type == rhs.mime_type; +} + +bool operator!=(const RequestMetadata& lhs, const RequestMetadata& rhs) { + return !(lhs == rhs); +} + +} // namespace image_fetcher
diff --git a/components/image_fetcher/request_metadata.h b/components/image_fetcher/request_metadata.h new file mode 100644 index 0000000..1bc997a7 --- /dev/null +++ b/components/image_fetcher/request_metadata.h
@@ -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. + +#ifndef COMPONENTS_IMAGE_FETCHER_REQUEST_METADATA_H_ +#define COMPONENTS_IMAGE_FETCHER_REQUEST_METADATA_H_ + +#include <string> + +namespace image_fetcher { + +struct RequestMetadata { + std::string mime_type; +}; + +bool operator==(const RequestMetadata& lhs, const RequestMetadata& rhs); +bool operator!=(const RequestMetadata& lhs, const RequestMetadata& rhs); + +} // namespace image_fetcher + +#endif // COMPONENTS_IMAGE_FETCHER_REQUEST_METADATA_H_
diff --git a/components/image_fetcher/request_metadata_unittest.cc b/components/image_fetcher/request_metadata_unittest.cc new file mode 100644 index 0000000..4855dbf1 --- /dev/null +++ b/components/image_fetcher/request_metadata_unittest.cc
@@ -0,0 +1,29 @@ +// 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/image_fetcher/request_metadata.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace image_fetcher { + +TEST(RequestMetadataTest, Equality) { + RequestMetadata rhs; + RequestMetadata lhs; + rhs.mime_type = "testMimeType"; + lhs.mime_type = "testMimeType"; + + EXPECT_EQ(rhs, lhs); +} + +TEST(RequestMetadataTest, NoEquality) { + RequestMetadata rhs; + RequestMetadata lhs; + rhs.mime_type = "testMimeType"; + lhs.mime_type = "testOtherMimeType"; + + EXPECT_NE(rhs, lhs); +} + +} // namespace image_fetcher
diff --git a/components/ntp_tiles/metrics.cc b/components/ntp_tiles/metrics.cc index e407af2..4acc1c0 100644 --- a/components/ntp_tiles/metrics.cc +++ b/components/ntp_tiles/metrics.cc
@@ -26,6 +26,11 @@ const char kHistogramPopularName[] = "popular"; const char kHistogramWhitelistName[] = "whitelist"; +// Suffixes for the various icon types. +const char kIconTypeSuffixColor[] = "IconsColor"; +const char kIconTypeSuffixGray[] = "IconsGray"; +const char kIconTypeSuffixReal[] = "IconsReal"; + // Log an event for a given |histogram| at a given element |position|. This // routine exists because regular histogram macros are cached thus can't be used // if the name of the histogram will change at a given call site. @@ -54,6 +59,23 @@ return std::string(); } +const char* GetIconTypeSuffix(MostVisitedTileType type) { + switch (type) { + case ICON_COLOR: + return kIconTypeSuffixColor; + case ICON_DEFAULT: + return kIconTypeSuffixGray; + case ICON_REAL: + return kIconTypeSuffixReal; + case NONE: // Fall through. + case NUM_RECORDED_TILE_TYPES: // Fall through. + case THUMBNAIL: // Fall through. + case UNKNOWN_TILE_TYPE: + break; + } + return nullptr; +} + } // namespace void RecordPageImpression(const std::vector<TileImpression>& tiles, @@ -89,25 +111,16 @@ base::StringPrintf("NewTabPage.TileType.%s", source_name.c_str()); LogHistogramEvent(tile_type_histogram, tile_type, NUM_RECORDED_TILE_TYPES); - switch (tile_type) { - case NONE: - break; - case ICON_COLOR: - rappor::SampleDomainAndRegistryFromGURL( - rappor_service, "NTP.SuggestionsImpressions.IconsColor", url); - break; - case ICON_DEFAULT: - rappor::SampleDomainAndRegistryFromGURL( - rappor_service, "NTP.SuggestionsImpressions.IconsGray", url); - break; - case ICON_REAL: - rappor::SampleDomainAndRegistryFromGURL( - rappor_service, "NTP.SuggestionsImpressions.IconsReal", url); - break; - case NUM_RECORDED_TILE_TYPES: // Fall through. - case THUMBNAIL: // Fall through. - case UNKNOWN_TILE_TYPE: - NOTREACHED(); + const char* icon_type_suffix = GetIconTypeSuffix(tile_type); + if (icon_type_suffix) { + rappor::SampleDomainAndRegistryFromGURL( + rappor_service, + base::StringPrintf("NTP.SuggestionsImpressions.%s", icon_type_suffix), + url); + + std::string icon_impression_histogram = base::StringPrintf( + "NewTabPage.SuggestionsImpression.%s", icon_type_suffix); + LogHistogramEvent(icon_impression_histogram, index, kMaxNumTiles); } } @@ -130,6 +143,13 @@ "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str()); LogHistogramEvent(histogram, index, kMaxNumTiles); + const char* icon_type_suffix = GetIconTypeSuffix(tile_type); + if (icon_type_suffix) { + std::string icon_histogram = + base::StringPrintf("NewTabPage.MostVisited.%s", icon_type_suffix); + LogHistogramEvent(icon_histogram, index, kMaxNumTiles); + } + if (tile_type < NUM_RECORDED_TILE_TYPES) { UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileTypeClicked", tile_type, NUM_RECORDED_TILE_TYPES);
diff --git a/components/ntp_tiles/metrics_unittest.cc b/components/ntp_tiles/metrics_unittest.cc index 53438777e..acb8c5a 100644 --- a/components/ntp_tiles/metrics_unittest.cc +++ b/components/ntp_tiles/metrics_unittest.cc
@@ -78,6 +78,20 @@ ElementsAre(base::Bucket(/*min=*/3, /*count=*/1))); EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.IconsGray"), ElementsAre(base::Bucket(/*min=*/1, /*count=*/1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsReal"), + ElementsAre(base::Bucket(/*min=*/0, /*count=*/1), + base::Bucket(/*min=*/1, /*count=*/1), + base::Bucket(/*min=*/2, /*count=*/1), + base::Bucket(/*min=*/5, /*count=*/1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsColor"), + ElementsAre(base::Bucket(/*min=*/3, /*count=*/1), + base::Bucket(/*min=*/4, /*count=*/1), + base::Bucket(/*min=*/7, /*count=*/1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsGray"), + ElementsAre(base::Bucket(/*min=*/6, /*count=*/1))); } TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) { @@ -115,6 +129,49 @@ IsEmpty()); EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.IconsGray"), IsEmpty()); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsReal"), + IsEmpty()); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsColor"), + IsEmpty()); + EXPECT_THAT(histogram_tester.GetAllSamples( + "NewTabPage.SuggestionsImpression.IconsGray"), + IsEmpty()); +} + +TEST(RecordTileClickTest, ShouldRecordUma) { + base::HistogramTester histogram_tester; + RecordTileClick(3, NTPTileSource::TOP_SITES, ICON_REAL); + EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"), + ElementsAre(base::Bucket(/*min=*/3, /*count=*/1))); + EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.server"), + IsEmpty()); + EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.popular"), + IsEmpty()); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"), + ElementsAre(base::Bucket(/*min=*/3, /*count=*/1))); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsColor"), + IsEmpty()); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"), + IsEmpty()); +} + +TEST(RecordTileClickTest, ShouldIgnoreThumbnails) { + base::HistogramTester histogram_tester; + RecordTileClick(3, NTPTileSource::TOP_SITES, THUMBNAIL); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"), + IsEmpty()); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsColor"), + IsEmpty()); + EXPECT_THAT( + histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"), + IsEmpty()); } TEST(RecordPageImpressionTest, ShouldRecordRappor) {
diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc index 306f206..b666953 100644 --- a/components/password_manager/core/browser/password_autofill_manager.cc +++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -219,7 +219,7 @@ } GURL origin = (fill_data_it->second).origin; - bool is_context_secure = autofill_client_->IsContextSecure(origin) && + bool is_context_secure = autofill_client_->IsContextSecure() && (!origin.is_valid() || !origin.SchemeIs("http")); if (!is_context_secure && security_state::IsHttpWarningInFormEnabled()) { std::string icon_str;
diff --git a/components/payments/payment_request.cc b/components/payments/payment_request.cc index d7302df..fd2fc4f5 100644 --- a/components/payments/payment_request.cc +++ b/components/payments/payment_request.cc
@@ -5,9 +5,7 @@ #include "components/payments/payment_request.h" #include "base/memory/ptr_util.h" -#include "components/autofill/core/browser/personal_data_manager.h" #include "components/payments/payment_details_validation.h" -#include "components/payments/payment_request_delegate.h" #include "components/payments/payment_request_web_contents_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" @@ -123,11 +121,8 @@ autofill::CreditCard* PaymentRequest::GetCurrentlySelectedCreditCard() { // TODO(anthonyvd): Change this code to prioritize server cards and implement // a way to modify this function's return value. - autofill::PersonalDataManager* data_manager = - delegate_->GetPersonalDataManager(); - const std::vector<autofill::CreditCard*> cards = - data_manager->GetCreditCardsToSuggest(); + personal_data_manager()->GetCreditCardsToSuggest(); auto first_complete_card = std::find_if( cards.begin(), @@ -140,10 +135,8 @@ } void PaymentRequest::PopulateProfileCache() { - autofill::PersonalDataManager* data_manager = - delegate_->GetPersonalDataManager(); std::vector<autofill::AutofillProfile*> profiles = - data_manager->GetProfilesToSuggest(); + personal_data_manager()->GetProfilesToSuggest(); // PaymentRequest may outlive the Profiles returned by the Data Manager. // Thus, we store copies, and return a vector of pointers to these copies
diff --git a/components/payments/payment_request.h b/components/payments/payment_request.h index a2caab9..cd54b7c 100644 --- a/components/payments/payment_request.h +++ b/components/payments/payment_request.h
@@ -9,8 +9,10 @@ #include <string> #include <vector> +#include "components/autofill/core/browser/personal_data_manager.h" #include "components/payments/currency_formatter.h" #include "components/payments/payment_request.mojom.h" +#include "components/payments/payment_request_delegate.h" #include "mojo/public/cpp/bindings/binding.h" namespace autofill { @@ -24,7 +26,6 @@ namespace payments { -class PaymentRequestDelegate; class PaymentRequestWebContentsManager; class PaymentRequest : payments::mojom::PaymentRequest { @@ -95,6 +96,10 @@ // card. autofill::CreditCard* GetCurrentlySelectedCreditCard(); + autofill::PersonalDataManager* personal_data_manager() { + return delegate_->GetPersonalDataManager(); + } + payments::mojom::PaymentDetails* details() { return details_.get(); } content::WebContents* web_contents() { return web_contents_; }
diff --git a/components/payments/payment_request_delegate.h b/components/payments/payment_request_delegate.h index 08988db..65e56af 100644 --- a/components/payments/payment_request_delegate.h +++ b/components/payments/payment_request_delegate.h
@@ -25,6 +25,7 @@ virtual void CloseDialog() = 0; // Gets the PersonalDataManager associated with this PaymentRequest flow. + // Cannot be null. virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; };
diff --git a/components/payments_strings.grdp b/components/payments_strings.grdp index 446ac6c..21e74fa 100644 --- a/components/payments_strings.grdp +++ b/components/payments_strings.grdp
@@ -25,27 +25,15 @@ <message name="IDS_PAYMENTS_ADD_CARD" desc="The title of the dialog for user to add new payment card." formatter_data="android_java"> Add card </message> - <message name="IDS_PAYMENTS_BILLING_ADDRESS_REQUIRED" desc="The label to indicate billing address is required for payment card." formatter_data="android_java"> - Billing address required - </message> <message name="IDS_PAYMENTS_ADD_BILLING_ADDRESS" desc="The title of the dialog for user to add billing address to payment card." formatter_data="android_java"> Add billing address </message> - <message name="IDS_PAYMENTS_NAME_ON_CARD_REQUIRED" desc="The label to indicate name on card is required for payment card." formatter_data="android_java"> - Name on card required - </message> <message name="IDS_PAYMENTS_ADD_NAME_ON_CARD" desc="The title of the dialog for user to add name on card to payment card." formatter_data="android_java"> Add name on card </message> - <message name="IDS_PAYMENTS_CARD_NUMBER_INVALID" desc="The label to indicate payment card number is invalid." formatter_data="android_java"> - Card number invalid - </message> <message name="IDS_PAYMENTS_ADD_VALID_CARD_NUMBER" desc="The title of the dialog for user to add valid payment card number." formatter_data="android_java"> Add valid card number </message> - <message name="IDS_PAYMENTS_MORE_INFORMATION_REQUIRED" desc="The label to indicate more information is required for payment card or shipping address or contact info." formatter_data="android_java"> - More information required - </message> <message name="IDS_PAYMENTS_ADD_MORE_INFORMATION" desc="The title of the dialog for user to add more information to payment card or shipping address or contact info." formatter_data="android_java"> Add more information </message> @@ -55,33 +43,18 @@ <message name="IDS_PAYMENTS_CREDIT_CARD_EXPIRATION_DATE_ABBR" desc="Abbreviated label for credit card expiration date. [CHAR-LIMIT=32]" formatter_data="android_java"> Exp: <ph name="EXPIRATION_MONTH">%1$s<ex>06</ex></ph>/<ph name="EXPIRATION_YEAR">%2$s<ex>17</ex></ph> </message> - <message name="IDS_PAYMENTS_PHONE_NUMBER_REQUIRED" desc="The label to indicate phone number is required in the shipping address or contact info. This phone number can be used, for example, if there's a problem with shipping a package to its destination." formatter_data="android_java"> - Phone number required - </message> <message name="IDS_PAYMENTS_ADD_PHONE_NUMBER" desc="The title of the dialog for user to add phone number to the shipping address or contact info. This phone number can be used, for example, if there's a problem with shipping a package to its destination." formatter_data="android_java"> Add phone number </message> - <message name="IDS_PAYMENTS_RECIPIENT_REQUIRED" desc="The label to indicate recipient is required in the shipping address. The recipient could be a person or institute name identifies the receiver of the shipping package." formatter_data="android_java"> - Recipient required - </message> <message name="IDS_PAYMENTS_ADD_RECIPIENT" desc="The title of the dialog for user to add recipient in the shipping address. The recipient could be a person or institute name identifies the receiver of the shipping package." formatter_data="android_java"> Add recipient </message> - <message name="IDS_PAYMENTS_INVALID_ADDRESS" desc="The label to indicate the shipping address is invalid. For example, missing state or city name." formatter_data="android_java"> - Invalid address - </message> <message name="IDS_PAYMENTS_ADD_VALID_ADDRESS" desc="The title of the dialog for user to add valid shipping address. For example, missing state or city name." formatter_data="android_java"> Add valid address </message> - <message name="IDS_PAYMENTS_EMAIL_REQUIRED" desc="The label to indicate email is required for the contact details. This email can be used to contact the payer." formatter_data="android_java"> - Email required - </message> <message name="IDS_PAYMENTS_ADD_EMAIL" desc="The title of the dialog for user to add email to the contact details. This email can be used to contact the payer." formatter_data="android_java"> Add email </message> - <message name="IDS_PAYMENTS_NAME_REQUIRED" desc="The label to indicate name is required for the contact details. This name could be a person or institute name of the payer." formatter_data="android_java"> - Name required - </message> <message name="IDS_PAYMENTS_ADD_NAME" desc="The title of the dialog for user to add name to the contact details. This name could be a person or institute name of the payer." formatter_data="android_java"> Add name </message> @@ -100,6 +73,38 @@ <message name="IDS_PAYMENTS_ERROR_MESSAGE" desc="The text that informs the user that there is error in verifying and charging the payment." formatter_data="android_java"> There was an error processing your order. Please check your account and try again. </message> + <message name="IDS_PAYMENTS_ADD_CONTACT" desc="Text on a button that lets a user add new contact details, like the user's full name, an email address or a phone number." formatter_data="android_java"> + Add contact info + </message> + <message name="IDS_PAYMENTS_CHECKING_OPTION" desc="Text explaining that the option the user selected is being checked and verified." formatter_data="android_java"> + Checking + </message> + <message name="IDS_PAYMENTS_UPDATED_LABEL" desc="The text that informs the user that the total value of their cart has been updated." formatter_data="android_java"> + Updated + </message> + <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS" desc="Label of the section containing the link to go to the settings page for card and address options." formatter_data="android_java"> + You can manage cards and addresses in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + </message> + <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN" desc="Label of the section containing the origin description and the link to go to the settings page for card and address options. This label is used when the user is signed in." formatter_data="android_java"> + Card and address options are from your Google Account (<ph name="ACCOUNT_EMAIL">%1$s<ex>johndoe@gmail.com</ex></ph>) and Chrome. You can manage these in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + </message> + <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT" desc="Label of the section containing the origin description and the link to go to the settings page for card and address options. This label is used when the user is not signed in." formatter_data="android_java"> + Card and address options are from Chrome. You can manage these in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + </message> + + <!-- Validation --> + <message name="IDS_PAYMENTS_VALIDATION_INVALID_NAME" desc="Message displayed to user when name validation fails."> + Invalid name + </message> + <message name="IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_YEAR" desc="Message displayed to user when the credit card expiration year is in an invalid format."> + Invalid expiration year + </message> + <message name="IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRATION_MONTH" desc="Message displayed to user when the credit card expiration month is in an invalid format."> + Invalid expiration month + </message> + <message name="IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED" desc="Message displayed to user when the credit card is expired."> + The card is expired + </message> <message name="IDS_PAYMENTS_REQUIRED_FIELD_MESSAGE" desc="The text that informs the user that '*' character indicates an input field that is required. The '*' character should not be changed." formatter_data="android_java"> * indicates required field </message> @@ -118,23 +123,52 @@ <message name="IDS_PAYMENTS_CARD_EXPIRATION_INVALID_VALIDATION_MESSAGE" desc="The text that informs the user that the credit card expiration date they have entered is not valid." formatter_data="android_java"> Invalid expiration date </message> - <message name="IDS_PAYMENTS_ADD_CONTACT" desc="Text on a button that lets a user add new contact details, like the user's full name, an email address or a phone number." formatter_data="android_java"> - Add contact info + <message name="IDS_PAYMENTS_BILLING_ADDRESS_REQUIRED" desc="The label to indicate billing address is required for payment card." formatter_data="android_java"> + Billing address required </message> - <message name="IDS_PAYMENTS_CHECKING_OPTION" desc="Text explaining that the option the user selected is being checked and verified." formatter_data="android_java"> - Checking + <message name="IDS_PAYMENTS_NAME_ON_CARD_REQUIRED" desc="The label to indicate name on card is required for payment card." formatter_data="android_java"> + Name on card required </message> - <message name="IDS_PAYMENTS_UPDATED_LABEL" desc="The text that informs the user that the total value of their cart has been updated." formatter_data="android_java"> - Updated + <message name="IDS_PAYMENTS_CARD_NUMBER_INVALID" desc="The label to indicate payment card number is invalid." formatter_data="android_java"> + Card number invalid </message> - <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS" desc="Label of the section containing the link to go to the settings page for card and address options." formatter_data="android_java"> - You can manage cards and addresses in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + <message name="IDS_PAYMENTS_MORE_INFORMATION_REQUIRED" desc="The label to indicate more information is required for payment card or shipping address or contact info." formatter_data="android_java"> + More information required </message> - <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN" desc="Label of the section containing the origin description and the link to go to the settings page for card and address options. This label is used when the user is signed in." formatter_data="android_java"> - Card and address options are from your Google Account (<ph name="ACCOUNT_EMAIL">%1$s<ex>johndoe@gmail.com</ex></ph>) and Chrome. You can manage these in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + <message name="IDS_PAYMENTS_PHONE_NUMBER_REQUIRED" desc="The label to indicate phone number is required in the shipping address or contact info. This phone number can be used, for example, if there's a problem with shipping a package to its destination." formatter_data="android_java"> + Phone number required </message> - <message name="IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT" desc="Label of the section containing the origin description and the link to go to the settings page for card and address options. This label is used when the user is not signed in." formatter_data="android_java"> - Card and address options are from Chrome. You can manage these in <ph name="BEGIN_LINK"><link></ph>Settings<ph name="END_LINK"></link></ph>. + <message name="IDS_PAYMENTS_RECIPIENT_REQUIRED" desc="The label to indicate recipient is required in the shipping address. The recipient could be a person or institute name identifies the receiver of the shipping package." formatter_data="android_java"> + Recipient required + </message> + <message name="IDS_PAYMENTS_INVALID_ADDRESS" desc="The label to indicate the shipping address is invalid. For example, missing state or city name." formatter_data="android_java"> + Invalid address + </message> + <message name="IDS_PAYMENTS_EMAIL_REQUIRED" desc="The label to indicate email is required for the contact details. This email can be used to contact the payer." formatter_data="android_java"> + Email required + </message> + <message name="IDS_PAYMENTS_NAME_REQUIRED" desc="The label to indicate name is required for the contact details. This name could be a person or institute name of the payer." formatter_data="android_java"> + Name required + </message> + + <!-- Payment Request (Sections mode) --> + <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME" desc="The name of the Order Summary section in the Payment Sheet of the Payment Request dialog."> + Order summary + </message> + <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_TOTAL_FORMAT" desc="The format specifier of the Total label in the Order Summary section of the Payment Sheet of the Payment Request dialog."> + <ph name="TOTAL_LABEL">$1<ex>Total</ex></ph> <ph name="CURRENCY_CODE">$2<ex>USD</ex></ph> <ph name="FORMATTED_TOTAL_AMOUNT">$3<ex>$ 12.34</ex></ph> + </message> + <message name="IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME" desc="The name of the Payment Method section in the Payment Sheet of the Payment Request dialog."> + Payment + </message> + <message name="IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SHEET_TOTAL_FORMAT" desc="The format specifier of the Total label in the Order Summary Sheet of the Payment Request dialog."> + <ph name="CURRENCY_CODE">$1<ex>USD</ex></ph> <ph name="FORMATTED_TOTAL_AMOUNT">$2<ex>$ 12.34</ex></ph> + </message> + <message name="IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME" desc="The name of the Shipping Address section in the Payment Sheet of the Payment Request dialog."> + Shipping address + </message> + <message name="IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME" desc="The name of the Contact Info section in the Payment Sheet of the Payment Request dialog."> + Contact info </message> <!-- Shipping address in web payments API --> @@ -190,5 +224,4 @@ <message name="IDS_PAYMENTS_ANDROID_APP_ERROR" desc="Error message that is shown when an Android payment application fails to start." formatter_data="android_java"> Unable to launch payment app. </message> - </grit-part>
diff --git a/components/ssl_errors_strings.grdp b/components/ssl_errors_strings.grdp index dbad0b9..0b9c8c8 100644 --- a/components/ssl_errors_strings.grdp +++ b/components/ssl_errors_strings.grdp
@@ -33,13 +33,6 @@ Server's certificate is not valid at this time. </message> - <message name="IDS_CERT_ERROR_CHAIN_EXPIRED_DETAILS" desc="Details for an expired root or intermediate cert in chain"> - This server could not prove that it is <ph name="DOMAIN"><strong>$1<ex>paypal.com</ex></strong></ph>; its security certificate expired. This may be caused by a misconfiguration or an attacker intercepting your connection. Your computer's clock is currently set to <ph name="CURRENT_TIME">$3<ex>July 18, 2012</ex></ph>. Does that look right? If not, you should correct your system's clock and then refresh this page. <ph name="BEGIN_LEARN_MORE_LINK"><a href="#" id="learn-more-link"></ph>Learn more<ph name="END_LEARN_MORE_LINK"></a></ph>. - </message> - <message name="IDS_CERT_ERROR_CHAIN_EXPIRED_DESCRIPTION" desc="Description for an expired intermediate/root certificate in chain"> - A root or intermediate certificate has expired. - </message> - <message name="IDS_CERT_ERROR_AUTHORITY_INVALID_DESCRIPTION" desc="Description for an X509 certificate with an invalid authority"> Server's certificate is not trusted. </message>
diff --git a/components/sync/engine_impl/net/server_connection_manager.cc b/components/sync/engine_impl/net/server_connection_manager.cc index 9aa63e8..76e6246 100644 --- a/components/sync/engine_impl/net/server_connection_manager.cc +++ b/components/sync/engine_impl/net/server_connection_manager.cc
@@ -266,7 +266,8 @@ if (auth_token.empty() || auth_token == "credentials_lost") { params->response.server_status = HttpResponse::SYNC_AUTH_ERROR; // Print a log to distinguish this "known failure" from others. - LOG(WARNING) << "ServerConnectionManager forcing SYNC_AUTH_ERROR"; + DVLOG(1) << "ServerConnectionManager forcing SYNC_AUTH_ERROR due to missing" + " auth token"; return false; }
diff --git a/components/test_runner/text_input_controller.cc b/components/test_runner/text_input_controller.cc index 9b5c9828..2cdfd66 100644 --- a/components/test_runner/text_input_controller.cc +++ b/components/test_runner/text_input_controller.cc
@@ -173,7 +173,8 @@ void TextInputController::InsertText(const std::string& text) { if (auto* controller = GetInputMethodController()) { controller->commitText(blink::WebString::fromUTF8(text), - std::vector<blink::WebCompositionUnderline>(), 0); + std::vector<blink::WebCompositionUnderline>(), + blink::WebRange(), 0); } } @@ -221,7 +222,8 @@ } if (auto* controller = GetInputMethodController()) { - controller->setComposition(web_text, underlines, start, start + length); + controller->setComposition(web_text, underlines, blink::WebRange(), start, + start + length); } } @@ -315,7 +317,7 @@ if (auto* controller = GetInputMethodController()) { controller->setComposition( newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), - textLength, textLength); + blink::WebRange(), textLength, textLength); } }
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 934bac4..0cedd5ff 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc
@@ -137,6 +137,14 @@ namespace { +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) && defined(OS_ANDROID) +#if defined __LP64__ +#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor64 +#else +#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor32 +#endif +#endif + // This sets up two singletons responsible for managing field trials. The // |field_trial_list| singleton lives on the stack and must outlive the Run() // method of the process. @@ -170,6 +178,55 @@ base::FeatureList::SetInstance(std::move(feature_list)); } +void InitializeV8IfNeeded( + const base::CommandLine& command_line, + const std::string& process_type) { + if (process_type == switches::kGpuProcess) + return; + +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) +#if defined(OS_POSIX) && !defined(OS_MACOSX) + base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); +#if !defined(OS_ANDROID) + // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared + // with child processes via file descriptors. On Android they are set in + // ChildProcessService::InternalInitChildProcess, otherwise set them here. + if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { + g_fds->Set( + kV8NativesDataDescriptor, + kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); + } + if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { + g_fds->Set( + kV8SnapshotDataDescriptor, + kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); + } +#endif // !OS_ANDROID + int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); + int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); + if (v8_snapshot_fd != -1) { + auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); + gin::V8Initializer::LoadV8SnapshotFromFD( + v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size); + } else { + gin::V8Initializer::LoadV8Snapshot(); + } + if (v8_natives_fd != -1) { + auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); + gin::V8Initializer::LoadV8NativesFromFD( + v8_natives_fd, v8_natives_region.offset, v8_natives_region.size); + } else { + gin::V8Initializer::LoadV8Natives(); + } +#else +#if !defined(CHROME_MULTIPLE_DLL_BROWSER) + gin::V8Initializer::LoadV8Snapshot(); + gin::V8Initializer::LoadV8Natives(); +#endif // !CHROME_MULTIPLE_DLL_BROWSER +#endif // OS_POSIX && !OS_MACOSX +#endif // V8_USE_EXTERNAL_STARTUP_DATA +} + } // namespace #if !defined(CHROME_MULTIPLE_DLL_CHILD) @@ -186,14 +243,6 @@ g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; #endif // !CHROME_MULTIPLE_DLL_BROWSER -#if defined(V8_USE_EXTERNAL_STARTUP_DATA) && defined(OS_ANDROID) -#if defined __LP64__ -#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor64 -#else -#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor32 -#endif -#endif - #if defined(OS_POSIX) // Setup signal-handling state: resanitize most signals, ignore SIGPIPE. @@ -707,46 +756,7 @@ base::StatisticsRecorder::Initialize(); -#if defined(V8_USE_EXTERNAL_STARTUP_DATA) -#if defined(OS_POSIX) && !defined(OS_MACOSX) -#if !defined(OS_ANDROID) - // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared - // with child processes via file descriptors. On Android they are set in - // ChildProcessService::InternalInitChildProcess, otherwise set them here. - if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { - g_fds->Set( - kV8NativesDataDescriptor, - kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); - } - if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { - g_fds->Set( - kV8SnapshotDataDescriptor, - kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); - } -#endif // !OS_ANDROID - int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); - int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); - if (v8_snapshot_fd != -1) { - auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); - gin::V8Initializer::LoadV8SnapshotFromFD( - v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size); - } else { - gin::V8Initializer::LoadV8Snapshot(); - } - if (v8_natives_fd != -1) { - auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); - gin::V8Initializer::LoadV8NativesFromFD( - v8_natives_fd, v8_natives_region.offset, v8_natives_region.size); - } else { - gin::V8Initializer::LoadV8Natives(); - } -#else -#if !defined(CHROME_MULTIPLE_DLL_BROWSER) - gin::V8Initializer::LoadV8Snapshot(); - gin::V8Initializer::LoadV8Natives(); -#endif // !CHROME_MULTIPLE_DLL_BROWSER -#endif // OS_POSIX && !OS_MACOSX -#endif // V8_USE_EXTERNAL_STARTUP_DATA + InitializeV8IfNeeded(command_line, process_type); #if !defined(OFFICIAL_BUILD) #if defined(OS_WIN)
diff --git a/content/browser/accessibility/accessibility_ui.cc b/content/browser/accessibility/accessibility_ui.cc index 2042326f..671a09a 100644 --- a/content/browser/accessibility/accessibility_ui.cc +++ b/content/browser/accessibility/accessibility_ui.cc
@@ -233,6 +233,11 @@ auto* web_contents = static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvh)); AccessibilityMode mode = web_contents->GetAccessibilityMode(); + // Note: this is slightly confusing, because: + // - Turning a11y ON for given web content will always turn it on, however + // - Turning a11y OFF for given web content will revert it to the + // global state (not necessarily off) + // TODO(aleventhal): clear this up through chrome:/accessibility UI update if ((mode & ACCESSIBILITY_MODE_COMPLETE) != ACCESSIBILITY_MODE_COMPLETE) { web_contents->AddAccessibilityMode(ACCESSIBILITY_MODE_COMPLETE); } else {
diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc index 50358c27..de3761d 100644 --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -97,7 +97,7 @@ // JavaScriptDialogManager void RunJavaScriptDialog(WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index deb886a..8ea87f7 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -6266,7 +6266,7 @@ namespace { -// A BrowserMessageFilter that delays the FrameHostMsg_RunJavaScriptMessage IPC +// A BrowserMessageFilter that delays the FrameHostMsg_RunJavaScriptDialog IPC // message until a commit happens on a given WebContents. This allows testing a // race condition. class AllowDialogIPCOnCommitFilter : public BrowserMessageFilter, @@ -6285,7 +6285,7 @@ // BrowserMessageFilter: bool OnMessageReceived(const IPC::Message& message) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (message.type() != FrameHostMsg_RunJavaScriptMessage::ID) + if (message.type() != FrameHostMsg_RunJavaScriptDialog::ID) return false; // Suspend the message.
diff --git a/content/browser/frame_host/render_frame_host_delegate.h b/content/browser/frame_host/render_frame_host_delegate.h index 33f79445..4b6ac1e8 100644 --- a/content/browser/frame_host/render_frame_host_delegate.h +++ b/content/browser/frame_host/render_frame_host_delegate.h
@@ -16,7 +16,7 @@ #include "content/common/content_export.h" #include "content/common/frame_message_enums.h" #include "content/public/browser/site_instance.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "content/public/common/media_stream_request.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "net/http/http_response_headers.h" @@ -93,13 +93,13 @@ virtual void ShowContextMenu(RenderFrameHost* render_frame_host, const ContextMenuParams& params) {} - // A JavaScript message, confirmation or prompt should be shown. - virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host, - const base::string16& message, - const base::string16& default_prompt, - const GURL& frame_url, - JavaScriptMessageType type, - IPC::Message* reply_msg) {} + // A JavaScript alert, confirmation or prompt dialog should be shown. + virtual void RunJavaScriptDialog(RenderFrameHost* render_frame_host, + const base::string16& message, + const base::string16& default_prompt, + const GURL& frame_url, + JavaScriptDialogType type, + IPC::Message* reply_msg) {} virtual void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, bool is_reload,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index d16dea8..6c04e23 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -722,8 +722,8 @@ OnVisualStateResponse) IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted, OnSmartClipDataExtracted) - IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, - OnRunJavaScriptMessage) + IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptDialog, + OnRunJavaScriptDialog) IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, OnRunBeforeUnloadConfirm) IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser) @@ -1688,11 +1688,11 @@ } } -void RenderFrameHostImpl::OnRunJavaScriptMessage( +void RenderFrameHostImpl::OnRunJavaScriptDialog( const base::string16& message, const base::string16& default_prompt, const GURL& frame_url, - JavaScriptMessageType type, + JavaScriptDialogType dialog_type, IPC::Message* reply_msg) { if (!is_active()) { JavaScriptDialogClosed(reply_msg, true, base::string16(), true); @@ -1710,8 +1710,8 @@ // process input events. GetProcess()->SetIgnoreInputEvents(true); render_view_host_->GetWidget()->StopHangMonitorTimeout(); - delegate_->RunJavaScriptMessage(this, message, default_prompt, - frame_url, type, reply_msg); + delegate_->RunJavaScriptDialog(this, message, default_prompt, frame_url, + dialog_type, reply_msg); } void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( @@ -2680,8 +2680,8 @@ blink::WebInputEvent::Undefined, type); } - FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, - success, user_input); + FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, + user_input); Send(reply_msg); // If we are waiting for an unload or beforeunload ack and the user has
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index ff7dec19..80b1c538 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -37,7 +37,7 @@ #include "content/common/image_downloader/image_downloader.mojom.h" #include "content/common/navigation_params.h" #include "content/public/browser/render_frame_host.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "content/public/common/previews_state.h" #include "media/mojo/interfaces/interface_factory.mojom.h" #include "net/http/http_response_headers.h" @@ -695,11 +695,11 @@ void OnContextMenu(const ContextMenuParams& params); void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); void OnVisualStateResponse(uint64_t id); - void OnRunJavaScriptMessage(const base::string16& message, - const base::string16& default_prompt, - const GURL& frame_url, - JavaScriptMessageType type, - IPC::Message* reply_msg); + void OnRunJavaScriptDialog(const base::string16& message, + const base::string16& default_prompt, + const GURL& frame_url, + JavaScriptDialogType dialog_type, + IPC::Message* reply_msg); void OnRunBeforeUnloadConfirm(const GURL& frame_url, bool is_reload, IPC::Message* reply_msg);
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index ea642f7..fd4f3172 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -40,7 +40,7 @@ #include "content/public/browser/web_ui_controller.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/browser_side_navigation_policy.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "content/public/common/previews_state.h" #include "content/public/common/url_constants.h" #include "content/public/common/url_utils.h"
diff --git a/content/browser/notifications/OWNERS b/content/browser/notifications/OWNERS index 818507f3..f525291 100644 --- a/content/browser/notifications/OWNERS +++ b/content/browser/notifications/OWNERS
@@ -1,5 +1,6 @@ # This OWNERS file also covers: # +# //content/child/notifications/ # //content/test/mock_platform_notification_service.* johnme@chromium.org @@ -7,5 +8,5 @@ mvanouwerkerk@chromium.org peter@chromium.org -# TEAM: push-notifications-dev@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications
diff --git a/content/browser/push_messaging/OWNERS b/content/browser/push_messaging/OWNERS index ce8749b2..674687c5 100644 --- a/content/browser/push_messaging/OWNERS +++ b/content/browser/push_messaging/OWNERS
@@ -13,5 +13,5 @@ mvanouwerkerk@chromium.org peter@chromium.org -# TEAM: push-notifications-dev@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: Blink>PushAPI
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index b17fddd..30cc898 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4164,13 +4164,12 @@ context_menu_params); } -void WebContentsImpl::RunJavaScriptMessage( - RenderFrameHost* render_frame_host, - const base::string16& message, - const base::string16& default_prompt, - const GURL& frame_url, - JavaScriptMessageType javascript_message_type, - IPC::Message* reply_msg) { +void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host, + const base::string16& message, + const base::string16& default_prompt, + const GURL& frame_url, + JavaScriptDialogType dialog_type, + IPC::Message* reply_msg) { // Suppress JavaScript dialogs when requested. Also suppress messages when // showing an interstitial as it's shown over the previous page and we don't // want the hidden page's dialogs to interfere with the interstitial. @@ -4183,7 +4182,7 @@ is_showing_javascript_dialog_ = true; dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); dialog_manager_->RunJavaScriptDialog( - this, frame_url, javascript_message_type, message, default_prompt, + this, frame_url, dialog_type, message, default_prompt, base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID(), reply_msg, false),
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 0eaec3a..72e4b50c 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -449,12 +449,12 @@ void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; void ShowContextMenu(RenderFrameHost* render_frame_host, const ContextMenuParams& params) override; - void RunJavaScriptMessage(RenderFrameHost* render_frame_host, - const base::string16& message, - const base::string16& default_prompt, - const GURL& frame_url, - JavaScriptMessageType type, - IPC::Message* reply_msg) override; + void RunJavaScriptDialog(RenderFrameHost* render_frame_host, + const base::string16& message, + const base::string16& default_prompt, + const GURL& frame_url, + JavaScriptDialogType dialog_type, + IPC::Message* reply_msg) override; void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, bool is_reload, IPC::Message* reply_msg) override;
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index 55f38c8..c010c17 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -958,7 +958,7 @@ void RunJavaScriptDialog(WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 238c19b1..f9dcf5d 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2507,10 +2507,10 @@ // While the interstitial is showing, let's simulate the hidden page // attempting to show a JS message. IPC::Message* dummy_message = new IPC::Message; - contents()->RunJavaScriptMessage(main_test_rfh(), - base::ASCIIToUTF16("This is an informative message"), - base::ASCIIToUTF16("OK"), - kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message); + contents()->RunJavaScriptDialog( + main_test_rfh(), base::ASCIIToUTF16("This is an informative message"), + base::ASCIIToUTF16("OK"), kGURL, JAVASCRIPT_DIALOG_TYPE_ALERT, + dummy_message); EXPECT_TRUE(contents()->last_dialog_suppressed_); } @@ -3398,7 +3398,7 @@ void RunJavaScriptDialog(WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/child/notifications/OWNERS b/content/child/notifications/OWNERS index 0563faf7..c7d29e3 100644 --- a/content/child/notifications/OWNERS +++ b/content/child/notifications/OWNERS
@@ -1,7 +1,4 @@ -johnme@chromium.org -mkwst@chromium.org -mvanouwerkerk@chromium.org -peter@chromium.org +file://content/browser/notifications/OWNERS -# TEAM: push-notifications-dev@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications
diff --git a/content/child/push_messaging/OWNERS b/content/child/push_messaging/OWNERS index d09ffef..4898e44 100644 --- a/content/child/push_messaging/OWNERS +++ b/content/child/push_messaging/OWNERS
@@ -1 +1,4 @@ file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 98dd781..cd50f6fa 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -303,6 +303,9 @@ WebRuntimeFeatures::enableTimerThrottlingForHiddenFrames( base::FeatureList::IsEnabled(features::kTimerThrottlingForHiddenFrames)); + WebRuntimeFeatures::enableTouchpadAndWheelScrollLatching( + base::FeatureList::IsEnabled(features::kTouchpadAndWheelScrollLatching)); + if (base::FeatureList::IsEnabled( features::kSendBeaconThrowForBlobWithNonSimpleType)) WebRuntimeFeatures::enableSendBeaconThrowForBlobWithNonSimpleType(true);
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index eec10530..8620dbc 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -35,7 +35,7 @@ #include "content/public/common/file_chooser_params.h" #include "content/public/common/form_field_data.h" #include "content/public/common/frame_navigate_params.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "content/public/common/page_importance_signals.h" #include "content/public/common/page_state.h" #include "content/public/common/previews_state.h" @@ -83,9 +83,9 @@ #define IPC_MESSAGE_START FrameMsgStart -IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::JavaScriptMessageType, - content::JAVASCRIPT_MESSAGE_TYPE_ALERT, - content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) +IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::JavaScriptDialogType, + content::JAVASCRIPT_DIALOG_TYPE_ALERT, + content::JAVASCRIPT_DIALOG_TYPE_PROMPT) IPC_ENUM_TRAITS_MAX_VALUE(FrameMsg_Navigate_Type::Value, FrameMsg_Navigate_Type::NAVIGATE_TYPE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(FrameMsg_UILoadMetricsReportType::Value, @@ -1367,13 +1367,13 @@ base::ListValue /* result */) // A request to run a JavaScript dialog. -IPC_SYNC_MESSAGE_ROUTED4_2(FrameHostMsg_RunJavaScriptMessage, - base::string16 /* in - alert message */, - base::string16 /* in - default prompt */, - GURL /* in - originating page URL */, - content::JavaScriptMessageType /* in - type */, - bool /* out - success */, - base::string16 /* out - user_input field */) +IPC_SYNC_MESSAGE_ROUTED4_2(FrameHostMsg_RunJavaScriptDialog, + base::string16 /* in - alert message */, + base::string16 /* in - default prompt */, + GURL /* in - originating page URL */, + content::JavaScriptDialogType /* in - type */, + bool /* out - success */, + base::string16 /* out - user_input field */) // Displays a dialog to confirm that the user wants to navigate away from the // page. Replies true if yes, and false otherwise. The reply string is ignored,
diff --git a/content/public/browser/javascript_dialog_manager.h b/content/public/browser/javascript_dialog_manager.h index 3598fee..e54da1e 100644 --- a/content/public/browser/javascript_dialog_manager.h +++ b/content/public/browser/javascript_dialog_manager.h
@@ -10,7 +10,7 @@ #include "base/callback.h" #include "base/strings/string16.h" #include "content/common/content_export.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" @@ -28,14 +28,13 @@ // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if // |true| is returned in it, the caller will handle faking the reply. - virtual void RunJavaScriptDialog( - WebContents* web_contents, - const GURL& origin_url, - JavaScriptMessageType javascript_message_type, - const base::string16& message_text, - const base::string16& default_prompt_text, - const DialogClosedCallback& callback, - bool* did_suppress_message) = 0; + virtual void RunJavaScriptDialog(WebContents* web_contents, + const GURL& origin_url, + JavaScriptDialogType dialog_type, + const base::string16& message_text, + const base::string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) = 0; // Displays a dialog asking the user if they want to leave a page. virtual void RunBeforeUnloadDialog(WebContents* web_contents,
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index addcdcbb..9e84aa7 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn
@@ -146,7 +146,7 @@ "frame_navigate_params.h", "injection_test_mac.h", "injection_test_win.h", - "javascript_message_type.h", + "javascript_dialog_type.h", "main_function_params.h", "manifest.cc", "manifest.h",
diff --git a/content/public/common/color_suggestion.cc b/content/public/common/color_suggestion.cc index 457ddd46..807b4ac 100644 --- a/content/public/common/color_suggestion.cc +++ b/content/public/common/color_suggestion.cc
@@ -4,11 +4,10 @@ #include "content/public/common/color_suggestion.h" -#include "third_party/WebKit/public/web/WebColorSuggestion.h" - namespace content { -ColorSuggestion::ColorSuggestion(const blink::WebColorSuggestion& suggestion) - : color(suggestion.color), label(suggestion.label.utf16()) {} +ColorSuggestion::ColorSuggestion(const SkColor& color, + const base::string16& label) + : color(color), label(label) {} } // namespace content
diff --git a/content/public/common/color_suggestion.h b/content/public/common/color_suggestion.h index dcb1a4ef..d54143041 100644 --- a/content/public/common/color_suggestion.h +++ b/content/public/common/color_suggestion.h
@@ -9,17 +9,13 @@ #include "content/common/content_export.h" #include "third_party/skia/include/core/SkColor.h" -namespace blink { -struct WebColorSuggestion; -} - namespace content { // Container for information about datalist suggestion for the color input // control. struct CONTENT_EXPORT ColorSuggestion { ColorSuggestion() {} - explicit ColorSuggestion(const blink::WebColorSuggestion& suggestion); + ColorSuggestion(const SkColor& color, const base::string16& label); SkColor color; base::string16 label;
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index e3b0d9fe..f682df6 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -146,6 +146,10 @@ const base::Feature kOriginTrials{"OriginTrials", base::FEATURE_ENABLED_BY_DEFAULT}; +// Whether a download can be handled by parallel jobs. +const base::Feature kParallelDownloading{ + "ParallelDownloading", base::FEATURE_DISABLED_BY_DEFAULT}; + // Whether document level event listeners should default 'passive' to true. const base::Feature kPassiveDocumentEventListeners{ "PassiveDocumentEventListeners", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index bc8a60d1..12c1543 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -43,6 +43,7 @@ CONTENT_EXPORT extern const base::Feature kMainThreadBusyScrollIntervention; CONTENT_EXPORT extern const base::Feature kOptimizeLoadingIPCForSmallResources; CONTENT_EXPORT extern const base::Feature kOriginTrials; +CONTENT_EXPORT extern const base::Feature kParallelDownloading; CONTENT_EXPORT extern const base::Feature kPassiveDocumentEventListeners; CONTENT_EXPORT extern const base::Feature kPassiveEventListenersDueToFling; CONTENT_EXPORT extern const base::Feature kPepper3DImageChromium;
diff --git a/content/public/common/javascript_dialog_type.h b/content/public/common/javascript_dialog_type.h new file mode 100644 index 0000000..d410f3ba --- /dev/null +++ b/content/public/common/javascript_dialog_type.h
@@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_COMMON_JAVASCRIPT_DIALOG_TYPE_H_ +#define CONTENT_PUBLIC_COMMON_JAVASCRIPT_DIALOG_TYPE_H_ + +namespace content { + +enum JavaScriptDialogType { + JAVASCRIPT_DIALOG_TYPE_ALERT, + JAVASCRIPT_DIALOG_TYPE_CONFIRM, + JAVASCRIPT_DIALOG_TYPE_PROMPT +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_JAVASCRIPT_DIALOG_TYPE_H_
diff --git a/content/public/common/javascript_message_type.h b/content/public/common/javascript_message_type.h deleted file mode 100644 index 8cc59744..0000000 --- a/content/public/common/javascript_message_type.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_PUBLIC_COMMON_JAVASCRIPT_MESSAGE_TYPE_H_ -#define CONTENT_PUBLIC_COMMON_JAVASCRIPT_MESSAGE_TYPE_H_ - -namespace content { - -enum JavaScriptMessageType { - JAVASCRIPT_MESSAGE_TYPE_ALERT, - JAVASCRIPT_MESSAGE_TYPE_CONFIRM, - JAVASCRIPT_MESSAGE_TYPE_PROMPT -}; - -} // namespace content - -#endif // CONTENT_PUBLIC_COMMON_JAVASCRIPT_MESSAGE_TYPE_H_
diff --git a/content/renderer/push_messaging/OWNERS b/content/renderer/push_messaging/OWNERS index d09ffef..4898e44 100644 --- a/content/renderer/push_messaging/OWNERS +++ b/content/renderer/push_messaging/OWNERS
@@ -1 +1,4 @@ file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 5a11cf0..effe56d 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -2310,11 +2310,11 @@ field)); } -bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, - const base::string16& message, - const base::string16& default_value, - const GURL& frame_url, - base::string16* result) { +bool RenderFrameImpl::RunJavaScriptDialog(JavaScriptDialogType type, + const base::string16& message, + const base::string16& default_value, + const GURL& frame_url, + base::string16* result) { // Don't allow further dialogs if we are waiting to swap out, since the // ScopedPageLoadDeferrer in our stack prevents it. if (suppress_further_dialogs_) @@ -2334,8 +2334,8 @@ if (!result) result = &result_temp; - Send(new FrameHostMsg_RunJavaScriptMessage( - routing_id_, message, default_value, frame_url, type, &success, result)); + Send(new FrameHostMsg_RunJavaScriptDialog(routing_id_, message, default_value, + frame_url, type, &success, result)); return success; } @@ -3503,13 +3503,6 @@ TRACE_EVENT1("navigation,benchmark,rail", "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); DCHECK_EQ(frame_, frame); - WebDataSource* ds = frame->provisionalDataSource(); - DCHECK(ds); - - const WebURLRequest& failed_request = ds->getRequest(); - - // Notify the browser that we failed a provisional load with an error. - // // Note: It is important this notification occur before DidStopLoading so the // SSL manager can react to the provisional load failure before being // notified the load stopped. @@ -3519,6 +3512,13 @@ for (auto& observer : observers_) observer.DidFailProvisionalLoad(error); + WebDataSource* ds = frame->provisionalDataSource(); + if (!ds) + return; + + const WebURLRequest& failed_request = ds->getRequest(); + + // Notify the browser that we failed a provisional load with an error. SendFailedProvisionalLoad(failed_request, error, frame); if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) @@ -4078,20 +4078,21 @@ new RendererWebColorChooserImpl(this, client); std::vector<ColorSuggestion> color_suggestions; for (size_t i = 0; i < suggestions.size(); i++) { - color_suggestions.push_back(ColorSuggestion(suggestions[i])); + color_suggestions.push_back( + ColorSuggestion(suggestions[i].color, suggestions[i].label.utf16())); } color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); return color_chooser; } void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) { - RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, message.utf16(), - base::string16(), frame_->document().url(), NULL); + RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_ALERT, message.utf16(), + base::string16(), frame_->document().url(), NULL); } bool RenderFrameImpl::runModalConfirmDialog(const blink::WebString& message) { - return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, message.utf16(), - base::string16(), frame_->document().url(), NULL); + return RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_CONFIRM, message.utf16(), + base::string16(), frame_->document().url(), NULL); } bool RenderFrameImpl::runModalPromptDialog( @@ -4099,9 +4100,9 @@ const blink::WebString& default_value, blink::WebString* actual_value) { base::string16 result; - bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, - message.utf16(), default_value.utf16(), - frame_->document().url(), &result); + bool ok = RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_PROMPT, message.utf16(), + default_value.utf16(), frame_->document().url(), + &result); if (ok) actual_value->assign(WebString::fromUTF16(result)); return ok; @@ -4115,7 +4116,7 @@ bool success = false; // This is an ignored return value, but is included so we can accept the same - // response as RunJavaScriptMessage. + // response as RunJavaScriptDialog. base::string16 ignored_result; Send(new FrameHostMsg_RunBeforeUnloadConfirm( routing_id_, frame_->document().url(), is_reload, &success, @@ -5224,6 +5225,11 @@ std::unique_ptr<HistoryEntry> history_entry; if (request_params.page_state.IsValid()) history_entry = PageStateToHistoryEntry(request_params.page_state); + + // For renderer initiated navigations, we send out a didFailProvisionalLoad() + // notification. + if (request_params.nav_entry_id == 0) + didFailProvisionalLoad(frame_, error, blink::WebStandardCommit); LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); browser_side_navigation_pending_ = false; }
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 3677ee3..cc28f1f4 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -34,7 +34,7 @@ #include "content/common/host_zoom.mojom.h" #include "content/common/renderer.mojom.h" #include "content/public/common/console_message_level.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" #include "content/public/common/previews_state.h" #include "content/public/common/referrer.h" #include "content/public/common/stop_find_action.h" @@ -984,11 +984,11 @@ // selection handles in sync with the webpage. void SyncSelectionIfRequired(); - bool RunJavaScriptMessage(JavaScriptMessageType type, - const base::string16& message, - const base::string16& default_value, - const GURL& frame_url, - base::string16* result); + bool RunJavaScriptDialog(JavaScriptDialogType type, + const base::string16& message, + const base::string16& default_value, + const GURL& frame_url, + base::string16* result); // Loads the appropriate error page for the specified failure into the frame. // |entry| is only used by PlzNavigate when navigating to a history item.
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 645363b2..5b60ffc 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -670,7 +670,7 @@ } bool RenderWidget::ShouldHandleImeEvents() const { - return GetWebWidget()->isWebFrameWidget() && has_focus_; + return GetWebWidget() && GetWebWidget()->isWebFrameWidget() && has_focus_; } void RenderWidget::SetWindowRectSynchronously( @@ -1570,20 +1570,16 @@ return; } #endif - if (replacement_range.IsValid()) { - GetWebWidget()->applyReplacementRange( - WebRange(replacement_range.start(), replacement_range.length())); - } - - if (!GetWebWidget()) - return; ImeEventGuard guard(this); blink::WebInputMethodController* controller = GetInputMethodController(); if (!controller || !controller->setComposition( WebString::fromUTF16(text), - WebVector<WebCompositionUnderline>(underlines), selection_start, - selection_end)) { + WebVector<WebCompositionUnderline>(underlines), + replacement_range.IsValid() + ? WebRange(replacement_range.start(), replacement_range.length()) + : WebRange(), + selection_start, selection_end)) { // If we failed to set the composition text, then we need to let the browser // process to cancel the input method's ongoing composition session, to make // sure we are in a consistent state. @@ -1607,19 +1603,16 @@ return; } #endif - if (replacement_range.IsValid()) { - GetWebWidget()->applyReplacementRange( - WebRange(replacement_range.start(), replacement_range.length())); - } - - if (!GetWebWidget()) - return; ImeEventGuard guard(this); input_handler_->set_handling_input_event(true); if (auto* controller = GetInputMethodController()) - controller->commitText(WebString::fromUTF16(text), - WebVector<WebCompositionUnderline>(underlines), - relative_cursor_pos); + controller->commitText( + WebString::fromUTF16(text), + WebVector<WebCompositionUnderline>(underlines), + replacement_range.IsValid() + ? WebRange(replacement_range.start(), replacement_range.length()) + : WebRange(), + relative_cursor_pos); input_handler_->set_handling_input_event(false); UpdateCompositionInfo(false /* not an immediate request */); }
diff --git a/content/renderer/render_widget_browsertest.cc b/content/renderer/render_widget_browsertest.cc index 051b212..de8e0c8 100644 --- a/content/renderer/render_widget_browsertest.cc +++ b/content/renderer/render_widget_browsertest.cc
@@ -9,6 +9,7 @@ #include "content/renderer/render_widget.h" #include "third_party/WebKit/public/web/WebFrameWidget.h" #include "third_party/WebKit/public/web/WebInputMethodController.h" +#include "third_party/WebKit/public/web/WebRange.h" #include "ui/base/ime/text_input_type.h" namespace content { @@ -130,7 +131,7 @@ blink::WebVector<blink::WebCompositionUnderline> emptyUnderlines; DCHECK(widget()->GetInputMethodController()); widget()->GetInputMethodController()->setComposition("hello", emptyUnderlines, - 3, 3); + blink::WebRange(), 3, 3); gfx::Range range; GetCompositionRange(&range); EXPECT_TRUE(range.IsValid());
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index bd3da17..28a3b10 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -767,3 +767,42 @@ "//url/mojo:url_mojom_gurl", ] } + +group("content_shell_crash_test") { + testonly = true + data_deps = [ + ":content_shell", + "//third_party/mesa:osmesa", + ] + data = [ + "//content/shell/tools/breakpad_integration_test.py", + "//testing/scripts/common.py", + "//testing/scripts/content_shell_crash_test.py", + "//testing/xvfb.py", + ] + if (is_posix) { + data += [ + "//components/crash/content/tools/generate_breakpad_symbols.py", + "//components/crash/content/tools/dmp2minidump.py", + ] + } + if (is_win) { + data_deps += [ ":content_shell_crash_service" ] + } + if (is_posix && !is_android) { + data_deps += [ + "//breakpad:dump_syms($host_toolchain)", + "//breakpad:minidump_stackwalk($host_toolchain)", + ] + } + if (is_android) { + data_deps += [ + "//breakpad:dump_syms", + "//breakpad:microdump_stackwalk", + "//breakpad:minidump_dump", + "//breakpad:minidump_stackwalk", + "//breakpad:symupload", + "//tools/android/forwarder2", + ] + } +}
diff --git a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc index 7e5076d66e..756d7a9 100644 --- a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc +++ b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc
@@ -23,7 +23,7 @@ void LayoutTestJavaScriptDialogManager::RunJavaScriptDialog( WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h index f730cbd..e284dfe03 100644 --- a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h +++ b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h
@@ -22,7 +22,7 @@ // JavaScriptDialogManager: void RunJavaScriptDialog(WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/shell/browser/shell_javascript_dialog.h b/content/shell/browser/shell_javascript_dialog.h index b113385..c4461a6 100644 --- a/content/shell/browser/shell_javascript_dialog.h +++ b/content/shell/browser/shell_javascript_dialog.h
@@ -26,7 +26,7 @@ ShellJavaScriptDialog( ShellJavaScriptDialogManager* manager, gfx::NativeWindow parent_window, - JavaScriptMessageType message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const JavaScriptDialogManager::DialogClosedCallback& callback); @@ -42,7 +42,7 @@ ShellJavaScriptDialogHelper* helper_; // owned #elif defined(OS_WIN) ShellJavaScriptDialogManager* manager_; - JavaScriptMessageType message_type_; + JavaScriptDialogType dialog_type_; HWND dialog_win_; base::string16 message_text_; base::string16 default_prompt_text_;
diff --git a/content/shell/browser/shell_javascript_dialog_mac.mm b/content/shell/browser/shell_javascript_dialog_mac.mm index 73b0f4b..ba3199a7 100644 --- a/content/shell/browser/shell_javascript_dialog_mac.mm +++ b/content/shell/browser/shell_javascript_dialog_mac.mm
@@ -89,13 +89,13 @@ ShellJavaScriptDialog::ShellJavaScriptDialog( ShellJavaScriptDialogManager* manager, gfx::NativeWindow parent_window, - JavaScriptMessageType message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const JavaScriptDialogManager::DialogClosedCallback& callback) : callback_(callback) { - bool text_field = message_type == JAVASCRIPT_MESSAGE_TYPE_PROMPT; - bool one_button = message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT; + bool text_field = dialog_type == JAVASCRIPT_DIALOG_TYPE_PROMPT; + bool one_button = dialog_type == JAVASCRIPT_DIALOG_TYPE_ALERT; helper_ = [[ShellJavaScriptDialogHelper alloc] initHelperWithManager:manager
diff --git a/content/shell/browser/shell_javascript_dialog_manager.cc b/content/shell/browser/shell_javascript_dialog_manager.cc index f720f80..b7991cb 100644 --- a/content/shell/browser/shell_javascript_dialog_manager.cc +++ b/content/shell/browser/shell_javascript_dialog_manager.cc
@@ -24,7 +24,7 @@ void ShellJavaScriptDialogManager::RunJavaScriptDialog( WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -50,11 +50,8 @@ base::ASCIIToUTF16("\n\n") + message_text; gfx::NativeWindow parent_window = web_contents->GetTopLevelNativeWindow(); - dialog_.reset(new ShellJavaScriptDialog(this, - parent_window, - javascript_message_type, - new_message_text, - default_prompt_text, + dialog_.reset(new ShellJavaScriptDialog(this, parent_window, dialog_type, + new_message_text, default_prompt_text, callback)); #else // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if @@ -91,12 +88,10 @@ gfx::NativeWindow parent_window = web_contents->GetTopLevelNativeWindow(); - dialog_.reset(new ShellJavaScriptDialog(this, - parent_window, - JAVASCRIPT_MESSAGE_TYPE_CONFIRM, - message_text, - base::string16(), // default - callback)); + dialog_.reset(new ShellJavaScriptDialog( + this, parent_window, JAVASCRIPT_DIALOG_TYPE_CONFIRM, message_text, + base::string16(), // default + callback)); #else // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if callback.Run(true, base::string16());
diff --git a/content/shell/browser/shell_javascript_dialog_manager.h b/content/shell/browser/shell_javascript_dialog_manager.h index 54482bf..ba627bae 100644 --- a/content/shell/browser/shell_javascript_dialog_manager.h +++ b/content/shell/browser/shell_javascript_dialog_manager.h
@@ -25,7 +25,7 @@ // JavaScriptDialogManager: void RunJavaScriptDialog(WebContents* web_contents, const GURL& origin_url, - JavaScriptMessageType javascript_message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback,
diff --git a/content/shell/browser/shell_javascript_dialog_win.cc b/content/shell/browser/shell_javascript_dialog_win.cc index f35d0f6e..ad18bd8 100644 --- a/content/shell/browser/shell_javascript_dialog_win.cc +++ b/content/shell/browser/shell_javascript_dialog_win.cc
@@ -24,7 +24,7 @@ reinterpret_cast<ShellJavaScriptDialog*>(lparam); owner->dialog_win_ = dialog; SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str()); - if (owner->message_type_ == JAVASCRIPT_MESSAGE_TYPE_PROMPT) + if (owner->dialog_type_ == JAVASCRIPT_DIALOG_TYPE_PROMPT) SetDlgItemText(dialog, IDC_PROMPTEDIT, owner->default_prompt_text_.c_str()); break; @@ -49,7 +49,7 @@ case IDOK: finish = true; result = true; - if (owner->message_type_ == JAVASCRIPT_MESSAGE_TYPE_PROMPT) { + if (owner->dialog_type_ == JAVASCRIPT_DIALOG_TYPE_PROMPT) { int length = GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1; GetDlgItemText(dialog, IDC_PROMPTEDIT, @@ -78,26 +78,26 @@ ShellJavaScriptDialog::ShellJavaScriptDialog( ShellJavaScriptDialogManager* manager, gfx::NativeWindow parent_window, - JavaScriptMessageType message_type, + JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const JavaScriptDialogManager::DialogClosedCallback& callback) : callback_(callback), manager_(manager), - message_type_(message_type), + dialog_type_(dialog_type), message_text_(message_text), default_prompt_text_(default_prompt_text) { - int dialog_type; - if (message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT) - dialog_type = IDD_ALERT; - else if (message_type == JAVASCRIPT_MESSAGE_TYPE_CONFIRM) - dialog_type = IDD_CONFIRM; - else // JAVASCRIPT_MESSAGE_TYPE_PROMPT - dialog_type = IDD_PROMPT; + int dialog_resource; + if (dialog_type == JAVASCRIPT_DIALOG_TYPE_ALERT) + dialog_resource = IDD_ALERT; + else if (dialog_type == JAVASCRIPT_DIALOG_TYPE_CONFIRM) + dialog_resource = IDD_CONFIRM; + else // JAVASCRIPT_DIALOG_TYPE_PROMPT + dialog_resource = IDD_PROMPT; - dialog_win_ = CreateDialogParam(GetModuleHandle(0), - MAKEINTRESOURCE(dialog_type), 0, DialogProc, - reinterpret_cast<LPARAM>(this)); + dialog_win_ = + CreateDialogParam(GetModuleHandle(0), MAKEINTRESOURCE(dialog_resource), 0, + DialogProc, reinterpret_cast<LPARAM>(this)); ShowWindow(dialog_win_, SW_SHOWNORMAL); }
diff --git a/content/shell/tools/breakpad_integration_test.py b/content/shell/tools/breakpad_integration_test.py index 7e16ffd..9e31ad7 100755 --- a/content/shell/tools/breakpad_integration_test.py +++ b/content/shell/tools/breakpad_integration_test.py
@@ -11,6 +11,7 @@ import glob +import json import optparse import os import shutil @@ -34,6 +35,8 @@ type='int', help='Number of parallel tasks to run.') parser.add_option('-v', '--verbose', action='store_true', help='Print verbose status output.') + parser.add_option('', '--json', default='', + help='Path to JSON output.') (options, _) = parser.parse_args() @@ -130,10 +133,17 @@ except: print "FAIL: %s" % failure + if options.json: + with open(options.json, 'w') as json_file: + json.dump([failure], json_file) + return 1 else: print "PASS: Breakpad integration test ran successfully." + if options.json: + with open(options.json, 'w') as json_file: + json.dump([], json_file) return 0 finally:
diff --git a/docs/android_studio.md b/docs/android_studio.md index 2815238..511d5e4e 100644 --- a/docs/android_studio.md +++ b/docs/android_studio.md
@@ -21,7 +21,7 @@ to generate projects for: ```shell -build/android/gradle/generate_gradle.py --target //some:target_apk --target //some/other:target_apk +build/android/gradle/generate_gradle.py --target //chrome/android:chrome_public_apk --target //android_webview/test:android_webview_apk ``` For first-time Android Studio users: @@ -34,14 +34,15 @@ To import the project: * Use "Import Project", and select the directory containing the generated - project, by default `out-gn/Debug/gradle`. + project, by default `out/Debug/gradle`. You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change. * After regenerating, Android Studio should prompt you to "Sync". If it doesn't, use: + * Button with two arrows on the right side of the top strip. * Help -> Find Action -> "Sync Project with Gradle Files" - + * After `gn clean` you may need to restart Android Studio. ## How it Works @@ -115,7 +116,7 @@ * Add the line `org.gradle.daemon=true` to `~/.gradle/gradle.properties`, creating it if necessary. -## Status (as of Jan 19, 2017) +## Status (as of Feb 7th, 2017) ### What works @@ -123,10 +124,12 @@ * Java editing and gradle compile works. * Instrumentation tests included as androidTest. * Symlinks to existing .so files in jniLibs (doesn't generate them). +* Editing resource xml files. ### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034)) -* Make gradle aware of resources and assets +* Make gradle aware of assets +* Layout editor * Add a mode in which gradle is responsible for generating `R.java` * Add support for native code editing * Make the "Make Project" button work correctly
diff --git a/docs/code_reviews.md b/docs/code_reviews.md index fb307e2..6efe906 100644 --- a/docs/code_reviews.md +++ b/docs/code_reviews.md
@@ -172,7 +172,7 @@ * ``` -The text `set noparent` it will stop owner propagation from parent directories. +The text `set noparent` will stop owner propagation from parent directories. This is used for specialized code. In this example, only the two listed people are owners: ```
diff --git a/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc b/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc index 200559c..e420cdc 100644 --- a/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc +++ b/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc
@@ -16,14 +16,14 @@ namespace { -std::string JavaScriptMessageTypeToString( - content::JavaScriptMessageType message_type) { - switch (message_type) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: +std::string JavaScriptDialogTypeToString( + content::JavaScriptDialogType dialog_type) { + switch (dialog_type) { + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: return "alert"; - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: return "confirm"; - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: return "prompt"; default: NOTREACHED() << "Unknown JavaScript Message Type."; @@ -43,7 +43,7 @@ void JavaScriptDialogHelper::RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType javascript_message_type, + content::JavaScriptDialogType dialog_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -54,9 +54,9 @@ new base::StringValue(base::UTF16ToUTF8(default_prompt_text))); request_info.Set(webview::kMessageText, new base::StringValue(base::UTF16ToUTF8(message_text))); - request_info.Set(webview::kMessageType, - new base::StringValue( - JavaScriptMessageTypeToString(javascript_message_type))); + request_info.Set( + webview::kMessageType, + new base::StringValue(JavaScriptDialogTypeToString(dialog_type))); request_info.Set(guest_view::kUrl, new base::StringValue(origin_url.spec())); WebViewPermissionHelper* web_view_permission_helper = WebViewPermissionHelper::FromWebContents(web_contents);
diff --git a/extensions/browser/guest_view/web_view/javascript_dialog_helper.h b/extensions/browser/guest_view/web_view/javascript_dialog_helper.h index 87e63cb..257108f 100644 --- a/extensions/browser/guest_view/web_view/javascript_dialog_helper.h +++ b/extensions/browser/guest_view/web_view/javascript_dialog_helper.h
@@ -18,14 +18,13 @@ ~JavaScriptDialogHelper() override; // JavaScriptDialogManager implementation. - void RunJavaScriptDialog( - content::WebContents* web_contents, - const GURL& origin_url, - content::JavaScriptMessageType javascript_message_type, - const base::string16& message_text, - const base::string16& default_prompt_text, - const DialogClosedCallback& callback, - bool* did_suppress_message) override; + void RunJavaScriptDialog(content::WebContents* web_contents, + const GURL& origin_url, + content::JavaScriptDialogType dialog_type, + const base::string16& message_text, + const base::string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) override; void RunBeforeUnloadDialog(content::WebContents* web_contents, bool is_reload, const DialogClosedCallback& callback) override;
diff --git a/headless/BUILD.gn b/headless/BUILD.gn index c951aa5..84049c5 100644 --- a/headless/BUILD.gn +++ b/headless/BUILD.gn
@@ -255,6 +255,7 @@ "public/util/in_memory_request_job.h", "public/util/managed_dispatch_url_request_job.cc", "public/util/managed_dispatch_url_request_job.h", + "public/util/navigation_request.h", "public/util/testing/generic_url_request_mocks.cc", "public/util/testing/generic_url_request_mocks.h", "public/util/url_fetcher.cc", @@ -407,8 +408,11 @@ static_library("headless_shell_lib") { sources = [ "app/headless_shell.cc", + "app/headless_shell.h", "app/headless_shell_switches.cc", "app/headless_shell_switches.h", + "app/shell_navigation_request.cc", + "app/shell_navigation_request.h", "public/headless_shell.h", ]
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc index 942fb9bb..91b17493 100644 --- a/headless/app/headless_shell.cc +++ b/headless/app/headless_shell.cc
@@ -13,23 +13,13 @@ #include "base/files/file_path.h" #include "base/json/json_writer.h" #include "base/location.h" -#include "base/memory/ptr_util.h" -#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" +#include "headless/app/headless_shell.h" #include "headless/app/headless_shell_switches.h" -#include "headless/public/devtools/domains/emulation.h" -#include "headless/public/devtools/domains/inspector.h" -#include "headless/public/devtools/domains/page.h" -#include "headless/public/devtools/domains/runtime.h" -#include "headless/public/headless_browser.h" -#include "headless/public/headless_devtools_client.h" #include "headless/public/headless_devtools_target.h" -#include "headless/public/headless_web_contents.h" -#include "headless/public/util/deterministic_dispatcher.h" #include "headless/public/util/deterministic_http_protocol_handler.h" -#include "net/base/file_stream.h" #include "net/base/io_buffer.h" #include "net/base/ip_address.h" #include "net/base/net_errors.h" @@ -54,351 +44,351 @@ } } // namespace -// An application which implements a simple headless browser. -class HeadlessShell : public HeadlessWebContents::Observer, - emulation::ExperimentalObserver, - inspector::ExperimentalObserver, - page::Observer { - public: - HeadlessShell() - : browser_(nullptr), - devtools_client_(HeadlessDevToolsClient::Create()), - web_contents_(nullptr), - processed_page_ready_(false), - browser_context_(nullptr), - weak_factory_(this) {} - ~HeadlessShell() override {} +HeadlessShell::HeadlessShell() + : browser_(nullptr), + devtools_client_(HeadlessDevToolsClient::Create()), + web_contents_(nullptr), + processed_page_ready_(false), + browser_context_(nullptr), + weak_factory_(this) {} - void OnStart(HeadlessBrowser* browser) { - browser_ = browser; +HeadlessShell::~HeadlessShell() {} - HeadlessBrowserContext::Builder context_builder = - browser_->CreateBrowserContextBuilder(); - // TODO(eseckler): These switches should also affect BrowserContexts that - // are created via DevTools later. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDeterministicFetch)) { - deterministic_dispatcher_.reset( - new DeterministicDispatcher(browser_->BrowserIOThread())); +void HeadlessShell::OnStart(HeadlessBrowser* browser) { + browser_ = browser; - ProtocolHandlerMap protocol_handlers; - protocol_handlers[url::kHttpScheme] = - base::MakeUnique<DeterministicHttpProtocolHandler>( - deterministic_dispatcher_.get(), browser->BrowserIOThread()); - protocol_handlers[url::kHttpsScheme] = - base::MakeUnique<DeterministicHttpProtocolHandler>( - deterministic_dispatcher_.get(), browser->BrowserIOThread()); + HeadlessBrowserContext::Builder context_builder = + browser_->CreateBrowserContextBuilder(); + // TODO(eseckler): These switches should also affect BrowserContexts that + // are created via DevTools later. + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDeterministicFetch)) { + deterministic_dispatcher_.reset( + new DeterministicDispatcher(browser_->BrowserIOThread())); - context_builder.SetProtocolHandlers(std::move(protocol_handlers)); - } - browser_context_ = context_builder.Build(); - browser_->SetDefaultBrowserContext(browser_context_); + ProtocolHandlerMap protocol_handlers; + protocol_handlers[url::kHttpScheme] = + base::MakeUnique<DeterministicHttpProtocolHandler>( + deterministic_dispatcher_.get(), browser->BrowserIOThread()); + protocol_handlers[url::kHttpsScheme] = + base::MakeUnique<DeterministicHttpProtocolHandler>( + deterministic_dispatcher_.get(), browser->BrowserIOThread()); - HeadlessWebContents::Builder builder( - browser_context_->CreateWebContentsBuilder()); - base::CommandLine::StringVector args = - base::CommandLine::ForCurrentProcess()->GetArgs(); - - // TODO(alexclarke): Should we navigate to about:blank first if using - // virtual time? - if (args.empty()) - args.push_back("about:blank"); - for (auto it = args.rbegin(); it != args.rend(); ++it) { - GURL url(*it); - HeadlessWebContents* web_contents = builder.SetInitialURL(url).Build(); - if (!web_contents) { - LOG(ERROR) << "Navigation to " << url << " failed"; - browser_->Shutdown(); - return; - } - if (!web_contents_ && !RemoteDebuggingEnabled()) { - // TODO(jzfeng): Support observing multiple targets. - url_ = url; - web_contents_ = web_contents; - web_contents_->AddObserver(this); - } - } + context_builder.SetProtocolHandlers(std::move(protocol_handlers)); } + browser_context_ = context_builder.Build(); + browser_->SetDefaultBrowserContext(browser_context_); - void Shutdown() { - if (!web_contents_) - return; - if (!RemoteDebuggingEnabled()) { - devtools_client_->GetEmulation()->GetExperimental()->RemoveObserver(this); - devtools_client_->GetInspector()->GetExperimental()->RemoveObserver(this); - devtools_client_->GetPage()->RemoveObserver(this); - if (web_contents_->GetDevToolsTarget()) { - web_contents_->GetDevToolsTarget()->DetachClient( - devtools_client_.get()); - } - } - web_contents_->RemoveObserver(this); - web_contents_ = nullptr; - browser_context_->Close(); - browser_->Shutdown(); - } + HeadlessWebContents::Builder builder( + browser_context_->CreateWebContentsBuilder()); + base::CommandLine::StringVector args = + base::CommandLine::ForCurrentProcess()->GetArgs(); - // HeadlessWebContents::Observer implementation: - void DevToolsTargetReady() override { - web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get()); - devtools_client_->GetInspector()->GetExperimental()->AddObserver(this); - devtools_client_->GetPage()->AddObserver(this); - devtools_client_->GetPage()->Enable(); - // Check if the document had already finished loading by the time we - // attached. - - devtools_client_->GetEmulation()->GetExperimental()->AddObserver(this); - - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kVirtualTimeBudget)) { - std::string budget_ms_ascii = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kVirtualTimeBudget); - int budget_ms; - CHECK(base::StringToInt(budget_ms_ascii, &budget_ms)) - << "Expected an integer value for --virtual-time-budget="; - devtools_client_->GetEmulation()->GetExperimental()->SetVirtualTimePolicy( - emulation::SetVirtualTimePolicyParams::Builder() - .SetPolicy(emulation::VirtualTimePolicy:: - PAUSE_IF_NETWORK_FETCHES_PENDING) - .SetBudget(budget_ms) - .Build()); - } else { - PollReadyState(); - } - - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTimeout)) { - std::string timeout_ms_ascii = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kTimeout); - int timeout_ms; - CHECK(base::StringToInt(timeout_ms_ascii, &timeout_ms)) - << "Expected an integer value for --timeout="; - browser_->BrowserMainThread()->PostDelayedTask( - FROM_HERE, - base::Bind(&HeadlessShell::FetchTimeout, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(timeout_ms)); - } - - // TODO(skyostil): Implement more features to demonstrate the devtools API. - } - - void FetchTimeout() { - LOG(INFO) << "Timeout."; - devtools_client_->GetPage()->GetExperimental()->StopLoading( - page::StopLoadingParams::Builder().Build()); - } - - void OnTargetCrashed(const inspector::TargetCrashedParams& params) override { - LOG(ERROR) << "Abnormal renderer termination."; - // NB this never gets called if remote debugging is enabled. - Shutdown(); - } - - void PollReadyState() { - // We need to check the current location in addition to the ready state to - // be sure the expected page is ready. - devtools_client_->GetRuntime()->Evaluate( - "document.readyState + ' ' + document.location.href", - base::Bind(&HeadlessShell::OnReadyState, weak_factory_.GetWeakPtr())); - } - - void OnReadyState(std::unique_ptr<runtime::EvaluateResult> result) { - std::string ready_state_and_url; - if (result->GetResult()->GetValue()->GetAsString(&ready_state_and_url)) { - std::stringstream stream(ready_state_and_url); - std::string ready_state; - std::string url; - stream >> ready_state; - stream >> url; - - if (ready_state == "complete" && - (url_.spec() == url || url != "about:blank")) { - OnPageReady(); - return; - } - } - } - - // emulation::Observer implementation: - void OnVirtualTimeBudgetExpired( - const emulation::VirtualTimeBudgetExpiredParams& params) override { - OnPageReady(); - } - - // page::Observer implementation: - void OnLoadEventFired(const page::LoadEventFiredParams& params) override { - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kVirtualTimeBudget)) { + // TODO(alexclarke): Should we navigate to about:blank first if using + // virtual time? + if (args.empty()) + args.push_back("about:blank"); + for (auto it = args.rbegin(); it != args.rend(); ++it) { + GURL url(*it); + HeadlessWebContents* web_contents = builder.SetInitialURL(url).Build(); + if (!web_contents) { + LOG(ERROR) << "Navigation to " << url << " failed"; + browser_->Shutdown(); return; } - OnPageReady(); - } - - void OnPageReady() { - if (processed_page_ready_) - return; - processed_page_ready_ = true; - - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpDom)) { - FetchDom(); - } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kRepl)) { - LOG(INFO) - << "Type a Javascript expression to evaluate or \"quit\" to exit."; - InputExpression(); - } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kScreenshot)) { - CaptureScreenshot(); - } else { - Shutdown(); + if (!web_contents_ && !RemoteDebuggingEnabled()) { + // TODO(jzfeng): Support observing multiple targets. + url_ = url; + web_contents_ = web_contents; + web_contents_->AddObserver(this); } } +} - void FetchDom() { - devtools_client_->GetRuntime()->Evaluate( - "document.body.innerHTML", - base::Bind(&HeadlessShell::OnDomFetched, weak_factory_.GetWeakPtr())); +void HeadlessShell::Shutdown() { + if (!web_contents_) + return; + if (!RemoteDebuggingEnabled()) { + devtools_client_->GetEmulation()->GetExperimental()->RemoveObserver(this); + devtools_client_->GetInspector()->GetExperimental()->RemoveObserver(this); + devtools_client_->GetPage()->GetExperimental()->RemoveObserver(this); + if (web_contents_->GetDevToolsTarget()) { + web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); + } + } + web_contents_->RemoveObserver(this); + web_contents_ = nullptr; + browser_context_->Close(); + browser_->Shutdown(); +} + +void HeadlessShell::DevToolsTargetReady() { + web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get()); + devtools_client_->GetInspector()->GetExperimental()->AddObserver(this); + devtools_client_->GetPage()->GetExperimental()->AddObserver(this); + devtools_client_->GetPage()->Enable(); + // Check if the document had already finished loading by the time we + // attached. + + devtools_client_->GetEmulation()->GetExperimental()->AddObserver(this); + + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDeterministicFetch)) { + devtools_client_->GetPage()->GetExperimental()->SetControlNavigations( + headless::page::SetControlNavigationsParams::Builder() + .SetEnabled(true) + .Build()); } - void OnDomFetched(std::unique_ptr<runtime::EvaluateResult> result) { - if (result->HasExceptionDetails()) { - LOG(ERROR) << "Failed to evaluate document.body.innerHTML: " - << result->GetExceptionDetails()->GetText(); - } else { - std::string dom; - if (result->GetResult()->GetValue()->GetAsString(&dom)) { - printf("%s\n", dom.c_str()); - } - } - Shutdown(); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kVirtualTimeBudget)) { + std::string budget_ms_ascii = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kVirtualTimeBudget); + int budget_ms; + CHECK(base::StringToInt(budget_ms_ascii, &budget_ms)) + << "Expected an integer value for --virtual-time-budget="; + devtools_client_->GetEmulation()->GetExperimental()->SetVirtualTimePolicy( + emulation::SetVirtualTimePolicyParams::Builder() + .SetPolicy( + emulation::VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING) + .SetBudget(budget_ms) + .Build()); + } else { + PollReadyState(); } - void InputExpression() { - // Note that a real system should read user input asynchronously, because - // otherwise all other browser activity is suspended (e.g., page loading). - printf(">>> "); - std::stringstream expression; - while (true) { - int c = fgetc(stdin); - if (c == EOF || c == '\n') { - break; - } - expression << static_cast<char>(c); - } - if (expression.str() == "quit") { - Shutdown(); + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTimeout)) { + std::string timeout_ms_ascii = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kTimeout); + int timeout_ms; + CHECK(base::StringToInt(timeout_ms_ascii, &timeout_ms)) + << "Expected an integer value for --timeout="; + browser_->BrowserMainThread()->PostDelayedTask( + FROM_HERE, + base::Bind(&HeadlessShell::FetchTimeout, weak_factory_.GetWeakPtr()), + base::TimeDelta::FromMilliseconds(timeout_ms)); + } + + // TODO(skyostil): Implement more features to demonstrate the devtools API. +} + +void HeadlessShell::FetchTimeout() { + LOG(INFO) << "Timeout."; + devtools_client_->GetPage()->GetExperimental()->StopLoading( + page::StopLoadingParams::Builder().Build()); +} + +void HeadlessShell::OnTargetCrashed( + const inspector::TargetCrashedParams& params) { + LOG(ERROR) << "Abnormal renderer termination."; + // NB this never gets called if remote debugging is enabled. + Shutdown(); +} + +void HeadlessShell::PollReadyState() { + // We need to check the current location in addition to the ready state to + // be sure the expected page is ready. + devtools_client_->GetRuntime()->Evaluate( + "document.readyState + ' ' + document.location.href", + base::Bind(&HeadlessShell::OnReadyState, weak_factory_.GetWeakPtr())); +} + +void HeadlessShell::OnReadyState( + std::unique_ptr<runtime::EvaluateResult> result) { + std::string ready_state_and_url; + if (result->GetResult()->GetValue()->GetAsString(&ready_state_and_url)) { + std::stringstream stream(ready_state_and_url); + std::string ready_state; + std::string url; + stream >> ready_state; + stream >> url; + + if (ready_state == "complete" && + (url_.spec() == url || url != "about:blank")) { + OnPageReady(); return; } - devtools_client_->GetRuntime()->Evaluate( - expression.str(), base::Bind(&HeadlessShell::OnExpressionResult, - weak_factory_.GetWeakPtr())); } +} - void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result) { - std::unique_ptr<base::Value> value = result->Serialize(); - std::string result_json; - base::JSONWriter::Write(*value, &result_json); - printf("%s\n", result_json.c_str()); +// emulation::Observer implementation: +void HeadlessShell::OnVirtualTimeBudgetExpired( + const emulation::VirtualTimeBudgetExpiredParams& params) { + OnPageReady(); +} + +// page::Observer implementation: +void HeadlessShell::OnLoadEventFired(const page::LoadEventFiredParams& params) { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kVirtualTimeBudget)) { + return; + } + OnPageReady(); +} + +void HeadlessShell::OnNavigationRequested( + const headless::page::NavigationRequestedParams& params) { + deterministic_dispatcher_->NavigationRequested( + base::MakeUnique<ShellNavigationRequest>(weak_factory_.GetWeakPtr(), + params)); +} + +void HeadlessShell::OnPageReady() { + if (processed_page_ready_) + return; + processed_page_ready_ = true; + + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpDom)) { + FetchDom(); + } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kRepl)) { + LOG(INFO) + << "Type a Javascript expression to evaluate or \"quit\" to exit."; InputExpression(); + } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kScreenshot)) { + CaptureScreenshot(); + } else { + Shutdown(); } +} - void CaptureScreenshot() { - devtools_client_->GetPage()->GetExperimental()->CaptureScreenshot( - page::CaptureScreenshotParams::Builder().Build(), - base::Bind(&HeadlessShell::OnScreenshotCaptured, - weak_factory_.GetWeakPtr())); - } +void HeadlessShell::FetchDom() { + devtools_client_->GetRuntime()->Evaluate( + "document.body.innerHTML", + base::Bind(&HeadlessShell::OnDomFetched, weak_factory_.GetWeakPtr())); +} - void OnScreenshotCaptured( - std::unique_ptr<page::CaptureScreenshotResult> result) { - base::FilePath file_name = - base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( - switches::kScreenshot); - if (file_name.empty()) { - file_name = base::FilePath().AppendASCII(kDefaultScreenshotFileName); - } - - screenshot_file_stream_.reset( - new net::FileStream(browser_->BrowserFileThread())); - const int open_result = screenshot_file_stream_->Open( - file_name, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | - base::File::FLAG_ASYNC, - base::Bind(&HeadlessShell::OnScreenshotFileOpened, - weak_factory_.GetWeakPtr(), base::Passed(std::move(result)), - file_name)); - if (open_result != net::ERR_IO_PENDING) { - // Operation could not be started. - OnScreenshotFileOpened(nullptr, file_name, open_result); +void HeadlessShell::OnDomFetched( + std::unique_ptr<runtime::EvaluateResult> result) { + if (result->HasExceptionDetails()) { + LOG(ERROR) << "Failed to evaluate document.body.innerHTML: " + << result->GetExceptionDetails()->GetText(); + } else { + std::string dom; + if (result->GetResult()->GetValue()->GetAsString(&dom)) { + printf("%s\n", dom.c_str()); } } + Shutdown(); +} - void OnScreenshotFileOpened( - std::unique_ptr<page::CaptureScreenshotResult> result, - const base::FilePath file_name, - const int open_result) { - if (open_result != net::OK) { - LOG(ERROR) << "Writing screenshot to file " << file_name.value() - << " was unsuccessful, could not open file: " - << net::ErrorToString(open_result); - return; +void HeadlessShell::InputExpression() { + // Note that a real system should read user input asynchronously, because + // otherwise all other browser activity is suspended (e.g., page loading). + printf(">>> "); + std::stringstream expression; + while (true) { + int c = fgetc(stdin); + if (c == EOF || c == '\n') { + break; } + expression << static_cast<char>(c); + } + if (expression.str() == "quit") { + Shutdown(); + return; + } + devtools_client_->GetRuntime()->Evaluate( + expression.str(), base::Bind(&HeadlessShell::OnExpressionResult, + weak_factory_.GetWeakPtr())); +} - std::string decoded_png; - base::Base64Decode(result->GetData(), &decoded_png); - scoped_refptr<net::IOBufferWithSize> buf = - new net::IOBufferWithSize(decoded_png.size()); - memcpy(buf->data(), decoded_png.data(), decoded_png.size()); - const int write_result = screenshot_file_stream_->Write( - buf.get(), buf->size(), - base::Bind(&HeadlessShell::OnScreenshotFileWritten, - weak_factory_.GetWeakPtr(), file_name, buf->size())); - if (write_result != net::ERR_IO_PENDING) { - // Operation may have completed successfully or failed. - OnScreenshotFileWritten(file_name, buf->size(), write_result); - } +void HeadlessShell::OnExpressionResult( + std::unique_ptr<runtime::EvaluateResult> result) { + std::unique_ptr<base::Value> value = result->Serialize(); + std::string result_json; + base::JSONWriter::Write(*value, &result_json); + printf("%s\n", result_json.c_str()); + InputExpression(); +} + +void HeadlessShell::CaptureScreenshot() { + devtools_client_->GetPage()->GetExperimental()->CaptureScreenshot( + page::CaptureScreenshotParams::Builder().Build(), + base::Bind(&HeadlessShell::OnScreenshotCaptured, + weak_factory_.GetWeakPtr())); +} + +void HeadlessShell::OnScreenshotCaptured( + std::unique_ptr<page::CaptureScreenshotResult> result) { + base::FilePath file_name = + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( + switches::kScreenshot); + if (file_name.empty()) { + file_name = base::FilePath().AppendASCII(kDefaultScreenshotFileName); } - void OnScreenshotFileWritten(const base::FilePath file_name, - const int length, - const int write_result) { - if (write_result < length) { - // TODO(eseckler): Support recovering from partial writes. - LOG(ERROR) << "Writing screenshot to file " << file_name.value() - << " was unsuccessful: " << net::ErrorToString(write_result); - } else { - LOG(INFO) << "Screenshot written to file " << file_name.value() << "." - << std::endl; - } - int close_result = screenshot_file_stream_->Close(base::Bind( - &HeadlessShell::OnScreenshotFileClosed, weak_factory_.GetWeakPtr())); - if (close_result != net::ERR_IO_PENDING) { - // Operation could not be started. - OnScreenshotFileClosed(close_result); - } + screenshot_file_stream_.reset( + new net::FileStream(browser_->BrowserFileThread())); + const int open_result = screenshot_file_stream_->Open( + file_name, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | + base::File::FLAG_ASYNC, + base::Bind(&HeadlessShell::OnScreenshotFileOpened, + weak_factory_.GetWeakPtr(), base::Passed(std::move(result)), + file_name)); + if (open_result != net::ERR_IO_PENDING) { + // Operation could not be started. + OnScreenshotFileOpened(nullptr, file_name, open_result); + } +} + +void HeadlessShell::OnScreenshotFileOpened( + std::unique_ptr<page::CaptureScreenshotResult> result, + const base::FilePath file_name, + const int open_result) { + if (open_result != net::OK) { + LOG(ERROR) << "Writing screenshot to file " << file_name.value() + << " was unsuccessful, could not open file: " + << net::ErrorToString(open_result); + return; } - void OnScreenshotFileClosed(const int close_result) { Shutdown(); } - - bool RemoteDebuggingEnabled() const { - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - return command_line.HasSwitch(switches::kRemoteDebuggingPort); + std::string decoded_png; + base::Base64Decode(result->GetData(), &decoded_png); + scoped_refptr<net::IOBufferWithSize> buf = + new net::IOBufferWithSize(decoded_png.size()); + memcpy(buf->data(), decoded_png.data(), decoded_png.size()); + const int write_result = screenshot_file_stream_->Write( + buf.get(), buf->size(), + base::Bind(&HeadlessShell::OnScreenshotFileWritten, + weak_factory_.GetWeakPtr(), file_name, buf->size())); + if (write_result != net::ERR_IO_PENDING) { + // Operation may have completed successfully or failed. + OnScreenshotFileWritten(file_name, buf->size(), write_result); } +} - private: - GURL url_; - HeadlessBrowser* browser_; // Not owned. - std::unique_ptr<HeadlessDevToolsClient> devtools_client_; - HeadlessWebContents* web_contents_; - bool processed_page_ready_; - std::unique_ptr<net::FileStream> screenshot_file_stream_; - HeadlessBrowserContext* browser_context_; - std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; - base::WeakPtrFactory<HeadlessShell> weak_factory_; +void HeadlessShell::OnScreenshotFileWritten(const base::FilePath file_name, + const int length, + const int write_result) { + if (write_result < length) { + // TODO(eseckler): Support recovering from partial writes. + LOG(ERROR) << "Writing screenshot to file " << file_name.value() + << " was unsuccessful: " << net::ErrorToString(write_result); + } else { + LOG(INFO) << "Screenshot written to file " << file_name.value() << "." + << std::endl; + } + int close_result = screenshot_file_stream_->Close(base::Bind( + &HeadlessShell::OnScreenshotFileClosed, weak_factory_.GetWeakPtr())); + if (close_result != net::ERR_IO_PENDING) { + // Operation could not be started. + OnScreenshotFileClosed(close_result); + } +} - DISALLOW_COPY_AND_ASSIGN(HeadlessShell); -}; +void HeadlessShell::OnScreenshotFileClosed(const int close_result) { + Shutdown(); +} + +bool HeadlessShell::RemoteDebuggingEnabled() const { + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + return command_line.HasSwitch(switches::kRemoteDebuggingPort); +} bool ValidateCommandLine(const base::CommandLine& command_line) { if (!command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
diff --git a/headless/app/headless_shell.h b/headless/app/headless_shell.h new file mode 100644 index 0000000..acb2fd47 --- /dev/null +++ b/headless/app/headless_shell.h
@@ -0,0 +1,96 @@ +// 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/memory/weak_ptr.h" +#include "headless/app/shell_navigation_request.h" +#include "headless/public/devtools/domains/emulation.h" +#include "headless/public/devtools/domains/inspector.h" +#include "headless/public/devtools/domains/page.h" +#include "headless/public/devtools/domains/runtime.h" +#include "headless/public/headless_browser.h" +#include "headless/public/headless_devtools_client.h" +#include "headless/public/headless_web_contents.h" +#include "headless/public/util/deterministic_dispatcher.h" +#include "net/base/file_stream.h" + +namespace headless { + +// An application which implements a simple headless browser. +class HeadlessShell : public HeadlessWebContents::Observer, + emulation::ExperimentalObserver, + inspector::ExperimentalObserver, + page::ExperimentalObserver { + public: + HeadlessShell(); + ~HeadlessShell() override; + + // HeadlessWebContents::Observer implementation: + void DevToolsTargetReady() override; + void OnTargetCrashed(const inspector::TargetCrashedParams& params) override; + + // emulation::Observer implementation: + void OnVirtualTimeBudgetExpired( + const emulation::VirtualTimeBudgetExpiredParams& params) override; + + // page::Observer implementation: + void OnLoadEventFired(const page::LoadEventFiredParams& params) override; + void OnNavigationRequested( + const headless::page::NavigationRequestedParams& params) override; + + void OnStart(HeadlessBrowser* browser); + void Shutdown(); + + void FetchTimeout(); + + void PollReadyState(); + + void OnReadyState(std::unique_ptr<runtime::EvaluateResult> result); + + void OnPageReady(); + + void FetchDom(); + + void OnDomFetched(std::unique_ptr<runtime::EvaluateResult> result); + + void InputExpression(); + + void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); + + void CaptureScreenshot(); + + void OnScreenshotCaptured( + std::unique_ptr<page::CaptureScreenshotResult> result); + + void OnScreenshotFileOpened( + std::unique_ptr<page::CaptureScreenshotResult> result, + const base::FilePath file_name, + const int open_result); + + void OnScreenshotFileWritten(const base::FilePath file_name, + const int length, + const int write_result); + + void OnScreenshotFileClosed(const int close_result); + + bool RemoteDebuggingEnabled() const; + + HeadlessDevToolsClient* devtools_client() const { + return devtools_client_.get(); + } + + private: + GURL url_; + HeadlessBrowser* browser_; // Not owned. + std::unique_ptr<HeadlessDevToolsClient> devtools_client_; + HeadlessWebContents* web_contents_; + bool processed_page_ready_; + std::unique_ptr<net::FileStream> screenshot_file_stream_; + HeadlessBrowserContext* browser_context_; + std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; + base::WeakPtrFactory<HeadlessShell> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(HeadlessShell); +}; + +} // namespace headless
diff --git a/headless/app/shell_navigation_request.cc b/headless/app/shell_navigation_request.cc new file mode 100644 index 0000000..3c419bce --- /dev/null +++ b/headless/app/shell_navigation_request.cc
@@ -0,0 +1,43 @@ +// 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 "headless/app/shell_navigation_request.h" + +#include "headless/app/headless_shell.h" + +namespace headless { + +ShellNavigationRequest::ShellNavigationRequest( + base::WeakPtr<HeadlessShell> headless_shell, + const page::NavigationRequestedParams& params) + : headless_shell_(headless_shell), + navigation_id_(params.GetNavigationId()) {} + +ShellNavigationRequest::~ShellNavigationRequest() {} + +void ShellNavigationRequest::StartProcessing(base::Closure done_callback) { + if (!headless_shell_) + return; + + // Allow the navigation to proceed. + headless_shell_->devtools_client() + ->GetPage() + ->GetExperimental() + ->ProcessNavigation( + headless::page::ProcessNavigationParams::Builder() + .SetNavigationId(navigation_id_) + .SetResponse(headless::page::NavigationResponse::PROCEED) + .Build(), + base::Bind(&ShellNavigationRequest::ProcessNavigationResult, + done_callback)); +} + +// static +void ShellNavigationRequest::ProcessNavigationResult( + base::Closure done_callback, + std::unique_ptr<page::ProcessNavigationResult>) { + done_callback.Run(); +} + +} // namespace headless
diff --git a/headless/app/shell_navigation_request.h b/headless/app/shell_navigation_request.h new file mode 100644 index 0000000..20ef77f --- /dev/null +++ b/headless/app/shell_navigation_request.h
@@ -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. + +#ifndef HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_ +#define HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_ + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "headless/public/devtools/domains/page.h" +#include "headless/public/util/navigation_request.h" + +namespace headless { +class HeadlessShell; + +// Used in deterministic mode to make sure navigations and resource requests +// complete in the order requested. +class ShellNavigationRequest : public NavigationRequest { + public: + ShellNavigationRequest(base::WeakPtr<HeadlessShell> headless_shell, + const page::NavigationRequestedParams& params); + + ~ShellNavigationRequest() override; + + void StartProcessing(base::Closure done_callback) override; + + private: + // Note the navigation likely isn't done when this is called, however we + // expect it will have been committed and the initial resource load requested. + static void ProcessNavigationResult( + base::Closure done_callback, + std::unique_ptr<page::ProcessNavigationResult>); + + base::WeakPtr<HeadlessShell> headless_shell_; + int navigation_id_; +}; + +} // namespace headless + +#endif // HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_
diff --git a/headless/public/util/deterministic_dispatcher.cc b/headless/public/util/deterministic_dispatcher.cc index 20982db..d6314469 100644 --- a/headless/public/util/deterministic_dispatcher.cc +++ b/headless/public/util/deterministic_dispatcher.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "headless/public/util/managed_dispatch_url_request_job.h" +#include "headless/public/util/navigation_request.h" namespace headless { @@ -16,20 +17,21 @@ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner) : io_thread_task_runner_(std::move(io_thread_task_runner)), dispatch_pending_(false), + navigation_in_progress_(false), weak_ptr_factory_(this) {} DeterministicDispatcher::~DeterministicDispatcher() {} void DeterministicDispatcher::JobCreated(ManagedDispatchURLRequestJob* job) { base::AutoLock lock(lock_); - pending_requests_.push_back(job); + pending_requests_.emplace_back(job); } void DeterministicDispatcher::JobKilled(ManagedDispatchURLRequestJob* job) { base::AutoLock lock(lock_); for (auto it = pending_requests_.begin(); it != pending_requests_.end(); it++) { - if (*it == job) { + if (it->url_request == job) { pending_requests_.erase(it); break; } @@ -56,10 +58,28 @@ MaybeDispatchJobLocked(); } +void DeterministicDispatcher::NavigationRequested( + std::unique_ptr<NavigationRequest> navigation) { + base::AutoLock lock(lock_); + pending_requests_.emplace_back(std::move(navigation)); + + MaybeDispatchJobLocked(); +} + void DeterministicDispatcher::MaybeDispatchJobLocked() { - if (dispatch_pending_ || ready_status_map_.empty()) + if (dispatch_pending_ || navigation_in_progress_) return; + if (ready_status_map_.empty()) { + if (pending_requests_.empty()) + return; // Nothing to do. + + // Don't post a task if the first job is a url request (which isn't ready + // yet). + if (pending_requests_.front().url_request) + return; + } + dispatch_pending_ = true; io_thread_task_runner_->PostTask( FROM_HERE, @@ -68,7 +88,7 @@ } void DeterministicDispatcher::MaybeDispatchJobOnIOThreadTask() { - ManagedDispatchURLRequestJob* job; + Request request; net::Error job_status; { @@ -77,22 +97,67 @@ // If the job got deleted, |pending_requests_| may be empty. if (pending_requests_.empty()) return; - job = pending_requests_.front(); - StatusMap::const_iterator it = ready_status_map_.find(job); - // Bail out if the oldest job is not be ready for dispatch yet. - if (it == ready_status_map_.end()) + + // Bail out if we're waiting for a navigation to complete. + if (navigation_in_progress_) return; - job_status = it->second; - ready_status_map_.erase(it); + request = std::move(pending_requests_.front()); + if (request.url_request) { + StatusMap::const_iterator it = + ready_status_map_.find(request.url_request); + // Bail out if the oldest job is not be ready for dispatch yet. + if (it == ready_status_map_.end()) + return; + + job_status = it->second; + ready_status_map_.erase(it); + } else { + DCHECK(!navigation_in_progress_); + navigation_in_progress_ = true; + } pending_requests_.pop_front(); } - if (job_status == net::OK) { - job->OnHeadersComplete(); + if (request.url_request) { + if (job_status == net::OK) { + request.url_request->OnHeadersComplete(); + } else { + request.url_request->OnStartError(job_status); + } } else { - job->OnStartError(job_status); + request.navigation_request->StartProcessing( + base::Bind(&DeterministicDispatcher::NavigationDoneTask, + weak_ptr_factory_.GetWeakPtr())); } } +void DeterministicDispatcher::NavigationDoneTask() { + { + base::AutoLock lock(lock_); + DCHECK(navigation_in_progress_); + navigation_in_progress_ = false; + } + + MaybeDispatchJobLocked(); +} + +DeterministicDispatcher::Request::Request() : url_request(nullptr) {} +DeterministicDispatcher::Request::~Request() {} + +DeterministicDispatcher::Request::Request( + ManagedDispatchURLRequestJob* url_request) + : url_request(url_request) {} + +DeterministicDispatcher::Request::Request( + std::unique_ptr<NavigationRequest> navigation_request) + : url_request(nullptr), navigation_request(std::move(navigation_request)) {} + +DeterministicDispatcher::Request& DeterministicDispatcher::Request::operator=( + DeterministicDispatcher::Request&& other) { + url_request = other.url_request; + navigation_request = std::move(other.navigation_request); + return *this; +} + } // namespace headless
diff --git a/headless/public/util/deterministic_dispatcher.h b/headless/public/util/deterministic_dispatcher.h index 0fea383..56c7c7e6 100644 --- a/headless/public/util/deterministic_dispatcher.h +++ b/headless/public/util/deterministic_dispatcher.h
@@ -20,8 +20,8 @@ class ManagedDispatchURLRequestJob; -// The purpose of this class is to queue up calls to OnHeadersComplete and -// OnStartError and dispatch them in order of URLRequestJob creation. This +// The purpose of this class is to queue up navigations and calls to +// OnHeadersComplete / OnStartError and dispatch them in order of creation. This // helps make renders deterministic at the cost of slower page loads. class DeterministicDispatcher : public URLRequestDispatcher { public: @@ -36,17 +36,34 @@ void JobFailed(ManagedDispatchURLRequestJob* job, net::Error error) override; void DataReady(ManagedDispatchURLRequestJob* job) override; void JobDeleted(ManagedDispatchURLRequestJob* job) override; + void NavigationRequested( + std::unique_ptr<NavigationRequest> navigation_request) override; private: + void MaybeDispatchNavigationJobLocked(); void MaybeDispatchJobLocked(); void MaybeDispatchJobOnIOThreadTask(); + void NavigationDoneTask(); scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; // Protects all members below. base::Lock lock_; - std::deque<ManagedDispatchURLRequestJob*> pending_requests_; + // TODO(alexclarke): Use std::variant when c++17 is allowed in chromium. + struct Request { + Request(); + explicit Request(ManagedDispatchURLRequestJob* url_request); + explicit Request(std::unique_ptr<NavigationRequest> navigation_request); + ~Request(); + + Request& operator=(Request&& other); + + ManagedDispatchURLRequestJob* url_request; // NOT OWNED + std::unique_ptr<NavigationRequest> navigation_request; + }; + + std::deque<Request> pending_requests_; using StatusMap = std::map<ManagedDispatchURLRequestJob*, net::Error>; StatusMap ready_status_map_; @@ -54,6 +71,7 @@ // Whether or not a MaybeDispatchJobOnIoThreadTask has been posted on the // |io_thread_task_runner_| bool dispatch_pending_; + bool navigation_in_progress_; base::WeakPtrFactory<DeterministicDispatcher> weak_ptr_factory_;
diff --git a/headless/public/util/deterministic_dispatcher_test.cc b/headless/public/util/deterministic_dispatcher_test.cc index 24cede8..7c2c6049 100644 --- a/headless/public/util/deterministic_dispatcher_test.cc +++ b/headless/public/util/deterministic_dispatcher_test.cc
@@ -8,8 +8,10 @@ #include <string> #include <vector> +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "headless/public/util/navigation_request.h" #include "headless/public/util/testing/fake_managed_dispatch_url_request_job.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -126,4 +128,70 @@ EXPECT_TRUE(notifications.empty()); } +namespace { +class NavigationRequestForTest : public NavigationRequest { + public: + explicit NavigationRequestForTest(base::Closure* done_closure) + : done_closure_(done_closure) {} + + ~NavigationRequestForTest() override {} + + // NavigationRequest implementation: + void StartProcessing(base::Closure done_callback) override { + *done_closure_ = std::move(done_callback); + } + + private: + base::Closure* done_closure_; // NOT OWNED +}; +} // namespace + +TEST_F(DeterministicDispatcherTest, NavigationBlocksUrlRequests) { + std::vector<std::string> notifications; + std::unique_ptr<FakeManagedDispatchURLRequestJob> job1( + new FakeManagedDispatchURLRequestJob(deterministic_dispatcher_.get(), 1, + ¬ifications)); + base::Closure navigation_done_closure; + deterministic_dispatcher_->NavigationRequested( + base::MakeUnique<NavigationRequestForTest>(&navigation_done_closure)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job2( + new FakeManagedDispatchURLRequestJob(deterministic_dispatcher_.get(), 2, + ¬ifications)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job3( + new FakeManagedDispatchURLRequestJob(deterministic_dispatcher_.get(), 3, + ¬ifications)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job4( + new FakeManagedDispatchURLRequestJob(deterministic_dispatcher_.get(), 4, + ¬ifications)); + job1->DispatchHeadersComplete(); + job2->DispatchHeadersComplete(); + job3->DispatchHeadersComplete(); + job4->DispatchHeadersComplete(); + + EXPECT_TRUE(notifications.empty()); + + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, ElementsAre("id: 1 OK")); + + // This triggers a call to NavigationRequestForTest::StartProcessing. + job1.reset(); + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, ElementsAre("id: 1 OK")); + + // Navigations should be blocked until we call the done closure. + navigation_done_closure.Run(); + + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, ElementsAre("id: 1 OK", "id: 2 OK")); + + job2.reset(); + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, ElementsAre("id: 1 OK", "id: 2 OK", "id: 3 OK")); + + job3.reset(); + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, + ElementsAre("id: 1 OK", "id: 2 OK", "id: 3 OK", "id: 4 OK")); +} + } // namespace headless
diff --git a/headless/public/util/expedited_dispatcher.cc b/headless/public/util/expedited_dispatcher.cc index 0120442d..649321a7 100644 --- a/headless/public/util/expedited_dispatcher.cc +++ b/headless/public/util/expedited_dispatcher.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "headless/public/util/managed_dispatch_url_request_job.h" +#include "headless/public/util/navigation_request.h" namespace headless { @@ -36,4 +37,13 @@ void ExpeditedDispatcher::JobDeleted(ManagedDispatchURLRequestJob*) {} +void ExpeditedDispatcher::NavigationRequested( + std::unique_ptr<NavigationRequest> navigation) { + // For the ExpeditedDispatcher we don't care when the navigation is done, + // hence the empty closure. + io_thread_task_runner_->PostTask( + FROM_HERE, base::Bind(&NavigationRequest::StartProcessing, + std::move(navigation), base::Closure())); +} + } // namespace headless
diff --git a/headless/public/util/expedited_dispatcher.h b/headless/public/util/expedited_dispatcher.h index 39b8057f..61062c4 100644 --- a/headless/public/util/expedited_dispatcher.h +++ b/headless/public/util/expedited_dispatcher.h
@@ -29,6 +29,8 @@ void JobFailed(ManagedDispatchURLRequestJob* job, net::Error error) override; void DataReady(ManagedDispatchURLRequestJob* job) override; void JobDeleted(ManagedDispatchURLRequestJob* job) override; + void NavigationRequested( + std::unique_ptr<NavigationRequest> navigation_request) override; private: scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
diff --git a/headless/public/util/expedited_dispatcher_test.cc b/headless/public/util/expedited_dispatcher_test.cc index 5ef6301..54f5249 100644 --- a/headless/public/util/expedited_dispatcher_test.cc +++ b/headless/public/util/expedited_dispatcher_test.cc
@@ -8,8 +8,10 @@ #include <string> #include <vector> +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "headless/public/util/navigation_request.h" #include "headless/public/util/testing/fake_managed_dispatch_url_request_job.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -83,4 +85,51 @@ "id: 2 OK", "id: 1 OK")); } +namespace { +class NavigationRequestForTest : public NavigationRequest { + public: + explicit NavigationRequestForTest(base::Closure* done_closure) + : done_closure_(done_closure) {} + + ~NavigationRequestForTest() override {} + + // NavigationRequest implementation: + void StartProcessing(base::Closure done_callback) override { + *done_closure_ = std::move(done_callback); + } + + private: + base::Closure* done_closure_; // NOT OWNED +}; +} // namespace + +TEST_F(ExpeditedDispatcherTest, NavigationDoesNotBlockUrlRequests) { + std::vector<std::string> notifications; + std::unique_ptr<FakeManagedDispatchURLRequestJob> job1( + new FakeManagedDispatchURLRequestJob(expedited_dispatcher_.get(), 1, + ¬ifications)); + base::Closure navigation_done_closure; + expedited_dispatcher_->NavigationRequested( + base::MakeUnique<NavigationRequestForTest>(&navigation_done_closure)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job2( + new FakeManagedDispatchURLRequestJob(expedited_dispatcher_.get(), 2, + ¬ifications)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job3( + new FakeManagedDispatchURLRequestJob(expedited_dispatcher_.get(), 3, + ¬ifications)); + std::unique_ptr<FakeManagedDispatchURLRequestJob> job4( + new FakeManagedDispatchURLRequestJob(expedited_dispatcher_.get(), 4, + ¬ifications)); + job1->DispatchHeadersComplete(); + job2->DispatchHeadersComplete(); + job3->DispatchHeadersComplete(); + job4->DispatchHeadersComplete(); + + EXPECT_TRUE(notifications.empty()); + + base::RunLoop().RunUntilIdle(); + EXPECT_THAT(notifications, + ElementsAre("id: 1 OK", "id: 2 OK", "id: 3 OK", "id: 4 OK")); +} + } // namespace headless
diff --git a/headless/public/util/navigation_request.h b/headless/public/util/navigation_request.h new file mode 100644 index 0000000..cd28f10d --- /dev/null +++ b/headless/public/util/navigation_request.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 HEADLESS_PUBLIC_UTIL_NAVIGATION_REQUEST_H_ +#define HEADLESS_PUBLIC_UTIL_NAVIGATION_REQUEST_H_ + +#include "base/macros.h" + +namespace headless { + +// While the actual details of the navigation processing are left undefined, +// it's anticipated implementations will use devtools Page.setControlNavigations +// and Page.processNavigation commands. +class NavigationRequest { + public: + NavigationRequest() {} + virtual ~NavigationRequest() {} + + // Called on the IO thread to ask the implementation to start processing the + // navigation request. The NavigationRequest will be deleted immediately after + // The |done_callback| can be called from any thread. + virtual void StartProcessing(base::Closure done_callback) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(NavigationRequest); +}; + +} // namespace headless + +#endif // HEADLESS_PUBLIC_UTIL_NAVIGATION_REQUEST_H_
diff --git a/headless/public/util/url_request_dispatcher.h b/headless/public/util/url_request_dispatcher.h index 1f34509..3029dd5 100644 --- a/headless/public/util/url_request_dispatcher.h +++ b/headless/public/util/url_request_dispatcher.h
@@ -10,6 +10,7 @@ namespace headless { class ManagedDispatchURLRequestJob; +class NavigationRequest; // Interface to abstract and potentially reorder (for determinism) calls to // ManagedDispatchUrlRequestJob::OnHeadersComplete and @@ -36,6 +37,10 @@ // Tells us the job has finished. Can be called from any thread. virtual void JobDeleted(ManagedDispatchURLRequestJob* job) = 0; + // Tells us a navigation has been requested. Can be called from any thread. + virtual void NavigationRequested( + std::unique_ptr<NavigationRequest> navigation_request) = 0; + private: DISALLOW_COPY_AND_ASSIGN(URLRequestDispatcher); };
diff --git a/ios/chrome/browser/autofill/autofill_controller.mm b/ios/chrome/browser/autofill/autofill_controller.mm index 196ca15..22b044c 100644 --- a/ios/chrome/browser/autofill/autofill_controller.mm +++ b/ios/chrome/browser/autofill/autofill_controller.mm
@@ -76,7 +76,7 @@ OAuth2TokenServiceFactory::GetForBrowserState(originalBrowserState), base::Closure())); _autofillClient.reset(new autofill::AutofillClientIOS( - browserState, infobarManager, self, passwordGenerationManager, + browserState, webState, infobarManager, self, passwordGenerationManager, std::move(identityProvider))); autofill::AutofillDriverIOS::CreateForWebStateAndDelegate( webState, _autofillClient.get(), self,
diff --git a/ios/chrome/browser/suggestions/image_fetcher_impl.mm b/ios/chrome/browser/suggestions/image_fetcher_impl.mm index b351c30e..fa20dec 100644 --- a/ios/chrome/browser/suggestions/image_fetcher_impl.mm +++ b/ios/chrome/browser/suggestions/image_fetcher_impl.mm
@@ -59,7 +59,7 @@ // If image_fetcher_ is destroyed the request will be cancelled and this block // will never be called. A reference to delegate_ can be kept. image_fetcher::IOSImageDataFetcherCallback fetcher_callback = - ^(NSData* data) { + ^(NSData* data, const image_fetcher::RequestMetadata& metadata) { if (data) { // Most likely always returns 1x images. UIImage* ui_image = [UIImage imageWithData:data scale:1];
diff --git a/ios/chrome/browser/ui/autofill/BUILD.gn b/ios/chrome/browser/ui/autofill/BUILD.gn index 7820ec6..cb27e1b 100644 --- a/ios/chrome/browser/ui/autofill/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/BUILD.gn
@@ -35,6 +35,7 @@ "//ios/public/provider/chrome/browser", "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios", + "//ios/web", "//ui/base", ] public_deps = [
diff --git a/ios/chrome/browser/ui/autofill/autofill_client_ios.h b/ios/chrome/browser/ui/autofill/autofill_client_ios.h index ccfd8adc..ce789c9f 100644 --- a/ios/chrome/browser/ui/autofill/autofill_client_ios.h +++ b/ios/chrome/browser/ui/autofill/autofill_client_ios.h
@@ -33,6 +33,10 @@ class SyncService; } +namespace web { +class WebState; +} + namespace autofill { class PersonalDataManager; @@ -42,6 +46,7 @@ public: AutofillClientIOS( ios::ChromeBrowserState* browser_state, + web::WebState* web_state, infobars::InfoBarManager* infobar_manager, id<AutofillClientIOSBridge> bridge, password_manager::PasswordGenerationManager* password_generation_manager, @@ -88,13 +93,14 @@ const base::string16& profile_full_name) override; void OnFirstUserGestureObserved() override; scoped_refptr<AutofillWebDataService> GetDatabase() override; - bool IsContextSecure(const GURL& form_origin) override; + bool IsContextSecure() override; bool ShouldShowSigninPromo() override; void StartSigninFlow() override; void ShowHttpNotSecureExplanation() override; private: ios::ChromeBrowserState* browser_state_; + web::WebState* web_state_; infobars::InfoBarManager* infobar_manager_; __weak id<AutofillClientIOSBridge> bridge_; password_manager::PasswordGenerationManager* password_generation_manager_;
diff --git a/ios/chrome/browser/ui/autofill/autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/autofill_client_ios.mm index 2e91efdb66..562998cf 100644 --- a/ios/chrome/browser/ui/autofill/autofill_client_ios.mm +++ b/ios/chrome/browser/ui/autofill/autofill_client_ios.mm
@@ -27,6 +27,10 @@ #include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h" #include "ios/chrome/browser/web_data_service_factory.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" +#import "ios/web/public/navigation_item.h" +#import "ios/web/public/navigation_manager.h" +#include "ios/web/public/ssl_status.h" +#import "ios/web/public/web_state/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -36,11 +40,13 @@ AutofillClientIOS::AutofillClientIOS( ios::ChromeBrowserState* browser_state, + web::WebState* web_state, infobars::InfoBarManager* infobar_manager, id<AutofillClientIOSBridge> bridge, password_manager::PasswordGenerationManager* password_generation_manager, std::unique_ptr<IdentityProvider> identity_provider) : browser_state_(browser_state), + web_state_(web_state), infobar_manager_(infobar_manager), bridge_(bridge), password_generation_manager_(password_generation_manager), @@ -183,10 +189,20 @@ browser_state_, ServiceAccessType::EXPLICIT_ACCESS); } -bool AutofillClientIOS::IsContextSecure(const GURL& form_origin) { - // TODO (sigbjorn): Return if the context is secure, not just - // the form_origin. See crbug.com/505388. - return form_origin.SchemeIsCryptographic(); +bool AutofillClientIOS::IsContextSecure() { + // This implementation differs slightly from other platforms. Other platforms' + // implementations check for the presence of active mixed content, but because + // the iOS web view blocks active mixed content without an option to run it, + // there is no need to check for active mixed conent here. + web::NavigationManager* manager = web_state_->GetNavigationManager(); + web::NavigationItem* nav_item = manager->GetLastCommittedItem(); + if (!nav_item) + return false; + + const web::SSLStatus& ssl = nav_item->GetSSL(); + return nav_item->GetURL().SchemeIsCryptographic() && ssl.certificate && + (!net::IsCertStatusError(ssl.cert_status) || + net::IsCertStatusMinorError(ssl.cert_status)); } void AutofillClientIOS::OnFirstUserGestureObserved() {
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index b201040..f287d477 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -16,6 +16,7 @@ #include "base/base64.h" #include "base/command_line.h" +#include "base/files/file_path.h" #include "base/format_macros.h" #include "base/i18n/rtl.h" #include "base/ios/block_types.h" @@ -185,6 +186,7 @@ #include "ios/web/public/web_thread.h" #import "ios/web/web_state/ui/crw_web_controller.h" #import "net/base/mac/url_conversions.h" +#include "net/base/mime_util.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/ssl/ssl_info.h" #include "net/url_request/url_request_context_getter.h" @@ -677,11 +679,12 @@ // Induces an intentional crash in the browser process. - (void)induceBrowserCrash; // Saves the image or display error message, based on privacy settings. -- (void)managePermissionAndSaveImage:(NSData*)data; +- (void)managePermissionAndSaveImage:(NSData*)data + withFileExtension:(NSString*)fileExtension; // Saves the image. In order to keep the metadata of the image, the image is // saved as a temporary file on disk then saved in photos. // This should be called on FILE thread. -- (void)saveImage:(NSData*)data; +- (void)saveImage:(NSData*)data withFileExtension:(NSString*)fileExtension; // Called when Chrome has been denied access to the photos or videos and the // user can change it. // Shows a privacy alert on the main queue, allowing the user to go to Chrome's @@ -2991,7 +2994,8 @@ DCHECK(url.is_valid()); base::WeakNSObject<BrowserViewController> weakSelf(self); const GURL image_source_url = url; - image_fetcher::IOSImageDataFetcherCallback callback = ^(NSData* data) { + image_fetcher::IOSImageDataFetcherCallback callback = ^( + NSData* data, const image_fetcher::RequestMetadata& metadata) { DCHECK(data); dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf searchByImageData:data atURL:image_source_url]; @@ -3047,17 +3051,29 @@ referrer:(const web::Referrer&)referrer { DCHECK(url.is_valid()); - image_fetcher::IOSImageDataFetcherCallback callback = ^(NSData* data) { + image_fetcher::IOSImageDataFetcherCallback callback = ^( + NSData* data, const image_fetcher::RequestMetadata& metadata) { DCHECK(data); - [self managePermissionAndSaveImage:data]; + base::FilePath::StringType extension; + + bool extensionSuccess = + net::GetPreferredExtensionForMimeType(metadata.mime_type, &extension); + if (!extensionSuccess || extension.length() == 0) { + extension = "png"; + } + + NSString* fileExtension = + [@"." stringByAppendingString:base::SysUTF8ToNSString(extension)]; + [self managePermissionAndSaveImage:data withFileExtension:fileExtension]; }; _imageFetcher->FetchImageDataWebpDecoded( url, callback, web::ReferrerHeaderValueForNavigation(url, referrer), web::PolicyForNavigation(url, referrer)); } -- (void)managePermissionAndSaveImage:(NSData*)data { +- (void)managePermissionAndSaveImage:(NSData*)data + withFileExtension:(NSString*)fileExtension { switch ([PHPhotoLibrary authorizationStatus]) { // User was never asked for permission to access photos. case PHAuthorizationStatusNotDetermined: @@ -3065,7 +3081,8 @@ // Call -saveImage again to check if chrome needs to display an error or // saves the image. if (status != PHAuthorizationStatusNotDetermined) - [self managePermissionAndSaveImage:data]; + [self managePermissionAndSaveImage:data + withFileExtension:fileExtension]; }]; break; @@ -3085,18 +3102,18 @@ // The application has permission to access the photos. default: { - web::WebThread::PostTask(web::WebThread::FILE, FROM_HERE, - base::BindBlock(^{ - [self saveImage:data]; - })); + web::WebThread::PostTask( + web::WebThread::FILE, FROM_HERE, base::BindBlock(^{ + [self saveImage:data withFileExtension:fileExtension]; + })); break; } } } -- (void)saveImage:(NSData*)data { +- (void)saveImage:(NSData*)data withFileExtension:(NSString*)fileExtension { NSString* fileName = [[[NSProcessInfo processInfo] globallyUniqueString] - stringByAppendingString:@".png"]; + stringByAppendingString:fileExtension]; NSURL* fileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:fileName]];
diff --git a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm index e74c2c9..d4a463a 100644 --- a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm +++ b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm
@@ -7,6 +7,7 @@ #import <QuartzCore/QuartzCore.h> #include <algorithm> +#include "base/ios/ios_util.h" #include "base/logging.h" #include "base/mac/objc_property_releaser.h" #include "base/mac/scoped_nsobject.h" @@ -651,6 +652,26 @@ [self clear]; } +// On iOS10 and above, trigger a haptic vibration for the user selecting an +// action. This is a no-op for devices that do not support it. +- (void)triggerHapticFeedbackForAction { + if (base::ios::IsRunningOnIOS10OrLater()) { + base::scoped_nsobject<UIImpactFeedbackGenerator> generator( + [[UIImpactFeedbackGenerator alloc] init]); + [generator impactOccurred]; + } +} + +// On iOS10 and above, trigger a haptic vibration for the change in selection. +// This is a no-op for devices that do not support it. +- (void)triggerHapticFeedbackForSelectionChange { + if (base::ios::IsRunningOnIOS10OrLater()) { + base::scoped_nsobject<UISelectionFeedbackGenerator> generator( + [[UISelectionFeedbackGenerator alloc] init]); + [generator selectionChanged]; + } +} + - (BOOL)isOverscrollActionEnabled { return _overscrollActionLock == 0 && _allowPullingActions && !_isOverscrollActionsDisabledForLoading; @@ -679,6 +700,7 @@ dispatch_async(dispatch_get_main_queue(), ^{ [self recordMetricForTriggeredAction:self.overscrollActionView .selectedAction]; + [self triggerHapticFeedbackForAction]; [self.delegate overscrollActionsController:self didTriggerAction:self.overscrollActionView .selectedAction]; @@ -894,9 +916,16 @@ [self scrollView].panGestureRecognizer.enabled = NO; [self scrollView].panGestureRecognizer.enabled = YES; [self startBounceWithInitialVelocity:CGPointZero]; + + [self triggerHapticFeedbackForAction]; [self.delegate overscrollActionsController:self didTriggerAction:self.overscrollActionView.selectedAction]; } +- (void)overscrollActionsView:(OverscrollActionsView*)view + selectedActionDidChange:(OverscrollAction)newAction { + [self triggerHapticFeedbackForSelectionChange]; +} + @end
diff --git a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h index a8f2e6f..fe5e8c0 100644 --- a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h +++ b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h
@@ -27,9 +27,16 @@ @protocol OverscrollActionsViewDelegate +// Called when the user explicitly taps on one of the items to trigger its +// action. - (void)overscrollActionsViewDidTapTriggerAction: (OverscrollActionsView*)overscrollActionsView; +// Called after the selectedAction property changed and the animations have +// been triggered. +- (void)overscrollActionsView:(OverscrollActionsView*)view + selectedActionDidChange:(OverscrollAction)newAction; + @end // This view displays the actions of the OverscrollActionsController.
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 4d43a86..9e2768c 100644 --- a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm +++ b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.mm
@@ -690,6 +690,9 @@ self.selectionCircleLayer.transform; } [UIView commitAnimations]; + + [self.delegate overscrollActionsView:self + selectedActionDidChange:self.selectedAction]; } - (base::scoped_nsobject<NSArray>&)layersToCenterVertically {
diff --git a/ios/chrome/browser/ui/stack_view/BUILD.gn b/ios/chrome/browser/ui/stack_view/BUILD.gn index cfea1f3..65fd86c 100644 --- a/ios/chrome/browser/ui/stack_view/BUILD.gn +++ b/ios/chrome/browser/ui/stack_view/BUILD.gn
@@ -106,6 +106,7 @@ } source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] testonly = true sources = [ "card_set_unittest.mm",
diff --git a/ios/chrome/browser/ui/stack_view/card_set_unittest.mm b/ios/chrome/browser/ui/stack_view/card_set_unittest.mm index b767665..51872e9 100644 --- a/ios/chrome/browser/ui/stack_view/card_set_unittest.mm +++ b/ios/chrome/browser/ui/stack_view/card_set_unittest.mm
@@ -4,8 +4,6 @@ #import <QuartzCore/QuartzCore.h> -#include "base/mac/scoped_nsautorelease_pool.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/stringprintf.h" #import "ios/chrome/browser/tabs/tab.h" #import "ios/chrome/browser/tabs/tab_model.h" @@ -21,10 +19,14 @@ #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + @interface MockTabModel : NSObject<NSFastEnumeration> { @private - base::scoped_nsobject<NSMutableArray> tabs_; - id<TabModelObserver> observer_; // weak + NSMutableArray* tabs_; + __weak id<TabModelObserver> observer_; } // Adds a new mock tab with the given properties. @@ -56,22 +58,22 @@ - (id)init { if ((self = [super init])) { - tabs_.reset([[NSMutableArray alloc] init]); + tabs_ = [[NSMutableArray alloc] init]; } return self; } - (void)addTabWithTitle:(NSString*)title location:(const GURL&)url { - base::scoped_nsobject<id> tab([[CardSetTestTabMock alloc] - initWithRepresentedObject:[OCMockObject mockForClass:[Tab class]]]); - UIView* dummyView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; + id tab = [[CardSetTestTabMock alloc] + initWithRepresentedObject:[OCMockObject mockForClass:[Tab class]]]; + UIView* dummyView = [[UIView alloc] initWithFrame:CGRectZero]; static int sCounter = 0; NSString* sessionID = [NSString stringWithFormat:@"%d", sCounter++]; BOOL no = NO; [[[tab stub] andReturn:dummyView] view]; - base::scoped_nsobject<id> block([^{ + id block = [^{ return (const GURL&)url; - } copy]); + } copy]; [tab onSelector:@selector(url) callBlockExpectation:block]; [[tab expect] retrieveSnapshot:[OCMArg any]]; @@ -91,7 +93,6 @@ - (void)removeTabAtIndex:(NSUInteger)index { id tab = [tabs_ objectAtIndex:index]; - [[tab retain] autorelease]; [tabs_ removeObjectAtIndex:index]; // A tab was removed at the given index. @@ -129,7 +130,7 @@ } - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState*)state - objects:(id*)stackbuf + objects:(__unsafe_unretained id*)stackbuf count:(NSUInteger)len { return [tabs_ countByEnumeratingWithState:state objects:stackbuf count:len]; } @@ -163,19 +164,17 @@ class CardSetTest : public PlatformTest { protected: virtual void SetUpWithTabs(int nb_tabs) { - tab_model_.reset([[MockTabModel alloc] init]); + tab_model_ = [[MockTabModel alloc] init]; for (int i = 0; i < nb_tabs; ++i) { std::string url = base::StringPrintf("http://%d.example.com", i); [tab_model_ addTabWithTitle:@"NewTab" location:GURL(url)]; } - card_set_.reset( - [[CardSet alloc] initWithModel:(TabModel*)tab_model_.get()]); + card_set_ = [[CardSet alloc] initWithModel:(TabModel*)tab_model_]; - display_view_.reset( - [[UIView alloc] initWithFrame:CGRectMake(0, 0, kViewportDimension, - kViewportDimension)]); + display_view_ = [[UIView alloc] + initWithFrame:CGRectMake(0, 0, kViewportDimension, kViewportDimension)]; // Do some initial configuration of the card set. [card_set_ setDisplayView:display_view_]; [card_set_ setCardSize:CGSizeMake(kCardDimension, kCardDimension)]; @@ -185,9 +184,9 @@ void SetUp() override { SetUpWithTabs(2); } - base::scoped_nsobject<MockTabModel> tab_model_; - base::scoped_nsobject<UIView> display_view_; - base::scoped_nsobject<CardSet> card_set_; + MockTabModel* tab_model_; + UIView* display_view_; + CardSet* card_set_; }; TEST_F(CardSetTest, InitialLayoutState) {
diff --git a/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm b/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm index 302780a..1d3a6c7 100644 --- a/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm +++ b/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm
@@ -2,13 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/mac/scoped_nsobject.h" #include "ios/chrome/browser/ui/rtl_geometry.h" #import "ios/chrome/browser/ui/stack_view/card_stack_layout_manager.h" #import "ios/chrome/browser/ui/stack_view/stack_card.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 + @interface CardStackLayoutManager (Private) - (CGFloat)minStackStaggerAmount; - (CGFloat)scrollCardAwayFromNeighborAmount; @@ -113,8 +116,7 @@ CardStackLayoutManager* stack = [[CardStackLayoutManager alloc] init]; stack.layoutIsVertical = layoutIsVertical; for (unsigned int i = 0; i < n; ++i) { - base::scoped_nsobject<StackCard> card( - (StackCard*)[[MockStackCard alloc] init]); + StackCard* card = static_cast<StackCard*>([[MockStackCard alloc] init]); [stack addCard:card]; } @@ -132,19 +134,15 @@ TEST_F(CardStackLayoutManagerTest, CardSizing) { BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { - base::scoped_nsobject<CardStackLayoutManager> stack( - [[CardStackLayoutManager alloc] init]); - stack.get().layoutIsVertical = boolValues[i]; + CardStackLayoutManager* stack = [[CardStackLayoutManager alloc] init]; + stack.layoutIsVertical = boolValues[i]; - base::scoped_nsobject<StackCard> view1( - (StackCard*)[[MockStackCard alloc] init]); - base::scoped_nsobject<StackCard> view2( - (StackCard*)[[MockStackCard alloc] init]); - base::scoped_nsobject<StackCard> view3( - (StackCard*)[[MockStackCard alloc] init]); - [stack addCard:view1.get()]; - [stack addCard:view2.get()]; - [stack addCard:view3.get()]; + StackCard* view1 = static_cast<StackCard*>([[MockStackCard alloc] init]); + StackCard* view2 = static_cast<StackCard*>([[MockStackCard alloc] init]); + StackCard* view3 = static_cast<StackCard*>([[MockStackCard alloc] init]); + [stack addCard:view1]; + [stack addCard:view2]; + [stack addCard:view3]; // Ensure that removed cards are not altered. [stack removeCard:view2]; @@ -168,9 +166,8 @@ TEST_F(CardStackLayoutManagerTest, StackSizes) { BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { - base::scoped_nsobject<CardStackLayoutManager> stack( - [[CardStackLayoutManager alloc] init]); - stack.get().layoutIsVertical = boolValues[i]; + CardStackLayoutManager* stack = [[CardStackLayoutManager alloc] init]; + stack.layoutIsVertical = boolValues[i]; CGRect cardFrame = CGRectMake(0, 0, 100, 200); [stack setCardSize:cardFrame.size]; [stack setMaxStagger:30]; @@ -178,8 +175,8 @@ // Asking the size for a collapsed stack should give the same result. CGFloat emptyCollapsedSize = [stack fullyCollapsedStackLength]; for (int i = 0; i < 10; ++i) { - base::scoped_nsobject<StackCard> card( - (StackCard*)[[UIView alloc] initWithFrame:cardFrame]); + StackCard* card = + static_cast<StackCard*>([[UIView alloc] initWithFrame:cardFrame]); [stack addCard:card]; } CGFloat largeCollapsedSize = [stack fullyCollapsedStackLength]; @@ -191,8 +188,7 @@ EXPECT_GT(largeExpandedSize, largeCollapsedSize); CGFloat largeMaximumSize = [stack maximumStackLength]; EXPECT_GT(largeMaximumSize, largeExpandedSize); - base::scoped_nsobject<StackCard> card( - (StackCard*)[[MockStackCard alloc] init]); + StackCard* card = static_cast<StackCard*>([[MockStackCard alloc] init]); [stack addCard:card]; CGFloat evenLargerExpandedSize = [stack fannedStackLength]; EXPECT_LT(largeExpandedSize, evenLargerExpandedSize); @@ -211,8 +207,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 30; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -235,8 +230,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -272,8 +266,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -308,8 +301,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); CGFloat endLimit = [stack maximumStackLength]; [stack setEndLimit:endLimit]; @@ -355,8 +347,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 30; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); NSInteger startIndex = 10; @@ -386,8 +377,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -417,8 +407,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -451,8 +440,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -491,8 +479,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; // Configure the stack so that the first card is > the scroll-away distance @@ -558,8 +545,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 4; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; // Make the stack large enough to fan out all its cards to avoid having to @@ -610,8 +596,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 10; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -662,8 +647,7 @@ BOOL boolValues[2] = {NO, YES}; const unsigned int kCardCount = 1; for (unsigned long i = 0; i < arraysize(boolValues); i++) { - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); // A laid-out stack with one card is fully collapsed and fully fanned out, // but not fully overextended. @@ -686,8 +670,7 @@ for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 1; const float kScrollAwayAmount = 20.0; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -734,8 +717,7 @@ for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 1; const float kScrollAwayAmount = 20.0; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -807,8 +789,7 @@ for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 1; const float kScrollAwayAmount = 10.0; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -863,8 +844,7 @@ for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 2; const float kScrollAwayAmount = 20.0; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; StackCard* secondCard = [[stack cards] objectAtIndex:1]; @@ -956,8 +936,7 @@ for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; const float kScrollAwayAmount = 100.0; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -1013,8 +992,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); StackCard* firstCard = [[stack cards] objectAtIndex:0]; const float kEndLimit = @@ -1051,8 +1029,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1114,8 +1091,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 7; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = 0.2 * [stack fannedStackLength]; [stack setEndLimit:kEndLimit]; @@ -1178,8 +1154,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1205,8 +1180,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); // Make sure that the stack end limit isn't hit in this test. const float kEndLimit = 2.0 * [stack maximumStackLength]; @@ -1249,8 +1223,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 2; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1283,8 +1256,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 2; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1315,8 +1287,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 30; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1352,8 +1323,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1398,8 +1368,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1458,8 +1427,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1517,8 +1485,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 7; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = 0.3 * [stack fannedStackLength]; const float kPinchDistance = 20; @@ -1578,8 +1545,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 3; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = kDefaultEndLimitFraction * [stack fannedStackLength]; @@ -1648,8 +1614,7 @@ BOOL boolValues[2] = {NO, YES}; for (unsigned long i = 0; i < arraysize(boolValues); i++) { const unsigned int kCardCount = 7; - base::scoped_nsobject<CardStackLayoutManager> stack( - newStackOfNCards(kCardCount, boolValues[i])); + CardStackLayoutManager* stack = newStackOfNCards(kCardCount, boolValues[i]); const float kEndLimit = 0.3 * [stack fannedStackLength]; const float kPinchDistance = 20;
diff --git a/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm b/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm index e2197c1..2fd8089 100644 --- a/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm +++ b/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/ui/rtl_geometry.h" #import "ios/chrome/browser/ui/stack_view/card_view.h" #import "ios/chrome/browser/ui/stack_view/stack_card.h" @@ -11,6 +10,10 @@ #include "testing/gtest_mac.h" #include "testing/platform_test.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + // Mocked-out CardView object @interface MockCardView : UIView @end @@ -26,7 +29,7 @@ @implementation MockCardViewProvider - (CardView*)cardViewWithFrame:(CGRect)frame forStackCard:(StackCard*)card { - return (CardView*)[[[MockCardView alloc] initWithFrame:frame] autorelease]; + return static_cast<CardView*>([[MockCardView alloc] initWithFrame:frame]); } @end @@ -36,16 +39,13 @@ class StackCardTest : public PlatformTest { protected: - void SetUp() override { - view_provider_.reset([[MockCardViewProvider alloc] init]); - } + StackCardTest() { view_provider_ = [[MockCardViewProvider alloc] init]; } - base::scoped_nsobject<MockCardViewProvider> view_provider_; + MockCardViewProvider* view_provider_; }; TEST_F(StackCardTest, LazyCreation) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Set attributes before asking for the view. LayoutRect layout = LayoutRectMake(10, 300, 20, 55, 98); CGRect frame = LayoutRectGetRect(layout); @@ -61,8 +61,7 @@ } TEST_F(StackCardTest, LiveViewUpdating) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Get the view, then set attributes. UIView* view = [card view]; LayoutRect layout = LayoutRectMake(10, 300, 20, 55, 98); @@ -76,8 +75,7 @@ } TEST_F(StackCardTest, BoundsUpdatePreservesCenter) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; LayoutRect layout = LayoutRectMake(0, 300, 0, 40, 100); CGRect frame = LayoutRectGetRect(layout); [card setLayout:layout]; @@ -89,8 +87,7 @@ } TEST_F(StackCardTest, PixelAlignmentOfViewFrameAfterLiveUpdate) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Get the view, then set attributes. UIView* view = [card view]; const LayoutRectPosition kPosition = LayoutRectPositionMake(10.3, 20.4); @@ -112,8 +109,7 @@ } TEST_F(StackCardTest, ViewFrameSynchronization) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Get the view, then set attributes. UIView* view = [card view]; const LayoutRect kFirstLayout = LayoutRectMake(10, 300, 20, 55, 98); @@ -148,8 +144,7 @@ } TEST_F(StackCardTest, ViewLayoutSynchronization) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Get the view, then set attributes. UIView* view = [card view]; const LayoutRect kFirstLayout = LayoutRectMake(30, 300, 40, 200, 100); @@ -185,8 +180,7 @@ } TEST_F(StackCardTest, PixelAlignmentOfViewAfterSynchronization) { - base::scoped_nsobject<StackCard> card( - [[StackCard alloc] initWithViewProvider:view_provider_]); + StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_]; // Get the view, then set attributes. UIView* view = [card view]; const CGFloat kBoundingWidth = 300;
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_controller_unittest.mm b/ios/chrome/browser/ui/stack_view/stack_view_controller_unittest.mm index e7509e5..f198eb6e 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/stack_view/stack_view_controller_unittest.mm
@@ -5,8 +5,6 @@ #import <QuartzCore/QuartzCore.h> #include "base/logging.h" -#include "base/mac/scoped_nsautorelease_pool.h" -#include "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/ui/stack_view/card_set.h" #import "ios/chrome/browser/ui/stack_view/stack_card.h" @@ -17,6 +15,10 @@ #include "testing/gtest_mac.h" #include "third_party/ocmock/OCMock/OCMock.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { const CGFloat kViewportDimension = 200; @@ -31,13 +33,12 @@ CGSize cardSize_; CGFloat layoutAxisPosition_; BOOL initialConfigurationSet_; - id observer_; } // CardSet simulation -@property(nonatomic, retain, readwrite) UIView* displayView; +@property(nonatomic, strong, readwrite) UIView* displayView; @property(nonatomic, assign, readwrite) CGSize cardSize; -@property(nonatomic, assign, readwrite) id<CardSetObserver> observer; +@property(nonatomic, weak, readwrite) id<CardSetObserver> observer; @property(nonatomic, assign, readwrite) BOOL keepOnlyVisibleCardViewsAlive; - (void)configureLayoutParametersWithMargin:(CGFloat)margin; @@ -111,13 +112,13 @@ void SetUp() override { BlockCleanupTest::SetUp(); - main_card_set_.reset([[MockCardSet alloc] init]); - otr_card_set_.reset([[MockCardSet alloc] init]); + main_card_set_ = [[MockCardSet alloc] init]; + otr_card_set_ = [[MockCardSet alloc] init]; - view_controller_.reset([[StackViewController alloc] - initWithMainCardSet:(CardSet*)main_card_set_.get() - otrCardSet:(CardSet*)otr_card_set_.get() - activeCardSet:(CardSet*)main_card_set_.get()]); + view_controller_ = [[StackViewController alloc] + initWithMainCardSet:static_cast<CardSet*>(main_card_set_) + otrCardSet:static_cast<CardSet*>(otr_card_set_) + activeCardSet:static_cast<CardSet*>(main_card_set_)]; // Resize the view and call VC lifecycle events [view_controller_ view].frame = CGRectMake(0.0, 0.0, kViewportDimension, kViewportDimension); @@ -127,7 +128,7 @@ void TearDown() override { // The view controller uses a delayed selector call, so in the unittests // that causes the controller to be retained and outlive the test. - [NSObject cancelPreviousPerformRequestsWithTarget:view_controller_.get()]; + [NSObject cancelPreviousPerformRequestsWithTarget:view_controller_]; // And there are likely animations still running. for (UIView* view in [[view_controller_ scrollView] subviews]) { // Remove any animations on cards themselves. @@ -183,9 +184,9 @@ } } - base::scoped_nsobject<StackViewController> view_controller_; - base::scoped_nsobject<MockCardSet> main_card_set_; - base::scoped_nsobject<MockCardSet> otr_card_set_; + StackViewController* view_controller_; + MockCardSet* main_card_set_; + MockCardSet* otr_card_set_; }; TEST_F(StackViewControllerTest, BasicConfiguration) { @@ -204,10 +205,12 @@ TEST_F(StackViewControllerTest, IncognitoHandling) { EXPECT_FALSE([view_controller_ isCurrentSetIncognito]); - EXPECT_EQ((CardSet*)otr_card_set_.get(), [view_controller_ inactiveCardSet]); + EXPECT_EQ(static_cast<CardSet*>(otr_card_set_), + [view_controller_ inactiveCardSet]); [view_controller_ setActiveCardSet:[view_controller_ inactiveCardSet]]; EXPECT_TRUE([view_controller_ isCurrentSetIncognito]); - EXPECT_EQ((CardSet*)main_card_set_.get(), [view_controller_ inactiveCardSet]); + EXPECT_EQ(static_cast<CardSet*>(main_card_set_), + [view_controller_ inactiveCardSet]); // Incognito should always be right of (or below in landscape) the main set. EXPECT_GT([otr_card_set_ layoutAxisPosition], [main_card_set_ layoutAxisPosition]);
diff --git a/ios/chrome/common/BUILD.gn b/ios/chrome/common/BUILD.gn index d71c521..077d33ac 100644 --- a/ios/chrome/common/BUILD.gn +++ b/ios/chrome/common/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/ios/ios_sdk.gni") source_set("common") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "channel_info.h", "channel_info.mm",
diff --git a/ios/chrome/common/channel_info.mm b/ios/chrome/common/channel_info.mm index 2d0eb8709..6e40f812 100644 --- a/ios/chrome/common/channel_info.mm +++ b/ios/chrome/common/channel_info.mm
@@ -12,6 +12,10 @@ #import "base/strings/sys_string_conversions.h" #include "components/version_info/version_info.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { #if defined(GOOGLE_CHROME_BUILD)
diff --git a/ios/chrome/common/material_timing.mm b/ios/chrome/common/material_timing.mm index d883aaca..ec125b2 100644 --- a/ios/chrome/common/material_timing.mm +++ b/ios/chrome/common/material_timing.mm
@@ -4,6 +4,10 @@ #import "ios/chrome/common/material_timing.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { UIViewAnimationOptions AnimationOptionsForceLinearTiming( @@ -39,8 +43,10 @@ const CGFloat kDuration8 = 0.07 * kSlowAnimationModifier; CAMediaTimingFunction* TransformCurve2() { - return [[[CAMediaTimingFunction alloc] - initWithControlPoints:0.0f :0.84f :0.13f :0.99f] autorelease]; + return [[CAMediaTimingFunction alloc] initWithControlPoints: + 0.0f: + 0.84f: + 0.13f:0.99f]; } CAMediaTimingFunction* TimingFunction(Curve curve) { @@ -48,18 +54,24 @@ case CurveEaseInOut: // This curve is slow both at the begining and end. // Visualization of curve http://cubic-bezier.com/#.4,0,.2,1 - return [[[CAMediaTimingFunction alloc] - initWithControlPoints:0.4f :0.0f :0.2f :1.0f] autorelease]; + return [[CAMediaTimingFunction alloc] initWithControlPoints: + 0.4f: + 0.0f: + 0.2f:1.0f]; case CurveEaseOut: // This curve is slow at the end. // Visualization of curve http://cubic-bezier.com/#0,0,.2,1 - return [[[CAMediaTimingFunction alloc] - initWithControlPoints:0.0f :0.0f :0.2f :1.0f] autorelease]; + return [[CAMediaTimingFunction alloc] initWithControlPoints: + 0.0f: + 0.0f: + 0.2f:1.0f]; case CurveEaseIn: // This curve is slow at the begining. // Visualization of curve http://cubic-bezier.com/#.4,0,1,1 - return [[[CAMediaTimingFunction alloc] - initWithControlPoints:0.4f :0.0f :1.0f :1.0f] autorelease]; + return [[CAMediaTimingFunction alloc] initWithControlPoints: + 0.4f: + 0.0f: + 1.0f:1.0f]; case CurveLinear: // This curve is linear. return
diff --git a/ios/chrome/common/string_util.mm b/ios/chrome/common/string_util.mm index c9e8912f..5b4aed3c 100644 --- a/ios/chrome/common/string_util.mm +++ b/ios/chrome/common/string_util.mm
@@ -8,10 +8,13 @@ #include "base/logging.h" #include "base/mac/scoped_block.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { typedef BOOL (^ArrayFilterProcedure)(id object, NSUInteger index, BOOL* stop); typedef NSString* (^SubstringExtractionProcedure)(NSUInteger); @@ -50,8 +53,7 @@ tag_text_range.location = after_begin_tag; tag_text_range.length = end_range.location - tag_text_range.location; - base::scoped_nsobject<NSMutableString> out_text( - [[NSMutableString alloc] init]); + NSMutableString* out_text = [[NSMutableString alloc] init]; // First part - before the tag. if (begin_range.location > 0) [out_text appendString:[text substringToIndex:begin_range.location]]; @@ -112,8 +114,8 @@ componentsSeparatedByCharactersInSet:GraphicCharactersSet()] componentsJoinedByString:@" "]; } - base::scoped_nsobject<NSMutableArray> spaceSeparatedCompoments( - [[cleanString componentsSeparatedByCharactersInSet:wspace] mutableCopy]); + NSMutableArray* spaceSeparatedCompoments = + [[cleanString componentsSeparatedByCharactersInSet:wspace] mutableCopy]; ArrayFilterProcedure filter = ^(id object, NSUInteger index, BOOL* stop) { return [object isEqualToString:@""]; }; @@ -142,16 +144,16 @@ // Function to get the correct substring while insulating against // length overrun/underrun. - base::mac::ScopedBlock<SubstringExtractionProcedure> getSubstring; + SubstringExtractionProcedure getSubstring; if (trailing) { - getSubstring.reset([^NSString*(NSUInteger chars) { + getSubstring = [^NSString*(NSUInteger chars) { NSUInteger length = [string length]; return [string substringFromIndex:length - MIN(length, chars)]; - } copy]); + } copy]; } else { - getSubstring.reset([^NSString*(NSUInteger chars) { + getSubstring = [^NSString*(NSUInteger chars) { return [string substringToIndex:MIN(chars, [string length])]; - } copy]); + } copy]; } // Guess at the number of characters that will fit, assuming @@ -160,11 +162,11 @@ NSUInteger characters = MIN(targetWidth / (font.xHeight * 0.8), [string length]); NSInteger increment = 1; - NSString* substring = getSubstring.get()(characters); + NSString* substring = getSubstring(characters); CGFloat prevWidth = [substring sizeWithAttributes:attributes].width; do { characters += increment; - substring = getSubstring.get()(characters); + substring = getSubstring(characters); CGFloat thisWidth = [substring sizeWithAttributes:attributes].width; if (prevWidth > targetWidth) { if (thisWidth <= targetWidth) @@ -175,7 +177,7 @@ if (thisWidth < targetWidth) increment = 1; // Grow the string else { - substring = getSubstring.get()(characters - increment); + substring = getSubstring(characters - increment); break; // Growing the string, found the right size. } }
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc index 3d5e855..c8baa42 100644 --- a/ipc/ipc_channel_mojo.cc +++ b/ipc/ipc_channel_mojo.cc
@@ -283,7 +283,7 @@ void ChannelMojo::ForwardMessageFromThreadSafePtr(mojo::Message message) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); - if (!message_reader_) + if (!message_reader_ || !message_reader_->sender().is_bound()) return; message_reader_->sender().internal_state()->ForwardMessage( std::move(message)); @@ -293,7 +293,7 @@ mojo::Message message, std::unique_ptr<mojo::MessageReceiver> responder) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); - if (!message_reader_) + if (!message_reader_ || !message_reader_->sender().is_bound()) return; message_reader_->sender().internal_state()->ForwardMessageWithResponder( std::move(message), std::move(responder));
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc index 4e416a8a..22355580 100644 --- a/media/audio/win/audio_low_latency_input_win.cc +++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -7,6 +7,7 @@ #include <memory> #include "base/logging.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h" #include "media/audio/audio_device_description.h" @@ -24,20 +25,10 @@ const AudioParameters& params, const std::string& device_id) : manager_(manager), - capture_thread_(NULL), - opened_(false), - started_(false), - frame_size_(0), - packet_size_frames_(0), - packet_size_bytes_(0), - endpoint_buffer_size_frames_(0), device_id_(device_id), - perf_count_to_100ns_units_(0.0), - ms_to_frame_count_(0.0), - sink_(NULL), - audio_bus_(media::AudioBus::Create(params)), - mute_done_(false) { + audio_bus_(media::AudioBus::Create(params)) { DCHECK(manager_); + DCHECK(!device_id_.empty()); // Load the Avrt DLL if not already loaded. Required to support MMCSS. bool avrt_init = avrt::Initialize(); @@ -89,6 +80,8 @@ bool WASAPIAudioInputStream::Open() { DCHECK(CalledOnValidThread()); + DCHECK_EQ(OPEN_RESULT_OK, open_result_); + // Verify that we are not already opened. if (opened_) return false; @@ -97,32 +90,43 @@ // device with the specified unique identifier or role which was // set at construction. HRESULT hr = SetCaptureDevice(); - if (FAILED(hr)) + if (FAILED(hr)) { + ReportOpenResult(); return false; + } // Obtain an IAudioClient interface which enables us to create and initialize // an audio stream between an audio application and the audio engine. - hr = ActivateCaptureDevice(); - if (FAILED(hr)) + hr = endpoint_device_->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, + NULL, audio_client_.ReceiveVoid()); + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_ACTIVATION_FAILED; + ReportOpenResult(); return false; + } +#ifndef NDEBUG // Retrieve the stream format which the audio engine uses for its internal // processing/mixing of shared-mode streams. This function call is for // diagnostic purposes only and only in debug mode. -#ifndef NDEBUG hr = GetAudioEngineStreamFormat(); #endif // Verify that the selected audio endpoint supports the specified format // set during construction. - if (!DesiredFormatIsSupported()) + if (!DesiredFormatIsSupported()) { + open_result_ = OPEN_RESULT_FORMAT_NOT_SUPPORTED; + ReportOpenResult(); return false; + } // Initialize the audio stream between the client and the device using // shared mode and a lowest possible glitch-free latency. hr = InitializeAudioEngine(); - + ReportOpenResult(); // Report before we assign a value to |opened_|. opened_ = SUCCEEDED(hr); + DCHECK(open_result_ == OPEN_RESULT_OK || !opened_); + return opened_; } @@ -159,9 +163,10 @@ // Create and start the thread that will drive the capturing by waiting for // capture events. - capture_thread_ = new base::DelegateSimpleThread( + DCHECK(!capture_thread_.get()); + capture_thread_.reset(new base::DelegateSimpleThread( this, "wasapi_capture_thread", - base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO)); + base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO))); capture_thread_->Start(); // Start streaming data between the endpoint buffer and the audio engine. @@ -209,7 +214,7 @@ if (capture_thread_) { SetEvent(stop_capture_event_.Get()); capture_thread_->Join(); - capture_thread_ = NULL; + capture_thread_.reset(); } started_ = false; @@ -299,8 +304,8 @@ // Enable MMCSS to ensure that this thread receives prioritized access to // CPU resources. DWORD task_index = 0; - HANDLE mm_task = avrt::AvSetMmThreadCharacteristics(L"Pro Audio", - &task_index); + HANDLE mm_task = + avrt::AvSetMmThreadCharacteristics(L"Pro Audio", &task_index); bool mmcss_is_ok = (mm_task && avrt::AvSetMmThreadPriority(mm_task, AVRT_PRIORITY_CRITICAL)); if (!mmcss_is_ok) { @@ -316,17 +321,17 @@ // 2) The selected buffer size is larger than the recorded buffer size in // each event. size_t buffer_frame_index = 0; - size_t capture_buffer_size = std::max( - 2 * endpoint_buffer_size_frames_ * frame_size_, - 2 * packet_size_frames_ * frame_size_); + size_t capture_buffer_size = + std::max(2 * endpoint_buffer_size_frames_ * frame_size_, + 2 * packet_size_frames_ * frame_size_); std::unique_ptr<uint8_t[]> capture_buffer(new uint8_t[capture_buffer_size]); LARGE_INTEGER now_count = {}; bool recording = true; bool error = false; double volume = GetVolume(); - HANDLE wait_array[2] = - { stop_capture_event_.Get(), audio_samples_ready_event_.Get() }; + HANDLE wait_array[2] = {stop_capture_event_.Get(), + audio_samples_ready_event_.Get()}; base::win::ScopedComPtr<IAudioClock> audio_clock; audio_client_->GetService(__uuidof(IAudioClock), audio_clock.ReceiveVoid()); @@ -344,113 +349,109 @@ // |stop_capture_event_| has been set. recording = false; break; - case WAIT_OBJECT_0 + 1: - { - TRACE_EVENT0("audio", "WASAPIAudioInputStream::Run_0"); - // |audio_samples_ready_event_| has been set. - BYTE* data_ptr = NULL; - UINT32 num_frames_to_read = 0; - DWORD flags = 0; - UINT64 device_position = 0; - UINT64 first_audio_frame_timestamp = 0; + case WAIT_OBJECT_0 + 1: { + TRACE_EVENT0("audio", "WASAPIAudioInputStream::Run_0"); + // |audio_samples_ready_event_| has been set. + BYTE* data_ptr = NULL; + UINT32 num_frames_to_read = 0; + DWORD flags = 0; + UINT64 device_position = 0; + UINT64 first_audio_frame_timestamp = 0; - // Retrieve the amount of data in the capture endpoint buffer, - // replace it with silence if required, create callbacks for each - // packet and store non-delivered data for the next event. - hr = audio_capture_client_->GetBuffer(&data_ptr, - &num_frames_to_read, - &flags, - &device_position, - &first_audio_frame_timestamp); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to get data from the capture buffer"; - continue; + // Retrieve the amount of data in the capture endpoint buffer, + // replace it with silence if required, create callbacks for each + // packet and store non-delivered data for the next event. + hr = audio_capture_client_->GetBuffer(&data_ptr, &num_frames_to_read, + &flags, &device_position, + &first_audio_frame_timestamp); + if (FAILED(hr)) { + DLOG(ERROR) << "Failed to get data from the capture buffer"; + continue; + } + + if (audio_clock) { + // The reported timestamp from GetBuffer is not as reliable as the + // clock from the client. We've seen timestamps reported for + // USB audio devices, be off by several days. Furthermore we've + // seen them jump back in time every 2 seconds or so. + audio_clock->GetPosition(&device_position, + &first_audio_frame_timestamp); + } + + if (num_frames_to_read != 0) { + size_t pos = buffer_frame_index * frame_size_; + size_t num_bytes = num_frames_to_read * frame_size_; + DCHECK_GE(capture_buffer_size, pos + num_bytes); + + if (flags & AUDCLNT_BUFFERFLAGS_SILENT) { + // Clear out the local buffer since silence is reported. + memset(&capture_buffer[pos], 0, num_bytes); + } else { + // Copy captured data from audio engine buffer to local buffer. + memcpy(&capture_buffer[pos], data_ptr, num_bytes); } - if (audio_clock) { - // The reported timestamp from GetBuffer is not as reliable as the - // clock from the client. We've seen timestamps reported for - // USB audio devices, be off by several days. Furthermore we've - // seen them jump back in time every 2 seconds or so. - audio_clock->GetPosition( - &device_position, &first_audio_frame_timestamp); - } + buffer_frame_index += num_frames_to_read; + } + hr = audio_capture_client_->ReleaseBuffer(num_frames_to_read); + DLOG_IF(ERROR, FAILED(hr)) << "Failed to release capture buffer"; - if (num_frames_to_read != 0) { - size_t pos = buffer_frame_index * frame_size_; - size_t num_bytes = num_frames_to_read * frame_size_; - DCHECK_GE(capture_buffer_size, pos + num_bytes); + // Derive a delay estimate for the captured audio packet. + // The value contains two parts (A+B), where A is the delay of the + // first audio frame in the packet and B is the extra delay + // contained in any stored data. Unit is in audio frames. + QueryPerformanceCounter(&now_count); + // first_audio_frame_timestamp will be 0 if we didn't get a timestamp. + double audio_delay_frames = + first_audio_frame_timestamp == 0 + ? num_frames_to_read + : ((perf_count_to_100ns_units_ * now_count.QuadPart - + first_audio_frame_timestamp) / + 10000.0) * + ms_to_frame_count_ + + buffer_frame_index - num_frames_to_read; - if (flags & AUDCLNT_BUFFERFLAGS_SILENT) { - // Clear out the local buffer since silence is reported. - memset(&capture_buffer[pos], 0, num_bytes); - } else { - // Copy captured data from audio engine buffer to local buffer. - memcpy(&capture_buffer[pos], data_ptr, num_bytes); - } + // Get a cached AGC volume level which is updated once every second + // on the audio manager thread. Note that, |volume| is also updated + // each time SetVolume() is called through IPC by the render-side AGC. + GetAgcVolume(&volume); - buffer_frame_index += num_frames_to_read; - } + // Deliver captured data to the registered consumer using a packet + // size which was specified at construction. + uint32_t delay_frames = static_cast<uint32_t>(audio_delay_frames + 0.5); + while (buffer_frame_index >= packet_size_frames_) { + // Copy data to audio bus to match the OnData interface. + uint8_t* audio_data = + reinterpret_cast<uint8_t*>(capture_buffer.get()); + audio_bus_->FromInterleaved(audio_data, audio_bus_->frames(), + format_.wBitsPerSample / 8); - hr = audio_capture_client_->ReleaseBuffer(num_frames_to_read); - DLOG_IF(ERROR, FAILED(hr)) << "Failed to release capture buffer"; + // Deliver data packet, delay estimation and volume level to + // the user. + sink_->OnData(this, audio_bus_.get(), delay_frames * frame_size_, + volume); - // Derive a delay estimate for the captured audio packet. - // The value contains two parts (A+B), where A is the delay of the - // first audio frame in the packet and B is the extra delay - // contained in any stored data. Unit is in audio frames. - QueryPerformanceCounter(&now_count); - // first_audio_frame_timestamp will be 0 if we didn't get a timestamp. - double audio_delay_frames = first_audio_frame_timestamp == 0 ? - num_frames_to_read : - ((perf_count_to_100ns_units_ * now_count.QuadPart - - first_audio_frame_timestamp) / 10000.0) * ms_to_frame_count_ + - buffer_frame_index - num_frames_to_read; + // Store parts of the recorded data which can't be delivered + // using the current packet size. The stored section will be used + // either in the next while-loop iteration or in the next + // capture event. + // TODO(tommi): If this data will be used in the next capture + // event, we will report incorrect delay estimates because + // we'll use the one for the captured data that time around + // (i.e. in the future). + memmove(&capture_buffer[0], &capture_buffer[packet_size_bytes_], + (buffer_frame_index - packet_size_frames_) * frame_size_); - // Get a cached AGC volume level which is updated once every second - // on the audio manager thread. Note that, |volume| is also updated - // each time SetVolume() is called through IPC by the render-side AGC. - GetAgcVolume(&volume); - - // Deliver captured data to the registered consumer using a packet - // size which was specified at construction. - uint32_t delay_frames = - static_cast<uint32_t>(audio_delay_frames + 0.5); - while (buffer_frame_index >= packet_size_frames_) { - // Copy data to audio bus to match the OnData interface. - uint8_t* audio_data = - reinterpret_cast<uint8_t*>(capture_buffer.get()); - audio_bus_->FromInterleaved( - audio_data, audio_bus_->frames(), format_.wBitsPerSample / 8); - - // Deliver data packet, delay estimation and volume level to - // the user. - sink_->OnData( - this, audio_bus_.get(), delay_frames * frame_size_, volume); - - // Store parts of the recorded data which can't be delivered - // using the current packet size. The stored section will be used - // either in the next while-loop iteration or in the next - // capture event. - // TODO(tommi): If this data will be used in the next capture - // event, we will report incorrect delay estimates because - // we'll use the one for the captured data that time around - // (i.e. in the future). - memmove(&capture_buffer[0], - &capture_buffer[packet_size_bytes_], - (buffer_frame_index - packet_size_frames_) * frame_size_); - - DCHECK_GE(buffer_frame_index, packet_size_frames_); - buffer_frame_index -= packet_size_frames_; - if (delay_frames > packet_size_frames_) { - delay_frames -= packet_size_frames_; - } else { - delay_frames = 0; - } + DCHECK_GE(buffer_frame_index, packet_size_frames_); + buffer_frame_index -= packet_size_frames_; + if (delay_frames > packet_size_frames_) { + delay_frames -= packet_size_frames_; + } else { + delay_frames = 0; } } - break; + } break; default: error = true; break; @@ -477,13 +478,16 @@ } HRESULT WASAPIAudioInputStream::SetCaptureDevice() { + DCHECK_EQ(OPEN_RESULT_OK, open_result_); DCHECK(!endpoint_device_.get()); ScopedComPtr<IMMDeviceEnumerator> enumerator; - HRESULT hr = enumerator.CreateInstance(__uuidof(MMDeviceEnumerator), - NULL, CLSCTX_INPROC_SERVER); - if (FAILED(hr)) + HRESULT hr = enumerator.CreateInstance(__uuidof(MMDeviceEnumerator), NULL, + CLSCTX_INPROC_SERVER); + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_CREATE_INSTANCE; return hr; + } // Retrieve the IMMDevice by using the specified role or the specified // unique endpoint device-identification string. @@ -513,34 +517,29 @@ endpoint_device_.Receive()); } - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_NO_ENDPOINT; return hr; + } // Verify that the audio endpoint device is active, i.e., the audio // adapter that connects to the endpoint device is present and enabled. DWORD state = DEVICE_STATE_DISABLED; hr = endpoint_device_->GetState(&state); - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_NO_STATE; return hr; + } if (!(state & DEVICE_STATE_ACTIVE)) { DLOG(ERROR) << "Selected capture device is not active."; + open_result_ = OPEN_RESULT_DEVICE_NOT_ACTIVE; hr = E_ACCESSDENIED; } return hr; } -HRESULT WASAPIAudioInputStream::ActivateCaptureDevice() { - // Creates and activates an IAudioClient COM object given the selected - // capture endpoint device. - HRESULT hr = endpoint_device_->Activate(__uuidof(IAudioClient), - CLSCTX_INPROC_SERVER, - NULL, - audio_client_.ReceiveVoid()); - return hr; -} - HRESULT WASAPIAudioInputStream::GetAudioEngineStreamFormat() { HRESULT hr = S_OK; #ifndef NDEBUG @@ -551,8 +550,8 @@ // An WAVEFORMATEXTENSIBLE structure can specify both the mapping of // channels to speakers and the number of bits of precision in each sample. base::win::ScopedCoMem<WAVEFORMATEXTENSIBLE> format_ex; - hr = audio_client_->GetMixFormat( - reinterpret_cast<WAVEFORMATEX**>(&format_ex)); + hr = + audio_client_->GetMixFormat(reinterpret_cast<WAVEFORMATEX**>(&format_ex)); // See http://msdn.microsoft.com/en-us/windows/hardware/gg463006#EFH // for details on the WAVE file format. @@ -567,10 +566,10 @@ DVLOG(2) << " cbSize : " << format.cbSize; DVLOG(2) << "WAVEFORMATEXTENSIBLE:"; - DVLOG(2) << " wValidBitsPerSample: " << - format_ex->Samples.wValidBitsPerSample; - DVLOG(2) << " dwChannelMask : 0x" << std::hex << - format_ex->dwChannelMask; + DVLOG(2) << " wValidBitsPerSample: " + << format_ex->Samples.wValidBitsPerSample; + DVLOG(2) << " dwChannelMask : 0x" << std::hex + << format_ex->dwChannelMask; if (format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM) DVLOG(2) << " SubFormat : KSDATAFORMAT_SUBTYPE_PCM"; else if (format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) @@ -593,14 +592,14 @@ // the audio engine can mix only PCM streams. base::win::ScopedCoMem<WAVEFORMATEX> closest_match; HRESULT hr = audio_client_->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, - &format_, - &closest_match); + &format_, &closest_match); DLOG_IF(ERROR, hr == S_FALSE) << "Format is not supported " << "but a closest match exists."; return (hr == S_OK); } HRESULT WASAPIAudioInputStream::InitializeAudioEngine() { + DCHECK_EQ(OPEN_RESULT_OK, open_result_); DWORD flags; // Use event-driven mode only fo regular input devices. For loopback the // EVENTCALLBACK flag is specified when intializing @@ -625,8 +624,10 @@ ? &kCommunicationsSessionId : nullptr); - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_AUDIO_CLIENT_INIT_FAILED; return hr; + } // Retrieve the length of the endpoint buffer shared between the client // and the audio engine. The buffer length determines the maximum amount @@ -634,8 +635,10 @@ // during a single processing pass. // A typical value is 960 audio frames <=> 20ms @ 48kHz sample rate. hr = audio_client_->GetBufferSize(&endpoint_buffer_size_frames_); - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_GET_BUFFER_SIZE_FAILED; return hr; + } DVLOG(1) << "endpoint buffer size: " << endpoint_buffer_size_frames_ << " [frames]"; @@ -685,15 +688,19 @@ hr = endpoint_device_->Activate( __uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, audio_render_client_for_loopback_.ReceiveVoid()); - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_LOOPBACK_ACTIVATE_FAILED; return hr; + } hr = audio_render_client_for_loopback_->Initialize( AUDCLNT_SHAREMODE_SHARED, - AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, - 0, 0, &format_, NULL); - if (FAILED(hr)) + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, 0, 0, + &format_, NULL); + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_LOOPBACK_INIT_FAILED; return hr; + } hr = audio_render_client_for_loopback_->SetEventHandle( audio_samples_ready_event_.Get()); @@ -701,21 +708,34 @@ hr = audio_client_->SetEventHandle(audio_samples_ready_event_.Get()); } - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_SET_EVENT_HANDLE; return hr; + } // Get access to the IAudioCaptureClient interface. This interface // enables us to read input data from the capture endpoint buffer. hr = audio_client_->GetService(__uuidof(IAudioCaptureClient), audio_capture_client_.ReceiveVoid()); - if (FAILED(hr)) + if (FAILED(hr)) { + open_result_ = OPEN_RESULT_NO_CAPTURE_CLIENT; return hr; + } // Obtain a reference to the ISimpleAudioVolume interface which enables // us to control the master volume level of an audio session. hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), simple_audio_volume_.ReceiveVoid()); + if (FAILED(hr)) + open_result_ = OPEN_RESULT_NO_AUDIO_VOLUME; + return hr; } +void WASAPIAudioInputStream::ReportOpenResult() const { + DCHECK(!opened_); // This method must be called before we set this flag. + UMA_HISTOGRAM_ENUMERATION("Media.Audio.Capture.Win.Open", open_result_, + OPEN_RESULT_MAX + 1); +} + } // namespace media
diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h index eff9d94..09aeaf99 100644 --- a/media/audio/win/audio_low_latency_input_win.h +++ b/media/audio/win/audio_low_latency_input_win.h
@@ -57,8 +57,8 @@ #define MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ #include <Audioclient.h> -#include <endpointvolume.h> #include <MMDeviceAPI.h> +#include <endpointvolume.h> #include <stddef.h> #include <stdint.h> @@ -120,37 +120,62 @@ // The Open() method is divided into these sub methods. HRESULT SetCaptureDevice(); - HRESULT ActivateCaptureDevice(); HRESULT GetAudioEngineStreamFormat(); bool DesiredFormatIsSupported(); HRESULT InitializeAudioEngine(); + void ReportOpenResult() const; + + // Used to track down where we fail during initialization which at the + // moment seems to be happening frequently and we're not sure why. + // The reason might be expected (e.g. trying to open "default" on a machine + // that has no audio devices). + // Note: This enum is used to record a histogram value and should not be + // re-ordered. + enum StreamOpenResult { + OPEN_RESULT_OK = 0, + OPEN_RESULT_CREATE_INSTANCE = 1, + OPEN_RESULT_NO_ENDPOINT = 2, + OPEN_RESULT_NO_STATE = 3, + OPEN_RESULT_DEVICE_NOT_ACTIVE = 4, + OPEN_RESULT_ACTIVATION_FAILED = 5, + OPEN_RESULT_FORMAT_NOT_SUPPORTED = 6, + OPEN_RESULT_AUDIO_CLIENT_INIT_FAILED = 7, + OPEN_RESULT_GET_BUFFER_SIZE_FAILED = 8, + OPEN_RESULT_LOOPBACK_ACTIVATE_FAILED = 9, + OPEN_RESULT_LOOPBACK_INIT_FAILED = 10, + OPEN_RESULT_SET_EVENT_HANDLE = 11, + OPEN_RESULT_NO_CAPTURE_CLIENT = 12, + OPEN_RESULT_NO_AUDIO_VOLUME = 13, + OPEN_RESULT_MAX = OPEN_RESULT_NO_AUDIO_VOLUME + }; // Our creator, the audio manager needs to be notified when we close. - AudioManagerWin* manager_; + AudioManagerWin* const manager_; // Capturing is driven by this thread (which has no message loop). // All OnData() callbacks will be called from this thread. - base::DelegateSimpleThread* capture_thread_; + std::unique_ptr<base::DelegateSimpleThread> capture_thread_; // Contains the desired audio format which is set up at construction. WAVEFORMATEX format_; - bool opened_; - bool started_; + bool opened_ = false; + bool started_ = false; + StreamOpenResult open_result_ = OPEN_RESULT_OK; // Size in bytes of each audio frame (4 bytes for 16-bit stereo PCM) - size_t frame_size_; + size_t frame_size_ = 0; // Size in audio frames of each audio packet where an audio packet // is defined as the block of data which the user received in each // OnData() callback. - size_t packet_size_frames_; + size_t packet_size_frames_ = 0; // Size in bytes of each audio packet. - size_t packet_size_bytes_; + size_t packet_size_bytes_ = 0; // Length of the audio endpoint buffer. - uint32_t endpoint_buffer_size_frames_; + uint32_t endpoint_buffer_size_frames_ = 0; // Contains the unique name of the selected endpoint device. // Note that AudioDeviceDescription::kDefaultDeviceId represents the default @@ -159,14 +184,14 @@ // Conversion factor used in delay-estimation calculations. // Converts a raw performance counter value to 100-nanosecond unit. - double perf_count_to_100ns_units_; + double perf_count_to_100ns_units_ = 0.0; // Conversion factor used in delay-estimation calculations. // Converts from milliseconds to audio frames. - double ms_to_frame_count_; + double ms_to_frame_count_ = 0.0; // Pointer to the object that will receive the recorded audio samples. - AudioInputCallback* sink_; + AudioInputCallback* sink_ = nullptr; // Windows Multimedia Device (MMDevice) API interfaces. @@ -216,7 +241,7 @@ // kLoopbackWithMuteDeviceId. // True, if we have muted the system audio for the stream capturing, and // indicates that we need to unmute the system audio when stopping capturing. - bool mute_done_; + bool mute_done_ = false; DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); };
diff --git a/media/base/android/BUILD.gn b/media/base/android/BUILD.gn index b8c638b..48883cf 100644 --- a/media/base/android/BUILD.gn +++ b/media/base/android/BUILD.gn
@@ -126,6 +126,7 @@ sources = [ "java/src/org/chromium/media/AudioManagerAndroid.java", "java/src/org/chromium/media/AudioRecordInput.java", + "java/src/org/chromium/media/CodecProfileLevelList.java", "java/src/org/chromium/media/MediaCodecBridge.java", "java/src/org/chromium/media/MediaCodecUtil.java", "java/src/org/chromium/media/MediaDrmBridge.java", @@ -145,6 +146,7 @@ java_files = [ "java/src/org/chromium/media/AudioManagerAndroid.java", "java/src/org/chromium/media/AudioRecordInput.java", + "java/src/org/chromium/media/CodecProfileLevelList.java", "java/src/org/chromium/media/MediaCodecBridge.java", "java/src/org/chromium/media/MediaCodecUtil.java", "java/src/org/chromium/media/MediaDrmBridge.java",
diff --git a/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java b/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java new file mode 100644 index 0000000..f99b890 --- /dev/null +++ b/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java
@@ -0,0 +1,291 @@ +// 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.media; + +import android.media.MediaCodecInfo.CodecProfileLevel; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.MainDex; + +import java.util.LinkedList; +import java.util.List; + +@JNINamespace("media") +@MainDex +class CodecProfileLevelList { + private static final String TAG = "CodecProfileLevelList"; + + // The following values are taken from media/base/video_codecs.h. These need to be kept in sync. + private static final int H264PROFILE_BASELINE = 0; + private static final int H264PROFILE_MAIN = 1; + private static final int H264PROFILE_EXTENDED = 2; + private static final int H264PROFILE_HIGH = 3; + private static final int H264PROFILE_HIGH10PROFILE = 4; + private static final int H264PROFILE_HIGH422PROFILE = 5; + private static final int H264PROFILE_HIGH444PREDICTIVEPROFILE = 6; + private static final int H264PROFILE_SCALABLEBASELINE = 7; + private static final int H264PROFILE_SCALABLEHIGH = 8; + private static final int H264PROFILE_STEREOHIGH = 9; + private static final int H264PROFILE_MULTIVIEWHIGH = 10; + private static final int VP8PROFILE_ANY = 11; + private static final int VP9PROFILE_PROFILE0 = 12; + private static final int VP9PROFILE_PROFILE1 = 13; + private static final int VP9PROFILE_PROFILE2 = 14; + private static final int VP9PROFILE_PROFILE3 = 15; + private static final int HEVCPROFILE_MAIN = 16; + private static final int HEVCPROFILE_MAIN10 = 17; + private static final int HEVCPROFILE_MAIN_STILL_PICTURE = 18; + + // Constants used to keep track of the codec from a mime string. + private static final String CODEC_AVC = "AVC"; + private static final String CODEC_VP8 = "VP8"; + private static final String CODEC_VP9 = "VP9"; + private static final String CODEC_HEVC = "HEVC"; + + private final List<CodecProfileLevelAdapter> mList; + + public CodecProfileLevelList() { + mList = new LinkedList<CodecProfileLevelAdapter>(); + } + + public boolean addCodecProfileLevel(String mime, CodecProfileLevel codecProfileLevel) { + try { + String codec = getCodecFromMime(mime); + mList.add(new CodecProfileLevelAdapter(codec, + mediaCodecProfileToChromiumMediaProfile(codec, codecProfileLevel.profile), + mediaCodecLevelToChromiumMediaLevel(codec, codecProfileLevel.level))); + return true; + } catch (UnsupportedCodecProfileException e) { + return false; + } + } + + public boolean addCodecProfileLevel(String codec, int profile, int level) { + mList.add(new CodecProfileLevelAdapter(codec, profile, level)); + return true; + } + + public Object[] toArray() { + return mList.toArray(); + } + + static class CodecProfileLevelAdapter { + private final String mCodec; + private final int mProfile; + private final int mLevel; + + public CodecProfileLevelAdapter(String codec, int profile, int level) { + mCodec = codec; + mProfile = profile; + mLevel = level; + } + + @CalledByNative("CodecProfileLevelAdapter") + public String getCodec() { + return mCodec; + } + + @CalledByNative("CodecProfileLevelAdapter") + public int getProfile() { + return mProfile; + } + + @CalledByNative("CodecProfileLevelAdapter") + public int getLevel() { + return mLevel; + } + } + + private static class UnsupportedCodecProfileException extends RuntimeException {} + + private static String getCodecFromMime(String mime) { + if (mime.endsWith("vp9")) return CODEC_VP9; + if (mime.endsWith("vp8")) return CODEC_VP8; + if (mime.endsWith("avc")) return CODEC_AVC; + if (mime.endsWith("hevc")) return CODEC_HEVC; + throw new UnsupportedCodecProfileException(); + } + + private static int mediaCodecProfileToChromiumMediaProfile(String codec, int profile) { + // Note: The values returned here correspond to the VideoCodecProfile enum in + // media/base/video_coedecs.h. These values need to be kept in sync with that file! + switch (codec) { + case CODEC_AVC: + switch (profile) { + case CodecProfileLevel.AVCProfileBaseline: + return H264PROFILE_BASELINE; + case CodecProfileLevel.AVCProfileMain: + return H264PROFILE_MAIN; + case CodecProfileLevel.AVCProfileExtended: + return H264PROFILE_EXTENDED; + case CodecProfileLevel.AVCProfileHigh: + return H264PROFILE_HIGH; + case CodecProfileLevel.AVCProfileHigh10: + return H264PROFILE_HIGH10PROFILE; + case CodecProfileLevel.AVCProfileHigh422: + return H264PROFILE_HIGH422PROFILE; + case CodecProfileLevel.AVCProfileHigh444: + return H264PROFILE_HIGH444PREDICTIVEPROFILE; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_VP8: + switch (profile) { + case CodecProfileLevel.VP8ProfileMain: + return VP8PROFILE_ANY; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_VP9: + switch (profile) { + case CodecProfileLevel.VP9Profile0: + return VP9PROFILE_PROFILE0; + case CodecProfileLevel.VP9Profile1: + return VP9PROFILE_PROFILE1; + case CodecProfileLevel.VP9Profile2: + return VP9PROFILE_PROFILE2; + case CodecProfileLevel.VP9Profile3: + return VP9PROFILE_PROFILE3; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_HEVC: + switch (profile) { + case CodecProfileLevel.HEVCProfileMain: + return HEVCPROFILE_MAIN; + case CodecProfileLevel.HEVCProfileMain10: + return HEVCPROFILE_MAIN10; + case CodecProfileLevel.HEVCProfileMain10HDR10: + return HEVCPROFILE_MAIN_STILL_PICTURE; + default: + throw new UnsupportedCodecProfileException(); + } + default: + throw new UnsupportedCodecProfileException(); + } + } + + private static int mediaCodecLevelToChromiumMediaLevel(String codec, int level) { + switch (codec) { + case CODEC_AVC: + switch (level) { + case CodecProfileLevel.AVCLevel1: + return 10; + case CodecProfileLevel.AVCLevel11: + return 11; + case CodecProfileLevel.AVCLevel12: + return 12; + case CodecProfileLevel.AVCLevel13: + return 14; + case CodecProfileLevel.AVCLevel2: + return 20; + case CodecProfileLevel.AVCLevel21: + return 21; + case CodecProfileLevel.AVCLevel22: + return 22; + case CodecProfileLevel.AVCLevel3: + return 30; + case CodecProfileLevel.AVCLevel31: + return 31; + case CodecProfileLevel.AVCLevel32: + return 32; + case CodecProfileLevel.AVCLevel4: + return 40; + case CodecProfileLevel.AVCLevel41: + return 41; + case CodecProfileLevel.AVCLevel42: + return 42; + case CodecProfileLevel.AVCLevel5: + return 50; + case CodecProfileLevel.AVCLevel51: + return 51; + case CodecProfileLevel.AVCLevel52: + return 52; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_VP8: + switch (level) { + case CodecProfileLevel.VP8Level_Version0: + return 0; + case CodecProfileLevel.VP8Level_Version1: + return 1; + case CodecProfileLevel.VP8Level_Version2: + return 2; + case CodecProfileLevel.VP8Level_Version3: + return 3; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_VP9: + switch (level) { + case CodecProfileLevel.VP9Level1: + return 10; + case CodecProfileLevel.VP9Level11: + return 11; + case CodecProfileLevel.VP9Level2: + return 20; + case CodecProfileLevel.VP9Level21: + return 21; + case CodecProfileLevel.VP9Level3: + return 30; + case CodecProfileLevel.VP9Level31: + return 31; + case CodecProfileLevel.VP9Level4: + return 40; + case CodecProfileLevel.VP9Level41: + return 41; + case CodecProfileLevel.VP9Level5: + return 50; + case CodecProfileLevel.VP9Level51: + return 51; + case CodecProfileLevel.VP9Level52: + return 52; + case CodecProfileLevel.VP9Level6: + return 60; + case CodecProfileLevel.VP9Level61: + return 61; + case CodecProfileLevel.VP9Level62: + return 62; + default: + throw new UnsupportedCodecProfileException(); + } + case CODEC_HEVC: + switch (level) { + case CodecProfileLevel.HEVCMainTierLevel1: + return 30; + case CodecProfileLevel.HEVCMainTierLevel2: + return 60; + case CodecProfileLevel.HEVCMainTierLevel21: + return 63; + case CodecProfileLevel.HEVCMainTierLevel3: + return 90; + case CodecProfileLevel.HEVCMainTierLevel31: + return 93; + case CodecProfileLevel.HEVCMainTierLevel4: + return 120; + case CodecProfileLevel.HEVCMainTierLevel41: + return 123; + case CodecProfileLevel.HEVCMainTierLevel5: + return 150; + case CodecProfileLevel.HEVCMainTierLevel51: + return 153; + case CodecProfileLevel.HEVCMainTierLevel52: + return 156; + case CodecProfileLevel.HEVCMainTierLevel6: + return 180; + case CodecProfileLevel.HEVCMainTierLevel61: + return 183; + case CodecProfileLevel.HEVCMainTierLevel62: + return 186; + default: + throw new UnsupportedCodecProfileException(); + } + default: + throw new UnsupportedCodecProfileException(); + } + } +}
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java index 024f4b0..6ea84417 100644 --- a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java +++ b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java
@@ -8,6 +8,9 @@ import android.media.MediaCodec; import android.media.MediaCodec.CryptoInfo; import android.media.MediaCodecInfo; +import android.media.MediaCodecInfo.CodecCapabilities; +import android.media.MediaCodecInfo.CodecProfileLevel; +import android.media.MediaCodecInfo.VideoCapabilities; import android.media.MediaCodecList; import android.os.Build; @@ -17,8 +20,10 @@ import org.chromium.base.annotations.MainDex; import java.util.Arrays; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; /** * A collection of MediaCodec utility functions. @@ -64,7 +69,7 @@ * Class to abstract platform version API differences for interacting with * the MediaCodecList. */ - private static class MediaCodecListHelper { + private static class MediaCodecListHelper implements Iterable<MediaCodecInfo> { @TargetApi(Build.VERSION_CODES.LOLLIPOP) public MediaCodecListHelper() { if (hasNewMediaCodecList()) { @@ -72,14 +77,19 @@ } } + @Override + public Iterator<MediaCodecInfo> iterator() { + return new CodecInfoIterator(); + } + @SuppressWarnings("deprecation") - public int getCodecCount() { + private int getCodecCount() { if (hasNewMediaCodecList()) return mCodecList.length; return MediaCodecList.getCodecCount(); } @SuppressWarnings("deprecation") - public MediaCodecInfo getCodecInfoAt(int index) { + private MediaCodecInfo getCodecInfoAt(int index) { if (hasNewMediaCodecList()) return mCodecList[index]; return MediaCodecList.getCodecInfoAt(index); } @@ -89,6 +99,28 @@ } private MediaCodecInfo[] mCodecList; + + private class CodecInfoIterator implements Iterator<MediaCodecInfo> { + private int mPosition = 0; + + @Override + public boolean hasNext() { + return mPosition < getCodecCount(); + } + + @Override + public MediaCodecInfo next() { + if (mPosition == getCodecCount()) { + throw new NoSuchElementException(); + } + return getCodecInfoAt(mPosition++); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } } /** @@ -115,18 +147,14 @@ private static String getDefaultCodecName( String mime, int direction, boolean requireSoftwareCodec) { MediaCodecListHelper codecListHelper = new MediaCodecListHelper(); - int codecCount = codecListHelper.getCodecCount(); - for (int i = 0; i < codecCount; ++i) { - MediaCodecInfo info = codecListHelper.getCodecInfoAt(i); - + for (MediaCodecInfo info : codecListHelper) { int codecDirection = info.isEncoder() ? MEDIA_CODEC_ENCODER : MEDIA_CODEC_DECODER; if (codecDirection != direction) continue; if (requireSoftwareCodec && !isSoftwareCodec(info.getName())) continue; - String[] supportedTypes = info.getSupportedTypes(); - for (int j = 0; j < supportedTypes.length; ++j) { - if (supportedTypes[j].equalsIgnoreCase(mime)) return info.getName(); + for (String supportedType : info.getSupportedTypes()) { + if (supportedType.equalsIgnoreCase(mime)) return info.getName(); } } @@ -142,15 +170,12 @@ @CalledByNative private static int[] getEncoderColorFormatsForMime(String mime) { MediaCodecListHelper codecListHelper = new MediaCodecListHelper(); - int codecCount = codecListHelper.getCodecCount(); - for (int i = 0; i < codecCount; i++) { - MediaCodecInfo info = codecListHelper.getCodecInfoAt(i); + for (MediaCodecInfo info : codecListHelper) { if (!info.isEncoder()) continue; - String[] supportedTypes = info.getSupportedTypes(); - for (int j = 0; j < supportedTypes.length; ++j) { - if (supportedTypes[j].equalsIgnoreCase(mime)) { - return info.getCapabilitiesForType(supportedTypes[j]).colorFormats; + for (String supportedType : info.getSupportedTypes()) { + if (supportedType.equalsIgnoreCase(mime)) { + return info.getCapabilitiesForType(supportedType).colorFormats; } } } @@ -178,6 +203,57 @@ } /** + * Needed on M and older to get correct information about VP9 support. + * @param profileLevels The CodecProfileLevelList to add supported profile levels to. + * @param videoCapabilities The MediaCodecInfo.VideoCapabilities used to infer support. + */ + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private static void addVp9CodecProfileLevels(CodecProfileLevelList profileLevels, + MediaCodecInfo.CodecCapabilities codecCapabilities) { + // https://www.webmproject.org/vp9/levels + final int[][] bitrateMapping = { + {200, 10}, {800, 11}, {1800, 20}, {3600, 21}, {7200, 30}, {12000, 31}, {18000, 40}, + {30000, 41}, {60000, 50}, {120000, 51}, {180000, 52}, + }; + VideoCapabilities videoCapabilities = codecCapabilities.getVideoCapabilities(); + for (int[] entry : bitrateMapping) { + int bitrate = entry[0]; + int level = entry[1]; + if (videoCapabilities.getBitrateRange().contains(bitrate)) { + // Assume all platforms before N only support VP9 profile 0. + profileLevels.addCodecProfileLevel("VP9", 12 /* VP9PROFILE_PROFILE0 */, level); + } + } + } + + /** + * Return an array of supported codecs and profiles. + */ + @CalledByNative + private static Object[] getSupportedCodecProfileLevels() { + CodecProfileLevelList profileLevels = new CodecProfileLevelList(); + MediaCodecListHelper codecListHelper = new MediaCodecListHelper(); + for (MediaCodecInfo info : codecListHelper) { + for (String mime : info.getSupportedTypes()) { + // On versions L and M, VP9 codecCapabilities do not advertise profile level + // support. In this case, estimate the level from MediaCodecInfo.VideoCapabilities + // instead. Assume VP9 is not supported before L. For more information, consult + // https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html + CodecCapabilities codecCapabilities = info.getCapabilitiesForType(mime); + if (mime.endsWith("vp9") && Build.VERSION_CODES.LOLLIPOP <= Build.VERSION.SDK_INT + && Build.VERSION.SDK_INT <= 23) { + addVp9CodecProfileLevels(profileLevels, codecCapabilities); + continue; + } + for (CodecProfileLevel profileLevel : codecCapabilities.profileLevels) { + profileLevels.addCodecProfileLevel(mime, profileLevel); + } + } + } + return profileLevels.toArray(); + } + + /** * Creates MediaCodec decoder. * @param mime MIME type of the media. * @param secure Whether secure decoder is required. @@ -499,10 +575,7 @@ */ private static HWEncoderProperties findHWEncoder(String mime) { MediaCodecListHelper codecListHelper = new MediaCodecListHelper(); - int codecCount = codecListHelper.getCodecCount(); - for (int i = 0; i < codecCount; ++i) { - MediaCodecInfo info = codecListHelper.getCodecInfoAt(i); - + for (MediaCodecInfo info : codecListHelper) { if (!info.isEncoder() || isSoftwareCodec(info.getName())) continue; String encoderName = null;
diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc index cf6204a..b2d5f82 100644 --- a/media/base/android/media_codec_util.cc +++ b/media/base/android/media_codec_util.cc
@@ -14,14 +14,17 @@ #include "base/android/jni_string.h" #include "base/logging.h" #include "base/strings/string_util.h" +#include "jni/CodecProfileLevelList_jni.h" #include "jni/MediaCodecUtil_jni.h" #include "media/base/android/media_codec_bridge.h" +#include "media/base/video_codecs.h" #include "url/gurl.h" using base::android::AttachCurrentThread; using base::android::ConvertJavaStringToUTF8; using base::android::ConvertUTF8ToJavaString; using base::android::JavaIntArrayToIntVector; +using base::android::JavaRef; using base::android::ScopedJavaLocalRef; namespace media { @@ -65,6 +68,32 @@ return std::string(); } +static VideoCodec AndroidCodecToCodecEnum(const std::string& codec) { + if (codec == "AVC") + return kCodecH264; + if (codec == "VP8") + return kCodecVP8; + if (codec == "VP9") + return kCodecVP9; + if (codec == "HEVC") + return kCodecHEVC; + DLOG(WARNING) << "Unknown video codec name \"" << codec << "\""; + return kUnknownVideoCodec; +} + +static CodecProfileLevel MediaCodecProfileLevelToChromiumProfileLevel( + JNIEnv* env, + const jobject& j_codec_profile_level) { + ScopedJavaLocalRef<jstring> codec = + Java_CodecProfileLevelAdapter_getCodec(env, j_codec_profile_level); + int profile = + Java_CodecProfileLevelAdapter_getProfile(env, j_codec_profile_level); + int level = + Java_CodecProfileLevelAdapter_getLevel(env, j_codec_profile_level); + return {AndroidCodecToCodecEnum(ConvertJavaStringToUTF8(codec)), + static_cast<VideoCodecProfile>(profile), level}; +} + static bool IsSupportedAndroidMimeType(const std::string& mime_type) { std::vector<std::string> supported{ kMp4aMimeType, kOpusMimeType, kVorbisMimeType, kAvcMimeType, @@ -167,6 +196,25 @@ } // static +bool MediaCodecUtil::AddSupportedCodecProfileLevels( + std::vector<CodecProfileLevel>* result) { + DCHECK(result); + if (!IsMediaCodecAvailable()) + return false; + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobjectArray> j_codec_profile_levels( + Java_MediaCodecUtil_getSupportedCodecProfileLevels(env)); + int java_array_length = env->GetArrayLength(j_codec_profile_levels.obj()); + for (int i = 0; i < java_array_length; ++i) { + const jobject& java_codec_profile_level = + env->GetObjectArrayElement(j_codec_profile_levels.obj(), i); + result->push_back(MediaCodecProfileLevelToChromiumProfileLevel( + env, java_codec_profile_level)); + } + return true; +} + +// static bool MediaCodecUtil::IsKnownUnaccelerated(const std::string& android_mime_type, MediaCodecDirection direction) { DCHECK(IsSupportedAndroidMimeType(android_mime_type));
diff --git a/media/base/android/media_codec_util.h b/media/base/android/media_codec_util.h index fb3b5ac4..3bf0e537 100644 --- a/media/base/android/media_codec_util.h +++ b/media/base/android/media_codec_util.h
@@ -14,6 +14,7 @@ #include "base/macros.h" #include "media/base/android/media_codec_direction.h" #include "media/base/media_export.h" +#include "media/base/video_codecs.h" class GURL; @@ -53,6 +54,10 @@ // decode |codec| type. static bool CanDecode(const std::string& codec, bool is_secure); + // Returns a vector of supported codecs profiles and levels. + static bool AddSupportedCodecProfileLevels( + std::vector<CodecProfileLevel>* out); + // Get a list of encoder supported color formats for |mime_type|. // The mapping of color format name and its value refers to // MediaCodecInfo.CodecCapabilities.
diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc index 477186c..a47a00d4 100644 --- a/media/base/android/media_drm_bridge.cc +++ b/media/base/android/media_drm_bridge.cc
@@ -14,6 +14,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/hash_tables.h" +#include "base/feature_list.h" #include "base/lazy_instance.h" #include "base/location.h" #include "base/logging.h" @@ -29,6 +30,7 @@ #include "media/base/android/media_codec_util.h" #include "media/base/android/media_drm_bridge_delegate.h" #include "media/base/cdm_key_information.h" +#include "media/base/media_switches.h" #include "media/base/provision_fetcher.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -259,6 +261,20 @@ } // static +bool MediaDrmBridge::IsPersistentLicenseTypeSupported( + const std::string& key_system) { + if (!MediaDrmBridge::IsAvailable()) + return false; + + if (!base::FeatureList::IsEnabled(kMediaDrmPersistentLicense)) { + return false; + } + + NOTIMPLEMENTED() << "In development. See http://crbug.com/493521"; + return false; +} + +// static bool MediaDrmBridge::IsKeySystemSupportedWithType( const std::string& key_system, const std::string& container_mime_type) { @@ -424,6 +440,8 @@ DCHECK(task_runner_->BelongsToCurrentThread()); DVLOG(2) << __func__; + DCHECK(base::FeatureList::IsEnabled(kMediaDrmPersistentLicense)); + NOTIMPLEMENTED() << "EME persistent sessions not yet supported on Android."; promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported.");
diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h index d5577cc7..dbb868b7 100644 --- a/media/base/android/media_drm_bridge.h +++ b/media/base/android/media_drm_bridge.h
@@ -79,6 +79,8 @@ const std::string& key_system, const std::string& container_mime_type); + static bool IsPersistentLicenseTypeSupported(const std::string& key_system); + // Returns the list of the platform-supported key system names that // are not handled by Chrome explicitly. static std::vector<std::string> GetPlatformKeySystemNames();
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index af1855d..49dc7289 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -204,6 +204,13 @@ // Lock the screen orientation when a video goes fullscreen. const base::Feature kVideoFullscreenOrientationLock{ "VideoFullscreenOrientationLock", base::FEATURE_ENABLED_BY_DEFAULT}; + +// An experimental feature to enable persistent-license type support in MediaDrm +// when using Encrypted Media Extensions (EME) API. +// TODO(xhwang): Remove this after feature launch. See http://crbug.com/493521 +const base::Feature kMediaDrmPersistentLicense{ + "MediaDrmPersistentLicense", base::FEATURE_DISABLED_BY_DEFAULT}; + #endif } // namespace media
diff --git a/media/base/media_switches.h b/media/base/media_switches.h index f7bfcdd8..c3e184b9 100644 --- a/media/base/media_switches.h +++ b/media/base/media_switches.h
@@ -103,6 +103,7 @@ #if defined(OS_ANDROID) MEDIA_EXPORT extern const base::Feature kAndroidMediaPlayerRenderer; MEDIA_EXPORT extern const base::Feature kVideoFullscreenOrientationLock; +MEDIA_EXPORT extern const base::Feature kMediaDrmPersistentLicense; #endif // defined(OS_ANDROID) } // namespace media
diff --git a/media/base/video_codecs.h b/media/base/video_codecs.h index 5c199d3..3343f72 100644 --- a/media/base/video_codecs.h +++ b/media/base/video_codecs.h
@@ -34,9 +34,11 @@ }; // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see -// media/mojo/interfaces/media_types.mojom) and gpu::VideoCodecProfile (see -// gpu/config/gpu_info.h), as well as PP_VideoDecoder_Profile (translation is -// performed in content/renderer/pepper/ppb_video_decoder_impl.cc). +// media/mojo/interfaces/media_types.mojom), gpu::VideoCodecProfile (see +// gpu/config/gpu_info.h), and +// media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java, +// as well as PP_VideoDecoder_Profile (translation is performed in +// content/renderer/pepper/ppb_video_decoder_impl.cc). // NOTE: These values are histogrammed over time in UMA so the values must // never ever change (add new values to tools/metrics/histograms/histograms.xml) enum VideoCodecProfile { @@ -75,6 +77,12 @@ VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAX, }; +struct CodecProfileLevel { + VideoCodec codec; + VideoCodecProfile profile; + int level; +}; + std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile);
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn index cc1946a..c831ada 100644 --- a/mojo/public/cpp/bindings/BUILD.gn +++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -50,6 +50,7 @@ "lib/array_internal.cc", "lib/array_internal.h", "lib/array_serialization.h", + "lib/associated_binding.cc", "lib/associated_group.cc", "lib/associated_group_controller.cc", "lib/associated_interface_ptr_state.h",
diff --git a/mojo/public/cpp/bindings/associated_binding.h b/mojo/public/cpp/bindings/associated_binding.h index f7787d7f..6ad07ee 100644 --- a/mojo/public/cpp/bindings/associated_binding.h +++ b/mojo/public/cpp/bindings/associated_binding.h
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" @@ -18,6 +19,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "mojo/public/cpp/bindings/associated_group.h" #include "mojo/public/cpp/bindings/associated_interface_request.h" +#include "mojo/public/cpp/bindings/bindings_export.h" #include "mojo/public/cpp/bindings/connection_error_callback.h" #include "mojo/public/cpp/bindings/interface_endpoint_client.h" #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" @@ -28,6 +30,61 @@ class MessageReceiver; +// Base class used to factor out code in AssociatedBinding<T> expansions, in +// particular for Bind(). +class MOJO_CPP_BINDINGS_EXPORT AssociatedBindingBase { + public: + AssociatedBindingBase(); + ~AssociatedBindingBase(); + + // Adds a message filter to be notified of each incoming message before + // dispatch. If a filter returns |false| from Accept(), the message is not + // dispatched and the pipe is closed. Filters cannot be removed. + void AddFilter(std::unique_ptr<MessageReceiver> filter); + + // Closes the associated interface. Puts this object into a state where it can + // be rebound. + void Close(); + + // Similar to the method above, but also specifies a disconnect reason. + void CloseWithReason(uint32_t custom_reason, const std::string& description); + + // Sets an error handler that will be called if a connection error occurs. + // + // This method may only be called after this AssociatedBinding has been bound + // to a message pipe. The error handler will be reset when this + // AssociatedBinding is unbound or closed. + void set_connection_error_handler(const base::Closure& error_handler); + + void set_connection_error_with_reason_handler( + const ConnectionErrorWithReasonCallback& error_handler); + + // Indicates whether the associated binding has been completed. + bool is_bound() const { return !!endpoint_client_; } + + // Returns the associated group that this object belongs to. Returns null if + // the object is not bound. + AssociatedGroup* associated_group() { + return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; + } + + // Sends a message on the underlying message pipe and runs the current + // message loop until its response is received. This can be used in tests to + // verify that no message was sent on a message pipe in response to some + // stimulus. + void FlushForTesting(); + + protected: + void BindImpl(ScopedInterfaceEndpointHandle handle, + MessageReceiverWithResponderStatus* receiver, + std::unique_ptr<MessageReceiver> payload_validator, + bool expect_sync_requests, + scoped_refptr<base::SingleThreadTaskRunner> runner, + uint32_t interface_version); + + std::unique_ptr<InterfaceEndpointClient> endpoint_client_; +}; + // Represents the implementation side of an associated interface. It is similar // to Binding, except that it doesn't own a message pipe handle. // @@ -40,7 +97,7 @@ // reenter outgoing synchrounous calls on the same thread. template <typename Interface, typename ImplRefTraits = RawPtrImplRefTraits<Interface>> -class AssociatedBinding { +class AssociatedBinding : public AssociatedBindingBase { public: using ImplPointerType = typename ImplRefTraits::PointerType; @@ -93,42 +150,10 @@ void Bind(AssociatedInterfaceRequest<Interface> request, scoped_refptr<base::SingleThreadTaskRunner> runner = base::ThreadTaskRunnerHandle::Get()) { - ScopedInterfaceEndpointHandle handle = request.PassHandle(); - - DCHECK(handle.is_local()) - << "The AssociatedInterfaceRequest is supposed to be used at the " - << "other side of the message pipe."; - - if (!handle.is_valid() || !handle.is_local()) { - endpoint_client_.reset(); - return; - } - - endpoint_client_.reset(new InterfaceEndpointClient( - std::move(handle), &stub_, - base::WrapUnique(new typename Interface::RequestValidator_()), - Interface::HasSyncMethods_, std::move(runner), Interface::Version_)); - } - - // Adds a message filter to be notified of each incoming message before - // dispatch. If a filter returns |false| from Accept(), the message is not - // dispatched and the pipe is closed. Filters cannot be removed. - void AddFilter(std::unique_ptr<MessageReceiver> filter) { - DCHECK(endpoint_client_); - endpoint_client_->AddFilter(std::move(filter)); - } - - // Closes the associated interface. Puts this object into a state where it can - // be rebound. - void Close() { - endpoint_client_.reset(); - } - - // Similar to the method above, but also specifies a disconnect reason. - void CloseWithReason(uint32_t custom_reason, const std::string& description) { - if (endpoint_client_) - endpoint_client_->CloseWithReason(custom_reason, description); - Close(); + BindImpl(request.PassHandle(), &stub_, + base::WrapUnique(new typename Interface::RequestValidator_()), + Interface::HasSyncMethods_, std::move(runner), + Interface::Version_); } // Unbinds and returns the associated interface request so it can be @@ -145,44 +170,10 @@ return request; } - // Sets an error handler that will be called if a connection error occurs. - // - // This method may only be called after this AssociatedBinding has been bound - // to a message pipe. The error handler will be reset when this - // AssociatedBinding is unbound or closed. - void set_connection_error_handler(const base::Closure& error_handler) { - DCHECK(is_bound()); - endpoint_client_->set_connection_error_handler(error_handler); - } - - void set_connection_error_with_reason_handler( - const ConnectionErrorWithReasonCallback& error_handler) { - DCHECK(is_bound()); - endpoint_client_->set_connection_error_with_reason_handler(error_handler); - } - // Returns the interface implementation that was previously specified. Interface* impl() { return ImplRefTraits::GetRawPointer(&stub_.sink()); } - // Indicates whether the associated binding has been completed. - bool is_bound() const { return !!endpoint_client_; } - - // Returns the associated group that this object belongs to. Returns null if - // the object is not bound. - AssociatedGroup* associated_group() { - return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; - } - - // Sends a message on the underlying message pipe and runs the current - // message loop until its response is received. This can be used in tests to - // verify that no message was sent on a message pipe in response to some - // stimulus. - void FlushForTesting() { - endpoint_client_->control_message_proxy()->FlushForTesting(); - } - private: - std::unique_ptr<InterfaceEndpointClient> endpoint_client_; typename Interface::template Stub_<ImplRefTraits> stub_; DISALLOW_COPY_AND_ASSIGN(AssociatedBinding);
diff --git a/mojo/public/cpp/bindings/lib/associated_binding.cc b/mojo/public/cpp/bindings/lib/associated_binding.cc new file mode 100644 index 0000000..f504b75 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/associated_binding.cc
@@ -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. + +#include "mojo/public/cpp/bindings/associated_binding.h" + +namespace mojo { + +AssociatedBindingBase::AssociatedBindingBase() {} + +AssociatedBindingBase::~AssociatedBindingBase() {} + +void AssociatedBindingBase::AddFilter(std::unique_ptr<MessageReceiver> filter) { + DCHECK(endpoint_client_); + endpoint_client_->AddFilter(std::move(filter)); +} + +void AssociatedBindingBase::Close() { + endpoint_client_.reset(); +} + +void AssociatedBindingBase::CloseWithReason(uint32_t custom_reason, + const std::string& description) { + if (endpoint_client_) + endpoint_client_->CloseWithReason(custom_reason, description); + Close(); +} + +void AssociatedBindingBase::set_connection_error_handler( + const base::Closure& error_handler) { + DCHECK(is_bound()); + endpoint_client_->set_connection_error_handler(error_handler); +} + +void AssociatedBindingBase::set_connection_error_with_reason_handler( + const ConnectionErrorWithReasonCallback& error_handler) { + DCHECK(is_bound()); + endpoint_client_->set_connection_error_with_reason_handler(error_handler); +} + +void AssociatedBindingBase::FlushForTesting() { + endpoint_client_->control_message_proxy()->FlushForTesting(); +} + +void AssociatedBindingBase::BindImpl( + ScopedInterfaceEndpointHandle handle, + MessageReceiverWithResponderStatus* receiver, + std::unique_ptr<MessageReceiver> payload_validator, + bool expect_sync_requests, + scoped_refptr<base::SingleThreadTaskRunner> runner, + uint32_t interface_version) { + DCHECK(handle.is_local()) + << "The AssociatedInterfaceRequest is supposed to be used at the " + << "other side of the message pipe."; + + if (!handle.is_valid() || !handle.is_local()) { + endpoint_client_.reset(); + return; + } + + endpoint_client_.reset(new InterfaceEndpointClient( + std::move(handle), receiver, std::move(payload_validator), + expect_sync_requests, std::move(runner), interface_version)); +} + +} // namespace mojo
diff --git a/net/BUILD.gn b/net/BUILD.gn index 09c5431..5ea19ee0 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -951,6 +951,8 @@ "http2/http2_constants.h", "http2/http2_structures.cc", "http2/http2_structures.h", + "http2/platform/api/http2_reconstruct_object.h", + "http2/platform/impl/http2_reconstruct_object_impl.h", "http2/tools/http2_bug_tracker.h", "log/file_net_log_observer.cc", "log/file_net_log_observer.h", @@ -1490,6 +1492,8 @@ "spdy/multiplexed_http_stream.h", "spdy/multiplexed_session.cc", "spdy/multiplexed_session.h", + "spdy/platform/api/spdy_estimate_memory_usage.h", + "spdy/platform/impl/spdy_estimate_memory_usage_impl.h", "spdy/priority_write_scheduler.h", "spdy/server_push_delegate.h", "spdy/spdy_alt_svc_wire_format.cc",
diff --git a/net/disk_cache/blockfile/eviction.cc b/net/disk_cache/blockfile/eviction.cc index 68f65b4bd..97d8f703 100644 --- a/net/disk_cache/blockfile/eviction.cc +++ b/net/disk_cache/blockfile/eviction.cc
@@ -329,8 +329,8 @@ int list = Rankings::LAST_ELEMENT; // Get a node from each list. + bool done = false; for (int i = 0; i < kListsToSearch; i++) { - bool done = false; next[i].set_rankings(rankings_); if (done) continue;
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 39b86328..ccded67 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc
@@ -230,6 +230,8 @@ DCHECK(buf->data()); request_info_.url = url; request_info_.method = "GET"; + + // todo (crbug.com/690099): Incorrect usage of LOAD_ONLY_FROM_CACHE. request_info_.load_flags = LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION | LOAD_SKIP_VARY_CHECK;
diff --git a/net/http/http_cache.h b/net/http/http_cache.h index f881b2a05..60bab05 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h
@@ -189,11 +189,9 @@ // referred to by |url| and |http_method|. void OnExternalCacheHit(const GURL& url, const std::string& http_method); - // Causes all transactions created after this point to effectively bypass - // the cache lock whenever there is lock contention. - void BypassLockForTest() { - bypass_lock_for_test_ = true; - } + // Causes all transactions created after this point to simulate lock timeout + // and effectively bypass the cache lock whenever there is lock contention. + void SimulateCacheLockTimeout() { bypass_lock_for_test_ = true; } // Causes all transactions created after this point to generate a failure // when attempting to conditionalize a network request.
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 24002d7..0e557c0 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc
@@ -1160,6 +1160,9 @@ } if (result == ERR_CACHE_LOCK_TIMEOUT) { + if (mode_ == READ) + return ERR_CACHE_MISS; + // The cache is busy, bypass it for this transaction. mode_ = NONE; next_state_ = STATE_SEND_REQUEST;
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 60c7ed7..635c15ca 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -1748,7 +1748,7 @@ // lock to continue. TEST(HttpCache, SimpleGET_WriterTimeout) { MockHttpCache cache; - cache.BypassCacheLock(); + cache.SimulateCacheLockTimeout(); MockHttpRequest request(kSimpleGET_Transaction); Context c1, c2; @@ -1769,6 +1769,34 @@ ReadAndVerifyTransaction(c1.trans.get(), kSimpleGET_Transaction); } +// Tests that a (simulated) timeout allows transactions waiting on the cache +// lock to continue but read only transactions to error out. +TEST(HttpCache, SimpleGET_WriterTimeoutReadOnlyError) { + MockHttpCache cache; + + // Simulate timeout. + cache.SimulateCacheLockTimeout(); + + MockHttpRequest request(kSimpleGET_Transaction); + Context c1, c2; + ASSERT_THAT(cache.CreateTransaction(&c1.trans), IsOk()); + ASSERT_EQ(ERR_IO_PENDING, c1.trans->Start(&request, c1.callback.callback(), + NetLogWithSource())); + + request.load_flags = LOAD_ONLY_FROM_CACHE; + ASSERT_THAT(cache.CreateTransaction(&c2.trans), IsOk()); + ASSERT_EQ(ERR_IO_PENDING, c2.trans->Start(&request, c2.callback.callback(), + NetLogWithSource())); + + // The second request is queued after the first one. + int res = c2.callback.WaitForResult(); + ASSERT_EQ(ERR_CACHE_MISS, res); + + // Complete the first transaction. + c1.callback.WaitForResult(); + ReadAndVerifyTransaction(c1.trans.get(), kSimpleGET_Transaction); +} + TEST(HttpCache, SimpleGET_AbandonedCacheRead) { MockHttpCache cache; @@ -6788,6 +6816,46 @@ EXPECT_EQ(1, cache.disk_cache()->create_count()); } +// Tests that if a metadata writer transaction hits cache lock timeout, it will +// error out. +TEST(HttpCache, WriteMetadata_CacheLockTimeout) { + MockHttpCache cache; + + // Write to the cache + HttpResponseInfo response; + RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction, + &response); + EXPECT_FALSE(response.metadata.get()); + + MockHttpRequest request(kSimpleGET_Transaction); + Context c1; + ASSERT_THAT(cache.CreateTransaction(&c1.trans), IsOk()); + ASSERT_EQ(ERR_IO_PENDING, c1.trans->Start(&request, c1.callback.callback(), + NetLogWithSource())); + + cache.SimulateCacheLockTimeout(); + + // Write meta data to the same entry. + scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(50)); + memset(buf->data(), 0, buf->size()); + base::strlcpy(buf->data(), "Hi there", buf->size()); + cache.http_cache()->WriteMetadata(GURL(kSimpleGET_Transaction.url), + DEFAULT_PRIORITY, response.response_time, + buf.get(), buf->size()); + + // Release the buffer before the operation takes place. + buf = NULL; + + // Makes sure we finish pending operations. + base::RunLoop().RunUntilIdle(); + + RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction, + &response); + + // The writer transaction should fail due to cache lock timeout. + ASSERT_FALSE(response.metadata.get()); +} + // Tests that we ignore VARY checks when writing metadata since the request // headers for the WriteMetadata transaction are made up. TEST(HttpCache, WriteMetadata_IgnoreVary) {
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h index 942c9116..6ba72dcf 100644 --- a/net/http/http_server_properties.h +++ b/net/http/http_server_properties.h
@@ -321,6 +321,9 @@ virtual void SetMaxServerConfigsStoredInProperties( size_t max_server_configs_stored_in_properties) = 0; + // Returns whether HttpServerProperties is initialized. + virtual bool IsInitialized() const = 0; + private: DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); };
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc index 7fee0c7..c020b046 100644 --- a/net/http/http_server_properties_impl.cc +++ b/net/http/http_server_properties_impl.cc
@@ -46,7 +46,7 @@ HttpServerPropertiesImpl::~HttpServerPropertiesImpl() { } -void HttpServerPropertiesImpl::InitializeSpdyServers( +void HttpServerPropertiesImpl::SetSpdyServers( std::vector<std::string>* spdy_servers, bool support_spdy) { DCHECK(CalledOnValidThread()); @@ -73,7 +73,7 @@ } } -void HttpServerPropertiesImpl::InitializeAlternativeServiceServers( +void HttpServerPropertiesImpl::SetAlternativeServiceServers( AlternativeServiceMap* alternative_service_map) { int32_t size_diff = alternative_service_map->size() - alternative_service_map_.size(); @@ -135,12 +135,12 @@ } } -void HttpServerPropertiesImpl::InitializeSupportsQuic(IPAddress* last_address) { +void HttpServerPropertiesImpl::SetSupportsQuic(IPAddress* last_address) { if (last_address) last_quic_address_ = *last_address; } -void HttpServerPropertiesImpl::InitializeServerNetworkStats( +void HttpServerPropertiesImpl::SetServerNetworkStats( ServerNetworkStatsMap* server_network_stats_map) { // Add the entries from persisted data. ServerNetworkStatsMap new_server_network_stats_map( @@ -164,7 +164,7 @@ } } -void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( +void HttpServerPropertiesImpl::SetQuicServerInfoMap( QuicServerInfoMap* quic_server_info_map) { // Add the entries from persisted data. QuicServerInfoMap temp_map(QuicServerInfoMap::NO_AUTO_EVICT); @@ -624,6 +624,11 @@ quic_server_info_map_.Swap(temp_map); } +bool HttpServerPropertiesImpl::IsInitialized() const { + // No initialization is needed. + return true; +} + AlternativeServiceMap::const_iterator HttpServerPropertiesImpl::GetAlternateProtocolIterator( const url::SchemeHostPort& server) {
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h index 3ab6fbca..eed9e46 100644 --- a/net/http/http_server_properties_impl.h +++ b/net/http/http_server_properties_impl.h
@@ -44,20 +44,19 @@ HttpServerPropertiesImpl(); ~HttpServerPropertiesImpl() override; - // Initializes |spdy_servers_map_| with the servers (host/port) from + // Sets |spdy_servers_map_| with the servers (host/port) from // |spdy_servers| that either support SPDY or not. - void InitializeSpdyServers(std::vector<std::string>* spdy_servers, - bool support_spdy); + void SetSpdyServers(std::vector<std::string>* spdy_servers, + bool support_spdy); - void InitializeAlternativeServiceServers( + void SetAlternativeServiceServers( AlternativeServiceMap* alternate_protocol_servers); - void InitializeSupportsQuic(IPAddress* last_address); + void SetSupportsQuic(IPAddress* last_address); - void InitializeServerNetworkStats( - ServerNetworkStatsMap* server_network_stats_map); + void SetServerNetworkStats(ServerNetworkStatsMap* server_network_stats_map); - void InitializeQuicServerInfoMap(QuicServerInfoMap* quic_server_info_map); + void SetQuicServerInfoMap(QuicServerInfoMap* quic_server_info_map); // Get the list of servers (host/port) that support SPDY. The max_size is the // number of MRU servers that support SPDY that are to be returned. @@ -120,6 +119,7 @@ size_t max_server_configs_stored_in_properties() const override; void SetMaxServerConfigsStoredInProperties( size_t max_server_configs_stored_in_properties) override; + bool IsInitialized() const override; private: friend class HttpServerPropertiesImplPeer;
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc index d5a053d..ec278578 100644 --- a/net/http/http_server_properties_impl_unittest.cc +++ b/net/http/http_server_properties_impl_unittest.cc
@@ -66,7 +66,7 @@ typedef HttpServerPropertiesImplTest SpdyServerPropertiesTest; -TEST_F(SpdyServerPropertiesTest, InitializeWithSchemeHostPort) { +TEST_F(SpdyServerPropertiesTest, SetWithSchemeHostPort) { // Check spdy servers are correctly set with SchemeHostPort key. url::SchemeHostPort https_www_server("https", "www.google.com", 443); url::SchemeHostPort http_photo_server("http", "photos.google.com", 80); @@ -84,7 +84,7 @@ std::vector<std::string> spdy_servers1; spdy_servers1.push_back(spdy_server_g); // Will be 0th index. spdy_servers1.push_back(spdy_server_p); // Will be 1st index. - impl_.InitializeSpdyServers(&spdy_servers1, true); + impl_.SetSpdyServers(&spdy_servers1, true); EXPECT_TRUE(impl_.SupportsRequestPriority(http_photo_server)); EXPECT_TRUE(impl_.SupportsRequestPriority(https_www_server)); EXPECT_FALSE(impl_.SupportsRequestPriority(http_google_server)); @@ -92,7 +92,7 @@ EXPECT_TRUE(impl_.SupportsRequestPriority(valid_google_server)); } -TEST_F(SpdyServerPropertiesTest, Initialize) { +TEST_F(SpdyServerPropertiesTest, Set) { url::SchemeHostPort spdy_server_google("https", "www.google.com", 443); std::string spdy_server_g = spdy_server_google.Serialize(); @@ -106,12 +106,12 @@ std::string spdy_server_m = spdy_server_mail.Serialize(); // Check by initializing NULL spdy servers. - impl_.InitializeSpdyServers(NULL, true); + impl_.SetSpdyServers(NULL, true); EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); // Check by initializing empty spdy servers. std::vector<std::string> spdy_servers; - impl_.InitializeSpdyServers(&spdy_servers, true); + impl_.SetSpdyServers(&spdy_servers, true); EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); // Check by initializing www.google.com:443 and photos.google.com:443 as spdy @@ -119,7 +119,7 @@ std::vector<std::string> spdy_servers1; spdy_servers1.push_back(spdy_server_g); // Will be 0th index. spdy_servers1.push_back(spdy_server_p); // Will be 1st index. - impl_.InitializeSpdyServers(&spdy_servers1, true); + impl_.SetSpdyServers(&spdy_servers1, true); EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_photos)); EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); @@ -139,7 +139,7 @@ std::vector<std::string> spdy_servers2; spdy_servers2.push_back(spdy_server_m); // Will be 2nd index. spdy_servers2.push_back(spdy_server_d); // Will be 3rd index. - impl_.InitializeSpdyServers(&spdy_servers2, true); + impl_.SetSpdyServers(&spdy_servers2, true); // Verify all the servers are in the list in the same order. spdy_server_list.Clear(); @@ -170,7 +170,7 @@ std::vector<std::string> spdy_servers3; spdy_servers3.push_back(spdy_server_m); spdy_servers3.push_back(spdy_server_p); - impl_.InitializeSpdyServers(&spdy_servers3, false); + impl_.SetSpdyServers(&spdy_servers3, false); // Verify the entries are in the same order. ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); @@ -388,9 +388,9 @@ EXPECT_EQ(alternative_service4, alternative_service_vector[2]); } -TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { +TEST_F(AlternateProtocolServerPropertiesTest, Set) { // |test_server1| has an alternative service, which will not be - // affected by InitializeAlternativeServiceServers(), because + // affected by SetAlternativeServiceServers(), because // |alternative_service_map| does not have an entry for // |test_server1|. url::SchemeHostPort test_server1("http", "foo1", 80); @@ -401,7 +401,7 @@ impl_.SetAlternativeService(test_server1, alternative_service1, expiration1); // |test_server2| has an alternative service, which will be - // overwritten by InitializeAlternativeServiceServers(), because + // overwritten by SetAlternativeServiceServers(), because // |alternative_service_map| has an entry for // |test_server2|. AlternativeServiceInfoVector alternative_service_info_vector; @@ -414,7 +414,7 @@ impl_.SetAlternativeServices(test_server2, alternative_service_info_vector); // Prepare |alternative_service_map| to be loaded by - // InitializeAlternativeServiceServers(). + // SetAlternativeServiceServers(). AlternativeServiceMap alternative_service_map( AlternativeServiceMap::NO_AUTO_EVICT); const AlternativeService alternative_service3(kProtoHTTP2, "bar3", 123); @@ -438,7 +438,7 @@ AlternativeServiceInfoVector(/*size=*/1, alternative_service_info2)); // MRU list will be test_server2, test_server1, test_server3. - impl_.InitializeAlternativeServiceServers(&alternative_service_map); + impl_.SetAlternativeServiceServers(&alternative_service_map); // Verify alternative_service_map. const AlternativeServiceMap& map = impl_.alternative_service_map(); @@ -462,9 +462,9 @@ } // Regression test for https://crbug.com/504032: -// InitializeAlternativeServiceServers() should not crash if there is an empty +// SetAlternativeServiceServers() should not crash if there is an empty // hostname is the mapping. -TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) { +TEST_F(AlternateProtocolServerPropertiesTest, SetWithEmptyHostname) { url::SchemeHostPort server("https", "foo", 443); const AlternativeService alternative_service_with_empty_hostname(kProtoHTTP2, "", 1234); @@ -475,7 +475,7 @@ AlternativeServiceMap alternative_service_map( AlternativeServiceMap::NO_AUTO_EVICT); - impl_.InitializeAlternativeServiceServers(&alternative_service_map); + impl_.SetAlternativeServiceServers(&alternative_service_map); EXPECT_TRUE( impl_.IsAlternativeServiceBroken(alternative_service_with_foo_hostname)); @@ -503,7 +503,7 @@ // Prepare |alternative_service_map_| with a single key that has a single // AlternativeServiceInfo with identical hostname and port. - impl_.InitializeAlternativeServiceServers(&alternative_service_map); + impl_.SetAlternativeServiceServers(&alternative_service_map); // GetAlternativeServices() should remove such AlternativeServiceInfo from // |alternative_service_map_|, emptying the AlternativeServiceInfoVector @@ -539,7 +539,7 @@ // Prepare |alternative_service_map_| with a single key that has a single // AlternativeServiceInfo with identical hostname and port. - impl_.InitializeAlternativeServiceServers(&alternative_service_map); + impl_.SetAlternativeServiceServers(&alternative_service_map); // GetAlternativeServices() should remove such AlternativeServiceInfo from // |alternative_service_map_|, emptying the AlternativeServiceInfoVector @@ -983,12 +983,12 @@ typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest; -TEST_F(SupportsQuicServerPropertiesTest, Initialize) { +TEST_F(SupportsQuicServerPropertiesTest, Set) { HostPortPair quic_server_google("www.google.com", 443); // Check by initializing empty address. IPAddress initial_address; - impl_.InitializeSupportsQuic(&initial_address); + impl_.SetSupportsQuic(&initial_address); IPAddress address; EXPECT_FALSE(impl_.GetSupportsQuic(&address)); @@ -996,7 +996,7 @@ // Check by initializing with a valid address. initial_address = IPAddress::IPv4Localhost(); - impl_.InitializeSupportsQuic(&initial_address); + impl_.SetSupportsQuic(&initial_address); EXPECT_TRUE(impl_.GetSupportsQuic(&address)); EXPECT_EQ(initial_address, address); @@ -1020,13 +1020,13 @@ typedef HttpServerPropertiesImplTest ServerNetworkStatsServerPropertiesTest; -TEST_F(ServerNetworkStatsServerPropertiesTest, Initialize) { +TEST_F(ServerNetworkStatsServerPropertiesTest, Set) { url::SchemeHostPort google_server("https", "www.google.com", 443); // Check by initializing empty ServerNetworkStats. ServerNetworkStatsMap init_server_network_stats_map( ServerNetworkStatsMap::NO_AUTO_EVICT); - impl_.InitializeServerNetworkStats(&init_server_network_stats_map); + impl_.SetServerNetworkStats(&init_server_network_stats_map); const ServerNetworkStats* stats = impl_.GetServerNetworkStats(google_server); EXPECT_EQ(NULL, stats); @@ -1035,7 +1035,7 @@ stats_google.srtt = base::TimeDelta::FromMicroseconds(10); stats_google.bandwidth_estimate = QuicBandwidth::FromBitsPerSecond(100); init_server_network_stats_map.Put(google_server, stats_google); - impl_.InitializeServerNetworkStats(&init_server_network_stats_map); + impl_.SetServerNetworkStats(&init_server_network_stats_map); // Verify data for www.google.com:443. ASSERT_EQ(1u, impl_.server_network_stats_map().size()); @@ -1044,7 +1044,7 @@ // Test recency order and overwriting of data. // // |docs_server| has a ServerNetworkStats, which will be overwritten by - // InitializeServerNetworkStats(), because |server_network_stats_map| has an + // SetServerNetworkStats(), because |server_network_stats_map| has an // entry for |docs_server|. url::SchemeHostPort docs_server("https", "docs.google.com", 443); ServerNetworkStats stats_docs; @@ -1054,7 +1054,7 @@ impl_.SetServerNetworkStats(docs_server, stats_docs); // Prepare |server_network_stats_map| to be loaded by - // InitializeServerNetworkStats(). + // SetServerNetworkStats(). ServerNetworkStatsMap server_network_stats_map( ServerNetworkStatsMap::NO_AUTO_EVICT); @@ -1071,7 +1071,7 @@ server_network_stats_map.Put(mail_server, stats_mail); // Recency order will be |docs_server|, |google_server| and |mail_server|. - impl_.InitializeServerNetworkStats(&server_network_stats_map); + impl_.SetServerNetworkStats(&server_network_stats_map); const ServerNetworkStatsMap& map = impl_.server_network_stats_map(); ASSERT_EQ(3u, map.size()); @@ -1112,7 +1112,7 @@ typedef HttpServerPropertiesImplTest QuicServerInfoServerPropertiesTest; -TEST_F(QuicServerInfoServerPropertiesTest, Initialize) { +TEST_F(QuicServerInfoServerPropertiesTest, Set) { HostPortPair google_server("www.google.com", 443); QuicServerId google_quic_server_id(google_server, PRIVACY_MODE_ENABLED); @@ -1123,13 +1123,13 @@ // Check empty map. QuicServerInfoMap init_quic_server_info_map(QuicServerInfoMap::NO_AUTO_EVICT); - impl_.InitializeQuicServerInfoMap(&init_quic_server_info_map); + impl_.SetQuicServerInfoMap(&init_quic_server_info_map); EXPECT_EQ(0u, impl_.quic_server_info_map().size()); // Check by initializing with www.google.com:443. std::string google_server_info("google_quic_server_info"); init_quic_server_info_map.Put(google_quic_server_id, google_server_info); - impl_.InitializeQuicServerInfoMap(&init_quic_server_info_map); + impl_.SetQuicServerInfoMap(&init_quic_server_info_map); // Verify data for www.google.com:443. EXPECT_EQ(1u, impl_.quic_server_info_map().size()); @@ -1139,7 +1139,7 @@ // Test recency order and overwriting of data. // // |docs_server| has a QuicServerInfo, which will be overwritten by - // InitializeQuicServerInfoMap(), because |quic_server_info_map| has an + // SetQuicServerInfoMap(), because |quic_server_info_map| has an // entry for |docs_server|. HostPortPair docs_server("docs.google.com", 443); QuicServerId docs_quic_server_id(docs_server, PRIVACY_MODE_ENABLED); @@ -1157,7 +1157,7 @@ EXPECT_EQ(google_server_info, map_it->second); // Prepare |quic_server_info_map| to be loaded by - // InitializeQuicServerInfoMap(). + // SetQuicServerInfoMap(). QuicServerInfoMap quic_server_info_map(QuicServerInfoMap::NO_AUTO_EVICT); // Change the values for |docs_server|. std::string new_docs_server_info("new_docs_quic_server_info"); @@ -1167,7 +1167,7 @@ QuicServerId mail_quic_server_id(mail_server, PRIVACY_MODE_ENABLED); std::string mail_server_info("mail_quic_server_info"); quic_server_info_map.Put(mail_quic_server_id, mail_server_info); - impl_.InitializeQuicServerInfoMap(&quic_server_info_map); + impl_.SetQuicServerInfoMap(&quic_server_info_map); // Recency order will be |docs_server|, |google_server| and |mail_server|. const QuicServerInfoMap& memory_map = impl_.quic_server_info_map();
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc index e94c7ca..ff1859f 100644 --- a/net/http/http_server_properties_manager.cc +++ b/net/http/http_server_properties_manager.cc
@@ -79,6 +79,7 @@ : pref_task_runner_(pref_task_runner), pref_delegate_(pref_delegate), setting_prefs_(false), + is_initialized_(false), network_task_runner_(network_task_runner) { DCHECK(pref_delegate_); pref_weak_ptr_factory_.reset( @@ -98,16 +99,22 @@ void HttpServerPropertiesManager::InitializeOnNetworkThread() { DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); + network_weak_ptr_factory_.reset( new base::WeakPtrFactory<HttpServerPropertiesManager>(this)); http_server_properties_impl_.reset(new HttpServerPropertiesImpl()); network_prefs_update_timer_.reset(new base::OneShotTimer); network_prefs_update_timer_->SetTaskRunner(network_task_runner_); - pref_task_runner_->PostTask( + // UpdateCacheFromPrefsOnPrefThread() will post a task to network thread to + // update server properties. SetInitialized() will be run after that task is + // run as |network_task_runner_| is single threaded. + pref_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&HttpServerPropertiesManager::UpdateCacheFromPrefsOnPrefThread, - pref_weak_ptr_)); + pref_weak_ptr_), + base::Bind(&HttpServerPropertiesManager::SetInitialized, + network_weak_ptr_factory_->GetWeakPtr())); } void HttpServerPropertiesManager::ShutdownOnPrefThread() { @@ -353,6 +360,12 @@ max_server_configs_stored_in_properties); } +bool HttpServerPropertiesManager::IsInitialized() const { + DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); + + return is_initialized_; +} + // // Update the HttpServerPropertiesImpl's cache with data from preferences. // @@ -757,22 +770,20 @@ DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); UMA_HISTOGRAM_COUNTS("Net.CountOfSpdyServers", spdy_servers->size()); - http_server_properties_impl_->InitializeSpdyServers(spdy_servers, true); + http_server_properties_impl_->SetSpdyServers(spdy_servers, true); // Update the cached data and use the new alternative service list from // preferences. UMA_HISTOGRAM_COUNTS("Net.CountOfAlternateProtocolServers", alternative_service_map->size()); - http_server_properties_impl_->InitializeAlternativeServiceServers( + http_server_properties_impl_->SetAlternativeServiceServers( alternative_service_map); - http_server_properties_impl_->InitializeSupportsQuic(last_quic_address); + http_server_properties_impl_->SetSupportsQuic(last_quic_address); - http_server_properties_impl_->InitializeServerNetworkStats( - server_network_stats_map); + http_server_properties_impl_->SetServerNetworkStats(server_network_stats_map); - http_server_properties_impl_->InitializeQuicServerInfoMap( - quic_server_info_map); + http_server_properties_impl_->SetQuicServerInfoMap(quic_server_info_map); // Update the prefs with what we have read (delete all corrupted prefs). if (detected_corrupted_prefs) @@ -1129,4 +1140,9 @@ ScheduleUpdateCacheOnPrefThread(); } +void HttpServerPropertiesManager::SetInitialized() { + DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); + is_initialized_ = true; +} + } // namespace net
diff --git a/net/http/http_server_properties_manager.h b/net/http/http_server_properties_manager.h index e20ef59d..e860fb53 100644 --- a/net/http/http_server_properties_manager.h +++ b/net/http/http_server_properties_manager.h
@@ -160,6 +160,7 @@ size_t max_server_configs_stored_in_properties() const override; void SetMaxServerConfigsStoredInProperties( size_t max_server_configs_stored_in_properties) override; + bool IsInitialized() const override; protected: // The location where ScheduleUpdatePrefsOnNetworkThread was called. @@ -283,6 +284,7 @@ void SaveQuicServerInfoMapToServerPrefs( QuicServerInfoMap* quic_server_info_map, base::DictionaryValue* http_server_properties_dict); + void SetInitialized(); // ----------- // Pref thread @@ -302,6 +304,9 @@ // Network thread // -------------- + // Whether InitializeOnNetworkThread() has completed. + bool is_initialized_; + const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; // Used to post |prefs::kHttpServerProperties| pref update tasks.
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 262f73f88..e9a6c1046 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc
@@ -177,9 +177,16 @@ new StrictMock<TestingHttpServerPropertiesManager>( pref_delegate_, pref_test_task_runner_, net_test_task_runner_)); + EXPECT_FALSE(http_server_props_manager_->IsInitialized()); ExpectCacheUpdate(); EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); pref_test_task_runner_->FastForwardUntilNoTasksRemain(); + // InitializeOnNetworkThread() is called from the test thread, so + // PostTaskAndReply() will post back to the test thread. + // TODO(xunjieli): Fix this in a follow-up so we can use + // |net_test_task_runner_|->RunUntilIdle(). + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(http_server_props_manager_->IsInitialized()); EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); EXPECT_FALSE(pref_test_task_runner_->HasPendingTask()); } @@ -191,8 +198,10 @@ pref_delegate_, base::ThreadTaskRunnerHandle::Get(), net_test_task_runner_)); + EXPECT_FALSE(net_test_task_runner_->HasPendingTask()); ExpectCacheUpdate(); base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(http_server_props_manager_->IsInitialized()); } void TearDown() override {
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index 38497c1..2aa4d31 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/feature_list.h" #include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" @@ -61,6 +62,10 @@ namespace { +// Experiment to preconnect only one connection if HttpServerProperties is +// not supported or initialized. +const base::Feature kLimitEarlyPreconnectsExperiment{ + "LimitEarlyPreconnects", base::FEATURE_DISABLED_BY_DEFAULT}; void DoNothingAsyncCallback(int result) {} void RecordChannelIDKeyMatch(SSLClientSocket* ssl_socket, ChannelIDService* channel_id_service, @@ -278,8 +283,16 @@ DCHECK_GT(num_streams, 0); HttpServerProperties* http_server_properties = session_->http_server_properties(); - // Preconnect one connection if the server supports H2 or QUIC. - if (http_server_properties && + DCHECK(http_server_properties); + // Preconnect one connection if either of the following is true: + // (1) kLimitEarlyPreconnectsStreamExperiment is turned on, + // HttpServerProperties is not initialized, and url scheme is cryptographic. + // (2) The server supports H2 or QUIC. + bool connect_one_stream = + base::FeatureList::IsEnabled(kLimitEarlyPreconnectsExperiment) && + !http_server_properties->IsInitialized() && + request_info_.url.SchemeIsCryptographic(); + if (connect_one_stream || http_server_properties->SupportsRequestPriority( url::SchemeHostPort(request_info_.url))) { num_streams_ = 1;
diff --git a/net/http/http_stream_factory_impl_job_controller_unittest.cc b/net/http/http_stream_factory_impl_job_controller_unittest.cc index 39024b99..577363bb 100644 --- a/net/http/http_stream_factory_impl_job_controller_unittest.cc +++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -5,10 +5,12 @@ #include "net/http/http_stream_factory_impl_job_controller.h" #include <memory> +#include <vector> #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/histogram_tester.h" +#include "base/test/scoped_feature_list.h" #include "base/threading/platform_thread.h" #include "net/base/test_proxy_delegate.h" #include "net/dns/mock_host_resolver.h" @@ -21,6 +23,7 @@ #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_service.h" #include "net/quic/test_tools/quic_stream_factory_peer.h" +#include "net/socket/socket_test_util.h" #include "net/spdy/spdy_test_util_common.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock_mutant.h" @@ -82,6 +85,15 @@ return ERR_IO_PENDING; } }; + +// A mock HttpServerProperties that always returns false for IsInitialized(). +class MockHttpServerProperties : public HttpServerPropertiesImpl { + public: + MockHttpServerProperties() {} + ~MockHttpServerProperties() override {} + bool IsInitialized() const override { return false; } +}; + } // anonymous namespace class HttpStreamFactoryImplJobPeer { @@ -114,9 +126,7 @@ } }; -class HttpStreamFactoryImplJobControllerTest - : public ::testing::Test, - public ::testing::WithParamInterface<NextProto> { +class HttpStreamFactoryImplJobControllerTest : public ::testing::Test { public: HttpStreamFactoryImplJobControllerTest() : session_deps_(ProxyService::CreateDirect()) { @@ -153,7 +163,7 @@ return test_proxy_delegate_; } - ~HttpStreamFactoryImplJobControllerTest() {} + ~HttpStreamFactoryImplJobControllerTest() override {} void SetAlternativeService(const HttpRequestInfo& request_info, AlternativeService alternative_service) { @@ -1153,4 +1163,75 @@ EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); } +class HttpStreamFactoryImplJobControllerPreconnectTest + : public HttpStreamFactoryImplJobControllerTest, + public ::testing::WithParamInterface<bool> { + protected: + void SetUp() override { + if (GetParam()) { + scoped_feature_list_.InitFromCommandLine("LimitEarlyPreconnects", + std::string()); + } + } + + void Initialize() { + session_deps_.http_server_properties = + base::MakeUnique<MockHttpServerProperties>(); + session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); + factory_ = + static_cast<HttpStreamFactoryImpl*>(session_->http_stream_factory()); + request_info_.method = "GET"; + request_info_.url = GURL("https://www.example.com"); + job_controller_ = new HttpStreamFactoryImpl::JobController( + factory_, &request_delegate_, session_.get(), &job_factory_, + request_info_, true); + HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller_); + } + + protected: + void Preconnect(int num_streams) { + job_controller_->Preconnect(num_streams, request_info_, SSLConfig(), + SSLConfig()); + // Only one job is started. + EXPECT_TRUE(job_controller_->main_job()); + EXPECT_FALSE(job_controller_->alternative_job()); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; + HttpRequestInfo request_info_; +}; + +INSTANTIATE_TEST_CASE_P( + /* no prefix */, + HttpStreamFactoryImplJobControllerPreconnectTest, + ::testing::Bool()); + +TEST_P(HttpStreamFactoryImplJobControllerPreconnectTest, + LimitEarlyPreconnects) { + std::vector<std::unique_ptr<SequencedSocketData>> providers; + std::vector<std::unique_ptr<SSLSocketDataProvider>> ssl_providers; + const int kNumPreconects = 5; + MockRead reads[] = {MockRead(ASYNC, OK)}; + // If experiment is not enabled, there are 5 socket connects. + const size_t actual_num_connects = GetParam() ? 1 : kNumPreconects; + for (size_t i = 0; i < actual_num_connects; ++i) { + auto data = base::MakeUnique<SequencedSocketData>(reads, arraysize(reads), + nullptr, 0); + auto ssl_data = base::MakeUnique<SSLSocketDataProvider>(ASYNC, OK); + session_deps_.socket_factory->AddSocketDataProvider(data.get()); + session_deps_.socket_factory->AddSSLSocketDataProvider(ssl_data.get()); + providers.push_back(std::move(data)); + ssl_providers.push_back(std::move(ssl_data)); + } + Initialize(); + Preconnect(kNumPreconects); + // If experiment is enabled, only 1 stream is requested. + EXPECT_EQ( + (int)actual_num_connects, + HttpStreamFactoryImplJobPeer::GetNumStreams(job_controller_->main_job())); + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); +} + } // namespace net
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index 205a45e..ed095bc 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc
@@ -572,8 +572,8 @@ return http_cache_.CreateTransaction(DEFAULT_PRIORITY, trans); } -void MockHttpCache::BypassCacheLock() { - http_cache_.BypassLockForTest(); +void MockHttpCache::SimulateCacheLockTimeout() { + http_cache_.SimulateCacheLockTimeout(); } void MockHttpCache::FailConditionalizations() {
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h index c920387..d1c5ee1 100644 --- a/net/http/mock_http_cache.h +++ b/net/http/mock_http_cache.h
@@ -199,8 +199,8 @@ // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...) int CreateTransaction(std::unique_ptr<HttpTransaction>* trans); - // Wrapper to bypass the cache lock for new transactions. - void BypassCacheLock(); + // Wrapper to simulate cache lock timeout for new transactions. + void SimulateCacheLockTimeout(); // Wrapper to fail request conditionalization for new transactions. void FailConditionalizations();
diff --git a/net/http2/decoder/http2_frame_decoder_test.cc b/net/http2/decoder/http2_frame_decoder_test.cc index cb7017d..a2380d9 100644 --- a/net/http2/decoder/http2_frame_decoder_test.cc +++ b/net/http2/decoder/http2_frame_decoder_test.cc
@@ -14,6 +14,7 @@ #include "net/http2/decoder/frame_parts.h" #include "net/http2/decoder/frame_parts_collector_listener.h" #include "net/http2/http2_constants.h" +#include "net/http2/platform/api/http2_reconstruct_object.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_random.h" #include "net/http2/tools/random_decoder_test.h" @@ -36,7 +37,6 @@ namespace { class Http2FrameDecoderTest : public RandomDecoderTest { - protected: void SetUp() override { // On any one run of this suite, we'll always choose the same value for @@ -101,12 +101,10 @@ // Alternate which constructor is used. if (use_default_reconstruct_) { - decoder_.~Http2FrameDecoder(); - new (&decoder_) Http2FrameDecoder; + Http2DefaultReconstructObject(&decoder_, RandomPtr()); decoder_.set_listener(&collector_); } else { - decoder_.~Http2FrameDecoder(); - new (&decoder_) Http2FrameDecoder(&collector_); + Http2ReconstructObject(&decoder_, RandomPtr(), &collector_); } decoder_.set_maximum_payload_size(maximum_payload_size);
diff --git a/net/http2/decoder/http2_structure_decoder_test.cc b/net/http2/decoder/http2_structure_decoder_test.cc index 22d50d7..06008b8 100644 --- a/net/http2/decoder/http2_structure_decoder_test.cc +++ b/net/http2/decoder/http2_structure_decoder_test.cc
@@ -27,6 +27,7 @@ #include "net/http2/decoder/decode_status.h" #include "net/http2/http2_constants.h" #include "net/http2/http2_structures_test_util.h" +#include "net/http2/platform/api/http2_reconstruct_object.h" #include "net/http2/tools/failure.h" #include "net/http2/tools/http2_frame_builder.h" #include "net/http2/tools/random_decoder_test.h" @@ -58,8 +59,7 @@ // Overwrite the current contents of |structure_|, in to which we'll // decode the buffer, so that we can be confident that we really decoded // the structure every time. - structure_.~S(); - new (&structure_) S; + Http2DefaultReconstructObject(&structure_, RandomPtr()); uint32_t old_remaining = b->Remaining(); if (structure_decoder_.Start(&structure_, b)) { EXPECT_EQ(old_remaining - S::EncodedSize(), b->Remaining());
diff --git a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc index d96d481b..4fd4aba 100644 --- a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc +++ b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc
@@ -39,8 +39,7 @@ // Reconstruct the FrameDecoderState, prepare the listener, and add it to // the FrameDecoderState. - frame_decoder_state_.~FrameDecoderState(); - new (&frame_decoder_state_) FrameDecoderState; + Http2DefaultReconstructObject(&frame_decoder_state_, RandomPtr()); frame_decoder_state_.set_listener(PrepareListener()); // Make sure that a listener was provided.
diff --git a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index 8eb244b60..ee2dc60 100644 --- a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -21,6 +21,7 @@ #include "net/http2/http2_constants.h" #include "net/http2/http2_constants_test_util.h" #include "net/http2/http2_structures.h" +#include "net/http2/platform/api/http2_reconstruct_object.h" #include "net/http2/tools/http2_frame_builder.h" #include "net/http2/tools/random_decoder_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -120,7 +121,6 @@ class Listener, bool SupportedFrameType = true> class AbstractPayloadDecoderTest : public PayloadDecoderBaseTest { - protected: // An ApproveSize function returns true to approve decoding the specified // size of payload, else false to skip that size. Typically used for negative @@ -161,8 +161,7 @@ } void PreparePayloadDecoder() override { - payload_decoder_.~Decoder(); - new (&payload_decoder_) Decoder; + Http2DefaultReconstructObject(&payload_decoder_, RandomPtr()); } Http2FrameDecoderListener* PrepareListener() override {
diff --git a/net/http2/platform/api/http2_reconstruct_object.h b/net/http2/platform/api/http2_reconstruct_object.h new file mode 100644 index 0000000..77b520f --- /dev/null +++ b/net/http2/platform/api/http2_reconstruct_object.h
@@ -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. + +#ifndef NET_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_ +#define NET_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_ + +#include <utility> + +#include "net/http2/platform/impl/http2_reconstruct_object_impl.h" + +namespace net { +namespace test { + +class RandomBase; + +// Reconstruct an object so that it is initialized as when it was first +// constructed. Runs the destructor to handle objects that might own resources, +// and runs the constructor with the provided arguments, if any. +template <class T, class... Args> +void Http2ReconstructObject(T* ptr, RandomBase* rng, Args&&... args) { + Http2ReconstructObjectImpl(ptr, rng, std::forward<Args>(args)...); +} + +// This version applies default-initialization to the object. +template <class T> +void Http2DefaultReconstructObject(T* ptr, RandomBase* rng) { + Http2DefaultReconstructObjectImpl(ptr, rng); +} + +} // namespace test +} // namespace net + +#endif // NET_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_
diff --git a/net/http2/platform/impl/http2_reconstruct_object_impl.h b/net/http2/platform/impl/http2_reconstruct_object_impl.h new file mode 100644 index 0000000..b08d5f1d --- /dev/null +++ b/net/http2/platform/impl/http2_reconstruct_object_impl.h
@@ -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. + +#ifndef NET_HTTP2_PLATFORM_IMPL_HTTP2_RECONSTRUCT_OBJECT_IMPL_H_ +#define NET_HTTP2_PLATFORM_IMPL_HTTP2_RECONSTRUCT_OBJECT_IMPL_H_ + +#include <utility> + +namespace net { +namespace test { + +class RandomBase; + +// Reconstruct an object so that it is initialized as when it was first +// constructed. Runs the destructor to handle objects that might own resources, +// and runs the constructor with the provided arguments, if any. +template <class T, class... Args> +void Http2ReconstructObjectImpl(T* ptr, RandomBase* rng, Args&&... args) { + ptr->~T(); + ::new (ptr) T(std::forward<Args>(args)...); +} + +// This version applies default-initialization to the object. +template <class T> +void Http2DefaultReconstructObjectImpl(T* ptr, RandomBase* rng) { + ptr->~T(); + ::new (ptr) T; +} + +} // namespace test +} // namespace net + +#endif // NET_HTTP2_PLATFORM_IMPL_HTTP2_RECONSTRUCT_OBJECT_IMPL_H_
diff --git a/net/spdy/hpack/hpack_entry.cc b/net/spdy/hpack/hpack_entry.cc index 9a47079..0581aaa 100644 --- a/net/spdy/hpack/hpack_entry.cc +++ b/net/spdy/hpack/hpack_entry.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" +#include "net/spdy/platform/api/spdy_estimate_memory_usage.h" namespace net { @@ -76,4 +77,8 @@ " }"; } +size_t HpackEntry::EstimateMemoryUsage() const { + return SpdyEstimateMemoryUsage(name_) + SpdyEstimateMemoryUsage(value_); +} + } // namespace net
diff --git a/net/spdy/hpack/hpack_entry.h b/net/spdy/hpack/hpack_entry.h index 12d3f068..bb637d2 100644 --- a/net/spdy/hpack/hpack_entry.h +++ b/net/spdy/hpack/hpack_entry.h
@@ -76,6 +76,9 @@ int64_t time_added() const { return time_added_; } void set_time_added(int64_t now) { time_added_ = now; } + // Returns the estimate of dynamically allocated memory in bytes. + size_t EstimateMemoryUsage() const; + private: enum EntryType { LOOKUP,
diff --git a/net/spdy/hpack/hpack_header_table.cc b/net/spdy/hpack/hpack_header_table.cc index b005559..d6fc7d2 100644 --- a/net/spdy/hpack/hpack_header_table.cc +++ b/net/spdy/hpack/hpack_header_table.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "net/spdy/hpack/hpack_constants.h" #include "net/spdy/hpack/hpack_static_table.h" +#include "net/spdy/platform/api/spdy_estimate_memory_usage.h" #include "net/spdy/spdy_flags.h" namespace net { @@ -274,4 +275,10 @@ } } +size_t HpackHeaderTable::EstimateMemoryUsage() const { + return SpdyEstimateMemoryUsage(dynamic_entries_) + + SpdyEstimateMemoryUsage(dynamic_index_) + + SpdyEstimateMemoryUsage(dynamic_name_index_); +} + } // namespace net
diff --git a/net/spdy/hpack/hpack_header_table.h b/net/spdy/hpack/hpack_header_table.h index ca0318a..a3b5744f 100644 --- a/net/spdy/hpack/hpack_header_table.h +++ b/net/spdy/hpack/hpack_header_table.h
@@ -125,6 +125,9 @@ debug_visitor_ = std::move(visitor); } + // Returns the estimate of dynamically allocated memory in bytes. + size_t EstimateMemoryUsage() const; + private: // Returns number of evictions required to enter |name| & |value|. size_t EvictionCountForEntry(base::StringPiece name,
diff --git a/net/spdy/platform/api/spdy_estimate_memory_usage.h b/net/spdy/platform/api/spdy_estimate_memory_usage.h new file mode 100644 index 0000000..8ae674a --- /dev/null +++ b/net/spdy/platform/api/spdy_estimate_memory_usage.h
@@ -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. + +#ifndef NET_SPDY_PLATFORM_API_SPDY_ESTIMATE_MEMORY_USAGE_H_ +#define NET_SPDY_PLATFORM_API_SPDY_ESTIMATE_MEMORY_USAGE_H_ + +#include <cstddef> + +#include "net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h" + +namespace net { + +template <class T> +size_t SpdyEstimateMemoryUsage(const T& object) { + return SpdyEstimateMemoryUsageImpl(object); +} + +} // namespace net + +#endif // NET_SPDY_PLATFORM_API_SPDY_ESTIMATE_MEMORY_USAGE_H_
diff --git a/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h b/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h new file mode 100644 index 0000000..8e5491a --- /dev/null +++ b/net/spdy/platform/impl/spdy_estimate_memory_usage_impl.h
@@ -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. + +#ifndef NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_ +#define NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_ + +#include <cstddef> + +#include "base/trace_event/memory_usage_estimator.h" + +namespace net { + +template <class T> +size_t SpdyEstimateMemoryUsageImpl(const T& object) { + return base::trace_event::EstimateMemoryUsage(object); +} + +} // namespace net + +#endif // NET_SPDY_PLATFORM_IMPL_SPDY_ESTIMATE_MEMORY_USAGE_IMPL_H_
diff --git a/remoting/client/ios/DEPS b/remoting/client/ios/DEPS index f63b2d2..aabd012 100644 --- a/remoting/client/ios/DEPS +++ b/remoting/client/ios/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+media/base", "+google/protobuf", + "+ios/third_party/material_components_ios/src", "+remoting/codec", "+remoting/client/ios", "+remoting/client/ios/bridge",
diff --git a/remoting/client/ios/app/host_collection_view_cell.h b/remoting/client/ios/app/host_collection_view_cell.h new file mode 100644 index 0000000..470c042f --- /dev/null +++ b/remoting/client/ios/app/host_collection_view_cell.h
@@ -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. + +#ifndef REMOTING_CLIENT_IOS_APP_HOST_COLLECTION_VIEW_CELL_H_ +#define REMOTING_CLIENT_IOS_APP_HOST_COLLECTION_VIEW_CELL_H_ + +#import <UIKit/UIKit.h> + +#import "ios/third_party/material_components_ios/src/components/Collections/src/MaterialCollections.h" + +@interface HostCollectionViewCell : MDCCollectionViewCell + +@property(nonatomic, copy) NSString* title; +@property(nonatomic, copy) NSString* status; + +- (void)populateContentWithTitle:(NSString*)title status:(NSString*)status; + +@end + +#endif // REMOTING_CLIENT_IOS_APP_HOST_COLLECTION_VIEW_CELL_H_
diff --git a/remoting/client/ios/app/host_collection_view_cell.mm b/remoting/client/ios/app/host_collection_view_cell.mm new file mode 100644 index 0000000..88e0cfe9 --- /dev/null +++ b/remoting/client/ios/app/host_collection_view_cell.mm
@@ -0,0 +1,128 @@ +// 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. + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +#import <UIKit/UIKit.h> + +#import "remoting/client/ios/app/host_collection_view_cell.h" + +#import "ios/third_party/material_components_ios/src/components/ShadowElevations/src/MaterialShadowElevations.h" +#import "ios/third_party/material_components_ios/src/components/ShadowLayer/src/MaterialShadowLayer.h" +#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" + +static CGFloat kLinePadding = 2.f; +static const CGFloat kHostCardIconInset = 10.f; +static const CGFloat kHostCardPadding = 4.f; +static const CGFloat kHostCardIconSize = 45.f; + +@interface HostCollectionViewCell () + +@property(nonatomic) UIImageView* imageView; +@property(nonatomic) UILabel* titleLabel; +@property(nonatomic) UILabel* statusLabel; +@property(nonatomic) UIView* cellView; + +@end + +// +// This is the implementation of the info card for a host's status shown in +// the host list. This will also be the selection for which host to connect +// to and other managements actions for a host in this list. +// +@implementation HostCollectionViewCell + +@synthesize title = _title; +@synthesize status = _status; +@synthesize imageView = _imageView; +@synthesize titleLabel = _titleLabel; +@synthesize statusLabel = _statusLabel; +@synthesize cellView = _cellView; + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + [self commonInit]; + } + return self; +} + +- (void)commonInit { + _cellView = [[UIView alloc] initWithFrame:self.bounds]; + _cellView.autoresizingMask = + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _cellView.backgroundColor = [UIColor whiteColor]; + _cellView.clipsToBounds = YES; + [self addSubview:_cellView]; + + MDCShadowLayer* shadowLayer = (MDCShadowLayer*)self.layer; + shadowLayer.shadowMaskEnabled = NO; + [shadowLayer setElevation:MDCShadowElevationCardResting]; + + CGRect imageViewFrame = + CGRectMake(kHostCardIconInset, + self.frame.size.height / 2.f - kHostCardIconSize / 2.f, + kHostCardIconSize, kHostCardIconSize); + _imageView = [[UIImageView alloc] initWithFrame:imageViewFrame]; + _imageView.contentMode = UIViewContentModeCenter; + _imageView.alpha = 0.87f; + _imageView.backgroundColor = UIColor.lightGrayColor; + _imageView.layer.cornerRadius = kHostCardIconSize / 2.f; + _imageView.layer.masksToBounds = YES; + [_cellView addSubview:_imageView]; + + _titleLabel = [[UILabel alloc] init]; + _titleLabel.font = [MDCTypography titleFont]; + _titleLabel.alpha = [MDCTypography titleFontOpacity]; + _titleLabel.textColor = [UIColor colorWithWhite:0 alpha:0.87f]; + _titleLabel.frame = CGRectMake( + imageViewFrame.origin.x + imageViewFrame.size.width + kHostCardIconInset, + (self.frame.size.height / 2.f) - + (_titleLabel.font.pointSize + kHostCardPadding / 2.f), + self.frame.size.width, _titleLabel.font.pointSize + kLinePadding); + [_cellView addSubview:_titleLabel]; + + _statusLabel = [[UILabel alloc] init]; + _statusLabel.font = [MDCTypography captionFont]; + _statusLabel.alpha = [MDCTypography captionFontOpacity]; + _statusLabel.textColor = [UIColor colorWithWhite:0 alpha:0.60f]; + _statusLabel.frame = CGRectMake( + imageViewFrame.origin.x + imageViewFrame.size.width + kHostCardIconInset, + (self.frame.size.height / 2.f) + kHostCardPadding / 2.f, + self.frame.size.width, _statusLabel.font.pointSize + kLinePadding); + [_cellView addSubview:_statusLabel]; +} + +- (void)populateContentWithTitle:(NSString*)title status:(NSString*)status { + self.title = title; + self.titleLabel.text = title; + + self.status = status; + self.statusLabel.text = status; + + self.imageView.image = [UIImage imageNamed:@"ic_desktop"]; + + // TODO(nicholss): These colors are incorrect for the final product. + // Need to update to the values in the mocks. + if ([status isEqualToString:@"ONLINE"]) { + _imageView.backgroundColor = UIColor.greenColor; + } else { + _imageView.backgroundColor = UIColor.lightGrayColor; + } +} + +- (void)prepareForReuse { + [super prepareForReuse]; + self.title = nil; + self.status = nil; +} + ++ (Class)layerClass { + return [MDCShadowLayer class]; +} + +@end
diff --git a/remoting/client/ios/app/host_collection_view_controller.h b/remoting/client/ios/app/host_collection_view_controller.h new file mode 100644 index 0000000..d9969c5 --- /dev/null +++ b/remoting/client/ios/app/host_collection_view_controller.h
@@ -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. + +#ifndef REMOTING_CLIENT_IOS_APP_HOST_COLLECTION_VIEW_CONTOLLER_H_ +#define REMOTING_CLIENT_IOS_APP_HOST_COLLECTION_VIEW_CONTOLLER_H_ + +#import <UIKit/UIKit.h> + +#import "ios/third_party/material_components_ios/src/components/Collections/src/MaterialCollections.h" +#import "ios/third_party/material_components_ios/src/components/FlexibleHeader/src/MaterialFlexibleHeader.h" +#import "remoting/client/ios/app/host_collection_view_cell.h" +#include "remoting/client/ios/domain/host.h" + +@protocol HostCollectionViewControllerDelegate<NSObject> + +@optional + +- (void)didSelectCell:(HostCollectionViewCell*)cell + completion:(void (^)())completionBlock; + +- (Host*)getHostAtIndexPath:(NSIndexPath*)path; +- (NSInteger)getHostCount; + +@end + +@interface HostCollectionViewController : MDCCollectionViewController + +@property(weak, nonatomic) id<HostCollectionViewControllerDelegate> delegate; +@property(nonatomic) CGFloat scrollOffsetY; +@property(nonatomic) + MDCFlexibleHeaderContainerViewController* flexHeaderContainerVC; + +@end + +#endif // REMOTING_CLIENT_IOS_APP_HOST_LIST_VIEW_CONTOLLER_H_
diff --git a/remoting/client/ios/app/host_collection_view_controller.mm b/remoting/client/ios/app/host_collection_view_controller.mm new file mode 100644 index 0000000..47a6fae1 --- /dev/null +++ b/remoting/client/ios/app/host_collection_view_controller.mm
@@ -0,0 +1,151 @@ +// 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. + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +#import "remoting/client/ios/app/host_collection_view_controller.h" + +#import "MaterialInk.h" +#import "MaterialShadowElevations.h" +#import "MaterialShadowLayer.h" +#import "remoting/client/ios/app/host_collection_view_cell.h" + +static NSString* const kReusableIdentifierItem = @"itemCellIdentifier"; + +static CGFloat kHostCollectionViewControllerCellHeight = 70.f; +static CGFloat kHostCollectionViewControllerDefaultHeaderHeight = 100.f; +static CGFloat kHostCollectionViewControllerSmallHeaderHeight = 60.f; +static UIColor* kBackgroundColor = + [UIColor colorWithRed:0.f green:0.67f blue:0.55f alpha:1.f]; + +@interface HostCollectionViewController () + +@property(nonatomic) MDCInkTouchController* inkTouchController; + +@end + +@implementation HostCollectionViewController + +@synthesize delegate = _delegate; +@synthesize scrollOffsetY = _scrollOffsetY; +@synthesize flexHeaderContainerVC = _flexHeaderContainerVC; +@synthesize inkTouchController = _inkTouchController; + +- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout*)layout { + self = [super initWithCollectionViewLayout:layout]; + if (self) { + self.collectionView.backgroundColor = [UIColor whiteColor]; + [self.collectionView registerClass:[HostCollectionViewCell class] + forCellWithReuseIdentifier:NSStringFromClass( + [HostCollectionViewCell class])]; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Customize collection view settings. + self.styler.cellStyle = MDCCollectionViewCellStyleCard; + self.styler.cellLayoutType = MDCCollectionViewCellLayoutTypeGrid; + self.styler.gridPadding = 0; + self.styler.gridColumnCount = 1; +} + +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator: + (id<UIViewControllerTransitionCoordinator>)coordinator { + [self.collectionView.collectionViewLayout invalidateLayout]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.collectionView.collectionViewLayout invalidateLayout]; +} + +#pragma mark - <UICollectionViewDataSource> + +- (NSInteger)collectionView:(UICollectionView*)collectionView + numberOfItemsInSection:(NSInteger)section { + return [self.delegate getHostCount]; +} + +- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView + cellForItemAtIndexPath:(NSIndexPath*)indexPath { + HostCollectionViewCell* cell = + [collectionView dequeueReusableCellWithReuseIdentifier: + NSStringFromClass([HostCollectionViewCell class]) + forIndexPath:indexPath]; + Host* host = [self.delegate getHostAtIndexPath:indexPath]; + [cell populateContentWithTitle:host.hostName status:host.status]; + return cell; +} + +#pragma mark - <UICollectionViewDelegate> + +- (void)collectionView:(UICollectionView*)collectionView + didSelectItemAtIndexPath:(NSIndexPath*)indexPath { + [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; + HostCollectionViewCell* cell = + (HostCollectionViewCell*)[collectionView + cellForItemAtIndexPath:indexPath]; + [self.delegate didSelectCell:cell + completion:^{}]; +} + +#pragma mark - <MDCCollectionViewStylingDelegate> + +- (CGFloat)collectionView:(UICollectionView*)collectionView + cellHeightAtIndexPath:(NSIndexPath*)indexPath { + return kHostCollectionViewControllerCellHeight; +} + +#pragma mark - <UIScrollViewDelegate> + +- (void)scrollViewDidScroll:(UIScrollView*)scrollView { + self.scrollOffsetY = scrollView.contentOffset.y; + [self.flexHeaderContainerVC.headerViewController + scrollViewDidScroll:scrollView]; +} + +#pragma mark - Private methods + +- (UIView*)hostsHeaderView { + CGRect headerFrame = + _flexHeaderContainerVC.headerViewController.headerView.bounds; + UIView* hostsHeaderView = [[UIView alloc] initWithFrame:headerFrame]; + hostsHeaderView.backgroundColor = kBackgroundColor; + hostsHeaderView.layer.masksToBounds = YES; + hostsHeaderView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + + _inkTouchController = + [[MDCInkTouchController alloc] initWithView:hostsHeaderView]; + [_inkTouchController addInkView]; + + return hostsHeaderView; +} + +- (void)setFlexHeaderContainerVC: + (MDCFlexibleHeaderContainerViewController*)flexHeaderContainerVC { + _flexHeaderContainerVC = flexHeaderContainerVC; + MDCFlexibleHeaderView* headerView = + _flexHeaderContainerVC.headerViewController.headerView; + headerView.trackingScrollView = self.collectionView; + headerView.maximumHeight = kHostCollectionViewControllerDefaultHeaderHeight; + headerView.minimumHeight = kHostCollectionViewControllerSmallHeaderHeight; + [headerView addSubview:[self hostsHeaderView]]; + + // Use a custom shadow under the flexible header. + MDCShadowLayer* shadowLayer = [MDCShadowLayer layer]; + [headerView setShadowLayer:shadowLayer + intensityDidChangeBlock:^(CALayer* layer, CGFloat intensity) { + CGFloat elevation = MDCShadowElevationAppBar * intensity; + [(MDCShadowLayer*)layer setElevation:elevation]; + }]; +} + +@end
diff --git a/services/memory_instrumentation/public/cpp/BUILD.gn b/services/memory_instrumentation/public/cpp/BUILD.gn index 99a22d62..5c09bf0 100644 --- a/services/memory_instrumentation/public/cpp/BUILD.gn +++ b/services/memory_instrumentation/public/cpp/BUILD.gn
@@ -5,6 +5,8 @@ source_set("cpp") { sources = [ "coordinator.h", + "memory_dump_manager_delegate_impl.cc", + "memory_dump_manager_delegate_impl.h", ] deps = [ @@ -12,7 +14,10 @@ ] public_deps = [ + "//base", + "//mojo/public/cpp/bindings", "//services/memory_instrumentation/public/interfaces", + "//services/service_manager/public/cpp", ] }
diff --git a/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.cc b/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.cc new file mode 100644 index 0000000..70e511a --- /dev/null +++ b/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.cc
@@ -0,0 +1,48 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.h" + +#include "base/trace_event/memory_dump_request_args.h" +#include "mojo/public/cpp/bindings/interface_request.h" +#include "services/memory_instrumentation/public/cpp/coordinator.h" +#include "services/memory_instrumentation/public/interfaces/memory_instrumentation.mojom.h" +#include "services/service_manager/public/cpp/interface_provider.h" + +namespace memory_instrumentation { + +MemoryDumpManagerDelegateImpl::MemoryDumpManagerDelegateImpl( + service_manager::InterfaceProvider* interface_provider) + : is_coordinator_(false), binding_(this) { + interface_provider->GetInterface(mojo::MakeRequest(&coordinator_)); + coordinator_->RegisterProcessLocalDumpManager( + binding_.CreateInterfacePtrAndBind()); +} + +MemoryDumpManagerDelegateImpl::MemoryDumpManagerDelegateImpl( + Coordinator* coordinator) : is_coordinator_(true), binding_(this) { + coordinator->BindCoordinatorRequest(mojo::MakeRequest(&coordinator_)); + coordinator_->RegisterProcessLocalDumpManager( + binding_.CreateInterfacePtrAndBind()); +} + +MemoryDumpManagerDelegateImpl::~MemoryDumpManagerDelegateImpl() {} + +bool MemoryDumpManagerDelegateImpl::IsCoordinator() const { + return is_coordinator_; +} + +void MemoryDumpManagerDelegateImpl::RequestProcessMemoryDump( + const base::trace_event::MemoryDumpRequestArgs& args, + const RequestProcessMemoryDumpCallback& callback) { + MemoryDumpManagerDelegate::CreateProcessDump(args, callback); +} + +void MemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump( + const base::trace_event::MemoryDumpRequestArgs& args, + const base::trace_event::MemoryDumpCallback& callback) { + coordinator_->RequestGlobalMemoryDump(args, callback); +} + +} // namespace memory_instrumentation
diff --git a/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.h b/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.h new file mode 100644 index 0000000..952f0b1c --- /dev/null +++ b/services/memory_instrumentation/public/cpp/memory_dump_manager_delegate_impl.h
@@ -0,0 +1,51 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ +#define SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ + +#include "base/trace_event/memory_dump_manager.h" +#include "base/trace_event/memory_dump_request_args.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "services/memory_instrumentation/public/cpp/coordinator.h" +#include "services/memory_instrumentation/public/interfaces/memory_instrumentation.mojom.h" +#include "services/service_manager/public/cpp/interface_provider.h" + +namespace memory_instrumentation { + +class MemoryDumpManagerDelegateImpl + : public base::trace_event::MemoryDumpManagerDelegate, + public mojom::ProcessLocalDumpManager { + public: + // Use to bind to a remote coordinator. + MemoryDumpManagerDelegateImpl( + service_manager::InterfaceProvider* interface_provider); + + // Use to bind to a coordinator in the same process. + MemoryDumpManagerDelegateImpl(Coordinator* coordinator); + ~MemoryDumpManagerDelegateImpl() override; + + bool IsCoordinator() const; + + // The base::trace_event::MemoryDumpManager calls this. + void RequestGlobalMemoryDump( + const base::trace_event::MemoryDumpRequestArgs& args, + const base::trace_event::MemoryDumpCallback& callback) override; + + private: + // The ProcessLocalDumpManager interface. The coordinator calls this. + void RequestProcessMemoryDump( + const base::trace_event::MemoryDumpRequestArgs& args, + const RequestProcessMemoryDumpCallback& callback) override; + + bool is_coordinator_; + mojom::CoordinatorPtr coordinator_; + mojo::Binding<mojom::ProcessLocalDumpManager> binding_; + + DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegateImpl); +}; + +} // namespace memory_instrumentation + +#endif // SERVICES_MEMORY_INFRA_PUBLIC_CPP_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
diff --git a/services/ui/demo/mus_demo.cc b/services/ui/demo/mus_demo.cc index 0fbcd356..f80c64f 100644 --- a/services/ui/demo/mus_demo.cc +++ b/services/ui/demo/mus_demo.cc
@@ -67,6 +67,38 @@ } // namespace +class MusDemo::WindowTreeData { + public: + explicit WindowTreeData( + std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); + ~WindowTreeData(); + + private: + // Draws one frame, incrementing the rotation angle. + void DrawFrame(); + + // The Window tree host corresponding to this data. + std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; + + // Root window of the window tree host. + aura::Window* root_window_ = nullptr; + + // Window to which we draw the bitmap. + std::unique_ptr<aura::Window> bitmap_window_; + + // Destroys itself when the window gets destroyed. + aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; + + // Timer for calling DrawFrame(). + base::RepeatingTimer timer_; + + // Current rotation angle for drawing. + double angle_ = 0.0; + + // Last time a frame was drawn. + base::TimeTicks last_draw_frame_time_; +}; + MusDemo::MusDemo() {} MusDemo::~MusDemo() { @@ -110,9 +142,8 @@ } void MusDemo::OnLostConnection(aura::WindowTreeClient* client) { - root_window_ = nullptr; window_tree_client_.reset(); - timer_.Stop(); + window_tree_data_.reset(); } void MusDemo::OnPointerEventObserved(const PointerEvent& event, @@ -157,8 +188,13 @@ void MusDemo::OnWmNewDisplay( std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, const display::Display& display) { - DCHECK(!root_window_); // Only support one display. + DCHECK(!window_tree_data_); // Only support one display. + window_tree_data_ = + base::MakeUnique<WindowTreeData>(std::move(window_tree_host)); +} +MusDemo::WindowTreeData::WindowTreeData( + std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { window_tree_host->InitHost(); window_tree_host->Show(); root_window_ = window_tree_host->window(); @@ -178,10 +214,14 @@ // Draw initial frame and start the timer to regularly draw frames. DrawFrame(); timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), - base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); + base::Bind(&WindowTreeData::DrawFrame, base::Unretained(this))); } void MusDemo::OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) { + window_tree_data_.reset(); +} + +MusDemo::WindowTreeData::~WindowTreeData() { timer_.Stop(); root_window_->RemoveChild(bitmap_window_.get()); bitmap_window_.reset(); @@ -211,7 +251,7 @@ void MusDemo::OnWmDeactivateWindow(aura::Window* window) {} -void MusDemo::DrawFrame() { +void MusDemo::WindowTreeData::DrawFrame() { base::TimeTicks now = base::TimeTicks::Now(); VLOG(1) << (now - last_draw_frame_time_).InMilliseconds()
diff --git a/services/ui/demo/mus_demo.h b/services/ui/demo/mus_demo.h index c4e490b..55112da 100644 --- a/services/ui/demo/mus_demo.h +++ b/services/ui/demo/mus_demo.h
@@ -28,10 +28,6 @@ } } // namespace aura -namespace aura_extra { -class ImageWindowDelegate; -} - namespace wm { class WMState; } @@ -98,12 +94,7 @@ bool IsWindowActive(aura::Window* window) override; void OnWmDeactivateWindow(aura::Window* window) override; - // Draws one frame, incrementing the rotation angle. - void DrawFrame(); - - aura::Window* root_window_ = nullptr; std::unique_ptr<aura::WindowTreeClient> window_tree_client_; - std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; std::unique_ptr<aura::Env> env_; std::unique_ptr<display::ScreenBase> screen_; @@ -111,20 +102,8 @@ std::unique_ptr<::wm::WMState> wm_state_; std::unique_ptr<aura::PropertyConverter> property_converter_; - // Window to which we draw the bitmap. - std::unique_ptr<aura::Window> bitmap_window_; - - // Destroys itself when the window gets destroyed. - aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; - - // Timer for calling DrawFrame(). - base::RepeatingTimer timer_; - - // Current rotation angle for drawing. - double angle_ = 0.0; - - // Last time a frame was drawn. - base::TimeTicks last_draw_frame_time_; + class WindowTreeData; + std::unique_ptr<WindowTreeData> window_tree_data_; DISALLOW_COPY_AND_ASSIGN(MusDemo); };
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 84b79cc5..770e11d 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -3247,6 +3247,13 @@ ], "isolated_scripts": [ { + "isolate_name": "content_shell_crash_test", + "name": "content_shell_crash_test", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { "isolate_name": "devtools_closure_compile", "name": "devtools_closure_compile", "swarming": {
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index e88d3ab..4b766d5 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -100803,7 +100803,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100831,7 +100831,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100860,7 +100860,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100888,7 +100888,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100917,7 +100917,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100945,7 +100945,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -100974,7 +100974,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101002,7 +101002,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101031,7 +101031,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101059,7 +101059,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101088,7 +101088,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101116,7 +101116,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101145,7 +101145,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101173,7 +101173,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101202,7 +101202,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101230,7 +101230,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101259,7 +101259,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101287,7 +101287,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101316,7 +101316,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101344,7 +101344,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101373,7 +101373,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101401,7 +101401,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101430,7 +101430,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101458,7 +101458,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101487,7 +101487,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101515,7 +101515,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101544,7 +101544,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101572,7 +101572,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101601,7 +101601,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101629,7 +101629,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101658,7 +101658,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101686,7 +101686,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101715,7 +101715,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101743,7 +101743,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101772,7 +101772,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101800,7 +101800,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101829,7 +101829,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101857,7 +101857,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101886,7 +101886,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101914,7 +101914,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101943,7 +101943,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -101971,7 +101971,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102000,7 +102000,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102028,7 +102028,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102057,7 +102057,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102085,7 +102085,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102114,7 +102114,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102142,7 +102142,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102171,7 +102171,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102199,7 +102199,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102228,7 +102228,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102256,7 +102256,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102285,7 +102285,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102313,7 +102313,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102342,7 +102342,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102370,7 +102370,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102399,7 +102399,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102427,7 +102427,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102456,7 +102456,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102484,7 +102484,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102513,7 +102513,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102541,7 +102541,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102570,7 +102570,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102598,7 +102598,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102627,7 +102627,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102655,7 +102655,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102684,7 +102684,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102712,7 +102712,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102741,7 +102741,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102769,7 +102769,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102798,7 +102798,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102826,7 +102826,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102855,7 +102855,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102883,7 +102883,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102912,7 +102912,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102940,7 +102940,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102969,7 +102969,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -102997,7 +102997,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103026,7 +103026,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103054,7 +103054,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103083,7 +103083,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103111,7 +103111,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103140,7 +103140,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103168,7 +103168,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103197,7 +103197,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103225,7 +103225,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103254,7 +103254,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103282,7 +103282,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103311,7 +103311,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103339,7 +103339,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103368,7 +103368,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103396,7 +103396,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103425,7 +103425,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103453,7 +103453,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103482,7 +103482,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103510,7 +103510,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103539,7 +103539,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103558,7 +103558,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103586,7 +103586,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103615,7 +103615,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103643,7 +103643,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103672,7 +103672,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103700,7 +103700,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103729,7 +103729,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103757,7 +103757,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103786,7 +103786,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103814,7 +103814,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103843,7 +103843,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103871,7 +103871,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103900,7 +103900,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103928,7 +103928,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103957,7 +103957,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -103985,7 +103985,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104014,7 +104014,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104042,7 +104042,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104071,7 +104071,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104090,7 +104090,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104118,7 +104118,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104147,7 +104147,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104175,7 +104175,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104204,7 +104204,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104232,7 +104232,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104261,7 +104261,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104289,7 +104289,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104318,7 +104318,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104346,7 +104346,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104375,7 +104375,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104403,7 +104403,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104432,7 +104432,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104460,7 +104460,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104489,7 +104489,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104517,7 +104517,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104546,7 +104546,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104574,7 +104574,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104603,7 +104603,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104631,7 +104631,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104660,7 +104660,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104688,7 +104688,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104717,7 +104717,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104745,7 +104745,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104774,7 +104774,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104802,7 +104802,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104831,7 +104831,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104859,7 +104859,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104888,7 +104888,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104916,7 +104916,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104945,7 +104945,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -104973,7 +104973,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105002,7 +105002,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105030,7 +105030,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105059,7 +105059,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105087,7 +105087,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105116,7 +105116,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105144,7 +105144,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105173,7 +105173,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105201,7 +105201,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105230,7 +105230,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105258,7 +105258,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105287,7 +105287,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105315,7 +105315,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105344,7 +105344,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105372,7 +105372,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105401,7 +105401,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105429,7 +105429,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105458,7 +105458,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105477,7 +105477,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105505,7 +105505,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105534,7 +105534,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105562,7 +105562,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105591,7 +105591,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105619,7 +105619,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105648,7 +105648,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105676,7 +105676,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105705,7 +105705,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105733,7 +105733,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105762,7 +105762,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105790,7 +105790,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105819,7 +105819,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105847,7 +105847,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105876,7 +105876,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105904,7 +105904,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105933,7 +105933,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105961,7 +105961,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -105990,7 +105990,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106018,7 +106018,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106047,7 +106047,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106075,7 +106075,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106104,7 +106104,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106132,7 +106132,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106161,7 +106161,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106189,7 +106189,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106218,7 +106218,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106246,7 +106246,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106275,7 +106275,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106303,7 +106303,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106332,7 +106332,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106360,7 +106360,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106389,7 +106389,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106417,7 +106417,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106446,7 +106446,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106474,7 +106474,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106503,7 +106503,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106531,7 +106531,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106560,7 +106560,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106588,7 +106588,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106617,7 +106617,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106645,7 +106645,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106674,7 +106674,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106702,7 +106702,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106731,7 +106731,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106759,7 +106759,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106788,7 +106788,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106816,7 +106816,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106845,7 +106845,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106873,7 +106873,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106902,7 +106902,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106930,7 +106930,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106959,7 +106959,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -106987,7 +106987,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107016,7 +107016,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107044,7 +107044,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107073,7 +107073,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107101,7 +107101,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107130,7 +107130,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107158,7 +107158,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107187,7 +107187,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107215,7 +107215,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107244,7 +107244,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107272,7 +107272,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107301,7 +107301,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107329,7 +107329,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107358,7 +107358,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107386,7 +107386,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107415,7 +107415,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107443,7 +107443,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107472,7 +107472,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107500,7 +107500,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107529,7 +107529,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107557,7 +107557,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107586,7 +107586,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107614,7 +107614,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107643,7 +107643,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107671,7 +107671,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107700,7 +107700,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107728,7 +107728,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107757,7 +107757,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107785,7 +107785,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107814,7 +107814,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107842,7 +107842,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107871,7 +107871,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107899,7 +107899,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107928,7 +107928,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107956,7 +107956,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -107985,7 +107985,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108013,7 +108013,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108042,7 +108042,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108070,7 +108070,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108099,7 +108099,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108127,7 +108127,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108156,7 +108156,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108184,7 +108184,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108213,7 +108213,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108241,7 +108241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108270,7 +108270,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108298,7 +108298,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108327,7 +108327,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108355,7 +108355,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108384,7 +108384,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108412,7 +108412,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108441,7 +108441,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108469,7 +108469,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108497,7 +108497,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108526,7 +108526,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108554,7 +108554,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108583,7 +108583,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108612,7 +108612,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108640,7 +108640,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108669,7 +108669,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108697,7 +108697,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108726,7 +108726,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108754,7 +108754,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108783,7 +108783,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108811,7 +108811,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108840,7 +108840,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108868,7 +108868,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108897,7 +108897,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108925,7 +108925,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108954,7 +108954,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -108982,7 +108982,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109011,7 +109011,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109039,7 +109039,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109068,7 +109068,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109096,7 +109096,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109125,7 +109125,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109153,7 +109153,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109182,7 +109182,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109210,7 +109210,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109239,7 +109239,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109267,7 +109267,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109296,7 +109296,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109324,7 +109324,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109353,7 +109353,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109381,7 +109381,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109410,7 +109410,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109438,7 +109438,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109467,7 +109467,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109495,7 +109495,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109524,7 +109524,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109552,7 +109552,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109581,7 +109581,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109609,7 +109609,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109638,7 +109638,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109666,7 +109666,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109695,7 +109695,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109723,7 +109723,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109752,7 +109752,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109780,7 +109780,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109809,7 +109809,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109837,7 +109837,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109866,7 +109866,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109894,7 +109894,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109923,7 +109923,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109951,7 +109951,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -109980,7 +109980,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110008,7 +110008,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110037,7 +110037,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110065,7 +110065,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110094,7 +110094,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110122,7 +110122,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110151,7 +110151,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110179,7 +110179,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110208,7 +110208,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110236,7 +110236,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110265,7 +110265,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110293,7 +110293,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110322,7 +110322,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110350,7 +110350,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110379,7 +110379,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110407,7 +110407,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110436,7 +110436,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110464,7 +110464,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110493,7 +110493,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110521,7 +110521,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110550,7 +110550,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110578,7 +110578,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110607,7 +110607,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110635,7 +110635,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110664,7 +110664,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110692,7 +110692,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110721,7 +110721,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110749,7 +110749,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110778,7 +110778,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110806,7 +110806,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110835,7 +110835,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110863,7 +110863,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110892,7 +110892,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110920,7 +110920,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110949,7 +110949,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -110977,7 +110977,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111006,7 +111006,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111034,7 +111034,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111063,7 +111063,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111091,7 +111091,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111120,7 +111120,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111148,7 +111148,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111177,7 +111177,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111205,7 +111205,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111234,7 +111234,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111262,7 +111262,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111291,7 +111291,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build104-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111319,7 +111319,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111348,7 +111348,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111376,7 +111376,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111405,7 +111405,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111433,7 +111433,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111462,7 +111462,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111490,7 +111490,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111519,7 +111519,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build101-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111547,7 +111547,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111575,7 +111575,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111604,7 +111604,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111632,7 +111632,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111661,7 +111661,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111690,7 +111690,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111718,7 +111718,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111747,7 +111747,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111775,7 +111775,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111804,7 +111804,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111832,7 +111832,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111861,7 +111861,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111889,7 +111889,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111918,7 +111918,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build103-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111946,7 +111946,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -111975,7 +111975,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build105-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -112003,7 +112003,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf" @@ -112032,7 +112032,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "1002:6779", + "gpu": "1002:6613", "id": "build102-m1", "os": "Windows-2008ServerR2-SP1", "pool": "Chrome-perf"
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 9902902..2deb8769 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -343,6 +343,11 @@ "label": "//content/public/android:content_junit_tests", "type": "junit_test", }, + "content_shell_crash_test": { + "label": "//content/shell:content_shell_crash_test", + "type": "script", + "script": "//testing/scripts/content_shell_crash_test.py", + }, "content_shell_test_apk": { "label": "//content/shell/android:content_shell_test_apk", "type": "console_test_launcher",
diff --git a/testing/scripts/content_shell_crash_test.py b/testing/scripts/content_shell_crash_test.py new file mode 100755 index 0000000..8c97846 --- /dev/null +++ b/testing/scripts/content_shell_crash_test.py
@@ -0,0 +1,86 @@ +#!/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. + +import argparse +import json +import os +import sys + + +import common + +# Add src/testing/ into sys.path for importing xvfb. +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +import xvfb + + +# Unfortunately we need to copy these variables from ../test_env.py. +# Importing it and using its get_sandbox_env breaks test runs on Linux +# (it seems to unset DISPLAY). +CHROME_SANDBOX_ENV = 'CHROME_DEVEL_SANDBOX' +CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox' + + +def main(argv): + parser = argparse.ArgumentParser() + parser.add_argument( + '--isolated-script-test-output', type=str, + required=True) + parser.add_argument( + '--isolated-script-test-chartjson-output', type=str, + required=True) + + args = parser.parse_args(argv) + + env = os.environ.copy() + # Assume we want to set up the sandbox environment variables all the + # time; doing so is harmless on non-Linux platforms and is needed + # all the time on Linux. + env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH + + if sys.platform == 'win32': + exe = os.path.join('.', 'content_shell.exe') + elif sys.platform == 'darwin': + exe = os.path.join('.', 'Content Shell.app', 'Contents', 'MacOS', + 'Content Shell') + else: + exe = os.path.join('.', 'content_shell') + + with common.temporary_file() as tempfile_path: + rc = xvfb.run_executable([ + sys.executable, + os.path.join(common.SRC_DIR, 'content', 'shell', 'tools', + 'breakpad_integration_test.py'), + '--verbose', + '--build-dir', '.', + '--binary', exe, + '--json', tempfile_path + ], env) + + with open(tempfile_path) as f: + failures = json.load(f) + + with open(args.isolated_script_test_output, 'w') as fp: + json.dump({ + 'valid': True, + 'failures': failures, + }, fp) + + return rc + + +def main_compile_targets(args): + json.dump(['content_shell_crash_test'], args.output) + + +if __name__ == '__main__': + # Conform minimally to the protocol defined by ScriptTest. + if 'compile_targets' in sys.argv: + funcs = { + 'run': None, + 'compile_targets': main_compile_targets, + } + sys.exit(common.run_script(sys.argv[1:], funcs)) + sys.exit(main(sys.argv[1:]))
diff --git a/testing/scripts/gn_check.py b/testing/scripts/gn_check.py deleted file mode 100755 index 5feb166..0000000 --- a/testing/scripts/gn_check.py +++ /dev/null
@@ -1,57 +0,0 @@ -#!/usr/bin/env python -# 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. - -"""Wrap `gn check` for the bots. - -This script wraps the `gn check` command in the facade needed for the -'ScriptTest' step class of the chromium recipe_module -(see scripts/slave/recipe_modules/chromium/steps.py in the build repo). - -The script takes no arguments. -""" - - -import json -import os -import sys - - -import common - - -def main_run(args): - if sys.platform == 'win32': - exe = os.path.join(common.SRC_DIR, 'buildtools', 'win', 'gn.exe') - elif sys.platform == 'mac': - exe = os.path.join(common.SRC_DIR, 'buildtools', 'mac', 'gn') - else: - exe = os.path.join(common.SRC_DIR, 'buildtools', 'linux64', 'gn') - - rc = common.run_command([ - exe, - '--root=%s' % common.SRC_DIR, - 'check', - '//out/%s' % args.build_config_fs, - ]) - - # TODO(dpranke): Figure out how to get a list of failures out of gn check? - json.dump({ - 'valid': True, - 'failures': ['check_failed'] if rc else [], - }, args.output) - - return rc - - -def main_compile_targets(args): - json.dump([], args.output) - - -if __name__ == '__main__': - funcs = { - 'run': main_run, - 'compile_targets': main_compile_targets, - } - sys.exit(common.run_script(sys.argv[1:], funcs))
diff --git a/testing/xvfb.py b/testing/xvfb.py index 54d4184..a5620e7c 100755 --- a/testing/xvfb.py +++ b/testing/xvfb.py
@@ -69,9 +69,12 @@ kill(xcompmgr_proc) else: env['_CHROMIUM_INSIDE_XVFB'] = '1' + xvfb_script = __file__ + if xvfb_script.endswith('.pyc'): + xvfb_script = xvfb_script[:-1] return subprocess.call(['xvfb-run', '-a', "--server-args=-screen 0 " "1280x800x24 -ac -nolisten tcp -dpi 96", - __file__] + cmd, env=env) + xvfb_script] + cmd, env=env) else: return test_env.run_executable(cmd, env)
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation b/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation index 1654c76..2e341b9 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation
@@ -5,17 +5,8 @@ crbug.com/608372 http/tests/history/back-to-post.html [ Timeout ] crbug.com/608372 virtual/mojo-loading/http/tests/history/back-to-post.html [ Timeout ] -# Ensure same-page back-forward are handled as same-page navigations -# Fixed by https://codereview.chromium.org/2584513003/ -crbug.com/575210 fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html [ Crash Timeout ] -crbug.com/575210 external/wpt/html/browsers/browsing-the-web/history-traversal/popstate_event.html [ Crash Failure Timeout ] -crbug.com/575210 external/wpt/html/browsers/history/the-history-interface/004.html [ Failure ] -crbug.com/575210 external/wpt/html/browsers/history/the-location-interface/security_location_0.htm [ Failure ] - # https://crbug.com/551000: PlzNavigate: DevTools support -crbug.com/551000 http/tests/inspector/extensions-network-redirect.html [ Timeout ] crbug.com/551000 http/tests/inspector/network/x-frame-options-deny.html [ Failure ] -crbug.com/551000 virtual/mojo-loading/http/tests/inspector/extensions-network-redirect.html [ Timeout ] crbug.com/551000 virtual/mojo-loading/http/tests/inspector/network/x-frame-options-deny.html [ Failure ] # Console error messages are wrongly ordered. crbug.com/551000 http/tests/inspector/console-resource-errors.html [ Failure ] @@ -26,10 +17,12 @@ crbug.com/551000 virtual/mojo-loading/http/tests/inspector/network/network-document-initiator.html [ Failure ] crbug.com/551000 virtual/mojo-loading/http/tests/inspector/network/network-initiator.html [ Failure ] -# https://crbug.com/625765: Need to solve duplicate output from -# WebFrameTestClient::willSendRequest() that causes text failures. -#crbug.com/625765 http/tests/loading/redirect-methods.html [ Crash Failure ] +# Forward redirect info to the renderer. Fixed by https://codereview.chromium.org/2653953005/. +crbug.com/551000 http/tests/inspector/extensions-network-redirect.html [ Timeout ] +crbug.com/551000 virtual/mojo-loading/http/tests/inspector/extensions-network-redirect.html [ Timeout ] +# These ones have an additional issue with a flipped order between diStartProvisionalLoad & willSendRequest crbug.com/625765 virtual/mojo-loading/http/tests/loading/redirect-methods.html [ Crash Failure ] +crbug.com/625765 http/tests/loading/redirect-methods.html [ Crash Failure ] # https://crbug.com/555418: Move `X-Frame-Options` and CSP's `frame-ancestor` # checks up out of the renderer. @@ -57,17 +50,6 @@ crbug.com/638900 http/tests/loading/doc-write-sync-third-party-script-reload.html [ Failure ] crbug.com/638900 virtual/mojo-loading/http/tests/loading/doc-write-sync-third-party-script-reload.html [ Failure ] -# https://crbug.com/640631: Failing due to difference in WebFrameClient -# callback sequence on renderer-initiated failed navigations. -crbug.com/640631 http/tests/loading/bad-scheme-subframe.html [ Timeout Failure ] -crbug.com/640631 http/tests/loading/bad-server-subframe.html [ Failure ] -crbug.com/640631 http/tests/loading/pdf-commit-load-callbacks.html [ Crash Failure ] -crbug.com/640631 http/tests/loading/text-content-type-with-binary-extension.html [ Timeout Failure ] -crbug.com/640631 virtual/mojo-loading/http/tests/loading/bad-scheme-subframe.html [ Timeout Failure ] -crbug.com/640631 virtual/mojo-loading/http/tests/loading/bad-server-subframe.html [ Failure ] -crbug.com/640631 virtual/mojo-loading/http/tests/loading/pdf-commit-load-callbacks.html [ Crash Failure ] -crbug.com/640631 virtual/mojo-loading/http/tests/loading/text-content-type-with-binary-extension.html [ Timeout Failure ] - # https://crbug.com/647698: Failing due to absence of call to # WebFrameClient::didReceiveServerRedirectForProvisionalLoad. crbug.com/647698 http/tests/loading/307-after-303-after-post.html [ Failure ] @@ -84,6 +66,20 @@ crbug.com/689153 virtual/stable/http/tests/navigation/response204.html [ Timeout ] crbug.com/689153 virtual/mojo-loading/http/tests/navigation/response204.html [ Timeout ] +# Missing console warning about usage of legacy protocol. +Bug(none) external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ Failure ] + +# Missing error messages. +Bug(none) external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html [ Failure ] + +# Missing console error line number. +Bug(none) http/tests/security/location-href-clears-username-password.html [ Failure ] +Bug(none) virtual/mojo-loading/http/tests/security/location-href-clears-username-password.html [ Failure ] + +# New untriaged. +Bug(none) http/tests/navigation/back-to-dynamic-iframe.html [ Failure ] +Bug(none) virtual/mojo-loading/http/tests/navigation/back-to-dynamic-iframe.html [ Failure ] + # This test seems to be partially failing without PlzNavigate as well. # These tests are flaky.
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 860ab62..89fb361 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -805,8 +805,10 @@ crbug.com/410974 fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html [ Pass Failure ] crbug.com/410974 fast/scroll-behavior/scroll-customization/touch-scroll-customization.html [ Pass Failure ] -# The test will pass once the --enable-features=TouchpadAndWheelScrollLatching flag is enabled by default. +# These tests will pass once the --enable-features=TouchpadAndWheelScrollLatching flag is enabled by default. crbug.com/526463 fast/events/wheel/mouse-wheel-scroll-latching.html [ Failure ] +crbug.com/526463 fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Failure Timeout ] +crbug.com/526463 fast/events/wheel/mainthread-touchpad-fling-latching.html [ Failure Timeout ] crbug.com/410974 virtual/threaded/fast/scroll-behavior/scroll-customization/scrollstate-basic.html [ Pass Failure ] crbug.com/410974 virtual/threaded/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html [ Pass Failure ] @@ -1653,6 +1655,8 @@ crbug.com/618082 [ Win10 ] printing/thead-repeats-at-top-of-each-page.html [ Failure ] crbug.com/618082 [ Win10 ] virtual/threaded/printing/thead-repeats-at-top-of-each-page.html [ Failure ] +crbug.com/690486 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-cjk.html [ Failure Pass ] + crbug.com/474759 fast/writing-mode/vertical-rl-replaced-selection.html [ Failure ] crbug.com/353746 virtual/android/fullscreen/video-specified-size.html [ Failure Pass ] @@ -2173,14 +2177,6 @@ crbug.com/652536 fast/events/mouse-cursor.html [ Pass Failure ] crbug.com/671478 fast/table/percent-height-replaced-content-in-cell.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-ltr-text-in-rtl-flow-underline-composition.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-ltr-flow.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-rtl-flow.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-rtl-flow-underline.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-ltr-flow-underline.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition.html [ Pass Failure ] -crbug.com/663855 fast/text/ellipsis-stroked.html [ Pass Failure ] crbug.com/663858 fast/text/emphasis.html [ Pass Failure ] crbug.com/663858 fast/text/emphasis-vertical.html [ Pass Failure ] crbug.com/663876 http/tests/loading/doc-write-sync-third-party-script-block-effectively-2g.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations index 4a3a9cb..461ae0b 100644 --- a/third_party/WebKit/LayoutTests/W3CImportExpectations +++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -363,7 +363,8 @@ external/wpt/websockets [ Skip ] ## Owners: michaeln@chromium.org,jsbell@chromium.org # external/wpt/webstorage [ Pass ] -external/wpt/webvtt [ Skip ] +## Owners: foolip@chromium.org, maksim.sisov@intel.com +# external/wpt/webvtt [ Pass ] ## Owners: nhiroki@chromium.org # external/wpt/workers [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding-expected.txt deleted file mode 100644 index 0a395dd..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding-expected.txt +++ /dev/null
@@ -1,18 +0,0 @@ -This tests canvas full arc fill with nonzero winding rule. Eight green concentric thick circumferences should be displayed. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[0] is 0 -PASS data[1] is 255 -PASS data[2] is 0 -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding.html index ca55e61..43c28e1f 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-360-winding.html
@@ -1,9 +1,43 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> -<script src="script-tests/canvas-arc-360-winding.js"></script> -</body> -</html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> + +<script> +test(function(t) { + var canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + var ctx = canvas.getContext('2d'); + + var r; + var anticlockwise = true; + ctx.beginPath(); + for (r = 200; r >= 10; r -= 10) { + ctx.moveTo(150 + r, 75); + ctx.arc(150, 75, r, 0, Math.PI*2, anticlockwise); + ctx.closePath(); + anticlockwise = !anticlockwise; + } + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.strokeStyle = 'rgba(0, 255, 0, 1)'; + ctx.fill(); + ctx.stroke(); + + var imageData = ctx.getImageData(297, 75, 1, 1); + var data = imageData.data; + assert_equals(data[0], 0); + assert_equals(data[1], 0); + assert_equals(data[2], 0); + + imageData = ctx.getImageData(285, 5, 1, 1); + data = imageData.data; + assert_equals(data[0], 0); + assert_equals(data[1], 255); + assert_equals(data[2], 0); + + imageData = ctx.getImageData(277, 75, 1, 1); + data = imageData.data; + assert_equals(data[0], 0); + assert_equals(data[1], 0); + assert_equals(data[2], 0); +}, 'This tests canvas full arc fill with nonzero winding rule. Eight green concentric thick circumferences should be displayed.'); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line-expected.txt deleted file mode 100644 index 9562be0..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line-expected.txt +++ /dev/null
@@ -1,18 +0,0 @@ -Test that canvas arc()s are connected by a straight line. There should be two C-shapes with a line from the bottom of the left one to the top of the right one. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS imgdata[0] is 0 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line.html index 2a17924..60886cc 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-connecting-line.html
@@ -1,9 +1,36 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> -<script src="script-tests/canvas-arc-connecting-line.js"></script> -</body> -</html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> + +<script> +test(function(t) { + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 300; + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.lineJoin = 'bevel'; + ctx.lineWidth = 12; + ctx.beginPath(); + ctx.arc(200, 50, 40, Math.PI / 2, -Math.PI / 2, false); + ctx.arc(100, 50, 40, Math.PI / 2, -Math.PI / 2, false); + ctx.stroke(); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + + imageData = ctx.getImageData(125, 30, 1, 1); + imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + + imageData = ctx.getImageData(125, 70, 1, 1); + imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); +}, 'Test that canvas arc()s are connected by a straight line. There should be two C-shapes with a line from the bottom of the left one to the top of the right one.'); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius-expected.txt deleted file mode 100644 index 48ed6b5..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -Tests CanvasPathMethods arc and arcTo with negative radii. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS ctx.arc(10, 10, 5, 0, 1, false) did not throw exception. -PASS ctx.arc(10, 10, 0, 0, 1, false) did not throw exception. -PASS ctx.arc(10, 10, -5, 0, 1, false) threw exception IndexSizeError: Failed to execute 'arc' on 'CanvasRenderingContext2D': The radius provided (-5) is negative.. -PASS ctx.arcTo(10, 10, 20, 20, 5) did not throw exception. -PASS ctx.arcTo(10, 10, 20, 20, 0) did not throw exception. -PASS ctx.arcTo(10, 10, 20, 20, -5) threw exception IndexSizeError: Failed to execute 'arcTo' on 'CanvasRenderingContext2D': The radius provided (-5) is negative.. -PASS path.arc(10, 10, 5, 0, 1, false) did not throw exception. -PASS path.arc(10, 10, 0, 0, 1, false) did not throw exception. -PASS path.arc(10, 10, -5, 0, 1, false) threw exception IndexSizeError: Failed to execute 'arc' on 'Path2D': The radius provided (-5) is negative.. -PASS path.arcTo(10, 10, 20, 20, 5) did not throw exception. -PASS path.arcTo(10, 10, 20, 20, 0) did not throw exception. -PASS path.arcTo(10, 10, 20, 20, -5) threw exception IndexSizeError: Failed to execute 'arcTo' on 'Path2D': The radius provided (-5) is negative.. -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius.html index a1810f5..8c52cc5 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-negative-radius.html
@@ -1,35 +1,29 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <p id="description"></p> <div id="console"></div> <script> -description("Tests CanvasPathMethods arc and arcTo with negative radii."); +test(function(t) { + var canvas = document.createElement("canvas"); + var ctx = canvas.getContext('2d'); -var canvas = document.createElement("canvas"); -var ctx = canvas.getContext('2d'); + ctx.arc(10, 10, 5, 0, 1, false); + ctx.arc(10, 10, 0, 0, 1, false); + assert_throws(null, function() {ctx.arc(10, 10, -5, 0, 1, false);}); -shouldNotThrow("ctx.arc(10, 10, 5, 0, 1, false)"); -shouldNotThrow("ctx.arc(10, 10, 0, 0, 1, false)"); -shouldThrow("ctx.arc(10, 10, -5, 0, 1, false)"); + ctx.arcTo(10, 10, 20, 20, 5); + ctx.arcTo(10, 10, 20, 20, 0); + assert_throws(null, function() {ctx.arcTo(10, 10, 20, 20, -5);}); -shouldNotThrow("ctx.arcTo(10, 10, 20, 20, 5)") -shouldNotThrow("ctx.arcTo(10, 10, 20, 20, 0)") -shouldThrow("ctx.arcTo(10, 10, 20, 20, -5)") + var path = new Path2D(); -var path = new Path2D(); + path.arc(10, 10, 5, 0, 1, false); + path.arc(10, 10, 0, 0, 1, false); + assert_throws(null, function() {path.arc(10, 10, -5, 0, 1, false);}); -shouldNotThrow("path.arc(10, 10, 5, 0, 1, false)"); -shouldNotThrow("path.arc(10, 10, 0, 0, 1, false)"); -shouldThrow("path.arc(10, 10, -5, 0, 1, false)"); - -shouldNotThrow("path.arcTo(10, 10, 20, 20, 5)") -shouldNotThrow("path.arcTo(10, 10, 20, 20, 0)") -shouldThrow("path.arcTo(10, 10, 20, 20, -5)") + path.arcTo(10, 10, 20, 20, 5); + path.arcTo(10, 10, 20, 20, 0); + assert_throws(null, function() {path.arcTo(10, 10, 20, 20, -5);}); +}, 'Tests CanvasPathMethods arc and arcTo with negative radii.'); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto-expected.txt deleted file mode 100644 index 45e8c2a..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -Bug 55696: Series of tests to ensure zero-length arc extends current subpath - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS Pixel (50,20) is black. -PASS Pixel (50,40) is black. -PASS Pixel (50,60) is black. -PASS Pixel (50,80) is black. -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto.html index 8e47173..bf00fbf 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-arc-zero-lineto.html
@@ -1,53 +1,47 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <canvas id="canvas" width="100" height="100"></canvas> -<script> -description("Bug 55696: Series of tests to ensure zero-length arc extends current subpath"); -var ctx = document.getElementById('canvas').getContext('2d'); -ctx.lineWidth = 4; -function shouldBeBlackPixel(x,y) +<script> +function shouldBeBlackPixel(ctx, x, y) { var data = ctx.getImageData(x, y, 1, 1).data; - if (data[0] != 0 || data[1] != 0 || data[2] != 0 || data[3] != 255) { - testFailed("Pixel (" + x + "," + y + ") should be black; " + - "was [" + data[0] + "," + data[1] + "," + data[2] + "," + data[3] + "]"); - } else { - testPassed("Pixel (" + x + "," + y + ") is black."); - } + assert_equals(data[0], 0); + assert_equals(data[1], 0); + assert_equals(data[2], 0); + assert_equals(data[3], 255); } -// moveTo + empty arc (swing == 0) -ctx.beginPath(); -ctx.moveTo(20, 20); -ctx.arc(80, 30, 10, -Math.PI/2, -Math.PI/2, true); -ctx.stroke(); -shouldBeBlackPixel(50, 20); - -// moveTo + empty arc (radius == 0) -ctx.beginPath(); -ctx.moveTo(20, 40); -ctx.arc(80, 40, 0, 0, 6, false); -ctx.stroke(); -shouldBeBlackPixel(50, 40) - -// empty arc (swing == 0) + lineTo -ctx.beginPath(); -ctx.arc(20, 50, 10, Math.PI/2, Math.PI/2, false); -ctx.lineTo(80, 60); -ctx.stroke(); -shouldBeBlackPixel(50, 60); - -// empty arc (radius == 0) + lineTo -ctx.beginPath(); -ctx.arc(20, 80, 0, 0, 6, false); -ctx.lineTo(80, 80); -ctx.stroke(); -shouldBeBlackPixel(50, 80); +test(function(t) { + var ctx = document.getElementById('canvas').getContext('2d'); + ctx.lineWidth = 4; + + // moveTo + empty arc (swing == 0) + ctx.beginPath(); + ctx.moveTo(20, 20); + ctx.arc(80, 30, 10, -Math.PI/2, -Math.PI/2, true); + ctx.stroke(); + shouldBeBlackPixel(ctx, 50, 20); + + // moveTo + empty arc (radius == 0) + ctx.beginPath(); + ctx.moveTo(20, 40); + ctx.arc(80, 40, 0, 0, 6, false); + ctx.stroke(); + shouldBeBlackPixel(ctx, 50, 40) + + // empty arc (swing == 0) + lineTo + ctx.beginPath(); + ctx.arc(20, 50, 10, Math.PI/2, Math.PI/2, false); + ctx.lineTo(80, 60); + ctx.stroke(); + shouldBeBlackPixel(ctx, 50, 60); + + // empty arc (radius == 0) + lineTo + ctx.beginPath(); + ctx.arc(20, 80, 0, 0, 6, false); + ctx.lineTo(80, 80); + ctx.stroke(); + shouldBeBlackPixel(ctx, 50, 80); +}, 'Series of tests to ensure zero-length arc extends current subpath (bug 55696)'); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt deleted file mode 100644 index b555b7d..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt +++ /dev/null
@@ -1,16 +0,0 @@ -Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS blue_value is 255 -PASS blue_value is 0 -PASS blue_value is 255 -PASS blue_value is 255 -PASS blue_value is 0 -PASS blue_value is 255 -PASS blue_value is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html index d64da81..fcbcf8e 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html
@@ -1,55 +1,49 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <canvas id="canvas" width="100" height="100"></canvas> + <script> -description("Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints"); -var ctx = document.getElementById('canvas').getContext('2d'); -var data; - -function shouldBeYellow(x,y) -{ - blue_value = ctx.getImageData(x, y, 1, 1).data[2]; - shouldBe("blue_value", "0"); -} - -function shouldBeBlue(x,y) -{ - blue_value = ctx.getImageData(x, y, 1, 1).data[2]; - shouldBe("blue_value", "255"); -} - -ctx.fillStyle = '#00f'; -ctx.strokeStyle = '#ff0'; -ctx.lineWidth = 30; - -ctx.beginPath(); -ctx.fillRect(0,0,100,100); -ctx.moveTo(0,0); - -// bezier curve with coincident endpoints, horizontal line -ctx.bezierCurveTo(0,0,200,0,0,0); -shouldBeBlue(50,0); -ctx.stroke(); -shouldBeYellow(50,0); -shouldBeBlue(0,50); -shouldBeBlue(70,70); - -// bezier curve with coincident endpoints, vertical line -ctx.bezierCurveTo(0,200,0,0,0,0); -ctx.stroke(); -shouldBeYellow(50,0); -shouldBeBlue(75,75); - -// bezier curve with coincident endpoints -ctx.bezierCurveTo(200,0,0,200,0,0); -ctx.stroke(); -shouldBeYellow(75,75); - - +test(function(t) { + var ctx = document.getElementById('canvas').getContext('2d'); + var data; + + function shouldBeYellow(x,y) + { + blue_value = ctx.getImageData(x, y, 1, 1).data[2]; + assert_equals(blue_value, 0); + } + + function shouldBeBlue(x,y) + { + blue_value = ctx.getImageData(x, y, 1, 1).data[2]; + assert_equals(blue_value, 255); + } + + ctx.fillStyle = '#00f'; + ctx.strokeStyle = '#ff0'; + ctx.lineWidth = 30; + + ctx.beginPath(); + ctx.fillRect(0,0,100,100); + ctx.moveTo(0,0); + + // bezier curve with coincident endpoints, horizontal line + ctx.bezierCurveTo(0,0,200,0,0,0); + shouldBeBlue(50,0); + ctx.stroke(); + shouldBeYellow(50,0); + shouldBeBlue(0,50); + shouldBeBlue(70,70); + + // bezier curve with coincident endpoints, vertical line + ctx.bezierCurveTo(0,200,0,0,0,0); + ctx.stroke(); + shouldBeYellow(50,0); + shouldBeBlue(75,75); + + // bezier curve with coincident endpoints + ctx.bezierCurveTo(200,0,0,200,0,0); + ctx.stroke(); + shouldBeYellow(75,75); +}, 'Test correct rendering of quadratic and bezier curves with coincident endpoints (bug 105650)'); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image-expected.txt deleted file mode 100644 index 410ccb9..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image-expected.txt +++ /dev/null
@@ -1,1129 +0,0 @@ -Series of tests to ensure correct results on applying different blend modes. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Testing blend mode "source-over" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 85 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "multiply" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "screen" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 85 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "overlay" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "darken" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "lighten" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 85 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "color-dodge" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "color-burn" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 42 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "hard-light" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 1 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 65 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "soft-light" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 0 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 43 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "difference" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 0 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 127 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 128 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 85 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 171 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "exclusion" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 0 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 64 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 127 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 255 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 255 -PASS pixelDataAtPoint(1)[1] is within 5 of 255 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 128 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 128 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 171 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 170 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 171 -PASS pixelDataAtPoint(1)[1] is within 5 of 171 -PASS pixelDataAtPoint(1)[2] is within 5 of 170 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 85 -PASS pixelDataAtPoint(2)[2] is within 5 of 170 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 171 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "hue" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 93 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 31 -PASS pixelDataAtPoint(1)[1] is within 5 of 31 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 46 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 49 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 16 -PASS pixelDataAtPoint(1)[1] is within 5 of 16 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 25 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 175 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 144 -PASS pixelDataAtPoint(1)[1] is within 5 of 144 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 88 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 116 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 96 -PASS pixelDataAtPoint(1)[1] is within 5 of 96 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 58 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "saturation" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 14 -PASS pixelDataAtPoint(2)[1] is within 5 of 14 -PASS pixelDataAtPoint(2)[2] is within 5 of 142 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 0 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 0 -PASS pixelDataAtPoint(1)[1] is within 5 of 0 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 7 -PASS pixelDataAtPoint(2)[1] is within 5 of 7 -PASS pixelDataAtPoint(2)[2] is within 5 of 198 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 128 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 128 -PASS pixelDataAtPoint(1)[1] is within 5 of 128 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 7 -PASS pixelDataAtPoint(2)[1] is within 5 of 71 -PASS pixelDataAtPoint(2)[2] is within 5 of 70 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 85 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 167 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 85 -PASS pixelDataAtPoint(1)[1] is within 5 of 85 -PASS pixelDataAtPoint(1)[2] is within 5 of 167 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 4 -PASS pixelDataAtPoint(2)[1] is within 5 of 48 -PASS pixelDataAtPoint(2)[2] is within 5 of 130 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "color" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 93 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 31 -PASS pixelDataAtPoint(1)[1] is within 5 of 31 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 47 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 49 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 16 -PASS pixelDataAtPoint(1)[1] is within 5 of 16 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 24 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 175 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 0 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 144 -PASS pixelDataAtPoint(1)[1] is within 5 of 144 -PASS pixelDataAtPoint(1)[2] is within 5 of 0 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 88 -PASS pixelDataAtPoint(2)[2] is within 5 of 0 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 116 -PASS pixelDataAtPoint(0)[1] is within 5 of 0 -PASS pixelDataAtPoint(0)[2] is within 5 of 84 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 96 -PASS pixelDataAtPoint(1)[1] is within 5 of 96 -PASS pixelDataAtPoint(1)[2] is within 5 of 84 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 0 -PASS pixelDataAtPoint(2)[1] is within 5 of 58 -PASS pixelDataAtPoint(2)[2] is within 5 of 84 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -Testing blend mode "luminosity" -solid on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 55 -PASS pixelDataAtPoint(0)[1] is within 5 of 55 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 224 -PASS pixelDataAtPoint(1)[1] is within 5 of 224 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 54 -PASS pixelDataAtPoint(2)[1] is within 5 of 54 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -solid on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 28 -PASS pixelDataAtPoint(0)[1] is within 5 of 28 -PASS pixelDataAtPoint(0)[2] is within 5 of 255 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 112 -PASS pixelDataAtPoint(1)[1] is within 5 of 112 -PASS pixelDataAtPoint(1)[2] is within 5 of 255 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 27 -PASS pixelDataAtPoint(2)[1] is within 5 of 27 -PASS pixelDataAtPoint(2)[2] is within 5 of 255 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on solid -PASS pixelDataAtPoint(0)[0] is within 5 of 155 -PASS pixelDataAtPoint(0)[1] is within 5 of 27 -PASS pixelDataAtPoint(0)[2] is within 5 of 127 -PASS pixelDataAtPoint(0)[3] is within 5 of 255 -PASS pixelDataAtPoint(1)[0] is within 5 of 239 -PASS pixelDataAtPoint(1)[1] is within 5 of 239 -PASS pixelDataAtPoint(1)[2] is within 5 of 127 -PASS pixelDataAtPoint(1)[3] is within 5 of 255 -PASS pixelDataAtPoint(2)[0] is within 5 of 26 -PASS pixelDataAtPoint(2)[1] is within 5 of 90 -PASS pixelDataAtPoint(2)[2] is within 5 of 127 -PASS pixelDataAtPoint(2)[3] is within 5 of 255 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 255 -alpha on alpha -PASS pixelDataAtPoint(0)[0] is within 5 of 104 -PASS pixelDataAtPoint(0)[1] is within 5 of 19 -PASS pixelDataAtPoint(0)[2] is within 5 of 167 -PASS pixelDataAtPoint(0)[3] is within 5 of 191 -PASS pixelDataAtPoint(1)[0] is within 5 of 158 -PASS pixelDataAtPoint(1)[1] is within 5 of 158 -PASS pixelDataAtPoint(1)[2] is within 5 of 167 -PASS pixelDataAtPoint(1)[3] is within 5 of 191 -PASS pixelDataAtPoint(2)[0] is within 5 of 16 -PASS pixelDataAtPoint(2)[1] is within 5 of 58 -PASS pixelDataAtPoint(2)[2] is within 5 of 167 -PASS pixelDataAtPoint(2)[3] is within 5 of 191 -PASS pixelDataAtPoint(3)[0] is within 5 of 0 -PASS pixelDataAtPoint(3)[1] is within 5 of 0 -PASS pixelDataAtPoint(3)[2] is within 5 of 255 -PASS pixelDataAtPoint(3)[3] is within 5 of 191 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image.html index 3a237ceb..b710848 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blend-image.html
@@ -1,8 +1,179 @@ -<!doctype html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> -<script src="script-tests/canvas-blend-image.js"></script> -</body> \ No newline at end of file +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script> +var canvas = document.createElement('canvas'); +canvas.width = 200; +canvas.height = 200; +ctx = canvas.getContext('2d'); + +// Create the image for blending test with images. +var img = document.createElement('canvas'); +img.width = 200; +img.height = 200; +var imgCtx = img.getContext('2d'); +imgCtx.fillStyle = "red"; +imgCtx.fillRect(0,0,100,100); +imgCtx.fillStyle = "yellow"; +imgCtx.fillRect(100,0,100,100); +imgCtx.fillStyle = "green"; +imgCtx.fillRect(100,100,100,100); +imgCtx.fillStyle = "blue"; +imgCtx.fillRect(0,100,100,100); + +// Create expected results. +var blendModes = +// [blendMode, expectations solid on solid, expectations solid on alpha, expectations alpha on solid, expectations alpha on alpha] +[ + ['source-over', + [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], + [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], + [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] + ], + ['multiply', + [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], + [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], + [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], + [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] + ], + ['screen', + [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], + [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], + [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], + [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] + ], + ['overlay', + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], + [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] + ], + ['darken', + [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], + [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], + [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], + [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] + ], + ['lighten', + [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], + [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], + [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], + [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] + ], + ['color-dodge', + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], + [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] + ], + ['color-burn', + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], + [[85, 0, 170, 191],[85, 85, 170, 191],[0, 42, 170, 191],[0, 0, 255, 191]] + ], + ['hard-light', + [[255, 0, 0, 255],[255, 255, 0, 255],[0, 1, 0, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], + [[255, 0, 0, 255],[255, 255, 0, 255],[0, 65, 0, 255],[0, 0, 255, 255]], + [[171, 0, 84, 191],[171, 171, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] + ], + ['soft-light', + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], + [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] + ], + ['difference', + [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], + [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], + [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], + [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] + ], + ['exclusion', + [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], + [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], + [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], + [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] + ], + ['hue', + [[93, 0, 0, 255],[31, 31, 0, 255],[0, 46, 0, 255],[0, 0, 255, 255]], + [[49, 0, 127, 255],[16, 16, 127, 255],[0, 25, 127, 255],[0, 0, 255, 255]], + [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], + [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] + ], + ['saturation', + [[0, 0, 255, 255],[0, 0, 255, 255],[14, 14, 142, 255],[0, 0, 255, 255]], + [[0, 0, 255, 255],[0, 0, 255, 255],[7, 7, 198, 255],[0, 0, 255, 255]], + [[128, 0, 127, 255],[128, 128, 127, 255],[7, 71, 70, 255],[0, 0, 255, 255]], + [[85, 0, 167, 191],[85, 85, 167, 191],[4, 48, 130, 191],[0, 0, 255, 191]] + ], + ['color', + [[93, 0, 0, 255],[31, 31, 0, 255],[0, 47, 0, 255],[0, 0, 255, 255]], + [[49, 0, 127, 255],[16, 16, 127, 255],[0, 24, 127, 255],[0, 0, 255, 255]], + [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], + [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] + ], + ['luminosity', + [[55, 55, 255, 255],[224, 224, 255, 255],[54, 54, 255, 255],[0, 0, 255, 255]], + [[28, 28, 255, 255],[112, 112, 255, 255],[27, 27, 255, 255],[0, 0, 255, 255]], + [[155, 27, 127, 255],[239, 239, 127, 255],[26, 90, 127, 255],[0, 0, 255, 255]], + [[104, 19, 167, 191],[158, 158, 167, 191],[16, 58, 167, 191],[0, 0, 255, 191]] + ]]; + +// [Scenario, [alpha on background, alpha on foreground, index helper]] +testScenario = [ + ['solid on solid', [1, 1, 0]], + ['solid on alpha', [1, 0.5, 1]], + ['alpha on solid', [0.5, 1, 2]], + ['alpha on alpha', [0.5, 0.5, 3]] +]; + +testBlendMode = blendModes[0]; + +testPoints = [{x: 50, y: 50}, {x: 150, y: 50}, {x: 150, y: 150}, {x: 50, y: 150}]; + +function pixelDataAtPoint(i) +{ + return ctx.getImageData(testPoints[i].x, testPoints[i].y , 1, 1).data; +} + +function checkBlendModeResult(expectedColors, sigma) { + for (var i = 0; i < testPoints.length; i++) { + var resultColor = pixelDataAtPoint(i); + assert_approx_equals(resultColor[0], expectedColors[i][0], sigma); + assert_approx_equals(resultColor[1], expectedColors[i][1], sigma); + assert_approx_equals(resultColor[2], expectedColors[i][2], sigma); + assert_approx_equals(resultColor[3], expectedColors[i][3], sigma); + } +} + +function testBlending(parameters) { + alpha = parameters[0]; + globalAlpha = parameters[1]; + testIndex = parameters[2]; + + ctx.clearRect(0,0,200,200); + ctx.save(); + + // Draw backdrop. + ctx.fillStyle = 'rgba(0, 0, 255, ' + alpha + ')'; + ctx.fillRect(0,0,200,200); + + // Apply blend mode. + ctx.globalCompositeOperation = testBlendMode[0]; + ctx.globalAlpha = globalAlpha; + ctx.drawImage(img, 0, 0); + checkBlendModeResult(testBlendMode[testIndex+1], 5); + ctx.restore(); +} + +test(function(t) { + // Run test and allow variation of results. + // Check each blend mode individually. + for (var i = 0; i < blendModes.length; i++) { + testBlendMode = blendModes[i]; + generate_tests(testBlending, testScenario); + } +}, 'Series of tests to ensure correct results on applying different blend modes.'); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping-expected.txt deleted file mode 100644 index 715fd2f..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping-expected.txt +++ /dev/null
@@ -1,169 +0,0 @@ -Series of tests to ensure correct results on applying different blend modes when drawing with clipped regions. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Testing blend mode source-over -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 129 -PASS actualColor(5, 5)[2] is within 5 of 129 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode multiply -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 129 -PASS actualColor(5, 5)[1] is within 5 of 129 -PASS actualColor(5, 5)[2] is within 5 of 65.25882352941176 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode screen -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 192.74117647058821 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode overlay -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 130.48235294117646 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode darken -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 129 -PASS actualColor(5, 5)[1] is within 5 of 129 -PASS actualColor(5, 5)[2] is within 5 of 129 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode lighten -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 129 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode color-dodge -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 255 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode color-burn -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 129 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 5.930232558139517 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode hard-light -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 130.48235294117646 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode soft-light -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 181.3697880023021 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 129.61611515296823 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode difference -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 126 -PASS actualColor(5, 5)[1] is within 5 of 126 -PASS actualColor(5, 5)[2] is within 5 of 0 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode exclusion -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 126 -PASS actualColor(5, 5)[1] is within 5 of 126 -PASS actualColor(5, 5)[2] is within 5 of 127.48235294117649 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode hue -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 181 -PASS actualColor(5, 5)[2] is within 5 of 181 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode saturation -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 129 -PASS actualColor(5, 5)[1] is within 5 of 255 -PASS actualColor(5, 5)[2] is within 5 of 129 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode color -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 255 -PASS actualColor(5, 5)[1] is within 5 of 181 -PASS actualColor(5, 5)[2] is within 5 of 181 -PASS actualColor(5, 5)[3] is within 5 of 255 - -Testing blend mode luminosity -PASS actualColor(0, 0)[0] is within 5 of 0 -PASS actualColor(0, 0)[1] is within 5 of 0 -PASS actualColor(0, 0)[2] is within 5 of 0 -PASS actualColor(0, 0)[3] is within 5 of 0 -PASS actualColor(5, 5)[0] is within 5 of 92 -PASS actualColor(5, 5)[1] is within 5 of 218 -PASS actualColor(5, 5)[2] is within 5 of 92 -PASS actualColor(5, 5)[3] is within 5 of 255 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping.html index 78196b65..9189359 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-clipping.html
@@ -1,62 +1,57 @@ -<!DOCTYPE HTML> -<html> -<body> - <script src="../../resources/js-test.js"></script> - <script type="text/javascript" src="canvas-blending-helpers.js"></script> - <script type="text/javascript"> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script type="text/javascript" src="canvas-blending-helpers.js"></script> +<script> +test(function(t) { + var context; + function actualColor(x, y) { + return context.getImageData(x, y, 1, 1).data; + } - description("Series of tests to ensure correct results on applying different blend modes when drawing with clipped regions."); + function checkBlendModeResult(i, context, sigma) { + var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i); + var ac = actualColor(0, 0); + assert_approx_equals(ac[0], 0, sigma); + assert_approx_equals(ac[1], 0, sigma); + assert_approx_equals(ac[2], 0, sigma); + assert_approx_equals(ac[3], 0, sigma); - var context; - function actualColor(x, y) { - return context.getImageData(x, y, 1, 1).data; + ac = actualColor(5, 5); + assert_approx_equals(ac[0], expectedColor[0], sigma); + assert_approx_equals(ac[1], expectedColor[1], sigma); + assert_approx_equals(ac[2], expectedColor[2], sigma); + assert_approx_equals(ac[3], expectedColor[3], sigma); + } + + function runTest() { + var canvas = document.createElement("canvas"); + var sigma = 5; + canvas.width = 10; + canvas.height = 10; + context = canvas.getContext("2d"); + + for (var i = 0; i < blendModes.length; ++i) { + context.clearRect(0, 0, 10, 10); + context.save(); + context.beginPath(); + context.moveTo(3, 3); + context.lineTo(3, 7); + context.lineTo(7, 7); + context.lineTo(7, 3); + context.lineTo(3, 3); + context.clip(); + + drawBackdropColorInContext(context); + context.globalCompositeOperation = blendModes[i]; + drawSourceColorInContext(context); + checkBlendModeResult(i, context, sigma); + context.restore(); } + } + runTest(); +}, 'Series of tests to ensure correct results on applying different blend modes when drawing with clipped regions.'); +</script> - function checkBlendModeResult(i, context, sigma) { - var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i); - var ac = "actualColor(0, 0)"; - shouldBeCloseTo(ac + "[0]", 0, sigma); - shouldBeCloseTo(ac + "[1]", 0, sigma); - shouldBeCloseTo(ac + "[2]", 0, sigma); - shouldBeCloseTo(ac + "[3]", 0, sigma); - - ac = "actualColor(5, 5)"; - shouldBeCloseTo(ac + "[0]", expectedColor[0], sigma); - shouldBeCloseTo(ac + "[1]", expectedColor[1], sigma); - shouldBeCloseTo(ac + "[2]", expectedColor[2], sigma); - shouldBeCloseTo(ac + "[3]", expectedColor[3], sigma); - } - - function runTest() { - var canvas = document.createElement("canvas"); - var sigma = 5; - canvas.width = 10; - canvas.height = 10; - context = canvas.getContext("2d"); - - for (var i = 0; i < blendModes.length; ++i) { - debug("Testing blend mode " + blendModes[i]); - - context.clearRect(0, 0, 10, 10); - context.save(); - context.beginPath(); - context.moveTo(3, 3); - context.lineTo(3, 7); - context.lineTo(7, 7); - context.lineTo(7, 3); - context.lineTo(3, 3); - context.clip(); - - drawBackdropColorInContext(context); - context.globalCompositeOperation = blendModes[i]; - drawSourceColorInContext(context); - checkBlendModeResult(i, context, sigma); - context.restore(); - debug(''); - } - } - - runTest(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect-expected.txt deleted file mode 100644 index 8a1aab91..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -Series of tests to ensure correct behavior of canvas.clearRect(). - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test canvas.clearRect() with height = width = 0. -PASS imgdata[0] is 255 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -Test canvas.clearRect() with height = 0, width = 1. -PASS imgdata[0] is 255 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -Test canvas.clearRect() with height = 1, width = 0. -PASS imgdata[0] is 255 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect.html index 899e664f..3432b60 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clearRect.html
@@ -1,9 +1,47 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-clearRect.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + // Clear rect with height = width = 0. + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 1, 1); + ctx.clearRect(0, 0, 0, 0); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 255); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + + ctx.clearRect(0, 0, 1, 1); + + // Clear rect with height = 0, width = 1. + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 1, 1); + ctx.clearRect(0, 0, 1, 0); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 255); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + + ctx.clearRect(0, 0, 1, 1); + + // Clear rect with height = 1, width = 0. + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 1, 1); + ctx.clearRect(0, 0, 0, 1); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 255); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + +}, "Series of tests to ensure correct behavior of canvas.clearRect()."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule-expected.txt deleted file mode 100644 index eb71dc9..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule-expected.txt +++ /dev/null
@@ -1,27 +0,0 @@ -Series of tests to ensure correct results of the winding rule. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Testing default clip -PASS pixelDataAtPoint()[0] is within 5 of 0 -PASS pixelDataAtPoint()[1] is within 5 of 255 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -Testing nonzero clip -PASS pixelDataAtPoint()[0] is within 5 of 0 -PASS pixelDataAtPoint()[1] is within 5 of 255 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -Testing evenodd clip -PASS pixelDataAtPoint()[0] is within 5 of 255 -PASS pixelDataAtPoint()[1] is within 5 of 0 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule.html index 663c7e5..2c04e06a 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-rule.html
@@ -1,8 +1,57 @@ -<!doctype html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-clip-rule.js"></script> +<script> +var tmpimg = document.createElement('canvas'); +tmpimg.width = 200; +tmpimg.height = 200; +ctx = tmpimg.getContext('2d'); + +// Create the image for blending test with images. +var img = document.createElement('canvas'); +img.width = 100; +img.height = 100; +var imgCtx = img.getContext('2d'); + +function checkResult(expectedColors, sigma) { + var data = ctx.getImageData(50, 50, 1, 1).data; + for (var i = 0; i < 4; i++) + assert_approx_equals(data[i], expectedColors[i], sigma); +} + +test(function(t) { + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.clip(); + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + checkResult([0, 255, 0, 255], 5); + + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.clip('nonzero'); + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + checkResult([0, 255, 0, 255], 5); + + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.clip('evenodd'); + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + checkResult([255, 0, 0, 255], 5); +}, "Series of tests to ensure correct results of the winding rule."); +</script> </body> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt deleted file mode 100644 index 7c90710..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -Test the behavior of closePath on a path with a single point - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS imgdata[3] is 255 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point.html index 695cc66..aa80993 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-closePath-single-point.html
@@ -1,9 +1,30 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-closePath-single-point.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + document.body.appendChild(ctx.canvas); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); + + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(100, 100); + ctx.closePath(); + ctx.stroke(); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + assert_equals(imgdata[3], 255); +}, "Test the behavior of closePath on a path with a single point"); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value-expected.txt deleted file mode 100644 index 308fb51..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -Testing default value: -PASS actualContextAttributes.alpha is true - -Testing undefined value: -PASS actualContextAttributes.alpha is true - -Testing null value: -PASS actualContextAttributes.alpha is false - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html index f23a538..b3065a0d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html
@@ -1,9 +1,6 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../resources/js-test.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <script> - var trueAttributes = { alpha : true, }; @@ -31,26 +28,20 @@ window.actualContextAttributes = context.getContextAttributes(); for (key in expectedAttributes) - shouldBe("actualContextAttributes." + key, - expectedAttributes[key].toString()); + assert_equals(eval("actualContextAttributes." + key), + expectedAttributes[key]); } -</script> -</head> -<body> -<script> + test(function(t) { + testAttributes(trueAttributes); + }, 'Test default value'); - debug("Testing default value:"); - testAttributes(trueAttributes); - debug("") + test(function(t) { + testAttributes(trueAttributes, undefined); + }, 'Test undfined value'); - debug("Testing undefined value:"); - testAttributes(trueAttributes, undefined); - debug("") - - debug("Testing null value:"); - testAttributes(falseAttributes, null); - debug("") - + test(function(t) { + testAttributes(falseAttributes, null); + }, 'Test null value'); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties-expected.txt deleted file mode 100644 index c702309..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -Verify that the custom properties on a Canvas 2D rendering context object are retained across GCs. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS context.customProperty is "value" -PASS context.customProperty is "value" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html index 2ec7253..585be39 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html
@@ -1,31 +1,38 @@ -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <script> -description("Verify that the custom properties on a Canvas 2D rendering context object are retained across GCs."); - -window.jsTestIsAsync = true; - -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); +function gc() { + if (typeof GCController !== "undefined") + GCController.collectAll(); + else { + var gcRec = function (n) { + if (n < 1) + return {}; + var temp = {i: "ab" + i + (i / 100000)}; + temp += "foo"; + gcRec(n-1); + }; + for (var i = 0; i < 1000; i++) + gcRec(10); + } } function runTest() { canvas = document.createElement("canvas"); context = canvas.getContext("2d"); context.customProperty = "value"; - shouldBeEqualToString("context.customProperty", "value"); + assert_equals(context.customProperty, "value"); context = null; gc(); context = canvas.getContext("2d"); - shouldBeEqualToString("context.customProperty", "value"); - finishJSTest(); + assert_equals(context.customProperty, "value"); } -window.onload = runTest; +async_test(t => { + window.onload = function() { + t.step(runTest); + t.done(); + } +}, 'Verify that the custom properties on a Canvas 2D rendering context object are retained across GCs.'); + </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels-expected.txt deleted file mode 100644 index ca06581..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels-expected.txt +++ /dev/null
@@ -1,18 +0,0 @@ -Test if putImageData gives back the same result as getImageData - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[4] is 255 -PASS imgdata[5] is 0 -PASS imgdata[6] is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 0 -PASS imgdata[6] is 255 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html index d6d7d21f..52b93de 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html
@@ -1,9 +1,37 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-copyPixels.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + ctx.fillStyle = "red"; + ctx.fillRect(0,0,50,20); + ctx.fillStyle = "green"; + ctx.fillRect(50,0,50,20); + ctx.fillStyle = "blue"; + ctx.fillRect(100,0,50,20); + + var data = ctx.getImageData(0,0,150,20); + ctx.putImageData(data, 0, 20); + + var imageData = ctx.getImageData(1, 21, 48, 18); + var imgdata = imageData.data; + assert_equals(imgdata[4], 255); + assert_equals(imgdata[5], 0); + assert_equals(imgdata[6], 0); + + imageData = ctx.getImageData(51, 21, 48, 18); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); + + imageData = ctx.getImageData(101, 21, 48, 18); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 0); + assert_equals(imgdata[6], 255); +}, "Test if putImageData gives back the same result as getImageData"); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow-expected.txt deleted file mode 100644 index d407bf8f..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow-expected.txt +++ /dev/null
@@ -1,57 +0,0 @@ -Ensure correct behavior of canvas with createPattern + fillRect with shadow. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 51 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 51 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 51 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 141 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 113 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 51 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 29 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 23 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 29 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow.html index b309e61..d9e5abf52 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createPattern-fillRect-shadow.html
@@ -1,9 +1,150 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-createPattern-fillRect-shadow.js"></script> +<script> + +// Create auxiliary canvas to draw to and create an image from. +// This is done instead of simply loading an image from the file system +// because that would throw a SECURITY_ERR DOM Exception. +var aCanvas = document.createElement('canvas'); +aCanvas.setAttribute('width', '200'); +aCanvas.setAttribute('height', '200'); +var aCtx = aCanvas.getContext('2d'); + +// Draw a circle on the same canvas. +aCtx.beginPath(); +aCtx.fillStyle = 'blue'; +aCtx.arc(100, 100, 100, 0, Math.PI * 2, false); +aCtx.fill(); + +// Create the image object to be drawn on the master canvas. +var img = new Image(); +img.src = aCanvas.toDataURL(); // set a data URI of the base64 encoded image as the source + +// Create master canvas. +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '700'); +canvas.setAttribute('height', '1100'); +var ctx = canvas.getContext('2d'); + +function drawImageToCanvasAndCheckPixels() { + ctx.shadowOffsetX = 250; + ctx.fillStyle = ctx.createPattern(img, 'repeat'); + + ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; + ctx.fillRect(50, 50, 200, 200); + + ctx.shadowColor = 'rgba(255, 0, 0, 0.2)'; + ctx.fillRect(50, 300, 200, 200); + + ctx.shadowBlur = 10; + ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; + ctx.fillRect(50, 550, 200, 200); + + ctx.shadowColor = 'rgba(255, 0, 0, 0.2)'; + ctx.fillRect(50, 800, 200, 200); + + checkPixels(); +} + +function checkPixels() { + var imageData, data; + + // Verify solid shadow. + imageData = ctx.getImageData(300, 50, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_equals(d[3], 255); + + imageData = ctx.getImageData(300, 249, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_equals(d[3], 255); + + imageData = ctx.getImageData(490, 240, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_equals(d[3], 255); + + // Verify solid alpha shadow. + imageData = ctx.getImageData(310, 350, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 51, 10); + + imageData = ctx.getImageData(490, 490, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 51, 10); + + imageData = ctx.getImageData(300, 499, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 51, 10); + + // Verify blurry shadow. + imageData = ctx.getImageData(310, 550, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 141, 10); + + imageData = ctx.getImageData(490, 750, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 113, 10); + + imageData = ctx.getImageData(499, 499, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 51, 10); + + // Verify blurry alpha shadow. + imageData = ctx.getImageData(300, 850, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 29, 10); + + imageData = ctx.getImageData(500, 875, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 23, 10); + + imageData = ctx.getImageData(300, 900, 1, 1); + d = imageData.data; + assert_equals(d[0], 255); + assert_equals(d[1], 0); + assert_equals(d[2], 0); + assert_approx_equals(d[3], 29, 10); +} + +async_test(t => { + img.onload = function() { + t.step(drawImageToCanvasAndCheckPixels); + t.done(); + } +}, "Ensure correct behavior of canvas with createPattern + fillRect with shadow."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor-expected.txt deleted file mode 100644 index 979c9cb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor-expected.txt +++ /dev/null
@@ -1,33 +0,0 @@ -Test that CanvasRenderingContext2D supports the 'currentColor' value. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS ctx.shadowColor = '#f00'; ctx.shadowColor is '#ff0000' -PASS ctx.shadowColor = 'currentColor'; ctx.shadowColor is '#000000' -PASS ctx.fillStyle = '#f00'; ctx.fillStyle is '#ff0000' -PASS ctx.fillStyle = 'currentColor'; ctx.fillStyle is '#000000' -PASS ctx.strokeStyle = '#f00'; ctx.strokeStyle is '#ff0000' -PASS ctx.strokeStyle = 'currentColor'; ctx.strokeStyle is '#000000' -PASS tryLinearGradientColor('#f00') is '255,0,0,255' -PASS tryLinearGradientColor('currentColor') is '0,0,0,255' -PASS tryRadialGradientColor('#f00') is '255,0,0,255' -PASS tryRadialGradientColor('currentColor') is '0,0,0,255' -PASS attachCanvasToDocument() is true -PASS canvas.style.color = '#123456'; canvas.style.color is 'rgb(18, 52, 86)' -PASS ctx.shadowColor = '#f00'; ctx.shadowColor is '#ff0000' -PASS ctx.shadowColor = 'currentColor'; ctx.shadowColor is '#123456' -PASS ctx.fillStyle = '#f00'; ctx.fillStyle is '#ff0000' -PASS ctx.fillStyle = 'currentColor'; ctx.fillStyle is '#123456' -PASS ctx.strokeStyle = '#f00'; ctx.strokeStyle is '#ff0000' -PASS ctx.strokeStyle = 'currentColor'; ctx.strokeStyle is '#123456' -PASS tryLinearGradientColor('#f00') is '255,0,0,255' -PASS tryLinearGradientColor('currentColor') is '0,0,0,255' -PASS tryRadialGradientColor('#f00') is '255,0,0,255' -PASS tryRadialGradientColor('currentColor') is '0,0,0,255' -PASS ctx.shadowColor = '#f00'; ctx.shadowColor is '#ff0000' -PASS ctx.shadowColor = 'CURRENTCOLOR'; ctx.shadowColor is '#123456' -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor.html index 29d1738..5d69335 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentColor.html
@@ -1,9 +1,84 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-currentColor.js"></script> +<script> +canvas = document.createElement('canvas'); +canvas.width = 100; +canvas.height = 100; +ctx = canvas.getContext('2d'); + +function attachCanvasToDocument() { + document.body.appendChild(canvas); + return document.body.parentNode != null; +} + +function tryLinearGradientColor(color) { + var gradient = ctx.createLinearGradient(0, 0, 100, 100); + gradient.addColorStop(0, color); + gradient.addColorStop(1, color); + ctx.fillStyle = gradient; + ctx.fillRect(0, 0, 100, 100); + var data = ctx.getImageData(0, 0, 1, 1).data; + return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3]; +} + +function tryRadialGradientColor(color) { + var gradient = ctx.createRadialGradient(0, 0, 100, 100, 100, 100); + gradient.addColorStop(0, color); + gradient.addColorStop(1, color); + ctx.fillStyle = gradient; + ctx.fillRect(0, 0, 100, 100); + var data = ctx.getImageData(0, 0, 1, 1).data; + return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3]; +} + +test(function(t) { + // First we test with the canvas out-of-document, 'currentColor' should mean transparent black + ctx.shadowColor = '#f00'; + assert_equals(ctx.shadowColor, '#ff0000'); + ctx.shadowColor = 'currentColor'; + assert_equals(ctx.shadowColor, '#000000'); + ctx.fillStyle = '#f00'; + assert_equals(ctx.fillStyle, '#ff0000'); + ctx.fillStyle = 'currentColor'; + assert_equals(ctx.fillStyle, '#000000'); + ctx.strokeStyle = '#f00'; + assert_equals(ctx.strokeStyle, '#ff0000'); + ctx.strokeStyle = 'currentColor'; + assert_equals(ctx.strokeStyle, '#000000'); + assert_equals(tryLinearGradientColor('#f00'), '255,0,0,255'); + assert_equals(tryLinearGradientColor('currentColor'), '0,0,0,255'); + assert_equals(tryRadialGradientColor('#f00'), '255,0,0,255'); + assert_equals(tryRadialGradientColor('currentColor'), '0,0,0,255'); + + // Attach to the document and set the canvas's color to #123456 + assert_equals(attachCanvasToDocument(), true); + canvas.style.color = '#123456'; + assert_equals(canvas.style.color, 'rgb(18, 52, 86)'); + + // 'currentColor' should now mean #123456 + ctx.shadowColor = '#f00'; + assert_equals(ctx.shadowColor, '#ff0000'); + ctx.shadowColor = 'currentColor'; + assert_equals(ctx.shadowColor, '#123456'); + ctx.fillStyle = '#f00'; + assert_equals(ctx.fillStyle, '#ff0000'); + ctx.fillStyle = 'currentColor'; + assert_equals(ctx.fillStyle, '#123456'); + ctx.strokeStyle = '#f00'; + assert_equals(ctx.strokeStyle, '#ff0000'); + ctx.strokeStyle = 'currentColor'; + assert_equals(ctx.strokeStyle, '#123456'); + assert_equals(tryLinearGradientColor('#f00'), '255,0,0,255'); + assert_equals(tryLinearGradientColor('currentColor'), '0,0,0,255'); + assert_equals(tryRadialGradientColor('#f00'), '255,0,0,255'); + assert_equals(tryRadialGradientColor('currentColor'), '0,0,0,255'); + + // Last but not least, verify that we're case insensitive + ctx.shadowColor = '#f00'; + assert_equals(ctx.shadowColor, '#ff0000'); + ctx.shadowColor = 'CURRENTCOLOR'; + assert_equals(ctx.shadowColor, '#123456'); +}, "Test that CanvasRenderingContext2D supports the 'currentColor' value."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform-expected.txt deleted file mode 100644 index 0ec2e26e..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform-expected.txt +++ /dev/null
@@ -1,608 +0,0 @@ -Series of tests to ensure correct behaviour of canvas.currentTransform - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Check initial currentTransform values -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -Changing matrix should not affect the CTM -PASS ctx.currentTransform.a is 1 -PASS ctx.currentTransform.b is 0 -PASS ctx.currentTransform.c is 0 -PASS ctx.currentTransform.d is 1 -PASS ctx.currentTransform.e is 0 -PASS ctx.currentTransform.f is 0 -Reset the CTM to the initial matrix -PASS matrix.a is 0.5 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0.5 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -currentTransform should not affect the current path -PASS matrix.a is 0.5 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0.5 -PASS matrix.e is 10 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -currentTransform should not affect the CTM outside of save() and restore() -PASS matrix.a is 0.5 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0.5 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -stop drawing on not-invertible CTM -PASS matrix.a is 0 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -currentTransform with a not-invertible matrix should only stop the drawing up to the next restore() -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS matrix.a is 0 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 0 -PASS imgdata[6] is 255 -currentTransform should set transform although CTM is not-invertible -PASS matrix.a is 0 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -PASS imgdata[4] is 0 -PASS imgdata[5] is 0 -PASS imgdata[6] is 255 -Check that non-invertible transforms are reflected in currentTransform -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 1 -PASS matrix.f is 2 -PASS matrix.a is 0 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 0 -PASS matrix.e is 1 -PASS matrix.f is 2 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 0 -PASS matrix.f is 0 -Check assigning an invalid object throws exception as expected -PASS ctx.currentTransform = ctx threw exception TypeError: Failed to set the 'currentTransform' property on 'CanvasRenderingContext2D': The provided value is not of type 'SVGMatrix'.. -PASS ctx.currentTransform = undefined threw exception TypeError: Failed to set the 'currentTransform' property on 'CanvasRenderingContext2D': The provided value is not of type 'SVGMatrix'.. -PASS ctx.currentTransform = null threw exception TypeError: Failed to set the 'currentTransform' property on 'CanvasRenderingContext2D': The provided value is not of type 'SVGMatrix'.. -Check handling non-finite values. see 2d.transformation.setTransform.nonfinite.html -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS matrix.a is 1 -PASS matrix.b is 0 -PASS matrix.c is 0 -PASS matrix.d is 1 -PASS matrix.e is 100 -PASS matrix.f is 10 -PASS imgdata[4] is 0 -PASS imgdata[5] is 128 -PASS imgdata[6] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform.html index e9ed6b2..1790a95 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-currentTransform.html
@@ -1,9 +1,329 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-currentTransform.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + var matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + + function setCurrentTransform(ctx, a, b, c, d, e, f) + { + matrix.a = a; + matrix.b = b; + matrix.c = c; + matrix.d = d; + matrix.e = e; + matrix.f = f; + ctx.currentTransform = matrix; + matrix.a = NaN; + matrix.b = NaN; + matrix.c = NaN; + matrix.d = NaN; + matrix.e = NaN; + matrix.f = NaN; + matrix = ctx.currentTransform; + assert_equals(matrix.a, a); + assert_equals(matrix.b, b); + assert_equals(matrix.c, c); + assert_equals(matrix.d, d); + assert_equals(matrix.e, e); + assert_equals(matrix.f, f); + } + + matrix.a = 2; + + assert_equals(ctx.currentTransform.a, 1); + assert_equals(ctx.currentTransform.b, 0); + assert_equals(ctx.currentTransform.c, 0); + assert_equals(ctx.currentTransform.d, 1); + assert_equals(ctx.currentTransform.e, 0); + assert_equals(ctx.currentTransform.f, 0); + + + ctx.beginPath(); + ctx.scale(0.5, 0.5); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 0.5); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 0.5); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 100, 100); + + var imageData = ctx.getImageData(1, 1, 98, 98); + var imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); + + + ctx.beginPath(); + ctx.rect(0,0,100,100); + ctx.save(); + setCurrentTransform(ctx, 0.5, 0, 0, 0.5, 10, 10); + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + ctx.restore(); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); + + + ctx.beginPath(); + ctx.fillStyle = 'green'; + ctx.save(); + setCurrentTransform(ctx, 0.5, 0, 0, 0.5, 0, 0); + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + ctx.restore(); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + ctx.fillRect(0, 0, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); + + + ctx.beginPath(); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 100, 100); + setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); + + + ctx.beginPath(); + ctx.resetTransform(); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + ctx.save(); + setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + ctx.restore(); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 0); + assert_equals(matrix.f, 0); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 0); + assert_equals(imgdata[6], 255); + + ctx.beginPath(); + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 100, 100); + setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 0); + assert_equals(imgdata[6], 255); + + setCurrentTransform(ctx, 1, 0, 0, 1, 1, 2); + ctx.scale(0, 0); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 0); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 0); + assert_equals(matrix.e, 1); + assert_equals(matrix.f, 2); + setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); + + // throws: TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'. + assert_throws(null, function() {ctx.currentTransform = ctx;}); + // throws: TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'. + assert_throws(null, function() {ctx.currentTransform = undefined;}); + // throws: TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'. + assert_throws(null, function() {ctx.currentTransform = null;}); + + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 100, 100); + + function setCurrentTransformToNonfinite(parameters) + { + ctx = parameters[0]; + matrix.a = parameters[1]; + matrix.b = parameters[2]; + matrix.c = parameters[3]; + matrix.d = parameters[4]; + matrix.e = parameters[5]; + matrix.f = parameters[6]; + ctx.currentTransform = matrix; + matrix.a = NaN; + matrix.b = NaN; + matrix.c = NaN; + matrix.d = NaN; + matrix.e = NaN; + matrix.f = NaN; + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 100); + assert_equals(matrix.f, 10); + } + + ctx.translate(100, 10); + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 100); + assert_equals(matrix.f, 10); + + testScenarios = [ + ['Case 1' , [ctx, Infinity, 0, 0, 0, 0, 0]], + ['Case 2' , [ctx, -Infinity, 0, 0, 0, 0, 0]], + ['Case 3' , [ctx, NaN, 0, 0, 0, 0, 0]], + ['Case 4' , [ctx, 0, Infinity, 0, 0, 0, 0]], + ['Case 5' , [ctx, 0, -Infinity, 0, 0, 0, 0]], + ['Case 6' , [ctx, 0, NaN, 0, 0, 0, 0]], + ['Case 7' , [ctx, 0, 0, Infinity, 0, 0, 0]], + ['Case 8' , [ctx, 0, 0, -Infinity, 0, 0, 0]], + ['Case 9' , [ctx, 0, 0, NaN, 0, 0, 0]], + ['Case 10' , [ctx, 0, 0, 0, Infinity, 0, 0]], + ['Case 11' , [ctx, 0, 0, 0, -Infinity, 0, 0]], + ['Case 12' , [ctx, 0, 0, 0, NaN, 0, 0]], + ['Case 13' , [ctx, 0, 0, 0, 0, Infinity, 0]], + ['Case 14' , [ctx, 0, 0, 0, 0, -Infinity, 0]], + ['Case 15' , [ctx, 0, 0, 0, 0, NaN, 0]], + ['Case 16' , [ctx, 0, 0, 0, 0, 0, Infinity]], + ['Case 17' , [ctx, 0, 0, 0, 0, 0, -Infinity]], + ['Case 18' , [ctx, 0, 0, 0, 0, 0, NaN]], + ['Case 19' , [ctx, Infinity, Infinity, 0, 0, 0, 0]], + ['Case 20' , [ctx, Infinity, Infinity, Infinity, 0, 0, 0]], + ['Case 21' , [ctx, Infinity, Infinity, Infinity, Infinity, 0, 0]], + ['Case 22' , [ctx, Infinity, Infinity, Infinity, Infinity, Infinity, 0]], + ['Case 23' , [ctx, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity]], + ['Case 24' , [ctx, Infinity, Infinity, Infinity, Infinity, 0, Infinity]], + ['Case 25' , [ctx, Infinity, Infinity, Infinity, 0, Infinity, 0]], + ['Case 26' , [ctx, Infinity, Infinity, Infinity, 0, Infinity, Infinity]], + ['Case 27' , [ctx, Infinity, Infinity, Infinity, 0, 0, Infinity]], + ['Case 28' , [ctx, Infinity, Infinity, 0, Infinity, 0, 0]], + ['Case 29' , [ctx, Infinity, Infinity, 0, Infinity, Infinity, 0]], + ['Case 30' , [ctx, Infinity, Infinity, 0, Infinity, Infinity, Infinity]], + ['Case 31' , [ctx, Infinity, Infinity, 0, Infinity, 0, Infinity]], + ['Case 32' , [ctx, Infinity, Infinity, 0, 0, Infinity, 0]], + ['Case 33' , [ctx, Infinity, Infinity, 0, 0, Infinity, Infinity]], + ['Case 34' , [ctx, Infinity, Infinity, 0, 0, 0, Infinity]], + ['Case 35' , [ctx, Infinity, 0, Infinity, 0, 0, 0]], + ['Case 36' , [ctx, Infinity, 0, Infinity, Infinity, 0, 0]], + ['Case 37' , [ctx, Infinity, 0, Infinity, Infinity, Infinity, 0]], + ['Case 38' , [ctx, Infinity, 0, Infinity, Infinity, Infinity, Infinity]], + ['Case 39' , [ctx, Infinity, 0, Infinity, Infinity, 0, Infinity]], + ['Case 40' , [ctx, Infinity, 0, Infinity, 0, Infinity, 0]], + ['Case 41' , [ctx, Infinity, 0, Infinity, 0, Infinity, Infinity]], + ['Case 42' , [ctx, Infinity, 0, Infinity, 0, 0, Infinity]], + ['Case 43' , [ctx, Infinity, 0, 0, Infinity, 0, 0]], + ['Case 44' , [ctx, Infinity, 0, 0, Infinity, Infinity, 0]], + ['Case 45' , [ctx, Infinity, 0, 0, Infinity, Infinity, Infinity]], + ['Case 46' , [ctx, Infinity, 0, 0, Infinity, 0, Infinity]], + ['Case 47' , [ctx, Infinity, 0, 0, 0, Infinity, 0]], + ['Case 48' , [ctx, Infinity, 0, 0, 0, Infinity, Infinity]], + ['Case 49' , [ctx, Infinity, 0, 0, 0, 0, Infinity]], + ['Case 50' , [ctx, 0, Infinity, Infinity, 0, 0, 0]], + ['Case 51' , [ctx, 0, Infinity, Infinity, Infinity, 0, 0]], + ['Case 52' , [ctx, 0, Infinity, Infinity, Infinity, Infinity, 0]], + ['Case 53' , [ctx, 0, Infinity, Infinity, Infinity, Infinity, Infinity]], + ['Case 54' , [ctx, 0, Infinity, Infinity, Infinity, 0, Infinity]], + ['Case 55' , [ctx, 0, Infinity, Infinity, 0, Infinity, 0]], + ['Case 56' , [ctx, 0, Infinity, Infinity, 0, Infinity, Infinity]], + ['Case 57' , [ctx, 0, Infinity, Infinity, 0, 0, Infinity]], + ['Case 58' , [ctx, 0, Infinity, 0, Infinity, 0, 0]], + ['Case 59' , [ctx, 0, Infinity, 0, Infinity, Infinity, 0]], + ['Case 60' , [ctx, 0, Infinity, 0, Infinity, Infinity, Infinity]], + ['Case 61' , [ctx, 0, Infinity, 0, Infinity, 0, Infinity]], + ['Case 62' , [ctx, 0, Infinity, 0, 0, Infinity, 0]], + ['Case 63' , [ctx, 0, Infinity, 0, 0, Infinity, Infinity]], + ['Case 64' , [ctx, 0, Infinity, 0, 0, 0, Infinity]], + ['Case 65' , [ctx, 0, 0, Infinity, Infinity, 0, 0]], + ['Case 66' , [ctx, 0, 0, Infinity, Infinity, Infinity, 0]], + ['Case 67' , [ctx, 0, 0, Infinity, Infinity, Infinity, Infinity]], + ['Case 68' , [ctx, 0, 0, Infinity, Infinity, 0, Infinity]], + ['Case 69' , [ctx, 0, 0, Infinity, 0, Infinity, 0]], + ['Case 70' , [ctx, 0, 0, Infinity, 0, Infinity, Infinity]], + ['Case 71' , [ctx, 0, 0, Infinity, 0, 0, Infinity]], + ['Case 72' , [ctx, 0, 0, 0, Infinity, Infinity, 0]], + ['Case 73' , [ctx, 0, 0, 0, Infinity, Infinity, Infinity]], + ['Case 74' , [ctx, 0, 0, 0, Infinity, 0, Infinity]], + ['Case 75' , [ctx, 0, 0, 0, 0, Infinity, Infinity]] + ] + generate_tests(setCurrentTransformToNonfinite, testScenarios); + + matrix = ctx.currentTransform; + assert_equals(matrix.a, 1); + assert_equals(matrix.b, 0); + assert_equals(matrix.c, 0); + assert_equals(matrix.d, 1); + assert_equals(matrix.e, 100); + assert_equals(matrix.f, 10); + + ctx.fillStyle = 'green'; + ctx.fillRect(-100, -10, 100, 100); + + imageData = ctx.getImageData(1, 1, 98, 98); + imgdata = imageData.data; + assert_equals(imgdata[4], 0); + assert_equals(imgdata[5], 128); + assert_equals(imgdata[6], 0); +}, "Series of tests to ensure correct behaviour of canvas.currentTransform"); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius-expected.txt deleted file mode 100644 index 3edfbffb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -Tests CanvasPathMethods ellipse with negative radii. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false) did not throw exception. -PASS ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false) did not throw exception. -PASS ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false) did not throw exception. -PASS ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false) threw exception IndexSizeError: Failed to execute 'ellipse' on 'CanvasRenderingContext2D': The major-axis radius provided (-2) is negative.. -PASS ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false) threw exception IndexSizeError: Failed to execute 'ellipse' on 'CanvasRenderingContext2D': The minor-axis radius provided (-1.5) is negative.. -PASS ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false) threw exception IndexSizeError: Failed to execute 'ellipse' on 'CanvasRenderingContext2D': The major-axis radius provided (-2) is negative.. -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius.html index f07b5314..f934358 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-negative-radius.html
@@ -1,27 +1,20 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<p id="description"></p> -<div id="console"></div> - <script> -description("Tests CanvasPathMethods ellipse with negative radii."); - -var canvas = document.createElement("canvas"); -var ctx = canvas.getContext('2d'); - -shouldNotThrow("ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false)"); -shouldNotThrow("ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false)"); -shouldNotThrow("ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false)"); - -shouldThrow("ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false)"); -shouldThrow("ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false)"); -shouldThrow("ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false)"); - -// FIXME: When this is exposed on Path as well as CanvasRenderingContext2D, add tests for Path as well. +test(function(t) { + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false); + ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false); + ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false); + + assert_throws(null, function() {ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false);}); + assert_throws(null, function() {ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false);}); + assert_throws(null, function() {ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false);}); + + // FIXME: When this is exposed on Path as well as CanvasRenderingContext2D, add tests for Path as well. +}, 'Tests CanvasPathMethods ellipse with negative radii.'); </script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto-expected.txt deleted file mode 100644 index bdd2512..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto-expected.txt +++ /dev/null
@@ -1,82 +0,0 @@ -This tests checks that ellipse can draw lines correctly in edge cases. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imageData.data[1] is 255 -moveTo + empty ellipse (swing == 0) -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -moveTo + empty ellipse (radiusX == 0) -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -moveTo + empty ellipse (radiusY == 0) -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -empty ellipse (swing == 0) + lineTo -PASS imageData.data[1] is 255 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -empty ellipse (radiusX == 0) + lineTo -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -empty ellipse (radiusY == 0) + lineTo -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -lineTo + empty ellipse (radiusX == 0) + lineTo - 1. sweepAngle < PI / 2 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 2. sweepAngle < PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 3. sweepAngle < 2PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 4. sweepAngle < 4PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 255 - 5. sweepAngle > 4PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 255 -lineTo + empty ellipse (radiusY == 0) + lineTo - 1. sweepAngle < PI / 2 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 2. sweepAngle < PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 255 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 3. sweepAngle < 2PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 4. sweepAngle < 4PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 - 5. sweepAngle > 4PI -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS imageData.data[1] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto.html index 631a7f95..dcd1f8e 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-ellipse-zero-lineto.html
@@ -1,313 +1,312 @@ -<!DOCTYPE html> <html> -<head></head> -<body> +<head><body> <canvas id="mycanvas" width="400" height="400"></canvas> -<script src="../../resources/js-test.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <script> -description("This tests checks that ellipse can draw lines correctly in edge cases."); -var canvas = document.getElementById('mycanvas'); -var ctx = canvas.getContext('2d'); - -var zero = 0; -ctx.lineWidth = 5; -ctx.fillStyle = 'rgb(255, 255, 255)'; -ctx.strokeStyle = 'rgb(0, 0, 0)'; -ctx.fillRect(0, 0, canvas.width, canvas.height); - -var imageData = ctx.getImageData(1, 1, 1, 1); -var data = imageData.data; -shouldBe("imageData.data[1]", "255"); - -ctx.save(); -debug("moveTo + empty ellipse (swing == 0)"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(20, 0); -ctx.ellipse(80, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2 + zero, false); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(23, 29, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(85, 14, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug("moveTo + empty ellipse (radiusX == 0)"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(20, 0); -ctx.ellipse(80, 0, zero, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(22, 60, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(86, 43, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(71, 73, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug("moveTo + empty ellipse (radiusY == 0)"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(20, 0); -ctx.ellipse(80, 0, 10, zero, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(22, 90, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(79, 90, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(87, 94, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug("empty ellipse (swing == 0) + lineTo"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.ellipse(20, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2 + zero, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(26, 101, 1, 1); -shouldBe("imageData.data[1]", "255"); -imageData = ctx.getImageData(32, 103, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(77, 119, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug("empty ellipse (radiusX == 0) + lineTo"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(28, 135, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(11, 166, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(76, 151, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug("empty ellipse (radiusY == 0) + lineTo"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.ellipse(20, 0, 10, zero, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(27, 183, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(21, 179, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(77, 180, 1, 1); -shouldBe("imageData.data[1]", "0"); - -ctx.restore(); - -ctx.translate(100, 0); -ctx.save(); -debug("lineTo + empty ellipse (radiusX == 0) + lineTo"); -debug(" 1. sweepAngle < PI / 2"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI / 4, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(110, 29, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(122, 22, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(113, 42, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(144, 38, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 2. sweepAngle < PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(122, 54, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(112, 76, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(142, 70, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 3. sweepAngle < 2PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 3 / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(115, 86, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(110, 104, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(138, 77, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 4. sweepAngle < 4PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(115, 116, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(111, 136, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(127, 106, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(127, 121, 1, 1); -shouldBe("imageData.data[1]", "255"); - -debug(" 5. sweepAngle > 4PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 16, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(115, 146, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(111, 166, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(127, 136, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(127, 151, 1, 1); -shouldBe("imageData.data[1]", "255"); - -ctx.restore(); - -ctx.translate(100, 0); -ctx.save(); -debug("lineTo + empty ellipse (radiusY == 0) + lineTo"); -debug(" 1. sweepAngle < PI / 2"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI / 4, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(213, 32, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(234, 39, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(240, 36, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 2. sweepAngle < PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(232, 69, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(238, 72, 1, 1); -shouldBe("imageData.data[1]", "255"); -imageData = ctx.getImageData(228, 65, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(242, 61, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 3. sweepAngle < 2PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 3 / 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(204, 82, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(234, 100, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(212, 92, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(240, 90, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 4. sweepAngle < 4PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 2, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(208, 114, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(235, 130, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(210, 120, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(252, 124, 1, 1); -shouldBe("imageData.data[1]", "0"); - -debug(" 5. sweepAngle > 4PI"); -ctx.translate(0, 30); -ctx.save(); -ctx.beginPath(); -ctx.lineTo(10, 0); -ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 16, false); -ctx.lineTo(80, 0); -ctx.stroke(); -ctx.restore(); - -imageData = ctx.getImageData(208, 144, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(235, 160, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(210, 150, 1, 1); -shouldBe("imageData.data[1]", "0"); -imageData = ctx.getImageData(252, 154, 1, 1); -shouldBe("imageData.data[1]", "0"); - +test(function(t) { + var canvas = document.getElementById('mycanvas'); + var ctx = canvas.getContext('2d'); + + var zero = 0; + ctx.lineWidth = 5; + ctx.fillStyle = 'rgb(255, 255, 255)'; + ctx.strokeStyle = 'rgb(0, 0, 0)'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + var imageData = ctx.getImageData(1, 1, 1, 1); + var data = imageData.data; + assert_equals(imageData.data[1], 255); + + ctx.save(); + // moveTo + empty ellipse (swing == 0) + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.moveTo(20, 0); + ctx.ellipse(80, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2 + zero, false); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(23, 29, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(85, 14, 1, 1); + assert_equals(imageData.data[1], 0); + + // moveTo + empty ellipse (radiusX == 0) + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.moveTo(20, 0); + ctx.ellipse(80, 0, zero, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(22, 60, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(86, 43, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(71, 73, 1, 1); + assert_equals(imageData.data[1], 0); + + // moveTo + empty ellipse (radiusY == 0) + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.moveTo(20, 0); + ctx.ellipse(80, 0, 10, zero, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(22, 90, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(79, 90, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(87, 94, 1, 1); + assert_equals(imageData.data[1], 0); + + // empty ellipse (swing == 0) + lineTo + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.ellipse(20, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2 + zero, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(26, 101, 1, 1); + assert_equals(imageData.data[1], 255); + imageData = ctx.getImageData(32, 103, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(77, 119, 1, 1); + assert_equals(imageData.data[1], 0); + + // empty ellipse (radiusX == 0) + lineTo + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(28, 135, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(11, 166, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(76, 151, 1, 1); + assert_equals(imageData.data[1], 0); + + // empty ellipse (radiusY == 0) + lineTo + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.ellipse(20, 0, 10, zero, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(27, 183, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(21, 179, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(77, 180, 1, 1); + assert_equals(imageData.data[1], 0); + + ctx.restore(); + + ctx.translate(100, 0); + ctx.save(); + // lineTo + empty ellipse (radiusX == 0) + lineTo + // 1. sweepAngle < PI / 2 + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI / 4, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(110, 29, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(122, 22, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(113, 42, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(144, 38, 1, 1); + assert_equals(imageData.data[1], 0); + + // 2. sweepAngle < PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(122, 54, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(112, 76, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(142, 70, 1, 1); + assert_equals(imageData.data[1], 0); + + // 3. sweepAngle < 2PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 3 / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(115, 86, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(110, 104, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(138, 77, 1, 1); + assert_equals(imageData.data[1], 0); + + // 4. sweepAngle < 4PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(115, 116, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(111, 136, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(127, 106, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(127, 121, 1, 1); + assert_equals(imageData.data[1], 255); + + // 5. sweepAngle > 4PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, zero, 20, Math.PI / 6, -Math.PI / 4, Math.PI * 16, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(115, 146, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(111, 166, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(127, 136, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(127, 151, 1, 1); + assert_equals(imageData.data[1], 255); + + ctx.restore(); + + ctx.translate(100, 0); + ctx.save(); + // lineTo + empty ellipse (radiusY == 0) + lineTo + // 1. sweepAngle < PI / 2 + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI / 4, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(213, 32, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(234, 39, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(240, 36, 1, 1); + assert_equals(imageData.data[1], 0); + + // 2. sweepAngle < PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(232, 69, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(238, 72, 1, 1); + assert_equals(imageData.data[1], 255); + imageData = ctx.getImageData(228, 65, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(242, 61, 1, 1); + assert_equals(imageData.data[1], 0); + + // 3. sweepAngle < 2PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 3 / 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(204, 82, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(234, 100, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(212, 92, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(240, 90, 1, 1); + assert_equals(imageData.data[1], 0); + + // 4. sweepAngle < 4PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 2, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(208, 114, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(235, 130, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(210, 120, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(252, 124, 1, 1); + assert_equals(imageData.data[1], 0); + + // 5. sweepAngle > 4PI + ctx.translate(0, 30); + ctx.save(); + ctx.beginPath(); + ctx.lineTo(10, 0); + ctx.ellipse(20, 0, 20, zero, Math.PI / 6, -Math.PI / 4, Math.PI * 16, false); + ctx.lineTo(80, 0); + ctx.stroke(); + ctx.restore(); + + imageData = ctx.getImageData(208, 144, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(235, 160, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(210, 150, 1, 1); + assert_equals(imageData.data[1], 0); + imageData = ctx.getImageData(252, 154, 1, 1); + assert_equals(imageData.data[1], 0); +}, 'This tests checks that ellipse can draw lines correctly in edge cases.'); </script> </body> </html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern-expected.txt deleted file mode 100644 index a40dedf..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern-expected.txt +++ /dev/null
@@ -1,2 +0,0 @@ -TEST PASSED -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern.html index 94390501..bc20d97 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-empty-image-pattern.html
@@ -1,15 +1,11 @@ -<!DOCTYPE HTML> -<title>Canvas test: filling a pattern with an empty image should not crash and should return a null pattern.</title> -<div id="console"></div> -<canvas id="canvas" class="output" width="100" height="100"><p class="fallback">FAIL (fallback content)</p></canvas> -<script> -if (window.testRunner) - testRunner.dumpAsText(); +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<canvas id="canvas" width="100" height="100"></canvas> -var canvas = document.getElementById("canvas").getContext("2d"); -var pattern = canvas.createPattern(new Image, "repeat") -if (pattern) - document.getElementById("console").innerHTML = "TEST FAILED"; -else - document.getElementById("console").innerHTML = "TEST PASSED"; +<script> +test(function(t) { + var ctx = document.getElementById("canvas").getContext("2d"); + var pattern = ctx.createPattern(new Image, "repeat") + assert_equals(pattern, null); +}, 'Test if filling a pattern with an empty image does not crash and returns a null pattern.'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt deleted file mode 100644 index 956e134..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt +++ /dev/null
@@ -1,27 +0,0 @@ -Series of tests to ensure correct results of the winding rule. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Testing default fill -PASS pixelDataAtPoint()[0] is within 5 of 0 -PASS pixelDataAtPoint()[1] is within 5 of 255 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -Testing nonzero fill -PASS pixelDataAtPoint()[0] is within 5 of 0 -PASS pixelDataAtPoint()[1] is within 5 of 255 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -Testing evenodd fill -PASS pixelDataAtPoint()[0] is within 5 of 255 -PASS pixelDataAtPoint()[1] is within 5 of 0 -PASS pixelDataAtPoint()[2] is within 5 of 0 -PASS pixelDataAtPoint()[3] is within 5 of 255 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html index b25a883..1669213 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html
@@ -1,8 +1,58 @@ -<!doctype html> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fill-rule.js"></script> +<script> + +var tmpimg = document.createElement('canvas'); +tmpimg.width = 200; +tmpimg.height = 200; +ctx = tmpimg.getContext('2d'); + +// Create the image for blending test with images. +var img = document.createElement('canvas'); +img.width = 100; +img.height = 100; +var imgCtx = img.getContext('2d'); + +function checkResult(expectedColors, sigma) { + var pixel = ctx.getImageData(50, 50, 1, 1).data; + for (var i = 0; i < 4; i++) + assert_approx_equals(pixel[i], expectedColors[i], sigma); +} + +test(function(t) { + // Testing default fill + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.fill(); + checkResult([0, 255, 0, 255], 5); + + // Testing nonzero fill + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.fill('nonzero'); + checkResult([0, 255, 0, 255], 5); + + // Testing evenodd fill + ctx.fillStyle = 'rgb(255,0,0)'; + ctx.beginPath(); + ctx.fillRect(0, 0, 100, 100); + ctx.fillStyle = 'rgb(0,255,0)'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + ctx.fill('evenodd'); + checkResult([255, 0, 0, 255], 5); +}, "Series of tests to ensure correct results of the winding rule."); +</script> </body> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt deleted file mode 100644 index c213889..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Series of tests to ensure that fill() paints nothing on canvas when the fillStyle is set to a zero-size gradient. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html index d830dd1..4a7a3d3 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html
@@ -1,9 +1,26 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fill-zeroSizeGradient.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + + var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); + g.addColorStop(0, '#f00'); + g.addColorStop(1, '#f00'); + ctx.fillStyle = g; + ctx.font = '1px sans-serif'; + ctx.fillText("AA", 0, 1); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + +}, "Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow-expected.txt deleted file mode 100644 index ef7d6cdf..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow-expected.txt +++ /dev/null
@@ -1,97 +0,0 @@ -Ensure correct behavior of canvas with fillPath using a fillStyle color with alpha and a shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Verifying alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -Verifying rotated alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying rotated blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow.html index 324e67b..e3daded 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-alpha-shadow.html
@@ -1,9 +1,85 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillPath-alpha-shadow.js"></script> +<script> +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '600'); +canvas.setAttribute('height', '1100'); +var ctx = canvas.getContext('2d'); + +ctx.save(); +ctx.fillStyle = 'rgba(0, 0, 255, 0.5)'; +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)'; +ctx.shadowOffsetX = 250; + +function fillShape(x, y) { + ctx.beginPath(); + ctx.arc(x, y, 100, 0, Math.PI*2, true); + ctx.arc(x, y, 50, 0, Math.PI*2, false); + ctx.fill(); +} + +// Alpha shadow. +ctx.shadowBlur = 0; +fillShape(150, 150); + +// Blurry shadow. +ctx.shadowBlur = 10; +fillShape(150, 400); + +ctx.rotate(Math.PI/2); + +// Rotated alpha shadow. +ctx.shadowBlur = 0; +fillShape(650, -150); + +// Rotated blurry shadow. +ctx.shadowBlur = 10; +fillShape(900, -150); + +ctx.restore(); +ctx.fillStyle = 'black'; + +function testPixelShadow(pixel, reference, alphaApprox) { + var testPassed = true; + for(i = 0; i < 3; i++) + if(pixel[i] != reference[i]) { + testPassed = false; + break; + } + assert_true(testPassed); + assert_approx_equals(pixel[3], reference[3], alphaApprox); +} + +testScenarios = + [ + ['TestAlphaShadow 1', ctx.getImageData(400, 150, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestAlphaShadow 2', ctx.getImageData(400, 75, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 3', ctx.getImageData(400, 225, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 4', ctx.getImageData(325, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 5', ctx.getImageData(475, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestBlurryShadow 1', ctx.getImageData(400, 400, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestBlurryShadow 2', ctx.getImageData(400, 300, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 3', ctx.getImageData(400, 500, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 4', ctx.getImageData(300, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 5', ctx.getImageData(500, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + + ['TestRotatedAlphaShadow 1', ctx.getImageData(400, 650, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedAlphaShadow 2', ctx.getImageData(400, 575, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 3', ctx.getImageData(400, 725, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 4', ctx.getImageData(325, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 5', ctx.getImageData(475, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestRotatedBlurryShadow 1', ctx.getImageData(400, 900, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedBlurryShadow 2', ctx.getImageData(400, 800, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 3', ctx.getImageData(400, 1000, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 4', ctx.getImageData(300, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 5', ctx.getImageData(500, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ]; + +generate_tests(testPixelShadow, testScenarios); + + </script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow-expected.txt deleted file mode 100644 index a2ebbdb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow-expected.txt +++ /dev/null
@@ -1,97 +0,0 @@ -Ensure correct behavior of canvas with fillPath using a gradient fillStyle and a shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Verifying alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -Verifying rotated alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying rotated blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html index 93346e3..842509f 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
@@ -1,9 +1,89 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillPath-gradient-shadow.js"></script> +<script> +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '600'); +canvas.setAttribute('height', '1100'); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 300, 0); +gradient.addColorStop(0, 'rgba(0, 0, 255, 0.5)'); +gradient.addColorStop(1, 'rgba(0, 0, 255, 0.5)'); + +ctx.save(); +ctx.fillStyle = gradient; +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)'; +ctx.shadowOffsetX = 250; + +function fillShape(x, y) { + ctx.beginPath(); + ctx.arc(x, y, 100, 0, Math.PI*2, true); + ctx.arc(x, y, 50, 0, Math.PI*2, false); + ctx.fill(); +} + +// Alpha shadow. +ctx.shadowBlur = 0; +fillShape(150, 150); + +// Blurry shadow. +ctx.shadowBlur = 10; +fillShape(150, 400); + +ctx.rotate(Math.PI/2); + +// Rotated alpha shadow. +ctx.shadowBlur = 0; +fillShape(650, -150); + +// Rotated blurry shadow. +ctx.shadowBlur = 10; +fillShape(900, -150); + +ctx.restore(); +ctx.fillStyle = 'black'; + +function testPixelShadow(pixel, reference, alphaApprox) { + var testPassed = true; + for(i = 0; i < 3; i++) + if(pixel[i] != reference[i]) { + testPassed = false; + break; + } + assert_true(testPassed); + assert_approx_equals(pixel[3], reference[3], alphaApprox); +} + +testScenarios = + [ + ['TestAlphaShadow 1', ctx.getImageData(400, 150, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestAlphaShadow 2', ctx.getImageData(400, 75, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 3', ctx.getImageData(400, 225, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 4', ctx.getImageData(325, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 5', ctx.getImageData(475, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestBlurryShadow 1', ctx.getImageData(400, 400, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestBlurryShadow 2', ctx.getImageData(400, 300, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 3', ctx.getImageData(400, 500, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 4', ctx.getImageData(300, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 5', ctx.getImageData(500, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + + ['TestRotatedAlphaShadow 1', ctx.getImageData(400, 650, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedAlphaShadow 2', ctx.getImageData(400, 575, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 3', ctx.getImageData(400, 725, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 4', ctx.getImageData(325, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 5', ctx.getImageData(475, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestRotatedBlurryShadow 1', ctx.getImageData(400, 900, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedBlurryShadow 2', ctx.getImageData(400, 800, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 3', ctx.getImageData(400, 1000, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 4', ctx.getImageData(300, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 5', ctx.getImageData(500, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ]; + +generate_tests(testPixelShadow, testScenarios); + + </script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow-expected.txt deleted file mode 100644 index 3567ae17..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow-expected.txt +++ /dev/null
@@ -1,97 +0,0 @@ -Ensure correct behavior of canvas with fillPath using a pattern fillStyle and a shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Verifying alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -Verifying rotated alpha shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 64 - -Verifying rotated blurry shadow... -PASS data[0] is 0 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] is around 31 - -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow.html index dd5f0089..a26efc8 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-pattern-shadow.html
@@ -1,9 +1,95 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillPath-pattern-shadow.js"></script> +<script> +var aCanvas = document.createElement('canvas'); +aCanvas.setAttribute('width', '50'); +aCanvas.setAttribute('height', '50'); + +var aCtx = aCanvas.getContext('2d'); +aCtx.fillStyle = 'rgba(0, 0, 255, 0.5)'; +aCtx.fillRect(0, 0, 50, 50); + +var pattern = aCtx.createPattern(aCanvas, 'repeat'); + +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '600'); +canvas.setAttribute('height', '1100'); +var ctx = canvas.getContext('2d'); + +ctx.save(); +ctx.fillStyle = pattern; +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)'; +ctx.shadowOffsetX = 250; + +function fillShape(x, y) { + ctx.beginPath(); + ctx.arc(x, y, 100, 0, Math.PI*2, true); + ctx.arc(x, y, 50, 0, Math.PI*2, false); + ctx.fill(); +} + +// Alpha shadow. +ctx.shadowBlur = 0; +fillShape(150, 150); + +// Blurry shadow. +ctx.shadowBlur = 10; +fillShape(150, 400); + +ctx.rotate(Math.PI/2); + +// Rotated alpha shadow. +ctx.shadowBlur = 0; +fillShape(650, -150); + +// Rotated blurry shadow. +ctx.shadowBlur = 10; +fillShape(900, -150); + +ctx.restore(); +ctx.fillStyle = 'black'; + +function testPixelShadow(pixel, reference, alphaApprox) { + var testPassed = true; + for(i = 0; i < 3; i++) + if(pixel[i] != reference[i]) { + testPassed = false; + break; + } + assert_true(testPassed); + assert_approx_equals(pixel[3], reference[3], alphaApprox); +} + +testScenarios = + [ + ['TestAlphaShadow 1', ctx.getImageData(400, 150, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestAlphaShadow 2', ctx.getImageData(400, 75, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 3', ctx.getImageData(400, 225, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 4', ctx.getImageData(325, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestAlphaShadow 5', ctx.getImageData(475, 150, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestBlurryShadow 1', ctx.getImageData(400, 400, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestBlurryShadow 2', ctx.getImageData(400, 300, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 3', ctx.getImageData(400, 500, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 4', ctx.getImageData(300, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestBlurryShadow 5', ctx.getImageData(500, 400, 1, 1).data, [ 255, 0, 0, 31], 15], + + ['TestRotatedAlphaShadow 1', ctx.getImageData(400, 650, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedAlphaShadow 2', ctx.getImageData(400, 575, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 3', ctx.getImageData(400, 725, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 4', ctx.getImageData(325, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + ['TestRotatedAlphaShadow 5', ctx.getImageData(475, 650, 1, 1).data, [ 255, 0, 0, 64], 15], + + ['TestRotatedBlurryShadow 1', ctx.getImageData(400, 900, 1, 1).data, [ 0, 0, 0, 0, 0], 0], + ['TestRotatedBlurryShadow 2', ctx.getImageData(400, 800, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 3', ctx.getImageData(400, 1000, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 4', ctx.getImageData(300, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ['TestRotatedBlurryShadow 5', ctx.getImageData(500, 900, 1, 1).data, [ 255, 0, 0, 31], 15], + ]; + +generate_tests(testPixelShadow, testScenarios); + + </script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt deleted file mode 100644 index d494c5a..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow-expected.txt +++ /dev/null
@@ -1,37 +0,0 @@ -Ensure correct behavior of canvas with path fill shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is within 3 of 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow.html index 6c082a75..4f5ece0 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillPath-shadow.html
@@ -1,9 +1,63 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillPath-shadow.js"></script> +<script> +var greenApprox = 0; +function testPixelShadow(pixel, reference, shouldBeTransparent) { + assert_equals(pixel[0], reference[0]); + assert_approx_equals(pixel[1], reference[1], greenApprox); + assert_equals(pixel[2], reference[2]); + if(shouldBeTransparent) + assert_not_equals(pixel[3], 255); +} + +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '700'); +canvas.setAttribute('height', '700'); +var ctx = canvas.getContext('2d'); + +ctx.beginPath(); +ctx.moveTo(300, 300); +ctx.lineTo(300, 50); +ctx.bezierCurveTo(200, 40, 75, 150, 30, 30); +ctx.quadraticCurveTo(250, 75, 50, 300); +ctx.shadowOffsetX = 350; +ctx.shadowColor = 'rgba(255, 20, 0, 0.5)'; +ctx.shadowBlur = 0; +ctx.fillStyle = 'rgba(0, 0, 255, 1)'; +ctx.lineWidth = 30; +ctx.fill(); + +ctx.beginPath(); +ctx.moveTo(300,650); +ctx.lineTo(300,400); +ctx.bezierCurveTo(200, 390, 75, 500, 30, 380); +ctx.quadraticCurveTo(250, 425, 50, 650); +ctx.shadowOffsetX = 350; +ctx.shadowColor = 'rgba(255, 0, 0, 0.5)'; +ctx.shadowBlur = 30; +ctx.fillStyle = 'rgba(0, 0, 255, 1)'; +ctx.lineWidth = 30; +ctx.fill(); + +testScenarios = + [ + ['TestSolidShadow 1', ctx.getImageData(640, 290, 1, 1).data, [ 255, 20, 0, 0], false], + ['TestSolidShadow 2', ctx.getImageData(570, 85, 1, 1).data, [ 255, 20, 0, 0], false], + ['TestSolidShadow 4', ctx.getImageData(400, 40, 1, 1).data, [ 255, 20, 0, 0], false], + + ['TestBlurryShadow 1', ctx.getImageData(640, 640, 1, 1).data, [ 255, 0, 0, 0], true], + ['TestBlurryShadow 2', ctx.getImageData(650, 400, 1, 1).data, [ 255, 0, 0, 0], true], + ['TestBlurryShadow 3', ctx.getImageData(380, 380, 1, 1).data, [ 255, 0, 0, 0], true], + ['TestBlurryShadow 4', ctx.getImageData(375, 390, 1, 1).data, [ 255, 0, 0, 0], true] + ]; + +testScenarios2 = + [['TestSolidShadow 3', ctx.getImageData(380, 30, 1, 1).data, [ 255, 20, 0, 0], false]]; + +generate_tests(testPixelShadow, testScenarios); +greenApprox = 3; +generate_tests(testPixelShadow, testScenarios2); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-expected.txt deleted file mode 100644 index eb6bfbb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -Series of tests to ensure correct behavior of canvas.fillRect(). - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test canvas.fillRect() with height = width = 0. -PASS imgdata[0] is 0 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -Test canvas.fillRect() with height = 0, width = 1. -PASS imgdata[0] is 0 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -Test canvas.fillRect() with height = 1, width = 0. -PASS imgdata[0] is 0 -PASS imgdata[1] is 0 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt deleted file mode 100644 index 2f04697..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow-expected.txt +++ /dev/null
@@ -1,89 +0,0 @@ -Ensure correct behavior of canvas with fillRect using a gradient fillStyle and a shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 15 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 15 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 15 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 15 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html index d0a71780..c29d13d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-gradient-shadow.html
@@ -1,9 +1,91 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillRect-gradient-shadow.js"></script> +<script> + +var alphaApprox = 0, alphaMax = 0; +function testPixelShadow(pixel, reference) { + var testPassed = true; + for(i = 0; i < 3; i++) + if(pixel[i] != reference[i]) { + testPassed = false; + break; + } + assert_true(testPassed); + if(alphaMax != 0) + assert_true(pixel[3] < alphaMax); + else + assert_approx_equals(pixel[3], reference[3], alphaApprox); +} + +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '400'); +canvas.setAttribute('height', '650'); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 100); +gradient.addColorStop(0, 'rgba(0, 0, 255, 1.0)'); +gradient.addColorStop(1, 'rgba(0, 0, 255, 1.0)'); + +ctx.shadowOffsetX = 200; +ctx.fillStyle = gradient; + +ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; +ctx.fillRect(50, 50, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; +ctx.fillRect(50, 200, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; +ctx.shadowBlur = 5; +ctx.fillRect(50, 350, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; +ctx.fillRect(50, 500, 100, 100); + +testSolidShadow = + [ + ['testSolidShadow 1', ctx.getImageData(250, 50, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 2', ctx.getImageData(250, 149, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 3', ctx.getImageData(349, 50, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 4', ctx.getImageData(349, 149, 1, 1).data, [255, 0, 0, 255]], + ]; + +// alphaApprox = 5 +testSolidAlphaShadow = + [ + ['testSolidAlphaShadow 1', ctx.getImageData(250, 200, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 2', ctx.getImageData(250, 299, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 3', ctx.getImageData(349, 200, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 4', ctx.getImageData(349, 299, 1, 1).data, [255, 0, 0, 76]], + ]; + +// alpha < 25 +testBlurryShadow = + [ + ['testBlurryShadow 1', ctx.getImageData(248, 348, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 2', ctx.getImageData(248, 451, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 3', ctx.getImageData(351, 348, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 4', ctx.getImageData(351, 451, 1, 1).data, [255, 0, 0, 0]], + ]; + +// alpha < 10 +testBlurryAlphaShadow = + [ + ['testBlurryShadow 1', ctx.getImageData(248, 498, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 2', ctx.getImageData(248, 601, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 3', ctx.getImageData(351, 498, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 4', ctx.getImageData(351, 601, 1, 1).data, [255, 0, 0, 0]], + ]; + +generate_tests(testPixelShadow, testSolidShadow); +alphaApprox = 5; +generate_tests(testPixelShadow, testSolidAlphaShadow); +alphaMax = 25; +generate_tests(testPixelShadow, testBlurryShadow); +alphaMax = 10; +generate_tests(testPixelShadow, testBlurryAlphaShadow); + +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow-expected.txt deleted file mode 100644 index dcb23d3..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow-expected.txt +++ /dev/null
@@ -1,73 +0,0 @@ -Ensure correct behavior of canvas with fillRect shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is 255 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is around 76 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 25 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS d[0] is 255 -PASS d[1] is 0 -PASS d[2] is 0 -PASS d[3] is smaller than 10 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow.html index 500174c..1b2948a 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-shadow.html
@@ -1,9 +1,87 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillRect-shadow.js"></script> +<script> + +var alphaApprox = 0, alphaMax = 0; +function testPixelShadow(pixel, reference) { + var testPassed = true; + for(i = 0; i < 3; i++) + if(pixel[i] != reference[i]) { + testPassed = false; + break; + } + assert_true(testPassed); + if(alphaMax != 0) + assert_true(pixel[3] < alphaMax); + else + assert_approx_equals(pixel[3], reference[3], alphaApprox); +} + +var canvas = document.createElement('canvas'); +document.body.appendChild(canvas); +canvas.setAttribute('width', '400'); +canvas.setAttribute('height', '650'); +var ctx = canvas.getContext('2d'); + +ctx.shadowOffsetX = 200; +ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + +ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; +ctx.fillRect(50, 50, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; +ctx.fillRect(50, 200, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; +ctx.shadowBlur = 5; +ctx.fillRect(50, 350, 100, 100); + +ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; +ctx.fillRect(50, 500, 100, 100); + +testSolidShadow = + [ + ['testSolidShadow 1', ctx.getImageData(250, 50, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 2', ctx.getImageData(250, 149, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 3', ctx.getImageData(349, 50, 1, 1).data, [255, 0, 0, 255]], + ['testSolidShadow 4', ctx.getImageData(349, 149, 1, 1).data, [255, 0, 0, 255]], + ]; + +// alphaApprox = 5 +testSolidAlphaShadow = + [ + ['testSolidAlphaShadow 1', ctx.getImageData(250, 200, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 2', ctx.getImageData(250, 299, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 3', ctx.getImageData(349, 200, 1, 1).data, [255, 0, 0, 76]], + ['testSolidAlphaShadow 4', ctx.getImageData(349, 299, 1, 1).data, [255, 0, 0, 76]], + ]; + +// alpha < 25 +testBlurryShadow = + [ + ['testBlurryShadow 1', ctx.getImageData(248, 348, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 2', ctx.getImageData(248, 451, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 3', ctx.getImageData(351, 348, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 4', ctx.getImageData(351, 451, 1, 1).data, [255, 0, 0, 0]], + ]; + +// alpha < 10 +testBlurryAlphaShadow = + [ + ['testBlurryShadow 1', ctx.getImageData(248, 498, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 2', ctx.getImageData(248, 601, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 3', ctx.getImageData(351, 498, 1, 1).data, [255, 0, 0, 0]], + ['testBlurryShadow 4', ctx.getImageData(351, 601, 1, 1).data, [255, 0, 0, 0]], + ]; + +generate_tests(testPixelShadow, testSolidShadow); +alphaApprox = 5; +generate_tests(testPixelShadow, testSolidAlphaShadow); +alphaMax = 25; +generate_tests(testPixelShadow, testBlurryShadow); +alphaMax = 10; +generate_tests(testPixelShadow, testBlurryAlphaShadow); + + </script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt deleted file mode 100644 index b714213..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html index e24d297..ec0d2de 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html
@@ -1,9 +1,25 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillRect-zeroSizeGradient.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + + var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); + g.addColorStop(0, '#f00'); + g.addColorStop(1, '#f00'); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 1 ,1); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + +}, "Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect.html index 7079ced..b5747da 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillRect.html
@@ -1,9 +1,47 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillRect.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + // Fill rect with height = width = 0. + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 0, 0); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + + ctx.clearRect(0, 0, 1, 1); + + // Fill rect with height = 0, width = 1. + + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 1, 0); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + + ctx.clearRect(0, 0, 1, 1); + + // Fill rect with height = 1, width = 0. + + ctx.fillStyle = 'red'; + ctx.fillRect(0, 0, 0, 1); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 0); + assert_equals(imgdata[2], 0); + + ctx.clearRect(0, 0, 1, 1); +}, "Series of tests to ensure correct behavior of canvas.fillRect()."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillStyle-no-quirks-parsing.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillStyle-no-quirks-parsing.html index 9e28750..ed36c5c 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillStyle-no-quirks-parsing.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillStyle-no-quirks-parsing.html
@@ -1,14 +1,10 @@ -<!DOCTYPE html> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script> -setup(function() { - window.ctx = document.createElement('canvas').getContext('2d'); -}); - -test(function() { - ctx.fillStyle = "#008000"; - ctx.fillStyle = "800000"; - assert_equals(ctx.fillStyle, "#008000"); +test(function(t) { + ctx = document.createElement('canvas').getContext('2d'); + ctx.fillStyle = "#008000"; + ctx.fillStyle = "800000"; + assert_equals(ctx.fillStyle, "#008000"); }, 'fillStyle should not accept quirks mode hex colors.'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth-expected.txt deleted file mode 100644 index 375641f..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -Series of tests to ensure that fillText() does not display any text when maxWidth is invalid. - -On success, you will see no "FAIL" messages, followed by "TEST COMPLETE". - - -Test canvas.fillText() with maxWidth zero -Test canvas.fillText() with maxWidth -1 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth.html index a73061f..4f81ce8 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-invalid-maxWidth.html
@@ -1,10 +1,60 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillText-invalid-maxWidth.js"></script> +<script> +test(function(t) { + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var canvasWidth = 100; + var canvasHeight = 50; + canvas.setWidth = canvasWidth; + canvas.setHeight = canvasHeight; + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, canvasWidth, canvasHeight); + ctx.font = '35px Arial, sans-serif'; + + ctx.fillStyle = '#f00'; + ctx.fillText("fail fail fail fail fail", 5, 35, 0); + + var imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); + var w = imageData.width, h = imageData.height, d = imageData.data; + var pixelsCheck = true; + loopMain1: + for (var i = 0; i < h; ++i) { + for (var j = 0; j < w; ++j) { + if (d[4 * (w * i + j) + 0] != 0) pixelsCheck = false; + if (d[4 * (w * i + j) + 1] != 255) pixelsCheck = false; + if (d[4 * (w * i + j) + 2] != 0) pixelsCheck = false; + if (d[4 * (w * i + j) + 3] != 255) pixelsCheck = false; + if(!pixelsCheck) break loopMain1; + } + } + assert_true(pixelsCheck); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, canvasWidth, canvasHeight); + + ctx.fillStyle = '#f00'; + ctx.fillText("fail fail fail fail fail", 5, 35, -1); + + var imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); + var w = imageData.width, h = imageData.height, d = imageData.data; + pixelsCheck = true; + loopMain2: + for (var i = 0; i < h; ++i) { + for (var j = 0; j < w; ++j) { + if (d[4 * (w * i + j) + 0] != 0) pixelsCheck = false; + if (d[4 * (w * i + j) + 1] != 255) pixelsCheck = false; + if (d[4 * (w * i + j) + 2] != 0) pixelsCheck = false; + if (d[4 * (w * i + j) + 3] != 255) pixelsCheck = false; + if(!pixelsCheck) break loopMain2; + } + } + assert_true(pixelsCheck); + +}, 'Series of tests to ensure that fillText() does not display any text when maxWidth is invalid.'); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt deleted file mode 100644 index 4f1eb7cb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS imgdata[0] is 0 -PASS imgdata[1] is 255 -PASS imgdata[2] is 0 -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html index dc69269..d17fe896 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html
@@ -1,9 +1,26 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-fillText-zeroSizeGradient.js"></script> +<script> +test(function(t) { + var ctx = document.createElement('canvas').getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + + var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); + g.addColorStop(0, '#f00'); + g.addColorStop(1, '#f00'); + ctx.fillStyle = g; + ctx.font = '1px sans-serif'; + ctx.fillText("AA", 0, 1); + + var imageData = ctx.getImageData(0, 0, 1, 1); + var imgdata = imageData.data; + assert_equals(imgdata[0], 0); + assert_equals(imgdata[1], 255); + assert_equals(imgdata[2], 0); + +}, 'Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient.'); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value-expected.txt deleted file mode 100644 index 35735b7..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value-expected.txt +++ /dev/null
@@ -1,16 +0,0 @@ -PASS ctx.filter is "none" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "none" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur(5px)" -PASS ctx.filter is "blur( 5px)" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html index f3719e4..34d0013d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html
@@ -1,39 +1,40 @@ -<script src="../../resources/js-test.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <script> - -var canvas = document.createElement('canvas'); -var ctx = canvas.getContext('2d'); - -shouldBe('ctx.filter', '"none"'); -ctx.filter = 'blur(5px)'; -shouldBe('ctx.filter', '"blur(5px)"'); - -ctx.save(); -ctx.filter = 'none'; -shouldBe('ctx.filter', '"none"'); -ctx.restore(); -shouldBe('ctx.filter', '"blur(5px)"'); - -// Invalid filter should be ignored -ctx.filter = 'blur(10)'; -shouldBe('ctx.filter', '"blur(5px)"'); -ctx.filter = 'blur 10px'; -shouldBe('ctx.filter', '"blur(5px)"'); - -ctx.filter = 'inherit'; -shouldBe('ctx.filter', '"blur(5px)"'); -ctx.filter = 'initial'; -shouldBe('ctx.filter', '"blur(5px)"'); - -ctx.filter = ''; -shouldBe('ctx.filter', '"blur(5px)"'); -ctx.filter = null; -shouldBe('ctx.filter', '"blur(5px)"'); -ctx.filter = undefined; -shouldBe('ctx.filter', '"blur(5px)"'); - -// verify that exact string is preserved -ctx.filter = 'blur( 5px)'; -shouldBe('ctx.filter', '"blur( 5px)"'); - +test(function(t) { + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + assert_equals(ctx.filter, 'none'); + ctx.filter = 'blur(5px)'; + assert_equals(ctx.filter, 'blur(5px)'); + + ctx.save(); + ctx.filter = 'none'; + assert_equals(ctx.filter, 'none'); + ctx.restore(); + assert_equals(ctx.filter, 'blur(5px)'); + + // Invalid filter should be ignored + ctx.filter = 'blur(10)'; + assert_equals(ctx.filter, 'blur(5px)'); + ctx.filter = 'blur 10px'; + assert_equals(ctx.filter, 'blur(5px)'); + + ctx.filter = 'inherit'; + assert_equals(ctx.filter, 'blur(5px)'); + ctx.filter = 'initial'; + assert_equals(ctx.filter, 'blur(5px)'); + + ctx.filter = ''; + assert_equals(ctx.filter, 'blur(5px)'); + ctx.filter = null; + assert_equals(ctx.filter, 'blur(5px)'); + ctx.filter = undefined; + assert_equals(ctx.filter, 'blur(5px)'); + + // verify that exact string is preserved + ctx.filter = 'blur( 5px)'; + assert_equals(ctx.filter, 'blur( 5px)'); +}, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct result'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache-expected.txt deleted file mode 100644 index e1ddce8..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -PASS successfullyParsed is true - -TEST COMPLETE -PASS internals.isInCanvasFontCache(document, "1px sans-serif") is true -PASS internals.isInCanvasFontCache(document, "1px sans-serif") is false -PASS internals.isInCanvasFontCache(document, "2px sans-serif") is true -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html index 984c839..b9c2c7c 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html
@@ -1,37 +1,33 @@ -<script src="../../resources/js-test.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <canvas id='c'></canvas> <script> -// The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp) -// is to exercise interactions with animation frames. +test(function(t) { -var cacheLimit = 0; -if (!window.internals || !window.testRunner) { - testFailed('This test requires the window.internals and window.testRunner interfaces'); -} else { - cacheLimit = internals.canvasFontCacheMaxFonts(); - testRunner.waitUntilDone(); - testRunner.dumpAsText(); - requestAnimationFrame(step1); -} - -var ctx = document.getElementById('c').getContext('2d'); - -function step1() -{ - for (var i = 0; i < cacheLimit + 1; i ++) { - ctx.font = (1 + i) + 'px sans-serif'; - ctx.fillText('a', 0, 50); - } - shouldBeTrue('internals.isInCanvasFontCache(document, "1px sans-serif")'); - requestAnimationFrame(step2); -} - -function step2() -{ - // Pruning of the cache is expected to happen between tasks - shouldBeFalse('internals.isInCanvasFontCache(document, "1px sans-serif")'); - shouldBeTrue('internals.isInCanvasFontCache(document, "2px sans-serif")'); - testRunner.notifyDone(); -} - + // The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp) + // is to exercise interactions with animation frames. + var cacheLimit = 0; + cacheLimit = window.internals.canvasFontCacheMaxFonts(); + requestAnimationFrame(step1); + + var ctx = document.getElementById('c').getContext('2d'); + + function step1() + { + for (var i = 0; i < cacheLimit + 1; i ++) { + ctx.font = (1 + i) + 'px sans-serif'; + ctx.fillText('a', 0, 50); + } + assert_true(internals.isInCanvasFontCache(document, "1px sans-serif")); + requestAnimationFrame(step2); + } + + function step2() + { + // Pruning of the cache is expected to happen between tasks + assert_false(internals.isInCanvasFontCache(document, "1px sans-serif")); + assert_true(internals.isInCanvasFontCache(document, "2px sans-serif")); + } + +}, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct result'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency-expected.txt deleted file mode 100644 index a42e6f7e..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -Series of tests to ensure that context.font is consistent. - -On success, you will see no "FAIL" messages, followed by "TEST COMPLETE". - - -Testing font "bold 13px Arial" -PASS ctx.font is fontName -Testing font "italic 13px Arial" -PASS ctx.font is fontName -Testing font "small-caps 13px Arial" -PASS ctx.font is fontName -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency.html index aa84149..4053c93 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-consistency.html
@@ -1,9 +1,22 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-font-consistency.js"></script> +<script> +test(function(t) { + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var fontNames = ["bold 13px Arial", + "italic 13px Arial", + "small-caps 13px Arial"]; + + for (var i = 0; i < fontNames.length; i++) { + var fontName = fontNames[i]; + ctx.font = fontName; + assert_equals(ctx.font, fontName); + } + +}, 'Series of tests to ensure that context.font is consistent.'); +</script> </body> </html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt deleted file mode 100644 index 04f18de..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -Test that setting a font with size in 'ex' units doesn't crash. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS size is within 10 of 25 -PASS family is 'sans-serif' -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash.html index 7f08156..014ebeb 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-ex-units-crash.html
@@ -1,9 +1,17 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<script src="../../resources/js-test.js"></script> -</head> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> <body> -<script src="script-tests/canvas-font-ex-units-crash.js"></script> +<script> +test(function(t) { + ctx = document.createElement('canvas').getContext('2d'); + + ctx.font = "5ex sans-serif"; + + size = parseInt(ctx.font.substr(0, 2)); + family = ctx.font.substr(5); + + assert_approx_equals(size, 25, 10); + assert_equals(family, 'sans-serif'); +}, "Test that setting a font with size in 'ex' units doesn't crash."); +</script> </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-360-winding.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-360-winding.js deleted file mode 100644 index 0ec7b82..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-360-winding.js +++ /dev/null
@@ -1,39 +0,0 @@ -description("This tests canvas full arc fill with nonzero winding rule. Eight green concentric thick circumferences should be displayed."); - -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas) -canvas.setAttribute('width', '300'); -canvas.setAttribute('height', '150'); -var ctx = canvas.getContext('2d'); - -var r; -var anticlockwise = true; -ctx.beginPath(); -for (r = 200; r >= 10; r -= 10) { - ctx.moveTo(150 + r, 75); - ctx.arc(150, 75, r, 0, Math.PI*2, anticlockwise); - ctx.closePath(); - anticlockwise = !anticlockwise; -} -ctx.fillStyle = 'rgba(0, 255, 0, 1)'; -ctx.strokeStyle = 'rgba(0, 255, 0, 1)'; -ctx.fill(); -ctx.stroke(); - -var imageData = ctx.getImageData(297, 75, 1, 1); -var data = imageData.data; -shouldBe("data[0]", "0"); -shouldBe("data[1]", "0"); -shouldBe("data[2]", "0"); - -imageData = ctx.getImageData(285, 5, 1, 1); -data = imageData.data; -shouldBe("data[0]", "0"); -shouldBe("data[1]", "255"); -shouldBe("data[2]", "0"); - -imageData = ctx.getImageData(277, 75, 1, 1); -data = imageData.data; -shouldBe("data[0]", "0"); -shouldBe("data[1]", "0"); -shouldBe("data[2]", "0");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-connecting-line.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-connecting-line.js deleted file mode 100644 index 0ffca0b3..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-arc-connecting-line.js +++ /dev/null
@@ -1,33 +0,0 @@ -description("Test that canvas arc()s are connected by a straight line. There should be two C-shapes with a line from the bottom of the left one to the top of the right one."); - -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas) -canvas.setAttribute('width', '300'); -canvas.setAttribute('height', '300'); -var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, canvas.width, canvas.height); -ctx.lineJoin = 'bevel'; -ctx.lineWidth = 12; -ctx.beginPath(); -ctx.arc(200, 50, 40, Math.PI / 2, -Math.PI / 2, false); -ctx.arc(100, 50, 40, Math.PI / 2, -Math.PI / 2, false); -ctx.stroke(); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0"); - -imageData = ctx.getImageData(125, 30, 1, 1); -imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0"); - -imageData = ctx.getImageData(125, 70, 1, 1); -imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-blend-image.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-blend-image.js deleted file mode 100644 index e2bc834..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-blend-image.js +++ /dev/null
@@ -1,175 +0,0 @@ -description("Series of tests to ensure correct results on applying different blend modes."); - -var tmpimg = document.createElement('canvas'); -tmpimg.width = 200; -tmpimg.height = 200; -ctx = tmpimg.getContext('2d'); - -// Create the image for blending test with images. -var img = document.createElement('canvas'); -img.width = 200; -img.height = 200; -var imgCtx = img.getContext('2d'); -imgCtx.fillStyle = "red"; -imgCtx.fillRect(0,0,100,100); -imgCtx.fillStyle = "yellow"; -imgCtx.fillRect(100,0,100,100); -imgCtx.fillStyle = "green"; -imgCtx.fillRect(100,100,100,100); -imgCtx.fillStyle = "blue"; -imgCtx.fillRect(0,100,100,100); - -// Create expected results. -var blendModes = -// [blendMode, expectations solid on solid, expectations solid on alpha, expectations alpha on solid, expectations alpha on alpha] -[ - ['source-over', - [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], - [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], - [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] - ], - ['multiply', - [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], - [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], - [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], - [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] - ], - ['screen', - [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], - [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], - [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], - [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] - ], - ['overlay', - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], - [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] - ], - ['darken', - [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], - [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], - [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], - [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] - ], - ['lighten', - [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], - [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], - [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], - [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] - ], - ['color-dodge', - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], - [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] - ], - ['color-burn', - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], - [[85, 0, 170, 191],[85, 85, 170, 191],[0, 42, 170, 191],[0, 0, 255, 191]] - ], - ['hard-light', - [[255, 0, 0, 255],[255, 255, 0, 255],[0, 1, 0, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], - [[255, 0, 0, 255],[255, 255, 0, 255],[0, 65, 0, 255],[0, 0, 255, 255]], - [[171, 0, 84, 191],[171, 171, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] - ], - ['soft-light', - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], - [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] - ], - ['difference', - [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], - [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], - [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], - [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] - ], - ['exclusion', - [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], - [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], - [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], - [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] - ], - ['hue', - [[93, 0, 0, 255],[31, 31, 0, 255],[0, 46, 0, 255],[0, 0, 255, 255]], - [[49, 0, 127, 255],[16, 16, 127, 255],[0, 25, 127, 255],[0, 0, 255, 255]], - [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], - [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] - ], - ['saturation', - [[0, 0, 255, 255],[0, 0, 255, 255],[14, 14, 142, 255],[0, 0, 255, 255]], - [[0, 0, 255, 255],[0, 0, 255, 255],[7, 7, 198, 255],[0, 0, 255, 255]], - [[128, 0, 127, 255],[128, 128, 127, 255],[7, 71, 70, 255],[0, 0, 255, 255]], - [[85, 0, 167, 191],[85, 85, 167, 191],[4, 48, 130, 191],[0, 0, 255, 191]] - ], - ['color', - [[93, 0, 0, 255],[31, 31, 0, 255],[0, 47, 0, 255],[0, 0, 255, 255]], - [[49, 0, 127, 255],[16, 16, 127, 255],[0, 24, 127, 255],[0, 0, 255, 255]], - [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], - [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] - ], - ['luminosity', - [[55, 55, 255, 255],[224, 224, 255, 255],[54, 54, 255, 255],[0, 0, 255, 255]], - [[28, 28, 255, 255],[112, 112, 255, 255],[27, 27, 255, 255],[0, 0, 255, 255]], - [[155, 27, 127, 255],[239, 239, 127, 255],[26, 90, 127, 255],[0, 0, 255, 255]], - [[104, 19, 167, 191],[158, 158, 167, 191],[16, 58, 167, 191],[0, 0, 255, 191]] - ]]; - -// [Scenario, alpha on background, alpha on foreground] -var testScenario = [ - ['solid on solid', 1, 1], - ['solid on alpha', 1, 0.5], - ['alpha on solid', 0.5, 1], - ['alpha on alpha', 0.5, 0.5] -]; - -testPoints = [{x: 50, y: 50}, {x: 150, y: 50}, {x: 150, y: 150}, {x: 50, y: 150}]; - -function pixelDataAtPoint(i) -{ - return ctx.getImageData(testPoints[i].x, testPoints[i].y , 1, 1).data; -} - -function checkBlendModeResult(blendMode, testScenario, expectedColors, sigma) { - debug(testScenario); - for (var i = 0; i < testPoints.length; i++) { - var resultColor = "pixelDataAtPoint(" + i + ")"; - shouldBeCloseTo(resultColor +"[0]", expectedColors[i][0], sigma); - shouldBeCloseTo(resultColor +"[1]", expectedColors[i][1], sigma); - shouldBeCloseTo(resultColor +"[2]", expectedColors[i][2], sigma); - shouldBeCloseTo(resultColor +"[3]", expectedColors[i][3], sigma); - } -} - -// Execute test. -function prepareTestScenario(sigma) { - // Check each blend mode individually. - for (var i = 0; i < blendModes.length; i++) { - debug('Testing blend mode "' + blendModes[i][0] + '"'); - for (var j = 0; j < testScenario.length; j++) { - ctx.clearRect(0,0,200,200); - ctx.save(); - - // Draw backdrop. - ctx.fillStyle = 'rgba(0, 0, 255, ' + testScenario[j][1] + ')'; - ctx.fillRect(0,0,200,200); - - // Apply blend mode. - ctx.globalCompositeOperation = blendModes[i][0]; - ctx.globalAlpha = testScenario[j][2]; - ctx.drawImage(img, 0, 0); - - checkBlendModeResult(blendModes[i][0], testScenario[j][0], blendModes[i][j+1], sigma); - ctx.restore(); - } - debug(''); - } - } - -// Run test and allow variation of results. -prepareTestScenario(5);
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clearRect.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clearRect.js deleted file mode 100644 index 61f4633..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clearRect.js +++ /dev/null
@@ -1,44 +0,0 @@ -description("Series of tests to ensure correct behavior of canvas.clearRect()."); -var ctx = document.createElement('canvas').getContext('2d'); - -// Clear rect with height = width = 0. -debug("Test canvas.clearRect() with height = width = 0."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 1, 1); -ctx.clearRect(0, 0, 0, 0); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "255"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1); - -// Clear rect with height = 0, width = 1. -debug("Test canvas.clearRect() with height = 0, width = 1."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 1, 1); -ctx.clearRect(0, 0, 1, 0); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "255"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1); - -// Clear rect with height = 1, width = 0. -debug("Test canvas.clearRect() with height = 1, width = 0."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 1, 1); -ctx.clearRect(0, 0, 0, 1); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "255"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1);
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clip-rule.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clip-rule.js deleted file mode 100644 index e6a45ed..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-clip-rule.js +++ /dev/null
@@ -1,69 +0,0 @@ -description("Series of tests to ensure correct results of the winding rule."); - - -var tmpimg = document.createElement('canvas'); -tmpimg.width = 200; -tmpimg.height = 200; -ctx = tmpimg.getContext('2d'); - -// Create the image for blending test with images. -var img = document.createElement('canvas'); -img.width = 100; -img.height = 100; -var imgCtx = img.getContext('2d'); - -function pixelDataAtPoint() -{ - return ctx.getImageData(50, 50, 1, 1).data; -} - -function checkResult(expectedColors, sigma) { - for (var i = 0; i < 4; i++) - shouldBeCloseTo("pixelDataAtPoint()[" + i + "]", expectedColors[i], sigma); -} - -// Execute test. -function prepareTestScenario() { - debug('Testing default clip'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.clip(); - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - checkResult([0, 255, 0, 255], 5); - debug(''); - - debug('Testing nonzero clip'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.clip('nonzero'); - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - checkResult([0, 255, 0, 255], 5); - debug(''); - - debug('Testing evenodd clip'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.clip('evenodd'); - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - checkResult([255, 0, 0, 255], 5); - debug(''); - -} - -// Run test and allow variation of results. -prepareTestScenario();
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js deleted file mode 100644 index 008a8f5..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js +++ /dev/null
@@ -1,23 +0,0 @@ -description("Test the behavior of closePath on a path with a single point"); -var ctx = document.createElement('canvas').getContext('2d'); - -document.body.appendChild(ctx.canvas); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); - -ctx.beginPath(); -ctx.moveTo(10, 10); -ctx.lineTo(100, 100); -ctx.closePath(); -ctx.stroke(); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0"); -shouldBe("imgdata[3]", "255");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-copyPixels.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-copyPixels.js deleted file mode 100644 index d7d2d9f..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-copyPixels.js +++ /dev/null
@@ -1,30 +0,0 @@ -description("Test if putImageData gives back the same result as getImageData"); -var ctx = document.createElement('canvas').getContext('2d'); - -ctx.fillStyle = "red"; -ctx.fillRect(0,0,50,20); -ctx.fillStyle = "green"; -ctx.fillRect(50,0,50,20); -ctx.fillStyle = "blue"; -ctx.fillRect(100,0,50,20); - -var data = ctx.getImageData(0,0,150,20); -ctx.putImageData(data, 0, 20); - -var imageData = ctx.getImageData(1, 21, 48, 18); -var imgdata = imageData.data; -shouldBe("imgdata[4]", "255"); -shouldBe("imgdata[5]", "0"); -shouldBe("imgdata[6]", "0"); - -imageData = ctx.getImageData(51, 21, 48, 18); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0"); - -imageData = ctx.getImageData(101, 21, 48, 18); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "0"); -shouldBe("imgdata[6]", "255");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-createPattern-fillRect-shadow.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-createPattern-fillRect-shadow.js deleted file mode 100644 index dedbd1e1..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-createPattern-fillRect-shadow.js +++ /dev/null
@@ -1,168 +0,0 @@ -description("Ensure correct behavior of canvas with createPattern + fillRect with shadow."); - -function print(message, color) -{ - var paragraph = document.createElement("div"); - paragraph.appendChild(document.createTextNode(message)); - paragraph.style.fontFamily = "monospace"; - if (color) - paragraph.style.color = color; - document.getElementById("console").appendChild(paragraph); -} - -function shouldBeAround(a, b) - { - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (Math.abs(evalA - b) < 10) - print("PASS " + a + " is around " + b , "green") - else - print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red"); - } - -// Create auxiliary canvas to draw to and create an image from. -// This is done instead of simply loading an image from the file system -// because that would throw a SECURITY_ERR DOM Exception. -var aCanvas = document.createElement('canvas'); -aCanvas.setAttribute('width', '200'); -aCanvas.setAttribute('height', '200'); -var aCtx = aCanvas.getContext('2d'); - -// Draw a circle on the same canvas. -aCtx.beginPath(); -aCtx.fillStyle = 'blue'; -aCtx.arc(100, 100, 100, 0, Math.PI*2, false); -aCtx.fill(); - -// Create the image object to be drawn on the master canvas. -var img = new Image(); -img.onload = drawImageToCanvasAndCheckPixels; -img.src = aCanvas.toDataURL(); // set a data URI of the base64 enconded image as the source - -// Create master canvas. -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas); -canvas.setAttribute('width', '700'); -canvas.setAttribute('height', '1100'); -var ctx = canvas.getContext('2d'); - -function drawImageToCanvasAndCheckPixels() { - ctx.shadowOffsetX = 250; - ctx.fillStyle = ctx.createPattern(img, 'repeat'); - - ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; - ctx.fillRect(50, 50, 200, 200); - - ctx.shadowColor = 'rgba(255, 0, 0, 0.2)'; - ctx.fillRect(50, 300, 200, 200); - - ctx.shadowBlur = 10; - ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; - ctx.fillRect(50, 550, 200, 200); - - ctx.shadowColor = 'rgba(255, 0, 0, 0.2)'; - ctx.fillRect(50, 800, 200, 200); - - checkPixels(); -} - -function checkPixels() { - var imageData, data; - - // Verify solid shadow. - imageData = ctx.getImageData(300, 50, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBe('d[3]', '255'); - - imageData = ctx.getImageData(300, 249, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBe('d[3]', '255'); - - imageData = ctx.getImageData(490, 240, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBe('d[3]', '255'); - - // Verify solid alpha shadow. - imageData = ctx.getImageData(310, 350, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '51'); - - imageData = ctx.getImageData(490, 490, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '51'); - - imageData = ctx.getImageData(300, 499, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '51'); - - // Verify blurry shadow. - imageData = ctx.getImageData(310, 550, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '141'); - - imageData = ctx.getImageData(490, 750, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '113'); - - imageData = ctx.getImageData(499, 499, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '51'); - - // Verify blurry alpha shadow. - imageData = ctx.getImageData(300, 850, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '29'); - - imageData = ctx.getImageData(500, 875, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '23'); - - imageData = ctx.getImageData(300, 900, 1, 1); - d = imageData.data; - shouldBe('d[0]', '255'); - shouldBe('d[1]', '0'); - shouldBe('d[2]', '0'); - shouldBeAround('d[3]', '29'); - - finishJSTest(); -} - -window.jsTestIsAsync = true;
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentColor.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentColor.js deleted file mode 100644 index 09b5ddfd..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentColor.js +++ /dev/null
@@ -1,63 +0,0 @@ -description("Test that CanvasRenderingContext2D supports the 'currentColor' value."); - -canvas = document.createElement('canvas'); -canvas.width = 100; -canvas.height = 100; -ctx = canvas.getContext('2d'); - -function attachCanvasToDocument() { - document.body.appendChild(canvas); - return document.body.parentNode != null; -} - -function tryLinearGradientColor(color) { - var gradient = ctx.createLinearGradient(0, 0, 100, 100); - gradient.addColorStop(0, color); - gradient.addColorStop(1, color); - ctx.fillStyle = gradient; - ctx.fillRect(0, 0, 100, 100); - var data = ctx.getImageData(0, 0, 1, 1).data; - return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3]; -} - -function tryRadialGradientColor(color) { - var gradient = ctx.createRadialGradient(0, 0, 100, 100, 100, 100); - gradient.addColorStop(0, color); - gradient.addColorStop(1, color); - ctx.fillStyle = gradient; - ctx.fillRect(0, 0, 100, 100); - var data = ctx.getImageData(0, 0, 1, 1).data; - return '' + data[0] + ',' + data[1] + ',' + data[2] + ',' + data[3]; -} - -// First we test with the canvas out-of-document, 'currentColor' should mean black -shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); -shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#000000'"); -shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'"); -shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#000000'"); -shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'"); -shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#000000'"); -shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'"); -shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'"); -shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'"); -shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'"); - -// Attach to the document and set the canvas's color to #123456 -shouldBe("attachCanvasToDocument()", "true"); -shouldBe("canvas.style.color = '#123456'; canvas.style.color", "'rgb(18, 52, 86)'"); - -// 'currentColor' should now mean #123456 -shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); -shouldBe("ctx.shadowColor = 'currentColor'; ctx.shadowColor", "'#123456'"); -shouldBe("ctx.fillStyle = '#f00'; ctx.fillStyle", "'#ff0000'"); -shouldBe("ctx.fillStyle = 'currentColor'; ctx.fillStyle", "'#123456'"); -shouldBe("ctx.strokeStyle = '#f00'; ctx.strokeStyle", "'#ff0000'"); -shouldBe("ctx.strokeStyle = 'currentColor'; ctx.strokeStyle", "'#123456'"); -shouldBe("tryLinearGradientColor('#f00')", "'255,0,0,255'"); -shouldBe("tryLinearGradientColor('currentColor')", "'0,0,0,255'"); -shouldBe("tryRadialGradientColor('#f00')", "'255,0,0,255'"); -shouldBe("tryRadialGradientColor('currentColor')", "'0,0,0,255'"); - -// Last but not least, verify that we're case insensitive -shouldBe("ctx.shadowColor = '#f00'; ctx.shadowColor", "'#ff0000'"); -shouldBe("ctx.shadowColor = 'CURRENTCOLOR'; ctx.shadowColor", "'#123456'");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentTransform.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentTransform.js deleted file mode 100644 index 23f0854..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-currentTransform.js +++ /dev/null
@@ -1,319 +0,0 @@ -description("Series of tests to ensure correct behaviour of canvas.currentTransform"); -var ctx = document.createElement('canvas').getContext('2d'); - -var matrix = ctx.currentTransform; - -debug("Check initial currentTransform values"); -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); - -function setCurrentTransform(ctx, a, b, c, d, e, f) -{ - matrix.a = a; - matrix.b = b; - matrix.c = c; - matrix.d = d; - matrix.e = e; - matrix.f = f; - ctx.currentTransform = matrix; - matrix.a = NaN; - matrix.b = NaN; - matrix.c = NaN; - matrix.d = NaN; - matrix.e = NaN; - matrix.f = NaN; - matrix = ctx.currentTransform; - shouldBe("matrix.a", "" + a); - shouldBe("matrix.b", "" + b); - shouldBe("matrix.c", "" + c); - shouldBe("matrix.d", "" + d); - shouldBe("matrix.e", "" + e); - shouldBe("matrix.f", "" + f); -} - -matrix.a = 2; -debug("Changing matrix should not affect the CTM"); -shouldBe("ctx.currentTransform.a", "1"); -shouldBe("ctx.currentTransform.b", "0"); -shouldBe("ctx.currentTransform.c", "0"); -shouldBe("ctx.currentTransform.d", "1"); -shouldBe("ctx.currentTransform.e", "0"); -shouldBe("ctx.currentTransform.f", "0"); - -debug("Reset the CTM to the initial matrix"); -ctx.beginPath(); -ctx.scale(0.5, 0.5); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "0.5"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "0.5"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); -setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); -ctx.fillStyle = 'green'; -ctx.fillRect(0, 0, 100, 100); - -var imageData = ctx.getImageData(1, 1, 98, 98); -var imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0"); - -debug("currentTransform should not affect the current path"); -ctx.beginPath(); -ctx.rect(0,0,100,100); -ctx.save(); -setCurrentTransform(ctx, 0.5, 0, 0, 0.5, 10, 10); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); -ctx.restore(); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); -ctx.fillStyle = 'green'; -ctx.fillRect(0, 0, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0"); - -debug("currentTransform should not affect the CTM outside of save() and restore()"); -ctx.beginPath(); -ctx.fillStyle = 'green'; -ctx.save(); -setCurrentTransform(ctx, 0.5, 0, 0, 0.5, 0, 0); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); -ctx.restore(); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); -ctx.fillRect(0, 0, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0"); - -debug("stop drawing on not-invertible CTM"); -ctx.beginPath(); -ctx.fillStyle = 'green'; -ctx.fillRect(0, 0, 100, 100); -setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0"); - -debug("currentTransform with a not-invertible matrix should only stop the drawing up to the next restore()"); -ctx.beginPath(); -ctx.resetTransform(); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); -ctx.save(); -setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); -ctx.restore(); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "0"); -shouldBe("matrix.f", "0"); -ctx.fillStyle = 'blue'; -ctx.fillRect(0, 0, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "0"); -shouldBe("imgdata[6]", "255"); - -debug("currentTransform should set transform although CTM is not-invertible"); -ctx.beginPath(); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); -setCurrentTransform(ctx, 0, 0, 0, 0, 0, 0); -ctx.fillStyle = 'green'; -ctx.fillRect(0, 0, 100, 100); -setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); -ctx.fillStyle = 'blue'; -ctx.fillRect(0, 0, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "0"); -shouldBe("imgdata[6]", "255"); - -debug("Check that non-invertible transforms are reflected in currentTransform"); -setCurrentTransform(ctx, 1, 0, 0, 1, 1, 2); -ctx.scale(0, 0); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "0"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "0"); -shouldBe("matrix.e", "1"); -shouldBe("matrix.f", "2"); -setCurrentTransform(ctx, 1, 0, 0, 1, 0, 0); - -debug("Check assigning an invalid object throws exception as expected"); -shouldThrow("ctx.currentTransform = ctx", '"TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'."'); -shouldThrow("ctx.currentTransform = undefined", '"TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'."'); -shouldThrow("ctx.currentTransform = null", '"TypeError: Failed to set the \'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value is not of type \'SVGMatrix\'."'); - -debug("Check handling non-finite values. see 2d.transformation.setTransform.nonfinite.html"); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 100, 100); - -function setCurrentTransformToNonfinite(ctx, a, b, c, d, e, f) -{ - matrix.a = a; - matrix.b = b; - matrix.c = c; - matrix.d = d; - matrix.e = e; - matrix.f = f; - ctx.currentTransform = matrix; - matrix.a = NaN; - matrix.b = NaN; - matrix.c = NaN; - matrix.d = NaN; - matrix.e = NaN; - matrix.f = NaN; - matrix = ctx.currentTransform; - shouldBe("matrix.a", "1"); - shouldBe("matrix.b", "0"); - shouldBe("matrix.c", "0"); - shouldBe("matrix.d", "1"); - shouldBe("matrix.e", "100"); - shouldBe("matrix.f", "10"); -} - -ctx.translate(100, 10); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "100"); -shouldBe("matrix.f", "10"); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, -Infinity, 0, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, NaN, 0, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, -Infinity, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, NaN, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, -Infinity, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, NaN, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, -Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, NaN, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, -Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, NaN, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, 0, -Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, 0, NaN); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, Infinity, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, Infinity, 0, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, Infinity, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, Infinity, 0, 0, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, 0, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, Infinity, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, Infinity, 0, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, Infinity, 0, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, 0, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, 0, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, Infinity, 0, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, Infinity, Infinity, 0); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, Infinity, Infinity, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, Infinity, 0, Infinity); -setCurrentTransformToNonfinite(ctx, 0, 0, 0, 0, Infinity, Infinity); -matrix = ctx.currentTransform; -shouldBe("matrix.a", "1"); -shouldBe("matrix.b", "0"); -shouldBe("matrix.c", "0"); -shouldBe("matrix.d", "1"); -shouldBe("matrix.e", "100"); -shouldBe("matrix.f", "10"); - -ctx.fillStyle = 'green'; -ctx.fillRect(-100, -10, 100, 100); - -imageData = ctx.getImageData(1, 1, 98, 98); -imgdata = imageData.data; -shouldBe("imgdata[4]", "0"); -shouldBe("imgdata[5]", "128"); -shouldBe("imgdata[6]", "0");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-rule.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-rule.js deleted file mode 100644 index 482e03a9..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-rule.js +++ /dev/null
@@ -1,66 +0,0 @@ -description("Series of tests to ensure correct results of the winding rule."); - - -var tmpimg = document.createElement('canvas'); -tmpimg.width = 200; -tmpimg.height = 200; -ctx = tmpimg.getContext('2d'); - -// Create the image for blending test with images. -var img = document.createElement('canvas'); -img.width = 100; -img.height = 100; -var imgCtx = img.getContext('2d'); - -function pixelDataAtPoint() -{ - return ctx.getImageData(50, 50, 1, 1).data; -} - -function checkResult(expectedColors, sigma) { - for (var i = 0; i < 4; i++) - shouldBeCloseTo("pixelDataAtPoint()[" + i + "]", expectedColors[i], sigma); -} - -// Execute test. -function prepareTestScenario() { - debug('Testing default fill'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.fill(); - checkResult([0, 255, 0, 255], 5); - debug(''); - - debug('Testing nonzero fill'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.fill('nonzero'); - checkResult([0, 255, 0, 255], 5); - debug(''); - - debug('Testing evenodd fill'); - ctx.fillStyle = 'rgb(255,0,0)'; - ctx.beginPath(); - ctx.fillRect(0, 0, 100, 100); - ctx.fillStyle = 'rgb(0,255,0)'; - ctx.beginPath(); - ctx.rect(0, 0, 100, 100); - ctx.rect(25, 25, 50, 50); - ctx.fill('evenodd'); - checkResult([255, 0, 0, 255], 5); - debug(''); - -} - -// Run test and allow variation of results. -prepareTestScenario();
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js deleted file mode 100644 index e8c0596c..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js +++ /dev/null
@@ -1,18 +0,0 @@ -description("Series of tests to ensure that fill() paints nothing on canvas when the fillStyle is set to a zero-size gradient."); -var ctx = document.createElement('canvas').getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); - -var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); -g.addColorStop(0, '#f00'); -g.addColorStop(1, '#f00'); -ctx.fillStyle = g; -ctx.rect(0, 0, 1 ,1); -ctx.fill(); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js deleted file mode 100644 index 39d6ada..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillPath-shadow.js +++ /dev/null
@@ -1,112 +0,0 @@ -description("Ensure correct behavior of canvas with path fill shadow"); - -function print(message, color) -{ - var paragraph = document.createElement("div"); - paragraph.appendChild(document.createTextNode(message)); - paragraph.style.fontFamily = "monospace"; - if (color) - paragraph.style.color = color; - document.getElementById("console").appendChild(paragraph); -} - -function shouldNotBe(a, b) -{ - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (evalA != b) - print("PASS " + a + " should not be " + b + " and it's not.", "green") - else - print("FAIL " + a + " should not be " + b + " but it is.", "red"); -} - -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas); -canvas.setAttribute('width', '700'); -canvas.setAttribute('height', '700'); -var ctx = canvas.getContext('2d'); - -ctx.beginPath(); -ctx.moveTo(300, 300); -ctx.lineTo(300, 50); -ctx.bezierCurveTo(200, 40, 75, 150, 30, 30); -ctx.quadraticCurveTo(250, 75, 50, 300); -ctx.shadowOffsetX = 350; -ctx.shadowColor = 'rgba(255, 20, 0, 0.5)'; -ctx.shadowBlur = 0; -ctx.fillStyle = 'rgba(0, 0, 255, 1)'; -ctx.lineWidth = 30; -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(300,650); -ctx.lineTo(300,400); -ctx.bezierCurveTo(200, 390, 75, 500, 30, 380); -ctx.quadraticCurveTo(250, 425, 50, 650); -ctx.shadowOffsetX = 350; -ctx.shadowColor = 'rgba(255, 0, 0, 0.5)'; -ctx.shadowBlur = 30; -ctx.fillStyle = 'rgba(0, 0, 255, 1)'; -ctx.lineWidth = 30; -ctx.fill(); - -var imageData, data; - -// Verify solid shadow. -imageData = ctx.getImageData(640, 290, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '20'); -shouldBe('data[2]', '0'); - -imageData = ctx.getImageData(570, 85, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '20'); -shouldBe('data[2]', '0'); - -imageData = ctx.getImageData(380, 30, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBeCloseTo('data[1]', 20, 3); -shouldBe('data[2]', '0'); - -imageData = ctx.getImageData(400, 40, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '20'); -shouldBe('data[2]', '0'); - -// Verify blurry shadow. -imageData = ctx.getImageData(640, 640, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '0'); -shouldBe('data[2]', '0'); -shouldNotBe('data[3]', '255'); - -imageData = ctx.getImageData(650, 400, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '0'); -shouldBe('data[2]', '0'); -shouldNotBe('data[3]', '255'); - -imageData = ctx.getImageData(380, 380, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '0'); -shouldBe('data[2]', '0'); -shouldNotBe('data[3]', '255'); - -imageData = ctx.getImageData(375, 390, 1, 1); -data = imageData.data; -shouldBe('data[0]', '255'); -shouldBe('data[1]', '0'); -shouldBe('data[2]', '0'); -shouldNotBe('data[3]', '255');
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js deleted file mode 100644 index 1ba6ef3e..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-gradient-shadow.js +++ /dev/null
@@ -1,197 +0,0 @@ -description("Ensure correct behavior of canvas with fillRect using a gradient fillStyle and a shadow"); - -function print(message, color) -{ - var paragraph = document.createElement("div"); - paragraph.appendChild(document.createTextNode(message)); - paragraph.style.fontFamily = "monospace"; - if (color) - paragraph.style.color = color; - document.getElementById("console").appendChild(paragraph); -} - -function shouldBeAround(a, b) -{ - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (Math.abs(evalA - b) < 5) - print("PASS " + a + " is around " + b , "green") - else - print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red"); -} - -function shouldBeSmaller(a, b) -{ - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (evalA < b) - print("PASS " + a + " is smaller than " + b , "green") - else - print("FAIL " + a + " is not smaller than " + b + " (actual: " + evalA + ")", "red"); -} - -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas); -canvas.setAttribute('width', '400'); -canvas.setAttribute('height', '800'); -var ctx = canvas.getContext('2d'); - -var gradient = ctx.createLinearGradient(0, 0, 100, 100); -gradient.addColorStop(0, 'rgba(0, 0, 255, 1.0)'); -gradient.addColorStop(1, 'rgba(0, 0, 255, 1.0)'); - -ctx.shadowOffsetX = 200; -ctx.fillStyle = gradient; - -ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; -ctx.fillRect(50, 50, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; -ctx.fillRect(50, 200, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; -ctx.shadowBlur = 5; -ctx.fillRect(50, 350, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; -ctx.fillRect(50, 500, 100, 100); - -ctx.rotate(Math.PI/2); -ctx.fillRect(650, -150, 100, 100); - -var d; // imageData.data - -// Verify solid shadow. -d = ctx.getImageData(250, 50, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(250, 149, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(349, 50, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(349, 149, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -// Verify solid alpha shadow. -d = ctx.getImageData(250, 200, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(250, 299, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(349, 200, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(349, 299, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -// Verify blurry shadow. -d = ctx.getImageData(248, 348, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(248, 451, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(351, 348, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(351, 451, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -// Verify blurry alpha shadow. -d = ctx.getImageData(248, 498, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(248, 601, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(351, 498, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(351, 601, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -// Verify blurry alpha shadow with rotation. -d = ctx.getImageData(249, 649, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '15'); - -d = ctx.getImageData(248, 751, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '15'); - -d = ctx.getImageData(350, 649, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '15'); - -d = ctx.getImageData(350, 750, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '15');
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-shadow.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-shadow.js deleted file mode 100644 index 78445c40..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-shadow.js +++ /dev/null
@@ -1,165 +0,0 @@ -description("Ensure correct behavior of canvas with fillRect shadow"); - -function print(message, color) -{ - var paragraph = document.createElement("div"); - paragraph.appendChild(document.createTextNode(message)); - paragraph.style.fontFamily = "monospace"; - if (color) - paragraph.style.color = color; - document.getElementById("console").appendChild(paragraph); -} - -function shouldBeAround(a, b) -{ - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (Math.abs(evalA - b) < 5) - print("PASS " + a + " is around " + b , "green") - else - print("FAIL " + a + " is not around " + b + " (actual: " + evalA + ")", "red"); -} - -function shouldBeSmaller(a, b) -{ - var evalA; - try { - evalA = eval(a); - } catch(e) { - evalA = e; - } - - if (evalA < b) - print("PASS " + a + " is smaller than " + b , "green") - else - print("FAIL " + a + " is not smaller than " + b + " (actual: " + evalA + ")", "red"); -} - -var canvas = document.createElement('canvas'); -document.body.appendChild(canvas); -canvas.setAttribute('width', '400'); -canvas.setAttribute('height', '650'); -var ctx = canvas.getContext('2d'); - -ctx.shadowOffsetX = 200; -ctx.fillStyle = 'rgba(0, 0, 255, 1)'; - -ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; -ctx.fillRect(50, 50, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; -ctx.fillRect(50, 200, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 1.0)'; -ctx.shadowBlur = 5; -ctx.fillRect(50, 350, 100, 100); - -ctx.shadowColor = 'rgba(255, 0, 0, 0.3)'; -ctx.fillRect(50, 500, 100, 100); - -var d; // imageData.data - -// Verify solid shadow. -d = ctx.getImageData(250, 50, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(250, 149, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(349, 50, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -d = ctx.getImageData(349, 149, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBe('d[3]', '255'); - -// Verify solid alpha shadow. -d = ctx.getImageData(250, 200, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(250, 299, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(349, 200, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -d = ctx.getImageData(349, 299, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeAround('d[3]', '76'); - -// Verify blurry shadow. -d = ctx.getImageData(248, 348, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(248, 451, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(351, 348, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -d = ctx.getImageData(351, 451, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '25'); - -// Verify blurry alpha shadow. -d = ctx.getImageData(248, 498, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(248, 601, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(351, 498, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10'); - -d = ctx.getImageData(351, 601, 1, 1).data; -shouldBe('d[0]', '255'); -shouldBe('d[1]', '0'); -shouldBe('d[2]', '0'); -shouldBeSmaller('d[3]', '10');
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js deleted file mode 100644 index cab8c78..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js +++ /dev/null
@@ -1,17 +0,0 @@ -description("Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient."); -var ctx = document.createElement('canvas').getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); - -var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); -g.addColorStop(0, '#f00'); -g.addColorStop(1, '#f00'); -ctx.fillStyle = g; -ctx.fillRect(0, 0, 1 ,1); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0");
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect.js deleted file mode 100644 index 1f6bec7..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillRect.js +++ /dev/null
@@ -1,41 +0,0 @@ -description("Series of tests to ensure correct behavior of canvas.fillRect()."); -var ctx = document.createElement('canvas').getContext('2d'); - -// Fill rect with height = width = 0. -debug("Test canvas.fillRect() with height = width = 0."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 0, 0); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1); - -// Fill rect with height = 0, width = 1. -debug("Test canvas.fillRect() with height = 0, width = 1."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 1, 0); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1); - -// Fill rect with height = 1, width = 0. -debug("Test canvas.fillRect() with height = 1, width = 0."); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 0, 1); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "0"); -shouldBe("imgdata[2]", "0"); - -ctx.clearRect(0, 0, 1, 1);
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-invalid-maxWidth.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-invalid-maxWidth.js deleted file mode 100644 index d75449a..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-invalid-maxWidth.js +++ /dev/null
@@ -1,46 +0,0 @@ -descriptionQuiet("Series of tests to ensure that fillText() does not display any text when maxWidth is invalid."); - -var canvas = document.createElement('canvas'); -var ctx = canvas.getContext('2d'); -var canvasWidth = 100; -var canvasHeight = 50; -canvas.setWidth = canvasWidth; -canvas.setHeight = canvasHeight; - - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, canvasWidth, canvasHeight); -ctx.font = '35px Arial, sans-serif'; - -debug("Test canvas.fillText() with maxWidth zero"); -ctx.fillStyle = '#f00'; -ctx.fillText("fail fail fail fail fail", 5, 35, 0); - -var imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); -var w = imageData.width, h = imageData.height, d = imageData.data; -for (var i = 0; i < h; ++i) { - for (var j = 0; j < w; ++j) { - if (d[4 * (w * i + j) + 0] != 0) shouldBe("d[4 * (w * i + j) + 0]", "0"); - if (d[4 * (w * i + j) + 1] != 255) shouldBe("d[4 * (w * i + j) + 1]", "255"); - if (d[4 * (w * i + j) + 2] != 0) shouldBe("d[4 * (w * i + j) + 2]", "0"); - if (d[4 * (w * i + j) + 3] != 255) shouldBe("d[4 * (w * i + j) + 3]", "255"); - } -} - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, canvasWidth, canvasHeight); -debug("Test canvas.fillText() with maxWidth -1"); -ctx.fillStyle = '#f00'; -ctx.fillText("fail fail fail fail fail", 5, 35, -1); - -var imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); -var w = imageData.width, h = imageData.height, d = imageData.data; -for (var i = 0; i < h; ++i) { - for (var j = 0; j < w; ++j) { - if (d[4 * (w * i + j) + 0] != 0) shouldBe("d[4 * (w * i + j) + 0]", "0"); - if (d[4 * (w * i + j) + 1] != 255) shouldBe("d[4 * (w * i + j) + 1]", "255"); - if (d[4 * (w * i + j) + 2] != 0) shouldBe("d[4 * (w * i + j) + 2]", "0"); - if (d[4 * (w * i + j) + 3] != 255) shouldBe("d[4 * (w * i + j) + 3]", "255"); - } -} -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js deleted file mode 100644 index 7cbbcd0..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js +++ /dev/null
@@ -1,19 +0,0 @@ -description("Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient."); -var ctx = document.createElement('canvas').getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); - -var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction); -g.addColorStop(0, '#f00'); -g.addColorStop(1, '#f00'); -ctx.fillStyle = g; -ctx.font = '1px sans-serif'; -ctx.fillText("AA", 0, 1); - -var imageData = ctx.getImageData(0, 0, 1, 1); -var imgdata = imageData.data; -shouldBe("imgdata[0]", "0"); -shouldBe("imgdata[1]", "255"); -shouldBe("imgdata[2]", "0"); -
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-consistency.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-consistency.js deleted file mode 100644 index c5b33462..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-consistency.js +++ /dev/null
@@ -1,14 +0,0 @@ -descriptionQuiet("Series of tests to ensure that context.font is consistent."); - -var canvas = document.createElement('canvas'); -var ctx = canvas.getContext('2d'); -var fontNames = ["bold 13px Arial", - "italic 13px Arial", - "small-caps 13px Arial"]; - -for (var i = 0; i < fontNames.length; i++) { - var fontName = fontNames[i]; - debug('Testing font "' + fontName + '"'); - ctx.font = fontName; - shouldBe("ctx.font", "fontName"); -} \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js deleted file mode 100644 index 2f275ad9..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js +++ /dev/null
@@ -1,11 +0,0 @@ -description("Test that setting a font with size in 'ex' units doesn't crash."); - -ctx = document.createElement('canvas').getContext('2d'); - -ctx.font = "5ex sans-serif"; - -size = parseInt(ctx.font.substr(0, 2)); -family = ctx.font.substr(5); - -shouldBeCloseTo("size", 25, 10); -shouldBe("family", "'sans-serif'");
diff --git a/third_party/WebKit/LayoutTests/fast/events/wheel/mainthread-touchpad-fling-latching.html b/third_party/WebKit/LayoutTests/fast/events/wheel/mainthread-touchpad-fling-latching.html new file mode 100644 index 0000000..3d48b418 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/wheel/mainthread-touchpad-fling-latching.html
@@ -0,0 +1,132 @@ +<!DOCTYPE HTML> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<style> + + ::-webkit-scrollbar { + display: none; + } + body { + margin: 0px; + height: 1000px; + width: 1000px; + } + #parentDiv { + background-color: #FF7F7F; + height: 600px; + width: 600px; + overflow: scroll; + } + #content1 { + height: 700px; + width: 700px; + } + #childDiv { + background-color: #84BE6A; + height: 500px; + width: 500px; + overflow: scroll; + } + #content2 { + height: 600px; + width: 600px; + } +</style> + +<div id="parentDiv"> + <div id="content1"> + <div id="childDiv"> + <div id="content2"> + </div> + </div> + </div> +</div> + +<script> + +var parentDiv = document.getElementById('parentDiv'); +var childDiv = document.getElementById('childDiv'); +var rect = childDiv.getBoundingClientRect(); + +setup({ explicit_done: true }); +test(() => { + // Start scrolling on the child div. + eventSender.gestureScrollBegin("touchpad", + (rect.left + rect.right) / 2, + (rect.top + rect.bottom) / 2); + eventSender.gestureScrollUpdate("touchpad", 0, -70); + waitForChildScrollAndCheck(); + +}, "Main thread fling on child div should latch to the div."); + +var lastScrollOffset = childDiv.scrollTop; +var rafCount = 0; + +// Wait for the child div to fully consume scroll delta, then start a fling. +function waitForChildScrollAndCheck() { + if (childDiv.scrollTop == 70) { + lastScrollOffset = childDiv.scrollTop; + rafCount = 0; + sendFlingStart(); + } else if (childDiv.scrollTop != lastScrollOffset) { + lastScrollOffset = childDiv.scrollTop; + rafCount = 0; + requestAnimationFrame(waitForChildScrollAndCheck); + } else if (rafCount < 10) { + requestAnimationFrame(waitForChildScrollAndCheck); + rafCount++; + } else { + // Fail the test since for the last 10 rafs childDiv.scrollTop hasn't + // changed and the scroll delta is not fully consumed. + assert_equals(childDiv.scrollTop, 70, + "The child div should fully comsume scroll delta."); + } +} + +function sendFlingStart() { + // Generate a fling on the child div. + eventSender.gestureFlingStart((rect.left + rect.right) / 2, + (rect.top + rect.bottom) / 2, + 0, -10000, "touchpad"); + childFlingCheck(); +} + +// Wait till the child div is fully scroll, then check to see if the fling +// propagates to the parent div or not. +function childFlingCheck() { + if (childDiv.scrollTop == childDiv.scrollHeight - childDiv.clientHeight) { + rafCount = 0; + flingLatchingCheck(); + } else if (childDiv.scrollTop != lastScrollOffset) { + lastScrollOffset = childDiv.scrollTop; + rafCount = 0; + requestAnimationFrame(childFlingCheck); + } else if (rafCount < 10) { + requestAnimationFrame(childFlingCheck); + rafCount++; + } else { + // Fail the test since for the last 10 rafs childDiv.scrollTop hasn't + // changed and the child div is not fully scrolled. + assert_equals(childDiv.scrollTop, + childDiv.scrollHeight - childDiv.clientHeight, + "The child div should fully scroll."); + } +} + +function flingLatchingCheck() { + if (parentDiv.scrollTop != 0) { + // Fail the test since the fling is not supposed to propagate to the parent + // div. + assert_equals(parentDiv.scrollTop, 0, + "The parent div is not supposed to scroll."); + } else if (rafCount == 10) { + // parentDiv.scrollTop remains 0 for 10 rafs. Fling is latched to the child + // div. + done(); + } else { + rafCount++; + requestAnimationFrame(flingLatchingCheck); + } +} + +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/wheel/wheel-scroll-latching-on-scrollbar.html b/third_party/WebKit/LayoutTests/fast/events/wheel/wheel-scroll-latching-on-scrollbar.html new file mode 100644 index 0000000..4a6bc89a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/wheel/wheel-scroll-latching-on-scrollbar.html
@@ -0,0 +1,121 @@ +<!DOCTYPE HTML> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<style> + + body { + margin: 0px; + height: 1000px; + width: 1000px; + } + #parentDiv { + background-color: #FF7F7F; + height: 600px; + width: 600px; + overflow: scroll; + } + #content1 { + height: 700px; + width: 700px; + } + #childDiv { + background-color: #84BE6A; + height: 500px; + width: 500px; + overflow: scroll; + } + #content2 { + height: 600px; + width: 600px; + } +</style> + +<div id="parentDiv"> + <div id="content1"> + <div id="childDiv"> + <div id="content2"> + </div> + </div> + </div> +</div> + +<script> +var childDiv = document.getElementById('childDiv'); +var parentDiv = document.getElementById('parentDiv'); +var rect = childDiv.getBoundingClientRect(); +const GESTURE_SOURCE_TYPE = 2; // MOUSE_INPUT from synthetic_gesture_params.h + +setup({ explicit_done: true }); +test(() => { + chrome.gpuBenchmarking.smoothScrollBy(150, waitForChildScrollAndCheck, + rect.right - 5, + (rect.top + rect.bottom) / 2, + GESTURE_SOURCE_TYPE, "down", 4000); + +}, "Scrolling on the child div scrollbar doesn't propagate to the parent div"); + +var lastScrollOffset = childDiv.scrollTop; +var rafCount = 0; + +// Wait for the child div to fully scroll. +function waitForChildScrollAndCheck() { + if (childDiv.scrollTop == childDiv.scrollHeight - childDiv.clientHeight) { + rafCount = 0; + waitForParentScrollAndCheck(); + } else if (childDiv.scrollTop != lastScrollOffset) { + lastScrollOffset = childDiv.scrollTop; + rafCount = 0; + requestAnimationFrame(waitForChildScrollAndCheck); + } else if (rafCount < 10) { + requestAnimationFrame(waitForChildScrollAndCheck); + rafCount++; + } else { + // Fail the test since for the last 10 rafs childDiv.scrollTop hasn't + // changed and the child div is not fully scrolled. + assert_equals(childDiv.scrollTop, + childDiv.scrollHeight - childDiv.clientHeight, + "The child div should be fully scrolled."); + } +} + +// Wait for 10 rafs, the scroll shouldn't get propagated to the parent div. +function waitForParentScrollAndCheck() { + if (parentDiv.scrollTop != 0) { + // Fail the test since the parent div has scrolled. + assert_equals(parentDiv.scrollTop, 0, + "The parent div is not supposed to scroll."); + } else if (rafCount < 10) { + requestAnimationFrame(waitForParentScrollAndCheck); + rafCount++; + } else { + rafCount = 0; + secondScrollCall(); + } +} + +// Scrolling on the scrollbar of the fully scrolled child div shouldn't get +// propagated to the parent div. +function secondScrollCall() { + chrome.gpuBenchmarking.smoothScrollBy(150, secondScrollShouldNotPropagate, + rect.right - 5, + (rect.top + rect.bottom) / 2, + GESTURE_SOURCE_TYPE, "down", 4000); +} + +// Wait for 10 rafs, if the parent div doesn't scroll the test will pass. +function secondScrollShouldNotPropagate() { + if (parentDiv.scrollTop != 0) { + // Fail the test since the parent div has scrolled. + assert_equals(parentDiv.scrollTop, 0, + "The parent div is not supposed to scroll."); + } else if (rafCount < 10) { + requestAnimationFrame(secondScrollShouldNotPropagate); + rafCount++; + } else { + done(); + } +} + +</script> + +
diff --git a/third_party/WebKit/LayoutTests/fast/text/ellipsis-stroked-expected.html b/third_party/WebKit/LayoutTests/fast/text/ellipsis-stroked-expected.html index 86888d58..da02ba8a 100644 --- a/third_party/WebKit/LayoutTests/fast/text/ellipsis-stroked-expected.html +++ b/third_party/WebKit/LayoutTests/fast/text/ellipsis-stroked-expected.html
@@ -13,7 +13,4 @@ </style> <!-- a span surrounding the ellipsis is needed so the stroke draws separately --> -<!-- <div>This text<span>…</span></div> ---> -<div>This text<span>...</span></div>
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin-expected.txt index e04c515fc..5db49111 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin-expected.txt
@@ -1,17 +1,16 @@ CONSOLE WARNING: Use of the Application Cache is deprecated on insecure origins. Support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. -CONSOLE WARNING: line 27: The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. -CONSOLE WARNING: line 32: The deviceorientation event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. -CONSOLE WARNING: line 42: getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. -CONSOLE WARNING: line 61: getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. -CONSOLE WARNING: line 36: Using requestMediaKeySystemAccess() on insecure origins is deprecated and will be removed in M58, around April 2017. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. +CONSOLE WARNING: line 26: The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. +CONSOLE WARNING: line 31: The deviceorientation event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. +CONSOLE WARNING: line 36: getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. +CONSOLE WARNING: line 55: getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. This is a testharness.js-based test. PASS device motion PASS device orientation -PASS requestMediaKeySystemAccess PASS getCurrentPosition PASS watchPosition PASS navigator.webkitGetUserMedia PASS navigator.mediaDevices.getUserMedia PASS appcache +PASS requestMediaKeySystemAccess Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin.html b/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin.html index 528fb97..e041c398 100644 --- a/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin.html +++ b/third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin.html
@@ -16,7 +16,6 @@ if (!window.internals) assert_unreached('window.internals is required for this test'); - // Tests for APIs that are deprecated, but still allowed, on // insecure origins async_test(function() { @@ -32,11 +31,6 @@ window.addEventListener('deviceorientation', this.step_func_done()); }, 'device orientation'); - promise_test(function(test) { - return navigator.requestMediaKeySystemAccess('org.w3.clearkey', - [{ videoCapabilities: [{contentType: 'video/webm; codecs="vp9"'}] }]); - }, 'requestMediaKeySystemAccess'); - // Tests for APIs that have been turned off on insecure origins async_test(function() { navigator.geolocation.getCurrentPosition( @@ -87,6 +81,10 @@ applicationCache.addEventListener('cached', cached, false); }, 'appcache'); + + test(function() { + assert_false('requestMediaKeySystemAccess' in navigator); + }, 'requestMediaKeySystemAccess'); } </script> </body>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness-expected.txt b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness-expected.txt deleted file mode 100644 index 62100eb6..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness-expected.txt +++ /dev/null
@@ -1,18 +0,0 @@ -This is a testharness.js-based test. -PASS PerformanceNavigationTiming interface: existence and properties of interface object -PASS PerformanceNavigationTiming interface object length -PASS PerformanceNavigationTiming interface object name -FAIL PerformanceNavigationTiming interface: existence and properties of interface prototype object assert_equals: class string of PerformanceNavigationTiming.prototype expected "[object PerformanceNavigationTimingPrototype]" but got "[object PerformanceNavigationTiming]" -PASS PerformanceNavigationTiming interface: existence and properties of interface prototype object's "constructor" property -PASS PerformanceNavigationTiming interface: attribute unloadEventStart -PASS PerformanceNavigationTiming interface: attribute unloadEventEnd -PASS PerformanceNavigationTiming interface: attribute domInteractive -PASS PerformanceNavigationTiming interface: attribute domContentLoadedEventStart -PASS PerformanceNavigationTiming interface: attribute domContentLoadedEventEnd -PASS PerformanceNavigationTiming interface: attribute domComplete -PASS PerformanceNavigationTiming interface: attribute loadEventStart -PASS PerformanceNavigationTiming interface: attribute loadEventEnd -PASS PerformanceNavigationTiming interface: attribute type -PASS PerformanceNavigationTiming interface: attribute redirectCount -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness.html deleted file mode 100644 index a2539002..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_idlharness.html +++ /dev/null
@@ -1,69 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>Navigation Timing 2 IDL tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> -<script src="/w3c/resources/testharness.js"></script> -<script src="/w3c/resources/testharnessreport.js"></script> -<script src="/w3c/resources/WebIDLParser.js"></script> -<script src="/w3c/resources/idlharness.js"></script> -</head> -<body> - -<pre id='untested_idl' style='display:none'> - -interface PerformanceResourceTiming : PerformanceEntry { - readonly attribute DOMString initiatorType; - readonly attribute DOMHighResTimeStamp workerStart; - readonly attribute DOMHighResTimeStamp redirectStart; - readonly attribute DOMHighResTimeStamp redirectEnd; - readonly attribute DOMHighResTimeStamp fetchStart; - readonly attribute DOMHighResTimeStamp domainLookupStart; - readonly attribute DOMHighResTimeStamp domainLookupEnd; - readonly attribute DOMHighResTimeStamp connectStart; - readonly attribute DOMHighResTimeStamp connectEnd; - readonly attribute DOMHighResTimeStamp secureConnectionStart; - readonly attribute DOMHighResTimeStamp requestStart; - readonly attribute DOMHighResTimeStamp responseStart; - readonly attribute DOMHighResTimeStamp responseEnd; - [MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long transferSize; - [MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long encodedBodySize; - [MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long decodedBodySize; -}; -</pre> - -<pre id='idl'> -enum NavigationType { - "navigate", - "reload", - "back_forward", - "prerender" -}; - -interface PerformanceNavigationTiming : PerformanceResourceTiming { - readonly attribute DOMHighResTimeStamp unloadEventStart; - readonly attribute DOMHighResTimeStamp unloadEventEnd; - readonly attribute DOMHighResTimeStamp domInteractive; - readonly attribute DOMHighResTimeStamp domContentLoadedEventStart; - readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd; - readonly attribute DOMHighResTimeStamp domComplete; - readonly attribute DOMHighResTimeStamp loadEventStart; - readonly attribute DOMHighResTimeStamp loadEventEnd; - readonly attribute NavigationType type; - readonly attribute unsigned short redirectCount; -}; -</pre> - -<script> -function test_idl() { - var idl_array = new IdlArray(); - idl_array.add_untested_idls(document.getElementById("untested_idl").textContent); - idl_array.add_idls(document.getElementById("idl").textContent); - idl_array.test(); -} -test_idl(); -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_exist.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_exist.html deleted file mode 100644 index 3d0a83b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_exist.html +++ /dev/null
@@ -1,66 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that PerformanceObserver can observe nav timing 2 instance and that the expected attributes in nav timing 2 instance exist (but does not validate that the values are correct).</p> - - <script> - var navTiming2Attributes = [ - 'connectEnd', - 'connectStart', - 'decodedBodySize', - 'domComplete', - 'domContentLoadedEventEnd', - 'domContentLoadedEventStart', - 'domInteractive', - 'domainLookupEnd', - 'domainLookupStart', - 'duration', - 'encodedBodySize', - 'entryType', - 'fetchStart', - 'initiatorType', - 'loadEventEnd', - 'loadEventStart', - 'name', - 'redirectCount', - 'redirectEnd', - 'redirectStart', - 'requestStart', - 'responseEnd', - 'responseStart', - 'secureConnectionStart', - 'transferSize', - 'type', - 'unloadEventEnd', - 'unloadEventStart', - 'workerStart' - ]; - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - var entries = entryList.getEntries(); - assert_equals(entries.length, 1, - "There should be only one navigation timing instance."); - for (var i = 0; i < navTiming2Attributes.length; i++) { - assert_true(navTiming2Attributes[i] in entries[0], - "Expected attribute: " + navTiming2Attributes[i] + "."); - } - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Performance navigation timing entries are observable."); - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_values.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_values.html deleted file mode 100644 index 6b1407d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_values.html +++ /dev/null
@@ -1,97 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that the values of nav timing 2 instance's timing-related attributes are in certain order and the others are of expected values.</p> - - <script> - var navTiming2EventOrder1 = [ - 'startTime', - 'redirectStart', - //'unloadEventStart', - 'redirectEnd', - //'unloadEventEnd', - 'fetchStart', - 'domainLookupStart', - 'domainLookupEnd', - 'connectStart', - //'secureConnectionStart', - 'connectEnd', - 'requestStart', - 'responseStart', - 'responseEnd', - 'domInteractive', - 'domContentLoadedEventStart', - 'domContentLoadedEventEnd', - 'domComplete', - 'loadEventStart', - 'loadEventEnd' - ]; - - var navTiming2EventOrder2 = [ - 'redirectStart', - 'unloadEventStart', - 'redirectEnd', - 'unloadEventEnd', - 'fetchStart' - ]; - - var navTiming2EventOrder3 = [ - 'connectStart', - 'secureConnectionStart', - 'connectEnd' - ]; - - function verifyTimingEventOrder(eventOrder, timingEntry) { - for (var i = 0; i < eventOrder.length - 1; i++) { - assert_true(timingEntry[eventOrder[i]] <= timingEntry[eventOrder[i + 1]], - "Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + "."); - } - } - - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - var entries = entryList.getEntries(); - assert_equals(entries[0].entryType, "navigation", - "Expected entryType to be: navigation."); - assert_equals(entries[0].name, "http://127.0.0.1:8000/w3c/webperf/approved/navigation-timing/html/nav2_test_attributes_values.html"); - assert_equals(entries[0].startTime, 0, - "Expected startTime to be: 0."); - assert_equals(entries[0].duration, entries[0].loadEventEnd, - "Expected duration to be equal to loadEventEnd."); - assert_equals(entries[0].initiatorType, "navigation", - "Expected initiatorType to be equal to navigation."); - // This test may fail when response is from cach. Disable or clean cach before - // running this test. - assert_true(entries[0].transferSize > entries[0].encodedBodySize, - "Expected transferSize to be greater than encodedBodySize in uncached navigation."); - assert_equals(entries[0].encodedBodySize, 4180); - assert_equals(entries[0].decodedBodySize, 4180); - verifyTimingEventOrder(entries[0], navTiming2EventOrder1); - // When unloadEvent happens - if (entries[0]["unloadEventStart"] != 0) { - verifyTimingEventOrder(entries[0], navTiming2EventOrder2); - } - // When a secure transport is used - if (entries[0]["secureConnectionStart"] != 0) { - verifyTimingEventOrder(entries[0], navTiming2EventOrder3); - } - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Performance navigation timing instance's value is reasonable."); - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_document_open.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_document_open.html deleted file mode 100644 index 4135f52..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_document_open.html +++ /dev/null
@@ -1,100 +0,0 @@ - <!DOCTYPE html> - <html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - var navTiming2Attributes = [ - 'connectEnd', - 'connectStart', - 'decodedBodySize', - 'domComplete', - 'domContentLoadedEventEnd', - 'domContentLoadedEventStart', - 'domInteractive', - 'domainLookupEnd', - 'domainLookupStart', - 'duration', - 'encodedBodySize', - 'entryType', - 'fetchStart', - 'initiatorType', - 'loadEventEnd', - 'loadEventStart', - 'name', - 'redirectCount', - 'redirectEnd', - 'redirectStart', - 'requestStart', - 'responseEnd', - 'responseStart', - 'secureConnectionStart', - 'transferSize', - 'type', - 'unloadEventEnd', - 'unloadEventStart', - 'workerStart' - ]; - - var originalTiming = {}; - var didOpen = false; - - function onload_test() - { - if (!didOpen) { - setTimeout(testTimingWithDocumentOpen, 0); - didOpen = true; - } - } - - function testTimingWithDocumentOpen() - { - var subcontentWindow = document.getElementById("frameContext").contentWindow; - - var timing = subcontentWindow.performance.getEntriesByType("navigation")[0]; - for (i in navTiming2Attributes) { - originalTiming[navTiming2Attributes[i]] = timing[navTiming2Attributes[i]]; - } - - var subdocument = subcontentWindow.document; - subdocument.open(); - subdocument.write('<!DOCTYPE HTML>'); - subdocument.write('<html>'); - subdocument.write('<head>'); - subdocument.write('<meta charset="utf-8" />'); - subdocument.write('<title><Green Test Page</title>'); - subdocument.write('</head>'); - subdocument.write('<body style="background-color:#00FF00;">'); - subdocument.write('</body>'); - subdocument.write('</html>'); - subdocument.close(); - - setTimeout(function() { - var timing = subcontentWindow.performance.getEntriesByType("navigation")[0]; - for (var i in navTiming2Attributes) { - assert_equals(originalTiming[navTiming2Attributes[i]], timing[navTiming2Attributes[i]], - navTiming2Attributes[i] + " is the same after document open."); - } - done(); - }, 0); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates window.performance.getEntriesByType("navigation") remains constant when a - document is replaced using document.open.</p> - - <p>This page should be loaded with a yellow frame below. It then replaces the - document in that frame with a green document.</p> - - <p>The test passes if all of the checks to performance.getEntriesByType("navigation") are correct and - the frame below ends with a green background.</p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/blank_page_yellow.htm" style="width: 250px; height: 250px;"></iframe> - </body> - </html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_instance_accessors.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_instance_accessors.html deleted file mode 100644 index 77750c2..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_instance_accessors.html +++ /dev/null
@@ -1,74 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that nav timing 2 instance can be accessed by three different accessors once available: window.performance.getEntries()/getEntriesByType("navigation")/getEntriesByName("<Requested URL>")</p> - - <script> - var navTiming2Attributes = [ - 'connectEnd', - 'connectStart', - 'decodedBodySize', - 'domComplete', - 'domContentLoadedEventEnd', - 'domContentLoadedEventStart', - 'domInteractive', - 'domainLookupEnd', - 'domainLookupStart', - 'duration', - 'encodedBodySize', - 'entryType', - 'fetchStart', - 'initiatorType', - 'loadEventEnd', - 'loadEventStart', - 'name', - 'redirectCount', - 'redirectEnd', - 'redirectStart', - 'requestStart', - 'responseEnd', - 'responseStart', - 'secureConnectionStart', - 'transferSize', - 'type', - 'unloadEventEnd', - 'unloadEventStart', - 'workerStart' - ]; - - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - var instance1 = performance.getEntries()[0]; - var instance2 = performance.getEntriesByType("navigation")[0]; - var instance3 = performance.getEntriesByName("http://127.0.0.1:8000/w3c/webperf/approved/navigation-timing/html/nav2_test_instance_accessors.html")[0]; - - assert_equals(performance.getEntriesByType("navigation").length, 1, "Expected there is only one navigation timing instance."); - assert_equals(performance.getEntriesByName("http://127.0.0.1:8000/w3c/webperf/approved/navigation-timing/html/nav2_test_instance_accessors.html").length, 1, "Expected there is only one navigation timing instance."); - - for (var i = 0; i < navTiming2Attributes.length; i++) { - assert_equals(instance1[navTiming2Attributes[i]], instance2[navTiming2Attributes[i]]); - } - - for (var i = 0; i < navTiming2Attributes.length; i++) { - assert_equals(instance1[navTiming2Attributes[i]], instance3[navTiming2Attributes[i]]); - } - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Performance navigation timing entries are accessible through three different accessors."); - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigate_within_document.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigate_within_document.html deleted file mode 100644 index f39ca05..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigate_within_document.html +++ /dev/null
@@ -1,83 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" > - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that all of the window.performance.getEntriesByType("navigation") attributes remain unchanged after an in document navigation (URL fragment change).</p> - - <script> - var navTiming2Attributes = [ - 'connectEnd', - 'connectStart', - 'decodedBodySize', - 'domComplete', - 'domContentLoadedEventEnd', - 'domContentLoadedEventStart', - 'domInteractive', - 'domainLookupEnd', - 'domainLookupStart', - 'duration', - 'encodedBodySize', - 'entryType', - 'fetchStart', - 'initiatorType', - 'loadEventEnd', - 'loadEventStart', - 'name', - 'redirectCount', - 'redirectEnd', - 'redirectStart', - 'requestStart', - 'responseEnd', - 'responseStart', - 'secureConnectionStart', - 'transferSize', - 'type', - 'unloadEventEnd', - 'unloadEventStart', - 'workerStart' - ]; - - var initial_timing = {}; - - function check_timing_not_changed() - { - var timing = window.performance.getEntriesByType("navigation")[0]; - for (var i = 0; i < navTiming2Attributes.length; ++i) - { - var property = navTiming2Attributes[i]; - assert_equals(timing[property], initial_timing[property], - property + " is the same after in document navigation."); - } - done(); - } - - function save_timing_after_load() - { - var timing = window.performance.getEntriesByType("navigation")[0]; - for (var i = 0; i < navTiming2Attributes.length; ++i) - { - var property = navTiming2Attributes[i]; - initial_timing[property] = timing[property]; - } - window.location.href = "#1"; - setTimeout("check_timing_not_changed()", 0); - } - - function load_handler() - { - window.removeEventListener("load", load_handler); - setTimeout("save_timing_after_load()", 0); - } - - window.addEventListener("load", load_handler, false); - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_backforward.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_backforward.html deleted file mode 100644 index 9bdf4ebd..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_backforward.html +++ /dev/null
@@ -1,81 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function onload_test() - { - // do this with a timeout to see the visuals of the navigations. - setTimeout("nav_frame();", 100); - } - - var step = 1; - function nav_frame() - { - var navigation_frame = document.getElementById("frameContext").contentWindow; - switch (step) - { - case 1: - { - navigation_frame.location.href = '/w3c/webperf/resources/blank_page_green_with_onunload.htm'; - step++; - break; - } - case 2: - { - assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type, - "navigate", - 'Expected navigation type to be navigate.'); - navigation_frame.history.back(); - step++; - break; - } - case 3: - { - assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type, - "back_forward", - 'Expected navigation type to be back_forward.'); - step++; - navigation_frame.history.forward(); - break; - } - case 4: - { - assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type, - "back_forward", - 'Expected navigation type to be back_forward.'); - done(); - step++; - break; - } - default: - break; - } - } - </script> - - </head> - <body> - <h1> - Description</h1> - <p> - This test validates the value of window.performance.getEntriesByType("navigation")[0].type with a forward - and back navigation.</p> - - <p>This page should be loaded with a yellow background frame below. It should turn green for a starting - navigation, back to yellow for a back navigation and then back to green again for a forward navigation.</p> - - <p>Along the navigation timeline the window.performance.getEntriesByType("navigation")[0].type is checked for back_forward.</p> - - <p>This test passes if all of the checks to the window.performance.getEntriesByType("navigation")[0].type are correct throughout the navigation - scenario and the frame below ends with a green background. Otherwise, this test fails.</p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/blank_page_yellow_with_onunload.htm" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_navigate.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_navigate.html deleted file mode 100644 index efaef1e..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_navigate.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - assert_equals(entryList.getEntries()[0].type, "navigate", "Expected navigation type to be navigate."); - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Navigation type to be navigate."); - </script> - - </head> - <body> - <h1> - Description</h1> - <p> - This test validates the value of window.performance.getEntriesByType("navigation")[0].type to be navigate.</p> - - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_reload.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_reload.html deleted file mode 100644 index d4385e1..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_navigation_type_reload.html +++ /dev/null
@@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - var reload_frame; - - function onload_test() - { - reload_frame = document.getElementById("frameContext"); - reload_frame.onload = function() { - setTimeout(do_test, 0); - } - setTimeout("reload_the_frame();", 100); - } - - function reload_the_frame() - { - reload_frame.contentWindow.location.reload(true); - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "reload", "Expected navigation type to be reload."); - assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadEventStart to be greater than 0."); - assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEventEnd to be greater than 0."); - done(); - } - </script> - </head> - <body onload="onload_test();"> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "reload" after reload</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart > 0 after reload</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd > 0 after reload</li> - </ul> - </p> - - <iframe id="frameContext" src="/w3c/webperf/resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_blank_page.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_blank_page.html deleted file mode 100644 index dbd5751b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_blank_page.html +++ /dev/null
@@ -1,28 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - - <script> - - function onload_test() - { - var iframe_performance = document.getElementById("frameContext").contentWindow.performance; - assert_equals(iframe_performance.getEntriesByType("navigation").length, 0, "Expected there is no navigation timing instance"); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates there does not exist a navigation timing instance when opening internal pages like about:blank.</p> - - <iframe id="frameContext" onload="onload_test();" src="about:blank" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_data_uri.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_data_uri.html deleted file mode 100644 index 284f01b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_open_data_uri.html +++ /dev/null
@@ -1,30 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates there does not exist a navigation timing instance when opening a data uri. This data uri is equivalent to nav2_data_uri.html.</p> - - <script> -async_test(function(t) { - var gotEvent = false; - window.addEventListener("message", t.step_func(function() { - assert_unreached("A navigation timing instance existed"); - })); - window.addEventListener("load", t.step_func(function() { - t.step_timeout(function() { t.done(); }, 2000); - })); -}, "Navigation timing instance existence"); - </script> - - <iframe src="data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Ctitle%3Edata%20URL%20source%20for%20navigation-timing%2Fnav2_test_open_data_uri.html%3C%2Ftitle%3E%0D%0A%3C%21--%20NB%3A%20this%20file%20isn%27t%20actually%20used%20any%20where%21%20--%3E%0D%0A%3Clink%20rel%3D%22author%22%20title%3D%22Google%22%20href%3D%22http%3A%2F%2Fwww.google.com%2F%22%20%2F%3E%0D%0A%3Cscript%3E%0D%0Avar%20observer%20%3D%20new%20PerformanceObserver%28%0D%0A%20%20%20%20function%20%28entryList%29%20%7B%0D%0A%20%20%20%20%20%20%20%20parent.postMessage%28%22observed%22%2C%20%22%2A%22%29%3B%0D%0A%20%20%20%20%20%20%20%20observer.disconnect%28%29%3B%0D%0A%20%20%20%20%7D%29%3B%0D%0Aobserver.observe%28%7BentryTypes%3A%20%5B%22navigation%22%5D%7D%29%3B%0D%0A%3C%2Fscript%3E%0D%0A"></iframe> - <!-- NB: see nav2_data_uri.html for the source of that data URI --> - </body> -</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_none.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_none.html deleted file mode 100644 index 97437e1a..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_none.html +++ /dev/null
@@ -1,33 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that the value of the window.performance.getEntriesByType("navigation")[0].redirectCount attribute, as well as the window.performance.getEntriesByType("navigation")[0].redirectStart and redirectEnd attributes on a non-redirected navigation.</p> - - <script> - - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - var navTiming = performance.getEntriesByType("navigation")[0]; - assert_equals(navTiming.redirectCount, 0, "Expected redirectCount to be 0."); - assert_equals(navTiming.redirectStart, 0, "Expected redirectStart to be 0."); - assert_equals(navTiming.redirectEnd, 0, "Expected redirectEnd to be 0."); - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Naivation without redirects."); - </script> - </body> -</html> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_server.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_server.html deleted file mode 100644 index 493304e..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_server.html +++ /dev/null
@@ -1,46 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - - <script> - - function verifyTimingEventOrder(eventOrder, timingEntry) { - for (var i = 0; i < eventOrder.length - 1; i++) { - assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]], - "Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + "."); - } - } - - function onload_test() - { - var frame_performance = document.getElementById("frameContext").contentWindow.performance; - assert_equals(frame_performance.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1."); - - var timgingEvents = [ - 'startTime', - 'redirectStart', - 'redirectEnd', - ]; - verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the values of the window.performance.redirectCount and the - window.performance.timing.redirectStart/End times for a same-origin server side redirect navigation.</p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/redirect.php?location=/w3c/webperf/resources/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver.html deleted file mode 100644 index 189ef3b3..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver.html +++ /dev/null
@@ -1,48 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function onload_test() - { - var performanceNamespace = document.getElementById("frameContext").contentWindow.performance; - assert_equals(performanceNamespace.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectCount, 0, - "Expected redirectCount to be 0."); - assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectStart, 0, - "Expected redirectStart to be 0."); - assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectEnd, 0, - "Expected redirectEnd to be 0."); - - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the - window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation.</p> - - <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> - <script> - // combine the page origin and redirect origin into the IFRAME's src URL - var pageOrigin = '127.0.0.1:8000'; - var redirectOrigin = 'localhost:8000'; - var destUrl = 'http://' + redirectOrigin + '/w3c/webperf/resources/redirect.php'; - destUrl += '?location=http://' + pageOrigin + '/w3c/webperf/resources/blank_page_green.htm'; - - var frameContext = document.getElementById("frameContext"); - frameContext.onload = onload_test; - frameContext.src = destUrl; - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver_opt_in.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver_opt_in.html deleted file mode 100644 index 2e28ae21..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_redirect_xserver_opt_in.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function verifyTimingEventOrder(eventOrder, timingEntry) { - for (var i = 0; i < eventOrder.length - 1; i++) { - assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]], - "Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + "."); - } - } - - function onload_test() - { - var frame_performance = document.getElementById("frameContext").contentWindow.performance; - assert_equals(frame_performance.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1."); - - var timgingEvents = [ - 'startTime', - 'redirectStart', - 'redirectEnd', - ]; - verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the - window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation when the redirect chooses to opt-in.</p> - - <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> - <script> - // combine the page origin and redirect origin into the IFRAME's src URL - // combine the page origin and redirect origin into the IFRAME's src URL - var pageOrigin = '127.0.0.1:8000'; - var redirectOrigin = 'localhost:8000'; - var destUrl = 'http://' + redirectOrigin + '/w3c/webperf/resources/redirect-opt-in.php'; - destUrl += '?location=http://' + pageOrigin + '/w3c/webperf/resources/blank_page_green.htm'; - var frameContext = document.getElementById("frameContext"); - frameContext.onload = onload_test; - frameContext.src = destUrl; - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unique_nav_instances.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unique_nav_instances.html deleted file mode 100644 index 1d77ab6..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unique_nav_instances.html +++ /dev/null
@@ -1,76 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - </head> - <body> - <h1>Description</h1> - <p>This test validates that each window has a unique nav timing 2 instance.</p> - <iframe id="frameContext" src="resources/blank_page_green.html" style="display:none;";></iframe> - <script> - - var navTiming2Attributes = [ - 'connectEnd', - 'connectStart', - 'decodedBodySize', - 'domComplete', - 'domContentLoadedEventEnd', - 'domContentLoadedEventStart', - 'domInteractive', - 'domainLookupEnd', - 'domainLookupStart', - 'duration', - 'encodedBodySize', - 'entryType', - 'fetchStart', - 'initiatorType', - 'loadEventEnd', - 'loadEventStart', - 'name', - 'redirectCount', - 'redirectEnd', - 'redirectStart', - 'requestStart', - 'responseEnd', - 'responseStart', - 'secureConnectionStart', - 'transferSize', - 'type', - 'unloadEventEnd', - 'unloadEventStart', - 'workerStart' - ]; - - function not_same_instance(instance1, instance2, attributes) { - for (var i in attributes) { - if (instance1[attributes[i]] != instance2[attributes[i]]) - return true; - } - return false; - } - - async_test(function (t) { - var observer = new PerformanceObserver( - t.step_func(function (entryList) { - assert_equals(entryList.getEntriesByType("navigation").length, 1, "Only one nav timing instance exists."); - assert_equals(document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation").length, 1, - "Only one nav timing instance exists."); - var main_frame_instance = entryList.getEntriesByType("navigation")[0]; - var iframe_instance = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_true(not_same_instance(main_frame_instance, iframe_instance, navTiming2Attributes), - "Two nav timing instances are not the same instance."); - observer.disconnect(); - t.done(); - }) - ); - observer.observe({entryTypes: ["navigation"]}); - - }, "Each window has a unique nav timing 2 instance."); - </script> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_no_previous_document.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_no_previous_document.html deleted file mode 100644 index 4000468..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_no_previous_document.html +++ /dev/null
@@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - - <script> - - function onload_test() - { - var frame = document.getElementById("frameContext"); - - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventStart, 0, - "Expected unloadEventStart to be 0."); - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventEnd, 0, - "Expected unloadEventEnd to be 0."); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the unload event times are 0 when there is no previous document.</p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_previous_document_cross_origin.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_previous_document_cross_origin.html deleted file mode 100644 index c3fbaf47..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_previous_document_cross_origin.html +++ /dev/null
@@ -1,44 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function onload_test() - { - var reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - reload_frame.contentWindow.location.href = "/w3c/webperf/resources/blank_page_green.htm"; - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0."); - assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a navigation on top of a cross-origin document.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart = 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd = 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="127.0.0.1:8000" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_cross_origin_redirects.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_cross_origin_redirects.html deleted file mode 100644 index c2750c2c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_cross_origin_redirects.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - var reload_frame; - - function onload_test() - { - reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - setTimeout("reload_the_frame();", 100); - } - - function reload_the_frame() - { - var pageOrigin = '127.0.0.1:8000'; - var redirectOrigin = 'localhost:8000'; - var destUrl = 'http://' + redirectOrigin + '/w3c/webperf/resources/redirect.php'; - destUrl += '?location=http://' + pageOrigin + '/w3c/webperf/resources/blank_page_yellow.htm'; - reload_frame.contentWindow.location.href = destUrl; - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0."); - assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_previous_document.html b/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_previous_document.html deleted file mode 100644 index 189e4d4..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/w3c/webperf/approved/navigation-timing/html/nav2_test_unloadEvents_with_previous_document.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function onload_test() - { - var reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - reload_frame.contentWindow.location.reload(true); - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadEventStart to be greater than 0."); - assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEventEnd to be greater than 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart > 0 after reload</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd > 0 after reload</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="/w3c/webperf/resources/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-filtering.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-filtering.html index 13c4cc56..1073b34 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-filtering.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-filtering.html
@@ -50,7 +50,6 @@ {"name": "Program", "ts": 2590000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default-devtools.timeline", "args": {}} ]; - var model = InspectorTest.createPerformanceModelWithEvents(testData); var view = new Timeline.EventsTimelineTreeView(UI.panels.timeline._filters, null); view.setModel(model); @@ -72,11 +71,11 @@ InspectorTest.addResult("Filtered by 'bar':"); var textFilterUI = filtersControl._textFilterUI; - textFilterUI.setValue("bar"); + textFilterUI._internalSetValue("bar", true); dumpRecords(); InspectorTest.addResult("Filtered by 'foo':"); - textFilterUI.setValue("foo"); + textFilterUI._internalSetValue("foo", true); dumpRecords(); InspectorTest.completeTest();
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-unique-origin.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-unique-origin.html index 4492bde..bfadd30 100644 --- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-unique-origin.html +++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-unique-origin.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <head> - <title>Unique origin is unable to create MediaKeys</title> + <title>requestMediaKeySystemAccess() is not available on unique origin</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> </head> @@ -31,22 +31,15 @@ } promise_test(function(test) { + // TODO(xhwang): Also check other EME APIs. var script = 'data:text/html,' + '<script>' + ' window.onmessage = function(e) {' + - ' navigator.requestMediaKeySystemAccess(\'org.w3.clearkey\', [{' + - ' initDataTypes: [ \'keyids\' ],' + - ' audioCapabilities: [' + - ' { contentType: \'audio/mp4; codecs="mp4a.40.2"\' },' + - ' { contentType: \'audio/webm; codecs="opus"\' }' + - ' ]' + - ' }]).then(function(access) {' + - ' return access.createMediaKeys();' + - ' }).then(function(mediaKeys) {' + - ' window.parent.postMessage({result: \'allowed\'}, \'*\');' + - ' }, function(error) {' + - ' window.parent.postMessage({result: \'failed\'}, \'*\');' + - ' });' + + ' if (\'requestMediaKeySystemAccess\' in navigator) {' + + ' window.parent.postMessage({result: \'available\'}, \'*\');' + + ' } else { ' + + ' window.parent.postMessage({result: \'unavailable\'}, \'*\');' + + ' }' + ' };' + '<\/script>'; @@ -66,9 +59,9 @@ iframe.contentWindow.postMessage({}, '*'); return wait_for_message(); }).then(function(message) { - assert_equals(message.result, 'failed'); + assert_equals(message.result, 'unavailable'); }); - }, 'Unique origin is unable to create MediaKeys'); + }, 'requestMediaKeySystemAccess() is not available on unique origin'); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png deleted file mode 100644 index f5044cf..0000000 --- a/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png deleted file mode 100644 index 6cd32f4..0000000 --- a/third_party/WebKit/LayoutTests/platform/android/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png index 4057c9c2..e02c2b08 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png index 177fdf6..93fb926 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png index 458a572..6d7b22d2 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png index 57f6a0a3..b41581c 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png index 46c8200d..f5044cf 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png index 5f8349a..6cd32f4 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png index 29f4093..bd2d0d5 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png index c2d7b4c..dea3a6e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png index aa4f227..1ef6ba8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png index 3b94e80..5f873bd 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png index be8a19b..5ad85e0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png index e7f9429..6bcef7d 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png index c89447b3..ea9b0df 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png index ce892993..4ffe0d4a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png index 41eebec..9b4d093 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png index bb88266..484cf55 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png index 1f5e632..6ea56fd9 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png index 3e25479..8a5d1be 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png index aac9ddd..4207cd3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png index b2420791..6e82c19 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png index 0211b2a..66575e0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png index 5ed6ab50..0c2c7f0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png index b92884a..39a9297 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png index 1ec5318..37ab21c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png index bdd4a1d..1c012f79 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png index 48f6c7f..6c1d741 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png index da5cdeab..30c5bef6 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png index 66c6b58..e36a657 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png index 6ea34ae61..7de2dac 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-composition-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png index 2075ed7..267ae6cd 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/ellipsis-rtl-text-in-rtl-flow-underline-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/canvas-fillPath-shadow-expected.txt b/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/canvas-fillPath-shadow-expected.txt deleted file mode 100644 index d494c5a..0000000 --- a/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/canvas-fillPath-shadow-expected.txt +++ /dev/null
@@ -1,37 +0,0 @@ -Ensure correct behavior of canvas with path fill shadow - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is within 3 of 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 20 -PASS data[2] is 0 -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS data[0] is 255 -PASS data[1] is 0 -PASS data[2] is 0 -PASS data[3] should not be 255 and it's not. -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/webaudio/Analyser/handle-silent-inputs.html b/third_party/WebKit/LayoutTests/webaudio/Analyser/handle-silent-inputs.html new file mode 100644 index 0000000..f1db505b --- /dev/null +++ b/third_party/WebKit/LayoutTests/webaudio/Analyser/handle-silent-inputs.html
@@ -0,0 +1,137 @@ +<!doctype html> +<html> + <head> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="../resources/audit-util.js"></script> + <script src="../resources/audit.js"></script> + <title>Handle Silent Inputs to AnalyserNode</title> + </head> + + <body> + <script> + let audit = Audit.createTaskRunner(); + let sampleRate = 16000; + let renderDuration = 1; + let renderFrames = renderDuration * sampleRate; + + audit.define('connected', function(task, should) { + task.describe('Test handling of silent inputs'); + + tester(should, false).then(task.done.bind(task)); + }); + + audit.define('auto-pull', function(task, should) { + task.describe('Test handling of silent inputs'); + + tester(should, true).then(task.done.bind(task)); + }); + + audit.define('timing', function(task, should) { + task.describe('Test shifting in of zeroes after source has stopped'); + + let renderQuantumFrames = 128; + + // sampleRate chosen to be a power of two so we don't have round-off + // errors in computing the times for when to suspend the context. + let context = new OfflineAudioContext(1, 16384, 16384); + let source = new ConstantSourceNode(context); + + // The fftSize for the analyser is fairly arbitrary, except the code + // assumes it is larger than 128. + let analyser = new AnalyserNode(context, {fftSize: 2048}); + + source.connect(analyser).connect(context.destination); + + source.start(); + + // Stop the source after 1 fftSize frames. + let time = analyser.fftSize / context.sampleRate; + source.stop(time); + + // Verify that the time data at this point is constant. + context.suspend(time) + .then(() => { + let data = new Float32Array(analyser.fftSize); + analyser.getFloatTimeDomainData(data); + should( + data, 'At time ' + context.currentTime + + ' Analyser frames [0, ' + analyser.fftSize + ')') + .beConstantValueOf(1); + }) + .then(context.resume.bind(context)); + + // After each rendering quantum from the point at which the source + // stopped, verify that zeroes are inserted into the time data one + // rendering quantum at a time. + + let limit = analyser.fftSize / renderQuantumFrames; + + for (let k = 1; k <= limit; ++k) { + let analyserTime = + (analyser.fftSize + k * renderQuantumFrames) / context.sampleRate; + context.suspend(analyserTime) + .then(() => { + let data = new Float32Array(analyser.fftSize); + let indexNewest = analyser.fftSize - k * renderQuantumFrames; + analyser.getFloatTimeDomainData(data); + if (k < limit) { + should( + data.slice(0, indexNewest), 'At time ' + + context.currentTime + ' Analyser frames [0, ' + + indexNewest + ')') + .beConstantValueOf(1); + } + should( + data.slice(indexNewest), 'At time ' + context.currentTime + + ' Analyser frames [' + indexNewest + ', ' + + analyser.fftSize + ')') + .beConstantValueOf(0); + }) + .then(context.resume.bind(context)); + } + + // Start the test + context.startRendering().then(() => task.done()); + }); + + audit.run(); + + function tester(should, isAutoPullTest) { + // Connect an oscillator to an analyser for testing the time data of the + // analyser after the oscillator stops. + let context = new OfflineAudioContext(1, renderFrames, sampleRate); + let source = new OscillatorNode(context); + let analyser = new AnalyserNode(context, {fftSize: 128}); + let timeData = new Float32Array(analyser.fftSize); + timeData.fill(NaN); + + source.connect(analyser); + + // For the automatic pull test, leave the analyser output disconnected. + if (isAutoPullTest) { + source.connect(context.destination); + } else { + analyser.connect(context.destination); + } + + source.start(); + + // Stop the source well in advance of when we want to get the time data + // from the analyser. + let stopTime = 0.1; + let dataTime = 0.5; + + source.stop(stopTime); + context.suspend(dataTime) + .then(() => { analyser.getFloatTimeDomainData(timeData); }) + .then(context.resume.bind(context)); + + return context.startRendering().then(buffer => { + should(timeData, 'Analyser time data at time ' + dataTime) + .beConstantValueOf(0); + }); + } + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/webauth/idl-expected.txt b/third_party/WebKit/LayoutTests/webauth/idl-expected.txt new file mode 100644 index 0000000..c4f1af0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/webauth/idl-expected.txt
@@ -0,0 +1,39 @@ +This is a testharness.js-based test. +PASS ScopedCredentialInfo interface: existence and properties of interface object +PASS ScopedCredentialInfo interface object length +PASS ScopedCredentialInfo interface object name +FAIL ScopedCredentialInfo interface: existence and properties of interface prototype object assert_equals: class string of ScopedCredentialInfo.prototype expected "[object ScopedCredentialInfoPrototype]" but got "[object ScopedCredentialInfo]" +PASS ScopedCredentialInfo interface: existence and properties of interface prototype object's "constructor" property +PASS ScopedCredentialInfo interface: attribute clientData +PASS ScopedCredentialInfo interface: attribute attestation +PASS AuthenticationAssertion interface: existence and properties of interface object +PASS AuthenticationAssertion interface object length +PASS AuthenticationAssertion interface object name +FAIL AuthenticationAssertion interface: existence and properties of interface prototype object assert_equals: class string of AuthenticationAssertion.prototype expected "[object AuthenticationAssertionPrototype]" but got "[object AuthenticationAssertion]" +PASS AuthenticationAssertion interface: existence and properties of interface prototype object's "constructor" property +PASS AuthenticationAssertion interface: attribute credential +PASS AuthenticationAssertion interface: attribute clientData +PASS AuthenticationAssertion interface: attribute authenticatorData +PASS AuthenticationAssertion interface: attribute signature +PASS ScopedCredential interface: existence and properties of interface object +PASS ScopedCredential interface object length +PASS ScopedCredential interface object name +FAIL ScopedCredential interface: existence and properties of interface prototype object assert_equals: class string of ScopedCredential.prototype expected "[object ScopedCredentialPrototype]" but got "[object ScopedCredential]" +PASS ScopedCredential interface: existence and properties of interface prototype object's "constructor" property +PASS ScopedCredential interface: attribute type +PASS ScopedCredential interface: attribute id +PASS WebAuthentication interface: existence and properties of interface object +PASS WebAuthentication interface object length +PASS WebAuthentication interface object name +FAIL WebAuthentication interface: existence and properties of interface prototype object assert_equals: class string of WebAuthentication.prototype expected "[object WebAuthenticationPrototype]" but got "[object WebAuthentication]" +PASS WebAuthentication interface: existence and properties of interface prototype object's "constructor" property +PASS WebAuthentication interface: operation makeCredential(Account,[object Object],BufferSource,ScopedCredentialOptions) +PASS WebAuthentication interface: operation getAssertion(BufferSource,AssertionOptions) +PASS WebAuthentication must be primary interface of navigator.authentication +PASS Stringification of navigator.authentication +PASS WebAuthentication interface: navigator.authentication must inherit property "makeCredential" with the proper type (0) +PASS WebAuthentication interface: calling makeCredential(Account,[object Object],BufferSource,ScopedCredentialOptions) on navigator.authentication with too few arguments must throw TypeError +PASS WebAuthentication interface: navigator.authentication must inherit property "getAssertion" with the proper type (1) +PASS WebAuthentication interface: calling getAssertion(BufferSource,AssertionOptions) on navigator.authentication with too few arguments must throw TypeError +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/webauth/idl.html b/third_party/WebKit/LayoutTests/webauth/idl.html new file mode 100644 index 0000000..730d8cf --- /dev/null +++ b/third_party/WebKit/LayoutTests/webauth/idl.html
@@ -0,0 +1,105 @@ +<!DOCTYPE html> +<script src=../resources/testharness.js></script> +<script src=../resources/testharnessreport.js></script> +<script src=../resources/WebIDLParser.js></script> +<script src=../resources/idlharness.js></script> +<script type="text/plain" id="tested"> +[SecureContext] +interface ScopedCredentialInfo { + readonly attribute ArrayBuffer clientData; + readonly attribute ArrayBuffer attestation; +}; + +dictionary RelyingPartyAccount { + required DOMString rpDisplayName; + required DOMString displayName; + required DOMString id; + DOMString name; + DOMString imageURL; +}; + +dictionary ScopedCredentialParameters { + required ScopedCredentialType type; + required AlgorithmIdentifier algorithm; +}; + +dictionary ScopedCredentialOptions { + unsigned long timeoutSeconds; + USVString rpId; + sequence < ScopedCredentialDescriptor > excludeList; + AuthenticationExtension extensions; +}; + +[SecureContext] +interface AuthenticationAssertion { + readonly attribute ScopedCredential credential; + readonly attribute ArrayBuffer clientData; + readonly attribute ArrayBuffer authenticatorData; + readonly attribute ArrayBuffer signature; +}; + +dictionary AssertionOptions { + unsigned long timeoutSeconds; + USVString rpId; + sequence < ScopedCredentialDescriptor > allowList; + AuthenticationExtension extensions; +}; + +dictionary AuthenticationExtension { +}; + +dictionary AuthenticationClientData { + required DOMString challenge; + required DOMString origin; + required AlgorithmIdentifier hashAlg; + DOMString tokenBinding; + AuthenticationExtension extensions; +}; + +enum ScopedCredentialType { + "ScopedCred" +}; + +[SecureContext] +interface ScopedCredential { + readonly attribute ScopedCredentialType type; + readonly attribute ArrayBuffer id; +}; + +dictionary ScopedCredentialDescriptor { + required ScopedCredentialType type; + required BufferSource id; + sequence < Transport > transports; +}; + +enum Transport { + "usb", + "nfc", + "ble" +}; +[SecureContext] +interface WebAuthentication { + Promise < ScopedCredentialInfo > makeCredential ( + Account accountInformation, + sequence < ScopedCredentialParameters > cryptoParameters, + BufferSource attestationChallenge, + optional ScopedCredentialOptions options + ); + + Promise < AuthenticationAssertion > getAssertion ( + BufferSource assertionChallenge, + optional AssertionOptions options + ); +}; +</script> +<script> +(function() { + "use strict"; + var idl_array = new IdlArray(); + idl_array.add_idls(document.querySelector('#tested').textContent); + idl_array.add_objects({ + WebAuthentication: ['navigator.authentication'] + }); + idl_array.test(); +})(); +</script>
diff --git a/third_party/WebKit/Source/build/scripts/json5_generator.py b/third_party/WebKit/Source/build/scripts/json5_generator.py index 4c7a63d..5b7184b 100644 --- a/third_party/WebKit/Source/build/scripts/json5_generator.py +++ b/third_party/WebKit/Source/build/scripts/json5_generator.py
@@ -152,7 +152,11 @@ return entry if "name" not in item: raise Exception("Missing name in item: %s" % item) + if not self.parameters: + entry.update(item) + return entry entry["name"] = item.pop("name") + # Validate parameters if it's specified. for key, value in item.items(): if key not in self.parameters: raise Exception(
diff --git a/third_party/WebKit/Source/build/scripts/make_element_factory.py b/third_party/WebKit/Source/build/scripts/make_element_factory.py index 5e9af05..68606172 100755 --- a/third_party/WebKit/Source/build/scripts/make_element_factory.py +++ b/third_party/WebKit/Source/build/scripts/make_element_factory.py
@@ -30,7 +30,7 @@ import sys from collections import defaultdict -import in_generator +import json5_generator import template_expander import name_utilities @@ -38,23 +38,23 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter): - defaults = dict(MakeQualifiedNamesWriter.default_parameters, **{ - 'JSInterfaceName': None, - 'Conditional': None, - 'constructorNeedsCreatedByParser': None, - 'interfaceName': None, - 'noConstructor': None, - 'noTypeHelpers': None, - 'runtimeEnabled': None, - }) - default_parameters = dict(MakeQualifiedNamesWriter.default_parameters, **{ + default_parameters = { + 'JSInterfaceName': {}, + 'Conditional': {}, + 'constructorNeedsCreatedByParser': {}, + 'interfaceName': {}, + 'noConstructor': {}, + 'noTypeHelpers': {}, + 'runtimeEnabled': {}, + } + default_metadata = dict(MakeQualifiedNamesWriter.default_metadata, **{ 'fallbackInterfaceName': '', 'fallbackJSInterfaceName': '', }) filters = MakeQualifiedNamesWriter.filters - def __init__(self, in_file_paths): - super(MakeElementFactoryWriter, self).__init__(in_file_paths) + def __init__(self, json5_file_paths): + super(MakeElementFactoryWriter, self).__init__(json5_file_paths) # FIXME: When we start using these element factories, we'll want to # remove the "new" prefix and also have our base class generate @@ -64,8 +64,8 @@ (self.namespace + 'ElementFactory.cpp'): self.generate_factory_implementation, }) - fallback_interface = self.tags_in_file.parameters['fallbackInterfaceName'].strip('"') - fallback_js_interface = self.tags_in_file.parameters['fallbackJSInterfaceName'].strip('"') or fallback_interface + fallback_interface = self.tags_json5_file.metadata['fallbackInterfaceName'].strip('"') + fallback_js_interface = self.tags_json5_file.metadata['fallbackJSInterfaceName'].strip('"') or fallback_interface interface_counts = defaultdict(int) tags = self._template_context['tags'] @@ -114,4 +114,4 @@ if __name__ == "__main__": - in_generator.Maker(MakeElementFactoryWriter).main(sys.argv) + json5_generator.Maker(MakeElementFactoryWriter).main()
diff --git a/third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py b/third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py index 5663f300..89b0d36b 100755 --- a/third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py +++ b/third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py
@@ -29,21 +29,21 @@ import sys -import in_generator +import json5_generator import trie_builder import template_expander -class ElementLookupTrieWriter(in_generator.Writer): +class ElementLookupTrieWriter(json5_generator.Writer): # FIXME: Inherit all these from somewhere. - defaults = { - 'JSInterfaceName': None, - 'constructorNeedsCreatedByParser': None, - 'interfaceName': None, - 'noConstructor': None, - 'runtimeEnabled': None, - } default_parameters = { + 'JSInterfaceName': {}, + 'constructorNeedsCreatedByParser': {}, + 'interfaceName': {}, + 'noConstructor': {}, + 'runtimeEnabled': {}, + } + default_metadata = { 'attrsNullNamespace': None, 'export': '', 'fallbackInterfaceName': '', @@ -53,12 +53,12 @@ 'namespaceURI': '', } - def __init__(self, in_file_paths): - super(ElementLookupTrieWriter, self).__init__(in_file_paths) + def __init__(self, json5_file_paths): + super(ElementLookupTrieWriter, self).__init__(json5_file_paths) self._tags = {} - for entry in self.in_file.name_dictionaries: + for entry in self.json5_file.name_dictionaries: self._tags[entry['name']] = entry['name'] - self._namespace = self.in_file.parameters['namespace'].strip('"') + self._namespace = self.json5_file.metadata['namespace'].strip('"') self._outputs = { (self._namespace + 'ElementLookupTrie.h'): self.generate_header, (self._namespace + 'ElementLookupTrie.cpp'): self.generate_implementation, @@ -79,4 +79,4 @@ if __name__ == '__main__': - in_generator.Maker(ElementLookupTrieWriter).main(sys.argv) + json5_generator.Maker(ElementLookupTrieWriter).main()
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 c6b4063..035bf730 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
@@ -7,31 +7,27 @@ from collections import defaultdict import hasher -import in_generator +import json5_generator import name_utilities import template_expander -from in_file import InFile - def _symbol(tag): - # FIXME: Remove this special case for the ugly x-webkit-foo attributes. - if tag['name'].startswith('-webkit-'): - return tag['name'].replace('-', '_')[1:] return name_utilities.cpp_name(tag).replace('-', '_') -class MakeElementTypeHelpersWriter(in_generator.Writer): - defaults = { - 'Conditional': None, - 'ImplementedAs': None, - 'JSInterfaceName': None, - 'constructorNeedsCreatedByParser': None, - 'interfaceName': None, - 'noConstructor': None, - 'noTypeHelpers': None, - 'runtimeEnabled': None, - } + +class MakeElementTypeHelpersWriter(json5_generator.Writer): default_parameters = { + 'Conditional': {}, + 'ImplementedAs': {}, + 'JSInterfaceName': {}, + 'constructorNeedsCreatedByParser': {}, + 'interfaceName': {}, + 'noConstructor': {}, + 'noTypeHelpers': {}, + 'runtimeEnabled': {}, + } + default_metadata = { 'attrsNullNamespace': None, 'export': '', 'fallbackInterfaceName': '', @@ -45,11 +41,11 @@ 'symbol': _symbol, } - def __init__(self, in_file_path): - super(MakeElementTypeHelpersWriter, self).__init__(in_file_path) + def __init__(self, json5_file_path): + super(MakeElementTypeHelpersWriter, self).__init__(json5_file_path) - self.namespace = self.in_file.parameters['namespace'].strip('"') - self.fallbackInterface = self.in_file.parameters['fallbackInterfaceName'].strip('"') + self.namespace = self.json5_file.metadata['namespace'].strip('"') + self.fallback_interface = self.json5_file.metadata['fallbackInterfaceName'].strip('"') assert self.namespace, 'A namespace is required.' @@ -60,7 +56,7 @@ self._template_context = { 'namespace': self.namespace, - 'tags': self.in_file.name_dictionaries, + 'tags': self.json5_file.name_dictionaries, 'elements': set(), } @@ -73,7 +69,7 @@ elements.add(tag['interface']) for tag in tags: - tag['multipleTagNames'] = (interface_counts[tag['interface']] > 1 or tag['interface'] == self.fallbackInterface) + tag['multipleTagNames'] = (interface_counts[tag['interface']] > 1 or tag['interface'] == self.fallback_interface) @template_expander.use_jinja("ElementTypeHelpers.h.tmpl", filters=filters) def generate_helper_header(self): @@ -97,4 +93,4 @@ return '%s%sElement' % (self.namespace, name) if __name__ == "__main__": - in_generator.Maker(MakeElementTypeHelpersWriter).main(sys.argv) + json5_generator.Maker(MakeElementTypeHelpersWriter).main()
diff --git a/third_party/WebKit/Source/build/scripts/make_qualified_names.py b/third_party/WebKit/Source/build/scripts/make_qualified_names.py index a7d9d1a..fd263e5 100755 --- a/third_party/WebKit/Source/build/scripts/make_qualified_names.py +++ b/third_party/WebKit/Source/build/scripts/make_qualified_names.py
@@ -30,24 +30,20 @@ import sys import hasher -import in_generator +import json5_generator import name_utilities import template_expander -from in_file import InFile +from json5_generator import Json5File def _symbol(entry): - # FIXME: Remove this special case for the ugly x-webkit-foo attributes. - if entry['name'].startswith('x-webkit-'): - return entry['name'].replace('-', '')[1:] return entry['name'].replace('-', '_') -class MakeQualifiedNamesWriter(in_generator.Writer): - defaults = { - } - default_parameters = { +class MakeQualifiedNamesWriter(json5_generator.Writer): + default_parameters = {} + default_metadata = { 'attrsNullNamespace': None, 'export': '', 'namespace': '', @@ -60,43 +56,44 @@ 'to_macro_style': name_utilities.to_macro_style, } - def __init__(self, in_file_paths): + def __init__(self, json5_file_paths): super(MakeQualifiedNamesWriter, self).__init__(None) - assert len(in_file_paths) <= 2, 'MakeQualifiedNamesWriter requires at most 2 in files, got %d.' % len(in_file_paths) + assert len(json5_file_paths) <= 2, 'MakeQualifiedNamesWriter requires at most 2 in files, got %d.' % len(json5_file_paths) - if len(in_file_paths) == 2: - self.tags_in_file = InFile.load_from_files([in_file_paths.pop(0)], self.defaults, self.valid_values, self.default_parameters) + if len(json5_file_paths) == 2: + self.tags_json5_file = Json5File.load_from_files( + [json5_file_paths.pop(0)], self.default_metadata, self.default_parameters) else: - self.tags_in_file = None + self.tags_json5_file = None - self.attrs_in_file = InFile.load_from_files([in_file_paths.pop()], self.defaults, self.valid_values, self.default_parameters) + self.attrs_json5_file = Json5File.load_from_files([json5_file_paths.pop()], self.default_metadata, self.default_parameters) - self.namespace = self._parameter('namespace') + self.namespace = self._metadata('namespace') - namespace_prefix = self._parameter('namespacePrefix') or self.namespace.lower() - namespace_uri = self._parameter('namespaceURI') + namespace_prefix = self._metadata('namespacePrefix') or self.namespace.lower() + namespace_uri = self._metadata('namespaceURI') - use_namespace_for_attrs = self.attrs_in_file.parameters['attrsNullNamespace'] is None + use_namespace_for_attrs = self.attrs_json5_file.metadata['attrsNullNamespace'] is None self._outputs = { (self.namespace + "Names.h"): self.generate_header, (self.namespace + "Names.cpp"): self.generate_implementation, } self._template_context = { - 'attrs': self.attrs_in_file.name_dictionaries, - 'export': self._parameter('export'), + 'attrs': self.attrs_json5_file.name_dictionaries, + 'export': self._metadata('export'), 'namespace': self.namespace, 'namespace_prefix': namespace_prefix, 'namespace_uri': namespace_uri, - 'tags': self.tags_in_file.name_dictionaries if self.tags_in_file else [], + 'tags': self.tags_json5_file.name_dictionaries if self.tags_json5_file else [], 'use_namespace_for_attrs': use_namespace_for_attrs, } - def _parameter(self, name): - parameter = self.attrs_in_file.parameters[name].strip('"') - if self.tags_in_file: - assert parameter == self.tags_in_file.parameters[name].strip('"'), 'Both in files must have the same %s.' % name - return parameter + def _metadata(self, name): + metadata = self.attrs_json5_file.metadata[name].strip('"') + if self.tags_json5_file: + assert metadata == self.tags_json5_file.metadata[name].strip('"'), 'Both files must have the same %s.' % name + return metadata @template_expander.use_jinja('MakeQualifiedNames.h.tmpl', filters=filters) def generate_header(self): @@ -108,4 +105,4 @@ if __name__ == "__main__": - in_generator.Maker(MakeQualifiedNamesWriter).main(sys.argv) + json5_generator.Maker(MakeQualifiedNamesWriter).main()
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 1b8461c1..02b4257 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -510,8 +510,8 @@ script = "../build/scripts/make_element_factory.py" in_files = [ - "html/HTMLTagNames.in", - "html/HTMLAttributeNames.in", + "html/HTMLTagNames.json5", + "html/HTMLAttributeNames.json5", ] other_inputs = make_element_factory_files outputs = [ @@ -525,7 +525,7 @@ process_in_files("make_core_generated_html_element_type_helpers") { script = "../build/scripts/make_element_type_helpers.py" - in_files = [ "html/HTMLTagNames.in" ] + in_files = [ "html/HTMLTagNames.json5" ] other_inputs = make_element_type_helpers_files outputs = [ "$blink_core_output_dir/HTMLElementTypeHelpers.cpp", @@ -537,8 +537,8 @@ script = "../build/scripts/make_element_factory.py" in_files = [ - "svg/SVGTagNames.in", - "svg/SVGAttributeNames.in", + "svg/SVGTagNames.json5", + "svg/SVGAttributeNames.json5", ] other_inputs = make_element_factory_files outputs = [ @@ -552,7 +552,7 @@ process_in_files("make_core_generated_svg_element_type_helpers") { script = "../build/scripts/make_element_type_helpers.py" - in_files = [ "svg/SVGTagNames.in" ] + in_files = [ "svg/SVGTagNames.json5" ] other_inputs = make_element_type_helpers_files outputs = [ "$blink_core_output_dir/SVGElementTypeHelpers.h", @@ -644,8 +644,8 @@ make_qualified_names("make_core_generated_math_ml_names") { in_files = [ - "html/parser/MathMLTagNames.in", - "html/parser/MathMLAttributeNames.in", + "html/parser/MathMLTagNames.json5", + "html/parser/MathMLAttributeNames.json5", ] outputs = [ "$blink_core_output_dir/MathMLNames.cpp", @@ -654,7 +654,7 @@ } make_qualified_names("make_core_generated_xlink_names") { - in_files = [ "svg/xlinkattrs.in" ] + in_files = [ "svg/xlinkattrs.json5" ] outputs = [ "$blink_core_output_dir/XLinkNames.cpp", "$blink_core_output_dir/XLinkNames.h", @@ -662,7 +662,7 @@ } make_qualified_names("make_core_generated_xml_ns_names") { - in_files = [ "xml/xmlnsattrs.in" ] + in_files = [ "xml/xmlnsattrs.json5" ] outputs = [ "$blink_core_output_dir/XMLNSNames.cpp", "$blink_core_output_dir/XMLNSNames.h", @@ -670,7 +670,7 @@ } make_qualified_names("make_core_generated_xml_names") { - in_files = [ "xml/xmlattrs.in" ] + in_files = [ "xml/xmlattrs.json5" ] outputs = [ "$blink_core_output_dir/XMLNames.cpp", "$blink_core_output_dir/XMLNames.h", @@ -774,7 +774,7 @@ visibility = [ ":*" ] script = "../build/scripts/make_element_lookup_trie.py" - input_file = "html/HTMLTagNames.in" + input_file = "html/HTMLTagNames.json5" inputs = make_trie_helpers_files + [ input_file, "../build/scripts/templates/ElementLookupTrie.cpp.tmpl",
diff --git a/third_party/WebKit/Source/core/frame/Deprecation.cpp b/third_party/WebKit/Source/core/frame/Deprecation.cpp index cd5cf67..cbba6d4 100644 --- a/third_party/WebKit/Source/core/frame/Deprecation.cpp +++ b/third_party/WebKit/Source/core/frame/Deprecation.cpp
@@ -324,14 +324,6 @@ "secure origin, such as HTTPS. See https://goo.gl/rStTGz for more " "details."; - case UseCounter::EncryptedMediaInsecureOrigin: - return String::format( - "Using requestMediaKeySystemAccess() on insecure origins is " - "deprecated and will be removed in %s. You should consider " - "switching your application to a secure origin, such as HTTPS. See " - "https://goo.gl/rStTGz for more details.", - milestoneString(M58)); - case UseCounter::MediaSourceAbortRemove: return "Using SourceBuffer.abort() to abort remove()'s asynchronous " "range removal is deprecated due to specification change. Support "
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index c5548f7..5392204 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -569,8 +569,6 @@ FullscreenInsecureOrigin = 766, DialogInSandboxedContext = 767, SVGSMILAnimationInImageRegardlessOfCache = 768, - EncryptedMediaSecureOrigin = 770, - EncryptedMediaInsecureOrigin = 771, PerformanceFrameTiming = 772, V8Element_Animate_Method = 773, // The above items are available in M44 branch.
diff --git a/third_party/WebKit/Source/core/html/HTMLAttributeNames.in b/third_party/WebKit/Source/core/html/HTMLAttributeNames.in deleted file mode 100644 index d7670e9..0000000 --- a/third_party/WebKit/Source/core/html/HTMLAttributeNames.in +++ /dev/null
@@ -1,348 +0,0 @@ -namespace="HTML" -namespacePrefix="xhtml" -namespaceURI="http://www.w3.org/1999/xhtml" -attrsNullNamespace -export="CORE_EXPORT" - -abbr -accept-charset -accept -accesskey -action -align -alink -allowfullscreen -allowpaymentrequest -alt -archive -aria-activedescendant -aria-atomic -aria-autocomplete -aria-busy -aria-checked -aria-colcount -aria-colindex -aria-colspan -aria-controls -aria-current -aria-describedby -aria-details -aria-disabled -aria-dropeffect -aria-errormessage -aria-expanded -aria-flowto -aria-grabbed -aria-haspopup -aria-help -aria-hidden -aria-invalid -aria-keyshortcuts -aria-label -aria-labeledby -aria-labelledby -aria-level -aria-live -aria-modal -aria-multiline -aria-multiselectable -aria-orientation -aria-owns -aria-placeholder -aria-posinset -aria-pressed -aria-readonly -aria-relevant -aria-required -aria-roledescription -aria-rowcount -aria-rowindex -aria-rowspan -aria-selected -aria-setsize -aria-sort -aria-valuemax -aria-valuemin -aria-valuenow -aria-valuetext -as -async -autocapitalize -autocomplete -autocorrect -autofocus -autoplay -axis -background -behavior -bgcolor -border -bordercolor -capture -cellpadding -cellspacing -char -challenge -charoff -charset -checked -cite -class -classid -clear -code -codebase -codetype -color -cols -colspan -compact -content -contenteditable -contextmenu -controls -coords -crossorigin -csp -data -datetime -declare -default -defer -dir -direction -dirname -disabled -disableremoteplayback -download -draggable -webkitdropzone -enctype -end -event -face -for -form -formaction -formenctype -formmethod -formnovalidate -formtarget -frame -frameborder -headers -height -hidden -high -href -hreflang -hspace -http-equiv -icon -id -incremental -inputmode -integrity -is -ismap -keytype -kind -label -lang -language -leftmargin -link -list -longdesc -loop -low -lowsrc -manifest -marginheight -marginwidth -max -maxlength -mayscript -media -method -min -minlength -multiple -muted -name -nohref -nonce -noresize -noshade -novalidate -nowrap -object -onabort -onanimationstart -onanimationiteration -onanimationend -onauxclick -onbeforecopy -onbeforecut -onbeforepaste -onbeforeunload -onblur -oncancel -oncanplay -oncanplaythrough -onchange -onclick -onclose -oncontextmenu -oncopy -oncuechange -oncut -ondblclick -ondrag -ondragend -ondragenter -ondragleave -ondragover -ondragstart -ondrop -ondurationchange -onemptied -onended -onerror -onfocus -onfocusin -onfocusout -ongotpointercapture -onhashchange -oninput -oninvalid -onkeydown -onkeypress -onkeyup -onlanguagechange -onload -onloadeddata -onloadedmetadata -onloadstart -onlostpointercapture -onmessage -onmousedown -onmouseenter -onmouseleave -onmousemove -onmouseout -onmouseover -onmouseup -onmousewheel -ononline -onoffline -onorientationchange -onpagehide -onpageshow -onpaste -onpause -onplay -onplaying -onpointercancel -onpointerdown -onpointerenter -onpointerleave -onpointermove -onpointerout -onpointerover -onpointerup -onpopstate -onprogress -onratechange -onreset -onresize -onscroll -onsearch -onseeked -onseeking -onselect -onselectstart -onselectionchange -onshow -onstalled -onstorage -onsuspend -onsubmit -ontimeupdate -ontoggle -ontouchstart -ontouchmove -ontouchend -ontouchcancel -ontransitionend -onunload -onvolumechange -onwaiting -onwebkitanimationstart -onwebkitanimationiteration -onwebkitanimationend -onwebkitfullscreenchange -onwebkitfullscreenerror -onwebkittransitionend -onwheel -open -optimum -pattern -permissions -placeholder -ping -poster -preload -pseudo -radiogroup -readonly -referrerpolicy -rel -required -rev -reversed -role -rows -rowspan -rules -sandbox -scheme -scope -scrollamount -scrolldelay -scrolling -select -selected -shape -size -sizes -slot -span -spellcheck -src -srcset -srcdoc -srclang -standby -start -step -style -summary -tabindex -target -text -title -topmargin -translate -truespeed -type -usemap -valign -value -valuetype -version -vlink -vspace -webkitdirectory -width -wrap
diff --git a/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 b/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 new file mode 100644 index 0000000..0ad4d65e --- /dev/null +++ b/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5
@@ -0,0 +1,354 @@ +{ + metadata: { + namespace: "HTML", + namespacePrefix: "xhtml", + namespaceURI: "http://www.w3.org/1999/xhtml", + attrsNullNamespace: true, + export: "CORE_EXPORT", + }, + + data: [ + "abbr", + "accept-charset", + "accept", + "accesskey", + "action", + "align", + "alink", + "allowfullscreen", + "allowpaymentrequest", + "alt", + "archive", + "aria-activedescendant", + "aria-atomic", + "aria-autocomplete", + "aria-busy", + "aria-checked", + "aria-colcount", + "aria-colindex", + "aria-colspan", + "aria-controls", + "aria-current", + "aria-describedby", + "aria-details", + "aria-disabled", + "aria-dropeffect", + "aria-errormessage", + "aria-expanded", + "aria-flowto", + "aria-grabbed", + "aria-haspopup", + "aria-help", + "aria-hidden", + "aria-invalid", + "aria-keyshortcuts", + "aria-label", + "aria-labeledby", + "aria-labelledby", + "aria-level", + "aria-live", + "aria-modal", + "aria-multiline", + "aria-multiselectable", + "aria-orientation", + "aria-owns", + "aria-placeholder", + "aria-posinset", + "aria-pressed", + "aria-readonly", + "aria-relevant", + "aria-required", + "aria-roledescription", + "aria-rowcount", + "aria-rowindex", + "aria-rowspan", + "aria-selected", + "aria-setsize", + "aria-sort", + "aria-valuemax", + "aria-valuemin", + "aria-valuenow", + "aria-valuetext", + "as", + "async", + "autocapitalize", + "autocomplete", + "autocorrect", + "autofocus", + "autoplay", + "axis", + "background", + "behavior", + "bgcolor", + "border", + "bordercolor", + "capture", + "cellpadding", + "cellspacing", + "char", + "challenge", + "charoff", + "charset", + "checked", + "cite", + "class", + "classid", + "clear", + "code", + "codebase", + "codetype", + "color", + "cols", + "colspan", + "compact", + "content", + "contenteditable", + "contextmenu", + "controls", + "coords", + "crossorigin", + "csp", + "data", + "datetime", + "declare", + "default", + "defer", + "dir", + "direction", + "dirname", + "disabled", + "disableremoteplayback", + "download", + "draggable", + "webkitdropzone", + "enctype", + "end", + "event", + "face", + "for", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "frame", + "frameborder", + "headers", + "height", + "hidden", + "high", + "href", + "hreflang", + "hspace", + "http-equiv", + "icon", + "id", + "incremental", + "inputmode", + "integrity", + "is", + "ismap", + "keytype", + "kind", + "label", + "lang", + "language", + "leftmargin", + "link", + "list", + "longdesc", + "loop", + "low", + "lowsrc", + "manifest", + "marginheight", + "marginwidth", + "max", + "maxlength", + "mayscript", + "media", + "method", + "min", + "minlength", + "multiple", + "muted", + "name", + "nohref", + "nonce", + "noresize", + "noshade", + "novalidate", + "nowrap", + "object", + "onabort", + "onanimationstart", + "onanimationiteration", + "onanimationend", + "onauxclick", + "onbeforecopy", + "onbeforecut", + "onbeforepaste", + "onbeforeunload", + "onblur", + "oncancel", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "onclose", + "oncontextmenu", + "oncopy", + "oncuechange", + "oncut", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "onfocusin", + "onfocusout", + "ongotpointercapture", + "onhashchange", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onlanguagechange", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onlostpointercapture", + "onmessage", + "onmousedown", + "onmouseenter", + "onmouseleave", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "ononline", + "onoffline", + "onorientationchange", + "onpagehide", + "onpageshow", + "onpaste", + "onpause", + "onplay", + "onplaying", + "onpointercancel", + "onpointerdown", + "onpointerenter", + "onpointerleave", + "onpointermove", + "onpointerout", + "onpointerover", + "onpointerup", + "onpopstate", + "onprogress", + "onratechange", + "onreset", + "onresize", + "onscroll", + "onsearch", + "onseeked", + "onseeking", + "onselect", + "onselectstart", + "onselectionchange", + "onshow", + "onstalled", + "onstorage", + "onsuspend", + "onsubmit", + "ontimeupdate", + "ontoggle", + "ontouchstart", + "ontouchmove", + "ontouchend", + "ontouchcancel", + "ontransitionend", + "onunload", + "onvolumechange", + "onwaiting", + "onwebkitanimationstart", + "onwebkitanimationiteration", + "onwebkitanimationend", + "onwebkitfullscreenchange", + "onwebkitfullscreenerror", + "onwebkittransitionend", + "onwheel", + "open", + "optimum", + "pattern", + "permissions", + "placeholder", + "ping", + "poster", + "preload", + "pseudo", + "radiogroup", + "readonly", + "referrerpolicy", + "rel", + "required", + "rev", + "reversed", + "role", + "rows", + "rowspan", + "rules", + "sandbox", + "scheme", + "scope", + "scrollamount", + "scrolldelay", + "scrolling", + "select", + "selected", + "shape", + "size", + "sizes", + "slot", + "span", + "spellcheck", + "src", + "srcset", + "srcdoc", + "srclang", + "standby", + "start", + "step", + "style", + "summary", + "tabindex", + "target", + "text", + "title", + "topmargin", + "translate", + "truespeed", + "type", + "usemap", + "valign", + "value", + "valuetype", + "version", + "vlink", + "vspace", + "webkitdirectory", + "width", + "wrap", + ], +}
diff --git a/third_party/WebKit/Source/core/html/HTMLTagNames.in b/third_party/WebKit/Source/core/html/HTMLTagNames.in deleted file mode 100644 index 0c8b5137..0000000 --- a/third_party/WebKit/Source/core/html/HTMLTagNames.in +++ /dev/null
@@ -1,145 +0,0 @@ -namespace="HTML" -namespacePrefix="xhtml" -namespaceURI="http://www.w3.org/1999/xhtml" -fallbackInterfaceName="HTMLUnknownElement" -export="CORE_EXPORT" - -a interfaceName=HTMLAnchorElement -abbr interfaceName=HTMLElement -acronym interfaceName=HTMLElement -address interfaceName=HTMLElement -applet interfaceName=HTMLUnknownElement -area -article interfaceName=HTMLElement -aside interfaceName=HTMLElement -audio -b interfaceName=HTMLElement -base -basefont interfaceName=HTMLElement -bdi interfaceName=HTMLBDIElement, JSInterfaceName=HTMLElement -bdo interfaceName=HTMLElement -bgsound interfaceName=HTMLUnknownElement -big interfaceName=HTMLElement -blockquote interfaceName=HTMLQuoteElement -body -br interfaceName=HTMLBRElement -button -canvas -caption interfaceName=HTMLTableCaptionElement -center interfaceName=HTMLElement -cite interfaceName=HTMLElement -code interfaceName=HTMLElement -col interfaceName=HTMLTableColElement -colgroup interfaceName=HTMLTableColElement -command interfaceName=HTMLUnknownElement -content interfaceName=HTMLContentElement -datalist interfaceName=HTMLDataListElement -dd interfaceName=HTMLElement -del interfaceName=HTMLModElement -details -dfn interfaceName=HTMLElement -dir interfaceName=HTMLDirectoryElement -dialog -div -dl interfaceName=HTMLDListElement -dt interfaceName=HTMLElement -em interfaceName=HTMLElement -embed constructorNeedsCreatedByParser -fieldset interfaceName=HTMLFieldSetElement -figcaption interfaceName=HTMLElement -figure interfaceName=HTMLElement -font -footer interfaceName=HTMLElement -form -frame -frameset interfaceName=HTMLFrameSetElement -h1 interfaceName=HTMLHeadingElement -h2 interfaceName=HTMLHeadingElement -h3 interfaceName=HTMLHeadingElement -h4 interfaceName=HTMLHeadingElement -h5 interfaceName=HTMLHeadingElement -h6 interfaceName=HTMLHeadingElement -head -header interfaceName=HTMLElement -hgroup interfaceName=HTMLElement -hr interfaceName=HTMLHRElement -html -i interfaceName=HTMLElement -iframe interfaceName=HTMLIFrameElement -image interfaceName=HTMLUnknownElement -img interfaceName=HTMLImageElement, constructorNeedsCreatedByParser -input constructorNeedsCreatedByParser -ins interfaceName=HTMLModElement -kbd interfaceName=HTMLElement -keygen interfaceName=HTMLUnknownElement -label -layer interfaceName=HTMLElement -legend -li interfaceName=HTMLLIElement -link constructorNeedsCreatedByParser -listing interfaceName=HTMLPreElement -main interfaceName=HTMLElement -map -mark interfaceName=HTMLElement -marquee -menu -menuitem interfaceName=HTMLMenuItemElement, runtimeEnabled=contextMenu -meta -meter interfaceName=HTMLMeterElement -nav interfaceName=HTMLElement -nobr interfaceName=HTMLElement -noembed interfaceName=HTMLNoEmbedElement, JSInterfaceName=HTMLElement -noframes interfaceName=HTMLElement -nolayer interfaceName=HTMLElement -object constructorNeedsCreatedByParser -ol interfaceName=HTMLOListElement -optgroup interfaceName=HTMLOptGroupElement -option -output -shadow interfaceName=HTMLShadowElement -p interfaceName=HTMLParagraphElement -param -picture interfaceName=HTMLPictureElement -plaintext interfaceName=HTMLElement -pre -progress interfaceName=HTMLProgressElement -q interfaceName=HTMLQuoteElement -rb interfaceName=HTMLElement -rp interfaceName=HTMLElement -rt interfaceName=HTMLRTElement, JSInterfaceName=HTMLElement -rtc interfaceName=HTMLElement -ruby interfaceName=HTMLRubyElement, JSInterfaceName=HTMLElement -s interfaceName=HTMLElement -samp interfaceName=HTMLElement -script constructorNeedsCreatedByParser -section interfaceName=HTMLElement -select -slot interfaceName=HTMLSlotElement -small interfaceName=HTMLElement -source -span -strike interfaceName=HTMLElement -strong interfaceName=HTMLElement -style constructorNeedsCreatedByParser -sub interfaceName=HTMLElement -summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement -sup interfaceName=HTMLElement -table -tbody interfaceName=HTMLTableSectionElement -td interfaceName=HTMLTableCellElement -template -textarea interfaceName=HTMLTextAreaElement -tfoot interfaceName=HTMLTableSectionElement -th interfaceName=HTMLTableCellElement -thead interfaceName=HTMLTableSectionElement -title -tr interfaceName=HTMLTableRowElement -track -tt interfaceName=HTMLElement -u interfaceName=HTMLElement -ul interfaceName=HTMLUListElement -var interfaceName=HTMLElement -video -wbr interfaceName=HTMLWBRElement, JSInterfaceName=HTMLElement -xmp interfaceName=HTMLPreElement -noscript interfaceName=HTMLNoScriptElement, JSInterfaceName=HTMLElement
diff --git a/third_party/WebKit/Source/core/html/HTMLTagNames.json5 b/third_party/WebKit/Source/core/html/HTMLTagNames.json5 new file mode 100644 index 0000000..5d65b245 --- /dev/null +++ b/third_party/WebKit/Source/core/html/HTMLTagNames.json5
@@ -0,0 +1,481 @@ +{ + metadata: { + namespace: "HTML", + namespacePrefix: "xhtml", + namespaceURI: "http://www.w3.org/1999/xhtml", + fallbackInterfaceName: "HTMLUnknownElement", + export: "CORE_EXPORT", + }, + + data: [ + { + name: "a", + interfaceName: "HTMLAnchorElement", + }, + { + name: "abbr", + interfaceName: "HTMLElement", + }, + { + name: "acronym", + interfaceName: "HTMLElement", + }, + { + name: "address", + interfaceName: "HTMLElement", + }, + { + name: "applet", + interfaceName: "HTMLUnknownElement", + }, + "area", + { + name: "article", + interfaceName: "HTMLElement", + }, + { + name: "aside", + interfaceName: "HTMLElement", + }, + "audio", + { + name: "b", + interfaceName: "HTMLElement", + }, + "base", + { + name: "basefont", + interfaceName: "HTMLElement", + }, + { + name: "bdi", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLBDIElement", + }, + { + name: "bdo", + interfaceName: "HTMLElement", + }, + { + name: "bgsound", + interfaceName: "HTMLUnknownElement", + }, + { + name: "big", + interfaceName: "HTMLElement", + }, + { + name: "blockquote", + interfaceName: "HTMLQuoteElement", + }, + "body", + { + name: "br", + interfaceName: "HTMLBRElement", + }, + "button", + "canvas", + { + name: "caption", + interfaceName: "HTMLTableCaptionElement", + }, + { + name: "center", + interfaceName: "HTMLElement", + }, + { + name: "cite", + interfaceName: "HTMLElement", + }, + { + name: "code", + interfaceName: "HTMLElement", + }, + { + name: "col", + interfaceName: "HTMLTableColElement", + }, + { + name: "colgroup", + interfaceName: "HTMLTableColElement", + }, + { + name: "command", + interfaceName: "HTMLUnknownElement", + }, + { + name: "content", + interfaceName: "HTMLContentElement", + }, + { + name: "datalist", + interfaceName: "HTMLDataListElement", + }, + { + name: "dd", + interfaceName: "HTMLElement", + }, + { + name: "del", + interfaceName: "HTMLModElement", + }, + "details", + { + name: "dfn", + interfaceName: "HTMLElement", + }, + { + name: "dir", + interfaceName: "HTMLDirectoryElement", + }, + "dialog", + "div", + { + name: "dl", + interfaceName: "HTMLDListElement", + }, + { + name: "dt", + interfaceName: "HTMLElement", + }, + { + name: "em", + interfaceName: "HTMLElement", + }, + { + name: "embed", + constructorNeedsCreatedByParser: true, + }, + { + name: "fieldset", + interfaceName: "HTMLFieldSetElement", + }, + { + name: "figcaption", + interfaceName: "HTMLElement", + }, + { + name: "figure", + interfaceName: "HTMLElement", + }, + "font", + { + name: "footer", + interfaceName: "HTMLElement", + }, + "form", + "frame", + { + name: "frameset", + interfaceName: "HTMLFrameSetElement", + }, + { + name: "h1", + interfaceName: "HTMLHeadingElement", + }, + { + name: "h2", + interfaceName: "HTMLHeadingElement", + }, + { + name: "h3", + interfaceName: "HTMLHeadingElement", + }, + { + name: "h4", + interfaceName: "HTMLHeadingElement", + }, + { + name: "h5", + interfaceName: "HTMLHeadingElement", + }, + { + name: "h6", + interfaceName: "HTMLHeadingElement", + }, + "head", + { + name: "header", + interfaceName: "HTMLElement", + }, + { + name: "hgroup", + interfaceName: "HTMLElement", + }, + { + name: "hr", + interfaceName: "HTMLHRElement", + }, + "html", + { + name: "i", + interfaceName: "HTMLElement", + }, + { + name: "iframe", + interfaceName: "HTMLIFrameElement", + }, + { + name: "image", + interfaceName: "HTMLUnknownElement", + }, + { + name: "img", + constructorNeedsCreatedByParser: true, + interfaceName: "HTMLImageElement", + }, + { + name: "input", + constructorNeedsCreatedByParser: true, + }, + { + name: "ins", + interfaceName: "HTMLModElement", + }, + { + name: "kbd", + interfaceName: "HTMLElement", + }, + { + name: "keygen", + interfaceName: "HTMLUnknownElement", + }, + "label", + { + name: "layer", + interfaceName: "HTMLElement", + }, + "legend", + { + name: "li", + interfaceName: "HTMLLIElement", + }, + { + name: "link", + constructorNeedsCreatedByParser: true, + }, + { + name: "listing", + interfaceName: "HTMLPreElement", + }, + { + name: "main", + interfaceName: "HTMLElement", + }, + "map", + { + name: "mark", + interfaceName: "HTMLElement", + }, + "marquee", + "menu", + { + name: "menuitem", + interfaceName: "HTMLMenuItemElement", + runtimeEnabled: "contextMenu", + }, + "meta", + { + name: "meter", + interfaceName: "HTMLMeterElement", + }, + { + name: "nav", + interfaceName: "HTMLElement", + }, + { + name: "nobr", + interfaceName: "HTMLElement", + }, + { + name: "noembed", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLNoEmbedElement", + }, + { + name: "noframes", + interfaceName: "HTMLElement", + }, + { + name: "nolayer", + interfaceName: "HTMLElement", + }, + { + name: "object", + constructorNeedsCreatedByParser: true, + }, + { + name: "ol", + interfaceName: "HTMLOListElement", + }, + { + name: "optgroup", + interfaceName: "HTMLOptGroupElement", + }, + "option", + "output", + { + name: "shadow", + interfaceName: "HTMLShadowElement", + }, + { + name: "p", + interfaceName: "HTMLParagraphElement", + }, + "param", + { + name: "picture", + interfaceName: "HTMLPictureElement", + }, + { + name: "plaintext", + interfaceName: "HTMLElement", + }, + "pre", + { + name: "progress", + interfaceName: "HTMLProgressElement", + }, + { + name: "q", + interfaceName: "HTMLQuoteElement", + }, + { + name: "rb", + interfaceName: "HTMLElement", + }, + { + name: "rp", + interfaceName: "HTMLElement", + }, + { + name: "rt", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLRTElement", + }, + { + name: "rtc", + interfaceName: "HTMLElement", + }, + { + name: "ruby", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLRubyElement", + }, + { + name: "s", + interfaceName: "HTMLElement", + }, + { + name: "samp", + interfaceName: "HTMLElement", + }, + { + name: "script", + constructorNeedsCreatedByParser: true, + }, + { + name: "section", + interfaceName: "HTMLElement", + }, + "select", + { + name: "slot", + interfaceName: "HTMLSlotElement", + }, + { + name: "small", + interfaceName: "HTMLElement", + }, + "source", + "span", + { + name: "strike", + interfaceName: "HTMLElement", + }, + { + name: "strong", + interfaceName: "HTMLElement", + }, + { + name: "style", + constructorNeedsCreatedByParser: true, + }, + { + name: "sub", + interfaceName: "HTMLElement", + }, + { + name: "summary", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLSummaryElement", + }, + { + name: "sup", + interfaceName: "HTMLElement", + }, + "table", + { + name: "tbody", + interfaceName: "HTMLTableSectionElement", + }, + { + name: "td", + interfaceName: "HTMLTableCellElement", + }, + "template", + { + name: "textarea", + interfaceName: "HTMLTextAreaElement", + }, + { + name: "tfoot", + interfaceName: "HTMLTableSectionElement", + }, + { + name: "th", + interfaceName: "HTMLTableCellElement", + }, + { + name: "thead", + interfaceName: "HTMLTableSectionElement", + }, + "title", + { + name: "tr", + interfaceName: "HTMLTableRowElement", + }, + "track", + { + name: "tt", + interfaceName: "HTMLElement", + }, + { + name: "u", + interfaceName: "HTMLElement", + }, + { + name: "ul", + interfaceName: "HTMLUListElement", + }, + { + name: "var", + interfaceName: "HTMLElement", + }, + "video", + { + name: "wbr", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLWBRElement", + }, + { + name: "xmp", + interfaceName: "HTMLPreElement", + }, + { + name: "noscript", + JSInterfaceName: "HTMLElement", + interfaceName: "HTMLNoScriptElement", + }, + ], +}
diff --git a/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in b/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in deleted file mode 100644 index 2277695..0000000 --- a/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in +++ /dev/null
@@ -1,6 +0,0 @@ -namespace="MathML" -namespaceURI="http://www.w3.org/1998/Math/MathML" -attrsNullNamespace - -definitionURL -encoding
diff --git a/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.json5 b/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.json5 new file mode 100644 index 0000000..464ce18 --- /dev/null +++ b/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.json5
@@ -0,0 +1,12 @@ +{ + metadata: { + namespace: "MathML", + namespaceURI: "http://www.w3.org/1998/Math/MathML", + attrsNullNamespace: true, + }, + + data: [ + "definitionURL", + "encoding", + ], +}
diff --git a/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in b/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in deleted file mode 100644 index 80d830f..0000000 --- a/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in +++ /dev/null
@@ -1,12 +0,0 @@ -namespace="MathML" -namespaceURI="http://www.w3.org/1998/Math/MathML" - -math -mi -mn -mo -mtext -ms -mglyph -malignmark -annotation-xml
diff --git a/third_party/WebKit/Source/core/html/parser/MathMLTagNames.json5 b/third_party/WebKit/Source/core/html/parser/MathMLTagNames.json5 new file mode 100644 index 0000000..4326dd7 --- /dev/null +++ b/third_party/WebKit/Source/core/html/parser/MathMLTagNames.json5
@@ -0,0 +1,18 @@ +{ + metadata: { + namespace: "MathML", + namespaceURI: "http://www.w3.org/1998/Math/MathML", + }, + + data: [ + "math", + "mi", + "mn", + "mo", + "mtext", + "ms", + "mglyph", + "malignmark", + "annotation-xml", + ], +}
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp index 12de4c6bf..99c3fbd 100644 --- a/third_party/WebKit/Source/core/input/ScrollManager.cpp +++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -4,6 +4,7 @@ #include "core/input/ScrollManager.h" +#include <memory> #include "core/dom/DOMNodeIds.h" #include "core/events/GestureEvent.h" #include "core/frame/BrowserControls.h" @@ -22,8 +23,8 @@ #include "core/page/scrolling/RootScrollerController.h" #include "core/page/scrolling/ScrollState.h" #include "core/paint/PaintLayer.h" +#include "platform/RuntimeEnabledFeatures.h" #include "wtf/PtrUtil.h" -#include <memory> namespace blink { @@ -383,6 +384,9 @@ if (!m_frame->view()) return WebInputEventResult::NotHandled; + bool enableTouchpadScrollLatching = + RuntimeEnabledFeatures::touchpadAndWheelScrollLatchingEnabled(); + Node* eventTarget = nullptr; Scrollbar* scrollbar = nullptr; if (gestureEvent.type() != WebInputEvent::GestureScrollBegin) { @@ -415,11 +419,23 @@ if (scrollbar) { bool shouldUpdateCapture = false; + // scrollbar->gestureEvent always returns true for touchpad based GSB + // events. Therefore, while mouse is over a fully scrolled scrollbar, GSB + // won't propagate to the next scrollable layer. if (scrollbar->gestureEvent(gestureEvent, &shouldUpdateCapture)) { if (shouldUpdateCapture) m_scrollbarHandlingScrollGesture = scrollbar; return WebInputEventResult::HandledSuppressed; } + + // When touchpad scroll latching is enabled and mouse is over a scrollbar, + // GSU events will always latch to the scrollbar even when it hits the + // scroll content. + if (enableTouchpadScrollLatching && + gestureEvent.type() == WebInputEvent::GestureScrollUpdate) { + return WebInputEventResult::NotHandled; + } + m_scrollbarHandlingScrollGesture = nullptr; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp index f160118..7328c89a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -2354,9 +2354,7 @@ fullstopCharacter}; DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr, (fullStopString, fullStopStringLength)); - DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, - (&horizontalEllipsisCharacter, 1)); - AtomicString& selectedEllipsisStr = ellipsisStr; + AtomicString selectedEllipsisStr(&horizontalEllipsisCharacter, 1); const Font& firstLineFont = firstLineStyle()->font(); // FIXME: We should probably not hard-code the direction here. @@ -2384,7 +2382,6 @@ if (!ellipsisWidth) { ASSERT(font.primaryFont()); if (font.primaryFont()->glyphForCharacter(horizontalEllipsisCharacter)) { - selectedEllipsisStr = ellipsisStr; ellipsisWidth = font.width(constructTextRun(font, &horizontalEllipsisCharacter, 1, styleRef(), ellipsisDirection));
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index be2a44ff..26bd2f95 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1239,6 +1239,11 @@ m_inStopAllLoaders = true; + if (m_isNavigationHandledByClient) { + client()->dispatchDidFailProvisionalLoad( + ResourceError::cancelledError(String()), StandardCommit); + } + m_isNavigationHandledByClient = false; for (Frame* child = m_frame->tree().firstChild(); child;
diff --git a/third_party/WebKit/Source/core/svg/SVGAttributeNames.in b/third_party/WebKit/Source/core/svg/SVGAttributeNames.in deleted file mode 100644 index 7952490..0000000 --- a/third_party/WebKit/Source/core/svg/SVGAttributeNames.in +++ /dev/null
@@ -1,243 +0,0 @@ -namespace="SVG" -namespaceURI="http://www.w3.org/2000/svg" -attrsNullNamespace -export="CORE_EXPORT" - -accent-height -accumulate -additive -alignment-baseline -alphabetic -amplitude -animate -arabic-form -ascent -attributeName -attributeType -azimuth -baseFrequency -baseline-shift -baseProfile -bbox -begin -bias -buffered-rendering -by -calcMode -cap-height -clip -clip-path -clip-rule -clipPathUnits -color -color-interpolation -color-interpolation-filters -color-rendering -cursor -cx -cy -d -descent -diffuseConstant -direction -display -divisor -dominant-baseline -dur -dx -dy -edgeMode -elevation -end -exponent -fill -fill-opacity -fill-rule -filter -filterUnits -flood-color -flood-opacity -font-family -font-size -font-size-adjust -font-stretch -font-style -font-variant -font-weight -format -from -fx -fy -fr -g1 -g2 -glyph-name -glyphRef -gradientTransform -gradientUnits -hanging -height -horiz-adv-x -horiz-origin-x -horiz-origin-y -href -ideographic -image-rendering -in -in2 -intercept -k -k1 -k2 -k3 -k4 -kernelMatrix -kernelUnitLength -keyPoints -keySplines -keyTimes -lang -lengthAdjust -letter-spacing -lighting-color -limitingConeAngle -local -marker-end -marker-mid -marker-start -markerHeight -markerUnits -markerWidth -mask -mask-type -maskContentUnits -maskUnits -mathematical -max -media -method -min -mode -name -numOctaves -offset -onactivate -onbegin -onend -onfocusin -onfocusout -onrepeat -opacity -operator -order -orient -orientation -origin -overflow -overline-position -overline-thickness -paint-order -panose-1 -path -pathLength -patternContentUnits -patternTransform -patternUnits -pointer-events -points -pointsAtX -pointsAtY -pointsAtZ -preserveAlpha -preserveAspectRatio -primitiveUnits -r -radius -refX -refY -rendering-intent -repeatCount -repeatDur -requiredExtensions -requiredFeatures -restart -result -rotate -rx -ry -scale -seed -shape-rendering -slope -spacing -specularConstant -specularExponent -spreadMethod -startOffset -stdDeviation -stemh -stemv -stitchTiles -stop-color -stop-opacity -strikethrough-position -strikethrough-thickness -stroke -stroke-dasharray -stroke-dashoffset -stroke-linecap -stroke-linejoin -stroke-miterlimit -stroke-opacity -stroke-width -style -surfaceScale -systemLanguage -tableValues -target -targetX -targetY -text-anchor -text-decoration -text-rendering -textLength -title -to -transform -transform-origin -type -u1 -u2 -underline-position -underline-thickness -unicode -unicode-bidi -unicode-range -units-per-em -v-alphabetic -v-hanging -v-ideographic -v-mathematical -values -vector-effect -version -vert-adv-y -vert-origin-x -vert-origin-y -viewBox -visibility -width -widths -word-spacing -writing-mode -x -x-height -x1 -x2 -xChannelSelector -y -y1 -y2 -yChannelSelector -z -zoomAndPan
diff --git a/third_party/WebKit/Source/core/svg/SVGAttributeNames.json5 b/third_party/WebKit/Source/core/svg/SVGAttributeNames.json5 new file mode 100644 index 0000000..5e5121d3 --- /dev/null +++ b/third_party/WebKit/Source/core/svg/SVGAttributeNames.json5
@@ -0,0 +1,249 @@ +{ + metadata: { + namespace: "SVG", + namespaceURI: "http://www.w3.org/2000/svg", + attrsNullNamespace: true, + export: "CORE_EXPORT", + }, + + data: [ + "accent-height", + "accumulate", + "additive", + "alignment-baseline", + "alphabetic", + "amplitude", + "animate", + "arabic-form", + "ascent", + "attributeName", + "attributeType", + "azimuth", + "baseFrequency", + "baseline-shift", + "baseProfile", + "bbox", + "begin", + "bias", + "buffered-rendering", + "by", + "calcMode", + "cap-height", + "clip", + "clip-path", + "clip-rule", + "clipPathUnits", + "color", + "color-interpolation", + "color-interpolation-filters", + "color-rendering", + "cursor", + "cx", + "cy", + "d", + "descent", + "diffuseConstant", + "direction", + "display", + "divisor", + "dominant-baseline", + "dur", + "dx", + "dy", + "edgeMode", + "elevation", + "end", + "exponent", + "fill", + "fill-opacity", + "fill-rule", + "filter", + "filterUnits", + "flood-color", + "flood-opacity", + "font-family", + "font-size", + "font-size-adjust", + "font-stretch", + "font-style", + "font-variant", + "font-weight", + "format", + "from", + "fx", + "fy", + "fr", + "g1", + "g2", + "glyph-name", + "glyphRef", + "gradientTransform", + "gradientUnits", + "hanging", + "height", + "horiz-adv-x", + "horiz-origin-x", + "horiz-origin-y", + "href", + "ideographic", + "image-rendering", + "in", + "in2", + "intercept", + "k", + "k1", + "k2", + "k3", + "k4", + "kernelMatrix", + "kernelUnitLength", + "keyPoints", + "keySplines", + "keyTimes", + "lang", + "lengthAdjust", + "letter-spacing", + "lighting-color", + "limitingConeAngle", + "local", + "marker-end", + "marker-mid", + "marker-start", + "markerHeight", + "markerUnits", + "markerWidth", + "mask", + "mask-type", + "maskContentUnits", + "maskUnits", + "mathematical", + "max", + "media", + "method", + "min", + "mode", + "name", + "numOctaves", + "offset", + "onactivate", + "onbegin", + "onend", + "onfocusin", + "onfocusout", + "onrepeat", + "opacity", + "operator", + "order", + "orient", + "orientation", + "origin", + "overflow", + "overline-position", + "overline-thickness", + "paint-order", + "panose-1", + "path", + "pathLength", + "patternContentUnits", + "patternTransform", + "patternUnits", + "pointer-events", + "points", + "pointsAtX", + "pointsAtY", + "pointsAtZ", + "preserveAlpha", + "preserveAspectRatio", + "primitiveUnits", + "r", + "radius", + "refX", + "refY", + "rendering-intent", + "repeatCount", + "repeatDur", + "requiredExtensions", + "requiredFeatures", + "restart", + "result", + "rotate", + "rx", + "ry", + "scale", + "seed", + "shape-rendering", + "slope", + "spacing", + "specularConstant", + "specularExponent", + "spreadMethod", + "startOffset", + "stdDeviation", + "stemh", + "stemv", + "stitchTiles", + "stop-color", + "stop-opacity", + "strikethrough-position", + "strikethrough-thickness", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + "style", + "surfaceScale", + "systemLanguage", + "tableValues", + "target", + "targetX", + "targetY", + "text-anchor", + "text-decoration", + "text-rendering", + "textLength", + "title", + "to", + "transform", + "transform-origin", + "type", + "u1", + "u2", + "underline-position", + "underline-thickness", + "unicode", + "unicode-bidi", + "unicode-range", + "units-per-em", + "v-alphabetic", + "v-hanging", + "v-ideographic", + "v-mathematical", + "values", + "vector-effect", + "version", + "vert-adv-y", + "vert-origin-x", + "vert-origin-y", + "viewBox", + "visibility", + "width", + "widths", + "word-spacing", + "writing-mode", + "x", + "x-height", + "x1", + "x2", + "xChannelSelector", + "y", + "y1", + "y2", + "yChannelSelector", + "z", + "zoomAndPan", + ], +}
diff --git a/third_party/WebKit/Source/core/svg/SVGTagNames.in b/third_party/WebKit/Source/core/svg/SVGTagNames.in deleted file mode 100644 index 23f5ad8..0000000 --- a/third_party/WebKit/Source/core/svg/SVGTagNames.in +++ /dev/null
@@ -1,71 +0,0 @@ -namespace="SVG" -namespaceURI="http://www.w3.org/2000/svg" -fallbackInterfaceName="SVGUnknownElement" -fallbackJSInterfaceName="SVGElement" -export="CORE_EXPORT" - -a -animate runtimeEnabled=smil, noTypeHelpers -animateColor runtimeEnabled=smil, interfaceName=SVGUnknownElement, JSInterfaceName=SVGElement, noConstructor -animateMotion runtimeEnabled=smil -animateTransform runtimeEnabled=smil -set runtimeEnabled=smil -circle -clipPath -defs -desc -discard runtimeEnabled=smil -ellipse -feBlend -feColorMatrix -feComponentTransfer -feComposite -feConvolveMatrix -feDiffuseLighting -feDisplacementMap -feDistantLight -feDropShadow -feFlood -feFuncA -feFuncB -feFuncG -feFuncR -feGaussianBlur -feImage -feMerge -feMergeNode -feMorphology -feOffset -fePointLight -feSpecularLighting -feSpotLight -feTile -feTurbulence -filter -foreignObject -g -image -line -linearGradient -marker -mask -metadata -mpath runtimeEnabled=smil, interfaceName=SVGMPathElement -path -pattern -polygon -polyline -radialGradient -rect -script constructorNeedsCreatedByParser -stop -style constructorNeedsCreatedByParser -svg interfaceName=SVGSVGElement -switch -symbol -text -textPath -title -tspan interfaceName=SVGTSpanElement -use -view
diff --git a/third_party/WebKit/Source/core/svg/SVGTagNames.json5 b/third_party/WebKit/Source/core/svg/SVGTagNames.json5 new file mode 100644 index 0000000..bc54ea7c --- /dev/null +++ b/third_party/WebKit/Source/core/svg/SVGTagNames.json5
@@ -0,0 +1,115 @@ +{ + metadata: { + namespace: "SVG", + namespaceURI: "http://www.w3.org/2000/svg", + fallbackInterfaceName: "SVGUnknownElement", + fallbackJSInterfaceName: "SVGElement", + export: "CORE_EXPORT", + }, + + data: [ + "a", + { + name: "animate", + noTypeHelpers: true, + runtimeEnabled: "smil", + }, + { + name: "animateColor", + JSInterfaceName: "SVGElement", + interfaceName: "SVGUnknownElement", + noConstructor: true, + runtimeEnabled: "smil", + }, + { + name: "animateMotion", + runtimeEnabled: "smil", + }, + { + name: "animateTransform", + runtimeEnabled: "smil", + }, + { + name: "set", + runtimeEnabled: "smil", + }, + "circle", + "clipPath", + "defs", + "desc", + { + name: "discard", + runtimeEnabled: "smil", + }, + "ellipse", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feDistantLight", + "feDropShadow", + "feFlood", + "feFuncA", + "feFuncB", + "feFuncG", + "feFuncR", + "feGaussianBlur", + "feImage", + "feMerge", + "feMergeNode", + "feMorphology", + "feOffset", + "fePointLight", + "feSpecularLighting", + "feSpotLight", + "feTile", + "feTurbulence", + "filter", + "foreignObject", + "g", + "image", + "line", + "linearGradient", + "marker", + "mask", + "metadata", + { + name: "mpath", + interfaceName: "SVGMPathElement", + runtimeEnabled: "smil", + }, + "path", + "pattern", + "polygon", + "polyline", + "radialGradient", + "rect", + { + name: "script", + constructorNeedsCreatedByParser: true, + }, + "stop", + { + name: "style", + constructorNeedsCreatedByParser: true, + }, + { + name: "svg", + interfaceName: "SVGSVGElement", + }, + "switch", + "symbol", + "text", + "textPath", + "title", + { + name: "tspan", + interfaceName: "SVGTSpanElement", + }, + "use", + "view", + ], +}
diff --git a/third_party/WebKit/Source/core/svg/xlinkattrs.in b/third_party/WebKit/Source/core/svg/xlinkattrs.in deleted file mode 100644 index e3e0c33..0000000 --- a/third_party/WebKit/Source/core/svg/xlinkattrs.in +++ /dev/null
@@ -1,11 +0,0 @@ -namespace="XLink" -namespaceURI="http://www.w3.org/1999/xlink" -export="CORE_EXPORT" - -actuate -arcrole -href -role -show -title -type
diff --git a/third_party/WebKit/Source/core/svg/xlinkattrs.json5 b/third_party/WebKit/Source/core/svg/xlinkattrs.json5 new file mode 100644 index 0000000..70ac0534 --- /dev/null +++ b/third_party/WebKit/Source/core/svg/xlinkattrs.json5
@@ -0,0 +1,17 @@ +{ + metadata: { + namespace: "XLink", + namespaceURI: "http://www.w3.org/1999/xlink", + export: "CORE_EXPORT", + }, + + data: [ + "actuate", + "arcrole", + "href", + "role", + "show", + "title", + "type", + ], +}
diff --git a/third_party/WebKit/Source/core/xml/xmlattrs.in b/third_party/WebKit/Source/core/xml/xmlattrs.in deleted file mode 100644 index ae6ab01..0000000 --- a/third_party/WebKit/Source/core/xml/xmlattrs.in +++ /dev/null
@@ -1,6 +0,0 @@ -namespace="XML" -namespacePrefix="xml" -namespaceURI="http://www.w3.org/XML/1998/namespace" - -lang -space
diff --git a/third_party/WebKit/Source/core/xml/xmlattrs.json5 b/third_party/WebKit/Source/core/xml/xmlattrs.json5 new file mode 100644 index 0000000..6fa47033 --- /dev/null +++ b/third_party/WebKit/Source/core/xml/xmlattrs.json5
@@ -0,0 +1,12 @@ +{ + metadata: { + namespace: "XML", + namespacePrefix: "xml", + namespaceURI: "http://www.w3.org/XML/1998/namespace", + }, + + data: [ + "lang", + "space", + ], +}
diff --git a/third_party/WebKit/Source/core/xml/xmlnsattrs.in b/third_party/WebKit/Source/core/xml/xmlnsattrs.in deleted file mode 100644 index 7ac415a..0000000 --- a/third_party/WebKit/Source/core/xml/xmlnsattrs.in +++ /dev/null
@@ -1,4 +0,0 @@ -namespace="XMLNS" -namespaceURI="http://www.w3.org/2000/xmlns/" - -xmlns
diff --git a/third_party/WebKit/Source/core/xml/xmlnsattrs.json5 b/third_party/WebKit/Source/core/xml/xmlnsattrs.json5 new file mode 100644 index 0000000..81f1684 --- /dev/null +++ b/third_party/WebKit/Source/core/xml/xmlnsattrs.json5
@@ -0,0 +1,10 @@ +{ + metadata: { + namespace: "XMLNS", + namespaceURI: "http://www.w3.org/2000/xmlns/", + }, + + data: [ + "xmlns", + ], +}
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/EventsTimelineTreeView.js b/third_party/WebKit/Source/devtools/front_end/timeline/EventsTimelineTreeView.js index 6c69dd36..8613bdc 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/EventsTimelineTreeView.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/EventsTimelineTreeView.js
@@ -90,18 +90,17 @@ */ populateColumns(columns) { columns.push( - {id: 'startTime', title: Common.UIString('Start Time'), width: '110px', fixedWidth: true, sortable: true}); + {id: 'startTime', title: Common.UIString('Start Time'), width: '80px', fixedWidth: true, sortable: true}); super.populateColumns(columns); + columns.filter(c => c.fixedWidth).forEach(c => c.width = '80px'); } /** * @override - * @param {!Element} parent + * @param {!UI.Toolbar} toolbar */ - _populateToolbar(parent) { - var filtersWidget = this._filtersControl.filtersWidget(); - filtersWidget.forceShowFilterBar(); - filtersWidget.show(parent); + _populateToolbar(toolbar) { + this._filtersControl.populateToolbar(toolbar); } /** @@ -141,13 +140,10 @@ Timeline.EventsTimelineTreeView.Filters = class extends Common.Object { constructor() { super(); - this._categoryFilter = new Timeline.TimelineFilters.Category(); this._durationFilter = new Timeline.TimelineFilters.IsLong(); this._textFilter = new Timeline.TimelineFilters.RegExp(); this._filters = [this._categoryFilter, this._durationFilter, this._textFilter]; - - this._createFilterBar(); } /** @@ -158,49 +154,22 @@ } /** - * @return {?RegExp} + * @param {!UI.Toolbar} toolbar */ - searchRegExp() { - return this._textFilter.regExp(); - } + populateToolbar(toolbar) { + this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter')); + this._textFilterUI.addEventListener(UI.ToolbarInput.Event.TextChanged, textFilterChanged, this); + toolbar.appendToolbarItem(this._textFilterUI); - /** - * @return {!UI.ToolbarItem} - */ - filterButton() { - return this._filterBar.filterButton(); - } - - /** - * @return {!UI.Widget} - */ - filtersWidget() { - return this._filterBar; - } - - _createFilterBar() { - this._filterBar = new UI.FilterBar('timelinePanel'); - - this._textFilterUI = new UI.TextFilterUI(); - this._textFilterUI.addEventListener(UI.FilterUI.Events.FilterChanged, textFilterChanged, this); - this._filterBar.addFilter(this._textFilterUI); - - var durationOptions = []; + var durationFilterUI = new UI.ToolbarComboBox(durationFilterChanged.bind(this)); for (var durationMs of Timeline.EventsTimelineTreeView.Filters._durationFilterPresetsMs) { - var durationOption = {}; - if (!durationMs) { - durationOption.label = Common.UIString('All'); - durationOption.title = Common.UIString('Show all records'); - } else { - durationOption.label = Common.UIString('\u2265 %dms', durationMs); - durationOption.title = Common.UIString('Hide records shorter than %dms', durationMs); - } - durationOption.value = String(durationMs); - durationOptions.push(durationOption); + durationFilterUI.addOption(durationFilterUI.createOption( + durationMs ? Common.UIString('\u2265 %d\u2009ms', durationMs) : Common.UIString('All'), + durationMs ? Common.UIString('Hide records shorter than %d\u2009ms', durationMs) + : Common.UIString('Show all records'), + String(durationMs))); } - var durationFilterUI = new UI.ComboBoxFilterUI(durationOptions); - durationFilterUI.addEventListener(UI.FilterUI.Events.FilterChanged, durationFilterChanged, this); - this._filterBar.addFilter(durationFilterUI); + toolbar.appendToolbarItem(durationFilterUI); var categoryFiltersUI = {}; var categories = Timeline.TimelineUIUtils.categories(); @@ -208,13 +177,13 @@ var category = categories[categoryName]; if (!category.visible) continue; - var filter = new UI.CheckboxFilterUI(category.name, category.title); - filter.setColor(category.color, 'rgba(0, 0, 0, 0.2)'); - categoryFiltersUI[category.name] = filter; - filter.addEventListener(UI.FilterUI.Events.FilterChanged, categoriesFilterChanged.bind(this, categoryName)); - this._filterBar.addFilter(filter); + var checkbox = new UI.ToolbarCheckbox( + category.title, undefined, undefined, categoriesFilterChanged.bind(this, categoryName)); + checkbox.setChecked(true); + checkbox.inputElement.style.backgroundColor = category.color; + categoryFiltersUI[category.name] = checkbox; + toolbar.appendToolbarItem(checkbox); } - return this._filterBar; /** * @this {Timeline.EventsTimelineTreeView.Filters} @@ -229,7 +198,7 @@ * @this {Timeline.EventsTimelineTreeView.Filters} */ function durationFilterChanged() { - var duration = durationFilterUI.value(); + var duration = durationFilterUI.selectedOption().value; var minimumRecordDuration = parseInt(duration, 10); this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); this._notifyFiltersChanged();
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js index 58125b1..2f19b974 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -53,8 +53,9 @@ this.populateColumns(columns); this._splitWidget = new UI.SplitWidget(true, true, 'timelineTreeViewDetailsSplitWidget'); - const mainView = new UI.VBox(); - this._populateToolbar(mainView.element); + var mainView = new UI.VBox(); + var toolbar = new UI.Toolbar('', mainView.element); + this._populateToolbar(toolbar); this._dataGrid = new DataGrid.SortableDataGrid(columns); this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this._sortingChanged, this); @@ -108,9 +109,9 @@ } /** - * @param {!Element} parent + * @param {!UI.Toolbar} toolbar */ - _populateToolbar(parent) { + _populateToolbar(toolbar) { } /** @@ -209,8 +210,8 @@ * @param {!Array<!DataGrid.DataGrid.ColumnDescriptor>} columns */ populateColumns(columns) { - columns.push({id: 'self', title: Common.UIString('Self Time'), width: '110px', fixedWidth: true, sortable: true}); - columns.push({id: 'total', title: Common.UIString('Total Time'), width: '110px', fixedWidth: true, sortable: true}); + columns.push({id: 'self', title: Common.UIString('Self Time'), width: '120px', fixedWidth: true, sortable: true}); + columns.push({id: 'total', title: Common.UIString('Total Time'), width: '120px', fixedWidth: true, sortable: true}); columns.push({id: 'activity', title: Common.UIString('Activity'), disclosure: true, sortable: true}); } @@ -571,10 +572,9 @@ /** * @override - * @param {!Element} parent + * @param {!UI.Toolbar} toolbar */ - _populateToolbar(parent) { - var panelToolbar = new UI.Toolbar('', parent); + _populateToolbar(toolbar) { this._groupByCombobox = new UI.ToolbarComboBox(this._onGroupByChanged.bind(this)); /** * @param {string} name @@ -595,9 +595,9 @@ addGroupingOption.call(this, Common.UIString('Group by Subdomain'), groupBy.Subdomain); addGroupingOption.call(this, Common.UIString('Group by URL'), groupBy.URL); addGroupingOption.call(this, Common.UIString('Group by Frame'), groupBy.Frame); - panelToolbar.appendToolbarItem(this._groupByCombobox); - panelToolbar.appendSpacer(); - panelToolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Common.UIString('heaviest stack'))); + toolbar.appendToolbarItem(this._groupByCombobox); + toolbar.appendSpacer(); + toolbar.appendToolbarItem(this._splitWidget.createShowHideSidebarButton(Common.UIString('heaviest stack'))); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js index e94ecae..e984f35 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -547,9 +547,6 @@ MouseUp: Symbol('MouseUp') }; -/** - * @unrestricted - */ UI.ToolbarInput = class extends UI.ToolbarItem { /** * @param {string} placeholder @@ -574,6 +571,8 @@ if (isSearchField) this._setupSearchControls(); + + this._updateEmptyStyles(); } _setupSearchControls() { @@ -598,6 +597,7 @@ this.input.value = value; if (notify) this._onChangeCallback(); + this._updateEmptyStyles(); } /** @@ -611,15 +611,20 @@ * @param {!Event} event */ _onKeydownCallback(event) { - if (this.isSearchField || !isEscKey(event) || !this.input.value) + if (!this._isSearchField || !isEscKey(event) || !this.input.value) return; this._internalSetValue('', true); event.consume(true); } _onChangeCallback() { + this._updateEmptyStyles(); this.dispatchEventToListeners(UI.ToolbarInput.Event.TextChanged, this.input.value); } + + _updateEmptyStyles() { + this.element.classList.toggle('toolbar-input-empty', !this.input.value); + } }; UI.ToolbarInput.Event = {
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css index 948e3ffc..94fcc60 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css +++ b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css
@@ -230,6 +230,10 @@ opacity: 1; } +.toolbar-input-empty .toolbar-input-clear-button { + display: none; +} + /* Separator */ .toolbar-divider {
diff --git a/third_party/WebKit/Source/modules/budget/OWNERS b/third_party/WebKit/Source/modules/budget/OWNERS index 0db732d..a45ee20e 100644 --- a/third_party/WebKit/Source/modules/budget/OWNERS +++ b/third_party/WebKit/Source/modules/budget/OWNERS
@@ -1,3 +1,4 @@ peter@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: Blink>PushAPI
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl index 7998203..37b49db 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl +++ b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl
@@ -1,10 +1,9 @@ // 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. - partial interface HTMLMediaElement { readonly attribute MediaKeys mediaKeys; - [CallWith=ScriptState] Promise setMediaKeys(MediaKeys? mediaKeys); + [SecureContext, CallWith=ScriptState] Promise setMediaKeys(MediaKeys? mediaKeys); attribute EventHandler onencrypted; attribute EventHandler onwaitingforkey; };
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.idl b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.idl index 0863a83..a716f07 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.idl +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.idl
@@ -31,6 +31,7 @@ [ ActiveScriptWrappable, DependentLifetime, + SecureContext, ] interface MediaKeys { [CallWith=ScriptState, RaisesException] MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary");
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp index ae354cf9..96c4f007 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -339,19 +339,6 @@ "The supportedConfigurations parameter is empty.")); } - // Note: This method should only be exposed to secure contexts as indicated - // by the [SecureContext] IDL attribute. Since that will break some existing - // sites, we simply keep track of sites that aren't secure and output a - // deprecation message. - if (executionContext->isSecureContext()) { - UseCounter::count(executionContext, UseCounter::EncryptedMediaSecureOrigin); - } else { - Deprecation::countDeprecation(executionContext, - UseCounter::EncryptedMediaInsecureOrigin); - // TODO(ddorwin): Implement the following: - // Reject promise with a new DOMException whose name is NotSupportedError. - } - // 3. Let document be the calling context's Document. // (Done at the begining of this function.) if (!document->page()) {
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.idl b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.idl index 62c96b7..2ea077a 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.idl +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.idl
@@ -5,5 +5,5 @@ // https://w3c.github.io/encrypted-media/#navigator-extension-requestmediakeysystemaccess partial interface Navigator { - [CallWith=ScriptState] Promise<MediaKeySystemAccess> requestMediaKeySystemAccess(DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfigurations); + [SecureContext, CallWith=ScriptState] Promise<MediaKeySystemAccess> requestMediaKeySystemAccess(DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfigurations); };
diff --git a/third_party/WebKit/Source/modules/notifications/OWNERS b/third_party/WebKit/Source/modules/notifications/OWNERS index 2d6d6fc4..20148c755 100644 --- a/third_party/WebKit/Source/modules/notifications/OWNERS +++ b/third_party/WebKit/Source/modules/notifications/OWNERS
@@ -1,5 +1,5 @@ mvanouwerkerk@chromium.org peter@chromium.org -# TEAM: push-notifications-dev@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications
diff --git a/third_party/WebKit/Source/modules/push_messaging/OWNERS b/third_party/WebKit/Source/modules/push_messaging/OWNERS index d09ffef..4898e44 100644 --- a/third_party/WebKit/Source/modules/push_messaging/OWNERS +++ b/third_party/WebKit/Source/modules/push_messaging/OWNERS
@@ -1 +1,4 @@ file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp index 8076910..3e3e9e7 100644 --- a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp
@@ -50,16 +50,24 @@ void AnalyserHandler::process(size_t framesToProcess) { AudioBus* outputBus = output(0).bus(); - if (!isInitialized() || !input(0).isConnected()) { + if (!isInitialized()) { outputBus->zero(); return; } AudioBus* inputBus = input(0).bus(); - // Give the analyser the audio which is passing through this AudioNode. + // Give the analyser the audio which is passing through this + // AudioNode. This must always be done so that the state of the + // Analyser reflects the current input. m_analyser.writeInput(inputBus, framesToProcess); + if (!input(0).isConnected()) { + // No inputs, so clear the output, and propagate the silence hint. + outputBus->zero(); + return; + } + // For in-place processing, our override of pullInputs() will just pass the // audio data through unchanged if the channel count matches from input to // output (resulting in inputBus == outputBus). Otherwise, do an up-mix to @@ -132,6 +140,35 @@ } } +void AnalyserHandler::updatePullStatus() { +#if DCHECK_IS_ON() + DCHECK(context()->isGraphOwner()); +#endif + + if (output(0).isConnected()) { + // When an AudioBasicInspectorNode is connected to a downstream node, it + // will get pulled by the downstream node, thus remove it from the context's + // automatic pull list. + if (m_needAutomaticPull) { + context()->deferredTaskHandler().removeAutomaticPullNode(this); + m_needAutomaticPull = false; + } + } else { + unsigned numberOfInputConnections = input(0).numberOfRenderingConnections(); + // When an AnalyserNode is not connected to any downstream node + // while still connected from upstream node(s), add it to the context's + // automatic pull list. + // + // But don't remove the AnalyserNode if there are no inputs + // connected to the node. The node needs to be pulled so that the + // internal state is updated with the correct input signal (of + // zeroes). + if (numberOfInputConnections && !m_needAutomaticPull) { + context()->deferredTaskHandler().addAutomaticPullNode(this); + m_needAutomaticPull = true; + } + } +} // ---------------------------------------------------------------- AnalyserNode::AnalyserNode(BaseAudioContext& context)
diff --git a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h index 6c80967..5fc6fbff3 100644 --- a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h
@@ -75,8 +75,20 @@ m_analyser.getByteTimeDomainData(array); } + // AnalyserNode needs special handling when updating the pull status + // because the node must get pulled even if there are no inputs or + // outputs so that the internal state is properly updated with the + // correct time data. + void updatePullStatus() override; + private: AnalyserHandler(AudioNode&, float sampleRate); + bool propagatesSilence() const { + // An AnalyserNode does actually propogate silence, but to get the + // time and FFT data updated correctly, process() needs to be + // called even if all the inputs are silent. + return false; + } RealtimeAnalyser m_analyser; };
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.cpp index e1bed1d..4ca43d2 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.cpp
@@ -116,8 +116,11 @@ context()->deferredTaskHandler().addAutomaticPullNode(this); m_needAutomaticPull = true; } else if (!numberOfInputConnections && m_needAutomaticPull) { - // The AudioBasicInspectorNode is connected to nothing, remove it from the - // context's automatic pull list. + // The AudioBasicInspectorNode is connected to nothing and is + // not an AnalyserNode, remove it from the context's automatic + // pull list. AnalyserNode's need to be pulled even with no + // inputs so that the internal state gets updated to hold the + // right time and FFT data. context()->deferredTaskHandler().removeAutomaticPullNode(this); m_needAutomaticPull = false; }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.h b/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.h index e3ccd83..6dbb7081 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicInspectorNode.h
@@ -50,9 +50,9 @@ void pullInputs(size_t framesToProcess) final; void checkNumberOfChannelsForInput(AudioNodeInput*) final; - void updatePullStatus(); + virtual void updatePullStatus(); - private: + protected: // When setting to true, AudioBasicInspectorHandler will be pulled // automaticlly by BaseAudioContext before the end of each render quantum. bool m_needAutomaticPull;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp index c2c0dcf4..a59f547 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
@@ -429,9 +429,14 @@ // This needs to be handled more generally where AudioNodes have a tailTime // attribute. Then the AudioNode only needs to remain "active" for tailTime // seconds after there are no longer any active connections. + // + // The analyser node also requires special handling because we + // need the internal state to be updated for the time and FFT data + // even if it has no connections. if (getNodeType() != NodeTypeConvolver && getNodeType() != NodeTypeDelay && getNodeType() != NodeTypeBiquadFilter && - getNodeType() != NodeTypeIIRFilter) { + getNodeType() != NodeTypeIIRFilter && + getNodeType() != NodeTypeAnalyser) { m_isDisabled = true; clearInternalStateWhenDisabled(); for (auto& output : m_outputs)
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 index f8788f4..83cf3d4 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -859,6 +859,12 @@ name: "TouchEventFeatureDetection", status: "stable", }, + // This is set conditionally in SetRuntimeFeaturesDefaultsAndUpdateFromArgs + // and will eventually go away when the touchpad/wheel scroll latching is + // enabled on all platforms (http://crbug.com/526463). + { + name: "TouchpadAndWheelScrollLatching", + }, { name: "TrueColorRendering", status: "experimental",
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp index 5a2c639..d9084ef 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -53,8 +53,6 @@ #include <unicode/uscript.h> namespace blink { -using FeaturesVector = Vector<hb_feature_t, 6>; - enum HolesQueueItemAction { HolesQueueNextFont, HolesQueueRange }; struct HolesQueueItem { @@ -94,6 +92,28 @@ HarfBuzzShaper::HarfBuzzShaper(const UChar* text, unsigned length) : m_text(text), m_textLength(length) {} +using FeaturesVector = Vector<hb_feature_t, 6>; +struct HarfBuzzShaper::RangeData { + hb_buffer_t* buffer; + const Font* font; + TextDirection textDirection; + unsigned start; + unsigned end; + FeaturesVector fontFeatures; + Deque<HolesQueueItem> holesQueue; + + hb_direction_t harfBuzzDirection(const SimpleFontData* fontData) { + FontOrientation orientation = font->getFontDescription().orientation(); + hb_direction_t direction = isVerticalAnyUpright(orientation) && + !fontData->isTextOrientationFallback() + ? HB_DIRECTION_TTB + : HB_DIRECTION_LTR; + return textDirection == TextDirection::kRtl + ? HB_DIRECTION_REVERSE(direction) + : direction; + } +}; + namespace { // A port of hb_icu_script_to_script because harfbuzz on CrOS is built @@ -105,19 +125,6 @@ return hb_script_from_string(uscript_getShortName(script), -1); } -static inline hb_direction_t TextDirectionToHBDirection( - TextDirection dir, - FontOrientation orientation, - const SimpleFontData* fontData) { - hb_direction_t harfBuzzDirection = - isVerticalAnyUpright(orientation) && - !fontData->isTextOrientationFallback() - ? HB_DIRECTION_TTB - : HB_DIRECTION_LTR; - return dir == TextDirection::kRtl ? HB_DIRECTION_REVERSE(harfBuzzDirection) - : harfBuzzDirection; -} - inline bool shapeRange(hb_buffer_t* buffer, hb_feature_t* fontFeatures, unsigned fontFeaturesSize, @@ -145,16 +152,13 @@ } // namespace -bool HarfBuzzShaper::extractShapeResults(hb_buffer_t* buffer, - ShapeResult* shapeResult, +bool HarfBuzzShaper::extractShapeResults(RangeData* rangeData, bool& fontCycleQueued, - Deque<HolesQueueItem>* holesQueue, const HolesQueueItem& currentQueueItem, - const Font* font, - TextDirection textDirection, const SimpleFontData* currentFont, UScriptCode currentRunScript, - bool isLastResort) const { + bool isLastResort, + ShapeResult* shapeResult) const { enum ClusterResult { Shaped, NotDef, Unknown }; ClusterResult currentClusterResult = Unknown; ClusterResult previousClusterResult = Unknown; @@ -162,8 +166,8 @@ unsigned currentCluster = 0; // Find first notdef glyph in buffer. - unsigned numGlyphs = hb_buffer_get_length(buffer); - hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos(buffer, 0); + unsigned numGlyphs = hb_buffer_get_length(rangeData->buffer); + hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos(rangeData->buffer, 0); unsigned lastChangePosition = 0; @@ -219,7 +223,7 @@ unsigned numCharacters = 0; unsigned numGlyphsToInsert = 0; unsigned startIndex = 0; - if (HB_DIRECTION_IS_FORWARD(hb_buffer_get_direction(buffer))) { + if (HB_DIRECTION_IS_FORWARD(hb_buffer_get_direction(rangeData->buffer))) { startIndex = glyphInfo[lastChangePosition].cluster; if (glyphIndex == numGlyphs) { numCharacters = currentQueueItem.m_startIndex + @@ -248,13 +252,13 @@ if (currentClusterResult == Shaped && !isLastResort) { // Now it's clear that we need to continue processing. if (!fontCycleQueued) { - holesQueue->append(HolesQueueItem(HolesQueueNextFont, 0, 0)); + rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); fontCycleQueued = true; } // Here we need to put character positions. ASSERT(numCharacters); - holesQueue->append( + rangeData->holesQueue.append( HolesQueueItem(HolesQueueRange, startIndex, numCharacters)); } @@ -266,14 +270,13 @@ // When we're getting here with the last resort font, we have no other // choice than adding boxes to the ShapeResult. if ((currentClusterResult == NotDef && numCharacters) || isLastResort) { - hb_direction_t direction = TextDirectionToHBDirection( - textDirection, font->getFontDescription().orientation(), currentFont); + hb_direction_t direction = rangeData->harfBuzzDirection(currentFont); // Here we need to specify glyph positions. ShapeResult::RunInfo* run = new ShapeResult::RunInfo( currentFont, direction, ICUScriptToHBScript(currentRunScript), startIndex, numGlyphsToInsert, numCharacters); shapeResult->insertRun(WTF::wrapUnique(run), lastChangePosition, - numGlyphsToInsert, buffer); + numGlyphsToInsert, rangeData->buffer); } lastChangePosition = glyphIndex; } @@ -296,16 +299,15 @@ } bool HarfBuzzShaper::collectFallbackHintChars( - const Deque<HolesQueueItem>* holesQueue, + const Deque<HolesQueueItem>& holesQueue, Vector<UChar32>& hint) const { - DCHECK(holesQueue); - if (!holesQueue->size()) + if (!holesQueue.size()) return false; hint.clear(); size_t numCharsAdded = 0; - for (auto it = holesQueue->begin(); it != holesQueue->end(); ++it) { + for (auto it = holesQueue.begin(); it != holesQueue.end(); ++it) { if (it->m_action == HolesQueueNextFont) break; @@ -549,19 +551,13 @@ } // namespace -void HarfBuzzShaper::shapeSegment(ShapeResult* result, - Deque<HolesQueueItem>* holesQueue, - hb_buffer_t* buffer, - const Font* font, - TextDirection textDirection, - FeaturesVector* fontFeatures, +void HarfBuzzShaper::shapeSegment(RangeData* rangeData, RunSegmenter::RunSegmenterRange segment, - unsigned start, - unsigned end) const { + ShapeResult* result) const { DCHECK(result); - DCHECK(holesQueue); - DCHECK(buffer); + DCHECK(rangeData->buffer); + const Font* font = rangeData->font; const FontDescription& fontDescription = font->getFontDescription(); const hb_language_t language = fontDescription.localeOrDefault().harfbuzzLanguage(); @@ -573,15 +569,15 @@ RefPtr<FontFallbackIterator> fallbackIterator = font->createFontFallbackIterator(segment.fontFallbackPriority); - holesQueue->append(HolesQueueItem(HolesQueueNextFont, 0, 0)); - holesQueue->append(HolesQueueItem(HolesQueueRange, segment.start, - segment.end - segment.start)); + rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); + rangeData->holesQueue.append(HolesQueueItem(HolesQueueRange, segment.start, + segment.end - segment.start)); bool fontCycleQueued = false; Vector<UChar32> fallbackCharsHint; RefPtr<FontDataForRangeSet> currentFontDataForRangeSet; - while (holesQueue->size()) { - HolesQueueItem currentQueueItem = holesQueue->takeFirst(); + while (rangeData->holesQueue.size()) { + HolesQueueItem currentQueueItem = rangeData->holesQueue.takeFirst(); if (currentQueueItem.m_action == HolesQueueNextFont) { // For now, we're building a character list with which we probe @@ -590,16 +586,16 @@ // for the shaper and check whether any glyphs were found, or // define a new API on the shaper which will give us coverage // information? - if (!collectFallbackHintChars(holesQueue, fallbackCharsHint)) { + if (!collectFallbackHintChars(rangeData->holesQueue, fallbackCharsHint)) { // Give up shaping since we cannot retrieve a font fallback // font without a hintlist. - holesQueue->clear(); + rangeData->holesQueue.clear(); break; } currentFontDataForRangeSet = fallbackIterator->next(fallbackCharsHint); if (!currentFontDataForRangeSet->fontData()) { - DCHECK(!holesQueue->size()); + DCHECK(!rangeData->holesQueue.size()); break; } fontCycleQueued = false; @@ -614,8 +610,8 @@ fontDescription.variantCaps(), ICUScriptToHBScript(segment.script)); if (capsSupport.needsRunCaseSplitting()) { - splitUntilNextCaseChange(m_text, holesQueue, currentQueueItem, - smallCapsBehavior); + splitUntilNextCaseChange(m_text, &rangeData->holesQueue, + currentQueueItem, smallCapsBehavior); } } @@ -639,32 +635,37 @@ // Clamp the start and end offsets of the queue item to the offsets // representing the shaping window. - unsigned shapeStart = std::max(start, currentQueueItem.m_startIndex); - unsigned shapeEnd = std::min( - end, currentQueueItem.m_startIndex + currentQueueItem.m_numCharacters); + unsigned shapeStart = + std::max(rangeData->start, currentQueueItem.m_startIndex); + unsigned shapeEnd = + std::min(rangeData->end, currentQueueItem.m_startIndex + + currentQueueItem.m_numCharacters); CaseMappingHarfBuzzBufferFiller( - caseMapIntend, fontDescription.localeOrDefault(), buffer, m_text, - m_textLength, shapeStart, shapeEnd - shapeStart); + caseMapIntend, fontDescription.localeOrDefault(), rangeData->buffer, + m_text, m_textLength, shapeStart, shapeEnd - shapeStart); CapsFeatureSettingsScopedOverlay capsOverlay( - fontFeatures, capsSupport.fontFeatureToUse(smallCapsBehavior)); - hb_direction_t direction = TextDirectionToHBDirection( - textDirection, orientation, directionAndSmallCapsAdjustedFont); + &rangeData->fontFeatures, + capsSupport.fontFeatureToUse(smallCapsBehavior)); + hb_direction_t direction = + rangeData->harfBuzzDirection(directionAndSmallCapsAdjustedFont); - if (!shapeRange(buffer, fontFeatures->isEmpty() ? 0 : fontFeatures->data(), - fontFeatures->size(), directionAndSmallCapsAdjustedFont, + if (!shapeRange(rangeData->buffer, rangeData->fontFeatures.isEmpty() + ? 0 + : rangeData->fontFeatures.data(), + rangeData->fontFeatures.size(), + directionAndSmallCapsAdjustedFont, currentFontDataForRangeSet->ranges(), segment.script, direction, language)) DLOG(ERROR) << "Shaping range failed."; - if (!extractShapeResults(buffer, result, fontCycleQueued, holesQueue, - currentQueueItem, font, textDirection, + if (!extractShapeResults(rangeData, fontCycleQueued, currentQueueItem, directionAndSmallCapsAdjustedFont, segment.script, - !fallbackIterator->hasNext())) + !fallbackIterator->hasNext(), result)) DLOG(ERROR) << "Shape result extraction failed."; - hb_buffer_reset(buffer); + hb_buffer_reset(rangeData->buffer); } } @@ -679,23 +680,25 @@ RefPtr<ShapeResult> result = ShapeResult::create(font, length, direction); HarfBuzzScopedPtr<hb_buffer_t> buffer(hb_buffer_create(), hb_buffer_destroy); - FeaturesVector fontFeatures; - setFontFeatures(font, &fontFeatures); - FontOrientation orientation = font->getFontDescription().orientation(); - // Run segmentation needs to operate on the entire string, regardless of the // shaping window (defined by the start and end parameters). RunSegmenter::RunSegmenterRange segmentRange = RunSegmenter::nullRange(); - RunSegmenter runSegmenter(m_text, m_textLength, orientation); + RunSegmenter runSegmenter(m_text, m_textLength, + font->getFontDescription().orientation()); - Deque<HolesQueueItem> holesQueue; + RangeData rangeData; + rangeData.buffer = buffer.get(); + rangeData.font = font; + rangeData.textDirection = direction; + rangeData.start = start; + rangeData.end = end; + setFontFeatures(font, &rangeData.fontFeatures); + while (runSegmenter.consume(&segmentRange)) { - // Only shape segments overlapping with the range indicated by start and + // Only shape segments overlapping with the range indicated by start and // end. Not only those strictly within. - if (start < segmentRange.end && end > segmentRange.start) { - shapeSegment(result.get(), &holesQueue, buffer.get(), font, direction, - &fontFeatures, segmentRange, start, end); - } + if (start < segmentRange.end && end > segmentRange.start) + shapeSegment(&rangeData, segmentRange, result.get()); } return result.release(); }
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h index aa33142..7ef87d5 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
@@ -31,12 +31,8 @@ #ifndef HarfBuzzShaper_h #define HarfBuzzShaper_h -#include <hb.h> -#include <unicode/uscript.h> -#include <memory> #include "platform/fonts/shaping/RunSegmenter.h" #include "platform/fonts/shaping/ShapeResult.h" -#include "platform/text/TextRun.h" #include "wtf/Allocator.h" #include "wtf/Deque.h" #include "wtf/Vector.h" @@ -71,33 +67,25 @@ ~HarfBuzzShaper() {} private: - using FeaturesVector = Vector<hb_feature_t, 6>; + struct RangeData; // Shapes a single seqment, as identified by the RunSegmenterRange parameter, // one or more times taking font fallback into account. The start and end // parameters are for the entire text run, not the segment, and are used to // determine pre- and post-context for shaping. - void shapeSegment(ShapeResult*, - Deque<HolesQueueItem>*, - hb_buffer_t*, - const Font*, - TextDirection, - FeaturesVector*, + void shapeSegment(RangeData*, RunSegmenter::RunSegmenterRange, - unsigned start, - unsigned end) const; + ShapeResult*) const; - bool extractShapeResults(hb_buffer_t*, - ShapeResult*, + bool extractShapeResults(RangeData*, bool& fontCycleQueued, - Deque<HolesQueueItem>*, const HolesQueueItem&, - const Font*, - TextDirection, const SimpleFontData*, UScriptCode, - bool isLastResort) const; - bool collectFallbackHintChars(const Deque<HolesQueueItem>*, + bool isLastResort, + ShapeResult*) const; + + bool collectFallbackHintChars(const Deque<HolesQueueItem>&, Vector<UChar32>& hint) const; const UChar* m_text;
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp index 0add5ca..e080626 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -696,16 +696,6 @@ return true; } -// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This -// code needs to be refactored (http://crbug.com/629721). -void WebFrameWidgetImpl::applyReplacementRange(const WebRange& range) { - if (LocalFrame* frame = focusedLocalFrameInWidget()) { - // TODO(dglazkov): Going from LocalFrame to WebLocalFrameImpl seems - // silly. What is going on here? - WebLocalFrameImpl::fromFrame(frame)->selectRange(range); - } -} - void WebFrameWidgetImpl::setRemoteViewportIntersection( const WebRect& viewportIntersection) { // Remote viewports are only applicable to local frames with remote ancestors.
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h index 3168dca..36370066 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -112,7 +112,6 @@ void didNotAcquirePointerLock() override; void didLosePointerLock() override; bool getCompositionCharacterBounds(WebVector<WebRect>& bounds) override; - void applyReplacementRange(const WebRange&) override; void setRemoteViewportIntersection(const WebRect&) override; // WebFrameWidget implementation.
diff --git a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp index d31d2ec..e71d80d 100644 --- a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp +++ b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
@@ -46,6 +46,7 @@ bool WebInputMethodControllerImpl::setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int selectionStart, int selectionEnd) { if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) { @@ -58,6 +59,10 @@ if (!frame()->editor().canEdit() && !inputMethodController().hasComposition()) return false; + // Select the range to be replaced with the composition later. + if (!replacementRange.isNull()) + m_webLocalFrame->selectRange(replacementRange); + // We should verify the parent node of this IME composition node are // editable because JavaScript may delete a parent node of the composition // node. In this case, WebKit crashes while deleting texts from the parent @@ -118,6 +123,7 @@ bool WebInputMethodControllerImpl::commitText( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int relativeCaretPosition) { UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create( frame()->document(), UserGestureToken::NewGesture)); @@ -125,6 +131,10 @@ if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) return plugin->commitText(text, underlines, relativeCaretPosition); + // Select the range to be replaced with the composition later. + if (!replacementRange.isNull()) + m_webLocalFrame->selectRange(replacementRange); + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets // needs to be audited. See http://crbug.com/590369 for more details. frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
diff --git a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.h b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.h index 0769335..17ec1e83 100644 --- a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.h +++ b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.h
@@ -15,6 +15,7 @@ class LocalFrame; class WebLocalFrameImpl; class WebPlugin; +class WebRange; class WebString; class WebInputMethodControllerImpl : public WebInputMethodController { @@ -29,10 +30,12 @@ // WebInputMethodController overrides. bool setComposition(const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int selectionStart, int selectionEnd) override; bool commitText(const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int relativeCaretPosition) override; bool finishComposingText( ConfirmCompositionBehavior selectionBehavior) override;
diff --git a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp index f53d634..4cbb4df 100644 --- a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
@@ -254,6 +254,10 @@ RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled(enable); } +void WebRuntimeFeatures::enableTouchpadAndWheelScrollLatching(bool enable) { + RuntimeEnabledFeatures::setTouchpadAndWheelScrollLatchingEnabled(enable); +} + void WebRuntimeFeatures::enableWebGLDraftExtensions(bool enable) { RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable); }
diff --git a/third_party/WebKit/Source/web/WebViewFrameWidget.cpp b/third_party/WebKit/Source/web/WebViewFrameWidget.cpp index 2e935aa6..bafa1877 100644 --- a/third_party/WebKit/Source/web/WebViewFrameWidget.cpp +++ b/third_party/WebKit/Source/web/WebViewFrameWidget.cpp
@@ -174,10 +174,6 @@ return m_webView->getCompositionCharacterBounds(bounds); } -void WebViewFrameWidget::applyReplacementRange(const WebRange& range) { - m_webView->applyReplacementRange(range); -} - void WebViewFrameWidget::updateBrowserControlsState( WebBrowserControlsState constraints, WebBrowserControlsState current,
diff --git a/third_party/WebKit/Source/web/WebViewFrameWidget.h b/third_party/WebKit/Source/web/WebViewFrameWidget.h index 2d89f2e..4096c7b 100644 --- a/third_party/WebKit/Source/web/WebViewFrameWidget.h +++ b/third_party/WebKit/Source/web/WebViewFrameWidget.h
@@ -82,7 +82,6 @@ WebColor backgroundColor() const override; WebPagePopup* pagePopup() const override; bool getCompositionCharacterBounds(WebVector<WebRect>& bounds) override; - void applyReplacementRange(const WebRange&) override; void updateBrowserControlsState(WebBrowserControlsState constraints, WebBrowserControlsState current, bool animate) override;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index 25d572c..0da54ac 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -630,6 +630,8 @@ return false; if (m_flingSourceDevice == WebGestureDeviceTouchpad) { + bool enableTouchpadScrollLatching = + RuntimeEnabledFeatures::touchpadAndWheelScrollLatchingEnabled(); WebMouseWheelEvent syntheticWheel(WebInputEvent::MouseWheel, m_flingModifier, WTF::monotonicallyIncreasingTime()); @@ -649,15 +651,15 @@ WebInputEventResult::NotHandled) return true; - // TODO(dtapuska): Remove these GSB/GSE sequences when trackpad latching is - // implemented; see crbug.com/526463. - WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( - WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); - syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; - syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; - syntheticScrollBegin.data.scrollBegin.inertialPhase = - WebGestureEvent::MomentumPhase; - handleGestureEvent(syntheticScrollBegin); + if (!enableTouchpadScrollLatching) { + WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( + WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); + syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; + syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; + syntheticScrollBegin.data.scrollBegin.inertialPhase = + WebGestureEvent::MomentumPhase; + handleGestureEvent(syntheticScrollBegin); + } WebGestureEvent syntheticScrollUpdate = createGestureScrollEventFromFling( WebInputEvent::GestureScrollUpdate, WebGestureDeviceTouchpad); @@ -670,11 +672,14 @@ bool scrollUpdateHandled = handleGestureEvent(syntheticScrollUpdate) != WebInputEventResult::NotHandled; - WebGestureEvent syntheticScrollEnd = createGestureScrollEventFromFling( - WebInputEvent::GestureScrollEnd, WebGestureDeviceTouchpad); - syntheticScrollEnd.data.scrollEnd.inertialPhase = - WebGestureEvent::MomentumPhase; - handleGestureEvent(syntheticScrollEnd); + if (!enableTouchpadScrollLatching) { + WebGestureEvent syntheticScrollEnd = createGestureScrollEventFromFling( + WebInputEvent::GestureScrollEnd, WebGestureDeviceTouchpad); + syntheticScrollEnd.data.scrollEnd.inertialPhase = + WebGestureEvent::MomentumPhase; + handleGestureEvent(syntheticScrollEnd); + } + return scrollUpdateHandled; } else { WebGestureEvent syntheticGestureEvent = createGestureScrollEventFromFling( @@ -2562,13 +2567,6 @@ return true; } -// TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as -// well. This code needs to be refactored (http://crbug.com/629721). -void WebViewImpl::applyReplacementRange(const WebRange& range) { - if (WebLocalFrame* frame = focusedFrame()) - frame->selectRange(range); -} - // WebView -------------------------------------------------------------------- WebSettingsImpl* WebViewImpl::settingsImpl() {
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 8870df1..9f26f8a 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -529,7 +529,6 @@ // TODO(lfg): Remove once WebViewFrameWidget is deleted. void scheduleAnimationForWidget(); bool getCompositionCharacterBounds(WebVector<WebRect>&) override; - void applyReplacementRange(const WebRange&) override; void updateBaseBackgroundColor();
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index add6983..6c6dd72 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -921,7 +921,8 @@ std::string compositionText("hello"); WebVector<WebCompositionUnderline> emptyUnderlines; activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 5, 5); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 5, 5); // Do arbitrary change to make layout dirty. Document& document = *webView->mainFrameImpl()->frame()->document(); @@ -950,7 +951,8 @@ ->getActiveWebInputMethodController(); WebVector<WebCompositionUnderline> emptyUnderlines; activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 3, 3); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); @@ -968,7 +970,8 @@ EXPECT_EQ(-1, info.compositionEnd); activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 3, 3); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helhellolo", std::string(info.value.utf8().data())); EXPECT_EQ(6, info.selectionStart); @@ -997,8 +1000,10 @@ WebVector<WebCompositionUnderline> emptyUnderlines; - activeInputMethodController->commitText("hello", emptyUnderlines, 0); - activeInputMethodController->commitText("world", emptyUnderlines, -5); + activeInputMethodController->commitText("hello", emptyUnderlines, WebRange(), + 0); + activeInputMethodController->commitText("world", emptyUnderlines, WebRange(), + -5); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); @@ -1012,7 +1017,8 @@ // Caret is on the left of composing text. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, 0); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 0, 0); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(5, info.selectionStart); @@ -1022,7 +1028,8 @@ // Caret is on the right of composing text. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 3, 3); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(8, info.selectionStart); @@ -1032,7 +1039,8 @@ // Caret is between composing text and left boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -2, -2); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + -2, -2); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(3, info.selectionStart); @@ -1042,7 +1050,8 @@ // Caret is between composing text and right boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 5, 5); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 5, 5); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(10, info.selectionStart); @@ -1052,7 +1061,8 @@ // Caret is on the left boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -5, -5); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + -5, -5); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1062,7 +1072,8 @@ // Caret is on the right boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 8, 8); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 8, 8); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(13, info.selectionStart); @@ -1072,8 +1083,8 @@ // Caret exceeds the left boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -100, - -100); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + -100, -100); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1083,7 +1094,8 @@ // Caret exceeds the right boundary. activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 100, 100); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 100, 100); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); EXPECT_EQ(13, info.selectionStart); @@ -1104,7 +1116,8 @@ WebVector<WebCompositionUnderline> emptyUnderlines; - activeInputMethodController->commitText("hello", emptyUnderlines, 0); + activeInputMethodController->commitText("hello", emptyUnderlines, WebRange(), + 0); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); @@ -1113,8 +1126,8 @@ EXPECT_EQ(-1, info.compositionStart); EXPECT_EQ(-1, info.compositionEnd); - activeInputMethodController->setComposition(WebString::fromUTF8(""), - emptyUnderlines, 0, 0); + activeInputMethodController->setComposition( + WebString::fromUTF8(""), emptyUnderlines, WebRange(), 0, 0); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); EXPECT_EQ(5, info.selectionStart); @@ -1122,8 +1135,8 @@ EXPECT_EQ(-1, info.compositionStart); EXPECT_EQ(-1, info.compositionEnd); - activeInputMethodController->setComposition(WebString::fromUTF8(""), - emptyUnderlines, -2, -2); + activeInputMethodController->setComposition( + WebString::fromUTF8(""), emptyUnderlines, WebRange(), -2, -2); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); EXPECT_EQ(3, info.selectionStart); @@ -1145,7 +1158,8 @@ WebVector<WebCompositionUnderline> emptyUnderlines; // Caret is on the left of composing text. - activeInputMethodController->commitText("ab", emptyUnderlines, -2); + activeInputMethodController->commitText("ab", emptyUnderlines, WebRange(), + -2); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("ab", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1154,7 +1168,7 @@ EXPECT_EQ(-1, info.compositionEnd); // Caret is on the right of composing text. - activeInputMethodController->commitText("c", emptyUnderlines, 1); + activeInputMethodController->commitText("c", emptyUnderlines, WebRange(), 1); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("cab", std::string(info.value.utf8().data())); EXPECT_EQ(2, info.selectionStart); @@ -1163,7 +1177,8 @@ EXPECT_EQ(-1, info.compositionEnd); // Caret is on the left boundary. - activeInputMethodController->commitText("def", emptyUnderlines, -5); + activeInputMethodController->commitText("def", emptyUnderlines, WebRange(), + -5); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("cadefb", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1172,7 +1187,7 @@ EXPECT_EQ(-1, info.compositionEnd); // Caret is on the right boundary. - activeInputMethodController->commitText("g", emptyUnderlines, 6); + activeInputMethodController->commitText("g", emptyUnderlines, WebRange(), 6); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("gcadefb", std::string(info.value.utf8().data())); EXPECT_EQ(7, info.selectionStart); @@ -1181,7 +1196,8 @@ EXPECT_EQ(-1, info.compositionEnd); // Caret exceeds the left boundary. - activeInputMethodController->commitText("hi", emptyUnderlines, -100); + activeInputMethodController->commitText("hi", emptyUnderlines, WebRange(), + -100); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("gcadefbhi", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1190,7 +1206,8 @@ EXPECT_EQ(-1, info.compositionEnd); // Caret exceeds the right boundary. - activeInputMethodController->commitText("jk", emptyUnderlines, 100); + activeInputMethodController->commitText("jk", emptyUnderlines, WebRange(), + 100); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("jkgcadefbhi", std::string(info.value.utf8().data())); EXPECT_EQ(11, info.selectionStart); @@ -1210,8 +1227,8 @@ ->getActiveWebInputMethodController(); WebVector<WebCompositionUnderline> emptyUnderlines; - activeInputMethodController->setComposition(WebString::fromUTF8("abc"), - emptyUnderlines, 0, 0); + activeInputMethodController->setComposition( + WebString::fromUTF8("abc"), emptyUnderlines, WebRange(), 0, 0); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("abc", std::string(info.value.utf8().data())); EXPECT_EQ(0, info.selectionStart); @@ -1221,7 +1238,8 @@ // Deletes ongoing composition, inserts the specified text and moves the // caret. - activeInputMethodController->commitText("hello", emptyUnderlines, -2); + activeInputMethodController->commitText("hello", emptyUnderlines, WebRange(), + -2); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); EXPECT_EQ(3, info.selectionStart); @@ -1229,8 +1247,8 @@ EXPECT_EQ(-1, info.compositionStart); EXPECT_EQ(-1, info.compositionEnd); - activeInputMethodController->setComposition(WebString::fromUTF8("abc"), - emptyUnderlines, 0, 0); + activeInputMethodController->setComposition( + WebString::fromUTF8("abc"), emptyUnderlines, WebRange(), 0, 0); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helabclo", std::string(info.value.utf8().data())); EXPECT_EQ(3, info.selectionStart); @@ -1239,7 +1257,7 @@ EXPECT_EQ(6, info.compositionEnd); // Deletes ongoing composition and moves the caret. - activeInputMethodController->commitText("", emptyUnderlines, 2); + activeInputMethodController->commitText("", emptyUnderlines, WebRange(), 2); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello", std::string(info.value.utf8().data())); EXPECT_EQ(5, info.selectionStart); @@ -1248,7 +1266,8 @@ EXPECT_EQ(-1, info.compositionEnd); // Inserts the specified text and moves the caret. - activeInputMethodController->commitText("world", emptyUnderlines, -5); + activeInputMethodController->commitText("world", emptyUnderlines, WebRange(), + -5); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); EXPECT_EQ(5, info.selectionStart); @@ -1257,7 +1276,7 @@ EXPECT_EQ(-1, info.compositionEnd); // Only moves the caret. - activeInputMethodController->commitText("", emptyUnderlines, 5); + activeInputMethodController->commitText("", emptyUnderlines, WebRange(), 5); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); EXPECT_EQ(10, info.selectionStart); @@ -1332,7 +1351,8 @@ std::string compositionText("\n"); activeInputMethodController->commitText( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 0); info = activeInputMethodController->textInputInfo(); EXPECT_EQ(5, info.selectionStart); EXPECT_EQ(5, info.selectionEnd); @@ -1444,7 +1464,7 @@ std::string newLineText("\n"); WebVector<WebCompositionUnderline> emptyUnderlines; activeInputMethodController->commitText( - WebString::fromUTF8(newLineText.c_str()), emptyUnderlines, 0); + WebString::fromUTF8(newLineText.c_str()), emptyUnderlines, WebRange(), 0); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.utf8().data())); @@ -1461,7 +1481,8 @@ std::string compositionText("yolo"); activeInputMethodController->commitText( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 0); info = activeInputMethodController->textInputInfo(); EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.utf8().data())); @@ -1500,10 +1521,11 @@ ->frameWidget() ->getActiveWebInputMethodController(); activeInputMethodController->commitText( - WebString::fromUTF8(compositionTextFirst.c_str()), emptyUnderlines, 0); + WebString::fromUTF8(compositionTextFirst.c_str()), emptyUnderlines, + WebRange(), 0); activeInputMethodController->setComposition( - WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, - 5); + WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, + WebRange(), 5, 5); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ("hello world", std::string(info.value.utf8().data())); @@ -2362,7 +2384,7 @@ WebVector<WebCompositionUnderline> emptyUnderlines; frame->setEditableSelectionOffsets(8, 8); EXPECT_TRUE(activeInputMethodController->setComposition( - "12345", emptyUnderlines, 8, 13)); + "12345", emptyUnderlines, WebRange(), 8, 13)); EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition()); EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); EXPECT_FALSE(frame->frame()->selection().isHandleVisible()); @@ -2733,7 +2755,7 @@ WebInputMethodController* activeInputMethodController = frame->frameWidget()->getActiveWebInputMethodController(); EXPECT_TRUE(activeInputMethodController->setComposition( - "fghij", emptyUnderlines, 0, 5)); + "fghij", emptyUnderlines, WebRange(), 0, 5)); frame->setEditableSelectionOffsets(11, 11); verifySelectionAndComposition(webView, 11, 11, 6, 11, "initial case"); @@ -2748,7 +2770,7 @@ frame->setEditableSelectionOffsets(6, 6); EXPECT_TRUE(activeInputMethodController->setComposition( - "fghi", emptyUnderlines, 0, 4)); + "fghi", emptyUnderlines, WebRange(), 0, 4)); frame->setEditableSelectionOffsets(10, 10); verifySelectionAndComposition(webView, 10, 10, 6, 10, "after pressing Backspace"); @@ -2782,8 +2804,8 @@ WebVector<WebCompositionUnderline> emptyUnderlines; activeInputMethodController->setComposition( - WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, - compositionText.length()); + WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, WebRange(), + 0, compositionText.length()); WebTextInputInfo info = activeInputMethodController->textInputInfo(); EXPECT_EQ(0, info.selectionStart); @@ -3563,7 +3585,7 @@ EXPECT_TRUE( frame->frameWidget()->getActiveWebInputMethodController()->setComposition( WebString::fromUTF8(std::string("hello").c_str()), - WebVector<WebCompositionUnderline>(), 3, 3)); + WebVector<WebCompositionUnderline>(), WebRange(), 3, 3)); EXPECT_EQ(1, client.textChangesFromUserGesture()); EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); EXPECT_TRUE(frame->hasMarkedText()); @@ -3975,7 +3997,7 @@ EXPECT_TRUE( frame->frameWidget()->getActiveWebInputMethodController()->commitText( WebString::fromUTF8(std::string("hello").c_str()), emptyUnderlines, - 0)); + WebRange(), 0)); EXPECT_EQ(1, client.textChangesFromUserGesture()); EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); frame->setAutofillClient(0);
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer_unittest.py index 1104f0d3..88711dc 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer_unittest.py
@@ -59,7 +59,7 @@ self.assertEqual(host.filesystem.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'), 'result A') - def test_move_baselines_skip_scm_commands(self): + def test_move_baselines_skip_git_commands(self): host = MockHost() host.filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]') host.filesystem.write_binary_file(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_unittest.py index cfaf1e7..b2a54f11 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_unittest.py
@@ -25,13 +25,13 @@ self._write_text_file('foo_file', 'foo') self._run(['git', 'add', 'foo_file']) self._run(['git', 'commit', '-am', 'dummy commit']) - self.untracking_scm = Git(cwd=self.untracking_checkout_path, filesystem=self.filesystem, executive=self.executive) + self.untracking_git = Git(cwd=self.untracking_checkout_path, filesystem=self.filesystem, executive=self.executive) # Then set up a second git repo that tracks the first one. self.tracking_git_checkout_path = self._mkdtemp(suffix='-git_unittest_tracking') self._run(['git', 'clone', '--quiet', self.untracking_checkout_path, self.tracking_git_checkout_path]) self._chdir(self.tracking_git_checkout_path) - self.tracking_scm = Git(cwd=self.tracking_git_checkout_path, filesystem=self.filesystem, executive=self.executive) + self.tracking_git = Git(cwd=self.tracking_git_checkout_path, filesystem=self.filesystem, executive=self.executive) def tearDown(self): self._chdir(self.original_cwd) @@ -76,7 +76,7 @@ def test_add_list(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._mkdir('added_dir') self._write_text_file('added_dir/added_file', 'new stuff') print self._run(['ls', 'added_dir']) @@ -87,7 +87,7 @@ def test_delete_recursively(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._mkdir('added_dir') self._write_text_file('added_dir/added_file', 'new stuff') git.add_list(['added_dir/added_file']) @@ -97,7 +97,7 @@ def test_delete_recursively_or_not(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._mkdir('added_dir') self._write_text_file('added_dir/added_file', 'new stuff') self._write_text_file('added_dir/another_added_file', 'more new stuff') @@ -109,7 +109,7 @@ def test_exists(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._chdir(git.checkout_root) self.assertFalse(git.exists('foo.txt')) self._write_text_file('foo.txt', 'some stuff') @@ -123,7 +123,7 @@ def test_move(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._write_text_file('added_file', 'new stuff') git.add_list(['added_file']) git.move('added_file', 'moved_file') @@ -131,7 +131,7 @@ def test_move_recursive(self): self._chdir(self.untracking_checkout_path) - git = self.untracking_scm + git = self.untracking_git self._mkdir('added_dir') self._write_text_file('added_dir/added_file', 'new stuff') self._write_text_file('added_dir/another_added_file', 'more new stuff') @@ -142,13 +142,13 @@ def test_remote_branch_ref(self): # This tests a protected method. pylint: disable=protected-access - self.assertEqual(self.tracking_scm._remote_branch_ref(), 'refs/remotes/origin/master') + self.assertEqual(self.tracking_git._remote_branch_ref(), 'refs/remotes/origin/master') self._chdir(self.untracking_checkout_path) - self.assertRaises(ScriptError, self.untracking_scm._remote_branch_ref) + self.assertRaises(ScriptError, self.untracking_git._remote_branch_ref) def test_create_patch(self): self._chdir(self.tracking_git_checkout_path) - git = self.tracking_scm + git = self.tracking_git self._write_text_file('test_file_commit1', 'contents') self._run(['git', 'add', 'test_file_commit1']) git.commit_locally_with_message('message') @@ -158,7 +158,7 @@ def test_patches_have_filenames_with_prefixes(self): self._chdir(self.tracking_git_checkout_path) - git = self.tracking_scm + git = self.tracking_git self._write_text_file('test_file_commit1', 'contents') self._run(['git', 'add', 'test_file_commit1']) git.commit_locally_with_message('message') @@ -171,7 +171,7 @@ def test_rename_files(self): self._chdir(self.tracking_git_checkout_path) - git = self.tracking_scm + git = self.tracking_git git.move('foo_file', 'bar_file') git.commit_locally_with_message('message') @@ -191,26 +191,26 @@ Cr-Commit-Position: refs/heads/master@{#1234567} """ self._chdir(self.tracking_git_checkout_path) - git = self.tracking_scm + git = self.tracking_git self.assertEqual(git._commit_position_from_git_log(git_log), 1234567) def test_timestamp_of_revision(self): # This tests a protected method. pylint: disable=protected-access self._chdir(self.tracking_git_checkout_path) - git = self.tracking_scm + git = self.tracking_git position_regex = git._commit_position_regex_for_timestamp() git.most_recent_log_matching(position_regex, git.checkout_root) class GitTestWithMock(unittest.TestCase): - def make_scm(self): + def make_git(self): git = Git(cwd='.', executive=MockExecutive(), filesystem=MockFileSystem()) git.read_git_config = lambda *args, **kw: 'MOCKKEY:MOCKVALUE' return git def _assert_timestamp_of_revision(self, canned_git_output, expected): - git = self.make_scm() + git = self.make_git() git.find_checkout_root = lambda path: '' # Modifying protected method. pylint: disable=protected-access git._run_git = lambda args: canned_git_output @@ -226,7 +226,7 @@ self._assert_timestamp_of_revision('Date: 2013-02-08 01:55:21 -0800', '2013-02-08T09:55:21Z') def test_unstaged_files(self): - scm = self.make_scm() + git = self.make_git() status_lines = [ ' M d/modified.txt', ' D d/deleted.txt', @@ -236,9 +236,9 @@ 'A d/added-staged.txt', ] # pylint: disable=protected-access - scm._run_git = lambda args: '\x00'.join(status_lines) + '\x00' + git._run_git = lambda args: '\x00'.join(status_lines) + '\x00' self.assertEqual( - scm.unstaged_changes(), + git.unstaged_changes(), { 'd/modified.txt': 'M', 'd/deleted.txt': 'D',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py index 176237f..5c4e51e 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py
@@ -47,13 +47,13 @@ SystemHost.__init__(self) self.web = web.Web() - self._scm = None + self._git = None # Everything below this line is WebKit-specific and belongs on a higher-level object. self.buildbot = BuildBot() # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world. - # In order to instantiate a port correctly, we have to pass it at least an executive, user, scm, and filesystem + # In order to instantiate a port correctly, we have to pass it at least an executive, user, git, and filesystem # so for now we just pass along the whole Host object. # FIXME: PortFactory doesn't belong on this Host object if Port is going to have a Host (circular dependency). self.port_factory = PortFactory(self) @@ -76,9 +76,9 @@ self.environ['LC_MESSAGES'] = 'en_US.UTF-8' self.environ['LC_ALL'] = '' - def scm(self, path=None): + def git(self, path=None): if path: return Git(cwd=path, executive=self.executive, filesystem=self.filesystem) - if not self._scm: - self._scm = Git(filesystem=self.filesystem, executive=self.executive) - return self._scm + if not self._git: + self._git = Git(filesystem=self.filesystem, executive=self.executive) + return self._git
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py index 1246a1d..dae0eb5f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
@@ -43,7 +43,7 @@ def __init__(self, log_executive=False, web=None, - scm=None, + git=None, os_name=None, os_version=None, time_return_val=123): @@ -55,7 +55,7 @@ add_unit_tests_to_mock_filesystem(self.filesystem) self.web = web or MockWeb() - self._scm = scm + self._git = git self.buildbot = MockBuildBot() @@ -65,12 +65,12 @@ self.builders = BuilderList(BUILDERS) - def scm(self, path=None): + def git(self, path=None): if path: return MockGit(cwd=path, filesystem=self.filesystem, executive=self.executive) - if not self._scm: - self._scm = MockGit(filesystem=self.filesystem, executive=self.executive) + if not self._git: + self._git = MockGit(filesystem=self.filesystem, executive=self.executive) # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). # Making the checkout_root exist in the mock filesystem makes that chdir not raise. - self.filesystem.maybe_make_directory(self._scm.checkout_root) - return self._scm + self.filesystem.maybe_make_directory(self._git.checkout_root) + return self._git
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results.py index a679b915..936eb3ef 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results.py
@@ -114,12 +114,12 @@ return self._results["builder_name"] @memoized - def chromium_revision(self, scm=None): + def chromium_revision(self, git=None): """Returns the revision of the results in commit position number format.""" revision = self._chromium_revision or self._results["chromium_revision"] if not revision.isdigit(): - assert scm, "scm is required if the original revision is a git hash." - revision = scm.commit_position_from_git_commit(revision) + assert git, "git is required if the original revision is a git hash." + revision = git.commit_position_from_git_commit(revision) return int(revision) def result_for_test(self, test):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py index 63a84c7..461d27d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
@@ -79,7 +79,7 @@ def exists(self, path): return os.path.exists(path) - def files_under(self, path, dirs_to_skip=[], file_filter=None): + def files_under(self, path, dirs_to_skip=None, file_filter=None): """Return the list of all files under the given path in topdown order. Args: @@ -90,6 +90,8 @@ each file found. The file is included in the result if the callback returns True. """ + dirs_to_skip = dirs_to_skip or [] + def filter_all(fs, dirpath, basename): return True
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py index 40573e64..74e0bb6d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py
@@ -68,7 +68,7 @@ self._host = host self._executable_path = executable_path self._output_dir = output_dir - self._identifier = "test" + self._identifier = identifier or 'test' self._host.filesystem.maybe_make_directory(self._output_dir) def adjusted_environment(self, env): @@ -86,10 +86,21 @@ def __init__(self, host, executable_path, output_dir, output_suffix, identifier=None): super(SingleFileOutputProfiler, self).__init__(host, executable_path, output_dir, identifier) # FIXME: Currently all reports are kept as test.*, until we fix that, search up to 1000 names before giving up. - self._output_path = self._host.workspace.find_unused_filename( - self._output_dir, self._identifier, output_suffix, search_limit=1000) + self._output_path = self._find_unused_filename(self._output_dir, self._identifier, output_suffix) assert self._output_path + def _find_unused_filename(self, directory, name, extension, search_limit=1000): + for count in range(search_limit): + if count: + target_name = "%s-%s.%s" % (name, count, extension) + else: + target_name = "%s.%s" % (name, extension) + target_path = self._host.filesystem.join(directory, target_name) + if not self._host.filesystem.exists(target_path): + return target_path + # If we can't find an unused name in search_limit tries, just give up. + return None + class GooglePProf(SingleFileOutputProfiler): name = 'pprof'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host.py index a23e5b6..45437ba97 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host.py
@@ -31,18 +31,20 @@ import sys import time -from webkitpy.common.system import executive, filesystem, platform_info, user, workspace +from webkitpy.common.system.executive import Executive +from webkitpy.common.system.filesystem import FileSystem +from webkitpy.common.system.platform_info import PlatformInfo +from webkitpy.common.system.user import User class SystemHost(object): def __init__(self): self.executable = sys.executable - self.executive = executive.Executive() - self.filesystem = filesystem.FileSystem() - self.user = user.User() - self.platform = platform_info.PlatformInfo(sys, platform, self.filesystem, self.executive) - self.workspace = workspace.Workspace(self.filesystem, self.executive) + self.executive = Executive() + self.filesystem = FileSystem() + self.user = User() + self.platform = PlatformInfo(sys, platform, self.filesystem, self.executive) self.stdin = sys.stdin self.stdout = sys.stdout self.stderr = sys.stderr
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py index 0696eaf9..acb61ee 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py
@@ -32,7 +32,6 @@ from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.platform_info_mock import MockPlatformInfo from webkitpy.common.system.user_mock import MockUser -from webkitpy.common.system.workspace_mock import MockWorkspace class MockSystemHost(object): @@ -54,9 +53,6 @@ if os_version: self.platform.os_version = os_version - # FIXME: Should this take pointers to the filesystem and the executive? - self.workspace = MockWorkspace() - self.stdin = StringIO() self.stdout = StringIO() self.stderr = StringIO()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py deleted file mode 100644 index ffb50a0..0000000 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py +++ /dev/null
@@ -1,74 +0,0 @@ -# Copyright (c) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# A home for file logic which should sit above FileSystem, but -# below more complicated objects. - -import logging -import zipfile - -from webkitpy.common.system.executive import ScriptError - - -_log = logging.getLogger(__name__) - - -class Workspace(object): - - def __init__(self, filesystem, executive): - self._filesystem = filesystem - self._executive = executive # FIXME: Remove if create_zip is moved to python. - - def find_unused_filename(self, directory, name, extension, search_limit=100): - for count in range(search_limit): - if count: - target_name = "%s-%s.%s" % (name, count, extension) - else: - target_name = "%s.%s" % (name, extension) - target_path = self._filesystem.join(directory, target_name) - if not self._filesystem.exists(target_path): - return target_path - # If we can't find an unused name in search_limit tries, just give up. - return None - - def create_zip(self, zip_path, source_path, zip_class=zipfile.ZipFile): - # It's possible to create zips with Python: - # zip_file = ZipFile(zip_path, 'w') - # for root, dirs, files in os.walk(source_path): - # for path in files: - # absolute_path = os.path.join(root, path) - # zip_file.write(os.path.relpath(path, source_path)) - # However, getting the paths, encoding and compression correct could be non-trivial. - # So, for now we depend on the environment having "zip" installed (likely fails on Win32) - try: - self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=source_path) - except ScriptError as error: - _log.error("Workspace.create_zip failed in %s:\n%s", source_path, error.message_with_output()) - return None - - return zip_class(zip_path)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_mock.py deleted file mode 100644 index 0abbdf7..0000000 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_mock.py +++ /dev/null
@@ -1,38 +0,0 @@ -# Copyright (C) 2011 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -class MockWorkspace(object): - - def find_unused_filename(self, directory, name, extension, search_limit=10): - return "%s/%s.%s" % (directory, name, extension) - - def create_zip(self, zip_path, source_path): - self.zip_path = zip_path - self.source_path = source_path - return object() # Something that is not None
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_unittest.py deleted file mode 100644 index 517d12b..0000000 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace_unittest.py +++ /dev/null
@@ -1,78 +0,0 @@ -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - -from webkitpy.common.system.filesystem_mock import MockFileSystem -from webkitpy.common.system.output_capture import OutputCapture -from webkitpy.common.system.workspace import Workspace -from webkitpy.common.system.executive_mock import MockExecutive - - -class WorkspaceTest(unittest.TestCase): - - def test_find_unused_filename(self): - filesystem = MockFileSystem({ - "dir/foo.jpg": "", - "dir/foo-1.jpg": "", - "dir/foo-2.jpg": "", - }) - workspace = Workspace(filesystem, None) - self.assertEqual(workspace.find_unused_filename("bar", "bar", "bar"), "bar/bar.bar") - self.assertIsNone(workspace.find_unused_filename("dir", "foo", "jpg", search_limit=1)) - self.assertIsNone(workspace.find_unused_filename("dir", "foo", "jpg", search_limit=2)) - self.assertEqual(workspace.find_unused_filename("dir", "foo", "jpg"), "dir/foo-3.jpg") - - def test_create_zip(self): - workspace = Workspace(None, MockExecutive(should_log=True)) - expected_logs = "MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path\n" - - class MockZipFile(object): - - def __init__(self, path): - self.filename = path - archive = OutputCapture().assert_outputs(self, workspace.create_zip, [ - "/zip/path", "/source/path", MockZipFile], expected_logs=expected_logs) - self.assertEqual(archive.filename, "/zip/path") - - def test_create_zip_exception(self): - workspace = Workspace(None, MockExecutive(should_log=True, should_throw=True)) - expected_logs = """MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path -Workspace.create_zip failed in /source/path: -MOCK ScriptError - -output: MOCK output of child process -""" - - class MockZipFile(object): - - def __init__(self, path): - self.filename = path - archive = OutputCapture().assert_outputs(self, workspace.create_zip, [ - "/zip/path", "/source/path", MockZipFile], expected_logs=expected_logs) - self.assertIsNone(archive)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py index 18fce80..7ee11e7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
@@ -88,7 +88,7 @@ Raises an AssertionError if the top dir can't be determined. """ # Note: This code somewhat duplicates the code in - # scm.find_checkout_root(). However, that code only works if the top + # git.find_checkout_root(). However, that code only works if the top # of the SCM repository also matches the top of the WebKit tree. Some SVN users # (the chromium test bots, for example), might only check out subdirectories like # Tools/Scripts. This code will also work if there is no SCM system at all.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py index b793814..346f56d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
@@ -206,7 +206,7 @@ def _handle_finished_test_list(self, worker_name, list_name): pass - def _handle_finished_test(self, worker_name, result, log_messages=[]): + def _handle_finished_test(self, worker_name, result, log_messages=None): # pylint: disable=unused-argument self._update_summary_with_result(self._current_run_results, result) def _handle_device_failed(self, worker_name, list_name, remaining_tests):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py index d44c592..0c8ecae 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
@@ -341,9 +341,9 @@ results['chromium_revision'] = '' if port_obj.get_option('builder_name'): path = port_obj.repository_path() - scm = port_obj.host.scm(path=path) - if scm: - results['chromium_revision'] = str(scm.commit_position(path)) + git = port_obj.host.git(path=path) + if git: + results['chromium_revision'] = str(git.commit_position(path)) else: _log.warning('Failed to determine chromium commit position for %s, ' 'leaving "chromium_revision" key blank in full_results.json.',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py index 5cf8ca4b..1a1afae 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py
@@ -52,7 +52,7 @@ return test_results.TestResult(test_name, failures=failures, test_run_time=run_time) -def run_results(port, extra_skipped_tests=[]): +def run_results(port, extra_skipped_tests=None): tests = [ 'passes/text.html', 'failures/expected/timeout.html', @@ -69,7 +69,7 @@ return test_run_results.TestRunResults(expectations, len(tests)) -def summarized_results(port, expected, passing, flaky, only_include_failing=False, extra_skipped_tests=[], fail_on_retry=False): +def summarized_results(port, expected, passing, flaky, only_include_failing=False, extra_skipped_tests=None): test_is_slow = False all_retry_results = [] @@ -402,8 +402,7 @@ self.assertEquals(summary['num_regressions'], 0) def test_summarized_results_regression(self): - summary = summarized_results(self.port, expected=False, passing=False, - flaky=False, fail_on_retry=True) + summary = summarized_results(self.port, expected=False, passing=False, flaky=False) self.assertTrue(summary['tests']['failures']['expected']['timeout.html']['is_unexpected']) self.assertEquals(summary['tests']['failures']['expected']['timeout.html']['expected'], 'TIMEOUT')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py index fd8fb7c..f562d2b4 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
@@ -56,15 +56,12 @@ def test_pretty_patch_os_error(self): port = self.make_port(executive=MockExecutive(exception=OSError)) - oc = OutputCapture() - oc.capture_output() self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) # This tests repeated calls to make sure we cache the result. self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html) - oc.restore_output() def test_pretty_patch_script_error(self): # FIXME: This is some ugly white-box test hacking ...
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py index 74e1deb..14ced71 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -36,7 +36,7 @@ from webkitpy.common.host import Host from webkitpy.common.host_mock import MockHost -from webkitpy.common.system import output_capture, path +from webkitpy.common.system.path import abspath_to_uri from webkitpy.common.system.system_host import SystemHost from webkitpy.layout_tests import run_webkit_tests @@ -97,15 +97,10 @@ def run_and_capture(port_obj, options, parsed_args, shared_port=True): if shared_port: port_obj.host.port_factory.get = lambda *args, **kwargs: port_obj - oc = output_capture.OutputCapture() - try: - oc.capture_output() - logging_stream = StringIO.StringIO() - stdout = StringIO.StringIO() - run_details = run_webkit_tests.run(port_obj, options, parsed_args, - logging_stream=logging_stream, stdout=stdout) - finally: - oc.restore_output() + logging_stream = StringIO.StringIO() + stdout = StringIO.StringIO() + run_details = run_webkit_tests.run(port_obj, options, parsed_args, + logging_stream=logging_stream, stdout=stdout) return (run_details, logging_stream) @@ -135,15 +130,10 @@ host = host or MockHost() port_obj = port_obj or host.port_factory.get(port_name=options.platform, options=options) - oc = output_capture.OutputCapture() - oc.capture_output() logging_stream = StringIO.StringIO() stdout = StringIO.StringIO() - try: - run_details = run_webkit_tests.run(port_obj, options, parsed_args, - logging_stream=logging_stream, stdout=stdout) - finally: - oc.restore_output() + run_details = run_webkit_tests.run(port_obj, options, parsed_args, + logging_stream=logging_stream, stdout=stdout) all_results = [] if run_details.initial_results: @@ -225,7 +215,7 @@ full_results_text = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json') self.assertEqual(json.loads(full_results_text), details.summarized_full_results) - self.assertEqual(host.user.opened_urls, [path.abspath_to_uri(MockHost().platform, '/tmp/layout-test-results/results.html')]) + self.assertEqual(host.user.opened_urls, [abspath_to_uri(MockHost().platform, '/tmp/layout-test-results/results.html')]) def test_batch_size(self): batch_tests_run = get_test_batches(['--batch-size', '2']) @@ -1159,9 +1149,9 @@ class PortTest(unittest.TestCase): - def assert_mock_port_works(self, port_name, args=[]): - self.assertTrue(passing_run(args + ['--platform', 'mock-' + port_name, - 'fast/harness/results.html'], tests_included=True, host=Host())) + def assert_mock_port_works(self, port_name): + self.assertTrue(passing_run(['--platform', 'mock-' + port_name, + 'fast/harness/results.html'], tests_included=True, host=Host())) def disabled_test_mac_lion(self): self.assert_mock_port_works('mac-lion')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py index 90294bb..757f632 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py
@@ -88,8 +88,7 @@ def test_print_unexpected_results_fail_on_retry_also(self): port = MockHost().port_factory.get('test') printer, out = self.get_printer() - summary = test_run_results_unittest.summarized_results( - port, expected=False, passing=False, flaky=False, fail_on_retry=True) + summary = test_run_results_unittest.summarized_results(port, expected=False, passing=False, flaky=False) printer.print_unexpected_results(summary) output = out.getvalue() self.assertIn(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py index 6c6ffd2..4262cfe8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
@@ -261,7 +261,7 @@ def _generate_results_dict(self, timestamp, description, platform, builder_name, build_number): revisions = {} path = self._port.repository_path() - git = self._host.scm(path=path) + git = self._host.git(path=path) revision = str(git.commit_position(path)) revisions['chromium'] = {'revision': revision, 'timestamp': git.timestamp_of_revision(path, revision)}
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py index cd3a649..96b503a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py
@@ -47,6 +47,7 @@ class MainTest(unittest.TestCase): def create_runner(self, args=[]): + args = args or [] options, _ = PerfTestsRunner._parse_args(args) test_port = TestPort(host=MockHost(), options=options) runner = PerfTestsRunner(args=args, port=test_port) @@ -392,7 +393,8 @@ json_content = runner._host.filesystem.read_text_file(runner._output_json_path()) return json.loads(re.sub(r'("stdev":\s*\d+\.\d{5})\d+', r'\1', json_content)) - def create_runner(self, args=[], driver_class=TestDriver): + def create_runner(self, args=None, driver_class=TestDriver): + args = args or [] options, _ = PerfTestsRunner._parse_args(args) test_port = TestPort(host=MockHost(), options=options) test_port.create_driver = lambda worker_number=None, no_timeout=False: driver_class() @@ -564,7 +566,8 @@ "tests": self._event_target_wrapper_and_inspector_results, "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) - def create_runner_and_setup_results_template(self, args=[]): + def create_runner_and_setup_results_template(self, args=None): + args = args or [] runner, port = self.create_runner(args) filesystem = port.host.filesystem filesystem.write_text_file(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py index 29144e1..51ce750 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -2079,7 +2079,7 @@ 'Consider converting bool bitfields to unsigned. [runtime/bitfields] [5]' % (name, bool_list, unsigned_list)) - def build_test_case(bitfields, name, will_warn, extra_warnings=[]): + def build_test_case(bitfields, name, will_warn, extra_warnings=None): bool_bitfields = [] unsigned_bitfields = [] test_string = 'class %s {\n' % (name,)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers_unittest.py index 743c517..e9b3b32 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers_unittest.py
@@ -90,7 +90,8 @@ """Test the __eq__() method for the return value of False.""" def make_handler(configuration=self._style_checker_configuration(), file_path='foo.txt', increment_error_count=lambda: True, - line_numbers=[100]): + line_numbers=None): + line_numbers = line_numbers or [100] return DefaultStyleErrorHandler(configuration=configuration, file_path=file_path, increment_error_count=increment_error_count,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py index 65efd03..be966e3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py
@@ -140,7 +140,7 @@ configuration = checker.check_webkit_style_configuration(options) - paths = change_directory(host.filesystem, checkout_root=host.scm().checkout_root, paths=paths) + paths = change_directory(host.filesystem, checkout_root=host.git().checkout_root, paths=paths) style_processor = StyleProcessor(configuration) file_reader = TextFileReader(host.filesystem, style_processor) @@ -149,7 +149,7 @@ file_reader.process_paths(paths) else: changed_files = paths if options.diff_files else None - patch = host.scm().create_patch(options.git_commit, changed_files=changed_files) + patch = host.git().create_patch(options.git_commit, changed_files=changed_files) patch_checker = PatchReader(file_reader) patch_checker.check(patch)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py index 1a5b42c50..668711a62 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py
@@ -51,7 +51,7 @@ paths = self._change_directory(checkout_root=self._checkout_root, paths=paths) self._assert_result(paths, ["foo1.txt", "foo2.txt"], [], self._checkout_root) - def test_with_scm_paths_unconvertible(self): + def test_with_git_paths_unconvertible(self): paths = ["/chromium/src/foo1.txt", "/outside/foo2.txt"] paths = self._change_directory(checkout_root=self._checkout_root, paths=paths) log_messages = [
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py index 79798c4..90414a6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py
@@ -40,7 +40,7 @@ def _create_options(self, output_format='emacs', min_confidence=3, - filter_rules=[], + filter_rules=None, git_commit=None): return ProcessorOptions(filter_rules=filter_rules, git_commit=git_commit,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py index 415d2597..3301e72 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py
@@ -49,7 +49,7 @@ def __init__(self, tool, announce_path, irc_password): SingleServerIRCBot.__init__(self, [(SERVER, PORT, irc_password)], NICKNAME, NICKNAME) self.announce_path = announce_path - self.git = tool.scm(path=tool.scm().checkout_root) + self.git = tool.git(path=tool.git().checkout_root) self.commands = { 'help': self.help, 'ping': self.ping,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline.py index 0e553df..1d773f3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline.py
@@ -62,7 +62,7 @@ [^[]*$ # Prevents matching previous [ for version specifiers instead of expectation specifiers ''', re.VERBOSE) - def bot_revision_data(self, scm): + def bot_revision_data(self, git): revisions = [] for builder_name in self._release_builders(): result = self._tool.buildbot.fetch_results(Build(builder_name)) @@ -71,7 +71,7 @@ return [] revisions.append({ "builder": result.builder_name(), - "revision": result.chromium_revision(scm), + "revision": result.chromium_revision(git), }) return revisions @@ -93,7 +93,7 @@ bugs = set() has_any_needs_rebaseline_lines = False - for line in tool.scm().blame(expectations_file_path).split("\n"): + for line in tool.git().blame(expectations_file_path).split("\n"): line = self._strip_comments(line) if "NeedsRebaseline" not in line: continue @@ -109,7 +109,7 @@ continue commit_hash = parsed_line.group(1) - commit_position = tool.scm().commit_position_from_git_commit(commit_hash) + commit_position = tool.git().commit_position_from_git_commit(commit_hash) test = parsed_line.group(3) if print_revisions: @@ -210,15 +210,15 @@ def execute(self, options, args, tool): self._tool = tool - if tool.scm().executable_name == "svn": + if tool.git().executable_name == "svn": _log.error("Auto rebaseline only works with a git checkout.") return - if not options.dry_run and tool.scm().has_working_directory_changes(): + if not options.dry_run and tool.git().has_working_directory_changes(): _log.error("Cannot proceed with working directory changes. Clean working directory first.") return - revision_data = self.bot_revision_data(tool.scm()) + revision_data = self.bot_revision_data(tool.git()) if not revision_data: return @@ -249,12 +249,12 @@ rebaseline_branch_name = self.AUTO_REBASELINE_BRANCH_NAME try: # Save the current branch name and check out a clean branch for the patch. - old_branch_name_or_ref = tool.scm().current_branch_or_ref() + old_branch_name_or_ref = tool.git().current_branch_or_ref() if old_branch_name_or_ref == self.AUTO_REBASELINE_BRANCH_NAME: rebaseline_branch_name = self.AUTO_REBASELINE_ALT_BRANCH_NAME if not options.dry_run: - tool.scm().delete_branch(rebaseline_branch_name) - tool.scm().create_clean_branch(rebaseline_branch_name) + tool.git().delete_branch(rebaseline_branch_name) + tool.git().create_clean_branch(rebaseline_branch_name) did_switch_branches = True if test_prefix_list: @@ -263,7 +263,7 @@ if options.dry_run: return - tool.scm().commit_locally_with_message( + tool.git().commit_locally_with_message( self.commit_message(author, revision, commit, bugs)) # FIXME: It would be nice if we could dcommit the patch without uploading, but still @@ -291,7 +291,7 @@ if not issue_already_closed: self._run_git_cl_command(options, ['set_close']) - tool.scm().ensure_cleanly_tracking_remote_master() + tool.git().ensure_cleanly_tracking_remote_master() if old_branch_name_or_ref: - tool.scm().checkout_branch(old_branch_name_or_ref) - tool.scm().delete_branch(rebaseline_branch_name) + tool.git().checkout_branch(old_branch_name_or_ref) + tool.git().delete_branch(rebaseline_branch_name)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py index 98f9d71..0349ea1 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py
@@ -44,7 +44,7 @@ "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Win7", "Debug"]}, }) self.command.latest_revision_processed_on_all_bots = lambda: 9000 - self.command.bot_revision_data = lambda scm: [{"builder": "MOCK Win7", "revision": "9000"}] + self.command.bot_revision_data = lambda git: [{"builder": "MOCK Win7", "revision": "9000"}] def test_release_builders(self): # Testing private method - pylint: disable=protected-access @@ -66,7 +66,7 @@ 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] 0000000000 path/to/TestExpectations (<foo@chromium.org@@bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame min_revision = 9000 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), ( @@ -86,7 +86,7 @@ "(<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) " "crbug.com/24182 path/to/rebaseline-%s.html [ NeedsRebaseline ]\n" % i) return result - self.tool.scm().blame = blame + self.tool.git().blame = blame expected_list_of_tests = [] for i in range(0, self.command.MAX_LINES_TO_REBASELINE): @@ -133,7 +133,7 @@ return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Failure ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame self._execute_with_mock_options() self.assertEqual(self.tool.executive.calls, []) @@ -149,7 +149,7 @@ 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] 0000000000 path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -266,7 +266,7 @@ return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -315,7 +315,7 @@ return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -367,7 +367,7 @@ return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -396,10 +396,10 @@ self.tool.builders = BuilderList({ "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, }) - old_branch_name = self.tool.scm().current_branch_or_ref + old_branch_name = self.tool.git().current_branch_or_ref try: self.command.tree_status = lambda: 'open' - self.tool.scm().current_branch_or_ref = lambda: 'auto-rebaseline-temporary-branch' + self.tool.git().current_branch_or_ref = lambda: 'auto-rebaseline-temporary-branch' self._execute_with_mock_options() self.assertEqual(self.tool.executive.calls, [ ['git', 'cl', 'upload', '-f'], @@ -413,14 +413,14 @@ Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] """) finally: - self.tool.scm().current_branch_or_ref = old_branch_name + self.tool.git().current_branch_or_ref = old_branch_name def test_execute_stuck_on_alternate_rebaseline_branch(self): def blame(_): return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -449,10 +449,10 @@ self.tool.builders = BuilderList({ "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, }) - old_branch_name = self.tool.scm().current_branch_or_ref + old_branch_name = self.tool.git().current_branch_or_ref try: self.command.tree_status = lambda: 'open' - self.tool.scm().current_branch_or_ref = lambda: 'auto-rebaseline-alt-temporary-branch' + self.tool.git().current_branch_or_ref = lambda: 'auto-rebaseline-alt-temporary-branch' self._execute_with_mock_options() self.assertEqual(self.tool.executive.calls, [ ['git', 'cl', 'upload', '-f'], @@ -466,14 +466,14 @@ Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] """) finally: - self.tool.scm().current_branch_or_ref = old_branch_name + self.tool.git().current_branch_or_ref = old_branch_name def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_json=None, commit_author=None, dry_run=False): def blame(_): return """ 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """ - self.tool.scm().blame = blame + self.tool.git().blame = blame test_port = self.tool.port_factory.get('test') @@ -529,10 +529,10 @@ def test_execute_with_dry_run(self): self._basic_execute_test([], dry_run=True) - self.assertEqual(self.tool.scm().local_commits(), []) + self.assertEqual(self.tool.git().local_commits(), []) def test_bot_revision_data(self): self._setup_mock_build_data() self.assertEqual( - self.command.bot_revision_data(self.tool.scm()), + self.command.bot_revision_data(self.tool.git()), [{'builder': 'MOCK Win7', 'revision': '9000'}])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py index 5a2896b..dcd202b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py
@@ -121,8 +121,8 @@ # main() exists so that Commands can be turned into stand-alone scripts. # Other parts of the code will likely require modification to work stand-alone. - def main(self, args=sys.argv): - (options, args) = self.parse_args(args) + def main(self, args=None): + options, args = self.parse_args(args) # Some commands might require a dummy tool return self.check_arguments_and_execute(options, args)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines_unittest.py index 5fcdf8cd..c712d25 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines_unittest.py
@@ -4,7 +4,6 @@ import optparse -from webkitpy.common.system.output_capture import OutputCapture from webkitpy.tool.commands.optimize_baselines import OptimizeBaselines from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase @@ -27,15 +26,10 @@ self._write_test_file(test_port, 'another/test-expected.txt', "result A") self._write_test_file(test_port, 'another/test-expected.png', "result A png") - try: - oc = OutputCapture() - oc.capture_output() - self.command.execute( - optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_scm': True, 'platform': 'test-mac-mac10.10'}), - ['another/test.html'], - self.tool) - finally: - oc.restore_output() + self.command.execute( + optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_git': True, 'platform': 'test-mac-mac10.10'}), + ['another/test.html'], + self.tool) self.assertFalse( self.tool.filesystem.exists(self.tool.filesystem.join(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py index e6e53a8..830d8b56 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py
@@ -81,8 +81,8 @@ _log.warning("PrettyPatch unavailable.") def _diff(self, options): - changed_files = self._tool.scm().changed_files(options.git_commit) - return self._tool.scm().create_patch(options.git_commit, + changed_files = self._tool.git().changed_files(options.git_commit) + return self._tool.git().create_patch(options.git_commit, changed_files=changed_files) def _open_pretty_diff(self, file_path):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py index 3cedbca..f7060f5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -300,7 +300,7 @@ try: verbose_args = ['--verbose'] if verbose else [] stderr = self._tool.executive.run_command([self._tool.path()] + verbose_args + - args, cwd=self._tool.scm().checkout_root, return_stderr=True) + args, cwd=self._tool.git().checkout_root, return_stderr=True) for line in stderr.splitlines(): _log.warning(line) except ScriptError: @@ -341,7 +341,7 @@ def _rebaseline_commands(self, test_prefix_list, options): path_to_webkit_patch = self._tool.path() - cwd = self._tool.scm().checkout_root + cwd = self._tool.git().checkout_root copy_baseline_commands = [] rebaseline_commands = [] lines_to_remove = {} @@ -421,7 +421,7 @@ cmd_line.append('--verbose') path_to_webkit_patch = self._tool.path() - cwd = self._tool.scm().checkout_root + cwd = self._tool.git().checkout_root optimize_commands.append(tuple([[self._tool.executable, path_to_webkit_patch, 'optimize-baselines'] + cmd_line, cwd])) return optimize_commands @@ -491,7 +491,7 @@ TODO(qyearsley): Replace test_prefix_list everywhere with some sort of class that contains the same data. """ - if self._tool.scm().has_working_directory_changes(pathspec=self._layout_tests_dir()): + if self._tool.git().has_working_directory_changes(pathspec=self._layout_tests_dir()): _log.error('There are uncommitted changes in the layout tests directory; aborting.') return @@ -524,13 +524,13 @@ self._remove_all_pass_testharness_baselines(test_prefix_list) - self._tool.scm().add_list(self.unstaged_baselines()) + self._tool.git().add_list(self.unstaged_baselines()) def unstaged_baselines(self): """Returns absolute paths for unstaged (including untracked) baselines.""" baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png|wav)$') - unstaged_changes = self._tool.scm().unstaged_changes() - return sorted(self._tool.scm().absolute_path(path) for path in unstaged_changes if re.match(baseline_re, path)) + unstaged_changes = self._tool.git().unstaged_changes() + return sorted(self._tool.git().absolute_path(path) for path in unstaged_changes if re.match(baseline_re, path)) def _remove_all_pass_testharness_baselines(self, test_prefix_list): """Removes all of the all-PASS baselines for the given builders and tests.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py index e31cb07..6c9b3d7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
@@ -318,8 +318,8 @@ ]) def test_bails_when_there_are_unstaged_baselines(self): - scm = self.tool.scm() - scm.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-expected.txt': '?'} + git = self.tool.git() + git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-expected.txt': '?'} return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool) self.assertEqual(return_code, 1) self.assertLog([
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py index e154f19e..51c96f4 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py
@@ -47,7 +47,7 @@ self.platforms = platforms self.host = host self.filesystem = host.filesystem - self.scm = host.scm() + self.git = host.git() class RebaselineServer(AbstractLocalServerCommand):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index df5a7c6..a2a30a36 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -485,8 +485,8 @@ ]) def test_unstaged_baselines(self): - scm = self.tool.scm() - scm.unstaged_changes = lambda: { + git = self.tool.git() + git.unstaged_changes = lambda: { 'third_party/WebKit/LayoutTests/x/foo-expected.txt': 'M', 'third_party/WebKit/LayoutTests/x/foo-expected.something': '?', 'third_party/WebKit/LayoutTests/x/foo-expected.png': '?',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server.py index c1013643..121465b2 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server.py
@@ -63,7 +63,7 @@ actual_result_files = _get_actual_result_files(test_file, test_config) filesystem = test_config.filesystem - scm = test_config.scm + git = test_config.git layout_tests_directory = test_config.layout_tests_directory target_expectations_directory = filesystem.join( layout_tests_directory, 'platform', baseline_target, test_directory) @@ -112,7 +112,7 @@ destination_path = filesystem.join( target_expectations_directory, destination_file) filesystem.copyfile(source_path, destination_path) - exit_code = scm.add(destination_path, return_exit_code=True) + exit_code = git.add(destination_path, return_exit_code=True) if exit_code: log(' Could not update %s in SCM, exit code %d' % (destination_file, exit_code)) @@ -148,7 +148,7 @@ source_path = filesystem.join(source_directory, file_name) destination_path = filesystem.join(destination_directory, file_name) filesystem.copyfile(source_path, destination_path) - exit_code = test_config.scm.add(destination_path, return_exit_code=True) + exit_code = test_config.git.add(destination_path, return_exit_code=True) if exit_code: log(' Could not update %s in SCM, exit code %d' % (file_name, exit_code))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py index 4c5ebcc..ca5bb0a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py
@@ -152,9 +152,9 @@ option_parser.add_option(option) def _should_execute_command(self, command): - if command.requires_local_commits and not self.scm().supports_local_commits(): + if command.requires_local_commits and not self.git().supports_local_commits(): failure_reason = "%s requires local commits using %s in %s." % ( - command.name, self.scm().display_name(), self.scm().checkout_root) + command.name, self.git().display_name(), self.git().checkout_root) return (False, failure_reason) return (True, None) @@ -165,7 +165,7 @@ if not command.show_in_main_help: return False if command.requires_local_commits: - return self.scm().supports_local_commits() + return self.git().supports_local_commits() return True def command_by_name(self, command_name):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py index bafafd81..2f4deea 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py
@@ -29,7 +29,6 @@ import unittest from webkitpy.common.host import Host -from webkitpy.common.system.output_capture import OutputCapture from webkitpy.common.webkit_finder import WebKitFinder from webkitpy.w3c.test_converter import _W3CTestConverter, convert_for_webkit from webkitpy.common.system.system_host_mock import MockSystemHost @@ -79,14 +78,9 @@ """ converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) - oc = OutputCapture() - oc.capture_output() - try: - converter.feed(test_html) - converter.close() - converted = converter.output() - finally: - oc.restore_output() + converter.feed(test_html) + converter.close() + converted = converter.output() self.verify_no_conversion_happened(converted, test_html) @@ -112,14 +106,9 @@ converter = _W3CTestConverter(fake_dir_path, DUMMY_FILENAME, None) test_content = self.generate_test_content(converter.prefixed_properties, 1, test_html) - oc = OutputCapture() - oc.capture_output() - try: - converter.feed(test_content[1]) - converter.close() - converted = converter.output() - finally: - oc.restore_output() + converter.feed(test_content[1]) + converter.close() + converted = converter.output() self.verify_conversion_happened(converted) self.verify_prefixed_properties(converted, test_content[0]) @@ -199,14 +188,9 @@ converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) test_content = self.generate_test_content(converter.prefixed_properties, 4, test_html) - oc = OutputCapture() - oc.capture_output() - try: - converter.feed(test_content[1]) - converter.close() - converted = converter.output() - finally: - oc.restore_output() + converter.feed(test_content[1]) + converter.close() + converted = converter.output() self.verify_conversion_happened(converted) self.verify_prefixed_properties(converted, test_content[0]) @@ -231,15 +215,9 @@ } converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, test_reference_support_info) - oc = OutputCapture() - oc.capture_output() - - try: - converter.feed(test_html) - converter.close() - converted = converter.output() - finally: - oc.restore_output() + converter.feed(test_html) + converter.close() + converted = converter.output() self.verify_conversion_happened(converted) self.verify_reference_relative_paths(converted, test_reference_support_info)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py index e508873..251335f7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
@@ -374,7 +374,7 @@ def get_directory_owners(self): """Returns a list of email addresses of owners of changed tests.""" _log.info('Gathering directory owners emails to CC.') - changed_files = self.host.scm().changed_files() + changed_files = self.host.git().changed_files() extractor = DirectoryOwnersExtractor(self.fs) extractor.read_owner_map() return extractor.list_owners(changed_files)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py index 45b6bb9c..506d77b3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
@@ -151,7 +151,7 @@ '# external/wpt/foo [ Pass ]\n') git = MockGit() git.changed_files = lambda: ['third_party/WebKit/LayoutTests/external/wpt/foo/x.html'] - host.scm = lambda: git + host.git = lambda: git importer = TestImporter(host) self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org': 'external/wpt/foo'})
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py index 2d581fc..18489e1a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
@@ -54,8 +54,8 @@ # Here we build up a dict of failing test results for all platforms. test_expectations = {} for build in builds: - platform_results = self.get_failing_results_dict(build) - test_expectations = self.merge_dicts(test_expectations, platform_results) + port_results = self.get_failing_results_dict(build) + test_expectations = self.merge_dicts(test_expectations, port_results) # And then we merge results for different platforms that had the same results. for test_name, platform_result in test_expectations.iteritems(): @@ -87,57 +87,57 @@ Returns: A dictionary with the structure: { - 'key': { + 'full-port-name': { 'expected': 'TIMEOUT', 'actual': 'CRASH', 'bug': 'crbug.com/11111' } } If there are no failing results or no results could be fetched, - this will return an empty dict. + this will return an empty dictionary. """ layout_test_results = self.host.buildbot.fetch_results(build) if layout_test_results is None: _log.warning('No results for build %s', build) return {} - platform = self.host.builders.port_name_for_builder_name(build.builder_name) + port_name = self.host.builders.port_name_for_builder_name(build.builder_name) test_results = layout_test_results.didnt_run_as_expected_results() - failing_results_dict = self.generate_results_dict(platform, test_results) + failing_results_dict = self.generate_results_dict(port_name, test_results) return failing_results_dict def generate_results_dict(self, full_port_name, test_results): """Makes a dict with results for one platform. Args: - full_port_name: The full port name, e.g. "win-win10". + full_port_name: The fully-qualified port name, e.g. "win-win10". test_results: A list of LayoutTestResult objects. Returns: - A dict mapping to platform string (e.g. "Win10") to a dict with - the results for that test and that platform. + A dict mapping the full port name to a dict with the results for + the given test and platform. """ - platform = self._port_name_to_platform_specifier(full_port_name) test_dict = {} for result in test_results: - test_dict[result.test_name()] = { - platform: { + test_name = result.test_name() + test_dict[test_name] = { + full_port_name: { 'expected': result.expected_results(), 'actual': result.actual_results(), 'bug': 'crbug.com/626703' - }} + } + } return test_dict def _port_name_to_platform_specifier(self, port_name): - """Maps a port name to the string used in test expectations lines. + """Maps a port name to the platform specifier used in expectation lines. For example: linux-trusty -> Trusty mac-mac10.11 -> Mac10.11. """ - # TODO(qyearsley): Do this in a more robust way with Port classes. - if '-' in port_name: - return port_name[port_name.find('-') + 1:].capitalize() - return port_name + builder_name = self.host.builders.builder_name_for_port_name(port_name) + specifiers = self.host.builders.specifiers_for_builder(builder_name) + return specifiers[0] def merge_dicts(self, target, source, path=None): """Recursively merges nested dictionaries. @@ -264,22 +264,22 @@ ['BUG_URL [PLATFORM(S)] TEST_MAME [EXPECTATION(S)]'] """ line_list = [] - for test_name, platform_results in merged_results.iteritems(): - for platform in platform_results: + for test_name, port_results in merged_results.iteritems(): + for port_names in port_results: if test_name.startswith('external'): - platform_list = [] - bug = [] - expectations = [] - if isinstance(platform, tuple): - platform_list = list(platform) - else: - platform_list.append(platform) - bug.append(platform_results[platform]['bug']) - expectations = self.get_expectations(platform_results[platform]) - line = '%s [ %s ] %s [ %s ]' % (bug[0], ' '.join(platform_list), test_name, ' '.join(expectations)) - line_list.append(str(line)) + bug_part = port_results[port_names]['bug'] + specifier_part = '[ %s ]' % ' '.join(self.to_list(port_names)) + expectations_part = '[ %s ]' % ' '.join(self.get_expectations(port_results[port_names])) + line = ' '.join([bug_part, specifier_part, test_name, expectations_part]) + line_list.append(line) return line_list + @staticmethod + def to_list(tuple_or_value): + if isinstance(tuple_or_value, tuple): + return list(tuple_or_value) + return [tuple_or_value] + def write_to_test_expectations(self, line_list): """Writes to TestExpectations.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py index 72cd63a..f1b5d039 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
@@ -17,15 +17,22 @@ class WPTExpectationsUpdaterTest(LoggingTestCase): - def setUp(self): + def mock_host(self): super(WPTExpectationsUpdaterTest, self).setUp() - self.host = MockHost() - self.host.builders = BuilderList({ - 'mac': {'port_name': 'test-mac'}, + host = MockHost() + host.builders = BuilderList({ + 'MOCK Mac10.10': {'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release']}, + 'MOCK Mac10.11': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release']}, + 'MOCK Trusty': {'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release']}, + 'MOCK Win10': {'port_name': 'test-win-win10', 'specifiers': ['Win10', 'Release']}, + 'MOCK Win7': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release']}, + 'MOCK Android': {'port_name': 'test-android', 'specifiers': ['Android', 'Release']}, }) + return host def test_get_failing_results_dict_only_passing_results(self): - self.host.buildbot.set_results(Build('mac', 123), LayoutTestResults({ + host = self.mock_host() + host.buildbot.set_results(Build('MOCK Mac10.10', 123), LayoutTestResults({ 'tests': { 'x': { 'passing-test.html': { @@ -35,17 +42,19 @@ }, }, })) - updater = WPTExpectationsUpdater(self.host) - self.assertEqual(updater.get_failing_results_dict(Build('mac', 123)), {}) + updater = WPTExpectationsUpdater(host) + self.assertEqual(updater.get_failing_results_dict(Build('MOCK Mac10.10', 123)), {}) def test_get_failing_results_dict_no_results(self): - self.host.buildbot = MockBuildBot() - self.host.buildbot.set_results(Build('mac', 123), None) - updater = WPTExpectationsUpdater(self.host) - self.assertEqual(updater.get_failing_results_dict(Build('mac', 123)), {}) + host = self.mock_host() + host.buildbot = MockBuildBot() + host.buildbot.set_results(Build('MOCK Mac10.10', 123), None) + updater = WPTExpectationsUpdater(host) + self.assertEqual(updater.get_failing_results_dict(Build('MOCK Mac10.10', 123)), {}) def test_get_failing_results_dict_some_failing_results(self): - self.host.buildbot.set_results(Build('mac', 123), LayoutTestResults({ + host = self.mock_host() + host.buildbot.set_results(Build('MOCK Mac10.10', 123), LayoutTestResults({ 'tests': { 'x': { 'failing-test.html': { @@ -56,19 +65,22 @@ }, }, })) - updater = WPTExpectationsUpdater(self.host) - self.assertEqual(updater.get_failing_results_dict(Build('mac', 123)), { - 'x/failing-test.html': { - 'Mac': { - 'actual': 'IMAGE', - 'expected': 'PASS', - 'bug': 'crbug.com/626703', + updater = WPTExpectationsUpdater(host) + results_dict = updater.get_failing_results_dict(Build('MOCK Mac10.10', 123)) + self.assertEqual( + results_dict, + { + 'x/failing-test.html': { + 'test-mac-mac10.10': { + 'actual': 'IMAGE', + 'expected': 'PASS', + 'bug': 'crbug.com/626703', + }, }, - }, - }) + }) def test_merge_same_valued_keys_all_match(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) self.assertEqual( updater.merge_same_valued_keys({ 'one': {'expected': 'FAIL', 'actual': 'PASS'}, @@ -77,7 +89,7 @@ {('two', 'one'): {'expected': 'FAIL', 'actual': 'PASS'}}) def test_merge_same_valued_keys_one_mismatch(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) self.assertEqual( updater.merge_same_valued_keys({ 'one': {'expected': 'FAIL', 'actual': 'PASS'}, @@ -90,7 +102,7 @@ }) def test_get_expectations(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) self.assertEqual( updater.get_expectations({'expected': 'FAIL', 'actual': 'PASS'}), {'Pass'}) @@ -109,7 +121,7 @@ def test_create_line_list_old_tests(self): # In this example, there are two failures that are not in w3c tests. - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) results = { 'fake/test/path.html': { 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/test'}, @@ -120,7 +132,7 @@ def test_create_line_list_new_tests(self): # In this example, there are unexpected non-fail results in w3c tests. - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) results = { 'external/fake/test/path.html': { 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/test'}, @@ -137,7 +149,7 @@ ]) def test_merge_dicts_with_conflict_raise_exception(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) # Both dicts here have the key "one", and the value is not equal. with self.assertRaises(ValueError): updater.merge_dicts( @@ -155,7 +167,7 @@ }) def test_merge_dicts_merges_second_dict_into_first(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) one = { 'fake/test/path.html': { 'one': {'expected': 'FAIL', 'actual': 'PASS'}, @@ -181,7 +193,7 @@ self.assertEqual(output, two) def test_generate_results_dict(self): - updater = WPTExpectationsUpdater(MockHost()) + updater = WPTExpectationsUpdater(self.mock_host()) layout_test_list = [ LayoutTestResult( 'test/name.html', { @@ -189,11 +201,11 @@ 'actual': 'foo', 'is_unexpected': True, 'has_stderr': True, - } - )] - self.assertEqual(updater.generate_results_dict('dummy_platform', layout_test_list), { + }) + ] + self.assertEqual(updater.generate_results_dict('test-mac-mac10.10', layout_test_list), { 'test/name.html': { - 'dummy_platform': { + 'test-mac-mac10.10': { 'expected': 'bar', 'actual': 'foo', 'bug': 'crbug.com/626703', @@ -202,9 +214,10 @@ }) def test_write_to_test_expectations_with_marker_comment(self): + host = self.mock_host() expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations' - self.host.filesystem.files[expectations_path] = MARKER_COMMENT + '\n' - updater = WPTExpectationsUpdater(self.host) + host.filesystem.files[expectations_path] = MARKER_COMMENT + '\n' + updater = WPTExpectationsUpdater(host) line_list = ['crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]'] updater.write_to_test_expectations(line_list) value = updater.host.filesystem.read_text_file(expectations_path) @@ -214,12 +227,13 @@ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n')) def test_write_to_test_expectations_with_no_marker_comment(self): + host = self.mock_host() expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations' - self.host.filesystem.files[expectations_path] = 'crbug.com/111 [ FakePlatform ]\n' - updater = WPTExpectationsUpdater(self.host) + host.filesystem.files[expectations_path] = 'crbug.com/111 [ FakePlatform ]\n' + updater = WPTExpectationsUpdater(host) line_list = ['crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]'] updater.write_to_test_expectations(line_list) - value = self.host.filesystem.read_text_file(expectations_path) + value = host.filesystem.read_text_file(expectations_path) self.assertMultiLineEqual( value, ('crbug.com/111 [ FakePlatform ]\n' @@ -227,15 +241,16 @@ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]')) def test_write_to_test_expectations_skips_existing_lines(self): + host = self.mock_host() expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations' - self.host.filesystem.files[expectations_path] = 'crbug.com/111 dont/copy/me.html [ Failure ]\n' - updater = WPTExpectationsUpdater(self.host) + host.filesystem.files[expectations_path] = 'crbug.com/111 dont/copy/me.html [ Failure ]\n' + updater = WPTExpectationsUpdater(host) line_list = [ 'crbug.com/111 dont/copy/me.html [ Failure ]', 'crbug.com/222 do/copy/me.html [ Failure ]' ] updater.write_to_test_expectations(line_list) - value = self.host.filesystem.read_text_file(expectations_path) + value = host.filesystem.read_text_file(expectations_path) self.assertEqual( value, ('crbug.com/111 dont/copy/me.html [ Failure ]\n' @@ -243,11 +258,12 @@ 'crbug.com/222 do/copy/me.html [ Failure ]')) def test_write_to_test_expectations_with_marker_and_no_lines(self): + host = self.mock_host() expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations' - self.host.filesystem.files[expectations_path] = ( + host.filesystem.files[expectations_path] = ( MARKER_COMMENT + '\n' 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) updater.write_to_test_expectations([]) value = updater.host.filesystem.read_text_file(expectations_path) self.assertMultiLineEqual( @@ -256,27 +272,30 @@ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n')) def test_is_js_test_true(self): - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/foo/bar.html'] = ( + host = self.mock_host() + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/foo/bar.html'] = ( '<script src="/resources/testharness.js"></script>') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) self.assertTrue(updater.is_js_test('foo/bar.html')) def test_is_js_test_false(self): - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/foo/bar.html'] = ( + host = self.mock_host() + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/foo/bar.html'] = ( '<script src="ref-test.html"></script>') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) self.assertFalse(updater.is_js_test('foo/bar.html')) def test_is_js_test_non_existent_file(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) self.assertFalse(updater.is_js_test('foo/bar.html')) def test_get_test_to_rebaseline_returns_only_tests_with_failures(self): - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( + host = self.mock_host() + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( '<script src="/resources/testharness.js"></script>') - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/other/test/path.html'] = ( + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/other/test/path.html'] = ( '<script src="/resources/testharness.js"></script>') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) two = { 'external/fake/test/path.html': { 'one': {'expected': 'FAIL', 'actual': 'PASS'}, @@ -289,9 +308,10 @@ self.assertEqual(tests_to_rebaseline, ['external/fake/test/path.html']) def test_get_test_to_rebaseline_returns_only_js_tests(self): - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( + host = self.mock_host() + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( 'this file does not look like a testharness JS test.') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) two = { 'external/fake/test/path.html': { 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/test'}, @@ -303,6 +323,7 @@ self.assertEqual(tests_to_rebaseline, []) def test_get_tests_to_rebaseline_returns_updated_dict(self): + host = self.mock_host() test_results_dict = { 'external/fake/test/path.html': { 'one': {'expected': 'PASS', 'actual': 'TEXT'}, @@ -310,9 +331,9 @@ }, } test_results_dict_copy = copy.deepcopy(test_results_dict) - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( '<script src="/resources/testharness.js"></script>') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) tests_to_rebaseline, modified_test_results = updater.get_tests_to_rebaseline( test_results_dict) self.assertEqual(tests_to_rebaseline, ['external/fake/test/path.html']) @@ -327,6 +348,7 @@ self.assertEqual(test_results_dict, test_results_dict_copy) def test_get_tests_to_rebaseline_also_returns_slow_tests(self): + host = self.mock_host() test_results_dict = { 'external/fake/test/path.html': { 'one': {'expected': 'SLOW', 'actual': 'TEXT'}, @@ -334,9 +356,9 @@ }, } test_results_dict_copy = copy.deepcopy(test_results_dict) - self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( + host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/external/fake/test/path.html'] = ( '<script src="/resources/testharness.js"></script>') - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) tests_to_rebaseline, modified_test_results = updater.get_tests_to_rebaseline( test_results_dict) self.assertEqual(tests_to_rebaseline, ['external/fake/test/path.html']) @@ -351,13 +373,14 @@ self.assertEqual(test_results_dict, test_results_dict_copy) def test_run_no_issue_number(self): - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(self.mock_host()) updater.get_issue_number = lambda: 'None' self.assertEqual(1, updater.run(args=[])) self.assertLog(['ERROR: No issue on current branch.\n']) def test_run_no_try_results(self): - self.host.web = MockWeb(urls={ + host = self.mock_host() + host.web = MockWeb(urls={ 'https://codereview.chromium.org/api/11112222': json.dumps({ 'patchsets': [1], }), @@ -365,12 +388,12 @@ 'try_job_results': [] }) }) - updater = WPTExpectationsUpdater(self.host) + updater = WPTExpectationsUpdater(host) updater.get_issue_number = lambda: '11112222' updater.get_try_bots = lambda: ['test-builder-name'] self.assertEqual(1, updater.run(args=[])) self.assertEqual( - self.host.web.urls_fetched, + host.web.urls_fetched, [ 'https://codereview.chromium.org/api/11112222', 'https://codereview.chromium.org/api/11112222/1'
diff --git a/third_party/WebKit/public/platform/modules/budget_service/OWNERS b/third_party/WebKit/public/platform/modules/budget_service/OWNERS index 1fd653b..461dee0 100644 --- a/third_party/WebKit/public/platform/modules/budget_service/OWNERS +++ b/third_party/WebKit/public/platform/modules/budget_service/OWNERS
@@ -3,4 +3,5 @@ per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS +# TEAM: platform-capabilities@chromium.org # COMPONENT: Blink>PushAPI
diff --git a/third_party/WebKit/public/platform/modules/notifications/OWNERS b/third_party/WebKit/public/platform/modules/notifications/OWNERS index a6735e3..0a5fdca 100644 --- a/third_party/WebKit/public/platform/modules/notifications/OWNERS +++ b/third_party/WebKit/public/platform/modules/notifications/OWNERS
@@ -3,5 +3,5 @@ per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS -# TEAM: push-notifications-dev@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications
diff --git a/third_party/WebKit/public/platform/modules/push_messaging/OWNERS b/third_party/WebKit/public/platform/modules/push_messaging/OWNERS index d09ffef..4898e44 100644 --- a/third_party/WebKit/public/platform/modules/push_messaging/OWNERS +++ b/third_party/WebKit/public/platform/modules/push_messaging/OWNERS
@@ -1 +1,4 @@ file://content/browser/push_messaging/OWNERS + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>PushAPI
diff --git a/third_party/WebKit/public/web/WebInputMethodController.h b/third_party/WebKit/public/web/WebInputMethodController.h index 090d2be..353c2a84 100644 --- a/third_party/WebKit/public/web/WebInputMethodController.h +++ b/third_party/WebKit/public/web/WebInputMethodController.h
@@ -12,6 +12,7 @@ namespace blink { +class WebRange; class WebString; template <typename T> class WebVector; @@ -24,22 +25,27 @@ }; virtual ~WebInputMethodController() {} - // Called to inform the WebInputMethodController of a new composition text. - // If selectionStart and selectionEnd has the same value, then it indicates - // the input caret position. If the text is empty, then the existing - // composition text will be canceled. - // Returns true if the composition text was set successfully. + + // Called to inform the WebInputMethodController of a new composition text. If + // selectionStart and selectionEnd has the same value, then it indicates the + // input caret position. If the text is empty, then the existing composition + // text will be canceled. |replacementRange| (when not null) is the range in + // current text which should be replaced by |text|. Returns true if the + // composition text was set successfully. virtual bool setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int selectionStart, int selectionEnd) = 0; - // Called to inform the controller that deleting the ongoing composition if - // any, inserting the specified text, and moving the caret according to - // relativeCaretPosition. + // Called to inform the controller to delete the ongoing composition if any, + // insert |text|, and move the caret according to |relativeCaretPosition|. + // |replacementRange| (when not null) is the range in current text which + // should be replaced by |text|. virtual bool commitText(const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + const WebRange& replacementRange, int relativeCaretPosition) = 0; // Called to inform the controller to confirm an ongoing composition.
diff --git a/third_party/WebKit/public/web/WebRuntimeFeatures.h b/third_party/WebKit/public/web/WebRuntimeFeatures.h index 053c167..129378f 100644 --- a/third_party/WebKit/public/web/WebRuntimeFeatures.h +++ b/third_party/WebKit/public/web/WebRuntimeFeatures.h
@@ -120,6 +120,7 @@ BLINK_EXPORT static void enableSlimmingPaintInvalidation(bool); BLINK_EXPORT static void enableSpeculativeLaunchServiceWorker(bool); BLINK_EXPORT static void enableTouchEventFeatureDetection(bool); + BLINK_EXPORT static void enableTouchpadAndWheelScrollLatching(bool); BLINK_EXPORT static void enableV8IdleTasks(bool); BLINK_EXPORT static void enableWebAssemblySerialization(bool); BLINK_EXPORT static void enableWebBluetooth(bool);
diff --git a/third_party/WebKit/public/web/WebWidget.h b/third_party/WebKit/public/web/WebWidget.h index 278d6428..0fba421 100644 --- a/third_party/WebKit/public/web/WebWidget.h +++ b/third_party/WebKit/public/web/WebWidget.h
@@ -218,10 +218,6 @@ return false; } - // Applies the range on the focused frame so that the text will later be - // replaced. - virtual void applyReplacementRange(const WebRange&) {} - protected: ~WebWidget() {} };
diff --git a/tools/metrics/histograms/README.md b/tools/metrics/histograms/README.md index 9c48ad8..1b6943c1 100644 --- a/tools/metrics/histograms/README.md +++ b/tools/metrics/histograms/README.md
@@ -49,12 +49,19 @@ ``` // These values are written to logs. New enum values can be added, but existing // enums must never be renumbered or deleted and reused. +enum NEW_TAB_PAGE_ACTION { + USE_OMNIBOX = 0, + CLICK_TILE = 1, + OPEN_BOOKMARK = 2, + NEW_TAB_PAGE_ACTION_MAX +}; ``` Also, please explicitly set enum values `= 0`, `= 1`, `= 2`, etc. This makes clearer that the actual values are important. In addition, it helps confirm the values align between the enum definition and -[histograms.xml](./histograms.xml). +[histograms.xml](./histograms.xml). If a "max" value is included it +should not include an explicit value. ### Count Histograms @@ -162,7 +169,7 @@ Histogram descriptions should clearly state when the histogram is emitted (profile open? network request received? etc.). -### Owners +### Owners Histograms need to be owned by a person or set of people. These indicate who the current experts on this metric are. Being the owner means you are
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 0191421..a3ef4ae2 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -3364,7 +3364,7 @@ the data after and then submitted, we would only emit one "Submitted with server suggestion filled (once)"; - The submission segmentation works by checking what kind of data was last filled for this type of form in - the page load. So, if I user initially filled with local data and after that + the page load. So, if a user initially filled with local data and after that filled with server, we will only emit "Submitted with server suggestion filled (once)". </details> @@ -3383,7 +3383,27 @@ the data after and then submitted, we would only emit one "Submitted with server suggestion filled (once)"; - The submission segmentation works by checking what kind of data was last filled for this type of form in - the page load. So, if I user initially filled with local data and after that + the page load. So, if a user initially filled with local data and after that + filled with server, we will only emit "Submitted with server suggestion + filled (once)". + </details> +</histogram> + +<histogram name="Autofill.FormEvents.CreditCard.OnNonsecurePage" + enum="AutofillFormEvent"> + <owner>estark@chromium.org</owner> + <summary> + Autofill form events for credit card forms on nonsecure pages. These are + recorded when the user interacts with a form requesting a credit card. + </summary> + <details> + Important caveat about submission metrics: - Submission using autofill data + is determined by simply evaluating if there was a fill operation in this + page. So, if the user filled with local data, completed erased or modified + the data after and then submitted, we would only emit one "Submitted + with server suggestion filled (once)"; - The submission segmentation + works by checking what kind of data was last filled for this type of form in + the page load. So, if a user initially filled with local data and after that filled with server, we will only emit "Submitted with server suggestion filled (once)". </details> @@ -24389,6 +24409,13 @@ </summary> </histogram> +<histogram name="Media.Audio.Capture.Win.Open" enum="AudioStreamOpenResult"> + <owner>tommi@chromium.org</owner> + <summary> + Success/error cases for opening an audio input stream on Windows. + </summary> +</histogram> + <histogram name="Media.Audio.InputBufferSizeWasChangedAudioWorkedMac" enum="BooleanChanged"> <owner>henrika@chromium.org</owner> @@ -39812,8 +39839,8 @@ <owner>justincohen@chromium.org</owner> <owner>newt@chromium.org</owner> <summary> - Histogram for user clicks of the most visited thumbnails. The value is equal - to the index of the thumbnail. + Histogram for user clicks of the most visited tile. The value is equal to + the index of the tile. </summary> </histogram> @@ -45808,6 +45835,14 @@ <summary>When a Payment Request gets initiated by the user.</summary> </histogram> +<histogram name="PaymentRequest.CheckoutFunnel.NoShow" + enum="PaymentRequestNoShowReason"> + <owner>sebsg@chromium.org</owner> + <summary> + The reason that leads to the Payment Request not being shown to the user. + </summary> +</histogram> + <histogram name="PaymentRequest.CheckoutFunnel.PayClicked" enum="BooleanHit"> <owner>sebsg@chromium.org</owner> <summary> @@ -45877,6 +45912,26 @@ </summary> </histogram> +<histogram + name="PaymentRequest.UserDidNotHaveSuggestionsForEverything.EffectOnCompletion" + enum="PaymentRequestFlowCompletionStatus"> + <owner>sebsg@chromium.org</owner> + <summary> + Whether the flow was completed when the user did not have suggestions + offered for each requested information. + </summary> +</histogram> + +<histogram + name="PaymentRequest.UserHadSuggestionsForEverything.EffectOnCompletion" + enum="PaymentRequestFlowCompletionStatus"> + <owner>sebsg@chromium.org</owner> + <summary> + Whether the flow was completed when the user had suggestions offered for + each requested information. + </summary> +</histogram> + <histogram name="PDF.DocumentFeature" enum="PDFFeatures"> <owner>tsergeant@chromium.org</owner> <summary> @@ -52734,6 +52789,24 @@ </summary> </histogram> +<histogram name="PushMessaging.UnregistrationGCMResult" enum="GCMClientResult"> + <owner>johnme@google.com</owner> + <summary> + When unregistering a legacy non-InstanceID push messaging subscription, this + records the result returned by the GCMDriver (note that exceeding the + maximum number of retries due to network errors is logged as SERVER_ERROR). + </summary> +</histogram> + +<histogram name="PushMessaging.UnregistrationIIDResult" enum="InstanceIDResult"> + <owner>johnme@google.com</owner> + <summary> + When unregistering an InstanceID push messaging subscription, this records + the result returned from deleting the InstanceID (note that exceeding the + maximum number of retries due to network errors is logged as SERVER_ERROR). + </summary> +</histogram> + <histogram name="PushMessaging.UnregistrationReason" enum="PushUnregistrationReason"> <owner>johnme@google.com</owner> @@ -54814,6 +54887,14 @@ </summary> </histogram> +<histogram name="ResourcePrefetchPredictor.LearningCount" units="urls"> + <owner>alexilin@chromium.org</owner> + <summary> + When the prefetch predictor has resources in the local database for a given + navigation, the count of predicted urls. + </summary> +</histogram> + <histogram name="ResourcePrefetchPredictor.LearningPrecision" units="%"> <owner>lizeb@chromium.org</owner> <summary> @@ -54978,6 +55059,15 @@ </summary> </histogram> +<histogram name="ResourcePrefetchPredictor.PrefetchingDuration" units="ms"> + <owner>alexilin@chromium.org</owner> + <summary> + Amount of time available for prefetching. Specifically, this is a time + interval between corresponding StartPrefetching() and StopPrefetching() + calls. This is recorded for both prefetched and non-prefetched pages. + </summary> +</histogram> + <histogram name="ResourcePrefetchPredictor.ReportingEvent" enum="ResourcePrefetchPredictorReportingEvent"> <owner>alexilin@chromium.org</owner> @@ -79153,6 +79243,23 @@ <int value="12" label="384 kHz"/> </enum> +<enum name="AudioStreamOpenResult" type="int"> + <int value="0" label="OK"/> + <int value="1" label="CREATE_INSTANCE"/> + <int value="2" label="NO_ENDPOINT"/> + <int value="3" label="NO_STATE"/> + <int value="4" label="DEVICE_NOT_ACTIVE"/> + <int value="5" label="ACTIVATION_FAILED"/> + <int value="6" label="FORMAT_NOT_SUPPORTED"/> + <int value="7" label="AUDIO_CLIENT_INIT_FAILED"/> + <int value="8" label="GET_BUFFER_SIZE_FAILED"/> + <int value="9" label="LOOPBACK_ACTIVATE_FAILED"/> + <int value="10" label="LOOPBACK_INIT_FAILED"/> + <int value="11" label="SET_EVENT_HANDLE"/> + <int value="12" label="NO_CAPTURE_CLIENT"/> + <int value="13" label="NO_AUDIO_VOLUME"/> +</enum> + <enum name="AudioThreadStatus" type="int"> <int value="0" label="None"/> <int value="1" label="Started"/> @@ -92766,6 +92873,17 @@ <int value="6" label="Zero ID or token"/> </enum> +<enum name="GCMClientResult" type="int"> + <int value="0" label="Success"/> + <int value="1" label="Invalid parameter"/> + <int value="2" label="GCM disabled"/> + <int value="3" label="Async operation pending"/> + <int value="4" label="Network error"/> + <int value="5" label="Server error"/> + <int value="6" label="TTL exceeded"/> + <int value="7" label="Unknown error"/> +</enum> + <enum name="GCMConnectionResetReason" type="int"> <int value="0" label="Login failure"/> <int value="1" label="Close command"/> @@ -94714,6 +94832,18 @@ <int value="63" label="DELETE_OLD_VERSIONS_TOO_MANY_ATTEMPTS"/> </enum> +<enum name="InstanceIDResult" type="int"> + <int value="0" label="Success"/> + <int value="1" label="Invalid parameter"/> + <int value="2" label="GCM disabled"/> + <int value="3" label="Async operation pending"/> + <int value="4" label="Network error"/> + <int value="5" label="Server error"/> +<!-- 6 is omitted, in case we ever merge this enum with GCMClientResult. --> + + <int value="7" label="Unknown error"/> +</enum> + <enum name="InstantAppsCallSource" type="int"> <int value="1" label="Loading screen"/> <int value="2" label="Notification"/> @@ -101878,8 +102008,8 @@ <int value="3" label="MojoConnectionError"/> <int value="4" label="MojoRendererClosing"/> <int value="5" label="InstrumentDetailsError"/> - <int value="6" label="NoMatchingPaymentMethod"/> - <int value="7" label="NoSupportedPaymentMethod"/> + <int value="6" label="NoMatchingPaymentMethod - Deprecated"/> + <int value="7" label="NoSupportedPaymentMethod - Deprecated"/> <int value="8" label="Other"/> </enum> @@ -101897,6 +102027,11 @@ <int value="1" label="Aborted"/> </enum> +<enum name="PaymentRequestNoShowReason" type="int"> + <int value="0" label="NoMatchingPaymentMethod"/> + <int value="1" label="NoSupportedPaymentMethod"/> +</enum> + <enum name="PaymentRequestPaymentMethods" type="int"> <int value="0" label="Autofill credit cards"/> <int value="1" label="Android Pay"/> @@ -116075,6 +116210,17 @@ <affected-histogram name="OOBE.ErrorScreensTime.Update"/> </histogram_suffixes> +<histogram_suffixes name="NewTabPageIconTypes" separator="."> + <suffix name="IconsColor" + label="Icons using a fallback color (favicon resolution too low)."/> + <suffix name="IconsGray" + label="Icons using a gray color (no favicon available)."/> + <suffix name="IconsReal" + label="Icons using an actual icon published by the site."/> + <affected-histogram name="NewTabPage.MostVisited"/> + <affected-histogram name="NewTabPage.SuggestionsImpression"/> +</histogram_suffixes> + <histogram_suffixes name="NewTabPageProviders" separator="."> <suffix name="client" label="Suggestions coming from the client."/> <suffix name="server" label="Suggestions coming from the server."/>
diff --git a/tools/perf/generate_perf_json.py b/tools/perf/generate_perf_json.py index eb51463..78a9e4b 100755 --- a/tools/perf/generate_perf_json.py +++ b/tools/perf/generate_perf_json.py
@@ -323,7 +323,7 @@ 'chromium-rel-win7-gpu-ati', 'win', swarming=[ { - 'gpu': '1002:6779', + 'gpu': '1002:6613', 'os': 'Windows-2008ServerR2-SP1', 'device_ids': [ 'build101-m1', 'build102-m1',
diff --git a/ui/aura/window_tree_host_platform.cc b/ui/aura/window_tree_host_platform.cc index 84cb477..54e820e 100644 --- a/ui/aura/window_tree_host_platform.cc +++ b/ui/aura/window_tree_host_platform.cc
@@ -42,12 +42,12 @@ : WindowTreeHostPlatform() { CreateCompositor(); #if defined(USE_OZONE) - window_ = + platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); #elif defined(OS_WIN) - window_.reset(new ui::WinWindow(this, bounds)); + platform_window_.reset(new ui::WinWindow(this, bounds)); #elif defined(OS_ANDROID) - window_.reset(new ui::PlatformWindowAndroid(this)); + platform_window_.reset(new ui::PlatformWindowAndroid(this)); #else NOTIMPLEMENTED(); #endif @@ -65,13 +65,13 @@ void WindowTreeHostPlatform::SetPlatformWindow( std::unique_ptr<ui::PlatformWindow> window) { - window_ = std::move(window); + platform_window_ = std::move(window); } WindowTreeHostPlatform::~WindowTreeHostPlatform() { DestroyCompositor(); DestroyDispatcher(); - window_->Close(); + platform_window_->Close(); } ui::EventSource* WindowTreeHostPlatform::GetEventSource() { @@ -83,31 +83,31 @@ } void WindowTreeHostPlatform::ShowImpl() { - window_->Show(); + platform_window_->Show(); } void WindowTreeHostPlatform::HideImpl() { - window_->Hide(); + platform_window_->Hide(); } gfx::Rect WindowTreeHostPlatform::GetBoundsInPixels() const { - return window_ ? window_->GetBounds() : gfx::Rect(); + return platform_window_ ? platform_window_->GetBounds() : gfx::Rect(); } void WindowTreeHostPlatform::SetBoundsInPixels(const gfx::Rect& bounds) { - window_->SetBounds(bounds); + platform_window_->SetBounds(bounds); } gfx::Point WindowTreeHostPlatform::GetLocationOnScreenInPixels() const { - return window_->GetBounds().origin(); + return platform_window_->GetBounds().origin(); } void WindowTreeHostPlatform::SetCapture() { - window_->SetCapture(); + platform_window_->SetCapture(); } void WindowTreeHostPlatform::ReleaseCapture() { - window_->ReleaseCapture(); + platform_window_->ReleaseCapture(); } void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) { @@ -120,12 +120,12 @@ cursor_loader.SetPlatformCursor(&cursor); #endif - window_->SetCursor(cursor.platform()); + platform_window_->SetCursor(cursor.platform()); } void WindowTreeHostPlatform::MoveCursorToScreenLocationInPixels( const gfx::Point& location_in_pixels) { - window_->MoveCursorTo(location_in_pixels); + platform_window_->MoveCursorTo(location_in_pixels); } void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) {
diff --git a/ui/aura/window_tree_host_platform.h b/ui/aura/window_tree_host_platform.h index 7cc90a52..0734078 100644 --- a/ui/aura/window_tree_host_platform.h +++ b/ui/aura/window_tree_host_platform.h
@@ -50,7 +50,7 @@ explicit WindowTreeHostPlatform(std::unique_ptr<WindowPort> window_port); void SetPlatformWindow(std::unique_ptr<ui::PlatformWindow> window); - ui::PlatformWindow* platform_window() { return window_.get(); } + ui::PlatformWindow* platform_window() { return platform_window_.get(); } // ui::PlatformWindowDelegate: void OnBoundsChanged(const gfx::Rect& new_bounds) override; @@ -67,7 +67,7 @@ private: gfx::AcceleratedWidget widget_; - std::unique_ptr<ui::PlatformWindow> window_; + std::unique_ptr<ui::PlatformWindow> platform_window_; gfx::NativeCursor current_cursor_; gfx::Rect bounds_;
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index ee88f865..456ee7a 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc
@@ -68,11 +68,7 @@ // DialogClientView, public: DialogClientView::DialogClientView(Widget* owner, View* contents_view) - : ClientView(owner, contents_view), - ok_button_(nullptr), - cancel_button_(nullptr), - extra_view_(nullptr), - delegate_allowed_close_(false) { + : ClientView(owner, contents_view) { button_row_insets_ = ViewsDelegate::GetInstance() ? ViewsDelegate::GetInstance()->GetDialogButtonInsets() @@ -192,6 +188,8 @@ size.Enlarge(0, contents_size.height()); size.set_width(std::max(size.width(), contents_size.width())); + size.SetToMax(minimum_size_); + return size; }
diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h index 1d2b3de..442e1bc8 100644 --- a/ui/views/window/dialog_client_view.h +++ b/ui/views/window/dialog_client_view.h
@@ -64,6 +64,8 @@ button_row_insets_ = insets; } + void set_minimum_size(const gfx::Size& size) { minimum_size_ = size; } + protected: // For testing. explicit DialogClientView(View* contents_view); @@ -103,25 +105,29 @@ // buttons/extra view. int GetButtonsAndExtraViewRowTopPadding() const; - // How much to inset the button row. - gfx::Insets button_row_insets_; - // Sets up the focus chain for the child views. This is required since the // delegate may choose to add/remove views at any time. void SetupFocusChain(); + // How much to inset the button row. + gfx::Insets button_row_insets_; + + // The minimum size of this dialog, regardless of the size of its content + // view. + gfx::Size minimum_size_; + // The dialog buttons. - LabelButton* ok_button_; - LabelButton* cancel_button_; + LabelButton* ok_button_ = nullptr; + LabelButton* cancel_button_ = nullptr; // The extra view shown in the row of buttons; may be NULL. - View* extra_view_; + View* extra_view_ = nullptr; // True if we've notified the delegate the window is closing and the delegate // allowed the close. In some situations it's possible to get two closes (see // http://crbug.com/71940). This is used to avoid notifying the delegate // twice, which can have bad consequences. - bool delegate_allowed_close_; + bool delegate_allowed_close_ = false; DISALLOW_COPY_AND_ASSIGN(DialogClientView); };
diff --git a/ui/web_dialogs/BUILD.gn b/ui/web_dialogs/BUILD.gn index 8f24d8e..9c56ea0 100644 --- a/ui/web_dialogs/BUILD.gn +++ b/ui/web_dialogs/BUILD.gn
@@ -26,7 +26,7 @@ ] if (!is_ios) { - deps += [ "//third_party/WebKit/public:blink_minimal" ] + deps += [ "//third_party/WebKit/public:blink_headers" ] } }
diff --git a/ui/web_dialogs/DEPS b/ui/web_dialogs/DEPS index 0c30349..d988b2f 100644 --- a/ui/web_dialogs/DEPS +++ b/ui/web_dialogs/DEPS
@@ -1,7 +1,6 @@ include_rules = [ "+content/public", "+third_party/WebKit/public/platform/WebGestureEvent.h", - "+third_party/WebKit/public/platform/WebInputEvent.h", "+ui/base", "+ui/gfx", ]