diff --git a/DEPS b/DEPS index 9762bd6d..2c514b22 100644 --- a/DEPS +++ b/DEPS
@@ -40,7 +40,7 @@ # 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': 'd69e1827b90e778a2240a469c3873e7f7fb0c768', + 'skia_revision': '841101d348bbfae2ca44e0a0f267c974d38c9891', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -56,7 +56,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. - 'buildtools_revision': 'b3771b1935ea74c388b6fb1750e83f5d83b39dec', + 'buildtools_revision': '95345544a05894b57398f60c16f6bd73eeb14eda', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # 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': 'c36fe07a4d800cab2bfbec95e8580ea2b0e406d2', + 'pdfium_revision': '8f03b422ed85180ac24fc76ba0fcf7de3556679f', # 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. @@ -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': 'd125684594a0cfca4845810fafd97530bf70587f', + 'catapult_revision': '6d919a03509eeae17a481eced499d5de6837d57e', # 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/OWNERS b/android_webview/OWNERS index 02610d0..cec0a5986 100644 --- a/android_webview/OWNERS +++ b/android_webview/OWNERS
@@ -3,3 +3,5 @@ sgurun@chromium.org tobiasjs@chromium.org torne@chromium.org + +# COMPONENT: Mobile>WebView
diff --git a/ash/DEPS b/ash/DEPS index e62e79c..56a7abe 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -10,6 +10,7 @@ "+gpu/config", "+media", "+mojo/public", + "+services/preferences/public", "+services/service_manager/public", "+services/ui/public", "+skia/ext",
diff --git a/ash/accelerators/accelerator_controller_delegate_aura.cc b/ash/accelerators/accelerator_controller_delegate_aura.cc index 451ffe05..a66d0a63 100644 --- a/ash/accelerators/accelerator_controller_delegate_aura.cc +++ b/ash/accelerators/accelerator_controller_delegate_aura.cc
@@ -73,7 +73,7 @@ void Click() override { if (!WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()) - WmShell::Get()->delegate()->OpenKeyboardShortcutHelpPage(); + Shell::Get()->shell_delegate()->OpenKeyboardShortcutHelpPage(); } private: @@ -475,7 +475,7 @@ new message_center::Notification( message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, base::string16(), message, - WmShell::Get()->delegate()->GetDeprecatedAcceleratorImage(), + Shell::Get()->shell_delegate()->GetDeprecatedAcceleratorImage(), base::string16(), GURL(), message_center::NotifierId( message_center::NotifierId::SYSTEM_COMPONENT,
diff --git a/ash/aura/wm_shell_aura.cc b/ash/aura/wm_shell_aura.cc index fd70e3f6..92c4bd8 100644 --- a/ash/aura/wm_shell_aura.cc +++ b/ash/aura/wm_shell_aura.cc
@@ -47,14 +47,9 @@ namespace ash { -WmShellAura::WmShellAura(std::unique_ptr<ShellDelegate> shell_delegate) - : WmShell(std::move(shell_delegate)) { - WmShell::Set(this); -} +WmShellAura::WmShellAura() {} -WmShellAura::~WmShellAura() { - WmShell::Set(nullptr); -} +WmShellAura::~WmShellAura() {} void WmShellAura::Shutdown() { if (added_display_observer_)
diff --git a/ash/aura/wm_shell_aura.h b/ash/aura/wm_shell_aura.h index ae1b8cd..509b940f 100644 --- a/ash/aura/wm_shell_aura.h +++ b/ash/aura/wm_shell_aura.h
@@ -20,7 +20,7 @@ class ASH_EXPORT WmShellAura : public WmShell, public WindowTreeHostManager::Observer { public: - explicit WmShellAura(std::unique_ptr<ShellDelegate> shell_delegate); + WmShellAura(); ~WmShellAura() override; static WmShellAura* Get();
diff --git a/ash/common/DEPS b/ash/common/DEPS index 038605e3..934eeb3 100644 --- a/ash/common/DEPS +++ b/ash/common/DEPS
@@ -1,7 +1,6 @@ include_rules = [ "+components/prefs", "+mojo/public/cpp", - "+services/preferences/public", "+ui", ]
diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc index 944245e..89c946f 100644 --- a/ash/common/accelerators/accelerator_controller.cc +++ b/ash/common/accelerators/accelerator_controller.cc
@@ -144,7 +144,7 @@ } bool CanHandleNewIncognitoWindow() { - return WmShell::Get()->delegate()->IsIncognitoAllowed(); + return Shell::Get()->shell_delegate()->IsIncognitoAllowed(); } void HandleNewIncognitoWindow() { @@ -414,7 +414,7 @@ } bool CanHandleCycleUser() { - return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && + return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() && WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; } @@ -1110,7 +1110,7 @@ actions_allowed_at_lock_screen_.end()) { return RESTRICTION_PREVENT_PROCESSING; } - if (wm_shell->delegate()->IsRunningInForcedAppMode() && + if (Shell::Get()->shell_delegate()->IsRunningInForcedAppMode() && actions_allowed_in_app_mode_.find(action) == actions_allowed_in_app_mode_.end()) { return RESTRICTION_PREVENT_PROCESSING;
diff --git a/ash/common/accelerators/debug_commands.cc b/ash/common/accelerators/debug_commands.cc index 58633fba..2712e40 100644 --- a/ash/common/accelerators/debug_commands.cc +++ b/ash/common/accelerators/debug_commands.cc
@@ -107,7 +107,7 @@ Shell::GetInstance()->wallpaper_controller(); switch (++index % 4) { case 0: - ash::WmShell::Get()->wallpaper_delegate()->InitializeWallpaper(); + Shell::Get()->wallpaper_delegate()->InitializeWallpaper(); break; case 1: wallpaper_controller->SetWallpaperImage( @@ -129,12 +129,12 @@ void HandleToggleTouchpad() { base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad")); - ash::WmShell::Get()->delegate()->ToggleTouchpad(); + Shell::Get()->shell_delegate()->ToggleTouchpad(); } void HandleToggleTouchscreen() { base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen")); - ShellDelegate* delegate = WmShell::Get()->delegate(); + ShellDelegate* delegate = Shell::Get()->shell_delegate(); delegate->SetTouchscreenEnabledInPrefs( !delegate->IsTouchscreenEnabledInPrefs(false /* use_local_state */), false /* use_local_state */);
diff --git a/ash/common/accelerators/exit_warning_handler.cc b/ash/common/accelerators/exit_warning_handler.cc index 396c4d9..d65e3a7 100644 --- a/ash/common/accelerators/exit_warning_handler.cc +++ b/ash/common/accelerators/exit_warning_handler.cc
@@ -116,7 +116,7 @@ CancelTimer(); Hide(); WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q); - WmShell::Get()->delegate()->Exit(); + Shell::Get()->shell_delegate()->Exit(); break; case EXITING: break;
diff --git a/ash/common/shelf/shelf_view.cc b/ash/common/shelf/shelf_view.cc index 7f712b4..6250d55 100644 --- a/ash/common/shelf/shelf_view.cc +++ b/ash/common/shelf/shelf_view.cc
@@ -25,6 +25,7 @@ #include "ash/common/wm/root_window_finder.h" #include "ash/common/wm_shell.h" #include "ash/common/wm_window.h" +#include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "base/auto_reset.h" #include "base/memory/ptr_util.h" @@ -1639,7 +1640,7 @@ } std::unique_ptr<ui::MenuModel> context_menu_model( - WmShell::Get()->delegate()->CreateContextMenu(wm_shelf_, item)); + Shell::Get()->shell_delegate()->CreateContextMenu(wm_shelf_, item)); if (!context_menu_model) return;
diff --git a/ash/common/shutdown_controller.cc b/ash/common/shutdown_controller.cc index b40fe86..98c3dae 100644 --- a/ash/common/shutdown_controller.cc +++ b/ash/common/shutdown_controller.cc
@@ -5,7 +5,7 @@ #include "ash/common/shutdown_controller.h" #include "ash/common/shell_delegate.h" -#include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "base/sys_info.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_manager_client.h" @@ -19,7 +19,7 @@ void ShutdownController::ShutDownOrReboot() { // For developers on Linux desktop just exit the app. if (!base::SysInfo::IsRunningOnChromeOS()) { - WmShell::Get()->delegate()->Exit(); + Shell::Get()->shell_delegate()->Exit(); return; }
diff --git a/ash/common/system/chromeos/screen_security/screen_tray_item.cc b/ash/common/system/chromeos/screen_security/screen_tray_item.cc index 8c0ebae..1263aec2 100644 --- a/ash/common/system/chromeos/screen_security/screen_tray_item.cc +++ b/ash/common/system/chromeos/screen_security/screen_tray_item.cc
@@ -4,18 +4,15 @@ #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" -#include "ash/common/material_design/material_design_controller.h" -#include "ash/common/shelf/wm_shelf_util.h" -#include "ash/common/system/tray/fixed_sized_image_view.h" +#include "ash/common/system/tray/system_tray.h" #include "ash/common/system/tray/tray_constants.h" #include "ash/common/system/tray/tray_popup_item_style.h" #include "ash/common/system/tray/tray_popup_utils.h" -#include "ash/resources/grit/ash_resources.h" #include "ash/resources/vector_icons/vector_icons.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/message_center/message_center.h" #include "ui/views/controls/button/label_button.h" +#include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/fill_layout.h" @@ -26,14 +23,8 @@ ScreenTrayView::ScreenTrayView(ScreenTrayItem* screen_tray_item) : TrayItemView(screen_tray_item), screen_tray_item_(screen_tray_item) { CreateImageView(); - if (MaterialDesignController::UseMaterialDesignSystemIcons()) { - image_view()->SetImage( - gfx::CreateVectorIcon(kSystemTrayScreenShareIcon, kTrayIconColor)); - } else { - image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() - .GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE) - .ToImageSkia()); - } + image_view()->SetImage( + gfx::CreateVectorIcon(kSystemTrayScreenShareIcon, kTrayIconColor)); Update(); } @@ -83,18 +74,10 @@ } void ScreenStatusView::CreateItems() { - const bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial(); icon_ = TrayPopupUtils::CreateMainImageView(); icon_->SetImage(gfx::CreateVectorIcon( kSystemMenuScreenShareIcon, TrayPopupItemStyle::GetIconColor( TrayPopupItemStyle::ColorStyle::ACTIVE))); - if (!use_md) { - set_background(views::Background::CreateSolidBackground(kBackgroundColor)); - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - icon_->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SCREENSHARE_DARK) - .ToImageSkia()); - } - label_ = TrayPopupUtils::CreateDefaultLabel(); label_->SetMultiLine(true); label_->SetText(label_text_);
diff --git a/ash/common/system/chromeos/screen_security/screen_tray_item.h b/ash/common/system/chromeos/screen_security/screen_tray_item.h index 5ed992a..eb4619d 100644 --- a/ash/common/system/chromeos/screen_security/screen_tray_item.h +++ b/ash/common/system/chromeos/screen_security/screen_tray_item.h
@@ -7,21 +7,20 @@ #include <string> -#include "ash/common/system/tray/system_tray.h" #include "ash/common/system/tray/system_tray_item.h" #include "ash/common/system/tray/tray_item_view.h" -#include "ash/common/system/tray/tray_notification_view.h" #include "base/macros.h" #include "ui/message_center/notification_delegate.h" #include "ui/views/controls/button/button.h" -#include "ui/views/controls/image_view.h" +#include "ui/views/view.h" namespace views { -class View; +class ImageView; } namespace ash { class ScreenTrayItem; +class SystemTray; namespace tray {
diff --git a/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc b/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc index 764b2f4..2e00fc5 100644 --- a/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc +++ b/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc
@@ -6,6 +6,7 @@ #include "ash/common/system/chromeos/screen_security/screen_capture_tray_item.h" #include "ash/common/system/chromeos/screen_security/screen_share_tray_item.h" +#include "ash/common/system/tray/system_tray.h" #include "ash/common/system/tray/system_tray_notifier.h" #include "ash/common/system/tray/tray_item_view.h" #include "ash/common/test/ash_test.h"
diff --git a/ash/common/system/user/tray_user_unittest.cc b/ash/common/system/user/tray_user_unittest.cc index 70c0423..f8db548 100644 --- a/ash/common/system/user/tray_user_unittest.cc +++ b/ash/common/system/user/tray_user_unittest.cc
@@ -10,7 +10,7 @@ #include "ash/common/system/user/tray_user.h" #include "ash/common/system/user/user_view.h" #include "ash/common/test/test_session_state_delegate.h" -#include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/ash_test_helper.h" #include "ash/test/test_shell_delegate.h" @@ -74,7 +74,7 @@ // after everything was created. delegate_->set_logged_in_users(users_logged_in); test::TestShellDelegate* shell_delegate = - static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); + static_cast<test::TestShellDelegate*>(Shell::Get()->shell_delegate()); shell_delegate->set_multi_profiles_enabled(multiprofile); // Instead of using the existing tray panels we create new ones which makes
diff --git a/ash/common/system/user/user_view.cc b/ash/common/system/user/user_view.cc index 63d1c42c..a21dff09c 100644 --- a/ash/common/system/user/user_view.cc +++ b/ash/common/system/user/user_view.cc
@@ -26,6 +26,7 @@ #include "ash/resources/grit/ash_resources.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/root_window_controller.h" +#include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "base/memory/ptr_util.h" #include "components/signin/core/account_id/account_id.h" @@ -60,7 +61,7 @@ } bool IsMultiProfileSupportedAndUserActive() { - return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && + return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() && !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked(); }
diff --git a/ash/common/wallpaper/wallpaper_controller.cc b/ash/common/wallpaper/wallpaper_controller.cc index 8c1420af..ac10132 100644 --- a/ash/common/wallpaper/wallpaper_controller.cc +++ b/ash/common/wallpaper/wallpaper_controller.cc
@@ -234,7 +234,7 @@ void WallpaperController::OpenSetWallpaperPage() { if (wallpaper_picker_ && - WmShell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage()) { + Shell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage()) { wallpaper_picker_->Open(); } } @@ -326,7 +326,7 @@ void WallpaperController::UpdateWallpaper(bool clear_cache) { current_wallpaper_.reset(); - WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); + Shell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); } void WallpaperController::SetProminentColor(SkColor color) {
diff --git a/ash/common/wallpaper/wallpaper_controller_unittest.cc b/ash/common/wallpaper/wallpaper_controller_unittest.cc index 007cb89..766292d 100644 --- a/ash/common/wallpaper/wallpaper_controller_unittest.cc +++ b/ash/common/wallpaper/wallpaper_controller_unittest.cc
@@ -118,7 +118,7 @@ root_window_controller->SetAnimatingWallpaperWidgetController(nullptr); controller_ = Shell::GetInstance()->wallpaper_controller(); wallpaper_delegate_ = static_cast<test::TestWallpaperDelegate*>( - WmShell::Get()->wallpaper_delegate()); + Shell::Get()->wallpaper_delegate()); controller_->set_wallpaper_reload_delay_for_test(0); }
diff --git a/ash/common/wallpaper/wallpaper_view.cc b/ash/common/wallpaper/wallpaper_view.cc index 2233d57..4156437 100644 --- a/ash/common/wallpaper/wallpaper_view.cc +++ b/ash/common/wallpaper/wallpaper_view.cc
@@ -195,7 +195,7 @@ views::Widget* CreateWallpaper(WmWindow* root_window, int container_id) { WallpaperController* controller = Shell::GetInstance()->wallpaper_controller(); - WallpaperDelegate* wallpaper_delegate = WmShell::Get()->wallpaper_delegate(); + WallpaperDelegate* wallpaper_delegate = Shell::Get()->wallpaper_delegate(); views::Widget* wallpaper_widget = new views::Widget; views::Widget::InitParams params(
diff --git a/ash/common/wallpaper/wallpaper_widget_controller.cc b/ash/common/wallpaper/wallpaper_widget_controller.cc index 506cea9..32a537bb8 100644 --- a/ash/common/wallpaper/wallpaper_widget_controller.cc +++ b/ash/common/wallpaper/wallpaper_widget_controller.cc
@@ -6,9 +6,9 @@ #include "ash/ash_export.h" #include "ash/common/wallpaper/wallpaper_delegate.h" -#include "ash/common/wm_shell.h" #include "ash/common/wm_window.h" #include "ash/root_window_controller.h" +#include "ash/shell.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/views/widget/widget.h" @@ -119,7 +119,7 @@ widget_->GetLayer()->GetAnimator()); settings.AddObserver(new ShowWallpaperAnimationObserver( root_window_controller, widget_, - WmShell::Get()->wallpaper_delegate()->ShouldShowInitialAnimation())); + Shell::Get()->wallpaper_delegate()->ShouldShowInitialAnimation())); // When |widget_| shows, AnimateShowWindowCommon() is called to do the // animation. Sets transition duration to 0 to avoid animating to the // show animation's initial values.
diff --git a/ash/common/wm/focus_rules.cc b/ash/common/wm/focus_rules.cc index e0634e62..5bbc224a 100644 --- a/ash/common/wm/focus_rules.cc +++ b/ash/common/wm/focus_rules.cc
@@ -6,9 +6,9 @@ #include "ash/common/shell_delegate.h" #include "ash/common/wm/window_state.h" -#include "ash/common/wm_shell.h" #include "ash/common/wm_window.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/shell.h" namespace ash { @@ -37,7 +37,7 @@ DCHECK(window); // If the |window| doesn't belong to the current active user and also doesn't // show for the current active user, then it should not be activated. - if (!WmShell::Get()->delegate()->CanShowWindowForUser(window)) + if (!Shell::Get()->shell_delegate()->CanShowWindowForUser(window)) return false; if (window->IsVisible())
diff --git a/ash/common/wm/maximize_mode/maximize_mode_controller.cc b/ash/common/wm/maximize_mode/maximize_mode_controller.cc index 3a80306..04b2a3c 100644 --- a/ash/common/wm/maximize_mode/maximize_mode_controller.cc +++ b/ash/common/wm/maximize_mode/maximize_mode_controller.cc
@@ -88,6 +88,7 @@ MaximizeModeController::MaximizeModeController() : have_seen_accelerometer_data_(false), + can_detect_lid_angle_(false), touchview_usage_interval_start_time_(base::Time::Now()), tick_clock_(new base::DefaultTickClock()), tablet_mode_switch_is_on_(false), @@ -174,10 +175,12 @@ void MaximizeModeController::OnAccelerometerUpdated( scoped_refptr<const chromeos::AccelerometerUpdate> update) { - bool first_accelerometer_update = !have_seen_accelerometer_data_; have_seen_accelerometer_data_ = true; + can_detect_lid_angle_ = + update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN) && + update->has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD); - if (!update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN)) + if (!can_detect_lid_angle_) return; if (!display::Display::HasInternalDisplay()) @@ -190,14 +193,11 @@ // Whether or not we enter maximize mode affects whether we handle screen // rotation, so determine whether to enter maximize mode first. - if (!update->has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD)) { - if (first_accelerometer_update) - EnterMaximizeMode(); - } else if (ui::IsAccelerometerReadingStable( - *update, chromeos::ACCELEROMETER_SOURCE_SCREEN) && - ui::IsAccelerometerReadingStable( - *update, chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD) && - IsAngleBetweenAccelerometerReadingsStable(*update)) { + if (ui::IsAccelerometerReadingStable(*update, + chromeos::ACCELEROMETER_SOURCE_SCREEN) && + ui::IsAccelerometerReadingStable( + *update, chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD) && + IsAngleBetweenAccelerometerReadingsStable(*update)) { // update.has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD) // Ignore the reading if it appears unstable. The reading is considered // unstable if it deviates too much from gravity and/or the magnitude of the @@ -224,8 +224,15 @@ display::Display::InternalDisplayId())) { return; } - if (on && !IsMaximizeModeWindowManagerEnabled()) + // The tablet mode switch activates at 300 degrees, so it is always reliable + // when |on|. However we wish to exit maximize mode at a smaller angle, so + // when |on| is false we ignore if it is possible to calculate the lid angle. + if (on && !IsMaximizeModeWindowManagerEnabled()) { EnterMaximizeMode(); + } else if (!on && IsMaximizeModeWindowManagerEnabled() && + !can_detect_lid_angle_) { + LeaveMaximizeMode(); + } } void MaximizeModeController::SuspendImminent() {
diff --git a/ash/common/wm/maximize_mode/maximize_mode_controller.h b/ash/common/wm/maximize_mode/maximize_mode_controller.h index 32650fe..69a30494 100644 --- a/ash/common/wm/maximize_mode/maximize_mode_controller.h +++ b/ash/common/wm/maximize_mode/maximize_mode_controller.h
@@ -153,6 +153,9 @@ // Whether we have ever seen accelerometer data. bool have_seen_accelerometer_data_; + // Whether both accelerometers are available. + bool can_detect_lid_angle_; + // Tracks time spent in (and out of) touchview mode. base::Time touchview_usage_interval_start_time_; base::TimeDelta total_touchview_time_;
diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc index 84215f33..a9b4463 100644 --- a/ash/common/wm_shell.cc +++ b/ash/common/wm_shell.cc
@@ -31,7 +31,6 @@ #include "ash/common/system/tray/system_tray_controller.h" #include "ash/common/system/tray/system_tray_delegate.h" #include "ash/common/system/tray/system_tray_notifier.h" -#include "ash/common/wallpaper/wallpaper_delegate.h" #include "ash/common/wm/immersive_context_ash.h" #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" #include "ash/common/wm/mru_window_tracker.h" @@ -46,9 +45,6 @@ #include "base/bind.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "services/preferences/public/cpp/pref_client_store.h" -#include "services/preferences/public/interfaces/preferences.mojom.h" -#include "services/service_manager/public/cpp/connector.h" #include "ui/app_list/presenter/app_list.h" #include "ui/display/display.h" @@ -58,15 +54,12 @@ WmShell* WmShell::instance_ = nullptr; WmShell::~WmShell() { + DCHECK_EQ(this, instance_); + instance_ = nullptr; session_controller_->RemoveSessionStateObserver(this); } // static -void WmShell::Set(WmShell* instance) { - instance_ = instance; -} - -// static WmShell* WmShell::Get() { return instance_; } @@ -120,7 +113,8 @@ // about multi-profile login state. DCHECK(GetSessionStateDelegate()); DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); - shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model())); + shelf_delegate_.reset( + Shell::Get()->shell_delegate()->CreateShelfDelegate(shelf_model())); shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); } @@ -149,9 +143,8 @@ shelf_delegate_ = std::move(test_delegate); } -WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) - : delegate_(std::move(shell_delegate)), - app_list_(base::MakeUnique<app_list::AppList>()), +WmShell::WmShell() + : app_list_(base::MakeUnique<app_list::AppList>()), brightness_control_delegate_( base::MakeUnique<system::BrightnessControllerChromeos>()), cast_config_(base::MakeUnique<CastConfigController>()), @@ -169,19 +162,13 @@ system_tray_controller_(base::MakeUnique<SystemTrayController>()), system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), vpn_list_(base::MakeUnique<VpnList>()), - wallpaper_delegate_(delegate_->CreateWallpaperDelegate()), window_cycle_controller_(base::MakeUnique<WindowCycleController>()), window_selector_controller_( base::MakeUnique<WindowSelectorController>()) { + DCHECK(!instance_); + instance_ = this; session_controller_->AddSessionStateObserver(this); - prefs::mojom::PreferencesServiceFactoryPtr pref_factory_ptr; - // Can be null in tests. - if (!delegate_->GetShellConnector()) - return; - delegate_->GetShellConnector()->BindInterface(prefs::mojom::kServiceName, - &pref_factory_ptr); - pref_store_ = new preferences::PrefClientStore(std::move(pref_factory_ptr)); } RootWindowController* WmShell::GetPrimaryRootWindowController() { @@ -189,7 +176,7 @@ } bool WmShell::IsForceMaximizeOnFirstRun() { - return delegate()->IsForceMaximizeOnFirstRun(); + return Shell::Get()->shell_delegate()->IsForceMaximizeOnFirstRun(); } bool WmShell::IsSystemModalWindowOpen() {
diff --git a/ash/common/wm_shell.h b/ash/common/wm_shell.h index 2de95ba..ecf2d82b 100644 --- a/ash/common/wm_shell.h +++ b/ash/common/wm_shell.h
@@ -35,10 +35,6 @@ class Point; } -namespace preferences { -class PrefClientStore; -} - namespace views { class PointerWatcher; enum class PointerWatcherEventTypes; @@ -68,14 +64,12 @@ class ShelfDelegate; class ShelfModel; class ShelfWindowWatcher; -class ShellDelegate; struct ShellInitParams; class ShutdownController; class SystemTrayDelegate; class SystemTrayController; class SystemTrayNotifier; class VpnList; -class WallpaperDelegate; class WindowCycleController; class WindowCycleEventFilter; class WindowResizer; @@ -97,16 +91,11 @@ public: ~WmShell() override; - // This is necessary for a handful of places that is difficult to plumb - // through context. - static void Set(WmShell* instance); static WmShell* Get(); static bool HasInstance() { return instance_ != nullptr; } virtual void Shutdown(); - ShellDelegate* delegate() { return delegate_.get(); } - AcceleratorController* accelerator_controller() { return accelerator_controller_.get(); } @@ -147,8 +136,6 @@ return new_window_controller_.get(); } - preferences::PrefClientStore* pref_store() { return pref_store_.get(); } - SessionController* session_controller() { return session_controller_.get(); } ShelfController* shelf_controller() { return shelf_controller_.get(); } @@ -175,8 +162,6 @@ VpnList* vpn_list() { return vpn_list_.get(); } - WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } - WindowCycleController* window_cycle_controller() { return window_cycle_controller_.get(); } @@ -363,7 +348,7 @@ virtual void CreatePointerWatcherAdapter() = 0; protected: - explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); + WmShell(); // Called during startup to create the primary WindowTreeHost and // the corresponding RootWindowController. @@ -400,10 +385,6 @@ static WmShell* instance_; - std::unique_ptr<ShellDelegate> delegate_; - - scoped_refptr<preferences::PrefClientStore> pref_store_; - std::unique_ptr<AcceleratorController> accelerator_controller_; std::unique_ptr<app_list::AppList> app_list_; std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; @@ -428,7 +409,6 @@ std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; std::unique_ptr<VpnList> vpn_list_; - std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; std::unique_ptr<WindowCycleController> window_cycle_controller_; std::unique_ptr<WindowSelectorController> window_selector_controller_;
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc index f23863e..4d72c90 100644 --- a/ash/mus/bridge/wm_shell_mus.cc +++ b/ash/mus/bridge/wm_shell_mus.cc
@@ -115,18 +115,15 @@ WmShellMus::WmShellMus( WmWindow* primary_root_window, - std::unique_ptr<ShellDelegate> shell_delegate, WindowManager* window_manager, views::PointerWatcherEventRouter* pointer_watcher_event_router, bool create_session_state_delegate_stub) - : WmShell(std::move(shell_delegate)), - window_manager_(window_manager), + : window_manager_(window_manager), primary_root_window_(primary_root_window), pointer_watcher_event_router_(pointer_watcher_event_router) { if (create_session_state_delegate_stub) session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); DCHECK(primary_root_window_); - WmShell::Set(this); uint16_t accelerator_namespace_id = 0u; const bool add_result = @@ -146,7 +143,6 @@ } WmShellMus::~WmShellMus() { - WmShell::Set(nullptr); } // static
diff --git a/ash/mus/bridge/wm_shell_mus.h b/ash/mus/bridge/wm_shell_mus.h index fd73293..a6bb187 100644 --- a/ash/mus/bridge/wm_shell_mus.h +++ b/ash/mus/bridge/wm_shell_mus.h
@@ -39,7 +39,6 @@ // If |create_session_state_delegate_stub| is true SessionStateDelegateStub is // created. If false, the SessionStateDelegate from Shell is used. WmShellMus(WmWindow* primary_root_window, - std::unique_ptr<ShellDelegate> shell_delegate, WindowManager* window_manager, views::PointerWatcherEventRouter* pointer_watcher_event_router, bool create_session_state_delegate_stub);
diff --git a/ash/mus/context_menu_mus.cc b/ash/mus/context_menu_mus.cc index 802713086..b012596 100644 --- a/ash/mus/context_menu_mus.cc +++ b/ash/mus/context_menu_mus.cc
@@ -36,7 +36,7 @@ bool ContextMenuMus::IsCommandIdEnabled(int command_id) const { if (command_id == MENU_CHANGE_WALLPAPER) - return WmShell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage(); + return Shell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage(); return true; }
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc index 8818e3c..3476cc5 100644 --- a/ash/mus/window_manager.cc +++ b/ash/mus/window_manager.cc
@@ -195,10 +195,12 @@ ShellInitParams init_params; WmShellMus* wm_shell = new WmShellMus( WmWindow::Get(window_tree_host->window()), - shell_delegate_for_test_ ? std::move(shell_delegate_for_test_) - : base::MakeUnique<ShellDelegateMus>(connector_), this, pointer_watcher_event_router_.get(), create_session_state_delegate_stub_for_test_); + // Shell::CreateInstance() takes ownership of ShellDelegate. + init_params.delegate = shell_delegate_for_test_ + ? shell_delegate_for_test_.release() + : new ShellDelegateMus(connector_); init_params.primary_window_tree_host = window_tree_host.release(); init_params.wm_shell = wm_shell; init_params.blocking_pool = blocking_pool_.get();
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 87b54b4cb..b68c8849 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc
@@ -536,7 +536,7 @@ // Make sure the wallpaper is visible. system_wallpaper_->SetColor(SK_ColorBLACK); boot_splash_screen_.reset(); - WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); + Shell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); // Only removes old component when wallpaper animation finished. If we // remove the old one before the new wallpaper is done fading in there will // be a white flash during the animation. @@ -727,7 +727,7 @@ void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, ui::MenuSourceType source_type) { - ShellDelegate* delegate = WmShell::Get()->delegate(); + ShellDelegate* delegate = Shell::Get()->shell_delegate(); DCHECK(delegate); menu_model_.reset(delegate->CreateContextMenu(wm_shelf_.get(), nullptr)); if (!menu_model_)
diff --git a/ash/shell.cc b/ash/shell.cc index 95bf8f6..fad7db2d 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -110,6 +110,8 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/system/devicemode.h" #include "components/ui_devtools/devtools_server.h" +#include "services/preferences/public/cpp/pref_client_store.h" +#include "services/preferences/public/interfaces/preferences.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "services/ui/public/interfaces/constants.mojom.h" #include "ui/aura/client/aura_constants.h" @@ -199,15 +201,15 @@ CHECK(!instance_); WmShell* wm_shell = init_params.wm_shell; if (!wm_shell) - wm_shell = - new WmShellAura(base::WrapUnique<ShellDelegate>(init_params.delegate)); - instance_ = new Shell(base::WrapUnique<WmShell>(wm_shell)); + wm_shell = new WmShellAura(); + instance_ = new Shell(base::WrapUnique<ShellDelegate>(init_params.delegate), + base::WrapUnique<WmShell>(wm_shell)); instance_->Init(init_params); return instance_; } // static -Shell* Shell::GetInstance() { +Shell* Shell::Get() { CHECK(instance_); return instance_; } @@ -478,8 +480,10 @@ //////////////////////////////////////////////////////////////////////////////// // Shell, private: -Shell::Shell(std::unique_ptr<WmShell> wm_shell) +Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, + std::unique_ptr<WmShell> wm_shell) : wm_shell_(std::move(wm_shell)), + shell_delegate_(std::move(shell_delegate)), link_handler_model_factory_(nullptr), display_configurator_(new display::DisplayConfigurator()), native_cursor_manager_(nullptr), @@ -489,7 +493,7 @@ // state on WmShellAura. http://crbug.com/671246. if (!wm_shell_->IsRunningInMash()) { - gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport()); + gpu_support_.reset(shell_delegate_->CreateGPUSupport()); display_manager_.reset(ScreenAsh::CreateDisplayManager()); window_tree_host_manager_.reset(new WindowTreeHostManager); user_metrics_recorder_.reset(new UserMetricsRecorder); @@ -506,7 +510,7 @@ if (!is_mash) user_metrics_recorder_->OnShellShuttingDown(); - wm_shell_->delegate()->PreShutdown(); + shell_delegate_->PreShutdown(); // Remove the focus from any window. This will prevent overhead and side // effects (e.g. crashes) from changing focus during shutdown. @@ -661,6 +665,9 @@ // Needs to happen right before |instance_| is reset. wm_shell_.reset(); + wallpaper_delegate_.reset(); + pref_store_ = nullptr; + shell_delegate_.reset(); DCHECK(instance_ == this); instance_ = nullptr; @@ -671,11 +678,20 @@ blocking_pool_ = init_params.blocking_pool; + wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); + + // Can be null in tests. + if (shell_delegate_->GetShellConnector()) { + prefs::mojom::PreferencesServiceFactoryPtr pref_factory_ptr; + shell_delegate_->GetShellConnector()->BindInterface( + prefs::mojom::kServiceName, &pref_factory_ptr); + pref_store_ = new preferences::PrefClientStore(std::move(pref_factory_ptr)); + } + // Some delegates access WmShell during their construction. Create them here // instead of the WmShell constructor. - accessibility_delegate_.reset( - wm_shell_->delegate()->CreateAccessibilityDelegate()); - palette_delegate_ = wm_shell_->delegate()->CreatePaletteDelegate(); + accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate()); + palette_delegate_ = shell_delegate_->CreatePaletteDelegate(); toast_manager_ = base::MakeUnique<ToastManager>(); // Create the app list item in the shelf data model. @@ -718,7 +734,7 @@ new CursorManager(base::WrapUnique(native_cursor_manager_))); } - wm_shell_->delegate()->PreInit(); + shell_delegate_->PreInit(); bool display_initialized = true; if (!is_mash) { display_initialized = display_manager_->InitFromCommandLine(); @@ -870,10 +886,10 @@ AddShellObserver(lock_state_controller_.get()); // The connector is unavailable in some tests. - if (is_mash && wm_shell_->delegate()->GetShellConnector()) { + if (is_mash && shell_delegate_->GetShellConnector()) { ui::mojom::UserActivityMonitorPtr user_activity_monitor; - wm_shell_->delegate()->GetShellConnector()->BindInterface( - ui::mojom::kServiceName, &user_activity_monitor); + shell_delegate_->GetShellConnector()->BindInterface(ui::mojom::kServiceName, + &user_activity_monitor); user_activity_forwarder_ = base::MakeUnique<aura::UserActivityForwarder>( std::move(user_activity_monitor), user_activity_detector_.get()); } @@ -914,8 +930,7 @@ event_client_.reset(new EventClientImpl); - session_state_delegate_.reset( - wm_shell_->delegate()->CreateSessionStateDelegate()); + session_state_delegate_.reset(shell_delegate_->CreateSessionStateDelegate()); // Must occur after Shell has installed its early pre-target handlers (for // example, WindowModalityController). wm_shell_->CreatePointerWatcherAdapter(); @@ -924,7 +939,7 @@ shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); wm_shell_->SetSystemTrayDelegate( - base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate())); + base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); // Create AshTouchTransformController before // WindowTreeHostManager::InitDisplays() @@ -950,7 +965,7 @@ // Initialize the wallpaper after the RootWindowController has been created, // otherwise the widget will not paint when restoring after a browser crash. // Also, initialize after display initialization to ensure correct sizing. - wm_shell_->wallpaper_delegate()->InitializeWallpaper(); + wallpaper_delegate_->InitializeWallpaper(); if (cursor_manager_) { if (initially_hide_cursor_) @@ -994,9 +1009,8 @@ } } keyboard::KeyboardController::ResetInstance( - new keyboard::KeyboardController( - wm_shell_->delegate()->CreateKeyboardUI(), - virtual_keyboard_controller_.get())); + new keyboard::KeyboardController(shell_delegate_->CreateKeyboardUI(), + virtual_keyboard_controller_.get())); } }
diff --git a/ash/shell.h b/ash/shell.h index 32ac6ee..c95e5eb4 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -53,6 +53,10 @@ class Insets; } +namespace preferences { +class PrefClientStore; +} + namespace ui { class UserActivityDetector; class UserActivityPowerManagerNotifier; @@ -118,6 +122,7 @@ class ScreenPinningController; class ScreenPositionController; class SessionStateDelegate; +class ShellDelegate; struct ShellInitParams; class ShellObserver; class ShutdownObserver; @@ -133,6 +138,7 @@ class VideoActivityNotifier; class VideoDetector; class WallpaperController; +class WallpaperDelegate; class WebNotificationTray; class WindowPositioner; class WindowTreeHostManager; @@ -165,7 +171,10 @@ static Shell* CreateInstance(const ShellInitParams& init_params); // Should never be called before |CreateInstance()|. - static Shell* GetInstance(); + // TODO: deprecated. Use Get() instead. GetInstance() will be renamed close + // to branch point. + static Shell* GetInstance() { return Get(); } + static Shell* Get(); // Returns true if the ash shell has been instantiated. static bool HasInstance(); @@ -291,11 +300,14 @@ LockStateController* lock_state_controller() { return lock_state_controller_.get(); } + preferences::PrefClientStore* pref_store() { return pref_store_.get(); } PaletteDelegate* palette_delegate() { return palette_delegate_.get(); } + ShellDelegate* shell_delegate() { return shell_delegate_.get(); } VideoDetector* video_detector() { return video_detector_.get(); } WallpaperController* wallpaper_controller() { return wallpaper_controller_.get(); } + WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } WindowTreeHostManager* window_tree_host_manager() { return window_tree_host_manager_.get(); } @@ -487,7 +499,8 @@ friend class test::ShellTestApi; friend class shell::WindowWatcher; - explicit Shell(std::unique_ptr<WmShell> wm_shell); + Shell(std::unique_ptr<ShellDelegate> shell_delegate, + std::unique_ptr<WmShell> wm_shell); ~Shell() override; void Init(const ShellInitParams& init_params); @@ -542,11 +555,14 @@ std::unique_ptr<PaletteDelegate> palette_delegate_; std::unique_ptr<DragDropController> drag_drop_controller_; std::unique_ptr<ResizeShadowController> resize_shadow_controller_; + std::unique_ptr<ShellDelegate> shell_delegate_; std::unique_ptr<ToastManager> toast_manager_; std::unique_ptr<WallpaperController> wallpaper_controller_; + std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; std::unique_ptr<::wm::ShadowController> shadow_controller_; std::unique_ptr<::wm::VisibilityController> visibility_controller_; std::unique_ptr<::wm::WindowModalityController> window_modality_controller_; + scoped_refptr<preferences::PrefClientStore> pref_store_; std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; std::unique_ptr<views::corewm::TooltipController> tooltip_controller_; LinkHandlerModelFactory* link_handler_model_factory_;
diff --git a/ash/system/chromeos/power/tablet_power_button_controller.cc b/ash/system/chromeos/power/tablet_power_button_controller.cc index fcdf81b..9020e8a 100644 --- a/ash/system/chromeos/power/tablet_power_button_controller.cc +++ b/ash/system/chromeos/power/tablet_power_button_controller.cc
@@ -216,7 +216,7 @@ ->SetBacklightsForcedOff(forced_off); backlights_forced_off_ = forced_off; - ShellDelegate* delegate = WmShell::Get()->delegate(); + ShellDelegate* delegate = Shell::Get()->shell_delegate(); delegate->SetTouchscreenEnabledInPrefs(!forced_off, true /* use_local_state */); delegate->UpdateTouchscreenStatusFromPrefs();
diff --git a/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc b/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc index 8a2df30..3f06a50 100644 --- a/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc +++ b/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc
@@ -67,7 +67,7 @@ tablet_controller_->SetTickClockForTesting( std::unique_ptr<base::TickClock>(tick_clock_)); shell_delegate_ = - static_cast<TestShellDelegate*>(WmShell::Get()->delegate()); + static_cast<TestShellDelegate*>(Shell::Get()->shell_delegate()); generator_ = &AshTestBase::GetEventGenerator(); power_manager_client_->SendBrightnessChanged(kNonZeroBrightness, false); EXPECT_FALSE(GetBacklightsForcedOff());
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index c8def6f..dae6e25 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc
@@ -188,7 +188,7 @@ void LockStateController::OnHostCloseRequested( const aura::WindowTreeHost* host) { - WmShell::Get()->delegate()->Exit(); + Shell::Get()->shell_delegate()->Exit(); } void LockStateController::OnLoginStateChanged(LoginStatus status) {
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index 51af510..b5a66fb8 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc
@@ -89,7 +89,7 @@ power_button_controller_ = Shell::GetInstance()->power_button_controller(); shell_delegate_ = - static_cast<TestShellDelegate*>(WmShell::Get()->delegate()); + static_cast<TestShellDelegate*>(Shell::Get()->shell_delegate()); } void TearDown() override {
diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc index 2bd0958..67cd5a47 100644 --- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc +++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -304,6 +304,27 @@ EXPECT_TRUE(IsMaximizeModeStarted()); } +// When there is no keyboard accelerometer available maximize mode should solely +// rely on the tablet mode switch. +TEST_F(MaximizeModeControllerTest, + TabletModeTransitionNoKeyboardAccelerometer) { + ASSERT_FALSE(IsMaximizeModeStarted()); + TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); + ASSERT_FALSE(IsMaximizeModeStarted()); + + SetTabletMode(true); + EXPECT_TRUE(IsMaximizeModeStarted()); + + // Single sensor reading should not change mode. + TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); + EXPECT_TRUE(IsMaximizeModeStarted()); + + // With a single sensor we should exit immediately on the tablet mode switch + // rather than waiting for stabilized accelerometer readings. + SetTabletMode(false); + EXPECT_FALSE(IsMaximizeModeStarted()); +} + // Verify the maximize mode enter/exit thresholds for stable angles. TEST_F(MaximizeModeControllerTest, StableHingeAnglesWithLidOpened) { ASSERT_FALSE(IsMaximizeModeStarted()); @@ -445,15 +466,6 @@ } } -// Tests that when an accelerometer event is received which has no keyboard that -// we enter maximize mode. -TEST_F(MaximizeModeControllerTest, - NoKeyboardAccelerometerTriggersMaximizeMode) { - ASSERT_FALSE(IsMaximizeModeStarted()); - TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); - ASSERT_TRUE(IsMaximizeModeStarted()); -} - // Test if this case does not crash. See http://crbug.com/462806 TEST_F(MaximizeModeControllerTest, DisplayDisconnectionDuringOverview) { UpdateDisplay("800x600,800x600");
diff --git a/ash/wm/window_positioner_unittest.cc b/ash/wm/window_positioner_unittest.cc index 2bda5d7..0945b06 100644 --- a/ash/wm/window_positioner_unittest.cc +++ b/ash/wm/window_positioner_unittest.cc
@@ -147,7 +147,7 @@ ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; test::TestShellDelegate* const delegate = - static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); + static_cast<test::TestShellDelegate*>(Shell::Get()->shell_delegate()); delegate->SetForceMaximizeOnFirstRun(true); WindowPositioner::GetBoundsAndShowStateForNewWindow( @@ -166,7 +166,7 @@ ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; test::TestShellDelegate* const delegate = - static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); + static_cast<test::TestShellDelegate*>(Shell::Get()->shell_delegate()); delegate->SetForceMaximizeOnFirstRun(true); WindowPositioner::GetBoundsAndShowStateForNewWindow(
diff --git a/base/task_scheduler/task_scheduler_impl.cc b/base/task_scheduler/task_scheduler_impl.cc index 6157635..9f4e4b0 100644 --- a/base/task_scheduler/task_scheduler_impl.cc +++ b/base/task_scheduler/task_scheduler_impl.cc
@@ -10,6 +10,7 @@ #include "base/bind_helpers.h" #include "base/memory/ptr_util.h" #include "base/task_scheduler/delayed_task_manager.h" +#include "base/task_scheduler/scheduler_single_thread_task_runner_manager.h" #include "base/task_scheduler/scheduler_worker_pool_params.h" #include "base/task_scheduler/sequence_sort_key.h" #include "base/task_scheduler/task.h" @@ -66,8 +67,8 @@ scoped_refptr<SingleThreadTaskRunner> TaskSchedulerImpl::CreateSingleThreadTaskRunnerWithTraits( const TaskTraits& traits) { - return GetWorkerPoolForTraits(traits)->CreateSingleThreadTaskRunnerWithTraits( - traits); + return single_thread_task_runner_manager_ + ->CreateSingleThreadTaskRunnerWithTraits(traits); } std::vector<const HistogramBase*> TaskSchedulerImpl::GetHistograms() const { @@ -98,6 +99,7 @@ #if DCHECK_IS_ON() DCHECK(!join_for_testing_returned_.IsSet()); #endif + single_thread_task_runner_manager_->JoinForTesting(); for (const auto& worker_pool : worker_pools_) worker_pool->DisallowWorkerDetachmentForTesting(); for (const auto& worker_pool : worker_pools_) @@ -148,6 +150,11 @@ delayed_task_manager_ = base::MakeUnique<DelayedTaskManager>(service_thread_.task_runner()); + single_thread_task_runner_manager_ = + MakeUnique<SchedulerSingleThreadTaskRunnerManager>( + worker_pool_params_vector, worker_pool_index_for_traits_callback_, + task_tracker_.get(), delayed_task_manager_.get()); + // Callback invoked by workers to re-enqueue a sequence in the appropriate // PriorityQueue. const SchedulerWorkerPoolImpl::ReEnqueueSequenceCallback
diff --git a/base/task_scheduler/task_scheduler_impl.h b/base/task_scheduler/task_scheduler_impl.h index 1e80d5c5..5a83d0a 100644 --- a/base/task_scheduler/task_scheduler_impl.h +++ b/base/task_scheduler/task_scheduler_impl.h
@@ -28,6 +28,7 @@ namespace internal { class DelayedTaskManager; +class SchedulerSingleThreadTaskRunnerManager; class TaskTracker; // Default TaskScheduler implementation. This class is thread-safe. @@ -80,6 +81,8 @@ Thread service_thread_; std::unique_ptr<TaskTracker> task_tracker_; std::unique_ptr<DelayedTaskManager> delayed_task_manager_; + std::unique_ptr<SchedulerSingleThreadTaskRunnerManager> + single_thread_task_runner_manager_; const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_;
diff --git a/build/android/gradle/generate_gradle.py b/build/android/gradle/generate_gradle.py index 54644825..ec50a24 100755 --- a/build/android/gradle/generate_gradle.py +++ b/build/android/gradle/generate_gradle.py
@@ -297,7 +297,8 @@ def _Srcjars(self, entry): srcjars = _RebasePath(entry.Gradle().get('bundled_srcjars', [])) if not self.use_gradle_process_resources: - srcjars += _RebasePath(entry.BuildConfig()['javac']['srcjars']) + srcjars += _RebasePath(entry.Javac()['srcjars']) + srcjars += _RebasePath(entry.Gradle().get('srcjars')) return srcjars def _GetEntries(self, entry):
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index b90f06f8..5c6c721c 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py
@@ -374,6 +374,7 @@ direct_library_deps = deps.Direct('java_library') all_library_deps = deps.All('java_library') + direct_resources_deps = deps.Direct('android_resources') all_resources_deps = deps.All('android_resources') # Resources should be ordered with the highest-level dependency first so that # overrides are done correctly. @@ -478,8 +479,11 @@ c['package_name'] for c in all_resources_deps if 'package_name' in c] if options.type == 'android_apk': - # Apks will get their resources srcjar explicitly passed to the java step. + # Apks will get their resources srcjar explicitly passed to the java step config['javac']['srcjars'] = [] + # Gradle may need to generate resources for some apks. + gradle['srcjars'] = [ + c['srcjar'] for c in direct_resources_deps if 'srcjar' in c] if options.type == 'android_assets': all_asset_sources = []
diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni index 2bcd6ca..5ea8777 100644 --- a/build/config/sysroot.gni +++ b/build/config/sysroot.gni
@@ -16,10 +16,6 @@ target_sysroot_dir = "" use_sysroot = true - - # TODO(tonikitoo): Remove this arg when wheezy is finally dropped and we - # can just use debian/jessie everywhere by default. crbug.com/564904. - use_jessie_sysroot = false } if (is_linux && target_sysroot_dir != "") { @@ -57,20 +53,18 @@ # functionality where possible) needs to run on the buliders, which are # running precise. The precise build has a different set of dependencies # from the wheezy build, so we cannot use the wheezy sysroot. + # TODO(sbc): This condition can perhaps be eliminated now that we are + # using jessie rather than wheezy. sysroot = "//build/linux/ubuntu_precise_amd64-sysroot" } else { if (current_cpu == "x64") { - sysroot = "//build/linux/debian_wheezy_amd64-sysroot" - - if (use_jessie_sysroot) { - sysroot = "//build/linux/debian_jessie_amd64-sysroot" - } + sysroot = "//build/linux/debian_jessie_amd64-sysroot" } else if (current_cpu == "x86") { - sysroot = "//build/linux/debian_wheezy_i386-sysroot" + sysroot = "//build/linux/debian_jessie_i386-sysroot" } else if (current_cpu == "mipsel") { - sysroot = "//build/linux/debian_wheezy_mips-sysroot" + sysroot = "//build/linux/debian_jessie_mips-sysroot" } else if (current_cpu == "arm") { - sysroot = "//build/linux/debian_wheezy_arm-sysroot" + sysroot = "//build/linux/debian_jessie_arm-sysroot" } else if (current_cpu == "arm64") { sysroot = "//build/linux/debian_jessie_arm64-sysroot" } else {
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py index d79c12b..c8e88ee 100755 --- a/build/linux/sysroot_scripts/install-sysroot.py +++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -6,16 +6,17 @@ """Install Debian sysroots for building chromium. """ -# The sysroot is needed to ensure that binaries will run on Debian Wheezy, -# the oldest supported linux distribution. For ARM64 linux, we have Debian -# Jessie sysroot as Jessie is the first version with ARM64 support. This script -# can be run manually but is more often run as part of gclient hooks. When run -# from hooks this script is a no-op on non-linux platforms. +# The sysroot is needed to ensure that binaries that get built will run on +# the oldest stable version of Debian that we currently support. +# This script can be run manually but is more often run as part of gclient +# hooks. When run from hooks this script is a no-op on non-linux platforms. -# The sysroot image could be constructed from scratch based on the current -# state or Debian Wheezy/Jessie but for consistency we currently use a -# pre-built root image. The image will normally need to be rebuilt every time -# chrome's build dependencies are changed. +# The sysroot image could be constructed from scratch based on the current state +# of the Debian archive but for consistency we use a pre-built root image (we +# don't want upstream changes to Debian to effect the chromium build until we +# choose to pull them in). The images will normally need to be rebuilt every +# time chrome's build dependencies are changed but should also be updated +# periodically to include upstream security fixes from Debian. import hashlib import json @@ -134,14 +135,6 @@ if target_arch and target_arch not in (host_arch, 'i386'): InstallDefaultSysrootForArch(target_arch) - # Desktop Linux ozone builds require libxkbcommon* which is not - # available in Wheezy. - # TODO(thomasanderson): Remove this once the Jessie sysroot is used - # by default. - gyp_defines = gyp_chromium.GetGypVars(gyp_chromium.GetSupplementalFiles()) - if gyp_defines.get('use_ozone') == '1': - InstallSysroot('Jessie', 'amd64') - def main(args): parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) @@ -150,6 +143,9 @@ ' Installs default sysroot images.') parser.add_option('--arch', type='choice', choices=VALID_ARCHS, help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) + parser.add_option('--all', action='store_true', + help='Install all sysroot images (useful when updating the' + ' images)') options, _ = parser.parse_args(args) if options.running_as_hook and not sys.platform.startswith('linux'): return 0 @@ -160,27 +156,23 @@ if host_arch in ['ppc','s390']: return 0 InstallDefaultSysroots(host_arch) - else: - if not options.arch: - print 'You much specify either --arch or --running-as-hook' - return 1 + elif options.arch: InstallDefaultSysrootForArch(options.arch) + elif options.all: + for arch in VALID_ARCHS: + InstallDefaultSysrootForArch(arch) + else: + print 'You much specify either --arch, --all or --running-as-hook' + return 1 return 0 + def InstallDefaultSysrootForArch(target_arch): - if target_arch == 'amd64': - InstallSysroot('Wheezy', 'amd64') - elif target_arch == 'arm': - InstallSysroot('Wheezy', 'arm') - elif target_arch == 'arm64': - InstallSysroot('Jessie', 'arm64') - elif target_arch == 'i386': - InstallSysroot('Wheezy', 'i386') - elif target_arch == 'mips': - InstallSysroot('Wheezy', 'mips') - else: + if target_arch not in VALID_ARCHS: raise Error('Unknown architecture: %s' % target_arch) + InstallSysroot('Jessie', target_arch) + def InstallSysroot(target_platform, target_arch): # The sysroot directory should match the one specified in build/common.gypi.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java index c157c6a..c19b3a1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
@@ -115,6 +115,14 @@ return; } + // Check whether the WebAPK package is already installed. The WebAPK may have been installed + // by another Chrome version (e.g. Chrome Dev). We have to do this check because the Play + // install API fails silently if the package is already installed. + if (isWebApkInstalled(packageName)) { + notify(true); + return; + } + Callback<Boolean> callback = new Callback<Boolean>() { @Override public void onResult(Boolean success) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/DateDividedAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/DateDividedAdapter.java index 3baaac0..7cf149e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/DateDividedAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/DateDividedAdapter.java
@@ -233,7 +233,7 @@ public TimedItem getItemAt(int index) { // 0 is allocated to the date header. The list header has no items. - if (index == 0 || mIsListHeader || mIsListFooter) return null; + if (index <= 0 || mIsListHeader || mIsListFooter) return null; sortIfNeeded(); return mItems.get(index - 1);
diff --git a/chrome/app/chrome_exe_main_win.cc b/chrome/app/chrome_exe_main_win.cc index cf40708b..975d04f59 100644 --- a/chrome/app/chrome_exe_main_win.cc +++ b/chrome/app/chrome_exe_main_win.cc
@@ -218,11 +218,6 @@ } // namespace -#if defined(SYZYASAN) -// This is in chrome_elf. -extern "C" void BlockUntilHandlerStartedImpl(); -#endif // SYZYASAN - #if !defined(WIN_CONSOLE_APP) int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { #else @@ -260,14 +255,6 @@ // Signal Chrome Elf that Chrome has begun to start. SignalChromeElf(); -#if defined(SYZYASAN) - if (process_type.empty()) { - // This is a temporary workaround for a race during startup with the - // syzyasan_rtl.dll. See https://crbug.com/675710. - BlockUntilHandlerStartedImpl(); - } -#endif // SYZYASAN - // The exit manager is in charge of calling the dtors of singletons. base::AtExitManager exit_manager;
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc index e4d237a..4bc5f68 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
@@ -19,13 +19,17 @@ namespace chromeos { SelectToSpeakEventHandler::SelectToSpeakEventHandler() { - if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->AddPreTargetHandler(this); + if (ash::Shell::HasInstance()) { + ash::Shell::GetInstance()->GetPrimaryRootWindow()->AddPreTargetHandler( + this); + } } SelectToSpeakEventHandler::~SelectToSpeakEventHandler() { - if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->RemovePreTargetHandler(this); + if (ash::Shell::HasInstance()) { + ash::Shell::GetInstance()->GetPrimaryRootWindow()->RemovePreTargetHandler( + this); + } } void SelectToSpeakEventHandler::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc index 9c9a8d0..0aea7cb 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
@@ -39,7 +39,6 @@ namespace { -constexpr char kArcGlobalAppRestrictions[] = "globalAppRestrictions"; constexpr char kArcCaCerts[] = "caCerts"; constexpr char kPolicyCompliantJson[] = "{ \"policyCompliant\": true }"; @@ -105,24 +104,6 @@ filtered_policies->SetBoolean(arc_policy_name, true); } -void AddGlobalAppRestriction(const std::string& arc_app_restriction_name, - const std::string& policy_name, - const policy::PolicyMap& policy_map, - base::DictionaryValue* filtered_policies) { - const base::Value* const policy_value = policy_map.GetValue(policy_name); - if (policy_value) { - base::DictionaryValue* global_app_restrictions = nullptr; - if (!filtered_policies->GetDictionary(kArcGlobalAppRestrictions, - &global_app_restrictions)) { - global_app_restrictions = new base::DictionaryValue(); - filtered_policies->Set(kArcGlobalAppRestrictions, - global_app_restrictions); - } - global_app_restrictions->SetWithoutPathExpansion( - arc_app_restriction_name, policy_value->CreateDeepCopy()); - } -} - void AddOncCaCertsToPolicies(const policy::PolicyMap& policy_map, base::DictionaryValue* filtered_policies) { const base::Value* const policy_value = @@ -253,14 +234,6 @@ MapObjectToPresenceBool("setWallpaperDisabled", policy::key::kWallpaperImage, policy_map, &filtered_policies, {"url", "hash"}); - // Add global app restrictions. - AddGlobalAppRestriction("com.android.browser:URLBlacklist", - policy::key::kURLBlacklist, policy_map, - &filtered_policies); - AddGlobalAppRestriction("com.android.browser:URLWhitelist", - policy::key::kURLWhitelist, policy_map, - &filtered_policies); - // Add CA certificates. AddOncCaCertsToPolicies(policy_map, &filtered_policies);
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc index 253a24ea..19ab2ee 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
@@ -294,36 +294,6 @@ policy_bridge()->GetPolicies(PolicyStringCallback("{}")); } -TEST_F(ArcPolicyBridgeTest, URLBlacklistTest) { - base::ListValue blacklist; - blacklist.AppendString("www.blacklist1.com"); - blacklist.AppendString("www.blacklist2.com"); - policy_map().Set(policy::key::kURLBlacklist, policy::POLICY_LEVEL_MANDATORY, - policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - blacklist.CreateDeepCopy(), nullptr); - policy_bridge()->GetPolicies( - PolicyStringCallback("{\"globalAppRestrictions\":" - "{\"com.android.browser:URLBlacklist\":" - "[\"www.blacklist1.com\"," - "\"www.blacklist2.com\"" - "]}}")); -} - -TEST_F(ArcPolicyBridgeTest, URLWhitelistTest) { - base::ListValue whitelist; - whitelist.AppendString("www.whitelist1.com"); - whitelist.AppendString("www.whitelist2.com"); - policy_map().Set(policy::key::kURLWhitelist, policy::POLICY_LEVEL_MANDATORY, - policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, - whitelist.CreateDeepCopy(), nullptr); - policy_bridge()->GetPolicies( - PolicyStringCallback("{\"globalAppRestrictions\":" - "{\"com.android.browser:URLWhitelist\":" - "[\"www.whitelist1.com\"," - "\"www.whitelist2.com\"" - "]}}")); -} - TEST_F(ArcPolicyBridgeTest, CaCertificateTest) { // Enable CA certificates sync. policy_map().Set(
diff --git a/chrome/browser/chromeos/arc/print/arc_print_service.cc b/chrome/browser/chromeos/arc/print/arc_print_service.cc index 68a409e..1f3c51c 100644 --- a/chrome/browser/chromeos/arc/print/arc_print_service.cc +++ b/chrome/browser/chromeos/arc/print/arc_print_service.cc
@@ -7,7 +7,7 @@ #include <utility> #include "ash/common/shell_delegate.h" -#include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "base/files/file.h" #include "base/files/file_util.h" #include "base/logging.h" @@ -48,7 +48,7 @@ return; GURL gurl = net::FilePathToFileURL(file_path.value()); - ash::WmShell::Get()->delegate()->OpenUrlFromArc(gurl); + ash::Shell::Get()->shell_delegate()->OpenUrlFromArc(gurl); // TODO(poromov) Delete file after printing. (http://crbug.com/629843) }
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 1ee08dfe..7f859b95 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -238,7 +238,10 @@ service_providers.push_back(base::MakeUnique<DisplayPowerServiceProvider>( base::MakeUnique<ChromeDisplayPowerServiceProviderDelegate>())); } - service_providers.push_back(base::MakeUnique<LivenessServiceProvider>()); + // TODO(teravest): Remove this service provider once clients use + // LivenessService instead of LibCrosService. + service_providers.push_back( + base::MakeUnique<LivenessServiceProvider>(kLibCrosServiceInterface)); service_providers.push_back(base::MakeUnique<ScreenLockServiceProvider>()); if (ash_util::IsRunningInMash()) { service_providers.push_back(base::MakeUnique<ConsoleServiceProvider>( @@ -252,6 +255,13 @@ kLibCrosServiceName, dbus::ObjectPath(kLibCrosServicePath), std::move(service_providers)); + CrosDBusService::ServiceProviderList liveness_service_providers; + liveness_service_providers.push_back( + base::MakeUnique<LivenessServiceProvider>(kLivenessServiceInterface)); + liveness_service_ = CrosDBusService::Create( + kLivenessServiceName, dbus::ObjectPath(kLivenessServicePath), + std::move(liveness_service_providers)); + // Initialize PowerDataCollector after DBusThreadManager is initialized. PowerDataCollector::Initialize(); @@ -301,6 +311,7 @@ CertLoader::Shutdown(); TPMTokenLoader::Shutdown(); cros_dbus_service_.reset(); + liveness_service_.reset(); PowerDataCollector::Shutdown(); PowerPolicyController::Shutdown(); device::BluetoothAdapterFactory::Shutdown(); @@ -318,6 +329,8 @@ // split between different processes: http://crbug.com/692246 std::unique_ptr<CrosDBusService> cros_dbus_service_; + std::unique_ptr<CrosDBusService> liveness_service_; + std::unique_ptr<NetworkConnectDelegateChromeOS> network_connect_delegate_; DISALLOW_COPY_AND_ASSIGN(DBusServices);
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index cfa9e34d..7e7b547 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc
@@ -963,7 +963,7 @@ VLOG(1) << "Login WebUI >> wp animation done"; is_wallpaper_loaded_ = true; if (!ash_util::IsRunningInMash()) { - ash::WmShell::Get() + ash::Shell::Get() ->wallpaper_delegate() ->OnWallpaperBootAnimationFinished(); } else {
diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index 05cdadd..544756e 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc
@@ -217,7 +217,8 @@ GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); if (!gpu_data_manager->GpuAccessAllowed(NULL) || - gpu_data_manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || + gpu_data_manager->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL) || gpu_data_manager->ShouldUseSwiftShader()) { gpu_data_manager->RemoveObserver(this); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
diff --git a/chrome/browser/devtools/devtools_auto_opener.cc b/chrome/browser/devtools/devtools_auto_opener.cc index 7e230f55..834030e3 100644 --- a/chrome/browser/devtools/devtools_auto_opener.cc +++ b/chrome/browser/devtools/devtools_auto_opener.cc
@@ -9,8 +9,7 @@ DevToolsAutoOpener::DevToolsAutoOpener() : browser_tab_strip_tracker_(this, nullptr, nullptr) { - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } DevToolsAutoOpener::~DevToolsAutoOpener() {
diff --git a/chrome/browser/devtools/global_confirm_info_bar.cc b/chrome/browser/devtools/global_confirm_info_bar.cc index 8ef6809..7848489 100644 --- a/chrome/browser/devtools/global_confirm_info_bar.cc +++ b/chrome/browser/devtools/global_confirm_info_bar.cc
@@ -147,8 +147,7 @@ : delegate_(std::move(delegate)), browser_tab_strip_tracker_(this, nullptr, nullptr), weak_factory_(this) { - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::BROWSERS_IN_ACTIVE_DESKTOP); + browser_tab_strip_tracker_.Init(); } GlobalConfirmInfoBar::~GlobalConfirmInfoBar() {
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc index 6566c7b..db50720 100644 --- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc +++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -141,8 +141,7 @@ tab_manager_scoped_observer_(this) { DCHECK(!profile->IsOffTheRecord()); - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); tab_manager_scoped_observer_.Add(g_browser_process->GetTabManager()); }
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index b903c5d..4064afc 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -81,8 +81,7 @@ content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } WebNavigationEventRouter::~WebNavigationEventRouter() {
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 3dd47353..bb9113bf 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -545,7 +545,7 @@ WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() : feature_checker_(content::GpuFeatureChecker::Create( - gpu::GPU_FEATURE_TYPE_WEBGL, + gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, base::Bind(&WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck, base::Unretained(this)))) {}
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index a0a30f8..6b2359c 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -422,7 +422,7 @@ " {\n" " \"id\": 1,\n" " \"features\": [\n" - " \"webgl\"\n" + " \"accelerated_webgl\"\n" " ]\n" " }\n" " ]\n" @@ -431,7 +431,7 @@ content::GpuDataManager::GetInstance()->InitializeForTesting( json_blacklist, gpu_info); EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_WEBGL)); + gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); bool webgl_allowed = false; RunTest(webgl_allowed);
diff --git a/chrome/browser/extensions/chrome_requirements_checker.cc b/chrome/browser/extensions/chrome_requirements_checker.cc index 8793491..3aeacef 100644 --- a/chrome/browser/extensions/chrome_requirements_checker.cc +++ b/chrome/browser/extensions/chrome_requirements_checker.cc
@@ -50,7 +50,7 @@ if (requirements.webgl) { ++pending_requirement_checks_; webgl_checker_ = content::GpuFeatureChecker::Create( - gpu::GPU_FEATURE_TYPE_WEBGL, + gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, base::Bind(&ChromeRequirementsChecker::SetWebGLAvailability, weak_ptr_factory_.GetWeakPtr())); }
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 31e13f4..c3b026a 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -640,16 +640,16 @@ void BlackListWebGL() { static const std::string json_blacklist = - "{\n" - " \"name\": \"gpu blacklist\",\n" - " \"version\": \"1.0\",\n" - " \"entries\": [\n" - " {\n" - " \"id\": 1,\n" - " \"features\": [\"webgl\"]\n" - " }\n" - " ]\n" - "}"; + "{\n" + " \"name\": \"gpu blacklist\",\n" + " \"version\": \"1.0\",\n" + " \"entries\": [\n" + " {\n" + " \"id\": 1,\n" + " \"features\": [\"accelerated_webgl\"]\n" + " }\n" + " ]\n" + "}"; gpu::GPUInfo gpu_info; content::GpuDataManager::GetInstance()->InitializeForTesting( json_blacklist, gpu_info);
diff --git a/chrome/browser/extensions/external_component_loader.cc b/chrome/browser/extensions/external_component_loader.cc index 68f6f74a..50feb8c 100644 --- a/chrome/browser/extensions/external_component_loader.cc +++ b/chrome/browser/extensions/external_component_loader.cc
@@ -41,7 +41,9 @@ void ExternalComponentLoader::StartLoading() { prefs_.reset(new base::DictionaryValue()); +#if defined(GOOGLE_CHROME_BUILD) AddExternalExtension(extension_misc::kInAppPaymentsSupportAppId); +#endif // defined(GOOGLE_CHROME_BUILD) if (HotwordServiceFactory::IsHotwordAllowed(profile_)) AddExternalExtension(extension_misc::kHotwordSharedModuleId);
diff --git a/chrome/browser/extensions/external_provider_impl_unittest.cc b/chrome/browser/extensions/external_provider_impl_unittest.cc index 18ccf8d0..f778f52 100644 --- a/chrome/browser/extensions/external_provider_impl_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_unittest.cc
@@ -160,6 +160,7 @@ } // namespace +#if defined(GOOGLE_CHROME_BUILD) TEST_F(ExternalProviderImplTest, InAppPayments) { InitServiceWithExternalProviders(); @@ -176,5 +177,6 @@ EXPECT_TRUE(service_->IsExtensionEnabled( extension_misc::kInAppPaymentsSupportAppId)); } +#endif // defined(GOOGLE_CHROME_BUILD) } // namespace extensions
diff --git a/chrome/browser/extensions/requirements_checker_browsertest.cc b/chrome/browser/extensions/requirements_checker_browsertest.cc index 12b8491f..e7665ba 100644 --- a/chrome/browser/extensions/requirements_checker_browsertest.cc +++ b/chrome/browser/extensions/requirements_checker_browsertest.cc
@@ -131,7 +131,7 @@ // Backlist webgl std::vector<std::string> blacklisted_features; - blacklisted_features.push_back("webgl"); + blacklisted_features.push_back("accelerated_webgl"); BlackListGPUFeatures(blacklisted_features); content::RunAllBlockingPoolTasksUntilIdle();
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc index b6893503..74baafa 100644 --- a/chrome/browser/memory/tab_manager.cc +++ b/chrome/browser/memory/tab_manager.cc
@@ -155,8 +155,7 @@ #if defined(OS_CHROMEOS) delegate_.reset(new TabManagerDelegate(weak_ptr_factory_.GetWeakPtr())); #endif - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); // Set up default callbacks. These may be overridden post-construction as // testing seams.
diff --git a/chrome/browser/metrics/tab_reactivation_tracker.cc b/chrome/browser/metrics/tab_reactivation_tracker.cc index c3127b1..54cc3cb 100644 --- a/chrome/browser/metrics/tab_reactivation_tracker.cc +++ b/chrome/browser/metrics/tab_reactivation_tracker.cc
@@ -71,8 +71,7 @@ TabReactivationTracker::TabReactivationTracker(Delegate* delegate) : delegate_(delegate), browser_tab_strip_tracker_(this, nullptr, nullptr) { - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } TabReactivationTracker::~TabReactivationTracker() = default;
diff --git a/chrome/browser/metrics/tab_usage_recorder.cc b/chrome/browser/metrics/tab_usage_recorder.cc index 6840b06d..d8537d8 100644 --- a/chrome/browser/metrics/tab_usage_recorder.cc +++ b/chrome/browser/metrics/tab_usage_recorder.cc
@@ -121,8 +121,7 @@ TabUsageRecorder::TabUsageRecorder() : tab_reactivation_tracker_(this), browser_tab_strip_tracker_(this, nullptr, nullptr) { - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } TabUsageRecorder::~TabUsageRecorder() = default;
diff --git a/chrome/browser/ntp_snippets/BUILD.gn b/chrome/browser/ntp_snippets/BUILD.gn deleted file mode 100644 index 474a6f8..0000000 --- a/chrome/browser/ntp_snippets/BUILD.gn +++ /dev/null
@@ -1,13 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("test_support") { - testonly = true - sources = [ - "fake_download_item.cc", - "fake_download_item.h", - ] - - deps = [] -}
diff --git a/chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc b/chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc index c5f2773b..e77a2c67 100644 --- a/chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc +++ b/chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc
@@ -12,18 +12,19 @@ #include "base/strings/string_number_conversions.h" #include "base/test/simple_test_clock.h" #include "base/time/default_clock.h" -#include "chrome/browser/ntp_snippets/fake_download_item.h" #include "components/ntp_snippets/category.h" #include "components/ntp_snippets/mock_content_suggestions_provider_observer.h" #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" #include "components/offline_pages/core/client_namespace_constants.h" #include "components/prefs/testing_pref_service.h" +#include "content/public/test/fake_download_item.h" #include "content/public/test/mock_download_item.h" #include "content/public/test/mock_download_manager.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" using content::DownloadItem; +using content::FakeDownloadItem; using content::MockDownloadManager; using ntp_snippets::Category; using ntp_snippets::CategoryStatus; @@ -34,7 +35,6 @@ using ntp_snippets::test::FakeOfflinePageModel; using offline_pages::ClientId; using offline_pages::OfflinePageItem; -using test::FakeDownloadItem; using testing::_; using testing::AllOf; using testing::AnyNumber;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 6b61f7d..74b97187 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1499,8 +1499,6 @@ "views/login_view.h", "views/new_back_shortcut_bubble.cc", "views/new_back_shortcut_bubble.h", - "views/payments/contact_info_view_controller.cc", - "views/payments/contact_info_view_controller.h", "views/payments/credit_card_editor_view_controller.cc", "views/payments/credit_card_editor_view_controller.h", "views/payments/editor_view_controller.cc", @@ -1524,8 +1522,8 @@ "views/payments/payment_sheet_view_controller.h", "views/payments/preselected_combobox_model.cc", "views/payments/preselected_combobox_model.h", - "views/payments/shipping_list_view_controller.cc", - "views/payments/shipping_list_view_controller.h", + "views/payments/profile_list_view_controller.cc", + "views/payments/profile_list_view_controller.h", "views/payments/validating_combobox.cc", "views/payments/validating_combobox.h", "views/payments/validating_textfield.cc",
diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index 4c7e7c2b..5dbf85c 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
@@ -86,8 +86,7 @@ ash::Shell::GetInstance()->activation_client()->AddObserver(this); - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } BrowserStatusMonitor::~BrowserStatusMonitor() {
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 7fcd0a9..98b84660 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
@@ -1156,7 +1156,7 @@ // Get some base objects. shell_delegate_ = static_cast<ash::test::TestShellDelegate*>( - ash::WmShell::Get()->delegate()); + ash::Shell::Get()->shell_delegate()); shell_delegate_->set_multi_profiles_enabled(true); }
diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc index 3a74ace7..6ded5035 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -11,6 +11,7 @@ #include "ash/common/wallpaper/wallpaper_delegate.h" #include "ash/common/wm_shell.h" #include "ash/common/wm_window.h" +#include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "build/build_config.h" #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" @@ -98,9 +99,7 @@ return !item_.pinned_by_policy && (item_.type == ash::TYPE_APP_SHORTCUT || item_.type == ash::TYPE_APP); case MENU_CHANGE_WALLPAPER: - return ash::WmShell::Get() - ->wallpaper_delegate() - ->CanOpenSetWallpaperPage(); + return ash::Shell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage(); case MENU_AUTO_HIDE: return CanUserModifyShelfAutoHideBehavior(controller_->profile()); default:
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc index 9ba0898a..e4ba98e7 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc
@@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos.h" + #include "ash/common/system/system_notifier.h" -#include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_shell_delegate.h" #include "base/macros.h" @@ -11,7 +13,6 @@ #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" -#include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile_manager.h" @@ -44,7 +45,7 @@ ash::test::TestShellDelegate* shell_delegate = static_cast<ash::test::TestShellDelegate*>( - ash::WmShell::Get()->delegate()); + ash::Shell::Get()->shell_delegate()); shell_delegate->set_multi_profiles_enabled(true); chrome::MultiUserWindowManager::CreateInstance();
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc index 7f5b97b..642389b 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc
@@ -6,7 +6,7 @@ #include "ash/common/multi_profile_uma.h" #include "ash/common/shell_delegate.h" -#include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "base/logging.h" #include "build/build_config.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" @@ -37,7 +37,7 @@ multi_user_mode_ = MULTI_PROFILE_MODE_OFF; ash::MultiProfileUMA::SessionMode mode = ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; - if (ash::WmShell::Get()->delegate()->IsMultiProfilesEnabled()) { + if (ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) { if (!g_instance) { MultiUserWindowManagerChromeOS* manager = new MultiUserWindowManagerChromeOS(user_manager::UserManager::Get()
diff --git a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc index 1d5ba25..525587b 100644 --- a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc
@@ -191,7 +191,7 @@ AnimationStep animation_step) { // Handle the wallpaper switch. ash::WallpaperDelegate* wallpaper_delegate = - ash::WmShell::Get()->wallpaper_delegate(); + ash::Shell::Get()->wallpaper_delegate(); if (animation_step == ANIMATION_STEP_HIDE_OLD_USER) { // Set the wallpaper cross dissolve animation duration to our complete // animation cycle for a fade in and fade out.
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 722d71a8..730f437 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -24,6 +24,7 @@ #include "ash/common/system/tray_accessibility.h" #include "ash/common/system/user/user_observer.h" #include "ash/common/wm_shell.h" +#include "ash/shell.h" #include "ash/system/chromeos/rotation/tray_rotation_lock.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -323,8 +324,7 @@ } void SystemTrayDelegateChromeOS::ShowUserLogin() { - ash::WmShell* wm_shell = ash::WmShell::Get(); - if (!wm_shell->delegate()->IsMultiProfilesEnabled()) + if (!ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) return; // Only regular non-supervised users could add other users to current session.
diff --git a/chrome/browser/ui/browser_tab_strip_tracker.cc b/chrome/browser/ui/browser_tab_strip_tracker.cc index 9fd936a0..bfe522d 100644 --- a/chrome/browser/ui/browser_tab_strip_tracker.cc +++ b/chrome/browser/ui/browser_tab_strip_tracker.cc
@@ -28,18 +28,12 @@ BrowserList::RemoveObserver(this); } -void BrowserTabStripTracker::Init(InitWith init_with) { +void BrowserTabStripTracker::Init() { BrowserList::AddObserver(this); base::AutoReset<bool> restter(&is_processing_initial_browsers_, true); - if (init_with == InitWith::BROWSERS_IN_ACTIVE_DESKTOP) { - for (Browser* browser : *BrowserList::GetInstance()) - MaybeTrackBrowser(browser); - } else { - DCHECK(InitWith::ALL_BROWERS == init_with); - for (auto* browser : *BrowserList::GetInstance()) - MaybeTrackBrowser(browser); - } + for (auto* browser : *BrowserList::GetInstance()) + MaybeTrackBrowser(browser); } void BrowserTabStripTracker::StopObservingAndSendOnBrowserRemoved() {
diff --git a/chrome/browser/ui/browser_tab_strip_tracker.h b/chrome/browser/ui/browser_tab_strip_tracker.h index b23076446..1f84ac5 100644 --- a/chrome/browser/ui/browser_tab_strip_tracker.h +++ b/chrome/browser/ui/browser_tab_strip_tracker.h
@@ -28,12 +28,6 @@ // should be tracked. class BrowserTabStripTracker : public chrome::BrowserListObserver { public: - // See Init() for details. - enum class InitWith { - BROWSERS_IN_ACTIVE_DESKTOP, - ALL_BROWERS, - }; - // See class description for details. You only need specify a // TabStripModelObserver. |delegate| and |browser_list_observer| are // optional. @@ -43,13 +37,13 @@ ~BrowserTabStripTracker() override; // Starts tracking BrowserList for changes and additionally observes the - // existing Browsers matching |init_with|. If there is a - // BrowserTabStripTrackerDelegate it is called to determine if the Browser - // should be observed. If an existing Browser should be observed - // TabInsertedAt() is called for any existing tabs. If a delegate needs to - // differentiate between Browsers observed by way of Init() vs. a Browser - // added after the fact use is_processing_initial_browsers(). - void Init(InitWith init_with); + // existing Browsers. If there is a BrowserTabStripTrackerDelegate it is + // called to determine if the Browser should be observed. If an existing + // Browser should be observed TabInsertedAt() is called for any existing tabs. + // If a delegate needs to differentiate between Browsers observed by way of + // Init() vs. a Browser added after the fact use + // is_processing_initial_browsers(). + void Init(); // Returns true if processing an existing Browser in Init(). bool is_processing_initial_browsers() const {
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 5b70340..bed90c3 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1654,6 +1654,10 @@ [[AvatarIconController alloc] initWithBrowser:browser_.get()]); } view = [avatarButtonController_ view]; + if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) + [view setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; + else + [view setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; [view setHidden:![self shouldShowAvatar]]; // Install the view.
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm index c2f96b3..0be5d23 100644 --- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm +++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
@@ -18,7 +18,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" -#include "chrome/browser/ui/cocoa/l10n_util.h" #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/theme_resources.h" @@ -184,10 +183,6 @@ [[avatarButton cell] setHighlightsBy:NSNoCellMask]; [avatarButton setBordered:YES]; - if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) - [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; - else - [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; [avatarButton setTarget:self]; [avatarButton setAction:@selector(buttonClicked:)]; [avatarButton setRightAction:@selector(buttonClicked:)];
diff --git a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc index c1043b4..8cbf8364 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
@@ -17,8 +17,7 @@ TabStripModelStatsRecorder::TabStripModelStatsRecorder() : browser_tab_strip_tracker_(this, nullptr, nullptr) { - browser_tab_strip_tracker_.Init( - BrowserTabStripTracker::InitWith::ALL_BROWERS); + browser_tab_strip_tracker_.Init(); } TabStripModelStatsRecorder::~TabStripModelStatsRecorder() {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc index ecddfc9..a8c5ee0 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -183,6 +183,10 @@ // (i.e. it's been navigated to). void SetAndEmphasizeText(const std::string& new_text, bool accept_input); + bool IsCursorEnabled() const { + return test_api_->GetRenderText()->cursor_enabled(); + } + private: // testing::Test: void SetUp() override; @@ -266,6 +270,17 @@ Range(1)); } +// Test that text cursor is shown in the omnibox after entering any single +// character in NTP 'Search box'. Test for crbug.com/698172. +TEST_F(OmniboxViewViewsTest, EditTextfield) { + omnibox_textfield()->SetCursorEnabled(false); + ui::KeyEvent char_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, 0, + ui::DomKey::FromCharacter('a'), + ui::EventTimeForNow()); + omnibox_textfield()->InsertChar(char_event); + EXPECT_TRUE(IsCursorEnabled()); +} + // Test that the scheduled text edit command is cleared when Textfield receives // a key press event. This ensures that the scheduled text edit command property // is always in the correct state. Test for http://crbug.com/613948.
diff --git a/chrome/browser/ui/views/payments/contact_info_view_controller.cc b/chrome/browser/ui/views/payments/contact_info_view_controller.cc deleted file mode 100644 index 6000e36d..0000000 --- a/chrome/browser/ui/views/payments/contact_info_view_controller.cc +++ /dev/null
@@ -1,130 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/payments/contact_info_view_controller.h" - -#include <string> -#include <vector> - -#include "base/memory/ptr_util.h" -#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" -#include "chrome/browser/ui/views/payments/payment_request_row_view.h" -#include "chrome/browser/ui/views/payments/payment_request_views_util.h" -#include "chrome/grit/generated_resources.h" -#include "components/payments/content/payment_request.h" -#include "components/strings/grit/components_strings.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/paint_vector_icon.h" -#include "ui/views/controls/image_view.h" -#include "ui/views/layout/box_layout.h" -#include "ui/views/layout/grid_layout.h" -#include "ui/views/vector_icons.h" - -namespace payments { - -namespace { - -class ContactInfoListItem : public payments::PaymentRequestItemList::Item, - public views::ButtonListener { - public: - // Constructs a ContactInfoListItem object owned by |list|. |request| is the - // PaymentRequest object that is represented by the current instance of the - // dialog. |profile| is the AutofillProfile that this specific list item - // represents. It's a cached profile owned by |request|. - ContactInfoListItem(autofill::AutofillProfile* profile, - PaymentRequest* request, - PaymentRequestItemList* list, - bool selected) - : payments::PaymentRequestItemList::Item(request, list, selected), - profile_(profile) {} - ~ContactInfoListItem() override {} - - private: - // payments::PaymentRequestItemList::Item: - std::unique_ptr<views::View> CreateItemView() override { - std::unique_ptr<PaymentRequestRowView> row = - base::MakeUnique<PaymentRequestRowView>(this); - views::GridLayout* layout = new views::GridLayout(row.get()); - layout->SetInsets( - kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, - kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets); - row->SetLayoutManager(layout); - views::ColumnSet* columns = layout->AddColumnSet(0); - - // A column for the contact info - columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, - views::GridLayout::USE_PREF, 0, 0); - // A padding column that resizes to take up the empty space between the - // leading and trailing parts. - columns->AddPaddingColumn(1, 0); - - // A column for the checkmark when the row is selected. - columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, - 0, views::GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, 0); - // TODO(anthonyvd): derive the following boolean options from the requested - // options in the PaymentRequest object. - std::unique_ptr<views::View> contact_info_label = GetContactInfoLabel( - AddressStyleType::DETAILED, std::string(), *profile_, true, true, true); - contact_info_label->set_can_process_events_within_subtree(false); - layout->AddView(contact_info_label.release()); - - checkmark_ = base::MakeUnique<views::ImageView>(); - checkmark_->set_id( - static_cast<int>(DialogViewID::CONTACT_INFO_ITEM_CHECKMARK_VIEW)); - checkmark_->set_owned_by_client(); - checkmark_->set_can_process_events_within_subtree(false); - checkmark_->SetImage( - gfx::CreateVectorIcon(views::kMenuCheckIcon, 0xFF609265)); - layout->AddView(checkmark_.get()); - if (!selected()) - checkmark_->SetVisible(false); - - return std::move(row); - } - - // payments::PaymentRequestItemList::Item: - void SelectedStateChanged() override {} - - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override {} - - autofill::AutofillProfile* profile_; - std::unique_ptr<views::ImageView> checkmark_; - - DISALLOW_COPY_AND_ASSIGN(ContactInfoListItem); -}; - -} // namespace - -ContactInfoViewController::ContactInfoViewController( - PaymentRequest* request, - PaymentRequestDialogView* dialog) - : PaymentRequestSheetController(request, dialog) { - const std::vector<autofill::AutofillProfile*>& profiles = - request->contact_profiles(); - for (autofill::AutofillProfile* profile : profiles) { - std::unique_ptr<ContactInfoListItem> item = - base::MakeUnique<ContactInfoListItem>( - profile, request, &contact_info_list_, - profile == request->selected_contact_profile()); - contact_info_list_.AddItem(std::move(item)); - } -} - -ContactInfoViewController::~ContactInfoViewController() {} - -std::unique_ptr<views::View> ContactInfoViewController::CreateView() { - std::unique_ptr<views::View> list_view = contact_info_list_.CreateListView(); - - return CreatePaymentView( - CreateSheetHeaderView(true, - l10n_util::GetStringUTF16( - IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME), - this), - std::move(list_view)); -} - -} // namespace payments
diff --git a/chrome/browser/ui/views/payments/contact_info_view_controller.h b/chrome/browser/ui/views/payments/contact_info_view_controller.h deleted file mode 100644 index f1f231d7..0000000 --- a/chrome/browser/ui/views/payments/contact_info_view_controller.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_VIEW_CONTROLLER_H_ -#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_VIEW_CONTROLLER_H_ - -#include "base/macros.h" -#include "chrome/browser/ui/views/payments/payment_request_item_list.h" -#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" - -namespace payments { - -class PaymentRequest; -class PaymentRequestDialogView; - -class ContactInfoViewController : public PaymentRequestSheetController { - public: - ContactInfoViewController(PaymentRequest* request, - PaymentRequestDialogView* dialog); - ~ContactInfoViewController() override; - - // PaymentRequestSheetController: - std::unique_ptr<views::View> CreateView() override; - - private: - PaymentRequestItemList contact_info_list_; - - DISALLOW_COPY_AND_ASSIGN(ContactInfoViewController); -}; - -} // namespace payments - -#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_VIEW_CONTROLLER_H_
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc index 383f0382..6120a7c 100644 --- a/chrome/browser/ui/views/payments/payment_method_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
@@ -40,8 +40,7 @@ ADD_CREDIT_CARD_BUTTON = kFirstTagValue, }; -class PaymentMethodListItem : public payments::PaymentRequestItemList::Item, - public views::ButtonListener { +class PaymentMethodListItem : public payments::PaymentRequestItemList::Item { public: // Does not take ownership of |card|, which should not be null and should // outlive this object. |list| is the PaymentRequestItemList object that will
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc index 96f5fb4..71e4220 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
@@ -8,12 +8,11 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "chrome/browser/ui/views/payments/contact_info_view_controller.h" #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" -#include "chrome/browser/ui/views/payments/shipping_list_view_controller.h" +#include "chrome/browser/ui/views/payments/profile_list_view_controller.h" #include "components/constrained_window/constrained_window_views.h" #include "components/payments/content/payment_request.h" #include "content/public/browser/browser_thread.h" @@ -101,10 +100,11 @@ observer_for_testing_->OnBackNavigation(); } -void PaymentRequestDialogView::ShowContactInfoSheet() { +void PaymentRequestDialogView::ShowContactProfileSheet() { view_stack_.Push( CreateViewAndInstallController( - base::MakeUnique<ContactInfoViewController>(request_, this), + ProfileListViewController::GetContactProfileViewController(request_, + this), &controller_map_), /* animate */ true); if (observer_for_testing_) @@ -131,10 +131,11 @@ observer_for_testing_->OnPaymentMethodOpened(); } -void PaymentRequestDialogView::ShowShippingListSheet() { +void PaymentRequestDialogView::ShowShippingProfileSheet() { view_stack_.Push( CreateViewAndInstallController( - base::MakeUnique<ShippingListViewController>(request_, this), + ProfileListViewController::GetShippingProfileViewController(request_, + this), &controller_map_), /* animate = */ true); }
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.h b/chrome/browser/ui/views/payments/payment_request_dialog_view.h index 604bf3c..ec2e44b 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view.h +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.h
@@ -65,9 +65,9 @@ void CloseDialog() override; void GoBack(); - void ShowContactInfoSheet(); + void ShowContactProfileSheet(); void ShowOrderSummary(); - void ShowShippingListSheet(); + void ShowShippingProfileSheet(); void ShowPaymentMethodSheet(); void ShowCreditCardEditor();
diff --git a/chrome/browser/ui/views/payments/payment_request_item_list.cc b/chrome/browser/ui/views/payments/payment_request_item_list.cc index 1dc95ee..31c0e80 100644 --- a/chrome/browser/ui/views/payments/payment_request_item_list.cc +++ b/chrome/browser/ui/views/payments/payment_request_item_list.cc
@@ -47,6 +47,7 @@ base::MakeUnique<views::ImageView>(); checkmark->set_id(static_cast<int>(DialogViewID::CHECKMARK_VIEW)); checkmark->set_can_process_events_within_subtree(false); + checkmark->set_owned_by_client(); checkmark->SetImage( gfx::CreateVectorIcon(views::kMenuCheckIcon, kCheckmarkColor)); checkmark->SetVisible(selected);
diff --git a/chrome/browser/ui/views/payments/payment_request_item_list.h b/chrome/browser/ui/views/payments/payment_request_item_list.h index 547194e..0ac1c87 100644 --- a/chrome/browser/ui/views/payments/payment_request_item_list.h +++ b/chrome/browser/ui/views/payments/payment_request_item_list.h
@@ -9,6 +9,7 @@ #include <vector> #include "base/macros.h" +#include "ui/views/controls/button/button.h" namespace views { class ImageView; @@ -27,12 +28,12 @@ class PaymentRequestItemList { public: // Represents an item in the item list. - class Item { + class Item : public views::ButtonListener { public: // Creates an item that will be owned by |list| with the initial state set // to |selected|. Item(PaymentRequest* request, PaymentRequestItemList* list, bool selected); - virtual ~Item(); + ~Item() override; // Gets the view associated with this item. It's owned by this object so // that it can listen to any changes to the underlying model and update the @@ -66,6 +67,10 @@ std::unique_ptr<views::ImageView> CreateCheckmark(bool selected); private: + // views::ButtonListener: + void ButtonPressed(views::Button* sender, const ui::Event& event) override { + } + std::unique_ptr<views::View> item_view_; PaymentRequest* request_; PaymentRequestItemList* list_; @@ -75,7 +80,7 @@ }; PaymentRequestItemList(); - ~PaymentRequestItemList(); + virtual ~PaymentRequestItemList(); // Adds an item to this list. |item->list()| should return this object. void AddItem(std::unique_ptr<Item> item);
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc index 62b815b..dd9a83e 100644 --- a/chrome/browser/ui/views/payments/payment_request_views_util.cc +++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -37,6 +37,8 @@ #include "ui/views/painter.h" #include "ui/views/view.h" +namespace payments { + namespace { // TODO(tmartino): Consider combining this with the Android equivalent in @@ -56,6 +58,41 @@ return profile.ConstructInferredLabel(fields, fields.size(), locale); } +std::unique_ptr<views::View> GetThreeLineLabel(AddressStyleType type, + const base::string16& s1, + const base::string16& s2, + const base::string16& s3) { + std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); + std::unique_ptr<views::BoxLayout> layout = + base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); + layout->set_cross_axis_alignment( + views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); + container->SetLayoutManager(layout.release()); + + if (!s1.empty()) { + std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s1); + if (type == AddressStyleType::DETAILED) { + const gfx::FontList& font_list = label->font_list(); + label->SetFontList(font_list.DeriveWithWeight(gfx::Font::Weight::BOLD)); + } + container->AddChildView(label.release()); + } + + if (!s2.empty()) { + std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s2); + container->AddChildView(label.release()); + } + + if (!s3.empty()) { + std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(s3); + container->AddChildView(label.release()); + } + + // TODO(anthonyvd): add the error label + + return container; +} + // Paints the gray horizontal line that doesn't span the entire width of the // dialog at the bottom of the view it borders. class PaymentRequestRowBorderPainter : public views::Painter { @@ -83,8 +120,6 @@ } // namespace -namespace payments { - std::unique_ptr<views::View> CreateSheetHeaderView( bool show_back_arrow, const base::string16& title, @@ -157,26 +192,15 @@ AddressStyleType type, const std::string& locale, const autofill::AutofillProfile& profile) { - base::string16 name_value = + base::string16 name = profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale); - // TODO(tmartino): Add bold styling for name in DETAILED style. + base::string16 address = GetAddressFromProfile(profile, locale); - base::string16 address_value = GetAddressFromProfile(profile, locale); - - base::string16 phone_value = profile.GetInfo( + base::string16 phone = profile.GetInfo( autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), locale); - std::vector<base::string16> values; - if (!name_value.empty()) - values.push_back(name_value); - if (!address_value.empty()) - values.push_back(address_value); - if (!phone_value.empty()) - values.push_back(phone_value); - - return base::MakeUnique<views::StyledLabel>( - base::JoinString(values, base::ASCIIToUTF16("\n")), nullptr); + return GetThreeLineLabel(type, name, address, phone); } // TODO(anthonyvd): unit test the label layout. @@ -185,52 +209,27 @@ const std::string& locale, const autofill::AutofillProfile& profile, bool show_payer_name, - bool show_payer_email, - bool show_payer_phone) { - std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); - std::unique_ptr<views::BoxLayout> layout = - base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); - layout->set_cross_axis_alignment( - views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - container->SetLayoutManager(layout.release()); + bool show_payer_phone, + bool show_payer_email) { + base::string16 name = + show_payer_name + ? profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale) + : base::string16(); - if (show_payer_name) { - base::string16 name = - profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL), locale); - if (!name.empty()) { - std::unique_ptr<views::Label> label = - base::MakeUnique<views::Label>(name); - if (type == AddressStyleType::DETAILED) { - const gfx::FontList& font_list = label->font_list(); - label->SetFontList(font_list.DeriveWithWeight(gfx::Font::Weight::BOLD)); - } - container->AddChildView(label.release()); - } - } + base::string16 phone = + show_payer_phone + ? profile.GetInfo( + autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), + locale) + : base::string16(); - if (show_payer_phone) { - base::string16 phone = profile.GetInfo( - autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), locale); - if (!phone.empty()) { - std::unique_ptr<views::Label> label = - base::MakeUnique<views::Label>(phone); - container->AddChildView(label.release()); - } - } + base::string16 email = + show_payer_email + ? profile.GetInfo(autofill::AutofillType(autofill::EMAIL_ADDRESS), + locale) + : base::string16(); - if (show_payer_email) { - base::string16 email = profile.GetInfo( - autofill::AutofillType(autofill::EMAIL_ADDRESS), locale); - if (!email.empty()) { - std::unique_ptr<views::Label> label = - base::MakeUnique<views::Label>(email); - container->AddChildView(label.release()); - } - } - - // TODO(anthonyvd): add the error label - - return container; + return GetThreeLineLabel(type, name, phone, email); } std::unique_ptr<views::Border> CreatePaymentRequestRowBorder() {
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.h b/chrome/browser/ui/views/payments/payment_request_views_util.h index 6a044dd6..c7cfbc6 100644 --- a/chrome/browser/ui/views/payments/payment_request_views_util.h +++ b/chrome/browser/ui/views/payments/payment_request_views_util.h
@@ -79,8 +79,8 @@ const std::string& locale, const autofill::AutofillProfile& profile, bool show_payer_name, - bool show_payer_email, - bool show_payer_phone); + bool show_payer_phone, + bool show_payer_email); // Creates a views::Border object that can paint the gray horizontal ruler used // as a separator between items in the Payment Request dialog.
diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc index a5ae940..39a5c2a 100644 --- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -288,7 +288,7 @@ break; case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): - dialog()->ShowShippingListSheet(); + dialog()->ShowShippingProfileSheet(); break; case static_cast<int>( @@ -298,7 +298,7 @@ case static_cast<int>( PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): - dialog()->ShowContactInfoSheet(); + dialog()->ShowContactProfileSheet(); break; default: @@ -397,10 +397,8 @@ PaymentSheetViewController::CreateShippingSectionContent() { auto* profile = request()->selected_shipping_profile(); - // TODO(tmartino): Empty string param is app locale; this should be passed - // at construct-time and stored as a member in a future CL. - return profile ? payments::GetShippingAddressLabel(AddressStyleType::SUMMARY, - std::string(), *profile) + return profile ? payments::GetShippingAddressLabel( + AddressStyleType::SUMMARY, request()->locale(), *profile) : base::MakeUnique<views::Label>(base::string16()); } @@ -475,10 +473,12 @@ std::unique_ptr<views::View> PaymentSheetViewController::CreateContactInfoSectionContent() { auto* profile = request()->selected_contact_profile(); - // TODO(tmartino): Replace empty string with app locale. - return profile ? payments::GetContactInfoLabel(AddressStyleType::SUMMARY, - std::string(), *profile, true, - true, true) + + return profile ? payments::GetContactInfoLabel( + AddressStyleType::SUMMARY, request()->locale(), *profile, + request()->request_payer_name(), + request()->request_payer_phone(), + request()->request_payer_email()) : base::MakeUnique<views::Label>(base::string16()); }
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc new file mode 100644 index 0000000..5e9ee75 --- /dev/null +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -0,0 +1,184 @@ +// 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/profile_list_view_controller.h" + +#include "chrome/browser/ui/views/payments/payment_request_row_view.h" +#include "chrome/browser/ui/views/payments/payment_request_views_util.h" +#include "components/payments/content/payment_request.h" +#include "components/strings/grit/components_strings.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/views/controls/image_view.h" +#include "ui/views/layout/grid_layout.h" + +namespace payments { + +namespace { + +class ProfileItem : public PaymentRequestItemList::Item { + public: + // Constructs an object owned by |parent_list|, representing one element in + // the list. |request| is the PaymentRequest object that is represented by the + // current instance of the dialog. |parent_view| points to the controller + // which owns |parent_list|. |profile| is the AutofillProfile that this + // specific list item represents. It's a cached profile owned by |request|. + ProfileItem(autofill::AutofillProfile* profile, + PaymentRequest* request, + PaymentRequestItemList* parent_list, + ProfileListViewController* parent_view, + bool selected) + : payments::PaymentRequestItemList::Item(request, parent_list, selected), + parent_view_(parent_view), + profile_(profile) {} + ~ProfileItem() override {} + + private: + // payments::PaymentRequestItemList::Item: + std::unique_ptr<views::View> CreateItemView() override { + DCHECK(profile_); + + std::unique_ptr<views::View> content = parent_view_->GetLabel(profile_); + + std::unique_ptr<PaymentRequestRowView> row = + base::MakeUnique<PaymentRequestRowView>(this); + views::GridLayout* layout = new views::GridLayout(row.get()); + row->SetLayoutManager(layout); + + layout->SetInsets( + kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, + kPaymentRequestRowVerticalInsets, + kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); + + // Add a column listing the profile information. + views::ColumnSet* columns = layout->AddColumnSet(0); + columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1, + views::GridLayout::USE_PREF, 0, 0); + + columns->AddPaddingColumn(1, 0); + + // Add a column for the checkmark shown next to the selected profile. + columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, + 0, views::GridLayout::USE_PREF, 0, 0); + + layout->StartRow(0, 0); + content->set_can_process_events_within_subtree(false); + layout->AddView(content.release()); + + checkmark_ = CreateCheckmark(selected()); + layout->AddView(checkmark_.get()); + + return std::move(row); + } + + void SelectedStateChanged() override {} + + ProfileListViewController* parent_view_; + autofill::AutofillProfile* profile_; + std::unique_ptr<views::ImageView> checkmark_; + + DISALLOW_COPY_AND_ASSIGN(ProfileItem); +}; + +// The ProfileListViewController subtype for the Shipping address list +// screen of the Payment Request flow. +class ShippingProfileViewController : public ProfileListViewController { + public: + ShippingProfileViewController(PaymentRequest* request, + PaymentRequestDialogView* dialog) + : ProfileListViewController(request, dialog) {} + ~ShippingProfileViewController() override {} + + protected: + // ProfileListViewController: + std::unique_ptr<views::View> GetLabel( + autofill::AutofillProfile* profile) override { + return GetShippingAddressLabel(AddressStyleType::DETAILED, + request_->locale(), *profile); + } + + std::vector<autofill::AutofillProfile*> GetProfiles() override { + return request_->shipping_profiles(); + } + + base::string16 GetHeaderString() override { + return l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME); + } + + private: + DISALLOW_COPY_AND_ASSIGN(ShippingProfileViewController); +}; + +class ContactProfileViewController : public ProfileListViewController { + public: + ContactProfileViewController(PaymentRequest* request, + PaymentRequestDialogView* dialog) + : ProfileListViewController(request, dialog) {} + ~ContactProfileViewController() override {} + + protected: + // ProfileListViewController: + std::unique_ptr<views::View> GetLabel( + autofill::AutofillProfile* profile) override { + return GetContactInfoLabel(AddressStyleType::DETAILED, request_->locale(), + *profile, request_->request_payer_name(), + request_->request_payer_phone(), + request_->request_payer_email()); + } + + std::vector<autofill::AutofillProfile*> GetProfiles() override { + return request_->contact_profiles(); + } + + base::string16 GetHeaderString() override { + return l10n_util::GetStringUTF16( + IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME); + } + + private: + DISALLOW_COPY_AND_ASSIGN(ContactProfileViewController); +}; + +} // namespace + +// static +std::unique_ptr<ProfileListViewController> +ProfileListViewController::GetShippingProfileViewController( + PaymentRequest* request, + PaymentRequestDialogView* dialog) { + return base::MakeUnique<ShippingProfileViewController>(request, dialog); +} + +// static +std::unique_ptr<ProfileListViewController> +ProfileListViewController::GetContactProfileViewController( + PaymentRequest* request, + PaymentRequestDialogView* dialog) { + return base::MakeUnique<ContactProfileViewController>(request, dialog); +} + +ProfileListViewController::ProfileListViewController( + PaymentRequest* request, + PaymentRequestDialogView* dialog) + : PaymentRequestSheetController(request, dialog), request_(request) {} + +ProfileListViewController::~ProfileListViewController() {} + +std::unique_ptr<views::View> ProfileListViewController::CreateView() { + autofill::AutofillProfile* selected_profile = + request()->selected_shipping_profile(); + + // This must be done at Create-time, rather than construct-time, because + // the subclass method GetProfiles can't be called in the ctor. + for (auto* profile : GetProfiles()) { + list_.AddItem(base::MakeUnique<ProfileItem>( + profile, request(), &list_, this, profile == selected_profile)); + } + + return CreatePaymentView( + CreateSheetHeaderView( + /* show_back_arrow = */ true, GetHeaderString(), this), + list_.CreateListView()); +} + +} // namespace payments
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.h b/chrome/browser/ui/views/payments/profile_list_view_controller.h new file mode 100644 index 0000000..b3838425 --- /dev/null +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.h
@@ -0,0 +1,79 @@ +// 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_PROFILE_LIST_VIEW_CONTROLLER_H_ +#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ + +#include <memory> +#include <vector> + +#include "base/macros.h" +#include "chrome/browser/ui/views/payments/payment_request_item_list.h" +#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" + +namespace autofill { +class AutofillProfile; +} + +namespace views { +class Button; +class View; +} + +namespace payments { + +class PaymentRequest; +class PaymentRequestDialogView; + +// This base class encapsulates common view logic for contexts which display +// a list of profiles and allow exactly one of them to be selected. +class ProfileListViewController : public PaymentRequestSheetController { + public: + ~ProfileListViewController() override; + + // Creates a controller which lists and allows selection of profiles + // for shipping address. + static std::unique_ptr<ProfileListViewController> + GetShippingProfileViewController(PaymentRequest* request, + PaymentRequestDialogView* dialog); + + // Creates a controller which lists and allows selection of profiles + // for contact info. + static std::unique_ptr<ProfileListViewController> + GetContactProfileViewController(PaymentRequest* request, + PaymentRequestDialogView* dialog); + + // PaymentRequestSheetController: + std::unique_ptr<views::View> CreateView() override; + + // Returns a representation of the given profile appropriate for display + // in this context. + virtual std::unique_ptr<views::View> GetLabel( + autofill::AutofillProfile* profile) = 0; + + protected: + // Does not take ownership of the arguments, which should outlive this object. + ProfileListViewController(PaymentRequest* request, + PaymentRequestDialogView* dialog); + + // Returns the profiles cached by |request| which are appropriate for display + // in this context. + virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; + + // Returns the string displayed at the top of the view. + virtual base::string16 GetHeaderString() = 0; + + // Not owned. Never null. Outlives this object. + PaymentRequest* request_; + + private: + std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); + PaymentRequestItemList list_; + + DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); +}; + +} // namespace payments + +#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_
diff --git a/chrome/browser/ui/views/payments/shipping_list_view_controller.cc b/chrome/browser/ui/views/payments/shipping_list_view_controller.cc deleted file mode 100644 index d9b38b7..0000000 --- a/chrome/browser/ui/views/payments/shipping_list_view_controller.cc +++ /dev/null
@@ -1,105 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/payments/shipping_list_view_controller.h" - -#include <memory> -#include <utility> - -#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" -#include "chrome/browser/ui/views/payments/payment_request_row_view.h" -#include "chrome/browser/ui/views/payments/payment_request_views_util.h" -#include "components/payments/content/payment_request.h" -#include "components/strings/grit/components_strings.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/views/controls/image_view.h" -#include "ui/views/layout/box_layout.h" -#include "ui/views/layout/grid_layout.h" - -namespace payments { - -class ShippingListItem : public payments::PaymentRequestItemList::Item, - public views::ButtonListener { - public: - ShippingListItem(autofill::AutofillProfile* profile, - PaymentRequest* request, - PaymentRequestItemList* list, - bool selected) - : payments::PaymentRequestItemList::Item(request, list, selected), - profile_(profile) {} - ~ShippingListItem() override {} - - private: - // payments::PaymentRequestItemList::Item: - std::unique_ptr<views::View> CreateItemView() override { - DCHECK(profile_); - - // TODO(tmartino): Pass an actual locale in place of empty string. - std::unique_ptr<views::View> content = GetShippingAddressLabel( - AddressStyleType::DETAILED, std::string(), *profile_); - - std::unique_ptr<PaymentRequestRowView> row = - base::MakeUnique<PaymentRequestRowView>(this); - views::GridLayout* layout = new views::GridLayout(row.get()); - row->SetLayoutManager(layout); - - layout->SetInsets( - kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, - kPaymentRequestRowVerticalInsets, - kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); - - // Add a column listing the address. - views::ColumnSet* columns = layout->AddColumnSet(0); - columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, - views::GridLayout::USE_PREF, 0, 0); - - columns->AddPaddingColumn(1, 0); - - // Add a column for the checkmark shown next to the selected address. - columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, - 0, views::GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, 0); - content->set_can_process_events_within_subtree(false); - layout->AddView(content.release()); - - checkmark_ = CreateCheckmark(selected()); - layout->AddView(checkmark_.get()); - - return std::move(row); - } - - void SelectedStateChanged() override {} - - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override {} - - autofill::AutofillProfile* profile_; - std::unique_ptr<views::ImageView> checkmark_; -}; - -ShippingListViewController::ShippingListViewController( - PaymentRequest* request, - PaymentRequestDialogView* dialog) - : PaymentRequestSheetController(request, dialog) { - auto* selected_profile = request->selected_shipping_profile(); - - for (auto* profile : request->shipping_profiles()) { - list_.AddItem(base::MakeUnique<ShippingListItem>( - profile, request, &list_, profile == selected_profile)); - } -} - -ShippingListViewController::~ShippingListViewController() {} - -std::unique_ptr<views::View> ShippingListViewController::CreateView() { - return CreatePaymentView( - CreateSheetHeaderView( - /* show_back_arrow = */ true, - l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME), - this), - list_.CreateListView()); -} - -} // namespace payments
diff --git a/chrome/browser/ui/views/payments/shipping_list_view_controller.h b/chrome/browser/ui/views/payments/shipping_list_view_controller.h deleted file mode 100644 index 3a2fc6e..0000000 --- a/chrome/browser/ui/views/payments/shipping_list_view_controller.h +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_LIST_VIEW_CONTROLLER_H_ -#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_LIST_VIEW_CONTROLLER_H_ - -#include "base/macros.h" -#include "chrome/browser/ui/views/payments/payment_request_item_list.h" -#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" - -namespace payments { - -class PaymentRequest; -class PaymentRequestDialogView; - -// The PaymentRequestSheetController subtype for the Shipping address list -// screen of the Payment Request flow. -class ShippingListViewController : public PaymentRequestSheetController { - public: - // Does not take ownership of the arguments, which should outlive this object. - ShippingListViewController(PaymentRequest* request, - PaymentRequestDialogView* dialog); - ~ShippingListViewController() override; - - // PaymentRequestSheetController: - std::unique_ptr<views::View> CreateView() override; - - private: - PaymentRequestItemList list_; - - DISALLOW_COPY_AND_ASSIGN(ShippingListViewController); -}; - -} // namespace payments - -#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_LIST_VIEW_CONTROLLER_H_
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index d7d644f..c28aaf3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3483,7 +3483,6 @@ "//chrome:child_dependencies", "//chrome:resources", "//chrome:strings", - "//chrome/browser/ntp_snippets:test_support", "//chrome/common:test_support", "//components/autofill/content/renderer:test_support", "//components/browser_sync:test_support",
diff --git a/chromeos/dbus/services/liveness_service_provider.cc b/chromeos/dbus/services/liveness_service_provider.cc index 1648793..5ef2e4f 100644 --- a/chromeos/dbus/services/liveness_service_provider.cc +++ b/chromeos/dbus/services/liveness_service_provider.cc
@@ -11,15 +11,16 @@ namespace chromeos { -LivenessServiceProvider::LivenessServiceProvider() : weak_ptr_factory_(this) {} +LivenessServiceProvider::LivenessServiceProvider( + const std::string& service_interface) + : service_interface_(service_interface), weak_ptr_factory_(this) {} LivenessServiceProvider::~LivenessServiceProvider() {} void LivenessServiceProvider::Start( scoped_refptr<dbus::ExportedObject> exported_object) { exported_object->ExportMethod( - kLibCrosServiceInterface, - kCheckLiveness, + service_interface_, kLivenessServiceCheckLivenessMethod, base::Bind(&LivenessServiceProvider::CheckLiveness, weak_ptr_factory_.GetWeakPtr()), base::Bind(&LivenessServiceProvider::OnExported,
diff --git a/chromeos/dbus/services/liveness_service_provider.h b/chromeos/dbus/services/liveness_service_provider.h index 75092a3..26dca2a 100644 --- a/chromeos/dbus/services/liveness_service_provider.h +++ b/chromeos/dbus/services/liveness_service_provider.h
@@ -26,9 +26,9 @@ // messages. It can be tested with the following command: // // % dbus-send --system --type=method_call --print-reply -// --dest=org.chromium.LibCrosService -// /org/chromium/LibCrosService -// org.chromium.LibCrosServiceInterface.CheckLiveness +// --dest=org.chromium.LivenessService +// /org/chromium/LivenessService +// org.chromium.LivenessServiceInterface.CheckLiveness // // -> method return sender=:1.9 -> dest=:1.27 reply_serial=2 // @@ -36,7 +36,9 @@ class CHROMEOS_EXPORT LivenessServiceProvider : public CrosDBusService::ServiceProviderInterface { public: - LivenessServiceProvider(); + // TODO(teravest): Remove the service_interface argument once this is no + // longer used by LibCrosService. + explicit LivenessServiceProvider(const std::string& service_interface); ~LivenessServiceProvider() override; // CrosDBusService::ServiceProviderInterface overrides: @@ -53,6 +55,8 @@ void CheckLiveness(dbus::MethodCall* method_call, dbus::ExportedObject::ResponseSender response_sender); + std::string service_interface_; + // Keep this last so that all weak pointers will be invalidated at the // beginning of destruction. base::WeakPtrFactory<LivenessServiceProvider> weak_ptr_factory_;
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc index ef9e4cc..e52f9da 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc
@@ -74,7 +74,7 @@ void ArcIntentHelperBridge::OnOpenUrl(const std::string& url) { DCHECK(thread_checker_.CalledOnValidThread()); - ash::WmShell::Get()->delegate()->OpenUrlFromArc(GURL(url)); + ash::Shell::Get()->shell_delegate()->OpenUrlFromArc(GURL(url)); } void ArcIntentHelperBridge::OpenWallpaperPicker() {
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc index f230512..021b91a 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc
@@ -167,20 +167,40 @@ bool* is_local_modified) { size_t remote_use_count = base::checked_cast<size_t>(remote_metadata.use_count()); - if (local_model->use_count() < remote_use_count) { - local_model->set_use_count(remote_use_count); - *is_local_modified = true; - } else if (local_model->use_count() > remote_use_count) { - *is_remote_outdated = true; - } - base::Time remote_use_date = base::Time::FromInternalValue(remote_metadata.use_date()); - if (local_model->use_date() < remote_use_date) { + + // If the two models have the same metadata, do nothing. + if (local_model->use_count() == remote_use_count && + local_model->use_date() == remote_use_date) { + return; + } + + // Special case for local models with a use_count of one. This means the local + // model was only created, never used. The remote model should always be + // preferred. + // This situation can happen for new Chromium instances where there is no data + // yet on disk, making the use_date artifically high. Once the metadata sync + // kicks in, we should use that value. + if (local_model->use_count() == 1) { local_model->set_use_date(remote_use_date); + local_model->set_use_count(remote_use_count); *is_local_modified = true; - } else if (local_model->use_date() > remote_use_date) { - *is_remote_outdated = true; + } else { + // Otherwise, just keep the most recent use date and biggest use count. + if (local_model->use_date() < remote_use_date) { + local_model->set_use_date(remote_use_date); + *is_local_modified = true; + } else if (local_model->use_date() > remote_use_date) { + *is_remote_outdated = true; + } + + if (local_model->use_count() < remote_use_count) { + local_model->set_use_count(remote_use_count); + *is_local_modified = true; + } else if (local_model->use_count() > remote_use_count) { + *is_remote_outdated = true; + } } }
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc index 462f7bb..b24fec6 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc
@@ -680,9 +680,9 @@ // server. TEST_F(AutofillWalletMetadataSyncableServiceTest, IgnoreNewMetadataFromServerOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -704,9 +704,9 @@ // disk when processing on-going sync changes. TEST_F(AutofillWalletMetadataSyncableServiceTest, SaveHigherValuesFromServerOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, false)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, false)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, false)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, false)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -730,9 +730,9 @@ // processing on-going sync changes. TEST_F(AutofillWalletMetadataSyncableServiceTest, SendHigherValuesToServerOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -749,7 +749,7 @@ SyncAddressChangeAndDataMatch( syncer::SyncChange::ACTION_UPDATE, kAddr1SyncTag, sync_pb::WalletMetadataSpecifics::ADDRESS, - kAddr1Utf8, 1, 2, true), + kAddr1Utf8, 2, 2, true), SyncCardChangeAndDataMatch( syncer::SyncChange::ACTION_UPDATE, kCard1SyncTag, sync_pb::WalletMetadataSpecifics::CARD, @@ -761,9 +761,9 @@ // Verify that addition of known metadata is treated the same as an update. TEST_F(AutofillWalletMetadataSyncableServiceTest, TreatAdditionOfKnownMetadataAsUpdateOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -780,7 +780,7 @@ SyncAddressChangeAndDataMatch( syncer::SyncChange::ACTION_UPDATE, kAddr1SyncTag, sync_pb::WalletMetadataSpecifics::ADDRESS, - kAddr1Utf8, 1, 2, true), + kAddr1Utf8, 2, 2, true), SyncCardChangeAndDataMatch( syncer::SyncChange::ACTION_UPDATE, kCard1SyncTag, sync_pb::WalletMetadataSpecifics::CARD, @@ -793,9 +793,9 @@ // no disk writes and no messages sent to the server. TEST_F(AutofillWalletMetadataSyncableServiceTest, IgnoreUpdateOfUnknownMetadataOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -817,9 +817,9 @@ // ignored. There should be no disk writes and no messages sent to the server. TEST_F(AutofillWalletMetadataSyncableServiceTest, IgnoreDeleteOfUnknownMetadataOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -841,9 +841,9 @@ // trigger an undelete message sent to the server. TEST_F(AutofillWalletMetadataSyncableServiceTest, UndeleteExistingMetadataOnSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -860,7 +860,7 @@ SyncAddressChangeAndDataMatch( syncer::SyncChange::ACTION_ADD, kAddr1SyncTag, sync_pb::WalletMetadataSpecifics::ADDRESS, - kAddr1Utf8, 1, 2, true), + kAddr1Utf8, 2, 2, true), SyncCardChangeAndDataMatch( syncer::SyncChange::ACTION_ADD, kCard1SyncTag, sync_pb::WalletMetadataSpecifics::CARD, @@ -873,11 +873,11 @@ // data, which is used to avoid calling the expensive GetAllSyncData() function. TEST_F(AutofillWalletMetadataSyncableServiceTest, CacheIsUpToDateAfterSyncChange) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); local_.UpdateAddressStats(BuildAddress(kAddr2, 3, 4, false)); local_.UpdateCardStats(BuildCard(kCard1, 5, 6, kAddr1)); local_.UpdateCardStats(BuildCard(kCard2, 7, 8, kAddr2)); - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, true)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, true)); remote_.UpdateAddressStats(BuildAddress(kAddr2, 3, 4, false)); remote_.UpdateCardStats(BuildCard(kCard1, 5, 6, kAddr1)); remote_.UpdateCardStats(BuildCard(kCard2, 7, 8, kAddr2)); @@ -909,7 +909,7 @@ // values to the sync server. TEST_F(AutofillWalletMetadataSyncableServiceTest, SaveHigherValuesLocallyOnLateDataArrival) { - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, false)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, false)); remote_.UpdateCardStats(BuildCard(kCard1, 5, 6, kAddr1)); MergeMetadata(&local_, &remote_); syncer::SyncChangeList changes; @@ -937,7 +937,7 @@ // once the data finally arrives. TEST_F(AutofillWalletMetadataSyncableServiceTest, SaveHigherValuesLocallyOnLateDataArrivalAfterPartialUpdates) { - remote_.UpdateAddressStats(BuildAddress(kAddr1, 1, 2, false)); + remote_.UpdateAddressStats(BuildAddress(kAddr1, 2, 2, false)); remote_.UpdateAddressStats(BuildAddress(kAddr2, 3, 4, false)); remote_.UpdateCardStats(BuildCard(kCard1, 5, 6, kAddr1)); remote_.UpdateCardStats(BuildCard(kCard2, 7, 8, kAddr1)); @@ -980,7 +980,7 @@ // Make sure that if the better data is split across the local and server // version, both are updated with the merge results. TEST_F(AutofillWalletMetadataSyncableServiceTest, SaveHigherValues_Mixed1) { - local_.UpdateAddressStats(BuildAddress(kAddr1, 1, 20, true)); + local_.UpdateAddressStats(BuildAddress(kAddr1, 2, 20, true)); local_.UpdateCardStats(BuildCard(kCard1, 30, 4, "")); remote_.UpdateAddressStats(BuildAddress(kAddr1, 10, 2, false)); remote_.UpdateCardStats(BuildCard(kCard1, 3, 40, kAddr1)); @@ -1217,5 +1217,19 @@ MergeMetadata(&local_, &remote_); } +// Verify that if the local card has a use_count of one, its use_date is +// replaced even if it is more recent (new cards are created with a use_date set +// to the current time). +TEST_F(AutofillWalletMetadataSyncableServiceTest, NewLocalCard) { + local_.UpdateCardStats(BuildCard(kCard1, 1, 5000, kLocalAddr1)); + remote_.UpdateCardStats(BuildCard(kCard1, 3, 4, kLocalAddr1)); + + EXPECT_CALL(local_, UpdateCardStats(AutofillCardMetadataMatches( + kCard1, 3, 4, kLocalAddr1))); + EXPECT_CALL(local_, SendChangesToSyncServer(_)).Times(0); + + MergeMetadata(&local_, &remote_); +} + } // namespace } // namespace autofill
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc index 8ad4333..b43f4fc3e 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc
@@ -291,7 +291,7 @@ } // static -void AutofillWalletSyncableService::CopyRelevantBillingAddressesFromDisk( +void AutofillWalletSyncableService::CopyRelevantMetadataFromDisk( const AutofillTable& table, std::vector<CreditCard>* cards_from_server) { std::vector<std::unique_ptr<CreditCard>> cards_on_disk; @@ -301,6 +301,11 @@ for (const auto& saved_card : cards_on_disk) { for (CreditCard& server_card : *cards_from_server) { if (saved_card->server_id() == server_card.server_id()) { + // The wallet data doesn't have the use stats. Use the ones present on + // disk to not overwrite them with bad data. + server_card.set_use_count(saved_card->use_count()); + server_card.set_use_date(saved_card->use_date()); + // Keep the billing address id of the saved cards only if it points to // a local address. if (saved_card->billing_address_id().length() == kLocalGuidSize) { @@ -320,11 +325,11 @@ // Users can set billing address of the server credit card locally, but that // information does not propagate to either Chrome Sync or Google Payments - // server. To preserve user's preferred billing address, copy the billing - // addresses from disk into |wallet_cards|. + // server. To preserve user's preferred billing address and most recent use + // stats, copy them from disk into |wallet_cards|. AutofillTable* table = AutofillTable::FromWebDatabase(webdata_backend_->GetDatabase()); - CopyRelevantBillingAddressesFromDisk(*table, &wallet_cards); + CopyRelevantMetadataFromDisk(*table, &wallet_cards); // In the common case, the database won't have changed. Committing an update // to the database will require at least one DB page write and will schedule
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h index 03f1311..ae8bae82 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h
@@ -61,15 +61,17 @@ const std::string& app_locale); private: + FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, + CopyRelevantMetadataFromDisk_KeepLocalAddresses); FRIEND_TEST_ALL_PREFIXES( AutofillWalletSyncableServiceTest, - CopyRelevantBillingAddressesFromDisk_KeepLocalAddresses); - FRIEND_TEST_ALL_PREFIXES( - AutofillWalletSyncableServiceTest, - CopyRelevantBillingAddressesFromDisk_OverwriteOtherAddresses); + CopyRelevantMetadataFromDisk_OverwriteOtherAddresses); FRIEND_TEST_ALL_PREFIXES( AutofillWalletSyncableServiceTest, PopulateWalletCardsAndAddresses_BillingAddressIdTransfer); + FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, + CopyRelevantMetadataFromDisk_KeepUseStats); + FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, NewWalletCard); syncer::SyncMergeResult SetSyncData(const syncer::SyncDataList& data_list); @@ -81,10 +83,10 @@ std::vector<AutofillProfile>* wallet_addresses); // Finds the copies of the same credit card from the server and on disk and - // overwrites the server version with the billing id saved on disk if it - // refers to a local autofill profile. The credit card's IDs do not change - // over time. - static void CopyRelevantBillingAddressesFromDisk( + // overwrites the server version with the use stats saved on disk, and the + // billing id if it refers to a local autofill profile. The credit card's IDs + // do not change over time. + static void CopyRelevantMetadataFromDisk( const AutofillTable& table, std::vector<CreditCard>* cards_from_server);
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc index 9561a8b..41e3372 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/credit_card.h" +#include "components/autofill/core/browser/test_autofill_clock.h" #include "components/autofill/core/browser/webdata/autofill_table.h" #include "components/sync/protocol/autofill_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" @@ -99,7 +100,7 @@ // Verify that the billing address id from the card saved on disk is kept if it // is a local profile guid. TEST(AutofillWalletSyncableServiceTest, - CopyRelevantBillingAddressesFromDisk_KeepLocalAddresses) { + CopyRelevantMetadataFromDisk_KeepLocalAddresses) { std::vector<CreditCard> cards_on_disk; std::vector<CreditCard> wallet_cards; @@ -119,8 +120,8 @@ // Setup the TestAutofillTable with the cards_on_disk. TestAutofillTable table(cards_on_disk); - AutofillWalletSyncableService::CopyRelevantBillingAddressesFromDisk( - table, &wallet_cards); + AutofillWalletSyncableService::CopyRelevantMetadataFromDisk(table, + &wallet_cards); ASSERT_EQ(1U, wallet_cards.size()); @@ -133,7 +134,7 @@ // Verify that the billing address id from the card saved on disk is overwritten // if it does not refer to a local profile. TEST(AutofillWalletSyncableServiceTest, - CopyRelevantBillingAddressesFromDisk_OverwriteOtherAddresses) { + CopyRelevantMetadataFromDisk_OverwriteOtherAddresses) { std::string old_billing_id = "1234"; std::string new_billing_id = "9876"; std::vector<CreditCard> cards_on_disk; @@ -152,8 +153,8 @@ // Setup the TestAutofillTable with the cards_on_disk. TestAutofillTable table(cards_on_disk); - AutofillWalletSyncableService::CopyRelevantBillingAddressesFromDisk( - table, &wallet_cards); + AutofillWalletSyncableService::CopyRelevantMetadataFromDisk(table, + &wallet_cards); ASSERT_EQ(1U, wallet_cards.size()); @@ -162,4 +163,63 @@ EXPECT_EQ(new_billing_id, wallet_cards.back().billing_address_id()); } +// Verify that the use stats on disk are kept when server cards are synced. +TEST(AutofillWalletSyncableServiceTest, + CopyRelevantMetadataFromDisk_KeepUseStats) { + TestAutofillClock test_clock; + base::Time arbitrary_time = base::Time::FromDoubleT(25); + base::Time disk_time = base::Time::FromDoubleT(10); + test_clock.SetNow(arbitrary_time); + + std::vector<CreditCard> cards_on_disk; + std::vector<CreditCard> wallet_cards; + + // Create a card on disk with specific use stats. + cards_on_disk.push_back(CreditCard()); + cards_on_disk.back().set_use_count(3U); + cards_on_disk.back().set_use_date(disk_time); + + // Create a card pulled from wallet with the same id, but a different billing + // address id. + wallet_cards.push_back(CreditCard()); + wallet_cards.back().set_use_count(10U); + + // Setup the TestAutofillTable with the cards_on_disk. + TestAutofillTable table(cards_on_disk); + + AutofillWalletSyncableService::CopyRelevantMetadataFromDisk(table, + &wallet_cards); + + ASSERT_EQ(1U, wallet_cards.size()); + + // Make sure the use stats from disk were kept + EXPECT_EQ(3U, wallet_cards.back().use_count()); + EXPECT_EQ(disk_time, wallet_cards.back().use_date()); +} + +// Verify that the use stats of a new Wallet card are as expected. +TEST(AutofillWalletSyncableServiceTest, NewWalletCard) { + TestAutofillClock test_clock; + base::Time arbitrary_time = base::Time::FromDoubleT(25); + test_clock.SetNow(arbitrary_time); + + std::vector<AutofillProfile> wallet_addresses; + std::vector<CreditCard> wallet_cards; + syncer::SyncDataList data_list; + + // Create a Sync data for a card and its billing address. + data_list.push_back(CreateSyncDataForWalletAddress("1" /* id */)); + data_list.push_back(CreateSyncDataForWalletCreditCard( + "card1" /* id */, "1" /* billing_address_id */)); + + AutofillWalletSyncableService::PopulateWalletCardsAndAddresses( + data_list, &wallet_cards, &wallet_addresses); + + ASSERT_EQ(1U, wallet_cards.size()); + + // The use_count should be 1 and the use_date should be the current time. + EXPECT_EQ(1U, wallet_cards.back().use_count()); + EXPECT_EQ(arbitrary_time, wallet_cards.back().use_date()); +} + } // namespace autofill \ No newline at end of file
diff --git a/components/autofill/core/common/password_form_fill_data.cc b/components/autofill/core/common/password_form_fill_data.cc index 9b138304..a75d9c5e 100644 --- a/components/autofill/core/common/password_form_fill_data.cc +++ b/components/autofill/core/common/password_form_fill_data.cc
@@ -90,4 +90,13 @@ } } +PasswordFormFillData ClearPasswordValues(const PasswordFormFillData& data) { + PasswordFormFillData result(data); + if (result.wait_for_username) + result.password_field.value.clear(); + for (auto& credentials : result.additional_logins) + credentials.second.password.clear(); + return result; +} + } // namespace autofill
diff --git a/components/autofill/core/common/password_form_fill_data.h b/components/autofill/core/common/password_form_fill_data.h index fd0f64fe..6c9c820 100644 --- a/components/autofill/core/common/password_form_fill_data.h +++ b/components/autofill/core/common/password_form_fill_data.h
@@ -96,6 +96,10 @@ bool enable_other_possible_usernames, PasswordFormFillData* result); +// Renderer needs to have only a password that should be autofilled, all other +// passwords might be safety erased. +PasswordFormFillData ClearPasswordValues(const PasswordFormFillData& data); + } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_FILL_DATA_H__
diff --git a/components/gcm_driver/android/OWNERS b/components/gcm_driver/android/OWNERS index 69b0ace..a172106 100644 --- a/components/gcm_driver/android/OWNERS +++ b/components/gcm_driver/android/OWNERS
@@ -1,2 +1,4 @@ johnme@chromium.org mvanouwerkerk@chromium.org + +# COMPONENT: Services>CloudMessaging
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc index 4058abb..52ed130 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.cc +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -85,7 +85,8 @@ const autofill::PasswordFormFillData& form_data) { const int key = next_free_key_++; password_autofill_manager_.OnAddPasswordFormMapping(key, form_data); - GetPasswordAutofillAgent()->FillPasswordForm(key, form_data); + GetPasswordAutofillAgent()->FillPasswordForm( + key, autofill::ClearPasswordValues(form_data)); } void ContentPasswordManagerDriver::AllowPasswordGenerationForForm(
diff --git a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc index 0606690..e91435b 100644 --- a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc +++ b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/strings/utf_string_conversions.h" #include "components/autofill/content/common/autofill_agent.mojom.h" #include "components/autofill/core/browser/test_autofill_client.h" #include "components/password_manager/core/browser/stub_log_manager.h" @@ -21,6 +22,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using autofill::PasswordForm; +using autofill::PasswordFormFillData; +using base::ASCIIToUTF16; +using testing::_; using testing::Return; namespace password_manager { @@ -67,12 +72,11 @@ logging_state_active_ = false; } - private: // autofill::mojom::PasswordAutofillAgent: - void FillPasswordForm( - int key, - const autofill::PasswordFormFillData& form_data) override {} + MOCK_METHOD2(FillPasswordForm, + void(int, const autofill::PasswordFormFillData&)); + private: void SetLoggingState(bool active) override { called_set_logging_state_ = true; logging_state_active_ = active; @@ -92,6 +96,47 @@ mojo::Binding<autofill::mojom::PasswordAutofillAgent> binding_; }; +PasswordFormFillData GetTestPasswordFormFillData() { + // Create the current form on the page. + PasswordForm form_on_page; + form_on_page.origin = GURL("https://foo.com/"); + form_on_page.action = GURL("https://foo.com/login"); + form_on_page.signon_realm = "https://foo.com/"; + form_on_page.scheme = PasswordForm::SCHEME_HTML; + + // Create an exact match in the database. + PasswordForm preferred_match = form_on_page; + preferred_match.username_element = ASCIIToUTF16("username"); + preferred_match.username_value = ASCIIToUTF16("test@gmail.com"); + preferred_match.password_element = ASCIIToUTF16("password"); + preferred_match.password_value = ASCIIToUTF16("test"); + preferred_match.preferred = true; + + std::map<base::string16, const PasswordForm*> matches; + PasswordForm non_preferred_match = preferred_match; + non_preferred_match.username_value = ASCIIToUTF16("test1@gmail.com"); + non_preferred_match.password_value = ASCIIToUTF16("test1"); + matches[non_preferred_match.username_value] = &non_preferred_match; + + PasswordFormFillData result; + InitPasswordFormFillData(form_on_page, matches, &preferred_match, true, false, + &result); + return result; +} + +MATCHER_P(WerePasswordsCleared, + should_preferred_password_cleared, + "Passwords not cleared") { + if (should_preferred_password_cleared && !arg.password_field.value.empty()) + return false; + + for (auto& credentials : arg.additional_logins) + if (!credentials.second.password.empty()) + return false; + + return true; +} + } // namespace class ContentPasswordManagerDriverTest @@ -366,6 +411,20 @@ content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP)); } +TEST_F(ContentPasswordManagerDriverTest, ClearPasswordsOnAutofill) { + std::unique_ptr<ContentPasswordManagerDriver> driver( + new ContentPasswordManagerDriver(main_rfh(), &password_manager_client_, + &autofill_client_)); + + for (bool wait_for_username : {false, true}) { + PasswordFormFillData fill_data = GetTestPasswordFormFillData(); + fill_data.wait_for_username = wait_for_username; + EXPECT_CALL(fake_agent_, + FillPasswordForm(_, WerePasswordsCleared(wait_for_username))); + driver->FillPasswordForm(fill_data); + } +} + INSTANTIATE_TEST_CASE_P(, ContentPasswordManagerDriverTest, testing::Values(true, false));
diff --git a/components/payments/content/payment_request.h b/components/payments/content/payment_request.h index 4a6507d..7933e61 100644 --- a/components/payments/content/payment_request.h +++ b/components/payments/content/payment_request.h
@@ -143,6 +143,7 @@ autofill::PersonalDataManager* personal_data_manager() { return delegate_->GetPersonalDataManager(); } + const std::string& locale() { return delegate_->GetApplicationLocale(); } payments::mojom::PaymentDetails* details() { return details_.get(); } payments::mojom::PaymentOptions* options() { return options_.get(); }
diff --git a/components/web_contents_delegate_android/OWNERS b/components/web_contents_delegate_android/OWNERS index 4048140c..be73798 100644 --- a/components/web_contents_delegate_android/OWNERS +++ b/components/web_contents_delegate_android/OWNERS
@@ -1,2 +1,4 @@ boliu@chromium.org tedchoc@chromium.org + +# COMPONENT: Internals>Core
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index b6086a0..30fd473 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -760,6 +760,10 @@ IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) #endif +#if defined(OS_ANDROID) + IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, + OnNavigationHandledByEmbedder) +#endif IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) IPC_END_MESSAGE_MAP() @@ -1973,6 +1977,9 @@ RenderWidgetHostViewBase* view = GetViewForAccessibility(); + if (frame_tree_node_->IsMainFrame() && view) + view->SetMainFrameAXTreeID(GetAXTreeID()); + AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); if ((accessibility_mode != AccessibilityModeOff) && view && is_active()) { if (accessibility_mode & ACCESSIBILITY_MODE_FLAG_NATIVE_APIS) @@ -2269,6 +2276,15 @@ } #endif +#if defined(OS_ANDROID) +void RenderFrameHostImpl::OnNavigationHandledByEmbedder() { + if (navigation_handle_) + navigation_handle_->set_net_error_code(net::ERR_ABORTED); + + OnDidStopLoading(); +} +#endif + void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id, WindowOpenDisposition disposition, const gfx::Rect& initial_rect,
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index fb510b8..caa031e 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -768,6 +768,9 @@ void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); void OnHidePopup(); #endif +#if defined(OS_ANDROID) + void OnNavigationHandledByEmbedder(); +#endif void OnShowCreatedWindow(int pending_widget_routing_id, WindowOpenDisposition disposition, const gfx::Rect& initial_rect,
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 21140f3..7607f77 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -86,8 +86,7 @@ " or the command line. The browser will fall back to software compositing" " and hardware acceleration will be unavailable.", true}, - {kWebGLFeatureName, - manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), + {kWebGLFeatureName, !manager->IsWebGLEnabled(), command_line.HasSwitch(switches::kDisableExperimentalWebGL), "WebGL has been disabled via blacklist or the command line.", false}, {"flash_3d", manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D), @@ -109,15 +108,17 @@ "Using Stage3d Baseline profile in Flash has been disabled, either" " via blacklist, about:flags or the command line.", true}, - {"video_decode", manager->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), + {"video_decode", + manager->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), "Accelerated video decode has been disabled, either via blacklist," " about:flags or the command line.", true}, #if BUILDFLAG(ENABLE_WEBRTC) - {"video_encode", manager->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE), + {"video_encode", + manager->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE), command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), "Accelerated video encode has been disabled, either via blacklist," " about:flags or the command line.", @@ -147,10 +148,11 @@ "Native GpuMemoryBuffers have been disabled, either via about:flags" " or command line.", true}, - {"vpx_decode", manager->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) || - manager->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), + {"vpx_decode", + manager->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) || + manager->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), accelerated_vpx_disabled, "Accelerated VPx video decode has been disabled, either via blacklist" " or the command line.",
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc index 8f09cb1..b111a1d0b 100644 --- a/content/browser/gpu/gpu_data_manager_impl.cc +++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -35,6 +35,11 @@ return private_->IsFeatureEnabled(feature); } +bool GpuDataManagerImpl::IsWebGLEnabled() const { + base::AutoLock auto_lock(lock_); + return private_->IsWebGLEnabled(); +} + bool GpuDataManagerImpl::IsDriverBugWorkaroundActive(int feature) const { base::AutoLock auto_lock(lock_); return private_->IsDriverBugWorkaroundActive(feature);
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h index b346f12..83227bf 100644 --- a/content/browser/gpu/gpu_data_manager_impl.h +++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -70,6 +70,7 @@ const gpu::GPUInfo& gpu_info) override; bool IsFeatureBlacklisted(int feature) const override; bool IsFeatureEnabled(int feature) const override; + bool IsWebGLEnabled() const override; gpu::GPUInfo GetGPUInfo() const override; void GetGpuProcessHandles( const GetGpuProcessHandlesCallback& callback) const override;
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 4d8ac44..864feb3 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -167,8 +167,7 @@ gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION, - gpu::GPU_FEATURE_TYPE_WEBGL, - gpu::GPU_FEATURE_TYPE_WEBGL2}; + gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, gpu::GPU_FEATURE_TYPE_WEBGL2}; const std::string kGpuBlacklistFeatureHistogramNames[] = { "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", "GPU.BlacklistFeatureTestResults.GpuCompositing", @@ -304,15 +303,9 @@ return true; } #endif // OS_CHROMEOS - if (use_swiftshader_) { - // Skia's software rendering is probably more efficient than going through - // software emulation of the GPU, so use that. - if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) - return true; - return false; - } - return (blacklisted_features_.count(feature) == 1); + // SwiftShader blacklists all features + return use_swiftshader_ || (blacklisted_features_.count(feature) == 1); } bool GpuDataManagerImplPrivate::IsFeatureEnabled(int feature) const { @@ -322,14 +315,19 @@ gpu::kGpuFeatureStatusEnabled; } +bool GpuDataManagerImplPrivate::IsWebGLEnabled() const { + return use_swiftshader_ || + !blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL); +} + bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const { return (gpu_driver_bugs_.count(feature) == 1); } size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { - if (use_swiftshader_) - return 1; - return blacklisted_features_.size(); + // SwiftShader blacklists all features + return use_swiftshader_ ? gpu::NUMBER_OF_GPU_FEATURE_TYPES + : blacklisted_features_.size(); } gpu::GPUInfo GpuDataManagerImplPrivate::GetGPUInfo() const { @@ -382,7 +380,7 @@ std::inserter(feature_diffs, feature_diffs.begin())); if (feature_diffs.size()) { // TODO(zmo): Other features might also be OK to ignore here. - feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL); + feature_diffs.erase(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL); feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL2); } if (feature_diffs.size()) { @@ -752,7 +750,7 @@ if (use_swiftshader_) { command_line->AppendSwitchASCII( switches::kUseGL, gl::kGLImplementationSwiftShaderForWebGLName); - } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || + } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL) || IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) || IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && @@ -892,7 +890,7 @@ WebPreferences* prefs) const { DCHECK(prefs); - if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { + if (!IsWebGLEnabled()) { prefs->experimental_webgl_enabled = false; prefs->pepper_3d_enabled = false; } @@ -1230,7 +1228,8 @@ // otherwise be allowed. if (card_blacklisted_) { blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING); - blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL); + blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL); + blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL2); } EnableSwiftShaderIfNecessary(); @@ -1260,7 +1259,7 @@ void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { if (!GpuAccessAllowed(NULL) || - blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { + blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) { if (!swiftshader_path_.empty() && !base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableSoftwareRasterizer))
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h index 2990433..b7d0b33b 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.h +++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -44,6 +44,7 @@ const gpu::GPUInfo& gpu_info); bool IsFeatureBlacklisted(int feature) const; bool IsFeatureEnabled(int feature) const; + bool IsWebGLEnabled() const; bool IsDriverBugWorkaroundActive(int feature) const; gpu::GPUInfo GetGPUInfo() const; void GetGpuProcessHandles(
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc index 880a83f..7e813da 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
@@ -158,7 +158,7 @@ { "id": 1, "features": [ - "webgl" + "accelerated_webgl" ] }, { @@ -180,7 +180,8 @@ EXPECT_TRUE(manager->GpuAccessAllowed(&reason)); EXPECT_TRUE(reason.empty()); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); gpu_info.gl_vendor = "NVIDIA"; gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; @@ -188,7 +189,8 @@ EXPECT_FALSE(manager->GpuAccessAllowed(&reason)); EXPECT_FALSE(reason.empty()); EXPECT_EQ(2u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); EXPECT_TRUE(manager->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); } @@ -219,7 +221,7 @@ "id": 2, "gl_renderer": ".*GeForce.*", "features": [ - "webgl", + "accelerated_webgl", "webgl2" ] } @@ -246,7 +248,8 @@ EXPECT_EQ(3u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2)); } @@ -268,7 +271,7 @@ } ], "features": [ - "webgl" + "accelerated_webgl" ] } ] @@ -322,7 +325,8 @@ manager->RegisterSwiftShaderPath(test_path); EXPECT_TRUE(manager->ShouldUseSwiftShader()); EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); - EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); + EXPECT_EQ(static_cast<size_t>(gpu::NUMBER_OF_GPU_FEATURE_TYPES), + manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); } @@ -344,7 +348,8 @@ manager->DisableHardwareAcceleration(); EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); EXPECT_TRUE(manager->ShouldUseSwiftShader()); - EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); + EXPECT_EQ(static_cast<size_t>(gpu::NUMBER_OF_GPU_FEATURE_TYPES), + manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); } @@ -573,7 +578,7 @@ } ], "features": [ - "webgl" + "accelerated_webgl" ] } ] @@ -595,7 +600,8 @@ manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801); EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); } TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsNoEffects) { @@ -626,7 +632,7 @@ } ], "features": [ - "webgl" + "accelerated_webgl" ] } ] @@ -645,7 +651,8 @@ // Full GPUInfo, the entry applies. EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); // Now assume browser gets GL strings from local state. // SetGLStrings() has no effects because GPUInfo already got these strings. @@ -653,7 +660,8 @@ manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa802); EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); } TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsDefered) { @@ -674,7 +682,7 @@ "device_id" : ["0x0042"], "driver_vendor" : "Mesa", "driver_version" : {"op" : ">=", "value" : "8.0.0"}, - "features" : ["webgl"] + "features" : ["accelerated_webgl"] } ] }); @@ -690,7 +698,8 @@ EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); - EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)); + EXPECT_TRUE( + manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)); } #endif // OS_LINUX @@ -774,7 +783,7 @@ "vendor_id": "0x8086", "multi_gpu_category": "active", "features": [ - "webgl" + "accelerated_webgl" ] } ]
diff --git a/content/browser/media/OWNERS b/content/browser/media/OWNERS index a4c232a..760028a 100644 --- a/content/browser/media/OWNERS +++ b/content/browser/media/OWNERS
@@ -5,3 +5,5 @@ # For changes related to the tab media indicators. per-file audio_stream_monitor*=miu@chromium.org + +# COMPONENT: Internals>Media
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 1000c12..4acaf33 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -63,6 +63,7 @@ #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "third_party/WebKit/public/platform/WebInputEvent.h" #include "third_party/WebKit/public/web/WebCompositionUnderline.h" +#include "ui/accessibility/platform/aura_window_properties.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/client/cursor_client_observer.h" @@ -1151,6 +1152,11 @@ return NULL; } +void RenderWidgetHostViewAura::SetMainFrameAXTreeID( + ui::AXTreeIDRegistry::AXTreeID id) { + window_->SetProperty(ui::kChildAXTreeID, id); +} + bool RenderWidgetHostViewAura::LockMouse() { return event_handler_->LockMouse(); }
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 818fcdc..8065e7f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -162,6 +162,7 @@ BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; + void SetMainFrameAXTreeID(ui::AXTreeIDRegistry::AXTreeID id) override; bool LockMouse() override; void UnlockMouse() override; void OnSwapCompositorFrame(uint32_t compositor_frame_sink_id,
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h index 657ad202..40ebb8c 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -31,6 +31,7 @@ #include "third_party/WebKit/public/web/WebPopupType.h" #include "third_party/WebKit/public/web/WebTextDirection.h" #include "third_party/skia/include/core/SkImageInfo.h" +#include "ui/accessibility/ax_tree_id_registry.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h" #include "ui/display/display.h" @@ -210,7 +211,7 @@ virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds); virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget(); virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible(); - + virtual void SetMainFrameAXTreeID(ui::AXTreeIDRegistry::AXTreeID id) {} // Informs that the focused DOM node has changed. virtual void FocusedNodeChanged(bool is_editable_node, const gfx::Rect& node_bounds_in_screen) {}
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 60fb513..ed8ff43 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -1611,6 +1611,8 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_GetNearestFindResult_Reply, int /* nfr_request_id */, float /* distance */) + +IPC_MESSAGE_ROUTED0(FrameHostMsg_NavigationHandledByEmbedder) #endif // Adding a new message? Stick to the sort order above: first platform
diff --git a/content/public/browser/gpu_data_manager.h b/content/public/browser/gpu_data_manager.h index 47767fd..f2e3b64 100644 --- a/content/public/browser/gpu_data_manager.h +++ b/content/public/browser/gpu_data_manager.h
@@ -40,6 +40,7 @@ virtual bool IsFeatureBlacklisted(int feature) const = 0; virtual bool IsFeatureEnabled(int feature) const = 0; + virtual bool IsWebGLEnabled() const = 0; virtual gpu::GPUInfo GetGPUInfo() const = 0;
diff --git a/chrome/browser/ntp_snippets/fake_download_item.cc b/content/public/test/fake_download_item.cc similarity index 92% rename from chrome/browser/ntp_snippets/fake_download_item.cc rename to content/public/test/fake_download_item.cc index 39eb275..a415a08 100644 --- a/chrome/browser/ntp_snippets/fake_download_item.cc +++ b/content/public/test/fake_download_item.cc
@@ -2,13 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ntp_snippets/fake_download_item.h" +#include "content/public/test/fake_download_item.h" #include "base/bind.h" -using content::DownloadItem; - -namespace test { +namespace content { FakeDownloadItem::FakeDownloadItem() = default; @@ -164,9 +162,9 @@ NOTREACHED(); } -content::DownloadInterruptReason FakeDownloadItem::GetLastReason() const { +DownloadInterruptReason FakeDownloadItem::GetLastReason() const { NOTREACHED(); - return content::DownloadInterruptReason(); + return DownloadInterruptReason(); } bool FakeDownloadItem::IsPaused() const { @@ -294,9 +292,9 @@ return false; } -content::DownloadDangerType FakeDownloadItem::GetDangerType() const { +DownloadDangerType FakeDownloadItem::GetDangerType() const { NOTREACHED(); - return content::DownloadDangerType(); + return DownloadDangerType(); } bool FakeDownloadItem::TimeRemaining(base::TimeDelta* remaining) const { @@ -371,18 +369,17 @@ return base::Time(); } -content::BrowserContext* FakeDownloadItem::GetBrowserContext() const { +BrowserContext* FakeDownloadItem::GetBrowserContext() const { NOTREACHED(); return nullptr; } -content::WebContents* FakeDownloadItem::GetWebContents() const { +WebContents* FakeDownloadItem::GetWebContents() const { NOTREACHED(); return nullptr; } -void FakeDownloadItem::OnContentCheckCompleted( - content::DownloadDangerType danger_type) { +void FakeDownloadItem::OnContentCheckCompleted(DownloadDangerType danger_type) { NOTREACHED(); } @@ -407,4 +404,4 @@ return std::string(); } -} // namespace test +} // namespace content
diff --git a/chrome/browser/ntp_snippets/fake_download_item.h b/content/public/test/fake_download_item.h similarity index 88% rename from chrome/browser/ntp_snippets/fake_download_item.h rename to content/public/test/fake_download_item.h index 37e36146..e11054a 100644 --- a/chrome/browser/ntp_snippets/fake_download_item.h +++ b/content/public/test/fake_download_item.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ -#define CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ +#ifndef CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ +#define CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ #include <string> #include <vector> @@ -17,9 +17,9 @@ #include "ui/base/page_transition_types.h" #include "url/gurl.h" -namespace test { +namespace content { -class FakeDownloadItem : public content::DownloadItem { +class FakeDownloadItem : public DownloadItem { public: FakeDownloadItem(); ~FakeDownloadItem() override; @@ -76,7 +76,7 @@ void Remove() override; void OpenDownload() override; void ShowDownloadInShell() override; - content::DownloadInterruptReason GetLastReason() const override; + DownloadInterruptReason GetLastReason() const override; bool IsPaused() const override; bool IsTemporary() const override; bool CanResume() const override; @@ -102,7 +102,7 @@ const std::string& GetHash() const override; void DeleteFile(const base::Callback<void(bool)>& callback) override; bool IsDangerous() const override; - content::DownloadDangerType GetDangerType() const override; + DownloadDangerType GetDangerType() const override; bool TimeRemaining(base::TimeDelta* remaining) const override; int64_t CurrentSpeed() const override; int PercentComplete() const override; @@ -118,10 +118,9 @@ bool GetAutoOpened() override; bool GetOpened() const override; base::Time GetLastAccessTime() const override; - content::BrowserContext* GetBrowserContext() const override; - content::WebContents* GetWebContents() const override; - void OnContentCheckCompleted( - content::DownloadDangerType danger_type) override; + BrowserContext* GetBrowserContext() const override; + WebContents* GetWebContents() const override; + void OnContentCheckCompleted(DownloadDangerType danger_type) override; void SetOpenWhenComplete(bool open) override; void SetOpened(bool opened) override; void SetLastAccessTime(base::Time time) override; @@ -150,6 +149,6 @@ DISALLOW_COPY_AND_ASSIGN(FakeDownloadItem); }; -} // namespace test +} // namespace content -#endif // CHROME_BROWSER_NTP_SNIPPETS_FAKE_DOWNLOAD_ITEM_H_ +#endif // CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index aa76a1ed..30c3607 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -5268,6 +5268,10 @@ this, is_content_initiated, render_view_was_created_by_renderer, frame_, info.urlRequest, info.navigationType, info.defaultPolicy, is_redirect)) { + if (IsBrowserSideNavigationEnabled()) { + // Need to let the browser know so it can notify its observers. + Send(new FrameHostMsg_NavigationHandledByEmbedder(routing_id_)); + } return blink::WebNavigationPolicyIgnore; } #endif
diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc index 6ee164f..3ace069a 100644 --- a/content/shell/browser/shell_url_request_context_getter.cc +++ b/content/shell/browser/shell_url_request_context_getter.cc
@@ -25,7 +25,8 @@ #include "net/base/cache_type.h" #include "net/cert/cert_verifier.h" #include "net/cert/ct_policy_enforcer.h" -#include "net/cert/multi_log_ct_verifier.h" +#include "net/cert/ct_policy_status.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cookies/cookie_monster.h" #include "net/dns/host_resolver.h" #include "net/dns/mapped_host_resolver.h" @@ -52,6 +53,29 @@ namespace { +// TODO(rsleevi): Embedders should see https://crbug.com/700973 before using +// this pattern. +class IgnoresCTPolicyEnforcer : public net::CTPolicyEnforcer { + public: + IgnoresCTPolicyEnforcer() = default; + ~IgnoresCTPolicyEnforcer() override = default; + + net::ct::CertPolicyCompliance DoesConformToCertPolicy( + net::X509Certificate* cert, + const net::SCTList& verified_scts, + const net::NetLogWithSource& net_log) override { + return net::ct::CertPolicyCompliance::CERT_POLICY_COMPLIES_VIA_SCTS; + } + + net::ct::EVPolicyCompliance DoesConformToCTEVPolicy( + net::X509Certificate* cert, + const net::ct::EVCertsWhitelist* ev_whitelist, + const net::SCTList& verified_scts, + const net::NetLogWithSource& net_log) override { + return net::ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY; + } +}; + void InstallProtocolHandlers(net::URLRequestJobFactoryImpl* job_factory, ProtocolHandlerMap* protocol_handlers) { for (ProtocolHandlerMap::iterator it = @@ -143,9 +167,9 @@ storage_->set_transport_security_state( base::WrapUnique(new net::TransportSecurityState)); storage_->set_cert_transparency_verifier( - base::WrapUnique(new net::MultiLogCTVerifier)); + base::WrapUnique(new net::DoNothingCTVerifier)); storage_->set_ct_policy_enforcer( - base::WrapUnique(new net::CTPolicyEnforcer)); + base::WrapUnique(new IgnoresCTPolicyEnforcer)); storage_->set_proxy_service(GetProxyService()); storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); storage_->set_http_auth_handler_factory(
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 02d9c0fe..b5c8762 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -55,6 +55,8 @@ "../public/test/content_test_suite_base.h", "../public/test/download_test_observer.cc", "../public/test/download_test_observer.h", + "../public/test/fake_download_item.cc", + "../public/test/fake_download_item.h", "../public/test/fake_speech_recognition_manager.cc", "../public/test/fake_speech_recognition_manager.h", "../public/test/find_test_utils.cc",
diff --git a/device/geolocation/public/interfaces/OWNERS b/device/geolocation/public/interfaces/OWNERS index a40e03c..3db7b0e 100644 --- a/device/geolocation/public/interfaces/OWNERS +++ b/device/geolocation/public/interfaces/OWNERS
@@ -2,3 +2,6 @@ per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS + +# TEAM: fizz-team-lon@chromium.org +# COMPONENT: Blink>Location
diff --git a/device/power_save_blocker/OWNERS b/device/power_save_blocker/OWNERS index 9cd2ee4..65496a6 100644 --- a/device/power_save_blocker/OWNERS +++ b/device/power_save_blocker/OWNERS
@@ -1,3 +1,5 @@ boliu@chromium.org hashimoto@chromium.org scottmg@chromium.org + +# COMPONENT: Internals>Core
diff --git a/gpu/config/gpu_blacklist.cc b/gpu/config/gpu_blacklist.cc index 883cdd1..7d51e12 100644 --- a/gpu/config/gpu_blacklist.cc +++ b/gpu/config/gpu_blacklist.cc
@@ -22,8 +22,8 @@ GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); list->AddSupportedFeature("gpu_compositing", GPU_FEATURE_TYPE_GPU_COMPOSITING); - list->AddSupportedFeature("webgl", - GPU_FEATURE_TYPE_WEBGL); + list->AddSupportedFeature("accelerated_webgl", + GPU_FEATURE_TYPE_ACCELERATED_WEBGL); list->AddSupportedFeature("flash_3d", GPU_FEATURE_TYPE_FLASH3D); list->AddSupportedFeature("flash_stage3d",
diff --git a/gpu/config/gpu_blacklist_unittest.cc b/gpu/config/gpu_blacklist_unittest.cc index f156b6c..cbaf007b 100644 --- a/gpu/config/gpu_blacklist_unittest.cc +++ b/gpu/config/gpu_blacklist_unittest.cc
@@ -102,8 +102,8 @@ GPU_FEATURE_TYPE_GPU_COMPOSITING) GPU_BLACKLIST_FEATURE_TEST(WebGL, - "webgl", - GPU_FEATURE_TYPE_WEBGL) + "accelerated_webgl", + GPU_FEATURE_TYPE_ACCELERATED_WEBGL) GPU_BLACKLIST_FEATURE_TEST(Flash3D, "flash_3d",
diff --git a/gpu/config/gpu_feature_type.h b/gpu/config/gpu_feature_type.h index e5244032..9e99d97 100644 --- a/gpu/config/gpu_feature_type.h +++ b/gpu/config/gpu_feature_type.h
@@ -13,7 +13,7 @@ enum GpuFeatureType { GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS = 0, GPU_FEATURE_TYPE_GPU_COMPOSITING, - GPU_FEATURE_TYPE_WEBGL, + GPU_FEATURE_TYPE_ACCELERATED_WEBGL, GPU_FEATURE_TYPE_FLASH3D, GPU_FEATURE_TYPE_FLASH_STAGE3D, GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE,
diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc index cd49655..34f5e50 100644 --- a/gpu/config/software_rendering_list_json.cc +++ b/gpu/config/software_rendering_list_json.cc
@@ -31,7 +31,7 @@ "device_id": ["0x7249"], "multi_gpu_category": "any", "features": [ - "webgl", + "accelerated_webgl", "flash_3d", "flash_stage3d", "gpu_rasterization" @@ -59,7 +59,7 @@ "vendor_id": "0x8086", "device_id": ["0x27AE", "0x27A2"], "features": [ - "webgl", + "accelerated_webgl", "flash_3d", "flash_stage3d", "accelerated_2d_canvas" @@ -121,7 +121,7 @@ "device_id": ["0x0393"], "multi_gpu_category": "any", "features": [ - "webgl", + "accelerated_webgl", "flash_3d", "flash_stage3d", "gpu_rasterization" @@ -593,7 +593,7 @@ "vendor_id": "0x10de", "device_id": ["0x0163"], "features": [ - "webgl" + "accelerated_webgl" ] }, { @@ -636,7 +636,7 @@ } ], "features": [ - "webgl" + "accelerated_webgl" ] }, { @@ -691,7 +691,7 @@ "vendor_id": "0x8086", "device_id": ["0xa011"], "features": [ - "webgl" + "accelerated_webgl" ] }, { @@ -1024,7 +1024,7 @@ "features": [ "all", {"exceptions": [ - "webgl" + "accelerated_webgl" ]} ] }, @@ -1177,7 +1177,7 @@ "gl_vendor": "Vivante.*", "gl_renderer": ".*PXA.*", "features": [ - "webgl", + "accelerated_webgl", "accelerated_2d_canvas" ] },
diff --git a/ios/chrome/app/strings/ios_chromium_strings.grd b/ios/chrome/app/strings/ios_chromium_strings.grd index c347380..fbd2bb8 100644 --- a/ios/chrome/app/strings/ios_chromium_strings.grd +++ b/ios/chrome/app/strings/ios_chromium_strings.grd
@@ -288,6 +288,9 @@ <message name="IDS_IOS_UPGRADE_AVAILABLE" desc="Text to inform the user of the presence of a new version of the application"> Chromium just got better! A new version is available. </message> + <message name="IDS_IOS_SIGNIN_PROMO_SETTINGS" desc="Text to inform the user that they can sign in to get personal settings"> + To get your settings on all your devices, sign in to Chromium. + </message> </messages> </release> </grit>
diff --git a/ios/chrome/app/strings/ios_google_chrome_strings.grd b/ios/chrome/app/strings/ios_google_chrome_strings.grd index 12aca122..edc1c2c 100644 --- a/ios/chrome/app/strings/ios_google_chrome_strings.grd +++ b/ios/chrome/app/strings/ios_google_chrome_strings.grd
@@ -288,6 +288,9 @@ <message name="IDS_IOS_UPGRADE_AVAILABLE" desc="Text to inform the user of the presence of a new version of the application"> Chrome just got better! A new version is available. </message> + <message name="IDS_IOS_SIGNIN_PROMO_SETTINGS" desc="Text to inform the user that they can sign in to get personal settings"> + To get your settings on all your devices, sign in to Chrome. + </message> </messages> </release> </grit>
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 28296d77..f0fd75a 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1504,6 +1504,12 @@ <message name="IDS_IOS_VOICE_SEARCH_SETTING_TTS" desc="The label for setting switch enabling text-to-speech response after voice search [Length: 29em] [iOS only]"> Speak Answers Back </message> + <message name="IDS_IOS_SIGNIN_PROMO_CONTINUE_AS" desc="Button that the user can press to login without asking the password and continue using Chrome with this acccount. [Length: 9em]"> + Continue as <ph name="NAME">$1<ex>John Doe</ex></ph> + </message> + <message name="IDS_IOS_SIGNIN_PROMO_NOT" desc="Button that the user can press if they are not the profile that Chrome found (opposite of 'Continue as Joe Doe')."> + Not <ph name="EMAIL">$1<ex>john.doe@example.com</ex>?</ph> + </message> </messages> </release> </grit>
diff --git a/ios/chrome/browser/interstitials/BUILD.gn b/ios/chrome/browser/interstitials/BUILD.gn index ef500ba..5cf360b 100644 --- a/ios/chrome/browser/interstitials/BUILD.gn +++ b/ios/chrome/browser/interstitials/BUILD.gn
@@ -24,6 +24,7 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/history", "//ios/web", + "//ios/web:reload_type", "//ui/base", "//url", ]
diff --git a/ios/chrome/browser/interstitials/ios_chrome_controller_client.mm b/ios/chrome/browser/interstitials/ios_chrome_controller_client.mm index 2d5658a..fa640ea 100644 --- a/ios/chrome/browser/interstitials/ios_chrome_controller_client.mm +++ b/ios/chrome/browser/interstitials/ios_chrome_controller_client.mm
@@ -11,6 +11,7 @@ #include "ios/chrome/browser/pref_names.h" #include "ios/web/public/interstitials/web_interstitial.h" #import "ios/web/public/navigation_manager.h" +#include "ios/web/public/reload_type.h" #include "ios/web/public/web_state/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -54,7 +55,8 @@ } void IOSChromeControllerClient::Reload() { - web_state_->GetNavigationManager()->Reload(true); + web_state_->GetNavigationManager()->Reload(web::ReloadType::NORMAL, + true /*check_for_repost*/); } void IOSChromeControllerClient::OpenUrlInCurrentTab(const GURL& url) {
diff --git a/ios/chrome/browser/reading_list/BUILD.gn b/ios/chrome/browser/reading_list/BUILD.gn index 40d5ac3..98434f6 100644 --- a/ios/chrome/browser/reading_list/BUILD.gn +++ b/ios/chrome/browser/reading_list/BUILD.gn
@@ -45,6 +45,7 @@ "//ios/chrome/browser/history", "//ios/chrome/common", "//ios/web", + "//ios/web:reload_type", "//net", "//url", ] @@ -73,6 +74,7 @@ "//ios/chrome/browser/dom_distiller", "//ios/testing:ios_test_support", "//ios/web", + "//ios/web:reload_type", "//ios/web:test_support", "//net", "//testing/gtest",
diff --git a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm index 89e9c86..58ac2e8 100644 --- a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm +++ b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
@@ -15,6 +15,7 @@ #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" #include "ios/web/public/navigation_item.h" #include "ios/web/public/navigation_manager.h" +#include "ios/web/public/reload_type.h" #include "ios/web/public/web_state/web_state_user_data.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -294,7 +295,8 @@ item = navigationManager->GetLastCommittedItem(); item->SetURL(url); item->SetVirtualURL(pending_url_); - navigationManager->Reload(false); + navigationManager->Reload(web::ReloadType::NORMAL, + false /*check_for_repost*/); } else if (navigationManager->GetPendingItemIndex() != -1 && navigationManager->GetItemAtIndex( navigationManager->GetPendingItemIndex()) == item) {
diff --git a/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm b/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm index 2cb4bc7..6c31e54 100644 --- a/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm +++ b/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm
@@ -8,6 +8,7 @@ #include "components/reading_list/ios/reading_list_model_impl.h" #include "ios/chrome/browser/reading_list/offline_url_utils.h" #import "ios/web/public/navigation_item.h" +#include "ios/web/public/reload_type.h" #import "ios/web/public/test/fakes/test_navigation_manager.h" #import "ios/web/public/test/fakes/test_web_state.h" #include "ios/web/public/test/web_test.h" @@ -25,7 +26,9 @@ // A Test navigation manager that checks if Reload was called. class TestNavigationManager : public web::TestNavigationManager { public: - void Reload(bool check_for_repost) override { reload_called_ = true; } + void Reload(web::ReloadType reload_type, bool check_for_repost) override { + reload_called_ = true; + } bool ReloadCalled() { return reload_called_; } private:
diff --git a/ios/chrome/browser/ui/first_run/first_run_egtest.mm b/ios/chrome/browser/ui/first_run/first_run_egtest.mm index 84fba96f..13584af 100644 --- a/ios/chrome/browser/ui/first_run/first_run_egtest.mm +++ b/ios/chrome/browser/ui/first_run/first_run_egtest.mm
@@ -21,6 +21,7 @@ #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/ui/first_run/first_run_chrome_signin_view_controller.h" #include "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h" +#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/chrome/test/app/chrome_test_util.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h" @@ -114,7 +115,8 @@ [[EarlGrey selectElementWithMatcher:termsOfServiceLink] performAction:grey_tap()]; - [[EarlGrey selectElementWithMatcher:grey_text(@"Chromium Terms of Service")] + [[EarlGrey selectElementWithMatcher:grey_text(l10n_util::GetNSString( + IDS_IOS_FIRSTRUN_TERMS_TITLE))] assertWithMatcher:grey_sufficientlyVisible()]; [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"back_bar_button")]
diff --git a/ios/chrome/browser/ui/reading_list/BUILD.gn b/ios/chrome/browser/ui/reading_list/BUILD.gn index f2f1b10..6f99991 100644 --- a/ios/chrome/browser/ui/reading_list/BUILD.gn +++ b/ios/chrome/browser/ui/reading_list/BUILD.gn
@@ -80,6 +80,7 @@ "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios", "//ios/web", + "//ios/web:reload_type", "//net", "//ui/base", "//ui/strings",
diff --git a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm index 53c4b8a..0b37551d 100644 --- a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm +++ b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm
@@ -15,6 +15,7 @@ #include "ios/web/public/browser_state.h" #import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" +#include "ios/web/public/reload_type.h" #import "ios/web/public/web_state/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -88,7 +89,8 @@ - (void)reload { [self restoreOnlineURL]; - _webState->GetNavigationManager()->Reload(false); + _webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, + false /*check_for_repost*/); } - (void)restoreOnlineURL {
diff --git a/ios/chrome/browser/ui/settings/cells/BUILD.gn b/ios/chrome/browser/ui/settings/cells/BUILD.gn index 74d8d7c5..f4c11e10 100644 --- a/ios/chrome/browser/ui/settings/cells/BUILD.gn +++ b/ios/chrome/browser/ui/settings/cells/BUILD.gn
@@ -28,6 +28,8 @@ "passphrase_error_item.mm", "password_details_item.h", "password_details_item.mm", + "signin_promo_item.h", + "signin_promo_item.mm", "sync_switch_item.h", "sync_switch_item.mm", "text_and_error_item.h", @@ -66,6 +68,7 @@ "native_app_item_unittest.mm", "passphrase_error_item_unittest.mm", "password_details_item_unittest.mm", + "signin_promo_item_unittest.mm", "sync_switch_item_unittest.mm", "text_and_error_item_unittest.mm", "version_item_unittest.mm",
diff --git a/ios/chrome/browser/ui/settings/cells/signin_promo_item.h b/ios/chrome/browser/ui/settings/cells/signin_promo_item.h new file mode 100644 index 0000000..e96ff3d --- /dev/null +++ b/ios/chrome/browser/ui/settings/cells/signin_promo_item.h
@@ -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. + +#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SIGNIN_PROMO_ITEM_H_ +#define IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SIGNIN_PROMO_ITEM_H_ + +#import <UIKit/UIKit.h> + +#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" +#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h" + +@class MDCFlatButton; + +// SigninPromoItem is an item that configures a SigninPromoCell cell. +@interface SigninPromoItem : CollectionViewItem + +// Item image. +@property(nonatomic, copy) UIImage* profileImage; +@property(nonatomic, copy) NSString* profileName; +@property(nonatomic, copy) NSString* profileEmail; + +@end + +// Cell representation for SigninPromoItem. The cell displays an image, a title +// text label, a sign-in button and a "Not me" button. This is intended to be +// used to let the user sign-in without entering his/her password based on a +// profile already known in Chrome/Chromium. The user can also remove the +// suggested profile if (s)he is not related to the suggested profile, using the +// "Not me" button. +@interface SigninPromoCell : MDCCollectionViewCell + +// Profile imageView. +@property(nonatomic, readonly, strong) UIImageView* imageView; +// Cell title. +@property(nonatomic, readonly, strong) UILabel* textLabel; +// Signin button. +@property(nonatomic, readonly, strong) MDCFlatButton* signinButton; +// Not-me button. +@property(nonatomic, readonly, strong) MDCFlatButton* notMeButton; + +@end + +#endif // IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SIGNIN_PROMO_ITEM_H_
diff --git a/ios/chrome/browser/ui/settings/cells/signin_promo_item.mm b/ios/chrome/browser/ui/settings/cells/signin_promo_item.mm new file mode 100644 index 0000000..e8f25ad --- /dev/null +++ b/ios/chrome/browser/ui/settings/cells/signin_promo_item.mm
@@ -0,0 +1,230 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/settings/cells/signin_promo_item.h" + +#include "base/strings/sys_string_conversions.h" +#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" +#include "ios/chrome/grit/ios_chromium_strings.h" +#include "ios/chrome/grit/ios_strings.h" +#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" +#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" +#include "ui/base/l10n/l10n_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +// Horizontal padding for label and buttons. +const CGFloat kHorizontalPadding = 40; +// Vertical padding for the image and the label. +const CGFloat kVerticalPadding = 12; +// Vertical padding for buttons. +const CGFloat kButtonVerticalPadding = 6; +// Image size. +const CGFloat kImageFixedSize = 48; +// Button height. +const CGFloat kButtonHeight = 36; +} + +@implementation SigninPromoItem + +@synthesize profileImage = _profileImage; +@synthesize profileName = _profileName; +@synthesize profileEmail = _profileEmail; + +- (instancetype)initWithType:(NSInteger)type { + self = [super initWithType:type]; + if (self) { + self.cellClass = [SigninPromoCell class]; + } + return self; +} + +#pragma mark - CollectionViewItem + +- (void)configureCell:(SigninPromoCell*)cell { + [super configureCell:cell]; + cell.imageView.image = _profileImage; + cell.textLabel.text = l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS); + [cell.signinButton + setTitle:l10n_util::GetNSStringF(IDS_IOS_SIGNIN_PROMO_CONTINUE_AS, + base::SysNSStringToUTF16(_profileName)) + forState:UIControlStateNormal]; + [cell.notMeButton + setTitle:l10n_util::GetNSStringF(IDS_IOS_SIGNIN_PROMO_NOT, + base::SysNSStringToUTF16(_profileEmail)) + forState:UIControlStateNormal]; +} + +@end + +@implementation SigninPromoCell + +@synthesize imageView = _imageView; +@synthesize textLabel = _textLabel; +@synthesize signinButton = _signinButton; +@synthesize notMeButton = _notMeButton; + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.isAccessibilityElement = YES; + [self addSubviews]; + [self setDefaultViewStyling]; + [self setViewConstraints]; + } + return self; +} + +// Create and add subviews. +- (void)addSubviews { + UIView* contentView = self.contentView; + contentView.clipsToBounds = YES; + + _imageView = [[UIImageView alloc] init]; + _imageView.translatesAutoresizingMaskIntoConstraints = NO; + [contentView addSubview:_imageView]; + + _textLabel = [[UILabel alloc] init]; + _textLabel.translatesAutoresizingMaskIntoConstraints = NO; + [contentView addSubview:_textLabel]; + + _signinButton = [[MDCFlatButton alloc] init]; + _signinButton.translatesAutoresizingMaskIntoConstraints = NO; + _signinButton.accessibilityIdentifier = @"signin_promo_button"; + [contentView addSubview:_signinButton]; + + _notMeButton = [[MDCFlatButton alloc] init]; + _notMeButton.translatesAutoresizingMaskIntoConstraints = NO; + _notMeButton.accessibilityIdentifier = @"signin_promo_no_button"; + [contentView addSubview:_notMeButton]; +} + +- (void)setDefaultViewStyling { + _imageView.contentMode = UIViewContentModeCenter; + _imageView.layer.masksToBounds = YES; + _imageView.contentMode = UIViewContentModeScaleAspectFit; + _textLabel.font = [MDCTypography buttonFont]; + _textLabel.textColor = [[MDCPalette greyPalette] tint900]; + _textLabel.numberOfLines = 0; + _textLabel.textAlignment = NSTextAlignmentCenter; + [_signinButton setBackgroundColor:[[MDCPalette cr_bluePalette] tint500] + forState:UIControlStateNormal]; + _signinButton.customTitleColor = [UIColor whiteColor]; + _signinButton.inkColor = [UIColor colorWithWhite:1 alpha:0.2]; + _notMeButton.customTitleColor = [[MDCPalette cr_bluePalette] tint500]; + _notMeButton.uppercaseTitle = NO; +} + +- (void)setViewConstraints { + UIView* contentView = self.contentView; + + [NSLayoutConstraint activateConstraints:@[ + // Set vertical anchors. + [_imageView.topAnchor constraintEqualToAnchor:contentView.topAnchor + constant:kVerticalPadding * 2], + [_textLabel.topAnchor constraintEqualToAnchor:_imageView.bottomAnchor + constant:kVerticalPadding], + [_signinButton.topAnchor + constraintEqualToAnchor:_textLabel.bottomAnchor + constant:kVerticalPadding + kButtonVerticalPadding], + [_notMeButton.topAnchor constraintEqualToAnchor:_signinButton.bottomAnchor + constant:kButtonVerticalPadding * 2], + [contentView.bottomAnchor + constraintEqualToAnchor:_notMeButton.bottomAnchor + constant:kVerticalPadding + kButtonVerticalPadding], + + // Set horizontal anchors. + [_imageView.centerXAnchor + constraintEqualToAnchor:contentView.centerXAnchor], + [_textLabel.centerXAnchor + constraintEqualToAnchor:contentView.centerXAnchor], + [_signinButton.centerXAnchor + constraintEqualToAnchor:contentView.centerXAnchor], + [_signinButton.leadingAnchor + constraintEqualToAnchor:contentView.leadingAnchor + constant:kHorizontalPadding], + [contentView.trailingAnchor + constraintEqualToAnchor:_signinButton.trailingAnchor + constant:kHorizontalPadding], + [_notMeButton.centerXAnchor + constraintEqualToAnchor:contentView.centerXAnchor], + [_notMeButton.leadingAnchor + constraintEqualToAnchor:contentView.leadingAnchor + constant:kHorizontalPadding], + [contentView.trailingAnchor + constraintEqualToAnchor:_notMeButton.trailingAnchor + constant:kHorizontalPadding], + + // Fix width and height. + [_imageView.widthAnchor constraintEqualToConstant:kImageFixedSize], + [_imageView.heightAnchor constraintEqualToConstant:kImageFixedSize], + [_signinButton.heightAnchor constraintEqualToConstant:kButtonHeight], + [_notMeButton.heightAnchor constraintEqualToConstant:kButtonHeight], + ]]; +} + +// Implements -layoutSubviews as per instructions in documentation for +// +[MDCCollectionViewCell cr_preferredHeightForWidth:forItem:]. +- (void)layoutSubviews { + [super layoutSubviews]; + + // Adjust the text label preferredMaxLayoutWidth when the parent's width + // changes, for instance on screen rotation. + CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); + _textLabel.preferredMaxLayoutWidth = parentWidth - 2 * kHorizontalPadding; + + // Re-layout with the new preferred width to allow the label to adjust its + // height. + [super layoutSubviews]; +} + +#pragma mark - Action + +- (void)accessibilitySigninAction:(id)unused { + // TODO(jlebel): Need to implement + NSLog(@"Sign-in action"); +} + +- (void)accessibilityNotMeAction:(id)unused { + // TODO(jlebel): Need to implement + NSLog(@"Not me action"); +} + +#pragma mark - UICollectionReusableView + +- (void)prepareForReuse { + [super prepareForReuse]; + _imageView.image = nil; + _textLabel.text = nil; + _signinButton = nil; + _notMeButton = nil; +} + +#pragma mark - NSObject(Accessibility) + +- (NSArray<UIAccessibilityCustomAction*>*)accessibilityCustomActions { + NSString* signinActionName = + [_signinButton titleForState:UIControlStateNormal]; + UIAccessibilityCustomAction* signinCustomAction = + [[UIAccessibilityCustomAction alloc] + initWithName:signinActionName + target:self + selector:@selector(accessibilitySigninAction:)]; + NSString* notMeActionName = [_notMeButton titleForState:UIControlStateNormal]; + UIAccessibilityCustomAction* notMeCustomAction = + [[UIAccessibilityCustomAction alloc] + initWithName:notMeActionName + target:self + selector:@selector(accessibilityNotMeAction:)]; + return [NSArray arrayWithObjects:signinCustomAction, notMeCustomAction, nil]; +} + +- (NSString*)accessibilityLabel { + return l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS); +} + +@end
diff --git a/ios/chrome/browser/ui/settings/cells/signin_promo_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/signin_promo_item_unittest.mm new file mode 100644 index 0000000..91fe8705 --- /dev/null +++ b/ios/chrome/browser/ui/settings/cells/signin_promo_item_unittest.mm
@@ -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. + +#import "ios/chrome/browser/ui/settings/cells/signin_promo_item.h" + +#import <CoreGraphics/CoreGraphics.h> +#import <UIKit/UIKit.h> + +#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" +#import "testing/gtest_mac.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// Tests that the profile image, the profile name and the profile email are set +// properly after a call to |configureCell:|. +TEST(SigninPromoItemTest, ConfigureCell) { + SigninPromoItem* item = [[SigninPromoItem alloc] initWithType:0]; + UIImage* image = [[UIImage alloc] init]; + + item.profileImage = image; + item.profileName = @"John Doe"; + item.profileEmail = @"johndoe@gmail.com"; + + id cell = [[[item cellClass] alloc] init]; + ASSERT_TRUE([cell isMemberOfClass:[SigninPromoCell class]]); + + SigninPromoCell* signInCell = cell; + EXPECT_FALSE(signInCell.imageView.image); + + [item configureCell:signInCell]; + + EXPECT_NSEQ(image, signInCell.imageView.image); + NSString* upperCaseProfileName = [item.profileName uppercaseString]; + NSRange profileNameRange = [signInCell.signinButton.titleLabel.text + rangeOfString:upperCaseProfileName]; + EXPECT_NE(profileNameRange.length, 0u); + NSRange profileEmailRange = + [signInCell.notMeButton.titleLabel.text rangeOfString:item.profileEmail]; + EXPECT_NE(profileEmailRange.length, 0u); +}
diff --git a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm index c475920..62af0ac 100644 --- a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm +++ b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
@@ -29,6 +29,7 @@ #import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h" #import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h" #import "ios/chrome/browser/ui/settings/cells/native_app_item.h" +#import "ios/chrome/browser/ui/settings/cells/signin_promo_item.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" @@ -69,6 +70,7 @@ ItemTypeAccountDetail, ItemTypeAccountCheckMark, ItemTypeAccountSignIn, + ItemTypeSigninPromo, ItemTypeApp, ItemTypePaymentsSingleLine, ItemTypePaymentsDynamicHeight, @@ -290,6 +292,8 @@ toSectionWithIdentifier:SectionIdentifierAccountCell]; [model addItem:[self accountSignInItem] toSectionWithIdentifier:SectionIdentifierAccountCell]; + [model addItem:[self signinPromoItem] + toSectionWithIdentifier:SectionIdentifierAccountCell]; // Account control cells. [model addSectionWithIdentifier:SectionIdentifierAccountControlCell]; @@ -350,6 +354,7 @@ case ItemTypeAutofillStorageSwitch: case ItemTypePaymentsDynamicHeight: case ItemTypeAutofillDynamicHeight: + case ItemTypeSigninPromo: return [MDCCollectionViewCell cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds) forItem:item]; @@ -398,13 +403,17 @@ hidesInkViewAtIndexPath:(nonnull NSIndexPath*)indexPath { NSInteger sectionIdentifier = [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; - switch (sectionIdentifier) { - case SectionIdentifierFooters: + if (sectionIdentifier == SectionIdentifierFooters) + return YES; + CollectionViewItem* item = + [self.collectionViewModel itemAtIndexPath:indexPath]; + switch (item.type) { case ItemTypeSwitchBasic: case ItemTypeSwitchDynamicHeight: case ItemTypeApp: case ItemTypeAutofillStorageSwitch: case ItemTypeSwitchSync: + case ItemTypeSigninPromo: return YES; default: return NO; @@ -453,6 +462,19 @@ return accountSignInItem; } +- (CollectionViewItem*)signinPromoItem { + SigninPromoItem* signinPromoItem = + [[[SigninPromoItem alloc] initWithType:ItemTypeSigninPromo] autorelease]; + signinPromoItem.profileName = @"Jane"; + signinPromoItem.profileEmail = @"jane@example.com"; + signinPromoItem.profileImage = + CircularImageFromImage(ios::GetChromeBrowserProvider() + ->GetSigninResourcesProvider() + ->GetDefaultAvatar(), + kHorizontalImageFixedSize); + return signinPromoItem; +} + - (CollectionViewItem*)accountControlItem { AccountControlItem* item = [[[AccountControlItem alloc] initWithType:ItemTypeAccountControlDynamicHeight] autorelease];
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index 521701a..2c904e9 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -19,6 +19,7 @@ deps = [ ":core", ":js_resources", + ":reload_type", ":resources", ":user_agent", "//base", @@ -257,6 +258,7 @@ deps = [ ":core", ":js_resources", + ":reload_type", ":resources", ":user_agent", "//base", @@ -345,6 +347,12 @@ configs += [ "//build/config/compiler:enable_arc" ] } +source_set("reload_type") { + sources = [ + "public/reload_type.h", + ] +} + source_set("earl_grey_test_support") { testonly = true
diff --git a/ios/web/interstitials/web_interstitial_impl.mm b/ios/web/interstitials/web_interstitial_impl.mm index 4187248f..30698e6 100644 --- a/ios/web/interstitials/web_interstitial_impl.mm +++ b/ios/web/interstitials/web_interstitial_impl.mm
@@ -10,6 +10,7 @@ #import "ios/web/navigation/navigation_manager_impl.h" #import "ios/web/public/interstitials/web_interstitial_delegate.h" #import "ios/web/public/navigation_manager.h" +#include "ios/web/public/reload_type.h" #import "ios/web/web_state/web_state_impl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -93,7 +94,7 @@ NSUserDefaults* user_defaults = [NSUserDefaults standardUserDefaults]; if (![user_defaults boolForKey:@"PendingIndexNavigationDisabled"]) { // Reload last committed entry. - nav_manager->Reload(true /* check_for_repost */); + nav_manager->Reload(ReloadType::NORMAL, true /* check_for_repost */); } delete this;
diff --git a/ios/web/navigation/navigation_manager_impl.h b/ios/web/navigation/navigation_manager_impl.h index 560a383..fb45737 100644 --- a/ios/web/navigation/navigation_manager_impl.h +++ b/ios/web/navigation/navigation_manager_impl.h
@@ -14,6 +14,7 @@ #include "base/macros.h" #import "ios/web/public/navigation_item_list.h" #import "ios/web/public/navigation_manager.h" +#include "ios/web/public/reload_type.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h" @@ -140,7 +141,7 @@ void GoBack() override; void GoForward() override; void GoToIndex(int index) override; - void Reload(bool check_for_reposts) override; + void Reload(ReloadType reload_type, bool check_for_reposts) override; void OverrideDesktopUserAgentForNextPendingItem() override; // Returns the current list of transient url rewriters, passing ownership to
diff --git a/ios/web/navigation/navigation_manager_impl.mm b/ios/web/navigation/navigation_manager_impl.mm index 76c6046..cd140448 100644 --- a/ios/web/navigation/navigation_manager_impl.mm +++ b/ios/web/navigation/navigation_manager_impl.mm
@@ -17,6 +17,7 @@ #include "ios/web/navigation/navigation_manager_facade_delegate.h" #include "ios/web/public/load_committed_details.h" #import "ios/web/public/navigation_item.h" +#include "ios/web/public/reload_type.h" #import "ios/web/public/web_client.h" #import "ios/web/public/web_state/web_state.h" #include "ui/base/page_transition_types.h" @@ -337,7 +338,8 @@ delegate_->GoToIndex(index); } -void NavigationManagerImpl::Reload(bool check_for_reposts) { +void NavigationManagerImpl::Reload(ReloadType reload_type, + bool check_for_reposts) { // Navigation manager may be empty if the only pending item failed to load // with SSL error and the user has decided not to proceed. NavigationItem* item = GetVisibleItem();
diff --git a/ios/web/public/navigation_manager.h b/ios/web/public/navigation_manager.h index 3cd75e3..ac49dce6 100644 --- a/ios/web/public/navigation_manager.h +++ b/ios/web/public/navigation_manager.h
@@ -10,6 +10,7 @@ #import "base/mac/scoped_nsobject.h" #include "ios/web/public/browser_url_rewriter.h" #include "ios/web/public/referrer.h" +#include "ios/web/public/reload_type.h" #include "ui/base/page_transition_types.h" @class NSDictionary; @@ -149,11 +150,15 @@ // TODO(crbug.com/533848): Update to use size_t. virtual void GoToIndex(int index) = 0; - // Reloads the current item. If |check_for_repost| is true and the current - // item has POST data the user is prompted to see if they really want to - // reload the page. In nearly all cases pass in true. If a transient item is - // showing, initiates a new navigation to its URL. - virtual void Reload(bool check_for_repost) = 0; + // Reloads the visible item under the specified ReloadType. If + // |check_for_repost| is true and the current item has POST data the user is + // prompted to see if they really want to reload the page. In nearly all cases + // pass in true. If a transient item is showing, initiates a new navigation + // to its URL. + // TODO(crbug.com/700571): implement the logic for when |reload_type| is + // ORIGINAL_REQUEST_URL. + // TODO(crbug.com/700958): implement the logic for |check_for_repost|. + virtual void Reload(ReloadType reload_type, bool check_for_repost) = 0; // Forces the pending item to be loaded using desktop user agent. Note that // the pending item may or may not already exist.
diff --git a/ios/web/public/reload_type.h b/ios/web/public/reload_type.h new file mode 100644 index 0000000..6ba46530 --- /dev/null +++ b/ios/web/public/reload_type.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_WEB_PUBLIC_RELOAD_TYPE_H_ +#define IOS_WEB_PUBLIC_RELOAD_TYPE_H_ + +namespace web { + +// Used to specify detailed behavior on requesting reload. +enum class ReloadType : short { + // Reloads the visible item. + NORMAL = 0, + + // Reloads the visible item using the original URL used to create it. This + // is used for cases where the user wants to refresh a page using a different + // user agent after following a redirect. + ORIGINAL_REQUEST_URL, +}; + +} // namespace web + +#endif // IOS_WEB_PUBLIC_RELOAD_TYPE_H_
diff --git a/ios/web/public/test/fakes/test_navigation_manager.h b/ios/web/public/test/fakes/test_navigation_manager.h index 812077a..e36ebb72e 100644 --- a/ios/web/public/test/fakes/test_navigation_manager.h +++ b/ios/web/public/test/fakes/test_navigation_manager.h
@@ -38,7 +38,7 @@ void GoBack() override; void GoForward() override; void GoToIndex(int index) override; - void Reload(bool check_for_reposts) override; + void Reload(ReloadType reload_type, bool check_for_reposts) override; void OverrideDesktopUserAgentForNextPendingItem() override; // Setters for test data.
diff --git a/ios/web/public/test/fakes/test_navigation_manager.mm b/ios/web/public/test/fakes/test_navigation_manager.mm index 954d59a..b6ca37e 100644 --- a/ios/web/public/test/fakes/test_navigation_manager.mm +++ b/ios/web/public/test/fakes/test_navigation_manager.mm
@@ -127,7 +127,8 @@ NOTREACHED(); } -void TestNavigationManager::Reload(bool check_for_repost) { +void TestNavigationManager::Reload(ReloadType reload_type, + bool check_for_repost) { NOTREACHED(); }
diff --git a/ios/web_view/internal/BUILD.gn b/ios/web_view/internal/BUILD.gn index a0bdd299..167256b 100644 --- a/ios/web_view/internal/BUILD.gn +++ b/ios/web_view/internal/BUILD.gn
@@ -43,6 +43,7 @@ "//components/translate/core/common", "//ios/net", "//ios/web", + "//ios/web:reload_type", "//ios/web:user_agent", "//ios/web/public/app", "//ios/web_view/internal/translate",
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm index c454bb3..ff7c2d1e 100644 --- a/ios/web_view/internal/cwv_web_view.mm +++ b/ios/web_view/internal/cwv_web_view.mm
@@ -12,6 +12,7 @@ #include "base/strings/sys_string_conversions.h" #import "ios/web/public/navigation_manager.h" #include "ios/web/public/referrer.h" +#include "ios/web/public/reload_type.h" #import "ios/web/public/web_state/context_menu_params.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/ui/crw_web_delegate.h" @@ -131,7 +132,7 @@ } - (void)reload { - _webState->GetNavigationManager()->Reload(true); + _webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, true); } - (void)stopLoading {
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 2e1e08b..ca3449d 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -3770,6 +3770,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gin_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "gn_unittests" }, { @@ -3814,6 +3820,12 @@ }, { "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "input_device_unittests" + }, + { + "swarming": { "can_use_on_swarming_builders": true, "shards": 3 }, @@ -3858,6 +3870,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "media_service_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "media_unittests" }, { @@ -3876,6 +3894,24 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mojo_js_integration_tests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "mojo_js_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "mojo_public_application_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "mojo_public_bindings_unittests" }, { @@ -3912,6 +3948,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mus_public_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "mus_ws_unittests" }, { @@ -3930,6 +3972,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "navigation_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "net_unittests" }, { @@ -3969,6 +4017,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "service_manager_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "service_unittests" }, { @@ -4011,6 +4065,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "ui_struct_traits_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "ui_touch_selection_unittests" }, {
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 918da71..40310a5 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -884,19 +884,6 @@ # TODO(oshima): Mac Android are currently not supported. crbug.com/567837 [ Mac Android ] virtual/scalefactor200withzoom/fast/hidpi/static [ Skip ] -# More cleanup needed after SK_SUPPORT_LEGACY_BROKEN_LERP removal -crbug.com/700914 [ Win ] fast/table/backgr_position-table-row-collapsed-border.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_border-table-row-collapsed-border.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_simple-table-row-collapsed-border.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_simple-table-cell-collapsed-border.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_simple-table-cell.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_simple-table-column-group.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] fast/table/backgr_position-table-column-group-collapsed-border.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] http/tests/inspector/network/waterfall-images.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Win ] virtual/mojo-loading/http/tests/inspector/network/waterfall-images.html [ NeedsManualRebaseline ] -crbug.com/700914 [ Mac ] svg/W3C-SVG-1.1/animate-elem-14-t.svg [ NeedsManualRebaseline ] -crbug.com/700914 [ Mac10.9 Mac10.10 ] virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open.html [ NeedsManualRebaseline ] - # Mac does not support fractional scale factor. crbug.com/567837 [ Mac ] virtual/scalefactor150/fast/hidpi/static [ Skip ] @@ -2676,11 +2663,11 @@ crbug.com/697971 [ Mac10.12 ] virtual/gpu-rasterization/images/color-profile-background-image-cross-fade-png.html [ Failure ] crbug.com/697971 [ Mac10.12 ] virtual/gpu-rasterization/images/color-profile-background-image-cross-fade.html [ Failure ] crbug.com/697971 [ Mac10.12 ] virtual/gpu-rasterization/images/color-profile-mask-image-svg.html [ Failure ] -crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-arc-circumference-fill.html [ Failure ] -crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-arc-circumference.html [ Failure ] -crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-ellipse-circumference-fill.html [ Failure ] -crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-ellipse-circumference.html [ Failure ] -crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-incremental-repaint.html [ Failure ] +#crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-arc-circumference-fill.html [ Failure ] +#crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-arc-circumference.html [ Failure ] +#crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-ellipse-circumference-fill.html [ Failure ] +#crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-ellipse-circumference.html [ Failure ] +#crbug.com/697971 [ Mac10.12 ] virtual/gpu/fast/canvas/canvas-incremental-repaint.html [ Failure ] crbug.com/697971 [ Mac10.12 ] virtual/mojo-loading/http/tests/filesystem/input-display.html [ Failure ] crbug.com/697971 [ Mac10.12 ] virtual/mojo-loading/http/tests/inspector-protocol/network-data-length.html [ Failure ] crbug.com/697971 [ Mac10.12 ] virtual/mojo-loading/http/tests/media/media-source/mediasource-is-type-supported.html [ Failure ] @@ -2800,6 +2787,12 @@ crbug.com/660384 external/wpt/webmessaging/without-ports/001.html [ Failure ] crbug.com/673526 external/wpt/webmessaging/message-channels/close.html [ Failure ] +crbug.com/642376 virtual/gpu/fast/canvas/canvas-arc-circumference-fill.html [ NeedsManualRebaseline ] +crbug.com/642376 virtual/gpu/fast/canvas/canvas-arc-circumference.html [ NeedsManualRebaseline ] +crbug.com/642376 virtual/gpu/fast/canvas/canvas-ellipse-circumference-fill.html [ NeedsManualRebaseline ] +crbug.com/642376 virtual/gpu/fast/canvas/canvas-ellipse-circumference.html [ NeedsManualRebaseline ] +crbug.com/642376 virtual/gpu/fast/canvas/canvas-incremental-repaint.html [ NeedsManualRebaseline ] + # Added 2016-12-12 crbug.com/610835 http/tests/security/XFrameOptions/x-frame-options-deny-multiple-clients.html [ Failure Pass ] crbug.com/610835 virtual/mojo-loading/http/tests/security/XFrameOptions/x-frame-options-deny-multiple-clients.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations index f17bbf5..ef2a81b 100644 --- a/third_party/WebKit/LayoutTests/W3CImportExpectations +++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -272,7 +272,8 @@ ## Owners: none; No tests in the directory. # external/wpt/images [ Pass ] external/wpt/imagebitmap-renderingcontext [ Skip ] -external/wpt/infrastructure [ Skip ] +## Owners: smcgruer@chromium.org +# external/wpt/infrastructure [ Skip ] ## Owners: dom-dev@chromium.org # external/wpt/innerText [ Pass ] external/wpt/js [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items-expected.txt b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items-expected.txt deleted file mode 100644 index 5c39c1f..0000000 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items-expected.txt +++ /dev/null
@@ -1,139 +0,0 @@ -Test that setting and getting align-items works as expected - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test getting align-items set through CSS -PASS getComputedStyle(alignItemsBaseline, '').getPropertyValue('align-items') is 'baseline' -PASS getComputedStyle(alignItemsLastBaseline, '').getPropertyValue('align-items') is 'last-baseline' -PASS getComputedStyle(alignItemsStretch, '').getPropertyValue('align-items') is 'stretch' -PASS getComputedStyle(alignItemsStart, '').getPropertyValue('align-items') is 'start' -PASS getComputedStyle(alignItemsEnd, '').getPropertyValue('align-items') is 'end' -PASS getComputedStyle(alignItemsCenter, '').getPropertyValue('align-items') is 'center' -PASS getComputedStyle(alignItemsSelfEnd, '').getPropertyValue('align-items') is 'self-end' -PASS getComputedStyle(alignItemsSelfStart, '').getPropertyValue('align-items') is 'self-start' -PASS getComputedStyle(alignItemsLeft, '').getPropertyValue('align-items') is 'left' -PASS getComputedStyle(alignItemsRight, '').getPropertyValue('align-items') is 'right' -PASS getComputedStyle(alignItemsFlexStart, '').getPropertyValue('align-items') is 'flex-start' -PASS getComputedStyle(alignItemsFlexEnd, '').getPropertyValue('align-items') is 'flex-end' -PASS getComputedStyle(alignItemsEndUnsafe, '').getPropertyValue('align-items') is 'end unsafe' -PASS getComputedStyle(alignItemsCenterUnsafe, '').getPropertyValue('align-items') is 'center unsafe' -PASS getComputedStyle(alignItemsSelfEndSafe, '').getPropertyValue('align-items') is 'self-end safe' -PASS getComputedStyle(alignItemsSelfStartSafe, '').getPropertyValue('align-items') is 'self-start safe' -PASS getComputedStyle(alignItemsRightSafe, '').getPropertyValue('align-items') is 'right safe' -PASS getComputedStyle(alignItemsLeftUnsafe, '').getPropertyValue('align-items') is 'left unsafe' -PASS getComputedStyle(alignItemsFlexStartUnsafe, '').getPropertyValue('align-items') is 'flex-start unsafe' -PASS getComputedStyle(alignItemsFlexEndSafe, '').getPropertyValue('align-items') is 'flex-end safe' - -Test initial value of align-items through JS -PASS getComputedStyle(element, '').getPropertyValue('align-items') is 'normal' - -Test getting and setting align-items through JS -PASS element.style.alignItems is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "center" -PASS element.style.alignItems is "start unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "start unsafe" -PASS element.style.alignItems is "flex-end safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "flex-end safe" -PASS element.style.alignItems is "right" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "right" -PASS element.style.alignItems is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "center" -PASS element.style.alignItems is "self-start" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "self-start" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "self-end" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "self-end" - -Test bad combinations of align-items -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" -PASS element.style.alignItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" - -Test the value 'initial' -PASS element.style.alignItems is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "center" -PASS element.style.alignItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" - -Test the value 'initial' for grid containers -PASS element.style.alignItems is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "left safe" -PASS element.style.alignItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" - -Test the value 'initial' for flex containers -PASS element.style.alignItems is "right unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "right unsafe" -PASS element.style.alignItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "normal" - -Test the value 'inherit' -PASS element.style.alignItems is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "end" -PASS element.style.alignItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "end" -PASS element.style.alignItems is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "left safe" -PASS element.style.alignItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "left safe" -PASS element.style.alignItems is "center unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "center unsafe" -PASS element.style.alignItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-items') is "center unsafe" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items.html b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items.html index b8bb7f4e..5b9d9e3 100644 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items.html +++ b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-items.html
@@ -1,13 +1,15 @@ <!DOCTYPE html> -<html> -<head> <style> #alignItemsBaseline { align-items: baseline; } +#alignItemsFirstBaseline { + align-items: first baseline; +} + #alignItemsLastBaseline { - align-items: last-baseline; + align-items: last baseline; } #alignItemsStretch { @@ -81,12 +83,10 @@ #alignItemsFlexEndSafe { align-items: flex-end safe; } - </style> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<p>Test that setting and getting align-items works as expected</p> <div id="alignItemsBaseline"></div> +<div id="alignItemsFirstBaseline"></div> <div id="alignItemsLastBaseline"></div> <div id="alignItemsStretch"></div> <div id="alignItemsStart"></div> @@ -107,167 +107,153 @@ <div id="alignItemsLeftUnsafe"></div> <div id="alignItemsFlexStartUnsafe"></div> <div id="alignItemsFlexEndSafe"></div> -<script src="resources/alignment-parsing-utils.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="resources/alignment-parsing-utils-th.js"></script> <script> -description('Test that setting and getting align-items works as expected'); +test(function() { + var alignItemsBaseline = document.getElementById("alignItemsBaseline"); + checkValues(alignItemsBaseline, "alignItems", "align-items", "", "baseline"); + var alignItemsFirstBaseline = document.getElementById("alignItemsFirstBaseline"); + checkValues(alignItemsFirstBaseline, "alignItems", "align-items", "", "baseline"); + var alignItemsLastBaseline = document.getElementById("alignItemsLastBaseline"); + checkValues(alignItemsLastBaseline, "alignItems", "align-items", "", "last baseline"); + var alignItemsStretch = document.getElementById("alignItemsStretch"); + checkValues(alignItemsStretch, "alignItems", "align-items", "", "stretch"); + var alignItemsStart = document.getElementById("alignItemsStart"); + checkValues(alignItemsStart, "alignItems", "align-items", "", "start"); + var alignItemsEnd = document.getElementById("alignItemsEnd"); + checkValues(alignItemsEnd, "alignItems", "align-items", "", "end"); + var alignItemsCenter = document.getElementById("alignItemsCenter"); + checkValues(alignItemsCenter, "alignItems", "align-items", "", "center"); + var alignItemsSelfEnd = document.getElementById("alignItemsSelfEnd"); + checkValues(alignItemsSelfEnd, "alignItems", "align-items", "", "self-end"); + var alignItemsSelfStart = document.getElementById("alignItemsSelfStart"); + checkValues(alignItemsSelfStart, "alignItems", "align-items", "", "self-start"); + var alignItemsLeft = document.getElementById("alignItemsLeft"); + checkValues(alignItemsLeft, "alignItems", "align-items", "", "left"); + var alignItemsRight = document.getElementById("alignItemsRight"); + checkValues(alignItemsRight, "alignItems", "align-items", "", "right"); + var alignItemsFlexStart = document.getElementById("alignItemsFlexStart"); + checkValues(alignItemsFlexStart, "alignItems", "align-items", "", "flex-start"); + var alignItemsFlexEnd = document.getElementById("alignItemsFlexEnd"); + checkValues(alignItemsFlexEnd, "alignItems", "align-items", "", "flex-end"); -debug("Test getting align-items set through CSS"); -var alignItemsBaseline = document.getElementById("alignItemsBaseline"); -shouldBe("getComputedStyle(alignItemsBaseline, '').getPropertyValue('align-items')", "'baseline'"); + var alignItemsEndUnsafe = document.getElementById("alignItemsEndUnsafe"); + checkValues(alignItemsEndUnsafe, "alignItems", "align-items", "", "end unsafe"); + var alignItemsCenterUnsafe = document.getElementById("alignItemsCenterUnsafe"); + checkValues(alignItemsCenterUnsafe, "alignItems", "align-items", "", "center unsafe"); + var alignItemsSelfEndSafe = document.getElementById("alignItemsSelfEndSafe"); + checkValues(alignItemsSelfEndSafe, "alignItems", "align-items", "", "self-end safe"); + var alignItemsSelfStartSafe = document.getElementById("alignItemsSelfStartSafe"); + checkValues(alignItemsSelfStartSafe, "alignItems", "align-items", "", "self-start safe"); + var alignItemsRightSafe = document.getElementById("alignItemsRightSafe"); + checkValues(alignItemsRightSafe, "alignItems", "align-items", "", "right safe"); + var alignItemsLeftUnsafe = document.getElementById("alignItemsLeftUnsafe"); + checkValues(alignItemsLeftUnsafe, "alignItems", "align-items", "", "left unsafe"); + var alignItemsFlexStartUnsafe = document.getElementById("alignItemsFlexStartUnsafe"); + checkValues(alignItemsFlexStartUnsafe, "alignItems", "align-items", "", "flex-start unsafe"); + var alignItemsFlexEndSafe = document.getElementById("alignItemsFlexEndSafe"); + checkValues(alignItemsFlexEndSafe, "alignItems", "align-items", "", "flex-end safe"); +}, "Test getting align-items set through CSS."); -var alignItemsLastBaseline = document.getElementById("alignItemsLastBaseline"); -shouldBe("getComputedStyle(alignItemsLastBaseline, '').getPropertyValue('align-items')", "'last-baseline'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + checkValues(element, "alignItems", "align-items", "", "normal"); +}, "Test initial value of align-items through JS"); -var alignItemsStretch = document.getElementById("alignItemsStretch"); -shouldBe("getComputedStyle(alignItemsStretch, '').getPropertyValue('align-items')", "'stretch'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + element.style.alignItems = "center"; + checkValues(element, "alignItems", "align-items", "center", "center"); -var alignItemsStart = document.getElementById("alignItemsStart"); -shouldBe("getComputedStyle(alignItemsStart, '').getPropertyValue('align-items')", "'start'"); + element.style.alignItems = "unsafe start"; + checkValues(element, "alignItems", "align-items", "start unsafe", "start unsafe"); -var alignItemsEnd = document.getElementById("alignItemsEnd"); -shouldBe("getComputedStyle(alignItemsEnd, '').getPropertyValue('align-items')", "'end'"); + element.style.alignItems = "flex-end safe"; + checkValues(element, "alignItems", "align-items", "flex-end safe", "flex-end safe"); -var alignItemsCenter = document.getElementById("alignItemsCenter"); -shouldBe("getComputedStyle(alignItemsCenter, '').getPropertyValue('align-items')", "'center'"); + element.style.alignItems = "right"; + checkValues(element, "alignItems", "align-items", "right", "right"); -var alignItemsSelfEnd = document.getElementById("alignItemsSelfEnd"); -shouldBe("getComputedStyle(alignItemsSelfEnd, '').getPropertyValue('align-items')", "'self-end'"); + element.style.alignItems = "center"; + checkValues(element, "alignItems", "align-items", "center", "center"); -var alignItemsSelfStart = document.getElementById("alignItemsSelfStart"); -shouldBe("getComputedStyle(alignItemsSelfStart, '').getPropertyValue('align-items')", "'self-start'"); + element.style.alignItems = "self-start"; + checkValues(element, "alignItems", "align-items", "self-start", "self-start"); -var alignItemsLeft = document.getElementById("alignItemsLeft"); -shouldBe("getComputedStyle(alignItemsLeft, '').getPropertyValue('align-items')", "'left'"); + // The 'auto' value is not valid for the align-items property. + element.style.alignItems = ""; + element.style.alignItems = "auto"; + checkValues(element, "alignItems", "align-items", "", "normal"); -var alignItemsRight = document.getElementById("alignItemsRight"); -shouldBe("getComputedStyle(alignItemsRight, '').getPropertyValue('align-items')", "'right'"); + element.style.display = "flex"; + element.style.alignItems = "auto"; + checkValues(element, "alignItems", "align-items", "", "normal"); -var alignItemsFlexStart = document.getElementById("alignItemsFlexStart"); -shouldBe("getComputedStyle(alignItemsFlexStart, '').getPropertyValue('align-items')", "'flex-start'"); + element.style.display = "grid"; + element.style.alignItems = "auto"; + checkValues(element, "alignItems", "align-items", "", "normal"); -var alignItemsFlexEnd = document.getElementById("alignItemsFlexEnd"); -shouldBe("getComputedStyle(alignItemsFlexEnd, '').getPropertyValue('align-items')", "'flex-end'"); + element.style.alignItems = "self-end"; + checkValues(element, "alignItems", "align-items", "self-end", "self-end"); +}, "Test getting and setting align-items through JS"); -var alignItemsEndUnsafe = document.getElementById("alignItemsEndUnsafe"); -shouldBe("getComputedStyle(alignItemsEndUnsafe, '').getPropertyValue('align-items')", "'end unsafe'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); -var alignItemsCenterUnsafe = document.getElementById("alignItemsCenterUnsafe"); -shouldBe("getComputedStyle(alignItemsCenterUnsafe, '').getPropertyValue('align-items')", "'center unsafe'"); + checkBadValues(element, "alignItems", "align-items", "auto"); + checkBadValues(element, "alignItems", "align-items", "unsafe auto"); + checkBadValues(element, "alignItems", "align-items", "auto safe"); + checkBadValues(element, "alignItems", "align-items", "auto left"); + checkBadValues(element, "alignItems", "align-items", "baseline safe"); + checkBadValues(element, "alignItems", "align-items", "baseline center"); + checkBadValues(element, "alignItems", "align-items", "first baseline center"); + checkBadValues(element, "alignItems", "align-items", "last baseline center"); + checkBadValues(element, "alignItems", "align-items", "baseline last"); + checkBadValues(element, "alignItems", "align-items", "baseline first"); + checkBadValues(element, "alignItems", "align-items", "stretch unsafe"); + checkBadValues(element, "alignItems", "align-items", "stretch right"); + checkBadValues(element, "alignItems", "align-items", "unsafe unsafe"); + checkBadValues(element, "alignItems", "align-items", "unsafe safe"); + checkBadValues(element, "alignItems", "align-items", "center start"); + checkBadValues(element, "alignItems", "align-items", "stretch unsafe"); + checkBadValues(element, "alignItems", "align-items", "safe stretch"); + checkBadValues(element, "alignItems", "align-items", "baseline safe"); + checkBadValues(element, "alignItems", "align-items", "unsafe baseline"); + checkBadValues(element, "alignItems", "align-items", "unsafe safe left"); + checkBadValues(element, "alignItems", "align-items", "unsafe left safe"); + checkBadValues(element, "alignItems", "align-items", "left safe unsafe safe"); + checkBadValues(element, "alignItems", "align-items", "legacy start"); + checkBadValues(element, "alignItems", "align-items", "legacy end"); + checkBadValues(element, "alignItems", "align-items", "legacy right unsafe"); + checkBadValues(element, "alignItems", "align-items", "legacy auto"); + checkBadValues(element, "alignItems", "align-items", "legacy stretch"); + checkBadValues(element, "alignItems", "align-items", "legacy"); + checkBadValues(element, "alignItems", "align-items", "legacy left right"); +}, "Test bad combinations of align-items"); -var alignItemsSelfEndSafe = document.getElementById("alignItemsSelfEndSafe"); -shouldBe("getComputedStyle(alignItemsSelfEndSafe, '').getPropertyValue('align-items')", "'self-end safe'"); +test(function() { + element.style.display = ""; + checkInitialValues(element, "alignItems", "align-items", "center", "normal"); +}, "Test the value 'initial'"); -var alignItemsSelfStartSafe = document.getElementById("alignItemsSelfStartSafe"); -shouldBe("getComputedStyle(alignItemsSelfStartSafe, '').getPropertyValue('align-items')", "'self-start safe'"); +test(function() { + element.style.display = "grid"; + checkInitialValues(element, "alignItems", "align-items", "left safe", "normal"); +}, "Test the value 'initial' for grid containers"); -var alignItemsRightSafe = document.getElementById("alignItemsRightSafe"); -shouldBe("getComputedStyle(alignItemsRightSafe, '').getPropertyValue('align-items')", "'right safe'"); +test(function() { + element.style.display = "flex"; + checkInitialValues(element, "alignItems", "align-items", "right unsafe", "normal"); +}, "Test the value 'initial' for flex containers"); -var alignItemsLeftUnsafe = document.getElementById("alignItemsLeftUnsafe"); -shouldBe("getComputedStyle(alignItemsLeftUnsafe, '').getPropertyValue('align-items')", "'left unsafe'"); - -var alignItemsFlexStartUnsafe = document.getElementById("alignItemsFlexStartUnsafe"); -shouldBe("getComputedStyle(alignItemsFlexStartUnsafe, '').getPropertyValue('align-items')", "'flex-start unsafe'"); - -var alignItemsFlexEndSafe = document.getElementById("alignItemsFlexEndSafe"); -shouldBe("getComputedStyle(alignItemsFlexEndSafe, '').getPropertyValue('align-items')", "'flex-end safe'"); - -debug(""); -debug("Test initial value of align-items through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -shouldBe("getComputedStyle(element, '').getPropertyValue('align-items')", "'normal'"); - -debug(""); -debug("Test getting and setting align-items through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -element.style.alignItems = "center"; -checkValues(element, "alignItems", "align-items", "center", "center"); - -element.style.alignItems = "unsafe start"; -checkValues(element, "alignItems", "align-items", "start unsafe", "start unsafe"); - -element.style.alignItems = "flex-end safe"; -checkValues(element, "alignItems", "align-items", "flex-end safe", "flex-end safe"); - -element.style.alignItems = "right"; -checkValues(element, "alignItems", "align-items", "right", "right"); - -element.style.alignItems = "center"; -checkValues(element, "alignItems", "align-items", "center", "center"); - -element.style.alignItems = "self-start"; -checkValues(element, "alignItems", "align-items", "self-start", "self-start"); - -// The 'auto' value is not valid for the align-items property. -element.style.alignItems = ""; -element.style.alignItems = "auto"; -checkValues(element, "alignItems", "align-items", "", "normal"); - -element.style.display = "flex"; -element.style.alignItems = "auto"; -checkValues(element, "alignItems", "align-items", "", "normal"); - -element.style.display = "grid"; -element.style.alignItems = "auto"; -checkValues(element, "alignItems", "align-items", "", "normal"); - -element.style.alignItems = "self-end"; -checkValues(element, "alignItems", "align-items", "self-end", "self-end"); - -debug(""); -debug("Test bad combinations of align-items"); -element = document.createElement("div"); -document.body.appendChild(element); - -checkBadValues(element, "alignItems", "align-items", "auto"); -checkBadValues(element, "alignItems", "align-items", "unsafe auto"); -checkBadValues(element, "alignItems", "align-items", "auto safe"); -checkBadValues(element, "alignItems", "align-items", "auto left"); -checkBadValues(element, "alignItems", "align-items", "baseline safe"); -checkBadValues(element, "alignItems", "align-items", "baseline center"); -checkBadValues(element, "alignItems", "align-items", "stretch unsafe"); -checkBadValues(element, "alignItems", "align-items", "stretch right"); -checkBadValues(element, "alignItems", "align-items", "unsafe unsafe"); -checkBadValues(element, "alignItems", "align-items", "unsafe safe"); -checkBadValues(element, "alignItems", "align-items", "center start"); -checkBadValues(element, "alignItems", "align-items", "stretch unsafe"); -checkBadValues(element, "alignItems", "align-items", "safe stretch"); -checkBadValues(element, "alignItems", "align-items", "baseline safe"); -checkBadValues(element, "alignItems", "align-items", "unsafe baseline"); -checkBadValues(element, "alignItems", "align-items", "unsafe safe left"); -checkBadValues(element, "alignItems", "align-items", "unsafe left safe"); -checkBadValues(element, "alignItems", "align-items", "left safe unsafe safe"); -checkBadValues(element, "alignItems", "align-items", "legacy start"); -checkBadValues(element, "alignItems", "align-items", "legacy end"); -checkBadValues(element, "alignItems", "align-items", "legacy right unsafe"); -checkBadValues(element, "alignItems", "align-items", "legacy auto"); -checkBadValues(element, "alignItems", "align-items", "legacy stretch"); -checkBadValues(element, "alignItems", "align-items", "legacy"); -checkBadValues(element, "alignItems", "align-items", "legacy left right"); - -debug(""); -debug("Test the value 'initial'"); -element.style.display = ""; -checkInitialValues(element, "alignItems", "align-items", "center", "normal"); - -debug(""); -debug("Test the value 'initial' for grid containers"); -element.style.display = "grid"; -checkInitialValues(element, "alignItems", "align-items", "left safe", "normal"); - -debug(""); -debug("Test the value 'initial' for flex containers"); -element.style.display = "flex"; -checkInitialValues(element, "alignItems", "align-items", "right unsafe", "normal"); - -debug(""); -debug("Test the value 'inherit'"); -checkInheritValues("alignItems", "align-items", "end"); -checkInheritValues("alignItems", "align-items", "left safe"); -checkInheritValues("alignItems", "align-items", "center unsafe"); - +test(function() { + checkInheritValues("alignItems", "align-items", "end"); + checkInheritValues("alignItems", "align-items", "left safe"); + checkInheritValues("alignItems", "align-items", "center unsafe"); +}, "Test the value 'inherit'"); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self-expected.txt b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self-expected.txt deleted file mode 100644 index 3f88dddd..0000000 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self-expected.txt +++ /dev/null
@@ -1,159 +0,0 @@ -Test that setting and getting align-self works as expected - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test getting align-self set through CSS -PASS getComputedStyle(alignSelfBaseline, '').getPropertyValue('align-self') is 'baseline' -PASS getComputedStyle(alignSelfLastBaseline, '').getPropertyValue('align-self') is 'last-baseline' -PASS getComputedStyle(alignSelfStretch, '').getPropertyValue('align-self') is 'stretch' -PASS getComputedStyle(alignSelfStart, '').getPropertyValue('align-self') is 'start' -PASS getComputedStyle(alignSelfEnd, '').getPropertyValue('align-self') is 'end' -PASS getComputedStyle(alignSelfCenter, '').getPropertyValue('align-self') is 'center' -PASS getComputedStyle(alignSelfSelfEnd, '').getPropertyValue('align-self') is 'self-end' -PASS getComputedStyle(alignSelfSelfStart, '').getPropertyValue('align-self') is 'self-start' -PASS getComputedStyle(alignSelfLeft, '').getPropertyValue('align-self') is 'left' -PASS getComputedStyle(alignSelfRight, '').getPropertyValue('align-self') is 'right' -PASS getComputedStyle(alignSelfFlexStart, '').getPropertyValue('align-self') is 'flex-start' -PASS getComputedStyle(alignSelfFlexEnd, '').getPropertyValue('align-self') is 'flex-end' -PASS getComputedStyle(alignSelfEndUnsafe, '').getPropertyValue('align-self') is 'end unsafe' -PASS getComputedStyle(alignSelfCenterUnsafe, '').getPropertyValue('align-self') is 'center unsafe' -PASS getComputedStyle(alignSelfSelfEndSafe, '').getPropertyValue('align-self') is 'self-end safe' -PASS getComputedStyle(alignSelfSelfStartSafe, '').getPropertyValue('align-self') is 'self-start safe' -PASS getComputedStyle(alignSelfRightSafe, '').getPropertyValue('align-self') is 'right safe' -PASS getComputedStyle(alignSelfLeftUnsafe, '').getPropertyValue('align-self') is 'left unsafe' -PASS getComputedStyle(alignSelfFlexStartUnsafe, '').getPropertyValue('align-self') is 'flex-start unsafe' -PASS getComputedStyle(alignSelfFlexEndSafe, '').getPropertyValue('align-self') is 'flex-end safe' - -Test initial value of align-self through JS -PASS getComputedStyle(element, '').getPropertyValue('align-self') is 'normal' - -Test getting and setting align-self through JS -PASS element.style.alignSelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "center" -PASS element.style.alignSelf is "start unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "start unsafe" -PASS element.style.alignSelf is "flex-end safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "flex-end safe" -PASS element.style.alignSelf is "right" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "right" -PASS element.style.alignSelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "center" -PASS element.style.alignSelf is "self-start" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "self-start" -PASS element.style.alignSelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "self-end" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "self-end" - -Test 'auto' value resolution for the root node -PASS element.style.alignSelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test bad combinations of align-self -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" -PASS element.style.alignSelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' -PASS element.style.alignSelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "center" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' for grid containers -PASS element.style.alignSelf is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "left safe" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' for flex containers -PASS element.style.alignSelf is "right unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "right unsafe" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' for positioned elements -PASS element.style.alignSelf is "left" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "left" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' for positioned elements in grid containers -PASS element.style.alignSelf is "right" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "right" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'initial' for positioned elements in grid containers -PASS element.style.alignSelf is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "end" -PASS element.style.alignSelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "normal" - -Test the value 'inherit' -PASS element.style.alignSelf is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "end" -PASS element.style.alignSelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "end" -PASS element.style.alignSelf is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "left safe" -PASS element.style.alignSelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "left safe" -PASS element.style.alignSelf is "center unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "center unsafe" -PASS element.style.alignSelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('align-self') is "center unsafe" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self.html b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self.html index 3531ca5..149c1a0 100644 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self.html +++ b/third_party/WebKit/LayoutTests/fast/alignment/parse-align-self.html
@@ -1,13 +1,15 @@ <!DOCTYPE html> -<html> -<head> <style> #alignSelfBaseline { align-self: baseline; } +#alignSelfFirstBaseline { + align-self: first baseline; +} + #alignSelfLastBaseline { - align-self: last-baseline; + align-self: last baseline; } #alignSelfStretch { @@ -82,10 +84,9 @@ align-self: flex-end safe; } </style> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<p>Test that setting and getting align-self works as expected</p> <div id="alignSelfBaseline"></div> +<div id="alignSelfFirstBaseline"></div> <div id="alignSelfLastBaseline"></div> <div id="alignSelfStretch"></div> <div id="alignSelfStart"></div> @@ -106,191 +107,172 @@ <div id="alignSelfLeftUnsafe"></div> <div id="alignSelfFlexStartUnsafe"></div> <div id="alignSelfFlexEndSafe"></div> -<script src="resources/alignment-parsing-utils.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="resources/alignment-parsing-utils-th.js"></script> <script> -description('Test that setting and getting align-self works as expected'); +test(function() { + var alignSelfBaseline = document.getElementById("alignSelfBaseline"); + checkValues(alignSelfBaseline, "alignSelf", "align-self", "", "baseline"); + var alignSelfFirstBaseline = document.getElementById("alignSelfFirstBaseline"); + checkValues(alignSelfFirstBaseline, "alignSelf", "align-self", "", "baseline"); + var alignSelfLastBaseline = document.getElementById("alignSelfLastBaseline"); + checkValues(alignSelfLastBaseline, "alignSelf", "align-self", "", "last baseline"); + var alignSelfStretch = document.getElementById("alignSelfStretch"); + checkValues(alignSelfStretch, "alignSelf", "align-self", "", "stretch"); + var alignSelfStart = document.getElementById("alignSelfStart"); + checkValues(alignSelfStart, "alignSelf", "align-self", "", "start"); + var alignSelfEnd = document.getElementById("alignSelfEnd"); + checkValues(alignSelfEnd, "alignSelf", "align-self", "", "end"); + var alignSelfCenter = document.getElementById("alignSelfCenter"); + checkValues(alignSelfCenter, "alignSelf", "align-self", "", "center"); + var alignSelfSelfEnd = document.getElementById("alignSelfSelfEnd"); + checkValues(alignSelfSelfEnd, "alignSelf", "align-self", "", "self-end"); + var alignSelfSelfStart = document.getElementById("alignSelfSelfStart"); + checkValues(alignSelfSelfStart, "alignSelf", "align-self", "", "self-start"); + var alignSelfLeft = document.getElementById("alignSelfLeft"); + checkValues(alignSelfLeft, "alignSelf", "align-self", "", "left"); + var alignSelfRight = document.getElementById("alignSelfRight"); + checkValues(alignSelfRight, "alignSelf", "align-self", "", "right"); + var alignSelfFlexStart = document.getElementById("alignSelfFlexStart"); + checkValues(alignSelfFlexStart, "alignSelf", "align-self", "", "flex-start"); + var alignSelfFlexEnd = document.getElementById("alignSelfFlexEnd"); + checkValues(alignSelfFlexEnd, "alignSelf", "align-self", "", "flex-end"); -debug("Test getting align-self set through CSS"); -var alignSelfBaseline = document.getElementById("alignSelfBaseline"); -shouldBe("getComputedStyle(alignSelfBaseline, '').getPropertyValue('align-self')", "'baseline'"); + var alignSelfEndUnsafe = document.getElementById("alignSelfEndUnsafe"); + checkValues(alignSelfEndUnsafe, "alignSelf", "align-self", "", "end unsafe"); + var alignSelfCenterUnsafe = document.getElementById("alignSelfCenterUnsafe"); + checkValues(alignSelfCenterUnsafe, "alignSelf", "align-self", "", "center unsafe"); + var alignSelfSelfEndSafe = document.getElementById("alignSelfSelfEndSafe"); + checkValues(alignSelfSelfEndSafe, "alignSelf", "align-self", "", "self-end safe"); + var alignSelfSelfStartSafe = document.getElementById("alignSelfSelfStartSafe"); + checkValues(alignSelfSelfStartSafe, "alignSelf", "align-self", "", "self-start safe"); + var alignSelfRightSafe = document.getElementById("alignSelfRightSafe"); + checkValues(alignSelfRightSafe, "alignSelf", "align-self", "", "right safe"); + var alignSelfLeftUnsafe = document.getElementById("alignSelfLeftUnsafe"); + checkValues(alignSelfLeftUnsafe, "alignSelf", "align-self", "", "left unsafe"); + var alignSelfFlexStartUnsafe = document.getElementById("alignSelfFlexStartUnsafe"); + checkValues(alignSelfFlexStartUnsafe, "alignSelf", "align-self", "", "flex-start unsafe"); + var alignSelfFlexEndSafe = document.getElementById("alignSelfFlexEndSafe"); + checkValues(alignSelfFlexEndSafe, "alignSelf", "align-self", "", "flex-end safe"); +}, "Test getting align-self set through CSS."); -var alignSelfLastBaseline = document.getElementById("alignSelfLastBaseline"); -shouldBe("getComputedStyle(alignSelfLastBaseline, '').getPropertyValue('align-self')", "'last-baseline'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + checkValues(element, "alignSelf", "align-self", "", "normal"); +}, "Test initial value of align-self through JS"); -var alignSelfStretch = document.getElementById("alignSelfStretch"); -shouldBe("getComputedStyle(alignSelfStretch, '').getPropertyValue('align-self')", "'stretch'"); +test(function() { + container = document.createElement("div"); + element = document.createElement("div"); + container.appendChild(element); + document.body.appendChild(container); + element.style.alignSelf = "center"; + checkValues(element, "alignSelf", "align-self", "center", "center"); -var alignSelfStart = document.getElementById("alignSelfStart"); -shouldBe("getComputedStyle(alignSelfStart, '').getPropertyValue('align-self')", "'start'"); + element.style.alignSelf = "unsafe start"; + checkValues(element, "alignSelf", "align-self", "start unsafe", "start unsafe"); -var alignSelfEnd = document.getElementById("alignSelfEnd"); -shouldBe("getComputedStyle(alignSelfEnd, '').getPropertyValue('align-self')", "'end'"); + element.style.alignSelf = "flex-end safe"; + checkValues(element, "alignSelf", "align-self", "flex-end safe", "flex-end safe"); -var alignSelfCenter = document.getElementById("alignSelfCenter"); -shouldBe("getComputedStyle(alignSelfCenter, '').getPropertyValue('align-self')", "'center'"); + element.style.alignSelf = "right"; + checkValues(element, "alignSelf", "align-self", "right", "right"); -var alignSelfSelfEnd = document.getElementById("alignSelfSelfEnd"); -shouldBe("getComputedStyle(alignSelfSelfEnd, '').getPropertyValue('align-self')", "'self-end'"); + element.style.alignSelf = "center"; + checkValues(element, "alignSelf", "align-self", "center", "center"); -var alignSelfSelfStart = document.getElementById("alignSelfSelfStart"); -shouldBe("getComputedStyle(alignSelfSelfStart, '').getPropertyValue('align-self')", "'self-start'"); + element.style.alignSelf = "self-start"; + checkValues(element, "alignSelf", "align-self", "self-start", "self-start"); -var alignSelfLeft = document.getElementById("alignSelfLeft"); -shouldBe("getComputedStyle(alignSelfLeft, '').getPropertyValue('align-self')", "'left'"); + element.style.alignSelf = "auto"; + checkValues(element, "alignSelf", "align-self", "auto", "normal"); -var alignSelfRight = document.getElementById("alignSelfRight"); -shouldBe("getComputedStyle(alignSelfRight, '').getPropertyValue('align-self')", "'right'"); + container.style.display = "flex"; + element.style.alignSelf = "auto"; + checkValues(element, "alignSelf", "align-self", "auto", "normal"); -var alignSelfFlexStart = document.getElementById("alignSelfFlexStart"); -shouldBe("getComputedStyle(alignSelfFlexStart, '').getPropertyValue('align-self')", "'flex-start'"); + container.style.display = "grid"; + element.style.alignSelf = "auto"; + checkValues(element, "alignSelf", "align-self", "auto", "normal"); -var alignSelfFlexEnd = document.getElementById("alignSelfFlexEnd"); -shouldBe("getComputedStyle(alignSelfFlexEnd, '').getPropertyValue('align-self')", "'flex-end'"); + element.style.alignSelf = "self-end"; + checkValues(element, "alignSelf", "align-self", "self-end", "self-end"); +}, "Test getting and setting align-self through JS"); -var alignSelfEndUnsafe = document.getElementById("alignSelfEndUnsafe"); -shouldBe("getComputedStyle(alignSelfEndUnsafe, '').getPropertyValue('align-self')", "'end unsafe'"); +test(function() { + document.documentElement.style.alignSelf = "auto"; + checkValues(document.documentElement, "alignSelf", "align-self", "auto", "normal"); +}, "Test 'auto' value resolution for the root node"); -var alignSelfCenterUnsafe = document.getElementById("alignSelfCenterUnsafe"); -shouldBe("getComputedStyle(alignSelfCenterUnsafe, '').getPropertyValue('align-self')", "'center unsafe'"); +test(function() { + container = document.createElement("div"); + element = document.createElement("div"); + container.appendChild(element); + document.body.appendChild(container); -var alignSelfSelfEndSafe = document.getElementById("alignSelfSelfEndSafe"); -shouldBe("getComputedStyle(alignSelfSelfEndSafe, '').getPropertyValue('align-self')", "'self-end safe'"); + checkBadValues(element, "alignSelf", "align-self", "auto safe"); + checkBadValues(element, "alignSelf", "align-self", "auto left"); + checkBadValues(element, "alignSelf", "align-self", "baseline safe"); + checkBadValues(element, "alignSelf", "align-self", "baseline center"); + checkBadValues(element, "alignSelf", "align-self", "stretch unsafe"); + checkBadValues(element, "alignSelf", "align-self", "stretch right"); + checkBadValues(element, "alignSelf", "align-self", "unsafe unsafe"); + checkBadValues(element, "alignSelf", "align-self", "unsafe safe"); + checkBadValues(element, "alignSelf", "align-self", "center start"); + checkBadValues(element, "alignSelf", "align-self", "stretch unsafe"); + checkBadValues(element, "alignSelf", "align-self", "safe stretch"); + checkBadValues(element, "alignSelf", "align-self", "baseline safe"); + checkBadValues(element, "alignSelf", "align-self", "unsafe baseline"); + checkBadValues(element, "alignSelf", "align-self", "unsafe safe left"); + checkBadValues(element, "alignSelf", "align-self", "unsafe left safe"); + checkBadValues(element, "alignSelf", "align-self", "left safe unsafe safe"); + checkBadValues(element, "alignSelf", "align-self", "legacy start"); + checkBadValues(element, "alignSelf", "align-self", "legacy end"); + checkBadValues(element, "alignSelf", "align-self", "legacy right unsafe"); + checkBadValues(element, "alignSelf", "align-self", "legacy auto"); + checkBadValues(element, "alignSelf", "align-self", "legacy stretch"); + checkBadValues(element, "alignSelf", "align-self", "legacy"); + checkBadValues(element, "alignSelf", "align-self", "legacy left right"); +}, "Test bad combinations of align-self"); -var alignSelfSelfStartSafe = document.getElementById("alignSelfSelfStartSafe"); -shouldBe("getComputedStyle(alignSelfSelfStartSafe, '').getPropertyValue('align-self')", "'self-start safe'"); +test(function() { + container.style.display = ""; + checkInitialValues(element, "alignSelf", "align-self", "center", "normal"); +}, "Test the value 'initial'"); -var alignSelfRightSafe = document.getElementById("alignSelfRightSafe"); -shouldBe("getComputedStyle(alignSelfRightSafe, '').getPropertyValue('align-self')", "'right safe'"); +test(function() { + container.style.display = "grid"; + checkInitialValues(element, "alignSelf", "align-self", "left safe", "normal"); +}, "Test the value 'initial' for grid containers"); -var alignSelfLeftUnsafe = document.getElementById("alignSelfLeftUnsafe"); -shouldBe("getComputedStyle(alignSelfLeftUnsafe, '').getPropertyValue('align-self')", "'left unsafe'"); +test(function() { + container.style.display = "flex"; + checkInitialValues(element, "alignSelf", "align-self", "right unsafe", "normal"); +}, "Test the value 'initial' for flex containers"); -var alignSelfFlexStartUnsafe = document.getElementById("alignSelfFlexStartUnsafe"); -shouldBe("getComputedStyle(alignSelfFlexStartUnsafe, '').getPropertyValue('align-self')", "'flex-start unsafe'"); +test(function() { + container.style.display = ""; + element.style.position = "absolute"; + checkInitialValues(element, "alignSelf", "align-self", "left", "normal"); +}, "Test the value 'initial' for positioned elements"); -var alignSelfFlexEndSafe = document.getElementById("alignSelfFlexEndSafe"); -shouldBe("getComputedStyle(alignSelfFlexEndSafe, '').getPropertyValue('align-self')", "'flex-end safe'"); +test(function() { + container.style.display = "grid"; + element.style.position = "absolute"; + checkInitialValues(element, "alignSelf", "align-self", "right", "normal"); +}, "Test the value 'initial' for positioned elements in grid containers"); -debug(""); -debug("Test initial value of align-self through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -shouldBe("getComputedStyle(element, '').getPropertyValue('align-self')", "'normal'"); +test(function() { + container.style.display = "flex"; + element.style.position = "absolute"; + checkInitialValues(element, "alignSelf", "align-self", "end", "normal"); +}, "Test the value 'initial' for positioned elements in grid containers"); -debug(""); -debug("Test getting and setting align-self through JS"); -container = document.createElement("div"); -element = document.createElement("div"); -container.appendChild(element); -document.body.appendChild(container); -element.style.alignSelf = "center"; -checkValues(element, "alignSelf", "align-self", "center", "center"); - -element.style.alignSelf = "unsafe start"; -checkValues(element, "alignSelf", "align-self", "start unsafe", "start unsafe"); - -element.style.alignSelf = "flex-end safe"; -checkValues(element, "alignSelf", "align-self", "flex-end safe", "flex-end safe"); - -element.style.alignSelf = "right"; -checkValues(element, "alignSelf", "align-self", "right", "right"); - -element.style.alignSelf = "center"; -checkValues(element, "alignSelf", "align-self", "center", "center"); - -element.style.alignSelf = "self-start"; -checkValues(element, "alignSelf", "align-self", "self-start", "self-start"); - -element.style.alignSelf = "auto"; -checkValues(element, "alignSelf", "align-self", "auto", "normal"); - -container.style.display = "flex"; -element.style.alignSelf = "auto"; -checkValues(element, "alignSelf", "align-self", "auto", "normal"); - -container.style.display = "grid"; -element.style.alignSelf = "auto"; -checkValues(element, "alignSelf", "align-self", "auto", "normal"); - -element.style.alignSelf = "self-end"; -checkValues(element, "alignSelf", "align-self", "self-end", "self-end"); - -debug(""); -debug("Test 'auto' value resolution for the root node"); -document.documentElement.style.alignSelf = "auto"; -checkValues(document.documentElement, "alignSelf", "align-self", "auto", "normal"); - -debug(""); -debug("Test bad combinations of align-self"); -container = document.createElement("div"); -element = document.createElement("div"); -container.appendChild(element); -document.body.appendChild(container); - -checkBadValues(element, "alignSelf", "align-self", "unsafe auto"); -checkBadValues(element, "alignSelf", "align-self", "auto safe"); -checkBadValues(element, "alignSelf", "align-self", "auto left"); -checkBadValues(element, "alignSelf", "align-self", "baseline safe"); -checkBadValues(element, "alignSelf", "align-self", "baseline center"); -checkBadValues(element, "alignSelf", "align-self", "stretch unsafe"); -checkBadValues(element, "alignSelf", "align-self", "stretch right"); -checkBadValues(element, "alignSelf", "align-self", "unsafe unsafe"); -checkBadValues(element, "alignSelf", "align-self", "unsafe safe"); -checkBadValues(element, "alignSelf", "align-self", "center start"); -checkBadValues(element, "alignSelf", "align-self", "stretch unsafe"); -checkBadValues(element, "alignSelf", "align-self", "safe stretch"); -checkBadValues(element, "alignSelf", "align-self", "baseline safe"); -checkBadValues(element, "alignSelf", "align-self", "unsafe baseline"); -checkBadValues(element, "alignSelf", "align-self", "unsafe safe left"); -checkBadValues(element, "alignSelf", "align-self", "unsafe left safe"); -checkBadValues(element, "alignSelf", "align-self", "left safe unsafe safe"); -checkBadValues(element, "alignSelf", "align-self", "legacy start"); -checkBadValues(element, "alignSelf", "align-self", "legacy end"); -checkBadValues(element, "alignSelf", "align-self", "legacy right unsafe"); -checkBadValues(element, "alignSelf", "align-self", "legacy auto"); -checkBadValues(element, "alignSelf", "align-self", "legacy stretch"); -checkBadValues(element, "alignSelf", "align-self", "legacy"); -checkBadValues(element, "alignSelf", "align-self", "legacy left right"); - -debug(""); -debug("Test the value 'initial'"); -container.style.display = ""; -checkInitialValues(element, "alignSelf", "align-self", "center", "normal"); - -debug(""); -debug("Test the value 'initial' for grid containers"); -container.style.display = "grid"; -checkInitialValues(element, "alignSelf", "align-self", "left safe", "normal"); - -debug(""); -debug("Test the value 'initial' for flex containers"); -container.style.display = "flex"; -checkInitialValues(element, "alignSelf", "align-self", "right unsafe", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements"); -container.style.display = ""; -element.style.position = "absolute"; -checkInitialValues(element, "alignSelf", "align-self", "left", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements in grid containers"); -container.style.display = "grid"; -element.style.position = "absolute"; -checkInitialValues(element, "alignSelf", "align-self", "right", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements in grid containers"); -container.style.display = "flex"; -element.style.position = "absolute"; -checkInitialValues(element, "alignSelf", "align-self", "end", "normal"); - -debug(""); -debug("Test the value 'inherit'"); -checkInheritValues("alignSelf", "align-self", "end"); -checkInheritValues("alignSelf", "align-self", "left safe"); -checkInheritValues("alignSelf", "align-self", "center unsafe"); - +test(function() { + checkInheritValues("alignSelf", "align-self", "end"); + checkInheritValues("alignSelf", "align-self", "left safe"); + checkInheritValues("alignSelf", "align-self", "center unsafe"); +}, "Test the value 'inherit'"); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items-expected.txt b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items-expected.txt deleted file mode 100644 index b2eb29a..0000000 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items-expected.txt +++ /dev/null
@@ -1,161 +0,0 @@ -Test that setting and getting justify-items works as expected - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test getting justify-items set through CSS -PASS getComputedStyle(justifyItemsBaseline, '').getPropertyValue('justify-items') is 'baseline' -PASS getComputedStyle(justifyItemsLastBaseline, '').getPropertyValue('justify-items') is 'last-baseline' -PASS getComputedStyle(justifyItemsStretch, '').getPropertyValue('justify-items') is 'stretch' -PASS getComputedStyle(justifyItemsStart, '').getPropertyValue('justify-items') is 'start' -PASS getComputedStyle(justifyItemsEnd, '').getPropertyValue('justify-items') is 'end' -PASS getComputedStyle(justifyItemsCenter, '').getPropertyValue('justify-items') is 'center' -PASS getComputedStyle(justifyItemsSelfEnd, '').getPropertyValue('justify-items') is 'self-end' -PASS getComputedStyle(justifyItemsSelfStart, '').getPropertyValue('justify-items') is 'self-start' -PASS getComputedStyle(justifyItemsLeft, '').getPropertyValue('justify-items') is 'left' -PASS getComputedStyle(justifyItemsRight, '').getPropertyValue('justify-items') is 'right' -PASS getComputedStyle(justifyItemsFlexStart, '').getPropertyValue('justify-items') is 'flex-start' -PASS getComputedStyle(justifyItemsFlexEnd, '').getPropertyValue('justify-items') is 'flex-end' -PASS getComputedStyle(justifyItemsEndUnsafe, '').getPropertyValue('justify-items') is 'end unsafe' -PASS getComputedStyle(justifyItemsCenterUnsafe, '').getPropertyValue('justify-items') is 'center unsafe' -PASS getComputedStyle(justifyItemsSelfEndSafe, '').getPropertyValue('justify-items') is 'self-end safe' -PASS getComputedStyle(justifyItemsSelfStartSafe, '').getPropertyValue('justify-items') is 'self-start safe' -PASS getComputedStyle(justifyItemsRightSafe, '').getPropertyValue('justify-items') is 'right safe' -PASS getComputedStyle(justifyItemsLeftUnsafe, '').getPropertyValue('justify-items') is 'left unsafe' -PASS getComputedStyle(justifyItemsFlexStartUnsafe, '').getPropertyValue('justify-items') is 'flex-start unsafe' -PASS getComputedStyle(justifyItemsFlexEndSafe, '').getPropertyValue('justify-items') is 'flex-end safe' -PASS getComputedStyle(justifyItemsLegacyLeft, '').getPropertyValue('justify-items') is 'legacy left' -PASS getComputedStyle(justifyItemsLegacyCenter, '').getPropertyValue('justify-items') is 'legacy center' -PASS getComputedStyle(justifyItemsLegacyRight, '').getPropertyValue('justify-items') is 'legacy right' -PASS getComputedStyle(justifyItemsLeftLegacy, '').getPropertyValue('justify-items') is 'legacy left' -PASS getComputedStyle(justifyItemsCenterLegacy, '').getPropertyValue('justify-items') is 'legacy center' -PASS getComputedStyle(justifyItemsRightLegacy, '').getPropertyValue('justify-items') is 'legacy right' - -Test initial value of justify-items through JS -PASS getComputedStyle(element, '').getPropertyValue('justify-items') is 'normal' - -Test getting and setting justify-items through JS -PASS element.style.justifyItems is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "center" -PASS element.style.justifyItems is "start unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "start unsafe" -PASS element.style.justifyItems is "flex-end safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "flex-end safe" -PASS element.style.justifyItems is "legacy right" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy right" -PASS element.style.justifyItems is "legacy center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" -PASS element.style.justifyItems is "legacy left" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy left" -PASS element.style.justifyItems is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "self-end" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "self-end" - -Test 'auto' value resolution for the root node -PASS element.style.justifyItems is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" - -Test bad combinations of justify-items -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" - -Test the value 'initial' -PASS element.style.justifyItems is "legacy center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" -PASS element.style.justifyItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" - -Test the value 'initial' for grid containers -PASS element.style.justifyItems is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "left safe" -PASS element.style.justifyItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" - -Test the value 'initial' for flex containers -PASS element.style.justifyItems is "right unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "right unsafe" -PASS element.style.justifyItems is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "normal" - -Test the value 'inherit' -PASS element.style.justifyItems is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "end" -PASS element.style.justifyItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "end" -PASS element.style.justifyItems is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "left safe" -PASS element.style.justifyItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "left safe" -PASS element.style.justifyItems is "legacy center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" -PASS element.style.justifyItems is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" - -Test the value 'legacy' -PASS element.style.justifyItems is "legacy left" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy left" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy left" -PASS element.style.justifyItems is "legacy center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy center" -PASS element.style.justifyItems is "legacy right" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy right" -PASS element.style.justifyItems is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-items') is "legacy right" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items.html b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items.html index 92548d0a..21d8d71 100644 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items.html +++ b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items.html
@@ -1,13 +1,15 @@ <!DOCTYPE html> -<html> -<head> <style> #justifyItemsBaseline { justify-items: baseline; } +#justifyItemsFirstBaseline { + justify-items: first baseline; +} + #justifyItemsLastBaseline { - justify-items: last-baseline; + justify-items: last baseline; } #justifyItemsStretch { @@ -106,10 +108,9 @@ justify-items: right legacy; } </style> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<p>Test that setting and getting justify-items works as expected</p> <div id="justifyItemsBaseline"></div> +<div id="justifyItemsFirstBaseline"></div> <div id="justifyItemsLastBaseline"></div> <div id="justifyItemsStretch"></div> <div id="justifyItemsStart"></div> @@ -136,193 +137,171 @@ <div id="justifyItemsLeftLegacy"></div> <div id="justifyItemsCenterLegacy"></div> <div id="justifyItemsRightLegacy"></div> -<script src="resources/alignment-parsing-utils.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="resources/alignment-parsing-utils-th.js"></script> <script> -description('Test that setting and getting justify-items works as expected'); +test(function() { + var justifyItemsBaseline = document.getElementById("justifyItemsBaseline"); + checkValues(justifyItemsBaseline, "justifyItems", "justify-items", "", "baseline"); + var justifyItemsFirstBaseline = document.getElementById("justifyItemsFirstBaseline"); + checkValues(justifyItemsFirstBaseline, "justifyItems", "justify-items", "", "baseline"); + var justifyItemsLastBaseline = document.getElementById("justifyItemsLastBaseline"); + checkValues(justifyItemsLastBaseline, "justifyItems", "justify-items", "", "last baseline"); + var justifyItemsStretch = document.getElementById("justifyItemsStretch"); + checkValues(justifyItemsStretch, "justifyItems", "justify-items", "", "stretch"); + var justifyItemsStart = document.getElementById("justifyItemsStart"); + checkValues(justifyItemsStart, "justifyItems", "justify-items", "", "start"); + var justifyItemsEnd = document.getElementById("justifyItemsEnd"); + checkValues(justifyItemsEnd, "justifyItems", "justify-items", "", "end"); + var justifyItemsCenter = document.getElementById("justifyItemsCenter"); + checkValues(justifyItemsCenter, "justifyItems", "justify-items", "", "center"); + var justifyItemsSelfEnd = document.getElementById("justifyItemsSelfEnd"); + checkValues(justifyItemsSelfEnd, "justifyItems", "justify-items", "", "self-end"); + var justifyItemsSelfStart = document.getElementById("justifyItemsSelfStart"); + checkValues(justifyItemsSelfStart, "justifyItems", "justify-items", "", "self-start"); + var justifyItemsLeft = document.getElementById("justifyItemsLeft"); + checkValues(justifyItemsLeft, "justifyItems", "justify-items", "", "left"); + var justifyItemsRight = document.getElementById("justifyItemsRight"); + checkValues(justifyItemsRight, "justifyItems", "justify-items", "", "right"); + var justifyItemsFlexStart = document.getElementById("justifyItemsFlexStart"); + checkValues(justifyItemsFlexStart, "justifyItems", "justify-items", "", "flex-start"); + var justifyItemsFlexEnd = document.getElementById("justifyItemsFlexEnd"); + checkValues(justifyItemsFlexEnd, "justifyItems", "justify-items", "", "flex-end"); -debug("Test getting justify-items set through CSS"); -var justifyItemsBaseline = document.getElementById("justifyItemsBaseline"); -shouldBe("getComputedStyle(justifyItemsBaseline, '').getPropertyValue('justify-items')", "'baseline'"); + var justifyItemsEndUnsafe = document.getElementById("justifyItemsEndUnsafe"); + checkValues(justifyItemsEndUnsafe, "justifyItems", "justify-items", "", "end unsafe"); + var justifyItemsCenterUnsafe = document.getElementById("justifyItemsCenterUnsafe"); + checkValues(justifyItemsCenterUnsafe, "justifyItems", "justify-items", "", "center unsafe"); + var justifyItemsSelfEndSafe = document.getElementById("justifyItemsSelfEndSafe"); + checkValues(justifyItemsSelfEndSafe, "justifyItems", "justify-items", "", "self-end safe"); + var justifyItemsSelfStartSafe = document.getElementById("justifyItemsSelfStartSafe"); + checkValues(justifyItemsSelfStartSafe, "justifyItems", "justify-items", "", "self-start safe"); + var justifyItemsRightSafe = document.getElementById("justifyItemsRightSafe"); + checkValues(justifyItemsRightSafe, "justifyItems", "justify-items", "", "right safe"); + var justifyItemsLeftUnsafe = document.getElementById("justifyItemsLeftUnsafe"); + checkValues(justifyItemsLeftUnsafe, "justifyItems", "justify-items", "", "left unsafe"); + var justifyItemsFlexStartUnsafe = document.getElementById("justifyItemsFlexStartUnsafe"); + checkValues(justifyItemsFlexStartUnsafe, "justifyItems", "justify-items", "", "flex-start unsafe"); + var justifyItemsFlexEndSafe = document.getElementById("justifyItemsFlexEndSafe"); + checkValues(justifyItemsFlexEndSafe, "justifyItems", "justify-items", "", "flex-end safe"); + var justifyItemsLegacyLeft = document.getElementById("justifyItemsLegacyLeft"); + checkValues(justifyItemsLegacyLeft, "justifyItems", "justify-items", "", "legacy left"); + var justifyItemsLegacyCenter = document.getElementById("justifyItemsLegacyCenter"); + checkValues(justifyItemsLegacyCenter, "justifyItems", "justify-items", "", "legacy center"); + var justifyItemsLegacyRight = document.getElementById("justifyItemsLegacyRight"); + checkValues(justifyItemsLegacyRight, "justifyItems", "justify-items", "", "legacy right"); + var justifyItemsLeftLegacy = document.getElementById("justifyItemsLeftLegacy"); + checkValues(justifyItemsLeftLegacy, "justifyItems", "justify-items", "", "legacy left"); + var justifyItemsCenterLegacy = document.getElementById("justifyItemsCenterLegacy"); + checkValues(justifyItemsCenterLegacy, "justifyItems", "justify-items", "", "legacy center"); + var justifyItemsRightLegacy = document.getElementById("justifyItemsRightLegacy"); + checkValues(justifyItemsRightLegacy, "justifyItems", "justify-items", "", "legacy right"); +}, "Test getting justify-items set through CSS."); -var justifyItemsLastBaseline = document.getElementById("justifyItemsLastBaseline"); -shouldBe("getComputedStyle(justifyItemsLastBaseline, '').getPropertyValue('justify-items')", "'last-baseline'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + checkValues(element, "justifyItems", "justify-items", "", "normal"); +}, "Test initial value of justify-items through JS"); -var justifyItemsStretch = document.getElementById("justifyItemsStretch"); -shouldBe("getComputedStyle(justifyItemsStretch, '').getPropertyValue('justify-items')", "'stretch'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + element.style.justifyItems = "center"; + checkValues(element, "justifyItems", "justify-items", "center", "center"); -var justifyItemsStart = document.getElementById("justifyItemsStart"); -shouldBe("getComputedStyle(justifyItemsStart, '').getPropertyValue('justify-items')", "'start'"); + element.style.justifyItems = "unsafe start"; + checkValues(element, "justifyItems", "justify-items", "start unsafe", "start unsafe"); -var justifyItemsEnd = document.getElementById("justifyItemsEnd"); -shouldBe("getComputedStyle(justifyItemsEnd, '').getPropertyValue('justify-items')", "'end'"); + element.style.justifyItems = "flex-end safe"; + checkValues(element, "justifyItems", "justify-items", "flex-end safe", "flex-end safe"); -var justifyItemsCenter = document.getElementById("justifyItemsCenter"); -shouldBe("getComputedStyle(justifyItemsCenter, '').getPropertyValue('justify-items')", "'center'"); + element.style.justifyItems = "right legacy"; + checkValues(element, "justifyItems", "justify-items", "legacy right", "legacy right"); -var justifyItemsSelfEnd = document.getElementById("justifyItemsSelfEnd"); -shouldBe("getComputedStyle(justifyItemsSelfEnd, '').getPropertyValue('justify-items')", "'self-end'"); + element.style.justifyItems = "center legacy"; + checkValues(element, "justifyItems", "justify-items", "legacy center", "legacy center"); -var justifyItemsSelfStart = document.getElementById("justifyItemsSelfStart"); -shouldBe("getComputedStyle(justifyItemsSelfStart, '').getPropertyValue('justify-items')", "'self-start'"); + element.style.justifyItems = "left legacy"; + checkValues(element, "justifyItems", "justify-items", "legacy left", "legacy left"); -var justifyItemsLeft = document.getElementById("justifyItemsLeft"); -shouldBe("getComputedStyle(justifyItemsLeft, '').getPropertyValue('justify-items')", "'left'"); + element.style.justifyItems = "auto"; + checkValues(element, "justifyItems", "justify-items", "auto", "normal"); -var justifyItemsRight = document.getElementById("justifyItemsRight"); -shouldBe("getComputedStyle(justifyItemsRight, '').getPropertyValue('justify-items')", "'right'"); + element.style.display = "flex"; + element.style.justifyItems = "auto"; + checkValues(element, "justifyItems", "justify-items", "auto", "normal"); -var justifyItemsFlexStart = document.getElementById("justifyItemsFlexStart"); -shouldBe("getComputedStyle(justifyItemsFlexStart, '').getPropertyValue('justify-items')", "'flex-start'"); + element.style.display = "grid"; + element.style.justifyItems = "auto"; + checkValues(element, "justifyItems", "justify-items", "auto", "normal"); -var justifyItemsFlexEnd = document.getElementById("justifyItemsFlexEnd"); -shouldBe("getComputedStyle(justifyItemsFlexEnd, '').getPropertyValue('justify-items')", "'flex-end'"); + element.style.justifyItems = "self-end"; + checkValues(element, "justifyItems", "justify-items", "self-end", "self-end"); +}, "Test getting and setting justify-items through JS"); -var justifyItemsEndUnsafe = document.getElementById("justifyItemsEndUnsafe"); -shouldBe("getComputedStyle(justifyItemsEndUnsafe, '').getPropertyValue('justify-items')", "'end unsafe'"); +test(function() { + document.documentElement.style.justifyItems = "auto"; + checkValues(document.documentElement, "justifyItems", "justify-items", "auto", "normal"); +}, "Test 'auto' value resolution for the root node"); -var justifyItemsCenterUnsafe = document.getElementById("justifyItemsCenterUnsafe"); -shouldBe("getComputedStyle(justifyItemsCenterUnsafe, '').getPropertyValue('justify-items')", "'center unsafe'"); +test(function() { + container = document.createElement("div"); + element = document.createElement("div"); + container.appendChild(element); + document.body.appendChild(container); -var justifyItemsSelfEndSafe = document.getElementById("justifyItemsSelfEndSafe"); -shouldBe("getComputedStyle(justifyItemsSelfEndSafe, '').getPropertyValue('justify-items')", "'self-end safe'"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe auto"); + checkBadValues(element, "justifyItems", "justify-items", "auto safe"); + checkBadValues(element, "justifyItems", "justify-items", "auto left"); + checkBadValues(element, "justifyItems", "justify-items", "baseline safe"); + checkBadValues(element, "justifyItems", "justify-items", "baseline center"); + checkBadValues(element, "justifyItems", "justify-items", "stretch unsafe"); + checkBadValues(element, "justifyItems", "justify-items", "stretch right"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe unsafe"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe safe"); + checkBadValues(element, "justifyItems", "justify-items", "center start"); + checkBadValues(element, "justifyItems", "justify-items", "stretch unsafe"); + checkBadValues(element, "justifyItems", "justify-items", "safe stretch"); + checkBadValues(element, "justifyItems", "justify-items", "baseline safe"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe baseline"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe safe left"); + checkBadValues(element, "justifyItems", "justify-items", "unsafe left safe"); + checkBadValues(element, "justifyItems", "justify-items", "left safe unsafe safe"); + checkBadValues(element, "justifyItems", "justify-items", "legacy start"); + checkBadValues(element, "justifyItems", "justify-items", "legacy end"); + checkBadValues(element, "justifyItems", "justify-items", "legacy right unsafe"); + checkBadValues(element, "justifyItems", "justify-items", "legacy auto"); + checkBadValues(element, "justifyItems", "justify-items", "legacy stretch"); + checkBadValues(element, "justifyItems", "justify-items", "legacy"); + checkBadValues(element, "justifyItems", "justify-items", "legacy left right"); +}, "Test bad combinations of justify-items"); -var justifyItemsSelfStartSafe = document.getElementById("justifyItemsSelfStartSafe"); -shouldBe("getComputedStyle(justifyItemsSelfStartSafe, '').getPropertyValue('justify-items')", "'self-start safe'"); +test(function() { + element.style.display = ""; + checkInitialValues(element, "justifyItems", "justify-items", "legacy center", "normal"); +}, "Test the value 'initial'"); -var justifyItemsRightSafe = document.getElementById("justifyItemsRightSafe"); -shouldBe("getComputedStyle(justifyItemsRightSafe, '').getPropertyValue('justify-items')", "'right safe'"); +test(function() { + element.style.display = "grid"; + checkInitialValues(element, "justifyItems", "justify-items", "left safe", "normal"); +}, "Test the value 'initial' for grid containers"); -var justifyItemsLeftUnsafe = document.getElementById("justifyItemsLeftUnsafe"); -shouldBe("getComputedStyle(justifyItemsLeftUnsafe, '').getPropertyValue('justify-items')", "'left unsafe'"); +test(function() { + element.style.display = "flex"; + checkInitialValues(element, "justifyItems", "justify-items", "right unsafe", "normal"); +}, "Test the value 'initial' for flex containers"); -var justifyItemsFlexStartUnsafe = document.getElementById("justifyItemsFlexStartUnsafe"); -shouldBe("getComputedStyle(justifyItemsFlexStartUnsafe, '').getPropertyValue('justify-items')", "'flex-start unsafe'"); +test(function() { + checkInheritValues("justifyItems", "justify-items", "end"); + checkInheritValues("justifyItems", "justify-items", "left safe"); + checkInheritValues("justifyItems", "justify-items", "legacy center"); +}, "Test the value 'inherit'"); -var justifyItemsFlexEndSafe = document.getElementById("justifyItemsFlexEndSafe"); -shouldBe("getComputedStyle(justifyItemsFlexEndSafe, '').getPropertyValue('justify-items')", "'flex-end safe'"); - -var justifyItemsLegacyLeft = document.getElementById("justifyItemsLegacyLeft"); -shouldBe("getComputedStyle(justifyItemsLegacyLeft, '').getPropertyValue('justify-items')", "'legacy left'"); - -var justifyItemsLegacyCenter = document.getElementById("justifyItemsLegacyCenter"); -shouldBe("getComputedStyle(justifyItemsLegacyCenter, '').getPropertyValue('justify-items')", "'legacy center'"); - -var justifyItemsLegacyRight = document.getElementById("justifyItemsLegacyRight"); -shouldBe("getComputedStyle(justifyItemsLegacyRight, '').getPropertyValue('justify-items')", "'legacy right'"); - -var justifyItemsLeftLegacy = document.getElementById("justifyItemsLeftLegacy"); -shouldBe("getComputedStyle(justifyItemsLeftLegacy, '').getPropertyValue('justify-items')", "'legacy left'"); - -var justifyItemsCenterLegacy = document.getElementById("justifyItemsCenterLegacy"); -shouldBe("getComputedStyle(justifyItemsCenterLegacy, '').getPropertyValue('justify-items')", "'legacy center'"); - -var justifyItemsRightLegacy = document.getElementById("justifyItemsRightLegacy"); -shouldBe("getComputedStyle(justifyItemsRightLegacy, '').getPropertyValue('justify-items')", "'legacy right'"); - -debug(""); -debug("Test initial value of justify-items through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -shouldBe("getComputedStyle(element, '').getPropertyValue('justify-items')", "'normal'"); - -debug(""); -debug("Test getting and setting justify-items through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -element.style.justifyItems = "center"; -checkValues(element, "justifyItems", "justify-items", "center", "center"); - -element.style.justifyItems = "unsafe start"; -checkValues(element, "justifyItems", "justify-items", "start unsafe", "start unsafe"); - -element.style.justifyItems = "flex-end safe"; -checkValues(element, "justifyItems", "justify-items", "flex-end safe", "flex-end safe"); - -element.style.justifyItems = "right legacy"; -checkValues(element, "justifyItems", "justify-items", "legacy right", "legacy right"); - -element.style.justifyItems = "center legacy"; -checkValues(element, "justifyItems", "justify-items", "legacy center", "legacy center"); - -element.style.justifyItems = "left legacy"; -checkValues(element, "justifyItems", "justify-items", "legacy left", "legacy left"); - -element.style.justifyItems = "auto"; -checkValues(element, "justifyItems", "justify-items", "auto", "normal"); - -element.style.display = "flex"; -element.style.justifyItems = "auto"; -checkValues(element, "justifyItems", "justify-items", "auto", "normal"); - -element.style.display = "grid"; -element.style.justifyItems = "auto"; -checkValues(element, "justifyItems", "justify-items", "auto", "normal"); - -element.style.justifyItems = "self-end"; -checkValues(element, "justifyItems", "justify-items", "self-end", "self-end"); - -debug(""); -debug("Test 'auto' value resolution for the root node"); -document.documentElement.style.justifyItems = "auto"; -checkValues(document.documentElement, "justifyItems", "justify-items", "auto", "normal"); - -debug(""); -debug("Test bad combinations of justify-items"); -element = document.createElement("div"); -document.body.appendChild(element); - -checkBadValues(element, "justifyItems", "justify-items", "unsafe auto"); -checkBadValues(element, "justifyItems", "justify-items", "auto safe"); -checkBadValues(element, "justifyItems", "justify-items", "auto left"); -checkBadValues(element, "justifyItems", "justify-items", "baseline safe"); -checkBadValues(element, "justifyItems", "justify-items", "baseline center"); -checkBadValues(element, "justifyItems", "justify-items", "stretch unsafe"); -checkBadValues(element, "justifyItems", "justify-items", "stretch right"); -checkBadValues(element, "justifyItems", "justify-items", "unsafe unsafe"); -checkBadValues(element, "justifyItems", "justify-items", "unsafe safe"); -checkBadValues(element, "justifyItems", "justify-items", "center start"); -checkBadValues(element, "justifyItems", "justify-items", "stretch unsafe"); -checkBadValues(element, "justifyItems", "justify-items", "safe stretch"); -checkBadValues(element, "justifyItems", "justify-items", "baseline safe"); -checkBadValues(element, "justifyItems", "justify-items", "unsafe baseline"); -checkBadValues(element, "justifyItems", "justify-items", "unsafe safe left"); -checkBadValues(element, "justifyItems", "justify-items", "unsafe left safe"); -checkBadValues(element, "justifyItems", "justify-items", "left safe unsafe safe"); -checkBadValues(element, "justifyItems", "justify-items", "legacy start"); -checkBadValues(element, "justifyItems", "justify-items", "legacy end"); -checkBadValues(element, "justifyItems", "justify-items", "legacy right unsafe"); -checkBadValues(element, "justifyItems", "justify-items", "legacy auto"); -checkBadValues(element, "justifyItems", "justify-items", "legacy stretch"); -checkBadValues(element, "justifyItems", "justify-items", "legacy"); -checkBadValues(element, "justifyItems", "justify-items", "legacy left right"); - -debug(""); -debug("Test the value 'initial'"); -element.style.display = ""; -checkInitialValues(element, "justifyItems", "justify-items", "legacy center", "normal"); - -debug(""); -debug("Test the value 'initial' for grid containers"); -element.style.display = "grid"; -checkInitialValues(element, "justifyItems", "justify-items", "left safe", "normal"); - -debug(""); -debug("Test the value 'initial' for flex containers"); -element.style.display = "flex"; -checkInitialValues(element, "justifyItems", "justify-items", "right unsafe", "normal"); - -debug(""); -debug("Test the value 'inherit'"); -checkInheritValues("justifyItems", "justify-items", "end"); -checkInheritValues("justifyItems", "justify-items", "left safe"); -checkInheritValues("justifyItems", "justify-items", "legacy center"); - -debug(""); -debug("Test the value 'legacy'"); -checkLegacyValues("justifyItems", "justify-items", "legacy left"); -checkLegacyValues("justifyItems", "justify-items", "legacy center"); -checkLegacyValues("justifyItems", "justify-items", "legacy right"); - +test(function() { + checkLegacyValues("justifyItems", "justify-items", "legacy left"); + checkLegacyValues("justifyItems", "justify-items", "legacy center"); + checkLegacyValues("justifyItems", "justify-items", "legacy right"); +}, "Test the value 'legacy'"); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self-expected.txt b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self-expected.txt deleted file mode 100644 index 8b845e3..0000000 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self-expected.txt +++ /dev/null
@@ -1,159 +0,0 @@ -Test that setting and getting justify-self works as expected - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -Test getting justify-self set through CSS -PASS getComputedStyle(justifySelfBaseline, '').getPropertyValue('justify-self') is 'baseline' -PASS getComputedStyle(justifySelfLastBaseline, '').getPropertyValue('justify-self') is 'last-baseline' -PASS getComputedStyle(justifySelfStretch, '').getPropertyValue('justify-self') is 'stretch' -PASS getComputedStyle(justifySelfStart, '').getPropertyValue('justify-self') is 'start' -PASS getComputedStyle(justifySelfEnd, '').getPropertyValue('justify-self') is 'end' -PASS getComputedStyle(justifySelfCenter, '').getPropertyValue('justify-self') is 'center' -PASS getComputedStyle(justifySelfSelfEnd, '').getPropertyValue('justify-self') is 'self-end' -PASS getComputedStyle(justifySelfSelfStart, '').getPropertyValue('justify-self') is 'self-start' -PASS getComputedStyle(justifySelfLeft, '').getPropertyValue('justify-self') is 'left' -PASS getComputedStyle(justifySelfRight, '').getPropertyValue('justify-self') is 'right' -PASS getComputedStyle(justifySelfFlexStart, '').getPropertyValue('justify-self') is 'flex-start' -PASS getComputedStyle(justifySelfFlexEnd, '').getPropertyValue('justify-self') is 'flex-end' -PASS getComputedStyle(justifySelfEndUnsafe, '').getPropertyValue('justify-self') is 'end unsafe' -PASS getComputedStyle(justifySelfCenterUnsafe, '').getPropertyValue('justify-self') is 'center unsafe' -PASS getComputedStyle(justifySelfSelfEndSafe, '').getPropertyValue('justify-self') is 'self-end safe' -PASS getComputedStyle(justifySelfSelfStartSafe, '').getPropertyValue('justify-self') is 'self-start safe' -PASS getComputedStyle(justifySelfRightSafe, '').getPropertyValue('justify-self') is 'right safe' -PASS getComputedStyle(justifySelfLeftUnsafe, '').getPropertyValue('justify-self') is 'left unsafe' -PASS getComputedStyle(justifySelfFlexStartUnsafe, '').getPropertyValue('justify-self') is 'flex-start unsafe' -PASS getComputedStyle(justifySelfFlexEndSafe, '').getPropertyValue('justify-self') is 'flex-end safe' - -Test initial value of justify-self through JS -PASS getComputedStyle(element, '').getPropertyValue('justify-self') is 'normal' - -Test getting and setting justify-self through JS -PASS element.style.justifySelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "center" -PASS element.style.justifySelf is "start unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "start unsafe" -PASS element.style.justifySelf is "flex-end safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "flex-end safe" -PASS element.style.justifySelf is "right" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "right" -PASS element.style.justifySelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "center" -PASS element.style.justifySelf is "self-start" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "self-start" -PASS element.style.justifySelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "self-end" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "self-end" - -Test 'auto' value resolution for the root node -PASS element.style.justifySelf is "auto" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test bad combinations of justify-self -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" -PASS element.style.justifySelf is "" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' -PASS element.style.justifySelf is "center" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "center" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' for grid containers -PASS element.style.justifySelf is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "left safe" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' for flex containers -PASS element.style.justifySelf is "right unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "right unsafe" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' for positioned elements -PASS element.style.justifySelf is "left" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "left" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' for positioned elements in grid containers -PASS element.style.justifySelf is "right" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "right" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'initial' for positioned elements in grid containers -PASS element.style.justifySelf is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "end" -PASS element.style.justifySelf is "initial" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "normal" - -Test the value 'inherit' -PASS element.style.justifySelf is "end" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "end" -PASS element.style.justifySelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "end" -PASS element.style.justifySelf is "left safe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "left safe" -PASS element.style.justifySelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "left safe" -PASS element.style.justifySelf is "center unsafe" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "center unsafe" -PASS element.style.justifySelf is "inherit" -PASS window.getComputedStyle(element, '').getPropertyValue('justify-self') is "center unsafe" -PASS successfullyParsed is true - -TEST COMPLETE -
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self.html b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self.html index 87edfda..4a4b760 100644 --- a/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self.html +++ b/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self.html
@@ -1,13 +1,15 @@ <!DOCTYPE html> -<html> -<head> <style> #justifySelfBaseline { justify-self: baseline; } +#justifySelfFirstBaseline { + justify-self: first baseline; +} + #justifySelfLastBaseline { - justify-self: last-baseline; + justify-self: last baseline; } #justifySelfStretch { @@ -82,10 +84,9 @@ justify-self: flex-end safe; } </style> -<script src="../../resources/js-test.js"></script> -</head> -<body> +<p>Test that setting and getting justify-self works as expected</p> <div id="justifySelfBaseline"></div> +<div id="justifySelfFirstBaseline"></div> <div id="justifySelfLastBaseline"></div> <div id="justifySelfStretch"></div> <div id="justifySelfStart"></div> @@ -106,191 +107,173 @@ <div id="justifySelfLeftUnsafe"></div> <div id="justifySelfFlexStartUnsafe"></div> <div id="justifySelfFlexEndSafe"></div> -<script src="resources/alignment-parsing-utils.js"></script> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="resources/alignment-parsing-utils-th.js"></script> <script> -description('Test that setting and getting justify-self works as expected'); +test(function() { + var justifySelfBaseline = document.getElementById("justifySelfBaseline"); + checkValues(justifySelfBaseline, "justifySelf", "justify-self", "", "baseline"); + var justifySelfFirstBaseline = document.getElementById("justifySelfFirstBaseline"); + checkValues(justifySelfFirstBaseline, "justifySelf", "justify-self", "", "baseline"); + var justifySelfLastBaseline = document.getElementById("justifySelfLastBaseline"); + checkValues(justifySelfLastBaseline, "justifySelf", "justify-self", "", "last baseline"); + var justifySelfStretch = document.getElementById("justifySelfStretch"); + checkValues(justifySelfStretch, "justifySelf", "justify-self", "", "stretch"); + var justifySelfStart = document.getElementById("justifySelfStart"); + checkValues(justifySelfStart, "justifySelf", "justify-self", "", "start"); + var justifySelfEnd = document.getElementById("justifySelfEnd"); + checkValues(justifySelfEnd, "justifySelf", "justify-self", "", "end"); + var justifySelfCenter = document.getElementById("justifySelfCenter"); + checkValues(justifySelfCenter, "justifySelf", "justify-self", "", "center"); + var justifySelfSelfEnd = document.getElementById("justifySelfSelfEnd"); + checkValues(justifySelfSelfEnd, "justifySelf", "justify-self", "", "self-end"); + var justifySelfSelfStart = document.getElementById("justifySelfSelfStart"); + checkValues(justifySelfSelfStart, "justifySelf", "justify-self", "", "self-start"); + var justifySelfLeft = document.getElementById("justifySelfLeft"); + checkValues(justifySelfLeft, "justifySelf", "justify-self", "", "left"); + var justifySelfRight = document.getElementById("justifySelfRight"); + checkValues(justifySelfRight, "justifySelf", "justify-self", "", "right"); + var justifySelfFlexStart = document.getElementById("justifySelfFlexStart"); + checkValues(justifySelfFlexStart, "justifySelf", "justify-self", "", "flex-start"); + var justifySelfFlexEnd = document.getElementById("justifySelfFlexEnd"); + checkValues(justifySelfFlexEnd, "justifySelf", "justify-self", "", "flex-end"); -debug("Test getting justify-self set through CSS"); -var justifySelfBaseline = document.getElementById("justifySelfBaseline"); -shouldBe("getComputedStyle(justifySelfBaseline, '').getPropertyValue('justify-self')", "'baseline'"); + var justifySelfEndUnsafe = document.getElementById("justifySelfEndUnsafe"); + checkValues(justifySelfEndUnsafe, "justifySelf", "justify-self", "", "end unsafe"); + var justifySelfCenterUnsafe = document.getElementById("justifySelfCenterUnsafe"); + checkValues(justifySelfCenterUnsafe, "justifySelf", "justify-self", "", "center unsafe"); + var justifySelfSelfEndSafe = document.getElementById("justifySelfSelfEndSafe"); + checkValues(justifySelfSelfEndSafe, "justifySelf", "justify-self", "", "self-end safe"); + var justifySelfSelfStartSafe = document.getElementById("justifySelfSelfStartSafe"); + checkValues(justifySelfSelfStartSafe, "justifySelf", "justify-self", "", "self-start safe"); + var justifySelfRightSafe = document.getElementById("justifySelfRightSafe"); + checkValues(justifySelfRightSafe, "justifySelf", "justify-self", "", "right safe"); + var justifySelfLeftUnsafe = document.getElementById("justifySelfLeftUnsafe"); + checkValues(justifySelfLeftUnsafe, "justifySelf", "justify-self", "", "left unsafe"); + var justifySelfFlexStartUnsafe = document.getElementById("justifySelfFlexStartUnsafe"); + checkValues(justifySelfFlexStartUnsafe, "justifySelf", "justify-self", "", "flex-start unsafe"); + var justifySelfFlexEndSafe = document.getElementById("justifySelfFlexEndSafe"); + checkValues(justifySelfFlexEndSafe, "justifySelf", "justify-self", "", "flex-end safe"); +}, "Test getting justify-self set through CSS."); -var justifySelfLastBaseline = document.getElementById("justifySelfLastBaseline"); -shouldBe("getComputedStyle(justifySelfLastBaseline, '').getPropertyValue('justify-self')", "'last-baseline'"); +test(function() { + element = document.createElement("div"); + document.body.appendChild(element); + checkValues(element, "justifySelf", "justify-self", "", "normal"); +}, "Test initial value of justify-self through JS"); -var justifySelfStretch = document.getElementById("justifySelfStretch"); -shouldBe("getComputedStyle(justifySelfStretch, '').getPropertyValue('justify-self')", "'stretch'"); +test(function() { + container = document.createElement("div"); + element = document.createElement("div"); + container.appendChild(element); + document.body.appendChild(container); + element.style.justifySelf = "center"; + checkValues(element, "justifySelf", "justify-self", "center", "center"); -var justifySelfStart = document.getElementById("justifySelfStart"); -shouldBe("getComputedStyle(justifySelfStart, '').getPropertyValue('justify-self')", "'start'"); + element.style.justifySelf = "unsafe start"; + checkValues(element, "justifySelf", "justify-self", "start unsafe", "start unsafe"); -var justifySelfEnd = document.getElementById("justifySelfEnd"); -shouldBe("getComputedStyle(justifySelfEnd, '').getPropertyValue('justify-self')", "'end'"); + element.style.justifySelf = "flex-end safe"; + checkValues(element, "justifySelf", "justify-self", "flex-end safe", "flex-end safe"); -var justifySelfCenter = document.getElementById("justifySelfCenter"); -shouldBe("getComputedStyle(justifySelfCenter, '').getPropertyValue('justify-self')", "'center'"); + element.style.justifySelf = "right"; + checkValues(element, "justifySelf", "justify-self", "right", "right"); -var justifySelfSelfEnd = document.getElementById("justifySelfSelfEnd"); -shouldBe("getComputedStyle(justifySelfSelfEnd, '').getPropertyValue('justify-self')", "'self-end'"); + element.style.justifySelf = "center"; + checkValues(element, "justifySelf", "justify-self", "center", "center"); -var justifySelfSelfStart = document.getElementById("justifySelfSelfStart"); -shouldBe("getComputedStyle(justifySelfSelfStart, '').getPropertyValue('justify-self')", "'self-start'"); + element.style.justifySelf = "self-start"; + checkValues(element, "justifySelf", "justify-self", "self-start", "self-start"); -var justifySelfLeft = document.getElementById("justifySelfLeft"); -shouldBe("getComputedStyle(justifySelfLeft, '').getPropertyValue('justify-self')", "'left'"); + element.style.justifySelf = "auto"; + checkValues(element, "justifySelf", "justify-self", "auto", "normal"); -var justifySelfRight = document.getElementById("justifySelfRight"); -shouldBe("getComputedStyle(justifySelfRight, '').getPropertyValue('justify-self')", "'right'"); + container.style.display = "flex"; + element.style.justifySelf = "auto"; + checkValues(element, "justifySelf", "justify-self", "auto", "normal"); -var justifySelfFlexStart = document.getElementById("justifySelfFlexStart"); -shouldBe("getComputedStyle(justifySelfFlexStart, '').getPropertyValue('justify-self')", "'flex-start'"); + container.style.display = "grid"; + element.style.justifySelf = "auto"; + checkValues(element, "justifySelf", "justify-self", "auto", "normal"); -var justifySelfFlexEnd = document.getElementById("justifySelfFlexEnd"); -shouldBe("getComputedStyle(justifySelfFlexEnd, '').getPropertyValue('justify-self')", "'flex-end'"); + element.style.justifySelf = "self-end"; + checkValues(element, "justifySelf", "justify-self", "self-end", "self-end"); +}, "Test getting and setting justify-self through JS"); -var justifySelfEndUnsafe = document.getElementById("justifySelfEndUnsafe"); -shouldBe("getComputedStyle(justifySelfEndUnsafe, '').getPropertyValue('justify-self')", "'end unsafe'"); +test(function() { + document.documentElement.style.justifySelf = "auto"; + checkValues(document.documentElement, "justifySelf", "justify-self", "auto", "normal"); +}, "Test 'auto' value resolution for the root node"); -var justifySelfCenterUnsafe = document.getElementById("justifySelfCenterUnsafe"); -shouldBe("getComputedStyle(justifySelfCenterUnsafe, '').getPropertyValue('justify-self')", "'center unsafe'"); +test(function() { + container = document.createElement("div"); + element = document.createElement("div"); + container.appendChild(element); + document.body.appendChild(container); -var justifySelfSelfEndSafe = document.getElementById("justifySelfSelfEndSafe"); -shouldBe("getComputedStyle(justifySelfSelfEndSafe, '').getPropertyValue('justify-self')", "'self-end safe'"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe auto"); + checkBadValues(element, "justifySelf", "justify-self", "auto safe"); + checkBadValues(element, "justifySelf", "justify-self", "auto left"); + checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); + checkBadValues(element, "justifySelf", "justify-self", "baseline center"); + checkBadValues(element, "justifySelf", "justify-self", "stretch unsafe"); + checkBadValues(element, "justifySelf", "justify-self", "stretch right"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe unsafe"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe safe"); + checkBadValues(element, "justifySelf", "justify-self", "center start"); + checkBadValues(element, "justifySelf", "justify-self", "stretch unsafe"); + checkBadValues(element, "justifySelf", "justify-self", "safe stretch"); + checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe baseline"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe safe left"); + checkBadValues(element, "justifySelf", "justify-self", "unsafe left safe"); + checkBadValues(element, "justifySelf", "justify-self", "left safe unsafe safe"); + checkBadValues(element, "justifySelf", "justify-self", "legacy start"); + checkBadValues(element, "justifySelf", "justify-self", "legacy end"); + checkBadValues(element, "justifySelf", "justify-self", "legacy right unsafe"); + checkBadValues(element, "justifySelf", "justify-self", "legacy auto"); + checkBadValues(element, "justifySelf", "justify-self", "legacy stretch"); + checkBadValues(element, "justifySelf", "justify-self", "legacy"); + checkBadValues(element, "justifySelf", "justify-self", "legacy left right"); +}, "Test bad combinations of justify-self"); -var justifySelfSelfStartSafe = document.getElementById("justifySelfSelfStartSafe"); -shouldBe("getComputedStyle(justifySelfSelfStartSafe, '').getPropertyValue('justify-self')", "'self-start safe'"); +test(function() { + container.style.display = ""; + checkInitialValues(element, "justifySelf", "justify-self", "center", "normal"); +}, "Test the value 'initial'"); -var justifySelfRightSafe = document.getElementById("justifySelfRightSafe"); -shouldBe("getComputedStyle(justifySelfRightSafe, '').getPropertyValue('justify-self')", "'right safe'"); +test(function() { + container.style.display = "grid"; + checkInitialValues(element, "justifySelf", "justify-self", "left safe", "normal"); +}, "Test the value 'initial' for grid containers"); -var justifySelfLeftUnsafe = document.getElementById("justifySelfLeftUnsafe"); -shouldBe("getComputedStyle(justifySelfLeftUnsafe, '').getPropertyValue('justify-self')", "'left unsafe'"); +test(function() { + container.style.display = "flex"; + checkInitialValues(element, "justifySelf", "justify-self", "right unsafe", "normal"); +}, "Test the value 'initial' for flex containers"); -var justifySelfFlexStartUnsafe = document.getElementById("justifySelfFlexStartUnsafe"); -shouldBe("getComputedStyle(justifySelfFlexStartUnsafe, '').getPropertyValue('justify-self')", "'flex-start unsafe'"); +test(function() { + container.style.display = ""; + element.style.position = "absolute"; + checkInitialValues(element, "justifySelf", "justify-self", "left", "normal"); +}, "Test the value 'initial' for positioned elements"); -var justifySelfFlexEndSafe = document.getElementById("justifySelfFlexEndSafe"); -shouldBe("getComputedStyle(justifySelfFlexEndSafe, '').getPropertyValue('justify-self')", "'flex-end safe'"); +test(function() { + container.style.display = "grid"; + element.style.position = "absolute"; + checkInitialValues(element, "justifySelf", "justify-self", "right", "normal"); +}, "Test the value 'initial' for positioned elements in grid containers"); -debug(""); -debug("Test initial value of justify-self through JS"); -element = document.createElement("div"); -document.body.appendChild(element); -shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'normal'"); +test(function() { + container.style.display = "flex"; + element.style.position = "absolute"; + checkInitialValues(element, "justifySelf", "justify-self", "end", "normal"); +}, "Test the value 'initial' for positioned elements in grid containers"); -debug(""); -debug("Test getting and setting justify-self through JS"); -container = document.createElement("div"); -element = document.createElement("div"); -container.appendChild(element); -document.body.appendChild(container); -element.style.justifySelf = "center"; -checkValues(element, "justifySelf", "justify-self", "center", "center"); - -element.style.justifySelf = "unsafe start"; -checkValues(element, "justifySelf", "justify-self", "start unsafe", "start unsafe"); - -element.style.justifySelf = "flex-end safe"; -checkValues(element, "justifySelf", "justify-self", "flex-end safe", "flex-end safe"); - -element.style.justifySelf = "right"; -checkValues(element, "justifySelf", "justify-self", "right", "right"); - -element.style.justifySelf = "center"; -checkValues(element, "justifySelf", "justify-self", "center", "center"); - -element.style.justifySelf = "self-start"; -checkValues(element, "justifySelf", "justify-self", "self-start", "self-start"); - -element.style.justifySelf = "auto"; -checkValues(element, "justifySelf", "justify-self", "auto", "normal"); - -container.style.display = "flex"; -element.style.justifySelf = "auto"; -checkValues(element, "justifySelf", "justify-self", "auto", "normal"); - -container.style.display = "grid"; -element.style.justifySelf = "auto"; -checkValues(element, "justifySelf", "justify-self", "auto", "normal"); - -element.style.justifySelf = "self-end"; -checkValues(element, "justifySelf", "justify-self", "self-end", "self-end"); - -debug(""); -debug("Test 'auto' value resolution for the root node"); -document.documentElement.style.justifySelf = "auto"; -checkValues(document.documentElement, "justifySelf", "justify-self", "auto", "normal"); - -debug(""); -debug("Test bad combinations of justify-self"); -container = document.createElement("div"); -element = document.createElement("div"); -container.appendChild(element); -document.body.appendChild(container); - -checkBadValues(element, "justifySelf", "justify-self", "unsafe auto"); -checkBadValues(element, "justifySelf", "justify-self", "auto safe"); -checkBadValues(element, "justifySelf", "justify-self", "auto left"); -checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); -checkBadValues(element, "justifySelf", "justify-self", "baseline center"); -checkBadValues(element, "justifySelf", "justify-self", "stretch unsafe"); -checkBadValues(element, "justifySelf", "justify-self", "stretch right"); -checkBadValues(element, "justifySelf", "justify-self", "unsafe unsafe"); -checkBadValues(element, "justifySelf", "justify-self", "unsafe safe"); -checkBadValues(element, "justifySelf", "justify-self", "center start"); -checkBadValues(element, "justifySelf", "justify-self", "stretch unsafe"); -checkBadValues(element, "justifySelf", "justify-self", "safe stretch"); -checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); -checkBadValues(element, "justifySelf", "justify-self", "unsafe baseline"); -checkBadValues(element, "justifySelf", "justify-self", "unsafe safe left"); -checkBadValues(element, "justifySelf", "justify-self", "unsafe left safe"); -checkBadValues(element, "justifySelf", "justify-self", "left safe unsafe safe"); -checkBadValues(element, "justifySelf", "justify-self", "legacy start"); -checkBadValues(element, "justifySelf", "justify-self", "legacy end"); -checkBadValues(element, "justifySelf", "justify-self", "legacy right unsafe"); -checkBadValues(element, "justifySelf", "justify-self", "legacy auto"); -checkBadValues(element, "justifySelf", "justify-self", "legacy stretch"); -checkBadValues(element, "justifySelf", "justify-self", "legacy"); -checkBadValues(element, "justifySelf", "justify-self", "legacy left right"); - -debug(""); -debug("Test the value 'initial'"); -container.style.display = ""; -checkInitialValues(element, "justifySelf", "justify-self", "center", "normal"); - -debug(""); -debug("Test the value 'initial' for grid containers"); -container.style.display = "grid"; -checkInitialValues(element, "justifySelf", "justify-self", "left safe", "normal"); - -debug(""); -debug("Test the value 'initial' for flex containers"); -container.style.display = "flex"; -checkInitialValues(element, "justifySelf", "justify-self", "right unsafe", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements"); -container.style.display = ""; -element.style.position = "absolute"; -checkInitialValues(element, "justifySelf", "justify-self", "left", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements in grid containers"); -container.style.display = "grid"; -element.style.position = "absolute"; -checkInitialValues(element, "justifySelf", "justify-self", "right", "normal"); - -debug(""); -debug("Test the value 'initial' for positioned elements in grid containers"); -container.style.display = "flex"; -element.style.position = "absolute"; -checkInitialValues(element, "justifySelf", "justify-self", "end", "normal"); - -debug(""); -debug("Test the value 'inherit'"); -checkInheritValues("justifySelf", "justify-self", "end"); -checkInheritValues("justifySelf", "justify-self", "left safe"); -checkInheritValues("justifySelf", "justify-self", "center unsafe"); - +test(function() { + checkInheritValues("justifySelf", "justify-self", "end"); + checkInheritValues("justifySelf", "justify-self", "left safe"); + checkInheritValues("justifySelf", "justify-self", "center unsafe"); +}, "Test the value 'inherit'"); </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/alignment/resources/alignment-parsing-utils-th.js b/third_party/WebKit/LayoutTests/fast/alignment/resources/alignment-parsing-utils-th.js index 43d3d57..e8b6e92 100644 --- a/third_party/WebKit/LayoutTests/fast/alignment/resources/alignment-parsing-utils-th.js +++ b/third_party/WebKit/LayoutTests/fast/alignment/resources/alignment-parsing-utils-th.js
@@ -2,7 +2,7 @@ { window.element = element; var elementID = element.id || "element"; - assert_equals(eval('element.style.' + property), value, property + ' specified value is not what it should..'); + assert_equals(eval('element.style.' + property), value, property + ' specified value is not what it should.'); assert_equals(eval("window.getComputedStyle(" + elementID + ", '').getPropertyValue('" + propertyID + "')"), computedValue, property + " is not what is should."); }
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/input-select-after-resize-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/input-select-after-resize-expected.png index f8b5cad..0b95a6aa 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/input-select-after-resize-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/input-select-after-resize-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png new file mode 100644 index 0000000..b212504 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png new file mode 100644 index 0000000..f1ef760e --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/mojo-loading/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/animate-elem-14-t-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/animate-elem-14-t-expected.png deleted file mode 100644 index 4c3a8720..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/svg/W3C-SVG-1.1/animate-elem-14-t-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_border-table-row-collapsed-border-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_border-table-row-collapsed-border-expected.png index 166f43e..dba7e0aa 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_border-table-row-collapsed-border-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_border-table-row-collapsed-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-column-group-collapsed-border-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-column-group-collapsed-border-expected.png index 4752545..d2239d5 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-column-group-collapsed-border-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-column-group-collapsed-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-row-collapsed-border-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-row-collapsed-border-expected.png index 0a904600..7064d91 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-row-collapsed-border-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_position-table-row-collapsed-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-collapsed-border-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-collapsed-border-expected.png index 680651ea..ce962a961 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-collapsed-border-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-collapsed-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-expected.png index ecbb4d89..1ebcde18 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-cell-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-column-group-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-column-group-expected.png index 9bcf038..3956269f 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-column-group-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-column-group-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-row-collapsed-border-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-row-collapsed-border-expected.png index 5e2df97..20e29525 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-row-collapsed-border-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/table/backgr_simple-table-row-collapsed-border-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/network/waterfall-images-expected.png b/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/network/waterfall-images-expected.png deleted file mode 100644 index 157891aec..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/http/tests/inspector/network/waterfall-images-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png deleted file mode 100644 index 157891aec..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png b/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png deleted file mode 100644 index 5fa85a6..0000000 --- a/third_party/WebKit/LayoutTests/virtual/mojo-loading/http/tests/inspector/network/waterfall-images-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp index 8a00588..87fcf6e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
@@ -194,9 +194,9 @@ const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) { - m_queue.append(Message::create(scriptState, data.GetPromise(), - data.GetValue(), errorMessage, - std::move(location), corsStatus)); + m_queue.push_back(Message::create(scriptState, data.GetPromise(), + data.GetValue(), errorMessage, + std::move(location), corsStatus)); } void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index c1f3134..5ee3723 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -122,7 +122,7 @@ void produce(const uint8_t* data, size_t length) { MutexLocker locker(m_mutex); DCHECK(!m_finished); - m_data.append(std::make_pair(data, length)); + m_data.push_back(std::make_pair(data, length)); m_haveData.signal(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h index aebeafdf..a8763a8e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
@@ -172,11 +172,11 @@ if (!m_tracingInProgress) return false; - m_markingDeque.append(WrapperMarkingData(traceWrappersCallback, - heapObjectHeaderCallback, object)); + m_markingDeque.push_back(WrapperMarkingData( + traceWrappersCallback, heapObjectHeaderCallback, object)); #if DCHECK_IS_ON() if (!m_advancingTracing) { - m_verifierDeque.append(WrapperMarkingData( + m_verifierDeque.push_back(WrapperMarkingData( traceWrappersCallback, heapObjectHeaderCallback, object)); } #endif
diff --git a/third_party/WebKit/Source/core/css/CSSFontFace.cpp b/third_party/WebKit/Source/core/css/CSSFontFace.cpp index e46ce5b..a7bfebe 100644 --- a/third_party/WebKit/Source/core/css/CSSFontFace.cpp +++ b/third_party/WebKit/Source/core/css/CSSFontFace.cpp
@@ -39,7 +39,7 @@ void CSSFontFace::addSource(CSSFontFaceSource* source) { source->setFontFace(this); - m_sources.append(source); + m_sources.push_back(source); } void CSSFontFace::setSegmentedFontFace(
diff --git a/third_party/WebKit/Source/core/css/CSSValueKeywords.json5 b/third_party/WebKit/Source/core/css/CSSValueKeywords.json5 index b82eac0..06f5ea7 100644 --- a/third_party/WebKit/Source/core/css/CSSValueKeywords.json5 +++ b/third_party/WebKit/Source/core/css/CSSValueKeywords.json5
@@ -533,6 +533,8 @@ // flex-end // center // baseline + // last baseline, + // first baseline, // stretch // justify-content @@ -982,6 +984,8 @@ // stretch // baseline "last-baseline", + "first", + "last", // center // start // end
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index 4227d23..6227c6d6 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -497,13 +497,25 @@ CSSValueList* result = CSSValueList::createSpaceSeparated(); if (data.positionType() == LegacyPosition) result->append(*CSSIdentifierValue::create(CSSValueLegacy)); - // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' - // flag to not just mean 'auto' prior to running the StyleAdjuster but also - // mean 'normal' after running it. - result->append(*CSSIdentifierValue::create( - data.position() == ItemPositionAuto - ? ComputedStyle::initialDefaultAlignment().position() - : data.position())); + if (data.position() == ItemPositionAuto) { + // To avoid needing to copy the RareNonInheritedData, we repurpose the + // 'auto' flag to not just mean 'auto' prior to running the StyleAdjuster + // but also mean 'normal' after running it. + result->append(*CSSIdentifierValue::create( + ComputedStyle::initialDefaultAlignment().position())); + } else if (data.position() == ItemPositionBaseline) { + result->append( + *CSSValuePair::create(CSSIdentifierValue::create(CSSValueBaseline), + CSSIdentifierValue::create(CSSValueBaseline), + CSSValuePair::DropIdenticalValues)); + } else if (data.position() == ItemPositionLastBaseline) { + result->append( + *CSSValuePair::create(CSSIdentifierValue::create(CSSValueLast), + CSSIdentifierValue::create(CSSValueBaseline), + CSSValuePair::DropIdenticalValues)); + } else { + result->append(*CSSIdentifierValue::create(data.position())); + } if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlignmentDefault) result->append(*CSSIdentifierValue::create(data.overflow()));
diff --git a/third_party/WebKit/Source/core/css/OWNERS b/third_party/WebKit/Source/core/css/OWNERS index 64176816..9c6d10c2 100644 --- a/third_party/WebKit/Source/core/css/OWNERS +++ b/third_party/WebKit/Source/core/css/OWNERS
@@ -1,2 +1,4 @@ meade@chromium.org suzyh@chromium.org + +# COMPONENT: Blink>CSS
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp index f66a77c..10e3235 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
@@ -21,16 +21,37 @@ return nullptr; } +CSSValue* consumeBaselineKeyword(CSSParserTokenRange& range) { + CSSValueID id = range.peek().id(); + if (CSSPropertyParserHelpers::identMatches<CSSValueBaseline>(id)) + return CSSPropertyParserHelpers::consumeIdent(range); + + if (CSSIdentifierValue* preference = + CSSPropertyParserHelpers::consumeIdent<CSSValueFirst, CSSValueLast>( + range)) { + if (range.peek().id() == CSSValueBaseline) { + return CSSValuePair::create(preference, + CSSPropertyParserHelpers::consumeIdent(range), + CSSValuePair::DropIdenticalValues); + } + } + return nullptr; +} + } // namespace CSSValue* CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition( CSSParserTokenRange& range) { if (CSSPropertyParserHelpers::identMatches<CSSValueAuto, CSSValueNormal, - CSSValueStretch, CSSValueBaseline, - CSSValueLastBaseline>( + CSSValueStretch>( range.peek().id())) return CSSPropertyParserHelpers::consumeIdent(range); + if (CSSPropertyParserHelpers::identMatches<CSSValueFirst, CSSValueLast, + CSSValueBaseline>( + range.peek().id())) + return consumeBaselineKeyword(range); + CSSIdentifierValue* overflowPosition = CSSPropertyParserHelpers::consumeIdent<CSSValueUnsafe, CSSValueSafe>( range);
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp index 46e06da..7fa8111 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -509,6 +509,12 @@ alignmentData.setPositionType(LegacyPosition); alignmentData.setPosition( toCSSIdentifierValue(pair.second()).convertTo<ItemPosition>()); + } else if (toCSSIdentifierValue(pair.first()).getValueID() == + CSSValueFirst) { + alignmentData.setPosition(ItemPositionBaseline); + } else if (toCSSIdentifierValue(pair.first()).getValueID() == + CSSValueLast) { + alignmentData.setPosition(ItemPositionLastBaseline); } else { alignmentData.setPosition( toCSSIdentifierValue(pair.first()).convertTo<ItemPosition>());
diff --git a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h index 3bf231d..3bd0702 100644 --- a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h +++ b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h
@@ -42,6 +42,9 @@ // - getExecutionContext() returns null after the context is detached. // - frame() is a syntax sugar for getExecutionContext()->frame(). It returns // null after the context is detached or the context is not a Document. +// +// Both can safely be used up until destruction; i.e., unsafe to +// call upon in a destructor. class CORE_EXPORT ContextClient : public GarbageCollectedMixin { public: ExecutionContext* getExecutionContext() const; @@ -90,6 +93,9 @@ // - frame() is a syntax sugar for domWindow()->frame(). It returns // null after the window is detached. // +// Both can safely be used up until destruction; i.e., unsafe to +// call upon in a destructor. +// // If the object is a per-ExecutionContext thing, use ContextClient/ // ContextLifecycleObserver. If the object is a per-DOMWindow thing, use // DOMWindowClient. Basically, DOMWindowClient is expected to be used (only)
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp index a0597c67..2347549 100644 --- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp +++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -780,7 +780,7 @@ target = &document; event = createEvent(EventTypeNames::webkitfullscreenchange, *target); } - m_eventQueue.append(event); + m_eventQueue.push_back(event); // NOTE: The timer is started in didEnterFullscreen/didExitFullscreen. } @@ -790,7 +790,7 @@ event = createEvent(EventTypeNames::fullscreenerror, element.document()); else event = createEvent(EventTypeNames::webkitfullscreenerror, element); - m_eventQueue.append(event); + m_eventQueue.push_back(event); m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); } @@ -806,7 +806,7 @@ // documentElement. if (!target->isConnected() && document()->documentElement()) { DCHECK(isPrefixed(event->type())); - eventQueue.append( + eventQueue.push_back( createEvent(event->type(), *document()->documentElement())); }
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp index 17606f8..eaf82d8 100644 --- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -58,7 +58,7 @@ break; case InOrder: - m_pendingInOrderScripts.append(scriptLoader); + m_pendingInOrderScripts.push_back(scriptLoader); m_numberOfInOrderScriptsWithPendingNotification++; break; case None: @@ -100,7 +100,8 @@ // notifyScriptLoadError(); it continues this draining of ready scripts. if (m_pendingInOrderScripts.first()->errorOccurred()) break; - m_inOrderScriptsToExecuteSoon.append(m_pendingInOrderScripts.takeFirst()); + m_inOrderScriptsToExecuteSoon.push_back( + m_pendingInOrderScripts.takeFirst()); postTask(BLINK_FROM_HERE); } } @@ -117,7 +118,7 @@ SECURITY_CHECK(m_pendingAsyncScripts.contains(scriptLoader)); m_pendingAsyncScripts.erase(scriptLoader); - m_asyncScriptsToExecuteSoon.append(scriptLoader); + m_asyncScriptsToExecuteSoon.push_back(scriptLoader); postTask(BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp index eb9bf25..51de7da 100644 --- a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp +++ b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
@@ -51,11 +51,11 @@ m_undoStack.removeFirst(); // drop oldest item off the far end if (!m_inRedo) m_redoStack.clear(); - m_undoStack.append(step); + m_undoStack.push_back(step); } void UndoStack::registerRedoStep(UndoStep* step) { - m_redoStack.append(step); + m_redoStack.push_back(step); } bool UndoStack::canUndo() const {
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp index aab2e39..49aabba 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
@@ -228,7 +228,7 @@ m_requestQueue.remove(sameElementRequest); } - m_requestQueue.append(request); + m_requestQueue.push_back(request); } void SpellCheckRequester::didCheck(int sequence,
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.cpp b/third_party/WebKit/Source/core/fileapi/FileReader.cpp index f892a626..c2fe676013 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReader.cpp +++ b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
@@ -136,7 +136,7 @@ m_runningReaders.insert(reader); return; } - m_pendingReaders.append(reader); + m_pendingReaders.push_back(reader); executeReaders(); }
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp index fd8184d..be8c877 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -296,7 +296,7 @@ CString frameHTML = document.encoding().encode(text, WTF::EntitiesForUnencodables); - m_resources->append(SerializedResource( + m_resources->push_back(SerializedResource( url, document.suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length()))); } @@ -388,7 +388,7 @@ String textString = cssText.toString(); CString text = textEncoding.encode(textString, WTF::CSSEncodedEntitiesForUnencodables); - m_resources->append( + m_resources->push_back( SerializedResource(url, String("text/css"), SharedBuffer::create(text.data(), text.length()))); m_resourceURLs.insert(url); @@ -473,7 +473,7 @@ return; } - m_resources->append(SerializedResource(url, mimeType, std::move(data))); + m_resources->push_back(SerializedResource(url, mimeType, std::move(data))); m_resourceURLs.insert(url); }
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.cpp b/third_party/WebKit/Source/core/html/forms/FormController.cpp index 02cf26aa..83bacc4 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.cpp +++ b/third_party/WebKit/Source/core/html/forms/FormController.cpp
@@ -259,10 +259,10 @@ FormElementKey key(name.impl(), type.impl()); FormElementStateMap::iterator it = m_stateForNewFormElements.find(key); if (it != m_stateForNewFormElements.end()) { - it->value.append(state); + it->value.push_back(state); } else { Deque<FormControlState> stateList; - stateList.append(state); + stateList.push_back(state); m_stateForNewFormElements.set(key, stateList); } m_controlStateCount++;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index 9c2a930..51efd1d 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -386,7 +386,7 @@ } for (auto& chunk : pendingChunks) - m_speculations.append(std::move(chunk)); + m_speculations.push_back(std::move(chunk)); if (!isPaused() && !isScheduledForResume()) { if (m_tasksWereSuspended)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp index 24066e6..7d37751 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -591,7 +591,7 @@ // "Add the element to the end of the list of scripts that will execute // when the document has finished parsing associated with the Document // of the parser that created the element." - m_scriptsToExecuteAfterParsing.append(pendingScript); + m_scriptsToExecuteAfterParsing.push_back(pendingScript); } PendingScript* HTMLParserScriptRunner::requestPendingScript(
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp index 6e62a16..48f30e1 100644 --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -406,7 +406,7 @@ if (result != WebInputEventResult::NotHandled && pointerEvent->type() == EventTypeNames::pointerdown && pointerEvent->isPrimary()) { - m_touchIdsForCanceledPointerdowns.append(event.uniqueTouchEventId); + m_touchIdsForCanceledPointerdowns.push_back(event.uniqueTouchEventId); } } }
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp b/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp index a719d89..49cadda8 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp
@@ -21,7 +21,7 @@ ++m_expiredCount; m_messages.removeFirst(); } - m_messages.append(message); + m_messages.push_back(message); } void ConsoleMessageStorage::clear() {
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp index 5fa7972..dd353c3 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp
@@ -538,12 +538,12 @@ void DOMPatchSupport::markNodeAsUsed(Digest* digest) { HeapDeque<Member<Digest>> queue; - queue.append(digest); + queue.push_back(digest); while (!queue.isEmpty()) { Digest* first = queue.takeFirst(); m_unusedNodesMap.erase(first->m_sha1); for (size_t i = 0; i < first->m_children.size(); ++i) - queue.append(first->m_children[i].get()); + queue.push_back(first->m_children[i].get()); } }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.cpp b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.cpp index 218dba2..8c51b9f 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.cpp
@@ -27,7 +27,7 @@ MutexLocker lock(m_mutex); if (m_killed) return; - m_queue.append(std::move(task)); + m_queue.push_back(std::move(task)); m_condition.signal(); }
diff --git a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp index 349ab3e..bf1b5700 100644 --- a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp +++ b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
@@ -264,7 +264,7 @@ // was loading, so remove it, if any. if (resourceData->hasContent()) m_contentSize -= resourceData->removeContent(); - m_requestIdsDeque.append(requestId); + m_requestIdsDeque.push_back(requestId); resourceData->setContent(content, base64Encoded); m_contentSize += dataLength; } @@ -282,7 +282,7 @@ if (resourceData->isContentEvicted()) return; if (ensureFreeSpace(dataLength) && !resourceData->isContentEvicted()) { - m_requestIdsDeque.append(requestId); + m_requestIdsDeque.push_back(requestId); resourceData->appendData(data, dataLength); m_contentSize += dataLength; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 07ed841b..2d85a29 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2401,7 +2401,7 @@ containerOffset.move(layer()->offsetForInFlowPosition()); } - bool preserve3D = container->style()->preserves3D() || style()->preserves3D(); + bool preserve3D = container->style()->preserves3D(); TransformState::TransformAccumulation accumulation = preserve3D ? TransformState::AccumulateTransform
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp index 6992af8..4a8cf22 100644 --- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -1211,7 +1211,7 @@ if (!container) return true; - bool preserve3D = container->style()->preserves3D() || style()->preserves3D(); + bool preserve3D = container->style()->preserves3D(); TransformState::TransformAccumulation accumulation = preserve3D ? TransformState::AccumulateTransform
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index baecf0e..077c672 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1306,8 +1306,7 @@ transformState.setQuad(FloatQuad(FloatRect(rect))); } - bool preserve3D = (parent->style()->preserves3D() && !parent->isText()) || - (style()->preserves3D() && !isText()); + bool preserve3D = parent->style()->preserves3D() && !parent->isText(); TransformState::TransformAccumulation accumulation = preserve3D ? TransformState::AccumulateTransform
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h index 52203ef..db07d40 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -400,7 +400,6 @@ private: ObjectPaintProperties& ensurePaintProperties(); - private: ////////////////////////////////////////// // Helper functions. Dangerous to use! void setPreviousSibling(LayoutObject* previous) { m_previous = previous; }
diff --git a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp index 4020dfa..09c2492 100644 --- a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp +++ b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
@@ -6,6 +6,7 @@ #include "core/layout/LayoutView.h" #include "core/layout/PaintInvalidationState.h" #include "core/paint/PaintLayer.h" +#include "core/paint/PaintPropertyTreePrinter.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { @@ -24,16 +25,47 @@ toLayoutBox(object).flipForWritingMode(rect); const LayoutBoxModelObject& paintInvalidationContainer = object.containerForPaintInvalidation(); - object.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, rect); - if (rect.isEmpty() && object.visualRect().isEmpty()) + + checkVisualRect(object, paintInvalidationContainer, rect, + object.visualRect(), true); + } + + void checkVisualRect(const LayoutObject& object, + const LayoutBoxModelObject& ancestor, + const LayoutRect& localRect, + const LayoutRect& expectedVisualRect, + bool adjustForBacking = false) { + LayoutRect slowMapRect = localRect; + object.mapToVisualRectInAncestorSpace(&ancestor, slowMapRect); + if (slowMapRect.isEmpty() && object.visualRect().isEmpty()) return; + + FloatRect geometryMapperRect(localRect); + if (object.paintProperties()) { + geometryMapperRect.moveBy(FloatPoint(object.paintOffset())); + document().view()->geometryMapper().sourceToDestinationVisualRect( + *object.paintProperties()->localBorderBoxProperties(), + *ancestor.paintProperties()->contentsProperties(), + geometryMapperRect); + geometryMapperRect.moveBy(-FloatPoint(ancestor.paintOffset())); + } + // The following condition can be false if paintInvalidationContainer is // a LayoutView and compositing is not enabled. - if (paintInvalidationContainer.isPaintInvalidationContainer()) { - PaintLayer::mapRectInPaintInvalidationContainerToBacking( - paintInvalidationContainer, rect); + if (adjustForBacking && ancestor.isPaintInvalidationContainer()) { + PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor, + slowMapRect); + LayoutRect temp(geometryMapperRect); + PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor, temp); + geometryMapperRect = FloatRect(temp); } - EXPECT_EQ(enclosingIntRect(rect), enclosingIntRect(object.visualRect())); + EXPECT_TRUE(enclosingIntRect(slowMapRect) + .contains(enclosingIntRect(expectedVisualRect))); + + if (object.paintProperties()) { + EXPECT_TRUE(enclosingIntRect(geometryMapperRect) + .contains(enclosingIntRect(expectedVisualRect))); + } } }; @@ -241,11 +273,8 @@ // This rect is in physical coordinates of target. EXPECT_EQ(LayoutRect(0, 0, 140, 70), rect); - rect = localVisualRect; - target->flipForWritingMode(rect); - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); - EXPECT_EQ(LayoutRect(222, 111, 140, 70), rect); - EXPECT_EQ(rect, target->visualRect()); + checkPaintInvalidationVisualRect(*target); + EXPECT_EQ(LayoutRect(222, 111, 140, 70), target->visualRect()); } TEST_F(VisualRectMappingTest, ContainerFlippedWritingMode) { @@ -278,11 +307,11 @@ EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); // 100 is the physical x location of target in container. EXPECT_EQ(LayoutRect(100, 0, 140, 110), rect); + rect = targetLocalVisualRect; target->flipForWritingMode(rect); - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); - EXPECT_EQ(LayoutRect(322, 111, 140, 110), rect); - EXPECT_EQ(rect, target->visualRect()); + checkPaintInvalidationVisualRect(*target); + EXPECT_EQ(LayoutRect(322, 111, 140, 110), target->visualRect()); LayoutRect containerLocalVisualRect = container->localVisualRect(); EXPECT_EQ(LayoutRect(0, 0, 200, 100), containerLocalVisualRect); @@ -332,13 +361,11 @@ // overflow:scroll. EXPECT_EQ(LayoutRect(2, 3, 140, 110), rect); - rect = targetLocalVisualRect; - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); + checkPaintInvalidationVisualRect(*target); // (2, 3, 140, 100) is first clipped by container's overflow clip, to // (10, 10, 50, 80), then is by added container's offset in LayoutView // (111, 222). - EXPECT_EQ(LayoutRect(232, 121, 50, 80), rect); - EXPECT_EQ(rect, target->visualRect()); + EXPECT_EQ(LayoutRect(232, 121, 50, 80), target->visualRect()); LayoutRect containerLocalVisualRect = container->localVisualRect(); // Because container has overflow clip, its visual overflow doesn't include @@ -351,10 +378,8 @@ // Container should not apply overflow clip on its own overflow rect. EXPECT_EQ(LayoutRect(0, 0, 70, 100), rect); - rect = containerLocalVisualRect; - EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(&layoutView(), rect)); - EXPECT_EQ(LayoutRect(222, 111, 70, 100), rect); - EXPECT_EQ(rect, container->visualRect()); + checkPaintInvalidationVisualRect(*container); + EXPECT_EQ(LayoutRect(222, 111, 70, 100), container->visualRect()); } TEST_F(VisualRectMappingTest, ContainerFlippedWritingModeAndOverflowScroll) { @@ -403,17 +428,14 @@ // Rect is clipped by container's overflow clip because of overflow:scroll. EXPECT_EQ(LayoutRect(-2, 3, 140, 110), rect); - rect = targetLocalVisualRect; - target->flipForWritingMode(rect); - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); + checkPaintInvalidationVisualRect(*target); // (-2, 3, 140, 100) is first clipped by container's overflow clip, to // (40, 10, 50, 80), then is added by container's offset in LayoutView // (111, 222). // TODO(crbug.com/600039): rect.x() should be 262 (left + border-left), but is // offset // by extra horizontal border-widths because of layout error. - EXPECT_EQ(LayoutRect(322, 121, 50, 80), rect); - EXPECT_EQ(rect, target->visualRect()); + EXPECT_EQ(LayoutRect(322, 121, 50, 80), target->visualRect()); LayoutRect containerLocalVisualRect = container->localVisualRect(); // Because container has overflow clip, its visual overflow doesn't include @@ -427,14 +449,11 @@ EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(container, rect)); EXPECT_EQ(LayoutRect(0, 0, 110, 120), rect); - rect = containerLocalVisualRect; - container->flipForWritingMode(rect); - EXPECT_TRUE(container->mapToVisualRectInAncestorSpace(&layoutView(), rect)); // TODO(crbug.com/600039): rect.x() should be 222 (left), but is offset by // extra horizontal // border-widths because of layout error. - EXPECT_EQ(LayoutRect(282, 111, 110, 120), rect); - EXPECT_EQ(rect, container->visualRect()); + checkPaintInvalidationVisualRect(*container); + EXPECT_EQ(LayoutRect(282, 111, 110, 120), container->visualRect()); } TEST_F(VisualRectMappingTest, ContainerOverflowHidden) { @@ -464,9 +483,8 @@ EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); rect = targetLocalVisualRect; - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); // Rect is not clipped by container's overflow clip. - EXPECT_EQ(LayoutRect(10, 10, 140, 110), rect); + checkVisualRect(*target, *container, rect, LayoutRect(10, 10, 140, 110)); } TEST_F(VisualRectMappingTest, ContainerFlippedWritingModeAndOverflowHidden) { @@ -507,9 +525,9 @@ rect = targetLocalVisualRect; target->flipForWritingMode(rect); - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); // 58 = target_physical_x(100) + container_border_left(40) - scroll_left(58) - EXPECT_EQ(LayoutRect(-10, 10, 140, 110), rect); + checkVisualRect(*target, *container, rect, LayoutRect(-10, 10, 140, 110)); + EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); } TEST_F(VisualRectMappingTest, ContainerAndTargetDifferentFlippedWritingMode) { @@ -595,12 +613,9 @@ EXPECT_EQ(stackingContext, &absolute->containerForPaintInvalidation()); EXPECT_EQ(stackingContext, absolute->container()); - LayoutRect absoluteVisualRect = absolute->localVisualRect(); - EXPECT_EQ(LayoutRect(0, 0, 50, 50), absoluteVisualRect); - rect = absoluteVisualRect; - EXPECT_TRUE(absolute->mapToVisualRectInAncestorSpace(stackingContext, rect)); - EXPECT_EQ(LayoutRect(222, 111, 50, 50), rect); - EXPECT_EQ(rect, absolute->visualRect()); + EXPECT_EQ(LayoutRect(0, 0, 50, 50), absolute->localVisualRect()); + checkPaintInvalidationVisualRect(*absolute); + EXPECT_EQ(LayoutRect(222, 111, 50, 50), absolute->visualRect()); } TEST_F(VisualRectMappingTest, @@ -649,12 +664,9 @@ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); - LayoutRect targetLocalVisualRect = target->localVisualRect(); - EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); - LayoutRect rect = targetLocalVisualRect; - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); - EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); - EXPECT_EQ(rect, target->visualRect()); + EXPECT_EQ(LayoutRect(0, 0, 400, 400), target->localVisualRect()); + checkPaintInvalidationVisualRect(*target); + EXPECT_EQ(LayoutRect(0, 0, 200, 200), target->visualRect()); } TEST_F(VisualRectMappingTest, ContainPaint) { @@ -666,12 +678,9 @@ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); - LayoutRect targetLocalVisualRect = target->localVisualRect(); - EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); - LayoutRect rect = targetLocalVisualRect; - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); - EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); - EXPECT_EQ(rect, target->visualRect()); + EXPECT_EQ(LayoutRect(0, 0, 400, 400), target->localVisualRect()); + checkPaintInvalidationVisualRect(*target); + EXPECT_EQ(LayoutRect(0, 0, 200, 200), target->visualRect()); } TEST_F(VisualRectMappingTest, FloatUnderInline) { @@ -696,8 +705,8 @@ EXPECT_EQ(rect, target->visualRect()); rect = targetVisualRect; - EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect)); - EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect); + + checkVisualRect(*target, *span, rect, LayoutRect(-200, -100, 33, 44)); } TEST_F(VisualRectMappingTest, ShouldAccountForPreserve3d) { @@ -722,13 +731,40 @@ LayoutRect originalRect(0, 0, 100, 100); // Multiply both matrices together before flattening. TransformationMatrix matrix = container->layer()->currentTransform(); - matrix *= target->layer()->currentTransform(); matrix.flattenTo2d(); - FloatRect output = matrix.mapRect(FloatRect(originalRect)); + matrix *= target->layer()->currentTransform(); + LayoutRect output(matrix.mapRect(FloatRect(originalRect))); - EXPECT_TRUE( - target->mapToVisualRectInAncestorSpace(target->view(), originalRect)); - EXPECT_EQ(LayoutRect(enclosingIntRect(output)), originalRect); + checkVisualRect(*target, *target->view(), originalRect, output); +} + +TEST_F(VisualRectMappingTest, ShouldAccountForPreserve3dNested) { + enableCompositing(); + setBodyInnerHTML( + "<style>" + "* { margin: 0; }" + "#container {" + " transform-style: preserve-3d;" + " transform: rotateX(-45deg);" + " width: 100px; height: 100px;" + "}" + "#target {" + " transform-style: preserve-3d; transform: rotateX(45deg);" + " background: lightblue;" + " width: 100px; height: 100px;" + "}" + "</style>" + "<div id='container'><div id='target'></div></div>"); + LayoutBlock* container = + toLayoutBlock(getLayoutObjectByElementId("container")); + LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); + LayoutRect originalRect(0, 0, 100, 100); + // Multiply both matrices together before flattening. + TransformationMatrix matrix = container->layer()->currentTransform(); + matrix *= target->layer()->currentTransform(); + LayoutRect output(matrix.mapRect(FloatRect(originalRect))); + + checkVisualRect(*target, *target->view(), originalRect, output); } TEST_F(VisualRectMappingTest, ShouldAccountForPerspective) { @@ -752,17 +788,47 @@ LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); LayoutRect originalRect(0, 0, 100, 100); TransformationMatrix matrix = container->layer()->currentTransform(); + matrix.flattenTo2d(); TransformationMatrix targetMatrix; // getTransformfromContainter includes transform and perspective matrix // of the container. target->getTransformFromContainer(container, LayoutSize(), targetMatrix); matrix *= targetMatrix; - matrix.flattenTo2d(); - FloatRect output = matrix.mapRect(FloatRect(originalRect)); + LayoutRect output(matrix.mapRect(FloatRect(originalRect))); - EXPECT_TRUE( - target->mapToVisualRectInAncestorSpace(target->view(), originalRect)); - EXPECT_EQ(LayoutRect(enclosingIntRect(output)), originalRect); + checkVisualRect(*target, *target->view(), originalRect, output); +} + +TEST_F(VisualRectMappingTest, ShouldAccountForPerspectiveNested) { + enableCompositing(); + setBodyInnerHTML( + "<style>" + "* { margin: 0; }" + "#container {" + " transform-style: preserve-3d;" + " transform: rotateX(-45deg); perspective: 100px;" + " width: 100px; height: 100px;" + "}" + "#target {" + " transform-style: preserve-3d; transform: rotateX(45deg);" + " background: lightblue;" + " width: 100px; height: 100px;" + "}" + "</style>" + "<div id='container'><div id='target'></div></div>"); + LayoutBlock* container = + toLayoutBlock(getLayoutObjectByElementId("container")); + LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target")); + LayoutRect originalRect(0, 0, 100, 100); + TransformationMatrix matrix = container->layer()->currentTransform(); + TransformationMatrix targetMatrix; + // getTransformfromContainter includes transform and perspective matrix + // of the container. + target->getTransformFromContainer(container, LayoutSize(), targetMatrix); + matrix *= targetMatrix; + LayoutRect output(matrix.mapRect(FloatRect(originalRect))); + + checkVisualRect(*target, *target->view(), originalRect, output); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/style/OWNERS b/third_party/WebKit/Source/core/style/OWNERS index 64176816..9c6d10c2 100644 --- a/third_party/WebKit/Source/core/style/OWNERS +++ b/third_party/WebKit/Source/core/style/OWNERS
@@ -1,2 +1,4 @@ meade@chromium.org suzyh@chromium.org + +# COMPONENT: Blink>CSS
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp index d0b11fc..3ead61f 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
@@ -152,7 +152,7 @@ void confirmMessageFromWorkerObject() override { EXPECT_TRUE(isMainThread()); InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject(); - m_events.append(Notification::MessageConfirmed); + m_events.push_back(Notification::MessageConfirmed); if (m_blocking) testing::exitRunLoop(); m_blocking = false; @@ -161,7 +161,7 @@ void pendingActivityFinished() override { EXPECT_TRUE(isMainThread()); InProcessWorkerMessagingProxy::pendingActivityFinished(); - m_events.append(Notification::PendingActivityReported); + m_events.push_back(Notification::PendingActivityReported); if (m_blocking) testing::exitRunLoop(); m_blocking = false; @@ -169,7 +169,7 @@ void workerThreadTerminated() override { EXPECT_TRUE(isMainThread()); - m_events.append(Notification::ThreadTerminated); + m_events.push_back(Notification::ThreadTerminated); if (m_blocking) testing::exitRunLoop(); m_blocking = false;
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index 800abaeb..9cd21b6 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -981,9 +981,10 @@ if (m_parserPaused) { m_scriptStartPosition = textPosition(); - m_pendingCallbacks.append(WTF::wrapUnique(new PendingStartElementNSCallback( - localName, prefix, uri, nbNamespaces, libxmlNamespaces, nbAttributes, - nbDefaulted, libxmlAttributes))); + m_pendingCallbacks.push_back( + WTF::wrapUnique(new PendingStartElementNSCallback( + localName, prefix, uri, nbNamespaces, libxmlNamespaces, + nbAttributes, nbDefaulted, libxmlAttributes))); return; } @@ -1063,7 +1064,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append( + m_pendingCallbacks.push_back( WTF::makeUnique<PendingEndElementNSCallback>(m_scriptStartPosition)); return; } @@ -1151,7 +1152,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append( + m_pendingCallbacks.push_back( WTF::makeUnique<PendingCharactersCallback>(chars, length)); return; } @@ -1170,7 +1171,7 @@ vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args); if (m_parserPaused) { - m_pendingCallbacks.append(WTF::wrapUnique(new PendingErrorCallback( + m_pendingCallbacks.push_back(WTF::wrapUnique(new PendingErrorCallback( type, reinterpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); return; @@ -1185,7 +1186,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append( + m_pendingCallbacks.push_back( WTF::makeUnique<PendingProcessingInstructionCallback>(target, data)); return; } @@ -1227,7 +1228,8 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(WTF::makeUnique<PendingCDATABlockCallback>(text)); + m_pendingCallbacks.push_back( + WTF::makeUnique<PendingCDATABlockCallback>(text)); return; } @@ -1243,7 +1245,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(WTF::makeUnique<PendingCommentCallback>(text)); + m_pendingCallbacks.push_back(WTF::makeUnique<PendingCommentCallback>(text)); return; } @@ -1298,7 +1300,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(WTF::wrapUnique( + m_pendingCallbacks.push_back(WTF::wrapUnique( new PendingInternalSubsetCallback(name, externalID, systemID))); return; }
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp index d4a4d41..e5585ff 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
@@ -515,7 +515,7 @@ ScriptPromise promise = result->promise(); // 10. Run the following steps asynchronously (done in generateRequestTask()) - m_pendingActions.append(PendingAction::CreatePendingGenerateRequest( + m_pendingActions.push_back(PendingAction::CreatePendingGenerateRequest( result, initDataType, initDataBuffer)); DCHECK(!m_actionTimer.isActive()); m_actionTimer.startOneShot(0, BLINK_FROM_HERE); @@ -610,7 +610,7 @@ ScriptPromise promise = result->promise(); // 8. Run the following steps asynchronously (done in loadTask()) - m_pendingActions.append( + m_pendingActions.push_back( PendingAction::CreatePendingLoadRequest(result, sessionId)); DCHECK(!m_actionTimer.isActive()); m_actionTimer.startOneShot(0, BLINK_FROM_HERE); @@ -729,7 +729,7 @@ ScriptPromise promise = result->promise(); // 6. Run the following steps asynchronously (done in updateTask()) - m_pendingActions.append( + m_pendingActions.push_back( PendingAction::CreatePendingUpdate(result, responseCopy)); if (!m_actionTimer.isActive()) m_actionTimer.startOneShot(0, BLINK_FROM_HERE); @@ -774,7 +774,7 @@ ScriptPromise promise = result->promise(); // 5. Run the following steps in parallel (done in closeTask()). - m_pendingActions.append(PendingAction::CreatePendingClose(result)); + m_pendingActions.push_back(PendingAction::CreatePendingClose(result)); if (!m_actionTimer.isActive()) m_actionTimer.startOneShot(0, BLINK_FROM_HERE); @@ -824,7 +824,7 @@ ScriptPromise promise = result->promise(); // 5. Run the following steps asynchronously (done in removeTask()). - m_pendingActions.append(PendingAction::CreatePendingRemove(result)); + m_pendingActions.push_back(PendingAction::CreatePendingRemove(result)); if (!m_actionTimer.isActive()) m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp index 5c3b653..9848a7a1 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -220,7 +220,7 @@ ScriptPromise promise = result->promise(); // 5. Run the following steps asynchronously (documented in timerFired()). - m_pendingActions.append(PendingAction::CreatePendingSetServerCertificate( + m_pendingActions.push_back(PendingAction::CreatePendingSetServerCertificate( result, serverCertificateBuffer)); if (!m_timer.isActive()) m_timer.startOneShot(0, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp index 429b3eb..1d4adcf 100644 --- a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
@@ -223,7 +223,7 @@ void enqueue(Chunk* chunk) { if (m_isCancelled) return; - m_chunks.append(chunk); + m_chunks.push_back(chunk); } bool isEmpty() const { return m_chunks.isEmpty(); }
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.h b/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.h index f858b783..8df1edf7 100644 --- a/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.h +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.h
@@ -108,7 +108,7 @@ // Add a command to this handle. This function must be called BEFORE // any BytesConsumer methods are called. - void add(const Command& command) { m_commands.append(command); } + void add(const Command& command) { m_commands.push_back(command); } Result beginRead(const char** buffer, size_t* available) override; Result endRead(size_t readSize) override;
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp index a09bdae..1e1fe38 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -120,7 +120,7 @@ void DataConsumerHandleTestUtil::ReplayingHandle::Context::add( const Command& command) { MutexLocker locker(m_mutex); - m_commands.append(command); + m_commands.push_back(command); } void DataConsumerHandleTestUtil::ReplayingHandle::Context::attachReader(
diff --git a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp index d865686..3f61474 100644 --- a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp +++ b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -145,7 +145,7 @@ sampleGamepad(change.index, *gamepad, change.pad); m_gamepads->set(change.index, gamepad); - m_pendingEvents.append(gamepad); + m_pendingEvents.push_back(gamepad); m_dispatchOneEventRunner->runAsync(); } @@ -263,10 +263,10 @@ oldGamepad->id() != newGamepad->id(); if (connectedGamepadChanged || (oldWasConnected && !newIsConnected)) { oldGamepad->setConnected(false); - m_pendingEvents.append(oldGamepad); + m_pendingEvents.push_back(oldGamepad); } if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { - m_pendingEvents.append(newGamepad); + m_pendingEvents.push_back(newGamepad); } }
diff --git a/third_party/WebKit/Source/modules/geolocation/OWNERS b/third_party/WebKit/Source/modules/geolocation/OWNERS index 02b971fe..d5024a6 100644 --- a/third_party/WebKit/Source/modules/geolocation/OWNERS +++ b/third_party/WebKit/Source/modules/geolocation/OWNERS
@@ -1 +1,4 @@ mvanouwerkerk@chromium.org + +# TEAM: fizz-team-lon@chromium.org +# COMPONENT: Blink>Location
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index 90500c5..768bbe6 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -108,7 +108,7 @@ int64_t id, const HashSet<String>& scope, IDBDatabase* db) - : ContextClient(executionContext), + : ContextLifecycleObserver(executionContext), m_id(id), m_database(db), m_mode(WebIDBTransactionModeReadOnly), @@ -125,7 +125,7 @@ const HashSet<String>& scope, WebIDBTransactionMode mode, IDBDatabase* db) - : ContextClient(scriptState->getExecutionContext()), + : ContextLifecycleObserver(scriptState->getExecutionContext()), m_id(id), m_database(db), m_mode(mode), @@ -149,7 +149,7 @@ IDBDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& oldMetadata) - : ContextClient(executionContext), + : ContextLifecycleObserver(executionContext), m_id(id), m_database(db), m_openDBRequest(openDBRequest), @@ -164,6 +164,9 @@ } IDBTransaction::~IDBTransaction() { + // Note: IDBTransaction is a ContextLifecycleObserver (rather than + // ContextClient) only in order to be able call upon getExecutionContext() + // during this destructor. DCHECK(m_state == Finished || !getExecutionContext()); DCHECK(m_requestList.isEmpty() || !getExecutionContext()); } @@ -177,7 +180,7 @@ visitor->trace(m_oldStoreMetadata); visitor->trace(m_deletedIndexes); EventTargetWithInlineData::trace(visitor); - ContextClient::trace(visitor); + ContextLifecycleObserver::trace(visitor); } void IDBTransaction::setError(DOMException* error) { @@ -479,7 +482,7 @@ } ExecutionContext* IDBTransaction::getExecutionContext() const { - return ContextClient::getExecutionContext(); + return ContextLifecycleObserver::getExecutionContext(); } DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h index 0b9e006..148d947 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h
@@ -56,7 +56,7 @@ class MODULES_EXPORT IDBTransaction final : public EventTargetWithInlineData, public ActiveScriptWrappable<IDBTransaction>, - public ContextClient { + public ContextLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp index ccb119b..d06f09e 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -266,7 +266,7 @@ if (!canSendMessage(exceptionState)) return; - m_messages.append(new Message(message)); + m_messages.push_back(new Message(message)); handleMessageQueue(); } @@ -276,7 +276,7 @@ if (!canSendMessage(exceptionState)) return; - m_messages.append(new Message(arrayBuffer)); + m_messages.push_back(new Message(arrayBuffer)); handleMessageQueue(); } @@ -286,7 +286,7 @@ if (!canSendMessage(exceptionState)) return; - m_messages.append(new Message(arrayBufferView->buffer())); + m_messages.push_back(new Message(arrayBufferView->buffer())); handleMessageQueue(); } @@ -295,7 +295,7 @@ if (!canSendMessage(exceptionState)) return; - m_messages.append(new Message(data->blobDataHandle())); + m_messages.push_back(new Message(data->blobDataHandle())); handleMessageQueue(); }
diff --git a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp index d4b91e1..50d0463 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp
@@ -96,7 +96,7 @@ void SpeechSynthesis::speak(SpeechSynthesisUtterance* utterance) { ASSERT(utterance); - m_utteranceQueue.append(utterance); + m_utteranceQueue.push_back(utterance); // If the queue was empty, speak this immediately. if (m_utteranceQueue.size() == 1)
diff --git a/third_party/WebKit/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp b/third_party/WebKit/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp index 6fbd40a..1ebfc14 100644 --- a/third_party/WebKit/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp +++ b/third_party/WebKit/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp
@@ -95,7 +95,7 @@ speakNow(); return; } - m_queuedUtterances.append(utterance); + m_queuedUtterances.push_back(utterance); } void PlatformSpeechSynthesizerMock::speakNow() {
diff --git a/third_party/WebKit/Source/modules/vibration/OWNERS b/third_party/WebKit/Source/modules/vibration/OWNERS index 02b971fe..d8c3423 100644 --- a/third_party/WebKit/Source/modules/vibration/OWNERS +++ b/third_party/WebKit/Source/modules/vibration/OWNERS
@@ -1 +1,4 @@ mvanouwerkerk@chromium.org + +# TEAM: platform-capabilities@chromium.org +# COMPONENT: Blink>Vibration
diff --git a/third_party/WebKit/Source/modules/vr/VRController.cpp b/third_party/WebKit/Source/modules/vr/VRController.cpp index 028834b..7c4b8595 100644 --- a/third_party/WebKit/Source/modules/vr/VRController.cpp +++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -44,7 +44,7 @@ // Otherwise we're still waiting for the full list of displays to be populated // so queue up the promise for resolution when onDisplaysSynced is called. - m_pendingGetDevicesCallbacks.append( + m_pendingGetDevicesCallbacks.push_back( WTF::makeUnique<VRGetDevicesCallback>(resolver)); }
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp index 97475f1..0c85c13 100644 --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -298,7 +298,7 @@ // If we are waiting on the results of a previous requestPresent call don't // fire a new request, just cache the resolver and resolve it when the // original request returns. - m_pendingPresentResolvers.append(resolver); + m_pendingPresentResolvers.push_back(resolver); } else if (firstPresent) { bool secureContext = scriptState->getExecutionContext()->isSecureContext(); if (!m_display) { @@ -309,7 +309,7 @@ return promise; } - m_pendingPresentResolvers.append(resolver); + m_pendingPresentResolvers.push_back(resolver); m_submit_frame_client_binding.Close(); m_display->RequestPresent( secureContext,
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 5d56244..18a6807 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -326,7 +326,7 @@ SQLTransactionBackend* transactionBackend = SQLTransactionBackend::create(this, transaction, wrapper, readOnly); - m_transactionQueue.append(transactionBackend); + m_transactionQueue.push_back(transactionBackend); if (!m_transactionInProgress) scheduleTransaction();
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp index 028afc9..dda4200a 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp
@@ -501,7 +501,7 @@ SQLStatementBackend* statementBackend) { DCHECK(isMainThread()); MutexLocker locker(m_statementMutex); - m_statementQueue.append(statementBackend); + m_statementQueue.push_back(statementBackend); } void SQLTransactionBackend::computeNextStateAndCleanupIfNeeded() {
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp index 6f7dfa2..90df91b 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp
@@ -81,11 +81,11 @@ CoordinationInfo& info = m_coordinationInfoMap.insert(dbIdentifier, CoordinationInfo()) .storedValue->value; - info.pendingTransactions.append(transaction); + info.pendingTransactions.push_back(transaction); processPendingTransactions(info); } else { CoordinationInfo& info = coordinationInfoIterator->value; - info.pendingTransactions.append(transaction); + info.pendingTransactions.push_back(transaction); processPendingTransactions(info); } }
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp index 1ed6912a..9128686 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
@@ -88,7 +88,7 @@ m_target->dispatchEvent(event); break; case Suspended: - m_events.append(event); + m_events.push_back(event); break; case Stopped: DCHECK(m_events.isEmpty()); @@ -141,7 +141,7 @@ } if (m_state == Suspended) { while (!m_events.isEmpty()) - events.append(m_events.takeFirst()); + events.push_back(m_events.takeFirst()); events.swap(m_events); } }
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp index bf702a3f..99a715d 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -235,7 +235,7 @@ probe::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeText, true, message.data(), message.length()); - m_messages.append(new Message(message)); + m_messages.push_back(new Message(message)); processSendQueue(); } @@ -250,7 +250,7 @@ // affect actual behavior. probe::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, "", 0); - m_messages.append(new Message(std::move(blobDataHandle))); + m_messages.push_back(new Message(std::move(blobDataHandle))); processSendQueue(); } @@ -267,7 +267,7 @@ // buffer.slice copies its contents. // FIXME: Reduce copy by sending the data immediately when we don't need to // queue the data. - m_messages.append( + m_messages.push_back( new Message(buffer.slice(byteOffset, byteOffset + byteLength))); processSendQueue(); } @@ -282,7 +282,8 @@ probe::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeText, true, data->data(), data->size()); - m_messages.append(new Message(std::move(data), MessageTypeTextAsCharVector)); + m_messages.push_back( + new Message(std::move(data), MessageTypeTextAsCharVector)); processSendQueue(); } @@ -296,7 +297,7 @@ probe::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, data->data(), data->size()); - m_messages.append( + m_messages.push_back( new Message(std::move(data), MessageTypeBinaryAsCharVector)); processSendQueue(); } @@ -306,7 +307,7 @@ DCHECK(m_handle); unsigned short codeToSend = static_cast<unsigned short>( code == CloseEventCodeNotSpecified ? CloseEventCodeNoStatusRcvd : code); - m_messages.append(new Message(codeToSend, reason)); + m_messages.push_back(new Message(codeToSend, reason)); processSendQueue(); }
diff --git a/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp b/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp index 0664966c9..3fe9b6f 100644 --- a/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp
@@ -182,7 +182,7 @@ --m_bracketsFixupDepth; } } - m_brackets.append(BracketRec({ch, USCRIPT_COMMON})); + m_brackets.push_back(BracketRec({ch, USCRIPT_COMMON})); ++m_bracketsFixupDepth; }
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp index d9084ef..d4ac4fa 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -252,13 +252,14 @@ if (currentClusterResult == Shaped && !isLastResort) { // Now it's clear that we need to continue processing. if (!fontCycleQueued) { - rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); + rangeData->holesQueue.push_back( + HolesQueueItem(HolesQueueNextFont, 0, 0)); fontCycleQueued = true; } // Here we need to put character positions. ASSERT(numCharacters); - rangeData->holesQueue.append( + rangeData->holesQueue.push_back( HolesQueueItem(HolesQueueRange, startIndex, numCharacters)); } @@ -569,9 +570,9 @@ RefPtr<FontFallbackIterator> fallbackIterator = font->createFontFallbackIterator(segment.fontFallbackPriority); - rangeData->holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); - rangeData->holesQueue.append(HolesQueueItem(HolesQueueRange, segment.start, - segment.end - segment.start)); + rangeData->holesQueue.push_back(HolesQueueItem(HolesQueueNextFont, 0, 0)); + rangeData->holesQueue.push_back(HolesQueueItem(HolesQueueRange, segment.start, + segment.end - segment.start)); bool fontCycleQueued = false; Vector<UChar32> fallbackCharsHint;
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp index 3ab8fd71..44f7f72 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
@@ -90,9 +90,6 @@ } sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { - // TODO(xlai): Refactor so that sync tokens are only used when - // |m_textureHolder| is MailboxTextureHolder. - // https://crbug.com/693229 checkThread(); if (!isValid()) return nullptr;
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index a5fdbf58..8cdbb05d 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -400,8 +400,22 @@ const cc::ReturnedResourceArray& resources) { for (const auto& resource : resources) { RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); - if (image) - image->updateSyncToken(resource.sync_token); + + if (image) { + if (image->hasMailbox()) { + image->updateSyncToken(resource.sync_token); + } else if (SharedGpuContext::isValid() && resource.sync_token.HasData()) { + // Although image has MailboxTextureHolder at the time when it is + // inserted to m_cachedImages, the + // OffscreenCanvasPlaceHolder::placeholderFrame() exposes this image to + // everyone accessing the placeholder canvas as an image source, some of + // which may want to consume the image as a SkImage, thereby converting + // the MailTextureHolder to a SkiaTextureHolder. In this case, we + // need to wait for the new sync token passed by CompositorFrameSink. + SharedGpuContext::gl()->WaitSyncTokenCHROMIUM( + resource.sync_token.GetConstData()); + } + } reclaimResource(resource.id); } }
diff --git a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h index b4da4fe2..0fab63e 100644 --- a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h +++ b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
@@ -15,8 +15,6 @@ ~SkiaTextureHolder() override; // Methods overriding TextureHolder - void updateSyncToken(gpu::SyncToken) override {} - bool isSkiaTextureHolder() final { return true; } bool isMailboxTextureHolder() final { return false; } unsigned sharedContextId() final; @@ -26,7 +24,6 @@ bool currentFrameKnownToBeOpaque(Image::MetadataMode) final { return m_image->isOpaque(); } - sk_sp<SkImage> skImage() final { return m_image; } void setSharedContextId(unsigned contextId) final { m_sharedContextId = contextId;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp index 03f9dadf..f43d5588 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
@@ -45,7 +45,7 @@ if (!gl || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) return; - m_queries.append(0); + m_queries.push_back(0); if (m_canUseSyncQueries) gl->GenQueriesEXT(1, &m_queries.last()); if (m_canUseSyncQueries) {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp index 6258d642..55f018c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -373,6 +373,14 @@ it++) { TransformationMatrix localTransformMatrix = (*it)->matrix(); localTransformMatrix.applyTransformOrigin((*it)->origin()); + + // Flattening Lemma: flatten(A * flatten(B)) = flatten(flatten(A) * B). + // goo.gl/DNKyOc. Thus we can flatten transformMatrix rather than + // localTransformMatrix, because GeometryMapper only supports transforms + // into a flattened destination space. + if ((*it)->flattensInheritedTransform()) + transformMatrix.flattenTo2d(); + transformMatrix = transformMatrix * localTransformMatrix; (*it)->getTransformCache().setCachedTransform(ancestorTransformNode, transformMatrix);
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h index c5a8ec36..0b414c5e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h
@@ -113,6 +113,10 @@ // Returns the matrix used in |LocalToAncestorRect|. DCHECK fails iff // |localTransformNode| is not equal to or a descendant of // |ancestorTransformNode|. + // This matrix may not be flattened. Since GeometryMapper only supports + // flattened ancestor spaces, the returned matrix must be flattened to have + // the correct semantics (calling mapRect() on it implicitly applies + // flattening to the input; flattenTo2d() does it explicitly to tme matrix). const TransformationMatrix& localToAncestorMatrix( const TransformPaintPropertyNode* localTransformNode, const TransformPaintPropertyNode* ancestorTransformNode);
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp index 7c44f7b1..cdda820d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -276,6 +276,32 @@ *getTransform(transform1.get(), rootPropertyTreeState().transform())); } +TEST_F(GeometryMapperTest, NestedTransformsFlattening) { + TransformationMatrix rotateTransform; + rotateTransform.rotate3d(45, 0, 0); + RefPtr<TransformPaintPropertyNode> transform1 = + TransformPaintPropertyNode::create(rootPropertyTreeState().transform(), + rotateTransform, FloatPoint3D()); + + TransformationMatrix inverseRotateTransform; + inverseRotateTransform.rotate3d(-45, 0, 0); + RefPtr<TransformPaintPropertyNode> transform2 = + TransformPaintPropertyNode::create(transform1, inverseRotateTransform, + FloatPoint3D(), + true); // Flattens + + PropertyTreeState localState = rootPropertyTreeState(); + localState.setTransform(transform2.get()); + + FloatRect input(0, 0, 100, 100); + rotateTransform.flattenTo2d(); + TransformationMatrix final = rotateTransform * inverseRotateTransform; + FloatRect output = final.mapRect(input); + bool hasRadius = false; + CHECK_MAPPINGS(input, output, output, final, FloatClipRect(), localState, + rootPropertyTreeState(), hasRadius); +} + TEST_F(GeometryMapperTest, NestedTransformsScaleAndTranslation) { TransformationMatrix scaleTransform; scaleTransform.scale(2); @@ -819,11 +845,11 @@ EXPECT_EQ(FloatRect(-150, -150, 450, 450), output); bool hasRadius = false; - CHECK_MAPPINGS( - input, output, FloatRect(0, 0, 300, 300), - transformAboveEffect->matrix() * transformBelowEffect->matrix(), - FloatClipRect(FloatRect(30, 30, 270, 270)), localState, - rootPropertyTreeState(), hasRadius); + TransformationMatrix combinedTransform = + transformAboveEffect->matrix() * transformBelowEffect->matrix(); + CHECK_MAPPINGS(input, output, FloatRect(0, 0, 300, 300), combinedTransform, + FloatClipRect(FloatRect(30, 30, 270, 270)), localState, + rootPropertyTreeState(), hasRadius); } TEST_F(GeometryMapperTest, ReflectionWithPaintOffset) {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h index 9d08f72..7b82beca 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h
@@ -24,6 +24,8 @@ // Returns the transformed rect (see GeometryMapper.h) of |this| in the // space of |ancestorTransform|, if there is one cached. Otherwise returns // null. + // + // These transforms are not flattened to 2d. const TransformationMatrix* getCachedTransform( const TransformPaintPropertyNode* ancestorTransform);
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp index 2481a8c..64d69dd 100644 --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -2426,27 +2426,27 @@ set3->add(oneB); set3->add(oneB); vector->push_back(oneB); - deque->append(oneB); + deque->push_back(oneB); vector2->push_back(threeB); vector2->push_back(fourB); - deque2->append(threeE); - deque2->append(fourE); + deque2->push_back(threeE); + deque2->push_back(fourE); vectorWU->push_back(PairWrappedUnwrapped(&*oneC, 42)); - dequeWU->append(PairWrappedUnwrapped(&*oneE, 42)); + dequeWU->push_back(PairWrappedUnwrapped(&*oneE, 42)); vectorWU2->push_back(PairWrappedUnwrapped(&*threeC, 43)); vectorWU2->push_back(PairWrappedUnwrapped(&*fourC, 44)); vectorWU2->push_back(PairWrappedUnwrapped(&*fiveC, 45)); - dequeWU2->append(PairWrappedUnwrapped(&*threeE, 43)); - dequeWU2->append(PairWrappedUnwrapped(&*fourE, 44)); - dequeWU2->append(PairWrappedUnwrapped(&*fiveE, 45)); + dequeWU2->push_back(PairWrappedUnwrapped(&*threeE, 43)); + dequeWU2->push_back(PairWrappedUnwrapped(&*fourE, 44)); + dequeWU2->push_back(PairWrappedUnwrapped(&*fiveE, 45)); vectorUW->push_back(PairUnwrappedWrapped(1, &*oneD)); vectorUW2->push_back(PairUnwrappedWrapped(103, &*threeD)); vectorUW2->push_back(PairUnwrappedWrapped(104, &*fourD)); vectorUW2->push_back(PairUnwrappedWrapped(105, &*fiveD)); - dequeUW->append(PairUnwrappedWrapped(1, &*oneF)); - dequeUW2->append(PairUnwrappedWrapped(103, &*threeF)); - dequeUW2->append(PairUnwrappedWrapped(104, &*fourF)); - dequeUW2->append(PairUnwrappedWrapped(105, &*fiveF)); + dequeUW->push_back(PairUnwrappedWrapped(1, &*oneF)); + dequeUW2->push_back(PairUnwrappedWrapped(103, &*threeF)); + dequeUW2->push_back(PairUnwrappedWrapped(104, &*fourF)); + dequeUW2->push_back(PairUnwrappedWrapped(105, &*fiveF)); EXPECT_TRUE(dequeContains(*deque, oneB)); @@ -2872,7 +2872,7 @@ public: NonTrivialObject() {} explicit NonTrivialObject(int num) { - m_deque.append(IntWrapper::create(num)); + m_deque.push_back(IntWrapper::create(num)); m_vector.push_back(IntWrapper::create(num)); } DEFINE_INLINE_TRACE() { @@ -3854,8 +3854,8 @@ pVec.push_back(one); pVec.push_back(two); - pDeque.append(seven); - pDeque.append(two); + pDeque.push_back(seven); + pDeque.push_back(two); Vec* vec = new Vec(); vec->swap(pVec); @@ -3934,7 +3934,7 @@ it->value.push_back(IntWrapper::create(42)); EXPECT_EQ(1u, map->at(key).size()); - it2->value.append(IntWrapper::create(42)); + it2->value.push_back(IntWrapper::create(42)); EXPECT_EQ(1u, map2->at(key).size()); Persistent<HeapHashMap<void*, IntVector>> keepAlive(map); @@ -4005,7 +4005,7 @@ HeapDeque<IntDeque>* deque = new HeapDeque<IntDeque>(); vector->push_back(IntVector()); - deque->append(IntDeque()); + deque->push_back(IntDeque()); HeapVector<IntVector>::iterator it = vector->begin(); HeapDeque<IntDeque>::iterator it2 = deque->begin(); @@ -4013,7 +4013,7 @@ EXPECT_EQ(0u, it2->size()); it->push_back(IntWrapper::create(42)); - it2->append(IntWrapper::create(42)); + it2->push_back(IntWrapper::create(42)); EXPECT_EQ(1u, it->size()); EXPECT_EQ(1u, it2->size()); @@ -4058,17 +4058,17 @@ PersistentHeapDeque<VectorObject, 2> inlineDeque; PersistentHeapDeque<VectorObject> outlineDeque; VectorObject i1, i2; - inlineDeque.append(i1); - inlineDeque.append(i2); + inlineDeque.push_back(i1); + inlineDeque.push_back(i2); VectorObject o1, o2; - outlineDeque.append(o1); - outlineDeque.append(o2); + outlineDeque.push_back(o1); + outlineDeque.push_back(o2); PersistentHeapDeque<VectorObjectInheritedTrace> dequeInheritedTrace; VectorObjectInheritedTrace it1, it2; - dequeInheritedTrace.append(it1); - dequeInheritedTrace.append(it2); + dequeInheritedTrace.push_back(it1); + dequeInheritedTrace.push_back(it2); preciselyCollectGarbage(); EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); @@ -5711,7 +5711,7 @@ // deque's buffer. int i = 0; for (; i < 60; ++i) - deque->append(IntWrapper::create(i)); + deque->push_back(IntWrapper::create(i)); EXPECT_EQ(60u, deque->size()); i = 0; @@ -5735,7 +5735,7 @@ // Append even more, eventually causing an expansion of the underlying // buffer once the end index wraps around and reaches the start index. for (i = 0; i < 70; ++i) - deque->append(IntWrapper::create(60 + i)); + deque->push_back(IntWrapper::create(60 + i)); // Verify that the final buffer expansion copied the start and end segments // of the old buffer to both ends of the expanded buffer, along with @@ -5795,8 +5795,8 @@ // deque's buffer. int i = 0; for (; i < 60; ++i) { - deque->append(PartObjectWithRef(i)); - dequeUnused->append(PartObjectWithRef(i)); + deque->push_back(PartObjectWithRef(i)); + dequeUnused->push_back(PartObjectWithRef(i)); } EXPECT_EQ(60u, deque->size()); @@ -5821,7 +5821,7 @@ // Append even more, eventually causing an expansion of the underlying // buffer once the end index wraps around and reaches the start index. for (i = 0; i < 70; ++i) - deque->append(PartObjectWithRef(60 + i)); + deque->push_back(PartObjectWithRef(60 + i)); // Verify that the final buffer expansion copied the start and end segments // of the old buffer to both ends of the expanded buffer, along with @@ -5834,7 +5834,7 @@ } for (i = 0; i < 70; ++i) - deque->append(PartObjectWithRef(130 + i)); + deque->push_back(PartObjectWithRef(130 + i)); EXPECT_EQ(150u, deque->size()); i = 0;
diff --git a/third_party/WebKit/Source/platform/text/SegmentedString.cpp b/third_party/WebKit/Source/platform/text/SegmentedString.cpp index 197cb16..98131fc1 100644 --- a/third_party/WebKit/Source/platform/text/SegmentedString.cpp +++ b/third_party/WebKit/Source/platform/text/SegmentedString.cpp
@@ -67,7 +67,7 @@ m_currentString = s; updateAdvanceFunctionPointers(); } else { - m_substrings.append(s); + m_substrings.push_back(s); } m_empty = false; }
diff --git a/third_party/WebKit/Source/wtf/Deque.h b/third_party/WebKit/Source/wtf/Deque.h index eb338fb632..7d3689a 100644 --- a/third_party/WebKit/Source/wtf/Deque.h +++ b/third_party/WebKit/Source/wtf/Deque.h
@@ -126,8 +126,6 @@ const T& operator[](size_t i) const { return at(i); } template <typename U> - void append(U&&); - template <typename U> void prepend(U&&); void removeFirst(); void remove(iterator&); @@ -135,9 +133,7 @@ // STL compatibility. template <typename U> - void push_back(U&& u) { - append(std::forward<U>(u)); - } + void push_back(U&&); template <typename U> void push_front(U&& u) { prepend(std::forward<U>(u)); @@ -503,7 +499,7 @@ template <typename T, size_t inlineCapacity, typename Allocator> template <typename U> -inline void Deque<T, inlineCapacity, Allocator>::append(U&& value) { +inline void Deque<T, inlineCapacity, Allocator>::push_back(U&& value) { expandCapacityIfNeeded(); T* newElement = &m_buffer.buffer()[m_end]; if (m_end == m_buffer.capacity() - 1)
diff --git a/third_party/WebKit/Source/wtf/DequeTest.cpp b/third_party/WebKit/Source/wtf/DequeTest.cpp index 8de0cd3..ef0da37 100644 --- a/third_party/WebKit/Source/wtf/DequeTest.cpp +++ b/third_party/WebKit/Source/wtf/DequeTest.cpp
@@ -95,18 +95,18 @@ template <size_t inlineCapacity> void reverseTest() { Deque<int, inlineCapacity> intDeque; - intDeque.append(10); - intDeque.append(11); - intDeque.append(12); - intDeque.append(13); + intDeque.push_back(10); + intDeque.push_back(11); + intDeque.push_back(12); + intDeque.push_back(13); checkNumberSequence(intDeque, 10, 13, true); checkNumberSequence(intDeque, 13, 10, false); checkNumberSequenceReverse(intDeque, 13, 10, true); checkNumberSequenceReverse(intDeque, 10, 13, false); - intDeque.append(14); - intDeque.append(15); + intDeque.push_back(14); + intDeque.push_back(15); EXPECT_EQ(10, intDeque.takeFirst()); EXPECT_EQ(15, intDeque.takeLast()); checkNumberSequence(intDeque, 11, 14, true); @@ -115,7 +115,7 @@ checkNumberSequenceReverse(intDeque, 11, 14, false); for (int i = 15; i < 200; ++i) - intDeque.append(i); + intDeque.push_back(i); checkNumberSequence(intDeque, 11, 199, true); checkNumberSequence(intDeque, 199, 11, false); checkNumberSequenceReverse(intDeque, 199, 11, true); @@ -175,8 +175,8 @@ void ownPtrTest() { int destructNumber = 0; OwnPtrDeque deque; - deque.append(WTF::wrapUnique(new DestructCounter(0, &destructNumber))); - deque.append(WTF::wrapUnique(new DestructCounter(1, &destructNumber))); + deque.push_back(WTF::wrapUnique(new DestructCounter(0, &destructNumber))); + deque.push_back(WTF::wrapUnique(new DestructCounter(1, &destructNumber))); EXPECT_EQ(2u, deque.size()); std::unique_ptr<DestructCounter>& counter0 = deque.first(); @@ -265,8 +265,8 @@ TEST(DequeTest, MoveOnlyType) { Deque<MoveOnly> deque; - deque.append(MoveOnly(1)); - deque.append(MoveOnly(2)); + deque.push_back(MoveOnly(1)); + deque.push_back(MoveOnly(2)); EXPECT_EQ(2u, deque.size()); ASSERT_EQ(1, deque.first().value()); @@ -317,9 +317,9 @@ template <size_t inlineCapacity> void swapWithOrWithoutInlineCapacity() { Deque<WrappedInt, inlineCapacity> dequeA; - dequeA.append(WrappedInt(1)); + dequeA.push_back(WrappedInt(1)); Deque<WrappedInt, inlineCapacity> dequeB; - dequeB.append(WrappedInt(2)); + dequeB.push_back(WrappedInt(2)); ASSERT_EQ(dequeA.size(), dequeB.size()); dequeA.swap(dequeB); @@ -329,7 +329,7 @@ ASSERT_EQ(1u, dequeB.size()); EXPECT_EQ(1, dequeB.first().get()); - dequeA.append(WrappedInt(3)); + dequeA.push_back(WrappedInt(3)); ASSERT_GT(dequeA.size(), dequeB.size()); dequeA.swap(dequeB); @@ -347,7 +347,7 @@ ASSERT_EQ(1u, dequeB.size()); EXPECT_EQ(1, dequeB.first().get()); - dequeA.append(WrappedInt(4)); + dequeA.push_back(WrappedInt(4)); dequeA.swap(dequeB); ASSERT_EQ(1u, dequeA.size()); @@ -388,8 +388,8 @@ Deque<RefPtr<LivenessCounter>, inlineCapacity> deque; Deque<RefPtr<LivenessCounter>, inlineCapacity> deque2; - deque.append(&counter); - deque2.append(&counter); + deque.push_back(&counter); + deque2.push_back(&counter); EXPECT_EQ(2u, LivenessCounter::s_live); // Add various numbers of elements to deques, then remove various numbers @@ -407,7 +407,7 @@ deque2.clear(); EXPECT_EQ(0u, LivenessCounter::s_live); for (unsigned k = 0; k < j; k++) - deque.append(&counter); + deque.push_back(&counter); EXPECT_EQ(j, LivenessCounter::s_live); EXPECT_EQ(j, deque.size()); for (unsigned k = 0; k < i; k++) @@ -422,9 +422,9 @@ deque.swap(deque2); EXPECT_EQ(j - i, LivenessCounter::s_live); - deque2.append(&counter); - deque2.append(&counter); - deque2.append(&counter); + deque2.push_back(&counter); + deque2.push_back(&counter); + deque2.push_back(&counter); for (unsigned k = 0; k < 12; k++) { EXPECT_EQ(3 + j - i, LivenessCounter::s_live); @@ -440,7 +440,7 @@ EXPECT_EQ(3u, deque2.size()); deque2.removeFirst(); - deque2.append(&counter); + deque2.push_back(&counter); } } } @@ -477,13 +477,13 @@ deque.clear(); deque2.clear(); for (unsigned i = 0; i < pad; i++) - deque.append(103); + deque.push_back(103); for (unsigned i = 0; i < pad2; i++) - deque2.append(888); + deque2.push_back(888); for (unsigned i = 0; i < size; i++) - deque.append(i); + deque.push_back(i); for (unsigned i = 0; i < size2; i++) - deque2.append(i + 42); + deque2.push_back(i + 42); for (unsigned i = 0; i < pad; i++) EXPECT_EQ(103u, deque.takeFirst()); for (unsigned i = 0; i < pad2; i++) @@ -510,8 +510,8 @@ TEST(DequeTest, UniquePtr) { using Pointer = std::unique_ptr<int>; Deque<Pointer> deque; - deque.append(Pointer(new int(1))); - deque.append(Pointer(new int(2))); + deque.push_back(Pointer(new int(1))); + deque.push_back(Pointer(new int(2))); deque.prepend(Pointer(new int(-1))); deque.prepend(Pointer(new int(-2))); ASSERT_EQ(4u, deque.size()); @@ -530,7 +530,7 @@ deque.pop_back(); EXPECT_EQ(0u, deque.size()); - deque.append(Pointer(new int(42))); + deque.push_back(Pointer(new int(42))); deque[0] = Pointer(new int(24)); ASSERT_EQ(1u, deque.size()); EXPECT_EQ(24, *deque[0]); @@ -562,8 +562,8 @@ // element-wise copy/move. Deque<CountCopy, 1> deque; int counter = 0; - deque.append(CountCopy(&counter)); - deque.append(CountCopy(&counter)); + deque.push_back(CountCopy(&counter)); + deque.push_back(CountCopy(&counter)); Deque<CountCopy, 1> other(deque); counter = 0; @@ -578,7 +578,7 @@ TEST(DequeTest, RemoveWhileIterating) { Deque<int> deque; for (int i = 0; i < 10; ++i) - deque.append(i); + deque.push_back(i); // All numbers present. {
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/bindings/bindings_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/bindings/bindings_tests.py index a80de506..831d26ce 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/bindings/bindings_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/bindings/bindings_tests.py
@@ -196,6 +196,7 @@ self.impl_output_directory = impl_output_directory self.target_component = target_component + def bindings_tests(output_directory, verbose): executive = Executive()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/bindings/generate_idl_diff_test.py b/third_party/WebKit/Tools/Scripts/webkitpy/bindings/generate_idl_diff_test.py index 8b9675b3..d634439 100755 --- a/third_party/WebKit/Tools/Scripts/webkitpy/bindings/generate_idl_diff_test.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/bindings/generate_idl_diff_test.py
@@ -69,7 +69,7 @@ self.assertEqual(deleted['ExtAttributes'], []) self.assertEqual(added['Name'], 'computedTiming') self.assertEqual(added['Type'], 'ComputedTimingProperties') - self.assertEqual(added['ExtAttributes'], [{"Name": "maxChannelCount"}]) + self.assertEqual(added['ExtAttributes'], [{'Name': 'maxChannelCount'}]) self.assertEqual(unchanged['Name'], 'timing') self.assertEqual(unchanged['Type'], 'AnimationEffectTiming') self.assertEqual(unchanged['ExtAttributes'], []) @@ -77,9 +77,9 @@ def test_changed_operation(self): changed_interface = self.diff['ANGLEInstancedArrays'] members = changed_interface['Operations'] - deleted_arguments = [{"Type": "long", "Name": "primcount"}] - added_arguments = [{"Type": "unsigned long", "Name": "mode"}] - unchanged_arguments = [{"Type": "unsigned long", "Name": "mode"}] + deleted_arguments = [{'Type': 'long', 'Name': 'primcount'}] + added_arguments = [{'Type': 'unsigned long', 'Name': 'mode'}] + unchanged_arguments = [{'Type': 'unsigned long', 'Name': 'mode'}] for member in members: if member.get(DIFF_TAG) == DIFF_TAG_DELETED: deleted = member
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer.py index 09302cb8..067d358 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baseline_optimizer.py
@@ -59,7 +59,7 @@ # So, we can optimize the virtual path, then the virtual root, and then # the regular path. - _log.debug("Optimizing regular fallback path.") + _log.debug('Optimizing regular fallback path.') result = self._optimize_subtree(baseline_name) non_virtual_baseline_name = self._virtual_base(baseline_name) if not non_virtual_baseline_name: @@ -67,13 +67,13 @@ self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) - _log.debug("Optimizing non-virtual fallback path.") + _log.debug('Optimizing non-virtual fallback path.') result |= self._optimize_subtree(non_virtual_baseline_name) return result def write_by_directory(self, results_by_directory, writer, indent): for path in sorted(results_by_directory): - writer("%s%s: %s" % (indent, self._platform(path), results_by_directory[path][0:6])) + writer('%s%s: %s' % (indent, self._platform(path), results_by_directory[path][0:6])) def read_results_by_directory(self, baseline_name): results_by_directory = {} @@ -92,10 +92,10 @@ if new_results_by_directory == results_by_directory: if new_results_by_directory: - _log.debug(" %s: (already optimal)", basename) - self.write_by_directory(results_by_directory, _log.debug, " ") + _log.debug(' %s: (already optimal)', basename) + self.write_by_directory(results_by_directory, _log.debug, ' ') else: - _log.debug(" %s: (no baselines found)", basename) + _log.debug(' %s: (no baselines found)', basename) # This is just used for unit tests. # Intentionally set it to the old data if we don't modify anything. self.new_results_by_directory.append(results_by_directory) @@ -106,15 +106,15 @@ # This really should never happen. Just a sanity check to make # sure the script fails in the case of bugs instead of committing # incorrect baselines. - _log.error(" %s: optimization failed", basename) - self.write_by_directory(results_by_directory, _log.warning, " ") + _log.error(' %s: optimization failed', basename) + self.write_by_directory(results_by_directory, _log.warning, ' ') return False - _log.debug(" %s:", basename) - _log.debug(" Before: ") - self.write_by_directory(results_by_directory, _log.debug, " ") - _log.debug(" After: ") - self.write_by_directory(new_results_by_directory, _log.debug, " ") + _log.debug(' %s:', basename) + _log.debug(' Before: ') + self.write_by_directory(results_by_directory, _log.debug, ' ') + _log.debug(' After: ') + self.write_by_directory(new_results_by_directory, _log.debug, ' ') self._move_baselines(baseline_name, results_by_directory, new_results_by_directory) return True @@ -134,13 +134,13 @@ fs_files.append(file_name) if fs_files: - _log.debug(" Deleting (file system):") + _log.debug(' Deleting (file system):') for platform_dir in sorted(self._platform(filename) for filename in fs_files): - _log.debug(" " + platform_dir) + _log.debug(' ' + platform_dir) for filename in fs_files: self._filesystem.remove(filename) else: - _log.debug(" (Nothing to delete)") + _log.debug(' (Nothing to delete)') file_names = [] for directory, result in new_results_by_directory.items(): @@ -151,11 +151,11 @@ file_names.append(destination) if file_names: - _log.debug(" Adding:") + _log.debug(' Adding:') for platform_dir in sorted(self._platform(filename) for filename in file_names): - _log.debug(" " + platform_dir) + _log.debug(' ' + platform_dir) else: - _log.debug(" (Nothing to add)") + _log.debug(' (Nothing to add)') def _platform(self, filename): platform_dir = self.ROOT_LAYOUT_TESTS_DIRECTORY + self._filesystem.sep + 'platform' + self._filesystem.sep @@ -183,8 +183,8 @@ return break - _log.debug("Deleting redundant virtual root expected result.") - _log.debug(" Deleting (file system): " + virtual_root_baseline_path) + _log.debug('Deleting redundant virtual root expected result.') + _log.debug(' Deleting (file system): ' + virtual_root_baseline_path) self._filesystem.remove(virtual_root_baseline_path) def _baseline_root(self, baseline_name): @@ -228,7 +228,6 @@ baseline_name_without_virtual = baseline_name return self._filesystem.join(self._webkit_base, directory, baseline_name_without_virtual) - def _results_by_port_name(self, results_by_directory, baseline_name): results_by_port_name = {} for port_name, port in self._ports.items(): @@ -322,5 +321,4 @@ for index, directory in enumerate(fallback_path): if directory in results_by_directory and (results_by_directory[directory] == current_result): return index, directory - assert False, "result %s not found in fallback_path %s, %s" % (current_result, fallback_path, results_by_directory) - + assert False, 'result %s not found in fallback_path %s, %s' % (current_result, fallback_path, results_by_directory)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git.py index 1024d14..cd6be8d6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git.py
@@ -109,14 +109,14 @@ try: executive = executive or Executive() return executive.run_command([cls.executable_name, 'rev-parse', '--is-inside-work-tree'], - cwd=path, error_handler=Executive.ignore_error).rstrip() == "true" + cwd=path, error_handler=Executive.ignore_error).rstrip() == 'true' except OSError: # The Windows bots seem to through a WindowsError when git isn't installed. return False def find_checkout_root(self, path): # "git rev-parse --show-cdup" would be another way to get to the root - checkout_root = self._run_git(['rev-parse', '--show-toplevel'], cwd=(path or "./")).strip() + checkout_root = self._run_git(['rev-parse', '--show-toplevel'], cwd=(path or './')).strip() if not self._filesystem.isabs(checkout_root): # Sometimes git returns relative paths checkout_root = self._filesystem.join(path, checkout_root) return checkout_root @@ -129,7 +129,7 @@ # FIXME: This should use an Executive. executive = executive or Executive() return executive.run_command( - [cls.executable_name, "config", "--get-all", key], error_handler=Executive.ignore_error, cwd=cwd).rstrip('\n') + [cls.executable_name, 'config', '--get-all', key], error_handler=Executive.ignore_error, cwd=cwd).rstrip('\n') def _discard_local_commits(self): self._run_git(['reset', '--hard', self._remote_branch_ref()]) @@ -182,16 +182,16 @@ return self._run_git(command) def add_list(self, paths, return_exit_code=False): - return self._run_git(["add"] + paths, return_exit_code=return_exit_code) + return self._run_git(['add'] + paths, return_exit_code=return_exit_code) def delete_list(self, paths): - return self._run_git(["rm", "-f"] + paths) + return self._run_git(['rm', '-f'] + paths) def move(self, origin, destination): - return self._run_git(["mv", "-f", origin, destination]) + return self._run_git(['mv', '-f', origin, destination]) def exists(self, path): - return_code = self._run_git(["show", "HEAD:%s" % path], return_exit_code=True, decode_output=False) + return_code = self._run_git(['show', 'HEAD:%s' % path], return_exit_code=True, decode_output=False) return return_code != self.ERROR_FILE_IS_MISSING def _branch_from_ref(self, ref): @@ -232,7 +232,7 @@ return git_commit[:-4] if '..' not in git_commit: - git_commit = git_commit + "^.." + git_commit + git_commit = git_commit + '^..' + git_commit return git_commit return self._remote_merge_base() @@ -240,13 +240,13 @@ def changed_files(self, git_commit=None, diff_filter='ADM'): # FIXME: --diff-filter could be used to avoid the "extract_filenames" step. status_command = ['diff', '-r', '--name-status', - "--no-renames", "--no-ext-diff", "--full-index", self._merge_base(git_commit)] + '--no-renames', '--no-ext-diff', '--full-index', self._merge_base(git_commit)] # FIXME: I'm not sure we're returning the same set of files that SVN.changed_files is. # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) return self._run_status_and_extract_filenames(status_command, self._status_regexp(diff_filter)) def added_files(self): - return self._run_status_and_extract_filenames(self.status_command(), self._status_regexp("A")) + return self._run_status_and_extract_filenames(self.status_command(), self._status_regexp('A')) def _run_status_and_extract_filenames(self, status_command, status_regexp): filenames = [] @@ -263,7 +263,7 @@ def status_command(self): # git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead. # No file contents printed, thus utf-8 autodecoding in self.run is fine. - return ["diff", "--name-status", "--no-renames", "HEAD"] + return ['diff', '--name-status', '--no-renames', 'HEAD'] def _status_regexp(self, expected_types): return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types @@ -273,7 +273,7 @@ return True def display_name(self): - return "git" + return 'git' def most_recent_log_matching(self, grep_str, path): # We use '--grep=' + foo rather than '--grep', foo because @@ -283,7 +283,7 @@ def _commit_position_from_git_log(self, git_log): match = re.search(r"^\s*Cr-Commit-Position:.*@\{#(?P<commit_position>\d+)\}", git_log, re.MULTILINE) if not match: - return "" + return '' return int(match.group('commit_position')) def commit_position(self, path): @@ -298,7 +298,7 @@ git_log = self.most_recent_log_matching(self._commit_position_regex_for_timestamp() % revision, path) match = re.search(r"^Date:\s*(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-])(\d{2})(\d{2})$", git_log, re.MULTILINE) if not match: - return "" + return '' # Manually modify the timezone since Git doesn't have an option to show it in UTC. # Git also truncates milliseconds but we're going to ignore that for now. @@ -320,16 +320,16 @@ 'diff', '--binary', '--no-color', - "--no-ext-diff", - "--full-index", - "--no-renames", - "--src-prefix=a/", - "--dst-prefix=b/", + '--no-ext-diff', + '--full-index', + '--no-renames', + '--src-prefix=a/', + '--dst-prefix=b/', ] if order: command.append(order) - command += [self._merge_base(git_commit), "--"] + command += [self._merge_base(git_commit), '--'] if changed_files: command += changed_files return self._run_git(command, decode_output=False, cwd=self.checkout_root) @@ -340,8 +340,8 @@ config_path = self._filesystem.dirname(self._filesystem.path_to_module('webkitpy.common.config')) order_file = self._filesystem.join(config_path, 'orderfile') if self._filesystem.exists(order_file): - return "-O%s" % order_file - return "" + return '-O%s' % order_file + return '' @memoized def commit_position_from_git_commit(self, git_commit): @@ -402,8 +402,8 @@ origin_info = self._run_git(['remote', 'show', 'origin', '-n']) match = re.search(r"^\s*(?P<branch_name>\S+)\s+merges with remote master$", origin_info, re.MULTILINE) if not match: - raise ScriptError(message="Unable to find local branch tracking origin/master.") - branch = str(match.group("branch_name")) + raise ScriptError(message='Unable to find local branch tracking origin/master.') + branch = str(match.group('branch_name')) return self._branch_from_ref(self._run_git(['rev-parse', '--symbolic-full-name', branch]).strip()) def is_cleanly_tracking_remote_master(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_mock.py index 4d6e4fee..386df35 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_mock.py
@@ -42,10 +42,10 @@ pass def current_branch(self): - return "mock-branch-name" + return 'mock-branch-name' def current_branch_or_ref(self): - return "mock-branch-name" + return 'mock-branch-name' def checkout_branch(self, name): pass
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/config/builders.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/config/builders.py index 19c3b6d..272fd6cb 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/config/builders.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/config/builders.py
@@ -27,97 +27,97 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. BUILDERS = { - "WebKit Win7": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Release'] + 'WebKit Win7': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Release'] }, - "WebKit Win7 (dbg)": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Debug'] + 'WebKit Win7 (dbg)': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Debug'] }, - "WebKit Win10": { - "port_name": "win-win10", - "specifiers": ['Win10', 'Release'] + 'WebKit Win10': { + 'port_name': 'win-win10', + 'specifiers': ['Win10', 'Release'] }, - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Linux Trusty (dbg)": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Debug'] + 'WebKit Linux Trusty (dbg)': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Debug'] }, - "WebKit Mac10.9": { - "port_name": "mac-mac10.9", - "specifiers": ['Mac10.9', 'Release'] + 'WebKit Mac10.9': { + 'port_name': 'mac-mac10.9', + 'specifiers': ['Mac10.9', 'Release'] }, - "WebKit Mac10.10": { - "port_name": "mac-mac10.10", - "specifiers": ['Mac10.10', 'Release'] + 'WebKit Mac10.10': { + 'port_name': 'mac-mac10.10', + 'specifiers': ['Mac10.10', 'Release'] }, - "WebKit Mac10.11": { - "port_name": "mac-mac10.11", - "specifiers": ['Mac10.11', 'Release'] + 'WebKit Mac10.11': { + 'port_name': 'mac-mac10.11', + 'specifiers': ['Mac10.11', 'Release'] }, - "WebKit Mac10.11 (dbg)": { - "port_name": "mac-mac10.11", - "specifiers": ['Mac10.11', 'Debug'] + 'WebKit Mac10.11 (dbg)': { + 'port_name': 'mac-mac10.11', + 'specifiers': ['Mac10.11', 'Debug'] }, - "WebKit Mac10.11 (retina)": { - "port_name": "mac-retina", - "specifiers": ['Retina', 'Release'] + 'WebKit Mac10.11 (retina)': { + 'port_name': 'mac-retina', + 'specifiers': ['Retina', 'Release'] }, - "WebKit Mac10.12": { - "port_name": "mac-mac10.12", - "specifiers": ['Mac10.12', 'Release'] + 'WebKit Mac10.12': { + 'port_name': 'mac-mac10.12', + 'specifiers': ['Mac10.12', 'Release'] }, - "WebKit Android (Nexus4)": { - "port_name": "android", - "specifiers": ['Android', 'Release'] + 'WebKit Android (Nexus4)': { + 'port_name': 'android', + 'specifiers': ['Android', 'Release'] }, - "linux_trusty_blink_rel": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'], - "is_try_builder": True, + 'linux_trusty_blink_rel': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'], + 'is_try_builder': True, }, - "mac10.9_blink_rel": { - "port_name": "mac-mac10.9", - "specifiers": ['Mac10.9', 'Release'], - "is_try_builder": True, + 'mac10.9_blink_rel': { + 'port_name': 'mac-mac10.9', + 'specifiers': ['Mac10.9', 'Release'], + 'is_try_builder': True, }, - "mac10.10_blink_rel": { - "port_name": "mac-mac10.10", - "specifiers": ['Mac10.10', 'Release'], - "is_try_builder": True, + 'mac10.10_blink_rel': { + 'port_name': 'mac-mac10.10', + 'specifiers': ['Mac10.10', 'Release'], + 'is_try_builder': True, }, - "mac10.11_blink_rel": { - "port_name": "mac-mac10.11", - "specifiers": ['Mac10.11', 'Release'], - "is_try_builder": True, + 'mac10.11_blink_rel': { + 'port_name': 'mac-mac10.11', + 'specifiers': ['Mac10.11', 'Release'], + 'is_try_builder': True, }, - "mac10.11_retina_blink_rel": { - "port_name": "mac-retina", - "specifiers": ['Retina', 'Release'], - "is_try_builder": True, + 'mac10.11_retina_blink_rel': { + 'port_name': 'mac-retina', + 'specifiers': ['Retina', 'Release'], + 'is_try_builder': True, }, - "mac10.12_blink_rel": { - "port_name": "mac-mac10.12", - "specifiers": ['Mac10.12', 'Release'], - "is_try_builder": True, + 'mac10.12_blink_rel': { + 'port_name': 'mac-mac10.12', + 'specifiers': ['Mac10.12', 'Release'], + 'is_try_builder': True, }, - "win7_blink_rel": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Release'], - "is_try_builder": True, + 'win7_blink_rel': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Release'], + 'is_try_builder': True, }, - "win10_blink_rel": { - "port_name": "win-win10", - "specifiers": ['Win10', 'Release'], - "is_try_builder": True, + 'win10_blink_rel': { + 'port_name': 'win-win10', + 'specifiers': ['Win10', 'Release'], + 'is_try_builder': True, }, - "android_blink_rel": { - "port_name": "android", - "specifiers": ['Android', 'Release'], - "is_try_builder": True, + 'android_blink_rel': { + 'port_name': 'android', + 'specifiers': ['Android', 'Release'], + 'is_try_builder': True, }, }
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py index fa719662..1728f3cb 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py
@@ -244,7 +244,7 @@ self._set_up_logging() worker = self._worker - _log.debug("%s starting", self.name) + _log.debug('%s starting', self.name) self._running = True try: @@ -259,7 +259,7 @@ assert message.name == 'stop', 'bad message %s' % repr(message) break - _log.debug("%s exiting", self.name) + _log.debug('%s exiting', self.name) except Queue.Empty: assert False, '%s: ran out of messages in worker queue.' % self.name except KeyboardInterrupt: @@ -296,7 +296,7 @@ raise exception_type, exception_value, exception_traceback if exception_type == KeyboardInterrupt: - _log.debug("%s: interrupted, exiting", self.name) + _log.debug('%s: interrupted, exiting', self.name) stack_utils.log_traceback(_log.debug, exception_traceback) else: _log.error("%s: %s('%s') raised:", self.name, exception_value.__class__.__name__, str(exception_value))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py index 8e69516..415a22f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py
@@ -59,7 +59,7 @@ proc.wait() # Temporary logging to try and diagnose hangs on the Windows bots. if 'win_chromium_rel_ng' in sys.argv: - print "proc.wait completed." + print 'proc.wait completed.' except KeyboardInterrupt: # We need a second wait in order to make sure the subprocess exits fully. # FIXME: It would be nice if we could put a timeout on this. @@ -68,9 +68,9 @@ try: # Temporary logging to try and diagnose hangs on the Windows bots. if 'win_chromium_rel_ng' in sys.argv: - print "sys.exit starting" + print 'sys.exit starting' sys.exit(proc.returncode) finally: # Temporary logging to try and diagnose hangs on the Windows bots. if 'win_chromium_rel_ng' in sys.argv: - print "sys.exit completed" + print 'sys.exit completed'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py index b83c2f3..26cf395d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py
@@ -55,6 +55,7 @@ for more information about the layout test result format, see: https://www.chromium.org/developers/the-json-test-results-format """ + def results_url(self, builder_name, build_number=None): """Returns a URL for one set of archived layout test results. @@ -64,7 +65,7 @@ """ if build_number: url_base = self.builder_results_url_base(builder_name) - return "%s/%s/layout-test-results" % (url_base, build_number) + return '%s/%s/layout-test-results' % (url_base, build_number) return self.accumulated_results_url_base(builder_name) def builder_results_url_base(self, builder_name): @@ -85,12 +86,12 @@ that failed only with the patch ("failures"), and tests that failed both with and without ("ignored"). """ - url_base = "%s/%s" % (self.builder_results_url_base(build.builder_name), build.build_number) + url_base = '%s/%s' % (self.builder_results_url_base(build.builder_name), build.build_number) return NetworkTransaction(return_none_on_404=True).run( - lambda: self._fetch_file(url_base, "retry_summary.json")) + lambda: self._fetch_file(url_base, 'retry_summary.json')) def accumulated_results_url_base(self, builder_name): - return self.builder_results_url_base(builder_name) + "/results/layout-test-results" + return self.builder_results_url_base(builder_name) + '/results/layout-test-results' @memoized def latest_layout_test_results(self, builder_name): @@ -104,9 +105,9 @@ def fetch_layout_test_results(self, results_url): """Returns a LayoutTestResults object for results fetched from a given URL.""" results_file = NetworkTransaction(return_none_on_404=True).run( - lambda: self._fetch_file(results_url, "failing_results.json")) + lambda: self._fetch_file(results_url, 'failing_results.json')) revision = NetworkTransaction(return_none_on_404=True).run( - lambda: self._fetch_file(results_url, "LAST_CHANGE")) + lambda: self._fetch_file(results_url, 'LAST_CHANGE')) if not revision: results_file = None return LayoutTestResults.results_from_string(results_file, revision) @@ -114,7 +115,7 @@ def _fetch_file(self, url_base, file_name): # It seems this can return None if the url redirects and then returns 404. # FIXME: This could use Web instead of using urllib2 directly. - result = urllib2.urlopen("%s/%s" % (url_base, file_name)) + result = urllib2.urlopen('%s/%s' % (url_base, file_name)) if not result: return None # urlopen returns a file-like object which sometimes works fine with str()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/file_uploader.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/file_uploader.py index 0f6264f..c9480c49 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/file_uploader.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/file_uploader.py
@@ -101,7 +101,7 @@ # FIXME: Setting a timeout, either globally using socket.setdefaulttimeout() # or in urlopen(), doesn't appear to work on Mac 10.5 with Python 2.7. # For now we will ignore the timeout value and hope for the best. - request = urllib2.Request(self._url, data, {"Content-Type": content_type}) + request = urllib2.Request(self._url, data, {'Content-Type': content_type}) return urllib2.urlopen(request) return NetworkTransaction(timeout_seconds=self._timeout_seconds).run(callback)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py index 1c7ac25..83f5b8f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py
@@ -35,6 +35,18 @@ command += ['--auth-refresh-token-json', self._auth_refresh_token_json] return self._host.executive.run_command(command, cwd=self._cwd) + def trigger_try_jobs(self, builders=None): + builders = builders or self._host.builders.all_try_builder_names() + if 'android_blink_rel' in builders: + self.run(['try', '-b', 'android_blink_rel']) + builders.remove('android_blink_rel') + # TODO(qyearsley): Stop explicitly adding the master name when + # git cl try can get the master name; see http://crbug.com/700523. + command = ['try', '-m', 'tryserver.blink'] + for builder in sorted(builders): + command.extend(['-b', builder]) + self.run(command) + def get_issue_number(self): return self.run(['issue']).split()[2]
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 936eb3ef..b7152ba 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
@@ -108,22 +108,22 @@ self._chromium_revision = chromium_revision def run_was_interrupted(self): - return self._results["interrupted"] + return self._results['interrupted'] def builder_name(self): - return self._results["builder_name"] + return self._results['builder_name'] @memoized 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"] + revision = self._chromium_revision or self._results['chromium_revision'] if not revision.isdigit(): - assert git, "git is required if the original revision is a git hash." + 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): - parts = test.split("/") + parts = test.split('/') tree = self._test_result_tree() for part in parts: if part not in tree:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results_unittest.py index ccc9013..82dbd789 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layout_test_results_unittest.py
@@ -98,7 +98,7 @@ def test_results_from_string(self): self.assertIsNone(LayoutTestResults.results_from_string(None)) - self.assertIsNone(LayoutTestResults.results_from_string("")) + self.assertIsNone(LayoutTestResults.results_from_string('')) def test_was_interrupted(self): self.assertTrue(LayoutTestResults.results_from_string( @@ -111,9 +111,9 @@ def test_actual_results(self): results = LayoutTestResults.results_from_string(self.example_full_results_json) - self.assertEqual(results.result_for_test("fast/dom/prototype-banana.html").actual_results(), "PASS") - self.assertEqual(results.result_for_test("fast/dom/prototype-taco.html").actual_results(), "PASS TEXT") - self.assertFalse(results.result_for_test("nonexistant.html")) + self.assertEqual(results.result_for_test('fast/dom/prototype-banana.html').actual_results(), 'PASS') + self.assertEqual(results.result_for_test('fast/dom/prototype-taco.html').actual_results(), 'PASS TEXT') + self.assertFalse(results.result_for_test('nonexistant.html')) def test_didnt_run_as_expected_results(self): results = LayoutTestResults.results_from_string(self.example_full_results_json) @@ -131,18 +131,18 @@ def test_didnt_run_as_expected_slow_test(self): results = LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-fast.html": { - "expected": "PASS", - "actual": "TEXT", - "is_unexpected": True, + 'tests': { + 'fast': { + 'dom': { + 'prototype-fast.html': { + 'expected': 'PASS', + 'actual': 'TEXT', + 'is_unexpected': True, }, - "prototype-slow.html": { - "expected": "SLOW", - "actual": "TEXT", - "is_unexpected": True, + 'prototype-slow.html': { + 'expected': 'SLOW', + 'actual': 'TEXT', + 'is_unexpected': True, } } }
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py index 654d3dc7a..c5f5abb 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py
@@ -59,7 +59,7 @@ if self._return_none_on_404 and error.code == 404: return None self._check_for_timeout() - _log.warning("Received HTTP status %s loading \"%s\". Retrying in %s seconds...", + _log.warning('Received HTTP status %s loading "%s". Retrying in %s seconds...', error.code, error.filename, self._backoff_seconds) self._sleep()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction_unittest.py index c63ab05..9b79549 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction_unittest.py
@@ -33,7 +33,7 @@ class NetworkTransactionTest(LoggingTestCase): - exception = Exception("Test exception") + exception = Exception('Test exception') def setUp(self): super(NetworkTransactionTest, self).setUp() @@ -62,11 +62,11 @@ def _raise_500_error(self): self._run_count += 1 if self._run_count < 3: - raise HTTPError("http://example.com/", 500, "internal server error", None, None) + raise HTTPError('http://example.com/', 500, 'internal server error', None, None) return 42 def _raise_404_error(self): - raise HTTPError("http://foo.com/", 404, "not found", None, None) + raise HTTPError('http://foo.com/', 404, 'not found', None, None) def test_retry(self): transaction = NetworkTransaction(initial_backoff_seconds=0)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/web_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/web_mock.py index e20fe9c7..d65f346 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/web_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/web_mock.py
@@ -39,4 +39,4 @@ self.urls_fetched.append(url) if url in self.urls: return self.urls[url] - return "MOCK Web result, convert 404 to None=%s" % return_none_on_404 + return 'MOCK Web result, convert 404 to None=%s' % return_none_on_404
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/prettypatch.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/prettypatch.py index ca8e6da1..17e5e99 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/prettypatch.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/prettypatch.py
@@ -40,7 +40,7 @@ # so we always deal with them as byte arrays, not unicode strings. assert isinstance(diff, str) pretty_diff = self.pretty_diff(diff) - diff_file = tempfile.NamedTemporaryFile(suffix=".html") + diff_file = tempfile.NamedTemporaryFile(suffix='.html') diff_file.write(pretty_diff) diff_file.flush() return diff_file @@ -49,14 +49,14 @@ # prettify.rb will hang forever if given no input. # Avoid the hang by returning an empty string. if not diff: - return "" + return '' pretty_patch_path = os.path.join(os.path.dirname(__file__), '..', '..', 'webkitruby', 'PrettyPatch') - prettify_path = os.path.join(pretty_patch_path, "prettify.rb") + prettify_path = os.path.join(pretty_patch_path, 'prettify.rb') args = [ - "ruby", - "-I", + 'ruby', + '-I', pretty_patch_path, prettify_path, ]
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs.py index 6f57707..4a56902 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs.py
@@ -40,17 +40,17 @@ return None def _log_directory_darwin(self): - log_directory = self._host.filesystem.expanduser("~") - log_directory = self._host.filesystem.join(log_directory, "Library", "Logs") - if self._host.filesystem.exists(self._host.filesystem.join(log_directory, "DiagnosticReports")): - log_directory = self._host.filesystem.join(log_directory, "DiagnosticReports") + log_directory = self._host.filesystem.expanduser('~') + log_directory = self._host.filesystem.join(log_directory, 'Library', 'Logs') + if self._host.filesystem.exists(self._host.filesystem.join(log_directory, 'DiagnosticReports')): + log_directory = self._host.filesystem.join(log_directory, 'DiagnosticReports') else: - log_directory = self._host.filesystem.join(log_directory, "CrashReporter") + log_directory = self._host.filesystem.join(log_directory, 'CrashReporter') return log_directory def _find_newest_log_darwin(self, process_name, pid, include_errors, newer_than): def is_crash_log(basename): - return basename.startswith(process_name + "_") and basename.endswith(".crash") + return basename.startswith(process_name + '_') and basename.endswith('.crash') log_directory = self._log_directory_darwin() logs = self._host.filesystem.files_under(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs_unittest.py index b136707b..96909cc3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/crash_logs_unittest.py
@@ -92,15 +92,15 @@ } filesystem = MockFileSystem(files) crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem)) - log = crash_logs.find_newest_log("DumpRenderTree") + log = crash_logs.find_newest_log('DumpRenderTree') self.assertMultiLineEqual(log, newer_mock_crash_report) - log = crash_logs.find_newest_log("DumpRenderTree", 28529) + log = crash_logs.find_newest_log('DumpRenderTree', 28529) self.assertMultiLineEqual(log, newer_mock_crash_report) - log = crash_logs.find_newest_log("DumpRenderTree", 28530) + log = crash_logs.find_newest_log('DumpRenderTree', 28530) self.assertMultiLineEqual(log, mock_crash_report) - log = crash_logs.find_newest_log("DumpRenderTree", 28531) + log = crash_logs.find_newest_log('DumpRenderTree', 28531) self.assertIsNone(log) - log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0) + log = crash_logs.find_newest_log('DumpRenderTree', newer_than=1.0) self.assertIsNone(log) def bad_read(_): @@ -110,11 +110,11 @@ raise OSError('OSError: No such file or directory') filesystem.read_text_file = bad_read - log = crash_logs.find_newest_log("DumpRenderTree", 28531, include_errors=True) + log = crash_logs.find_newest_log('DumpRenderTree', 28531, include_errors=True) self.assertIn('IOError: No such file or directory', log) filesystem = MockFileSystem(files) crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem)) filesystem.mtime = bad_mtime - log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0, include_errors=True) + log = crash_logs.find_newest_log('DumpRenderTree', newer_than=1.0, include_errors=True) self.assertIn('OSError: No such file or directory', log)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py index c0afd688..573e716 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py
@@ -55,17 +55,17 @@ output_limit=500): shortened_output = output if output and output_limit and len(output) > output_limit: - shortened_output = "Last %s characters of output:\n%s" % (output_limit, output[-output_limit:]) + shortened_output = 'Last %s characters of output:\n%s' % (output_limit, output[-output_limit:]) if not message: message = 'Failed to run "%s"' % repr(script_args) if exit_code: - message += " exit_code: %d" % exit_code + message += ' exit_code: %d' % exit_code if cwd: - message += " cwd: %s" % cwd + message += ' cwd: %s' % cwd if shortened_output: - message += "\n\noutput: %s" % shortened_output + message += '\n\noutput: %s' % shortened_output Exception.__init__(self, message) self.script_args = script_args # 'args' is already used by Exception @@ -103,11 +103,11 @@ """Attempts to kill the given pid. Will fail silently if pid does not exist or insufficient permissions. """ - if sys.platform == "win32": + if sys.platform == 'win32': # We only use taskkill.exe on windows (not cygwin) because subprocess.pid # is a CYGWIN pid and taskkill.exe expects a windows pid. # Thankfully os.kill on CYGWIN handles either pid type. - command = ["taskkill.exe", "/f", "/t", "/pid", pid] + command = ['taskkill.exe', '/f', '/t', '/pid', pid] # taskkill will exit 128 if the process is not found. We should log. self.run_command(command, error_handler=self.ignore_error) return @@ -115,7 +115,7 @@ # According to http://docs.python.org/library/os.html # os.kill isn't available on Windows. python 2.5.5 os.kill appears # to work in cygwin, however it occasionally raises EAGAIN. - retries_left = 10 if sys.platform == "cygwin" else 1 + retries_left = 10 if sys.platform == 'cygwin' else 1 while retries_left > 0: try: retries_left -= 1 @@ -124,7 +124,7 @@ except OSError as error: if error.errno == errno.EAGAIN: if retries_left <= 0: - _log.warning("Failed to kill pid %s. Too many EAGAIN errors.", pid) + _log.warning('Failed to kill pid %s. Too many EAGAIN errors.', pid) continue if error.errno == errno.ESRCH: # The process does not exist. return @@ -145,16 +145,16 @@ import ctypes class PROCESSENTRY32(ctypes.Structure): - _fields_ = [("dwSize", ctypes.c_ulong), - ("cntUsage", ctypes.c_ulong), - ("th32ProcessID", ctypes.c_ulong), - ("th32DefaultHeapID", ctypes.POINTER(ctypes.c_ulong)), - ("th32ModuleID", ctypes.c_ulong), - ("cntThreads", ctypes.c_ulong), - ("th32ParentProcessID", ctypes.c_ulong), - ("pcPriClassBase", ctypes.c_ulong), - ("dwFlags", ctypes.c_ulong), - ("szExeFile", ctypes.c_char * 260)] + _fields_ = [('dwSize', ctypes.c_ulong), + ('cntUsage', ctypes.c_ulong), + ('th32ProcessID', ctypes.c_ulong), + ('th32DefaultHeapID', ctypes.POINTER(ctypes.c_ulong)), + ('th32ModuleID', ctypes.c_ulong), + ('cntThreads', ctypes.c_ulong), + ('th32ParentProcessID', ctypes.c_ulong), + ('pcPriClassBase', ctypes.c_ulong), + ('dwFlags', ctypes.c_ulong), + ('szExeFile', ctypes.c_char * 260)] CreateToolhelp32Snapshot = ctypes.windll.kernel32.CreateToolhelp32Snapshot Process32First = ctypes.windll.kernel32.Process32First @@ -166,7 +166,7 @@ pe32.dwSize = ctypes.sizeof(PROCESSENTRY32) result = False if not Process32First(hProcessSnap, ctypes.byref(pe32)): - _log.debug("Failed getting first process.") + _log.debug('Failed getting first process.') CloseHandle(hProcessSnap) return result while True: @@ -192,7 +192,7 @@ def _running_processes(self): processes = [] - if sys.platform in ("win32", "cygwin"): + if sys.platform in ('win32', 'cygwin'): tasklist_process = self.popen(['tasklist', '/fo', 'csv'], stdout=self.PIPE, stderr=self.PIPE) stdout, _ = tasklist_process.communicate() @@ -228,7 +228,7 @@ def process_dump(self): ps_process = None - if sys.platform in ("win32", "cygwin"): + if sys.platform in ('win32', 'cygwin'): ps_process = self.popen( ['wmic', 'process', 'get', 'ProcessId,ParentProcessId,CommandLine'], @@ -288,7 +288,7 @@ # child processes from getting input from the user. if not input: return (None, None) - if hasattr(input, "read"): # Check if the input is a file. + if hasattr(input, 'read'): # Check if the input is a file. return (input, None) # Assume the file is in the right encoding. # Popen in Python 2.5 and before does not automatically encode unicode objects. @@ -309,10 +309,10 @@ for arg in args: if isinstance(arg, unicode): # Escape any non-ascii characters for easy copy/paste - arg = arg.encode("unicode_escape") + arg = arg.encode('unicode_escape') # FIXME: Do we need to fix quotes here? escaped_args.append(arg) - return " ".join(escaped_args) + return ' '.join(escaped_args) def run_command(self, args, @@ -347,7 +347,7 @@ # run_command automatically decodes to unicode() unless explicitly told not to. if decode_output: - output = output.decode(self._child_process_encoding(), errors="replace") + output = output.decode(self._child_process_encoding(), errors='replace') # wait() is not threadsafe and can throw OSError due to: # http://bugs.python.org/issue1731717
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py index d32c505..670b728 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py
@@ -58,16 +58,16 @@ class MockExecutive(object): - PIPE = "MOCK PIPE" - STDOUT = "MOCK STDOUT" - DEVNULL = "MOCK_DEVNULL" + PIPE = 'MOCK PIPE' + STDOUT = 'MOCK STDOUT' + DEVNULL = 'MOCK_DEVNULL' @staticmethod def ignore_error(error): pass def __init__(self, should_log=False, should_throw=False, - output="MOCK output of child process", stderr='', + output='MOCK output of child process', stderr='', exit_code=0, exception=None, run_command_fn=None): self._should_log = should_log self._should_throw = should_throw @@ -90,12 +90,12 @@ if process_name_filter(process_name): running_pids.append(process_pid) - _log.info("MOCK running_pids: %s", running_pids) + _log.info('MOCK running_pids: %s', running_pids) return running_pids def command_for_printing(self, args): string_args = map(unicode, args) - return " ".join(string_args) + return ' '.join(string_args) # The argument list should match Executive.run_command, even if # some arguments are not used. pylint: disable=unused-argument @@ -115,18 +115,18 @@ assert isinstance(args, list) or isinstance(args, tuple) if self._should_log: - env_string = "" + env_string = '' if env: - env_string = ", env=%s" % env - input_string = "" + env_string = ', env=%s' % env + input_string = '' if input: - input_string = ", input=%s" % input - _log.info("MOCK run_command: %s, cwd=%s%s%s", args, cwd, env_string, input_string) + input_string = ', input=%s' % input + _log.info('MOCK run_command: %s, cwd=%s%s%s', args, cwd, env_string, input_string) if self._exception: raise self._exception # pylint: disable=raising-bad-type if self._should_throw: - raise ScriptError("MOCK ScriptError", output=self._output) + raise ScriptError('MOCK ScriptError', output=self._output) if self._run_command_fn: return self._run_command_fn(args) @@ -159,13 +159,13 @@ assert all(isinstance(arg, basestring) for arg in args) self.calls.append(args) if self._should_log: - cwd_string = "" + cwd_string = '' if cwd: - cwd_string = ", cwd=%s" % cwd - env_string = "" + cwd_string = ', cwd=%s' % cwd + env_string = '' if env: - env_string = ", env=%s" % env - _log.info("MOCK popen: %s%s%s", args, cwd_string, env_string) + env_string = ', env=%s' % env + _log.info('MOCK popen: %s%s%s', args, cwd_string, env_string) if not self._proc: self._proc = MockProcess(self._output) return self._proc
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py index 37dce818..f457650 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py
@@ -79,12 +79,12 @@ def test_run_command_with_bad_command(self): def run_bad_command(): - Executive().run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True) + Executive().run_command(['foo_bar_command_blah'], error_handler=Executive.ignore_error, return_exit_code=True) self.assertRaises(OSError, run_bad_command) def test_run_command_args_type(self): executive = Executive() - self.assertRaises(AssertionError, executive.run_command, "echo") + self.assertRaises(AssertionError, executive.run_command, 'echo') self.assertRaises(AssertionError, executive.run_command, u"echo") executive.run_command(command_line('echo', 'foo')) executive.run_command(tuple(command_line('echo', 'foo')))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py index 80d30a4..270748e9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
@@ -88,16 +88,16 @@ return self._split(path)[1] def expanduser(self, path): - if path[0] != "~": + if path[0] != '~': return path parts = path.split(self.sep, 1) - home_directory = self.sep + "Users" + self.sep + "mock" + home_directory = self.sep + 'Users' + self.sep + 'mock' if len(parts) == 1: return home_directory return home_directory + self.sep + parts[1] def path_to_module(self, module_name): - return "/mock-checkout/third_party/WebKit/Tools/Scripts/" + module_name.replace('.', '/') + ".py" + return '/mock-checkout/third_party/WebKit/Tools/Scripts/' + module_name.replace('.', '/') + '.py' def chdir(self, path): path = self.normpath(path) @@ -209,7 +209,7 @@ def walk(self, top): sep = self.sep if not self.isdir(top): - raise OSError("%s is not a directory" % top) + raise OSError('%s is not a directory' % top) if not top.endswith(sep): top += sep @@ -431,7 +431,7 @@ self.fs = fs self.path = path self.closed = False - self.fs.files[path] = "" + self.fs.files[path] = '' def __enter__(self): return self @@ -482,7 +482,7 @@ class ReadableTextFileObject(ReadableBinaryFileObject): def __init__(self, fs, path, data): - super(ReadableTextFileObject, self).__init__(fs, path, StringIO.StringIO(data.decode("utf-8"))) + super(ReadableTextFileObject, self).__init__(fs, path, StringIO.StringIO(data.decode('utf-8'))) def close(self): self.data.close()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py index 4e0e96e..68baecc 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py
@@ -215,7 +215,7 @@ fs = FileSystem() with fs.mkdtemp(prefix='filesystem_unittest_') as base_path: - sub_path = os.path.join(base_path, "newdir") + sub_path = os.path.join(base_path, 'newdir') self.assertFalse(os.path.exists(sub_path)) self.assertFalse(fs.isdir(sub_path)) @@ -324,5 +324,5 @@ fs = FileSystem() self.assertEqual(fs.sep, os.sep) - self.assertEqual(fs.join("foo", "bar"), - os.path.join("foo", "bar")) + self.assertEqual(fs.join('foo', 'bar'), + os.path.join('foo', 'bar'))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_testing.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_testing.py index 97df6c5..aedbc86 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_testing.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_testing.py
@@ -38,6 +38,7 @@ # TODO(qyearsley): Change these names to use lowercase-only, for consistency # with other unit test helper methods. + class TestLogStream(object): """Represents a file-like object for unit-testing logging. @@ -139,7 +140,7 @@ stream = TestLogStream(test_case) handler = logging.StreamHandler(stream) handler.setLevel(logging_level) - formatter = logging.Formatter("%(levelname)s: %(message)s") + formatter = logging.Formatter('%(levelname)s: %(message)s') handler.setFormatter(formatter) # Notice that we only change the root logger by adding a handler
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils.py index b105b32..a862bd57 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils.py
@@ -37,7 +37,7 @@ # Create the filter. def should_log(record): """Return whether a logging.LogRecord should be logged.""" - if record.name.startswith("webkitpy.thirdparty"): + if record.name.startswith('webkitpy.thirdparty'): return False return True @@ -47,9 +47,9 @@ # Create the handler. handler = logging.StreamHandler(stream) if logging_level == logging.DEBUG: - formatter = logging.Formatter("%(name)s: [%(levelname)s] %(message)s") + formatter = logging.Formatter('%(name)s: [%(levelname)s] %(message)s') else: - formatter = logging.Formatter("%(message)s") + formatter = logging.Formatter('%(message)s') handler.setFormatter(formatter) handler.addFilter(logging_filter) @@ -103,6 +103,6 @@ for handler in handlers: logger.addHandler(handler) - _log.debug("Debug logging enabled.") + _log.debug('Debug logging enabled.') return handlers
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils_unittest.py index 7217ada..28ca6732 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/log_utils_unittest.py
@@ -31,14 +31,14 @@ """Base class for configure_logging() unit tests.""" def _logging_level(self): - raise Exception("Not implemented.") + raise Exception('Not implemented.') def setUp(self): log_stream = TestLogStream(self) # Use a logger other than the root logger or one prefixed with # "webkitpy." so as not to conflict with test-webkitpy logging. - logger = logging.getLogger("unittest") + logger = logging.getLogger('unittest') # Configure the test logger not to pass messages along to the # root logger. This prevents test messages from being @@ -74,11 +74,11 @@ return None def test_info_message(self): - self._log.info("test message") - self._assert_log_messages(["test message\n"]) + self._log.info('test message') + self._assert_log_messages(['test message\n']) def test_debug_message(self): - self._log.debug("test message") + self._log.debug('test message') self._assert_log_messages([]) def test_below_threshold_message(self): @@ -86,14 +86,14 @@ # In practice, we will probably only be calling log.debug(), # which corresponds to a logging level of 10. level = logging.INFO - 1 # Equals 19. - self._log.log(level, "test message") + self._log.log(level, 'test message') self._assert_log_messages([]) def test_two_messages(self): - self._log.info("message1") - self._log.info("message2") - self._assert_log_messages(["message1\n", - "message2\n"]) + self._log.info('message1') + self._log.info('message2') + self._assert_log_messages(['message1\n', + 'message2\n']) class ConfigureLoggingVerboseTest(ConfigureLoggingTestBase): @@ -102,12 +102,12 @@ return logging.DEBUG def test_info_message(self): - self._log.info("test message") - self._assert_log_messages(["unittest: [INFO] test message\n"]) + self._log.info('test message') + self._assert_log_messages(['unittest: [INFO] test message\n']) def test_debug_message(self): - self._log.debug("test message") - self._assert_log_messages(["unittest: [DEBUG] test message\n"]) + self._log.debug('test message') + self._assert_log_messages(['unittest: [DEBUG] test message\n']) class ConfigureLoggingCustomLevelTest(ConfigureLoggingTestBase): @@ -120,9 +120,9 @@ return self._level def test_logged_message(self): - self._log.log(self._level, "test message") - self._assert_log_messages(["test message\n"]) + self._log.log(self._level, 'test message') + self._assert_log_messages(['test message\n']) def test_below_threshold_message(self): - self._log.log(self._level - 1, "test message") + self._log.log(self._level - 1, 'test message') self._assert_log_messages([])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/output_capture.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/output_capture.py index 4ef5fdc..61f18a6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/output_capture.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/output_capture.py
@@ -70,7 +70,7 @@ self._orig_log_level = self._logger.level self._logger.addHandler(self._logs_handler) self._logger.setLevel(min(self._log_level, self._orig_log_level)) - return (self._capture_output_with_name("stdout"), self._capture_output_with_name("stderr")) + return (self._capture_output_with_name('stdout'), self._capture_output_with_name('stderr')) def restore_output(self): self._logger.removeHandler(self._logs_handler) @@ -80,10 +80,10 @@ logs_string = self._logs.getvalue() delattr(self, '_logs_handler') delattr(self, '_logs') - return (self._restore_output_with_name("stdout"), self._restore_output_with_name("stderr"), logs_string) + return (self._restore_output_with_name('stdout'), self._restore_output_with_name('stderr'), logs_string) - def assert_outputs(self, testcase, function, args=None, kwargs=None, expected_stdout="", - expected_stderr="", expected_exception=None, expected_logs=None): + def assert_outputs(self, testcase, function, args=None, kwargs=None, expected_stdout='', + expected_stderr='', expected_exception=None, expected_logs=None): args = args or [] kwargs = kwargs or {} self.capture_output()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py index 147ce1ed..01f5acb3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py
@@ -36,7 +36,7 @@ def abspath_to_uri(platform, path): """Converts a platform-specific absolute path to a file: URL.""" - return "file:" + _escape(_convert_path(platform, path)) + return 'file:' + _escape(_convert_path(platform, path)) def cygpath(path): @@ -97,7 +97,7 @@ def convert(self, path): if not self.is_running(): self.start() - self._child_process.stdin.write("%s\r\n" % path) + self._child_process.stdin.write('%s\r\n' % path) self._child_process.stdin.flush() windows_path = self._child_process.stdout.readline().rstrip() # Some versions of cygpath use lowercase drive letters while others @@ -126,9 +126,9 @@ def _winpath_to_uri(path): """Converts a window absolute path to a file: URL.""" - return "///" + path.replace("\\", "/") + return '///' + path.replace('\\', '/') def _unixypath_to_uri(path): """Converts a unix-style path to a file: URL.""" - return "//" + path + return '//' + path
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path_unittest.py index f2fe637..699a026a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path_unittest.py
@@ -46,7 +46,7 @@ 'file:///C:/foo/bar.html') def test_abspath_to_uri_unixy(self): - self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), "/foo/bar.html"), + self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar.html'), 'file:///foo/bar.html') def test_abspath_to_uri_win(self): @@ -71,7 +71,7 @@ return # Call cygpath to ensure the subprocess is running. - path.cygpath("/cygdrive/c/foo.txt") + path.cygpath('/cygdrive/c/foo.txt') self.assertTrue(path._CygPath._singleton.is_running()) # Stop it.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info.py index acf588a..1b2c3739 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info.py
@@ -84,7 +84,7 @@ def display_name(self): # platform.platform() returns Darwin information for Mac, which is just confusing. if self.is_mac(): - return "Mac OS X %s" % self._platform_module.mac_ver()[0] + return 'Mac OS X %s' % self._platform_module.mac_ver()[0] # Returns strings like: # Linux-2.6.18-194.3.1.el5-i686-with-redhat-5.5-Final @@ -93,7 +93,7 @@ def total_bytes_memory(self): if self.is_mac(): - return long(self._executive.run_command(["sysctl", "-n", "hw.memsize"])) + return long(self._executive.run_command(['sysctl', '-n', 'hw.memsize'])) return None def terminal_width(self): @@ -106,7 +106,7 @@ console_screen_buffer_info = create_string_buffer(22) # 22 == sizeof(console_screen_buffer_info) if windll.kernel32.GetConsoleScreenBufferInfo(handle, console_screen_buffer_info): import struct - _, _, _, _, _, left, _, right, _, _, _ = struct.unpack("hhhhHhhhhhh", console_screen_buffer_info.raw) + _, _, _, _, _, left, _, right, _, _, _ = struct.unpack('hhhhHhhhhhh', console_screen_buffer_info.raw) # Note that we return 1 less than the width since writing into the rightmost column # automatically performs a line feed. return right - left
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info_mock.py index c51cf9cd..5c1e0d0f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platform_info_mock.py
@@ -54,7 +54,7 @@ return self.os_name == 'freebsd' def display_name(self): - return "MockPlatform 1.0" + return 'MockPlatform 1.0' def linux_distribution(self): return self._linux_distribution if self.is_linux() else None
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 74e0bb6d..d5d3339b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/profiler.py
@@ -92,9 +92,9 @@ 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) + target_name = '%s-%s.%s' % (name, count, extension) else: - target_name = "%s.%s" % (name, extension) + 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 @@ -106,14 +106,14 @@ name = 'pprof' def __init__(self, host, executable_path, output_dir, identifier=None): - super(GooglePProf, self).__init__(host, executable_path, output_dir, "pprof", identifier) + super(GooglePProf, self).__init__(host, executable_path, output_dir, 'pprof', identifier) def adjusted_environment(self, env): env['CPUPROFILE'] = self._output_path return env def _first_ten_lines_of_profile(self, pprof_output): - match = re.search("^Total:[^\n]*\n((?:[^\n]*\n){0,10})", pprof_output, re.MULTILINE) + match = re.search('^Total:[^\n]*\n((?:[^\n]*\n){0,10})', pprof_output, re.MULTILINE) return match.group(1) if match else None def _pprof_path(self): @@ -124,16 +124,16 @@ def profile_after_exit(self): # google-pprof doesn't check its arguments, so we have to. if not self._host.filesystem.exists(self._output_path): - print "Failed to gather profile, %s does not exist." % self._output_path + print 'Failed to gather profile, %s does not exist.' % self._output_path return pprof_args = [self._pprof_path(), '--text', self._executable_path, self._output_path] profile_text = self._host.executive.run_command(pprof_args) - print "First 10 lines of pprof --text:" + print 'First 10 lines of pprof --text:' print self._first_ten_lines_of_profile(profile_text) - print "http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html documents output." + print 'http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html documents output.' print - print "To interact with the the full profile, including produce graphs:" + print 'To interact with the the full profile, including produce graphs:' print ' '.join([self._pprof_path(), self._executable_path, self._output_path]) @@ -141,7 +141,7 @@ name = 'perf' def __init__(self, host, executable_path, output_dir, identifier=None): - super(Perf, self).__init__(host, executable_path, output_dir, "data", identifier) + super(Perf, self).__init__(host, executable_path, output_dir, 'data', identifier) self._perf_process = None self._pid_being_profiled = None @@ -152,11 +152,11 @@ def attach_to_pid(self, pid): assert not self._perf_process and not self._pid_being_profiled self._pid_being_profiled = pid - cmd = [self._perf_path(), "record", "--call-graph", "--pid", pid, "--output", self._output_path] + cmd = [self._perf_path(), 'record', '--call-graph', '--pid', pid, '--output', self._output_path] self._perf_process = self._host.executive.popen(cmd) def _first_ten_lines_of_profile(self, perf_output): - match = re.search("^#[^\n]*\n((?: [^\n]*\n){1,10})", perf_output, re.MULTILINE) + match = re.search('^#[^\n]*\n((?: [^\n]*\n){1,10})', perf_output, re.MULTILINE) return match.group(1) if match else None def profile_after_exit(self): @@ -175,11 +175,11 @@ perf_args = [self._perf_path(), 'report', '--call-graph', 'none', '--input', self._output_path] print "First 10 lines of 'perf report --call-graph=none':" - print " ".join(perf_args) + print ' '.join(perf_args) perf_output = self._host.executive.run_command(perf_args) print self._first_ten_lines_of_profile(perf_output) - print "To view the full profile, run:" + print 'To view the full profile, run:' print ' '.join([self._perf_path(), 'report', '-i', self._output_path]) print # An extra line between tests looks nicer. @@ -188,11 +188,11 @@ name = 'sample' def __init__(self, host, executable_path, output_dir, identifier=None): - super(Sample, self).__init__(host, executable_path, output_dir, "txt", identifier) + super(Sample, self).__init__(host, executable_path, output_dir, 'txt', identifier) self._profiler_process = None def attach_to_pid(self, pid): - cmd = ["sample", pid, "-mayDie", "-file", self._output_path] + cmd = ['sample', pid, '-mayDie', '-file', self._output_path] self._profiler_process = self._host.executive.popen(cmd) def profile_after_exit(self): @@ -203,15 +203,15 @@ name = 'iprofiler' def __init__(self, host, executable_path, output_dir, identifier=None): - super(IProfiler, self).__init__(host, executable_path, output_dir, "dtps", identifier) + super(IProfiler, self).__init__(host, executable_path, output_dir, 'dtps', identifier) self._profiler_process = None def attach_to_pid(self, pid): # FIXME: iprofiler requires us to pass the directory separately # from the basename of the file, with no control over the extension. fs = self._host.filesystem - cmd = ["iprofiler", "-timeprofiler", "-a", pid, - "-d", fs.dirname(self._output_path), "-o", fs.splitext(fs.basename(self._output_path))[0]] + cmd = ['iprofiler', '-timeprofiler', '-a', pid, + '-d', fs.dirname(self._output_path), '-o', fs.splitext(fs.basename(self._output_path))[0]] # FIXME: Consider capturing instead of letting instruments spam to stderr directly. self._profiler_process = self._host.executive.popen(cmd)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils.py index 882c2807..45108f5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils.py
@@ -36,10 +36,10 @@ """Log information about the given thread state.""" stack = _find_thread_stack(thread_id) assert stack is not None - logger("") - logger("%s (tid %d) %s" % (name, thread_id, msg)) + logger('') + logger('%s (tid %d) %s' % (name, thread_id, msg)) _log_stack(logger, stack) - logger("") + logger('') def _find_thread_stack(thread_id): @@ -65,4 +65,4 @@ for frame_str in traceback.format_list(stack): for line in frame_str.split('\n'): if line: - logger(" %s" % line) + logger(' %s' % line)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py index 96f4317..55074f1 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py
@@ -55,8 +55,8 @@ msgs.append(msg) thread_id = current_thread_id() - stack_utils.log_thread_state(logger, "test-thread", thread_id, - "is tested") + stack_utils.log_thread_state(logger, 'test-thread', thread_id, + 'is tested') self.assertTrue(msgs) def test_log_traceback(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user.py index 1aa23fd..d4b6ba9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user.py
@@ -72,10 +72,10 @@ cumulated_list = [] print list_title for i in range(len(subtitles)): - print "\n" + subtitles[i] + print '\n' + subtitles[i] for item in lists[i]: item_index += 1 - print "%2d. %s" % (item_index, item) + print '%2d. %s' % (item_index, item) cumulated_list += lists[i] return cls._wait_on_list_response(cumulated_list, can_choose_multiple, raw_input) @@ -84,8 +84,8 @@ while True: if can_choose_multiple: response = cls.prompt( - "Enter one or more numbers (comma-separated) or ranges (e.g. 3-7), or \"all\": ", raw_input=raw_input) - if not response.strip() or response == "all": + 'Enter one or more numbers (comma-separated) or ranges (e.g. 3-7), or \'all\': ', raw_input=raw_input) + if not response.strip() or response == 'all': return list_items try: @@ -102,7 +102,7 @@ return [list_items[i] for i in indices] else: try: - result = int(cls.prompt("Enter a number: ", raw_input=raw_input)) - 1 + result = int(cls.prompt('Enter a number: ', raw_input=raw_input)) - 1 except ValueError: continue return list_items[result] @@ -113,17 +113,17 @@ i = 0 for item in list_items: i += 1 - print "%2d. %s" % (i, item) + print '%2d. %s' % (i, item) return cls._wait_on_list_response(list_items, can_choose_multiple, raw_input) def edit(self, files): - editor = os.environ.get("EDITOR") or "vi" + editor = os.environ.get('EDITOR') or 'vi' args = shlex.split(editor) # Note: Not thread safe: http://bugs.python.org/issue2320 subprocess.call(args + files) def page(self, message): - pager = os.environ.get("PAGER") or "less" + pager = os.environ.get('PAGER') or 'less' try: # Note: Not thread safe: http://bugs.python.org/issue2320 child_process = subprocess.Popen([pager], stdin=subprocess.PIPE) @@ -133,9 +133,9 @@ def confirm(self, message=None, default=DEFAULT_YES, raw_input=raw_input): if not message: - message = "Continue?" + message = 'Continue?' choice = {'y': 'Y/n', 'n': 'y/N'}[default] - response = raw_input("%s [%s]: " % (message, choice)) + response = raw_input('%s [%s]: ' % (message, choice)) if not response: response = default return response.lower() == 'y' @@ -149,5 +149,5 @@ def open_url(self, url): if not self.can_open_url(): - _log.warning("Failed to open %s", url) + _log.warning('Failed to open %s', url) webbrowser.open(url)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_mock.py index e70e130..06eb60c 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_mock.py
@@ -35,7 +35,7 @@ @classmethod def prompt(cls, message, repeat=1, raw_input=raw_input): - return "Mock user response" + return 'Mock user response' @classmethod def prompt_with_list(cls, list_title, list_items, can_choose_multiple=False, raw_input=raw_input): @@ -59,7 +59,7 @@ def open_url(self, url): self.opened_urls.append(url) - if url.startswith("file://"): - _log.info("MOCK: user.open_url: file://...") + if url.startswith('file://'): + _log.info('MOCK: user.open_url: file://...') return - _log.info("MOCK: user.open_url: %s", url) + _log.info('MOCK: user.open_url: %s', url)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_unittest.py index c984887c..8dddac5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/user_unittest.py
@@ -34,7 +34,7 @@ class UserTest(unittest.TestCase): - example_user_response = "example user response" + example_user_response = 'example user response' def test_prompt_repeat(self): self.repeatsRemaining = 2 @@ -44,7 +44,7 @@ if not self.repeatsRemaining: return UserTest.example_user_response return None - self.assertEqual(User.prompt("input", repeat=self.repeatsRemaining, + self.assertEqual(User.prompt('input', repeat=self.repeatsRemaining, raw_input=mock_raw_input), UserTest.example_user_response) def test_prompt_when_exceeded_repeats(self): @@ -53,7 +53,7 @@ def mock_raw_input(message): self.repeatsRemaining -= 1 return None - self.assertIsNone(User.prompt("input", repeat=self.repeatsRemaining, raw_input=mock_raw_input)) + self.assertIsNone(User.prompt('input', repeat=self.repeatsRemaining, raw_input=mock_raw_input)) def test_prompt_with_multiple_lists(self): def run_prompt_test(inputs, expected_result, can_choose_multiple=False): @@ -63,27 +63,27 @@ actual_result = output_capture.assert_outputs( self, User.prompt_with_multiple_lists, - args=["title", ["subtitle1", "subtitle2"], [["foo", "bar"], ["foobar", "barbaz", "foobaz"]]], - kwargs={"can_choose_multiple": can_choose_multiple, "raw_input": mock_raw_input}, - expected_stdout="title\n\nsubtitle1\n 1. foo\n 2. bar\n\nsubtitle2\n 3. foobar\n 4. barbaz\n 5. foobaz\n") + args=['title', ['subtitle1', 'subtitle2'], [['foo', 'bar'], ['foobar', 'barbaz', 'foobaz']]], + kwargs={'can_choose_multiple': can_choose_multiple, 'raw_input': mock_raw_input}, + expected_stdout='title\n\nsubtitle1\n 1. foo\n 2. bar\n\nsubtitle2\n 3. foobar\n 4. barbaz\n 5. foobaz\n') self.assertEqual(actual_result, expected_result) self.assertEqual(len(inputs), 0) - run_prompt_test(["1"], "foo") - run_prompt_test(["badinput", "2"], "bar") - run_prompt_test(["3"], "foobar") - run_prompt_test(["4"], "barbaz") - run_prompt_test(["5"], "foobaz") + run_prompt_test(['1'], 'foo') + run_prompt_test(['badinput', '2'], 'bar') + run_prompt_test(['3'], 'foobar') + run_prompt_test(['4'], 'barbaz') + run_prompt_test(['5'], 'foobaz') - run_prompt_test(["1,2"], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test(["1-3"], ["foo", "bar", "foobar"], can_choose_multiple=True) - run_prompt_test(["1-2,3"], ["foo", "bar", "foobar"], can_choose_multiple=True) - run_prompt_test(["2-1,3"], ["foobar"], can_choose_multiple=True) - run_prompt_test([" 1, 2 "], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test(["all"], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) - run_prompt_test([""], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) - run_prompt_test([" "], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) - run_prompt_test(["badinput", "all"], ["foo", "bar", 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test(['1,2'], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test(['1-3'], ['foo', 'bar', 'foobar'], can_choose_multiple=True) + run_prompt_test(['1-2,3'], ['foo', 'bar', 'foobar'], can_choose_multiple=True) + run_prompt_test(['2-1,3'], ['foobar'], can_choose_multiple=True) + run_prompt_test([' 1, 2 '], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test(['all'], ['foo', 'bar', 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test([''], ['foo', 'bar', 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test([' '], ['foo', 'bar', 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) + run_prompt_test(['badinput', 'all'], ['foo', 'bar', 'foobar', 'barbaz', 'foobaz'], can_choose_multiple=True) def test_prompt_with_list(self): def run_prompt_test(inputs, expected_result, can_choose_multiple=False): @@ -93,32 +93,32 @@ actual_result = output_capture.assert_outputs( self, User.prompt_with_list, - args=["title", ["foo", "bar"]], - kwargs={"can_choose_multiple": can_choose_multiple, "raw_input": mock_raw_input}, - expected_stdout="title\n 1. foo\n 2. bar\n") + args=['title', ['foo', 'bar']], + kwargs={'can_choose_multiple': can_choose_multiple, 'raw_input': mock_raw_input}, + expected_stdout='title\n 1. foo\n 2. bar\n') self.assertEqual(actual_result, expected_result) self.assertEqual(len(inputs), 0) - run_prompt_test(["1"], "foo") - run_prompt_test(["badinput", "2"], "bar") + run_prompt_test(['1'], 'foo') + run_prompt_test(['badinput', '2'], 'bar') - run_prompt_test(["1,2"], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test([" 1, 2 "], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test(["all"], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test([""], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test([" "], ["foo", "bar"], can_choose_multiple=True) - run_prompt_test(["badinput", "all"], ["foo", "bar"], can_choose_multiple=True) + run_prompt_test(['1,2'], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test([' 1, 2 '], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test(['all'], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test([''], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test([' '], ['foo', 'bar'], can_choose_multiple=True) + run_prompt_test(['badinput', 'all'], ['foo', 'bar'], can_choose_multiple=True) def test_confirm(self): test_cases = ( - (("Continue? [Y/n]: ", True), (User.DEFAULT_YES, 'y')), - (("Continue? [Y/n]: ", False), (User.DEFAULT_YES, 'n')), - (("Continue? [Y/n]: ", True), (User.DEFAULT_YES, '')), - (("Continue? [Y/n]: ", False), (User.DEFAULT_YES, 'q')), - (("Continue? [y/N]: ", True), (User.DEFAULT_NO, 'y')), - (("Continue? [y/N]: ", False), (User.DEFAULT_NO, 'n')), - (("Continue? [y/N]: ", False), (User.DEFAULT_NO, '')), - (("Continue? [y/N]: ", False), (User.DEFAULT_NO, 'q')), + (('Continue? [Y/n]: ', True), (User.DEFAULT_YES, 'y')), + (('Continue? [Y/n]: ', False), (User.DEFAULT_YES, 'n')), + (('Continue? [Y/n]: ', True), (User.DEFAULT_YES, '')), + (('Continue? [Y/n]: ', False), (User.DEFAULT_YES, 'q')), + (('Continue? [y/N]: ', True), (User.DEFAULT_NO, 'y')), + (('Continue? [y/N]: ', False), (User.DEFAULT_NO, 'n')), + (('Continue? [y/N]: ', False), (User.DEFAULT_NO, '')), + (('Continue? [y/N]: ', False), (User.DEFAULT_NO, 'q')), ) for test_case in test_cases: expected, inputs = test_case
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 7ee11e7..0e25a32b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
@@ -99,7 +99,7 @@ self._webkit_base = self._webkit_base module_path = self._filesystem.abspath(self._filesystem.path_to_module(self.__module__)) tools_index = module_path.rfind('Tools') - assert tools_index != -1, "could not find location of this checkout from %s" % module_path + assert tools_index != -1, 'could not find location of this checkout from %s' % module_path self._webkit_base = self._filesystem.normpath(module_path[0:tools_index - 1]) return self._webkit_base @@ -118,7 +118,7 @@ """Returns the relative path to the script from the top of the WebKit tree.""" # This is intentionally relative in order to force callers to consider what # their current working directory is (and change to the top of the tree if necessary). - return self._filesystem.join("Tools", "Scripts", script_name) + return self._filesystem.join('Tools', 'Scripts', script_name) def layout_tests_dir(self): return self.path_from_webkit_base('LayoutTests')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/bisect_test_ordering.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/bisect_test_ordering.py index 9108c4c..035ba59 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/bisect_test_ordering.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/bisect_test_ordering.py
@@ -98,7 +98,7 @@ for bucket in self.buckets: tests += bucket.tests extra_args = ' --debug' if self.is_debug else '' - print 'run-webkit-tests%s --child-processes=1 --order=none %s' % (extra_args, " ".join(tests)) + print 'run-webkit-tests%s --child-processes=1 --order=none %s' % (extra_args, ' '.join(tests)) def is_done(self): for bucket in self.buckets:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_multipart.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_multipart.py index a3082f1..c84f2e5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_multipart.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_multipart.py
@@ -67,7 +67,7 @@ self._generate_breakpad_symbols_if_necessary() f, temp_name = self._host.filesystem.open_binary_tempfile('dmp') - f.write("\r\n".join(dump['upload_file_minidump'])) + f.write('\r\n'.join(dump['upload_file_minidump'])) f.close() cmd = [self._path_to_minidump_stackwalk(), temp_name, self._symbols_dir()] @@ -116,11 +116,11 @@ return self._breakpad_tools_available def _path_to_minidump_stackwalk(self): - return self._host.filesystem.join(self._build_dir, "minidump_stackwalk") + return self._host.filesystem.join(self._build_dir, 'minidump_stackwalk') def _path_to_generate_breakpad_symbols(self): return self._webkit_finder.path_from_chromium_base( - "components", "crash", "content", "tools", "generate_breakpad_symbols.py") + 'components', 'crash', 'content', 'tools', 'generate_breakpad_symbols.py') def _symbols_dir(self): return self._host.filesystem.join(self._build_dir, 'content_shell.syms') @@ -130,7 +130,7 @@ return self._generated_symbols = True - _log.debug("Generating breakpad symbols") + _log.debug('Generating breakpad symbols') queue = Queue.Queue() thread = threading.Thread(target=_symbolize_keepalive, args=(queue,)) thread.start() @@ -151,7 +151,7 @@ finally: queue.put(None) thread.join() - _log.debug("Done generating breakpad symbols") + _log.debug('Done generating breakpad symbols') def _binaries_to_symbolize(self): """This routine must be implemented by subclasses. @@ -163,7 +163,7 @@ def _symbolize_keepalive(queue): while True: - _log.debug("waiting for symbolize to complete") + _log.debug('waiting for symbolize to complete') try: queue.get(block=True, timeout=60) return
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list.py index e7ecd10..d0a2ba5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list.py
@@ -61,7 +61,7 @@ return sorted(b for b in self._builders if not self._builders[b].get('is_try_builder')) def all_port_names(self): - return sorted({b["port_name"] for b in self._builders.values()}) + return sorted({b['port_name'] for b in self._builders.values()}) def port_name_for_builder_name(self, builder_name): return self._builders[builder_name]['port_name']
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list_unittest.py index e704bde..1bfcf8cd 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/builder_list_unittest.py
@@ -40,8 +40,8 @@ 'Blink B': {'port_name': 'port-b', 'specifiers': ['B', 'Release']}, 'Blink B (dbg)': {'port_name': 'port-b', 'specifiers': ['B', 'Debug']}, 'Blink C (dbg)': {'port_name': 'port-c', 'specifiers': ['C', 'Release']}, - 'Try A': {'port_name': 'port-a', 'specifiers': ['A', 'Release'], "is_try_builder": True}, - 'Try B': {'port_name': 'port-b', 'specifiers': ['B', 'Release'], "is_try_builder": True}, + 'Try A': {'port_name': 'port-a', 'specifiers': ['A', 'Release'], 'is_try_builder': True}, + 'Try B': {'port_name': 'port-b', 'specifiers': ['B', 'Release'], 'is_try_builder': True}, }) def test_all_builder_names(self):
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 346f56d..56f7982 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
@@ -163,7 +163,7 @@ # so that existing buildbot grep rules work. def interrupt_if_at_failure_limit(limit, failure_count, run_results, message): if limit and failure_count >= limit: - message += " %d tests run." % (run_results.expected + run_results.unexpected) + message += ' %d tests run.' % (run_results.expected + run_results.unexpected) self._mark_interrupted_tests_as_skipped(run_results) raise TestRunInterruptedException(message) @@ -171,13 +171,13 @@ self._options.exit_after_n_failures, run_results.unexpected_failures, run_results, - "Exiting early after %d failures." % run_results.unexpected_failures) + 'Exiting early after %d failures.' % run_results.unexpected_failures) interrupt_if_at_failure_limit( self._options.exit_after_n_crashes_or_timeouts, run_results.unexpected_crashes + run_results.unexpected_timeouts, run_results, # This differs from ORWT because it does not include WebProcess crashes. - "Exiting early after %d crashes and %d timeouts." % (run_results.unexpected_crashes, run_results.unexpected_timeouts)) + 'Exiting early after %d crashes and %d timeouts.' % (run_results.unexpected_crashes, run_results.unexpected_timeouts)) def _update_summary_with_result(self, run_results, result): expected = self._expectations.matches_an_expected_result( @@ -186,7 +186,7 @@ got_str = self._expectations.expectation_to_string(result.type) if result.device_failed: - self._printer.print_finished_test(result, False, exp_str, "Aborted") + self._printer.print_finished_test(result, False, exp_str, 'Aborted') return run_results.add(result, expected, self._test_is_slow(result.test_name)) @@ -210,7 +210,7 @@ self._update_summary_with_result(self._current_run_results, result) def _handle_device_failed(self, worker_name, list_name, remaining_tests): - _log.warning("%s has failed", worker_name) + _log.warning('%s has failed', worker_name) if remaining_tests: self._shards_to_redo.append(TestShard(list_name, remaining_tests)) @@ -304,15 +304,15 @@ return result.device_failed def stop(self): - _log.debug("%s cleaning up", self._name) - self._kill_driver(self._primary_driver, "primary") - self._kill_driver(self._secondary_driver, "secondary") + _log.debug('%s cleaning up', self._name) + self._kill_driver(self._primary_driver, 'primary') + self._kill_driver(self._secondary_driver, 'secondary') def _kill_driver(self, driver, label): # Be careful about how and when we kill the driver; if driver.stop() # raises an exception, this routine may get re-entered via __del__. if driver: - _log.debug("%s killing %s driver", self._name, label) + _log.debug('%s killing %s driver', self._name, label) driver.stop() def _clean_up_after_test(self, test_input, result): @@ -324,20 +324,20 @@ # FIXME: Need more information in failure reporting so # we know which driver needs to be restarted. For now # we kill both drivers. - self._kill_driver(self._primary_driver, "primary") - self._kill_driver(self._secondary_driver, "secondary") + self._kill_driver(self._primary_driver, 'primary') + self._kill_driver(self._secondary_driver, 'secondary') # Reset the batch count since the shell just bounced. self._batch_count = 0 # Print the error message(s). - _log.debug("%s %s failed:", self._name, test_name) + _log.debug('%s %s failed:', self._name, test_name) for f in result.failures: - _log.debug("%s %s", self._name, f.message()) + _log.debug('%s %s', self._name, f.message()) elif result.type == test_expectations.SKIP: - _log.debug("%s %s skipped", self._name, test_name) + _log.debug('%s %s skipped', self._name, test_name) else: - _log.debug("%s %s passed", self._name, test_name) + _log.debug('%s %s passed', self._name, test_name) class TestShard(object):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py index 7803e5b..e32cbe3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
@@ -140,7 +140,7 @@ self._make_fake_test_result(port.host, '/tmp/layout-test-results') self.assertTrue(port.host.filesystem.exists('/tmp/layout-test-results')) timestamp = time.strftime( - "%Y-%m-%d-%H-%M-%S", time.localtime(port.host.filesystem.mtime('/tmp/layout-test-results/results.html'))) + '%Y-%m-%d-%H-%M-%S', time.localtime(port.host.filesystem.mtime('/tmp/layout-test-results/results.html'))) archived_file_name = '/tmp/layout-test-results' + '_' + timestamp manager = get_manager() manager._rename_results_folder()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py index aef586d..a79ed87 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
@@ -51,7 +51,7 @@ try: return runner.run() except DeviceFailure as error: - _log.error("device failed: %s", error) + _log.error('device failed: %s', error) return TestResult(test_input.test_name, device_failed=True) @@ -228,7 +228,7 @@ raise AssertionError('unrecognized baseline location: %s' % location) fs.maybe_make_directory(output_dir) - output_basename = fs.basename(fs.splitext(self._test_name)[0] + "-expected" + extension) + output_basename = fs.basename(fs.splitext(self._test_name)[0] + '-expected' + extension) output_path = fs.join(output_dir, output_basename) _log.info('Writing new expected result "%s"', port.relative_test_filename(output_path)) port.update_baseline(output_path, data) @@ -257,17 +257,17 @@ driver_output.crashed_pid, self._port.output_contains_sanitizer_messages(driver_output.crash_log))) if driver_output.error: - _log.debug("%s %s crashed, (stderr lines):", self._worker_name, testname) + _log.debug('%s %s crashed, (stderr lines):', self._worker_name, testname) else: - _log.debug("%s %s crashed, (no stderr)", self._worker_name, testname) + _log.debug('%s %s crashed, (no stderr)', self._worker_name, testname) elif driver_output.leak: failures.append(test_failures.FailureLeak(bool(reference_filename), driver_output.leak_log)) - _log.debug("%s %s leaked", self._worker_name, testname) + _log.debug('%s %s leaked', self._worker_name, testname) elif driver_output.error: - _log.debug("%s %s output stderr lines:", self._worker_name, testname) + _log.debug('%s %s output stderr lines:', self._worker_name, testname) for line in driver_output.error.splitlines(): - _log.debug(" %s", line) + _log.debug(' %s', line) return failures def _compare_output(self, expected_driver_output, driver_output): @@ -309,7 +309,7 @@ return True, [] def _is_render_tree(self, text): - return text and "layer at (0,0) size 800x600" in text + return text and 'layer at (0,0) size 800x600' in text def _compare_text(self, expected_text, actual_text): failures = [] @@ -338,7 +338,7 @@ # changed to "\r\n" by our system (Python/Cygwin), resulting in # "\r\r\n", when, in fact, we wanted to compare the text output with # the normalized text expectation files. - return output.replace("\r\r\n", "\r\n").replace("\r\n", "\n") + return output.replace('\r\r\n', '\r\n').replace('\r\n', '\n') # FIXME: This function also creates the image diff. Maybe that work should # be handled elsewhere?
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py index 4851727..2fd2402 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py
@@ -59,9 +59,9 @@ row = [] length = len(self._old_failing_results_list) for index in range(0, length): - result = self._recurse_json_object(self._old_failing_results_list[index]["tests"], key_list) + result = self._recurse_json_object(self._old_failing_results_list[index]['tests'], key_list) if result == 'NOTFOUND': - result = self._recurse_json_object(self._old_full_results_list[index]["tests"], key_list) + result = self._recurse_json_object(self._old_full_results_list[index]['tests'], key_list) row.append(result) return row @@ -80,8 +80,8 @@ return def generate_archived_result(self): - for key in self._current_result_json_dict["tests"]: - self._process_json_object(self._current_result_json_dict["tests"][key], [key]) + for key in self._current_result_json_dict['tests']: + self._process_json_object(self._current_result_json_dict['tests'][key], [key]) return self._current_result_json_dict
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations.py index 165961c..bed3fb3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations.py
@@ -170,7 +170,7 @@ line.filename = test_path line.path = test_path # FIXME: Should this be normpath? line.matching_tests = [test_path] - line.bugs = ["crbug.com/FILE_A_BUG_BEFORE_COMMITTING_THIS"] + line.bugs = ['crbug.com/FILE_A_BUG_BEFORE_COMMITTING_THIS'] line.expectations = sorted(flaky_types) line.specifiers = self.specifiers return line
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py index e742cfe..5c7bc2f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py
@@ -37,7 +37,7 @@ def fake_builder_list(self): return BuilderList({ - "Dummy builder name": {"port_name": "dummy-port", "specifiers": []}, + 'Dummy builder name': {'port_name': 'dummy-port', 'specifiers': []}, }) def fake_results_json_for_builder(self, builder): @@ -58,8 +58,8 @@ class BotTestExpectationsTest(unittest.TestCase): # FIXME: Find a way to import this map from Tools/TestResultServer/model/jsonresults.py. - FAILURE_MAP = {"A": "AUDIO", "C": "CRASH", "F": "TEXT", "I": "IMAGE", "O": "MISSING", - "N": "NO DATA", "P": "PASS", "T": "TIMEOUT", "Y": "NOTRUN", "X": "SKIP", "Z": "IMAGE+TEXT", "K": "LEAK"} + FAILURE_MAP = {'A': 'AUDIO', 'C': 'CRASH', 'F': 'TEXT', 'I': 'IMAGE', 'O': 'MISSING', + 'N': 'NO DATA', 'P': 'PASS', 'T': 'TIMEOUT', 'Y': 'NOTRUN', 'X': 'SKIP', 'Z': 'IMAGE+TEXT', 'K': 'LEAK'} # All result_string's in this file represent retries from a single run. # The left-most entry is the first try, the right-most is the last. @@ -162,13 +162,13 @@ } } self._assert_expectations(test_data, { - 'foo/veryflaky.html': sorted(["TEXT", "PASS"]), + 'foo/veryflaky.html': sorted(['TEXT', 'PASS']), }, only_ignore_very_flaky=True) self._assert_expectations(test_data, { - 'foo/veryflaky.html': sorted(["TEXT", "PASS"]), + 'foo/veryflaky.html': sorted(['TEXT', 'PASS']), 'foo/notverflakynoexpected.html': ['TEXT', 'TIMEOUT'], - 'foo/maybeflaky.html': sorted(["TEXT", "PASS"]), + 'foo/maybeflaky.html': sorted(['TEXT', 'PASS']), }, only_ignore_very_flaky=False) def test_unexpected_results_no_unexpected(self): @@ -202,12 +202,12 @@ } self.maxDiff = None self._assert_unexpected_results(test_data, { - 'foo/pass1.html': sorted(["FAIL", "PASS"]), - 'foo/pass2.html': sorted(["IMAGE", "PASS"]), - 'foo/fail.html': sorted(["TEXT", "PASS"]), - 'foo/f_p.html': sorted(["TEXT", "PASS"]), - 'foo/crash.html': sorted(["WONTFIX", "CRASH", "TEXT"]), - 'foo/image.html': sorted(["CRASH", "TEXT", "IMAGE"]), - 'foo/i_f.html': sorted(["PASS", "IMAGE", "TEXT"]), - 'foo/all.html': sorted(["TEXT", "PASS", "IMAGE+TEXT", "TIMEOUT", "CRASH", "IMAGE", "MISSING", "LEAK"]), + 'foo/pass1.html': sorted(['FAIL', 'PASS']), + 'foo/pass2.html': sorted(['IMAGE', 'PASS']), + 'foo/fail.html': sorted(['TEXT', 'PASS']), + 'foo/f_p.html': sorted(['TEXT', 'PASS']), + 'foo/crash.html': sorted(['WONTFIX', 'CRASH', 'TEXT']), + 'foo/image.html': sorted(['CRASH', 'TEXT', 'IMAGE']), + 'foo/i_f.html': sorted(['PASS', 'IMAGE', 'TEXT']), + 'foo/all.html': sorted(['TEXT', 'PASS', 'IMAGE+TEXT', 'TIMEOUT', 'CRASH', 'IMAGE', 'MISSING', 'LEAK']), })
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py index 718dd73e..e9754049 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py
@@ -160,6 +160,7 @@ self.assertIn('flag-specific:1 Path does not exist. does/not/exist', logging_stream.getvalue()) self.assertNotIn('noproblem', logging_stream.getvalue()) + class CheckVirtualSuiteTest(unittest.TestCase): def test_check_virtual_test_suites(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py index 5f4fdfe9..c4745d6b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py
@@ -50,7 +50,7 @@ return self.__dict__.keys() def __str__(self): - return ("<%(version)s, %(architecture)s, %(build_type)s>" % + return ('<%(version)s, %(architecture)s, %(build_type)s>' % self.__dict__) def __repr__(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py index e6408388e..1ae771a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures.py
@@ -82,7 +82,7 @@ elif is_audio_failure: return test_expectations.AUDIO else: - raise ValueError("unclassifiable set of failures: " + raise ValueError('unclassifiable set of failures: ' + str(failure_types)) @@ -123,7 +123,7 @@ self.is_reftest = is_reftest def message(self): - return "test timed out" + return 'test timed out' def driver_needs_restart(self): return True @@ -140,8 +140,8 @@ def message(self): if self.pid: - return "%s crashed [pid=%d]" % (self.process_name, self.pid) - return self.process_name + " crashed" + return '%s crashed [pid=%d]' % (self.process_name, self.pid) + return self.process_name + ' crashed' def driver_needs_restart(self): return True @@ -155,49 +155,49 @@ self.log = log def message(self): - return "leak detected: %s" % (self.log) + return 'leak detected: %s' % (self.log) class FailureMissingResult(TestFailure): def message(self): - return "-expected.txt was missing" + return '-expected.txt was missing' class FailureTestHarnessAssertion(TestFailure): def message(self): - return "asserts failed" + return 'asserts failed' class FailureTextMismatch(TestFailure): def message(self): - return "text diff" + return 'text diff' class FailureMissingImageHash(TestFailure): def message(self): - return "-expected.png was missing an embedded checksum" + return '-expected.png was missing an embedded checksum' class FailureMissingImage(TestFailure): def message(self): - return "-expected.png was missing" + return '-expected.png was missing' class FailureImageHashMismatch(TestFailure): def message(self): - return "image diff" + return 'image diff' class FailureImageHashIncorrect(TestFailure): def message(self): - return "-expected.png embedded checksum is incorrect" + return '-expected.png embedded checksum is incorrect' class FailureReftestMismatch(TestFailure): @@ -207,7 +207,7 @@ self.reference_filename = reference_filename def message(self): - return "reference mismatch" + return 'reference mismatch' class FailureReftestMismatchDidNotOccur(TestFailure): @@ -233,19 +233,19 @@ class FailureMissingAudio(TestFailure): def message(self): - return "expected audio result was missing" + return 'expected audio result was missing' class FailureAudioMismatch(TestFailure): def message(self): - return "audio mismatch" + return 'audio mismatch' class FailureEarlyExit(TestFailure): def message(self): - return "skipped due to early exit" + return 'skipped due to early exit' # Convenient collection of all failure classes for anything that might
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py index 0e207df..9f160972 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py
@@ -70,7 +70,7 @@ crash_set = set([FailureCrash(), FailureCrash()]) self.assertEqual(len(crash_set), 1) # The hash happens to be the name of the class, but sets still work: - crash_set = set([FailureCrash(), "FailureCrash"]) + crash_set = set([FailureCrash(), 'FailureCrash']) self.assertEqual(len(crash_set), 2) def test_crashes(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_input.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_input.py index 1b9082f..a14f4ae 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_input.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_input.py
@@ -47,8 +47,8 @@ def __repr__(self): return ( "TestInput('%s', timeout_ms=%s, requires_lock=%s, " - "reference_files=%s, should_run_pixel_test=%s, " - "should_add_missing_baselines=%s)" % ( + 'reference_files=%s, should_run_pixel_test=%s, ' + 'should_add_missing_baselines=%s)' % ( self.test_name, self.timeout_ms, self.requires_lock,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py index da3b8c7..2dd3414 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py
@@ -34,7 +34,7 @@ class TestResultsTest(unittest.TestCase): def test_defaults(self): - result = TestResult("foo") + result = TestResult('foo') self.assertEqual(result.test_name, 'foo') self.assertEqual(result.failures, []) self.assertEqual(result.test_run_time, 0)
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 0c8ecae..59b6e450 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
@@ -276,7 +276,7 @@ test_dict.update(reftest_type=list(result.reftest_type)) test_dict['expected'] = expected - test_dict['actual'] = " ".join(actual) + test_dict['actual'] = ' '.join(actual) def is_expected(actual_result): return expectations.matches_an_expected_result(test_name, actual_result,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py index 34998b1..8e59b06b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py
@@ -107,7 +107,7 @@ DEVICE_WEBKIT_BASE_DIR = DEVICE_SOURCE_ROOT_DIR + 'third_party/WebKit/' DEVICE_LAYOUT_TESTS_DIR = DEVICE_WEBKIT_BASE_DIR + 'LayoutTests/' -KPTR_RESTRICT_PATH = "/proc/sys/kernel/kptr_restrict" +KPTR_RESTRICT_PATH = '/proc/sys/kernel/kptr_restrict' # All the test cases are still served to the test runner through file protocol, # but we use a file-to-http feature to bridge the file request to host's http @@ -356,7 +356,7 @@ usable_devices = self._devices.usable_devices(self._executive) if not usable_devices: raise test_run_results.TestRunException(test_run_results.NO_DEVICES_EXIT_STATUS, - "Unable to find any attached Android devices.") + 'Unable to find any attached Android devices.') return len(usable_devices) def max_drivers_per_process(self): @@ -389,15 +389,15 @@ else: callback = printer.write_update with lock: - callback("[%s] %s" % (serial, msg)) + callback('[%s] %s' % (serial, msg)) - log_safely("preparing device", throttled=False) + log_safely('preparing device', throttled=False) try: d._setup_test(log_safely) - log_safely("device prepared", throttled=False) + log_safely('device prepared', throttled=False) except (ScriptError, driver.DeviceFailure) as error: with lock: - _log.warning("[%s] failed to prepare_device: %s", serial, error) + _log.warning('[%s] failed to prepare_device: %s', serial, error) except KeyboardInterrupt: if pool: pool.terminate() @@ -515,7 +515,7 @@ _have_searched_for_perf_host = False def __init__(self, host, executable_path, output_dir, device, symfs_path, kallsyms_path, identifier=None): - super(AndroidPerf, self).__init__(host, executable_path, output_dir, "data", identifier) + super(AndroidPerf, self).__init__(host, executable_path, output_dir, 'data', identifier) self._device = device self._perf_process = None self._symfs_path = symfs_path @@ -524,12 +524,12 @@ def check_configuration(self): # Check that perf is installed if not self._device.PathExists('/system/bin/perf'): - _log.error("Cannot find /system/bin/perf on device %s", self._device.serial) + _log.error('Cannot find /system/bin/perf on device %s', self._device.serial) return False # Check that the device is a userdebug build (or at least has the necessary libraries). if self._device.build_type != 'userdebug': - _log.error("Device %s is not flashed with a userdebug build of Android", self._device.serial) + _log.error('Device %s is not flashed with a userdebug build of Android', self._device.serial) return False # FIXME: Check that the binary actually is perf-able (has stackframe pointers)? @@ -626,7 +626,7 @@ """) perfhost_display_patch = perfhost_path if perfhost_path else 'perfhost_linux' - _log.debug("To view the full profile, run:") + _log.debug('To view the full profile, run:') _log.debug(' '.join([perfhost_display_patch] + perfhost_report_command)) @@ -648,7 +648,7 @@ # FIXME: If we taught ProfileFactory about "target" devices we could # just use the logic in Driver instead of duplicating it here. - if self._port.get_option("profile"): + if self._port.get_option('profile'): # FIXME: This should be done once, instead of per-driver! symfs_path = self._find_or_create_symfs() kallsyms_path = self._update_kallsyms_cache(symfs_path) @@ -670,7 +670,7 @@ super(ChromiumAndroidDriver, self).__del__() def _update_kallsyms_cache(self, output_dir): - kallsyms_name = "%s-kallsyms" % self._device.serial + kallsyms_name = '%s-kallsyms' % self._device.serial kallsyms_cache_path = self._port.host.filesystem.join(output_dir, kallsyms_name) self._device.EnableRoot() @@ -678,7 +678,7 @@ saved_kptr_restrict = self._device.ReadFile(KPTR_RESTRICT_PATH).strip() self._device.WriteFile(KPTR_RESTRICT_PATH, '0') - _log.debug("Updating kallsyms file (%s) from device", kallsyms_cache_path) + _log.debug('Updating kallsyms file (%s) from device', kallsyms_cache_path) self._device.PullFile('/proc/kallsysm', kallsyms_cache_path) self._device.WriteFile(KPTR_RESTRICT_PATH, saved_kptr_restrict) @@ -692,18 +692,18 @@ symfs_path = env['ANDROID_SYMFS'] else: symfs_path = fs.join(self._port.results_directory(), 'symfs') - _log.debug("ANDROID_SYMFS not set, using %s", symfs_path) + _log.debug('ANDROID_SYMFS not set, using %s', symfs_path) # find the installed path, and the path of the symboled built library # FIXME: We should get the install path from the device! - symfs_library_path = fs.join(symfs_path, "data/app-lib/%s-1/%s" % + symfs_library_path = fs.join(symfs_path, 'data/app-lib/%s-1/%s' % (self._driver_details.package_name(), self._driver_details.library_name())) built_library_path = self._port._build_path('lib', self._driver_details.library_name()) assert fs.exists(built_library_path) # FIXME: Ideally we'd check the sha1's first and make a soft-link instead # of copying (since we probably never care about windows). - _log.debug("Updating symfs library (%s) from built copy (%s)", symfs_library_path, built_library_path) + _log.debug('Updating symfs library (%s) from built copy (%s)', symfs_library_path, built_library_path) fs.maybe_make_directory(fs.dirname(symfs_library_path)) fs.copyfile(built_library_path, symfs_library_path) @@ -774,7 +774,7 @@ def _push_file_if_needed(self, host_file, device_file, log_callback): basename = self._port.host.filesystem.basename(host_file) - log_callback("checking %s" % basename) + log_callback('checking %s' % basename) self._device.PushChangedFiles([(host_file, device_file)]) def _push_executable(self, log_callback): @@ -789,7 +789,7 @@ try: driver_host_path = self._port._path_to_driver() # pylint: disable=protected-access - log_callback("installing apk if necessary") + log_callback('installing apk if necessary') self._device.Install(driver_host_path) except (device_errors.CommandFailedError, device_errors.CommandTimeoutError) as exc: @@ -911,7 +911,7 @@ def _start(self, pixel_tests, per_test_args): if not self._android_devices.is_device_prepared(self._device.serial): - raise driver.DeviceFailure("%s is not prepared in _start()" % self._device.serial) + raise driver.DeviceFailure('%s is not prepared in _start()' % self._device.serial) for retries in range(3): try: @@ -1005,7 +1005,7 @@ if not self._wait_for_server_process_output(self._server_process, deadline, '#READY'): return False - self._log_debug("content_shell is ready") + self._log_debug('content_shell is ready') return True def _create_device_crash_dumps_directory(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py index 6593c970..8661a35 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -176,7 +176,7 @@ self._dump_reader = None # FIXME: prettypatch.py knows this path; it should not be copied here. - self._pretty_patch_path = self.path_from_webkit_base("Tools", "Scripts", "webkitruby", "PrettyPatch", "prettify.rb") + self._pretty_patch_path = self.path_from_webkit_base('Tools', 'Scripts', 'webkitruby', 'PrettyPatch', 'prettify.rb') self._pretty_patch_available = None if not hasattr(options, 'configuration') or not options.configuration: @@ -189,7 +189,7 @@ self._virtual_test_suites = None def __str__(self): - return "Port{name=%s, version=%s, architecture=%s, test_configuration=%s}" % ( + return 'Port{name=%s, version=%s, architecture=%s, test_configuration=%s}' % ( self._name, self._version, self._architecture, self._test_configuration) def additional_driver_flag(self): @@ -334,7 +334,7 @@ def _check_driver(self): driver_path = self._path_to_driver() if not self._filesystem.exists(driver_path): - _log.error("%s was not found at %s", self.driver_name(), driver_path) + _log.error('%s was not found at %s', self.driver_name(), driver_path) return False return True @@ -372,7 +372,7 @@ """Checks whether image_diff binary exists.""" image_diff_path = self._path_to_image_diff() if not self._filesystem.exists(image_diff_path): - _log.error("image_diff was not found at %s", image_diff_path) + _log.error('image_diff was not found at %s', image_diff_path) return False return True @@ -400,13 +400,13 @@ if httpd_path: try: env = self.setup_environ_for_server() - if self._executive.run_command([httpd_path, "-v"], env=env, return_exit_code=True) != 0: - _log.error("httpd seems broken. Cannot run http tests.") + if self._executive.run_command([httpd_path, '-v'], env=env, return_exit_code=True) != 0: + _log.error('httpd seems broken. Cannot run http tests.') return False return True except OSError: pass - _log.error("No httpd found. Cannot run http tests.") + _log.error('No httpd found. Cannot run http tests.') return False def do_text_results_differ(self, expected_text, actual_text): @@ -431,13 +431,13 @@ tempdir = self._filesystem.mkdtemp() - expected_filename = self._filesystem.join(str(tempdir), "expected.png") + expected_filename = self._filesystem.join(str(tempdir), 'expected.png') self._filesystem.write_binary_file(expected_filename, expected_contents) - actual_filename = self._filesystem.join(str(tempdir), "actual.png") + actual_filename = self._filesystem.join(str(tempdir), 'actual.png') self._filesystem.write_binary_file(actual_filename, actual_contents) - diff_filename = self._filesystem.join(str(tempdir), "diff.png") + diff_filename = self._filesystem.join(str(tempdir), 'diff.png') # image_diff needs native win paths as arguments, so we need to convert them if running under cygwin. native_expected_filename = self._convert_path(expected_filename) @@ -458,7 +458,7 @@ elif exit_code == 1: result = self._filesystem.read_binary_file(native_diff_filename) else: - err_str = "Image diff returned an exit code of %s. See http://crbug.com/278596" % exit_code + err_str = 'Image diff returned an exit code of %s. See http://crbug.com/278596' % exit_code except OSError as error: err_str = 'error running image diff: %s' % error finally: @@ -617,7 +617,7 @@ if not self._filesystem.exists(baseline_path): return None text = self._filesystem.read_binary_file(baseline_path) - return text.replace("\r\n", "\n") + return text.replace('\r\n', '\n') def _get_reftest_list(self, test_name): dirname = self._filesystem.join(self.layout_tests_dir(), self._filesystem.dirname(test_name)) @@ -934,11 +934,11 @@ # TODO(qyearsley): Remove this if there are no more "Skipped" files. tests_to_skip = [] for search_path in skipped_file_paths: - filename = self._filesystem.join(self._absolute_baseline_path(search_path), "Skipped") + filename = self._filesystem.join(self._absolute_baseline_path(search_path), 'Skipped') if not self._filesystem.exists(filename): - _log.debug("Skipped does not exist: %s", filename) + _log.debug('Skipped does not exist: %s', filename) continue - _log.debug("Using Skipped file: %s", filename) + _log.debug('Using Skipped file: %s', filename) skipped_file_contents = self._filesystem.read_text_file(filename) tests_to_skip.extend(self._tests_from_skipped_file_contents(skipped_file_contents)) return tests_to_skip @@ -1040,7 +1040,7 @@ # Delete the disk cache if any to ensure a clean test run. dump_render_tree_binary_path = self._path_to_driver() cachedir = self._filesystem.dirname(dump_render_tree_binary_path) - cachedir = self._filesystem.join(cachedir, "cache") + cachedir = self._filesystem.join(cachedir, 'cache') if self._filesystem.exists(cachedir): self._filesystem.rmtree(cachedir) @@ -1151,7 +1151,7 @@ @staticmethod def is_wptserve_test(test): """Whether wptserve should be used for a given test if enabled.""" - return test.startswith("external/wpt/") + return test.startswith('external/wpt/') def should_use_wptserve(self, test): return self.is_wptserve_test(test) @@ -1328,14 +1328,14 @@ return self.path_from_chromium_base('build') # This is a class variable so we can test error output easily. - _pretty_patch_error_html = "Failed to run PrettyPatch, see error log." + _pretty_patch_error_html = 'Failed to run PrettyPatch, see error log.' def pretty_patch_text(self, diff_path): if self._pretty_patch_available is None: self._pretty_patch_available = self.check_pretty_patch(more_logging=False) if not self._pretty_patch_available: return self._pretty_patch_error_html - command = ("ruby", "-I", self._filesystem.dirname(self._pretty_patch_path), + command = ('ruby', '-I', self._filesystem.dirname(self._pretty_patch_path), self._pretty_patch_path, diff_path) try: # Diffs are treated as binary (we pass decode_output=False) as they @@ -1344,13 +1344,13 @@ except OSError as error: # If the system is missing ruby log the error and stop trying. self._pretty_patch_available = False - _log.error("Failed to run PrettyPatch (%s): %s", command, error) + _log.error('Failed to run PrettyPatch (%s): %s', command, error) return self._pretty_patch_error_html except ScriptError as error: # If ruby failed to run for some reason, log the command # output and stop trying. self._pretty_patch_available = False - _log.error("Failed to run PrettyPatch (%s):\n%s", command, error.message_with_output()) + _log.error('Failed to run PrettyPatch (%s):\n%s', command, error.message_with_output()) return self._pretty_patch_error_html def default_configuration(self): @@ -1397,7 +1397,7 @@ custom_configuration_distributions = ['arch', 'debian', 'redhat'] if distribution in custom_configuration_distributions: - return "%s-httpd-%s.conf" % (distribution, self._apache_version()) + return '%s-httpd-%s.conf' % (distribution, self._apache_version()) return 'apache2-httpd-' + self._apache_version() + '.conf' @@ -1482,7 +1482,7 @@ return [ # For example, to turn on force-compositing-mode in the svg/ directory: # PhysicalTestSuite('svg', ['--force-compositing-mode']), - PhysicalTestSuite('fast/text', ["--enable-direct-write", "--enable-font-antialiasing"]), + PhysicalTestSuite('fast/text', ['--enable-direct-write', '--enable-font-antialiasing']), ] def virtual_test_suites(self): @@ -1493,7 +1493,7 @@ test_suite_json = json.loads(self._filesystem.read_text_file(path_to_virtual_test_suites)) self._virtual_test_suites = [VirtualTestSuite(**d) for d in test_suite_json] except ValueError as error: - raise ValueError("LayoutTests/VirtualTestSuites is not a valid JSON file: %s" % error) + raise ValueError('LayoutTests/VirtualTestSuites is not a valid JSON file: %s' % error) return self._virtual_test_suites def _all_virtual_tests(self, suites):
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 f562d2b4..44b772a 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,22 +56,22 @@ def test_pretty_patch_os_error(self): port = self.make_port(executive=MockExecutive(exception=OSError)) - self.assertEqual(port.pretty_patch_text("patch.txt"), + 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"), + self.assertEqual(port.pretty_patch_text('patch.txt'), port._pretty_patch_error_html) def test_pretty_patch_script_error(self): # FIXME: This is some ugly white-box test hacking ... port = self.make_port(executive=MockExecutive(exception=ScriptError)) port._pretty_patch_available = True - self.assertEqual(port.pretty_patch_text("patch.txt"), + 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"), + self.assertEqual(port.pretty_patch_text('patch.txt'), port._pretty_patch_error_html) def test_setup_test_run(self): @@ -340,14 +340,14 @@ def test_parse_reftest_list(self): port = self.make_port(with_tests=True) - port.host.filesystem.files['bar/reftest.list'] = "\n".join(["== test.html test-ref.html", - "", - "# some comment", - "!= test-2.html test-notref.html # more comments", - "== test-3.html test-ref.html", - "== test-3.html test-ref2.html", - "!= test-3.html test-notref.html", - "fuzzy(80,500) == test-3 test-ref.html"]) + port.host.filesystem.files['bar/reftest.list'] = '\n'.join(['== test.html test-ref.html', + '', + '# some comment', + '!= test-2.html test-notref.html # more comments', + '== test-3.html test-ref.html', + '== test-3.html test-ref2.html', + '!= test-3.html test-notref.html', + 'fuzzy(80,500) == test-3 test-ref.html']) # Note that we don't support the syntax in the last line; the code should ignore it, rather than crashing.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py index c0cecf9..4e381b6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py
@@ -130,8 +130,8 @@ self._current_cmd_line = None self._measurements = {} - if self._port.get_option("profile"): - profiler_name = self._port.get_option("profiler") + if self._port.get_option('profile'): + profiler_name = self._port.get_option('profiler') self._profiler = ProfilerFactory.create_profiler( self._port.host, self._port._path_to_driver(), # pylint: disable=protected-access @@ -178,7 +178,7 @@ self.error_from_test = 'OUTPUT CONTAINS "' + sanitizer + \ '", so we are treating this test as if it crashed, even though it did not.\n\n' + self.error_from_test crashed = True - self._crashed_process_name = "unknown process name" + self._crashed_process_name = 'unknown process name' self._crashed_pid = 0 if stop_when_done or crashed or timed_out or leaked: @@ -197,7 +197,7 @@ # If we don't find a crash log use a placeholder error message instead. if not crash_log: - pid_str = str(self._crashed_pid) if self._crashed_pid else "unknown pid" + pid_str = str(self._crashed_pid) if self._crashed_pid else 'unknown pid' crash_log = 'No crash log found for %s:%s.\n' % (self._crashed_process_name, pid_str) # If we were unresponsive append a message informing there may not have been a crash. if self._subprocess_was_unresponsive: @@ -225,9 +225,9 @@ # used by e.g. tools/valgrind/valgrind_tests.py. return shlex.split(wrapper_option) if wrapper_option else [] - HTTP_DIR = "http/tests/" - HTTP_LOCAL_DIR = "http/tests/local/" - WPT_DIR = "external/wpt/" + HTTP_DIR = 'http/tests/' + HTTP_LOCAL_DIR = 'http/tests/local/' + WPT_DIR = 'external/wpt/' def is_http_test(self, test_name): return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(self.HTTP_LOCAL_DIR) @@ -235,9 +235,9 @@ def _get_http_host_and_ports_for_test(self, test_name): if self._port.should_use_wptserve(test_name): # TODO(burnik): Read from config or args. - return ("web-platform.test", 8001, 8444) + return ('web-platform.test', 8001, 8444) else: - return ("127.0.0.1", 8000, 8443) + return ('127.0.0.1', 8000, 8443) def test_to_uri(self, test_name): """Convert a test name to a URI. @@ -260,9 +260,9 @@ relative_path = test_name[len(test_dir_prefix):] hostname, insecure_port, secure_port = self._get_http_host_and_ports_for_test(test_name) - if "/https/" in test_name or ".https." in test_name: - return "https://%s:%d/%s" % (hostname, secure_port, relative_path) - return "http://%s:%d/%s" % (hostname, insecure_port, relative_path) + if '/https/' in test_name or '.https.' in test_name: + return 'https://%s:%d/%s' % (hostname, secure_port, relative_path) + return 'http://%s:%d/%s' % (hostname, insecure_port, relative_path) def uri_to_test(self, uri): """Return the base layout test name for a given URI. @@ -275,14 +275,14 @@ # This looks like a bit of a hack, since the uri is used instead of test name. hostname, insecure_port, secure_port = self._get_http_host_and_ports_for_test(uri) - if uri.startswith("file:///"): + if uri.startswith('file:///'): prefix = path.abspath_to_uri(self._port.host.platform, self._port.layout_tests_dir()) if not prefix.endswith('/'): prefix += '/' return uri[len(prefix):] - if uri.startswith("http://"): + if uri.startswith('http://'): return uri.replace('http://%s:%d/' % (hostname, insecure_port), self.HTTP_DIR) - if uri.startswith("https://"): + if uri.startswith('https://'): return uri.replace('https://%s:%d/' % (hostname, secure_port), self.HTTP_DIR) raise NotImplementedError('unknown url type: %s' % uri) @@ -320,14 +320,14 @@ self._leak_log = None cmd_line = self.cmd_line(pixel_tests, per_test_args) self._server_process = self._port.server_process_constructor( - self._port, server_name, cmd_line, environment, more_logging=self._port.get_option("driver_logging")) + self._port, server_name, cmd_line, environment, more_logging=self._port.get_option('driver_logging')) self._server_process.start() self._current_cmd_line = cmd_line if wait_for_ready: deadline = time.time() + DRIVER_START_TIMEOUT_SECS if not self._wait_for_server_process_output(self._server_process, deadline, '#READY'): - _log.error("content_shell took too long to startup.") + _log.error('content_shell took too long to startup.') def _wait_for_server_process_output(self, server_process, deadline, text): output = '' @@ -380,13 +380,13 @@ return cmd def _check_for_driver_crash(self, error_line): - if error_line == "#CRASHED\n": + if error_line == '#CRASHED\n': # This is used on Windows to report that the process has crashed # See http://trac.webkit.org/changeset/65537. self._crashed_process_name = self._server_process.name() self._crashed_pid = self._server_process.pid() - elif (error_line.startswith("#CRASHED - ") - or error_line.startswith("#PROCESS UNRESPONSIVE - ")): + elif (error_line.startswith('#CRASHED - ') + or error_line.startswith('#PROCESS UNRESPONSIVE - ')): # WebKitTestRunner uses this to report that the WebProcess subprocess crashed. match = re.match(r'#(?:CRASHED|PROCESS UNRESPONSIVE) - (\S+)', error_line) self._crashed_process_name = match.group(1) if match else 'WebProcess' @@ -395,7 +395,7 @@ self._crashed_pid = pid # FIXME: delete this after we're sure this code is working :) _log.debug('%s crash, pid = %s, error_line = %s', self._crashed_process_name, str(pid), error_line) - if error_line.startswith("#PROCESS UNRESPONSIVE - "): + if error_line.startswith('#PROCESS UNRESPONSIVE - '): self._subprocess_was_unresponsive = True self._port.sample_process(self._crashed_process_name, self._crashed_pid) # We want to show this since it's not a regular crash and probably we don't have a crash log. @@ -404,7 +404,7 @@ return self.has_crashed() def _check_for_leak(self, error_line): - if error_line.startswith("#LEAK - "): + if error_line.startswith('#LEAK - '): self._leaked = True match = re.match(r'#LEAK - (\S+) pid (\d+) (.+)\n', error_line) self._leak_log = match.group(3) @@ -431,7 +431,7 @@ command += "'--pixel-test" if driver_input.image_hash: command += "'" + driver_input.image_hash - return command + "\n" + return command + '\n' def _read_first_block(self, deadline): # returns (text_content, audio_content) @@ -474,10 +474,10 @@ block.content += line def _strip_eof(self, line): - if line and line.endswith("#EOF\n"): + if line and line.endswith('#EOF\n'): return line[:-5], True - if line and line.endswith("#EOF\r\n"): - _log.error("Got a CRLF-terminated #EOF - this is a driver bug.") + if line and line.endswith('#EOF\r\n'): + _log.error('Got a CRLF-terminated #EOF - this is a driver bug.') return line[:-6], True return line, False @@ -509,9 +509,9 @@ err_line, self.err_seen_eof = self._strip_eof(err_line) if out_line: - if out_line[-1] != "\n": + if out_line[-1] != '\n': _log.error( - "Last character read from DRT stdout line was not a newline! This indicates either a NRWT or DRT bug.") + 'Last character read from DRT stdout line was not a newline! This indicates either a NRWT or DRT bug.') content_length_before_header_check = block._content_length self._process_stdout_line(block, out_line) # FIXME: Unlike HTTP, DRT dumps the content right after printing a Content-Length header. @@ -520,7 +520,7 @@ if block._content_length > 0: block.content = self._server_process.read_stdout(deadline, block._content_length) else: - _log.error("Received content of type %s with Content-Length of 0! This indicates a bug in %s.", + _log.error('Received content of type %s with Content-Length of 0! This indicates a bug in %s.', block.content_type, self._server_process.name()) if err_line:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py index d48bd31..11ce6f6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py
@@ -46,11 +46,11 @@ def test_command_wrapper(self): self._assert_wrapper(None, []) - self._assert_wrapper("valgrind", ["valgrind"]) + self._assert_wrapper('valgrind', ['valgrind']) # Validate that shlex works as expected. - command_with_spaces = "valgrind --smc-check=\"check with spaces!\" --foo" - expected_parse = ["valgrind", "--smc-check=check with spaces!", "--foo"] + command_with_spaces = 'valgrind --smc-check=\'check with spaces!\' --foo' + expected_parse = ['valgrind', '--smc-check=check with spaces!', '--foo'] self._assert_wrapper(command_with_spaces, expected_parse) def test_test_to_uri(self): @@ -77,7 +77,7 @@ 'ActualHash: foobar', 'Content-Type: my_type', 'Content-Transfer-Encoding: none', - "#EOF", + '#EOF', ]) content_block = driver._read_block(0) self.assertEqual(content_block.content, '') @@ -94,8 +94,8 @@ 'ExpectedHash: expected', 'Content-Type: image/png', 'Content-Length: 9', - "12345678", - "#EOF", + '12345678', + '#EOF', ]) content_block = driver._read_block(0) self.assertEqual(content_block.content_type, 'image/png')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py index 60a6863..28c22b4 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py
@@ -59,7 +59,7 @@ def __init__(self, host, port_name, **kwargs): super(LinuxPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('linux-') + len('linux-'):] - self._architecture = "x86_64" + self._architecture = 'x86_64' assert self._version in self.SUPPORTED_VERSIONS if not self.get_option('disable_breakpad'): @@ -96,10 +96,10 @@ def path_to_apache(self): # The Apache binary path can vary depending on OS and distribution # See http://wiki.apache.org/httpd/DistrosDefaultLayout - for path in ["/usr/sbin/httpd", "/usr/sbin/apache2"]: + for path in ['/usr/sbin/httpd', '/usr/sbin/apache2']: if self._filesystem.exists(path): return path - _log.error("Could not find apache. Not installed or unknown path.") + _log.error('Could not find apache. Not installed or unknown path.') return None def setup_test_run(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py index 0444b0f7..1705eed 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
@@ -176,7 +176,7 @@ self._driver = self._port.create_driver(0) def run(self): - self._stdout.write("#READY\n") + self._stdout.write('#READY\n') self._stdout.flush() while True: line = self._stdin.readline()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py index ab8887f4..660a676 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -101,7 +101,6 @@ self.assertIn('pretty patches', logs) self.assertIn('build requirements', logs) - def test_default_batch_size(self): port = self.make_port() @@ -157,12 +156,12 @@ def test_diff_image(self): def _path_to_image_diff(): - return "/path/to/image_diff" + return '/path/to/image_diff' port = self.make_port() port._path_to_image_diff = _path_to_image_diff - mock_image_diff = "MOCK Image Diff" + mock_image_diff = 'MOCK Image Diff' def mock_run_command(args): port.host.filesystem.write_binary_file(args[4], mock_image_diff) @@ -170,17 +169,17 @@ # Images are different. port._executive = MockExecutive(run_command_fn=mock_run_command) # pylint: disable=protected-access - self.assertEqual(mock_image_diff, port.diff_image("EXPECTED", "ACTUAL")[0]) + self.assertEqual(mock_image_diff, port.diff_image('EXPECTED', 'ACTUAL')[0]) # Images are the same. port._executive = MockExecutive(exit_code=0) # pylint: disable=protected-access - self.assertEqual(None, port.diff_image("EXPECTED", "ACTUAL")[0]) + self.assertEqual(None, port.diff_image('EXPECTED', 'ACTUAL')[0]) # There was some error running image_diff. port._executive = MockExecutive(exit_code=2) # pylint: disable=protected-access exception_raised = False try: - port.diff_image("EXPECTED", "ACTUAL") + port.diff_image('EXPECTED', 'ACTUAL') except ValueError: exception_raised = True self.assertFalse(exception_raised) @@ -188,7 +187,7 @@ def test_diff_image_crashed(self): port = self.make_port() port._executive = MockExecutive(exit_code=2) # pylint: disable=protected-access - self.assertEqual(port.diff_image("EXPECTED", "ACTUAL"), + self.assertEqual(port.diff_image('EXPECTED', 'ACTUAL'), (None, 'Image diff returned an exit code of 2. See http://crbug.com/278596')) def test_test_configuration(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py index 6795b35d..da9a1f2 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py
@@ -124,14 +124,14 @@ def _start(self): if self._proc: - raise ValueError("%s already running" % self._name) + raise ValueError('%s already running' % self._name) self._reset() # close_fds is a workaround for http://bugs.python.org/issue2320 close_fds = not self._host.platform.is_win() if self._logging: env_str = '' if self._env: - env_str += '\n'.join("%s=%s" % (k, v) for k, v in self._env.items()) + '\n' + env_str += '\n'.join('%s=%s' % (k, v) for k, v in self._env.items()) + '\n' _log.info('CMD: \n%s%s\n', env_str, _quote_cmd(self._cmd)) self._proc = self._host.executive.popen(self._cmd, stdin=self._host.executive.PIPE, stdout=self._host.executive.PIPE,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process_mock.py index 70ac65c..110f7773 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process_mock.py
@@ -53,7 +53,7 @@ return self.crashed def read_stdout_line(self, deadline): - return self.lines.pop(0) + "\n" + return self.lines.pop(0) + '\n' def read_stdout(self, deadline, size): first_line = self.lines[0] @@ -61,8 +61,8 @@ self.lines.pop(0) remaining_size = size - len(first_line) - 1 if not remaining_size: - return first_line + "\n" - return first_line + "\n" + self.read_stdout(deadline, remaining_size) + return first_line + '\n' + return first_line + '\n' + self.read_stdout(deadline, remaining_size) result = self.lines[0][:size] self.lines[0] = self.lines[0][size:] return result
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py index 7c47439..37394d8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py
@@ -49,7 +49,7 @@ def __init__(self, name): self.name = name - self.base = name[(name.rfind("/") + 1):name.rfind(".")] + self.base = name[(name.rfind('/') + 1):name.rfind('.')] self.crash = False self.web_process_crash = False self.exception = False @@ -140,11 +140,11 @@ actual_checksum=None) tests.add('failures/expected/keyboard.html', keyboard=True) tests.add('failures/expected/newlines_leading.html', - expected_text="\nfoo\n", actual_text="foo\n") + expected_text='\nfoo\n', actual_text='foo\n') tests.add('failures/expected/newlines_trailing.html', - expected_text="foo\n\n", actual_text="foo\n") + expected_text='foo\n\n', actual_text='foo\n') tests.add('failures/expected/newlines_with_excess_CR.html', - expected_text="foo\r\r\r\n", actual_text="foo\n") + expected_text='foo\r\r\r\n', actual_text='foo\n') tests.add('failures/expected/text.html', actual_text='text_fail-png') tests.add('failures/expected/crash_then_text.html') tests.add('failures/expected/skip_text.html', actual_text='text diff') @@ -162,9 +162,9 @@ """, expected_text=None) tests.add('failures/unexpected/crash.html', crash=True) tests.add('failures/unexpected/crash-with-stderr.html', crash=True, - error="mock-std-error-output") + error='mock-std-error-output') tests.add('failures/unexpected/web-process-crash-with-stderr.html', web_process_crash=True, - error="mock-std-error-output") + error='mock-std-error-output') tests.add('failures/unexpected/pass.html') tests.add('failures/unexpected/text-checksum.html', actual_text='text-checksum_fail-txt', @@ -454,7 +454,7 @@ if not actual_contents or not expected_contents: return (True, None) if diffed: - return ("< %s\n---\n> %s\n" % (expected_contents, actual_contents), None) + return ('< %s\n---\n> %s\n' % (expected_contents, actual_contents), None) return (None, None) def layout_tests_dir(self): @@ -505,7 +505,7 @@ pass def path_to_apache(self): - return "/usr/sbin/httpd" + return '/usr/sbin/httpd' def path_to_apache_config_file(self): return self._filesystem.join(self.apache_config_directory(), 'httpd.conf')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py index 5a22b8e0..883aaf7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py
@@ -77,7 +77,7 @@ def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] - assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (self._version, self.SUPPORTED_VERSIONS) + assert self._version in self.SUPPORTED_VERSIONS, '%s is not in %s' % (self._version, self.SUPPORTED_VERSIONS) if self.get_option('disable_breakpad'): self._dump_reader = None else: @@ -103,7 +103,7 @@ res = self._check_reg(r'.cgi\Shell\ExecCGI\Command') and res res = self._check_reg(r'.pl\Shell\ExecCGI\Command') and res else: - _log.warning("Could not check the registry; http may not work correctly.") + _log.warning('Could not check the registry; http may not work correctly.') return res @@ -165,12 +165,12 @@ env[key] = value # Put the cygwin directory first in the path to find cygwin1.dll. - env["PATH"] = "%s;%s" % (self.path_from_chromium_base("third_party", "cygwin", "bin"), env["PATH"]) + env['PATH'] = '%s;%s' % (self.path_from_chromium_base('third_party', 'cygwin', 'bin'), env['PATH']) # Configure the cygwin directory so that pywebsocket finds proper # python executable to run cgi program. - env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin", "bin") + env['CYGWIN_PATH'] = self.path_from_chromium_base('third_party', 'cygwin', 'bin') if self.get_option('register_cygwin'): - setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") + setup_mount = self.path_from_chromium_base('third_party', 'cygwin', 'setup_mount.bat') self._executive.run_command([setup_mount]) # Paths are all absolute, so this does not require a cwd. return env @@ -224,7 +224,7 @@ def _check_crash_service_available(self): """Checks whether the crash service binary is present.""" - result = self._check_file_exists(self._path_to_crash_service(), "content_shell_crash_service.exe") + result = self._check_file_exists(self._path_to_crash_service(), 'content_shell_crash_service.exe') if not result: _log.error(" Could not find crash service, unexpected crashes won't be symbolized.") _log.error(' Did you build the target blink_tests?')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py index bbd8205..dec8c057 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py
@@ -47,8 +47,8 @@ output = output_capture.OutputCapture() orig_environ = port.host.environ.copy() env = output.assert_outputs(self, port.setup_environ_for_server) - self.assertEqual(orig_environ["PATH"], port.host.environ.get("PATH")) - self.assertNotEqual(env["PATH"], port.host.environ.get("PATH")) + self.assertEqual(orig_environ['PATH'], port.host.environ.get('PATH')) + self.assertNotEqual(env['PATH'], port.host.environ.get('PATH')) def test_setup_environ_for_server_cygpath(self): port = self.make_port()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times.py index 7b69879..cbda7a76 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times.py
@@ -77,9 +77,9 @@ by_key = times_by_key(times, options.forward, options.backward) for key in sorted(by_key): if key: - host.print_("%s %d" % (key, by_key[key])) + host.print_('%s %d' % (key, by_key[key])) else: - host.print_("%d" % by_key[key]) + host.print_('%d' % by_key[key]) def print_fastest(host, port, options, times): @@ -114,7 +114,7 @@ for k in sorted(fast_tests_by_key): for t in fast_tests_by_key[k]: - host.print_("%s %d" % (t, times[t])) + host.print_('%s %d' % (t, times[t])) return
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times_unittest.py index 485130a..58846372 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/print_layout_test_times_unittest.py
@@ -58,52 +58,52 @@ def test_fastest_overall(self): # This is the fastest 10% of the tests overall (ignoring dir structure, equivalent to -f 0). self.check(['--fastest', '10'], - "bar/bar1/fast5.html 10\n" - "bar/bar1/fast6.html 10\n" - "foo/foo1/fast1.html 10\n") + 'bar/bar1/fast5.html 10\n' + 'bar/bar1/fast6.html 10\n' + 'foo/foo1/fast1.html 10\n') def test_fastest_forward_1(self): # Note that we don't get anything from foo/foo2, as foo/foo1 used up the budget for foo. self.check(['-f', '1', '--fastest', '10'], - "bar/bar1/fast5.html 10\n" - "foo/foo1/fast1.html 10\n" - "foo/foo1/fast2.html 10\n") + 'bar/bar1/fast5.html 10\n' + 'foo/foo1/fast1.html 10\n' + 'foo/foo1/fast2.html 10\n') def test_fastest_back_1(self): # Here we get one test from each dir, showing that we are going properly breadth-first. self.check(['-b', '1', '--fastest', '10'], - "bar/bar1/fast5.html 10\n" - "foo/foo1/fast1.html 10\n" - "foo/foo2/fast3.html 10\n") + 'bar/bar1/fast5.html 10\n' + 'foo/foo1/fast1.html 10\n' + 'foo/foo2/fast3.html 10\n') def test_no_args(self): # This should be every test, sorted lexicographically. self.check([], - "bar/bar1/fast5.html 10\n" - "bar/bar1/fast6.html 10\n" - "bar/bar1/slow3.html 80\n" - "foo/foo1/fast1.html 10\n" - "foo/foo1/fast2.html 10\n" - "foo/foo1/slow1.html 80\n" - "foo/foo2/fast3.html 10\n" - "foo/foo2/fast4.html 10\n" - "foo/foo2/slow2.html 80\n") + 'bar/bar1/fast5.html 10\n' + 'bar/bar1/fast6.html 10\n' + 'bar/bar1/slow3.html 80\n' + 'foo/foo1/fast1.html 10\n' + 'foo/foo1/fast2.html 10\n' + 'foo/foo1/slow1.html 80\n' + 'foo/foo2/fast3.html 10\n' + 'foo/foo2/fast4.html 10\n' + 'foo/foo2/slow2.html 80\n') def test_total(self): - self.check(['-f', '0'], "300\n") + self.check(['-f', '0'], '300\n') def test_forward_one(self): self.check(['-f', '1'], - "bar 100\n" - "foo 200\n") + 'bar 100\n' + 'foo 200\n') def test_backward_one(self): self.check(['-b', '1'], - "bar/bar1 100\n" - "foo/foo1 100\n" - "foo/foo2 100\n") + 'bar/bar1 100\n' + 'foo/foo1 100\n' + 'foo/foo2 100\n') def test_path_to_file(self): # Tests that we can use a custom file rather than the port's default. - self.check(['/tmp/times_ms.json'], "foo/bar.html 1\n", + self.check(['/tmp/times_ms.json'], 'foo/bar.html 1\n', files={'/tmp/times_ms.json': '{"foo":{"bar.html": 1}}'})
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 113c3d3..d4f23c9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -83,383 +83,383 @@ option_group_definitions = [] option_group_definitions.append( - ("Platform options", platform_options())) + ('Platform options', platform_options())) option_group_definitions.append( - ("Configuration options", configuration_options())) + ('Configuration options', configuration_options())) option_group_definitions.append( - ("Printing Options", printing.print_options())) + ('Printing Options', printing.print_options())) option_group_definitions.append( - ("Android-specific Options", [ + ('Android-specific Options', [ optparse.make_option( - "--adb-device", - action="append", + '--adb-device', + action='append', default=[], dest='adb_devices', - help="Run Android layout tests on these devices."), + help='Run Android layout tests on these devices.'), # FIXME: Flip this to be off by default once we can log the # device setup more cleanly. optparse.make_option( - "--no-android-logging", - dest="android_logging", - action="store_false", + '--no-android-logging', + dest='android_logging', + action='store_false', default=True, - help=("Do not log android-specific debug messages (default is to log as part " - "of --debug-rwt-logging")), + help=('Do not log android-specific debug messages (default is to log as part ' + 'of --debug-rwt-logging')), ])) option_group_definitions.append( - ("Results Options", [ + ('Results Options', [ optparse.make_option( - "--add-platform-exceptions", - action="store_true", + '--add-platform-exceptions', + action='store_true', default=False, - help=("Save generated results into the *most-specific-platform* directory rather " - "than the *generic-platform* directory")), + help=('Save generated results into the *most-specific-platform* directory rather ' + 'than the *generic-platform* directory')), optparse.make_option( - "--additional-driver-flag", - "--additional-drt-flag", - dest="additional_driver_flag", - action="append", + '--additional-driver-flag', + '--additional-drt-flag', + dest='additional_driver_flag', + action='append', default=[], - help=("Additional command line flag to pass to the driver. Specify multiple " - "times to add multiple flags.")), + help=('Additional command line flag to pass to the driver. Specify multiple ' + 'times to add multiple flags.')), optparse.make_option( - "--additional-expectations", - action="append", + '--additional-expectations', + action='append', default=[], - help=("Path to a test_expectations file that will override previous " - "expectations. Specify multiple times for multiple sets of overrides.")), + help=('Path to a test_expectations file that will override previous ' + 'expectations. Specify multiple times for multiple sets of overrides.')), optparse.make_option( - "--additional-platform-directory", - action="append", + '--additional-platform-directory', + action='append', default=[], - help=("Additional directory where to look for test baselines (will take " - "precedence over platform baselines). Specify multiple times to add " - "multiple search path entries.")), + help=('Additional directory where to look for test baselines (will take ' + 'precedence over platform baselines). Specify multiple times to add ' + 'multiple search path entries.')), optparse.make_option( - "--build-directory", - help=("Path to the directory under which build files are kept (should not " - "include configuration)")), + '--build-directory', + help=('Path to the directory under which build files are kept (should not ' + 'include configuration)')), optparse.make_option( - "--clobber-old-results", - action="store_true", + '--clobber-old-results', + action='store_true', default=False, - help="Clobbers test results from previous runs."), + help='Clobbers test results from previous runs.'), optparse.make_option( - "--compare-port", - action="store", + '--compare-port', + action='store', default=None, help="Use the specified port's baselines first"), optparse.make_option( - "--driver-name", - type="string", - help="Alternative driver binary to use"), + '--driver-name', + type='string', + help='Alternative driver binary to use'), optparse.make_option( - "--full-results-html", - action="store_true", + '--full-results-html', + action='store_true', default=False, - help="Show all failures in results.html, rather than only regressions"), + help='Show all failures in results.html, rather than only regressions'), optparse.make_option( - "--json-test-results", - action="store", - help="Path to write the JSON test results to."), + '--json-test-results', + action='store', + help='Path to write the JSON test results to.'), optparse.make_option( - "--new-baseline", - action="store_true", + '--new-baseline', + action='store_true', default=False, - help=("Save generated results as new baselines into the *most-specific-platform* " + help=('Save generated results as new baselines into the *most-specific-platform* ' "directory, overwriting whatever's already there. Equivalent to " - "--reset-results --add-platform-exceptions")), + '--reset-results --add-platform-exceptions')), optparse.make_option( - "--new-test-results", - action="store_true", + '--new-test-results', + action='store_true', default=False, - help="Create new baselines when no expected results exist"), + help='Create new baselines when no expected results exist'), optparse.make_option( - "--no-show-results", - dest="show_results", - action="store_false", + '--no-show-results', + dest='show_results', + action='store_false', default=True, help="Don't launch a browser with results after the tests are done"), optparse.make_option( - "-p", - "--pixel", - "--pixel-tests", - dest="pixel_tests", - action="store_true", + '-p', + '--pixel', + '--pixel-tests', + dest='pixel_tests', + action='store_true', default=True, - help="Enable pixel-to-pixel PNG comparisons (enabled by default)"), + help='Enable pixel-to-pixel PNG comparisons (enabled by default)'), optparse.make_option( - "--no-pixel", - "--no-pixel-tests", - dest="pixel_tests", - action="store_false", + '--no-pixel', + '--no-pixel-tests', + dest='pixel_tests', + action='store_false', default=True, - help="Disable pixel-to-pixel PNG comparisons"), + help='Disable pixel-to-pixel PNG comparisons'), # FIXME: we should support a comma separated list with # --pixel-test-directory as well. optparse.make_option( - "--pixel-test-directory", - dest="pixel_test_directories", - action="append", + '--pixel-test-directory', + dest='pixel_test_directories', + action='append', default=[], - help=("A directory where it is allowed to execute tests as pixel tests. Specify " - "multiple times to add multiple directories. This option implies " - "--pixel-tests. If specified, only those tests will be executed as pixel " - "tests that are located in one of the" " directories enumerated with the " - "option. Some ports may ignore this option while others can have a default " - "value that can be overridden here.")), + help=('A directory where it is allowed to execute tests as pixel tests. Specify ' + 'multiple times to add multiple directories. This option implies ' + '--pixel-tests. If specified, only those tests will be executed as pixel ' + 'tests that are located in one of the' ' directories enumerated with the ' + 'option. Some ports may ignore this option while others can have a default ' + 'value that can be overridden here.')), optparse.make_option( - "--reset-results", - action="store_true", + '--reset-results', + action='store_true', default=False, - help="Reset expectations to the generated results in their existing location."), + help='Reset expectations to the generated results in their existing location.'), optparse.make_option( - "--results-directory", - help="Location of test results"), + '--results-directory', + help='Location of test results'), optparse.make_option( - "--skip-failing-tests", - action="store_true", + '--skip-failing-tests', + action='store_true', default=False, - help=("Skip tests that are expected to fail. Note: When using this option, " - "you might miss new crashes in these tests.")), + help=('Skip tests that are expected to fail. Note: When using this option, ' + 'you might miss new crashes in these tests.')), optparse.make_option( - "--smoke", - action="store_true", - help="Run just the SmokeTests"), + '--smoke', + action='store_true', + help='Run just the SmokeTests'), optparse.make_option( - "--no-smoke", - dest="smoke", - action="store_false", - help="Do not run just the SmokeTests"), + '--no-smoke', + dest='smoke', + action='store_false', + help='Do not run just the SmokeTests'), ])) option_group_definitions.append( - ("Testing Options", [ + ('Testing Options', [ optparse.make_option( - "--additional-env-var", - type="string", - action="append", + '--additional-env-var', + type='string', + action='append', default=[], - help=("Passes that environment variable to the tests " - "(--additional-env-var=NAME=VALUE)")), + help=('Passes that environment variable to the tests ' + '(--additional-env-var=NAME=VALUE)')), optparse.make_option( - "--batch-size", - type="int", + '--batch-size', + type='int', default=None, - help=("Run a the tests in batches (n), after every n tests, the driver is " - "relaunched.")), + help=('Run a the tests in batches (n), after every n tests, the driver is ' + 'relaunched.')), optparse.make_option( - "--build", - dest="build", - action="store_true", + '--build', + dest='build', + action='store_true', default=True, - help=("Check to ensure the build is up to date (default).")), + help=('Check to ensure the build is up to date (default).')), optparse.make_option( - "--no-build", - dest="build", - action="store_false", + '--no-build', + dest='build', + action='store_false', help="Don't check to see if the build is up to date."), optparse.make_option( - "--child-processes", - help="Number of drivers to run in parallel."), + '--child-processes', + help='Number of drivers to run in parallel.'), optparse.make_option( - "--disable-breakpad", - action="store_true", + '--disable-breakpad', + action='store_true', help="Don't use breakpad to symbolize unexpected crashes."), optparse.make_option( - "--driver-logging", - action="store_true", - help="Print detailed logging of the driver/content_shell"), + '--driver-logging', + action='store_true', + help='Print detailed logging of the driver/content_shell'), optparse.make_option( - "--enable-leak-detection", - action="store_true", - help="Enable the leak detection of DOM objects."), + '--enable-leak-detection', + action='store_true', + help='Enable the leak detection of DOM objects.'), optparse.make_option( - "--enable-sanitizer", - action="store_true", - help="Only alert on sanitizer-related errors and crashes"), + '--enable-sanitizer', + action='store_true', + help='Only alert on sanitizer-related errors and crashes'), optparse.make_option( - "--exit-after-n-crashes-or-timeouts", - type="int", + '--exit-after-n-crashes-or-timeouts', + type='int', default=None, - help="Exit after the first N crashes instead of running all tests"), + help='Exit after the first N crashes instead of running all tests'), optparse.make_option( - "--exit-after-n-failures", - type="int", + '--exit-after-n-failures', + type='int', default=None, - help="Exit after the first N failures instead of running all tests"), + help='Exit after the first N failures instead of running all tests'), optparse.make_option( - "--ignore-builder-category", - action="store", - help=("The category of builders to use with the --ignore-flaky-tests option " + '--ignore-builder-category', + action='store', + help=('The category of builders to use with the --ignore-flaky-tests option ' "('layout' or 'deps').")), optparse.make_option( - "--ignore-flaky-tests", - action="store", - help=("Control whether tests that are flaky on the bots get ignored. " + '--ignore-flaky-tests', + action='store', + help=('Control whether tests that are flaky on the bots get ignored. ' "'very-flaky' == Ignore any tests that flaked more than once on the bot. " "'maybe-flaky' == Ignore any tests that flaked once on the bot. " "'unexpected' == Ignore any tests that had unexpected results on the bot.")), optparse.make_option( - "--iterations", - type="int", + '--iterations', + type='int', default=1, - help="Number of times to run the set of tests (e.g. ABCABCABC)"), + help='Number of times to run the set of tests (e.g. ABCABCABC)'), optparse.make_option( - "--layout-tests-directory", - help=("Path to a custom layout tests directory")), + '--layout-tests-directory', + help=('Path to a custom layout tests directory')), optparse.make_option( - "--max-locked-shards", - type="int", + '--max-locked-shards', + type='int', default=0, - help="Set the maximum number of locked shards"), + help='Set the maximum number of locked shards'), optparse.make_option( - "--nocheck-sys-deps", - action="store_true", + '--nocheck-sys-deps', + action='store_true', default=False, help="Don't check the system dependencies (themes)"), optparse.make_option( - "--order", - action="store", - default="random", - help=("Determine the order in which the test cases will be run. " + '--order', + action='store', + default='random', + help=('Determine the order in which the test cases will be run. ' "'none' == use the order in which the tests were listed " - "either in arguments or test list, " + 'either in arguments or test list, ' "'random' == pseudo-random order (default). Seed can be specified " - "via --seed, otherwise it will default to the current unix timestamp. " + 'via --seed, otherwise it will default to the current unix timestamp. ' "'natural' == use the natural order")), optparse.make_option( - "--profile", - action="store_true", - help="Output per-test profile information."), + '--profile', + action='store_true', + help='Output per-test profile information.'), optparse.make_option( - "--profiler", - action="store", - help="Output per-test profile information, using the specified profiler."), + '--profiler', + action='store', + help='Output per-test profile information, using the specified profiler.'), optparse.make_option( - "--repeat-each", - type="int", + '--repeat-each', + type='int', default=1, - help="Number of times to run each test (e.g. AAABBBCCC)"), + help='Number of times to run each test (e.g. AAABBBCCC)'), # TODO(joelo): Delete --retry-failures and --no-retry-failures as they # are redundant with --num-retries. optparse.make_option( - "--retry-failures", - action="store_true", - help=("Re-try any tests that produce unexpected results. Default is to not retry " - "if an explicit list of tests is passed to run-webkit-tests.")), + '--retry-failures', + action='store_true', + help=('Re-try any tests that produce unexpected results. Default is to not retry ' + 'if an explicit list of tests is passed to run-webkit-tests.')), optparse.make_option( - "--no-retry-failures", - dest="retry_failures", - action="store_false", + '--no-retry-failures', + dest='retry_failures', + action='store_false', help="Don't re-try any tests that produce unexpected results."), optparse.make_option( - "--num-retries", - type="int", + '--num-retries', + type='int', default=3, - help=("Number of times to retry failures, default is 3. Only relevant when " - "failure retries are enabled.")), + help=('Number of times to retry failures, default is 3. Only relevant when ' + 'failure retries are enabled.')), optparse.make_option( - "--total-shards", + '--total-shards', type=int, help=('Total number of shards being used for this test run. ' 'Must be used with --shard-index. ' '(The user of this script is responsible for spawning ' 'all of the shards.)')), optparse.make_option( - "--shard-index", + '--shard-index', type=int, help=('Shard index [0..total_shards) of this test run. ' 'Must be used with --total-shards.')), optparse.make_option( - "--run-singly", - action="store_true", + '--run-singly', + action='store_true', default=False, - help="DEPRECATED, same as --batch-size=1 --verbose"), + help='DEPRECATED, same as --batch-size=1 --verbose'), optparse.make_option( - "--seed", - type="int", - help=("Seed to use for random test order (default: %default). " - "Only applicable in combination with --order=random.")), + '--seed', + type='int', + help=('Seed to use for random test order (default: %default). ' + 'Only applicable in combination with --order=random.')), optparse.make_option( - "--skipped", - action="store", + '--skipped', + action='store', default=None, - help=("control how tests marked SKIP are run. " + help=('control how tests marked SKIP are run. ' "'default' == Skip tests unless explicitly listed on the command line, " "'ignore' == Run them anyway, " "'only' == only run the SKIP tests, " "'always' == always skip, even if listed on the command line.")), optparse.make_option( - "--fastest", - action="store", - type="float", - help="Run the N% fastest tests as well as any tests listed on the command line"), + '--fastest', + action='store', + type='float', + help='Run the N% fastest tests as well as any tests listed on the command line'), optparse.make_option( - "--test-list", - action="append", - metavar="FILE", - help="read list of tests to run from file"), + '--test-list', + action='append', + metavar='FILE', + help='read list of tests to run from file'), optparse.make_option( - "--time-out-ms", - help="Set the timeout for each test"), + '--time-out-ms', + help='Set the timeout for each test'), optparse.make_option( - "--wrapper", - help=("wrapper command to insert before invocations of the driver; option " + '--wrapper', + help=('wrapper command to insert before invocations of the driver; option ' "is split on whitespace before running. (Example: --wrapper='valgrind " "--smc-check=all')")), # FIXME: Display default number of child processes that will run. optparse.make_option( - "-f", "--fully-parallel", - action="store_true", - help="run all tests in parallel"), + '-f', '--fully-parallel', + action='store_true', + help='run all tests in parallel'), optparse.make_option( - "-i", "--ignore-tests", - action="append", + '-i', '--ignore-tests', + action='append', default=[], - help="directories or test to ignore (may specify multiple times)"), + help='directories or test to ignore (may specify multiple times)'), optparse.make_option( - "-n", "--dry-run", - action="store_true", + '-n', '--dry-run', + action='store_true', default=False, - help="Do everything but actually run the tests or upload results."), + help='Do everything but actually run the tests or upload results.'), ])) # FIXME: Move these into json_results_generator.py. option_group_definitions.append( - ("Result JSON Options", [ + ('Result JSON Options', [ optparse.make_option( - "--build-name", - default="DUMMY_BUILD_NAME", - help="The name of the builder used in its path, e.g. webkit-rel."), + '--build-name', + default='DUMMY_BUILD_NAME', + help='The name of the builder used in its path, e.g. webkit-rel.'), optparse.make_option( - "--step-name", - default="webkit_tests", - help="The name of the step in a build running this script."), + '--step-name', + default='webkit_tests', + help='The name of the step in a build running this script.'), optparse.make_option( - "--build-number", - default="DUMMY_BUILD_NUMBER", - help="The build number of the builder running this script."), + '--build-number', + default='DUMMY_BUILD_NUMBER', + help='The build number of the builder running this script.'), optparse.make_option( - "--builder-name", - default="", - help=("The name of the builder shown on the waterfall running this script " - "e.g. WebKit.")), + '--builder-name', + default='', + help=('The name of the builder shown on the waterfall running this script ' + 'e.g. WebKit.')), optparse.make_option( - "--master-name", - help="The name of the buildbot master."), + '--master-name', + help='The name of the buildbot master.'), optparse.make_option( - "--test-results-server", - default="", - help="If specified, upload results json files to this appengine server."), + '--test-results-server', + default='', + help='If specified, upload results json files to this appengine server.'), optparse.make_option( - "--write-full-results-to", - help=("If specified, copy full_results.json from the results dir to the " - "specified path.")), + '--write-full-results-to', + help=('If specified, copy full_results.json from the results dir to the ' + 'specified path.')), ])) option_parser = optparse.OptionParser() @@ -478,10 +478,10 @@ options.batch_size = port.default_batch_size() if not options.child_processes: - options.child_processes = port.host.environ.get("WEBKIT_TEST_CHILD_PROCESSES", + options.child_processes = port.host.environ.get('WEBKIT_TEST_CHILD_PROCESSES', str(port.default_child_processes())) if not options.max_locked_shards: - options.max_locked_shards = int(port.host.environ.get("WEBKIT_TEST_MAX_LOCKED_SHARDS", + options.max_locked_shards = int(port.host.environ.get('WEBKIT_TEST_MAX_LOCKED_SHARDS', str(port.default_max_locked_shards()))) if not options.configuration: @@ -546,6 +546,7 @@ if not options.seed: options.seed = port.host.time() + def _run_tests(port, options, args, printer): _set_up_derived_options(port, options, args) manager = Manager(port, options, printer) @@ -570,19 +571,19 @@ bot_printer.print_results(run_details) stdout.flush() - _log.debug("Generating dashboard...") + _log.debug('Generating dashboard...') gen_dash_board = DashBoardGenerator(port) gen_dash_board.generate() - _log.debug("Dashboard generated.") + _log.debug('Dashboard generated.') - _log.debug("") - _log.debug("Testing completed, Exit status: %d", run_details.exit_code) + _log.debug('') + _log.debug('Testing completed, Exit status: %d', run_details.exit_code) # Temporary process dump for debugging windows timeout issues, see crbug.com/522396. - _log.debug("") - _log.debug("Process dump:") + _log.debug('') + _log.debug('Process dump:') for process in port.host.executive.process_dump(): - _log.debug("\t%s", process) + _log.debug('\t%s', process) return run_details
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 84fe526..8fa61f5 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
@@ -145,7 +145,7 @@ def parse_full_results(full_results_text): - json_to_eval = full_results_text.replace("ADD_RESULTS(", "").replace(");", "") + json_to_eval = full_results_text.replace('ADD_RESULTS(', '').replace(');', '') compressed_results = json.loads(json_to_eval) return compressed_results @@ -210,7 +210,7 @@ # Ensure the results were written out and displayed. failing_results_text = host.filesystem.read_text_file('/tmp/layout-test-results/failing_results.json') - json_to_eval = failing_results_text.replace("ADD_RESULTS(", "").replace(");", "") + json_to_eval = failing_results_text.replace('ADD_RESULTS(', '').replace(');', '') self.assertEqual(json.loads(json_to_eval), details.summarized_failing_results) json_test_results = host.filesystem.read_text_file('/tmp/json_test_results.json') @@ -811,9 +811,9 @@ host.filesystem.exists('/tmp/layout-test-results/retry_3/failures/unexpected/text-image-checksum-actual.png')) json_string = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json') results = parse_full_results(json_string) - self.assertEqual(results["tests"]["failures"]["unexpected"]["text-image-checksum.html"], - {"expected": "PASS", "actual": "TEXT IMAGE+TEXT IMAGE+TEXT IMAGE+TEXT", "is_unexpected": True}) - self.assertFalse(results["pixel_tests_enabled"]) + self.assertEqual(results['tests']['failures']['unexpected']['text-image-checksum.html'], + {'expected': 'PASS', 'actual': 'TEXT IMAGE+TEXT IMAGE+TEXT IMAGE+TEXT', 'is_unexpected': True}) + self.assertFalse(results['pixel_tests_enabled']) self.assertTrue(details.enabled_pixel_tests_in_retry) def test_retrying_uses_retry_directories(self): @@ -867,9 +867,9 @@ host = MockHost() logging_run(['--no-show-results', 'reftests/foo/'], tests_included=True, host=host) results = parse_full_results(host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')) - self.assertEqual(results["tests"]["reftests"]["foo"]["unlistedtest.html"]["actual"], "MISSING") - self.assertEqual(results["num_regressions"], 5) - self.assertEqual(results["num_flaky"], 0) + self.assertEqual(results['tests']['reftests']['foo']['unlistedtest.html']['actual'], 'MISSING') + self.assertEqual(results['num_regressions'], 5) + self.assertEqual(results['num_flaky'], 0) def test_reftest_crash(self): test_results = get_test_results(['failures/unexpected/crash-reftest.html']) @@ -1052,24 +1052,24 @@ json_string = host.filesystem.read_text_file('/tmp/layout-test-results/failing_results.json') results = parse_full_results(json_string) - self.assertTrue("multiple-match-success.html" not in results["tests"]["reftests"]["foo"]) - self.assertTrue("multiple-mismatch-success.html" not in results["tests"]["reftests"]["foo"]) - self.assertTrue("multiple-both-success.html" not in results["tests"]["reftests"]["foo"]) + self.assertTrue('multiple-match-success.html' not in results['tests']['reftests']['foo']) + self.assertTrue('multiple-mismatch-success.html' not in results['tests']['reftests']['foo']) + self.assertTrue('multiple-both-success.html' not in results['tests']['reftests']['foo']) - self.assertEqual(results["tests"]["reftests"]["foo"]["multiple-match-failure.html"], - {"expected": "PASS", "actual": "IMAGE", "reftest_type": ["=="], "is_unexpected": True}) - self.assertEqual(results["tests"]["reftests"]["foo"]["multiple-mismatch-failure.html"], - {"expected": "PASS", "actual": "IMAGE", "reftest_type": ["!="], "is_unexpected": True}) - self.assertEqual(results["tests"]["reftests"]["foo"]["multiple-both-failure.html"], - {"expected": "PASS", "actual": "IMAGE", "reftest_type": ["==", "!="], "is_unexpected": True}) + self.assertEqual(results['tests']['reftests']['foo']['multiple-match-failure.html'], + {'expected': 'PASS', 'actual': 'IMAGE', 'reftest_type': ['=='], 'is_unexpected': True}) + self.assertEqual(results['tests']['reftests']['foo']['multiple-mismatch-failure.html'], + {'expected': 'PASS', 'actual': 'IMAGE', 'reftest_type': ['!='], 'is_unexpected': True}) + self.assertEqual(results['tests']['reftests']['foo']['multiple-both-failure.html'], + {'expected': 'PASS', 'actual': 'IMAGE', 'reftest_type': ['==', '!='], 'is_unexpected': True}) class RebaselineTest(unittest.TestCase, StreamTestingMixin): def assert_baselines(self, file_list, file_base, extensions, err): - "assert that the file_list contains the baselines.""" + 'assert that the file_list contains the baselines.''' for ext in extensions: - baseline = file_base + "-expected" + ext + baseline = file_base + '-expected' + ext baseline_msg = 'Writing new expected result "%s"\n' % baseline self.assertTrue(any(baseline in f for f in file_list)) self.assert_contains(err, baseline_msg) @@ -1087,7 +1087,7 @@ file_list = host.filesystem.written_files.keys() self.assertEqual(details.exit_code, 0) self.assertEqual(len(file_list), 8) - self.assert_baselines(file_list, "passes/image", [".txt", ".png"], err) + self.assert_baselines(file_list, 'passes/image', ['.txt', '.png'], err) def test_missing_results(self): # Test that we update expectations in place. If the expectation @@ -1101,9 +1101,9 @@ file_list = host.filesystem.written_files.keys() self.assertEqual(details.exit_code, 3) self.assertEqual(len(file_list), 12) - self.assert_baselines(file_list, "failures/unexpected/missing_text", [".txt"], err) - self.assert_baselines(file_list, "platform/test/failures/unexpected/missing_image", [".png"], err) - self.assert_baselines(file_list, "platform/test/failures/unexpected/missing_render_tree_dump", [".txt"], err) + self.assert_baselines(file_list, 'failures/unexpected/missing_text', ['.txt'], err) + self.assert_baselines(file_list, 'platform/test/failures/unexpected/missing_image', ['.png'], err) + self.assert_baselines(file_list, 'platform/test/failures/unexpected/missing_render_tree_dump', ['.txt'], err) def test_new_baseline(self): # Test that we update the platform expectations in the version-specific directories @@ -1116,7 +1116,7 @@ self.assertEqual(details.exit_code, 0) self.assertEqual(len(file_list), 8) self.assert_baselines(file_list, - "platform/test-mac-mac10.10/passes/image", [".txt", ".png"], err) + 'platform/test-mac-mac10.10/passes/image', ['.txt', '.png'], err) def test_reftest_reset_results(self): # Test rebaseline of reftests.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http.py index ad41719..e087e49 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http.py
@@ -56,16 +56,16 @@ server_root = self._filesystem.dirname(self._filesystem.dirname(executable)) test_dir = self._port_obj.layout_tests_dir() - document_root = self._filesystem.join(test_dir, "http", "tests") - forms_test_resources_dir = self._filesystem.join(test_dir, "fast", "forms", "resources") - imported_resources_dir = self._filesystem.join(test_dir, "external", "wpt", "resources") - media_resources_dir = self._filesystem.join(test_dir, "media") - mime_types_path = self._filesystem.join(self._port_obj.apache_config_directory(), "mime.types") - cert_file = self._filesystem.join(self._port_obj.apache_config_directory(), "webkit-httpd.pem") + document_root = self._filesystem.join(test_dir, 'http', 'tests') + forms_test_resources_dir = self._filesystem.join(test_dir, 'fast', 'forms', 'resources') + imported_resources_dir = self._filesystem.join(test_dir, 'external', 'wpt', 'resources') + media_resources_dir = self._filesystem.join(test_dir, 'media') + mime_types_path = self._filesystem.join(self._port_obj.apache_config_directory(), 'mime.types') + cert_file = self._filesystem.join(self._port_obj.apache_config_directory(), 'webkit-httpd.pem') inspector_sources_dir = self._port_obj.inspector_build_directory() - self._access_log_path = self._filesystem.join(output_dir, "access_log.txt") - self._error_log_path = self._filesystem.join(output_dir, "error_log.txt") + self._access_log_path = self._filesystem.join(output_dir, 'access_log.txt') + self._error_log_path = self._filesystem.join(output_dir, 'error_log.txt') self._is_win = self._port_obj.host.platform.is_win() @@ -90,11 +90,11 @@ ] if self._is_win: - start_cmd += ['-c', "ThreadsPerChild %d" % (self._number_of_servers * 8)] + start_cmd += ['-c', 'ThreadsPerChild %d' % (self._number_of_servers * 8)] else: - start_cmd += ['-c', "StartServers %d" % self._number_of_servers, - '-c', "MinSpareServers %d" % self._number_of_servers, - '-c', "MaxSpareServers %d" % self._number_of_servers, + start_cmd += ['-c', 'StartServers %d' % self._number_of_servers, + '-c', 'MinSpareServers %d' % self._number_of_servers, + '-c', 'MaxSpareServers %d' % self._number_of_servers, '-C', 'User "%s"' % self._port_obj.host.environ.get('USERNAME', self._port_obj.host.environ.get('USER', '')), '-k', 'start'] @@ -115,13 +115,13 @@ for mapping in self._mappings: port = mapping['port'] - start_cmd += ['-C', "Listen 127.0.0.1:%d" % port] + start_cmd += ['-C', 'Listen 127.0.0.1:%d' % port] # We listen to both IPv4 and IPv6 loop-back addresses, but ignore # requests to 8000 from random users on network. # See https://bugs.webkit.org/show_bug.cgi?id=37104 if enable_ipv6: - start_cmd += ['-C', "Listen [::1]:%d" % port] + start_cmd += ['-C', 'Listen [::1]:%d' % port] if additional_dirs: self._start_cmd = start_cmd
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_unittest.py index 2422a83..8e1a9a5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_unittest.py
@@ -52,7 +52,7 @@ test_port = test.TestPort(host) host.filesystem.write_text_file(test_port.path_to_apache_config_file(), '') - server = ApacheHTTP(test_port, "/mock/output_dir", additional_dirs=[], number_of_servers=4) + server = ApacheHTTP(test_port, '/mock/output_dir', additional_dirs=[], number_of_servers=4) server._check_that_all_ports_are_available = lambda: True server._is_server_running_on_all_ports = lambda: True server._wait_for_action = fake_pid @@ -63,6 +63,6 @@ server.stop() finally: _, _, logs = oc.restore_output() - self.assertIn("StartServers 4", logs) - self.assertIn("MinSpareServers 4", logs) - self.assertIn("MaxSpareServers 4", logs) + self.assertIn('StartServers 4', logs) + self.assertIn('MinSpareServers 4', logs) + self.assertIn('MaxSpareServers 4', logs)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/pywebsocket.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/pywebsocket.py index a67e3d2..063792b 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/pywebsocket.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/pywebsocket.py
@@ -54,7 +54,7 @@ self._web_socket_tests = self._filesystem.join(self._layout_tests, 'http', 'tests', 'websocket') time_str = time.strftime('%d%b%Y-%H%M%S') log_file_name = _WS_LOG_PREFIX + time_str - self._error_log = self._filesystem.join(self._output_dir, log_file_name + "-err.txt") + self._error_log = self._filesystem.join(self._output_dir, log_file_name + '-err.txt') pywebsocket_base = self._port_obj.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'thirdparty') pywebsocket_script = self._filesystem.join(pywebsocket_base, 'mod_pywebsocket', 'standalone.py')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py index 6ab143752..34ded0f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py
@@ -58,7 +58,7 @@ if self._platform.is_mac() or self._platform.is_linux(): tmpdir = '/tmp' - self._runtime_path = self._filesystem.join(tmpdir, "WebKit") + self._runtime_path = self._filesystem.join(tmpdir, 'WebKit') self._filesystem.maybe_make_directory(self._runtime_path) # Subclasses must override these fields. @@ -102,7 +102,7 @@ self._pid = self._spawn_process() if self._wait_for_action(self._is_server_running_on_all_ports): - _log.debug("%s successfully started (pid = %d)", self._name, self._pid) + _log.debug('%s successfully started (pid = %d)', self._name, self._pid) else: self._log_errors_from_subprocess() self._stop_running_server() @@ -135,9 +135,9 @@ self._pid = None return - _log.debug("Attempting to shut down %s server at pid %d", self._name, self._pid) + _log.debug('Attempting to shut down %s server at pid %d', self._name, self._pid) self._stop_running_server() - _log.debug("%s server at pid %d stopped", self._name, self._pid) + _log.debug('%s server at pid %d stopped', self._name, self._pid) self._pid = None finally: # Make sure we delete the pid file no matter what happens. @@ -234,7 +234,7 @@ while self._port_obj.host.time() - start_time < wait_secs: if action(): return True - _log.debug("Waiting for action: %s", action) + _log.debug('Waiting for action: %s', action) self._port_obj.host.sleep(sleep_secs) return False @@ -246,18 +246,18 @@ if not self._platform.is_win() and not self._executive.check_running_pid(self._pid): _log.debug("Server isn't running at all") self._log_errors_from_subprocess() - raise ServerError("Server exited") + raise ServerError('Server exited') for mapping in self._mappings: s = socket.socket() port = mapping['port'] try: s.connect(('localhost', port)) - _log.debug("Server running on %d", port) + _log.debug('Server running on %d', port) except IOError as error: if error.errno not in (errno.ECONNREFUSED, errno.ECONNRESET): raise - _log.debug("Server NOT running on %d: %s", port, error) + _log.debug('Server NOT running on %d: %s', port, error) return False finally: s.close()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py index 5c32387..0ade6bf 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py
@@ -43,7 +43,7 @@ help='Open results dashboard for all removed lines') args = parser.parse_args(argv) - logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO, format="%(levelname)s: %(message)s") + logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO, format='%(levelname)s: %(message)s') port = host.port_factory.get() expectations_file = port.path_to_generic_test_expectations_file()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py index a3f3c76..13817716 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py
@@ -123,10 +123,10 @@ def _assert_expectations_match(self, expectations, expected_string): self.assertIsNotNone(expectations) - stringified_expectations = "\n".join( + stringified_expectations = '\n'.join( x.to_string() for x in expectations) - expected_string = "\n".join( - x.strip() for x in expected_string.split("\n")) + expected_string = '\n'.join( + x.strip() for x in expected_string.split('\n')) self.assertEqual(stringified_expectations, expected_string) def _parse_expectations(self, expectations): @@ -171,9 +171,9 @@ Bug(test) test/f.html [ NeedsRebaseline ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -182,12 +182,12 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS"], - "test/b.html": ["PASS", "PASS"], - "test/c.html": ["PASS", "PASS"], - "test/d.html": ["PASS", "PASS"], - "test/e.html": ["PASS", "PASS"], - "test/f.html": ["PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS'], + 'test/d.html': ['PASS', 'PASS'], + 'test/e.html': ['PASS', 'PASS'], + 'test/f.html': ['PASS', 'PASS'], } } updated_expectations = ( @@ -202,9 +202,9 @@ Bug(test) test/ [ Failure Pass ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -213,12 +213,12 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS"], - "test/b.html": ["PASS", "PASS"], - "test/c.html": ["PASS", "PASS"], - "test/d.html": ["PASS", "PASS"], - "test/e.html": ["PASS", "PASS"], - "test/f.html": ["PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS'], + 'test/d.html': ['PASS', 'PASS'], + 'test/e.html': ['PASS', 'PASS'], + 'test/f.html': ['PASS', 'PASS'], } } updated_expectations = ( @@ -240,9 +240,9 @@ Bug(test) test/c.html [ Skip ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -251,8 +251,8 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE"], + 'test/a.html': ['PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE'], } } updated_expectations = ( @@ -270,9 +270,9 @@ Bug(test) test/c.html [ Failure NeedsManualRebaseline Pass ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -281,9 +281,9 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS"], - "test/b.html": ["PASS", "PASS"], - "test/c.html": ["PASS", "PASS"] + 'test/a.html': ['PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS'] } } updated_expectations = ( @@ -304,9 +304,9 @@ Bug(test) test/f.html [ Failure Pass ]""") self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -315,12 +315,12 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "IMAGE"], - "test/b.html": ["PASS", "TEXT"], - "test/c.html": ["PASS", "IMAGE+TEXT"], - "test/d.html": ["PASS", "AUDIO"], - "test/e.html": ["PASS", "CRASH"], - "test/f.html": ["PASS", "TIMEOUT"], + 'test/a.html': ['PASS', 'IMAGE'], + 'test/b.html': ['PASS', 'TEXT'], + 'test/c.html': ['PASS', 'IMAGE+TEXT'], + 'test/d.html': ['PASS', 'AUDIO'], + 'test/e.html': ['PASS', 'CRASH'], + 'test/f.html': ['PASS', 'TIMEOUT'], } } updated_expectations = ( @@ -348,9 +348,9 @@ Bug(test) test/c.html [ Crash Pass ]""") self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -359,9 +359,9 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "CRASH", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'CRASH', 'PASS'], } } updated_expectations = ( @@ -377,9 +377,9 @@ Bug(test) test/a.html [ Failure Pass ]""") self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -388,7 +388,7 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["IMAGE", "IMAGE", "IMAGE"], + 'test/a.html': ['IMAGE', 'IMAGE', 'IMAGE'], } } updated_expectations = ( @@ -399,12 +399,12 @@ def test_empty_test_expectations(self): """Running on an empty TestExpectations file outputs an empty file.""" - test_expectations_before = "" + test_expectations_before = '' self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -413,12 +413,12 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], } } updated_expectations = ( self._flake_remover.get_updated_test_expectations()) - self._assert_expectations_match(updated_expectations, "") + self._assert_expectations_match(updated_expectations, '') def test_basic_multiple_builders(self): """Tests basic functionality with multiple builders.""" @@ -431,13 +431,13 @@ Bug(test) test/c.html [ Failure Pass ]""") self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Mac10.10": { - "port_name": "mac-mac10.10", - "specifiers": ['Mac10.10', 'Release'] + 'WebKit Mac10.10': { + 'port_name': 'mac-mac10.10', + 'specifiers': ['Mac10.10', 'Release'] }, }) @@ -448,14 +448,14 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["AUDIO", "AUDIO", "AUDIO"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['AUDIO', 'AUDIO', 'AUDIO'], }, 'WebKit Mac10.10': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "IMAGE"], - "test/c.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'IMAGE'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], }, } updated_expectations = ( @@ -479,17 +479,17 @@ Bug(test) [ Mac ] test/d.html [ Failure Pass ]""") self._define_builders({ - "WebKit Win7": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Release'] + 'WebKit Win7': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Release'] }, - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Mac10.10": { - "port_name": "mac-mac10.10", - "specifiers": ['Mac10.10', 'Release'] + 'WebKit Mac10.10': { + 'port_name': 'mac-mac10.10', + 'specifiers': ['Mac10.10', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -500,22 +500,22 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["IMAGE", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['IMAGE', 'PASS', 'PASS'], }, 'WebKit Mac10.10': { - "test/a.html": ["PASS", "PASS", "IMAGE"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "IMAGE", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'IMAGE'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'IMAGE', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Win7': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["IMAGE", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["IMAGE", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['IMAGE', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['IMAGE', 'PASS', 'PASS'], }, } updated_expectations = ( @@ -541,21 +541,21 @@ Bug(test) [ Linux ] test/e.html [ Failure Pass ]""") self._define_builders({ - "WebKit Win7": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Release'] + 'WebKit Win7': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Release'] }, - "WebKit Win7 (dbg)": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Debug'] + 'WebKit Win7 (dbg)': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Debug'] }, - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Linux Trusty (dbg)": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Debug'] + 'WebKit Linux Trusty (dbg)': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Debug'] }, }) self._port.all_build_types = ('release', 'debug') @@ -565,32 +565,32 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "IMAGE", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], - "test/e.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'IMAGE', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], + 'test/e.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Linux Trusty (dbg)': { - "test/a.html": ["PASS", "IMAGE", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["IMAGE", "PASS", "PASS"], - "test/e.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'IMAGE', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['IMAGE', 'PASS', 'PASS'], + 'test/e.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Win7 (dbg)': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["PASS", "IMAGE", "PASS"], - "test/e.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['PASS', 'IMAGE', 'PASS'], + 'test/e.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Win7': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "IMAGE"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["PASS", "IMAGE", "PASS"], - "test/e.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'IMAGE'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['PASS', 'IMAGE', 'PASS'], + 'test/e.html': ['PASS', 'PASS', 'PASS'], }, } updated_expectations = ( @@ -643,9 +643,9 @@ Bug(test) test/e.html [ Failure Pass ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -654,11 +654,11 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "IMAGE", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], - "test/e.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'IMAGE', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], + 'test/e.html': ['PASS', 'PASS', 'PASS'], } } updated_expectations = ( @@ -693,9 +693,9 @@ Bug(test) test/e.html [ Crash Pass ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -749,9 +749,9 @@ Bug(test) [ Linux Release ] test/e.html [ Failure Pass ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) @@ -764,11 +764,11 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "IMAGE", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], - "test/e.html": ["PASS", "IMAGE", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'IMAGE', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], + 'test/e.html': ['PASS', 'IMAGE', 'PASS'], } } @@ -817,21 +817,21 @@ Bug(test) [ Linux ] test/d.html [ Failure ]""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Linux Trusty (dbg)": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Debug'] + 'WebKit Linux Trusty (dbg)': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Debug'] }, - "WebKit Win7": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Release'] + 'WebKit Win7': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Release'] }, - "WebKit Win7 (dbg)": { - "port_name": "win-win7", - "specifiers": ['Win7', 'Debug'] + 'WebKit Win7 (dbg)': { + 'port_name': 'win-win7', + 'specifiers': ['Win7', 'Debug'] }, }) @@ -849,16 +849,16 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Win7 (dbg)': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], }, } @@ -880,13 +880,13 @@ """Tests that the call harness updates the TestExpectations file.""" self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Linux Trusty (dbg)": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Debug'] + 'WebKit Linux Trusty (dbg)': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Debug'] }, }) @@ -919,16 +919,16 @@ expectation_factory = FakeBotTestExpectationsFactory() expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Linux Trusty (dbg)': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "PASS", "PASS"], - "test/c.html": ["PASS", "PASS", "PASS"], - "test/d.html": ["IMAGE", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'PASS', 'PASS'], + 'test/c.html': ['PASS', 'PASS', 'PASS'], + 'test/d.html': ['IMAGE', 'PASS', 'PASS'], }, } @@ -979,13 +979,13 @@ """ self._define_builders({ - "WebKit Linux Trusty": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux Trusty': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, - "WebKit Linux Trusty (dbg)": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Debug'] + 'WebKit Linux Trusty (dbg)': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Debug'] }, }) @@ -1013,10 +1013,10 @@ expectation_factory = FakeBotTestExpectationsFactory() expectation_factory.all_results_by_builder = { 'WebKit Linux Trusty': { - "test/a.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], }, 'WebKit Linux Trusty (dbg)': { - "test/a.html": ["PASS", "PASS", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], }, } @@ -1041,9 +1041,9 @@ Bug(test) test/c.html [ Crash Pass ]""") self._define_builders({ - "WebKit Linux": { - "port_name": "linux-trusty", - "specifiers": ['Trusty', 'Release'] + 'WebKit Linux': { + 'port_name': 'linux-trusty', + 'specifiers': ['Trusty', 'Release'] }, }) self._port.all_build_types = ('release',) @@ -1052,9 +1052,9 @@ self._parse_expectations(test_expectations_before) self._expectation_factory.all_results_by_builder = { 'WebKit Linux': { - "test/a.html": ["PASS", "PASS", "PASS"], - "test/b.html": ["PASS", "IMAGE", "PASS"], - "test/c.html": ["PASS", "CRASH", "PASS"], + 'test/a.html': ['PASS', 'PASS', 'PASS'], + 'test/b.html': ['PASS', 'IMAGE', 'PASS'], + 'test/c.html': ['PASS', 'CRASH', 'PASS'], } } self._flake_remover.show_removed_results()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results.py index 9f7c398..e45f283 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/buildbot_results.py
@@ -58,22 +58,22 @@ if total > 0: percent_passed = float(passed) * 100 / total - self._print("=> Results: %d/%d tests passed (%.1f%%)" % (passed, total, percent_passed)) - self._print("") - self._print_run_results_entry(run_results, test_expectations.NOW, "Tests to be fixed") + self._print('=> Results: %d/%d tests passed (%.1f%%)' % (passed, total, percent_passed)) + self._print('') + self._print_run_results_entry(run_results, test_expectations.NOW, 'Tests to be fixed') - self._print("") + self._print('') # FIXME: We should be skipping anything marked WONTFIX, so we shouldn't bother logging these stats. self._print_run_results_entry(run_results, test_expectations.WONTFIX, - "Tests that will only be fixed if they crash (WONTFIX)") - self._print("") + 'Tests that will only be fixed if they crash (WONTFIX)') + self._print('') def _print_run_results_entry(self, run_results, timeline, heading): total = len(run_results.tests_by_timeline[timeline]) not_passing = (total - len(run_results.tests_by_expectation[test_expectations.PASS] & run_results.tests_by_timeline[timeline])) - self._print("=> %s (%d):" % (heading, not_passing)) + self._print('=> %s (%d):' % (heading, not_passing)) for result in TestExpectations.EXPECTATION_DESCRIPTIONS.keys(): if result in (test_expectations.PASS, test_expectations.SKIP): @@ -82,7 +82,7 @@ desc = TestExpectations.EXPECTATION_DESCRIPTIONS[result] if not_passing and len(results): pct = len(results) * 100.0 / not_passing - self._print(" %5d %-24s (%4.1f%%)" % (len(results), desc, pct)) + self._print(' %5d %-24s (%4.1f%%)' % (len(results), desc, pct)) def print_unexpected_results(self, summarized_results, enabled_pixel_tests_in_retry=False): passes = {} @@ -94,8 +94,8 @@ def add_result(result): test = result.test_name() - actual = result.actual_results().split(" ") - expected = result.expected_results().split(" ") + actual = result.actual_results().split(' ') + expected = result.expected_results().split(' ') if result.did_run_as_expected(): # Don't print anything for tests that ran as expected. @@ -120,47 +120,47 @@ test_results.for_each_test(add_result) if len(passes) or len(flaky) or len(regressions): - self._print("") + self._print('') if len(passes): for key, tests in passes.iteritems(): - self._print("%s: (%d)" % (key, len(tests))) + self._print('%s: (%d)' % (key, len(tests))) tests.sort() for test in tests: - self._print(" %s" % test) - self._print("") - self._print("") + self._print(' %s' % test) + self._print('') + self._print('') if len(flaky): descriptions = TestExpectations.EXPECTATION_DESCRIPTIONS for key, tests in flaky.iteritems(): result_type = TestExpectations.EXPECTATIONS[key.lower()] - self._print("Unexpected flakiness: %s (%d)" % (descriptions[result_type], len(tests))) + self._print('Unexpected flakiness: %s (%d)' % (descriptions[result_type], len(tests))) tests.sort() for test in tests: result = test_results.result_for_test(test) - actual = result.actual_results().split(" ") - expected = result.expected_results().split(" ") + actual = result.actual_results().split(' ') + expected = result.expected_results().split(' ') # FIXME: clean this up once the old syntax is gone new_expectations_list = [TestExpectationLine.inverted_expectation_tokens[exp] for exp in list(set(actual) | set(expected))] - self._print(" %s [ %s ]" % (test, " ".join(new_expectations_list))) - self._print("") - self._print("") + self._print(' %s [ %s ]' % (test, ' '.join(new_expectations_list))) + self._print('') + self._print('') if len(regressions): descriptions = TestExpectations.EXPECTATION_DESCRIPTIONS for key, tests in regressions.iteritems(): result_type = TestExpectations.EXPECTATIONS[key.lower()] - self._print("Regressions: Unexpected %s (%d)" % (descriptions[result_type], len(tests))) + self._print('Regressions: Unexpected %s (%d)' % (descriptions[result_type], len(tests))) tests.sort() for test in tests: result = test_results.result_for_test(test) - actual = result.actual_results().split(" ") - expected = result.expected_results().split(" ") + actual = result.actual_results().split(' ') + expected = result.expected_results().split(' ') new_expectations_list = [TestExpectationLine.inverted_expectation_tokens[exp] for exp in actual] - self._print(" %s [ %s ]" % (test, " ".join(new_expectations_list))) - self._print("") + self._print(' %s [ %s ]' % (test, ' '.join(new_expectations_list))) + self._print('') if len(summarized_results['tests']) and self.debug_logging: - self._print("%s" % ("-" * 78)) + self._print('%s' % ('-' * 78))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing.py index 3f281ba..836ceb5 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing.py
@@ -75,27 +75,27 @@ def print_config(self, results_directory): self._print_default("Using port '%s'" % self._port.name()) - self._print_default("Test configuration: %s" % self._port.test_configuration()) - self._print_default("View the test results at file://%s/results.html" % results_directory) - self._print_default("View the archived results dashboard at file://%s/dashboard.html" % results_directory) + self._print_default('Test configuration: %s' % self._port.test_configuration()) + self._print_default('View the test results at file://%s/results.html' % results_directory) + self._print_default('View the archived results dashboard at file://%s/dashboard.html' % results_directory) if self._options.order == 'random': - self._print_default("Using random order with seed: %d" % self._options.seed) + self._print_default('Using random order with seed: %d' % self._options.seed) # FIXME: should these options be in printing_options? if self._options.new_baseline: - self._print_default("Placing new baselines in %s" % self._port.baseline_version_dir()) + self._print_default('Placing new baselines in %s' % self._port.baseline_version_dir()) fs = self._port.host.filesystem fallback_path = [fs.split(x)[1] for x in self._port.baseline_search_path()] - self._print_default("Baseline search path: %s -> generic" % " -> ".join(fallback_path)) + self._print_default('Baseline search path: %s -> generic' % ' -> '.join(fallback_path)) - self._print_default("Using %s build" % self._options.configuration) + self._print_default('Using %s build' % self._options.configuration) if self._options.pixel_tests: - self._print_default("Pixel tests enabled") + self._print_default('Pixel tests enabled') else: - self._print_default("Pixel tests disabled") + self._print_default('Pixel tests disabled') - self._print_default("Regular timeout: %s, slow test timeout: %s" % + self._print_default('Regular timeout: %s, slow test timeout: %s' % (self._options.time_out_ms, self._options.slow_time_out_ms)) self._print_default('Command line: ' + ' '.join(self._port.driver_cmd_line())) @@ -112,19 +112,19 @@ self._print_default(found_str + '.') def print_expected(self, run_results, tests_with_result_type_callback): - self._print_expected_results_of_type(run_results, test_expectations.PASS, "passes", tests_with_result_type_callback) - self._print_expected_results_of_type(run_results, test_expectations.FAIL, "failures", tests_with_result_type_callback) - self._print_expected_results_of_type(run_results, test_expectations.FLAKY, "flaky", tests_with_result_type_callback) + self._print_expected_results_of_type(run_results, test_expectations.PASS, 'passes', tests_with_result_type_callback) + self._print_expected_results_of_type(run_results, test_expectations.FAIL, 'failures', tests_with_result_type_callback) + self._print_expected_results_of_type(run_results, test_expectations.FLAKY, 'flaky', tests_with_result_type_callback) self._print_debug('') def print_workers_and_shards(self, num_workers, num_shards, num_locked_shards): driver_name = self._port.driver_name() if num_workers == 1: - self._print_default("Running 1 %s." % driver_name) - self._print_debug("(%s)." % grammar.pluralize('shard', num_shards)) + self._print_default('Running 1 %s.' % driver_name) + self._print_debug('(%s).' % grammar.pluralize('shard', num_shards)) else: - self._print_default("Running %d %ss in parallel." % (num_workers, driver_name)) - self._print_debug("(%d shards; %d locked)." % (num_shards, num_locked_shards)) + self._print_default('Running %d %ss in parallel.' % (num_workers, driver_name)) + self._print_debug('(%d shards; %d locked).' % (num_shards, num_locked_shards)) self._print_default('') def _print_expected_results_of_type(self, run_results, result_type, result_type_str, tests_with_result_type_callback): @@ -134,7 +134,7 @@ # We use a fancy format string in order to print the data out in a # nicely-aligned table. - fmtstr = ("Expect: %%5d %%-8s (%%%dd now, %%%dd wontfix)" + fmtstr = ('Expect: %%5d %%-8s (%%%dd now, %%%dd wontfix)' % (self._num_digits(now), self._num_digits(wontfix))) self._print_debug(fmtstr % (len(tests), result_type_str, len(tests & now), len(tests & wontfix))) @@ -149,9 +149,9 @@ self._print_one_line_summary(run_time, run_results) def _print_timing_statistics(self, total_time, run_results): - self._print_debug("Test timing:") - self._print_debug(" %6.2f total testing time" % total_time) - self._print_debug("") + self._print_debug('Test timing:') + self._print_debug(' %6.2f total testing time' % total_time) + self._print_debug('') self._print_worker_statistics(run_results, int(self._options.child_processes)) self._print_aggregate_test_statistics(run_results) @@ -159,7 +159,7 @@ self._print_directory_timings(run_results) def _print_worker_statistics(self, run_results, num_workers): - self._print_debug("Thread timing:") + self._print_debug('Thread timing:') stats = {} cuml_time = 0 for result in run_results.results_by_name.values(): @@ -169,14 +169,14 @@ cuml_time += result.total_run_time for worker_name in stats: - self._print_debug(" %10s: %5d tests, %6.2f secs" % (worker_name, stats[ + self._print_debug(' %10s: %5d tests, %6.2f secs' % (worker_name, stats[ worker_name]['num_tests'], stats[worker_name]['total_time'])) - self._print_debug(" %6.2f cumulative, %6.2f optimal" % (cuml_time, cuml_time / num_workers)) - self._print_debug("") + self._print_debug(' %6.2f cumulative, %6.2f optimal' % (cuml_time, cuml_time / num_workers)) + self._print_debug('') def _print_aggregate_test_statistics(self, run_results): times_for_dump_render_tree = [result.test_run_time for result in run_results.results_by_name.values()] - self._print_statistics_for_test_timings("PER TEST TIME IN TESTSHELL (seconds):", times_for_dump_render_tree) + self._print_statistics_for_test_timings('PER TEST TIME IN TESTSHELL (seconds):', times_for_dump_render_tree) def _print_individual_test_times(self, run_results): # Reverse-sort by the time spent in the driver. @@ -205,25 +205,25 @@ num_printed = num_printed + 1 unexpected_slow_tests.append(test_tuple) - self._print_debug("") + self._print_debug('') if unexpected_slow_tests: - self._print_test_list_timing("%s slowest tests that are not marked as SLOW and did not timeout/crash:" % + self._print_test_list_timing('%s slowest tests that are not marked as SLOW and did not timeout/crash:' % NUM_SLOW_TESTS_TO_LOG, unexpected_slow_tests) - self._print_debug("") + self._print_debug('') if slow_tests: - self._print_test_list_timing("Tests marked as SLOW:", slow_tests) - self._print_debug("") + self._print_test_list_timing('Tests marked as SLOW:', slow_tests) + self._print_debug('') if timeout_or_crash_tests: - self._print_test_list_timing("Tests that timed out or crashed:", timeout_or_crash_tests) - self._print_debug("") + self._print_test_list_timing('Tests that timed out or crashed:', timeout_or_crash_tests) + self._print_debug('') def _print_test_list_timing(self, title, test_list): self._print_debug(title) for test_tuple in test_list: test_run_time = round(test_tuple.test_run_time, 1) - self._print_debug(" %s took %s seconds" % (test_tuple.test_name, test_run_time)) + self._print_debug(' %s took %s seconds' % (test_tuple.test_name, test_run_time)) def _print_directory_timings(self, run_results): stats = {} @@ -245,10 +245,10 @@ timings.sort() - self._print_debug("Time to process slowest subdirectories:") + self._print_debug('Time to process slowest subdirectories:') for timing in timings: - self._print_debug(" %s took %s seconds to run %s tests." % timing) - self._print_debug("") + self._print_debug(' %s took %s seconds to run %s tests.' % timing) + self._print_debug('') def _print_statistics_for_test_timings(self, title, timings): self._print_debug(title) @@ -273,12 +273,12 @@ sum_of_deviations = math.pow(timing - mean, 2) std_deviation = math.sqrt(sum_of_deviations / num_tests) - self._print_debug(" Median: %6.3f" % median) - self._print_debug(" Mean: %6.3f" % mean) - self._print_debug(" 90th percentile: %6.3f" % percentile90) - self._print_debug(" 99th percentile: %6.3f" % percentile99) - self._print_debug(" Standard dev: %6.3f" % std_deviation) - self._print_debug("") + self._print_debug(' Median: %6.3f' % median) + self._print_debug(' Mean: %6.3f' % mean) + self._print_debug(' 90th percentile: %6.3f' % percentile90) + self._print_debug(' 99th percentile: %6.3f' % percentile99) + self._print_debug(' Standard dev: %6.3f' % std_deviation) + self._print_debug('') def _print_one_line_summary(self, total_time, run_results): if self._options.timing: @@ -300,11 +300,11 @@ incomplete = total - expected - unexpected incomplete_str = '' if incomplete: - self._print_default("") + self._print_default('') incomplete_str = " (%d didn't run)" % incomplete if self._options.verbose or self._options.debug_rwt_logging or unexpected: - self.writeln("") + self.writeln('') expected_summary_str = '' if run_results.expected_failures > 0: @@ -315,18 +315,18 @@ if unexpected == 0: if expected == total: if expected > 1: - summary = "All %d tests ran as expected%s%s." % (expected, expected_summary_str, timing_summary) + summary = 'All %d tests ran as expected%s%s.' % (expected, expected_summary_str, timing_summary) else: - summary = "The test ran as expected%s%s." % (expected_summary_str, timing_summary) + summary = 'The test ran as expected%s%s.' % (expected_summary_str, timing_summary) else: - summary = "%s ran as expected%s%s%s." % (grammar.pluralize( + summary = '%s ran as expected%s%s%s.' % (grammar.pluralize( 'test', expected), expected_summary_str, incomplete_str, timing_summary) else: summary = "%s ran as expected%s, %d didn't%s%s:" % (grammar.pluralize( 'test', expected), expected_summary_str, unexpected, incomplete_str, timing_summary) self._print_quiet(summary) - self._print_quiet("") + self._print_quiet('') def _test_status_line(self, test_name, suffix): format_string = '[%d/%d] %s%s'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py index d0343cb..233e2ec 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py
@@ -150,9 +150,9 @@ run_results = FakeRunResults() run_results.results_by_name = { - "slowShard": FakeShard("slowShard", 16), - "borderlineShard": FakeShard("borderlineShard", 15), - "fastShard": FakeShard("fastShard", 1), + 'slowShard': FakeShard('slowShard', 16), + 'borderlineShard': FakeShard('borderlineShard', 15), + 'fastShard': FakeShard('fastShard', 1), } printer._print_directory_timings(run_results) @@ -163,8 +163,8 @@ printer._options.debug_rwt_logging = True run_results.results_by_name = { - "borderlineShard": FakeShard("borderlineShard", 15), - "fastShard": FakeShard("fastShard", 1), + 'borderlineShard': FakeShard('borderlineShard', 15), + 'fastShard': FakeShard('fastShard', 1), } printer._print_directory_timings(run_results) @@ -179,17 +179,17 @@ self.assertWritten(err, result) # Without times: - run_test(1, 1, 0, [], ["The test ran as expected.\n", "\n"]) - run_test(2, 1, 1, [], ["\n", "1 test ran as expected, 1 didn't:\n", "\n"]) - run_test(3, 2, 1, [], ["\n", "2 tests ran as expected, 1 didn't:\n", "\n"]) - run_test(3, 2, 0, [], ["\n", "2 tests ran as expected (1 didn't run).\n", "\n"]) + run_test(1, 1, 0, [], ['The test ran as expected.\n', '\n']) + run_test(2, 1, 1, [], ['\n', "1 test ran as expected, 1 didn't:\n", '\n']) + run_test(3, 2, 1, [], ['\n', "2 tests ran as expected, 1 didn't:\n", '\n']) + run_test(3, 2, 0, [], ['\n', "2 tests ran as expected (1 didn't run).\n", '\n']) # With times: - fake_shards = [FakeShard("foo", 1), FakeShard("bar", 2)] - run_test(1, 1, 0, fake_shards, ["The test ran as expected in 5.00s (2.00s in rwt, 1x).\n", "\n"]) - run_test(2, 1, 1, fake_shards, ["\n", "1 test ran as expected, 1 didn't in 5.00s (2.00s in rwt, 1x):\n", "\n"]) - run_test(3, 2, 1, fake_shards, ["\n", "2 tests ran as expected, 1 didn't in 5.00s (2.00s in rwt, 1x):\n", "\n"]) - run_test(3, 2, 0, fake_shards, ["\n", "2 tests ran as expected (1 didn't run) in 5.00s (2.00s in rwt, 1x).\n", "\n"]) + fake_shards = [FakeShard('foo', 1), FakeShard('bar', 2)] + run_test(1, 1, 0, fake_shards, ['The test ran as expected in 5.00s (2.00s in rwt, 1x).\n', '\n']) + run_test(2, 1, 1, fake_shards, ['\n', "1 test ran as expected, 1 didn't in 5.00s (2.00s in rwt, 1x):\n", '\n']) + run_test(3, 2, 1, fake_shards, ['\n', "2 tests ran as expected, 1 didn't in 5.00s (2.00s in rwt, 1x):\n", '\n']) + run_test(3, 2, 0, fake_shards, ['\n', "2 tests ran as expected (1 didn't run) in 5.00s (2.00s in rwt, 1x).\n", '\n']) def test_test_status_line(self): printer, _ = self.get_printer() @@ -234,15 +234,15 @@ self.reset(err) printer.print_found(100, 100, 10, 1, 1) - self.assertWritten(err, ["Found 100 tests; running 10, skipping 90.\n"]) + self.assertWritten(err, ['Found 100 tests; running 10, skipping 90.\n']) self.reset(err) printer.print_found(100, 20, 10, 1, 1) - self.assertWritten(err, ["Found 20 tests (total 100); running 10, skipping 10.\n"]) + self.assertWritten(err, ['Found 20 tests (total 100); running 10, skipping 10.\n']) self.reset(err) printer.print_found(100, 100, 10, 2, 3) - self.assertWritten(err, ["Found 100 tests; running 10 (6 times each: --repeat-each=2 --iterations=3), skipping 90.\n"]) + self.assertWritten(err, ['Found 100 tests; running 10 (6 times each: --repeat-each=2 --iterations=3), skipping 90.\n']) def test_debug_rwt_logging_is_throttled(self): printer, err = self.get_printer(['--debug-rwt-logging'])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py index d02afcb..0641a19 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py
@@ -175,9 +175,9 @@ [ERROR:main.cc] The sky has fallen""") test._filter_output(output_with_lines_to_ignore) self.assertEqual(output_with_lines_to_ignore.error, - "Should not be ignored\n" - "[WARNING:chrome.cc] Something went wrong\n" - "[ERROR:main.cc] The sky has fallen") + 'Should not be ignored\n' + '[WARNING:chrome.cc] Something went wrong\n' + '[ERROR:main.cc] The sky has fallen') def test_parse_output_with_subtests(self): output = DriverOutput("""
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 96b503a..cde3eb6 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
@@ -538,9 +538,9 @@ return logs _event_target_wrapper_and_inspector_results = { - "Bindings": { - "url": "https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/PerformanceTests/Bindings", - "tests": {"event-target-wrapper": EventTargetWrapperTestData.results} + 'Bindings': { + 'url': 'https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/PerformanceTests/Bindings', + 'tests': {'event-target-wrapper': EventTargetWrapperTestData.results} } } @@ -549,8 +549,8 @@ '--test-results-server=some.host']) self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True) self.assertEqual(self._load_output_json(runner), [{ - "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + 'buildTime': '2013-02-08T15:19:37.460000', 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}]) filesystem = port.host.filesystem self.assertTrue(filesystem.isfile(runner._output_json_path())) @@ -562,9 +562,9 @@ '--test-results-server=some.host', '--description', 'some description']) self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True) self.assertEqual(self._load_output_json(runner), [{ - "buildTime": "2013-02-08T15:19:37.460000", "description": "some description", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + 'buildTime': '2013-02-08T15:19:37.460000', 'description': 'some description', + '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=None): args = args or [] @@ -598,9 +598,9 @@ self._load_output_json(runner), [ { - "buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}} + 'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}} } ]) @@ -616,13 +616,13 @@ self._test_run_with_json_output(runner, port.host.filesystem) - self.assertEqual(self._load_output_json(runner), [{"previous": "results"}, { - "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + self.assertEqual(self._load_output_json(runner), [{'previous': 'results'}, { + 'buildTime': '2013-02-08T15:19:37.460000', 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}]) self.assertTrue(filesystem.isfile(filesystem.splitext(output_json_path)[0] + '.html')) def test_run_respects_reset_results(self): - runner, port = self.create_runner_and_setup_results_template(args=["--reset-results"]) + runner, port = self.create_runner_and_setup_results_template(args=['--reset-results']) filesystem = port.host.filesystem output_json_path = runner._output_json_path() @@ -631,8 +631,8 @@ self._test_run_with_json_output(runner, port.host.filesystem) self.assertEqual(self._load_output_json(runner), [{ - "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + 'buildTime': '2013-02-08T15:19:37.460000', 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}]) self.assertTrue(filesystem.isfile(filesystem.splitext(output_json_path)[0] + '.html')) def test_run_generates_and_show_results_page(self): @@ -642,9 +642,9 @@ filesystem = port.host.filesystem self._test_run_with_json_output(runner, filesystem, results_shown=False) - expected_entry = {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}} + expected_entry = {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}} self.maxDiff = None self.assertEqual(runner._output_json_path(), '/mock-checkout/output.json') @@ -692,8 +692,8 @@ port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '{"key": "value"}') self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True) self.assertEqual(self._load_output_json(runner), [{ - "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}, "builderKey": "value"}]) + 'buildTime': '2013-02-08T15:19:37.460000', 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}, 'builderKey': 'value'}]) def test_run_with_bad_slave_config_json(self): runner, port = self.create_runner_and_setup_results_template( @@ -714,8 +714,8 @@ port.repository_path = lambda: '/mock-checkout' self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True) self.assertEqual(self._load_output_json(runner), [{ - "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + 'buildTime': '2013-02-08T15:19:37.460000', 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}]) def test_run_with_upload_json(self): runner, port = self.create_runner_and_setup_results_template(args=[ @@ -776,21 +776,21 @@ '--test-results-server=some.host', '--repeat', '5']) self._test_run_with_json_output(runner, port.host.filesystem, upload_succeeds=True, repeat=5) self.assertEqual(self._load_output_json(runner), [ - {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}, - {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}, - {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}, - {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}, - {"buildTime": "2013-02-08T15:19:37.460000", - "tests": self._event_target_wrapper_and_inspector_results, - "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000", "revision": "5678"}}}]) + {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}, + {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}, + {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}, + {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}, + {'buildTime': '2013-02-08T15:19:37.460000', + 'tests': self._event_target_wrapper_and_inspector_results, + 'revisions': {'chromium': {'timestamp': '2013-02-01 08:48:05 +0000', 'revision': '5678'}}}]) def test_run_with_test_runner_count(self): runner, port = self.create_runner_and_setup_results_template(args=['--output-json-path=/mock-checkout/output.json',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py index f305755..8ceda22 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py
@@ -125,24 +125,24 @@ # No trailing white space: since this is easy to correct. # No carriage-return line endings: since this is easy to correct. # - (["webkitpy/thirdparty/"], - ["-", - "+pep8/W191", # Tabs - "+pep8/W291", # Trailing white space - "+whitespace/carriage_return"]), + (['webkitpy/thirdparty/'], + ['-', + '+pep8/W191', # Tabs + '+pep8/W291', # Trailing white space + '+whitespace/carriage_return']), ([ # Jinja templates: files have .cpp or .h extensions, but contain # template code, which can't be handled, so disable tests. - "Source/bindings/templates", - "Source/build/scripts/templates"], - ["-"]), + 'Source/bindings/templates', + 'Source/build/scripts/templates'], + ['-']), ([ # IDL compiler reference output # Conforming to style significantly increases the complexity of the code # generator and decreases *its* readability, which is of more concern # than style of the machine-generated code itself. - "Source/bindings/tests/results"], - ["-"]), + 'Source/bindings/tests/results'], + ['-']), ] @@ -192,7 +192,7 @@ # WebKit maintains some files in Mozilla style on purpose to ease # future merges. _SKIPPED_FILES_WITH_WARNING = [ - "Source/WebKit/gtk/tests/", + 'Source/WebKit/gtk/tests/', # All WebKit*.h files in Source/WebKit2/UIProcess/API/gtk, # except those ending in ...Private.h are GTK+ API headers, # which differ greatly from WebKit coding style. @@ -206,10 +206,10 @@ # This list should be in addition to files with FileType.NONE. Files # with FileType.NONE are automatically skipped without warning. _SKIPPED_FILES_WITHOUT_WARNING = [ - "LayoutTests" + os.path.sep, - "Source/ThirdParty/leveldb" + os.path.sep, + 'LayoutTests' + os.path.sep, + 'Source/ThirdParty/leveldb' + os.path.sep, # Prevents this being recognized as a text file. - "Source/WebCore/GNUmakefile.features.am.in", + 'Source/WebCore/GNUmakefile.features.am.in', ] # Extensions of files which are allowed to contain carriage returns. @@ -222,7 +222,7 @@ # The maximum number of errors to report per file, per category. # If a category is not a key, then it has no maximum. _MAX_REPORTS_PER_CATEGORY = { - "whitespace/carriage_return": 1 + 'whitespace/carriage_return': 1 } @@ -239,7 +239,7 @@ # now we add only the categories needed for the unit tests # (which validate the consistency of the configuration # settings against the known categories, etc). - categories = categories.union(["pep8/W191", "pep8/W291", "pep8/E501"]) + categories = categories.union(['pep8/W191', 'pep8/W291', 'pep8/E501']) return categories @@ -289,7 +289,7 @@ # Handles logging.WARNING and above. error_handler = logging.StreamHandler(stream) error_handler.setLevel(logging.WARNING) - formatter = logging.Formatter("%(levelname)s: %(message)s") + formatter = logging.Formatter('%(levelname)s: %(message)s') error_handler.setFormatter(formatter) # Create a logging.Filter instance that only accepts messages @@ -300,7 +300,7 @@ non_error_handler = logging.StreamHandler(stream) non_error_handler.addFilter(non_error_filter) - formatter = logging.Formatter("%(message)s") + formatter = logging.Formatter('%(message)s') non_error_handler.setFormatter(formatter) return [error_handler, non_error_handler] @@ -313,7 +313,7 @@ stream: See the configure_logging() docstring. """ handler = logging.StreamHandler(stream) - formatter = logging.Formatter("%(name)s: %(levelname)-8s %(message)s") + formatter = logging.Formatter('%(name)s: %(levelname)-8s %(message)s') handler.setFormatter(formatter) return [handler] @@ -384,7 +384,7 @@ def _file_extension(self, file_path): """Return the file extension without the leading dot.""" - return os.path.splitext(file_path)[1].lstrip(".") + return os.path.splitext(file_path)[1].lstrip('.') def _should_skip_file_path(self, file_path, skip_array_entry): match = re.search(r"\s*png$", file_path) @@ -446,7 +446,7 @@ return FileType.XCODEPROJ elif file_extension == _PNG_FILE_EXTENSION: return FileType.PNG - elif ((not file_extension and os.path.join("Tools", "Scripts") in file_path) or + elif ((not file_extension and os.path.join('Tools', 'Scripts') in file_path) or file_extension in _TEXT_FILE_EXTENSIONS or os.path.basename(file_path) == 'TestExpectations'): return FileType.TEXT else: @@ -479,11 +479,11 @@ checker = TextChecker(file_path, handle_style_error) else: raise ValueError('Invalid file type "%(file_type)s": the only valid file types ' - "are %(NONE)s, %(CPP)s, and %(TEXT)s." - % {"file_type": file_type, - "NONE": FileType.NONE, - "CPP": FileType.CPP, - "TEXT": FileType.TEXT}) + 'are %(NONE)s, %(CPP)s, and %(TEXT)s.' + % {'file_type': file_type, + 'NONE': FileType.NONE, + 'CPP': FileType.CPP, + 'TEXT': FileType.TEXT}) return checker @@ -576,9 +576,9 @@ message): """Write a style error to the configured stderr.""" if self._output_format == 'vs7': - format_string = "%s(%s): %s [%s] [%d]\n" + format_string = '%s(%s): %s [%s] [%d]\n' else: - format_string = "%s:%s: %s [%s] [%d]\n" + format_string = '%s:%s: %s [%s] [%d]\n' self.stderr_write(format_string % (file_path, line_number, @@ -693,7 +693,7 @@ list normally contains the line numbers corresponding to the modified lines of a patch. """ - _log.debug("Checking style: " + file_path) + _log.debug('Checking style: ' + file_path) style_error_handler = DefaultStyleErrorHandler( configuration=self._configuration, @@ -715,6 +715,6 @@ if checker is None: raise AssertionError("File should not be checked: '%s'" % file_path) - _log.debug("Using class: " + checker.__class__.__name__) + _log.debug('Using class: ' + checker.__class__.__name__) checker.check(lines)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common.py index 76aa956b..c9c5f57 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common.py
@@ -29,8 +29,8 @@ # after moving the relevant cpp_unittest.ErrorCollector code # into a shared location and refactoring appropriately. categories = set([ - "whitespace/carriage_return", - "whitespace/tab"]) + 'whitespace/carriage_return', + 'whitespace/tab']) class CarriageReturnChecker(object): @@ -43,16 +43,16 @@ def check(self, lines): """Check for and strip trailing carriage returns from lines.""" for line_number in range(len(lines)): - if not lines[line_number].endswith("\r"): + if not lines[line_number].endswith('\r'): continue self._handle_style_error(line_number + 1, # Correct for offset. - "whitespace/carriage_return", + 'whitespace/carriage_return', 1, - "One or more unexpected \\r (^M) found; " - "better to use only a \\n") + 'One or more unexpected \\r (^M) found; ' + 'better to use only a \\n') - lines[line_number] = lines[line_number].rstrip("\r") + lines[line_number] = lines[line_number].rstrip('\r') return lines @@ -68,7 +68,7 @@ def check(self, lines): # FIXME: share with cpp_style. for line_number, line in enumerate(lines): - if "\t" in line: + if '\t' in line: self.handle_style_error(line_number + 1, - "whitespace/tab", 5, - "Line contains tab character.") + 'whitespace/tab', 5, + 'Line contains tab character.')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common_unittest.py index bda749a..0a669ee 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/common_unittest.py
@@ -39,10 +39,10 @@ """Tests check_no_carriage_return().""" - _category = "whitespace/carriage_return" + _category = 'whitespace/carriage_return' _confidence = 1 - _expected_message = ("One or more unexpected \\r (^M) found; " - "better to use only a \\n") + _expected_message = ('One or more unexpected \\r (^M) found; ' + 'better to use only a \\n') def setUp(self): self._style_errors = [] # The list of accumulated style errors. @@ -69,30 +69,30 @@ self.assertEqual(self._style_errors, expected_errors) def test_ends_with_carriage(self): - self.assert_carriage_return(["carriage return\r"], - ["carriage return"], + self.assert_carriage_return(['carriage return\r'], + ['carriage return'], [1]) def test_ends_with_nothing(self): - self.assert_carriage_return(["no carriage return"], - ["no carriage return"], + self.assert_carriage_return(['no carriage return'], + ['no carriage return'], []) def test_ends_with_newline(self): - self.assert_carriage_return(["no carriage return\n"], - ["no carriage return\n"], + self.assert_carriage_return(['no carriage return\n'], + ['no carriage return\n'], []) def test_carriage_in_middle(self): # The CarriageReturnChecker checks only the final character # of each line. - self.assert_carriage_return(["carriage\r in a string"], - ["carriage\r in a string"], + self.assert_carriage_return(['carriage\r in a string'], + ['carriage\r in a string'], []) def test_multiple_errors(self): - self.assert_carriage_return(["line1", "line2\r", "line3\r"], - ["line1", "line2", "line3"], + self.assert_carriage_return(['line1', 'line2\r', 'line3\r'], + ['line1', 'line2', 'line3'], [2, 3])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py index ac611f8..29fa523 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py
@@ -308,7 +308,7 @@ _OTHER_HEADER: 'other header', } _SECTION_NAMES = { - _INITIAL_SECTION: "... nothing.", + _INITIAL_SECTION: '... nothing.', _PRIMARY_SECTION: 'a header this file implements.', _OTHER_SECTION: 'other header.', } @@ -643,13 +643,13 @@ if os.path.exists(fullname): project_dir = os.path.dirname(fullname) - if os.path.exists(os.path.join(project_dir, ".svn")): + if os.path.exists(os.path.join(project_dir, '.svn')): # If there's a .svn file in the current directory, we # recursively look up the directory tree for the top # of the SVN checkout root_dir = project_dir one_up_dir = os.path.dirname(root_dir) - while os.path.exists(os.path.join(one_up_dir, ".svn")): + while os.path.exists(os.path.join(one_up_dir, '.svn')): root_dir = os.path.dirname(root_dir) one_up_dir = os.path.dirname(one_up_dir) @@ -660,9 +660,9 @@ # searching up from the current path. root_dir = os.path.dirname(fullname) while (root_dir != os.path.dirname(root_dir) - and not os.path.exists(os.path.join(root_dir, ".git"))): + and not os.path.exists(os.path.join(root_dir, '.git'))): root_dir = os.path.dirname(root_dir) - if os.path.exists(os.path.join(root_dir, ".git")): + if os.path.exists(os.path.join(root_dir, '.git')): prefix = os.path.commonprefix([root_dir, project_dir]) return fullname[len(prefix) + 1:] @@ -939,7 +939,7 @@ # Files under WTF typically have header guards that start with WTF_. if '/wtf/' in filename: - special_name = "WTF_" + standard_name + special_name = 'WTF_' + standard_name else: special_name = standard_name return (special_name, standard_name) @@ -1229,7 +1229,7 @@ for line in self._clean_lines.elided: # Starting with @ or #import seem like the best indications # that we have an Objective C file. - if line.startswith("@") or line.startswith("#import"): + if line.startswith('@') or line.startswith('#import'): self._is_objective_c = True break else: @@ -1670,7 +1670,7 @@ 1 and filename.find('chromium/platform') == -1: error(function_state.function_name_start_position.row, 'readability/webkit_export', 5, 'WEBKIT_EXPORT should only appear in the chromium public (or tests) directory.') - elif not file_extension == "h": + elif not file_extension == 'h': error(function_state.function_name_start_position.row, 'readability/webkit_export', 5, 'WEBKIT_EXPORT should only be used in header files.') elif not function_state.is_declaration or search(r'\binline\b', modifiers_and_return_type): @@ -2232,7 +2232,7 @@ expect_conditional_expression = True know_whether_using_braces = False using_braces = False - search_for_else_clause = control_match.group(1) == "if" + search_for_else_clause = control_match.group(1) == 'if' current_pos = Position(line_number, control_match.end() - 1) while True: @@ -2300,7 +2300,7 @@ if not next_conditional: # Done processing this 'if' and all arms. return - if next_conditional.group(1) == "else if": + if next_conditional.group(1) == 'else if': current_pos = _find_in_lines(r'\(', lines, current_pos, None) else: current_pos.column += 4 # skip 'else' @@ -2526,7 +2526,7 @@ fileinfo = FileInfo(filename) if not fileinfo.is_source(): return False - primary_header = fileinfo.no_extension() + ".h" + primary_header = fileinfo.no_extension() + '.h' return os.path.isfile(primary_header) @@ -2596,7 +2596,7 @@ # The include_state object keeps track of the last type seen # and complains if the header types are out of order or missing. error_message = include_state.check_next_include_order(header_type, - file_extension == "h", + file_extension == 'h', primary_header_exists) # Check to make sure we have a blank line after primary header. @@ -2953,9 +2953,9 @@ and not modified_identifier.startswith('cti_') and not modified_identifier.find('::qt_') >= 0 and not modified_identifier.find('::_q_') >= 0 - and not modified_identifier == "const_iterator" - and not modified_identifier == "vm_throw" - and not modified_identifier == "DFG_OPERATION"): + and not modified_identifier == 'const_iterator' + and not modified_identifier == 'vm_throw' + and not modified_identifier == 'DFG_OPERATION'): error(line_number, 'readability/naming/underscores', 4, identifier + " is incorrectly named. Don't use underscores in your identifier names.") @@ -3011,7 +3011,7 @@ detect_functions(lines, line_number, function_state, error) # Exclude the match of dummy conversion function. Dummy function is just to # catch invalid conversions and shouldn't be part of possible alternatives. - result = re.search(r'%s(\s+)%s' % ("void", pattern), line) + result = re.search(r'%s(\s+)%s' % ('void', pattern), line) if not result: matches.append([line, function_state.body_start_position.row, function_state.end_position.row + 1]) function_state = None
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 4e6c9582..7880bef1 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
@@ -74,7 +74,7 @@ if self._lines_to_check and not line_number in self._lines_to_check: return False - if self._filter.should_check(category, ""): + if self._filter.should_check(category, ''): self._seen_style_categories[category] = 1 self._errors.append('%s [%s] [%d]' % (message, category, confidence)) return True @@ -3711,7 +3711,7 @@ self.assert_lint( 'using std::min;', "Use 'using namespace std;' instead of 'using std::min;'." - " [build/using_std] [4]", + ' [build/using_std] [4]', 'foo.cpp') def test_using_std_swap_ignored(self): @@ -3765,9 +3765,9 @@ def test_names(self): name_underscore_error_message = (" is incorrectly named. Don't use underscores in your identifier names." - " [readability/naming/underscores] [4]") + ' [readability/naming/underscores] [4]') name_tooshort_error_message = (" is incorrectly named. Don't use the single letter 'l' as an identifier name." - " [readability/naming] [4]") + ' [readability/naming] [4]') # Basic cases from WebKit style guide. self.assert_lint('struct Data;', '') @@ -4104,13 +4104,13 @@ pass def _checker(self): - return CppChecker("foo", "h", self.mock_handle_style_error, 3) + return CppChecker('foo', 'h', self.mock_handle_style_error, 3) def test_init(self): """Test __init__ constructor.""" checker = self._checker() - self.assertEqual(checker.file_extension, "h") - self.assertEqual(checker.file_path, "foo") + self.assertEqual(checker.file_extension, 'h') + self.assertEqual(checker.file_path, 'foo') self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) self.assertEqual(checker.min_confidence, 3) @@ -4126,11 +4126,11 @@ pass # Verify that a difference in any argument cause equality to fail. - checker = CppChecker("foo", "h", self.mock_handle_style_error, 3) - self.assertFalse(checker == CppChecker("bar", "h", self.mock_handle_style_error, 3)) - self.assertFalse(checker == CppChecker("foo", "c", self.mock_handle_style_error, 3)) - self.assertFalse(checker == CppChecker("foo", "h", mock_handle_style_error2, 3)) - self.assertFalse(checker == CppChecker("foo", "h", self.mock_handle_style_error, 4)) + checker = CppChecker('foo', 'h', self.mock_handle_style_error, 3) + self.assertFalse(checker == CppChecker('bar', 'h', self.mock_handle_style_error, 3)) + self.assertFalse(checker == CppChecker('foo', 'c', self.mock_handle_style_error, 3)) + self.assertFalse(checker == CppChecker('foo', 'h', mock_handle_style_error2, 3)) + self.assertFalse(checker == CppChecker('foo', 'h', self.mock_handle_style_error, 4)) def test_ne(self): """Test __ne__ inequality function."""
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png.py index 4a27d33a..09946797 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png.py
@@ -39,9 +39,9 @@ self._fs = self._host.filesystem def check(self, inline=None): - if self._fs.exists(self._file_path) and self._file_path.endswith("-expected.png"): + if self._fs.exists(self._file_path) and self._file_path.endswith('-expected.png'): with self._fs.open_binary_file_for_reading(self._file_path) as filehandle: if not read_checksum_from_png.read_checksum(filehandle): self._handle_style_error( 0, 'image/png', 5, - "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.") + 'Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python.py index 5f5de3eb..365d4278 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python.py
@@ -58,7 +58,7 @@ pep8_code = text[:4] pep8_message = text[5:] - category = "pep8/" + pep8_code + category = 'pep8/' + pep8_code self._handle_style_error(line_number, category, 5, pep8_message)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py index 6ca9699..7133158 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
@@ -51,7 +51,7 @@ self._port_obj = host.port_factory.get() # Suppress error messages of test_expectations module since they will be reported later. - log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expectations") + log = logging.getLogger('webkitpy.layout_tests.layout_package.test_expectations') log.setLevel(logging.CRITICAL) def _handle_error_message(self, lineno, message, confidence):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py index c2d4e29..402843cf 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py
@@ -90,14 +90,14 @@ self.assertFalse(self._error_collector.turned_off_filtering) def test_valid_expectations(self): - self.assert_lines_lint(["crbug.com/1234 [ Mac ] passes/text.html [ Pass Failure ]"], should_pass=True) + self.assert_lines_lint(['crbug.com/1234 [ Mac ] passes/text.html [ Pass Failure ]'], should_pass=True) def test_invalid_expectations(self): - self.assert_lines_lint(["Bug(me) passes/text.html [ Give Up]"], should_pass=False) + self.assert_lines_lint(['Bug(me) passes/text.html [ Give Up]'], should_pass=False) def test_tab(self): - self.assert_lines_lint(["\twebkit.org/b/1 passes/text.html [ Pass ]"], should_pass=False, - expected_output="Line contains tab character. [whitespace/tab] [5]") + self.assert_lines_lint(['\twebkit.org/b/1 passes/text.html [ Pass ]'], should_pass=False, + expected_output='Line contains tab character. [whitespace/tab] [5]') def test_missing_expectation_not_allowed(self): - self.assert_lines_lint(["crbug.com/1234 [ Mac ] passes/text.html [ Missing ]"], should_pass=False) + self.assert_lines_lint(['crbug.com/1234 [ Mac ] passes/text.html [ Missing ]'], should_pass=False)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/text_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/text_unittest.py index beeffb6..42b1be12 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/text_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/text_unittest.py
@@ -80,6 +80,6 @@ def test_init(self): """Test __init__ constructor.""" - checker = TextChecker("foo.txt", self.mock_handle_style_error) - self.assertEqual(checker.file_path, "foo.txt") + checker = TextChecker('foo.txt', self.mock_handle_style_error) + self.assertEqual(checker.file_path, 'foo.txt') self.assertEqual(checker.handle_style_error, self.mock_handle_style_error)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers.py index 9ed45cb..048d38c 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/error_handlers.py
@@ -119,7 +119,7 @@ return self._configuration.max_reports_per_category[category] def should_line_be_checked(self, line_number): - "Returns if a particular line should be checked" + 'Returns if a particular line should be checked' # Was the line that was modified? return self._line_numbers is None or line_number in self._line_numbers @@ -153,6 +153,6 @@ line_number=line_number, message=message) if category_total == max_reports: - self._configuration.stderr_write("Suppressing further [%s] reports " - "for this file.\n" % category) + self._configuration.stderr_write('Suppressing further [%s] reports ' + 'for this file.\n' % category) return True
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 6c93eb2..03039f1 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
@@ -37,10 +37,10 @@ self._error_messages = [] self._error_count = 0 - _category = "whitespace/tab" + _category = 'whitespace/tab' """The category name for the tests in this class.""" - _file_path = "foo.h" + _file_path = 'foo.h' """The file path for the tests in this class.""" def _mock_increment_error_count(self): @@ -51,14 +51,14 @@ def _style_checker_configuration(self): """Return a StyleProcessorConfiguration instance for testing.""" - base_rules = ["-whitespace", "+whitespace/tab"] + base_rules = ['-whitespace', '+whitespace/tab'] filter_configuration = FilterConfiguration(base_rules=base_rules) return StyleProcessorConfiguration( filter_configuration=filter_configuration, - max_reports_per_category={"whitespace/tab": 2}, + max_reports_per_category={'whitespace/tab': 2}, min_confidence=3, - output_format="vs7", + output_format='vs7', stderr_write=self._mock_stderr_write) def _error_handler(self, configuration, line_numbers=None): @@ -77,7 +77,7 @@ handle_error(line_number=line_number, category=self._category, confidence=confidence, - message="message") + message='message') def test_eq__true_return_value(self): """Test the __eq__() method for the return value of True.""" @@ -148,7 +148,7 @@ self.assertEqual(1, self._error_count) self.assertEqual(1, len(self._error_messages)) self.assertEqual(self._error_messages, - ["foo.h(100): message [whitespace/tab] [5]\n"]) + ['foo.h(100): message [whitespace/tab] [5]\n']) # Second call: suppression message reported. self._call_error_handler(error_handler, confidence) @@ -157,10 +157,10 @@ self.assertEqual(2, self._error_count) self.assertEqual(3, len(self._error_messages)) self.assertEqual(self._error_messages[-2], - "foo.h(100): message [whitespace/tab] [5]\n") + 'foo.h(100): message [whitespace/tab] [5]\n') self.assertEqual(self._error_messages[-1], - "Suppressing further [whitespace/tab] reports " - "for this file.\n") + 'Suppressing further [whitespace/tab] reports ' + 'for this file.\n') # Third call: no report. self._call_error_handler(error_handler, confidence) @@ -184,7 +184,7 @@ self._call_error_handler(error_handler, confidence, line_number=50) self.assertEqual(1, self._error_count) self.assertEqual(self._error_messages, - ["foo.h(50): message [whitespace/tab] [5]\n"]) + ['foo.h(50): message [whitespace/tab] [5]\n']) # Error on non-modified line after turning off line filtering: error. error_handler.turn_off_line_filtering()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/filereader.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/filereader.py index 5d6b76c..a3fa4da 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/filereader.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/filereader.py
@@ -107,7 +107,7 @@ """ self.file_count += 1 - if not self.filesystem.exists(file_path) and file_path != "-": + if not self.filesystem.exists(file_path) and file_path != '-': _log.error("File does not exist: '%s'", file_path) sys.exit(1) # FIXME: This should throw or return instead of exiting directly.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/filter.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/filter.py index ff38149..d5822ec 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/filter.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/filter.py
@@ -41,15 +41,15 @@ for rule in filter_rules: if not (rule.startswith('+') or rule.startswith('-')): raise ValueError('Invalid filter rule "%s": every rule ' - "must start with + or -." % rule) + 'must start with + or -.' % rule) for category in all_categories: if category.startswith(rule[1:]): break else: raise ValueError('Suspected incorrect filter rule "%s": ' - "the rule does not match the beginning " - "of any category name." % rule) + 'the rule does not match the beginning ' + 'of any category name.' % rule) class _CategoryFilter(object): @@ -77,7 +77,7 @@ self._should_check_category = {} # Cached dictionary of category to True/False def __str__(self): - return ",".join(self._filter_rules) + return ','.join(self._filter_rules) # Useful for unit testing. def __eq__(self, other):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py index be966e3..8da2ed3 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py
@@ -94,7 +94,7 @@ # If we got here, the conversion was successful. paths = rel_paths - _log.debug("Changing to checkout root: " + checkout_root) + _log.debug('Changing to checkout root: ' + checkout_root) filesystem.chdir(checkout_root) return paths @@ -112,7 +112,7 @@ # Setting an "encoding" attribute on the stream is necessary to # prevent the logging module from raising an error. See # the checker.configure_logging() function for more information. - stderr.encoding = "UTF-8" + stderr.encoding = 'UTF-8' # FIXME: Change webkitpy.style so that we do not need to overwrite # the global sys.stderr. This involves updating the code to @@ -130,10 +130,10 @@ # Checking for the verbose flag before calling check_webkit_style_parser() # lets us enable verbose logging earlier. - is_verbose = "-v" in args or "--verbose" in args + is_verbose = '-v' in args or '--verbose' in args checker.configure_logging(stream=stderr, is_verbose=is_verbose) - _log.debug("Verbose logging enabled.") + _log.debug('Verbose logging enabled.') parser = checker.check_webkit_style_parser() (paths, options) = parser.parse(args) @@ -157,6 +157,6 @@ file_count = file_reader.file_count delete_only_file_count = file_reader.delete_only_file_count - _log.info("Total errors found: %d in %d files", error_count, file_count) + _log.info('Total errors found: %d in %d files', error_count, file_count) # We fail when style errors are found or there are no checked files. return error_count > 0 or (file_count == 0 and delete_only_file_count == 0)
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 668711a62..c660c6a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/main_unittest.py
@@ -26,8 +26,8 @@ class ChangeDirectoryTest(LoggingTestCase): - _original_directory = "/original" - _checkout_root = "/chromium/src" + _original_directory = '/original' + _checkout_root = '/chromium/src' def setUp(self): super(ChangeDirectoryTest, self).setUp() @@ -47,12 +47,12 @@ self._assert_result(paths, None, [], self._checkout_root) def test_paths_convertible(self): - paths = ["/chromium/src/foo1.txt", "/chromium/src/foo2.txt"] + paths = ['/chromium/src/foo1.txt', '/chromium/src/foo2.txt'] paths = self._change_directory(checkout_root=self._checkout_root, paths=paths) - self._assert_result(paths, ["foo1.txt", "foo2.txt"], [], self._checkout_root) + self._assert_result(paths, ['foo1.txt', 'foo2.txt'], [], self._checkout_root) def test_with_git_paths_unconvertible(self): - paths = ["/chromium/src/foo1.txt", "/outside/foo2.txt"] + paths = ['/chromium/src/foo1.txt', '/outside/foo2.txt'] paths = self._change_directory(checkout_root=self._checkout_root, paths=paths) log_messages = [ """WARNING: Path-dependent style checks may not work correctly:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py index 12cd4ff..89c1608 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py
@@ -96,8 +96,8 @@ detected. This is because all file paths will already be relative to the source root and so will not need to be converted.""" -_EPILOG = ("This script can miss errors and does not substitute for " - "code review.") +_EPILOG = ('This script can miss errors and does not substitute for ' + 'code review.') # This class should not have knowledge of the flag key names. @@ -146,16 +146,16 @@ diff_files=None, is_verbose=False, min_confidence=1, - output_format="emacs"): + output_format='emacs'): if filter_rules is None: filter_rules = [] if (min_confidence < 1) or (min_confidence > 5): raise ValueError('Invalid "min_confidence" parameter: value ' - "must be an integer between 1 and 5 inclusive. " + 'must be an integer between 1 and 5 inclusive. ' 'Value given: "%s".' % min_confidence) - if output_format not in ("emacs", "vs7"): + if output_format not in ('emacs', 'vs7'): raise ValueError('Invalid "output_format" parameter: ' 'value must be "emacs" or "vs7". ' 'Value given: "%s".' % output_format) @@ -212,7 +212,7 @@ # Only include the filter flag if user-provided rules are present. filter_rules = options.filter_rules if filter_rules: - flags['filter'] = ",".join(filter_rules) + flags['filter'] = ','.join(filter_rules) if options.git_commit: flags['git-commit'] = options.git_commit if options.diff_files: @@ -301,36 +301,36 @@ '"--filter -whitespace,+whitespace/braces". To display ' 'all categories and which are enabled by default, pass ' """no value (e.g. '-f ""' or '--filter=').""") - parser.add_option("-f", "--filter-rules", metavar="RULES", - dest="filter_value", help=filter_help) + parser.add_option('-f', '--filter-rules', metavar='RULES', + dest='filter_value', help=filter_help) - git_commit_help = ("check all changes in the given commit. " + git_commit_help = ('check all changes in the given commit. ' "Use 'commit_id..' to check all changes after commit_id") - parser.add_option("-g", "--git-diff", "--git-commit", - metavar="COMMIT", dest="git_commit", help=git_commit_help,) + parser.add_option('-g', '--git-diff', '--git-commit', + metavar='COMMIT', dest='git_commit', help=git_commit_help,) - diff_files_help = "diff the files passed on the command line rather than checking the style of every line" - parser.add_option("--diff-files", action="store_true", dest="diff_files", default=False, help=diff_files_help) + diff_files_help = 'diff the files passed on the command line rather than checking the style of every line' + parser.add_option('--diff-files', action='store_true', dest='diff_files', default=False, help=diff_files_help) - min_confidence_help = ("set the minimum confidence of style errors " - "to report. Can be an integer 1-5, with 1 " - "displaying all errors. Defaults to %default.") - parser.add_option("-m", "--min-confidence", metavar="INT", - type="int", dest="min_confidence", + min_confidence_help = ('set the minimum confidence of style errors ' + 'to report. Can be an integer 1-5, with 1 ' + 'displaying all errors. Defaults to %default.') + parser.add_option('-m', '--min-confidence', metavar='INT', + type='int', dest='min_confidence', default=default_min_confidence, help=min_confidence_help) output_format_help = ('set the output format, which can be "emacs" ' 'or "vs7" (for Visual Studio). ' 'Defaults to "%default".') - parser.add_option("-o", "--output-format", metavar="FORMAT", - choices=["emacs", "vs7"], - dest="output_format", default=default_output_format, + parser.add_option('-o', '--output-format', metavar='FORMAT', + choices=['emacs', 'vs7'], + dest='output_format', default=default_output_format, help=output_format_help) - verbose_help = "enable verbose logging." - parser.add_option("-v", "--verbose", dest="is_verbose", default=False, - action="store_true", help=verbose_help) + verbose_help = 'enable verbose logging.' + parser.add_option('-v', '--verbose', dest='is_verbose', default=False, + action='store_true', help=verbose_help) # Override OptionParser's error() method so that option help will # also display when an error occurs. Normally, just the usage @@ -350,7 +350,7 @@ # the flag options. help = self._parser.format_help() # Separate help from the error message with a single blank line. - self.stderr_write(help + "\n") + self.stderr_write(help + '\n') if error_message: _log.error(error_message)
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 90414a6..1a535a1 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser_unittest.py
@@ -79,13 +79,13 @@ def _create_defaults(self): """Return a DefaultCommandOptionValues instance for testing.""" return DefaultCommandOptionValues(min_confidence=3, - output_format="vs7") + output_format='vs7') def _create_parser(self): """Return an ArgumentParser instance for testing.""" default_options = self._create_defaults() - all_categories = ["build", "whitespace"] + all_categories = ['build', 'whitespace'] mock_stderr = self._MockStdErr() @@ -93,7 +93,7 @@ base_filter_rules=[], default_options=default_options, mock_stderr=mock_stderr, - usage="test usage") + usage='test usage') def test_parse_documentation(self): parse = self._parse @@ -172,12 +172,12 @@ # Pass user_rules. _, options = parse(['--filter=+build,-whitespace']) self.assertEqual(options.filter_rules, - ["+build", "-whitespace"]) + ['+build', '-whitespace']) # Pass spurious white space in user rules. _, options = parse(['--filter=+build, -whitespace']) self.assertEqual(options.filter_rules, - ["+build", "-whitespace"]) + ['+build', '-whitespace']) def test_parse_files(self): parse = self._parse @@ -202,28 +202,28 @@ self.assertIsNone(options.git_commit) self.assertFalse(options.is_verbose) self.assertEqual(options.min_confidence, 1) - self.assertEqual(options.output_format, "emacs") + self.assertEqual(options.output_format, 'emacs') # Check argument validation. - self.assertRaises(ValueError, ProcessorOptions, output_format="bad") - ProcessorOptions(output_format="emacs") # No ValueError: works - ProcessorOptions(output_format="vs7") # works + self.assertRaises(ValueError, ProcessorOptions, output_format='bad') + ProcessorOptions(output_format='emacs') # No ValueError: works + ProcessorOptions(output_format='vs7') # works self.assertRaises(ValueError, ProcessorOptions, min_confidence=0) self.assertRaises(ValueError, ProcessorOptions, min_confidence=6) ProcessorOptions(min_confidence=1) # works ProcessorOptions(min_confidence=5) # works # Check attributes. - options = ProcessorOptions(filter_rules=["+"], - git_commit="commit", + options = ProcessorOptions(filter_rules=['+'], + git_commit='commit', is_verbose=True, min_confidence=3, - output_format="vs7") - self.assertEqual(options.filter_rules, ["+"]) - self.assertEqual(options.git_commit, "commit") + output_format='vs7') + self.assertEqual(options.filter_rules, ['+']) + self.assertEqual(options.git_commit, 'commit') self.assertTrue(options.is_verbose) self.assertEqual(options.min_confidence, 3) - self.assertEqual(options.output_format, "vs7") + self.assertEqual(options.output_format, 'vs7') def test_eq(self): """Test __eq__ equality function.""" @@ -238,15 +238,15 @@ git_commit=None, is_verbose=False, min_confidence=1, - output_format="emacs") + output_format='emacs') # Verify that we created options correctly. self.assertTrue(options.__eq__(ProcessorOptions())) - self.assertFalse(options.__eq__(ProcessorOptions(filter_rules=["+"]))) - self.assertFalse(options.__eq__(ProcessorOptions(git_commit="commit"))) + self.assertFalse(options.__eq__(ProcessorOptions(filter_rules=['+']))) + self.assertFalse(options.__eq__(ProcessorOptions(git_commit='commit'))) self.assertFalse(options.__eq__(ProcessorOptions(is_verbose=True))) self.assertFalse(options.__eq__(ProcessorOptions(min_confidence=2))) - self.assertFalse(options.__eq__(ProcessorOptions(output_format="vs7"))) + self.assertFalse(options.__eq__(ProcessorOptions(output_format='vs7'))) def test_ne(self): """Test __ne__ inequality function."""
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 3301e72..d834d8ee8 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
@@ -33,10 +33,10 @@ _log = logging.getLogger(__name__) -SERVER = "irc.freenode.net" +SERVER = 'irc.freenode.net' PORT = 6667 -CHANNEL = "#blink" -NICKNAME = "commit-bot" +CHANNEL = '#blink' +NICKNAME = 'commit-bot' PULL_TIMEOUT_SECONDS = 60 * 5 UPDATE_WAIT_SECONDS = 10 @@ -44,7 +44,7 @@ class CommitAnnouncer(SingleServerIRCBot): - _commit_detail_format = "%H\n%ae\n%s\n%b" # commit-sha1, author email, subject, body + _commit_detail_format = '%H\n%ae\n%s\n%b' # commit-sha1, author email, subject, body def __init__(self, tool, announce_path, irc_password): SingleServerIRCBot.__init__(self, [(SERVER, PORT, irc_password)], NICKNAME, NICKNAME) @@ -67,7 +67,7 @@ if not self.connection.is_connected(): return if not self._update(force_clean=True): - self.stop("Failed to update repository!") + self.stop('Failed to update repository!') return new_commits = self.git.git_commits_since(self.last_commit) if not new_commits: @@ -92,7 +92,7 @@ def ping(self): self._post('Pong.') - def stop(self, message=""): + def stop(self, message=''): self.connection.execute_delayed(0, lambda: self.die(message)) # IRC event handlers. Methods' arguments are determined by superclass
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer_unittest.py index 4e410322..a0f8424 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer_unittest.py
@@ -33,7 +33,7 @@ def test_format_commit(self): tool = MockWebKitPatch() - bot = CommitAnnouncer(tool, "test/directory", "test_password") + bot = CommitAnnouncer(tool, 'test/directory', 'test_password') self.assertEqual( 'https://crrev.com/456789 authorABC@chromium.org committed "Commit test subject line"', bot._format_commit_detail("""\ @@ -200,6 +200,6 @@ """)) def test_sanitize_string(self): - bot = CommitAnnouncer(MockWebKitPatch(), "test/directory", "test_password") + bot = CommitAnnouncer(MockWebKitPatch(), 'test/directory', 'test_password') self.assertEqual('normal ascii', bot._sanitize_string('normal ascii')) self.assertEqual('uni\\u0441ode!', bot._sanitize_string(u'uni\u0441ode!'))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/abstract_local_server_command.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/abstract_local_server_command.py index 7da1460..3a73833 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/abstract_local_server_command.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/abstract_local_server_command.py
@@ -30,12 +30,12 @@ class AbstractLocalServerCommand(Command): server = None - launch_path = "/" + launch_path = '/' def __init__(self): options = [ - make_option("--httpd-port", action="store", type="int", default=8127, help="Port to use for the HTTP server"), - make_option("--no-show-results", action="store_false", default=True, dest="show_results", + make_option('--httpd-port', action='store', type='int', default=8127, help='Port to use for the HTTP server'), + make_option('--no-show-results', action='store_false', default=True, dest='show_results', help="Don't launch a browser with the rebaseline server"), ] super(AbstractLocalServerCommand, self).__init__(options=options) @@ -46,8 +46,8 @@ def execute(self, options, args, tool): config = self._prepare_config(options, args, tool) - server_url = "http://localhost:%d%s" % (options.httpd_port, self.launch_path) - print "Starting server at %s" % server_url + server_url = 'http://localhost:%d%s' % (options.httpd_port, self.launch_path) + print 'Starting server at %s' % server_url print "Use the 'Exit' link in the UI, %squitquitquit or Ctrl-C to stop" % server_url if options.show_results:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines.py index eac4877..f29a085 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines.py
@@ -37,10 +37,10 @@ class AnalyzeBaselines(AbstractRebaseliningCommand): - name = "analyze-baselines" - help_text = "Analyzes the baselines for the given tests and prints results that are identical." + name = 'analyze-baselines' + help_text = 'Analyzes the baselines for the given tests and prints results that are identical.' show_in_main_help = True - argument_names = "TEST_NAMES" + argument_names = 'TEST_NAMES' def __init__(self): super(AnalyzeBaselines, self).__init__(options=[ @@ -60,10 +60,10 @@ name = baseline_name(self._tool.filesystem, test_name, suffix) results_by_directory = self._baseline_optimizer.read_results_by_directory(name) if results_by_directory: - self._write("%s:" % name) - self._baseline_optimizer.write_by_directory(results_by_directory, self._write, " ") + self._write('%s:' % name) + self._baseline_optimizer.write_by_directory(results_by_directory, self._write, ' ') elif options.missing: - self._write("%s: (no baselines found)" % name) + self._write('%s: (no baselines found)' % name) def execute(self, options, args, tool): self._tool = tool
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 1d773f3..f052a27 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
@@ -26,10 +26,10 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): - name = "auto-rebaseline" - help_text = "Rebaselines any NeedsRebaseline lines in TestExpectations that have cycled through all the bots." - AUTO_REBASELINE_BRANCH_NAME = "auto-rebaseline-temporary-branch" - AUTO_REBASELINE_ALT_BRANCH_NAME = "auto-rebaseline-alt-temporary-branch" + name = 'auto-rebaseline' + help_text = 'Rebaselines any NeedsRebaseline lines in TestExpectations that have cycled through all the bots.' + AUTO_REBASELINE_BRANCH_NAME = 'auto-rebaseline-temporary-branch' + AUTO_REBASELINE_ALT_BRANCH_NAME = 'auto-rebaseline-alt-temporary-branch' # Rietveld uploader stinks. Limit the number of rebaselines in a given patch to keep upload from failing. # FIXME: http://crbug.com/263676 Obviously we should fix the uploader here. @@ -43,8 +43,8 @@ self.no_optimize_option, # FIXME: Remove this option. self.results_directory_option, - optparse.make_option("--auth-refresh-token-json", help="Rietveld auth refresh JSON token."), - optparse.make_option("--dry-run", action='store_true', default=False, + optparse.make_option('--auth-refresh-token-json', help='Rietveld auth refresh JSON token.'), + optparse.make_option('--dry-run', action='store_true', default=False, help='Run without creating a temporary branch, committing locally, or uploading/landing ' 'changes to the remote repository.') ]) @@ -70,17 +70,17 @@ _log.error("Can't rebaseline because the latest run on %s exited early.", result.builder_name()) return [] revisions.append({ - "builder": result.builder_name(), - "revision": result.chromium_revision(git), + 'builder': result.builder_name(), + 'revision': result.chromium_revision(git), }) return revisions @staticmethod def _strip_comments(line): - comment_index = line.find("#") + comment_index = line.find('#') if comment_index == -1: comment_index = len(line) - return re.sub(r"\s+", " ", line[:comment_index].strip()) + return re.sub(r"\s+", ' ', line[:comment_index].strip()) def tests_to_rebaseline(self, tool, min_revision, print_revisions): port = tool.port_factory.get() @@ -93,9 +93,9 @@ bugs = set() has_any_needs_rebaseline_lines = False - for line in tool.git().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: + if 'NeedsRebaseline' not in line: continue has_any_needs_rebaseline_lines = True @@ -113,7 +113,7 @@ test = parsed_line.group(3) if print_revisions: - _log.info("%s is waiting for r%s", test, commit_position) + _log.info('%s is waiting for r%s', test, commit_position) if not commit_position or commit_position > min_revision: continue @@ -130,7 +130,7 @@ tests.add(test) if len(tests) >= self.MAX_LINES_TO_REBASELINE: - _log.info("Too many tests to rebaseline in one patch. Doing the first %d.", self.MAX_LINES_TO_REBASELINE) + _log.info('Too many tests to rebaseline in one patch. Doing the first %d.', self.MAX_LINES_TO_REBASELINE) break return tests, revision, commit, author, bugs, has_any_needs_rebaseline_lines @@ -200,36 +200,36 @@ # FIXME: Move this somewhere more general. @staticmethod def tree_status(): - blink_tree_status_url = "http://chromium-status.appspot.com/status" + blink_tree_status_url = 'http://chromium-status.appspot.com/status' status = urllib2.urlopen(blink_tree_status_url).read().lower() - if 'closed' in status or status == "0": + if 'closed' in status or status == '0': return 'closed' - elif 'open' in status or status == "1": + elif 'open' in status or status == '1': return 'open' return 'unknown' def execute(self, options, args, tool): self._tool = tool - if tool.git().executable_name == "svn": - _log.error("Auto rebaseline only works with a git checkout.") + if tool.git().executable_name == 'svn': + _log.error('Auto rebaseline only works with a git checkout.') return if not options.dry_run and tool.git().has_working_directory_changes(): - _log.error("Cannot proceed with working directory changes. Clean working directory first.") + _log.error('Cannot proceed with working directory changes. Clean working directory first.') return revision_data = self.bot_revision_data(tool.git()) if not revision_data: return - min_revision = int(min([item["revision"] for item in revision_data])) + min_revision = int(min([item['revision'] for item in revision_data])) tests, revision, commit, author, bugs, _ = self.tests_to_rebaseline( tool, min_revision, print_revisions=options.verbose) if options.verbose: - _log.info("Min revision across all bots is %s.", min_revision) + _log.info('Min revision across all bots is %s.', min_revision) for item in revision_data: - _log.info("%s: r%s", item["builder"], item["revision"]) + _log.info('%s: r%s', item['builder'], item['revision']) if not tests: _log.debug('No tests to rebaseline.')
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 0349ea1..a70786da 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
@@ -36,21 +36,21 @@ def setUp(self): super(TestAutoRebaseline, self).setUp() self.tool.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 Precise": {"port_name": "test-linux-precise", "specifiers": ["Precise", "Release"]}, - "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Trusty", "Release"]}, - "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, - "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Win7", "Debug"]}, + '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 Precise': {'port_name': 'test-linux-precise', 'specifiers': ['Precise', 'Release']}, + 'MOCK Trusty': {'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release']}, + 'MOCK Win7': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release']}, + '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 git: [{"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 self.tool.builders = BuilderList({ - "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["Mac10.10", "Release"]}, - "MOCK Mac10.11 (dbg)": {"port_name": "test-mac-mac10.11", "specifiers": ["Mac10.11", "Debug"]}, + 'MOCK Mac10.10': {'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release']}, + 'MOCK Mac10.11 (dbg)': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Debug']}, }) self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10']) @@ -80,17 +80,17 @@ def test_tests_to_rebaseline_over_limit(self): def blame(_): - result = "" + result = '' for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): - result += ("624c3081c0 path/to/TestExpectations " - "(<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) " - "crbug.com/24182 path/to/rebaseline-%s.html [ NeedsRebaseline ]\n" % i) + result += ('624c3081c0 path/to/TestExpectations ' + '(<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.git().blame = blame expected_list_of_tests = [] for i in range(0, self.command.MAX_LINES_TO_REBASELINE): - expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) + expected_list_of_tests.append('path/to/rebaseline-%s.html' % i) min_revision = 9000 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), ( @@ -102,16 +102,16 @@ True)) def test_commit_message(self): - author = "foo@chromium.org" + author = 'foo@chromium.org' revision = 1234 - commit = "abcd567" + commit = 'abcd567' bugs = set() self.assertEqual(self.command.commit_message(author, revision, commit, bugs), 'Auto-rebaseline for r1234\n\n' 'https://chromium.googlesource.com/chromium/src/+/abcd567\n\n' 'TBR=foo@chromium.org\n') - bugs = set(["234", "345"]) + bugs = set(['234', '345']) self.assertEqual(self.command.commit_message(author, revision, commit, bugs), 'Auto-rebaseline for r1234\n\n' 'https://chromium.googlesource.com/chromium/src/+/abcd567\n\n' @@ -156,42 +156,42 @@ # Have prototype-chocolate only fail on "MOCK Mac10.11", # and pass on "Mock Mac10.10". self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "PASS", - "actual": "PASS TEXT", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'PASS', + 'actual': 'PASS TEXT', + 'is_unexpected': True }, - "prototype-chocolate.html": { - "expected": "FAIL", - "actual": "PASS" + 'prototype-chocolate.html': { + 'expected': 'FAIL', + 'actual': 'PASS' }, - "prototype-strawberry.html": { - "expected": "PASS", - "actual": "IMAGE PASS", - "is_unexpected": True + 'prototype-strawberry.html': { + 'expected': 'PASS', + 'actual': 'IMAGE PASS', + 'is_unexpected': True } } } } })) self.tool.buildbot.set_results(Build('MOCK Mac10.10'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "PASS", - "actual": "PASS", + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'PASS', + 'actual': 'PASS', }, - "prototype-chocolate.html": { - "expected": "FAIL", - "actual": "FAIL" + 'prototype-chocolate.html': { + 'expected': 'FAIL', + 'actual': 'FAIL' }, - "prototype-strawberry.html": { - "expected": "PASS", - "actual": "PASS", + 'prototype-strawberry.html': { + 'expected': 'PASS', + 'actual': 'PASS', } } } @@ -207,15 +207,15 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") - self._write_test_file(test_port, 'fast/dom/prototype-strawberry.html', "Dummy test contents") - self._write_test_file(test_port, 'fast/dom/prototype-chocolate.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') + self._write_test_file(test_port, 'fast/dom/prototype-strawberry.html', 'Dummy test contents') + self._write_test_file(test_port, 'fast/dom/prototype-chocolate.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.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 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']}, }) self.command.tree_status = lambda: 'closed' @@ -272,13 +272,13 @@ # Have prototype-chocolate only fail on "MOCK Mac10.11". self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "PASS", - "actual": "PASS TEXT", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'PASS', + 'actual': 'PASS TEXT', + 'is_unexpected': True } } } @@ -289,10 +289,10 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.builders = BuilderList({ - "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": ["Mac10.11", "Release"]}, + 'MOCK Mac10.11': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release']}, }) self.command.SECONDS_BEFORE_GIVING_UP = 0 @@ -321,13 +321,13 @@ for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "FAIL", - "actual": "PASS", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'FAIL', + 'actual': 'PASS', + 'is_unexpected': True } } } @@ -338,13 +338,13 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.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 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']}, }) self.command.tree_status = lambda: 'open' @@ -372,13 +372,13 @@ test_port = self.tool.port_factory.get('test') self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "FAIL", - "actual": "PASS", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'FAIL', + 'actual': 'PASS', + 'is_unexpected': True } } } @@ -389,12 +389,12 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.builders = BuilderList({ - "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, + 'MOCK Win7': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release']}, }) old_branch_name = self.tool.git().current_branch_or_ref try: @@ -425,13 +425,13 @@ test_port = self.tool.port_factory.get('test') self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "FAIL", - "actual": "PASS", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'FAIL', + 'actual': 'PASS', + 'is_unexpected': True } } } @@ -442,12 +442,12 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.builders = BuilderList({ - "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, + 'MOCK Win7': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release']}, }) old_branch_name = self.tool.git().current_branch_or_ref try: @@ -479,13 +479,13 @@ for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "FAIL", - "actual": "PASS", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'FAIL', + 'actual': 'PASS', + 'is_unexpected': True } } } @@ -496,13 +496,13 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.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 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']}, }) self.command.tree_status = lambda: 'open'
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 dcd202b..4503a58 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py
@@ -74,13 +74,13 @@ required_args = [] if not argument_names: return required_args - split_args = argument_names.split(" ") + split_args = argument_names.split(' ') for argument in split_args: if argument[0] == '[': # For now our parser is rather dumb. Do some minimal validation that # we haven't confused it. if argument[-1] != ']': - raise Exception("Failure to parse argument string %s. Argument %s is missing ending ]" % + raise Exception('Failure to parse argument string %s. Argument %s is missing ending ]' % (argument_names, argument)) else: required_args.append(argument) @@ -89,9 +89,9 @@ def name_with_arguments(self): usage_string = self.name if self.options: - usage_string += " [options]" + usage_string += ' [options]' if self.argument_names: - usage_string += " " + self.argument_names + usage_string += ' ' + self.argument_names return usage_string def parse_args(self, args): @@ -100,24 +100,24 @@ def check_arguments_and_execute(self, options, args, tool=None): if len(args) < len(self.required_arguments): _log.error("%s required, %s provided. Provided: %s Required: %s\nSee '%s help %s' for usage.", - pluralize("argument", len(self.required_arguments)), - pluralize("argument", len(args)), - "'%s'" % " ".join(args), - " ".join(self.required_arguments), + pluralize('argument', len(self.required_arguments)), + pluralize('argument', len(args)), + "'%s'" % ' '.join(args), + ' '.join(self.required_arguments), tool.name(), self.name) return 1 return self.execute(options, args, tool) or 0 def standalone_help(self): - help_text = self.name_with_arguments().ljust(len(self.name_with_arguments()) + 3) + self.help_text + "\n\n" + help_text = self.name_with_arguments().ljust(len(self.name_with_arguments()) + 3) + self.help_text + '\n\n' if self.long_help: - help_text += "%s\n\n" % self.long_help + help_text += '%s\n\n' % self.long_help help_text += self.option_parser.format_option_help(optparse.IndentedHelpFormatter()) return help_text def execute(self, options, args, tool): - raise NotImplementedError("subclasses must implement") + raise NotImplementedError('subclasses must implement') # 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. @@ -135,14 +135,14 @@ def error(self, msg): self.print_usage(sys.stderr) - error_message = "%s: error: %s\n" % (self.get_prog_name(), msg) + error_message = '%s: error: %s\n' % (self.get_prog_name(), msg) # This method is overridden to add this one line to the output: - error_message += "\nType \"%s --help\" to see usage.\n" % self.get_prog_name() + error_message += '\nType \'%s --help\' to see usage.\n' % self.get_prog_name() self.exit(1, error_message) # We override format_epilog to avoid the default formatting which would paragraph-wrap the epilog # and also to allow us to compute the epilog lazily instead of in the constructor (allowing it to be context sensitive). def format_epilog(self, epilog): # pylint: disable=unused-argument if self.epilog_method: - return "\n%s\n" % self.epilog_method() - return "" + return '\n%s\n' % self.epilog_method() + return ''
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command_test.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command_test.py index 134aa40..18d7d68 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command_test.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command_test.py
@@ -36,7 +36,7 @@ class CommandsTest(unittest.TestCase): def assert_execute_outputs( - self, command, args=None, expected_stdout="", expected_stderr="", + self, command, args=None, expected_stdout='', expected_stderr='', expected_exception=None, expected_logs=None, options=optparse.Values(), tool=MockWebKitPatch()): args = args or [] options.blocks = None
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/commit_announcer.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/commit_announcer.py index 74e85e7..30d2fe77 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/commit_announcer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/commit_announcer.py
@@ -33,37 +33,37 @@ from webkitpy.tool.commands.command import Command _log = logging.getLogger(__name__) -ANNOUNCE_PATH = "third_party/WebKit" +ANNOUNCE_PATH = 'third_party/WebKit' class CommitAnnouncerCommand(Command): - name = "commit-announcer" - help_text = "Start an IRC bot for announcing new git commits." + name = 'commit-announcer' + help_text = 'Start an IRC bot for announcing new git commits.' show_in_main_help = True def __init__(self): options = [ - optparse.make_option("--irc-password", default=None, help="Specify IRC password to use."), + optparse.make_option('--irc-password', default=None, help='Specify IRC password to use.'), ] super(CommitAnnouncerCommand, self).__init__(options) def execute(self, options, args, tool): bot_thread = CommitAnnouncerThread(tool, ANNOUNCE_PATH, options.irc_password) bot_thread.start() - _log.info("Bot started") + _log.info('Bot started') try: while bot_thread.is_alive(): bot_thread.bot.post_new_commits() time.sleep(UPDATE_WAIT_SECONDS) except KeyboardInterrupt: - _log.error("Terminated by keyboard interrupt") + _log.error('Terminated by keyboard interrupt') except Exception: - _log.error("Unexpected error:") + _log.error('Unexpected error:') _log.error(traceback.format_exc()) if bot_thread.is_alive(): - _log.info("Disconnecting bot") + _log.info('Disconnecting bot') bot_thread.stop() else: - _log.info("Bot offline") - _log.info("Done") + _log.info('Bot offline') + _log.info('Done')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests.py index c932241..8bc9e212 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests.py
@@ -38,8 +38,8 @@ class FlakyTests(Command): - name = "print-flaky-tests" - help_text = "Print out flaky tests based on results from the flakiness dashboard" + name = 'print-flaky-tests' + help_text = 'Print out flaky tests based on results from the flakiness dashboard' show_in_main_help = True FLAKINESS_DASHBOARD_URL = 'https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=webkit_tests&tests=%s'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests_unittest.py index 73c1d2df..966c7a4 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flaky_tests_unittest.py
@@ -18,9 +18,9 @@ class FakeBotTestExpectationsFactory(object): - FAILURE_MAP = {"A": "AUDIO", "C": "CRASH", "F": "TEXT", "I": "IMAGE", "O": "MISSING", - "N": "NO DATA", "P": "PASS", "T": "TIMEOUT", "Y": "NOTRUN", "X": "SKIP", - "Z": "IMAGE+TEXT", "K": "LEAK"} + FAILURE_MAP = {'A': 'AUDIO', 'C': 'CRASH', 'F': 'TEXT', 'I': 'IMAGE', 'O': 'MISSING', + 'N': 'NO DATA', 'P': 'PASS', 'T': 'TIMEOUT', 'Y': 'NOTRUN', 'X': 'SKIP', + 'Z': 'IMAGE+TEXT', 'K': 'LEAK'} def __init__(self, builders): self.builders = builders @@ -57,8 +57,8 @@ @staticmethod def fake_builders_list(): return BuilderList({ - "foo-builder": {"port_name": "dummy-port", "specifiers": ['Linux', 'Release']}, - "bar-builder": {"port_name": "dummy-port", "specifiers": ['Mac', 'Debug']}, + 'foo-builder': {'port_name': 'dummy-port', 'specifiers': ['Linux', 'Release']}, + 'bar-builder': {'port_name': 'dummy-port', 'specifiers': ['Mac', 'Debug']}, }) def test_merge_lines(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/help_command.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/help_command.py index 625f0bf..fa700b4 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/help_command.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/help_command.py
@@ -32,18 +32,18 @@ class HelpCommand(Command): - name = "help" - help_text = "Display information about this program or its subcommands" - argument_names = "[COMMAND]" + name = 'help' + help_text = 'Display information about this program or its subcommands' + argument_names = '[COMMAND]' def __init__(self, tool=None): options = [ optparse.make_option( - "-a", - "--all-commands", - action="store_true", - dest="show_all_commands", - help="Print all available commands"), + '-a', + '--all-commands', + action='store_true', + dest='show_all_commands', + help='Print all available commands'), ] super(HelpCommand, self).__init__(options) # A hack used to pass --all-commands to help_epilog even though it's called by the OptionParser. @@ -54,19 +54,19 @@ def help_epilog(self): # Only show commands which are relevant to this checkout's SCM system. Might this be confusing to some users? if self.show_all_commands: - epilog = "All %prog commands:\n" + epilog = 'All %prog commands:\n' relevant_commands = self._tool.commands[:] else: - epilog = "Common %prog commands:\n" + epilog = 'Common %prog commands:\n' relevant_commands = filter(self._tool.should_show_in_main_help, self._tool.commands) longest_name_length = max(len(command.name) for command in relevant_commands) relevant_commands.sort(lambda a, b: cmp(a.name, b.name)) - command_help_texts = [" %s %s\n" % (command.name.ljust(longest_name_length), command.help_text) + command_help_texts = [' %s %s\n' % (command.name.ljust(longest_name_length), command.help_text) for command in relevant_commands] - epilog += "%s\n" % "".join(command_help_texts) + epilog += '%s\n' % ''.join(command_help_texts) epilog += "See '%prog help --all-commands' to list all commands.\n" epilog += "See '%prog help COMMAND' for more information on a specific command.\n" - return epilog.replace("%prog", self._tool.name()) # Use of %prog here mimics OptionParser.expand_prog_name(). + return epilog.replace('%prog', self._tool.name()) # Use of %prog here mimics OptionParser.expand_prog_name(). # FIXME: This is a hack so that we don't show --all-commands as a global option: def _remove_help_options(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines.py index 04884f2..4b0b771 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines.py
@@ -13,10 +13,10 @@ class OptimizeBaselines(AbstractRebaseliningCommand): - name = "optimize-baselines" - help_text = "Reshuffles the baselines for the given tests to use as litte space on disk as possible." + name = 'optimize-baselines' + help_text = 'Reshuffles the baselines for the given tests to use as litte space on disk as possible.' show_in_main_help = True - argument_names = "TEST_NAMES" + argument_names = 'TEST_NAMES' def __init__(self): super(OptimizeBaselines, self).__init__(options=[ @@ -30,7 +30,7 @@ name = baseline_name(self._tool.filesystem, test_name, suffix) succeeded = optimizer.optimize(name) if not succeeded: - _log.error("Heuristics failed to optimize %s", name) + _log.error('Heuristics failed to optimize %s', name) return files_to_delete, files_to_add def execute(self, options, args, tool):
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 c712d25..26eb0e9 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
@@ -20,11 +20,11 @@ def test_optimize_all_suffixes_by_default(self): test_port = self.tool.port_factory.get('test') - self._write_test_file(test_port, 'another/test.html', "Dummy test contents") - self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/test-expected.txt', "result A") - self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/test-expected.png', "result A png") - 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") + self._write_test_file(test_port, 'another/test.html', 'Dummy test contents') + self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/test-expected.txt', 'result A') + self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/test-expected.png', 'result A png') + 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') self.command.execute( optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_git': True, 'platform': 'test-mac-mac10.10'}),
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 830d8b56..9090224 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
@@ -40,15 +40,15 @@ class PrettyDiff(Command): - name = "pretty-diff" - help_text = "Shows the pretty diff in the default browser" + name = 'pretty-diff' + help_text = 'Shows the pretty diff in the default browser' show_in_main_help = True def __init__(self): options = [ - optparse.make_option("-g", "--git-commit", action="store", dest="git_commit", - help=("Operate on a local commit. If a range, the commits are squashed into one. <ref>.... " - "includes the working copy changes. UPSTREAM can be used for the upstream/tracking branch.")) + optparse.make_option('-g', '--git-commit', action='store', dest='git_commit', + help=('Operate on a local commit. If a range, the commits are squashed into one. <ref>.... ' + 'includes the working copy changes. UPSTREAM can be used for the upstream/tracking branch.')) ] super(PrettyDiff, self).__init__(options) self._tool = None @@ -57,7 +57,7 @@ self._tool = tool pretty_diff_file = self._show_pretty_diff(options) if pretty_diff_file: - diff_correct = tool.user.confirm("Was that diff correct?") + diff_correct = tool.user.confirm('Was that diff correct?') pretty_diff_file.close() if not diff_correct: sys.exit(1) @@ -74,11 +74,11 @@ # file alive until the user has had a chance to confirm the diff. return pretty_diff_file except ScriptError as error: - _log.warning("PrettyPatch failed. :(") + _log.warning('PrettyPatch failed. :(') _log.error(error.message_with_output()) self._exit(error.exit_code or 2) except OSError: - _log.warning("PrettyPatch unavailable.") + _log.warning('PrettyPatch unavailable.') def _diff(self, options): changed_files = self._tool.git().changed_files(options.git_commit) @@ -90,5 +90,5 @@ assert file_path.endswith('.html') self._tool.executive.run_command(['cygstart', file_path]) return - url = "file://%s" % urllib.quote(file_path) + url = 'file://%s' % urllib.quote(file_path) self._tool.user.open_url(url)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/queries.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/queries.py index 7b7fc87..3cbc418 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/queries.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/queries.py
@@ -40,12 +40,12 @@ class CrashLog(Command): - name = "crash-log" - help_text = "Print the newest crash log for the given process" + name = 'crash-log' + help_text = 'Print the newest crash log for the given process' show_in_main_help = True long_help = """Finds the newest crash log matching the given process name and PID and prints it to stdout.""" - argument_names = "PROCESS_NAME [PID]" + argument_names = 'PROCESS_NAME [PID]' def execute(self, options, args, tool): crash_logs = CrashLogs(tool) @@ -84,7 +84,7 @@ def execute(self, options, args, tool): if not options.paths and not args and not options.all: - print "You must either specify one or more test paths or --all." + print 'You must either specify one or more test paths or --all.' return if options.platform: @@ -137,13 +137,13 @@ output = [] if options.csv: for line in lines: - output.append("%s,%s" % (port_name, line.to_csv())) + output.append('%s,%s' % (port_name, line.to_csv())) elif lines: include_modifiers = options.full include_expectations = options.full or len(options.include_keyword) != 1 or len(options.exclude_keyword) - output.append("// For %s" % port_name) + output.append('// For %s' % port_name) for line in lines: - output.append("%s" % line.to_string(None, include_modifiers, include_expectations, include_comment=False)) + output.append('%s' % line.to_string(None, include_modifiers, include_expectations, include_comment=False)) return output @@ -167,7 +167,7 @@ def execute(self, options, args, tool): if not args and not options.all: - print "You must either specify one or more test paths or --all." + print 'You must either specify one or more test paths or --all.' return default_port = tool.port_factory.get() @@ -187,7 +187,7 @@ if port_name != port_names[0]: print if not options.csv: - print "// For %s" % port_name + print '// For %s' % port_name port = tool.port_factory.get(port_name) for test_name in tests: self._print_baselines(options, port_name, test_name, port.expected_baselines_by_extension(test_name)) @@ -197,7 +197,7 @@ baseline_location = baselines[extension] if baseline_location: if options.csv: - print "%s,%s,%s,%s,%s,%s" % (port_name, test_name, self._platform_for_path(test_name), + print '%s,%s,%s,%s,%s,%s' % (port_name, test_name, self._platform_for_path(test_name), extension[1:], baseline_location, self._platform_for_path(baseline_location)) else: print baseline_location
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 0e0f965..7b1bea93 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -85,10 +85,10 @@ return self._tool.filesystem.splitext(test_name)[0] def _file_name_for_actual_result(self, test_name, suffix): - return "%s-actual.%s" % (self._test_root(test_name), suffix) + return '%s-actual.%s' % (self._test_root(test_name), suffix) def _file_name_for_expected_result(self, test_name, suffix): - return "%s-expected.%s" % (self._test_root(test_name), suffix) + return '%s-expected.%s' % (self._test_root(test_name), suffix) class ChangeSet(object): @@ -97,6 +97,7 @@ TODO(qyearsley): Remove this class, track list of lines to remove directly in an attribute of AbstractRebaseliningCommand. """ + def __init__(self, lines_to_remove=None): self.lines_to_remove = lines_to_remove or {} @@ -126,7 +127,7 @@ def update(self, other): assert isinstance(other, ChangeSet) - assert type(other.lines_to_remove) is dict + assert isinstance(other.lines_to_remove, dict) for test in other.lines_to_remove: if test not in self.lines_to_remove: self.lines_to_remove[test] = [] @@ -134,8 +135,8 @@ class CopyExistingBaselinesInternal(AbstractRebaseliningCommand): - name = "copy-existing-baselines-internal" - help_text = ("Copy existing baselines down one level in the baseline order to ensure " + name = 'copy-existing-baselines-internal' + help_text = ('Copy existing baselines down one level in the baseline order to ensure ' "new baselines don't break existing passing platforms.") def __init__(self): @@ -180,7 +181,7 @@ for port in [self._tool.port_factory.get(port_name) for port_name in self._tool.port_factory.all_port_names()]: if self._tool.filesystem.basename(port.baseline_version_dir()) == baseline: return port - raise Exception("Failed to find port for primary baseline %s." % baseline) + raise Exception('Failed to find port for primary baseline %s.' % baseline) def _copy_existing_baseline(self, builder_name, test_name, suffix): """Copies the baseline for the given builder to all "predecessor" directories.""" @@ -194,26 +195,26 @@ # Need to gather all the baseline paths before modifying the filesystem since # the modifications can affect the results of port.expected_filename. for port in ports: - old_baseline = port.expected_filename(test_name, "." + suffix) + old_baseline = port.expected_filename(test_name, '.' + suffix) if not self._tool.filesystem.exists(old_baseline): - _log.debug("No existing baseline for %s.", test_name) + _log.debug('No existing baseline for %s.', test_name) continue new_baseline = self._tool.filesystem.join( port.baseline_version_dir(), self._file_name_for_expected_result(test_name, suffix)) if self._tool.filesystem.exists(new_baseline): - _log.debug("Existing baseline at %s, not copying over it.", new_baseline) + _log.debug('Existing baseline at %s, not copying over it.', new_baseline) continue generic_expectations = TestExpectations(port, tests=[test_name], include_overrides=False) full_expectations = TestExpectations(port, tests=[test_name], include_overrides=True) # TODO(qyearsley): Change Port.skips_test so that this can be simplified. if SKIP in full_expectations.get_expectations(test_name): - _log.debug("%s is skipped (perhaps temporarily) on %s.", test_name, port.name()) + _log.debug('%s is skipped (perhaps temporarily) on %s.', test_name, port.name()) continue if port.skips_test(test_name, generic_expectations, full_expectations): - _log.debug("%s is skipped on %s.", test_name, port.name()) + _log.debug('%s is skipped on %s.', test_name, port.name()) continue old_baselines.append(old_baseline) @@ -223,7 +224,7 @@ old_baseline = old_baselines[i] new_baseline = new_baselines[i] - _log.debug("Copying baseline from %s to %s.", old_baseline, new_baseline) + _log.debug('Copying baseline from %s to %s.', old_baseline, new_baseline) self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dirname(new_baseline)) self._tool.filesystem.copyfile(old_baseline, new_baseline) @@ -234,8 +235,8 @@ class RebaselineTest(AbstractRebaseliningCommand): - name = "rebaseline-test-internal" - help_text = "Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands." + name = 'rebaseline-test-internal' + help_text = 'Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands.' def __init__(self): super(RebaselineTest, self).__init__(options=[ @@ -248,7 +249,7 @@ def _save_baseline(self, data, target_baseline): if not data: - _log.debug("No baseline data to save.") + _log.debug('No baseline data to save.') return filesystem = self._tool.filesystem @@ -258,10 +259,10 @@ def _rebaseline_test(self, builder_name, test_name, suffix, results_url): baseline_directory = self._baseline_directory(builder_name) - source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_result(test_name, suffix)) + source_baseline = '%s/%s' % (results_url, self._file_name_for_actual_result(test_name, suffix)) target_baseline = self._tool.filesystem.join(baseline_directory, self._file_name_for_expected_result(test_name, suffix)) - _log.debug("Retrieving source %s for target %s.", source_baseline, target_baseline) + _log.debug('Retrieving source %s for target %s.', source_baseline, target_baseline) self._save_baseline(self._tool.web.get_binary(source_baseline, return_none_on_404=True), target_baseline) @@ -271,7 +272,7 @@ port = self._tool.port_factory.get_from_builder_name(options.builder) if port.reference_files(options.test): if 'png' in self._baseline_suffix_list: - _log.warning("Cannot rebaseline image result for reftest: %s", options.test) + _log.warning('Cannot rebaseline image result for reftest: %s', options.test) return assert self._baseline_suffix_list == ['txt'] @@ -509,9 +510,9 @@ return for test, builds_to_check in sorted(test_prefix_list.items()): - _log.info("Rebaselining %s", test) + _log.info('Rebaselining %s', test) for build, suffixes in sorted(builds_to_check.items()): - _log.debug(" %s: %s", build, ",".join(suffixes)) + _log.debug(' %s: %s', build, ','.join(suffixes)) copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = self._rebaseline_commands( test_prefix_list, options) @@ -625,8 +626,8 @@ class RebaselineJson(AbstractParallelRebaselineCommand): - name = "rebaseline-json" - help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts." + name = 'rebaseline-json' + help_text = 'Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts.' def __init__(self,): super(RebaselineJson, self).__init__(options=[ @@ -640,8 +641,8 @@ class RebaselineExpectations(AbstractParallelRebaselineCommand): - name = "rebaseline-expectations" - help_text = "Rebaselines the tests indicated in TestExpectations." + name = 'rebaseline-expectations' + help_text = 'Rebaselines the tests indicated in TestExpectations.' show_in_main_help = True def __init__(self): @@ -667,10 +668,10 @@ tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name)).items() if tests: - _log.info("Retrieving results for %s from %s.", port_name, builder_name) + _log.info('Retrieving results for %s from %s.', port_name, builder_name) for test_name, suffixes in tests: - _log.info(" %s (%s)", test_name, ','.join(suffixes)) + _log.info(' %s (%s)', test_name, ','.join(suffixes)) if test_name not in self._test_prefix_list: self._test_prefix_list[test_name] = {} self._test_prefix_list[test_name][Build(builder_name)] = suffixes @@ -683,17 +684,17 @@ for port_name in port_names: self._add_tests_to_rebaseline(port_name) if not self._test_prefix_list: - _log.warning("Did not find any tests marked Rebaseline.") + _log.warning('Did not find any tests marked Rebaseline.') return self.rebaseline(options, self._test_prefix_list) class Rebaseline(AbstractParallelRebaselineCommand): - name = "rebaseline" - help_text = "Rebaseline tests with results from the build bots." + name = 'rebaseline' + help_text = 'Rebaseline tests with results from the build bots.' show_in_main_help = True - argument_names = "[TEST_NAMES]" + argument_names = '[TEST_NAMES]' def __init__(self): super(Rebaseline, self).__init__(options=[ @@ -701,30 +702,30 @@ # FIXME: should we support the platform options in addition to (or instead of) --builders? self.suffixes_option, self.results_directory_option, - optparse.make_option("--builders", default=None, action="append", - help=("Comma-separated-list of builders to pull new baselines from " - "(can also be provided multiple times).")), + optparse.make_option('--builders', default=None, action='append', + help=('Comma-separated-list of builders to pull new baselines from ' + '(can also be provided multiple times).')), ]) def _builders_to_pull_from(self): return self._tool.user.prompt_with_list( - "Which builder to pull results from:", self._release_builders(), can_choose_multiple=True) + 'Which builder to pull results from:', self._release_builders(), can_choose_multiple=True) def execute(self, options, args, tool): self._tool = tool if not args: - _log.error("Must list tests to rebaseline.") + _log.error('Must list tests to rebaseline.') return if options.builders: builders_to_check = [] for builder_names in options.builders: - builders_to_check += builder_names.split(",") + builders_to_check += builder_names.split(',') else: builders_to_check = self._builders_to_pull_from() test_prefix_list = {} - suffixes_to_update = options.suffixes.split(",") + suffixes_to_update = options.suffixes.split(',') for builder in builders_to_check: for test in args: @@ -734,6 +735,6 @@ test_prefix_list[test][build] = suffixes_to_update if options.verbose: - _log.debug("rebaseline-json: " + str(test_prefix_list)) + _log.debug('rebaseline-json: ' + str(test_prefix_list)) self.rebaseline(options, test_prefix_list)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py index 795e4d4..9141a8e 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
@@ -115,11 +115,9 @@ def trigger_builds(self, builders): _log.info('Triggering try jobs for:') - command = ['try'] for builder in sorted(builders): _log.info(' %s', builder) - command.extend(['-b', builder]) - self.git_cl().run(command) + self.git_cl().trigger_try_jobs(builders) def builders_with_no_results(self, builds): """Returns the set of builders that don't have finished results."""
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 325db465..0ff2ad8 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
@@ -262,7 +262,7 @@ '--tests-root', '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt' ], - ['git', 'cl', 'try', '-b', 'MOCK Try Linux'] + ['git', 'cl', 'try', '-m', 'tryserver.blink', '-b', 'MOCK Try Linux'] ]) def test_rebaseline_calls(self): @@ -276,7 +276,7 @@ self.command.rebaseline( self.command_options(), - {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt", "png"]}}) + {'fast/dom/prototype-taco.html': {Build('MOCK Try Win', 5000): ['txt', 'png']}}) self.assertEqual( self.tool.executive.calls, @@ -293,7 +293,7 @@ self.command.trigger_builds(['MOCK Try Linux', 'MOCK Try Win']) self.assertEqual( self.tool.executive.calls, - [['git', 'cl', 'try', '-b', 'MOCK Try Linux', '-b', 'MOCK Try Win']]) + [['git', 'cl', 'try', '-m', 'tryserver.blink', '-b', 'MOCK Try Linux', '-b', 'MOCK Try Win']]) self.assertLog([ 'INFO: Triggering try jobs for:\n', 'INFO: MOCK Try Linux\n',
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 51c96f4..00f97fd4b 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
@@ -51,10 +51,10 @@ class RebaselineServer(AbstractLocalServerCommand): - name = "rebaseline-server" + name = 'rebaseline-server' help_text = __doc__ show_in_main_help = True - argument_names = "/path/to/results/directory" + argument_names = '/path/to/results/directory' server = RebaselineHTTPServer @@ -97,8 +97,8 @@ return { 'test_config': self._test_config, - "results_json": results_json, - "platforms_json": { + 'results_json': results_json, + 'platforms_json': { 'platforms': platforms, 'defaultPlatform': port.name(), },
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 bf288d5..891c349 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
@@ -29,24 +29,24 @@ self.command = self.command_constructor() self.command._tool = self.tool self.tool.builders = BuilderList({ - "MOCK Mac10.10 (dbg)": {"port_name": "test-mac-mac10.10", "specifiers": ["Mac10.10", "Debug"]}, - "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["Mac10.10", "Release"]}, - "MOCK Mac10.11 (dbg)": {"port_name": "test-mac-mac10.11", "specifiers": ["Mac10.11", "Debug"]}, - "MOCK Mac10.11 ASAN": {"port_name": "test-mac-mac10.11", "specifiers": ["Mac10.11", "Release"]}, - "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": ["Mac10.11", "Release"]}, - "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": ["Precise", "Release"]}, - "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Trusty", "Release"]}, - "MOCK Win10": {"port_name": "test-win-win10", "specifiers": ["Win10", "Release"]}, - "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Win7", "Debug"]}, - "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7", "specifiers": ["Win7", "Debug"]}, - "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7", "specifiers": ["Win7", "Debug"]}, - "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "Release"]}, + 'MOCK Mac10.10 (dbg)': {'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Debug']}, + 'MOCK Mac10.10': {'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release']}, + 'MOCK Mac10.11 (dbg)': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Debug']}, + 'MOCK Mac10.11 ASAN': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release']}, + 'MOCK Mac10.11': {'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release']}, + 'MOCK Precise': {'port_name': 'test-linux-precise', 'specifiers': ['Precise', 'Release']}, + 'MOCK Trusty': {'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release']}, + 'MOCK Win10': {'port_name': 'test-win-win10', 'specifiers': ['Win10', 'Release']}, + 'MOCK Win7 (dbg)': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Debug']}, + 'MOCK Win7 (dbg)(1)': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Debug']}, + 'MOCK Win7 (dbg)(2)': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Debug']}, + 'MOCK Win7': {'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release']}, }) - self.mac_port = self.tool.port_factory.get_from_builder_name("MOCK Mac10.11") + self.mac_port = self.tool.port_factory.get_from_builder_name('MOCK Mac10.11') self.mac_expectations_path = self.mac_port.path_to_generic_test_expectations_file() self.tool.filesystem.write_text_file( - self.tool.filesystem.join(self.mac_port.layout_tests_dir(), "VirtualTestSuites"), '[]') + self.tool.filesystem.join(self.mac_port.layout_tests_dir(), 'VirtualTestSuites'), '[]') # In AbstractParallelRebaselineCommand._rebaseline_commands, a default port # object is gotten using self.tool.port_factory.get(), which is used to get @@ -87,15 +87,15 @@ def _setup_mock_build_data(self): for builder in ['MOCK Win7', 'MOCK Win7 (dbg)', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "userscripts": { - "first-test.html": { - "expected": "PASS", - "actual": "IMAGE+TEXT" + 'tests': { + 'userscripts': { + 'first-test.html': { + 'expected': 'PASS', + 'actual': 'IMAGE+TEXT' }, - "second-test.html": { - "expected": "FAIL", - "actual": "IMAGE+TEXT" + 'second-test.html': { + 'expected': 'FAIL', + 'actual': 'IMAGE+TEXT' } } } @@ -195,8 +195,8 @@ 'original test-win-win10 result') self._write( port.path_to_generic_test_expectations_file(), - ("[ Win ] failures/expected/image.html [ Failure ]\n" - "[ Linux ] failures/expected/image.html [ Skip ]\n")) + ('[ Win ] failures/expected/image.html [ Failure ]\n' + '[ Linux ] failures/expected/image.html [ Skip ]\n')) self.command.execute(self.options(builder='MOCK Win10', test='failures/expected/image.html'), [], self.tool) @@ -221,35 +221,35 @@ @staticmethod def options(**kwargs): return optparse.Values(dict({ - 'builder': "MOCK Mac10.11", - 'test': "userscripts/another-test.html", - 'suffixes': "txt", + 'builder': 'MOCK Mac10.11', + 'test': 'userscripts/another-test.html', + 'suffixes': 'txt', 'results_directory': None, 'build_number': None }, **kwargs)) def test_baseline_directory(self): command = self.command - self.assertMultiLineEqual(command._baseline_directory("MOCK Mac10.11"), - "/test.checkout/LayoutTests/platform/test-mac-mac10.11") - self.assertMultiLineEqual(command._baseline_directory("MOCK Mac10.10"), - "/test.checkout/LayoutTests/platform/test-mac-mac10.10") - self.assertMultiLineEqual(command._baseline_directory("MOCK Trusty"), - "/test.checkout/LayoutTests/platform/test-linux-trusty") - self.assertMultiLineEqual(command._baseline_directory("MOCK Precise"), - "/test.checkout/LayoutTests/platform/test-linux-precise") + self.assertMultiLineEqual(command._baseline_directory('MOCK Mac10.11'), + '/test.checkout/LayoutTests/platform/test-mac-mac10.11') + self.assertMultiLineEqual(command._baseline_directory('MOCK Mac10.10'), + '/test.checkout/LayoutTests/platform/test-mac-mac10.10') + self.assertMultiLineEqual(command._baseline_directory('MOCK Trusty'), + '/test.checkout/LayoutTests/platform/test-linux-trusty') + self.assertMultiLineEqual(command._baseline_directory('MOCK Precise'), + '/test.checkout/LayoutTests/platform/test-linux-precise') def test_rebaseline_updates_expectations_file_noop(self): self._zero_out_test_expectations() self._write( self.mac_expectations_path, - ("Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]\n" - "Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]\n")) - self._write("fast/dom/Window/window-postmessage-clone-really-deep-array.html", "Dummy test contents") - self._write("fast/css/large-list-of-rules-crash.html", "Dummy test contents") - self._write("userscripts/another-test.html", "Dummy test contents") + ('Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]\n' + 'Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]\n')) + self._write('fast/dom/Window/window-postmessage-clone-really-deep-array.html', 'Dummy test contents') + self._write('fast/css/large-list-of-rules-crash.html', 'Dummy test contents') + self._write('userscripts/another-test.html', 'Dummy test contents') - self.command._rebaseline_test_and_update_expectations(self.options(suffixes="png,wav,txt")) + self.command._rebaseline_test_and_update_expectations(self.options(suffixes='png,wav,txt')) self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.png', @@ -258,28 +258,28 @@ new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( new_expectations, - ("Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]\n" - "Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]\n")) + ('Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]\n' + 'Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]\n')) def test_rebaseline_test(self): - self.command._rebaseline_test("MOCK Trusty", "userscripts/another-test.html", "txt", self.WEB_PREFIX) + self.command._rebaseline_test('MOCK Trusty', 'userscripts/another-test.html', 'txt', self.WEB_PREFIX) self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) def test_rebaseline_test_with_results_directory(self): - self._write("userscripts/another-test.html", "test data") + self._write('userscripts/another-test.html', 'test data') self._write( self.mac_expectations_path, - ("Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n" - "bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n")) + ('Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n' + 'bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n')) self.command._rebaseline_test_and_update_expectations(self.options(results_directory='/tmp')) self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscripts/another-test-actual.txt']) def test_rebaseline_reftest(self): - self._write("userscripts/another-test.html", "test data") - self._write("userscripts/another-test-expected.html", "generic result") + self._write('userscripts/another-test.html', 'test data') + self._write('userscripts/another-test-expected.html', 'generic result') OutputCapture().assert_outputs( self, self.command._rebaseline_test_and_update_expectations, args=[self.options(suffixes='png')], - expected_logs="Cannot rebaseline image result for reftest: userscripts/another-test.html\n") + expected_logs='Cannot rebaseline image result for reftest: userscripts/another-test.html\n') self.assertDictEqual(self.command.expectation_line_changes.to_dict(), {'remove-lines': []}) def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): @@ -296,10 +296,10 @@ try: options = optparse.Values({ 'optimize': True, - 'builder': "MOCK Win10", - 'suffixes': "txt", + 'builder': 'MOCK Win10', + 'suffixes': 'txt', 'verbose': True, - 'test': "failures/expected/image.html", + 'test': 'failures/expected/image.html', 'results_directory': None, 'build_number': None }) @@ -324,8 +324,8 @@ def test_builders_to_fetch_from(self): builders_to_fetch = self.command._builders_to_fetch_from( - ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"]) - self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"]) + ['MOCK Win10', 'MOCK Win7 (dbg)(1)', 'MOCK Win7 (dbg)(2)', 'MOCK Win7']) + self.assertEqual(builders_to_fetch, ['MOCK Win7', 'MOCK Win10']) def test_all_baseline_paths(self): test_prefix_list = { @@ -383,27 +383,27 @@ self._setup_mock_build_data() self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ - "tests": { - "userscripts": { - "first-test.html": { - "expected": "NEEDSREBASELINE", - "actual": "PASS" + 'tests': { + 'userscripts': { + 'first-test.html': { + 'expected': 'NEEDSREBASELINE', + 'actual': 'PASS' } } } })) - self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.html [ Failure ]\n") - self._write("userscripts/first-test.html", "Dummy test contents") - self.command.rebaseline(self.options(), {"userscripts/first-test.html": {Build("MOCK Win7"): ["txt", "png"]}}) + self._write(self.mac_expectations_path, 'Bug(x) userscripts/first-test.html [ Failure ]\n') + self._write('userscripts/first-test.html', 'Dummy test contents') + self.command.rebaseline(self.options(), {'userscripts/first-test.html': {Build('MOCK Win7'): ['txt', 'png']}}) self.assertEqual(self.tool.executive.calls, []) def test_rebaseline_all(self): self._setup_mock_build_data() - self._write("userscripts/first-test.html", "Dummy test contents") - self.command.rebaseline(self.options(), {"userscripts/first-test.html": {Build("MOCK Win7"): ["txt", "png"]}}) + self._write('userscripts/first-test.html', 'Dummy test contents') + self.command.rebaseline(self.options(), {'userscripts/first-test.html': {Build('MOCK Win7'): ['txt', 'png']}}) # Note that we have one run_in_parallel() call followed by a run_command() self.assertEqual( @@ -420,8 +420,8 @@ def test_rebaseline_debug(self): self._setup_mock_build_data() - self._write("userscripts/first-test.html", "Dummy test contents") - self.command.rebaseline(self.options(), {"userscripts/first-test.html": {Build("MOCK Win7 (dbg)"): ["txt", "png"]}}) + self._write('userscripts/first-test.html', 'Dummy test contents') + self.command.rebaseline(self.options(), {'userscripts/first-test.html': {Build('MOCK Win7 (dbg)'): ['txt', 'png']}}) # Note that we have one run_in_parallel() call followed by a run_command() self.assertEqual( @@ -437,10 +437,10 @@ def test_no_optimize(self): self._setup_mock_build_data() - self._write("userscripts/first-test.html", "Dummy test contents") + self._write('userscripts/first-test.html', 'Dummy test contents') self.command.rebaseline( self.options(optimize=False), - {"userscripts/first-test.html": {Build("MOCK Win7"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Win7'): ['txt', 'png']}}) # Note that we have only one run_in_parallel() call self.assertEqual( @@ -454,10 +454,10 @@ def test_results_directory(self): self._setup_mock_build_data() - self._write("userscripts/first-test.html", "Dummy test contents") + self._write('userscripts/first-test.html', 'Dummy test contents') self.command.rebaseline( self.options(optimize=False, results_directory='/tmp'), - {"userscripts/first-test.html": {Build("MOCK Win7"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Win7'): ['txt', 'png']}}) # Note that we have only one run_in_parallel() call self.assertEqual( @@ -508,48 +508,48 @@ def test_rebaseline_updates_expectations_file(self): self._write( self.mac_expectations_path, - ("Bug(x) [ Mac ] userscripts/first-test.html [ Failure ]\n" - "bug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n")) - self._write("userscripts/first-test.html", "Dummy test contents") + ('Bug(x) [ Mac ] userscripts/first-test.html [ Failure ]\n' + 'bug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n')) + self._write('userscripts/first-test.html', 'Dummy test contents') self._setup_mock_build_data() self.command.rebaseline( self.options(), - {"userscripts/first-test.html": {Build("MOCK Mac10.11"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Mac10.11'): ['txt', 'png']}}) new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( new_expectations, - ("Bug(x) [ Mac10.10 ] userscripts/first-test.html [ Failure ]\n" - "bug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n")) + ('Bug(x) [ Mac10.10 ] userscripts/first-test.html [ Failure ]\n' + 'bug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n')) def test_rebaseline_updates_expectations_file_all_platforms(self): - self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.html [ Failure ]\n") - self._write("userscripts/first-test.html", "Dummy test contents") + self._write(self.mac_expectations_path, 'Bug(x) userscripts/first-test.html [ Failure ]\n') + self._write('userscripts/first-test.html', 'Dummy test contents') self._setup_mock_build_data() self.command.rebaseline( self.options(), - {"userscripts/first-test.html": {Build("MOCK Mac10.11"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Mac10.11'): ['txt', 'png']}}) new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( - new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n") + new_expectations, 'Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n') def test_rebaseline_handles_platform_skips(self): # This test is just like test_rebaseline_updates_expectations_file_all_platforms(), # except that if a particular port happens to SKIP a test in an overrides file, # we count that as passing, and do not think that we still need to rebaseline it. - self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.html [ Failure ]\n") - self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ WontFix ]\n") - self._write("userscripts/first-test.html", "Dummy test contents") + self._write(self.mac_expectations_path, 'Bug(x) userscripts/first-test.html [ Failure ]\n') + self._write('NeverFixTests', 'Bug(y) [ Android ] userscripts [ WontFix ]\n') + self._write('userscripts/first-test.html', 'Dummy test contents') self._setup_mock_build_data() self.command.rebaseline( self.options(), - {"userscripts/first-test.html": {Build("MOCK Mac10.11"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Mac10.11'): ['txt', 'png']}}) new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( - new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n") + new_expectations, 'Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n') def test_rebaseline_handles_skips_in_file(self): # This test is like test_Rebaseline_handles_platform_skips, except that the @@ -558,38 +558,38 @@ # qualified as "[Linux Mac Win]"; if it was unqualified, it would conflict with # the second line. self._write(self.mac_expectations_path, - ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Failure ]\n" - "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) - self._write("userscripts/first-test.html", "Dummy test contents") + ('Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Failure ]\n' + 'Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n')) + self._write('userscripts/first-test.html', 'Dummy test contents') self._setup_mock_build_data() self.command.rebaseline( self.options(), - {"userscripts/first-test.html": {Build("MOCK Mac10.11"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Mac10.11'): ['txt', 'png']}}) new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( new_expectations, - ("Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n" - "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) + ('Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n' + 'Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n')) def test_rebaseline_handles_smoke_tests(self): # This test is just like test_rebaseline_handles_platform_skips, except that we check for # a test not being in the SmokeTests file, instead of using overrides files. # If a test is not part of the smoke tests, we count that as passing on ports that only # run smoke tests, and do not think that we still need to rebaseline it. - self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.html [ Failure ]\n") - self._write("SmokeTests", "fast/html/article-element.html") - self._write("userscripts/first-test.html", "Dummy test contents") + self._write(self.mac_expectations_path, 'Bug(x) userscripts/first-test.html [ Failure ]\n') + self._write('SmokeTests', 'fast/html/article-element.html') + self._write('userscripts/first-test.html', 'Dummy test contents') self._setup_mock_build_data() self.command.rebaseline( self.options(), - {"userscripts/first-test.html": {Build("MOCK Mac10.11"): ["txt", "png"]}}) + {'userscripts/first-test.html': {Build('MOCK Mac10.11'): ['txt', 'png']}}) new_expectations = self._read(self.mac_expectations_path) self.assertMultiLineEqual( - new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n") + new_expectations, 'Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failure ]\n') class TestRebaseline(BaseTestCase): @@ -600,7 +600,7 @@ def test_rebaseline(self): self.command._builders_to_pull_from = lambda: ['MOCK Win7'] - self._write("userscripts/first-test.html", "test data") + self._write('userscripts/first-test.html', 'test data') self._zero_out_test_expectations() self._setup_mock_build_data() @@ -608,7 +608,7 @@ 'results_directory': False, 'optimize': False, 'builders': None, - 'suffixes': "txt,png", + 'suffixes': 'txt,png', 'verbose': True }) self.command.execute(options, ['userscripts/first-test.html'], self.tool) @@ -625,15 +625,15 @@ def test_rebaseline_directory(self): self.command._builders_to_pull_from = lambda: ['MOCK Win7'] - self._write("userscripts/first-test.html", "test data") - self._write("userscripts/second-test.html", "test data") + self._write('userscripts/first-test.html', 'test data') + self._write('userscripts/second-test.html', 'test data') self._setup_mock_build_data() options = optparse.Values({ 'results_directory': False, 'optimize': False, 'builders': None, - 'suffixes': "txt,png", + 'suffixes': 'txt,png', 'verbose': True }) self.command.execute(options, ['userscripts'], self.tool) @@ -684,22 +684,22 @@ for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "userscripts": { - "another-test.html": { - "expected": "PASS", - "actual": "PASS TEXT" + 'tests': { + 'userscripts': { + 'another-test.html': { + 'expected': 'PASS', + 'actual': 'PASS TEXT' }, - "images.svg": { - "expected": "FAIL", - "actual": "IMAGE+TEXT" + 'images.svg': { + 'expected': 'FAIL', + 'actual': 'IMAGE+TEXT' } } } })) - self._write("userscripts/another-test.html", "Dummy test contents") - self._write("userscripts/images.svg", "Dummy test contents") + self._write('userscripts/another-test.html', 'Dummy test contents') + self._write('userscripts/images.svg', 'Dummy test contents') self.command._tests_to_rebaseline = lambda port: { 'userscripts/another-test.html': set(['txt']), 'userscripts/images.svg': set(['png']), @@ -738,27 +738,27 @@ for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "userscripts": { - "reftest-text.html": { - "expected": "PASS", - "actual": "TEXT" + 'tests': { + 'userscripts': { + 'reftest-text.html': { + 'expected': 'PASS', + 'actual': 'TEXT' }, - "reftest-image.html": { - "expected": "FAIL", - "actual": "IMAGE" + 'reftest-image.html': { + 'expected': 'FAIL', + 'actual': 'IMAGE' }, - "reftest-image-text.html": { - "expected": "FAIL", - "actual": "IMAGE+TEXT" + 'reftest-image-text.html': { + 'expected': 'FAIL', + 'actual': 'IMAGE+TEXT' } } } })) - self._write("userscripts/reftest-text.html", "Dummy test contents") - self._write("userscripts/reftest-text-expected.html", "Dummy test contents") - self._write("userscripts/reftest-text-expected.html", "Dummy test contents") + self._write('userscripts/reftest-text.html', 'Dummy test contents') + self._write('userscripts/reftest-text-expected.html', 'Dummy test contents') + self._write('userscripts/reftest-text-expected.html', 'Dummy test contents') self.command._tests_to_rebaseline = lambda port: { 'userscripts/reftest-text.html': set(['txt']), 'userscripts/reftest-image.html': set(['png']), @@ -812,8 +812,8 @@ self.assertEqual(self._read(self.mac_expectations_path), '') def test_rebaseline_without_other_expectations(self): - self._write("userscripts/another-test.html", "Dummy test contents") - self._write(self.mac_expectations_path, "Bug(x) userscripts/another-test.html [ Rebaseline ]\n") + self._write('userscripts/another-test.html', 'Dummy test contents') + self._write(self.mac_expectations_path, 'Bug(x) userscripts/another-test.html [ Rebaseline ]\n') self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), {'userscripts/another-test.html': ('png', 'wav', 'txt')}) @@ -822,13 +822,13 @@ for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "prototype-taco.html": { - "expected": "FAIL", - "actual": "PASS", - "is_unexpected": True + 'tests': { + 'fast': { + 'dom': { + 'prototype-taco.html': { + 'expected': 'FAIL', + 'actual': 'PASS', + 'is_unexpected': True } } } @@ -839,13 +839,13 @@ Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ] """) - self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") + self._write_test_file(test_port, 'fast/dom/prototype-taco.html', 'Dummy test contents') self.tool.executive = MockLineRemovingExecutive() self.tool.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 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']}, }) self.command.execute(self.options(), [], self.tool) @@ -858,36 +858,36 @@ def test_rebaseline_missing(self): self.tool.buildbot.set_results(Build('MOCK Mac10.10'), LayoutTestResults({ - "tests": { - "fast": { - "dom": { - "missing-text.html": { - "expected": "PASS", - "actual": "MISSING", - "is_unexpected": True, - "is_missing_text": True + 'tests': { + 'fast': { + 'dom': { + 'missing-text.html': { + 'expected': 'PASS', + 'actual': 'MISSING', + 'is_unexpected': True, + 'is_missing_text': True }, - "missing-text-and-image.html": { - "expected": "PASS", - "actual": "MISSING", - "is_unexpected": True, - "is_missing_text": True, - "is_missing_image": True + 'missing-text-and-image.html': { + 'expected': 'PASS', + 'actual': 'MISSING', + 'is_unexpected': True, + 'is_missing_text': True, + 'is_missing_image': True }, - "missing-image.html": { - "expected": "PASS", - "actual": "MISSING", - "is_unexpected": True, - "is_missing_image": True + 'missing-image.html': { + 'expected': 'PASS', + 'actual': 'MISSING', + 'is_unexpected': True, + 'is_missing_image': True } } } } })) - self._write('fast/dom/missing-text.html', "Dummy test contents") - self._write('fast/dom/missing-text-and-image.html', "Dummy test contents") - self._write('fast/dom/missing-image.html', "Dummy test contents") + self._write('fast/dom/missing-text.html', 'Dummy test contents') + self._write('fast/dom/missing-text-and-image.html', 'Dummy test contents') + self._write('fast/dom/missing-image.html', 'Dummy test contents') self.command._tests_to_rebaseline = lambda port: { 'fast/dom/missing-text.html': set(['txt', 'png']),
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar.py index 8db9826..bd253be 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar.py
@@ -32,23 +32,23 @@ def plural(noun): # This is a dumb plural() implementation that is just enough for our uses. - if re.search("h$", noun): - return noun + "es" + if re.search('h$', noun): + return noun + 'es' else: - return noun + "s" + return noun + 's' def pluralize(noun, count): if count != 1: noun = plural(noun) - return "%d %s" % (count, noun) + return '%d %s' % (count, noun) -def join_with_separators(list_of_strings, separator=', ', only_two_separator=" and ", last_separator=', and '): +def join_with_separators(list_of_strings, separator=', ', only_two_separator=' and ', last_separator=', and '): if not list_of_strings: - return "" + return '' if len(list_of_strings) == 1: return list_of_strings[0] if len(list_of_strings) == 2: return only_two_separator.join(list_of_strings) - return "%s%s%s" % (separator.join(list_of_strings[:-1]), last_separator, list_of_strings[-1]) + return '%s%s%s' % (separator.join(list_of_strings[:-1]), last_separator, list_of_strings[-1])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar_unittest.py index 43f4e71..01a8ab0 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar_unittest.py
@@ -35,32 +35,32 @@ def test_join_with_separators_zero(self): self.assertEqual( - "", + '', grammar.join_with_separators([])) def test_join_with_separators_one(self): self.assertEqual( - "one", - grammar.join_with_separators(["one"])) + 'one', + grammar.join_with_separators(['one'])) def test_join_with_separators_two(self): self.assertEqual( - "one and two", - grammar.join_with_separators(["one", "two"])) + 'one and two', + grammar.join_with_separators(['one', 'two'])) def test_join_with_separators_three(self): self.assertEqual( - "one, two, and three", - grammar.join_with_separators(["one", "two", "three"])) + 'one, two, and three', + grammar.join_with_separators(['one', 'two', 'three'])) def test_pluralize_zero(self): - self.assertEqual("0 tests", grammar.pluralize("test", 0)) + self.assertEqual('0 tests', grammar.pluralize('test', 0)) def test_pluralize_one(self): - self.assertEqual("1 test", grammar.pluralize("test", 1)) + self.assertEqual('1 test', grammar.pluralize('test', 1)) def test_pluralize_two(self): - self.assertEqual("2 tests", grammar.pluralize("test", 2)) + self.assertEqual('2 tests', grammar.pluralize('test', 2)) def test_pluralize_two_ends_with_sh(self): - self.assertEqual("2 crashes", grammar.pluralize("crash", 2)) + self.assertEqual('2 crashes', grammar.pluralize('crash', 2))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/mock_tool.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/mock_tool.py index 2229b5c..4761163 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/mock_tool.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/mock_tool.py
@@ -35,4 +35,4 @@ MockHost.__init__(self, *args, **kwargs) def path(self): - return "echo" + return 'echo'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/layout_tests_server.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/layout_tests_server.py index 880907b9..7e9e6fe8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/layout_tests_server.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/layout_tests_server.py
@@ -41,7 +41,7 @@ class LayoutTestsHTTPServer(BaseHTTPServer.HTTPServer): def __init__(self, httpd_port, _): - server_address = ("", httpd_port) + server_address = ('', httpd_port) BaseHTTPServer.HTTPServer.__init__(self, server_address, LayoutTestsServerHTTPRequestHandler) @@ -56,13 +56,13 @@ filesystem = FileSystem() webkit_finder = WebKitFinder(filesystem) script_dir = webkit_finder.path_from_webkit_base('Tools', 'Scripts') - executable_path = script_dir + "/run-webkit-tests" - cmd = "python " + executable_path + " --no-show-results " + executable_path = script_dir + '/run-webkit-tests' + cmd = 'python ' + executable_path + ' --no-show-results ' cmd += test_list process = subprocess.Popen(cmd, shell=True, cwd=script_dir, env=None, stdout=subprocess.PIPE, stderr=STDOUT) self.send_response(200) self.send_header('Access-Control-Allow-Origin', '*') - self.send_header("Content-type", "text/html") + self.send_header('Content-type', 'text/html') self.end_headers() while process.poll() is None: html_output = '<br>' + str(process.stdout.readline()) @@ -72,7 +72,7 @@ process.wait() def do_OPTIONS(self): - self.send_response(200, "ok") + self.send_response(200, 'ok') self.send_header('Access-Control-Allow-Origin', '*') self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') - self.send_header("Access-Control-Allow-Headers", "Content-type") + self.send_header('Access-Control-Allow-Headers', 'Content-type')
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 121465b2..c3d9b3f 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
@@ -199,7 +199,7 @@ class RebaselineHTTPServer(BaseHTTPServer.HTTPServer): def __init__(self, httpd_port, config): - server_name = "" + server_name = '' BaseHTTPServer.HTTPServer.__init__(self, (server_name, httpd_port), RebaselineHTTPRequestHandler) self.test_config = config['test_config'] self.results_json = config['results_json'] @@ -208,15 +208,15 @@ class RebaselineHTTPRequestHandler(ReflectionHandler): STATIC_FILE_NAMES = frozenset([ - "index.html", - "loupe.js", - "main.js", - "main.css", - "queue.js", - "util.js", + 'index.html', + 'loupe.js', + 'main.js', + 'main.css', + 'queue.js', + 'util.js', ]) - STATIC_FILE_DIRECTORY = os.path.join(os.path.dirname(__file__), "data", "rebaseline_server") + STATIC_FILE_DIRECTORY = os.path.join(os.path.dirname(__file__), 'data', 'rebaseline_server') def results_json(self): self._serve_json(self.server.results_json) @@ -234,7 +234,7 @@ test_json = self.server.results_json['tests'][test] if test_json['state'] != STATE_NEEDS_REBASELINE: - self.send_error(400, "Test %s is in unexpected state: %s" % (test, test_json["state"])) + self.send_error(400, 'Test %s is in unexpected state: %s' % (test, test_json['state'])) return log = []
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server_unittest.py index d574ea8..b31c47f2 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaseline_server_unittest.py
@@ -310,7 +310,7 @@ class TestMacPort(Port): # Abstract method path_to_apache not implemented - pylint: disable=abstract-method - port_name = "mac" + port_name = 'mac' FALLBACK_PATHS = {'': ['mac']} return TestConfig(
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler.py index 63962f8..25dcd07 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler.py
@@ -73,25 +73,25 @@ # (https://docs.python.org/2/library/basehttpserver.html) say "Subclasses should # not need to override or extend the __init__() method." # pylint: disable=attribute-defined-outside-init - if "?" in self.path: - path, query_string = self.path.split("?", 1) + if '?' in self.path: + path, query_string = self.path.split('?', 1) self.query = cgi.parse_qs(query_string) else: path = self.path self.query = {} - function_or_file_name = path[1:] or "index.html" + function_or_file_name = path[1:] or 'index.html' _, extension = os.path.splitext(function_or_file_name) if extension in self.STATIC_FILE_EXTENSIONS: self._serve_static_file(function_or_file_name) return - function_name = function_or_file_name.replace(".", "_") + function_name = function_or_file_name.replace('.', '_') if not hasattr(self, function_name): - self.send_error(404, "Unknown function %s" % function_name) + self.send_error(404, 'Unknown function %s' % function_name) return - if function_name[0] == "_": - self.send_error(401, "Not allowed to invoke private or protected methods") + if function_name[0] == '_': + self.send_error(401, 'Not allowed to invoke private or protected methods') return function = getattr(self, function_name) function() @@ -100,7 +100,7 @@ self._serve_file(os.path.join(self.STATIC_FILE_DIRECTORY, static_path)) def quitquitquit(self): - self._serve_text("Server quit.\n") + self._serve_text('Server quit.\n') # Shutdown has to happen on another thread from the server's thread, # otherwise there's a deadlock. threading.Thread(target=self.server.shutdown).start() @@ -112,7 +112,7 @@ def _serve_text(self, text): self.send_response(200) self._send_access_control_header() - self.send_header("Content-type", "text/plain") + self.send_header('Content-type', 'text/plain') self.end_headers() self.wfile.write(text) @@ -125,22 +125,22 @@ def _serve_file(self, file_path, cacheable_seconds=0, headers_only=False): if not os.path.exists(file_path): - self.send_error(404, "File not found") + self.send_error(404, 'File not found') return - with codecs.open(file_path, "rb") as static_file: + with codecs.open(file_path, 'rb') as static_file: self.send_response(200) self._send_access_control_header() - self.send_header("Content-Length", os.path.getsize(file_path)) + self.send_header('Content-Length', os.path.getsize(file_path)) mime_type, _ = mimetypes.guess_type(file_path) if mime_type: - self.send_header("Content-type", mime_type) + self.send_header('Content-type', mime_type) if cacheable_seconds: expires_time = (datetime.datetime.now() + datetime.timedelta(0, cacheable_seconds)) expires_formatted = wsgiref.handlers.format_date_time( time.mktime(expires_time.timetuple())) - self.send_header("Expires", expires_formatted) + self.send_header('Expires', expires_formatted) self.end_headers() if not headers_only: @@ -149,7 +149,7 @@ def _serve_xml(self, xml): self.send_response(200) self._send_access_control_header() - self.send_header("Content-type", "text/xml") + self.send_header('Content-type', 'text/xml') self.end_headers() xml = xml.encode('utf-8') self.wfile.write(xml)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler_unittest.py index 69980cd21..811f0daa 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflection_handler_unittest.py
@@ -32,7 +32,7 @@ class TestReflectionHandler(ReflectionHandler): - STATIC_FILE_DIRECTORY = "/" + STATIC_FILE_DIRECTORY = '/' def __init__(self): # pylint: disable=super-init-not-called self.static_files_served = set() @@ -47,10 +47,10 @@ self.errors_sent.add(code) def function_one(self): - self.functions_run.add("function_one") + self.functions_run.add('function_one') def some_html(self): - self.functions_run.add("some_html") + self.functions_run.add('some_html') class WriteConvertingLogger(object): @@ -90,12 +90,12 @@ self.assertEqual(handler.functions_run, expected_functions) def test_static_content_or_function_switch(self): - self.assert_handler_response(["/test.js"], set(["test.js"]), set(), set()) - self.assert_handler_response(["/test.js", "/test.css", "/test.html"], - set(["test.js", "test.html", "test.css"]), set(), set()) - self.assert_handler_response(["/test.js", "/test.exe", "/testhtml"], set(["test.js"]), set([404]), set()) - self.assert_handler_response(["/test.html", "/function.one"], set(["test.html"]), set(), set(['function_one'])) - self.assert_handler_response(["/some.html"], set(["some.html"]), set(), set()) + self.assert_handler_response(['/test.js'], set(['test.js']), set(), set()) + self.assert_handler_response(['/test.js', '/test.css', '/test.html'], + set(['test.js', 'test.html', 'test.css']), set(), set()) + self.assert_handler_response(['/test.js', '/test.exe', '/testhtml'], set(['test.js']), set([404]), set()) + self.assert_handler_response(['/test.html', '/function.one'], set(['test.html']), set(), set(['function_one'])) + self.assert_handler_response(['/some.html'], set(['some.html']), set(), set()) def test_svn_log_non_ascii(self): xml_change_log = (u'<?xml version="1.0"?>\n<log>\n<logentry revision="1">\n'
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 ca5bb0a..084915c 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py
@@ -70,11 +70,11 @@ global_options = [ optparse.make_option( - "-v", "--verbose", action="store_true", dest="verbose", default=False, - help="enable all logging"), + '-v', '--verbose', action='store_true', dest='verbose', default=False, + help='enable all logging'), optparse.make_option( - "-d", "--directory", action="append", default=[], - help="Directory to look at for changed files"), + '-d', '--directory', action='append', default=[], + help='Directory to look at for changed files'), ] def __init__(self, path): @@ -111,7 +111,7 @@ command = self.command_by_name(command_name) or self.help_command if not command: - option_parser.error("%s is not a recognized command", command_name) + option_parser.error('%s is not a recognized command', command_name) command.set_option_parser(option_parser) (options, args) = command.parse_args(args) @@ -132,7 +132,7 @@ # Assume the first argument which doesn't start with "-" is the command name. command_index = 0 for arg in args: - if arg[0] != "-": + if arg[0] != '-': break command_index += 1 else: @@ -142,7 +142,7 @@ return (command, args[:command_index] + args[command_index + 1:]) def _create_option_parser(self): - usage = "Usage: %prog [options] COMMAND [ARGS]" + usage = 'Usage: %prog [options] COMMAND [ARGS]' name = optparse.OptionParser().get_prog_name() return HelpPrintingOptionParser(epilog_method=self.help_command.help_epilog, prog=name, usage=usage) @@ -153,7 +153,7 @@ def _should_execute_command(self, command): if command.requires_local_commits and not self.git().supports_local_commits(): - failure_reason = "%s requires local commits using %s in %s." % ( + failure_reason = '%s requires local commits using %s in %s.' % ( command.name, self.git().display_name(), self.git().checkout_root) return (False, failure_reason) return (True, None)
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 2f4deea..59cbd7ed 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
@@ -45,7 +45,7 @@ def fake_dir_path(self, dirname): filesystem = Host().filesystem webkit_root = WebKitFinder(filesystem).webkit_base() - return filesystem.abspath(filesystem.join(webkit_root, "LayoutTests", "css", dirname)) + return filesystem.abspath(filesystem.join(webkit_root, 'LayoutTests', 'css', dirname)) def test_read_prefixed_property_list(self): """Tests that the current list of properties requiring the -webkit- prefix load correctly."""
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_copier.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_copier.py index c3264ce..471b4f6a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_copier.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_copier.py
@@ -82,7 +82,7 @@ self._prefixed_properties = {} def do_import(self): - _log.info("Importing %s into %s", self.source_repo_path, self.destination_directory) + _log.info('Importing %s into %s', self.source_repo_path, self.destination_directory) self.find_importable_tests() self.import_tests() @@ -212,7 +212,7 @@ for line in expectation_lines: if 'SKIP' in line.expectations: if line.specifiers: - _log.warning("W3CImportExpectations:%s should not have any specifiers", line.line_numbers) + _log.warning('W3CImportExpectations:%s should not have any specifiers', line.line_numbers) continue paths_to_skip.add(line.name) return paths_to_skip
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 8ca3658..3ad5740 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
@@ -344,9 +344,10 @@ _log.info('Issue: %s', self.git_cl.run(['issue']).strip()) # First, try on Blink try bots in order to get any new baselines. + # TODO(qyearsley): Make this faster by triggering all try jobs in + # one invocation. _log.info('Triggering try jobs.') - for try_bot in self.host.builders.all_try_builder_names(): - self.git_cl.run(['try', '-b', try_bot]) + self.git_cl.trigger_try_jobs() try_results = self.git_cl.wait_for_try_jobs( poll_delay_seconds=POLL_DELAY_SECONDS, timeout_seconds=TIMEOUT_SECONDS)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser.py index 9d39db8..586f76d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser.py
@@ -51,19 +51,19 @@ try: doc = BeautifulSoup(self.filesystem.read_binary_file(filename)) except IOError: - _log.error("IOError: Failed to read %s", filename) + _log.error('IOError: Failed to read %s', filename) doc = None except HTMLParser.HTMLParseError: # FIXME: Figure out what to do if we can't parse the file. - _log.error("HTMLParseError: Failed to parse %s", filename) + _log.error('HTMLParseError: Failed to parse %s', filename) doc = None except UnicodeEncodeError: - _log.error("UnicodeEncodeError while reading %s", filename) + _log.error('UnicodeEncodeError while reading %s', filename) doc = None else: if self.filesystem.isdir(filename): # FIXME: Figure out what is triggering this and what to do about it. - _log.error("Trying to load %s, which is a directory", filename) + _log.error('Trying to load %s, which is a directory', filename) doc = None if is_ref:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py index 4412018..75680bfd 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py
@@ -54,10 +54,10 @@ path = '/repos/w3c/web-platform-tests/pulls' body = { - "title": desc_title, - "body": body, - "head": remote_branch_name, - "base": 'master', + 'title': desc_title, + 'body': body, + 'head': remote_branch_name, + 'base': 'master', } data, status_code = self.request(path, method='POST', body=body)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests.py index 4982736..4f20c35 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests.py
@@ -42,10 +42,10 @@ # Mapping of single filename to relative path under WebKit root. # Assumption: these filenames are globally unique. include_mapping = { - "js-test-style.css": "../../js/resources", - "js-test-pre.js": "../../js/resources", - "js-test-post.js": "../../js/resources", - "desktop-gl-constants.js": "resources", + 'js-test-style.css': '../../js/resources', + 'js-test-pre.js': '../../js/resources', + 'js-test-post.js': '../../js/resources', + 'desktop-gl-constants.js': 'resources', } for filename, path in include_mapping.items(): @@ -77,7 +77,7 @@ # check out_dir exists out_filename = os.path.join(out_dir, os.path.basename(in_filename)) - _log.debug("Processing " + in_filename) + _log.debug('Processing ' + in_filename) with open(in_filename, 'r') as in_file: with open(out_filename, 'w') as out_file: out_file.write(translate_khronos_test(in_file.read())) @@ -106,7 +106,7 @@ def option_parser(): - usage = "usage: %prog [options] (input file or directory)" + usage = 'usage: %prog [options] (input file or directory)' parser = optparse.OptionParser(usage=usage) parser.add_option('-v', '--verbose', action='store_true', @@ -128,7 +128,7 @@ configure_logging(options) if len(args) == 0: - _log.error("Must specify an input directory or filename.") + _log.error('Must specify an input directory or filename.') parser.print_help() return 1
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests_unittest.py index e3e3a52b..4f1b0db9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/webgl/update_webgl_conformance_tests_unittest.py
@@ -34,11 +34,11 @@ def construct_script(name): - return "<script src=\"" + name + "\"></script>\n" + return '<script src=\'' + name + '\'></script>\n' def construct_style(name): - return "<link rel=\"stylesheet\" href=\"" + name + "\">" + return '<link rel=\'stylesheet\' href=\'' + name + '\'>' class TestTranslation(unittest.TestCase): @@ -50,16 +50,16 @@ self.assertEqual(output, webgl.translate_khronos_test(input)) def test_simple_unchanged(self): - self.assert_unchanged("") - self.assert_unchanged("<html></html>") + self.assert_unchanged('') + self.assert_unchanged('<html></html>') def test_header_strip(self): - single_line_header = "<!-- single line header. -->" + single_line_header = '<!-- single line header. -->' multi_line_header = """<!-- this is a multi-line header. it should all be removed too. -->""" - text = "<html></html>" - self.assert_translate(single_line_header, "") + text = '<html></html>' + self.assert_translate(single_line_header, '') self.assert_translate(single_line_header + text, text) self.assert_translate(multi_line_header + text, text) @@ -69,22 +69,22 @@ def test_include_rewriting(self): # Mappings to None are unchanged styles = { - "../resources/js-test-style.css": "../../js/resources/js-test-style.css", - "fail.css": None, - "resources/stylesheet.css": None, - "../resources/style.css": None, + '../resources/js-test-style.css': '../../js/resources/js-test-style.css', + 'fail.css': None, + 'resources/stylesheet.css': None, + '../resources/style.css': None, } scripts = { - "../resources/js-test-pre.js": "../../js/resources/js-test-pre.js", - "../resources/js-test-post.js": "../../js/resources/js-test-post.js", - "../resources/desktop-gl-constants.js": "resources/desktop-gl-constants.js", + '../resources/js-test-pre.js': '../../js/resources/js-test-pre.js', + '../resources/js-test-post.js': '../../js/resources/js-test-post.js', + '../resources/desktop-gl-constants.js': 'resources/desktop-gl-constants.js', - "resources/shadow-offset.js": None, - "../resources/js-test-post-async.js": None, + 'resources/shadow-offset.js': None, + '../resources/js-test-post-async.js': None, } - input_text = "" - output_text = "" + input_text = '' + output_text = '' for input, output in styles.items(): input_text += construct_style(input) output_text += construct_style(output if output else input)
diff --git a/third_party/junit/BUILD.gn b/third_party/junit/BUILD.gn index 7859257..e786315 100644 --- a/third_party/junit/BUILD.gn +++ b/third_party/junit/BUILD.gn
@@ -209,4 +209,7 @@ "src/src/main/java/org/junit/validator/TestClassValidator.java", "src/src/main/java/org/junit/validator/ValidateWith.java", ] + + # Work-around for combined android projects not having java.lang.management. + gradle_treat_as_prebuilt = true }
diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh index 6daaf26..17a33ff 100755 --- a/third_party/libvpx/generate_gni.sh +++ b/third_party/libvpx/generate_gni.sh
@@ -271,7 +271,8 @@ # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus # available, which doesn't work from inside a sandbox on linux. - ( echo '/HAVE_UNISTD_H/s/[01]/0/' ; echo 'w' ; echo 'q' ) | ed -s vpx_config.h + sed -i.bak -e 's/\(HAVE_UNISTD_H\s\+\)1/\10/' vpx_config.h + rm vpx_config.h.bak # Use the correct ads2gas script. if [[ "$1" == linux* ]]; then
diff --git a/tools/checklicenses/checklicenses.py b/tools/checklicenses/checklicenses.py index 3d27b0f2..0e28311 100755 --- a/tools/checklicenses/checklicenses.py +++ b/tools/checklicenses/checklicenses.py
@@ -649,6 +649,10 @@ # Don't check sysroot directories 'build/linux/debian_jessie_arm64-sysroot', + 'build/linux/debian_jessie_amd64-sysroot', + 'build/linux/debian_jessie_arm-sysroot', + 'build/linux/debian_jessie_i386-sysroot', + 'build/linux/debian_jessie_mips-sysroot', 'build/linux/debian_wheezy_amd64-sysroot', 'build/linux/debian_wheezy_arm-sysroot', 'build/linux/debian_wheezy_i386-sysroot',
diff --git a/tools/chrome_proxy/webdriver/compression_regression.py b/tools/chrome_proxy/webdriver/compression_regression.py index 9f89a220..6f8cc92a 100644 --- a/tools/chrome_proxy/webdriver/compression_regression.py +++ b/tools/chrome_proxy/webdriver/compression_regression.py
@@ -73,7 +73,7 @@ checking and facilitates the test with all of the helper functions' behavior. """ - compression_average = self.getCurrentCompressionMetrics() + compression_average = self.getCurrentCompressionMetricsWithRetry() self.fetchFromGoogleStorage() data = {} with open(DATA_FILE, 'r') as data_fp: @@ -83,6 +83,27 @@ json.dump(data, data_fp) self.uploadToGoogleStorage() + def getCurrentCompressionMetricsWithRetry(self, max_attempts=10): + """This function allows some number of attempts to be tried to fetch + compressed responses. Sometimes, the proxy will not have compressed results + available immediately, especially for video resources. + + Args: + max_attempts: the maximum number of attempts to try to fetch compressed + resources. + Returns: + a dict object mapping resource type to compression + """ + attempts = 0 + while attempts < max_attempts: + try: + return self.getCurrentCompressionMetrics() + except Exception as e: + attempts += 1 + time.sleep(2) + if attempts >= max_attempts: + raise Exception("Didn't get good response after %d attempts" % attempts) + def getCurrentCompressionMetrics(self): """This function uses the ChromeDriver framework to open Chrome and navigate to a number of static resources of different types, like jpg, png, mp4, gif,
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc index 26fc729..194cace3 100644 --- a/tools/gn/command_gen.cc +++ b/tools/gn/command_gen.cc
@@ -36,6 +36,7 @@ const char kSwitchIdeValueVs[] = "vs"; const char kSwitchIdeValueVs2013[] = "vs2013"; const char kSwitchIdeValueVs2015[] = "vs2015"; +const char kSwitchIdeValueVs2017[] = "vs2017"; const char kSwitchIdeValueXcode[] = "xcode"; const char kSwitchIdeValueJson[] = "json"; const char kSwitchNinjaExtraArgs[] = "ninja-extra-args"; @@ -193,10 +194,13 @@ } return res; } else if (ide == kSwitchIdeValueVs || ide == kSwitchIdeValueVs2013 || - ide == kSwitchIdeValueVs2015) { - VisualStudioWriter::Version version = - ide == kSwitchIdeValueVs2013 ? VisualStudioWriter::Version::Vs2013 - : VisualStudioWriter::Version::Vs2015; + ide == kSwitchIdeValueVs2015 || ide == kSwitchIdeValueVs2017) { + VisualStudioWriter::Version version = VisualStudioWriter::Version::Vs2015; + if (ide == kSwitchIdeValueVs2013) + version = VisualStudioWriter::Version::Vs2013; + else if (ide == kSwitchIdeValueVs2017) + version = VisualStudioWriter::Version::Vs2017; + std::string sln_name; if (command_line->HasSwitch(kSwitchSln)) sln_name = command_line->GetSwitchValueASCII(kSwitchSln); @@ -293,6 +297,7 @@ (default Visual Studio version: 2015) "vs2013" - Visual Studio 2013 project/solution files. "vs2015" - Visual Studio 2015 project/solution files. + "vs2017" - Visual Studio 2017 project/solution files. "xcode" - Xcode workspace/solution files. "qtcreator" - QtCreator project files. "json" - JSON file containing target information
diff --git a/tools/gn/visual_studio_writer.cc b/tools/gn/visual_studio_writer.cc index 6e0b1bd..8a8cf528 100644 --- a/tools/gn/visual_studio_writer.cc +++ b/tools/gn/visual_studio_writer.cc
@@ -71,10 +71,13 @@ const char kToolsetVersionVs2013[] = "v120"; // Visual Studio 2013 const char kToolsetVersionVs2015[] = "v140"; // Visual Studio 2015 +const char kToolsetVersionVs2017[] = "v141"; // Visual Studio 2017 const char kProjectVersionVs2013[] = "12.0"; // Visual Studio 2013 const char kProjectVersionVs2015[] = "14.0"; // Visual Studio 2015 +const char kProjectVersionVs2017[] = "15.0"; // Visual Studio 2015 const char kVersionStringVs2013[] = "Visual Studio 2013"; // Visual Studio 2013 const char kVersionStringVs2015[] = "Visual Studio 2015"; // Visual Studio 2015 +const char kVersionStringVs2017[] = "Visual Studio 2017"; // Visual Studio 2017 const char kWindowsKitsVersion[] = "10"; // Windows 10 SDK const char kWindowsKitsIncludeVersion[] = "10.0.14393.0"; // Windows 10 SDK @@ -273,6 +276,11 @@ toolset_version_ = kToolsetVersionVs2015; version_string_ = kVersionStringVs2015; break; + case Version::Vs2017: + project_version_ = kProjectVersionVs2017; + toolset_version_ = kToolsetVersionVs2017; + version_string_ = kVersionStringVs2017; + break; default: NOTREACHED() << "Not a valid Visual Studio Version: " << version; }
diff --git a/tools/gn/visual_studio_writer.h b/tools/gn/visual_studio_writer.h index 639be09e..17935731 100644 --- a/tools/gn/visual_studio_writer.h +++ b/tools/gn/visual_studio_writer.h
@@ -28,7 +28,8 @@ public: enum Version { Vs2013 = 1, // Visual Studio 2013 - Vs2015 // Visual Studio 2015 + Vs2015, // Visual Studio 2015 + Vs2017 // Visual Studio 2017 }; // Writes Visual Studio project and solution files. |sln_name| is the optional
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 63c1e6a..e48bb9f4 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -1835,7 +1835,7 @@ 'gn_args': ('ozone_auto_platforms=false ozone_platform_wayland=true ' 'ozone_platform_x11=true ozone_platform_gbm=true ' 'enable_package_mash_services=true use_ash=false ' - 'use_jessie_sysroot=true use_xkbcommon=true'), + 'use_xkbcommon=true'), }, 'pdf_xfa': {
diff --git a/tools/perf/benchmarks/system_health_smoke_test.py b/tools/perf/benchmarks/system_health_smoke_test.py index 11fe1e0..5e02ad3 100644 --- a/tools/perf/benchmarks/system_health_smoke_test.py +++ b/tools/perf/benchmarks/system_health_smoke_test.py
@@ -49,6 +49,9 @@ # crbug.com/ 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_health.memory_desktop.browse:news:nytimes', # pylint: disable=line-too-long + # crbug.com/688190 + 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_health.memory_mobile.browse:news:washingtonpost', # pylint: disable=line-too-long + # crbug.com/696824 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_health.memory_desktop.load:news:qq', # pylint: disable=line-too-long
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py index 3cb97768..50f3956d 100644 --- a/tools/perf/page_sets/system_health/browsing_stories.py +++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -214,7 +214,6 @@ SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY -@decorators.Disabled('all') # crbug.com/688190 class WashingtonPostMobileStory(_NewsBrowsingStory): """Progressive website""" NAME = 'browse:news:washingtonpost'
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index 06a95cc..a8a8b236 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -97,6 +97,15 @@ configs += [ "//build/config/linux:glib" ] } } + + if (use_aura) { + sources += [ + "platform/aura_window_properties.cc", + "platform/aura_window_properties.h", + ] + + public_deps += [ "//ui/aura" ] + } } if (is_android) {
diff --git a/ui/accessibility/DEPS b/ui/accessibility/DEPS index 0198e2c..f3b2cb5 100644 --- a/ui/accessibility/DEPS +++ b/ui/accessibility/DEPS
@@ -1,5 +1,7 @@ include_rules = [ "+third_party/iaccessible2", + "+ui/aura", + "+ui/base", "+ui/base/l10n", "+ui/base/win", "+ui/gfx",
diff --git a/ui/accessibility/ax_tree.cc b/ui/accessibility/ax_tree.cc index 2d2a535..c726a4d 100644 --- a/ui/accessibility/ax_tree.cc +++ b/ui/accessibility/ax_tree.cc
@@ -24,6 +24,63 @@ return result; } +template <typename K, typename V> +bool KeyValuePairsKeysMatch(std::vector<std::pair<K, V>> pairs1, + std::vector<std::pair<K, V>> pairs2) { + if (pairs1.size() != pairs2.size()) + return false; + for (size_t i = 0; i < pairs1.size(); ++i) { + if (pairs1[i].first != pairs2[i].first) + return false; + } + return true; +} + +template <typename K, typename V> +std::map<K, V> MapFromKeyValuePairs(std::vector<std::pair<K, V>> pairs) { + std::map<K, V> result; + for (size_t i = 0; i < pairs.size(); ++i) + result[pairs[i].first] = pairs[i].second; + return result; +} + +// Given two vectors of <K, V> key, value pairs representing an "old" vs "new" +// state, or "before" vs "after", calls a callback function for each key that +// changed value. +template <typename K, typename V, typename F> +void CallIfAttributeValuesChanged(const std::vector<std::pair<K, V>>& pairs1, + const std::vector<std::pair<K, V>>& pairs2, + const V& empty_value, + F callback) { + // Fast path - if they both have the same keys in the same order. + if (KeyValuePairsKeysMatch(pairs1, pairs2)) { + for (size_t i = 0; i < pairs1.size(); ++i) { + if (pairs1[i].second != pairs2[i].second) + callback(pairs1[i].first, pairs1[i].second, pairs2[i].second); + } + return; + } + + // Slower path - they don't have the same keys in the same order, so + // check all keys against each other, using maps to prevent this from + // becoming O(n^2) as the size grows. + auto map1 = MapFromKeyValuePairs(pairs1); + auto map2 = MapFromKeyValuePairs(pairs2); + for (size_t i = 0; i < pairs1.size(); ++i) { + const auto& new_iter = map2.find(pairs1[i].first); + if (pairs1[i].second != empty_value && new_iter == map2.end()) + callback(pairs1[i].first, pairs1[i].second, empty_value); + } + + for (size_t i = 0; i < pairs2.size(); ++i) { + const auto& iter = map1.find(pairs2[i].first); + if (iter == map1.end()) + callback(pairs2[i].first, empty_value, pairs2[i].second); + else if (iter->second != pairs2[i].second) + callback(pairs2[i].first, iter->second, pairs2[i].second); + } +} + } // namespace // Intermediate state to keep track of during a tree update. @@ -228,9 +285,8 @@ AXNode* node = GetFromId(src.id); if (node) { update_state->pending_nodes.erase(node); - if (delegate_ && - update_state->new_nodes.find(node) == update_state->new_nodes.end()) - delegate_->OnNodeDataWillChange(this, node->data(), src); + if (update_state->new_nodes.find(node) == update_state->new_nodes.end()) + CallNodeChangeCallbacks(node, src); node->SetData(src); } else { if (!is_new_root) { @@ -291,6 +347,70 @@ return success; } +void AXTree::CallNodeChangeCallbacks(AXNode* node, const AXNodeData& new_data) { + if (!delegate_) + return; + + const AXNodeData& old_data = node->data(); + delegate_->OnNodeDataWillChange(this, old_data, new_data); + + if (old_data.role != new_data.role) + delegate_->OnRoleChanged(this, node, old_data.role, new_data.role); + + if (old_data.state != new_data.state) { + for (int i = AX_STATE_NONE + 1; i <= AX_STATE_LAST; ++i) { + AXState state = static_cast<AXState>(i); + if (old_data.HasStateFlag(state) != new_data.HasStateFlag(state)) { + delegate_->OnStateChanged(this, node, state, + new_data.HasStateFlag(state)); + } + } + } + + auto string_callback = [this, node](AXStringAttribute attr, + const std::string& old_string, + const std::string& new_string) { + delegate_->OnStringAttributeChanged(this, node, attr, old_string, + new_string); + }; + CallIfAttributeValuesChanged(old_data.string_attributes, + new_data.string_attributes, std::string(), + string_callback); + + auto bool_callback = [this, node](AXBoolAttribute attr, const bool& old_bool, + const bool& new_bool) { + delegate_->OnBoolAttributeChanged(this, node, attr, new_bool); + }; + CallIfAttributeValuesChanged(old_data.bool_attributes, + new_data.bool_attributes, false, bool_callback); + + auto float_callback = [this, node](AXFloatAttribute attr, + const float& old_float, + const float& new_float) { + delegate_->OnFloatAttributeChanged(this, node, attr, old_float, new_float); + }; + CallIfAttributeValuesChanged(old_data.float_attributes, + new_data.float_attributes, 0.0f, float_callback); + + auto int_callback = [this, node](AXIntAttribute attr, const int& old_int, + const int& new_int) { + delegate_->OnIntAttributeChanged(this, node, attr, old_int, new_int); + }; + CallIfAttributeValuesChanged(old_data.int_attributes, new_data.int_attributes, + 0, int_callback); + + auto intlist_callback = [this, node]( + AXIntListAttribute attr, + const std::vector<int32_t>& old_intlist, + const std::vector<int32_t>& new_intlist) { + delegate_->OnIntListAttributeChanged(this, node, attr, old_intlist, + new_intlist); + }; + CallIfAttributeValuesChanged(old_data.intlist_attributes, + new_data.intlist_attributes, + std::vector<int32_t>(), intlist_callback); +} + void AXTree::DestroySubtree(AXNode* node, AXTreeUpdateState* update_state) { DCHECK(update_state);
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h index bcc0ce5f..53cd9ea 100644 --- a/ui/accessibility/ax_tree.h +++ b/ui/accessibility/ax_tree.h
@@ -49,6 +49,41 @@ const AXNodeData& old_node_data, const AXNodeData& new_node_data) = 0; + // Individual callbacks for every attribute of AXNodeData that can change. + virtual void OnRoleChanged(AXTree* tree, + AXNode* node, + AXRole old_role, + AXRole new_role) {} + virtual void OnStateChanged(AXTree* tree, + AXNode* node, + AXState state, + bool new_value) {} + virtual void OnStringAttributeChanged(AXTree* tree, + AXNode* node, + AXStringAttribute attr, + const std::string& old_value, + const std::string& new_value) {} + virtual void OnIntAttributeChanged(AXTree* tree, + AXNode* node, + AXIntAttribute attr, + int32_t old_value, + int32_t new_value) {} + virtual void OnFloatAttributeChanged(AXTree* tree, + AXNode* node, + AXFloatAttribute attr, + float old_value, + float new_value) {} + virtual void OnBoolAttributeChanged(AXTree* tree, + AXNode* node, + AXBoolAttribute attr, + bool new_value) {} + virtual void OnIntListAttributeChanged( + AXTree* tree, + AXNode* node, + AXIntListAttribute attr, + const std::vector<int32_t>& old_value, + const std::vector<int32_t>& new_value) {} + // Called when tree data changes. virtual void OnTreeDataChanged(AXTree* tree) = 0; @@ -156,6 +191,8 @@ bool is_new_root, AXTreeUpdateState* update_state); + void CallNodeChangeCallbacks(AXNode* node, const AXNodeData& new_data); + void OnRootChanged(); // Notify the delegate that the subtree rooted at |node| will be destroyed,
diff --git a/ui/accessibility/ax_tree_unittest.cc b/ui/accessibility/ax_tree_unittest.cc index 59ea6303..fdf41f9 100644 --- a/ui/accessibility/ax_tree_unittest.cc +++ b/ui/accessibility/ax_tree_unittest.cc
@@ -10,15 +10,30 @@ #include <memory> #include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/accessibility/ax_node.h" #include "ui/accessibility/ax_serializable_tree.h" #include "ui/accessibility/ax_tree_serializer.h" +using base::DoubleToString; +using base::IntToString; +using base::StringPrintf; + namespace ui { namespace { +std::string IntVectorToString(const std::vector<int>& items) { + std::string str; + for (size_t i = 0; i < items.size(); ++i) { + if (i > 0) + str += ","; + str += IntToString(items[i]); + } + return str; +} + class FakeAXTreeDelegate : public AXTreeDelegate { public: FakeAXTreeDelegate() @@ -81,6 +96,75 @@ } } + void OnRoleChanged(AXTree* tree, + AXNode* node, + AXRole old_role, + AXRole new_role) override { + attribute_change_log_.push_back(StringPrintf("Role changed from %s to %s", + ToString(old_role).c_str(), + ToString(new_role).c_str())); + } + + void OnStateChanged(AXTree* tree, + AXNode* node, + AXState state, + bool new_value) override { + attribute_change_log_.push_back(StringPrintf("%s changed to %s", + ToString(state).c_str(), + new_value ? "true" : "false")); + } + + void OnStringAttributeChanged(AXTree* tree, + AXNode* node, + AXStringAttribute attr, + const std::string& old_value, + const std::string& new_value) override { + attribute_change_log_.push_back( + StringPrintf("%s changed from %s to %s", ToString(attr).c_str(), + old_value.c_str(), new_value.c_str())); + } + + void OnIntAttributeChanged(AXTree* tree, + AXNode* node, + AXIntAttribute attr, + int32_t old_value, + int32_t new_value) override { + attribute_change_log_.push_back(StringPrintf("%s changed from %d to %d", + ToString(attr).c_str(), + old_value, new_value)); + } + + void OnFloatAttributeChanged(AXTree* tree, + AXNode* node, + AXFloatAttribute attr, + float old_value, + float new_value) override { + attribute_change_log_.push_back(StringPrintf( + "%s changed from %s to %s", ToString(attr).c_str(), + DoubleToString(old_value).c_str(), DoubleToString(new_value).c_str())); + } + + void OnBoolAttributeChanged(AXTree* tree, + AXNode* node, + AXBoolAttribute attr, + bool new_value) override { + attribute_change_log_.push_back(StringPrintf("%s changed to %s", + ToString(attr).c_str(), + new_value ? "true" : "false")); + } + + void OnIntListAttributeChanged( + AXTree* tree, + AXNode* node, + AXIntListAttribute attr, + const std::vector<int32_t>& old_value, + const std::vector<int32_t>& new_value) override { + attribute_change_log_.push_back( + StringPrintf("%s changed from %s to %s", ToString(attr).c_str(), + IntVectorToString(old_value).c_str(), + IntVectorToString(new_value).c_str())); + } + bool tree_data_changed() const { return tree_data_changed_; } bool root_changed() const { return root_changed_; } const std::vector<int32_t>& deleted_ids() { return deleted_ids_; } @@ -103,6 +187,9 @@ const std::vector<int32_t>& change_finished_ids() { return change_finished_ids_; } + const std::vector<std::string>& attribute_change_log() { + return attribute_change_log_; + } private: bool tree_data_changed_; @@ -116,6 +203,7 @@ std::vector<int32_t> node_reparented_finished_ids_; std::vector<int32_t> subtree_reparented_finished_ids_; std::vector<int32_t> change_finished_ids_; + std::vector<std::string> attribute_change_log_; }; } // namespace @@ -532,4 +620,177 @@ tree.Unserialize(initial_state); } +TEST(AXTreeTest, RoleAndStateChangeCallbacks) { + AXTreeUpdate initial_state; + initial_state.root_id = 1; + initial_state.nodes.resize(1); + initial_state.nodes[0].id = 1; + initial_state.nodes[0].role = AX_ROLE_BUTTON; + initial_state.nodes[0].state = 0; + initial_state.nodes[0].AddStateFlag(AX_STATE_CHECKED); + initial_state.nodes[0].AddStateFlag(AX_STATE_FOCUSABLE); + AXTree tree(initial_state); + + FakeAXTreeDelegate fake_delegate; + tree.SetDelegate(&fake_delegate); + + // Change the role and state. + AXTreeUpdate update; + update.root_id = 1; + update.nodes.resize(1); + update.nodes[0].id = 1; + update.nodes[0].role = AX_ROLE_CHECK_BOX; + update.nodes[0].state = 0; + update.nodes[0].AddStateFlag(AX_STATE_FOCUSABLE); + update.nodes[0].AddStateFlag(AX_STATE_VISITED); + EXPECT_TRUE(tree.Unserialize(update)); + + const std::vector<std::string>& change_log = + fake_delegate.attribute_change_log(); + ASSERT_EQ(3U, change_log.size()); + EXPECT_EQ("Role changed from button to checkBox", change_log[0]); + EXPECT_EQ("checked changed to false", change_log[1]); + EXPECT_EQ("visited changed to true", change_log[2]); + + tree.SetDelegate(NULL); +} + +TEST(AXTreeTest, AttributeChangeCallbacks) { + AXTreeUpdate initial_state; + initial_state.root_id = 1; + initial_state.nodes.resize(1); + initial_state.nodes[0].id = 1; + initial_state.nodes[0].AddStringAttribute(AX_ATTR_NAME, "N1"); + initial_state.nodes[0].AddStringAttribute(AX_ATTR_DESCRIPTION, "D1"); + initial_state.nodes[0].AddBoolAttribute(AX_ATTR_LIVE_ATOMIC, true); + initial_state.nodes[0].AddBoolAttribute(AX_ATTR_LIVE_BUSY, false); + initial_state.nodes[0].AddFloatAttribute(AX_ATTR_MIN_VALUE_FOR_RANGE, 1.0); + initial_state.nodes[0].AddFloatAttribute(AX_ATTR_MAX_VALUE_FOR_RANGE, 10.0); + initial_state.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X, 5); + initial_state.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X_MIN, 1); + AXTree tree(initial_state); + + FakeAXTreeDelegate fake_delegate; + tree.SetDelegate(&fake_delegate); + + // Change existing attributes. + AXTreeUpdate update0; + update0.root_id = 1; + update0.nodes.resize(1); + update0.nodes[0].id = 1; + update0.nodes[0].AddStringAttribute(AX_ATTR_NAME, "N2"); + update0.nodes[0].AddStringAttribute(AX_ATTR_DESCRIPTION, "D2"); + update0.nodes[0].AddBoolAttribute(AX_ATTR_LIVE_ATOMIC, false); + update0.nodes[0].AddBoolAttribute(AX_ATTR_LIVE_BUSY, true); + update0.nodes[0].AddFloatAttribute(AX_ATTR_MIN_VALUE_FOR_RANGE, 2.0); + update0.nodes[0].AddFloatAttribute(AX_ATTR_MAX_VALUE_FOR_RANGE, 9.0); + update0.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X, 6); + update0.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X_MIN, 2); + EXPECT_TRUE(tree.Unserialize(update0)); + + const std::vector<std::string>& change_log = + fake_delegate.attribute_change_log(); + ASSERT_EQ(8U, change_log.size()); + EXPECT_EQ("name changed from N1 to N2", change_log[0]); + EXPECT_EQ("description changed from D1 to D2", change_log[1]); + EXPECT_EQ("liveAtomic changed to false", change_log[2]); + EXPECT_EQ("liveBusy changed to true", change_log[3]); + EXPECT_EQ("minValueForRange changed from 1 to 2", change_log[4]); + EXPECT_EQ("maxValueForRange changed from 10 to 9", change_log[5]); + EXPECT_EQ("scrollX changed from 5 to 6", change_log[6]); + EXPECT_EQ("scrollXMin changed from 1 to 2", change_log[7]); + + FakeAXTreeDelegate fake_delegate2; + tree.SetDelegate(&fake_delegate2); + + // Add and remove attributes. + AXTreeUpdate update1; + update1.root_id = 1; + update1.nodes.resize(1); + update1.nodes[0].id = 1; + update1.nodes[0].AddStringAttribute(AX_ATTR_DESCRIPTION, "D3"); + update1.nodes[0].AddStringAttribute(AX_ATTR_VALUE, "V3"); + update1.nodes[0].AddBoolAttribute(AX_ATTR_MODAL, true); + update1.nodes[0].AddFloatAttribute(AX_ATTR_VALUE_FOR_RANGE, 5.0); + update1.nodes[0].AddFloatAttribute(AX_ATTR_MAX_VALUE_FOR_RANGE, 9.0); + update1.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X, 7); + update1.nodes[0].AddIntAttribute(AX_ATTR_SCROLL_X_MAX, 10); + EXPECT_TRUE(tree.Unserialize(update1)); + + const std::vector<std::string>& change_log2 = + fake_delegate2.attribute_change_log(); + ASSERT_EQ(10U, change_log2.size()); + EXPECT_EQ("name changed from N2 to ", change_log2[0]); + EXPECT_EQ("description changed from D2 to D3", change_log2[1]); + EXPECT_EQ("value changed from to V3", change_log2[2]); + EXPECT_EQ("liveBusy changed to false", change_log2[3]); + EXPECT_EQ("modal changed to true", change_log2[4]); + EXPECT_EQ("minValueForRange changed from 2 to 0", change_log2[5]); + EXPECT_EQ("valueForRange changed from 0 to 5", change_log2[6]); + EXPECT_EQ("scrollXMin changed from 2 to 0", change_log2[7]); + EXPECT_EQ("scrollX changed from 6 to 7", change_log2[8]); + EXPECT_EQ("scrollXMax changed from 0 to 10", change_log2[9]); + + tree.SetDelegate(NULL); +} + +TEST(AXTreeTest, IntListChangeCallbacks) { + std::vector<int32_t> one; + one.push_back(1); + + std::vector<int32_t> two; + two.push_back(2); + two.push_back(2); + + std::vector<int32_t> three; + three.push_back(3); + + AXTreeUpdate initial_state; + initial_state.root_id = 1; + initial_state.nodes.resize(1); + initial_state.nodes[0].id = 1; + initial_state.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, one); + initial_state.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, two); + AXTree tree(initial_state); + + FakeAXTreeDelegate fake_delegate; + tree.SetDelegate(&fake_delegate); + + // Change existing attributes. + AXTreeUpdate update0; + update0.root_id = 1; + update0.nodes.resize(1); + update0.nodes[0].id = 1; + update0.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, two); + update0.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, three); + EXPECT_TRUE(tree.Unserialize(update0)); + + const std::vector<std::string>& change_log = + fake_delegate.attribute_change_log(); + ASSERT_EQ(2U, change_log.size()); + EXPECT_EQ("controlsIds changed from 1 to 2,2", change_log[0]); + EXPECT_EQ("detailsIds changed from 2,2 to 3", change_log[1]); + + FakeAXTreeDelegate fake_delegate2; + tree.SetDelegate(&fake_delegate2); + + // Add and remove attributes. + AXTreeUpdate update1; + update1.root_id = 1; + update1.nodes.resize(1); + update1.nodes[0].id = 1; + update1.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, two); + update1.nodes[0].AddIntListAttribute(AX_ATTR_FLOWTO_IDS, three); + EXPECT_TRUE(tree.Unserialize(update1)); + + const std::vector<std::string>& change_log2 = + fake_delegate2.attribute_change_log(); + ASSERT_EQ(3U, change_log2.size()); + EXPECT_EQ("controlsIds changed from 2,2 to ", change_log2[0]); + EXPECT_EQ("detailsIds changed from 3 to 2,2", change_log2[1]); + EXPECT_EQ("flowtoIds changed from to 3", change_log2[2]); + + tree.SetDelegate(NULL); +} + } // namespace ui
diff --git a/ui/accessibility/platform/aura_window_properties.cc b/ui/accessibility/platform/aura_window_properties.cc new file mode 100644 index 0000000..146ad75 --- /dev/null +++ b/ui/accessibility/platform/aura_window_properties.cc
@@ -0,0 +1,15 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/accessibility/platform/aura_window_properties.h" + +#include "ui/base/class_property.h" + +namespace ui { + +DEFINE_UI_CLASS_PROPERTY_KEY(AXTreeIDRegistry::AXTreeID, + kChildAXTreeID, + AXTreeIDRegistry::kNoAXTreeID); + +} // namespace ui
diff --git a/ui/accessibility/platform/aura_window_properties.h b/ui/accessibility/platform/aura_window_properties.h new file mode 100644 index 0000000..8c8ea13 --- /dev/null +++ b/ui/accessibility/platform/aura_window_properties.h
@@ -0,0 +1,19 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_ACCESSIBILITY_PLATFORM_AURA_WINDOW_PROPERTIES_H_ +#define UI_ACCESSIBILITY_PLATFORM_AURA_WINDOW_PROPERTIES_H_ + +#include "ui/accessibility/ax_export.h" +#include "ui/accessibility/ax_tree_id_registry.h" +#include "ui/aura/window.h" + +namespace ui { + +AX_EXPORT extern const aura::WindowProperty<AXTreeIDRegistry::AXTreeID>* const + kChildAXTreeID; + +} // namespace ui + +#endif // UI_ACCESSIBILITY_PLATFORM_AURA_WINDOW_PROPERTIES_H_
diff --git a/ui/android/java/src/org/chromium/ui/display/OWNERS b/ui/android/java/src/org/chromium/ui/display/OWNERS index 57a0c64..fa63015 100644 --- a/ui/android/java/src/org/chromium/ui/display/OWNERS +++ b/ui/android/java/src/org/chromium/ui/display/OWNERS
@@ -1 +1,3 @@ boliu@chromium.org + +# COMPONENT: Internals>Core
diff --git a/ui/views/accessibility/ax_window_obj_wrapper.cc b/ui/views/accessibility/ax_window_obj_wrapper.cc index c1059476..d826df3 100644 --- a/ui/views/accessibility/ax_window_obj_wrapper.cc +++ b/ui/views/accessibility/ax_window_obj_wrapper.cc
@@ -8,6 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/accessibility/platform/aura_window_properties.h" #include "ui/aura/window.h" #include "ui/views/accessibility/ax_aura_obj_cache.h" #include "ui/views/widget/widget.h" @@ -54,6 +55,11 @@ base::UTF16ToUTF8(window_->GetTitle())); out_node_data->state = 0; out_node_data->location = gfx::RectF(window_->bounds()); + + ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id = + window_->GetProperty(ui::kChildAXTreeID); + if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID) + out_node_data->AddIntAttribute(ui::AX_ATTR_CHILD_TREE_ID, child_ax_tree_id); } int32_t AXWindowObjWrapper::GetID() {
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index fdfe19b..8414521 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc
@@ -455,7 +455,12 @@ } void Textfield::SetCursorEnabled(bool enabled) { + if (GetRenderText()->cursor_enabled() == enabled) + return; + GetRenderText()->SetCursorEnabled(enabled); + UpdateCursorViewPosition(); + UpdateCursorVisibility(); } const gfx::FontList& Textfield::GetFontList() const { @@ -982,7 +987,7 @@ void Textfield::OnFocus() { GetRenderText()->set_focused(true); if (ShouldShowCursor()) { - UpdateCursorView(); + UpdateCursorViewPosition(); cursor_view_.SetVisible(true); } if (GetInputMethod()) @@ -1910,12 +1915,8 @@ NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); } if (cursor_changed) { - UpdateCursorView(); - cursor_view_.SetVisible(ShouldShowCursor()); - if (ShouldBlinkCursor()) - StartBlinkingCursor(); - else - StopBlinkingCursor(); + UpdateCursorViewPosition(); + UpdateCursorVisibility(); NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true); } if (text_changed || cursor_changed) { @@ -1924,7 +1925,15 @@ } } -void Textfield::UpdateCursorView() { +void Textfield::UpdateCursorVisibility() { + cursor_view_.SetVisible(ShouldShowCursor()); + if (ShouldBlinkCursor()) + StartBlinkingCursor(); + else + StopBlinkingCursor(); +} + +void Textfield::UpdateCursorViewPosition() { gfx::Rect location(GetRenderText()->GetUpdatedCursorBounds()); location.set_x(GetMirroredXForRect(location)); cursor_view_.SetBoundsRect(location); @@ -2089,7 +2098,7 @@ void Textfield::OnCursorBlinkTimerFired() { DCHECK(ShouldBlinkCursor()); cursor_view_.SetVisible(!cursor_view_.visible()); - UpdateCursorView(); + UpdateCursorViewPosition(); } } // namespace views
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h index 4e4fc2e..358a248 100644 --- a/ui/views/controls/textfield/textfield.h +++ b/ui/views/controls/textfield/textfield.h
@@ -370,11 +370,14 @@ // Does necessary updates when the text and/or cursor position changes. void UpdateAfterChange(bool text_changed, bool cursor_changed); + // Updates cursor visibility and blinks the cursor if needed. + void ShowCursor(); + // A callback function to periodically update the cursor node_data. - void UpdateCursor(); + void UpdateCursorVisibility(); // Update the cursor position in the text field. - void UpdateCursorView(); + void UpdateCursorViewPosition(); void PaintTextAndCursor(gfx::Canvas* canvas);
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index 45abeec..71d3ad8 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -252,7 +252,7 @@ result_text_.clear(); } -// A Textfield wrapper to intercept OnKey[Pressed|Released]() ressults. +// A Textfield wrapper to intercept OnKey[Pressed|Released]() results. class TestTextfield : public views::Textfield { public: TestTextfield() @@ -3112,20 +3112,14 @@ EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); } -// Test if the cursor visibility is controlled by |cursor_enabled_| in -// RenderText. +// Verify that cursor visibility is controlled by SetCursorEnabled. TEST_F(TextfieldTest, CursorVisibility) { InitTextfield(); - gfx::RenderText* render_text = test_api_->GetRenderText(); - render_text->SetCursorEnabled(false); - textfield_->OnBlur(); - textfield_->OnFocus(); + textfield_->SetCursorEnabled(false); EXPECT_FALSE(test_api_->IsCursorVisible()); - render_text->SetCursorEnabled(true); - textfield_->OnBlur(); - textfield_->OnFocus(); + textfield_->SetCursorEnabled(true); EXPECT_TRUE(test_api_->IsCursorVisible()); }